@native-sdk/cli 0.7.1 → 0.8.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/build/app.zig +273 -65
- package/build/ts_run.mjs +6 -8
- package/build.zig +341 -361
- package/native-sdk.d.ts +6 -3
- package/package.json +13 -11
- package/packages/core/compile-surface/core.ts +559 -0
- package/packages/core/package-lock.json +375 -12
- package/packages/core/package.json +9 -6
- package/packages/core/scripts/compiler_typecheck.mjs +58 -0
- package/packages/core/scripts/gen_case_tables.mjs +130 -0
- package/packages/core/scripts/gen_declarations.mjs +97 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +108 -0
- package/packages/core/scripts/stage_external_core.mjs +148 -0
- package/packages/core/sdk/core.d.ts +363 -0
- package/packages/core/sdk/events.d.ts +65 -0
- package/packages/core/sdk/text.d.ts +51 -0
- package/packages/core/src/checker.ts +3 -3
- package/packages/core/src/cli.ts +40 -38
- package/packages/core/src/contract.ts +749 -0
- package/packages/core/src/devhost.ts +4 -3
- package/packages/core/src/diagnostics.ts +5 -7
- package/packages/core/src/{transpile.ts → frontend.ts} +38 -50
- package/packages/core/src/infer.ts +1 -1
- package/packages/core/src/typed_ast.ts +16 -15
- package/packages/core/src/wyhash.ts +79 -0
- package/skill-data/native-ui/SKILL.md +4 -2
- package/skill-data/ts-core/SKILL.md +29 -29
- package/src/platform/macos/appkit_host.m +51 -3
- package/src/platform/types.zig +4 -0
- package/src/platform/windows/gpu_surface_renderer.cpp +2280 -0
- package/src/platform/windows/gpu_surface_renderer.h +86 -0
- package/src/platform/windows/root.zig +298 -20
- package/src/platform/windows/webview2_host.cpp +343 -33
- package/src/primitives/canvas/code.zig +50 -0
- package/src/primitives/canvas/code_tests.zig +174 -1
- package/src/primitives/canvas/frame.zig +45 -1
- package/src/primitives/canvas/gpu.zig +6 -0
- package/src/primitives/canvas/render_tests.zig +93 -0
- package/src/primitives/canvas/root.zig +2 -0
- package/src/primitives/canvas/serialization.zig +150 -21
- package/src/primitives/canvas/themes/geist.zig +51 -5
- package/src/primitives/canvas/tokens.zig +33 -4
- package/src/primitives/canvas/ui.zig +52 -7
- package/src/primitives/canvas/ui_markup.zig +38 -1
- package/src/primitives/canvas/ui_markup_compiled.zig +28 -0
- package/src/primitives/canvas/ui_markup_contract.zig +9 -0
- package/src/primitives/canvas/ui_markup_view.zig +28 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +10 -2
- package/src/primitives/canvas/ui_schema.zig +5 -0
- package/src/primitives/canvas/ui_schema_tests.zig +4 -3
- package/src/primitives/canvas/ui_tests.zig +14 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +513 -13
- package/src/primitives/canvas/widget_invalidation.zig +11 -1
- package/src/primitives/canvas/widget_layout.zig +260 -21
- package/src/primitives/canvas/widget_metrics.zig +45 -9
- package/src/primitives/canvas/widget_render.zig +220 -70
- package/src/primitives/canvas/widget_render_controls.zig +79 -21
- package/src/primitives/canvas/widget_render_style.zig +52 -8
- package/src/primitives/canvas/widget_text_input.zig +2 -0
- package/src/primitives/canvas/widgets.zig +53 -2
- package/src/runtime/canvas_frame.zig +60 -7
- package/src/runtime/canvas_frame_invalidation_tests.zig +80 -0
- package/src/runtime/canvas_frame_packet_tests.zig +83 -9
- package/src/runtime/canvas_frame_patch_tests.zig +16 -0
- package/src/runtime/canvas_images.zig +8 -2
- package/src/runtime/canvas_widget_clipboard_tests.zig +1 -1
- package/src/runtime/canvas_widget_runtime.zig +11 -8
- package/src/runtime/effects.zig +6 -0
- package/src/runtime/effects_tests.zig +30 -0
- package/src/runtime/gpu_surface_events.zig +38 -7
- package/src/runtime/media_surface_tests.zig +1 -1
- package/src/runtime/runtime_event_tests.zig +74 -0
- package/src/runtime/ts_core_host.zig +38 -38
- package/src/runtime/ts_ui_app.zig +12 -12
- package/src/runtime/ui_app.zig +10 -8
- package/src/runtime/ui_app_tests.zig +67 -0
- package/src/runtime/view.zig +6 -0
- package/src/runtime/view_canvas.zig +15 -0
- package/src/runtime/view_widget_text.zig +6 -4
- package/src/runtime/window_view_runtime.zig +1 -0
- package/src/tooling/manifest.zig +32 -0
- package/src/tooling/raw_manifest.zig +4 -0
- package/src/tooling/templates.zig +34 -26
- package/src/tooling/ts_core.zig +55 -34
- package/src/tooling/verbs.zig +1 -1
- package/tools/corewire/core_abi.zig +169 -0
- package/tools/corewire/emit.zig +2418 -0
- package/tools/corewire/emit_facade.zig +3984 -0
- package/tools/corewire/emit_profile.zig +501 -0
- package/tools/corewire/main.zig +561 -0
- package/tools/corewire/shim_rt.zig +632 -0
- package/tools/corewire/sidecar.zig +2507 -0
- package/packages/core/rt/rt.zig +0 -1986
- package/packages/core/src/emitter.ts +0 -11898
|
@@ -1141,6 +1141,7 @@ fn emitCodeEditorWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1141
1141
|
.fill = colorFill(tokens.colors.surface_subtle),
|
|
1142
1142
|
});
|
|
1143
1143
|
}
|
|
1144
|
+
try emitVisibleCodeTextSpansWidget(builder, widget, tokens, widget.frame, .{});
|
|
1144
1145
|
if (selection_range) |range| {
|
|
1145
1146
|
if (!range.isCollapsed(widget.text.len)) {
|
|
1146
1147
|
try widget_render_controls.emitWidgetTextSelectionRects(
|
|
@@ -1156,7 +1157,6 @@ fn emitCodeEditorWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1156
1157
|
);
|
|
1157
1158
|
}
|
|
1158
1159
|
}
|
|
1159
|
-
try emitVisibleCodeTextSpansWidget(builder, widget, tokens, widget.frame, .{});
|
|
1160
1160
|
if (selection_range) |range| {
|
|
1161
1161
|
if (!range.isCollapsed(widget.text.len)) {
|
|
1162
1162
|
try emitCodeEditorSelectedGlyphs(
|
|
@@ -1204,7 +1204,7 @@ fn emitCodeEditorWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1204
1204
|
// duplicate the retained line-number command IDs and place a second set
|
|
1205
1205
|
// of markers at logical-line rather than visual-row positions.
|
|
1206
1206
|
if (widget.text_no_wrap) {
|
|
1207
|
-
try
|
|
1207
|
+
try emitVisibleEditableCodeGutter(builder, widget, tokens, widget.frame, active_row);
|
|
1208
1208
|
}
|
|
1209
1209
|
try builder.popClip();
|
|
1210
1210
|
}
|
|
@@ -1309,7 +1309,7 @@ fn emitTextSpansWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1309
1309
|
&runs,
|
|
1310
1310
|
);
|
|
1311
1311
|
|
|
1312
|
-
try
|
|
1312
|
+
try emitCodeLineDecorations(builder, widget, widget.spans, tokens, content, widget.frame, layout_options, null, true);
|
|
1313
1313
|
// Span background highlights (intra-line diff emphasis): one
|
|
1314
1314
|
// full-line-height rect per run, the same geometry selection rects
|
|
1315
1315
|
// use, painted before selection and glyphs. Edge-snapped rects of
|
|
@@ -1538,7 +1538,7 @@ fn emitVisibleCodeTextSpansWidget(
|
|
|
1538
1538
|
if (!budget.hasCommand(builder)) return;
|
|
1539
1539
|
|
|
1540
1540
|
if (paint.selection_ordinal == null) {
|
|
1541
|
-
try
|
|
1541
|
+
try emitCodeLineDecorations(builder, widget, spans, tokens, content, visible_bounds, layout_options, &budget, true);
|
|
1542
1542
|
try emitStaticTextSelectionBounded(builder, widget, tokens, budget.command_ceiling);
|
|
1543
1543
|
}
|
|
1544
1544
|
if (!budget.hasCommand(builder) or budget.remainingText() == 0) return;
|
|
@@ -1634,7 +1634,7 @@ fn emitVisibleWrappedEditableCodeLines(
|
|
|
1634
1634
|
if (paint.selection_ordinal == null) {
|
|
1635
1635
|
var gutter_content = content;
|
|
1636
1636
|
gutter_content.x += widget.value_x;
|
|
1637
|
-
try
|
|
1637
|
+
try emitCodeLineDecorations(
|
|
1638
1638
|
builder,
|
|
1639
1639
|
widget,
|
|
1640
1640
|
widget.spans,
|
|
@@ -1643,6 +1643,7 @@ fn emitVisibleWrappedEditableCodeLines(
|
|
|
1643
1643
|
visible_bounds,
|
|
1644
1644
|
layout_options,
|
|
1645
1645
|
&budget,
|
|
1646
|
+
true,
|
|
1646
1647
|
);
|
|
1647
1648
|
}
|
|
1648
1649
|
if (!budget.hasCommand(builder) or budget.remainingText() == 0) return;
|
|
@@ -1822,6 +1823,19 @@ fn emitVisibleEditableCodeLines(
|
|
|
1822
1823
|
|
|
1823
1824
|
var budget = CodeEmissionBudget.init(builder);
|
|
1824
1825
|
if (!budget.hasCommand(builder)) return;
|
|
1826
|
+
if (paint.selection_ordinal == null) {
|
|
1827
|
+
try emitCodeLineDecorations(
|
|
1828
|
+
builder,
|
|
1829
|
+
widget,
|
|
1830
|
+
widget.spans,
|
|
1831
|
+
tokens,
|
|
1832
|
+
content,
|
|
1833
|
+
visible_bounds,
|
|
1834
|
+
layout_options,
|
|
1835
|
+
&budget,
|
|
1836
|
+
false,
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1825
1839
|
var line_runs: [text_spans_model.max_text_span_runs_per_paragraph]text_spans_model.TextSpanRun = undefined;
|
|
1826
1840
|
|
|
1827
1841
|
while (line_start <= widget.text.len and logical_line <= last_line) : (logical_line += 1) {
|
|
@@ -1898,17 +1912,19 @@ fn emitVisibleEditableCodeLines(
|
|
|
1898
1912
|
}
|
|
1899
1913
|
|
|
1900
1914
|
/// The editable no-wrap code path scrolls source glyphs beneath a pinned
|
|
1901
|
-
///
|
|
1902
|
-
/// decoration, and the caret all disappear cleanly behind its opaque
|
|
1903
|
-
/// surface instead of clashing with the anchored
|
|
1904
|
-
fn
|
|
1915
|
+
/// number/diff-marker gutter. Paint that gutter last so source, selection,
|
|
1916
|
+
/// IME decoration, and the caret all disappear cleanly behind its opaque
|
|
1917
|
+
/// surface instead of clashing with the anchored decorations.
|
|
1918
|
+
fn emitVisibleEditableCodeGutter(
|
|
1905
1919
|
builder: *Builder,
|
|
1906
1920
|
widget: Widget,
|
|
1907
1921
|
tokens: DesignTokens,
|
|
1908
1922
|
visible_bounds: geometry.RectF,
|
|
1909
1923
|
active_row: ?geometry.RectF,
|
|
1910
1924
|
) Error!void {
|
|
1911
|
-
|
|
1925
|
+
const has_diff = widget.hasCodeDiff();
|
|
1926
|
+
const line_number_digits = widget.codeLineNumberDigits();
|
|
1927
|
+
if (line_number_digits == 0 and !has_diff) return;
|
|
1912
1928
|
|
|
1913
1929
|
var content = widget_metrics.widgetTextSpanContentFrame(widget, tokens);
|
|
1914
1930
|
content.y -= widget.value;
|
|
@@ -1972,33 +1988,71 @@ fn emitVisibleEditableCodeLineNumberGutter(
|
|
|
1972
1988
|
const line_top = content.y + @as(f32, @floatFromInt(logical_line)) * line_height;
|
|
1973
1989
|
const marker_bounds = geometry.RectF.init(padded.x, line_top, marker_width, line_height);
|
|
1974
1990
|
if (marker_bounds.intersects(visible_bounds)) {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1991
|
+
const one_based_line = logical_line + 1;
|
|
1992
|
+
if (codeDiffKind(widget, one_based_line)) |kind| {
|
|
1993
|
+
const diff_gutter = geometry.RectF.intersection(
|
|
1994
|
+
gutter_bounds,
|
|
1995
|
+
geometry.RectF.init(gutter_bounds.x, line_top, gutter_bounds.width, line_height),
|
|
1996
|
+
);
|
|
1997
|
+
if (!diff_gutter.isEmpty()) {
|
|
1998
|
+
try builder.fillRect(.{
|
|
1999
|
+
.id = codeDiffGutterBackgroundCommandId(widget.id, one_based_line),
|
|
2000
|
+
.rect = pixelSnapGeometryRect(tokens, diff_gutter),
|
|
2001
|
+
.fill = colorFill(codeDiffBackground(tokens, kind)),
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
const marker = switch (kind) {
|
|
2005
|
+
.added => "+",
|
|
2006
|
+
.removed => "-",
|
|
2007
|
+
};
|
|
1983
2008
|
try builder.drawText(.{
|
|
1984
|
-
.id =
|
|
2009
|
+
.id = codeDiffMarkerCommandId(widget.id, one_based_line),
|
|
1985
2010
|
.font_id = tokens.typography.mono_font_id,
|
|
1986
2011
|
.size = layout_options.size,
|
|
1987
2012
|
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(
|
|
1988
2013
|
padded.x,
|
|
1989
2014
|
line_top + layout_options.size,
|
|
1990
2015
|
)),
|
|
1991
|
-
.color = tokens
|
|
1992
|
-
.text =
|
|
2016
|
+
.color = codeDiffForeground(tokens, kind),
|
|
2017
|
+
.text = marker,
|
|
1993
2018
|
.text_layout = .{
|
|
1994
2019
|
.max_width = marker_width,
|
|
1995
2020
|
.line_height = line_height,
|
|
1996
2021
|
.wrap = .none,
|
|
1997
|
-
.alignment = .
|
|
2022
|
+
.alignment = .start,
|
|
1998
2023
|
.measure = tokens.text_measure,
|
|
1999
2024
|
},
|
|
2000
2025
|
});
|
|
2001
2026
|
}
|
|
2027
|
+
if (line_number_digits != 0) {
|
|
2028
|
+
var marker_buffer: [20]u8 = undefined;
|
|
2029
|
+
const marker_formatted = std.fmt.bufPrint(
|
|
2030
|
+
&marker_buffer,
|
|
2031
|
+
"{d}",
|
|
2032
|
+
.{one_based_line},
|
|
2033
|
+
) catch "";
|
|
2034
|
+
const marker_text = builder.allocTextBytes(marker_formatted) catch "";
|
|
2035
|
+
if (marker_text.len > 0) {
|
|
2036
|
+
try builder.drawText(.{
|
|
2037
|
+
.id = codeLineNumberCommandId(widget.id, one_based_line),
|
|
2038
|
+
.font_id = tokens.typography.mono_font_id,
|
|
2039
|
+
.size = layout_options.size,
|
|
2040
|
+
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(
|
|
2041
|
+
padded.x,
|
|
2042
|
+
line_top + layout_options.size,
|
|
2043
|
+
)),
|
|
2044
|
+
.color = tokens.colors.text_muted,
|
|
2045
|
+
.text = marker_text,
|
|
2046
|
+
.text_layout = .{
|
|
2047
|
+
.max_width = marker_width,
|
|
2048
|
+
.line_height = line_height,
|
|
2049
|
+
.wrap = .none,
|
|
2050
|
+
.alignment = .end,
|
|
2051
|
+
.measure = tokens.text_measure,
|
|
2052
|
+
},
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2002
2056
|
}
|
|
2003
2057
|
|
|
2004
2058
|
const newline = std.mem.indexOfScalarPos(u8, widget.text, line_start, '\n') orelse break;
|
|
@@ -2006,11 +2060,49 @@ fn emitVisibleEditableCodeLineNumberGutter(
|
|
|
2006
2060
|
}
|
|
2007
2061
|
}
|
|
2008
2062
|
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2063
|
+
const CodeDiffKind = enum { added, removed };
|
|
2064
|
+
|
|
2065
|
+
fn codeDiffKind(widget: Widget, logical_line: usize) ?CodeDiffKind {
|
|
2066
|
+
if (logical_line == 0 or logical_line > code_model.max_diff_lines) return null;
|
|
2067
|
+
const lines = widget.codeDiffLines() orelse return null;
|
|
2068
|
+
const shift: u7 = @intCast(logical_line - 1);
|
|
2069
|
+
const bit = @as(u128, 1) << shift;
|
|
2070
|
+
if (lines.added & bit != 0) return .added;
|
|
2071
|
+
if (lines.removed & bit != 0) return .removed;
|
|
2072
|
+
return null;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
fn codeDiffBackground(tokens: DesignTokens, kind: CodeDiffKind) Color {
|
|
2076
|
+
// Geist publishes these as component states rather than general-purpose
|
|
2077
|
+
// surface roles. Both built-in packs share the exact pair; background
|
|
2078
|
+
// luminance keeps custom light/dark palettes on the matching register.
|
|
2079
|
+
const background = tokens.colors.background;
|
|
2080
|
+
const dark = background.r * 0.2126 + background.g * 0.7152 + background.b * 0.0722 < 0.5;
|
|
2081
|
+
return if (dark)
|
|
2082
|
+
switch (kind) {
|
|
2083
|
+
.added => Color.rgb8(18, 54, 27),
|
|
2084
|
+
.removed => Color.rgb8(86, 26, 30),
|
|
2085
|
+
}
|
|
2086
|
+
else switch (kind) {
|
|
2087
|
+
.added => Color.rgb8(218, 246, 218),
|
|
2088
|
+
.removed => Color.rgb8(255, 230, 230),
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
fn codeDiffForeground(tokens: DesignTokens, kind: CodeDiffKind) Color {
|
|
2093
|
+
return canvas.colorTokenValue(tokens.colors, switch (kind) {
|
|
2094
|
+
.added => .syntax_literal,
|
|
2095
|
+
.removed => .syntax_property,
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
/// Geist-style diff washes/markers plus muted logical-line numbers for one
|
|
2100
|
+
/// coherent code paragraph. Each logical line is measured independently
|
|
2101
|
+
/// with the same monospace layout options; summing wrapped extents keeps the
|
|
2102
|
+
/// next marker paired with its source. `draw_gutter=false` is the first pass
|
|
2103
|
+
/// of a horizontally scrolling editor: it paints the wash before source,
|
|
2104
|
+
/// while the pinned gutter redraws its marker and number last.
|
|
2105
|
+
fn emitCodeLineDecorations(
|
|
2014
2106
|
builder: *Builder,
|
|
2015
2107
|
widget: Widget,
|
|
2016
2108
|
spans: []const text_spans_model.TextSpan,
|
|
@@ -2019,8 +2111,11 @@ fn emitCodeLineNumberGutter(
|
|
|
2019
2111
|
visible_bounds: geometry.RectF,
|
|
2020
2112
|
layout_options: text_spans_model.TextSpanLayoutOptions,
|
|
2021
2113
|
budget: ?*CodeEmissionBudget,
|
|
2114
|
+
draw_gutter: bool,
|
|
2022
2115
|
) Error!void {
|
|
2023
|
-
|
|
2116
|
+
const has_diff = widget.hasCodeDiff();
|
|
2117
|
+
const line_number_digits = widget.codeLineNumberDigits();
|
|
2118
|
+
if (!has_diff and (line_number_digits == 0 or !draw_gutter)) return;
|
|
2024
2119
|
const line_height = text_spans_model.textSpanLineHeight(spans, layout_options);
|
|
2025
2120
|
if (line_height <= 0 or !std.math.isFinite(line_height)) return;
|
|
2026
2121
|
|
|
@@ -2036,48 +2131,8 @@ fn emitCodeLineNumberGutter(
|
|
|
2036
2131
|
if (line_start == widget.text.len and widget.text.len > 0 and !widget.code_editor) break;
|
|
2037
2132
|
const newline = std.mem.indexOfScalarPos(u8, widget.text, line_start, '\n');
|
|
2038
2133
|
const line_end = newline orelse widget.text.len;
|
|
2039
|
-
const baseline = content.y + layout_options.size +
|
|
2040
|
-
@as(f32, @floatFromInt(visual_line)) * line_height;
|
|
2041
|
-
const marker_bounds = geometry.RectF.init(
|
|
2042
|
-
padded.x,
|
|
2043
|
-
baseline - layout_options.size,
|
|
2044
|
-
marker_width,
|
|
2045
|
-
line_height,
|
|
2046
|
-
);
|
|
2047
|
-
if (marker_bounds.intersects(visible_bounds)) {
|
|
2048
|
-
var marker_buffer: [20]u8 = undefined;
|
|
2049
|
-
const marker_formatted = std.fmt.bufPrint(
|
|
2050
|
-
&marker_buffer,
|
|
2051
|
-
"{d}",
|
|
2052
|
-
.{logical_line},
|
|
2053
|
-
) catch "";
|
|
2054
|
-
const marker_text = builder.allocTextBytes(marker_formatted) catch "";
|
|
2055
|
-
if (budget) |admission| {
|
|
2056
|
-
if (!admission.hasCommand(builder)) return;
|
|
2057
|
-
if (marker_text.len > admission.remainingText()) return;
|
|
2058
|
-
}
|
|
2059
|
-
try builder.drawText(.{
|
|
2060
|
-
.id = codeLineNumberCommandId(widget.id, logical_line),
|
|
2061
|
-
.font_id = tokens.typography.mono_font_id,
|
|
2062
|
-
.size = layout_options.size,
|
|
2063
|
-
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(padded.x, baseline)),
|
|
2064
|
-
.color = tokens.colors.text_muted,
|
|
2065
|
-
.text = marker_text,
|
|
2066
|
-
.text_layout = .{
|
|
2067
|
-
.max_width = marker_width,
|
|
2068
|
-
.line_height = line_height,
|
|
2069
|
-
.wrap = .none,
|
|
2070
|
-
.alignment = .end,
|
|
2071
|
-
.measure = tokens.text_measure,
|
|
2072
|
-
},
|
|
2073
|
-
});
|
|
2074
|
-
if (budget) |admission| admission.chargeText(marker_text.len);
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
2134
|
const line = widget.text[line_start..line_end];
|
|
2078
|
-
if (line.len == 0) {
|
|
2079
|
-
visual_line += 1;
|
|
2080
|
-
} else {
|
|
2135
|
+
const visual_count = if (line.len == 0) 1 else blk: {
|
|
2081
2136
|
const line_spans = [_]text_spans_model.TextSpan{.{
|
|
2082
2137
|
.text = line,
|
|
2083
2138
|
.monospace = true,
|
|
@@ -2088,8 +2143,91 @@ fn emitCodeLineNumberGutter(
|
|
|
2088
2143
|
layout_options,
|
|
2089
2144
|
&line_runs,
|
|
2090
2145
|
);
|
|
2091
|
-
|
|
2146
|
+
break :blk @max(1, line_layout.line_count);
|
|
2147
|
+
};
|
|
2148
|
+
const baseline = content.y + layout_options.size +
|
|
2149
|
+
@as(f32, @floatFromInt(visual_line)) * line_height;
|
|
2150
|
+
const row_bounds = geometry.RectF.init(
|
|
2151
|
+
widget.frame.x,
|
|
2152
|
+
baseline - layout_options.size,
|
|
2153
|
+
widget.frame.width,
|
|
2154
|
+
@as(f32, @floatFromInt(visual_count)) * line_height,
|
|
2155
|
+
);
|
|
2156
|
+
const diff_kind = codeDiffKind(widget, logical_line);
|
|
2157
|
+
if (diff_kind) |kind| {
|
|
2158
|
+
const visible_row = geometry.RectF.intersection(row_bounds, visible_bounds);
|
|
2159
|
+
if (!visible_row.isEmpty()) {
|
|
2160
|
+
if (budget) |admission| if (!admission.hasCommand(builder)) return;
|
|
2161
|
+
try builder.fillRect(.{
|
|
2162
|
+
.id = codeDiffBackgroundCommandId(widget.id, logical_line),
|
|
2163
|
+
.rect = pixelSnapGeometryRect(tokens, visible_row),
|
|
2164
|
+
.fill = colorFill(codeDiffBackground(tokens, kind)),
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
const marker_bounds = geometry.RectF.init(
|
|
2169
|
+
padded.x,
|
|
2170
|
+
baseline - layout_options.size,
|
|
2171
|
+
marker_width,
|
|
2172
|
+
line_height,
|
|
2173
|
+
);
|
|
2174
|
+
if (draw_gutter and marker_bounds.intersects(visible_bounds)) {
|
|
2175
|
+
if (diff_kind) |kind| {
|
|
2176
|
+
if (budget) |admission| {
|
|
2177
|
+
if (!admission.hasCommand(builder) or admission.remainingText() == 0) return;
|
|
2178
|
+
}
|
|
2179
|
+
const marker = switch (kind) {
|
|
2180
|
+
.added => "+",
|
|
2181
|
+
.removed => "-",
|
|
2182
|
+
};
|
|
2183
|
+
try builder.drawText(.{
|
|
2184
|
+
.id = codeDiffMarkerCommandId(widget.id, logical_line),
|
|
2185
|
+
.font_id = tokens.typography.mono_font_id,
|
|
2186
|
+
.size = layout_options.size,
|
|
2187
|
+
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(padded.x, baseline)),
|
|
2188
|
+
.color = codeDiffForeground(tokens, kind),
|
|
2189
|
+
.text = marker,
|
|
2190
|
+
.text_layout = .{
|
|
2191
|
+
.max_width = marker_width,
|
|
2192
|
+
.line_height = line_height,
|
|
2193
|
+
.wrap = .none,
|
|
2194
|
+
.alignment = .start,
|
|
2195
|
+
.measure = tokens.text_measure,
|
|
2196
|
+
},
|
|
2197
|
+
});
|
|
2198
|
+
if (budget) |admission| admission.chargeText(marker.len);
|
|
2199
|
+
}
|
|
2200
|
+
if (line_number_digits != 0) {
|
|
2201
|
+
var marker_buffer: [20]u8 = undefined;
|
|
2202
|
+
const marker_formatted = std.fmt.bufPrint(
|
|
2203
|
+
&marker_buffer,
|
|
2204
|
+
"{d}",
|
|
2205
|
+
.{logical_line},
|
|
2206
|
+
) catch "";
|
|
2207
|
+
const marker_text = builder.allocTextBytes(marker_formatted) catch "";
|
|
2208
|
+
if (budget) |admission| {
|
|
2209
|
+
if (!admission.hasCommand(builder)) return;
|
|
2210
|
+
if (marker_text.len > admission.remainingText()) return;
|
|
2211
|
+
}
|
|
2212
|
+
try builder.drawText(.{
|
|
2213
|
+
.id = codeLineNumberCommandId(widget.id, logical_line),
|
|
2214
|
+
.font_id = tokens.typography.mono_font_id,
|
|
2215
|
+
.size = layout_options.size,
|
|
2216
|
+
.origin = pixelSnapTextPoint(tokens, geometry.PointF.init(padded.x, baseline)),
|
|
2217
|
+
.color = tokens.colors.text_muted,
|
|
2218
|
+
.text = marker_text,
|
|
2219
|
+
.text_layout = .{
|
|
2220
|
+
.max_width = marker_width,
|
|
2221
|
+
.line_height = line_height,
|
|
2222
|
+
.wrap = .none,
|
|
2223
|
+
.alignment = .end,
|
|
2224
|
+
.measure = tokens.text_measure,
|
|
2225
|
+
},
|
|
2226
|
+
});
|
|
2227
|
+
if (budget) |admission| admission.chargeText(marker_text.len);
|
|
2228
|
+
}
|
|
2092
2229
|
}
|
|
2230
|
+
visual_line += visual_count;
|
|
2093
2231
|
if (newline == null) break;
|
|
2094
2232
|
line_start = line_end + 1;
|
|
2095
2233
|
}
|
|
@@ -2171,6 +2309,18 @@ fn codeLineNumberGutterCommandId(widget_id: ObjectId) ObjectId {
|
|
|
2171
2309
|
return textSpanCommandId(0x5eed_59a2_0000_0015, widget_id, 0);
|
|
2172
2310
|
}
|
|
2173
2311
|
|
|
2312
|
+
fn codeDiffBackgroundCommandId(widget_id: ObjectId, logical_line: usize) ObjectId {
|
|
2313
|
+
return textSpanCommandId(0x5eed_59a2_0000_0019, widget_id, logical_line);
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
fn codeDiffGutterBackgroundCommandId(widget_id: ObjectId, logical_line: usize) ObjectId {
|
|
2317
|
+
return textSpanCommandId(0x5eed_59a2_0000_001b, widget_id, logical_line);
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
fn codeDiffMarkerCommandId(widget_id: ObjectId, logical_line: usize) ObjectId {
|
|
2321
|
+
return textSpanCommandId(0x5eed_59a2_0000_001a, widget_id, logical_line);
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2174
2324
|
fn codeEditorActiveRowCommandId(widget_id: ObjectId, ordinal: usize) ObjectId {
|
|
2175
2325
|
return textSpanCommandId(0x5eed_59a2_0000_0016, widget_id, ordinal);
|
|
2176
2326
|
}
|
|
@@ -46,6 +46,10 @@ const textInputClearButtonRect = widget_text_input.textInputClearButtonRect;
|
|
|
46
46
|
const widgetButtonTextSize = widget_metrics.widgetButtonTextSize;
|
|
47
47
|
const widgetBodyTextSize = widget_metrics.widgetBodyTextSize;
|
|
48
48
|
const widgetLabelTextSize = widget_metrics.widgetLabelTextSize;
|
|
49
|
+
const widgetTabTriggerTextSize = widget_metrics.widgetTabTriggerTextSize;
|
|
50
|
+
const widgetTabTriggerInset = widget_metrics.widgetTabTriggerInset;
|
|
51
|
+
const widgetTabTriggerIconExtent = widget_metrics.widgetTabTriggerIconExtent;
|
|
52
|
+
const widgetTabTriggerIconGap = widget_metrics.widgetTabTriggerIconGap;
|
|
49
53
|
const widgetTypographySize = widget_metrics.widgetTypographySize;
|
|
50
54
|
const widgetButtonInset = widget_metrics.widgetButtonInset;
|
|
51
55
|
const widgetControlInset = widget_metrics.widgetControlInset;
|
|
@@ -842,7 +846,7 @@ pub fn emitListItemWidget(builder: *Builder, widget: Widget, tokens: DesignToken
|
|
|
842
846
|
if (icon) |resolved| {
|
|
843
847
|
const icon_extent = widgetRowIconExtent(widget, tokens);
|
|
844
848
|
const icon_frame = geometry.RectF.init(
|
|
845
|
-
|
|
849
|
+
text_frame.x + text_inset,
|
|
846
850
|
widget.frame.y + (widget.frame.height - icon_extent) * 0.5,
|
|
847
851
|
icon_extent,
|
|
848
852
|
icon_extent,
|
|
@@ -850,9 +854,9 @@ pub fn emitListItemWidget(builder: *Builder, widget: Widget, tokens: DesignToken
|
|
|
850
854
|
try emitVectorIcon(builder, widget.id, 4, icon_frame, content_color, resolved);
|
|
851
855
|
const shift = icon_extent + widgetRowIconGap(widget, tokens);
|
|
852
856
|
text_frame = geometry.RectF.init(
|
|
853
|
-
|
|
857
|
+
text_frame.x + shift,
|
|
854
858
|
widget.frame.y,
|
|
855
|
-
@max(1,
|
|
859
|
+
@max(1, text_frame.width - shift),
|
|
856
860
|
widget.frame.height,
|
|
857
861
|
);
|
|
858
862
|
}
|
|
@@ -928,32 +932,44 @@ pub fn emitDataCellWidgetChrome(builder: *Builder, widget: Widget, tokens: Desig
|
|
|
928
932
|
fn segmentedTriggerRadius(widget: Widget, visual: ControlVisualTokens, tokens: DesignTokens) Radius {
|
|
929
933
|
if (widget.style.radius) |radius| return Radius.all(@max(0, radius));
|
|
930
934
|
if (visual.radius) |radius| return Radius.all(@max(0, widgetSizedRadiusValue(widget, radius)));
|
|
935
|
+
// Primary underline triggers are square text hit targets; rounding
|
|
936
|
+
// is part of the house pill register (and the ignored secondary-tab
|
|
937
|
+
// variant), not the Geist primary Tabs shape.
|
|
938
|
+
if (tokens.controls.tabs_indicator == .underline) return Radius.all(0);
|
|
931
939
|
const container = tokens.controls.tabs.radius orelse tokens.radius.lg;
|
|
932
940
|
return Radius.all(@max(0, widgetSizedRadiusValue(widget, container) - widget_model.tabs_list_inset));
|
|
933
941
|
}
|
|
934
942
|
|
|
935
|
-
/// The selected-tab bar for the `.underline` tab register: a short
|
|
936
|
-
///
|
|
937
|
-
///
|
|
938
|
-
///
|
|
939
|
-
///
|
|
940
|
-
///
|
|
941
|
-
///
|
|
942
|
-
///
|
|
943
|
-
/// register; shared with invalidation so damage covers the overhang.
|
|
943
|
+
/// The selected-tab bar for the `.underline` tab register: a short filled
|
|
944
|
+
/// rect hugging the trigger's rendered content (text, optional icon and
|
|
945
|
+
/// icon gap, plus the register's side inset), capped to the hit-target
|
|
946
|
+
/// frame. Measuring the content instead of reusing the frame keeps the
|
|
947
|
+
/// marker honest when an author gives triggers fixed widths or grow
|
|
948
|
+
/// factors. It lands on the trigger's bottom edge and covers the TabsList
|
|
949
|
+
/// hairline where they meet. Null in the `.pill` register; shared with
|
|
950
|
+
/// invalidation.
|
|
944
951
|
pub fn segmentedControlUnderlineRect(widget: Widget, tokens: DesignTokens) ?geometry.RectF {
|
|
945
952
|
if (tokens.controls.tabs_indicator != .underline) return null;
|
|
946
953
|
const frame = widget.frame.normalized();
|
|
947
954
|
if (frame.isEmpty()) return null;
|
|
948
955
|
const thickness = @min(frame.height, widgetSizedDensityValue(widget, tokens, tokens.metrics.tabs_indicator_thickness));
|
|
949
|
-
const text_size =
|
|
956
|
+
const text_size = widgetTabTriggerTextSize(widget, tokens);
|
|
950
957
|
const text_width = measureTextWidthForFont(tokens.text_measure, tokens.typography.font_id, widget.text, text_size);
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
958
|
+
const icon_width = if (widget.icon.len > 0)
|
|
959
|
+
widgetTabTriggerIconExtent(widget, tokens) + (if (widget.text.len > 0) widgetTabTriggerIconGap(tokens) else 0)
|
|
960
|
+
else
|
|
961
|
+
0;
|
|
962
|
+
const content_width = icon_width + text_width;
|
|
963
|
+
// A truly empty trigger has no content to hug, so retain the
|
|
964
|
+
// historical full-frame marker instead of collapsing it to an
|
|
965
|
+
// invisible zero-width rect.
|
|
966
|
+
const bar_width = if (content_width > 0)
|
|
967
|
+
@min(frame.width, content_width + widgetTabTriggerInset(widget, tokens) * 2)
|
|
968
|
+
else
|
|
969
|
+
frame.width;
|
|
954
970
|
return pixelSnapGeometryRect(tokens, geometry.RectF.init(
|
|
955
971
|
frame.x + (frame.width - bar_width) * 0.5,
|
|
956
|
-
frame.maxY()
|
|
972
|
+
frame.maxY() - thickness,
|
|
957
973
|
bar_width,
|
|
958
974
|
thickness,
|
|
959
975
|
));
|
|
@@ -963,8 +979,8 @@ pub fn emitSegmentedControlWidget(builder: *Builder, widget: Widget, tokens: Des
|
|
|
963
979
|
const selected = widget.state.selected or widget.value >= 0.5;
|
|
964
980
|
const visual = selectionControlVisualTokens(widget, tokens);
|
|
965
981
|
const radius = segmentedTriggerRadius(widget, visual, tokens);
|
|
966
|
-
const text_size =
|
|
967
|
-
const text_inset =
|
|
982
|
+
const text_size = widgetTabTriggerTextSize(widget, tokens);
|
|
983
|
+
const text_inset = widgetTabTriggerInset(widget, tokens);
|
|
968
984
|
switch (tokens.controls.tabs_indicator) {
|
|
969
985
|
// The house tab-trigger treatment: the active segment lifts to
|
|
970
986
|
// the page surface with a hairline border; inactive segments
|
|
@@ -1028,14 +1044,56 @@ pub fn emitSegmentedControlWidget(builder: *Builder, widget: Widget, tokens: Des
|
|
|
1028
1044
|
// Inactive labels sit in the muted ink; in the underline register a
|
|
1029
1045
|
// hovered (enabled) trigger previews the active ink — the register
|
|
1030
1046
|
// has no hover WASH, so the type itself is the hover feedback.
|
|
1031
|
-
const active_ink =
|
|
1047
|
+
const active_ink = if (tokens.controls.tabs_indicator == .underline)
|
|
1048
|
+
widget.style.foreground orelse visual.foreground orelse tokens.colors.text
|
|
1049
|
+
else
|
|
1050
|
+
widgetForegroundColor(widget, tokens, visual.foreground orelse tokens.colors.text);
|
|
1032
1051
|
const hover_preview = tokens.controls.tabs_indicator == .underline and widget.state.hovered and !widget.state.disabled;
|
|
1052
|
+
const content_color = if (selected or hover_preview) active_ink else widgetForegroundColor(widget, tokens, visual.foreground orelse tokens.colors.text_muted);
|
|
1053
|
+
// Primary icon tabs use the same regular ink, 16px glyph, and 6px
|
|
1054
|
+
// icon-to-label gap as the Geist reference. Keep this inside the
|
|
1055
|
+
// underline arm so the default theme's pill tabs remain byte-for-byte
|
|
1056
|
+
// unchanged, including their historical text-only command stream.
|
|
1057
|
+
if (tokens.controls.tabs_indicator == .underline and widget.icon.len > 0) {
|
|
1058
|
+
const resolved = icon_model.resolveOrMissing(widget.icon).?;
|
|
1059
|
+
const icon_extent = widgetTabTriggerIconExtent(widget, tokens);
|
|
1060
|
+
const icon_y = widget.frame.y + (widget.frame.height - icon_extent) * 0.5;
|
|
1061
|
+
if (widget.text.len == 0) {
|
|
1062
|
+
try emitVectorIcon(builder, widget.id, 5, geometry.RectF.init(
|
|
1063
|
+
widget.frame.x + (widget.frame.width - icon_extent) * 0.5,
|
|
1064
|
+
icon_y,
|
|
1065
|
+
icon_extent,
|
|
1066
|
+
icon_extent,
|
|
1067
|
+
), content_color, resolved);
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
const gap = widgetTabTriggerIconGap(tokens);
|
|
1071
|
+
const text_width = measureTextWidthForFont(tokens.text_measure, tokens.typography.font_id, widget.text, text_size);
|
|
1072
|
+
const available = @max(0, widget.frame.width - text_inset * 2);
|
|
1073
|
+
const content_width = @min(available, icon_extent + gap + text_width);
|
|
1074
|
+
const start_x = widget.frame.x + text_inset + @max(0, (available - content_width) * 0.5);
|
|
1075
|
+
const icon_x = if (widget.icon_placement == .trailing) start_x + content_width - icon_extent else start_x;
|
|
1076
|
+
const text_x = if (widget.icon_placement == .trailing) start_x else start_x + icon_extent + gap;
|
|
1077
|
+
const text_max_x = if (widget.icon_placement == .trailing) icon_x - gap else widget.frame.maxX() - text_inset;
|
|
1078
|
+
try emitVectorIcon(builder, widget.id, 5, geometry.RectF.init(icon_x, icon_y, icon_extent, icon_extent), content_color, resolved);
|
|
1079
|
+
const text_frame = geometry.RectF.init(text_x, widget.frame.y, @max(1, text_max_x - text_x), widget.frame.height);
|
|
1080
|
+
try builder.drawText(.{
|
|
1081
|
+
.id = widgetPartId(widget.id, 3),
|
|
1082
|
+
.font_id = tokens.typography.font_id,
|
|
1083
|
+
.size = text_size,
|
|
1084
|
+
.origin = pixelSnapTextPoint(tokens, boundedTextOrigin(text_frame, text_size, 0)),
|
|
1085
|
+
.color = content_color,
|
|
1086
|
+
.text = widget.text,
|
|
1087
|
+
.text_layout = boundedTextLayout(text_frame, text_size, 0, .start, .none, widget.text_overflow, tokens),
|
|
1088
|
+
});
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1033
1091
|
try builder.drawText(.{
|
|
1034
1092
|
.id = widgetPartId(widget.id, 3),
|
|
1035
1093
|
.font_id = tokens.typography.font_id,
|
|
1036
1094
|
.size = text_size,
|
|
1037
1095
|
.origin = pixelSnapTextPoint(tokens, boundedTextOrigin(widget.frame, text_size, text_inset)),
|
|
1038
|
-
.color =
|
|
1096
|
+
.color = content_color,
|
|
1039
1097
|
.text = widget.text,
|
|
1040
1098
|
.text_layout = boundedTextLayout(widget.frame, text_size, text_inset, .center, .none, widget.text_overflow, tokens),
|
|
1041
1099
|
});
|
|
@@ -361,17 +361,22 @@ pub fn disabledWash(color: Color, disabled: bool, alpha: f32) Color {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
pub fn buttonTextColorForWidget(widget: Widget, tokens: DesignTokens) Color {
|
|
364
|
-
// Disabled ink
|
|
365
|
-
// strength
|
|
366
|
-
//
|
|
367
|
-
//
|
|
368
|
-
//
|
|
369
|
-
//
|
|
370
|
-
//
|
|
364
|
+
// Disabled ink normally keeps the variant's own ink at the
|
|
365
|
+
// disabled-wash strength. A filled primary is the exception: CSS
|
|
366
|
+
// opacity composites its knockout label and fill as ONE layer, so
|
|
367
|
+
// on the matching surface the label lands near the surface color
|
|
368
|
+
// instead of fading a second time through the already-muted fill.
|
|
369
|
+
// Precomposite that ink over the themed page at the requested state
|
|
370
|
+
// strength; this preserves the group-opacity result while still
|
|
371
|
+
// honoring a custom `disabled_alpha`. Themes with a stated disabled
|
|
372
|
+
// ink (`disabled_foreground`) take it instead — Geist uses that for
|
|
373
|
+
// its gray swap register.
|
|
371
374
|
if (widget.state.disabled) {
|
|
372
375
|
const visual = buttonControlVisualTokens(widget, tokens);
|
|
373
376
|
if (visual.disabled_foreground) |color| return color;
|
|
374
|
-
|
|
377
|
+
const rest = buttonTextColorForWidget(restStateWidget(widget), tokens);
|
|
378
|
+
if (widget.variant == .primary) return compositeOver(rest, tokens.colors.background, tokens.states.disabled_alpha);
|
|
379
|
+
return disabledWash(rest, true, tokens.states.disabled_alpha);
|
|
375
380
|
}
|
|
376
381
|
const active = widget.state.pressed or widget.state.selected;
|
|
377
382
|
const visual = buttonControlVisualTokens(widget, tokens);
|
|
@@ -417,9 +422,48 @@ pub fn buttonBorderFill(widget: Widget, tokens: DesignTokens) Fill {
|
|
|
417
422
|
else => widgetBorderColor(widget, visual.border orelse tokens.colors.border),
|
|
418
423
|
};
|
|
419
424
|
};
|
|
425
|
+
if (widget.state.disabled and widget.style.border == null) {
|
|
426
|
+
const visual = buttonControlVisualTokens(widget, tokens);
|
|
427
|
+
// The shared edge is independently overridable: a custom theme
|
|
428
|
+
// may want a solid disabled outline while keeping the house fill
|
|
429
|
+
// wash instead of also stating a disabled body color.
|
|
430
|
+
switch (widget.variant) {
|
|
431
|
+
.default, .secondary, .outline => if (tokens.controls.button_disabled_border) |disabled_border| return colorFill(disabled_border),
|
|
432
|
+
.primary, .ghost, .destructive => {},
|
|
433
|
+
}
|
|
434
|
+
// shadcn's filled default button has a transparent CSS border.
|
|
435
|
+
// At rest our fallback accent stroke is invisible against the
|
|
436
|
+
// identical opaque fill, but washing both commands separately
|
|
437
|
+
// makes their overlap darker and creates a false outline. Drop
|
|
438
|
+
// that implicit edge in the disabled state. This remains
|
|
439
|
+
// transparent even when a theme states a translucent disabled
|
|
440
|
+
// body: painting that color again as a stroke would double-blend
|
|
441
|
+
// into a false outline. An explicitly themed or locally authored
|
|
442
|
+
// border still follows its own opacity wash.
|
|
443
|
+
if (widget.variant == .primary and visual.border == null) return colorFill(transparentColor());
|
|
444
|
+
}
|
|
420
445
|
return colorFill(disabledWash(border, widget.state.disabled, tokens.states.disabled_alpha));
|
|
421
446
|
}
|
|
422
447
|
|
|
448
|
+
/// The command color equivalent to painting `foreground` over
|
|
449
|
+
/// `background` at `opacity`. Button fill, border, and text are separate
|
|
450
|
+
/// display-list commands, so the filled-primary disabled label uses this
|
|
451
|
+
/// to reproduce whole-control opacity without blending a translucent
|
|
452
|
+
/// glyph through the already-muted fill a second time.
|
|
453
|
+
fn compositeOver(foreground: Color, background: Color, opacity: f32) Color {
|
|
454
|
+
const foreground_alpha = std.math.clamp(opacity, 0, 1) * std.math.clamp(foreground.a, 0, 1);
|
|
455
|
+
const background_alpha = std.math.clamp(background.a, 0, 1);
|
|
456
|
+
const output_alpha = foreground_alpha + background_alpha * (1 - foreground_alpha);
|
|
457
|
+
if (output_alpha <= 0) return transparentColor();
|
|
458
|
+
const background_weight = background_alpha * (1 - foreground_alpha);
|
|
459
|
+
return Color.rgba(
|
|
460
|
+
(foreground.r * foreground_alpha + background.r * background_weight) / output_alpha,
|
|
461
|
+
(foreground.g * foreground_alpha + background.g * background_weight) / output_alpha,
|
|
462
|
+
(foreground.b * foreground_alpha + background.b * background_weight) / output_alpha,
|
|
463
|
+
output_alpha,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
|
|
423
467
|
/// Whether this widget is a button-group member rendering in the
|
|
424
468
|
/// `.detached` chip register: the group walks stamp `group_segment`
|
|
425
469
|
/// onto every member on the way down, and the register switch decides
|