@native-sdk/cli 0.6.3 → 0.7.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 (64) hide show
  1. package/build.zig +65 -91
  2. package/package.json +9 -9
  3. package/packages/core/package-lock.json +2 -2
  4. package/packages/core/package.json +1 -1
  5. package/packages/core/sdk/text.ts +25 -14
  6. package/packages/core/src/checker.ts +39 -0
  7. package/packages/core/src/emitter.ts +125 -1
  8. package/skill-data/native-ui/SKILL.md +23 -6
  9. package/src/platform/macos/appkit_host.m +25 -1
  10. package/src/platform/macos/cef_host.mm +24 -2
  11. package/src/platform/macos/root.zig +13 -0
  12. package/src/primitives/canvas/code.zig +1008 -0
  13. package/src/primitives/canvas/code_tests.zig +1912 -0
  14. package/src/primitives/canvas/events.zig +111 -1
  15. package/src/primitives/canvas/layout_audit.zig +3 -1
  16. package/src/primitives/canvas/markdown.zig +13 -11
  17. package/src/primitives/canvas/markdown_tests.zig +168 -6
  18. package/src/primitives/canvas/root.zig +8 -2
  19. package/src/primitives/canvas/tests.zig +1 -0
  20. package/src/primitives/canvas/text.zig +6 -0
  21. package/src/primitives/canvas/text_measure_cache.zig +4 -4
  22. package/src/primitives/canvas/text_span_tests.zig +254 -0
  23. package/src/primitives/canvas/text_spans.zig +556 -32
  24. package/src/primitives/canvas/themes/geist.zig +29 -0
  25. package/src/primitives/canvas/tokens.zig +72 -2
  26. package/src/primitives/canvas/ui.zig +400 -22
  27. package/src/primitives/canvas/ui_markup.zig +78 -7
  28. package/src/primitives/canvas/ui_markup_compiled.zig +89 -0
  29. package/src/primitives/canvas/ui_markup_compiled_tests.zig +45 -0
  30. package/src/primitives/canvas/ui_markup_contract.zig +41 -0
  31. package/src/primitives/canvas/ui_markup_view.zig +89 -0
  32. package/src/primitives/canvas/ui_markup_view_tests.zig +154 -3
  33. package/src/primitives/canvas/ui_schema.zig +30 -6
  34. package/src/primitives/canvas/ui_schema_tests.zig +13 -10
  35. package/src/primitives/canvas/ui_tests.zig +26 -0
  36. package/src/primitives/canvas/widget_invalidation.zig +4 -0
  37. package/src/primitives/canvas/widget_layout.zig +57 -8
  38. package/src/primitives/canvas/widget_layout_tests.zig +35 -0
  39. package/src/primitives/canvas/widget_metrics.zig +35 -1
  40. package/src/primitives/canvas/widget_render.zig +1077 -11
  41. package/src/primitives/canvas/widget_render_controls.zig +4 -4
  42. package/src/primitives/canvas/widget_runtime.zig +2 -0
  43. package/src/primitives/canvas/widget_text_input.zig +165 -8
  44. package/src/primitives/canvas/widget_text_select.zig +2 -2
  45. package/src/primitives/canvas/widget_tree.zig +6 -5
  46. package/src/primitives/canvas/widgets.zig +38 -0
  47. package/src/root.zig +1 -0
  48. package/src/runtime/canvas_budget_edge_tests.zig +3 -2
  49. package/src/runtime/canvas_limits.zig +13 -6
  50. package/src/runtime/canvas_widget_clipboard_tests.zig +137 -4
  51. package/src/runtime/canvas_widget_context_menu.zig +17 -2
  52. package/src/runtime/canvas_widget_event_tests.zig +18 -14
  53. package/src/runtime/canvas_widget_events.zig +58 -21
  54. package/src/runtime/canvas_widget_runtime.zig +112 -6
  55. package/src/runtime/canvas_widget_scroll_driver_tests.zig +59 -0
  56. package/src/runtime/canvas_widget_split_tree_tests.zig +100 -0
  57. package/src/runtime/canvas_widget_state.zig +27 -0
  58. package/src/runtime/canvas_widget_text_tests.zig +383 -0
  59. package/src/runtime/core.zig +15 -5
  60. package/src/runtime/gpu_surface_events.zig +12 -12
  61. package/src/runtime/view.zig +61 -19
  62. package/src/runtime/view_widget_scroll.zig +48 -18
  63. package/src/runtime/view_widget_text.zig +248 -17
  64. package/src/runtime/window_view_runtime.zig +9 -0
@@ -153,6 +153,14 @@ fn light() ColorTokens {
153
153
  .text = Color.rgb8(23, 23, 23),
154
154
  // Secondary ink: gray-900 #4d4d4d.
155
155
  .text_muted = Color.rgb8(77, 77, 77),
156
+ // Geist Code Block syntax inks (the published 900 steps).
157
+ .syntax_plain = Color.rgb8(23, 23, 23),
158
+ .syntax_comment = Color.rgb8(77, 77, 77),
159
+ .syntax_keyword = Color.rgb8(189, 40, 100),
160
+ .syntax_literal = Color.rgb8(41, 122, 58),
161
+ .syntax_function = Color.rgb8(120, 32, 188),
162
+ .syntax_property = Color.rgb8(203, 42, 47),
163
+ .syntax_constant = Color.rgb8(0, 104, 214),
156
164
  // Hairline: black at 8% — the translucent border register.
157
165
  .border = Color.rgba8(0, 0, 0, 20),
158
166
  // The monochrome primary FILL: pure black #000000 filled
@@ -205,6 +213,13 @@ fn dark() ColorTokens {
205
213
  .text = Color.rgb8(237, 237, 237),
206
214
  // Secondary ink: gray-900 #a0a0a0.
207
215
  .text_muted = Color.rgb8(160, 160, 160),
216
+ .syntax_plain = Color.rgb8(237, 237, 237),
217
+ .syntax_comment = Color.rgb8(161, 161, 161),
218
+ .syntax_keyword = Color.rgb8(247, 95, 143),
219
+ .syntax_literal = Color.rgb8(98, 192, 115),
220
+ .syntax_function = Color.rgb8(191, 122, 240),
221
+ .syntax_property = Color.rgb8(255, 97, 102),
222
+ .syntax_constant = Color.rgb8(82, 168, 255),
208
223
  // Hairline: white at 14% — hairlines brighten what they overlap.
209
224
  .border = Color.rgba8(255, 255, 255, 36),
210
225
  // Porcelain primary with black knockout text.
@@ -247,6 +262,13 @@ fn highContrastLight() ColorTokens {
247
262
  .text = Color.rgb8(0, 0, 0),
248
263
  // Secondary ink darkens to gray-1000.
249
264
  .text_muted = Color.rgb8(23, 23, 23),
265
+ .syntax_plain = Color.rgb8(23, 23, 23),
266
+ .syntax_comment = Color.rgb8(77, 77, 77),
267
+ .syntax_keyword = Color.rgb8(189, 40, 100),
268
+ .syntax_literal = Color.rgb8(41, 122, 58),
269
+ .syntax_function = Color.rgb8(120, 32, 188),
270
+ .syntax_property = Color.rgb8(203, 42, 47),
271
+ .syntax_constant = Color.rgb8(0, 104, 214),
250
272
  .border = Color.rgba8(0, 0, 0, 180),
251
273
  .accent = Color.rgb8(0, 0, 0),
252
274
  .accent_text = Color.rgb8(255, 255, 255),
@@ -281,6 +303,13 @@ fn highContrastDark() ColorTokens {
281
303
  .surface_pressed = Color.rgb8(41, 41, 41),
282
304
  .text = Color.rgb8(255, 255, 255),
283
305
  .text_muted = Color.rgb8(237, 237, 237),
306
+ .syntax_plain = Color.rgb8(237, 237, 237),
307
+ .syntax_comment = Color.rgb8(161, 161, 161),
308
+ .syntax_keyword = Color.rgb8(247, 95, 143),
309
+ .syntax_literal = Color.rgb8(98, 192, 115),
310
+ .syntax_function = Color.rgb8(191, 122, 240),
311
+ .syntax_property = Color.rgb8(255, 97, 102),
312
+ .syntax_constant = Color.rgb8(82, 168, 255),
284
313
  .border = Color.rgba8(255, 255, 255, 190),
285
314
  .accent = Color.rgb8(255, 255, 255),
286
315
  .accent_text = Color.rgb8(0, 0, 0),
@@ -132,6 +132,20 @@ pub const ColorTokens = struct {
132
132
  text: Color = Color.rgb8(10, 10, 10),
133
133
  /// Muted foreground; oklch(0.556 0 0) = #737373.
134
134
  text_muted: Color = Color.rgb8(115, 115, 115),
135
+ /// Source-code ink follows the Geist Code Block palette in every
136
+ /// built-in pack. Dedicated roles keep syntax highlighting independent
137
+ /// from the app's semantic success/warning/info colors. Transparent is
138
+ /// the compatibility sentinel for an older custom palette that omitted
139
+ /// these newer fields: syntax resolution inherits `text` (or
140
+ /// `text_muted` for comments), so a dark palette never silently picks up
141
+ /// the light register's near-black ink.
142
+ syntax_plain: Color = Color.rgba8(0, 0, 0, 0),
143
+ syntax_comment: Color = Color.rgba8(0, 0, 0, 0),
144
+ syntax_keyword: Color = Color.rgba8(0, 0, 0, 0),
145
+ syntax_literal: Color = Color.rgba8(0, 0, 0, 0),
146
+ syntax_function: Color = Color.rgba8(0, 0, 0, 0),
147
+ syntax_property: Color = Color.rgba8(0, 0, 0, 0),
148
+ syntax_constant: Color = Color.rgba8(0, 0, 0, 0),
135
149
  /// Border/input hairline; oklch(0.922 0 0) = #e5e5e5.
136
150
  border: Color = Color.rgb8(229, 229, 229),
137
151
  /// Primary; oklch(0.205 0 0) = #171717 — the monochrome near-black
@@ -183,7 +197,15 @@ pub const ColorTokens = struct {
183
197
  }
184
198
 
185
199
  pub fn light() ColorTokens {
186
- return .{};
200
+ return .{
201
+ .syntax_plain = Color.rgb8(23, 23, 23),
202
+ .syntax_comment = Color.rgb8(77, 77, 77),
203
+ .syntax_keyword = Color.rgb8(189, 40, 100),
204
+ .syntax_literal = Color.rgb8(41, 122, 58),
205
+ .syntax_function = Color.rgb8(120, 32, 188),
206
+ .syntax_property = Color.rgb8(203, 42, 47),
207
+ .syntax_constant = Color.rgb8(0, 104, 214),
208
+ };
187
209
  }
188
210
 
189
211
  pub fn dark() ColorTokens {
@@ -203,6 +225,13 @@ pub const ColorTokens = struct {
203
225
  .text = Color.rgb8(250, 250, 250),
204
226
  // Muted foreground; oklch(0.708 0 0) = #a1a1a1.
205
227
  .text_muted = Color.rgb8(161, 161, 161),
228
+ .syntax_plain = Color.rgb8(237, 237, 237),
229
+ .syntax_comment = Color.rgb8(161, 161, 161),
230
+ .syntax_keyword = Color.rgb8(247, 95, 143),
231
+ .syntax_literal = Color.rgb8(98, 192, 115),
232
+ .syntax_function = Color.rgb8(191, 122, 240),
233
+ .syntax_property = Color.rgb8(255, 97, 102),
234
+ .syntax_constant = Color.rgb8(82, 168, 255),
206
235
  // Dark borders are translucent white (10%), not a gray fill:
207
236
  // hairlines brighten what they overlap instead of muddying it.
208
237
  .border = Color.rgba8(255, 255, 255, 26),
@@ -241,6 +270,13 @@ pub const ColorTokens = struct {
241
270
  .surface_pressed = Color.rgb8(229, 229, 229),
242
271
  .text = Color.rgb8(0, 0, 0),
243
272
  .text_muted = Color.rgb8(64, 64, 64),
273
+ .syntax_plain = Color.rgb8(23, 23, 23),
274
+ .syntax_comment = Color.rgb8(77, 77, 77),
275
+ .syntax_keyword = Color.rgb8(189, 40, 100),
276
+ .syntax_literal = Color.rgb8(41, 122, 58),
277
+ .syntax_function = Color.rgb8(120, 32, 188),
278
+ .syntax_property = Color.rgb8(203, 42, 47),
279
+ .syntax_constant = Color.rgb8(0, 104, 214),
244
280
  .border = Color.rgba8(0, 0, 0, 180),
245
281
  // The monochrome primary at its contrast extreme: pure
246
282
  // black filled controls, 21:1 against the white accent
@@ -276,6 +312,13 @@ pub const ColorTokens = struct {
276
312
  .surface_pressed = Color.rgb8(38, 38, 38),
277
313
  .text = Color.rgb8(255, 255, 255),
278
314
  .text_muted = Color.rgb8(229, 229, 229),
315
+ .syntax_plain = Color.rgb8(237, 237, 237),
316
+ .syntax_comment = Color.rgb8(161, 161, 161),
317
+ .syntax_keyword = Color.rgb8(247, 95, 143),
318
+ .syntax_literal = Color.rgb8(98, 192, 115),
319
+ .syntax_function = Color.rgb8(191, 122, 240),
320
+ .syntax_property = Color.rgb8(255, 97, 102),
321
+ .syntax_constant = Color.rgb8(82, 168, 255),
279
322
  .border = Color.rgba8(255, 255, 255, 190),
280
323
  // The monochrome primary at its contrast extreme: pure
281
324
  // white filled controls, 21:1 against the black accent
@@ -303,6 +346,26 @@ pub const ColorTokens = struct {
303
346
  }
304
347
  };
305
348
 
349
+ /// Resolve one named color token, including the compatibility inheritance
350
+ /// for syntax roles omitted by older custom palettes.
351
+ pub fn colorTokenValue(colors: ColorTokens, ref: std.meta.FieldEnum(ColorTokens)) Color {
352
+ const value = switch (ref) {
353
+ inline else => |tag| @field(colors, @tagName(tag)),
354
+ };
355
+ if (value.a != 0) return value;
356
+ return switch (ref) {
357
+ .syntax_comment => colors.text_muted,
358
+ .syntax_plain,
359
+ .syntax_keyword,
360
+ .syntax_literal,
361
+ .syntax_function,
362
+ .syntax_property,
363
+ .syntax_constant,
364
+ => colors.text,
365
+ else => value,
366
+ };
367
+ }
368
+
306
369
  pub const FontFamily = enum {
307
370
  geist,
308
371
  geist_mono,
@@ -1205,6 +1268,13 @@ pub const ColorTokenOverrides = struct {
1205
1268
  surface_pressed: ?Color = null,
1206
1269
  text: ?Color = null,
1207
1270
  text_muted: ?Color = null,
1271
+ syntax_plain: ?Color = null,
1272
+ syntax_comment: ?Color = null,
1273
+ syntax_keyword: ?Color = null,
1274
+ syntax_literal: ?Color = null,
1275
+ syntax_function: ?Color = null,
1276
+ syntax_property: ?Color = null,
1277
+ syntax_constant: ?Color = null,
1208
1278
  border: ?Color = null,
1209
1279
  accent: ?Color = null,
1210
1280
  accent_text: ?Color = null,
@@ -1767,7 +1837,7 @@ pub const DesignTokenOverrides = struct {
1767
1837
  };
1768
1838
 
1769
1839
  pub const DesignTokens = struct {
1770
- colors: ColorTokens = .{},
1840
+ colors: ColorTokens = ColorTokens.light(),
1771
1841
  typography: TypographyTokens = .{},
1772
1842
  spacing: SpacingTokens = .{},
1773
1843
  radius: RadiusTokens = .{},