@native-sdk/cli 0.9.4 → 0.10.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.
- package/README.md +3 -3
- package/build/app.zig +75 -57
- package/build/ts_run.mjs +1 -1
- package/build.zig +20 -2
- package/package.json +11 -10
- package/packages/core/package-lock.json +12 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_command.mjs +1 -1
- package/packages/core/scripts/run_external_core_compiler.mjs +19 -9
- package/packages/core/scripts/run_external_service_compiler.mjs +17 -8
- package/packages/core/scripts/vendor_service_packages.mjs +121 -8
- package/packages/core/sdk/events.d.ts +33 -4
- package/packages/core/sdk/events.ts +45 -6
- package/packages/core/src/checker.ts +103 -8
- package/packages/core/src/modules.ts +6 -2
- package/packages/core/src/sqlite_cli.ts +22 -2
- package/packages/core/src/typed_ast.ts +4 -2
- package/packages/core/src/types.ts +8 -8
- package/schemas/app.schema.json +446 -0
- package/skill-data/core/SKILL.md +53 -15
- package/skill-data/core/references/project-anatomy.md +6 -6
- package/skill-data/native-ui/SKILL.md +26 -5
- package/skill-data/ts-core/SKILL.md +6 -6
- package/skill-data/ts-services/references/service-surface.md +1 -1
- package/skills/native-sdk/SKILL.md +2 -2
- package/src/app_runner/root.zig +25 -0
- package/src/automation/snapshot.zig +91 -3
- package/src/platform/macos/appkit_host.h +66 -2
- package/src/platform/macos/appkit_host.m +735 -24
- package/src/platform/macos/cef_host.mm +208 -9
- package/src/platform/macos/root.zig +205 -3
- package/src/platform/null_platform.zig +50 -1
- package/src/platform/null_platform_tests.zig +53 -0
- package/src/platform/root.zig +12 -0
- package/src/platform/types.zig +73 -0
- package/src/platform/windows/root.zig +88 -15
- package/src/primitives/app_manifest/tests.zig +19 -0
- package/src/primitives/app_manifest/validation.zig +14 -2
- package/src/primitives/canvas/font_ttf.zig +24 -0
- package/src/primitives/canvas/gpu.zig +5 -0
- package/src/primitives/canvas/reference.zig +41 -16
- package/src/primitives/canvas/reference_tests.zig +63 -0
- package/src/primitives/canvas/render_tests.zig +1 -1
- package/src/primitives/canvas/root.zig +1 -0
- package/src/primitives/canvas/serialization.zig +1 -0
- package/src/primitives/canvas/test_support.zig +1 -0
- package/src/primitives/canvas/text.zig +1 -0
- package/src/primitives/canvas/text_layout.zig +84 -15
- package/src/primitives/canvas/text_layout_hash.zig +3 -1
- package/src/primitives/canvas/text_layout_types.zig +3 -0
- package/src/primitives/canvas/text_metrics.zig +28 -1
- package/src/primitives/canvas/text_tests.zig +61 -6
- package/src/primitives/canvas/ui.zig +9 -0
- package/src/primitives/canvas/ui_markup.zig +29 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +32 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +4 -2
- package/src/primitives/canvas/ui_markup_contract.zig +7 -0
- package/src/primitives/canvas/ui_markup_contract_tests.zig +21 -0
- package/src/primitives/canvas/ui_markup_tests.zig +6 -0
- package/src/primitives/canvas/ui_markup_view.zig +28 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +32 -3
- package/src/primitives/canvas/ui_schema.zig +9 -0
- package/src/primitives/canvas/ui_schema_tests.zig +5 -3
- package/src/primitives/canvas/ui_tests.zig +4 -2
- package/src/primitives/canvas/widget_render.zig +13 -2
- package/src/primitives/canvas/widget_render_controls.zig +1 -0
- package/src/primitives/canvas/widget_semantics_tests.zig +3 -1
- package/src/root.zig +6 -0
- package/src/runtime/automation_snapshot.zig +3 -0
- package/src/runtime/canvas_fonts.zig +87 -0
- package/src/runtime/core.zig +1 -0
- package/src/runtime/flow.zig +8 -1
- package/src/runtime/native_command_event_tests.zig +58 -0
- package/src/runtime/state.zig +14 -0
- package/src/runtime/system_services.zig +62 -0
- package/src/runtime/ts_ui_app.zig +161 -33
- package/src/runtime/ui_app.zig +33 -1
- package/src/runtime/ui_app_tests.zig +63 -0
- package/src/runtime/validation.zig +87 -1
- package/src/tooling/android.zig +5 -4
- package/src/tooling/buildgraph.zig +24 -8
- package/src/tooling/db.zig +1 -1
- package/src/tooling/doctor.zig +1 -1
- package/src/tooling/ios.zig +5 -4
- package/src/tooling/json_to_zon.zig +136 -0
- package/src/tooling/manifest.zig +199 -35
- package/src/tooling/package.zig +33 -0
- package/src/tooling/raw_manifest.zig +11 -0
- package/src/tooling/root.zig +2 -0
- package/src/tooling/templates.zig +210 -116
- package/src/tooling/ts_core.zig +11 -7
- package/src/tooling/update.zig +576 -0
- package/src/tooling/verbs.zig +7 -6
- package/src/tooling/web_engine.zig +17 -1
- package/src/updater/c_api.zig +123 -0
- package/src/updater/feed.zig +215 -0
- package/src/updater/root.zig +10 -0
|
@@ -1820,6 +1820,7 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1820
1820
|
// ---------------------------------------------------- attributes
|
|
1821
1821
|
|
|
1822
1822
|
fn applyAttrs(comptime node: markup.MarkupNode, comptime entries: []const ScopeEntry, ui: *Ui, model: *const ModelT, scope: anytype, options: *Ui.ElementOptions) void {
|
|
1823
|
+
applyImageSourceAttrs(node, entries, ui, model, scope, options);
|
|
1823
1824
|
inline for (0..node.attrs.len) |attr_index| {
|
|
1824
1825
|
const attribute = comptime node.attrs[attr_index];
|
|
1825
1826
|
if (comptime std.mem.eql(u8, attribute.name, "kind")) {
|
|
@@ -1840,6 +1841,8 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1840
1841
|
};
|
|
1841
1842
|
} else if (comptime std.mem.eql(u8, attribute.name, "image")) {
|
|
1842
1843
|
applyImageAttr(node, attribute.value, entries, ui, model, scope, options);
|
|
1844
|
+
} else if (comptime markup.imageSourceAttrName(attribute.name)) {
|
|
1845
|
+
// Consumed atomically by applyImageSourceAttrs above.
|
|
1843
1846
|
} else if (comptime std.mem.eql(u8, attribute.name, "surface")) {
|
|
1844
1847
|
applySurfaceAttr(node, attribute.value, entries, ui, model, scope, options);
|
|
1845
1848
|
} else if (comptime std.mem.eql(u8, attribute.name, "pty")) {
|
|
@@ -1943,6 +1946,35 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1943
1946
|
};
|
|
1944
1947
|
}
|
|
1945
1948
|
|
|
1949
|
+
/// Comptime mirror of the interpreter's atomic source-rectangle
|
|
1950
|
+
/// construction. Source-known shape mistakes are compile errors;
|
|
1951
|
+
/// bound numeric values evaluate through the shared expression
|
|
1952
|
+
/// path at runtime.
|
|
1953
|
+
fn applyImageSourceAttrs(comptime node: markup.MarkupNode, comptime entries: []const ScopeEntry, ui: *Ui, model: *const ModelT, scope: anytype, options: *Ui.ElementOptions) void {
|
|
1954
|
+
const has_any = comptime blk: {
|
|
1955
|
+
for (markup.image_source_attr_names) |name| {
|
|
1956
|
+
if (node.attr(name) != null) break :blk true;
|
|
1957
|
+
}
|
|
1958
|
+
break :blk false;
|
|
1959
|
+
};
|
|
1960
|
+
if (comptime !has_any) return;
|
|
1961
|
+
comptime {
|
|
1962
|
+
if (!std.mem.eql(u8, node.name, "avatar") and !std.mem.eql(u8, node.name, "image")) {
|
|
1963
|
+
fail(node, markup.image_source_element_message);
|
|
1964
|
+
}
|
|
1965
|
+
if (node.attr("image") == null) fail(node, markup.image_source_binding_message);
|
|
1966
|
+
for (markup.image_source_attr_names) |name| {
|
|
1967
|
+
if (node.attr(name) == null) fail(node, markup.image_source_complete_message);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
options.image_src = .{
|
|
1971
|
+
.x = floatAttr(node, entries, comptime node.attr("source-x").?, ui, model, scope),
|
|
1972
|
+
.y = floatAttr(node, entries, comptime node.attr("source-y").?, ui, model, scope),
|
|
1973
|
+
.width = floatAttr(node, entries, comptime node.attr("source-width").?, ui, model, scope),
|
|
1974
|
+
.height = floatAttr(node, entries, comptime node.attr("source-height").?, ui, model, scope),
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1946
1978
|
/// Comptime mirror of the interpreter's `applySurfaceAttr`:
|
|
1947
1979
|
/// `surface="{binding}"` on media-surface resolves to the
|
|
1948
1980
|
/// model-owned u64 surface id a producer targets —
|
|
@@ -1406,12 +1406,14 @@ test "compiled image leaf binding matches the interpreter and the hand-written v
|
|
|
1406
1406
|
try expectSameTree(fixture.ImageLeafMsg, hand, interpreted);
|
|
1407
1407
|
try expectSameTree(fixture.ImageLeafMsg, hand, compiled);
|
|
1408
1408
|
|
|
1409
|
-
// The field binding and
|
|
1410
|
-
//
|
|
1409
|
+
// The field binding, source-coordinate bindings, and id fn all
|
|
1410
|
+
// resolve through comptime-unrolled access.
|
|
1411
1411
|
const cover = compiled.root.children[0];
|
|
1412
1412
|
try testing.expectEqual(canvas.WidgetKind.image, cover.kind);
|
|
1413
1413
|
try testing.expectEqual(@as(canvas.ImageId, 42), cover.image_id);
|
|
1414
|
+
try testing.expectEqualDeep(@as(?geometry.RectF, geometry.RectF.init(4, 8, 32, 24)), cover.image_src);
|
|
1414
1415
|
try testing.expectEqual(@as(canvas.ImageId, 43), compiled.root.children[1].image_id);
|
|
1416
|
+
try testing.expectEqual(@as(?geometry.RectF, null), compiled.root.children[1].image_src);
|
|
1415
1417
|
|
|
1416
1418
|
// 0 draws nothing in both engines — the not-loaded-yet state.
|
|
1417
1419
|
const empty_model = fixture.ImageLeafModel{};
|
|
@@ -1248,6 +1248,13 @@ const Checker = struct {
|
|
|
1248
1248
|
try self.requireAttrKind(node, attribute, resolved.kind, &.{.integer}, markup.image_binding_message);
|
|
1249
1249
|
continue;
|
|
1250
1250
|
}
|
|
1251
|
+
if (markup.imageSourceAttrName(attribute.name)) {
|
|
1252
|
+
// Structural validation owns the atomic/scoped rectangle
|
|
1253
|
+
// rules; the model-aware pass verifies every coordinate
|
|
1254
|
+
// binding is numeric and marks it used.
|
|
1255
|
+
try self.checkClassAttr(node, attribute, .number);
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1251
1258
|
if (std.mem.eql(u8, attribute.name, "surface")) {
|
|
1252
1259
|
// Media-surface ids are model integers (engine parity —
|
|
1253
1260
|
// the runtime-image-id shape exactly).
|
|
@@ -795,6 +795,27 @@ test "the image leaf's image binding checks as a model integer" {
|
|
|
795
795
|
try testing.expectEqualStrings(markup.image_binding_message, message);
|
|
796
796
|
}
|
|
797
797
|
|
|
798
|
+
test "registered-image source rectangle bindings check as numbers" {
|
|
799
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
800
|
+
defer arena_state.deinit();
|
|
801
|
+
const arena = arena_state.allocator();
|
|
802
|
+
|
|
803
|
+
const good = try parseFixture(arena,
|
|
804
|
+
\\<column>
|
|
805
|
+
\\ <image image="{count}" source-x="{ratio}" source-y="{count}" source-width="32" source-height="16" label="Atlas tile" />
|
|
806
|
+
\\</column>
|
|
807
|
+
);
|
|
808
|
+
try testing.expectEqual(null, try contractMessage(arena, good, null));
|
|
809
|
+
|
|
810
|
+
const wrong = try parseFixture(arena,
|
|
811
|
+
\\<column>
|
|
812
|
+
\\ <image image="{count}" source-x="{name}" source-y="0" source-width="32" source-height="16" label="Atlas tile" />
|
|
813
|
+
\\</column>
|
|
814
|
+
);
|
|
815
|
+
const message = (try contractMessage(arena, wrong, null)).?;
|
|
816
|
+
try testing.expect(std.mem.startsWith(u8, message, "expected a number"));
|
|
817
|
+
}
|
|
818
|
+
|
|
798
819
|
test "app: icon references check against the contract's registered icon list" {
|
|
799
820
|
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
800
821
|
defer arena_state.deinit();
|
|
@@ -696,6 +696,7 @@ test "the image attribute validates as one binding on avatar and image" {
|
|
|
696
696
|
const valid = [_][]const u8{
|
|
697
697
|
"<row>\n <avatar image=\"{user_image}\">CT</avatar>\n</row>",
|
|
698
698
|
"<row>\n <image image=\"{cover}\" width=\"120\" height=\"80\" label=\"Cover art\" />\n</row>",
|
|
699
|
+
"<row>\n <image image=\"{atlas}\" source-x=\"0\" source-y=\"32\" source-width=\"16\" source-height=\"16\" label=\"Atlas tile\" />\n</row>",
|
|
699
700
|
};
|
|
700
701
|
for (valid) |source| {
|
|
701
702
|
var parser = markup.Parser.init(arena, source);
|
|
@@ -711,6 +712,11 @@ test "the image attribute validates as one binding on avatar and image" {
|
|
|
711
712
|
// attribute would be silently inert.
|
|
712
713
|
.{ .source = "<row>\n <badge image=\"{user_image}\">3</badge>\n</row>", .message = markup.image_binding_element_message },
|
|
713
714
|
.{ .source = "<column>\n <panel image=\"{user_image}\" />\n</column>", .message = markup.image_binding_element_message },
|
|
715
|
+
// Source rectangles are image/avatar-only, require an image, and
|
|
716
|
+
// are atomic so a missing coordinate never defaults silently.
|
|
717
|
+
.{ .source = "<row>\n <badge source-x=\"0\" source-y=\"0\" source-width=\"16\" source-height=\"16\">3</badge>\n</row>", .message = markup.image_source_element_message },
|
|
718
|
+
.{ .source = "<row>\n <avatar source-x=\"0\" source-y=\"0\" source-width=\"16\" source-height=\"16\">CT</avatar>\n</row>", .message = markup.image_source_binding_message },
|
|
719
|
+
.{ .source = "<row>\n <image image=\"{atlas}\" source-x=\"0\" source-y=\"0\" source-width=\"16\" label=\"Tile\" />\n</row>", .message = markup.image_source_complete_message },
|
|
714
720
|
// ...and required on the leaf: an unbound image is statically
|
|
715
721
|
// dead markup (avatar keeps its initials fallback instead).
|
|
716
722
|
.{ .source = "<row>\n <image label=\"Art\" />\n</row>", .message = markup.image_missing_image_message },
|
|
@@ -1714,6 +1714,7 @@ pub fn MarkupView(comptime ModelT: type, comptime MsgT: type) type {
|
|
|
1714
1714
|
// ---------------------------------------------------- attributes
|
|
1715
1715
|
|
|
1716
1716
|
fn applyAttrs(self: *Self, scope: *Scope, node: markup.MarkupNode, options: *Ui.ElementOptions) BuildError!void {
|
|
1717
|
+
try self.applyImageSourceAttrs(scope, node, options);
|
|
1717
1718
|
for (node.attrs) |attribute| {
|
|
1718
1719
|
if (std.mem.eql(u8, attribute.name, "kind")) continue;
|
|
1719
1720
|
if (std.mem.startsWith(u8, attribute.name, "on-")) {
|
|
@@ -1751,6 +1752,7 @@ pub fn MarkupView(comptime ModelT: type, comptime MsgT: type) type {
|
|
|
1751
1752
|
try self.applyImageAttr(scope, node, options, attribute);
|
|
1752
1753
|
continue;
|
|
1753
1754
|
}
|
|
1755
|
+
if (markup.imageSourceAttrName(attribute.name)) continue;
|
|
1754
1756
|
if (std.mem.eql(u8, attribute.name, "surface")) {
|
|
1755
1757
|
try self.applySurfaceAttr(scope, node, options, attribute);
|
|
1756
1758
|
continue;
|
|
@@ -1868,6 +1870,32 @@ pub fn MarkupView(comptime ModelT: type, comptime MsgT: type) type {
|
|
|
1868
1870
|
};
|
|
1869
1871
|
}
|
|
1870
1872
|
|
|
1873
|
+
/// The four `source-*` attributes form one optional source
|
|
1874
|
+
/// rectangle in decoded-image pixel coordinates. Build it before
|
|
1875
|
+
/// the scalar attribute walk so declaration order carries no
|
|
1876
|
+
/// meaning; repeat the validator's shape checks for hot-reloaded
|
|
1877
|
+
/// documents that reached the interpreter without validation.
|
|
1878
|
+
fn applyImageSourceAttrs(self: *Self, scope: *Scope, node: markup.MarkupNode, options: *Ui.ElementOptions) BuildError!void {
|
|
1879
|
+
var any = false;
|
|
1880
|
+
for (markup.image_source_attr_names) |name| {
|
|
1881
|
+
if (node.attr(name) != null) any = true;
|
|
1882
|
+
}
|
|
1883
|
+
if (!any) return;
|
|
1884
|
+
if (!std.mem.eql(u8, node.name, "avatar") and !std.mem.eql(u8, node.name, "image")) {
|
|
1885
|
+
return self.failVoid(node, markup.image_source_element_message);
|
|
1886
|
+
}
|
|
1887
|
+
if (node.attr("image") == null) return self.failVoid(node, markup.image_source_binding_message);
|
|
1888
|
+
for (markup.image_source_attr_names) |name| {
|
|
1889
|
+
if (node.attr(name) == null) return self.failVoid(node, markup.image_source_complete_message);
|
|
1890
|
+
}
|
|
1891
|
+
options.image_src = .{
|
|
1892
|
+
.x = try self.floatAttr(scope, node, node.attrEntry("source-x").?),
|
|
1893
|
+
.y = try self.floatAttr(scope, node, node.attrEntry("source-y").?),
|
|
1894
|
+
.width = try self.floatAttr(scope, node, node.attrEntry("source-width").?),
|
|
1895
|
+
.height = try self.floatAttr(scope, node, node.attrEntry("source-height").?),
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1871
1899
|
/// `surface="{binding}"` on media-surface: the model-owned u64
|
|
1872
1900
|
/// surface id a producer targets — media-surface-only,
|
|
1873
1901
|
/// binding-only, integer-valued (the runtime-image-id grammar
|
|
@@ -2846,6 +2846,9 @@ pub const ImageLeafModel = struct {
|
|
|
2846
2846
|
/// A signed id field: bindings evaluate as i64, so a negative must
|
|
2847
2847
|
/// reach the image seam as a value, never trap in the u64 cast.
|
|
2848
2848
|
stale_image: i64 = -2,
|
|
2849
|
+
source_x: f32 = 4,
|
|
2850
|
+
source_width: f32 = 32,
|
|
2851
|
+
invalid_source: []const u8 = "wide",
|
|
2849
2852
|
|
|
2850
2853
|
/// A pub fn producing an ImageId binds like a field.
|
|
2851
2854
|
pub fn thumbnail(model: *const ImageLeafModel) canvas.ImageId {
|
|
@@ -2855,7 +2858,7 @@ pub const ImageLeafModel = struct {
|
|
|
2855
2858
|
|
|
2856
2859
|
pub const image_markup_source =
|
|
2857
2860
|
\\<row gap="8">
|
|
2858
|
-
\\ <image image="{cover}" width="120" height="80" label="Cover art" />
|
|
2861
|
+
\\ <image image="{cover}" source-x="{source_x}" source-y="8" source-width="{source_width}" source-height="24" width="120" height="80" label="Cover art" />
|
|
2859
2862
|
\\ <image image="{thumbnail}" width="48" height="48" label="" />
|
|
2860
2863
|
\\</row>
|
|
2861
2864
|
;
|
|
@@ -2875,7 +2878,7 @@ pub const ImageLeafUi = canvas.Ui(ImageLeafMsg);
|
|
|
2875
2878
|
/// shares.
|
|
2876
2879
|
pub fn handImageLeafView(ui: *ImageLeafUi, model: *const ImageLeafModel) ImageLeafUi.Node {
|
|
2877
2880
|
return ui.row(.{ .gap = 8 }, .{
|
|
2878
|
-
ui.image(.{ .image = model.cover, .width = 120, .height = 80, .semantics = .{ .label = "Cover art" } }),
|
|
2881
|
+
ui.image(.{ .image = model.cover, .image_src = geometry.RectF.init(model.source_x, 8, model.source_width, 24), .width = 120, .height = 80, .semantics = .{ .label = "Cover art" } }),
|
|
2879
2882
|
ui.image(.{ .image = model.thumbnail(), .width = 48, .height = 48, .semantics = .{ .label = "" } }),
|
|
2880
2883
|
});
|
|
2881
2884
|
}
|
|
@@ -2902,13 +2905,16 @@ test "the image leaf binds a dynamic ImageId from model fields and fns" {
|
|
|
2902
2905
|
try collectIds(hand_tree.root, &hand_ids, testing.allocator);
|
|
2903
2906
|
try testing.expectEqualSlices(canvas.ObjectId, hand_ids.items, markup_ids.items);
|
|
2904
2907
|
|
|
2905
|
-
// The
|
|
2908
|
+
// The id and source-coordinate bindings land on the widget. The
|
|
2909
|
+
// second image omits a crop and draws the whole registered image.
|
|
2906
2910
|
const cover = markup_tree.root.children[0];
|
|
2907
2911
|
try testing.expectEqual(canvas.WidgetKind.image, cover.kind);
|
|
2908
2912
|
try testing.expectEqual(@as(canvas.ImageId, 42), cover.image_id);
|
|
2913
|
+
try testing.expectEqualDeep(@as(?geometry.RectF, geometry.RectF.init(4, 8, 32, 24)), cover.image_src);
|
|
2909
2914
|
try testing.expectEqualStrings("Cover art", cover.semantics.label);
|
|
2910
2915
|
const thumbnail = markup_tree.root.children[1];
|
|
2911
2916
|
try testing.expectEqual(@as(canvas.ImageId, 43), thumbnail.image_id);
|
|
2917
|
+
try testing.expectEqual(@as(?geometry.RectF, null), thumbnail.image_src);
|
|
2912
2918
|
|
|
2913
2919
|
// 0 is the "no image" sentinel: the leaf renders nothing (the
|
|
2914
2920
|
// model simply has not loaded the image yet).
|
|
@@ -2945,6 +2951,29 @@ test "image leaf misuse fails the build with the teaching messages" {
|
|
|
2945
2951
|
.source = "<row>\n <image image=\"{cover}\" label=\"Art\"><text>Caption</text></image>\n</row>",
|
|
2946
2952
|
.message = canvas.ui_markup.image_children_message,
|
|
2947
2953
|
},
|
|
2954
|
+
.{
|
|
2955
|
+
// A source rectangle is atomic: omitting one coordinate is
|
|
2956
|
+
// a typo, not an implicit zero/default.
|
|
2957
|
+
.source = "<row>\n <image image=\"{cover}\" source-x=\"0\" source-y=\"0\" source-width=\"16\" label=\"Art\" />\n</row>",
|
|
2958
|
+
.message = canvas.ui_markup.image_source_complete_message,
|
|
2959
|
+
},
|
|
2960
|
+
.{
|
|
2961
|
+
// Cropping without an image would be inert (avatar may omit
|
|
2962
|
+
// image normally for its initials fallback).
|
|
2963
|
+
.source = "<row>\n <avatar source-x=\"0\" source-y=\"0\" source-width=\"16\" source-height=\"16\">CT</avatar>\n</row>",
|
|
2964
|
+
.message = canvas.ui_markup.image_source_binding_message,
|
|
2965
|
+
},
|
|
2966
|
+
.{
|
|
2967
|
+
// Only registered-image widgets consume source rectangles.
|
|
2968
|
+
.source = "<row>\n <badge source-x=\"0\" source-y=\"0\" source-width=\"16\" source-height=\"16\">3</badge>\n</row>",
|
|
2969
|
+
.message = canvas.ui_markup.image_source_element_message,
|
|
2970
|
+
},
|
|
2971
|
+
.{
|
|
2972
|
+
// Runtime model values still pass the numeric conversion
|
|
2973
|
+
// gate; a string cannot become a source coordinate.
|
|
2974
|
+
.source = "<row>\n <image image=\"{cover}\" source-x=\"{invalid_source}\" source-y=\"0\" source-width=\"16\" source-height=\"16\" label=\"Art\" />\n</row>",
|
|
2975
|
+
.message = "expected a number",
|
|
2976
|
+
},
|
|
2948
2977
|
.{
|
|
2949
2978
|
// Markup that skipped validation (hot reload) can reach the
|
|
2950
2979
|
// engine without the binding: the leaf could only ever
|
|
@@ -591,6 +591,15 @@ pub const attrs = [_]AttrInfo{
|
|
|
591
591
|
// minimum unconstrained so a capped element still shrinks with a
|
|
592
592
|
// narrow parent.
|
|
593
593
|
.{ .code = 98, .name = "max-width", .class = .number, .group = .option, .field = "max_width" },
|
|
594
|
+
// Registered-image source rectangle, in decoded-image pixel
|
|
595
|
+
// coordinates. The four values are one atomic declaration: the
|
|
596
|
+
// validator scopes them to avatar/image and requires all four beside
|
|
597
|
+
// the image binding. They lower together into ElementOptions.image_src,
|
|
598
|
+
// so no individual attribute names a flat field.
|
|
599
|
+
.{ .code = 99, .name = "source-x", .class = .number, .group = .element },
|
|
600
|
+
.{ .code = 100, .name = "source-y", .class = .number, .group = .element },
|
|
601
|
+
.{ .code = 101, .name = "source-width", .class = .number, .group = .element },
|
|
602
|
+
.{ .code = 102, .name = "source-height", .class = .number, .group = .element },
|
|
594
603
|
};
|
|
595
604
|
|
|
596
605
|
// ----------------------------------------------------------------- events
|
|
@@ -22,7 +22,7 @@ test "registry codes are stable: assigned at birth, never renumbered or renamed"
|
|
|
22
22
|
// the new fingerprint ONLY for additions; renames/renumbers are
|
|
23
23
|
// schema-version-bump events, not silent edits.
|
|
24
24
|
try testing.expectEqual(@as(usize, 70), schema.elements.len);
|
|
25
|
-
try testing.expectEqual(@as(usize,
|
|
25
|
+
try testing.expectEqual(@as(usize, 102), schema.attrs.len);
|
|
26
26
|
try testing.expectEqual(@as(usize, 15), schema.events.len);
|
|
27
27
|
// The element table runs through the span composite (64), the
|
|
28
28
|
// bubble-reactions composite (65), the media surface (66), the
|
|
@@ -48,9 +48,11 @@ test "registry codes are stable: assigned at birth, never renumbered or renamed"
|
|
|
48
48
|
// code-diff line sets added-lines (94) and removed-lines (95), and
|
|
49
49
|
// Markdown's registered-image iterable binding images (96), and the
|
|
50
50
|
// textarea Enter policy submit-on-enter (97), and the responsive
|
|
51
|
-
// layout ceiling max-width (98)
|
|
51
|
+
// layout ceiling max-width (98), and the registered-image source
|
|
52
|
+
// rectangle source-x (99), source-y (100), source-width (101), and
|
|
53
|
+
// source-height (102).
|
|
52
54
|
try testing.expectEqual(
|
|
53
|
-
@as(u64,
|
|
55
|
+
@as(u64, 0x3614b1510b48dcf4),
|
|
54
56
|
tableFingerprint(schema.AttrInfo, &schema.attrs),
|
|
55
57
|
);
|
|
56
58
|
// The event table runs through the pointer-hover containment pair
|
|
@@ -562,9 +562,9 @@ test "avatar and image sugar carry registered image ids" {
|
|
|
562
562
|
|
|
563
563
|
var ui = InboxUi.init(arena_state.allocator());
|
|
564
564
|
const tree = try ui.finalize(ui.column(.{}, .{
|
|
565
|
-
ui.avatar(.{ .image = 77, .semantics = .{ .label = "Native SDK" } }, "NS"),
|
|
565
|
+
ui.avatar(.{ .image = 77, .image_src = geometry.RectF.init(32, 0, 32, 32), .semantics = .{ .label = "Native SDK" } }, "NS"),
|
|
566
566
|
ui.avatar(.{}, "NS"),
|
|
567
|
-
ui.image(.{ .image = 42, .semantics = .{ .label = "Chart" } }),
|
|
567
|
+
ui.image(.{ .image = 42, .image_src = geometry.RectF.init(4, 8, 24, 16), .semantics = .{ .label = "Chart" } }),
|
|
568
568
|
}));
|
|
569
569
|
|
|
570
570
|
// With an image id the avatar clips it to the circle (cover fit);
|
|
@@ -572,6 +572,7 @@ test "avatar and image sugar carry registered image ids" {
|
|
|
572
572
|
const with_image = tree.root.children[0];
|
|
573
573
|
try testing.expectEqual(canvas.WidgetKind.avatar, with_image.kind);
|
|
574
574
|
try testing.expectEqual(@as(canvas.ImageId, 77), with_image.image_id);
|
|
575
|
+
try testing.expectEqualDeep(@as(?geometry.RectF, geometry.RectF.init(32, 0, 32, 32)), with_image.image_src);
|
|
575
576
|
try testing.expectEqual(canvas.ImageFit.cover, with_image.image_fit);
|
|
576
577
|
try testing.expectEqualStrings("NS", with_image.text);
|
|
577
578
|
|
|
@@ -582,6 +583,7 @@ test "avatar and image sugar carry registered image ids" {
|
|
|
582
583
|
const image_leaf = tree.root.children[2];
|
|
583
584
|
try testing.expectEqual(canvas.WidgetKind.image, image_leaf.kind);
|
|
584
585
|
try testing.expectEqual(@as(canvas.ImageId, 42), image_leaf.image_id);
|
|
586
|
+
try testing.expectEqualDeep(@as(?geometry.RectF, geometry.RectF.init(4, 8, 24, 16)), image_leaf.image_src);
|
|
585
587
|
}
|
|
586
588
|
|
|
587
589
|
test "payload-carrying handlers build messages from edits and values" {
|
|
@@ -2673,6 +2673,7 @@ fn emitIconWidget(builder: *Builder, widget: Widget, tokens: DesignTokens) Error
|
|
|
2673
2673
|
.origin = pixelSnapTextPoint(tokens, centeredTextOrigin(widget.frame, widget.text, size, tokens)),
|
|
2674
2674
|
.color = widgetForegroundColor(widget, tokens, tokens.colors.text),
|
|
2675
2675
|
.text = widget.text,
|
|
2676
|
+
.measure = tokens.text_measure,
|
|
2676
2677
|
});
|
|
2677
2678
|
}
|
|
2678
2679
|
|
|
@@ -2697,7 +2698,10 @@ fn emitImageWidget(builder: *Builder, widget: Widget) Error!void {
|
|
|
2697
2698
|
.dst = widget.frame,
|
|
2698
2699
|
.opacity = widget.image_opacity,
|
|
2699
2700
|
.fit = widget.image_fit,
|
|
2700
|
-
|
|
2701
|
+
// Packet hosts expose filtering but no per-draw sampler-address
|
|
2702
|
+
// mode. Nearest sampling keeps an atlas crop from filtering
|
|
2703
|
+
// across its source boundary; whole-image draws stay linear.
|
|
2704
|
+
.sampling = if (widget.image_src != null) .nearest else widget.image_sampling,
|
|
2701
2705
|
});
|
|
2702
2706
|
if (clips_image) try builder.popClip();
|
|
2703
2707
|
}
|
|
@@ -2987,7 +2991,9 @@ fn emitAvatarWidget(builder: *Builder, widget: Widget, tokens: DesignTokens) Err
|
|
|
2987
2991
|
.dst = widget.frame,
|
|
2988
2992
|
.opacity = widget.image_opacity,
|
|
2989
2993
|
.fit = widget.image_fit,
|
|
2990
|
-
|
|
2994
|
+
// See emitImageWidget: a cropped avatar is an atlas draw and
|
|
2995
|
+
// must not sample neighboring regions on packet hosts.
|
|
2996
|
+
.sampling = if (widget.image_src != null) .nearest else widget.image_sampling,
|
|
2991
2997
|
// The render plan flattens the clip stack to rects, so the
|
|
2992
2998
|
// pill clip above only crops the bounds; the draw's own
|
|
2993
2999
|
// radius mask is what actually rounds the image.
|
|
@@ -3657,6 +3663,7 @@ fn emitChartAxisLabels(builder: *Builder, widget: Widget, tokens: DesignTokens,
|
|
|
3657
3663
|
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(plot.x - chart_axis_label_gap - width, top + size)),
|
|
3658
3664
|
.color = tokens.colors.text_muted,
|
|
3659
3665
|
.text = text,
|
|
3666
|
+
.measure = tokens.text_measure,
|
|
3660
3667
|
});
|
|
3661
3668
|
}
|
|
3662
3669
|
}
|
|
@@ -3688,6 +3695,7 @@ fn emitChartAxisLabels(builder: *Builder, widget: Widget, tokens: DesignTokens,
|
|
|
3688
3695
|
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(x, baseline)),
|
|
3689
3696
|
.color = tokens.colors.text_muted,
|
|
3690
3697
|
.text = label,
|
|
3698
|
+
.measure = tokens.text_measure,
|
|
3691
3699
|
});
|
|
3692
3700
|
}
|
|
3693
3701
|
}
|
|
@@ -4159,6 +4167,7 @@ fn emitChartHoverDetail(builder: *Builder, widget: Widget, tokens: DesignTokens,
|
|
|
4159
4167
|
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(card.x + chart_detail_pad_h, row_y + size)),
|
|
4160
4168
|
.color = tokens.colors.text,
|
|
4161
4169
|
.text = title_text,
|
|
4170
|
+
.measure = tokens.text_measure,
|
|
4162
4171
|
});
|
|
4163
4172
|
row_y += line_height;
|
|
4164
4173
|
for (data.series, 0..) |series, series_index| {
|
|
@@ -4178,6 +4187,7 @@ fn emitChartHoverDetail(builder: *Builder, widget: Widget, tokens: DesignTokens,
|
|
|
4178
4187
|
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(card.x + chart_detail_pad_h + chart_detail_swatch + chart_detail_swatch_gap, row_y + size)),
|
|
4179
4188
|
.color = tokens.colors.text_muted,
|
|
4180
4189
|
.text = chartDetailRowName(series),
|
|
4190
|
+
.measure = tokens.text_measure,
|
|
4181
4191
|
});
|
|
4182
4192
|
var value_buffer: [chart_model.max_chart_value_label_bytes]u8 = undefined;
|
|
4183
4193
|
const value_text = try builder.allocChartLabelBytes(chart_model.formatChartValue(&value_buffer, series.values[detail.index], decimals));
|
|
@@ -4189,6 +4199,7 @@ fn emitChartHoverDetail(builder: *Builder, widget: Widget, tokens: DesignTokens,
|
|
|
4189
4199
|
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(card.maxX() - chart_detail_pad_h - value_width, row_y + size)),
|
|
4190
4200
|
.color = tokens.colors.text,
|
|
4191
4201
|
.text = value_text,
|
|
4202
|
+
.measure = tokens.text_measure,
|
|
4192
4203
|
});
|
|
4193
4204
|
row_y += line_height;
|
|
4194
4205
|
}
|
|
@@ -267,6 +267,7 @@ pub fn emitIconButtonWidget(builder: *Builder, widget: Widget, tokens: DesignTok
|
|
|
267
267
|
.origin = pixelSnapTextPoint(tokens, centeredTextOrigin(widget.frame, widget.text, size, tokens)),
|
|
268
268
|
.color = buttonTextColorForWidget(widget, tokens),
|
|
269
269
|
.text = widget.text,
|
|
270
|
+
.measure = tokens.text_measure,
|
|
270
271
|
});
|
|
271
272
|
}
|
|
272
273
|
}
|
|
@@ -829,7 +829,7 @@ test "widget image emits draw image and exposes image semantics" {
|
|
|
829
829
|
.image_id = 42,
|
|
830
830
|
.image_src = geometry.RectF.init(0, 0, 320, 192),
|
|
831
831
|
.image_fit = .cover,
|
|
832
|
-
.image_sampling = .
|
|
832
|
+
.image_sampling = .linear,
|
|
833
833
|
.image_opacity = 0.75,
|
|
834
834
|
.semantics = .{ .label = "Deployment preview" },
|
|
835
835
|
};
|
|
@@ -864,6 +864,8 @@ test "widget image emits draw image and exposes image semantics" {
|
|
|
864
864
|
try expectRect(geometry.RectF.init(0, 0, 320, 192), draw.src);
|
|
865
865
|
try expectRect(geometry.RectF.init(12, 14, 80, 48), draw.dst);
|
|
866
866
|
try std.testing.expectEqual(ImageFit.cover, draw.fit);
|
|
867
|
+
// Atlas crops force nearest sampling at the widget seam so
|
|
868
|
+
// packet hosts cannot filter outside the source rectangle.
|
|
867
869
|
try std.testing.expectEqual(ImageSampling.nearest, draw.sampling);
|
|
868
870
|
try std.testing.expectEqual(@as(f32, 0.75), draw.opacity);
|
|
869
871
|
},
|
package/src/root.zig
CHANGED
|
@@ -21,6 +21,8 @@ pub const js = @import("js/root.zig");
|
|
|
21
21
|
pub const bridge = @import("bridge/root.zig");
|
|
22
22
|
pub const frontend = @import("frontend/root.zig");
|
|
23
23
|
pub const security = @import("security/root.zig");
|
|
24
|
+
pub const updater = @import("updater/root.zig");
|
|
25
|
+
pub const update_check_command = platform.update_check_command;
|
|
24
26
|
|
|
25
27
|
pub const Runtime = runtime.Runtime;
|
|
26
28
|
pub const RuntimeOptions = runtime.Options;
|
|
@@ -253,6 +255,10 @@ pub const TrayItemId = platform.TrayItemId;
|
|
|
253
255
|
pub const TrayOptions = platform.TrayOptions;
|
|
254
256
|
pub const TrayShell = platform.TrayShell;
|
|
255
257
|
pub const TrayMenuItem = platform.TrayMenuItem;
|
|
258
|
+
pub const TraySegmentOption = platform.TraySegmentOption;
|
|
259
|
+
pub const TraySegmentedRow = platform.TraySegmentedRow;
|
|
260
|
+
pub const TrayMetricRow = platform.TrayMetricRow;
|
|
261
|
+
pub const TrayChartRow = platform.TrayChartRow;
|
|
256
262
|
pub const BridgeDispatcher = bridge.Dispatcher;
|
|
257
263
|
pub const BridgePolicy = bridge.Policy;
|
|
258
264
|
pub const BridgeCommandPolicy = bridge.CommandPolicy;
|
|
@@ -103,6 +103,9 @@ pub fn RuntimeAutomationSnapshot(comptime Runtime: type) type {
|
|
|
103
103
|
.role = item.role,
|
|
104
104
|
.key = item.key,
|
|
105
105
|
.modifiers = item.modifiers,
|
|
106
|
+
.segmented = item.segmented,
|
|
107
|
+
.metric = item.metric,
|
|
108
|
+
.chart = item.chart,
|
|
106
109
|
};
|
|
107
110
|
}
|
|
108
111
|
self.automation_trays[tray_count] = .{
|
|
@@ -222,6 +222,7 @@ pub fn RuntimeCanvasFonts(comptime Runtime: type) type {
|
|
|
222
222
|
.context = self,
|
|
223
223
|
.measure_fn = canvasFontMeasure,
|
|
224
224
|
.measure_advances_fn = canvasFontMeasureAdvances,
|
|
225
|
+
.measure_ink_fn = canvasFontMeasureInk,
|
|
225
226
|
};
|
|
226
227
|
}
|
|
227
228
|
noteCanvasFontsChanged(self);
|
|
@@ -290,6 +291,92 @@ pub fn RuntimeCanvasFonts(comptime Runtime: type) type {
|
|
|
290
291
|
return true;
|
|
291
292
|
}
|
|
292
293
|
|
|
294
|
+
fn canvasFontMeasureInk(context: ?*anyopaque, font_id: canvas.FontId, size: f32, text: []const u8, metrics: *canvas.TextInkMetrics) bool {
|
|
295
|
+
const runtime: *Runtime = @ptrCast(@alignCast(context));
|
|
296
|
+
const index = findCanvasFontIndex(runtime, font_id) orelse return false;
|
|
297
|
+
const face = &runtime.canvas_font_faces[index];
|
|
298
|
+
const scale = size / face.units_per_em;
|
|
299
|
+
var pen_x: f32 = 0;
|
|
300
|
+
var has_ink = false;
|
|
301
|
+
var min_x: f32 = 0;
|
|
302
|
+
var max_x: f32 = 0;
|
|
303
|
+
var min_y: f32 = 0;
|
|
304
|
+
var max_y: f32 = 0;
|
|
305
|
+
var offset: usize = 0;
|
|
306
|
+
while (offset < text.len) {
|
|
307
|
+
const next = @min(text.len, offset + canvas.utf8SequenceLength(text[offset]));
|
|
308
|
+
const cluster = text[offset..next];
|
|
309
|
+
const cell_advance = canvas.estimateTextWidthForFace(face, cluster, size);
|
|
310
|
+
const is_break = text[offset] == ' ' or text[offset] == '\t' or
|
|
311
|
+
text[offset] == '\n' or text[offset] == '\r';
|
|
312
|
+
|
|
313
|
+
if (!is_break) {
|
|
314
|
+
var glyph: u16 = 0;
|
|
315
|
+
if (cluster.len == canvas.utf8SequenceLength(cluster[0]) and cluster.len > 1) {
|
|
316
|
+
if (std.unicode.utf8Decode(cluster)) |codepoint| {
|
|
317
|
+
glyph = face.glyphIndex(codepoint);
|
|
318
|
+
} else |_| {}
|
|
319
|
+
} else if (cluster.len == 1 and cluster[0] >= 0x20 and cluster[0] < 0x7F) {
|
|
320
|
+
glyph = face.glyphIndex(cluster[0]);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (glyph != 0) {
|
|
324
|
+
const natural_advance = face.advance(glyph) * scale;
|
|
325
|
+
const inset = @max(0, (cell_advance - natural_advance) * 0.5);
|
|
326
|
+
const outline = face.glyphBounds(glyph) catch return false;
|
|
327
|
+
if (outline) |glyph_bounds| {
|
|
328
|
+
const outline_min_x = pen_x + inset + glyph_bounds.x * scale;
|
|
329
|
+
const outline_max_x = pen_x + inset + (glyph_bounds.x + glyph_bounds.width) * scale;
|
|
330
|
+
const outline_min_y = -((glyph_bounds.y + glyph_bounds.height) * scale);
|
|
331
|
+
const outline_max_y = -(glyph_bounds.y * scale);
|
|
332
|
+
if (!has_ink) {
|
|
333
|
+
has_ink = true;
|
|
334
|
+
min_x = outline_min_x;
|
|
335
|
+
max_x = outline_max_x;
|
|
336
|
+
min_y = outline_min_y;
|
|
337
|
+
max_y = outline_max_y;
|
|
338
|
+
} else {
|
|
339
|
+
min_x = @min(min_x, outline_min_x);
|
|
340
|
+
max_x = @max(max_x, outline_max_x);
|
|
341
|
+
min_y = @min(min_y, outline_min_y);
|
|
342
|
+
max_y = @max(max_y, outline_max_y);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
// The reference renderer paints a solid fallback
|
|
347
|
+
// cell for an uncovered cluster. Keep this provider
|
|
348
|
+
// in lockstep with that block's actual cell bounds.
|
|
349
|
+
const block_min_x = pen_x;
|
|
350
|
+
const block_max_x = pen_x + cell_advance;
|
|
351
|
+
const block_min_y = -size;
|
|
352
|
+
const block_max_y = 0;
|
|
353
|
+
if (!has_ink) {
|
|
354
|
+
has_ink = true;
|
|
355
|
+
min_x = block_min_x;
|
|
356
|
+
max_x = block_max_x;
|
|
357
|
+
min_y = block_min_y;
|
|
358
|
+
max_y = block_max_y;
|
|
359
|
+
} else {
|
|
360
|
+
min_x = @min(min_x, block_min_x);
|
|
361
|
+
max_x = @max(max_x, block_max_x);
|
|
362
|
+
min_y = @min(min_y, block_min_y);
|
|
363
|
+
max_y = @max(max_y, block_max_y);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
pen_x += cell_advance;
|
|
368
|
+
offset = next;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
metrics.* = if (has_ink) .{
|
|
372
|
+
.min_x = min_x,
|
|
373
|
+
.max_x = max_x,
|
|
374
|
+
.min_y = min_y,
|
|
375
|
+
.max_y = max_y,
|
|
376
|
+
} else .{};
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
|
|
293
380
|
fn findCanvasFontIndex(self: *const Runtime, id: canvas.FontId) ?usize {
|
|
294
381
|
for (self.canvas_font_entries[0..self.canvas_font_count], 0..) |entry, index| {
|
|
295
382
|
if (entry.id == id) return index;
|
package/src/runtime/core.zig
CHANGED
|
@@ -529,6 +529,7 @@ pub const Runtime = struct {
|
|
|
529
529
|
.context = options.platform.services.context,
|
|
530
530
|
.measure_fn = measure_fn,
|
|
531
531
|
.measure_advances_fn = options.platform.services.measure_text_advances_fn,
|
|
532
|
+
.measure_ink_fn = options.platform.services.measure_text_ink_fn,
|
|
532
533
|
}
|
|
533
534
|
else
|
|
534
535
|
null;
|
package/src/runtime/flow.zig
CHANGED
|
@@ -573,6 +573,13 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
573
573
|
|
|
574
574
|
pub fn dispatchCommand(self: *Runtime, app: App, command: CommandEvent) anyerror!void {
|
|
575
575
|
try validateCommandName(command.name);
|
|
576
|
+
if (std.mem.eql(u8, command.name, platform.update_check_command)) {
|
|
577
|
+
self.options.platform.services.checkForUpdates(true) catch |err| switch (err) {
|
|
578
|
+
error.UnsupportedService => return dispatchEvent(self, app, .{ .command = command }),
|
|
579
|
+
else => return err,
|
|
580
|
+
};
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
576
583
|
try dispatchEvent(self, app, .{ .command = command });
|
|
577
584
|
}
|
|
578
585
|
|
|
@@ -1012,7 +1019,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1012
1019
|
// stale or unknown item id is loud driver misuse,
|
|
1013
1020
|
// like widget-click on an unmounted widget.
|
|
1014
1021
|
const target = try parseAutomationTrayTarget(command.value);
|
|
1015
|
-
if (!SystemServiceMethods().
|
|
1022
|
+
if (!SystemServiceMethods().statusItemMenuItemActionable(self, target.status_item_id, target.item_id)) return error.InvalidCommand;
|
|
1016
1023
|
try dispatchPlatformEvent(self, app, .{ .tray_action = .{
|
|
1017
1024
|
.status_item_id = target.status_item_id,
|
|
1018
1025
|
.item_id = target.item_id,
|