@mun-ui/ui 0.0.0-stage → 0.2.0

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.
Files changed (158) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +104 -2
  3. package/bin/compile.mjs +38 -0
  4. package/bin/dev-protocol.mjs +94 -0
  5. package/bin/formatter.mjs +109 -0
  6. package/bin/hot-reload.mjs +38 -0
  7. package/bin/mun.mjs +521 -0
  8. package/bin/native.mjs +133 -0
  9. package/bin/pnpm-workspace.mjs +58 -0
  10. package/bin/program-patch.mjs +104 -0
  11. package/bin/project.mjs +322 -0
  12. package/bin/watch.mjs +316 -0
  13. package/bin/workflow.mjs +261 -0
  14. package/dist/astro.d.ts +3 -0
  15. package/dist/astro.d.ts.map +1 -0
  16. package/dist/astro.js +3 -0
  17. package/dist/astro.js.map +1 -0
  18. package/dist/closures.d.ts +2 -0
  19. package/dist/closures.d.ts.map +1 -0
  20. package/dist/closures.js +2 -0
  21. package/dist/closures.js.map +1 -0
  22. package/dist/compiler/index.d.ts +2 -0
  23. package/dist/compiler/index.d.ts.map +1 -0
  24. package/dist/compiler/index.js +2 -0
  25. package/dist/compiler/index.js.map +1 -0
  26. package/dist/core.d.ts +3 -0
  27. package/dist/core.d.ts.map +1 -0
  28. package/dist/core.js +3 -0
  29. package/dist/core.js.map +1 -0
  30. package/dist/experimental.d.ts +2 -0
  31. package/dist/experimental.d.ts.map +1 -0
  32. package/dist/experimental.js +2 -0
  33. package/dist/experimental.js.map +1 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +3 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/jsx-dev-runtime.d.ts +2 -0
  39. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  40. package/dist/jsx-dev-runtime.js +2 -0
  41. package/dist/jsx-dev-runtime.js.map +1 -0
  42. package/dist/jsx-runtime.d.ts +2 -0
  43. package/dist/jsx-runtime.d.ts.map +1 -0
  44. package/dist/jsx-runtime.js +2 -0
  45. package/dist/jsx-runtime.js.map +1 -0
  46. package/dist/legacy.d.ts +3 -0
  47. package/dist/legacy.d.ts.map +1 -0
  48. package/dist/legacy.js +3 -0
  49. package/dist/legacy.js.map +1 -0
  50. package/dist/mun.d.ts +5 -0
  51. package/dist/mun.d.ts.map +1 -0
  52. package/dist/mun.js +4 -0
  53. package/dist/mun.js.map +1 -0
  54. package/dist/progressive-blur/index.d.ts +8 -0
  55. package/dist/progressive-blur/index.d.ts.map +1 -0
  56. package/dist/progressive-blur/index.js +8 -0
  57. package/dist/progressive-blur/index.js.map +1 -0
  58. package/dist/progressive-blur/plan.d.ts +3 -0
  59. package/dist/progressive-blur/plan.d.ts.map +1 -0
  60. package/dist/progressive-blur/plan.js +3 -0
  61. package/dist/progressive-blur/plan.js.map +1 -0
  62. package/dist/react-types.d.ts +2 -0
  63. package/dist/react-types.d.ts.map +1 -0
  64. package/dist/react-types.js +2 -0
  65. package/dist/react-types.js.map +1 -0
  66. package/dist/rendering-quality.d.ts +4 -0
  67. package/dist/rendering-quality.d.ts.map +1 -0
  68. package/dist/rendering-quality.js +4 -0
  69. package/dist/rendering-quality.js.map +1 -0
  70. package/dist/state.d.ts +2 -0
  71. package/dist/state.d.ts.map +1 -0
  72. package/dist/state.js +2 -0
  73. package/dist/state.js.map +1 -0
  74. package/dist/types.d.ts +2 -0
  75. package/dist/types.d.ts.map +1 -0
  76. package/dist/types.js +2 -0
  77. package/dist/types.js.map +1 -0
  78. package/dist/vite.d.ts +2 -0
  79. package/dist/vite.d.ts.map +1 -0
  80. package/dist/vite.js +2 -0
  81. package/dist/vite.js.map +1 -0
  82. package/editors/install.mjs +102 -0
  83. package/editors/lsp/mun-lsp.mjs +123 -0
  84. package/editors/lsp/service.mjs +306 -0
  85. package/editors/lsp/source.mjs +58 -0
  86. package/editors/vscode/client.mjs +40 -0
  87. package/editors/vscode/dev-client.mjs +83 -0
  88. package/editors/vscode/discovery.mjs +46 -0
  89. package/editors/vscode/export.mjs +42 -0
  90. package/editors/vscode/extension.cjs +226 -0
  91. package/editors/vscode/language-configuration.json +15 -0
  92. package/editors/vscode/package.json +119 -0
  93. package/editors/vscode/protocol.mjs +29 -0
  94. package/editors/vscode/syntaxes/mun.tmLanguage.json +130 -0
  95. package/native/Cargo.lock +3581 -0
  96. package/native/Cargo.toml +21 -0
  97. package/native/README.md +21 -0
  98. package/native/mun-native/Cargo.toml +23 -0
  99. package/native/mun-native/src/accessibility.rs +738 -0
  100. package/native/mun-native/src/dev.rs +604 -0
  101. package/native/mun-native/src/lib.rs +2676 -0
  102. package/native/mun-native/src/main.rs +204 -0
  103. package/native/mun-native/src/offscreen.rs +393 -0
  104. package/native/mun-native/src/rect.wgsl +63 -0
  105. package/native/mun-native/src/text.rs +310 -0
  106. package/native/mun-native/tests/offscreen_rendering.rs +161 -0
  107. package/native/mun-native/tests/stress.rs +408 -0
  108. package/native/mun-native/tests/window_lifecycle.rs +183 -0
  109. package/native/mun-runtime/Cargo.toml +13 -0
  110. package/native/mun-runtime/src/accessibility.rs +193 -0
  111. package/native/mun-runtime/src/collection.rs +1073 -0
  112. package/native/mun-runtime/src/gesture.rs +1070 -0
  113. package/native/mun-runtime/src/input.rs +325 -0
  114. package/native/mun-runtime/src/ir.rs +782 -0
  115. package/native/mun-runtime/src/kinetics.rs +500 -0
  116. package/native/mun-runtime/src/layout.rs +173 -0
  117. package/native/mun-runtime/src/layout_cache.rs +209 -0
  118. package/native/mun-runtime/src/lib.rs +49 -0
  119. package/native/mun-runtime/src/motion.rs +1162 -0
  120. package/native/mun-runtime/src/retained.rs +574 -0
  121. package/native/mun-runtime/src/runtime.rs +7078 -0
  122. package/native/mun-runtime/src/scene.rs +530 -0
  123. package/native/mun-runtime/src/scroll.rs +521 -0
  124. package/native/mun-runtime/src/scroll_view.rs +220 -0
  125. package/native/mun-runtime/src/text_edit.rs +670 -0
  126. package/native/mun-runtime/src/timeline.rs +1534 -0
  127. package/native/mun-runtime/src/validate.rs +677 -0
  128. package/native/mun-runtime/tests/accessibility_semantics.rs +168 -0
  129. package/native/mun-runtime/tests/compiler_contract.rs +110 -0
  130. package/native/mun-runtime/tests/flexible_frames.rs +47 -0
  131. package/native/mun-runtime/tests/hot_update.rs +367 -0
  132. package/native/mun-runtime/tests/incremental_runtime.rs +323 -0
  133. package/native/mun-runtime/tests/ir_validation.rs +167 -0
  134. package/native/mun-runtime/tests/keyed_collections.rs +251 -0
  135. package/native/mun-runtime/tests/native_controls_style.rs +491 -0
  136. package/native/mun-runtime/tests/native_demo.rs +285 -0
  137. package/native/mun-runtime/tests/native_layout_style.rs +175 -0
  138. package/native/mun-runtime/tests/native_settings_pane.rs +152 -0
  139. package/native/mun-runtime/tests/scroll_view.rs +403 -0
  140. package/native/mun-runtime/tests/text_editing.rs +491 -0
  141. package/package.json +210 -3
  142. package/schemas/README.md +19 -0
  143. package/schemas/semantic-ui-ir-v1.schema.json +1972 -0
  144. package/templates/native/App.mun +15 -0
  145. package/templates/native/gitignore +3 -0
  146. package/templates/native/mun.toml +8 -0
  147. package/templates/project/gitignore +5 -0
  148. package/templates/project/index.html +13 -0
  149. package/templates/project/package.json +21 -0
  150. package/templates/project/src/App.mun +13 -0
  151. package/templates/project/src/index.css +21 -0
  152. package/templates/project/src/main.ts +5 -0
  153. package/templates/project/tsconfig.json +20 -0
  154. package/templates/project/vite.config.ts +6 -0
  155. package/templates/vite/src/App.css +134 -0
  156. package/templates/vite/src/App.tsx +91 -0
  157. package/templates/vite/src/index.css +23 -0
  158. package/templates/vite/vite.config.ts +10 -0
@@ -0,0 +1,15 @@
1
+ @main
2
+ struct __MUN_PROJECT_APP_NAME__: View {
3
+ @State var count: Int = 0
4
+
5
+ var body: some View {
6
+ VStack(spacing: 12) {
7
+ Text("Hello, Mün")
8
+ Text("Count: \(count)")
9
+ Button("Increase") {
10
+ count += 1
11
+ }
12
+ }
13
+ .padding(24)
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ .mun/
2
+ mun.local.json
3
+ .DS_Store
@@ -0,0 +1,8 @@
1
+ manifest_version = 1
2
+ name = "__MUN_PROJECT_APP_NAME__"
3
+ entry = "Sources/App.mun"
4
+ identifier = "app.mun.__MUN_PROJECT_NAME__"
5
+ version = "1.0.0"
6
+ minimum_mun_version = "__MUN_VERSION__"
7
+ platforms = ["macos", "windows", "linux"]
8
+ resources = ["Assets"]
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ .env
4
+ .env.*
5
+ !.env.example
@@ -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,21 @@
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
+ }
@@ -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,21 @@
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
+ button {
20
+ font: inherit;
21
+ }
@@ -0,0 +1,5 @@
1
+ import { mount } from '@mun-ui/web'
2
+ import App from './App.mun'
3
+ import './index.css'
4
+
5
+ mount(App, document.getElementById('root')!)
@@ -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,6 @@
1
+ import { defineConfig } from 'vite'
2
+ import { munPlugin } from '@mun-ui/vite'
3
+
4
+ export default defineConfig({
5
+ plugins: [munPlugin()],
6
+ })
@@ -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
+ }
@@ -0,0 +1,10 @@
1
+ import react from '@vitejs/plugin-react'
2
+ import { defineConfig } from 'vite'
3
+ import { munMacro } from '@mun-ui/ui/vite'
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ munMacro(),
8
+ react(),
9
+ ],
10
+ })