@mun-ui/ui 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +114 -2
- package/bin/compile.mjs +38 -0
- package/bin/desktop.mjs +143 -0
- package/bin/dev-protocol.mjs +94 -0
- package/bin/formatter.mjs +109 -0
- package/bin/hot-reload.mjs +38 -0
- package/bin/mun.mjs +538 -0
- package/bin/native.mjs +133 -0
- package/bin/pnpm-workspace.mjs +58 -0
- package/bin/program-patch.mjs +104 -0
- package/bin/project.mjs +322 -0
- package/bin/watch.mjs +316 -0
- package/bin/workflow.mjs +261 -0
- package/dist/astro.d.ts +3 -0
- package/dist/astro.d.ts.map +1 -0
- package/dist/astro.js +3 -0
- package/dist/astro.js.map +1 -0
- package/dist/closures.d.ts +2 -0
- package/dist/closures.d.ts.map +1 -0
- package/dist/closures.js +2 -0
- package/dist/closures.js.map +1 -0
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +2 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +3 -0
- package/dist/core.js.map +1 -0
- package/dist/experimental.d.ts +2 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +2 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +2 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +2 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +2 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/legacy.d.ts +3 -0
- package/dist/legacy.d.ts.map +1 -0
- package/dist/legacy.js +3 -0
- package/dist/legacy.js.map +1 -0
- package/dist/mun.d.ts +5 -0
- package/dist/mun.d.ts.map +1 -0
- package/dist/mun.js +4 -0
- package/dist/mun.js.map +1 -0
- package/dist/progressive-blur/index.d.ts +8 -0
- package/dist/progressive-blur/index.d.ts.map +1 -0
- package/dist/progressive-blur/index.js +8 -0
- package/dist/progressive-blur/index.js.map +1 -0
- package/dist/progressive-blur/plan.d.ts +3 -0
- package/dist/progressive-blur/plan.d.ts.map +1 -0
- package/dist/progressive-blur/plan.js +3 -0
- package/dist/progressive-blur/plan.js.map +1 -0
- package/dist/react-types.d.ts +2 -0
- package/dist/react-types.d.ts.map +1 -0
- package/dist/react-types.js +2 -0
- package/dist/react-types.js.map +1 -0
- package/dist/rendering-quality.d.ts +4 -0
- package/dist/rendering-quality.d.ts.map +1 -0
- package/dist/rendering-quality.js +4 -0
- package/dist/rendering-quality.js.map +1 -0
- package/dist/state.d.ts +2 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +2 -0
- package/dist/state.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +2 -0
- package/dist/vite.js.map +1 -0
- package/editors/install.mjs +102 -0
- package/editors/lsp/mun-lsp.mjs +123 -0
- package/editors/lsp/service.mjs +306 -0
- package/editors/lsp/source.mjs +58 -0
- package/editors/vscode/client.mjs +40 -0
- package/editors/vscode/dev-client.mjs +83 -0
- package/editors/vscode/discovery.mjs +46 -0
- package/editors/vscode/export.mjs +42 -0
- package/editors/vscode/extension.cjs +226 -0
- package/editors/vscode/language-configuration.json +15 -0
- package/editors/vscode/package.json +119 -0
- package/editors/vscode/protocol.mjs +29 -0
- package/editors/vscode/syntaxes/mun.tmLanguage.json +130 -0
- package/native/Cargo.lock +3581 -0
- package/native/Cargo.toml +21 -0
- package/native/README.md +21 -0
- package/native/mun-native/Cargo.toml +23 -0
- package/native/mun-native/src/accessibility.rs +738 -0
- package/native/mun-native/src/dev.rs +604 -0
- package/native/mun-native/src/host_services.rs +202 -0
- package/native/mun-native/src/lib.rs +2843 -0
- package/native/mun-native/src/main.rs +204 -0
- package/native/mun-native/src/offscreen.rs +393 -0
- package/native/mun-native/src/rect.wgsl +63 -0
- package/native/mun-native/src/text.rs +401 -0
- package/native/mun-native/tests/offscreen_rendering.rs +161 -0
- package/native/mun-native/tests/stress.rs +408 -0
- package/native/mun-native/tests/window_lifecycle.rs +183 -0
- package/native/mun-runtime/Cargo.toml +13 -0
- package/native/mun-runtime/src/accessibility.rs +193 -0
- package/native/mun-runtime/src/collection.rs +1090 -0
- package/native/mun-runtime/src/gesture.rs +1070 -0
- package/native/mun-runtime/src/input.rs +325 -0
- package/native/mun-runtime/src/ir.rs +852 -0
- package/native/mun-runtime/src/kinetics.rs +500 -0
- package/native/mun-runtime/src/layout.rs +258 -0
- package/native/mun-runtime/src/layout_cache.rs +209 -0
- package/native/mun-runtime/src/lib.rs +52 -0
- package/native/mun-runtime/src/motion.rs +1162 -0
- package/native/mun-runtime/src/retained.rs +574 -0
- package/native/mun-runtime/src/runtime.rs +7449 -0
- package/native/mun-runtime/src/scene.rs +567 -0
- package/native/mun-runtime/src/scroll.rs +521 -0
- package/native/mun-runtime/src/scroll_view.rs +220 -0
- package/native/mun-runtime/src/text_edit.rs +670 -0
- package/native/mun-runtime/src/timeline.rs +1534 -0
- package/native/mun-runtime/src/validate.rs +677 -0
- package/native/mun-runtime/tests/accessibility_semantics.rs +168 -0
- package/native/mun-runtime/tests/compiler_contract.rs +110 -0
- package/native/mun-runtime/tests/flexible_frames.rs +47 -0
- package/native/mun-runtime/tests/host_services.rs +107 -0
- package/native/mun-runtime/tests/hot_update.rs +367 -0
- package/native/mun-runtime/tests/incremental_runtime.rs +323 -0
- package/native/mun-runtime/tests/ir_validation.rs +167 -0
- package/native/mun-runtime/tests/keyed_collections.rs +251 -0
- package/native/mun-runtime/tests/minimum_window_size.rs +80 -0
- package/native/mun-runtime/tests/native_controls_style.rs +491 -0
- package/native/mun-runtime/tests/native_demo.rs +285 -0
- package/native/mun-runtime/tests/native_layout_style.rs +175 -0
- package/native/mun-runtime/tests/native_settings_pane.rs +152 -0
- package/native/mun-runtime/tests/priority_proposals.rs +69 -0
- package/native/mun-runtime/tests/scroll_view.rs +403 -0
- package/native/mun-runtime/tests/text_editing.rs +491 -0
- package/native/mun-runtime/tests/text_proposals.rs +42 -0
- package/native/mun-runtime/tests/typography.rs +63 -0
- package/package.json +213 -3
- package/schemas/README.md +19 -0
- package/schemas/semantic-ui-ir-v1.schema.json +2061 -0
- package/templates/desktop/gitignore +5 -0
- package/templates/desktop/package.json +10 -0
- package/templates/desktop/src-tauri/Cargo.toml +14 -0
- package/templates/desktop/src-tauri/build.rs +1 -0
- package/templates/desktop/src-tauri/capabilities/main.json +12 -0
- package/templates/desktop/src-tauri/icons/icon.icns +0 -0
- package/templates/desktop/src-tauri/icons/icon.ico +0 -0
- package/templates/desktop/src-tauri/icons/icon.png +0 -0
- package/templates/desktop/src-tauri/src/main.rs +2 -0
- package/templates/desktop/src-tauri/tauri.conf.json +42 -0
- package/templates/desktop/vite.config.ts +10 -0
- package/templates/native/App.mun +15 -0
- package/templates/native/gitignore +3 -0
- package/templates/native/mun.toml +8 -0
- package/templates/project/gitignore +5 -0
- package/templates/project/index.html +13 -0
- package/templates/project/package.json +24 -0
- package/templates/project/src/App.mun +13 -0
- package/templates/project/src/index.css +30 -0
- package/templates/project/src/main.ts +5 -0
- package/templates/project/tsconfig.json +20 -0
- package/templates/project/vite.config.ts +6 -0
- package/templates/vite/src/App.css +134 -0
- package/templates/vite/src/App.tsx +91 -0
- package/templates/vite/src/index.css +23 -0
- package/templates/vite/vite.config.ts +10 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__MUN_PROJECT_NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"mun": {"target": "desktop"},
|
|
7
|
+
"scripts": {"dev": "mun dev", "run": "mun run", "build": "mun build", "package": "mun package", "doctor": "mun doctor"},
|
|
8
|
+
"dependencies": {"@mun-ui/core": "^__MUN_VERSION__", "@mun-ui/web": "^__MUN_VERSION__", "@mun-ui/desktop": "^__MUN_VERSION__"},
|
|
9
|
+
"devDependencies": {"@mun-ui/ui": "^__MUN_VERSION__", "@mun-ui/vite": "^__MUN_VERSION__", "@tauri-apps/cli": "^2.12.0", "typescript": "^5.8.0", "vite": "^8.0.0"}
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "__MUN_PROJECT_CRATE__"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[build-dependencies]
|
|
7
|
+
tauri-build = { version = "2", features = [] }
|
|
8
|
+
|
|
9
|
+
[dependencies]
|
|
10
|
+
tauri = { version = "2.12", features = [] }
|
|
11
|
+
tauri-plugin-mun-desktop = { path = "../node_modules/@mun-ui/desktop/host" }
|
|
12
|
+
|
|
13
|
+
[features]
|
|
14
|
+
custom-protocol = ["tauri/custom-protocol"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fn main() { tauri_build::build() }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../gen/schemas/desktop-schema.json",
|
|
3
|
+
"identifier": "main",
|
|
4
|
+
"description": "Local main window: picker-authorized text documents and window lifecycle only.",
|
|
5
|
+
"windows": ["main"],
|
|
6
|
+
"permissions": [
|
|
7
|
+
"mun-desktop:allow-open-folder", "mun-desktop:allow-open-file",
|
|
8
|
+
"mun-desktop:allow-list-directory", "mun-desktop:allow-read-text", "mun-desktop:allow-write-text",
|
|
9
|
+
"mun-desktop:allow-revoke-location", "mun-desktop:allow-window-info",
|
|
10
|
+
"core:event:allow-listen", "core:event:allow-unlisten", "core:window:allow-close", "core:window:allow-destroy"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schema.tauri.app/config/2",
|
|
3
|
+
"productName": "__MUN_PROJECT_APP_NAME__",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"identifier": "app.mun.__MUN_PROJECT_CRATE__",
|
|
6
|
+
"build": {
|
|
7
|
+
"frontendDist": "../dist",
|
|
8
|
+
"devUrl": "http://127.0.0.1:1420"
|
|
9
|
+
},
|
|
10
|
+
"app": {
|
|
11
|
+
"windows": [
|
|
12
|
+
{
|
|
13
|
+
"label": "main",
|
|
14
|
+
"title": "__MUN_PROJECT_APP_NAME__",
|
|
15
|
+
"create": false,
|
|
16
|
+
"width": 1100,
|
|
17
|
+
"height": 760,
|
|
18
|
+
"minWidth": 640,
|
|
19
|
+
"minHeight": 420
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"security": {
|
|
23
|
+
"capabilities": [
|
|
24
|
+
"main"
|
|
25
|
+
],
|
|
26
|
+
"csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src ipc: http://ipc.localhost; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'",
|
|
27
|
+
"devCsp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self' ipc: http://ipc.localhost ws://127.0.0.1:*; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"bundle": {
|
|
31
|
+
"active": true,
|
|
32
|
+
"targets": "all",
|
|
33
|
+
"icon": [
|
|
34
|
+
"icons/icon.icns",
|
|
35
|
+
"icons/icon.ico",
|
|
36
|
+
"icons/icon.png"
|
|
37
|
+
],
|
|
38
|
+
"macOS": {
|
|
39
|
+
"minimumSystemVersion": "13.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { munPlugin } from '@mun-ui/vite'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [munPlugin()],
|
|
6
|
+
base: './',
|
|
7
|
+
clearScreen: false,
|
|
8
|
+
server: { host: '127.0.0.1', port: 1420, strictPort: true, watch: { ignored: ['**/src-tauri/**'] } },
|
|
9
|
+
build: { target: 'safari16' },
|
|
10
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta name="theme-color" content="#f5f7fb" />
|
|
7
|
+
<title>Mun app</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__MUN_PROJECT_NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@mun-ui/core": "^__MUN_VERSION__",
|
|
13
|
+
"@mun-ui/ui": "^__MUN_VERSION__",
|
|
14
|
+
"@mun-ui/web": "^__MUN_VERSION__"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@mun-ui/vite": "^__MUN_VERSION__",
|
|
18
|
+
"typescript": "^5.8.0",
|
|
19
|
+
"vite": "^8.0.0"
|
|
20
|
+
},
|
|
21
|
+
"mun": {
|
|
22
|
+
"target": "web"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
struct __MUN_PROJECT_APP_NAME__: View {
|
|
2
|
+
@State var count = 0
|
|
3
|
+
|
|
4
|
+
var body: some View {
|
|
5
|
+
VStack(spacing: 12) {
|
|
6
|
+
Text('Hello, Mün')
|
|
7
|
+
Text("Count: \(count)")
|
|
8
|
+
Button('Increase') { count += 1 }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default __MUN_PROJECT_APP_NAME__()
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color: #172033;
|
|
3
|
+
background: #f5f7fb;
|
|
4
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
5
|
+
font-synthesis: none;
|
|
6
|
+
text-rendering: optimizeLegibility;
|
|
7
|
+
-webkit-font-smoothing: antialiased;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
* {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
min-width: 320px;
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* The mount point plays the native window: it proposes the viewport to the
|
|
20
|
+
root View, centers a View that hugs its content, and lets a flexible one
|
|
21
|
+
(`.frame(maxWidth: .infinity, maxHeight: .infinity)`, a ScrollView) fill. */
|
|
22
|
+
#root {
|
|
23
|
+
display: grid;
|
|
24
|
+
place-items: center;
|
|
25
|
+
min-height: 100dvh;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
button {
|
|
29
|
+
font: inherit;
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
+
"allowJs": false,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "Bundler",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"types": ["vite/client"]
|
|
18
|
+
},
|
|
19
|
+
"include": ["src", "vite.config.ts"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.demo-page {
|
|
2
|
+
width: min(100% - 40px, 520px);
|
|
3
|
+
min-height: 100vh;
|
|
4
|
+
margin: 0 auto;
|
|
5
|
+
padding: 52px 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.demo-title {
|
|
9
|
+
color: #20384a;
|
|
10
|
+
font-size: 28px;
|
|
11
|
+
font-weight: 700;
|
|
12
|
+
letter-spacing: -0.04em;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.demo-description {
|
|
16
|
+
color: #718793;
|
|
17
|
+
font-size: 13px;
|
|
18
|
+
line-height: 1.5;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.code-sample {
|
|
22
|
+
width: 100%;
|
|
23
|
+
padding: 12px;
|
|
24
|
+
border-radius: 6px;
|
|
25
|
+
background: #f6f8f9;
|
|
26
|
+
color: #526673;
|
|
27
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
line-height: 1.65;
|
|
30
|
+
white-space: pre;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.field-label {
|
|
34
|
+
color: #627987;
|
|
35
|
+
font-size: 13px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.field-value {
|
|
39
|
+
color: #687d88;
|
|
40
|
+
font-size: 13px;
|
|
41
|
+
font-variant-numeric: tabular-nums;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.demo-input {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 40px;
|
|
47
|
+
padding: 0 12px;
|
|
48
|
+
border: 0;
|
|
49
|
+
border-radius: 8px;
|
|
50
|
+
outline: 0;
|
|
51
|
+
background: #f4f7f8;
|
|
52
|
+
color: #20384a;
|
|
53
|
+
box-shadow: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.demo-input::placeholder {
|
|
57
|
+
color: #9aabb5;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.demo-input:focus {
|
|
61
|
+
background: #eef5f7;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.demo-slider {
|
|
65
|
+
width: 100%;
|
|
66
|
+
accent-color: #8eacba;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.demo-page input[type='checkbox'] {
|
|
70
|
+
width: 18px;
|
|
71
|
+
height: 18px;
|
|
72
|
+
margin: 0;
|
|
73
|
+
accent-color: #8eacba;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.section-label {
|
|
77
|
+
color: #718793;
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.component-list {
|
|
83
|
+
gap: 0;
|
|
84
|
+
padding-top: 4px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.object-row {
|
|
88
|
+
min-height: 44px;
|
|
89
|
+
padding: 8px 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.object-name {
|
|
93
|
+
color: #718793;
|
|
94
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.object-preview {
|
|
99
|
+
color: #405866;
|
|
100
|
+
font-size: 13px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.demo-button {
|
|
104
|
+
min-height: 30px;
|
|
105
|
+
padding: 0 10px;
|
|
106
|
+
border: 0;
|
|
107
|
+
border-radius: 6px;
|
|
108
|
+
background: #eef2f3;
|
|
109
|
+
color: #405866;
|
|
110
|
+
font-size: 12px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.object-progress {
|
|
114
|
+
width: 120px;
|
|
115
|
+
height: 4px;
|
|
116
|
+
accent-color: #8eacba;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.object-progress::-webkit-progress-bar {
|
|
120
|
+
background: #e7edef;
|
|
121
|
+
border-radius: 4px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.object-progress::-webkit-progress-value {
|
|
125
|
+
background: #8eacba;
|
|
126
|
+
border-radius: 4px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@media (max-width: 520px) {
|
|
130
|
+
.demo-page {
|
|
131
|
+
width: min(100% - 28px, 520px);
|
|
132
|
+
padding-top: 32px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
HStack,
|
|
4
|
+
ProgressView,
|
|
5
|
+
Slider,
|
|
6
|
+
Spacer,
|
|
7
|
+
State,
|
|
8
|
+
Text,
|
|
9
|
+
TextField,
|
|
10
|
+
Toggle,
|
|
11
|
+
VStack,
|
|
12
|
+
view,
|
|
13
|
+
} from '@mun-ui/ui/legacy'
|
|
14
|
+
import './App.css'
|
|
15
|
+
|
|
16
|
+
const codeSample = `const App = view({
|
|
17
|
+
state: () => ({
|
|
18
|
+
name: State('Mun'),
|
|
19
|
+
volume: State(60),
|
|
20
|
+
}),
|
|
21
|
+
body: ({ name, volume }) => VStack(
|
|
22
|
+
Text('Hello, ' + name.value),
|
|
23
|
+
Slider(volume),
|
|
24
|
+
),
|
|
25
|
+
})`
|
|
26
|
+
|
|
27
|
+
function ComponentRow(label: string, content: any) {
|
|
28
|
+
return HStack(
|
|
29
|
+
{ spacing: 12 },
|
|
30
|
+
Text(label).className('object-name'),
|
|
31
|
+
Spacer(),
|
|
32
|
+
content,
|
|
33
|
+
).className('object-row')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const App = view({
|
|
37
|
+
state: () => ({
|
|
38
|
+
text: State('Mun'),
|
|
39
|
+
value: State(60),
|
|
40
|
+
checked: State(true),
|
|
41
|
+
}),
|
|
42
|
+
body: ({ text, value, checked }) => VStack(
|
|
43
|
+
{ alignment: 'leading', spacing: 24 },
|
|
44
|
+
Text('DEMO').className('demo-title'),
|
|
45
|
+
Text('Mun is a small SwiftUI-like declarative UI layer for React.')
|
|
46
|
+
.className('demo-description'),
|
|
47
|
+
Text(codeSample).className('code-sample'),
|
|
48
|
+
VStack(
|
|
49
|
+
{ alignment: 'leading', spacing: 10 },
|
|
50
|
+
Text('TextField').className('field-label'),
|
|
51
|
+
TextField(text, {
|
|
52
|
+
placeholder: 'Type here',
|
|
53
|
+
'aria-label': 'Demo text field',
|
|
54
|
+
}).className('demo-input'),
|
|
55
|
+
),
|
|
56
|
+
VStack(
|
|
57
|
+
{ alignment: 'leading', spacing: 10 },
|
|
58
|
+
HStack(
|
|
59
|
+
{ spacing: 12 },
|
|
60
|
+
Text('Slider').className('field-label'),
|
|
61
|
+
Spacer(),
|
|
62
|
+
Text(String(value.value)).className('field-value'),
|
|
63
|
+
),
|
|
64
|
+
Slider(value, {
|
|
65
|
+
min: 0,
|
|
66
|
+
max: 100,
|
|
67
|
+
step: 1,
|
|
68
|
+
'aria-label': 'Demo slider',
|
|
69
|
+
}).className('demo-slider'),
|
|
70
|
+
),
|
|
71
|
+
HStack(
|
|
72
|
+
{ spacing: 12 },
|
|
73
|
+
Text('Checkbox').className('field-label').grow(),
|
|
74
|
+
Toggle(checked, { 'aria-label': 'Demo checkbox' }),
|
|
75
|
+
),
|
|
76
|
+
VStack(
|
|
77
|
+
{ alignment: 'leading', spacing: 10 },
|
|
78
|
+
Text('Components').className('section-label'),
|
|
79
|
+
ComponentRow('Text', Text('Hello, Mun').className('object-preview')),
|
|
80
|
+
ComponentRow('Button', Button('Button', () => {}).className('demo-button')),
|
|
81
|
+
ComponentRow(
|
|
82
|
+
'ProgressView',
|
|
83
|
+
ProgressView(0.7, { max: 1, 'aria-label': 'Demo progress' })
|
|
84
|
+
.className('object-progress'),
|
|
85
|
+
),
|
|
86
|
+
ComponentRow('Toggle', Toggle(checked, { 'aria-label': 'Component toggle' })),
|
|
87
|
+
).className('component-list'),
|
|
88
|
+
).className('demo-page'),
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
export default App
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color: #20384a;
|
|
3
|
+
background: #fff;
|
|
4
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
|
|
5
|
+
font-synthesis: none;
|
|
6
|
+
text-rendering: optimizeLegibility;
|
|
7
|
+
-webkit-font-smoothing: antialiased;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
* {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
min-width: 320px;
|
|
16
|
+
margin: 0;
|
|
17
|
+
background: #fff;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
button,
|
|
21
|
+
input {
|
|
22
|
+
font: inherit;
|
|
23
|
+
}
|