@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,359 @@
1
+ /**
2
+ * What a Settings window decides, without a DOM.
3
+ *
4
+ * Which pane is open, where back and forward lead, which sidebar item a pane
5
+ * belongs under, what a search finds and in what order, and where an arrow key
6
+ * or a typed letter moves the selection. The view reads the page into the
7
+ * shapes below and asks these functions what to do.
8
+ */
9
+
10
+ /** A pane as the page declares it. `parent` is empty for a pane in the sidebar. */
11
+ export interface SettingsPaneInfo {
12
+ id: string
13
+ title: string
14
+ keywords?: string
15
+ parent?: string
16
+ }
17
+
18
+ /** A sidebar item. Its id is the id of the pane it opens. */
19
+ export interface SettingsItemInfo {
20
+ id: string
21
+ label: string
22
+ keywords?: string
23
+ }
24
+
25
+ /** A row inside a pane. `id` is its `data-setting`, empty when it has none. */
26
+ export interface SettingsRowInfo {
27
+ id: string
28
+ label: string
29
+ keywords?: string
30
+ /** The pane the row sits in. */
31
+ pane: string
32
+ }
33
+
34
+ /** Everything a search looks through. */
35
+ export interface SettingsSearchIndex {
36
+ panes: readonly SettingsPaneInfo[]
37
+ items: readonly SettingsItemInfo[]
38
+ rows: readonly SettingsRowInfo[]
39
+ }
40
+
41
+ /** A setting a search found. */
42
+ export interface SettingsSearchHit {
43
+ /** The row's `data-setting`, empty when it has none. */
44
+ id: string
45
+ label: string
46
+ pane: string
47
+ paneTitle: string
48
+ /** Where the row is in the index, so the view can find the element again. */
49
+ row: number
50
+ rank: number
51
+ }
52
+
53
+ export interface SettingsSearchResult {
54
+ query: string
55
+ /** Sidebar items that match, in sidebar order. */
56
+ panes: string[]
57
+ /** Settings that match, best first. */
58
+ settings: SettingsSearchHit[]
59
+ }
60
+
61
+ /** The trail of panes visited, and where in it the window is. */
62
+ export interface SettingsHistory {
63
+ trail: readonly string[]
64
+ cursor: number
65
+ }
66
+
67
+ /** How well a label matched. Higher is better; `NONE` is no match. */
68
+ export const SETTINGS_RANK = { NONE: 0, KEYWORD: 1, SUBSTRING: 2, WORD_PREFIX: 3, PREFIX: 4 } as const
69
+
70
+ /** How long a typed run of letters stays one word, in milliseconds. */
71
+ export const SETTINGS_TYPE_AHEAD_MS = 700
72
+
73
+ /** How long a found row stays highlighted, in milliseconds. */
74
+ export const SETTINGS_HIGHLIGHT_MS = 1600
75
+
76
+ // ---------------------------------------------------------------------------
77
+ // Panes
78
+ // ---------------------------------------------------------------------------
79
+
80
+ /** The storage name the last pane is kept under. */
81
+ export function settingsStorageName(key: string): string {
82
+ return `stx:settings:${key}`
83
+ }
84
+
85
+ export function findSettingsPane(panes: readonly SettingsPaneInfo[], id: string | null | undefined): SettingsPaneInfo | null {
86
+ if (!id)
87
+ return null
88
+ return panes.find(pane => pane.id === id) ?? null
89
+ }
90
+
91
+ /** The pane a window opens on when nothing says otherwise: the first that is not a sub-pane. */
92
+ export function firstSettingsPane(panes: readonly SettingsPaneInfo[]): string {
93
+ const top = panes.find(pane => !pane.parent)
94
+ return (top ?? panes[0])?.id ?? ''
95
+ }
96
+
97
+ /**
98
+ * The first of `wanted` that is a pane, or the first pane.
99
+ *
100
+ * A stored id outlives the pane it named, and a prop can be mistyped. Neither
101
+ * should open a window on nothing.
102
+ */
103
+ export function resolveSettingsPane(panes: readonly SettingsPaneInfo[], ...wanted: Array<string | null | undefined>): string {
104
+ for (const id of wanted) {
105
+ if (findSettingsPane(panes, id))
106
+ return id as string
107
+ }
108
+ return firstSettingsPane(panes)
109
+ }
110
+
111
+ /**
112
+ * The sidebar item that stays selected while `id` is open: the pane itself, or
113
+ * for a sub-pane the pane at the top of its chain of parents.
114
+ */
115
+ export function settingsSidebarPane(panes: readonly SettingsPaneInfo[], id: string): string {
116
+ const seen = new Set<string>()
117
+ let current = findSettingsPane(panes, id)
118
+ while (current && current.parent && !seen.has(current.id)) {
119
+ seen.add(current.id)
120
+ const parent = findSettingsPane(panes, current.parent)
121
+ if (!parent)
122
+ break
123
+ current = parent
124
+ }
125
+ return current?.id ?? ''
126
+ }
127
+
128
+ /** The pane above a sub-pane, or empty. A parent that does not exist is no parent. */
129
+ export function settingsParentPane(panes: readonly SettingsPaneInfo[], id: string): string {
130
+ const pane = findSettingsPane(panes, id)
131
+ if (!pane?.parent || pane.parent === id)
132
+ return ''
133
+ return findSettingsPane(panes, pane.parent) ? pane.parent : ''
134
+ }
135
+
136
+ // ---------------------------------------------------------------------------
137
+ // History
138
+ // ---------------------------------------------------------------------------
139
+
140
+ export function emptySettingsHistory(): SettingsHistory {
141
+ return { trail: [], cursor: -1 }
142
+ }
143
+
144
+ export function settingsHistoryCurrent(history: SettingsHistory): string {
145
+ return history.trail[history.cursor] ?? ''
146
+ }
147
+
148
+ /**
149
+ * Visit a pane. Whatever lay ahead of the cursor is a future this choice
150
+ * replaced, as a browser drops its forward stack on a new navigation. Visiting
151
+ * the pane that is already open changes nothing.
152
+ */
153
+ export function settingsHistoryVisit(history: SettingsHistory, id: string): SettingsHistory {
154
+ if (!id || settingsHistoryCurrent(history) === id)
155
+ return history
156
+ const trail = [...history.trail.slice(0, history.cursor + 1), id]
157
+ return { trail, cursor: trail.length - 1 }
158
+ }
159
+
160
+ export function settingsCanGoForward(history: SettingsHistory): boolean {
161
+ return history.cursor < history.trail.length - 1
162
+ }
163
+
164
+ /**
165
+ * Back is possible when there is a pane behind the cursor, or when the window
166
+ * opened straight onto a sub-pane, whose parent is then where back leads.
167
+ */
168
+ export function settingsCanGoBack(history: SettingsHistory, panes: readonly SettingsPaneInfo[] = []): boolean {
169
+ if (history.cursor > 0)
170
+ return true
171
+ return history.cursor === 0 && settingsParentPane(panes, settingsHistoryCurrent(history)) !== ''
172
+ }
173
+
174
+ export function settingsHistoryBack(history: SettingsHistory, panes: readonly SettingsPaneInfo[] = []): SettingsHistory {
175
+ if (history.cursor > 0)
176
+ return { trail: history.trail, cursor: history.cursor - 1 }
177
+ if (history.cursor === 0) {
178
+ const parent = settingsParentPane(panes, settingsHistoryCurrent(history))
179
+ // The parent goes in behind the sub-pane, so forward returns to it.
180
+ if (parent)
181
+ return { trail: [parent, ...history.trail], cursor: 0 }
182
+ }
183
+ return history
184
+ }
185
+
186
+ export function settingsHistoryForward(history: SettingsHistory): SettingsHistory {
187
+ return settingsCanGoForward(history) ? { trail: history.trail, cursor: history.cursor + 1 } : history
188
+ }
189
+
190
+ // ---------------------------------------------------------------------------
191
+ // Search
192
+ // ---------------------------------------------------------------------------
193
+
194
+ /** Lower case, accents folded, runs of space made one. What both sides of a match are compared as. */
195
+ export function normalizeSettingsText(text: string | null | undefined): string {
196
+ return String(text ?? '')
197
+ .normalize('NFD')
198
+ .replace(/[̀-ͯ]/g, '')
199
+ .toLowerCase()
200
+ .replace(/\s+/g, ' ')
201
+ .trim()
202
+ }
203
+
204
+ function wordStarts(text: string, needle: string): boolean {
205
+ let from = text.indexOf(needle)
206
+ while (from !== -1) {
207
+ if (from === 0 || !/[\p{L}\p{N}]/u.test(text.charAt(from - 1)))
208
+ return true
209
+ from = text.indexOf(needle, from + 1)
210
+ }
211
+ return false
212
+ }
213
+
214
+ function rankOne(needle: string, label: string, keywords: string): number {
215
+ if (label.startsWith(needle))
216
+ return SETTINGS_RANK.PREFIX
217
+ if (wordStarts(label, needle))
218
+ return SETTINGS_RANK.WORD_PREFIX
219
+ if (label.includes(needle))
220
+ return SETTINGS_RANK.SUBSTRING
221
+ // A keyword is matched from its start: a letter out of the middle of a word
222
+ // nobody can see would make every search list everything.
223
+ if (wordStarts(keywords, needle))
224
+ return SETTINGS_RANK.KEYWORD
225
+ return SETTINGS_RANK.NONE
226
+ }
227
+
228
+ /**
229
+ * How well `query` matches a label and its keywords.
230
+ *
231
+ * The label starting with the query is best, then a word of the label starting
232
+ * with it, then the query anywhere in the label, then the keywords. A query of
233
+ * several words matches when every word does, and is as good as its weakest
234
+ * word, unless the label holds the whole phrase.
235
+ */
236
+ export function settingsMatchRank(query: string, label: string, keywords = ''): number {
237
+ const needle = normalizeSettingsText(query)
238
+ if (needle === '')
239
+ return SETTINGS_RANK.NONE
240
+ const text = normalizeSettingsText(label)
241
+ const extra = normalizeSettingsText(keywords)
242
+
243
+ const whole = rankOne(needle, text, extra)
244
+ const words = needle.split(' ')
245
+ if (whole !== SETTINGS_RANK.NONE || words.length === 1)
246
+ return whole
247
+
248
+ let weakest: number = SETTINGS_RANK.PREFIX
249
+ for (const word of words) {
250
+ const rank = rankOne(word, text, extra)
251
+ if (rank === SETTINGS_RANK.NONE)
252
+ return SETTINGS_RANK.NONE
253
+ // Only the first word can be what the label starts with.
254
+ weakest = Math.min(weakest, rank === SETTINGS_RANK.PREFIX && word !== words[0] ? SETTINGS_RANK.WORD_PREFIX : rank)
255
+ }
256
+ return weakest
257
+ }
258
+
259
+ /**
260
+ * Search the sidebar and the settings inside the panes.
261
+ *
262
+ * A sidebar item matches on its label, its own keywords and its pane's. A
263
+ * setting matches on its label and its keywords, and last of all on the name
264
+ * of the pane it is in, so typing a pane's name lists what is in it under the
265
+ * better matches. Settings come back best first, and in page order within a
266
+ * rank.
267
+ */
268
+ export function searchSettings(query: string, index: SettingsSearchIndex): SettingsSearchResult {
269
+ const text = normalizeSettingsText(query)
270
+ if (text === '')
271
+ return { query: '', panes: [], settings: [] }
272
+
273
+ const panes: string[] = []
274
+ for (const item of index.items) {
275
+ const pane = findSettingsPane(index.panes, item.id)
276
+ const keywords = `${item.keywords ?? ''} ${pane?.keywords ?? ''} ${pane && pane.title !== item.label ? pane.title : ''}`
277
+ if (settingsMatchRank(text, item.label, keywords) !== SETTINGS_RANK.NONE)
278
+ panes.push(item.id)
279
+ }
280
+
281
+ const settings: SettingsSearchHit[] = []
282
+ index.rows.forEach((row, position) => {
283
+ if (!row.label)
284
+ return
285
+ const pane = findSettingsPane(index.panes, row.pane)
286
+ const paneTitle = pane?.title ?? ''
287
+ const rank = settingsMatchRank(text, row.label, `${row.keywords ?? ''} ${paneTitle}`)
288
+ if (rank !== SETTINGS_RANK.NONE)
289
+ settings.push({ id: row.id, label: row.label, pane: row.pane, paneTitle, row: position, rank })
290
+ })
291
+ settings.sort((a, b) => b.rank - a.rank || a.row - b.row)
292
+
293
+ return { query: text, panes, settings }
294
+ }
295
+
296
+ /** What a screen reader is told after a search. */
297
+ export function settingsResultsAnnouncement(count: number): string {
298
+ if (count <= 0)
299
+ return 'No results'
300
+ return count === 1 ? '1 result' : `${count} results`
301
+ }
302
+
303
+ // ---------------------------------------------------------------------------
304
+ // The keyboard in the sidebar
305
+ // ---------------------------------------------------------------------------
306
+
307
+ /**
308
+ * Where a key moves from `index` in a list of `count`, or -1 when the key is
309
+ * not one that moves. The ends stop, as they do in a Mac source list.
310
+ */
311
+ export function settingsRovingIndex(key: string, index: number, count: number): number {
312
+ if (count <= 0)
313
+ return -1
314
+ if (key === 'ArrowDown')
315
+ return Math.min(count - 1, index + 1)
316
+ if (key === 'ArrowUp')
317
+ return index < 0 ? count - 1 : Math.max(0, index - 1)
318
+ if (key === 'Home')
319
+ return 0
320
+ if (key === 'End')
321
+ return count - 1
322
+ return -1
323
+ }
324
+
325
+ /** The letters typed so far, and when the last one landed. */
326
+ export interface SettingsTypeAhead {
327
+ buffer: string
328
+ at: number
329
+ }
330
+
331
+ /** Add a typed character. A pause starts a new word. */
332
+ export function settingsTypeAheadAdd(state: SettingsTypeAhead | null, character: string, now: number, timeout = SETTINGS_TYPE_AHEAD_MS): SettingsTypeAhead {
333
+ const fresh = !state || now - state.at > timeout
334
+ return { buffer: (fresh ? '' : state.buffer) + normalizeSettingsText(character), at: now }
335
+ }
336
+
337
+ /**
338
+ * The item a typed word selects, or -1.
339
+ *
340
+ * One letter, or the same letter again and again, walks through the items that
341
+ * start with it, beginning after the current one. A longer word stays on the
342
+ * current item while it still matches, and otherwise finds the next that does.
343
+ */
344
+ export function settingsTypeAheadMatch(labels: readonly string[], buffer: string, current: number): number {
345
+ const count = labels.length
346
+ const typed = normalizeSettingsText(buffer)
347
+ if (count === 0 || typed === '')
348
+ return -1
349
+
350
+ const repeated = typed.split('').every(letter => letter === typed.charAt(0))
351
+ const needle = repeated ? typed.charAt(0) : typed
352
+ const start = repeated ? current + 1 : Math.max(0, current)
353
+ for (let offset = 0; offset < count; offset++) {
354
+ const index = (((start + offset) % count) + count) % count
355
+ if (normalizeSettingsText(labels[index]).startsWith(needle))
356
+ return index
357
+ }
358
+ return -1
359
+ }
@@ -0,0 +1,111 @@
1
+ export * from './core'
2
+ export { default as SettingsGroup } from './SettingsGroup.stx'
3
+ export { default as SettingsPane } from './SettingsPane.stx'
4
+ export { default as SettingsPaneHeader } from './SettingsPaneHeader.stx'
5
+ export { default as SettingsRow } from './SettingsRow.stx'
6
+ export { default as SettingsSidebarGroup } from './SettingsSidebarGroup.stx'
7
+ export { default as SettingsSidebarItem } from './SettingsSidebarItem.stx'
8
+ export { default as SettingsWindow } from './SettingsWindow.stx'
9
+ export * from './view'
10
+
11
+ /** The colour of an icon tile, in the sidebar or leading a row. */
12
+ export type SettingsTone = 'grey' | 'blue' | 'red' | 'orange' | 'yellow' | 'green' | 'indigo' | 'purple' | 'pink' | 'ink'
13
+
14
+ export interface SettingsWindowProps {
15
+ /** The window's accessible name. Default `Settings`. */
16
+ title?: string
17
+ /** The pane to open on. Two-way with `v-model:pane`. Default: the stored one, then the first. */
18
+ pane?: string
19
+ /** Show the search field. Default on. */
20
+ searchable?: boolean
21
+ /** Default `Search`. */
22
+ searchPlaceholder?: string
23
+ /** Remembers the last pane in local storage under `stx:settings:<key>`. */
24
+ storageKey?: string
25
+ /** `window` fills a titlebar-less window and clears its buttons; `sheet` is a rounded panel inside another window. Default `window`. */
26
+ presentation?: 'window' | 'sheet'
27
+ /** Pixels. Default 226. */
28
+ sidebarWidth?: number
29
+ /** A CSS length. Default the viewport for a window, `min(640px, 90vh)` for a sheet. */
30
+ height?: string
31
+ id?: string
32
+ className?: string
33
+ }
34
+
35
+ export interface SettingsSidebarGroupProps {
36
+ /** A caption over the group. System Settings has none; leave it out to match. */
37
+ label?: string
38
+ className?: string
39
+ }
40
+
41
+ export interface SettingsSidebarItemProps {
42
+ /** The id of the pane this row opens. */
43
+ id: string
44
+ label: string
45
+ /** An Iconify class, drawn white in the tile: `i-f7-gear-alt-fill`. */
46
+ icon?: string
47
+ /** Default `grey`. */
48
+ tone?: SettingsTone
49
+ /** A count at the trailing edge. */
50
+ badge?: string | number
51
+ /** More words the search finds this row by. */
52
+ keywords?: string
53
+ className?: string
54
+ }
55
+
56
+ export interface SettingsPaneProps {
57
+ /** What a sidebar item, a navigation row or `showPane()` names it by. */
58
+ id: string
59
+ /** Shown in the toolbar. */
60
+ title: string
61
+ /** More words the search finds this pane by. */
62
+ keywords?: string
63
+ /** The pane this one is reached from. A pane with a parent is not in the sidebar and has a way back. */
64
+ parent?: string
65
+ /** Render this pane visible before any script runs. Give it to the pane the window opens on. */
66
+ active?: boolean
67
+ className?: string
68
+ }
69
+
70
+ export interface SettingsGroupProps {
71
+ /** A heading above the card. */
72
+ header?: string
73
+ /** A footnote under it. The `footer` slot takes markup, for a note with a link. */
74
+ footer?: string
75
+ id?: string
76
+ className?: string
77
+ }
78
+
79
+ export interface SettingsRowProps {
80
+ label: string
81
+ /** A second line under the label. */
82
+ description?: string
83
+ /** An Iconify class for a leading tile. */
84
+ icon?: string
85
+ tone?: SettingsTone
86
+ /** Names the setting, for `revealSetting(id)` and for its label's id. */
87
+ setting?: string
88
+ /** More words the search finds this row by. */
89
+ keywords?: string
90
+ /** A pane id. Makes this a navigation row: a chevron, and a press opens that pane. */
91
+ to?: string
92
+ /** Text at the trailing edge of a navigation row: the current value. */
93
+ value?: string
94
+ /** Let the label and description wrap, with the control aligned to the top. */
95
+ multiline?: boolean
96
+ /** Draw the label in the danger colour. */
97
+ destructive?: boolean
98
+ disabled?: boolean
99
+ /** `stacked` puts the control under the label at full width. Default `inline`. */
100
+ layout?: 'inline' | 'stacked'
101
+ id?: string
102
+ className?: string
103
+ }
104
+
105
+ export interface SettingsPaneHeaderProps {
106
+ icon?: string
107
+ tone?: SettingsTone
108
+ title: string
109
+ description?: string
110
+ className?: string
111
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The Settings window without its stx templates.
3
+ *
4
+ * `@stacksjs/components/settings`. What the window decides (`./core`, no DOM)
5
+ * and the view that applies it to any markup following the DOM contract.
6
+ */
7
+ export * from './core'
8
+ export * from './view'