@native-sdk/cli 0.9.0 → 0.9.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.
- package/build/app.zig +357 -33
- package/build.zig +234 -11
- package/native-sdk.d.ts +8 -0
- package/package.json +10 -10
- package/packages/core/compile-surface/core.ts +70 -1
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/merge_static_archives.mjs +78 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
- package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
- package/packages/core/scripts/stage_external_services.mjs +1 -1
- package/packages/core/sdk/core.d.ts +75 -0
- package/packages/core/sdk/core.ts +170 -13
- package/packages/core/sdk/events.d.ts +53 -0
- package/packages/core/sdk/events.ts +78 -7
- package/packages/core/src/checker.ts +470 -2
- package/packages/core/src/cli.ts +13 -0
- package/packages/core/src/contract.ts +3 -1
- package/packages/core/src/devhost.ts +30 -1
- package/packages/core/src/devhost_journal.mjs +10 -8
- package/packages/core/src/diagnostics.ts +99 -8
- package/packages/core/src/frontend.ts +6 -0
- package/packages/core/src/infer.ts +24 -0
- package/skill-data/automation/SKILL.md +1 -1
- package/skill-data/native-ui/SKILL.md +18 -12
- package/skill-data/ts-core/SKILL.md +54 -21
- package/skill-data/ts-services/SKILL.md +4 -4
- package/skill-data/ts-services/references/service-surface.md +2 -1
- package/skill-data/zig/SKILL.md +1 -1
- package/src/app_runner/root.zig +122 -6
- package/src/app_runner/ts_core_main.zig +9 -4
- package/src/app_runner/ts_core_mobile.zig +241 -0
- package/src/app_runner/window_placement.zig +63 -0
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +8 -6
- package/src/embed/app_exports.zig +3 -1
- package/src/embed/conversions.zig +1 -0
- package/src/embed/host.zig +10 -3
- package/src/embed/root.zig +2 -0
- package/src/embed/tests.zig +41 -1
- package/src/embed/types.zig +2 -0
- package/src/embed/ui_host.zig +94 -4
- package/src/platform/android/NativeSdkActivity.java +49 -4
- package/src/platform/android/android_host.c +3 -3
- package/src/platform/android/native_sdk_app.h +1 -1
- package/src/platform/ios/apple_image_fit.h +38 -0
- package/src/platform/ios/files.zig +1 -0
- package/src/platform/ios/native_sdk_app.h +1 -1
- package/src/platform/ios/uikit_host.m +28 -5
- package/src/platform/linux/cef_host.cpp +17 -3
- package/src/platform/linux/gtk_host.c +243 -15
- package/src/platform/linux/gtk_host.h +5 -4
- package/src/platform/linux/root.zig +91 -11
- package/src/platform/macos/appkit_host.h +18 -11
- package/src/platform/macos/appkit_host.m +402 -128
- package/src/platform/macos/cef_host.mm +342 -122
- package/src/platform/macos/image_fit_test.m +44 -0
- package/src/platform/macos/root.zig +231 -39
- package/src/platform/null_platform.zig +251 -54
- package/src/platform/null_platform_tests.zig +97 -4
- package/src/platform/root.zig +12 -0
- package/src/platform/types.zig +174 -35
- package/src/platform/windows/root.zig +42 -13
- package/src/platform/windows/webview2_host.cpp +72 -11
- package/src/primitives/app_manifest/root.zig +3 -0
- package/src/primitives/app_manifest/tests.zig +24 -0
- package/src/primitives/app_manifest/types.zig +13 -0
- package/src/primitives/app_manifest/validation.zig +24 -0
- package/src/primitives/canvas/a11y_audit.zig +9 -7
- package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
- package/src/primitives/canvas/events.zig +50 -0
- package/src/primitives/canvas/layout_audit.zig +6 -6
- package/src/primitives/canvas/markdown.zig +4 -0
- package/src/primitives/canvas/markdown_tests.zig +1 -0
- package/src/primitives/canvas/png.zig +138 -0
- package/src/primitives/canvas/root.zig +13 -2
- package/src/primitives/canvas/text_span_tests.zig +5 -3
- package/src/primitives/canvas/text_spans.zig +2 -0
- package/src/primitives/canvas/text_tests.zig +20 -0
- package/src/primitives/canvas/ui.zig +55 -2
- package/src/primitives/canvas/ui_markup.zig +40 -13
- package/src/primitives/canvas/ui_markup_binary.zig +8 -6
- package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
- package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +52 -0
- package/src/primitives/canvas/ui_markup_tests.zig +11 -2
- package/src/primitives/canvas/ui_markup_view.zig +8 -2
- package/src/primitives/canvas/ui_markup_view_tests.zig +49 -4
- package/src/primitives/canvas/ui_schema.zig +17 -13
- package/src/primitives/canvas/ui_tests.zig +47 -0
- package/src/primitives/canvas/widget_access.zig +3 -3
- package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +580 -32
- package/src/primitives/canvas/widget_invalidation.zig +33 -6
- package/src/primitives/canvas/widget_layout.zig +333 -126
- package/src/primitives/canvas/widget_layout_tests.zig +169 -0
- package/src/primitives/canvas/widget_metrics.zig +7 -8
- package/src/primitives/canvas/widget_render.zig +76 -44
- package/src/primitives/canvas/widget_render_controls.zig +110 -32
- package/src/primitives/canvas/widget_render_style.zig +58 -18
- package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
- package/src/primitives/canvas/widget_routing.zig +40 -34
- package/src/primitives/canvas/widget_runtime.zig +11 -2
- package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
- package/src/primitives/canvas/widget_semantics.zig +8 -3
- package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
- package/src/primitives/canvas/widget_tree.zig +99 -5
- package/src/primitives/canvas/widgets.zig +20 -7
- package/src/root.zig +10 -0
- package/src/runtime/api.zig +14 -0
- package/src/runtime/automation_commands.zig +35 -2
- package/src/runtime/automation_snapshot.zig +32 -24
- package/src/runtime/automation_widget_dispatch.zig +48 -6
- package/src/runtime/bridge_permission_tests.zig +35 -1
- package/src/runtime/bridge_responses.zig +1 -1
- package/src/runtime/builtin_bridge.zig +16 -3
- package/src/runtime/canvas_frame_packet_tests.zig +22 -13
- package/src/runtime/canvas_image_tests.zig +146 -2
- package/src/runtime/canvas_images.zig +35 -16
- package/src/runtime/canvas_limits.zig +13 -3
- package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
- package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
- package/src/runtime/canvas_widget_control_tests.zig +31 -1
- package/src/runtime/canvas_widget_events.zig +151 -26
- package/src/runtime/canvas_widget_floating_tests.zig +48 -0
- package/src/runtime/canvas_widget_runtime.zig +322 -102
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
- package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
- package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
- package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
- package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
- package/src/runtime/canvas_widget_state.zig +33 -7
- package/src/runtime/core.zig +28 -6
- package/src/runtime/effects.zig +1337 -49
- package/src/runtime/effects_file_tests.zig +587 -0
- package/src/runtime/effects_image_tests.zig +91 -0
- package/src/runtime/effects_notification_tests.zig +11 -0
- package/src/runtime/file_access.zig +400 -0
- package/src/runtime/file_effect_crash_helper.zig +28 -0
- package/src/runtime/file_effect_crash_tests.zig +37 -0
- package/src/runtime/flow.zig +21 -9
- package/src/runtime/gpu_surface_events.zig +25 -2
- package/src/runtime/native_command_event_tests.zig +44 -2
- package/src/runtime/pty.zig +5 -2
- package/src/runtime/root.zig +7 -0
- package/src/runtime/session_blobs.zig +4 -1
- package/src/runtime/session_journal.zig +56 -5
- package/src/runtime/session_record.zig +38 -0
- package/src/runtime/session_replay.zig +110 -15
- package/src/runtime/session_tests.zig +192 -4
- package/src/runtime/shell_layout_tests.zig +12 -0
- package/src/runtime/state.zig +10 -0
- package/src/runtime/system_services.zig +129 -36
- package/src/runtime/ts_core_host.zig +281 -11
- package/src/runtime/ts_core_host_tests.zig +142 -1
- package/src/runtime/ts_ui_app.zig +461 -8
- package/src/runtime/ui_app.zig +330 -112
- package/src/runtime/ui_app_tests.zig +251 -25
- package/src/runtime/ui_app_window_tests.zig +74 -8
- package/src/runtime/validation.zig +20 -0
- package/src/runtime/view.zig +3 -0
- package/src/runtime/view_widget_control.zig +18 -0
- package/src/runtime/view_widget_scroll.zig +112 -18
- package/src/runtime/view_widget_tree.zig +110 -13
- package/src/runtime/widget_bridge.zig +2 -0
- package/src/runtime/window_command_bridge_tests.zig +86 -0
- package/src/runtime/window_storage.zig +16 -1
- package/src/runtime/window_views.zig +1 -0
- package/src/tooling/ios.zig +3 -0
- package/src/tooling/manifest.zig +90 -2
- package/src/tooling/package.zig +67 -2
- package/src/tooling/raw_manifest.zig +10 -0
- package/src/tooling/templates.zig +156 -18
- package/src/tooling/ts_core.zig +83 -0
- package/src/tooling/web_engine.zig +1 -1
- package/tools/corewire/emit.zig +3 -3
- package/tools/corewire/emit_facade.zig +65 -5
- package/tools/corewire/emit_profile.zig +2 -2
- package/tools/corewire/emit_service.zig +2 -2
- package/tools/corewire/service_contract.zig +4 -4
- package/tools/corewire/sidecar.zig +4 -4
|
@@ -301,6 +301,7 @@ fn buttonGroupSegmentRadius(widget: Widget, visual: ControlVisualTokens, tokens:
|
|
|
301
301
|
/// freed by the retired button shadow.
|
|
302
302
|
fn emitButtonBorder(builder: *Builder, widget: Widget, tokens: DesignTokens, radius: Radius) Error!void {
|
|
303
303
|
const stroke_width = buttonStrokeWidth(widget, tokens);
|
|
304
|
+
if (stroke_width <= 0) return;
|
|
304
305
|
const border = snapHairlineStrokeRect(tokens, .{
|
|
305
306
|
.id = widgetPartId(widget.id, 2),
|
|
306
307
|
.rect = widget.frame,
|
|
@@ -830,7 +831,7 @@ pub fn emitListItemWidget(builder: *Builder, widget: Widget, tokens: DesignToken
|
|
|
830
831
|
.id = widgetPartId(widget.id, 1),
|
|
831
832
|
.rect = widget.frame,
|
|
832
833
|
.radius = radius,
|
|
833
|
-
.fill =
|
|
834
|
+
.fill = colorFill(fill),
|
|
834
835
|
});
|
|
835
836
|
}
|
|
836
837
|
if (widget.state.focused) try emitWidgetFocusRing(builder, widget, tokens, 2);
|
|
@@ -902,7 +903,7 @@ pub fn emitDataCellWidgetChrome(builder: *Builder, widget: Widget, tokens: Desig
|
|
|
902
903
|
try builder.fillRect(.{
|
|
903
904
|
.id = widgetPartId(widget.id, 1),
|
|
904
905
|
.rect = widget.frame,
|
|
905
|
-
.fill =
|
|
906
|
+
.fill = colorFill(state_fill),
|
|
906
907
|
});
|
|
907
908
|
}
|
|
908
909
|
// Borderless by default: the table's chrome is its hairline ROW
|
|
@@ -1107,30 +1108,41 @@ pub fn emitCheckboxWidget(builder: *Builder, widget: Widget, tokens: DesignToken
|
|
|
1107
1108
|
// 6px token reads nearly round; 4px keeps the square-with-softened-
|
|
1108
1109
|
// corners shape the checkbox is known by.
|
|
1109
1110
|
const radius = controlRadius(widget, visual, 4);
|
|
1111
|
+
const box_rest = if (selected)
|
|
1112
|
+
widgetAccentColor(widget, visual.active_background orelse tokens.colors.accent)
|
|
1113
|
+
else
|
|
1114
|
+
widgetBackgroundColor(widget, buttonStateBackground(visual, false, washHovered(widget), tokens.colors.surface));
|
|
1110
1115
|
try builder.fillRoundedRect(.{
|
|
1111
1116
|
.id = widgetPartId(widget.id, 1),
|
|
1112
1117
|
.rect = box,
|
|
1113
1118
|
.radius = radius,
|
|
1114
|
-
.fill =
|
|
1115
|
-
colorFill(disabledWash(widgetAccentColor(widget, visual.active_background orelse tokens.colors.accent), widget.state.disabled, tokens.states.disabled_alpha))
|
|
1116
|
-
else
|
|
1117
|
-
colorFill(widgetBackgroundColor(widget, buttonStateBackground(visual, false, washHovered(widget), tokens.colors.surface))),
|
|
1119
|
+
.fill = colorFill(selectionDisabledBackground(widget, visual, box_rest, tokens)),
|
|
1118
1120
|
});
|
|
1119
1121
|
try builder.strokeRect(snapHairlineStrokeRect(tokens, .{
|
|
1120
1122
|
.id = widgetPartId(widget.id, 2),
|
|
1121
1123
|
.rect = box,
|
|
1122
1124
|
.radius = radius,
|
|
1123
1125
|
.stroke = .{
|
|
1124
|
-
.fill = colorFill(
|
|
1126
|
+
.fill = colorFill(selectionDisabledNeutral(
|
|
1127
|
+
widget,
|
|
1128
|
+
visual,
|
|
1129
|
+
if (selected) widgetAccentColor(widget, visual.border orelse visual.active_background orelse tokens.colors.accent) else widgetBorderColor(widget, visual.border orelse tokens.colors.border),
|
|
1130
|
+
tokens,
|
|
1131
|
+
)),
|
|
1125
1132
|
.width = controlStrokeWidth(widget, visual, tokens.stroke.regular),
|
|
1126
1133
|
},
|
|
1127
1134
|
}));
|
|
1128
1135
|
if (widget.state.focused) try emitWidgetFocusRingForRect(builder, widget, tokens, 3, box, radius);
|
|
1129
1136
|
if (selected) {
|
|
1130
|
-
//
|
|
1131
|
-
//
|
|
1132
|
-
//
|
|
1133
|
-
const check_color =
|
|
1137
|
+
// With no theme swap, the check keeps the accent-foreground tint
|
|
1138
|
+
// washed in step with the box; an explicit disabled foreground
|
|
1139
|
+
// replaces that channel (and the label) consistently.
|
|
1140
|
+
const check_color = selectionDisabledForeground(
|
|
1141
|
+
widget,
|
|
1142
|
+
visual,
|
|
1143
|
+
widget.style.accent_foreground orelse visual.foreground orelse tokens.colors.accent_text,
|
|
1144
|
+
tokens,
|
|
1145
|
+
);
|
|
1134
1146
|
const left = pixelSnapGeometryPoint(tokens, geometry.PointF.init(box.x + box.width * 0.26, box.y + box.height * 0.54));
|
|
1135
1147
|
const mid = pixelSnapGeometryPoint(tokens, geometry.PointF.init(box.x + box.width * 0.43, box.y + box.height * 0.70));
|
|
1136
1148
|
const right = pixelSnapGeometryPoint(tokens, geometry.PointF.init(box.x + box.width * 0.76, box.y + box.height * 0.32));
|
|
@@ -1153,19 +1165,30 @@ pub fn emitCheckboxWidget(builder: *Builder, widget: Widget, tokens: DesignToken
|
|
|
1153
1165
|
.cap = .round,
|
|
1154
1166
|
});
|
|
1155
1167
|
}
|
|
1156
|
-
try emitControlLabelWithColor(
|
|
1168
|
+
try emitControlLabelWithColor(
|
|
1169
|
+
builder,
|
|
1170
|
+
widget,
|
|
1171
|
+
tokens,
|
|
1172
|
+
box.x + box.width + widgetControlInset(widget, tokens, tokens.spacing.sm),
|
|
1173
|
+
6,
|
|
1174
|
+
selectionDisabledForeground(widget, visual, widget.style.foreground orelse visual.foreground orelse tokens.colors.text, tokens),
|
|
1175
|
+
);
|
|
1157
1176
|
}
|
|
1158
1177
|
|
|
1159
1178
|
pub fn emitRadioWidget(builder: *Builder, widget: Widget, tokens: DesignTokens) Error!void {
|
|
1160
1179
|
const visual = selectionControlVisualTokens(widget, tokens);
|
|
1161
1180
|
const circle = radioWidgetCircleRect(widget, tokens);
|
|
1162
1181
|
const selected = booleanControlSelected(widget);
|
|
1163
|
-
|
|
1182
|
+
// The house fallback is a circle in every size register. Explicit
|
|
1183
|
+
// widget/theme radii still shape the control through the ordinary
|
|
1184
|
+
// precedence ladder.
|
|
1185
|
+
const radius = selectionShapeRadius(widget, visual, circle.height * 0.5);
|
|
1186
|
+
const circle_rest = widgetBackgroundColor(widget, buttonStateBackground(visual, false, washHovered(widget), tokens.colors.surface));
|
|
1164
1187
|
try builder.fillRoundedRect(.{
|
|
1165
1188
|
.id = widgetPartId(widget.id, 1),
|
|
1166
1189
|
.rect = circle,
|
|
1167
1190
|
.radius = radius,
|
|
1168
|
-
.fill = colorFill(
|
|
1191
|
+
.fill = colorFill(selectionDisabledBackground(widget, visual, circle_rest, tokens)),
|
|
1169
1192
|
});
|
|
1170
1193
|
try builder.strokeRect(snapHairlineStrokeRect(tokens, .{
|
|
1171
1194
|
.id = widgetPartId(widget.id, 2),
|
|
@@ -1174,7 +1197,7 @@ pub fn emitRadioWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1174
1197
|
// The border stays on the input hairline even when selected —
|
|
1175
1198
|
// the primary-colored dot alone carries the checked state.
|
|
1176
1199
|
.stroke = .{
|
|
1177
|
-
.fill = colorFill(
|
|
1200
|
+
.fill = colorFill(selectionDisabledNeutral(widget, visual, widgetBorderColor(widget, visual.border orelse tokens.colors.border), tokens)),
|
|
1178
1201
|
.width = controlStrokeWidth(widget, visual, tokens.stroke.regular),
|
|
1179
1202
|
},
|
|
1180
1203
|
}));
|
|
@@ -1191,10 +1214,22 @@ pub fn emitRadioWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1191
1214
|
.id = widgetPartId(widget.id, 4),
|
|
1192
1215
|
.rect = dot,
|
|
1193
1216
|
.radius = Radius.all(dot.height * 0.5),
|
|
1194
|
-
.fill = colorFill(
|
|
1217
|
+
.fill = colorFill(selectionDisabledForeground(
|
|
1218
|
+
widget,
|
|
1219
|
+
visual,
|
|
1220
|
+
widgetAccentColor(widget, visual.active_background orelse tokens.colors.accent),
|
|
1221
|
+
tokens,
|
|
1222
|
+
)),
|
|
1195
1223
|
});
|
|
1196
1224
|
}
|
|
1197
|
-
try emitControlLabelWithColor(
|
|
1225
|
+
try emitControlLabelWithColor(
|
|
1226
|
+
builder,
|
|
1227
|
+
widget,
|
|
1228
|
+
tokens,
|
|
1229
|
+
circle.x + circle.width + widgetControlInset(widget, tokens, tokens.spacing.sm),
|
|
1230
|
+
5,
|
|
1231
|
+
selectionDisabledForeground(widget, visual, widget.style.foreground orelse visual.foreground orelse tokens.colors.text, tokens),
|
|
1232
|
+
);
|
|
1198
1233
|
}
|
|
1199
1234
|
|
|
1200
1235
|
pub fn emitToggleWidget(builder: *Builder, widget: Widget, tokens: DesignTokens) Error!void {
|
|
@@ -1202,7 +1237,9 @@ pub fn emitToggleWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1202
1237
|
const visual = selectionControlVisualTokens(widget, tokens);
|
|
1203
1238
|
const knob_inset = widgetSizedDensityValue(widget, tokens, 2);
|
|
1204
1239
|
const track = toggleWidgetTrackRect(widget, tokens);
|
|
1205
|
-
|
|
1240
|
+
// The house rail is a pill in every size register. Explicit
|
|
1241
|
+
// widget/theme radii still shape both rail and thumb.
|
|
1242
|
+
const track_radius = selectionShapeRadius(widget, visual, track.height * 0.5);
|
|
1206
1243
|
const knob_size = @max(0, track.height - knob_inset * 2);
|
|
1207
1244
|
const knob_x = if (selected)
|
|
1208
1245
|
track.x + track.width - knob_size - knob_inset
|
|
@@ -1210,14 +1247,15 @@ pub fn emitToggleWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1210
1247
|
track.x + knob_inset;
|
|
1211
1248
|
const knob = pixelSnapGeometryRect(tokens, geometry.RectF.init(knob_x, track.y + knob_inset, knob_size, knob_size));
|
|
1212
1249
|
|
|
1250
|
+
const track_rest = if (selected)
|
|
1251
|
+
widgetAccentColor(widget, visual.active_background orelse tokens.colors.accent)
|
|
1252
|
+
else
|
|
1253
|
+
widgetBackgroundColor(widget, buttonStateBackground(visual, false, washHovered(widget), tokens.colors.surface_pressed));
|
|
1213
1254
|
try builder.fillRoundedRect(.{
|
|
1214
1255
|
.id = widgetPartId(widget.id, 1),
|
|
1215
1256
|
.rect = track,
|
|
1216
1257
|
.radius = track_radius,
|
|
1217
|
-
.fill =
|
|
1218
|
-
colorFill(disabledWash(widgetAccentColor(widget, visual.active_background orelse tokens.colors.accent), widget.state.disabled, tokens.states.disabled_alpha))
|
|
1219
|
-
else
|
|
1220
|
-
colorFill(disabledWash(widgetBackgroundColor(widget, buttonStateBackground(visual, false, washHovered(widget), tokens.colors.surface_pressed)), widget.state.disabled, tokens.states.disabled_alpha)),
|
|
1258
|
+
.fill = colorFill(selectionDisabledBackground(widget, visual, track_rest, tokens)),
|
|
1221
1259
|
});
|
|
1222
1260
|
// Borderless by default: the switch is a filled pill (primary when
|
|
1223
1261
|
// on, the input wash when off) whose near-white thumb provides the
|
|
@@ -1232,7 +1270,7 @@ pub fn emitToggleWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1232
1270
|
.rect = track,
|
|
1233
1271
|
.radius = track_radius,
|
|
1234
1272
|
.stroke = .{
|
|
1235
|
-
.fill =
|
|
1273
|
+
.fill = colorFill(selectionDisabledNeutral(widget, visual, widgetBorderColor(widget, visual.border orelse tokens.colors.border), tokens)),
|
|
1236
1274
|
.width = track_stroke_width,
|
|
1237
1275
|
},
|
|
1238
1276
|
}));
|
|
@@ -1240,19 +1278,57 @@ pub fn emitToggleWidget(builder: *Builder, widget: Widget, tokens: DesignTokens)
|
|
|
1240
1278
|
try builder.fillRoundedRect(.{
|
|
1241
1279
|
.id = widgetPartId(widget.id, 3),
|
|
1242
1280
|
.rect = knob,
|
|
1243
|
-
.radius =
|
|
1281
|
+
.radius = selectionShapeRadius(widget, visual, knob.height * 0.5),
|
|
1244
1282
|
// The thumb is near-white in both states and schemes (the
|
|
1245
1283
|
// primary-foreground tint), so it stays legible on the primary
|
|
1246
|
-
// track and on the dark input wash alike. Disabled washes it
|
|
1247
|
-
//
|
|
1248
|
-
.fill = colorFill(
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
tokens.
|
|
1284
|
+
// track and on the dark input wash alike. Disabled washes it with
|
|
1285
|
+
// the track unless the theme supplies a foreground swap.
|
|
1286
|
+
.fill = colorFill(selectionDisabledForeground(
|
|
1287
|
+
widget,
|
|
1288
|
+
visual,
|
|
1289
|
+
widget.style.accent_foreground orelse visual.foreground orelse tokens.colors.accent_text,
|
|
1290
|
+
tokens,
|
|
1252
1291
|
)),
|
|
1253
1292
|
});
|
|
1254
1293
|
if (widget.state.focused) try emitWidgetFocusRingForRect(builder, widget, tokens, 4, track, track_radius);
|
|
1255
|
-
try emitControlLabelWithColor(
|
|
1294
|
+
try emitControlLabelWithColor(
|
|
1295
|
+
builder,
|
|
1296
|
+
widget,
|
|
1297
|
+
tokens,
|
|
1298
|
+
track.x + track.width + widgetControlInset(widget, tokens, tokens.spacing.sm),
|
|
1299
|
+
5,
|
|
1300
|
+
selectionDisabledForeground(widget, visual, widget.style.foreground orelse visual.foreground orelse tokens.colors.text, tokens),
|
|
1301
|
+
);
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
/// Selection controls share the slider's disabled-token contract. With no
|
|
1305
|
+
/// explicit disabled channel, every resolved rest color gets the house
|
|
1306
|
+
/// alpha wash. Stating either disabled channel selects the theme's swap
|
|
1307
|
+
/// register: stated background/foreground colors replace those channels,
|
|
1308
|
+
/// while unstated channels stay at full strength. Marks and thumbs are
|
|
1309
|
+
/// foreground channels; boxes and tracks are backgrounds.
|
|
1310
|
+
fn selectionDisabledBackground(widget: Widget, visual: ControlVisualTokens, rest: Color, tokens: DesignTokens) Color {
|
|
1311
|
+
if (!widget.state.disabled) return rest;
|
|
1312
|
+
if (visual.disabled_background) |color| return color;
|
|
1313
|
+
return selectionDisabledNeutral(widget, visual, rest, tokens);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
fn selectionDisabledForeground(widget: Widget, visual: ControlVisualTokens, rest: Color, tokens: DesignTokens) Color {
|
|
1317
|
+
if (!widget.state.disabled) return rest;
|
|
1318
|
+
if (visual.disabled_foreground) |color| return color;
|
|
1319
|
+
return selectionDisabledNeutral(widget, visual, rest, tokens);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
fn selectionDisabledNeutral(widget: Widget, visual: ControlVisualTokens, rest: Color, tokens: DesignTokens) Color {
|
|
1323
|
+
const swap = visual.disabled_background != null or visual.disabled_foreground != null;
|
|
1324
|
+
return disabledWash(rest, widget.state.disabled and !swap, tokens.states.disabled_alpha);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
fn selectionShapeRadius(widget: Widget, visual: ControlVisualTokens, fallback: f32) Radius {
|
|
1328
|
+
if (widget.style.radius != null or visual.radius != null) {
|
|
1329
|
+
return controlRadius(widget, visual, fallback);
|
|
1330
|
+
}
|
|
1331
|
+
return Radius.all(@max(0, fallback));
|
|
1256
1332
|
}
|
|
1257
1333
|
|
|
1258
1334
|
pub fn emitSliderWidget(builder: *Builder, widget: Widget, tokens: DesignTokens) Error!void {
|
|
@@ -1456,7 +1532,9 @@ fn emitControlLabelWithColor(builder: *Builder, widget: Widget, tokens: DesignTo
|
|
|
1456
1532
|
.font_id = tokens.typography.font_id,
|
|
1457
1533
|
.size = text_size,
|
|
1458
1534
|
.origin = pixelSnapTextPoint(tokens, boundedTextOrigin(labelFrameForControl(widget.frame, x), text_size, 0)),
|
|
1459
|
-
|
|
1535
|
+
// Callers resolve the selection control's enabled/disabled
|
|
1536
|
+
// foreground channel before reaching this common text emitter.
|
|
1537
|
+
.color = color,
|
|
1460
1538
|
.text = widget.text,
|
|
1461
1539
|
.text_layout = boundedTextLayout(labelFrameForControl(widget.frame, x), text_size, 0, .start, .none, widget.text_overflow, tokens),
|
|
1462
1540
|
});
|
|
@@ -169,13 +169,13 @@ pub fn widgetBorderColor(widget: Widget, fallback: Color) Color {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
pub fn widgetForegroundColor(widget: Widget, tokens: DesignTokens, fallback: Color) Color {
|
|
172
|
-
|
|
173
|
-
return widget.
|
|
172
|
+
const color = widget.style.foreground orelse fallback;
|
|
173
|
+
return disabledWash(color, widget.state.disabled, tokens.states.disabled_alpha);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
pub fn widgetAccentForegroundColor(widget: Widget, tokens: DesignTokens, fallback: Color) Color {
|
|
177
|
-
|
|
178
|
-
return widget.
|
|
177
|
+
const color = widget.style.accent_foreground orelse fallback;
|
|
178
|
+
return disabledWash(color, widget.state.disabled, tokens.states.disabled_alpha);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
pub fn widgetRadius(widget: Widget, fallback: f32) Radius {
|
|
@@ -282,7 +282,7 @@ pub fn buttonFillColor(widget: Widget, tokens: DesignTokens) Color {
|
|
|
282
282
|
// the light recipe, so a bare untheme'd `DesignTokens{}` (whose
|
|
283
283
|
// color defaults are the light palette) renders identically.
|
|
284
284
|
.destructive => widgetAccentColor(widget, destructiveChipBackground(visual, tokens, pressed, selected, hovered)),
|
|
285
|
-
.secondary =>
|
|
285
|
+
.secondary => widgetAccentColor(widget, buttonStateBackground(visual, pressed or selected, hovered, if (pressed or selected) tokens.colors.surface_pressed else hoverWash(tokens.colors.surface_subtle, false, hovered, tokens.states.secondary_hover_alpha))),
|
|
286
286
|
// The quiet variants step through the neutral washes: hover and
|
|
287
287
|
// a toggle's on-state sit on the muted wash, a press deepens one
|
|
288
288
|
// step further so the moment of commitment is visible under the
|
|
@@ -419,6 +419,7 @@ pub fn buttonBorderFill(widget: Widget, tokens: DesignTokens) Fill {
|
|
|
419
419
|
// chip's edge is where its wash ends, nothing more.
|
|
420
420
|
.destructive => widgetAccentColor(widget, visual.border orelse transparentColor()),
|
|
421
421
|
.ghost => widgetBorderColor(widget, visual.border orelse transparentColor()),
|
|
422
|
+
.secondary => widgetAccentColor(widget, visual.border orelse tokens.colors.border),
|
|
422
423
|
else => widgetBorderColor(widget, visual.border orelse tokens.colors.border),
|
|
423
424
|
};
|
|
424
425
|
};
|
|
@@ -544,7 +545,15 @@ pub fn textInputControlVisualTokens(widget: Widget, tokens: DesignTokens) Contro
|
|
|
544
545
|
}
|
|
545
546
|
|
|
546
547
|
pub fn textInputFill(widget: Widget, tokens: DesignTokens, visual: ControlVisualTokens) Fill {
|
|
547
|
-
if (widget.state.disabled)
|
|
548
|
+
if (widget.state.disabled) {
|
|
549
|
+
if (visual.disabled_background) |color| return colorFill(color);
|
|
550
|
+
const rest = restStateWidget(widget);
|
|
551
|
+
return colorFill(disabledWash(
|
|
552
|
+
widgetBackgroundColor(rest, buttonStateBackground(visual, false, false, tokens.colors.surface)),
|
|
553
|
+
true,
|
|
554
|
+
tokens.states.disabled_alpha,
|
|
555
|
+
));
|
|
556
|
+
}
|
|
548
557
|
return colorFill(widgetBackgroundColor(widget, buttonStateBackground(visual, false, washHovered(widget), tokens.colors.surface)));
|
|
549
558
|
}
|
|
550
559
|
|
|
@@ -642,11 +651,18 @@ pub fn componentPillRadius(widget: Widget, visual: ControlVisualTokens, fallback
|
|
|
642
651
|
}
|
|
643
652
|
|
|
644
653
|
pub fn badgeBackgroundColor(widget: Widget, tokens: DesignTokens, visual: ControlVisualTokens) Color {
|
|
645
|
-
if (widget.state.disabled)
|
|
654
|
+
if (widget.state.disabled) {
|
|
655
|
+
if (visual.disabled_background) |color| return color;
|
|
656
|
+
return disabledWash(badgeBackgroundColor(restStateWidget(widget), tokens, visual), true, tokens.states.disabled_alpha);
|
|
657
|
+
}
|
|
646
658
|
const hovered = washHovered(widget);
|
|
659
|
+
// Badges intentionally have one control table rather than the button
|
|
660
|
+
// register's per-variant tables. Variant identity therefore resolves
|
|
661
|
+
// from the shared palette plus local style channels; this does not
|
|
662
|
+
// invent themeable per-variant badge tokens.
|
|
647
663
|
return switch (widget.variant) {
|
|
648
664
|
.default, .primary => widgetAccentColor(widget, controlStateBackground(visual, widget.state.pressed, widget.state.pressed or widget.state.selected, hovered, tokens.colors.accent)),
|
|
649
|
-
.secondary =>
|
|
665
|
+
.secondary => widgetAccentColor(widget, controlStateBackground(visual, widget.state.pressed, widget.state.pressed or widget.state.selected, hovered, tokens.colors.surface_subtle)),
|
|
650
666
|
.outline, .ghost => widgetBackgroundColor(widget, controlStateBackground(visual, widget.state.pressed, widget.state.pressed or widget.state.selected, hovered, if (hovered or widget.state.pressed) tokens.colors.surface_subtle else transparentColor())),
|
|
651
667
|
// The QUIET destructive chip: a translucent destructive wash
|
|
652
668
|
// (`states.badge_destructive_wash_alpha`) under destructive
|
|
@@ -658,15 +674,20 @@ pub fn badgeBackgroundColor(widget: Widget, tokens: DesignTokens, visual: Contro
|
|
|
658
674
|
}
|
|
659
675
|
|
|
660
676
|
pub fn badgeBorderColor(widget: Widget, tokens: DesignTokens, visual: ControlVisualTokens) Color {
|
|
661
|
-
|
|
677
|
+
const border = widget.style.border orelse switch (widget.variant) {
|
|
662
678
|
.default, .primary => widgetAccentColor(widget, visual.border orelse tokens.colors.accent),
|
|
663
679
|
.destructive => widgetAccentColor(widget, visual.border orelse tokens.colors.destructive),
|
|
664
|
-
|
|
680
|
+
.secondary => widgetAccentColor(widget, visual.border orelse tokens.colors.border),
|
|
681
|
+
else => visual.border orelse tokens.colors.border,
|
|
665
682
|
};
|
|
683
|
+
return disabledWash(border, widget.state.disabled, tokens.states.disabled_alpha);
|
|
666
684
|
}
|
|
667
685
|
|
|
668
686
|
pub fn badgeTextColor(widget: Widget, tokens: DesignTokens, visual: ControlVisualTokens) Color {
|
|
669
|
-
if (widget.state.disabled)
|
|
687
|
+
if (widget.state.disabled) {
|
|
688
|
+
if (visual.disabled_foreground) |color| return color;
|
|
689
|
+
return disabledWash(badgeTextColor(restStateWidget(widget), tokens, visual), true, tokens.states.disabled_alpha);
|
|
690
|
+
}
|
|
670
691
|
return switch (widget.variant) {
|
|
671
692
|
.default, .primary => widgetAccentForegroundColor(widget, tokens, visual.foreground orelse tokens.colors.accent_text),
|
|
672
693
|
// Ink on the quiet wash, not knockout text on a filled block.
|
|
@@ -705,13 +726,32 @@ pub fn listItemFillColor(widget: Widget, tokens: DesignTokens, state: WidgetStat
|
|
|
705
726
|
// The quiet-surface knob reads through the widget, not the caller's
|
|
706
727
|
// state copy, so every row/cell path honors it identically.
|
|
707
728
|
const hovered = state.hovered and !widget.style.quiet_hover;
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
return
|
|
729
|
+
if (state.pressed) return visual.pressed_background orelse visual.active_background orelse visual.hover_background orelse visual.background orelse tokens.colors.surface_pressed;
|
|
730
|
+
if (state.selected) return visual.active_background orelse visual.hover_background orelse visual.background orelse tokens.colors.surface_pressed;
|
|
731
|
+
if (hovered) return visual.hover_background orelse visual.background orelse tokens.colors.surface_subtle;
|
|
732
|
+
// Local authored chrome is the rest rung. A theme's shared row
|
|
733
|
+
// background remains the fallback for rows without one, while its
|
|
734
|
+
// state-specific channels above still own interaction feedback.
|
|
735
|
+
return widget.style.background orelse visual.background orelse transparentColor();
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/// Surface chrome uses the same neutral feedback ladder as an actionable
|
|
739
|
+
/// row when its theme does not state state-specific colors: surface at
|
|
740
|
+
/// rest, subtle on hover, pressed on selection/press. A themed active or
|
|
741
|
+
/// hover fill remains authoritative, and a locally authored background is
|
|
742
|
+
/// the surface's explicit all-state override.
|
|
743
|
+
pub fn surfaceStateBackground(widget: Widget, visual: ControlVisualTokens, tokens: DesignTokens) Color {
|
|
744
|
+
const active = widget.state.pressed or widget.state.selected;
|
|
745
|
+
const hovered = washHovered(widget);
|
|
746
|
+
// A local background is an explicit all-state override. The theme
|
|
747
|
+
// table's background is only the REST rung: letting it participate in
|
|
748
|
+
// the state fallbacks would mask the standard subtle/pressed washes
|
|
749
|
+
// whenever a custom theme stated only its surface color.
|
|
750
|
+
if (widget.style.background) |background| return background;
|
|
751
|
+
if (widget.state.pressed) return visual.pressed_background orelse visual.active_background orelse visual.hover_background orelse tokens.colors.surface_pressed;
|
|
752
|
+
if (active) return visual.active_background orelse visual.hover_background orelse tokens.colors.surface_pressed;
|
|
753
|
+
if (hovered) return visual.hover_background orelse tokens.colors.surface_subtle;
|
|
754
|
+
return visual.background orelse tokens.colors.surface;
|
|
715
755
|
}
|
|
716
756
|
|
|
717
757
|
pub fn transparentColor() Color {
|
|
@@ -29,9 +29,11 @@ const widgetLabelTextSize = widget_metrics.widgetLabelTextSize;
|
|
|
29
29
|
const widgetLineHeight = widget_metrics.widgetLineHeight;
|
|
30
30
|
const widgetTypographySize = widget_metrics.widgetTypographySize;
|
|
31
31
|
const widgetControlInset = widget_metrics.widgetControlInset;
|
|
32
|
+
const widgetAlertInset = widget_metrics.widgetAlertInset;
|
|
32
33
|
const widgetSizedDensityValue = widget_metrics.widgetSizedDensityValue;
|
|
33
34
|
|
|
34
35
|
const colorFill = widget_render_style.colorFill;
|
|
36
|
+
const colorWithAlpha = widget_render_style.colorWithAlpha;
|
|
35
37
|
const widgetBackgroundFill = widget_render_style.widgetBackgroundFill;
|
|
36
38
|
const widgetBorderFill = widget_render_style.widgetBorderFill;
|
|
37
39
|
const widgetFocusRingFill = widget_render_style.widgetFocusRingFill;
|
|
@@ -41,8 +43,9 @@ const widgetRadius = widget_render_style.widgetRadius;
|
|
|
41
43
|
const controlRadius = widget_render_style.controlRadius;
|
|
42
44
|
const controlStrokeWidth = widget_render_style.controlStrokeWidth;
|
|
43
45
|
const snapHairlineStrokeRect = widget_render_style.snapHairlineStrokeRect;
|
|
44
|
-
const buttonStateBackground = widget_render_style.buttonStateBackground;
|
|
45
46
|
const washHovered = widget_render_style.washHovered;
|
|
47
|
+
const surfaceStateBackground = widget_render_style.surfaceStateBackground;
|
|
48
|
+
const disabledWash = widget_render_style.disabledWash;
|
|
46
49
|
const alertControlVisualTokens = widget_render_style.alertControlVisualTokens;
|
|
47
50
|
const cardControlVisualTokens = widget_render_style.cardControlVisualTokens;
|
|
48
51
|
const dialogControlVisualTokens = widget_render_style.dialogControlVisualTokens;
|
|
@@ -57,26 +60,26 @@ pub fn emitAlertWidgetChrome(builder: *Builder, widget: Widget, tokens: DesignTo
|
|
|
57
60
|
.id = widgetPartId(widget.id, 1),
|
|
58
61
|
.rect = widget.frame,
|
|
59
62
|
.radius = radius,
|
|
60
|
-
.fill = colorFill(
|
|
63
|
+
.fill = colorFill(alertBackgroundColor(widget, visual, tokens)),
|
|
61
64
|
});
|
|
62
65
|
try builder.strokeRect(snapHairlineStrokeRect(tokens, .{
|
|
63
66
|
.id = widgetPartId(widget.id, 2),
|
|
64
67
|
.rect = widget.frame,
|
|
65
68
|
.radius = radius,
|
|
66
69
|
.stroke = .{
|
|
67
|
-
.fill =
|
|
70
|
+
.fill = colorFill(alertBorderColor(widget, visual, tokens)),
|
|
68
71
|
.width = controlStrokeWidth(widget, visual, tokens.stroke.hairline),
|
|
69
72
|
},
|
|
70
73
|
}));
|
|
71
74
|
if (widget.text.len == 0) return;
|
|
72
75
|
|
|
73
|
-
// The house style alert geometry: a
|
|
76
|
+
// The house style alert geometry: a 16px-base icon centered on the first
|
|
74
77
|
// text line's box, a spacing.md gap, and wrapped text hanging past
|
|
75
78
|
// the icon column (`alertContentFrame` indents children the same
|
|
76
79
|
// way, so a description column lines up under the title).
|
|
77
80
|
const text_size = widgetBodyTextSize(widget, tokens);
|
|
78
81
|
const line_height = widgetLineHeight(text_size);
|
|
79
|
-
const inset =
|
|
82
|
+
const inset = widgetAlertInset(widget, tokens);
|
|
80
83
|
const icon_size = widgetSizedDensityValue(widget, tokens, 16);
|
|
81
84
|
const icon_frame = geometry.RectF.init(
|
|
82
85
|
widget.frame.x + inset,
|
|
@@ -91,7 +94,7 @@ pub fn emitAlertWidgetChrome(builder: *Builder, widget: Widget, tokens: DesignTo
|
|
|
91
94
|
@max(1, widget.frame.width - inset * 2 - icon_size - text_gap),
|
|
92
95
|
widget.frame.height,
|
|
93
96
|
);
|
|
94
|
-
const foreground = widgetForegroundColor(widget, tokens,
|
|
97
|
+
const foreground = widgetForegroundColor(widget, tokens, alertVariantForeground(widget, visual, tokens));
|
|
95
98
|
try emitAlertMark(builder, widget, tokens, icon_frame, foreground);
|
|
96
99
|
// Baseline centered within the first line box, so icon and first
|
|
97
100
|
// line share one optical center.
|
|
@@ -116,10 +119,38 @@ pub fn emitAlertWidgetChrome(builder: *Builder, widget: Widget, tokens: DesignTo
|
|
|
116
119
|
/// The alert's identity color: destructive alerts read in the
|
|
117
120
|
/// destructive hue (the house style `text-destructive` treatment on a plain
|
|
118
121
|
/// card surface); every other variant keeps the plain foreground.
|
|
119
|
-
fn
|
|
122
|
+
fn alertBackgroundColor(widget: Widget, visual: ControlVisualTokens, tokens: DesignTokens) Color {
|
|
123
|
+
if (widget.variant != .destructive) return surfaceStateBackground(widget, visual, tokens);
|
|
124
|
+
if (widget.style.background) |color| return disabledWash(color, widget.state.disabled, tokens.states.disabled_alpha);
|
|
125
|
+
const hue = widget.style.accent orelse tokens.colors.destructive;
|
|
126
|
+
const wash = colorWithAlpha(hue, if (widget.state.pressed)
|
|
127
|
+
tokens.states.destructive_wash_pressed_alpha
|
|
128
|
+
else if (washHovered(widget))
|
|
129
|
+
tokens.states.destructive_wash_hover_alpha
|
|
130
|
+
else
|
|
131
|
+
tokens.states.destructive_wash_alpha);
|
|
132
|
+
return disabledWash(wash, widget.state.disabled, tokens.states.disabled_alpha);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
fn alertBorderColor(widget: Widget, visual: ControlVisualTokens, tokens: DesignTokens) Color {
|
|
136
|
+
const border = widget.style.border orelse if (widget.variant == .destructive)
|
|
137
|
+
// Destructive alerts use the callout edge from the house recipe:
|
|
138
|
+
// the destructive hue at half strength. ControlTokens has one
|
|
139
|
+
// shared alert table, not per-variant alert tables, so a flat
|
|
140
|
+
// neutral `alert.border` cannot masquerade as variant theming.
|
|
141
|
+
colorWithAlpha(widget.style.accent orelse tokens.colors.destructive, 0.5)
|
|
142
|
+
else
|
|
143
|
+
visual.border orelse tokens.colors.border;
|
|
144
|
+
return disabledWash(border, widget.state.disabled, tokens.states.disabled_alpha);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
fn alertVariantForeground(widget: Widget, visual: ControlVisualTokens, tokens: DesignTokens) Color {
|
|
120
148
|
return switch (widget.variant) {
|
|
121
|
-
|
|
122
|
-
|
|
149
|
+
// Variant identity precedes the shared alert table's flat neutral
|
|
150
|
+
// foreground; a local foreground still wins in
|
|
151
|
+
// `widgetForegroundColor` and disabled then washes that result.
|
|
152
|
+
.destructive => widget.style.accent orelse tokens.colors.destructive,
|
|
153
|
+
else => visual.foreground orelse tokens.colors.text,
|
|
123
154
|
};
|
|
124
155
|
}
|
|
125
156
|
|
|
@@ -143,7 +174,7 @@ pub fn emitCardWidgetChrome(builder: *Builder, widget: Widget, tokens: DesignTok
|
|
|
143
174
|
.id = widgetPartId(widget.id, 1),
|
|
144
175
|
.rect = widget.frame,
|
|
145
176
|
.radius = radius,
|
|
146
|
-
.fill = colorFill(
|
|
177
|
+
.fill = colorFill(surfaceStateBackground(widget, visual, tokens)),
|
|
147
178
|
});
|
|
148
179
|
try builder.strokeRect(snapHairlineStrokeRect(tokens, .{
|
|
149
180
|
.id = widgetPartId(widget.id, 2),
|
|
@@ -206,7 +237,7 @@ pub fn emitModalSurfaceWidgetChrome(builder: *Builder, widget: Widget, tokens: D
|
|
|
206
237
|
.id = widgetPartId(widget.id, 2),
|
|
207
238
|
.rect = widget.frame,
|
|
208
239
|
.radius = radius,
|
|
209
|
-
.fill =
|
|
240
|
+
.fill = colorFill(surfaceStateBackground(widget, visual, tokens)),
|
|
210
241
|
});
|
|
211
242
|
try builder.strokeRect(snapHairlineStrokeRect(tokens, .{
|
|
212
243
|
.id = widgetPartId(widget.id, 3),
|
|
@@ -241,7 +272,7 @@ pub fn emitModalSurfaceWidgetChrome(builder: *Builder, widget: Widget, tokens: D
|
|
|
241
272
|
pub fn emitPanelWidgetChrome(builder: *Builder, widget: Widget, tokens: DesignTokens) Error!void {
|
|
242
273
|
const visual = surfaceControlVisualTokens(widget, tokens);
|
|
243
274
|
const radius = controlRadius(widget, visual, tokens.radius.lg);
|
|
244
|
-
const background =
|
|
275
|
+
const background = surfaceStateBackground(widget, visual, tokens);
|
|
245
276
|
const shadow_token = tokens.shadow.sm;
|
|
246
277
|
// Only an opaque surface casts a drop shadow: a translucent or
|
|
247
278
|
// fully transparent panel (a dismiss catcher, a tinted wash) has
|
|
@@ -690,7 +721,7 @@ pub fn emitPopoverWidgetChrome(builder: *Builder, widget: Widget, tokens: Design
|
|
|
690
721
|
.id = widgetPartId(widget.id, 2),
|
|
691
722
|
.rect = widget.frame,
|
|
692
723
|
.radius = radius,
|
|
693
|
-
.fill =
|
|
724
|
+
.fill = colorFill(surfaceStateBackground(widget, visual, tokens)),
|
|
694
725
|
});
|
|
695
726
|
try builder.strokeRect(snapHairlineStrokeRect(tokens, .{
|
|
696
727
|
.id = widgetPartId(widget.id, 3),
|
|
@@ -723,7 +754,7 @@ pub fn emitMenuSurfaceWidgetChrome(builder: *Builder, widget: Widget, tokens: De
|
|
|
723
754
|
.id = widgetPartId(widget.id, 2),
|
|
724
755
|
.rect = widget.frame,
|
|
725
756
|
.radius = radius,
|
|
726
|
-
.fill =
|
|
757
|
+
.fill = colorFill(surfaceStateBackground(widget, visual, tokens)),
|
|
727
758
|
});
|
|
728
759
|
try builder.strokeRect(snapHairlineStrokeRect(tokens, .{
|
|
729
760
|
.id = widgetPartId(widget.id, 3),
|