@stacksjs/components 0.2.867 → 0.2.869

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 (109) hide show
  1. package/dist/AppearancePicker-61r20jpp.stx +351 -0
  2. package/dist/{Button-sebyqeva.stx → Button-pg8mzsq3.stx} +249 -0
  3. package/dist/Checkbox-52mhrzkz.stx +417 -0
  4. package/dist/ColorSwatches-ecfxphjy.stx +287 -0
  5. package/dist/{NumberInput-axcfj9y8.stx → NumberInput-e2afxyh3.stx} +303 -0
  6. package/dist/{PasswordInput-8m3109tp.stx → PasswordInput-n2ven456.stx} +315 -0
  7. package/dist/RadioGroup-ps9kn22f.stx +329 -0
  8. package/dist/RadioGroupOption-6hyy1bvb.stx +246 -0
  9. package/dist/{SegmentedControl-fr69q4gb.stx → SegmentedControl-7q0t8c9s.stx} +170 -1
  10. package/dist/{Select-1cnqbcmg.stx → Select-ygzchedx.stx} +266 -0
  11. package/dist/SettingsGroup-dkae46k5.stx +200 -0
  12. package/dist/SettingsPane-jbd1gbdt.stx +50 -0
  13. package/dist/SettingsPaneHeader-f0cvkqs7.stx +188 -0
  14. package/dist/SettingsRow-4cxbsf1q.stx +424 -0
  15. package/dist/SettingsSidebarGroup-p2ygv5yy.stx +108 -0
  16. package/dist/SettingsSidebarItem-x8fsn3w5.stx +228 -0
  17. package/dist/SettingsWindow-mm490ymt.stx +537 -0
  18. package/dist/Slider-j59dgw1c.stx +377 -0
  19. package/dist/Switch-ga9ap8n8.stx +374 -0
  20. package/dist/{TextInput-tsvfwxmg.stx → TextInput-tyqzz3jy.stx} +325 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.js +35 -24
  23. package/dist/settings/settings.js +757 -0
  24. package/dist/ui/appearance-picker/AppearancePicker.d.ts +12 -0
  25. package/dist/ui/appearance-picker/index.d.ts +16 -0
  26. package/dist/ui/button/Button.d.ts +24 -1
  27. package/dist/ui/button/index.d.ts +1 -0
  28. package/dist/ui/checkbox/Checkbox.d.ts +9 -1
  29. package/dist/ui/checkbox/index.d.ts +1 -0
  30. package/dist/ui/color-swatches/ColorSwatches.d.ts +26 -0
  31. package/dist/ui/color-swatches/index.d.ts +18 -0
  32. package/dist/ui/input/NumberInput.d.ts +11 -1
  33. package/dist/ui/input/PasswordInput.d.ts +9 -1
  34. package/dist/ui/input/TextInput.d.ts +12 -1
  35. package/dist/ui/input/index.d.ts +7 -3
  36. package/dist/ui/radio-group/RadioGroup.d.ts +14 -2
  37. package/dist/ui/radio-group/RadioGroupOption.d.ts +6 -1
  38. package/dist/ui/radio-group/index.d.ts +2 -0
  39. package/dist/ui/segmented-control/SegmentedControl.d.ts +9 -1
  40. package/dist/ui/segmented-control/index.d.ts +1 -0
  41. package/dist/ui/select/Select.d.ts +10 -1
  42. package/dist/ui/select/index.d.ts +1 -0
  43. package/dist/ui/settings/SettingsGroup.d.ts +30 -0
  44. package/dist/ui/settings/SettingsPane.d.ts +19 -0
  45. package/dist/ui/settings/SettingsPaneHeader.d.ts +20 -0
  46. package/dist/ui/settings/SettingsRow.d.ts +53 -0
  47. package/dist/ui/settings/SettingsSidebarGroup.d.ts +11 -0
  48. package/dist/ui/settings/SettingsSidebarItem.d.ts +22 -0
  49. package/dist/ui/settings/SettingsWindow.d.ts +22 -0
  50. package/dist/ui/settings/core.d.ts +146 -0
  51. package/dist/ui/settings/index.d.ts +73 -0
  52. package/dist/ui/settings/settings.d.ts +8 -0
  53. package/dist/ui/settings/view.d.ts +36 -0
  54. package/dist/ui/slider/Slider.d.ts +24 -0
  55. package/dist/ui/slider/core.d.ts +33 -0
  56. package/dist/ui/slider/index.d.ts +20 -0
  57. package/dist/ui/switch/Switch.d.ts +10 -1
  58. package/dist/ui/switch/index.d.ts +2 -1
  59. package/dist/utils/mac-theme.d.ts +24 -0
  60. package/package.json +8 -3
  61. package/src/index.ts +6 -0
  62. package/src/ui/appearance-picker/AppearancePicker.stx +351 -0
  63. package/src/ui/appearance-picker/README.md +61 -0
  64. package/src/ui/appearance-picker/index.ts +22 -0
  65. package/src/ui/button/Button.stx +249 -0
  66. package/src/ui/button/README.md +21 -0
  67. package/src/ui/button/index.ts +8 -0
  68. package/src/ui/checkbox/Checkbox.stx +275 -0
  69. package/src/ui/checkbox/index.ts +2 -0
  70. package/src/ui/color-swatches/ColorSwatches.stx +287 -0
  71. package/src/ui/color-swatches/README.md +66 -0
  72. package/src/ui/color-swatches/index.ts +25 -0
  73. package/src/ui/input/NumberInput.stx +303 -0
  74. package/src/ui/input/PasswordInput.stx +315 -0
  75. package/src/ui/input/TextInput.stx +325 -0
  76. package/src/ui/input/index.ts +9 -3
  77. package/src/ui/radio-group/README.md +17 -0
  78. package/src/ui/radio-group/RadioGroup.stx +184 -6
  79. package/src/ui/radio-group/RadioGroupOption.stx +178 -2
  80. package/src/ui/radio-group/index.ts +4 -0
  81. package/src/ui/segmented-control/SegmentedControl.stx +170 -1
  82. package/src/ui/segmented-control/index.ts +2 -0
  83. package/src/ui/select/README.md +12 -0
  84. package/src/ui/select/Select.stx +266 -0
  85. package/src/ui/select/index.ts +2 -0
  86. package/src/ui/settings/README.md +221 -0
  87. package/src/ui/settings/SettingsGroup.stx +200 -0
  88. package/src/ui/settings/SettingsPane.stx +50 -0
  89. package/src/ui/settings/SettingsPaneHeader.stx +188 -0
  90. package/src/ui/settings/SettingsRow.stx +424 -0
  91. package/src/ui/settings/SettingsSidebarGroup.stx +108 -0
  92. package/src/ui/settings/SettingsSidebarItem.stx +228 -0
  93. package/src/ui/settings/SettingsWindow.stx +537 -0
  94. package/src/ui/settings/core.ts +359 -0
  95. package/src/ui/settings/index.ts +111 -0
  96. package/src/ui/settings/settings.ts +8 -0
  97. package/src/ui/settings/view.ts +740 -0
  98. package/src/ui/slider/README.md +91 -0
  99. package/src/ui/slider/Slider.stx +377 -0
  100. package/src/ui/slider/core.ts +120 -0
  101. package/src/ui/slider/index.ts +34 -0
  102. package/src/ui/switch/README.md +11 -0
  103. package/src/ui/switch/Switch.stx +217 -0
  104. package/src/ui/switch/index.ts +4 -1
  105. package/src/utils/mac-theme.ts +95 -0
  106. package/dist/Checkbox-80myyzzm.stx +0 -142
  107. package/dist/RadioGroup-smqcqgds.stx +0 -151
  108. package/dist/RadioGroupOption-twcw1b2a.stx +0 -70
  109. package/dist/Switch-s8yf2rvm.stx +0 -157
@@ -0,0 +1,424 @@
1
+ <script server>
2
+ /*
3
+ * <SettingsRow>: one setting in a <SettingsGroup>. Its name at the leading
4
+ * edge, a description under it, and the control (whatever is in the slot) at
5
+ * the trailing edge.
6
+ *
7
+ * <SettingsRow label="Tint window background" setting="tint" keywords="wallpaper colour">
8
+ * <Switch variant="mac" v-model:checked="tint" />
9
+ * </SettingsRow>
10
+ *
11
+ * The row is how the window's search finds a setting, so it carries
12
+ * `data-settings-row`, `data-setting`, `data-label` and `data-keywords`, and
13
+ * it draws the wash the window asks for by setting `data-highlight` on it.
14
+ *
15
+ * The label names the control. Its id is `<row id>-label` (also on the row as
16
+ * `data-label-id`), for a control that wants `aria-labelledby` itself, and
17
+ * when the first control in the slot has no accessible name the row gives it
18
+ * that one, with the description as `aria-describedby`.
19
+ *
20
+ * `to="<pane id>"` makes it a navigation row: a chevron, an optional `value`
21
+ * beside it, and `data-navigate` for the window, which is what opens the pane.
22
+ * The row only draws it.
23
+ *
24
+ * `multiline` lets the words wrap and puts the control at the top;
25
+ * `layout="stacked"` puts the control under the label at full width;
26
+ * `destructive` paints the label as a destructive action. `icon` is an
27
+ * Iconify class on a tile of `tone`.
28
+ */
29
+ const TONES = ['grey', 'blue', 'red', 'orange', 'yellow', 'green', 'indigo', 'purple', 'pink', 'ink']
30
+ export const label = $props.label || ''
31
+ export const description = $props.description || ''
32
+ export const icon = $props.icon || ''
33
+ export const tone = TONES.includes($props.tone) ? $props.tone : 'grey'
34
+ export const setting = $props.setting || ''
35
+ export const keywords = Array.isArray($props.keywords) ? $props.keywords.join(' ') : ($props.keywords || '')
36
+ export const to = $props.to || ''
37
+ export const navigates = to !== ''
38
+ export const value = $props.value || ''
39
+ export const multiline = $bool($props.multiline)
40
+ export const destructive = $bool($props.destructive)
41
+ export const disabled = $bool($props.disabled)
42
+ export const layout = $props.layout === 'stacked' ? 'stacked' : 'inline'
43
+ const settingSlug = String(setting).replace(/[^\w-]+/g, '-')
44
+ export const rowId = $props.id || (settingSlug ? `settings-row-${settingSlug}` : `settings-row-${$uid}`)
45
+ export const labelId = `${rowId}-label`
46
+ export const descriptionId = `${rowId}-description`
47
+ export const className = $props.className || ''
48
+ </script>
49
+
50
+ <script client>
51
+ const heading = useReactiveProp('label', {{ label }})
52
+ const detail = useReactiveProp('description', {{ description }})
53
+ const trailing = useReactiveProp('value', {{ value }})
54
+ const isDisabled = useReactiveProp('disabled', {{ disabled }})
55
+ const labelId = {{ labelId }}
56
+ const descriptionId = {{ descriptionId }}
57
+ const rowRef = useRef('row')
58
+
59
+ // What counts as the control: a group of choices before any one choice in it.
60
+ const CONTROLS = '[role="radiogroup"], [role="group"], input:not([type="hidden"]), select, textarea, button, [role="switch"], [role="slider"], [role="combobox"], [role="checkbox"], [role="listbox"], [role="textbox"], [role="spinbutton"], [tabindex]:not([tabindex="-1"])'
61
+
62
+ /*
63
+ * A name a control falls back to when it was given none says what kind of
64
+ * thing it is, not which setting. <Switch> calls itself "Toggle switch", and a
65
+ * window of twenty of those tells a screen reader nothing, so the row's label
66
+ * is put in charge of it: `aria-labelledby` outranks `aria-label`.
67
+ */
68
+ const PLACEHOLDER_NAMES = ['Toggle switch']
69
+
70
+ function isNamed(control) {
71
+ if (PLACEHOLDER_NAMES.includes(control.getAttribute('aria-label') || '') && !control.hasAttribute('aria-labelledby')) return false
72
+ if ((control.getAttribute('aria-label') || '').trim() !== '') return true
73
+ if (control.hasAttribute('aria-labelledby')) return true
74
+ if (control.labels && control.labels.length > 0) return true
75
+ // A push button says what it does in its own words.
76
+ return control.tagName === 'BUTTON' && !control.hasAttribute('role') && control.textContent.trim() !== ''
77
+ }
78
+
79
+ /** Name the slot's first control after the row, unless it has a name. */
80
+ function nameControl() {
81
+ const row = rowRef()
82
+ const slot = row ? row.querySelector('.stx-settings-row-control') : null
83
+ const control = slot ? slot.querySelector(CONTROLS) : null
84
+ if (!control) return null
85
+ if (!isNamed(control)) control.setAttribute('aria-labelledby', labelId)
86
+ if (detail() && !control.hasAttribute('aria-describedby')) control.setAttribute('aria-describedby', descriptionId)
87
+ return control
88
+ }
89
+
90
+ onMount(() => {
91
+ nameControl()
92
+ })
93
+
94
+ defineExpose({ labelId, descriptionId, nameControl })
95
+ </script>
96
+
97
+ <div
98
+ ref="row"
99
+ id="{{ rowId }}"
100
+ data-settings-row
101
+ @if(setting)data-setting="{{ setting }}"@endif
102
+ data-label="{{ label }}"
103
+ :data-label="heading()"
104
+ data-keywords="{{ keywords }}"
105
+ data-label-id="{{ labelId }}"
106
+ data-layout="{{ layout }}"
107
+ @if(multiline)data-multiline@endif
108
+ @if(destructive)data-destructive@endif
109
+ @if(icon)data-tile@endif
110
+ @if(navigates)data-navigate="{{ to }}" role="button" tabindex="0"@endif
111
+ @if(disabled)aria-disabled="true"@endif
112
+ :aria-disabled="isDisabled() ? 'true' : null"
113
+ class="stx-settings-row {{ className }}"
114
+ >
115
+ @if(icon)
116
+ <span class="stx-settings-row-tile" data-tone="{{ tone }}" aria-hidden="true"><i class="{{ icon }}"></i></span>
117
+ @endif
118
+ <span class="stx-settings-row-text">
119
+ <span id="{{ labelId }}" :text="heading()" class="stx-settings-row-label">{{ label }}</span>
120
+ <span id="{{ descriptionId }}" :show="detail()" :text="detail()" class="stx-settings-row-description">{{ description }}</span>
121
+ </span>
122
+ <span class="stx-settings-row-control"><slot /></span>
123
+ @if(navigates)
124
+ <span :show="trailing()" :text="trailing()" class="stx-settings-row-value">{{ value }}</span>
125
+ <span class="stx-settings-row-chevron" aria-hidden="true"></span>
126
+ @endif
127
+ </div>
128
+
129
+ <style data-native-exclude>
130
+ :where(:root) {
131
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
132
+ --stx-mac-font-size: 13px;
133
+ --stx-mac-font-size-small: 11px;
134
+ --stx-mac-hairline: 0.5px;
135
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
136
+ --stx-mac-card-radius: 12px;
137
+ --stx-mac-control-radius: 6px;
138
+ --stx-mac-row-height: 38px;
139
+ --stx-mac-row-inset: 10px;
140
+ --stx-mac-sidebar-width: 226px;
141
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
142
+ --stx-mac-accent-ink: #ffffff;
143
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
144
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
145
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
146
+ --stx-mac-window: #ffffff;
147
+ --stx-mac-sidebar: #f2f1f0;
148
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
149
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
150
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
151
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
152
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
153
+ --stx-mac-control: #ffffff;
154
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
155
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
156
+ --stx-mac-switch-on: #34c759;
157
+ --stx-mac-knob: #ffffff;
158
+ --stx-mac-danger: #ff3b30;
159
+ }
160
+ :where(.dark) {
161
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
162
+ --stx-mac-accent-ink: #ffffff;
163
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
164
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
165
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
166
+ --stx-mac-window: #1e1e1e;
167
+ --stx-mac-sidebar: #2a2a2a;
168
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
169
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
170
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
171
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
172
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
173
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
174
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
175
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.4), inset 0 0.5px 0 rgba(255, 255, 255, 0.12);
176
+ --stx-mac-switch-on: #30d158;
177
+ --stx-mac-knob: #ffffff;
178
+ --stx-mac-danger: #ff453a;
179
+ }
180
+ @media (max-resolution: 1.5dppx) {
181
+ :where(:root) {
182
+ --stx-mac-hairline: 1px;
183
+ }
184
+ }
185
+ @media (prefers-contrast: more) {
186
+ :where(:root) {
187
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
188
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
189
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
190
+ --stx-mac-hairline: 1px;
191
+ }
192
+ :where(.dark) {
193
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
194
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
195
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
196
+ }
197
+ }
198
+
199
+ :where([data-settings-row]) {
200
+ /* The tile colours a Settings icon is drawn on. */
201
+ --stx-settings-tone-grey: #8e8e93;
202
+ --stx-settings-tone-blue: #007aff;
203
+ --stx-settings-tone-red: #ff3b30;
204
+ --stx-settings-tone-orange: #ff9500;
205
+ --stx-settings-tone-yellow: #ffcc00;
206
+ --stx-settings-tone-green: #34c759;
207
+ --stx-settings-tone-indigo: #5856d6;
208
+ --stx-settings-tone-purple: #af52de;
209
+ --stx-settings-tone-pink: #ff2d55;
210
+ --stx-settings-tone-ink: #1c1c1e;
211
+ --stx-settings-tile-size: 24px;
212
+ --stx-settings-tile-radius: 6px;
213
+ --stx-settings-tile-glyph: 15px;
214
+ --stx-settings-row-gap: 10px;
215
+ --stx-settings-row-wash: color-mix(in srgb, var(--stx-mac-accent) 20%, transparent);
216
+ /* A slider in a row is a control at the trailing edge, not the row's width. */
217
+ --stx-slider-width: 220px;
218
+ position: relative;
219
+ display: flex;
220
+ flex-direction: row;
221
+ align-items: center;
222
+ gap: var(--stx-settings-row-gap);
223
+ box-sizing: border-box;
224
+ min-height: var(--stx-mac-row-height);
225
+ min-width: 0;
226
+ padding: 0 var(--stx-mac-row-inset);
227
+ font-family: var(--stx-mac-font);
228
+ font-size: var(--stx-mac-font-size);
229
+ letter-spacing: -0.08px;
230
+ color: var(--stx-mac-ink);
231
+ -webkit-font-smoothing: antialiased;
232
+ cursor: default;
233
+ outline: none;
234
+ }
235
+ :where(.dark) :where([data-settings-row]) {
236
+ --stx-settings-tone-grey: #8e8e93;
237
+ --stx-settings-tone-blue: #0a84ff;
238
+ --stx-settings-tone-red: #ff453a;
239
+ --stx-settings-tone-orange: #ff9f0a;
240
+ --stx-settings-tone-yellow: #ffd60a;
241
+ --stx-settings-tone-green: #30d158;
242
+ --stx-settings-tone-indigo: #5e5ce6;
243
+ --stx-settings-tone-purple: #bf5af2;
244
+ --stx-settings-tone-pink: #ff375f;
245
+ --stx-settings-tone-ink: #48484a;
246
+ }
247
+
248
+ /* The words. The label is one line unless the row is `multiline`; the
249
+ description always wraps. */
250
+ :where([data-settings-row]) > .stx-settings-row-text {
251
+ display: flex;
252
+ flex: 1 1 auto;
253
+ flex-direction: column;
254
+ justify-content: center;
255
+ min-width: 0;
256
+ padding: 7px 0;
257
+ -webkit-user-select: none;
258
+ user-select: none;
259
+ }
260
+ :where([data-settings-row]) .stx-settings-row-label {
261
+ overflow: hidden;
262
+ line-height: 16px;
263
+ text-overflow: ellipsis;
264
+ white-space: nowrap;
265
+ color: var(--stx-mac-ink);
266
+ }
267
+ :where([data-settings-row]) .stx-settings-row-description {
268
+ overflow: hidden;
269
+ margin-top: 1px;
270
+ font-size: var(--stx-mac-font-size-small);
271
+ line-height: 14px;
272
+ letter-spacing: 0;
273
+ /* A description wraps, as System Settings' do: it is a sentence, and a
274
+ sentence cut off at the control says less than no sentence. */
275
+ overflow-wrap: anywhere;
276
+ white-space: normal;
277
+ color: var(--stx-mac-ink-secondary);
278
+ }
279
+ :where([data-settings-row]) .stx-settings-row-description:empty { display: none; }
280
+ :where([data-settings-row][data-destructive]) .stx-settings-row-label { color: var(--stx-mac-danger); }
281
+
282
+ /* The control, at the trailing edge and never squeezed by the words. */
283
+ :where([data-settings-row]) > .stx-settings-row-control {
284
+ display: flex;
285
+ flex: 0 0 auto;
286
+ flex-direction: row;
287
+ align-items: center;
288
+ justify-content: flex-end;
289
+ gap: 8px;
290
+ max-width: 100%;
291
+ min-width: 0;
292
+ }
293
+ :where([data-settings-row]) > .stx-settings-row-control:empty { display: none; }
294
+
295
+ /* Words that wrap, with the control level with the first line. */
296
+ :where([data-settings-row][data-multiline]) { align-items: flex-start; }
297
+ :where([data-settings-row][data-multiline]) > .stx-settings-row-text { justify-content: flex-start; padding: 10px 0; }
298
+ :where([data-settings-row][data-multiline]) :is(.stx-settings-row-label, .stx-settings-row-description) {
299
+ overflow: visible;
300
+ text-overflow: clip;
301
+ white-space: normal;
302
+ }
303
+ :where([data-settings-row][data-multiline]) > .stx-settings-row-control { padding: 10px 0; }
304
+ :where([data-settings-row][data-multiline]) > :is(.stx-settings-row-tile, .stx-settings-row-chevron, .stx-settings-row-value) { margin-top: 10px; }
305
+
306
+ /* The control under the label, as wide as the row: a text area, a radio group. */
307
+ :where([data-settings-row][data-layout="stacked"]) {
308
+ flex-direction: column;
309
+ align-items: stretch;
310
+ gap: 4px;
311
+ --stx-slider-width: 100%;
312
+ }
313
+ :where([data-settings-row][data-layout="stacked"]) > .stx-settings-row-text { flex: 0 0 auto; padding: 10px 0 0; }
314
+ :where([data-settings-row][data-layout="stacked"]) > .stx-settings-row-control {
315
+ flex-direction: column;
316
+ align-items: stretch;
317
+ justify-content: flex-start;
318
+ gap: 0;
319
+ padding: 0 0 7px;
320
+ }
321
+
322
+ /* The icon tile. */
323
+ :where([data-settings-row]) > .stx-settings-row-tile {
324
+ display: inline-flex;
325
+ flex: 0 0 auto;
326
+ align-items: center;
327
+ justify-content: center;
328
+ width: var(--stx-settings-tile-size);
329
+ height: var(--stx-settings-tile-size);
330
+ border-radius: var(--stx-settings-tile-radius);
331
+ background: var(--stx-settings-tone-grey);
332
+ color: #ffffff;
333
+ font-size: var(--stx-settings-tile-glyph);
334
+ line-height: 1;
335
+ }
336
+ :where([data-settings-row]) > .stx-settings-row-tile > i { display: block; width: 1em; height: 1em; }
337
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="blue"] { background: var(--stx-settings-tone-blue); }
338
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="red"] { background: var(--stx-settings-tone-red); }
339
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="orange"] { background: var(--stx-settings-tone-orange); }
340
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="yellow"] { background: var(--stx-settings-tone-yellow); }
341
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="green"] { background: var(--stx-settings-tone-green); }
342
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="indigo"] { background: var(--stx-settings-tone-indigo); }
343
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="purple"] { background: var(--stx-settings-tone-purple); }
344
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="pink"] { background: var(--stx-settings-tone-pink); }
345
+ :where([data-settings-row]) > .stx-settings-row-tile[data-tone="ink"] { background: var(--stx-settings-tone-ink); }
346
+
347
+ /* A navigation row: a value, a chevron, and something to press. */
348
+ :where([data-settings-row][data-navigate][data-tile]) { min-height: 44px; }
349
+ :where([data-settings-row]) > .stx-settings-row-value {
350
+ flex: 0 1 auto;
351
+ overflow: hidden;
352
+ min-width: 0;
353
+ text-overflow: ellipsis;
354
+ white-space: nowrap;
355
+ color: var(--stx-mac-ink-secondary);
356
+ -webkit-user-select: none;
357
+ user-select: none;
358
+ }
359
+ :where([data-settings-row]) > .stx-settings-row-value:empty { display: none; }
360
+ :where([data-settings-row]) > .stx-settings-row-chevron {
361
+ position: relative;
362
+ flex: 0 0 auto;
363
+ width: 7px;
364
+ height: 11px;
365
+ margin-left: -2px;
366
+ }
367
+ :where([data-settings-row]) > .stx-settings-row-chevron::before {
368
+ content: '';
369
+ position: absolute;
370
+ top: 50%;
371
+ left: 0;
372
+ box-sizing: border-box;
373
+ width: 7px;
374
+ height: 7px;
375
+ border-top: 1.5px solid var(--stx-mac-ink-tertiary);
376
+ border-right: 1.5px solid var(--stx-mac-ink-tertiary);
377
+ border-radius: 0.5px;
378
+ transform: translate(-2px, -50%) rotate(45deg);
379
+ }
380
+
381
+ /*
382
+ * What a row is washed with: hover and press on a navigation row, the focus
383
+ * ring, and the highlight the window's search puts on a found row. A rounded
384
+ * shape inside the row, concentric with the card, so the card need not clip.
385
+ */
386
+ :where([data-settings-row])::after {
387
+ content: '';
388
+ position: absolute;
389
+ inset: 3px;
390
+ border-radius: calc(var(--stx-mac-card-radius) - 3px);
391
+ background: transparent;
392
+ pointer-events: none;
393
+ transition: background-color 150ms ease;
394
+ }
395
+ :where([data-settings-row][data-navigate]:hover)::after { background: var(--stx-mac-hover); }
396
+ :where([data-settings-row][data-navigate]:active)::after { background: var(--stx-mac-selection-inactive); }
397
+ :where([data-settings-row][data-navigate]:focus-visible)::after { box-shadow: var(--stx-mac-focus-ring); }
398
+
399
+ :where([data-settings-row][aria-disabled="true"]) > :not(.stx-settings-row-tile) { opacity: 0.4; }
400
+ :where([data-settings-row][aria-disabled="true"]) { pointer-events: none; }
401
+
402
+ [data-settings-row][data-highlight]::after { animation: stx-settings-row-highlight 1.6s ease-out both; }
403
+ @keyframes stx-settings-row-highlight {
404
+ 0%, 30% { background: var(--stx-settings-row-wash); }
405
+ 100% { background: transparent; }
406
+ }
407
+
408
+ /* A window that is not the key window has no accent to wash with. */
409
+ :where([data-stx-window-active="false"]) :where([data-settings-row]),
410
+ :root[data-craft-window-active='false'] :where([data-settings-row]) {
411
+ --stx-settings-row-wash: var(--stx-mac-selection-inactive);
412
+ }
413
+
414
+ @media (prefers-reduced-motion: reduce) {
415
+ :where([data-settings-row])::after { transition: none; }
416
+ /* The found row is still marked, for as long as the window marks it. It does not move. */
417
+ [data-settings-row][data-highlight]::after { animation: none; background: var(--stx-settings-row-wash); }
418
+ }
419
+
420
+ @media (prefers-contrast: more) {
421
+ :where([data-settings-row]) > .stx-settings-row-chevron::before { border-color: var(--stx-mac-ink-secondary); }
422
+ :where([data-settings-row][data-navigate]:focus-visible)::after { box-shadow: 0 0 0 2px var(--stx-mac-accent); }
423
+ }
424
+ </style>
@@ -0,0 +1,108 @@
1
+ <script server>
2
+ /*
3
+ * <SettingsSidebarGroup>: a run of sidebar items, set a little apart from the
4
+ * next. System Settings gives its groups no headings; `label` is there for
5
+ * the window that needs one.
6
+ */
7
+ export const label = $props.label || ''
8
+ export const className = $props.className || ''
9
+ </script>
10
+
11
+ <div data-settings-group role="presentation" class="stx-settings-group {{ className }}">
12
+ @if(label)
13
+ <div class="stx-settings-group-label" role="presentation">{{ label }}</div>
14
+ @endif
15
+ <slot />
16
+ </div>
17
+
18
+ <style data-native-exclude>
19
+ :where(:root) {
20
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
21
+ --stx-mac-font-size: 13px;
22
+ --stx-mac-font-size-small: 11px;
23
+ --stx-mac-hairline: 0.5px;
24
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
25
+ --stx-mac-card-radius: 12px;
26
+ --stx-mac-control-radius: 6px;
27
+ --stx-mac-row-height: 38px;
28
+ --stx-mac-row-inset: 10px;
29
+ --stx-mac-sidebar-width: 226px;
30
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
31
+ --stx-mac-accent-ink: #ffffff;
32
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
33
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
34
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
35
+ --stx-mac-window: #ffffff;
36
+ --stx-mac-sidebar: #f2f1f0;
37
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
38
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
39
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
40
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
41
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
42
+ --stx-mac-control: #ffffff;
43
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
44
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
45
+ --stx-mac-switch-on: #34c759;
46
+ --stx-mac-knob: #ffffff;
47
+ --stx-mac-danger: #ff3b30;
48
+ }
49
+ :where(.dark) {
50
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
51
+ --stx-mac-accent-ink: #ffffff;
52
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
53
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
54
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
55
+ --stx-mac-window: #1e1e1e;
56
+ --stx-mac-sidebar: #2a2a2a;
57
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
58
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
59
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
60
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
61
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
62
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
63
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
64
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.4), inset 0 0.5px 0 rgba(255, 255, 255, 0.12);
65
+ --stx-mac-switch-on: #30d158;
66
+ --stx-mac-knob: #ffffff;
67
+ --stx-mac-danger: #ff453a;
68
+ }
69
+ @media (max-resolution: 1.5dppx) {
70
+ :where(:root) {
71
+ --stx-mac-hairline: 1px;
72
+ }
73
+ }
74
+ @media (prefers-contrast: more) {
75
+ :where(:root) {
76
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
77
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
78
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
79
+ --stx-mac-hairline: 1px;
80
+ }
81
+ :where(.dark) {
82
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
83
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
84
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
85
+ }
86
+ }
87
+
88
+ :where([data-settings-group]) {
89
+ --stx-settings-group-gap: 13px;
90
+ --stx-settings-item-gap: 2px;
91
+ }
92
+ .stx-settings-group {
93
+ display: flex;
94
+ flex-direction: column;
95
+ gap: var(--stx-settings-item-gap);
96
+ }
97
+ .stx-settings-group[hidden] { display: none; }
98
+ /* The gap sits above every group but the first one showing, so a search that hides a group hides its gap. */
99
+ .stx-settings-group:not([hidden]) ~ .stx-settings-group,
100
+ :where([data-stx-scope]):has(> .stx-settings-group:not([hidden])) ~ :where([data-stx-scope]) > .stx-settings-group { margin-top: var(--stx-settings-group-gap); }
101
+ .stx-settings-group-label {
102
+ padding: 0 8px 3px;
103
+ color: var(--stx-mac-ink-secondary);
104
+ font-size: var(--stx-mac-font-size-small);
105
+ font-weight: 600;
106
+ letter-spacing: 0;
107
+ }
108
+ </style>