@native-sdk/cli 0.7.0 → 0.7.2

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 (81) hide show
  1. package/build/app.zig +8 -0
  2. package/build.zig +114 -103
  3. package/native-sdk.d.ts +6 -3
  4. package/package.json +9 -9
  5. package/packages/core/package-lock.json +2 -2
  6. package/packages/core/package.json +1 -1
  7. package/packages/core/sdk/text.ts +25 -14
  8. package/packages/core/src/checker.ts +39 -0
  9. package/packages/core/src/emitter.ts +125 -1
  10. package/skill-data/native-ui/SKILL.md +11 -7
  11. package/src/platform/macos/appkit_host.m +76 -4
  12. package/src/platform/macos/cef_host.mm +24 -2
  13. package/src/platform/macos/root.zig +13 -0
  14. package/src/platform/types.zig +4 -0
  15. package/src/platform/windows/gpu_surface_renderer.cpp +2280 -0
  16. package/src/platform/windows/gpu_surface_renderer.h +86 -0
  17. package/src/platform/windows/root.zig +298 -20
  18. package/src/platform/windows/webview2_host.cpp +343 -33
  19. package/src/primitives/canvas/code.zig +501 -33
  20. package/src/primitives/canvas/code_tests.zig +1029 -6
  21. package/src/primitives/canvas/events.zig +111 -1
  22. package/src/primitives/canvas/frame.zig +45 -1
  23. package/src/primitives/canvas/gpu.zig +6 -0
  24. package/src/primitives/canvas/markdown_tests.zig +17 -18
  25. package/src/primitives/canvas/render_tests.zig +93 -0
  26. package/src/primitives/canvas/root.zig +6 -0
  27. package/src/primitives/canvas/serialization.zig +150 -21
  28. package/src/primitives/canvas/text.zig +6 -0
  29. package/src/primitives/canvas/themes/geist.zig +51 -5
  30. package/src/primitives/canvas/tokens.zig +33 -4
  31. package/src/primitives/canvas/ui.zig +160 -36
  32. package/src/primitives/canvas/ui_markup.zig +60 -9
  33. package/src/primitives/canvas/ui_markup_compiled.zig +41 -0
  34. package/src/primitives/canvas/ui_markup_compiled_tests.zig +12 -0
  35. package/src/primitives/canvas/ui_markup_contract.zig +17 -1
  36. package/src/primitives/canvas/ui_markup_view.zig +44 -0
  37. package/src/primitives/canvas/ui_markup_view_tests.zig +80 -6
  38. package/src/primitives/canvas/ui_schema.zig +18 -0
  39. package/src/primitives/canvas/ui_schema_tests.zig +10 -7
  40. package/src/primitives/canvas/ui_tests.zig +40 -0
  41. package/src/primitives/canvas/widget_builtin_tests.zig +513 -13
  42. package/src/primitives/canvas/widget_invalidation.zig +12 -1
  43. package/src/primitives/canvas/widget_layout.zig +260 -21
  44. package/src/primitives/canvas/widget_metrics.zig +47 -6
  45. package/src/primitives/canvas/widget_render.zig +849 -78
  46. package/src/primitives/canvas/widget_render_controls.zig +83 -25
  47. package/src/primitives/canvas/widget_render_style.zig +52 -8
  48. package/src/primitives/canvas/widget_runtime.zig +2 -0
  49. package/src/primitives/canvas/widget_text_input.zig +167 -8
  50. package/src/primitives/canvas/widget_tree.zig +6 -5
  51. package/src/primitives/canvas/widgets.zig +78 -2
  52. package/src/runtime/canvas_budget_edge_tests.zig +3 -2
  53. package/src/runtime/canvas_frame.zig +60 -7
  54. package/src/runtime/canvas_frame_invalidation_tests.zig +80 -0
  55. package/src/runtime/canvas_frame_packet_tests.zig +83 -9
  56. package/src/runtime/canvas_frame_patch_tests.zig +16 -0
  57. package/src/runtime/canvas_images.zig +8 -2
  58. package/src/runtime/canvas_limits.zig +13 -6
  59. package/src/runtime/canvas_widget_clipboard_tests.zig +8 -5
  60. package/src/runtime/canvas_widget_context_menu.zig +7 -2
  61. package/src/runtime/canvas_widget_event_tests.zig +18 -14
  62. package/src/runtime/canvas_widget_events.zig +51 -20
  63. package/src/runtime/canvas_widget_runtime.zig +108 -4
  64. package/src/runtime/canvas_widget_scroll_driver_tests.zig +59 -0
  65. package/src/runtime/canvas_widget_split_tree_tests.zig +100 -0
  66. package/src/runtime/canvas_widget_state.zig +27 -0
  67. package/src/runtime/canvas_widget_text_tests.zig +326 -0
  68. package/src/runtime/core.zig +15 -5
  69. package/src/runtime/effects.zig +6 -0
  70. package/src/runtime/effects_tests.zig +30 -0
  71. package/src/runtime/gpu_surface_events.zig +50 -19
  72. package/src/runtime/media_surface_tests.zig +1 -1
  73. package/src/runtime/runtime_event_tests.zig +74 -0
  74. package/src/runtime/ui_app.zig +10 -8
  75. package/src/runtime/ui_app_tests.zig +67 -0
  76. package/src/runtime/view.zig +60 -16
  77. package/src/runtime/view_canvas.zig +15 -0
  78. package/src/runtime/view_widget_scroll.zig +48 -18
  79. package/src/runtime/view_widget_text.zig +59 -16
  80. package/src/runtime/window_view_runtime.zig +10 -0
  81. package/src/tooling/templates.zig +9 -6
@@ -504,16 +504,20 @@ const max_packet_text_layout_lines: usize = 64;
504
504
  /// they can never disagree on line breaks. Returns null when the run
505
505
  /// exceeds the line budget, which keeps the host's legacy wrapping
506
506
  /// fallback.
507
- fn packetTextLayout(value: CanvasGpuText, options: TextLayoutOptions, lines: []TextLine) ?text_model.TextLayout {
508
- return text_model.layoutTextRun(.{
507
+ fn packetDrawText(value: CanvasGpuText) text_model.DrawText {
508
+ return .{
509
509
  .font_id = value.font_id,
510
510
  .size = value.size,
511
511
  .origin = value.origin,
512
512
  .color = value.color,
513
513
  .text = value.text,
514
514
  .glyphs = value.glyphs,
515
- .text_layout = options,
516
- }, options, lines) catch null;
515
+ .text_layout = value.text_layout,
516
+ };
517
+ }
518
+
519
+ fn packetTextLayout(value: CanvasGpuText, options: TextLayoutOptions, lines: []TextLine) ?text_model.TextLayout {
520
+ return text_model.layoutTextRun(packetDrawText(value), options, lines) catch null;
517
521
  }
518
522
 
519
523
  fn writeCanvasGpuTextLinesJson(value: CanvasGpuText, options: TextLayoutOptions, writer: anytype) !void {
@@ -976,22 +980,19 @@ fn writeGlyphsJson(glyphs: []const Glyph, writer: anytype) !void {
976
980
  }
977
981
 
978
982
  // ---------------------------------------------------------------------------
979
- // Compact binary gpu-surface packet encoding (wire format v4).
983
+ // Compact binary gpu-surface packet encoding (wire format v5).
980
984
  //
981
985
  // The version this comment names, the `binary_packet_version` constant
982
- // below, and the host decoder's spec comment (appkit_host.m) must agree;
986
+ // below, and both host decoders' spec comments (appkit_host.m and the
987
+ // Windows gpu_surface_renderer.cpp) must agree;
983
988
  // the `test-wire-format-version-prose` build check pins all three, so
984
989
  // bumping the constant without updating the prose fails the suite.
985
990
  //
986
- // Little-endian, length-prefixed throughout, no field names, no decimal
987
- // formatting, and no glyph arrays (the packet host draws text through the
988
- // system text stack from the run's UTF-8 text plus the engine-measured
989
- // lines, so glyph payloads — the bulk of a text-heavy JSON packet — never
990
- // ride the wire). The AppKit host decoder
991
- // (`NativeSdkPacketDictionaryFromBinary` in appkit_host.m) pins the same
992
- // layout and tag tables independently; a disagreement fails the host
993
- // decode loudly (refused present -> recorded fallback) instead of drawing
994
- // garbage. Bump `binary_packet_version` on ANY layout change.
991
+ // Little-endian, length-prefixed throughout, with no field names or decimal
992
+ // formatting. The AppKit and Windows host decoders pin the same layout
993
+ // and tag tables independently; a disagreement fails host decode loudly
994
+ // (refused present -> recorded fallback) instead of drawing garbage. Bump
995
+ // `binary_packet_version` on ANY layout change.
995
996
  //
996
997
  // v2 (from v1): every header carries a retained-state `generation`, every
997
998
  // command rides behind an explicit retain `key` (its ObjectId, or a
@@ -1013,6 +1014,11 @@ fn writeGlyphsJson(glyphs: []const Glyph, writer: anytype) !void {
1013
1014
  // (the checkbox mark, the spinner arc) with the same cap the reference
1014
1015
  // renderer rasterizes instead of their engine default.
1015
1016
  //
1017
+ // v5 (from v4): text commands carry optional compact positioned-glyph runs
1018
+ // after their UTF-8 text. Each glyph preserves its engine-resolved index,
1019
+ // font override, final pen x/baseline, and advance; synthesized elision
1020
+ // markers ride as positioned UTF-8 fragments.
1021
+ //
1016
1022
  // Layout:
1017
1023
  // "NSGP" u8[4] | version u8 | load_action u8 (1 load / 2 clear /
1018
1024
  // 3 patch) | flags u8 (bit0 scissor, bit1 dirty rect list) | reserved u8
@@ -1030,7 +1036,7 @@ fn writeGlyphsJson(glyphs: []const Glyph, writer: anytype) !void {
1030
1036
  // | order_count u32 | order keys u64[]
1031
1037
 
1032
1038
  pub const binary_packet_magic = "NSGP";
1033
- pub const binary_packet_version: u8 = 4;
1039
+ pub const binary_packet_version: u8 = 5;
1034
1040
 
1035
1041
  /// Most dirty rects a patch header carries: enough to keep far-apart
1036
1042
  /// small changes (a switch plus a status line) from fusing into a
@@ -1422,7 +1428,11 @@ fn writeBinaryImage(image: CanvasGpuImage, writer: anytype) !void {
1422
1428
  }
1423
1429
 
1424
1430
  /// Text draw: font_id u64 | size f32 | origin f32[2] | color f32[4]
1425
- /// | text u32+bytes | has_layout u8 | layout { max_width f32,
1431
+ /// | text u32+bytes | has_positioned_glyphs u8 | [glyph_count u32,
1432
+ /// glyphs { id u16, flags u8 (bit0 font override), [font_id u64],
1433
+ /// x f32, baseline f32, advance f32 }, fragment_count u32, fragments
1434
+ /// { x f32, baseline f32, text u32+bytes }] | has_layout u8 | layout {
1435
+ /// max_width f32,
1426
1436
  /// line_height f32, wrap u8 (0 none / 1 word / 2 character), align u8
1427
1437
  /// (0 start / 1 center / 2 end), has_lines u8, [line_count u32, lines
1428
1438
  /// { x f32, baseline f32, text u32+bytes }] }. Lines carry the same
@@ -1435,6 +1445,9 @@ fn writeBinaryText(text: CanvasGpuText, writer: anytype) !void {
1435
1445
  try writeBinaryPoint(text.origin, writer);
1436
1446
  try writeBinaryColor(text.color, writer);
1437
1447
  try writeBinarySlice(text.text, writer);
1448
+ var lines: [max_packet_text_layout_lines]TextLine = undefined;
1449
+ const layout = if (text.text_layout) |options| packetTextLayout(text, options, &lines) else null;
1450
+ try writeBinaryPositionedText(text, layout, writer);
1438
1451
  const options = text.text_layout orelse {
1439
1452
  try writer.writeByte(0);
1440
1453
  return;
@@ -1452,14 +1465,13 @@ fn writeBinaryText(text: CanvasGpuText, writer: anytype) !void {
1452
1465
  .center => 1,
1453
1466
  .end => 2,
1454
1467
  });
1455
- var lines: [max_packet_text_layout_lines]TextLine = undefined;
1456
- const layout = packetTextLayout(text, options, &lines) orelse {
1468
+ const planned_layout = layout orelse {
1457
1469
  try writer.writeByte(0);
1458
1470
  return;
1459
1471
  };
1460
1472
  try writer.writeByte(1);
1461
- try writer.writeInt(u32, @intCast(layout.lines.len), .little);
1462
- for (layout.lines) |line| {
1473
+ try writer.writeInt(u32, @intCast(planned_layout.lines.len), .little);
1474
+ for (planned_layout.lines) |line| {
1463
1475
  // Elided lines ship painted bytes (kept prefix + ellipsis),
1464
1476
  // mirroring the JSON encoding, so both packet hosts draw the
1465
1477
  // measured extent verbatim.
@@ -1474,6 +1486,123 @@ fn writeBinaryText(text: CanvasGpuText, writer: anytype) !void {
1474
1486
  }
1475
1487
  }
1476
1488
 
1489
+ /// Resolve shaped glyphs onto the same final per-line positions the reference
1490
+ /// renderer uses. Packet hosts can draw these glyph indices directly instead
1491
+ /// of reshaping UTF-8 and discarding authoritative x/y placement. Elision
1492
+ /// markers are separate positioned text fragments because they are synthesized
1493
+ /// by layout and have no source glyph id.
1494
+ fn writeBinaryPositionedText(text: CanvasGpuText, layout: ?text_model.TextLayout, writer: anytype) !void {
1495
+ if (text.glyphs.len == 0) {
1496
+ try writer.writeByte(0);
1497
+ return;
1498
+ }
1499
+ try writer.writeByte(1);
1500
+
1501
+ var glyph_count: usize = 0;
1502
+ if (layout) |planned| {
1503
+ for (planned.lines) |line| {
1504
+ if (line.glyph_start >= text.glyphs.len) continue;
1505
+ glyph_count += @min(line.paintedGlyphLen(), text.glyphs.len - line.glyph_start);
1506
+ }
1507
+ } else {
1508
+ glyph_count = text.glyphs.len;
1509
+ }
1510
+ try writer.writeInt(u32, @intCast(glyph_count), .little);
1511
+
1512
+ const draw_text = packetDrawText(text);
1513
+ if (layout) |planned| {
1514
+ for (planned.lines) |line| {
1515
+ if (line.glyph_start >= text.glyphs.len) continue;
1516
+ const count = @min(line.paintedGlyphLen(), text.glyphs.len - line.glyph_start);
1517
+ if (count == 0) continue;
1518
+ const line_glyphs = text.glyphs[line.glyph_start..][0..count];
1519
+ const raw_bounds = text_model.textLineBounds(
1520
+ draw_text,
1521
+ line.text_start,
1522
+ line.paintedTextLen(),
1523
+ line.glyph_start,
1524
+ count,
1525
+ line.baseline,
1526
+ line.bounds.height,
1527
+ );
1528
+ const first_x = line_glyphs[0].x;
1529
+ const dx = line.bounds.x - raw_bounds.x;
1530
+ for (line_glyphs) |glyph| {
1531
+ try writeBinaryPositionedGlyph(
1532
+ text,
1533
+ glyph,
1534
+ text.origin.x + glyph.x - first_x + dx,
1535
+ line.baseline + glyph.y,
1536
+ writer,
1537
+ );
1538
+ }
1539
+ }
1540
+ } else {
1541
+ const first_x = text.glyphs[0].x;
1542
+ for (text.glyphs) |glyph| {
1543
+ try writeBinaryPositionedGlyph(
1544
+ text,
1545
+ glyph,
1546
+ text.origin.x + glyph.x - first_x,
1547
+ text.origin.y + glyph.y,
1548
+ writer,
1549
+ );
1550
+ }
1551
+ }
1552
+
1553
+ var fragment_count: usize = 0;
1554
+ if (layout) |planned| {
1555
+ for (planned.lines) |line| {
1556
+ const visible_glyphs = if (line.glyph_start < text.glyphs.len)
1557
+ @min(line.paintedGlyphLen(), text.glyphs.len - line.glyph_start)
1558
+ else
1559
+ 0;
1560
+ const start = @min(line.text_start, text.text.len);
1561
+ const end = @min(text.text.len, start + line.paintedTextLen());
1562
+ if ((visible_glyphs == 0 and end > start) or line.hasEllipsis()) fragment_count += 1;
1563
+ }
1564
+ }
1565
+ try writer.writeInt(u32, @intCast(fragment_count), .little);
1566
+ if (layout) |planned| {
1567
+ for (planned.lines) |line| {
1568
+ const visible_glyphs = if (line.glyph_start < text.glyphs.len)
1569
+ @min(line.paintedGlyphLen(), text.glyphs.len - line.glyph_start)
1570
+ else
1571
+ 0;
1572
+ const start = @min(line.text_start, text.text.len);
1573
+ const end = @min(text.text.len, start + line.paintedTextLen());
1574
+ const ellipsis = packetLineEllipsis(line);
1575
+ if (visible_glyphs != 0 and ellipsis.len == 0) continue;
1576
+ if (visible_glyphs == 0 and end == start and ellipsis.len == 0) continue;
1577
+ try writeBinaryF32(if (visible_glyphs == 0) line.bounds.x else line.bounds.maxX() - line.ellipsis_advance, writer);
1578
+ try writeBinaryF32(line.baseline, writer);
1579
+ if (visible_glyphs == 0) {
1580
+ try writer.writeInt(u32, @intCast(end - start + ellipsis.len), .little);
1581
+ try writer.writeAll(text.text[start..end]);
1582
+ try writer.writeAll(ellipsis);
1583
+ } else {
1584
+ try writeBinarySlice(ellipsis, writer);
1585
+ }
1586
+ }
1587
+ }
1588
+ }
1589
+
1590
+ fn writeBinaryPositionedGlyph(
1591
+ text: CanvasGpuText,
1592
+ glyph: Glyph,
1593
+ x: f32,
1594
+ baseline: f32,
1595
+ writer: anytype,
1596
+ ) !void {
1597
+ try writer.writeInt(u16, @intCast(glyph.id), .little);
1598
+ const has_font_override = glyph.font_id != 0;
1599
+ try writer.writeByte(if (has_font_override) 1 else 0);
1600
+ if (has_font_override) try writer.writeInt(u64, glyph.font_id, .little);
1601
+ try writeBinaryF32(x, writer);
1602
+ try writeBinaryF32(baseline, writer);
1603
+ try writeBinaryF32(text_model.estimatedGlyphAdvance(glyph, text.size), writer);
1604
+ }
1605
+
1477
1606
  /// Effect: tag u8 (1 shadow / 2 blur) + payload.
1478
1607
  fn writeBinaryEffect(effect: CanvasGpuEffect, writer: anytype) !void {
1479
1608
  switch (effect) {
@@ -2,6 +2,12 @@ const text_atlas = @import("text_atlas.zig");
2
2
  const text_layout = @import("text_layout.zig");
3
3
  const text_interaction = @import("text_interaction.zig");
4
4
 
5
+ /// Largest retained widget-text pool a view may expose. Text-event
6
+ /// sanitization and defensive single-line presentation share this ceiling
7
+ /// with the runtime so an insert the editor can accept is never too large for
8
+ /// those correctness seams to rewrite.
9
+ pub const max_widget_text_bytes_per_view: usize = 512 * 1024;
10
+
5
11
  pub const Glyph = text_atlas.Glyph;
6
12
  pub const GlyphAtlasKey = text_atlas.GlyphAtlasKey;
7
13
  pub const GlyphAtlasEntry = text_atlas.GlyphAtlasEntry;
@@ -94,6 +94,16 @@ pub fn designTokens(color_scheme: ColorScheme, contrast: ColorContrast) DesignTo
94
94
  // the primary ink under the active label (see the tabs
95
95
  // entries in `controlTokens` below).
96
96
  .tabs_indicator_thickness = 2,
97
+ // Primary Tabs are a 50px, full-width ruled row. Each
98
+ // trigger hugs 14px regular text with 2px shoulders and the
99
+ // list adds no pill-style outer inset; these fields are read
100
+ // only by the underline register, so house tabs keep their
101
+ // existing control ladder and 3px container hug.
102
+ .tabs_list_inset = 0,
103
+ .tabs_list_full_width = true,
104
+ .tabs_trigger_height = 50,
105
+ .tabs_trigger_inset = 2,
106
+ .tabs_label_size_step = 1,
97
107
  // The underline register's inter-trigger gap: measured at a
98
108
  // 24px flex gap between triggers on the reference strip
99
109
  // (28px optical once each trigger's 2px horizontal padding
@@ -333,17 +343,34 @@ fn highContrastDark() ColorTokens {
333
343
  }
334
344
 
335
345
  /// The pack's control tables: the treatments that are MORE than a
336
- /// palette swap. Geist's disabled register is a color SWAP (gray-100
337
- /// chip under gray-700 ink — the new disabled channels exist for
338
- /// exactly this), its destructive button is a FILLED error block
346
+ /// palette swap. Geist's main disabled register is a color SWAP
347
+ /// (gray-100 chip under gray-700 ink with a gray-400 edge), while its
348
+ /// tertiary button is that chip at half opacity with primary ink. Its
349
+ /// destructive button is a FILLED error block
339
350
  /// rather than the house quiet chip, and its floating surfaces sit on
340
351
  /// the 12px corner while controls hold 6.
341
352
  fn controlTokens(color_scheme: ColorScheme, contrast: ColorContrast) ControlTokens {
342
353
  const colors = colorTokens(color_scheme, contrast);
343
- // Disabled pair: gray-100 fill under gray-700 #8f8f8f ink, the same
344
- // hex in both schemes (the scales cross at their quiet middle).
354
+ // Disabled register: gray-100 fill under gray-700 #8f8f8f ink (the
355
+ // same hex in both schemes), with the solid gray-400 edge used by
356
+ // bordered variants.
345
357
  const disabled_background = colors.disabled;
346
358
  const disabled_foreground = Color.rgb8(143, 143, 143);
359
+ const disabled_border: ?Color = switch (contrast) {
360
+ .standard => switch (color_scheme) {
361
+ .light => Color.rgb8(235, 235, 235),
362
+ .dark => Color.rgb8(31, 31, 31),
363
+ },
364
+ // High contrast keeps its louder palette edge.
365
+ .high => null,
366
+ };
367
+ // Tertiary is the one exception in the reference: gray-100 and the
368
+ // primary ink are composited together at 50% over the page. The
369
+ // renderer's opacity is per command, so state the equivalent opaque
370
+ // pair here; glyph coverage then blends between the same two final
371
+ // colors as the reference layer.
372
+ const tertiary_disabled_background = compositeOver(colors.disabled, colors.background, 0.5);
373
+ const tertiary_disabled_foreground = compositeOver(colors.text, colors.background, 0.5);
347
374
  // The filled error button: solid red under white text, hover one
348
375
  // step deeper in light (red-900 #d8001b) and one step brighter in
349
376
  // dark (red-700 #f13242) — feedback moves TOWARD the scheme's ink.
@@ -380,6 +407,10 @@ fn controlTokens(color_scheme: ColorScheme, contrast: ColorContrast) ControlToke
380
407
  .disabled_background = disabled_background,
381
408
  .disabled_foreground = disabled_foreground,
382
409
  },
410
+ .button_ghost = .{
411
+ .disabled_background = tertiary_disabled_background,
412
+ .disabled_foreground = tertiary_disabled_foreground,
413
+ },
383
414
  .button_destructive = .{
384
415
  .background = destructive_rest,
385
416
  .hover_background = destructive_hover,
@@ -388,6 +419,7 @@ fn controlTokens(color_scheme: ColorScheme, contrast: ColorContrast) ControlToke
388
419
  .disabled_foreground = disabled_foreground,
389
420
  .stroke_width = 0,
390
421
  },
422
+ .button_disabled_border = disabled_border,
391
423
  // The slider is the one control whose fill keeps a hue in the
392
424
  // monochrome register: rail on gray-200, range in blue-700 (the
393
425
  // same #0072f5 step in both schemes), and a paper-white
@@ -503,3 +535,17 @@ fn controlTokens(color_scheme: ColorScheme, contrast: ColorContrast) ControlToke
503
535
  .panel = .{ .radius = surface_radius },
504
536
  };
505
537
  }
538
+
539
+ /// Composite one opaque theme color over another at `opacity`. Used for
540
+ /// Geist's tertiary disabled layer, whose reference opacity applies to
541
+ /// the whole chip while the current display list carries opacity on
542
+ /// individual commands.
543
+ fn compositeOver(foreground: Color, background: Color, opacity: f32) Color {
544
+ const alpha = std.math.clamp(opacity, 0, 1);
545
+ return Color.rgba(
546
+ foreground.r * alpha + background.r * (1 - alpha),
547
+ foreground.g * alpha + background.g * (1 - alpha),
548
+ foreground.b * alpha + background.b * (1 - alpha),
549
+ 1,
550
+ );
551
+ }
@@ -572,6 +572,21 @@ pub const ControlMetricTokens = struct {
572
572
  /// active trigger's label. Unused by the house `.pill` register —
573
573
  /// the default only matters once a theme opts into underlines.
574
574
  tabs_indicator_thickness: f32 = 2,
575
+ /// Geometry of an `.underline` tab strip. These values are ignored
576
+ /// by the house `.pill` register, whose container inset and trigger
577
+ /// sizing stay on the ordinary control ladder. An underline strip
578
+ /// uses a full-height 50px trigger, 2px of horizontal breathing room
579
+ /// around its content, no outer list inset, and a one-step lift from
580
+ /// the label type rung (13 -> 14 in the Geist pack).
581
+ tabs_list_inset: f32 = 0,
582
+ /// Whether a primary `.underline` TabsList expands across its parent.
583
+ /// Underline styling alone does not imply this layout policy: packs
584
+ /// opt in explicitly, so a custom underline theme keeps the authored
585
+ /// hug width unless it requests the full-width ruled-row treatment.
586
+ tabs_list_full_width: bool = false,
587
+ tabs_trigger_height: f32 = 50,
588
+ tabs_trigger_inset: f32 = 2,
589
+ tabs_label_size_step: f32 = 1,
575
590
  /// The inter-trigger gap of the `.underline` tab register (see
576
591
  /// `ControlTokens.tabs_indicator`), applied only when the author
577
592
  /// left the strip's gap at 0. Unused by the house `.pill` register —
@@ -1124,10 +1139,12 @@ pub const ControlVisualTokens = struct {
1124
1139
  /// `active_background`, then to the state-formula washes — so a
1125
1140
  /// theme that wants press and on-state to differ states both.
1126
1141
  pressed_background: ?Color = null,
1127
- /// Disabled fill and ink. Null keeps the half-strength wash
1128
- /// register (`StateTokens.disabled_alpha` over the rest colors);
1129
- /// themes whose disabled treatment is a color SWAP (a flat gray
1130
- /// chip under gray text) state the pair here.
1142
+ /// Disabled fill and ink. Null keeps the house treatment:
1143
+ /// the rest color at `StateTokens.disabled_alpha`, except that a
1144
+ /// filled primary precomposites its knockout ink over the page at
1145
+ /// that strength so the label does not double-fade through the
1146
+ /// already-muted fill. Themes whose disabled treatment is a color
1147
+ /// SWAP (a flat gray chip under gray text) state the pair here.
1131
1148
  disabled_background: ?Color = null,
1132
1149
  disabled_foreground: ?Color = null,
1133
1150
  foreground: ?Color = null,
@@ -1147,6 +1164,11 @@ pub const ControlTokens = struct {
1147
1164
  button_outline: ControlVisualTokens = .{},
1148
1165
  button_ghost: ControlVisualTokens = .{},
1149
1166
  button_destructive: ControlVisualTokens = .{},
1167
+ /// Shared disabled edge for the button variants that retain an
1168
+ /// outline. Filled variants drop their implicit edge so their disabled
1169
+ /// body alone defines the silhouette; ghost remains borderless. Null
1170
+ /// keeps the house opacity wash.
1171
+ button_disabled_border: ?Color = null,
1150
1172
  toggle_button: ControlVisualTokens = .{},
1151
1173
  accordion: ControlVisualTokens = .{},
1152
1174
  alert: ControlVisualTokens = .{},
@@ -1381,6 +1403,11 @@ pub const ControlMetricTokenOverrides = struct {
1381
1403
  slider_thumb_width: ?f32 = null,
1382
1404
  slider_thumb_height: ?f32 = null,
1383
1405
  tabs_indicator_thickness: ?f32 = null,
1406
+ tabs_list_inset: ?f32 = null,
1407
+ tabs_list_full_width: ?bool = null,
1408
+ tabs_trigger_height: ?f32 = null,
1409
+ tabs_trigger_inset: ?f32 = null,
1410
+ tabs_label_size_step: ?f32 = null,
1384
1411
  tabs_gap: ?f32 = null,
1385
1412
  button_group_gap: ?f32 = null,
1386
1413
  spinner_style: ?SpinnerStyleToken = null,
@@ -1528,6 +1555,7 @@ pub const ControlTokenOverrides = struct {
1528
1555
  button_outline: ControlVisualTokenOverrides = .{},
1529
1556
  button_ghost: ControlVisualTokenOverrides = .{},
1530
1557
  button_destructive: ControlVisualTokenOverrides = .{},
1558
+ button_disabled_border: ?Color = null,
1531
1559
  toggle_button: ControlVisualTokenOverrides = .{},
1532
1560
  accordion: ControlVisualTokenOverrides = .{},
1533
1561
  alert: ControlVisualTokenOverrides = .{},
@@ -1576,6 +1604,7 @@ pub const ControlTokenOverrides = struct {
1576
1604
  next.button_outline = self.button_outline.apply(next.button_outline);
1577
1605
  next.button_ghost = self.button_ghost.apply(next.button_ghost);
1578
1606
  next.button_destructive = self.button_destructive.apply(next.button_destructive);
1607
+ if (self.button_disabled_border) |button_disabled_border| next.button_disabled_border = button_disabled_border;
1579
1608
  next.toggle_button = self.toggle_button.apply(next.toggle_button);
1580
1609
  next.accordion = self.accordion.apply(next.accordion);
1581
1610
  next.alert = self.alert.apply(next.alert);