@mun-ui/ui 0.2.0 → 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.
Files changed (33) hide show
  1. package/README.md +11 -1
  2. package/bin/desktop.mjs +143 -0
  3. package/bin/mun.mjs +27 -10
  4. package/native/mun-native/src/host_services.rs +202 -0
  5. package/native/mun-native/src/lib.rs +209 -42
  6. package/native/mun-native/src/text.rs +107 -16
  7. package/native/mun-runtime/src/collection.rs +18 -1
  8. package/native/mun-runtime/src/ir.rs +71 -1
  9. package/native/mun-runtime/src/layout.rs +85 -0
  10. package/native/mun-runtime/src/layout_cache.rs +6 -6
  11. package/native/mun-runtime/src/lib.rs +7 -4
  12. package/native/mun-runtime/src/runtime.rs +388 -17
  13. package/native/mun-runtime/src/scene.rs +37 -0
  14. package/native/mun-runtime/tests/host_services.rs +107 -0
  15. package/native/mun-runtime/tests/minimum_window_size.rs +80 -0
  16. package/native/mun-runtime/tests/priority_proposals.rs +69 -0
  17. package/native/mun-runtime/tests/text_proposals.rs +42 -0
  18. package/native/mun-runtime/tests/typography.rs +63 -0
  19. package/package.json +19 -16
  20. package/schemas/semantic-ui-ir-v1.schema.json +89 -0
  21. package/templates/desktop/gitignore +5 -0
  22. package/templates/desktop/package.json +10 -0
  23. package/templates/desktop/src-tauri/Cargo.toml +14 -0
  24. package/templates/desktop/src-tauri/build.rs +1 -0
  25. package/templates/desktop/src-tauri/capabilities/main.json +12 -0
  26. package/templates/desktop/src-tauri/icons/icon.icns +0 -0
  27. package/templates/desktop/src-tauri/icons/icon.ico +0 -0
  28. package/templates/desktop/src-tauri/icons/icon.png +0 -0
  29. package/templates/desktop/src-tauri/src/main.rs +2 -0
  30. package/templates/desktop/src-tauri/tauri.conf.json +42 -0
  31. package/templates/desktop/vite.config.ts +10 -0
  32. package/templates/project/package.json +3 -0
  33. package/templates/project/src/index.css +9 -0
@@ -0,0 +1,107 @@
1
+ //! Host service actions: the runtime forwards `host` actions to the embedding
2
+ //! host, stores results into state, and reports failures as diagnostics.
3
+
4
+ use mun_runtime::{HostServices, Runtime, RuntimeDiagnostic};
5
+ use serde_json::{Value, json};
6
+ use std::{cell::RefCell, rc::Rc};
7
+
8
+ const PROGRAM: &str = r##"{
9
+ "version": 1, "sourceLanguage": "mun", "entry": "Host",
10
+ "states": [
11
+ { "name": "path", "initial": "~/notes" },
12
+ { "name": "content", "initial": "" }
13
+ ],
14
+ "root": {
15
+ "kind": "window",
16
+ "id": "window",
17
+ "title": "Host",
18
+ "child": {
19
+ "kind": "column",
20
+ "id": "column",
21
+ "children": [
22
+ {
23
+ "kind": "action",
24
+ "id": "read",
25
+ "label": "Read",
26
+ "accessibility": { "role": "button", "label": "Read" },
27
+ "action": {
28
+ "kind": "sequence",
29
+ "actions": [
30
+ { "kind": "host", "service": "files", "operation": "writeText", "arguments": [ { "kind": "state", "state": "path" }, { "kind": "literal", "value": "hello" } ] },
31
+ { "kind": "host", "service": "files", "operation": "readText", "arguments": [ { "kind": "state", "state": "path" } ], "state": "content" }
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "kind": "action",
37
+ "id": "missing",
38
+ "label": "Missing",
39
+ "accessibility": { "role": "button", "label": "Missing" },
40
+ "action": { "kind": "host", "service": "files", "operation": "readText", "arguments": [ { "kind": "literal", "value": "/nowhere" } ], "state": "content" }
41
+ }
42
+ ]
43
+ }
44
+ }
45
+ }"##;
46
+
47
+ #[derive(Default)]
48
+ struct FakeHost {
49
+ calls: Rc<RefCell<Vec<(String, String, Vec<Value>)>>>,
50
+ }
51
+
52
+ impl HostServices for FakeHost {
53
+ fn call(
54
+ &mut self,
55
+ service: &str,
56
+ operation: &str,
57
+ arguments: &[Value],
58
+ ) -> Result<Value, String> {
59
+ self.calls.borrow_mut().push((
60
+ service.to_string(),
61
+ operation.to_string(),
62
+ arguments.to_vec(),
63
+ ));
64
+ match (service, operation) {
65
+ ("files", "writeText") => Ok(Value::Null),
66
+ ("files", "readText") if arguments[0] == json!("~/notes") => Ok(json!("hello")),
67
+ _ => Err("no such file".to_string()),
68
+ }
69
+ }
70
+ }
71
+
72
+ #[test]
73
+ fn host_actions_call_the_host_and_store_results() {
74
+ let mut runtime = Runtime::from_json(PROGRAM).expect("valid program");
75
+ let calls = Rc::new(RefCell::new(Vec::new()));
76
+ runtime.set_host_services(Box::new(FakeHost {
77
+ calls: calls.clone(),
78
+ }));
79
+
80
+ assert!(runtime.activate_action("read").is_some());
81
+ assert_eq!(runtime.state_value("content"), Some(&json!("hello")));
82
+ let calls = calls.borrow();
83
+ assert_eq!(calls.len(), 2);
84
+ assert_eq!(calls[0].1, "writeText");
85
+ assert_eq!(calls[0].2, vec![json!("~/notes"), json!("hello")]);
86
+ assert_eq!(calls[1].1, "readText");
87
+ }
88
+
89
+ #[test]
90
+ fn failed_host_calls_leave_state_and_report_a_diagnostic() {
91
+ let mut runtime = Runtime::from_json(PROGRAM).expect("valid program");
92
+ runtime.set_host_services(Box::new(FakeHost::default()));
93
+ runtime.activate_action("missing");
94
+ assert_eq!(runtime.state_value("content"), Some(&json!("")));
95
+ let diagnostics = runtime.take_diagnostics();
96
+ assert!(matches!(
97
+ diagnostics.as_slice(),
98
+ [RuntimeDiagnostic::HostServiceFailed { service, operation, .. }] if service == "files" && operation == "readText"
99
+ ));
100
+ }
101
+
102
+ #[test]
103
+ fn without_a_host_every_call_is_a_diagnostic() {
104
+ let mut runtime = Runtime::from_json(PROGRAM).expect("valid program");
105
+ runtime.activate_action("read");
106
+ assert_eq!(runtime.take_diagnostics().len(), 2);
107
+ }
@@ -0,0 +1,80 @@
1
+ //! The minimum window size is derived from the layout: authored minimums,
2
+ //! fixed frames, spacing and padding count; flexible space, ScrollView content
3
+ //! and Text width do not.
4
+ use mun_runtime::Runtime;
5
+ use serde_json::json;
6
+
7
+ fn lit(v: f32) -> serde_json::Value {
8
+ json!({"kind": "literal", "value": v})
9
+ }
10
+
11
+ fn runtime(child: serde_json::Value) -> Runtime {
12
+ let program = json!({
13
+ "version": 1, "sourceLanguage": "mun", "entry": "Min", "states": [{"name": "s", "initial": "a long value that is wider than any minimum width in these tests"}],
14
+ "root": {"kind": "window", "id": "w", "title": "Min", "child": child}
15
+ });
16
+ Runtime::from_json(&program.to_string()).unwrap()
17
+ }
18
+
19
+ #[test]
20
+ fn minimum_window_size_sums_mins_fixed_frames_spacing_and_padding() {
21
+ let r = runtime(json!({
22
+ "kind": "column", "id": "col",
23
+ "layout": {"alignment": "leading", "spacing": 10, "padding": 16,
24
+ "maxWidth": "infinity", "maxHeight": "infinity"},
25
+ "children": [
26
+ {"kind": "row", "id": "row", "layout": {"spacing": 8}, "children": [
27
+ // As compiled: padding and frame wrap the (itself flexible) field,
28
+ // whose long content must not hold the row wider than the minWidth.
29
+ {"kind": "overlay", "id": "padded", "layout": {"padding": 6}, "children": [
30
+ {"kind": "overlay", "id": "field", "layout": {"minWidth": 240, "maxWidth": "infinity"}, "children": [
31
+ {"kind": "textField", "id": "input", "state": "s",
32
+ "layout": {"height": lit(36.0), "maxWidth": "infinity"}}
33
+ ]}
34
+ ]},
35
+ {"kind": "action", "id": "go", "label": "Go", "action": {"kind": "toggle-state", "state": "s"},
36
+ "layout": {"width": lit(60.0), "height": lit(36.0)}}
37
+ ]},
38
+ {"kind": "scroll", "id": "list", "axis": "vertical",
39
+ "layout": {"minHeight": 160, "maxHeight": "infinity", "maxWidth": "infinity"},
40
+ "children": [{"kind": "panel", "id": "tall", "layout": {"width": lit(900.0), "height": lit(2000.0)}}]}
41
+ ]
42
+ }));
43
+ // width: padding 16 + field (min 240 + padding 12) + spacing 8 + button 60 + padding 16
44
+ // height: padding 16 + row (36 + padding 12) + spacing 10 + scroll min 160 + padding 16
45
+ assert_eq!(r.minimum_window_size(), (352.0, 250.0));
46
+ // At the minimum nothing is clipped: the field sits at its minWidth, the
47
+ // button ends at the padding and the scroll view keeps its minHeight.
48
+ let tree = r.build_accessibility_tree(352.0, 250.0).unwrap();
49
+ assert_eq!(tree.node("field").unwrap().bounds.width, 240.0);
50
+ let go = tree.node("go").unwrap().bounds;
51
+ assert_eq!(go.x + go.width, 336.0);
52
+ let list = tree.node("list").unwrap().bounds;
53
+ assert_eq!((list.height, list.y + list.height), (160.0, 234.0));
54
+ }
55
+
56
+ #[test]
57
+ fn fully_flexible_content_only_keeps_padding_and_fixed_parts() {
58
+ let r = runtime(json!({
59
+ "kind": "column", "id": "col",
60
+ "layout": {"padding": 12, "maxWidth": "infinity", "maxHeight": "infinity"},
61
+ "children": [
62
+ {"kind": "text", "id": "label", "value": {"kind": "literal", "value": "a long wrapping sentence"}},
63
+ {"kind": "panel", "id": "fill", "layout": {"maxWidth": "infinity", "maxHeight": "infinity"}},
64
+ {"kind": "action", "id": "ok", "label": "OK", "action": {"kind": "toggle-state", "state": "s"},
65
+ "layout": {"width": lit(50.0), "height": lit(20.0)}}
66
+ ]
67
+ }));
68
+ let (width, height) = r.minimum_window_size();
69
+ // Only the fixed button and the padding hold the width; Text gives up
70
+ // width, the flexible panel gives up both axes.
71
+ assert_eq!(width, 74.0);
72
+ let line = r
73
+ .build_accessibility_tree(800.0, 600.0)
74
+ .unwrap()
75
+ .node("label")
76
+ .unwrap()
77
+ .bounds
78
+ .height;
79
+ assert_eq!(height, (24.0 + line + 20.0).ceil());
80
+ }
@@ -0,0 +1,69 @@
1
+ //! Priority-based compression and ideal sizes in unbounded proposals.
2
+ use mun_runtime::{IntrinsicMeasurer, IntrinsicSize, Runtime};
3
+ use serde_json::json;
4
+ struct Measure;
5
+ impl IntrinsicMeasurer for Measure {
6
+ fn measure_text(&self, _: &str) -> IntrinsicSize {
7
+ IntrinsicSize::new(100.0, 20.0)
8
+ }
9
+ fn measure_text_for_width(&self, _: &str, width: Option<f32>) -> IntrinsicSize {
10
+ IntrinsicSize::new(width.unwrap_or(100.0).min(100.0), 20.0)
11
+ }
12
+ fn measure_action(&self, _: &str) -> IntrinsicSize {
13
+ IntrinsicSize::new(50.0, 30.0)
14
+ }
15
+ fn measure_panel(&self) -> IntrinsicSize {
16
+ IntrinsicSize::new(50.0, 40.0)
17
+ }
18
+ }
19
+ fn program(child: serde_json::Value) -> Runtime {
20
+ Runtime::from_json(
21
+ &json!({
22
+ "version": 1, "sourceLanguage": "mun", "entry": "Test", "states": [],
23
+ "root": { "kind": "window", "id": "window", "title": "Test", "child": child }
24
+ })
25
+ .to_string(),
26
+ )
27
+ .unwrap()
28
+ }
29
+ #[test]
30
+ fn higher_priority_children_resist_compression_first() {
31
+ let text = |id: &str, priority: f32| {
32
+ json!({
33
+ "kind": "text", "id": id,
34
+ "value": { "kind": "literal", "value": id },
35
+ "layout": { "layoutPriority": priority }
36
+ })
37
+ };
38
+ let runtime = program(json!({
39
+ "kind": "row", "id": "row", "layout": { "width": { "kind": "literal", "value": 140 } },
40
+ "children": [text("first", 1.0), text("second", 0.0)]
41
+ }));
42
+ let layout = runtime
43
+ .build_frame_with_measurer(300.0, 200.0, &Measure)
44
+ .unwrap();
45
+ let first = layout.accessibility.node("first").unwrap().bounds;
46
+ let second = layout.accessibility.node("second").unwrap().bounds;
47
+ assert!(
48
+ first.width > second.width,
49
+ "higher-priority Text should receive more width: first={first:?}, second={second:?}"
50
+ );
51
+ assert!((first.width + second.width - 140.0).abs() < 0.01);
52
+ }
53
+
54
+ #[test]
55
+ fn ideal_width_is_used_for_scroll_axes_with_no_definite_proposal() {
56
+ let runtime = program(json!({
57
+ "kind": "scroll", "id": "scroller", "axis": "horizontal",
58
+ "layout": { "width": { "kind": "literal", "value": 220 }, "height": { "kind": "literal", "value": 60 } },
59
+ "children": [{
60
+ "kind": "text", "id": "ideal", "layout": { "idealWidth": 160 },
61
+ "value": { "kind": "literal", "value": "x" }
62
+ }]
63
+ }));
64
+ let layout = runtime
65
+ .build_frame_with_measurer(400.0, 200.0, &Measure)
66
+ .unwrap();
67
+ let rect = layout.accessibility.node("ideal").unwrap().bounds;
68
+ assert_eq!(rect.width, 160.0);
69
+ }
@@ -0,0 +1,42 @@
1
+ //! A Text leaf answers a bounded width proposal with its wrapped height.
2
+ use mun_runtime::{IntrinsicMeasurer, IntrinsicSize, Runtime};
3
+ use serde_json::json;
4
+
5
+ struct WrappingMeasurer;
6
+ impl IntrinsicMeasurer for WrappingMeasurer {
7
+ fn measure_text(&self, text: &str) -> IntrinsicSize {
8
+ IntrinsicSize::new(text.len() as f32 * 10.0, 20.0)
9
+ }
10
+
11
+ fn measure_text_for_width(&self, text: &str, width: Option<f32>) -> IntrinsicSize {
12
+ let natural = self.measure_text(text);
13
+ let proposed = width.unwrap_or(natural.width).max(1.0);
14
+ let lines = (natural.width / proposed).ceil().max(1.0);
15
+ IntrinsicSize::new(natural.width.min(proposed), lines * natural.height)
16
+ }
17
+
18
+ fn measure_action(&self, _: &str) -> IntrinsicSize {
19
+ IntrinsicSize::new(50.0, 30.0)
20
+ }
21
+ fn measure_panel(&self) -> IntrinsicSize {
22
+ IntrinsicSize::new(50.0, 40.0)
23
+ }
24
+ }
25
+
26
+ #[test]
27
+ fn text_height_tracks_the_width_proposed_by_a_stack() {
28
+ let value = json!({
29
+ "version": 1, "sourceLanguage": "mun", "entry": "Wrap", "states": [],
30
+ "root": { "kind": "window", "id": "window", "title": "Wrap",
31
+ "child": { "kind": "column", "id": "stack", "layout": { "width": { "kind": "literal", "value": 100 } },
32
+ "children": [{ "kind": "text", "id": "text", "value": { "kind": "literal", "value": "abcdefghijabcdefghij" } }] }
33
+ }
34
+ });
35
+ let runtime = Runtime::from_json(&value.to_string()).unwrap();
36
+ let frame = runtime
37
+ .build_frame_with_measurer(300.0, 220.0, &WrappingMeasurer)
38
+ .unwrap();
39
+ let rect = frame.accessibility.node("text").unwrap().bounds;
40
+ assert_eq!(rect.width, 100.0);
41
+ assert_eq!(rect.height, 40.0);
42
+ }
@@ -0,0 +1,63 @@
1
+ //! `.font`, `.bold`, `.lineLimit` and `.multilineTextAlignment` reach layout
2
+ //! measurement and the retained scene as renderer-neutral typography.
3
+
4
+ use mun_runtime::{Runtime, ir::UiTextAlignment};
5
+
6
+ fn program(font: &str) -> String {
7
+ format!(
8
+ r##"{{"version":1,"sourceLanguage":"mun","entry":"Type","states":[],
9
+ "root":{{"kind":"window","id":"window","title":"Type","child":{{"kind":"column","id":"column","children":[
10
+ {{"kind":"text","id":"plain","value":{{"kind":"literal","value":"Plain"}}}},
11
+ {{"kind":"text","id":"styled","value":{{"kind":"literal","value":"Styled"}},"font":{font}}}
12
+ ]}}}}}}"##
13
+ )
14
+ }
15
+
16
+ #[test]
17
+ fn styled_text_reaches_the_scene_with_its_metrics() {
18
+ let runtime = Runtime::from_json(&program(
19
+ r#"{"size":34,"weight":700,"italic":true,"design":"monospaced","lineLimit":2,"alignment":"center"}"#,
20
+ ))
21
+ .expect("valid program");
22
+ let scene = runtime.build_scene(400.0, 300.0).expect("scene");
23
+ let plain = scene.texts.iter().find(|text| text.id == "plain").unwrap();
24
+ let styled = scene.texts.iter().find(|text| text.id == "styled").unwrap();
25
+ assert_eq!(plain.font_size, 24.0);
26
+ assert_eq!(plain.style, Default::default());
27
+ assert_eq!(styled.font_size, 34.0);
28
+ assert_eq!(styled.style.weight, 700);
29
+ assert!(styled.style.italic);
30
+ assert_eq!(
31
+ styled.style.design,
32
+ mun_runtime::ir::UiFontDesign::Monospaced
33
+ );
34
+ assert_eq!(styled.style.line_limit, Some(2));
35
+ assert_eq!(styled.style.alignment, UiTextAlignment::Center);
36
+ }
37
+
38
+ #[test]
39
+ fn font_size_scales_measured_height() {
40
+ let small = Runtime::from_json(&program(r#"{"size":12}"#)).expect("valid program");
41
+ let large = Runtime::from_json(&program(r#"{"size":48}"#)).expect("valid program");
42
+ let height = |runtime: &Runtime| {
43
+ runtime
44
+ .build_frame(400.0, 300.0)
45
+ .expect("frame")
46
+ .accessibility
47
+ .nodes
48
+ .iter()
49
+ .find(|node| node.id == "styled")
50
+ .map(|node| node.bounds.height)
51
+ .expect("styled text bounds")
52
+ };
53
+ assert!(
54
+ height(&large) > height(&small) * 2.0,
55
+ "48pt text is far taller than 12pt text"
56
+ );
57
+ }
58
+
59
+ #[test]
60
+ fn unknown_typography_fields_are_rejected() {
61
+ assert!(Runtime::from_json(&program(r#"{"size":12,"kerning":2}"#)).is_err());
62
+ assert!(Runtime::from_json(&program(r#"{"weight":1000}"#)).is_err());
63
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mun-ui/ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "SwiftUI-like frontend language, compiler and reactive web runtime.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "dependencies": {
84
- "@mun-ui/animation": "0.2.0",
85
- "@mun-ui/compiler": "0.2.0",
86
- "@mun-ui/astro": "0.2.0",
87
- "@mun-ui/execution": "0.2.0",
88
- "@mun-ui/progressive-blur": "0.2.0",
89
- "@mun-ui/core": "0.2.0",
90
- "@mun-ui/react": "0.2.0",
91
- "@mun-ui/vue": "0.2.0",
92
- "@mun-ui/vite": "0.2.0",
93
- "@mun-ui/web": "0.2.0"
84
+ "@mun-ui/animation": "0.2.1",
85
+ "@mun-ui/astro": "0.2.1",
86
+ "@mun-ui/core": "0.2.1",
87
+ "@mun-ui/react": "0.2.1",
88
+ "@mun-ui/vite": "0.2.1",
89
+ "@mun-ui/compiler": "0.2.1",
90
+ "@mun-ui/vue": "0.2.1",
91
+ "@mun-ui/web": "0.2.1",
92
+ "@mun-ui/progressive-blur": "0.2.1",
93
+ "@mun-ui/execution": "0.2.1"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@lucide/icons": "^1.61.0",
@@ -111,10 +111,10 @@
111
111
  "typescript": "^5.9.3",
112
112
  "vite": "^8.3.5",
113
113
  "vue": "^3.5.44",
114
- "@mun-ui/vite": "0.2.0",
115
- "@mun-ui/react": "0.2.0",
116
- "@mun-ui/vue": "0.2.0",
117
- "@mun-ui/web": "0.2.0"
114
+ "@mun-ui/react": "0.2.1",
115
+ "@mun-ui/vite": "0.2.1",
116
+ "@mun-ui/web": "0.2.1",
117
+ "@mun-ui/vue": "0.2.1"
118
118
  },
119
119
  "engines": {
120
120
  "node": ">=20.19.0"
@@ -208,6 +208,9 @@
208
208
  "check:swiftui-manifest": "pnpm --filter @mun-ui/core --filter @mun-ui/compiler run build && node scripts/check-swiftui-manifest.mjs",
209
209
  "check:swiftui-snapshot": "pnpm --filter @mun-ui/core run build && node scripts/check-swiftui-snapshot.mjs",
210
210
  "snapshot:swiftui": "node scripts/snapshot-swiftui-api.mjs",
211
- "report:swiftui-parity": "node scripts/swiftui-parity-report.mjs"
211
+ "report:swiftui-parity": "node scripts/swiftui-parity-report.mjs",
212
+ "test:desktop": "node --test tests/desktop.test.mjs && cargo test --manifest-path packages/desktop/host/Cargo.toml",
213
+ "test:desktop:host": "node scripts/test-desktop.mjs",
214
+ "test:desktop:parity": "node scripts/test-desktop-parity.mjs"
212
215
  }
213
216
  }
@@ -371,6 +371,10 @@
371
371
  "type": "number",
372
372
  "minimum": 0
373
373
  },
374
+ "idealWidth": {
375
+ "type": "number",
376
+ "minimum": 0
377
+ },
374
378
  "maxWidth": {
375
379
  "oneOf": [
376
380
  {
@@ -386,6 +390,13 @@
386
390
  "type": "number",
387
391
  "minimum": 0
388
392
  },
393
+ "idealHeight": {
394
+ "type": "number",
395
+ "minimum": 0
396
+ },
397
+ "layoutPriority": {
398
+ "type": "number"
399
+ },
389
400
  "maxHeight": {
390
401
  "oneOf": [
391
402
  {
@@ -401,6 +412,43 @@
401
412
  "required": [],
402
413
  "additionalProperties": false
403
414
  },
415
+ "typography": {
416
+ "type": "object",
417
+ "properties": {
418
+ "size": {
419
+ "type": "number",
420
+ "exclusiveMinimum": 0
421
+ },
422
+ "weight": {
423
+ "type": "integer",
424
+ "minimum": 100,
425
+ "maximum": 900
426
+ },
427
+ "italic": {
428
+ "type": "boolean"
429
+ },
430
+ "design": {
431
+ "enum": [
432
+ "default",
433
+ "monospaced",
434
+ "rounded",
435
+ "serif"
436
+ ]
437
+ },
438
+ "lineLimit": {
439
+ "type": "integer",
440
+ "minimum": 1
441
+ },
442
+ "alignment": {
443
+ "enum": [
444
+ "leading",
445
+ "center",
446
+ "trailing"
447
+ ]
448
+ }
449
+ },
450
+ "additionalProperties": false
451
+ },
404
452
  "visual": {
405
453
  "type": "object",
406
454
  "properties": {
@@ -891,6 +939,44 @@
891
939
  "actions"
892
940
  ],
893
941
  "additionalProperties": false
942
+ },
943
+ {
944
+ "type": "object",
945
+ "properties": {
946
+ "kind": {
947
+ "const": "host"
948
+ },
949
+ "service": {
950
+ "enum": [
951
+ "files",
952
+ "workspace"
953
+ ]
954
+ },
955
+ "operation": {
956
+ "type": "string",
957
+ "minLength": 1
958
+ },
959
+ "arguments": {
960
+ "type": "array",
961
+ "items": {
962
+ "$ref": "#/$defs/expression"
963
+ }
964
+ },
965
+ "state": {
966
+ "type": "string",
967
+ "minLength": 1
968
+ },
969
+ "transaction": {
970
+ "$ref": "#/$defs/transaction"
971
+ }
972
+ },
973
+ "required": [
974
+ "kind",
975
+ "service",
976
+ "operation",
977
+ "arguments"
978
+ ],
979
+ "additionalProperties": false
894
980
  }
895
981
  ]
896
982
  },
@@ -1138,6 +1224,9 @@
1138
1224
  "value": {
1139
1225
  "$ref": "#/$defs/expression"
1140
1226
  },
1227
+ "font": {
1228
+ "$ref": "#/$defs/typography"
1229
+ },
1141
1230
  "identityKey": {
1142
1231
  "$ref": "#/$defs/expression"
1143
1232
  },
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist/
3
+ src-tauri/target/
4
+ src-tauri/gen/
5
+ .DS_Store
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
2
+ fn main() { tauri_plugin_mun_desktop::run(tauri::generate_context!()) }
@@ -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
+ })