@stacksjs/components 0.2.867 → 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 (109) hide show
  1. package/dist/AppearancePicker-61r20jpp.stx +351 -0
  2. package/dist/{Button-sebyqeva.stx → Button-pg8mzsq3.stx} +249 -0
  3. package/dist/Checkbox-52mhrzkz.stx +417 -0
  4. package/dist/ColorSwatches-ecfxphjy.stx +287 -0
  5. package/dist/{NumberInput-axcfj9y8.stx → NumberInput-e2afxyh3.stx} +303 -0
  6. package/dist/{PasswordInput-8m3109tp.stx → PasswordInput-n2ven456.stx} +315 -0
  7. package/dist/RadioGroup-ps9kn22f.stx +329 -0
  8. package/dist/RadioGroupOption-6hyy1bvb.stx +246 -0
  9. package/dist/{SegmentedControl-fr69q4gb.stx → SegmentedControl-7q0t8c9s.stx} +170 -1
  10. package/dist/{Select-1cnqbcmg.stx → Select-ygzchedx.stx} +266 -0
  11. package/dist/SettingsGroup-dkae46k5.stx +200 -0
  12. package/dist/SettingsPane-jbd1gbdt.stx +50 -0
  13. package/dist/SettingsPaneHeader-f0cvkqs7.stx +188 -0
  14. package/dist/SettingsRow-4cxbsf1q.stx +424 -0
  15. package/dist/SettingsSidebarGroup-p2ygv5yy.stx +108 -0
  16. package/dist/SettingsSidebarItem-x8fsn3w5.stx +228 -0
  17. package/dist/SettingsWindow-mm490ymt.stx +537 -0
  18. package/dist/Slider-j59dgw1c.stx +377 -0
  19. package/dist/Switch-ga9ap8n8.stx +374 -0
  20. package/dist/{TextInput-tsvfwxmg.stx → TextInput-tyqzz3jy.stx} +325 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.js +35 -24
  23. package/dist/settings/settings.js +757 -0
  24. package/dist/ui/appearance-picker/AppearancePicker.d.ts +12 -0
  25. package/dist/ui/appearance-picker/index.d.ts +16 -0
  26. package/dist/ui/button/Button.d.ts +24 -1
  27. package/dist/ui/button/index.d.ts +1 -0
  28. package/dist/ui/checkbox/Checkbox.d.ts +9 -1
  29. package/dist/ui/checkbox/index.d.ts +1 -0
  30. package/dist/ui/color-swatches/ColorSwatches.d.ts +26 -0
  31. package/dist/ui/color-swatches/index.d.ts +18 -0
  32. package/dist/ui/input/NumberInput.d.ts +11 -1
  33. package/dist/ui/input/PasswordInput.d.ts +9 -1
  34. package/dist/ui/input/TextInput.d.ts +12 -1
  35. package/dist/ui/input/index.d.ts +7 -3
  36. package/dist/ui/radio-group/RadioGroup.d.ts +14 -2
  37. package/dist/ui/radio-group/RadioGroupOption.d.ts +6 -1
  38. package/dist/ui/radio-group/index.d.ts +2 -0
  39. package/dist/ui/segmented-control/SegmentedControl.d.ts +9 -1
  40. package/dist/ui/segmented-control/index.d.ts +1 -0
  41. package/dist/ui/select/Select.d.ts +10 -1
  42. package/dist/ui/select/index.d.ts +1 -0
  43. package/dist/ui/settings/SettingsGroup.d.ts +30 -0
  44. package/dist/ui/settings/SettingsPane.d.ts +19 -0
  45. package/dist/ui/settings/SettingsPaneHeader.d.ts +20 -0
  46. package/dist/ui/settings/SettingsRow.d.ts +53 -0
  47. package/dist/ui/settings/SettingsSidebarGroup.d.ts +11 -0
  48. package/dist/ui/settings/SettingsSidebarItem.d.ts +22 -0
  49. package/dist/ui/settings/SettingsWindow.d.ts +22 -0
  50. package/dist/ui/settings/core.d.ts +146 -0
  51. package/dist/ui/settings/index.d.ts +73 -0
  52. package/dist/ui/settings/settings.d.ts +8 -0
  53. package/dist/ui/settings/view.d.ts +36 -0
  54. package/dist/ui/slider/Slider.d.ts +24 -0
  55. package/dist/ui/slider/core.d.ts +33 -0
  56. package/dist/ui/slider/index.d.ts +20 -0
  57. package/dist/ui/switch/Switch.d.ts +10 -1
  58. package/dist/ui/switch/index.d.ts +2 -1
  59. package/dist/utils/mac-theme.d.ts +24 -0
  60. package/package.json +8 -3
  61. package/src/index.ts +6 -0
  62. package/src/ui/appearance-picker/AppearancePicker.stx +351 -0
  63. package/src/ui/appearance-picker/README.md +61 -0
  64. package/src/ui/appearance-picker/index.ts +22 -0
  65. package/src/ui/button/Button.stx +249 -0
  66. package/src/ui/button/README.md +21 -0
  67. package/src/ui/button/index.ts +8 -0
  68. package/src/ui/checkbox/Checkbox.stx +275 -0
  69. package/src/ui/checkbox/index.ts +2 -0
  70. package/src/ui/color-swatches/ColorSwatches.stx +287 -0
  71. package/src/ui/color-swatches/README.md +66 -0
  72. package/src/ui/color-swatches/index.ts +25 -0
  73. package/src/ui/input/NumberInput.stx +303 -0
  74. package/src/ui/input/PasswordInput.stx +315 -0
  75. package/src/ui/input/TextInput.stx +325 -0
  76. package/src/ui/input/index.ts +9 -3
  77. package/src/ui/radio-group/README.md +17 -0
  78. package/src/ui/radio-group/RadioGroup.stx +184 -6
  79. package/src/ui/radio-group/RadioGroupOption.stx +178 -2
  80. package/src/ui/radio-group/index.ts +4 -0
  81. package/src/ui/segmented-control/SegmentedControl.stx +170 -1
  82. package/src/ui/segmented-control/index.ts +2 -0
  83. package/src/ui/select/README.md +12 -0
  84. package/src/ui/select/Select.stx +266 -0
  85. package/src/ui/select/index.ts +2 -0
  86. package/src/ui/settings/README.md +221 -0
  87. package/src/ui/settings/SettingsGroup.stx +200 -0
  88. package/src/ui/settings/SettingsPane.stx +50 -0
  89. package/src/ui/settings/SettingsPaneHeader.stx +188 -0
  90. package/src/ui/settings/SettingsRow.stx +424 -0
  91. package/src/ui/settings/SettingsSidebarGroup.stx +108 -0
  92. package/src/ui/settings/SettingsSidebarItem.stx +228 -0
  93. package/src/ui/settings/SettingsWindow.stx +537 -0
  94. package/src/ui/settings/core.ts +359 -0
  95. package/src/ui/settings/index.ts +111 -0
  96. package/src/ui/settings/settings.ts +8 -0
  97. package/src/ui/settings/view.ts +740 -0
  98. package/src/ui/slider/README.md +91 -0
  99. package/src/ui/slider/Slider.stx +377 -0
  100. package/src/ui/slider/core.ts +120 -0
  101. package/src/ui/slider/index.ts +34 -0
  102. package/src/ui/switch/README.md +11 -0
  103. package/src/ui/switch/Switch.stx +217 -0
  104. package/src/ui/switch/index.ts +4 -1
  105. package/src/utils/mac-theme.ts +95 -0
  106. package/dist/Checkbox-80myyzzm.stx +0 -142
  107. package/dist/RadioGroup-smqcqgds.stx +0 -151
  108. package/dist/RadioGroupOption-twcw1b2a.stx +0 -70
  109. package/dist/Switch-s8yf2rvm.stx +0 -157
@@ -0,0 +1,228 @@
1
+ <script server>
2
+ /*
3
+ * <SettingsSidebarItem>: one row of the sidebar, opening the pane whose id it
4
+ * carries. The icon is an Iconify class, drawn white on a rounded tile in one
5
+ * of System Settings' tile colours.
6
+ *
7
+ * It only draws. The shell selects it, gives it its place in the tab order
8
+ * and links it to its pane.
9
+ */
10
+ const TONES = ['grey', 'blue', 'red', 'orange', 'yellow', 'green', 'indigo', 'purple', 'pink', 'ink']
11
+ export const paneId = $props.id || ''
12
+ export const label = $props.label || ''
13
+ export const icon = $props.icon || ''
14
+ export const tone = TONES.includes($props.tone) ? $props.tone : 'grey'
15
+ export const badge = $props.badge == null || $props.badge === false ? '' : String($props.badge)
16
+ /* Words a search should find this item by, beyond its label. */
17
+ export const keywords = $props.keywords || ''
18
+ export const className = $props.className || ''
19
+ </script>
20
+
21
+ <button
22
+ type="button"
23
+ role="tab"
24
+ aria-selected="false"
25
+ tabindex="-1"
26
+ data-settings-item="{{ paneId }}"
27
+ data-keywords="{{ keywords }}"
28
+ class="stx-settings-item {{ className }}"
29
+ >
30
+ @if(icon)
31
+ <span class="stx-settings-tile" data-tone="{{ tone }}" aria-hidden="true"><span class="{{ icon }}"></span></span>
32
+ @endif
33
+ <span class="stx-settings-item-label">{{ label }}</span>
34
+ @if(badge)
35
+ <span class="stx-settings-item-badge">{{ badge }}</span>
36
+ @endif
37
+ </button>
38
+
39
+ <style data-native-exclude>
40
+ :where(:root) {
41
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
42
+ --stx-mac-font-size: 13px;
43
+ --stx-mac-font-size-small: 11px;
44
+ --stx-mac-hairline: 0.5px;
45
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
46
+ --stx-mac-card-radius: 12px;
47
+ --stx-mac-control-radius: 6px;
48
+ --stx-mac-row-height: 38px;
49
+ --stx-mac-row-inset: 10px;
50
+ --stx-mac-sidebar-width: 226px;
51
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
52
+ --stx-mac-accent-ink: #ffffff;
53
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
54
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
55
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
56
+ --stx-mac-window: #ffffff;
57
+ --stx-mac-sidebar: #f2f1f0;
58
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
59
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
60
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
61
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
62
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
63
+ --stx-mac-control: #ffffff;
64
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
65
+ --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);
66
+ --stx-mac-switch-on: #34c759;
67
+ --stx-mac-knob: #ffffff;
68
+ --stx-mac-danger: #ff3b30;
69
+ }
70
+ :where(.dark) {
71
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
72
+ --stx-mac-accent-ink: #ffffff;
73
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
74
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
75
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
76
+ --stx-mac-window: #1e1e1e;
77
+ --stx-mac-sidebar: #2a2a2a;
78
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
79
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
80
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
81
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
82
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
83
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
84
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
85
+ --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);
86
+ --stx-mac-switch-on: #30d158;
87
+ --stx-mac-knob: #ffffff;
88
+ --stx-mac-danger: #ff453a;
89
+ }
90
+ @media (max-resolution: 1.5dppx) {
91
+ :where(:root) {
92
+ --stx-mac-hairline: 1px;
93
+ }
94
+ }
95
+ @media (prefers-contrast: more) {
96
+ :where(:root) {
97
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
98
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
99
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
100
+ --stx-mac-hairline: 1px;
101
+ }
102
+ :where(.dark) {
103
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
104
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
105
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
106
+ }
107
+ }
108
+
109
+ :where([data-settings-item]) {
110
+ --stx-settings-item-height: 30px;
111
+ --stx-settings-item-radius: 8px;
112
+ --stx-settings-tile-size: 20px;
113
+ --stx-settings-tile-radius: 5.5px;
114
+ --stx-settings-selection: var(--stx-mac-accent);
115
+ --stx-settings-selection-ink: var(--stx-mac-accent-ink);
116
+ /* How much colour a tile keeps in a window that is not in front. */
117
+ --stx-settings-tile-inactive-saturation: 0.7;
118
+ }
119
+
120
+ .stx-settings-item {
121
+ display: flex;
122
+ align-items: center;
123
+ flex: none;
124
+ gap: 8px;
125
+ box-sizing: border-box;
126
+ width: 100%;
127
+ height: var(--stx-settings-item-height);
128
+ margin: 0;
129
+ padding: 0 8px;
130
+ border: 0;
131
+ border-radius: var(--stx-settings-item-radius);
132
+ outline: 0;
133
+ background: none;
134
+ color: var(--stx-mac-ink);
135
+ font: inherit;
136
+ font-family: var(--stx-mac-font);
137
+ font-size: var(--stx-mac-font-size);
138
+ letter-spacing: -0.08px;
139
+ text-align: left;
140
+ cursor: default;
141
+ user-select: none;
142
+ -webkit-user-select: none;
143
+ -webkit-font-smoothing: antialiased;
144
+ }
145
+ .stx-settings-item[hidden] { display: none; }
146
+ .stx-settings-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
147
+ .stx-settings-item:focus-visible { box-shadow: var(--stx-mac-focus-ring); }
148
+
149
+ .stx-settings-item-badge {
150
+ flex: none;
151
+ min-width: 19px;
152
+ height: 19px;
153
+ padding: 0 6px;
154
+ border-radius: 10px;
155
+ background: var(--stx-mac-well);
156
+ color: var(--stx-mac-ink-secondary);
157
+ font-size: var(--stx-mac-font-size-small);
158
+ font-variant-numeric: tabular-nums;
159
+ line-height: 19px;
160
+ letter-spacing: 0;
161
+ text-align: center;
162
+ }
163
+
164
+ /* ---------- The tile ---------- */
165
+ .stx-settings-tile {
166
+ --stx-settings-tile: #8e8e93;
167
+ --stx-settings-tile-glyph: #ffffff;
168
+ display: grid;
169
+ place-items: center;
170
+ flex: none;
171
+ width: var(--stx-settings-tile-size);
172
+ height: var(--stx-settings-tile-size);
173
+ border-radius: var(--stx-settings-tile-radius);
174
+ /* Lighter at the top, as a tile is lit from above. */
175
+ background: linear-gradient(color-mix(in srgb, var(--stx-settings-tile) 84%, #ffffff), var(--stx-settings-tile));
176
+ color: var(--stx-settings-tile-glyph);
177
+ }
178
+ .stx-settings-tile > span { display: block; width: 13px; height: 13px; }
179
+ .stx-settings-tile[data-tone="grey"] { --stx-settings-tile: #8e8e93; }
180
+ .stx-settings-tile[data-tone="blue"] { --stx-settings-tile: #007aff; }
181
+ .stx-settings-tile[data-tone="red"] { --stx-settings-tile: #ff3b30; }
182
+ .stx-settings-tile[data-tone="orange"] { --stx-settings-tile: #ff9500; }
183
+ .stx-settings-tile[data-tone="yellow"] { --stx-settings-tile: #ffcc00; }
184
+ .stx-settings-tile[data-tone="green"] { --stx-settings-tile: #34c759; }
185
+ .stx-settings-tile[data-tone="indigo"] { --stx-settings-tile: #5856d6; }
186
+ .stx-settings-tile[data-tone="purple"] { --stx-settings-tile: #af52de; }
187
+ .stx-settings-tile[data-tone="pink"] { --stx-settings-tile: #ff2d55; }
188
+ .stx-settings-tile[data-tone="ink"] { --stx-settings-tile: #1d1d1f; }
189
+ /* Ink is the page's own ink: black on white, and the reverse in the dark. */
190
+ :where(.dark) .stx-settings-tile[data-tone="ink"] { --stx-settings-tile: #dcdce0; --stx-settings-tile-glyph: #1d1d1f; }
191
+
192
+ /* ---------- Selected ---------- */
193
+ .stx-settings-item[aria-selected="true"] {
194
+ background: var(--stx-settings-selection);
195
+ color: var(--stx-settings-selection-ink);
196
+ /* The same weight as its neighbours, as System Settings draws it: the fill
197
+ says which row is chosen, and a heavier label would shift its width. */
198
+ font-weight: var(--stx-settings-selection-weight, inherit);
199
+ }
200
+ .stx-settings-item[aria-selected="true"] .stx-settings-item-badge {
201
+ background: color-mix(in srgb, var(--stx-settings-selection-ink) 22%, transparent);
202
+ color: var(--stx-settings-selection-ink);
203
+ }
204
+ .stx-settings-item[aria-selected="true"]:focus-visible {
205
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--stx-settings-selection) 45%, transparent);
206
+ }
207
+
208
+ /*
209
+ * A window that is not in front goes quiet: the selection is the grey pill,
210
+ * in the ordinary ink. Craft stamps the root element; the shell stamps itself.
211
+ */
212
+ :where([data-stx-window-active="false"]) .stx-settings-item[aria-selected="true"],
213
+ :root[data-craft-window-active='false'] .stx-settings-item[aria-selected="true"] {
214
+ background: var(--stx-mac-selection-inactive);
215
+ color: var(--stx-mac-ink);
216
+ }
217
+ :where([data-stx-window-active="false"]) .stx-settings-item[aria-selected="true"] .stx-settings-item-badge,
218
+ :root[data-craft-window-active='false'] .stx-settings-item[aria-selected="true"] .stx-settings-item-badge {
219
+ background: var(--stx-mac-well);
220
+ color: var(--stx-mac-ink-secondary);
221
+ }
222
+ :where([data-stx-window-active="false"]) .stx-settings-tile,
223
+ :root[data-craft-window-active='false'] .stx-settings-tile { filter: saturate(var(--stx-settings-tile-inactive-saturation)); }
224
+
225
+ @media (prefers-contrast: more) {
226
+ .stx-settings-item[aria-selected="true"] { outline: 1px solid var(--stx-mac-ink); outline-offset: -1px; }
227
+ }
228
+ </style>