@stacksjs/components 0.2.865 → 0.2.868

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 (116) 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/preview-frame/preview-frame.js +58 -2
  24. package/dist/settings/settings.js +757 -0
  25. package/dist/ui/appearance-picker/AppearancePicker.d.ts +12 -0
  26. package/dist/ui/appearance-picker/index.d.ts +16 -0
  27. package/dist/ui/button/Button.d.ts +24 -1
  28. package/dist/ui/button/index.d.ts +1 -0
  29. package/dist/ui/checkbox/Checkbox.d.ts +9 -1
  30. package/dist/ui/checkbox/index.d.ts +1 -0
  31. package/dist/ui/color-swatches/ColorSwatches.d.ts +26 -0
  32. package/dist/ui/color-swatches/index.d.ts +18 -0
  33. package/dist/ui/input/NumberInput.d.ts +11 -1
  34. package/dist/ui/input/PasswordInput.d.ts +9 -1
  35. package/dist/ui/input/TextInput.d.ts +12 -1
  36. package/dist/ui/input/index.d.ts +7 -3
  37. package/dist/ui/preview-frame/core.d.ts +22 -0
  38. package/dist/ui/preview-frame/view.d.ts +9 -0
  39. package/dist/ui/radio-group/RadioGroup.d.ts +14 -2
  40. package/dist/ui/radio-group/RadioGroupOption.d.ts +6 -1
  41. package/dist/ui/radio-group/index.d.ts +2 -0
  42. package/dist/ui/segmented-control/SegmentedControl.d.ts +9 -1
  43. package/dist/ui/segmented-control/index.d.ts +1 -0
  44. package/dist/ui/select/Select.d.ts +10 -1
  45. package/dist/ui/select/index.d.ts +1 -0
  46. package/dist/ui/settings/SettingsGroup.d.ts +30 -0
  47. package/dist/ui/settings/SettingsPane.d.ts +19 -0
  48. package/dist/ui/settings/SettingsPaneHeader.d.ts +20 -0
  49. package/dist/ui/settings/SettingsRow.d.ts +53 -0
  50. package/dist/ui/settings/SettingsSidebarGroup.d.ts +11 -0
  51. package/dist/ui/settings/SettingsSidebarItem.d.ts +22 -0
  52. package/dist/ui/settings/SettingsWindow.d.ts +22 -0
  53. package/dist/ui/settings/core.d.ts +146 -0
  54. package/dist/ui/settings/index.d.ts +73 -0
  55. package/dist/ui/settings/settings.d.ts +8 -0
  56. package/dist/ui/settings/view.d.ts +36 -0
  57. package/dist/ui/slider/Slider.d.ts +24 -0
  58. package/dist/ui/slider/core.d.ts +33 -0
  59. package/dist/ui/slider/index.d.ts +20 -0
  60. package/dist/ui/switch/Switch.d.ts +10 -1
  61. package/dist/ui/switch/index.d.ts +2 -1
  62. package/dist/utils/mac-theme.d.ts +24 -0
  63. package/package.json +8 -3
  64. package/src/index.ts +6 -0
  65. package/src/ui/appearance-picker/AppearancePicker.stx +351 -0
  66. package/src/ui/appearance-picker/README.md +61 -0
  67. package/src/ui/appearance-picker/index.ts +22 -0
  68. package/src/ui/button/Button.stx +249 -0
  69. package/src/ui/button/README.md +21 -0
  70. package/src/ui/button/index.ts +8 -0
  71. package/src/ui/checkbox/Checkbox.stx +275 -0
  72. package/src/ui/checkbox/index.ts +2 -0
  73. package/src/ui/color-swatches/ColorSwatches.stx +287 -0
  74. package/src/ui/color-swatches/README.md +66 -0
  75. package/src/ui/color-swatches/index.ts +25 -0
  76. package/src/ui/input/NumberInput.stx +303 -0
  77. package/src/ui/input/PasswordInput.stx +315 -0
  78. package/src/ui/input/TextInput.stx +325 -0
  79. package/src/ui/input/index.ts +9 -3
  80. package/src/ui/preview-frame/README.md +16 -14
  81. package/src/ui/preview-frame/core.ts +50 -0
  82. package/src/ui/preview-frame/index.ts +4 -4
  83. package/src/ui/preview-frame/view.ts +61 -4
  84. package/src/ui/radio-group/README.md +17 -0
  85. package/src/ui/radio-group/RadioGroup.stx +184 -6
  86. package/src/ui/radio-group/RadioGroupOption.stx +178 -2
  87. package/src/ui/radio-group/index.ts +4 -0
  88. package/src/ui/segmented-control/SegmentedControl.stx +170 -1
  89. package/src/ui/segmented-control/index.ts +2 -0
  90. package/src/ui/select/README.md +12 -0
  91. package/src/ui/select/Select.stx +266 -0
  92. package/src/ui/select/index.ts +2 -0
  93. package/src/ui/settings/README.md +221 -0
  94. package/src/ui/settings/SettingsGroup.stx +200 -0
  95. package/src/ui/settings/SettingsPane.stx +50 -0
  96. package/src/ui/settings/SettingsPaneHeader.stx +188 -0
  97. package/src/ui/settings/SettingsRow.stx +424 -0
  98. package/src/ui/settings/SettingsSidebarGroup.stx +108 -0
  99. package/src/ui/settings/SettingsSidebarItem.stx +228 -0
  100. package/src/ui/settings/SettingsWindow.stx +537 -0
  101. package/src/ui/settings/core.ts +359 -0
  102. package/src/ui/settings/index.ts +111 -0
  103. package/src/ui/settings/settings.ts +8 -0
  104. package/src/ui/settings/view.ts +740 -0
  105. package/src/ui/slider/README.md +91 -0
  106. package/src/ui/slider/Slider.stx +377 -0
  107. package/src/ui/slider/core.ts +120 -0
  108. package/src/ui/slider/index.ts +34 -0
  109. package/src/ui/switch/README.md +11 -0
  110. package/src/ui/switch/Switch.stx +217 -0
  111. package/src/ui/switch/index.ts +4 -1
  112. package/src/utils/mac-theme.ts +95 -0
  113. package/dist/Checkbox-80myyzzm.stx +0 -142
  114. package/dist/RadioGroup-smqcqgds.stx +0 -151
  115. package/dist/RadioGroupOption-twcw1b2a.stx +0 -70
  116. package/dist/Switch-s8yf2rvm.stx +0 -157
@@ -0,0 +1,221 @@
1
+ # Settings window
2
+
3
+ A Mac-native Settings window, built once: the two-column shell System Settings
4
+ has, its sidebar and search, panes with back and forward, the rounded groups of
5
+ rows, and controls drawn the way AppKit draws them. Measured against System
6
+ Settings on macOS 26 and later, in light, dark and an inactive window.
7
+
8
+ ```html
9
+ <script client>
10
+ const pane = state('general')
11
+ const openAtLogin = state(true)
12
+ const size = state('medium')
13
+ </script>
14
+
15
+ <SettingsWindow title="Settings" storageKey="my-app" v-model:pane="pane">
16
+ <template #sidebar>
17
+ <SettingsSidebarGroup>
18
+ <SettingsSidebarItem id="general" label="General" icon="i-f7-gear-alt-fill" tone="grey" />
19
+ <SettingsSidebarItem id="appearance" label="Appearance" icon="i-f7-circle-lefthalf-fill" tone="ink" />
20
+ </SettingsSidebarGroup>
21
+ </template>
22
+
23
+ <SettingsPane id="general" title="General" active>
24
+ <SettingsGroup header="Startup" footer="Starts in the background when you sign in.">
25
+ <SettingsRow label="Open at login" setting="open-at-login" keywords="launch start">
26
+ <Switch variant="mac" v-model:checked="openAtLogin" />
27
+ </SettingsRow>
28
+ <SettingsRow label="Sidebar icon size" setting="icon-size">
29
+ <Select variant="mac" v-model:value="size" placeholder="" :options="['small', 'medium', 'large']" />
30
+ </SettingsRow>
31
+ <SettingsRow label="About" to="about" />
32
+ </SettingsGroup>
33
+ </SettingsPane>
34
+
35
+ <SettingsPane id="about" title="About" parent="general">
36
+ <SettingsGroup>
37
+ <SettingsRow label="Version"><span>2.4</span></SettingsRow>
38
+ </SettingsGroup>
39
+ </SettingsPane>
40
+
41
+ <SettingsPane id="appearance" title="Appearance">
42
+ <SettingsGroup>
43
+ <SettingsRow label="Appearance" multiline>
44
+ <AppearancePicker value="auto" />
45
+ </SettingsRow>
46
+ </SettingsGroup>
47
+ </SettingsPane>
48
+ </SettingsWindow>
49
+ ```
50
+
51
+ Open it as its own window on Cmd+, (in a Craft app, `craft.window.open({ name:
52
+ 'settings', ... })` on a titlebar-less window), or put it inside another window
53
+ with `presentation="sheet"`.
54
+
55
+ ## The pieces
56
+
57
+ | Tag | What it is |
58
+ |---|---|
59
+ | `<SettingsWindow>` | The shell: sidebar with search, toolbar with back and forward, the scrolling pane. |
60
+ | `<SettingsSidebarGroup>`, `<SettingsSidebarItem>` | The sidebar's rows, in groups. An item's `id` is the pane it opens. |
61
+ | `<SettingsPane>` | One screen. With `parent`, a sub-pane reached from a navigation row. |
62
+ | `<SettingsPaneHeader>` | The card at the top of a pane: icon, title, a sentence. |
63
+ | `<SettingsGroup>` | The rounded card of rows, with an optional heading above and footnote below. |
64
+ | `<SettingsRow>` | A label, an optional description, and the control at the trailing edge. |
65
+
66
+ Controls, each the library's own component in its Mac look:
67
+
68
+ | Control | Tag |
69
+ |---|---|
70
+ | Switch | `<Switch variant="mac">` (`size="mini"` for the small one) |
71
+ | Pop-up button | `<Select variant="mac">` |
72
+ | Segmented control | `<SegmentedControl variant="mac">` |
73
+ | Checkbox, radio buttons | `<Checkbox variant="mac">`, `<RadioGroup variant="mac">` |
74
+ | Push button | `<Button appearance="mac">`, with `variant="primary"` or `variant="danger"` |
75
+ | Text and secure field, stepper | `<TextInput variant="mac">`, `<PasswordInput variant="mac">`, `<NumberInput variant="mac">` |
76
+ | Slider | `<Slider>` |
77
+ | Colour swatches | `<ColorSwatches>` |
78
+ | Appearance picker | `<AppearancePicker>` |
79
+
80
+ `Button` takes `appearance`, not `variant`, because its `variant` already says
81
+ what the button is for.
82
+
83
+ ## How it works
84
+
85
+ | File | What it is |
86
+ |---|---|
87
+ | `core.ts` | What the window decides: which pane, the history trail, what a search finds and in what order, where an arrow key lands. No DOM. |
88
+ | `view.ts` | The DOM: shows a pane, runs the search, moves focus, remembers the pane, marks the window inactive. |
89
+ | `*.stx` | The templates and their styles. |
90
+
91
+ The pieces meet in the DOM, not in each other's scripts. A sidebar item is a
92
+ `[data-settings-item]`, a pane a `[data-settings-pane]`, a row a
93
+ `[data-settings-row]`; the shell finds them wherever they are, so a row can be
94
+ your own markup as long as it carries those attributes.
95
+ `@stacksjs/components/settings` exports the core and the view without the
96
+ templates.
97
+
98
+ ## SettingsWindow
99
+
100
+ | Prop | Default | |
101
+ |---|---|---|
102
+ | `title` | `'Settings'` | The window's accessible name. |
103
+ | `pane` | stored, then first | The open pane. Two-way with `v-model:pane`. |
104
+ | `searchable` | `true` | |
105
+ | `searchPlaceholder` | `'Search'` | |
106
+ | `storageKey` | | Remembers the last pane under `stx:settings:<key>`. |
107
+ | `presentation` | `'window'` | `window` fills a titlebar-less window and clears its buttons. `sheet` is a rounded panel inside another window. |
108
+ | `sidebarWidth` | `226` | Pixels. |
109
+ | `height` | viewport, or `min(640px, 90vh)` for a sheet | A CSS length. |
110
+ | `id`, `className` | | |
111
+
112
+ Slots: `sidebar` (the groups), `account` (anything above them, such as whose
113
+ account this is), and the default slot (the panes).
114
+
115
+ | Event | Payload |
116
+ |---|---|
117
+ | `@pane` | `{ id, title, parent }` |
118
+ | `@search` | `{ query, panes, settings }` |
119
+ | `@navigate` | `{ id, from, setting }` |
120
+
121
+ From `componentApi(target)` (`@stacksjs/components/component-api`):
122
+ `showPane(id)`, `revealSetting(id)` (opens the pane that holds the row with
123
+ that `setting`, scrolls to it and highlights it; false when there is none),
124
+ `back()`, `forward()`, `focusSearch()`, `getPane()`.
125
+
126
+ ```ts
127
+ import { componentApi } from '@stacksjs/components/component-api'
128
+
129
+ // From a menu item, a notification, a deep link:
130
+ componentApi('settings').revealSetting('open-at-login')
131
+ ```
132
+
133
+ ## Rows
134
+
135
+ `<SettingsRow>` props: `label`, `description`, `icon` and `tone` (a leading
136
+ tile), `setting` (its id), `keywords`, `to` (a pane id: a navigation row with a
137
+ chevron), `value` (text beside the chevron), `multiline`, `destructive`,
138
+ `disabled`, `layout="stacked"` (the control under the label, for a text area or
139
+ a list of radio buttons).
140
+
141
+ The row's label names the control inside it: a control with no accessible name
142
+ of its own gets `aria-labelledby` pointing at the label, and the description
143
+ becomes its `aria-describedby`.
144
+
145
+ Tones: `grey`, `blue`, `red`, `orange`, `yellow`, `green`, `indigo`, `purple`,
146
+ `pink`, `ink`. Icons are Iconify classes, such as `i-f7-bell-fill`.
147
+
148
+ ## Search
149
+
150
+ The field filters the sidebar and, like System Settings, also lists the
151
+ settings whose label or `keywords` match, each with the name of its pane.
152
+ Choosing one opens the pane, scrolls the row into view and highlights it
153
+ briefly. The number of results is announced to a screen reader.
154
+
155
+ ## Keys
156
+
157
+ | Key | |
158
+ |---|---|
159
+ | Up, Down | Move through the sidebar and open each pane, as System Settings does. |
160
+ | Home, End | First and last row. |
161
+ | A letter | Jump to the row starting with it. |
162
+ | Cmd/Ctrl+F | Focus the search field. |
163
+ | Escape | Clear the search and go back to the list. |
164
+ | Cmd/Ctrl+[ and ] | Back and forward. |
165
+ | Enter, Space | Open a navigation row. |
166
+
167
+ The sidebar is a vertical tab list with one tab stop; each pane is a labelled
168
+ tab panel. Nothing traps focus.
169
+
170
+ ## Theming
171
+
172
+ Everything is drawn from `--stx-mac-*` custom properties
173
+ (`src/utils/mac-theme.ts`), in two sets of values that follow the `dark` class.
174
+ The accent is `--stx-accent`: set it and the selection, the focus rings (35% of
175
+ it), the primary button and the pickers follow. The ones an app is most likely
176
+ to set:
177
+
178
+ - `--stx-mac-accent`, `--stx-mac-window`, `--stx-mac-sidebar`, `--stx-mac-card`
179
+ - `--stx-mac-card-radius`, `--stx-mac-control-radius`, `--stx-mac-row-height`
180
+ - `--stx-mac-font`, `--stx-mac-font-size`
181
+ - `--stx-settings-sidebar-width`, `--stx-settings-content-width`
182
+
183
+ The font is the system's: San Francisco on a Mac, Segoe UI on Windows, the
184
+ platform sans elsewhere, at the same sizes and layout. Hairlines are half a
185
+ point where a display can draw one. Motion stops under
186
+ `prefers-reduced-motion`, and lines and secondary text firm up under
187
+ `prefers-contrast: more`.
188
+
189
+ ## In a Craft window
190
+
191
+ - **Window buttons.** In `presentation="window"` the top of the sidebar leaves
192
+ room for the traffic lights, read from `--craft-window-buttons-*`. Nothing is
193
+ drawn under them.
194
+ - **Dragging.** The sidebar's top band and the toolbar are marked
195
+ `data-window-drag` (and `-webkit-app-region: drag`, which Chromium honours).
196
+ WKWebView ignores the CSS, so on a Mac the host hands a press on
197
+ `[data-window-drag]` to `startDrag()`.
198
+ - **Inactive window.** The shell stamps `data-stx-window-active="false"` when
199
+ the window loses focus, and also honours Craft's
200
+ `data-craft-window-active`: the selection turns grey and the switches and
201
+ radio buttons stand down, as AppKit's do.
202
+ - **Appearance.** `<AppearancePicker>` reports the choice; applying it is the
203
+ app's business (`useColorMode()`).
204
+
205
+ ## Limits of this version
206
+
207
+ - **The pop-up button's menu is the platform's.** `<Select>` is a native
208
+ `<select>`, so on a Mac the menu is a real NSMenu and elsewhere it is the
209
+ browser's. Only the button is drawn.
210
+ - **`<RadioGroup>` has no `v-model`.** Give it `value` and listen for `@change`.
211
+ - **A pane says for itself that it is open first** (`active`), because a pane
212
+ cannot see the window's `pane` prop while the server renders it. Without it
213
+ the first pane shows until the script runs.
214
+ - **Appearance thumbnails are sketches** drawn in CSS, not Apple's artwork.
215
+ - **The Mac look is for a web view.** Its styles are left out of a native
216
+ (iOS, Android) build, where a control has the platform's own look already.
217
+ - **Icons need the app's icon CSS.** A tile shows nothing if the page does not
218
+ generate the Iconify class it was given.
219
+ - **Not looked at:** a real Craft window, Windows and Linux web views, a screen
220
+ reader. Focus rings are tested from their CSS rules, since a headless window
221
+ never shows keyboard focus.
@@ -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>
@@ -0,0 +1,50 @@
1
+ <script server>
2
+ /*
3
+ * <SettingsPane>: one screen of a Settings window. Its `id` is the id its
4
+ * sidebar item carries; a pane with a `parent` is a sub-pane, reached by a
5
+ * navigation row and not from the sidebar.
6
+ *
7
+ * Every pane is in the page from the start and all but one are hidden. The
8
+ * shell shows the open one; `active` leaves this one showing before it has.
9
+ */
10
+ export const paneId = $props.id || ''
11
+ export const title = $props.title || paneId
12
+ export const keywords = $props.keywords || ''
13
+ export const parent = $props.parent || ''
14
+ export const active = $bool($props.active)
15
+ export const role = parent ? 'region' : 'tabpanel'
16
+ export const className = $props.className || ''
17
+ </script>
18
+
19
+ @if(active)
20
+ <section
21
+ data-settings-pane="{{ paneId }}"
22
+ data-title="{{ title }}"
23
+ data-keywords="{{ keywords }}"
24
+ data-parent="{{ parent }}"
25
+ data-active
26
+ role="{{ role }}"
27
+ aria-label="{{ title }}"
28
+ class="stx-settings-pane {{ className }}"
29
+ >
30
+ <slot />
31
+ </section>
32
+ @else
33
+ <section
34
+ data-settings-pane="{{ paneId }}"
35
+ data-title="{{ title }}"
36
+ data-keywords="{{ keywords }}"
37
+ data-parent="{{ parent }}"
38
+ role="{{ role }}"
39
+ aria-label="{{ title }}"
40
+ class="stx-settings-pane {{ className }}"
41
+ hidden
42
+ >
43
+ <slot />
44
+ </section>
45
+ @endif
46
+
47
+ <style>
48
+ .stx-settings-pane { display: block; min-width: 0; outline: 0; }
49
+ .stx-settings-pane[hidden] { display: none; }
50
+ </style>
@@ -0,0 +1,188 @@
1
+ <script server>
2
+ /*
3
+ * <SettingsPaneHeader>: the card at the top of a pane that says what the pane
4
+ * is. A large icon tile, the pane's name, and a sentence about it.
5
+ *
6
+ * <SettingsPaneHeader icon="i-f7-gear-alt-fill" tone="grey" title="General"
7
+ * description="Manage your overall setup and preferences." />
8
+ *
9
+ * Anything in the slot goes under the description: a link, a button.
10
+ */
11
+ const TONES = ['grey', 'blue', 'red', 'orange', 'yellow', 'green', 'indigo', 'purple', 'pink', 'ink']
12
+ export const icon = $props.icon || ''
13
+ export const tone = TONES.includes($props.tone) ? $props.tone : 'grey'
14
+ export const title = $props.title || ''
15
+ export const description = $props.description || ''
16
+ export const className = $props.className || ''
17
+ </script>
18
+
19
+ <script client>
20
+ const heading = useReactiveProp('title', {{ title }})
21
+ const detail = useReactiveProp('description', {{ description }})
22
+ </script>
23
+
24
+ <header data-settings-pane-header class="stx-settings-hero {{ className }}">
25
+ @if(icon)
26
+ <span class="stx-settings-hero-tile" data-tone="{{ tone }}" aria-hidden="true"><i class="{{ icon }}"></i></span>
27
+ @endif
28
+ <h2 :text="heading()" class="stx-settings-hero-title">{{ title }}</h2>
29
+ <p :show="detail()" :text="detail()" class="stx-settings-hero-description">{{ description }}</p>
30
+ <div class="stx-settings-hero-extra"><slot /></div>
31
+ </header>
32
+
33
+ <style data-native-exclude>
34
+ :where(:root) {
35
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
36
+ --stx-mac-font-size: 13px;
37
+ --stx-mac-font-size-small: 11px;
38
+ --stx-mac-hairline: 0.5px;
39
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
40
+ --stx-mac-card-radius: 12px;
41
+ --stx-mac-control-radius: 6px;
42
+ --stx-mac-row-height: 38px;
43
+ --stx-mac-row-inset: 10px;
44
+ --stx-mac-sidebar-width: 226px;
45
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
46
+ --stx-mac-accent-ink: #ffffff;
47
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
48
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
49
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
50
+ --stx-mac-window: #ffffff;
51
+ --stx-mac-sidebar: #f2f1f0;
52
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
53
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
54
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
55
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
56
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
57
+ --stx-mac-control: #ffffff;
58
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
59
+ --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);
60
+ --stx-mac-switch-on: #34c759;
61
+ --stx-mac-knob: #ffffff;
62
+ --stx-mac-danger: #ff3b30;
63
+ }
64
+ :where(.dark) {
65
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
66
+ --stx-mac-accent-ink: #ffffff;
67
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
68
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
69
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
70
+ --stx-mac-window: #1e1e1e;
71
+ --stx-mac-sidebar: #2a2a2a;
72
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
73
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
74
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
75
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
76
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
77
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
78
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
79
+ --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);
80
+ --stx-mac-switch-on: #30d158;
81
+ --stx-mac-knob: #ffffff;
82
+ --stx-mac-danger: #ff453a;
83
+ }
84
+ @media (max-resolution: 1.5dppx) {
85
+ :where(:root) {
86
+ --stx-mac-hairline: 1px;
87
+ }
88
+ }
89
+ @media (prefers-contrast: more) {
90
+ :where(:root) {
91
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
92
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
93
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
94
+ --stx-mac-hairline: 1px;
95
+ }
96
+ :where(.dark) {
97
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
98
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
99
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
100
+ }
101
+ }
102
+
103
+ :where([data-settings-pane-header]) {
104
+ --stx-settings-tone-grey: #8e8e93;
105
+ --stx-settings-tone-blue: #007aff;
106
+ --stx-settings-tone-red: #ff3b30;
107
+ --stx-settings-tone-orange: #ff9500;
108
+ --stx-settings-tone-yellow: #ffcc00;
109
+ --stx-settings-tone-green: #34c759;
110
+ --stx-settings-tone-indigo: #5856d6;
111
+ --stx-settings-tone-purple: #af52de;
112
+ --stx-settings-tone-pink: #ff2d55;
113
+ --stx-settings-tone-ink: #1c1c1e;
114
+ --stx-settings-hero-tile-size: 48px;
115
+ --stx-settings-hero-padding: 22px;
116
+ display: flex;
117
+ flex-direction: column;
118
+ align-items: center;
119
+ box-sizing: border-box;
120
+ margin: 0 0 10px;
121
+ padding: var(--stx-settings-hero-padding);
122
+ border-radius: var(--stx-mac-card-radius);
123
+ background: var(--stx-mac-card);
124
+ font-family: var(--stx-mac-font);
125
+ text-align: center;
126
+ color: var(--stx-mac-ink);
127
+ -webkit-font-smoothing: antialiased;
128
+ cursor: default;
129
+ -webkit-user-select: none;
130
+ user-select: none;
131
+ }
132
+ :where(.dark) :where([data-settings-pane-header]) {
133
+ --stx-settings-tone-blue: #0a84ff;
134
+ --stx-settings-tone-red: #ff453a;
135
+ --stx-settings-tone-orange: #ff9f0a;
136
+ --stx-settings-tone-yellow: #ffd60a;
137
+ --stx-settings-tone-green: #30d158;
138
+ --stx-settings-tone-indigo: #5e5ce6;
139
+ --stx-settings-tone-purple: #bf5af2;
140
+ --stx-settings-tone-pink: #ff375f;
141
+ --stx-settings-tone-ink: #48484a;
142
+ }
143
+
144
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile {
145
+ display: inline-flex;
146
+ flex: 0 0 auto;
147
+ align-items: center;
148
+ justify-content: center;
149
+ width: var(--stx-settings-hero-tile-size);
150
+ height: var(--stx-settings-hero-tile-size);
151
+ margin-bottom: 12px;
152
+ border-radius: 11px;
153
+ background: var(--stx-settings-tone-grey);
154
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
155
+ color: #ffffff;
156
+ font-size: 30px;
157
+ line-height: 1;
158
+ }
159
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile > i { display: block; width: 1em; height: 1em; }
160
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="blue"] { background: var(--stx-settings-tone-blue); }
161
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="red"] { background: var(--stx-settings-tone-red); }
162
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="orange"] { background: var(--stx-settings-tone-orange); }
163
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="yellow"] { background: var(--stx-settings-tone-yellow); }
164
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="green"] { background: var(--stx-settings-tone-green); }
165
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="indigo"] { background: var(--stx-settings-tone-indigo); }
166
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="purple"] { background: var(--stx-settings-tone-purple); }
167
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="pink"] { background: var(--stx-settings-tone-pink); }
168
+ :where([data-settings-pane-header]) > .stx-settings-hero-tile[data-tone="ink"] { background: var(--stx-settings-tone-ink); }
169
+
170
+ :where([data-settings-pane-header]) > .stx-settings-hero-title {
171
+ margin: 0;
172
+ font-size: 20px;
173
+ font-weight: 700;
174
+ line-height: 24px;
175
+ letter-spacing: -0.2px;
176
+ color: var(--stx-mac-ink);
177
+ }
178
+ :where([data-settings-pane-header]) > .stx-settings-hero-description {
179
+ max-width: 440px;
180
+ margin: 2px 0 0;
181
+ font-size: 12px;
182
+ line-height: 16px;
183
+ color: var(--stx-mac-ink-secondary);
184
+ }
185
+ :where([data-settings-pane-header]) > .stx-settings-hero-description:empty { display: none; }
186
+ :where([data-settings-pane-header]) > .stx-settings-hero-extra { margin-top: 10px; font-size: var(--stx-mac-font-size); }
187
+ :where([data-settings-pane-header]) > .stx-settings-hero-extra:empty { display: none; }
188
+ </style>