commit 117a0fc5edb743a2a87cd642eb4f649aaac7fc73 Author: aOK Date: Mon Dec 11 23:23:39 2023 +0300 first commit diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..5ef1c15 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,17 @@ +# Copyright 2019-2022 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" +[target.aarch64-unknown-linux-musl] +linker = "aarch64-linux-musl-gcc" +rustflags = ["-C", "target-feature=-crt-static"] +[target.armv7-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] +[target.i686-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] +[target.aarch64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed768f3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target/ +Cargo.lock \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..3084546 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,24 @@ +[workspace] +resolver = "2" +members = [ + "packages/cli", + # "packages/cli/node". + ] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[profile.small] +inherits = "release" +#debug = true +opt-level = 'z' # Optimize for size +lto = true # Enable link-time optimization +codegen-units = 1 # Reduce number of codegen units to increase optimizations +panic = 'abort' # Abort on panic +strip = true + +[profile.release] +opt-level = "s" +lto = true +codegen-units = 1 +panic = "abort" +strip = true \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..af58465 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +cargo run my-app + +Rapidly scaffold out a new Makepad app project. + +# Usage + +## Cargo: + +```bash +cargo install create-makepad-app +cargo create-makepad-app +``` + +
+ +```bash +# cargo +cargo create-makepad-app my-app --template counter --manager cargo +``` + +Currently supported template presets include: + +- `counter` +- `simple stack navigation` +- `simple login` + +You can use `.` for the project name to scaffold in the current directory. + +## Semver + +**create-makepad-app** is following [Semantic Versioning 2.0](https://semver.org/). + +## Licenses + +Code: (c) 2022. + +MIT or MIT/Apache 2.0 where applicable. diff --git a/packages/cli/Cargo.toml b/packages/cli/Cargo.toml new file mode 100644 index 0000000..fd1b21c --- /dev/null +++ b/packages/cli/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "create-makepad-app" +description = "Rapidly scaffold out a new makepad app project." +version = "0.1.0" +edition = "2021" +license = "Apache-2.0 OR MIT" +readme = "README.md" +repository = "https://gitdab.com/andodeki/create-makepad-app" +keywords = [ "makepad" ] +categories = [ "gui" ] +exclude = [ "/node" ] +rust-version = "1.59" + +[[bin]] +name = "cargo-create-makepad-app" +path = "src/main.rs" + +[dependencies] +anyhow = "1" +dialoguer = "0.10" +pico-args = "0.5" +ctrlc = "3.3" +rust-embed = { version = "8.0", features = [ "compression", "interpolate-folder-path" ] } +makepad-widgets = { version = "0.6.0" } \ No newline at end of file diff --git a/packages/cli/README.md b/packages/cli/README.md new file mode 100644 index 0000000..214e923 --- /dev/null +++ b/packages/cli/README.md @@ -0,0 +1,48 @@ +# Usage + +## Cargo: + +```bash +cargo install create-makepad-app +cargo create-makepad-app +``` + +# Clone this repository Need help cloning? Visit Help. +https://gitdab.com/andodeki/makepad-template.git +# Creating a new repository on the command line +touch README.md +git init +git checkout -b main +git add README.md +git commit -m "first commit" +git remote add origin https://gitdab.com/andodeki/makepad-template.git +git push -u origin main +# Pushing an existing repository from the command line +git remote add origin https://gitdab.com/andodeki/makepad-template.git +git push -u origin main + +# Desktop in Debug Mode +cargo run + +# Desktop in Release Mode +cargo run --release + +# Desktop in small size +cargo run --profile=small + +# Android +cargo makepad android run --release + +# IOS Simulator +cargo makepad apple ios --org=my.test --app=makepad-template run-sim --release + +# IOS Device +cargo makepad apple ios --org-id=123456 --org=my.test --app=makepad-template run-device makepad-template --release + +# Cargo Check Builds +cargo makepad check install-toolchain +cargo makepad check all + +cargo makepad wasm install-toolchain +cargo makepad apple ios install-toolchain +cargo makepad android --abi=all install-toolchain \ No newline at end of file diff --git a/packages/cli/fragments/_assets_/makepad.svg b/packages/cli/fragments/_assets_/makepad.svg new file mode 100644 index 0000000..e7b911e --- /dev/null +++ b/packages/cli/fragments/_assets_/makepad.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/cli/fragments/_assets_/styles.css b/packages/cli/fragments/_assets_/styles.css new file mode 100644 index 0000000..f7de85b --- /dev/null +++ b/packages/cli/fragments/_assets_/styles.css @@ -0,0 +1,109 @@ +:root { + font-family: Inter, Avenir, Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 24px; + font-weight: 400; + + color: #0f0f0f; + background-color: #f6f6f6; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +.container { + margin: 0; + padding-top: 10vh; + display: flex; + flex-direction: column; + justify-content: center; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: 0.75s; +} + +.logo.tauri:hover { + filter: drop-shadow(0 0 2em #24c8db); +} + +.row { + display: flex; + justify-content: center; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} + +a:hover { + color: #535bf2; +} + +h1 { + text-align: center; +} + +input, +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + color: #0f0f0f; + background-color: #ffffff; + transition: border-color 0.25s; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); +} + +button { + cursor: pointer; +} + +button:hover { + border-color: #396cd8; +} +button:active { + border-color: #396cd8; + background-color: #e8e8e8; +} + +input, +button { + outline: none; +} + +#greet-input { + margin-right: 5px; +} + +@media (prefers-color-scheme: dark) { + :root { + color: #f6f6f6; + background-color: #2f2f2f; + } + + a:hover { + color: #24c8db; + } + + input, + button { + color: #ffffff; + background-color: #0f0f0f98; + } + button:active { + background-color: #0f0f0f69; + } +} diff --git a/packages/cli/fragments/fragment-counter/.makepadignore b/packages/cli/fragments/fragment-counter/.makepadignore new file mode 100644 index 0000000..1ebdc6d --- /dev/null +++ b/packages/cli/fragments/fragment-counter/.makepadignore @@ -0,0 +1,3 @@ +/src +/public +/Cargo.toml \ No newline at end of file diff --git a/packages/cli/fragments/fragment-counter/.vscode/extensions.json b/packages/cli/fragments/fragment-counter/.vscode/extensions.json new file mode 100644 index 0000000..24d7cc6 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] +} diff --git a/packages/cli/fragments/fragment-counter/.vscode/settings.json b/packages/cli/fragments/fragment-counter/.vscode/settings.json new file mode 100644 index 0000000..e6d9d21 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "emmet.includeLanguages": { + "rust": "html" + } +} diff --git a/packages/cli/fragments/fragment-counter/Cargo.toml.lts b/packages/cli/fragments/fragment-counter/Cargo.toml.lts new file mode 100644 index 0000000..90950a5 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/Cargo.toml.lts @@ -0,0 +1,25 @@ +[package] +name = "{% package_name %}" +version = "0.0.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[profile.small] +inherits = "release" +#debug = true +opt-level = 'z' # Optimize for size +lto = true # Enable link-time optimization +codegen-units = 1 # Reduce number of codegen units to increase optimizations +panic = 'abort' # Abort on panic +strip = true + +[profile.release] +opt-level = "s" +lto = true +codegen-units = 1 +panic = "abort" +strip = true + +[dependencies] +makepad-widgets = { version = "0.6.0" } diff --git a/packages/cli/fragments/fragment-counter/README.md b/packages/cli/fragments/fragment-counter/README.md new file mode 100644 index 0000000..b85f4b2 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/README.md @@ -0,0 +1,34 @@ +# Makepad UI + +This template should help get you started developing with Makepad Rust UI. + +## Recommended IDE Setup + +[VS Code](https://code.visualstudio.com/) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). + + +# Desktop in Debug Mode +cargo run + +# Desktop in Release Mode +cargo run --release + +# Desktop in small size +cargo run --profile=small + +# Android +cargo makepad android run --release + +# IOS Simulator +cargo makepad apple ios --org=my.test --app=makepad-template run-sim --release + +# IOS Device +cargo makepad apple ios --org-id=123456 --org=my.test --app=makepad-template run-device makepad-template --release + +# Cargo Check Builds +cargo makepad check install-toolchain +cargo makepad check all + +cargo makepad wasm install-toolchain +cargo makepad apple ios install-toolchain +cargo makepad android --abi=all install-toolchain \ No newline at end of file diff --git a/packages/cli/fragments/fragment-counter/Trunk.toml.lts b/packages/cli/fragments/fragment-counter/Trunk.toml.lts new file mode 100644 index 0000000..991f338 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/Trunk.toml.lts @@ -0,0 +1,11 @@ +[build] +target = "./index.html" + +[watch] +ignore = ["./src-tauri"] + +[serve] +address = "{% if mobile %}0.0.0.0{% else %}127.0.0.1{% endif %}" +port = 1420 +open = false{% if mobile %} +ws_protocol = "ws"{% endif %} diff --git a/packages/cli/fragments/fragment-counter/_cta_manifest_ b/packages/cli/fragments/fragment-counter/_cta_manifest_ new file mode 100644 index 0000000..d8ee4b8 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/_cta_manifest_ @@ -0,0 +1,13 @@ +# Copyright 2019-2022 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +beforeDevCommand = trunk serve +beforeBuildCommand = trunk build +devPath = http://localhost:1420 +distDir = ../dist +withGlobalTauri = true + +[files] +makepad.svg = resources/makepad.svg +styles.css = styles.css diff --git a/packages/cli/fragments/fragment-counter/_gitignore b/packages/cli/fragments/fragment-counter/_gitignore new file mode 100644 index 0000000..48c3ca4 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/_gitignore @@ -0,0 +1,3 @@ +/dist/ +/target/ +/Cargo.lock diff --git a/packages/cli/fragments/fragment-counter/index.html.lts b/packages/cli/fragments/fragment-counter/index.html.lts new file mode 100644 index 0000000..c458263 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/index.html.lts @@ -0,0 +1,34 @@ + + + + + + Makepad Template + + + + + + +
+
+ Loading.. +
+
+ + diff --git a/packages/cli/fragments/fragment-counter/resources/makepad.svg b/packages/cli/fragments/fragment-counter/resources/makepad.svg new file mode 100644 index 0000000..e7b911e --- /dev/null +++ b/packages/cli/fragments/fragment-counter/resources/makepad.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/cli/fragments/fragment-counter/src/app.rs b/packages/cli/fragments/fragment-counter/src/app.rs new file mode 100644 index 0000000..33f73f2 --- /dev/null +++ b/packages/cli/fragments/fragment-counter/src/app.rs @@ -0,0 +1,91 @@ +use makepad_widgets::*; + +live_design!{ + import makepad_widgets::base::*; + import makepad_widgets::theme_desktop_dark::*; + + import crate::shared::styles::*; + + LOGO_MAKEPAD = dep("crate://self/resources/makepad.svg") + + + App = {{App}} { + + ui: { + show_bg: true + width: Fill, + height: Fill + + draw_bg: { + fn pixel(self) -> vec4 { + //return #000 + return mix(#7, #3, self.pos.y); + } + } + + body = { + + flow: Down, + spacing: 20, + align: { + x: 0.5, + y: 0.5 + }, + avatar = { + source: (LOGO_MAKEPAD), + width: 50., height: 50. + } + button1 =