@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
@@ -41,6 +41,14 @@ export const disabled = $bool($props.disabled)
41
41
  export const size = $props.size === 'sm' ? 'sm' : $props.size === 'lg' ? 'lg' : 'md'
42
42
  export const testID = $props.testID || ''
43
43
  export const className = $props.className || ''
44
+ /*
45
+ * `variant="mac"` draws the segmented control a Mac draws: a 24px capsule
46
+ * track with the chosen segment raised in it. The buttons, `aria-pressed` and
47
+ * the events are the ones below; only the classes change, to
48
+ * `stx-mac-segmented`, which this file's <style> block draws from the
49
+ * `--stx-mac-*` tokens. It has one size, so `size` is not read.
50
+ */
51
+ export const mac = $props.variant === 'mac' && !$native
44
52
 
45
53
  const sizeClasses = {
46
54
  sm: { segment: 'min-h-[28px] px-2.5 py-1', text: 'text-[13px]' },
@@ -64,7 +72,9 @@ const segmentSizing = stretch ? sizing.segment.replace(/\bpx-\S+/, stretchedPadd
64
72
  */
65
73
  export const trackClasses = $native
66
74
  ? `${stretch ? 'flex' : 'self-start'} flex-row gap-0.5 p-0.5 rounded-[9px] bg-[#767680]/12 dark:bg-[#767680]/24 ${className}`.replace(/\s+/g, ' ').trim()
67
- : `${stretch ? 'flex' : 'inline-flex'} flex-row gap-0.5 p-0.5 rounded-control bg-surface-sunken ${className}`.replace(/\s+/g, ' ').trim()
75
+ : mac
76
+ ? `stx-mac-segmented ${stretch ? 'stx-mac-segmented-stretch' : ''} ${className}`.replace(/\s+/g, ' ').trim()
77
+ : `${stretch ? 'flex' : 'inline-flex'} flex-row gap-0.5 p-0.5 rounded-control bg-surface-sunken ${className}`.replace(/\s+/g, ' ').trim()
68
78
  export const segmentBase = $native
69
79
  ? `${stretch ? 'flex-1 min-w-0' : ''} items-center justify-center rounded-[7px] ${segmentSizing}`.replace(/\s+/g, ' ').trim()
70
80
  : `${stretch ? 'flex-1 min-w-0' : ''} items-center justify-center rounded-control transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${segmentSizing}`.replace(/\s+/g, ' ').trim()
@@ -89,6 +99,9 @@ const segmentOn = {{ segmentOn }}
89
99
  const segmentOff = {{ segmentOff }}
90
100
  const labelOn = {{ labelOn }}
91
101
  const labelOff = {{ labelOff }}
102
+ // The Mac look is drawn from `aria-pressed` and `disabled` in the stylesheet,
103
+ // so a segment's class does not change with its state.
104
+ const macLook = {{ mac }}
92
105
 
93
106
  /** A choice as `{ value, label, disabled }`, whichever way it was written. */
94
107
  function normalise(choice) {
@@ -130,11 +143,13 @@ function onNativeChange(event) {
130
143
  }
131
144
 
132
145
  function segmentClasses(segment) {
146
+ if (macLook) return 'stx-mac-segment'
133
147
  const state = isOn(segment) ? segmentOn : 'bg-transparent'
134
148
  return `${segmentBase} ${state} ${isOff(segment) ? segmentOff : 'cursor-pointer'}`
135
149
  }
136
150
 
137
151
  function labelClasses(segment) {
152
+ if (macLook) return 'stx-mac-segment-label'
138
153
  return `${textSize} ${isOn(segment) ? labelOn : labelOff}`
139
154
  }
140
155
 
@@ -176,3 +191,157 @@ defineExpose({ selected })
176
191
  @click="choose(segment)"
177
192
  ><span class="truncate" :class="labelClasses(segment)" :text="segment.label"></span></button>
178
193
  </div>
194
+
195
+ <style data-native-exclude>
196
+ :where(:root) {
197
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
198
+ --stx-mac-font-size: 13px;
199
+ --stx-mac-font-size-small: 11px;
200
+ --stx-mac-hairline: 0.5px;
201
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
202
+ --stx-mac-card-radius: 12px;
203
+ --stx-mac-control-radius: 6px;
204
+ --stx-mac-row-height: 38px;
205
+ --stx-mac-row-inset: 10px;
206
+ --stx-mac-sidebar-width: 226px;
207
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
208
+ --stx-mac-accent-ink: #ffffff;
209
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
210
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
211
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
212
+ --stx-mac-window: #ffffff;
213
+ --stx-mac-sidebar: #f2f1f0;
214
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
215
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
216
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
217
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
218
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
219
+ --stx-mac-control: #ffffff;
220
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
221
+ --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);
222
+ --stx-mac-switch-on: #34c759;
223
+ --stx-mac-knob: #ffffff;
224
+ --stx-mac-danger: #ff3b30;
225
+ }
226
+ :where(.dark) {
227
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
228
+ --stx-mac-accent-ink: #ffffff;
229
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
230
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
231
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
232
+ --stx-mac-window: #1e1e1e;
233
+ --stx-mac-sidebar: #2a2a2a;
234
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
235
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
236
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
237
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
238
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
239
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
240
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
241
+ --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);
242
+ --stx-mac-switch-on: #30d158;
243
+ --stx-mac-knob: #ffffff;
244
+ --stx-mac-danger: #ff453a;
245
+ }
246
+ @media (max-resolution: 1.5dppx) {
247
+ :where(:root) {
248
+ --stx-mac-hairline: 1px;
249
+ }
250
+ }
251
+ @media (prefers-contrast: more) {
252
+ :where(:root) {
253
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
254
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
255
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
256
+ --stx-mac-hairline: 1px;
257
+ }
258
+ :where(.dark) {
259
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
260
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
261
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
262
+ }
263
+ }
264
+
265
+ .stx-mac-segmented {
266
+ display: inline-flex;
267
+ box-sizing: border-box;
268
+ height: 24px;
269
+ padding: 2px;
270
+ border-radius: 12px;
271
+ background: var(--stx-mac-well);
272
+ font-family: var(--stx-mac-font);
273
+ font-size: var(--stx-mac-font-size);
274
+ letter-spacing: -0.08px;
275
+ -webkit-font-smoothing: antialiased;
276
+ color: var(--stx-mac-ink);
277
+ cursor: default;
278
+ -webkit-user-select: none;
279
+ user-select: none;
280
+ }
281
+
282
+ .stx-mac-segmented-stretch {
283
+ display: flex;
284
+ }
285
+
286
+ .stx-mac-segment {
287
+ display: inline-flex;
288
+ flex: none;
289
+ align-items: center;
290
+ justify-content: center;
291
+ box-sizing: border-box;
292
+ min-width: 0;
293
+ height: 20px;
294
+ margin: 0;
295
+ padding: 0 10px;
296
+ border: 0;
297
+ border-radius: 10px;
298
+ background: transparent;
299
+ color: inherit;
300
+ font: inherit;
301
+ letter-spacing: inherit;
302
+ -webkit-appearance: none;
303
+ appearance: none;
304
+ cursor: default;
305
+ outline: none;
306
+ transition: background-color 150ms ease, box-shadow 150ms ease;
307
+ }
308
+
309
+ .stx-mac-segmented-stretch .stx-mac-segment {
310
+ flex: 1 1 0;
311
+ }
312
+
313
+ .stx-mac-segment[aria-pressed='true'] {
314
+ background: var(--stx-mac-control);
315
+ box-shadow: var(--stx-mac-control-shadow);
316
+ }
317
+
318
+ .stx-mac-segment:focus-visible {
319
+ box-shadow: var(--stx-mac-focus-ring);
320
+ }
321
+
322
+ .stx-mac-segment[aria-pressed='true']:focus-visible {
323
+ box-shadow: var(--stx-mac-control-shadow), var(--stx-mac-focus-ring);
324
+ }
325
+
326
+ .stx-mac-segment:disabled {
327
+ opacity: 0.5;
328
+ }
329
+
330
+ .stx-mac-segment-label {
331
+ overflow: hidden;
332
+ text-overflow: ellipsis;
333
+ white-space: nowrap;
334
+ }
335
+
336
+ @media (prefers-reduced-motion: reduce) {
337
+ .stx-mac-segment {
338
+ transition: none;
339
+ }
340
+ }
341
+
342
+ @media (prefers-contrast: more) {
343
+ .stx-mac-segmented {
344
+ box-shadow: inset 0 0 0 1px var(--stx-mac-control-line);
345
+ }
346
+ }
347
+ </style>
@@ -36,6 +36,15 @@ export const label = $props.label || ''
36
36
  export const helperText = $props.helperText || ''
37
37
  export const required = $bool($props.required)
38
38
  export const className = $props.className || ''
39
+ /*
40
+ * `variant="mac"` draws the pop-up button a Mac draws: the chosen value as
41
+ * plain text, right-aligned, and a 20px disc holding an up and a down
42
+ * chevron. It is still the <select> below, so the menu it opens, the keys
43
+ * that work in it and the value it submits are the platform's own (on a Mac
44
+ * that menu is the system's). Only the classes change, to `stx-mac-popup`,
45
+ * which this file's <style> block draws from the `--stx-mac-*` tokens.
46
+ */
47
+ export const mac = $props.variant === 'mac'
39
48
 
40
49
  /*
41
50
  * Padding decides the height here too, with no `h-*` to override it: an app
@@ -191,6 +200,64 @@ defineExpose({ value: selectedValue, options: optionList })
191
200
  <p id="{{ helperId }}" class="mt-1.5 px-4 text-[13px] {{ error ? 'text-[#ff3b30] dark:text-[#ff453a]' : 'text-[#6d6d72] dark:text-[#8d8d93]' }}">{{ helperText }}</p>
192
201
  @endif
193
202
  </div>
203
+ @elseif(mac)
204
+ <div class="stx-mac-popup-field">
205
+ @if(label)
206
+ <label for="{{ selectId }}" class="stx-mac-popup-label">
207
+ {{ label }}
208
+ @if(required)
209
+ <span class="stx-mac-popup-required">*</span>
210
+ @endif
211
+ </label>
212
+ @endif
213
+
214
+ <div class="stx-mac-popup">
215
+ <select
216
+ @if(name)name="{{ name }}"@endif
217
+ @if(autocomplete)autocomplete="{{ autocomplete }}"@endif
218
+ @if(form)form="{{ form }}"@endif
219
+ id="{{ selectId }}"
220
+ class="stx-mac-popup-select {{ className }}"
221
+ :value="selectedValue()"
222
+ @if(disabled)disabled@endif
223
+ @if(required)required@endif
224
+ @change="onChange($event)"
225
+ aria-invalid="{{ error ? 'true' : 'false' }}"
226
+ :aria-invalid="isError() ? 'true' : 'false'"
227
+ @if(helperText)aria-describedby="{{ helperId }}"@endif
228
+ >
229
+ @if(placeholder)
230
+ <option value="" disabled>{{ placeholder }}</option>
231
+ @endif
232
+
233
+ {{-- The served list and the live one, as in the default look below. --}}
234
+ @foreach(option in options)
235
+ <option
236
+ x-no-cloak
237
+ x-if="false"
238
+ value="{{ option.value }}"
239
+ @if(option.disabled)disabled@endif
240
+ @if(option.value === String(value))selected@endif
241
+ >{{ option.label }}</option>
242
+ @endforeach
243
+
244
+ <template :for="option in optionList()" :key="option.value">
245
+ <option :value="option.value" :disabled="option.disabled" x-text="option.label"></option>
246
+ </template>
247
+
248
+ <slot />
249
+ </select>
250
+ {{-- The disc is a picture of the control, not a second one: the select
251
+ lies under it and takes the click. --}}
252
+ <span class="stx-mac-popup-disc" aria-hidden="true"></span>
253
+ </div>
254
+
255
+ @if(helperText)
256
+ <p id="{{ helperId }}" class="stx-mac-popup-helper" @if(error)data-error="true"@endif>
257
+ {{ helperText }}
258
+ </p>
259
+ @endif
260
+ </div>
194
261
  @else
195
262
  <div class="w-full">
196
263
  @if(label)
@@ -263,3 +330,202 @@ defineExpose({ value: selectedValue, options: optionList })
263
330
  @endif
264
331
  </div>
265
332
  @endif
333
+
334
+ <style data-native-exclude>
335
+ :where(:root) {
336
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
337
+ --stx-mac-font-size: 13px;
338
+ --stx-mac-font-size-small: 11px;
339
+ --stx-mac-hairline: 0.5px;
340
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
341
+ --stx-mac-card-radius: 12px;
342
+ --stx-mac-control-radius: 6px;
343
+ --stx-mac-row-height: 38px;
344
+ --stx-mac-row-inset: 10px;
345
+ --stx-mac-sidebar-width: 226px;
346
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
347
+ --stx-mac-accent-ink: #ffffff;
348
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
349
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
350
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
351
+ --stx-mac-window: #ffffff;
352
+ --stx-mac-sidebar: #f2f1f0;
353
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
354
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
355
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
356
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
357
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
358
+ --stx-mac-control: #ffffff;
359
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
360
+ --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);
361
+ --stx-mac-switch-on: #34c759;
362
+ --stx-mac-knob: #ffffff;
363
+ --stx-mac-danger: #ff3b30;
364
+ }
365
+ :where(.dark) {
366
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
367
+ --stx-mac-accent-ink: #ffffff;
368
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
369
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
370
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
371
+ --stx-mac-window: #1e1e1e;
372
+ --stx-mac-sidebar: #2a2a2a;
373
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
374
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
375
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
376
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
377
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
378
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
379
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
380
+ --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);
381
+ --stx-mac-switch-on: #30d158;
382
+ --stx-mac-knob: #ffffff;
383
+ --stx-mac-danger: #ff453a;
384
+ }
385
+ @media (max-resolution: 1.5dppx) {
386
+ :where(:root) {
387
+ --stx-mac-hairline: 1px;
388
+ }
389
+ }
390
+ @media (prefers-contrast: more) {
391
+ :where(:root) {
392
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
393
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
394
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
395
+ --stx-mac-hairline: 1px;
396
+ }
397
+ :where(.dark) {
398
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
399
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
400
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
401
+ }
402
+ }
403
+
404
+ .stx-mac-popup-field {
405
+ display: inline-flex;
406
+ flex-direction: column;
407
+ align-items: flex-end;
408
+ gap: 4px;
409
+ max-width: 100%;
410
+ font-family: var(--stx-mac-font);
411
+ font-size: var(--stx-mac-font-size);
412
+ letter-spacing: -0.08px;
413
+ -webkit-font-smoothing: antialiased;
414
+ color: var(--stx-mac-ink);
415
+ cursor: default;
416
+ -webkit-user-select: none;
417
+ user-select: none;
418
+ }
419
+
420
+ .stx-mac-popup-required {
421
+ color: var(--stx-mac-danger);
422
+ }
423
+
424
+ .stx-mac-popup {
425
+ --stx-mac-popup-disc: var(--stx-mac-well);
426
+ --stx-mac-popup-disc-hover: color-mix(in srgb, var(--stx-mac-ink) 14%, transparent);
427
+ position: relative;
428
+ display: inline-flex;
429
+ align-items: center;
430
+ max-width: 100%;
431
+ height: 20px;
432
+ }
433
+
434
+ .stx-mac-popup-select {
435
+ box-sizing: border-box;
436
+ max-width: 100%;
437
+ height: 20px;
438
+ margin: 0;
439
+ padding: 0 28px 0 6px;
440
+ border: 0;
441
+ border-radius: 10px;
442
+ background: transparent;
443
+ color: var(--stx-mac-ink);
444
+ font: inherit;
445
+ line-height: 20px;
446
+ letter-spacing: inherit;
447
+ text-align: right;
448
+ text-align-last: right;
449
+ field-sizing: content;
450
+ -webkit-appearance: none;
451
+ appearance: none;
452
+ cursor: default;
453
+ outline: none;
454
+ }
455
+
456
+ .stx-mac-popup-select:focus-visible {
457
+ box-shadow: var(--stx-mac-focus-ring);
458
+ }
459
+
460
+ .stx-mac-popup-select[aria-invalid='true'] {
461
+ color: var(--stx-mac-danger);
462
+ }
463
+
464
+ .stx-mac-popup-select:disabled,
465
+ .stx-mac-popup-select:disabled + .stx-mac-popup-disc {
466
+ opacity: 0.5;
467
+ }
468
+
469
+ .stx-mac-popup-disc {
470
+ position: absolute;
471
+ top: 0;
472
+ right: 0;
473
+ width: 20px;
474
+ height: 20px;
475
+ border-radius: 50%;
476
+ background: var(--stx-mac-popup-disc);
477
+ color: var(--stx-mac-ink);
478
+ pointer-events: none;
479
+ transition: background-color 150ms ease;
480
+ }
481
+
482
+ .stx-mac-popup:hover .stx-mac-popup-select:not(:disabled) + .stx-mac-popup-disc {
483
+ background: var(--stx-mac-popup-disc-hover);
484
+ }
485
+
486
+ /* The two chevrons, each the corner of a small square turned on its point. */
487
+ .stx-mac-popup-disc::before,
488
+ .stx-mac-popup-disc::after {
489
+ content: '';
490
+ position: absolute;
491
+ left: 7.5px;
492
+ box-sizing: border-box;
493
+ width: 5px;
494
+ height: 5px;
495
+ border: solid currentColor;
496
+ border-width: 1.5px 0 0 1.5px;
497
+ }
498
+
499
+ .stx-mac-popup-disc::before {
500
+ top: 5.5px;
501
+ transform: rotate(45deg);
502
+ }
503
+
504
+ .stx-mac-popup-disc::after {
505
+ top: 9.5px;
506
+ transform: rotate(225deg);
507
+ }
508
+
509
+ .stx-mac-popup-helper {
510
+ margin: 0;
511
+ font-size: var(--stx-mac-font-size-small);
512
+ letter-spacing: 0;
513
+ color: var(--stx-mac-ink-secondary);
514
+ }
515
+
516
+ .stx-mac-popup-helper[data-error='true'] {
517
+ color: var(--stx-mac-danger);
518
+ }
519
+
520
+ @media (prefers-reduced-motion: reduce) {
521
+ .stx-mac-popup-disc {
522
+ transition: none;
523
+ }
524
+ }
525
+
526
+ @media (prefers-contrast: more) {
527
+ .stx-mac-popup-disc {
528
+ box-shadow: inset 0 0 0 1px var(--stx-mac-control-line);
529
+ }
530
+ }
531
+ </style>
@@ -0,0 +1,200 @@
1
+ <script server>
2
+ /*
3
+ * <SettingsGroup>: the rounded inset card a Settings pane is made of, with an
4
+ * optional heading above it and a footnote below.
5
+ *
6
+ * <SettingsGroup header="Windows" footer="Applies to new windows.">
7
+ * <SettingsRow label="Sidebar icon size">...</SettingsRow>
8
+ * <SettingsRow label="Tint window background">...</SettingsRow>
9
+ * </SettingsGroup>
10
+ *
11
+ * The rows are whatever is inside. Each `[data-settings-row]` after the first
12
+ * draws a hairline above itself, inset on both sides, so the card has rules
13
+ * between rows and none at its edges. The rule is found with a sibling
14
+ * selector that looks through the `display: contents` wrapper stx puts
15
+ * around every component, which is why the card does not need to know how
16
+ * many rows it has or which is last.
17
+ *
18
+ * `footer` is text, or a named slot when the footnote carries a link:
19
+ *
20
+ * <template #footer>Read the <a href="/privacy">privacy notes</a>.</template>
21
+ */
22
+ export const header = $props.header || ''
23
+ export const footer = $props.footer || ''
24
+ export const hasFooterSlot = Boolean($slots && $slots.footer)
25
+ export const groupId = $props.id || `settings-section-${$uid}`
26
+ export const headerId = `${groupId}-header`
27
+ export const className = $props.className || ''
28
+ </script>
29
+
30
+ <script client>
31
+ const heading = useReactiveProp('header', {{ header }})
32
+ const note = useReactiveProp('footer', {{ footer }})
33
+ const headerId = {{ headerId }}
34
+ </script>
35
+
36
+ <section id="{{ groupId }}" data-settings-section class="stx-settings-section {{ className }}">
37
+ <h3 id="{{ headerId }}" :show="heading()" :text="heading()" class="stx-settings-section-header">{{ header }}</h3>
38
+ <div class="stx-settings-card" role="group" @if(header)aria-labelledby="{{ headerId }}"@endif :aria-labelledby="heading() ? headerId : null">
39
+ <slot />
40
+ </div>
41
+ @if(hasFooterSlot)
42
+ <p class="stx-settings-section-footer"><slot name="footer" /></p>
43
+ @else
44
+ <p :show="note()" :text="note()" class="stx-settings-section-footer">{{ footer }}</p>
45
+ @endif
46
+ </section>
47
+
48
+ <style data-native-exclude>
49
+ :where(:root) {
50
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
51
+ --stx-mac-font-size: 13px;
52
+ --stx-mac-font-size-small: 11px;
53
+ --stx-mac-hairline: 0.5px;
54
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
55
+ --stx-mac-card-radius: 12px;
56
+ --stx-mac-control-radius: 6px;
57
+ --stx-mac-row-height: 38px;
58
+ --stx-mac-row-inset: 10px;
59
+ --stx-mac-sidebar-width: 226px;
60
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
61
+ --stx-mac-accent-ink: #ffffff;
62
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
63
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
64
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
65
+ --stx-mac-window: #ffffff;
66
+ --stx-mac-sidebar: #f2f1f0;
67
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
68
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
69
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
70
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
71
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
72
+ --stx-mac-control: #ffffff;
73
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
74
+ --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);
75
+ --stx-mac-switch-on: #34c759;
76
+ --stx-mac-knob: #ffffff;
77
+ --stx-mac-danger: #ff3b30;
78
+ }
79
+ :where(.dark) {
80
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
81
+ --stx-mac-accent-ink: #ffffff;
82
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
83
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
84
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
85
+ --stx-mac-window: #1e1e1e;
86
+ --stx-mac-sidebar: #2a2a2a;
87
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
88
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
89
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
90
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
91
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
92
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
93
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
94
+ --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);
95
+ --stx-mac-switch-on: #30d158;
96
+ --stx-mac-knob: #ffffff;
97
+ --stx-mac-danger: #ff453a;
98
+ }
99
+ @media (max-resolution: 1.5dppx) {
100
+ :where(:root) {
101
+ --stx-mac-hairline: 1px;
102
+ }
103
+ }
104
+ @media (prefers-contrast: more) {
105
+ :where(:root) {
106
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
107
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
108
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
109
+ --stx-mac-hairline: 1px;
110
+ }
111
+ :where(.dark) {
112
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
113
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
114
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
115
+ }
116
+ }
117
+
118
+ /*
119
+ * The card. No border and no clipping: a pop-up menu or a focus ring inside a
120
+ * row has to be able to leave it.
121
+ */
122
+ :where([data-settings-section]) {
123
+ --stx-settings-section-gap: 10px;
124
+ --stx-settings-header-above: 18px;
125
+ --stx-settings-header-below: 8px;
126
+ --stx-settings-footer-above: 6px;
127
+ display: block;
128
+ margin: 0 0 var(--stx-settings-section-gap);
129
+ padding: 0;
130
+ font-family: var(--stx-mac-font);
131
+ font-size: var(--stx-mac-font-size);
132
+ letter-spacing: -0.08px;
133
+ color: var(--stx-mac-ink);
134
+ -webkit-font-smoothing: antialiased;
135
+ cursor: default;
136
+ }
137
+
138
+ /* Ten of the 28 above a heading are the gap the card before it left. */
139
+ :where([data-settings-section]) > .stx-settings-section-header {
140
+ margin: 0;
141
+ padding: var(--stx-settings-header-above) var(--stx-mac-row-inset) var(--stx-settings-header-below);
142
+ font-size: var(--stx-mac-font-size);
143
+ font-weight: 700;
144
+ line-height: 16px;
145
+ color: var(--stx-mac-ink);
146
+ -webkit-user-select: none;
147
+ user-select: none;
148
+ }
149
+
150
+ :where([data-settings-section]) > .stx-settings-card {
151
+ display: flex;
152
+ flex-direction: column;
153
+ min-width: 0;
154
+ border-radius: var(--stx-mac-card-radius);
155
+ background: var(--stx-mac-card);
156
+ }
157
+
158
+ :where([data-settings-section]) > .stx-settings-section-footer {
159
+ margin: 0;
160
+ padding: var(--stx-settings-footer-above) var(--stx-mac-row-inset) 0;
161
+ font-size: var(--stx-mac-font-size-small);
162
+ line-height: 14px;
163
+ letter-spacing: 0;
164
+ color: var(--stx-mac-ink-secondary);
165
+ }
166
+ :where([data-settings-section]) > .stx-settings-section-footer a {
167
+ color: var(--stx-mac-accent);
168
+ text-decoration: none;
169
+ cursor: default;
170
+ }
171
+ :where([data-settings-section]) > .stx-settings-section-footer a:hover { text-decoration: underline; }
172
+ :where([data-settings-section]) > .stx-settings-section-footer a:focus-visible {
173
+ outline: none;
174
+ border-radius: 3px;
175
+ box-shadow: var(--stx-mac-focus-ring);
176
+ }
177
+
178
+ /* Nothing to say, nothing drawn: an empty heading or footnote takes no room. */
179
+ :where([data-settings-section]) > :is(.stx-settings-section-header, .stx-settings-section-footer):empty { display: none; }
180
+
181
+ /*
182
+ * The rule between rows. A row draws it above itself when a row comes before
183
+ * it in the card, whether the two are siblings or each sits in a component
184
+ * wrapper (`[data-stx-scope]`, `display: contents`). A row that is hidden
185
+ * does not count as coming before anything.
186
+ */
187
+ .stx-settings-card [data-settings-row]:not([hidden]) ~ [data-settings-row]::before,
188
+ .stx-settings-card [data-settings-row]:not([hidden]) ~ [data-stx-scope] [data-settings-row]::before,
189
+ .stx-settings-card [data-stx-scope]:has([data-settings-row]:not([hidden])) ~ [data-settings-row]::before,
190
+ .stx-settings-card [data-stx-scope]:has([data-settings-row]:not([hidden])) ~ [data-stx-scope] [data-settings-row]::before {
191
+ content: '';
192
+ position: absolute;
193
+ top: 0;
194
+ left: var(--stx-mac-row-inset);
195
+ right: var(--stx-mac-row-inset);
196
+ height: var(--stx-mac-hairline);
197
+ background: var(--stx-mac-separator);
198
+ pointer-events: none;
199
+ }
200
+ </style>