@prestack/thread-ui 0.1.10 → 0.1.11

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 (209) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/dist/ui/attach.js +6 -7
  3. package/dist/ui/compositions.d.ts +0 -8
  4. package/dist/ui/compositions.js +3 -166
  5. package/dist/ui/generators/routes.js +1 -0
  6. package/package.json +2 -2
  7. package/dist/ui/animations/anm_appear.ts +0 -13
  8. package/dist/ui/animations/anm_blur_in.ts +0 -19
  9. package/dist/ui/animations/anm_blur_out.ts +0 -18
  10. package/dist/ui/animations/anm_dismiss.ts +0 -18
  11. package/dist/ui/animations/anm_drop.ts +0 -19
  12. package/dist/ui/animations/anm_fall.ts +0 -18
  13. package/dist/ui/animations/anm_flash.ts +0 -18
  14. package/dist/ui/animations/anm_glow.ts +0 -16
  15. package/dist/ui/animations/anm_lift.ts +0 -16
  16. package/dist/ui/animations/anm_nudge.ts +0 -16
  17. package/dist/ui/animations/anm_pop_in.ts +0 -23
  18. package/dist/ui/animations/anm_pop_out.ts +0 -22
  19. package/dist/ui/animations/anm_press.ts +0 -12
  20. package/dist/ui/animations/anm_pulse.ts +0 -13
  21. package/dist/ui/animations/anm_rise.ts +0 -19
  22. package/dist/ui/animations/anm_shake.ts +0 -13
  23. package/dist/ui/animations/anm_slide_in_left.ts +0 -19
  24. package/dist/ui/animations/anm_slide_in_right.ts +0 -19
  25. package/dist/ui/animations/anm_slide_out_left.ts +0 -18
  26. package/dist/ui/animations/anm_slide_out_right.ts +0 -18
  27. package/dist/ui/animations/anm_spin.ts +0 -12
  28. package/dist/ui/animations/anm_swell.ts +0 -16
  29. package/dist/ui/animations/anm_wobble.ts +0 -24
  30. package/dist/ui/animations/anm_zoom_in.ts +0 -19
  31. package/dist/ui/animations/anm_zoom_out.ts +0 -18
  32. package/dist/ui/animations.ts +0 -308
  33. package/dist/ui/attach.ts +0 -553
  34. package/dist/ui/charts.tsx +0 -69
  35. package/dist/ui/checked.ts +0 -32
  36. package/dist/ui/collector.ts +0 -140
  37. package/dist/ui/compositions.ts +0 -613
  38. package/dist/ui/consent.ts +0 -55
  39. package/dist/ui/content.tsx +0 -27
  40. package/dist/ui/contrast.ts +0 -27
  41. package/dist/ui/controls.tsx +0 -25
  42. package/dist/ui/disclosure.tsx +0 -20
  43. package/dist/ui/dismiss-layer.ts +0 -87
  44. package/dist/ui/door.ts +0 -140
  45. package/dist/ui/drag.ts +0 -316
  46. package/dist/ui/elements/accordion.tsx +0 -47
  47. package/dist/ui/elements/accordion.works.ts +0 -66
  48. package/dist/ui/elements/aspect-ratio.tsx +0 -31
  49. package/dist/ui/elements/aspect-ratio.works.ts +0 -5
  50. package/dist/ui/elements/avatar.tsx +0 -34
  51. package/dist/ui/elements/avatar.works.ts +0 -16
  52. package/dist/ui/elements/badge.tsx +0 -33
  53. package/dist/ui/elements/badge.works.ts +0 -9
  54. package/dist/ui/elements/bars.tsx +0 -50
  55. package/dist/ui/elements/bars.works.ts +0 -29
  56. package/dist/ui/elements/box.tsx +0 -36
  57. package/dist/ui/elements/breadcrumb.tsx +0 -38
  58. package/dist/ui/elements/breadcrumb.works.ts +0 -24
  59. package/dist/ui/elements/button.tsx +0 -46
  60. package/dist/ui/elements/button.works.tsx +0 -52
  61. package/dist/ui/elements/column.tsx +0 -29
  62. package/dist/ui/elements/consent.tsx +0 -71
  63. package/dist/ui/elements/consent.works.tsx +0 -132
  64. package/dist/ui/elements/donut.tsx +0 -45
  65. package/dist/ui/elements/donut.works.ts +0 -42
  66. package/dist/ui/elements/each.tsx +0 -34
  67. package/dist/ui/elements/each.works.tsx +0 -82
  68. package/dist/ui/elements/empty.tsx +0 -33
  69. package/dist/ui/elements/field.tsx +0 -45
  70. package/dist/ui/elements/field.works.ts +0 -65
  71. package/dist/ui/elements/funnel.tsx +0 -50
  72. package/dist/ui/elements/funnel.works.ts +0 -37
  73. package/dist/ui/elements/gauge.tsx +0 -40
  74. package/dist/ui/elements/gauge.works.ts +0 -42
  75. package/dist/ui/elements/glyph.tsx +0 -30
  76. package/dist/ui/elements/glyph.works.tsx +0 -42
  77. package/dist/ui/elements/grid.tsx +0 -29
  78. package/dist/ui/elements/heatmap.tsx +0 -48
  79. package/dist/ui/elements/heatmap.works.ts +0 -24
  80. package/dist/ui/elements/hit-box.tsx +0 -47
  81. package/dist/ui/elements/hit-box.works.tsx +0 -576
  82. package/dist/ui/elements/image.tsx +0 -29
  83. package/dist/ui/elements/line-chart.tsx +0 -45
  84. package/dist/ui/elements/line-chart.works.ts +0 -41
  85. package/dist/ui/elements/link.tsx +0 -38
  86. package/dist/ui/elements/link.works.ts +0 -25
  87. package/dist/ui/elements/media.tsx +0 -57
  88. package/dist/ui/elements/menu.tsx +0 -51
  89. package/dist/ui/elements/menu.works.tsx +0 -154
  90. package/dist/ui/elements/money.tsx +0 -36
  91. package/dist/ui/elements/money.works.ts +0 -9
  92. package/dist/ui/elements/pagination.tsx +0 -39
  93. package/dist/ui/elements/pagination.works.ts +0 -20
  94. package/dist/ui/elements/progress.tsx +0 -34
  95. package/dist/ui/elements/progress.works.ts +0 -8
  96. package/dist/ui/elements/radio-group.tsx +0 -50
  97. package/dist/ui/elements/radio-group.works.ts +0 -33
  98. package/dist/ui/elements/row.tsx +0 -29
  99. package/dist/ui/elements/scatter.tsx +0 -42
  100. package/dist/ui/elements/scatter.works.ts +0 -38
  101. package/dist/ui/elements/select.tsx +0 -43
  102. package/dist/ui/elements/select.works.ts +0 -5
  103. package/dist/ui/elements/separator.tsx +0 -31
  104. package/dist/ui/elements/skeleton.tsx +0 -31
  105. package/dist/ui/elements/slider.tsx +0 -34
  106. package/dist/ui/elements/slider.works.ts +0 -5
  107. package/dist/ui/elements/sparkline.tsx +0 -37
  108. package/dist/ui/elements/sparkline.works.ts +0 -32
  109. package/dist/ui/elements/spinner.tsx +0 -33
  110. package/dist/ui/elements/stack.tsx +0 -29
  111. package/dist/ui/elements/stat.tsx +0 -36
  112. package/dist/ui/elements/stat.works.ts +0 -14
  113. package/dist/ui/elements/surface.tsx +0 -36
  114. package/dist/ui/elements/surface.works.ts +0 -9
  115. package/dist/ui/elements/table.tsx +0 -62
  116. package/dist/ui/elements/table.works.ts +0 -30
  117. package/dist/ui/elements/tabs.tsx +0 -47
  118. package/dist/ui/elements/tabs.works.ts +0 -84
  119. package/dist/ui/elements/text.tsx +0 -33
  120. package/dist/ui/elements/textarea.tsx +0 -38
  121. package/dist/ui/elements/textarea.works.ts +0 -5
  122. package/dist/ui/elements/time.tsx +0 -40
  123. package/dist/ui/elements/time.works.ts +0 -29
  124. package/dist/ui/elements/toggle.tsx +0 -34
  125. package/dist/ui/elements/toggle.works.ts +0 -5
  126. package/dist/ui/elements/tooltip.tsx +0 -40
  127. package/dist/ui/elements/tooltip.works.ts +0 -77
  128. package/dist/ui/elements/value.tsx +0 -38
  129. package/dist/ui/elements/value.works.ts +0 -9
  130. package/dist/ui/elements.ts +0 -127
  131. package/dist/ui/focus-scope.ts +0 -121
  132. package/dist/ui/fonts.ts +0 -355
  133. package/dist/ui/generators/dev.d.ts +0 -1
  134. package/dist/ui/generators/dev.js +0 -62
  135. package/dist/ui/generators/dev.ts +0 -75
  136. package/dist/ui/generators/elements.ts +0 -796
  137. package/dist/ui/generators/i18n.ts +0 -283
  138. package/dist/ui/generators/icons.ts +0 -207
  139. package/dist/ui/generators/react.ts +0 -267
  140. package/dist/ui/generators/routes.ts +0 -847
  141. package/dist/ui/generators/show.ts +0 -261
  142. package/dist/ui/generators/styles.ts +0 -677
  143. package/dist/ui/generators/variants.ts +0 -196
  144. package/dist/ui/i18n/catalogs/en.ts +0 -191
  145. package/dist/ui/i18n/format.ts +0 -221
  146. package/dist/ui/i18n/locales.ts +0 -33
  147. package/dist/ui/i18n/parse.ts +0 -315
  148. package/dist/ui/i18n/translator.ts +0 -31
  149. package/dist/ui/i18n/types.ts +0 -96
  150. package/dist/ui/icons.ts +0 -331
  151. package/dist/ui/islands/map.ts +0 -58
  152. package/dist/ui/localizations.ts +0 -75
  153. package/dist/ui/material.ts +0 -236
  154. package/dist/ui/materials/mat_bordered.ts +0 -13
  155. package/dist/ui/materials/mat_ceramic.ts +0 -13
  156. package/dist/ui/materials/mat_clay.ts +0 -13
  157. package/dist/ui/materials/mat_elevated.ts +0 -24
  158. package/dist/ui/materials/mat_flat.ts +0 -34
  159. package/dist/ui/materials/mat_glass.ts +0 -20
  160. package/dist/ui/materials/mat_lit.ts +0 -13
  161. package/dist/ui/materials/mat_moulded.ts +0 -11
  162. package/dist/ui/materials.ts +0 -197
  163. package/dist/ui/modes.ts +0 -44
  164. package/dist/ui/navigation.tsx +0 -29
  165. package/dist/ui/positioning.ts +0 -90
  166. package/dist/ui/presented.tsx +0 -119
  167. package/dist/ui/provider.tsx +0 -184
  168. package/dist/ui/render-loop.ts +0 -133
  169. package/dist/ui/roving-focus.ts +0 -161
  170. package/dist/ui/screens.ts +0 -141
  171. package/dist/ui/scroll-lock.ts +0 -28
  172. package/dist/ui/series.ts +0 -97
  173. package/dist/ui/signals.ts +0 -386
  174. package/dist/ui/styleguide.ts +0 -231
  175. package/dist/ui/styleguides.ts +0 -374
  176. package/dist/ui/themes.ts +0 -22
  177. package/dist/ui/token.ts +0 -78
  178. package/dist/ui/tokens/shadow.ts +0 -25
  179. package/dist/ui/tokens.ts +0 -234
  180. package/dist/ui/validators.ts +0 -232
  181. package/dist/ui/variant.ts +0 -349
  182. package/dist/ui/variants/var_avatar-round.ts +0 -14
  183. package/dist/ui/variants/var_bubble-me.ts +0 -14
  184. package/dist/ui/variants/var_bubble-them.ts +0 -13
  185. package/dist/ui/variants/var_button-border.ts +0 -76
  186. package/dist/ui/variants/var_button-cta.ts +0 -76
  187. package/dist/ui/variants/var_button-destructive-ghost.ts +0 -72
  188. package/dist/ui/variants/var_button-destructive.ts +0 -76
  189. package/dist/ui/variants/var_button-fill.ts +0 -76
  190. package/dist/ui/variants/var_button-ghost.ts +0 -72
  191. package/dist/ui/variants/var_button-glass.ts +0 -55
  192. package/dist/ui/variants/var_button-normal.ts +0 -76
  193. package/dist/ui/variants/var_button-quiet.ts +0 -74
  194. package/dist/ui/variants/var_card.ts +0 -17
  195. package/dist/ui/variants/var_chip.ts +0 -13
  196. package/dist/ui/variants/var_choice.ts +0 -15
  197. package/dist/ui/variants/var_framed.ts +0 -10
  198. package/dist/ui/variants/var_glyph-plain.ts +0 -11
  199. package/dist/ui/variants/var_input.ts +0 -43
  200. package/dist/ui/variants/var_link-inline.ts +0 -29
  201. package/dist/ui/variants/var_list-row.ts +0 -34
  202. package/dist/ui/variants/var_rule.ts +0 -10
  203. package/dist/ui/variants/var_skeleton-block.ts +0 -12
  204. package/dist/ui/variants/var_spinner-turning.ts +0 -12
  205. package/dist/ui/variants/var_stat-tile.ts +0 -13
  206. package/dist/ui/variants/var_tab-bar.ts +0 -15
  207. package/dist/ui/variants/var_tap-target.ts +0 -25
  208. package/dist/ui/variants.ts +0 -64
  209. package/dist/ui/wrappers.tsx +0 -429
@@ -1,349 +0,0 @@
1
- import { BOUND as MATERIAL_BOUND, compose, composed, FREE, type Material, type Setting } from './material.ts'
2
- import type { Holds, Token, Wearing } from './token.ts'
3
- import { coexist, holds, isSignal, selectorOf, signalNames } from './signals.ts'
4
-
5
- interface Stateful {
6
- readonly id: string
7
-
8
- readonly states?: readonly {
9
- readonly when: readonly string[]
10
- readonly sets: readonly Setting[]
11
- }[]
12
- }
13
-
14
- type SignalId = (typeof holds)[number]['id'] | (string & {})
15
-
16
- const BOUND = {
17
- background: ['colour', 'gradient', 'texture', 'noise', 'img'],
18
- borderColor: ['colour'],
19
- color: ['colour'],
20
- borderRadius: ['radius'],
21
- borderWidth: ['edge'],
22
-
23
- borderStyle: ['line'],
24
- boxShadow: ['shadow'],
25
- cursor: ['cursor'],
26
- gap: ['space'],
27
- padding: ['space'],
28
- outlineOffset: ['space'],
29
- minHeight: ['control', 'space'],
30
- minWidth: ['space'],
31
- maxWidth: ['space'],
32
- opacity: ['opacity'],
33
- transform: ['transform'],
34
- animation: ['animation'],
35
- width: ['icon'],
36
- height: ['control', 'icon'],
37
-
38
- display: ['layout'],
39
- flexDirection: ['flow'],
40
- alignItems: ['align'],
41
- justifyContent: ['align'],
42
- flexWrap: ['wrap'],
43
-
44
- position: ['position'],
45
- visibility: ['visibility'],
46
- pointerEvents: ['reach'],
47
- userSelect: ['picking'],
48
- touchAction: ['touch'],
49
- willChange: ['readying'],
50
- transformOrigin: ['origin'],
51
- overflow: ['overflow'],
52
- zIndex: ['layer'],
53
- top: ['space'],
54
- left: ['space'],
55
- aspectRatio: ['ratio'],
56
- } as const
57
-
58
- type Property = keyof typeof BOUND
59
-
60
- type BoundSettingFor<P extends Property> = {
61
- readonly property: P
62
-
63
- readonly is?: string
64
-
65
- readonly token?: (typeof BOUND)[P][number]
66
-
67
- readonly asks?: Readonly<Record<string, string | number>>
68
- }
69
-
70
- type FreeProperty = (typeof FREE)[number]
71
-
72
- type FreeSettingFor<P extends FreeProperty> = {
73
- readonly property: P
74
-
75
- readonly is: string
76
- }
77
-
78
- type VariantSetting =
79
- | { [P in Property]: BoundSettingFor<P> }[Property]
80
- | { [P in FreeProperty]: FreeSettingFor<P> }[FreeProperty]
81
-
82
- export interface Variant {
83
- readonly id: string
84
-
85
- readonly version?: number
86
-
87
- readonly material?: string
88
-
89
- readonly type?: string
90
-
91
- readonly icon?: string
92
-
93
- readonly sets: readonly VariantSetting[]
94
-
95
- readonly states?: readonly {
96
- readonly when: readonly SignalId[]
97
- readonly sets: readonly VariantSetting[]
98
- }[]
99
-
100
- readonly reacts: readonly SignalId[]
101
-
102
- readonly plays?: {
103
- readonly in?: string
104
- readonly out?: string
105
- }
106
- }
107
-
108
- export function propertiesHeld(): Readonly<Record<string, readonly string[]>> {
109
- return BOUND
110
- }
111
-
112
- export function freeHeld(): readonly string[] {
113
- return FREE
114
- }
115
-
116
- export const structural = new Set(['tag', 'shows', 'reads', 'holds', 'each', 'by', 'takes', 'marks', 'gives', 'keyed', 'when'])
117
-
118
- export function looking(made: Readonly<Record<string, string>>): boolean {
119
- return Object.keys(made).some((key) => !structural.has(key))
120
- }
121
-
122
- export const variant = <const T extends Variant>(
123
- one: T & {
124
- readonly sets: {
125
- readonly [I in keyof T['sets']]: T['sets'][I] extends { readonly is: infer Said }
126
- ? { readonly is: Wearing<Said & string> }
127
- : unknown
128
- }
129
- } & (T extends { readonly states: infer States }
130
- ? {
131
- readonly states: {
132
- readonly [S in keyof States]: States[S] extends { readonly sets: infer Sets }
133
- ? {
134
- readonly sets: {
135
- readonly [I in keyof Sets]: Sets[I] extends { readonly is: infer Said }
136
- ? { readonly is: Wearing<Said & string> }
137
- : unknown
138
- }
139
- }
140
- : unknown
141
- }
142
- }
143
- : unknown),
144
- ): T => one
145
-
146
- export function boundHeld(): Readonly<Record<string, readonly string[]>> {
147
- return BOUND
148
- }
149
- export function camel(id: string): string {
150
- return id.replace(/-([a-z0-9])/g, (_, one: string) => one.toUpperCase())
151
- }
152
-
153
- export function classOf(id: string): string {
154
- return `thread-${id}`
155
- }
156
-
157
- export function classOfElement(id: string): string {
158
- return `e-${id}`
159
- }
160
-
161
- export function classOfComposition(id: string): string {
162
- return `c-${id}`
163
- }
164
-
165
- export function classOfScreen(id: string): string {
166
- return `s-${id}`
167
- }
168
-
169
- export function unreacted(
170
- variant: Variant,
171
- materials: Readonly<Record<string, Material>>,
172
- ): readonly string[] {
173
- const whole = statesOf(variant, materials)
174
- const described = new Set((whole.states ?? []).flatMap((one) => one.when))
175
- const claimed = new Set<string>(variant.reacts)
176
- const missing: string[] = []
177
-
178
- for (const name of [...described].sort()) {
179
- if (claimed.has(name)) continue
180
- missing.push(
181
- `\`${variant.id}\` looks different under "${name}" and does not say it reacts to it. A ` +
182
- 'variant states what it answers to, so reading one tells you without opening its material.',
183
- )
184
- }
185
-
186
- for (const name of [...claimed].sort()) {
187
- if (!isSignal(name)) {
188
- missing.push(
189
- `\`${variant.id}\` says it reacts to "${name}", and no signal by that name is declared. ` +
190
- `Declared: ${signalNames().join(' · ')}.`,
191
- )
192
- continue
193
- }
194
- if (described.has(name)) continue
195
- missing.push(
196
- `\`${variant.id}\` says it reacts to "${name}" and never says how it looks under it, so it ` +
197
- 'reacts to nothing.',
198
- )
199
- }
200
-
201
- return missing
202
- }
203
-
204
- export function complete(
205
- variant: Variant,
206
- materials: Readonly<Record<string, Material>>,
207
- named: ReadonlySet<string>,
208
- tokens: Readonly<Record<string, Token>>,
209
- kinds: Readonly<Record<string, string>>,
210
- ): Readonly<Record<string, Holds>> {
211
- const made: Record<string, Holds> = {}
212
-
213
- if (variant.material !== undefined) {
214
- const material = materials[variant.material]
215
- if (material === undefined) {
216
- throw new Error(
217
- `\`${variant.id}\` is made of \`${variant.material}\`, and no material by that name is ` +
218
- 'declared. A variant is material plus the rest, so without the material there is no rest.',
219
- )
220
- }
221
- Object.assign(made, compose(material, named, tokens, kinds))
222
- }
223
-
224
- Object.assign(
225
- made,
226
- composed(variant.sets, named, tokens, variant.id, kinds, { ...MATERIAL_BOUND, ...BOUND }),
227
- )
228
-
229
- return made
230
- }
231
-
232
- export function statesOf(
233
- variant: Variant,
234
- materials: Readonly<Record<string, Material>>,
235
- ): Stateful {
236
- const material = variant.material === undefined ? undefined : materials[variant.material]
237
- const merged = new Map<string, { when: readonly string[]; sets: Setting[] }>()
238
-
239
- for (const state of [...(material?.states ?? []), ...(variant.states ?? [])]) {
240
- const at = [...state.when].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)).join('+')
241
- const already = merged.get(at)
242
- if (already === undefined) merged.set(at, { when: state.when, sets: [...state.sets] })
243
- else already.sets.push(...state.sets)
244
- }
245
-
246
- return { id: variant.id, states: [...merged.values()] }
247
- }
248
-
249
- function marked(when: readonly string[]): string {
250
- return [...when]
251
- .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))
252
- .map((one) => selectorOf(one) ?? '')
253
- .join('')
254
- }
255
-
256
- export function under(
257
- variant: Stateful,
258
- named: ReadonlySet<string>,
259
- tokens: Readonly<Record<string, Token>>,
260
- kinds: Readonly<Record<string, string>>,
261
- ): readonly { readonly marks: string; readonly made: Readonly<Record<string, Holds>> }[] {
262
- const found: { marks: string; made: Readonly<Record<string, Holds>> }[] = []
263
-
264
- for (const state of variant.states ?? []) {
265
- if (state.when.length === 0) {
266
- throw new Error(
267
- `\`${variant.id}\` declares a state that names no signal. A state is the set of truths it ` +
268
- 'holds under, and the empty set is the resting look, which is already declared.',
269
- )
270
- }
271
-
272
- for (const name of state.when) {
273
- if (isSignal(name)) continue
274
- throw new Error(
275
- `\`${variant.id}\` declares a state under \`${name}\`, and no signal by that name is ` +
276
- `declared. Declared: ${signalNames().join(' · ')}.`,
277
- )
278
- }
279
-
280
- found.push({
281
- marks: marked(state.when),
282
- made: composed(state.sets, named, tokens, variant.id, kinds, { ...MATERIAL_BOUND, ...BOUND }),
283
- })
284
- }
285
-
286
- return found
287
- }
288
-
289
- const key = (when: readonly string[]): string =>
290
- [...when].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)).join('+')
291
-
292
- function sized(all: readonly string[], size: number): readonly (readonly string[])[] {
293
- if (size === 0) return [[]]
294
- const found: (readonly string[])[] = []
295
- for (let at = 0; at <= all.length - size; at += 1) {
296
- const head = all[at]
297
- if (head === undefined) continue
298
- for (const rest of sized(all.slice(at + 1), size - 1)) found.push([head, ...rest])
299
- }
300
- return found
301
- }
302
-
303
- function together(all: readonly string[]): boolean {
304
- for (let i = 0; i < all.length; i += 1) {
305
- for (let j = i + 1; j < all.length; j += 1) {
306
- if (!coexist(all[i] ?? '', all[j] ?? '')) return false
307
- }
308
- }
309
- return true
310
- }
311
-
312
- export function undeclaredStates(variant: Stateful): readonly string[] {
313
- const states = variant.states ?? []
314
- const declared = new Set(states.map((one) => key(one.when)))
315
- const named = [...new Set(states.flatMap((one) => one.when))].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))
316
- const missing: string[] = []
317
-
318
- for (let size = 2; size <= named.length; size += 1) {
319
- for (const combination of sized(named, size)) {
320
- if (!together(combination)) continue
321
- if (declared.has(key(combination))) continue
322
-
323
- const applying = states.filter((one) => one.when.every((name) => combination.includes(name)))
324
- const deepest = new Map<string, number>()
325
- const tied = new Map<string, number>()
326
- for (const state of applying) {
327
- for (const property of new Set(state.sets.map((set) => set.property))) {
328
- const depth = deepest.get(property) ?? 0
329
- if (state.when.length > depth) {
330
- deepest.set(property, state.when.length)
331
- tied.set(property, 1)
332
- } else if (state.when.length === depth) {
333
- tied.set(property, (tied.get(property) ?? 0) + 1)
334
- }
335
- }
336
- }
337
- const clash = new Set([...tied.entries()].filter(([, held]) => held > 1).map(([property]) => property))
338
- if (clash.size === 0) continue
339
-
340
- missing.push(
341
- `${combination.map((one) => `"${one}"`).join(' and ')} can all hold at once and they all ` +
342
- `set ${[...clash].sort().join(', ')}, so which one wins would be an accident of file ` +
343
- `order. "${key(combination)}" is not declared — declare it, or say the signals cannot coexist`,
344
- )
345
- }
346
- }
347
-
348
- return missing
349
- }
@@ -1,14 +0,0 @@
1
- import { variant } from '../variant.ts'
2
-
3
- export const AVATAR_ROUND = variant({
4
- id: 'avatar-round',
5
- sets: [
6
- { property: 'width', is: 'icon-lg' },
7
- { property: 'height', is: 'icon-lg' },
8
- { property: 'borderRadius', is: 'radius-pill' },
9
- { property: 'background', is: 'colour-sunken' },
10
- { property: 'display', is: 'layout-flex' },
11
- { property: 'alignItems', is: 'align-centre' },
12
- ],
13
- reacts: [],
14
- } as const)
@@ -1,14 +0,0 @@
1
- import { variant } from '../variant.ts'
2
-
3
- export const BUBBLE_ME = variant({
4
- id: 'bubble-me',
5
- material: 'flat',
6
- sets: [
7
- { property: 'background', is: 'colour-accent' },
8
- { property: 'color', is: 'colour-on-accent' },
9
- { property: 'borderRadius', is: 'radius-lg' },
10
- { property: 'padding', is: 'space-3 space-4' },
11
- { property: 'gap', is: 'space-2' },
12
- ],
13
- reacts: ['focus', 'hover'],
14
- } as const)
@@ -1,13 +0,0 @@
1
- import { variant } from '../variant.ts'
2
-
3
- export const BUBBLE_THEM = variant({
4
- id: 'bubble-them',
5
- material: 'flat',
6
- sets: [
7
- { property: 'color', is: 'colour-ink' },
8
- { property: 'borderRadius', is: 'radius-lg' },
9
- { property: 'padding', is: 'space-3 space-4' },
10
- { property: 'gap', is: 'space-2' },
11
- ],
12
- reacts: ['focus', 'hover'],
13
- } as const)
@@ -1,76 +0,0 @@
1
- import { variant } from '../variant.ts'
2
-
3
- export const BUTTON_BORDER = variant({
4
- id: 'button-border',
5
- type: 'label',
6
- icon: 'md',
7
- sets: [
8
- { property: 'display', is: 'layout-flex' },
9
- { property: 'alignItems', is: 'align-centre' },
10
- { property: 'justifyContent', is: 'align-centre' },
11
- { property: 'borderRadius', is: 'control-radius' },
12
- { property: 'height', is: 'control-md' },
13
- { property: 'padding', is: 'control-pad-y control-pad-x' },
14
- { property: 'gap', is: 'control-gap' },
15
- { property: 'cursor', is: 'cursor-press' },
16
- { property: 'transition', is: 'motion-quick ease-out' },
17
- { property: 'background', is: 'colour-clear' },
18
- { property: 'color', is: 'colour-accent' },
19
- { property: 'borderWidth', is: 'control-edge' },
20
- { property: 'borderStyle', is: 'line-solid' },
21
- { property: 'borderColor', is: 'colour-accent' },
22
- { property: 'boxShadow', is: 'shadow-0' },
23
- ],
24
- states: [
25
- {
26
- when: ['hover'],
27
- sets: [
28
- { property: 'background', is: 'colour-surface-lit' },
29
- { property: 'transform', is: 'transform-lift' },
30
- ],
31
- },
32
- {
33
- when: ['active'],
34
- sets: [
35
- { property: 'background', is: 'colour-surface-lit' },
36
- { property: 'transform', is: 'transform-press' },
37
- ],
38
- },
39
- {
40
- when: ['active', 'hover'],
41
- sets: [
42
- { property: 'background', is: 'colour-surface-lit' },
43
- { property: 'transform', is: 'transform-press' },
44
- ],
45
- },
46
- {
47
- when: ['focus'],
48
- sets: [
49
- { property: 'outline', is: 'control-ring line-solid colour-accent' },
50
- { property: 'outlineOffset', is: 'control-ring-offset' },
51
- ],
52
- },
53
- {
54
- when: ['loading'],
55
- sets: [
56
- { property: 'opacity', is: 'opacity-muted' },
57
- ],
58
- },
59
- {
60
- when: ['disabled'],
61
- sets: [
62
- { property: 'cursor', is: 'cursor-refuse' },
63
- { property: 'borderColor', is: 'colour-edge' },
64
- { property: 'color', is: 'colour-ink-faint' },
65
- ],
66
- },
67
- {
68
- when: ['disabled', 'hover'],
69
- sets: [
70
- { property: 'background', is: 'colour-clear' },
71
- { property: 'transform', is: 'transform-rest' },
72
- ],
73
- },
74
- ],
75
- reacts: ['active', 'disabled', 'focus', 'hover', 'loading'],
76
- } as const)
@@ -1,76 +0,0 @@
1
- import { variant } from '../variant.ts'
2
-
3
- export const BUTTON_CTA = variant({
4
- id: 'button-cta',
5
- type: 'body',
6
- icon: 'md',
7
- sets: [
8
- { property: 'display', is: 'layout-flex' },
9
- { property: 'alignItems', is: 'align-centre' },
10
- { property: 'justifyContent', is: 'align-centre' },
11
- { property: 'borderRadius', is: 'control-radius' },
12
- { property: 'height', is: 'control-lg' },
13
- { property: 'padding', is: 'control-pad-y control-pad-x' },
14
- { property: 'gap', is: 'control-gap' },
15
- { property: 'cursor', is: 'cursor-press' },
16
- { property: 'transition', is: 'motion-quick ease-out' },
17
- { property: 'background', is: 'colour-accent' },
18
- { property: 'color', is: 'colour-on-accent' },
19
- { property: 'borderWidth', is: 'edge-hair' },
20
- { property: 'borderStyle', is: 'line-off' },
21
- { property: 'borderColor', is: 'colour-clear' },
22
- { property: 'boxShadow', is: 'shadow-2' },
23
- ],
24
- states: [
25
- {
26
- when: ['hover'],
27
- sets: [
28
- { property: 'background', is: 'colour-accent-hover' },
29
- { property: 'transform', is: 'transform-lift' },
30
- ],
31
- },
32
- {
33
- when: ['active'],
34
- sets: [
35
- { property: 'background', is: 'colour-accent-press' },
36
- { property: 'transform', is: 'transform-press' },
37
- ],
38
- },
39
- {
40
- when: ['active', 'hover'],
41
- sets: [
42
- { property: 'background', is: 'colour-accent-press' },
43
- { property: 'transform', is: 'transform-press' },
44
- ],
45
- },
46
- {
47
- when: ['focus'],
48
- sets: [
49
- { property: 'outline', is: 'control-ring line-solid colour-accent' },
50
- { property: 'outlineOffset', is: 'control-ring-offset' },
51
- ],
52
- },
53
- {
54
- when: ['loading'],
55
- sets: [
56
- { property: 'opacity', is: 'opacity-muted' },
57
- ],
58
- },
59
- {
60
- when: ['disabled'],
61
- sets: [
62
- { property: 'cursor', is: 'cursor-refuse' },
63
- { property: 'background', is: 'colour-sunken' },
64
- { property: 'color', is: 'colour-ink-faint' },
65
- ],
66
- },
67
- {
68
- when: ['disabled', 'hover'],
69
- sets: [
70
- { property: 'background', is: 'colour-sunken' },
71
- { property: 'transform', is: 'transform-rest' },
72
- ],
73
- },
74
- ],
75
- reacts: ['active', 'disabled', 'focus', 'hover', 'loading'],
76
- } as const)
@@ -1,72 +0,0 @@
1
- import { variant } from '../variant.ts'
2
-
3
- export const BUTTON_DESTRUCTIVE_GHOST = variant({
4
- id: 'button-destructive-ghost',
5
- type: 'label',
6
- icon: 'md',
7
- sets: [
8
- { property: 'display', is: 'layout-flex' },
9
- { property: 'alignItems', is: 'align-centre' },
10
- { property: 'justifyContent', is: 'align-centre' },
11
- { property: 'borderRadius', is: 'control-radius' },
12
- { property: 'height', is: 'control-md' },
13
- { property: 'padding', is: 'control-pad-y control-pad-x' },
14
- { property: 'gap', is: 'control-gap' },
15
- { property: 'cursor', is: 'cursor-press' },
16
- { property: 'transition', is: 'motion-quick ease-out' },
17
- { property: 'background', is: 'colour-clear' },
18
- { property: 'color', is: 'colour-negative' },
19
- { property: 'borderWidth', is: 'edge-hair' },
20
- { property: 'borderStyle', is: 'line-off' },
21
- { property: 'borderColor', is: 'colour-clear' },
22
- { property: 'boxShadow', is: 'shadow-0' },
23
- ],
24
- states: [
25
- {
26
- when: ['hover'],
27
- sets: [
28
- { property: 'background', is: 'colour-surface-alert' },
29
- { property: 'transform', is: 'transform-lift' },
30
- ],
31
- },
32
- {
33
- when: ['active'],
34
- sets: [
35
- { property: 'background', is: 'colour-surface-alert' },
36
- { property: 'transform', is: 'transform-press' },
37
- ],
38
- },
39
- {
40
- when: ['active', 'hover'],
41
- sets: [
42
- { property: 'background', is: 'colour-surface-alert' },
43
- { property: 'transform', is: 'transform-press' },
44
- ],
45
- },
46
- {
47
- when: ['focus'],
48
- sets: [
49
- { property: 'outline', is: 'control-ring line-solid colour-negative' },
50
- { property: 'outlineOffset', is: 'control-ring-offset' },
51
- ],
52
- },
53
- {
54
- when: ['loading'],
55
- sets: [
56
- { property: 'opacity', is: 'opacity-muted' },
57
- ],
58
- },
59
- {
60
- when: ['disabled'],
61
- sets: [{ property: 'color', is: 'colour-ink-faint' }, { property: 'cursor', is: 'cursor-refuse' }],
62
- },
63
- {
64
- when: ['disabled', 'hover'],
65
- sets: [
66
- { property: 'background', is: 'colour-clear' },
67
- { property: 'transform', is: 'transform-rest' },
68
- ],
69
- },
70
- ],
71
- reacts: ['active', 'disabled', 'focus', 'hover', 'loading'],
72
- } as const)
@@ -1,76 +0,0 @@
1
- import { variant } from '../variant.ts'
2
-
3
- export const BUTTON_DESTRUCTIVE = variant({
4
- id: 'button-destructive',
5
- type: 'label',
6
- icon: 'md',
7
- sets: [
8
- { property: 'display', is: 'layout-flex' },
9
- { property: 'alignItems', is: 'align-centre' },
10
- { property: 'justifyContent', is: 'align-centre' },
11
- { property: 'borderRadius', is: 'control-radius' },
12
- { property: 'height', is: 'control-md' },
13
- { property: 'padding', is: 'control-pad-y control-pad-x' },
14
- { property: 'gap', is: 'control-gap' },
15
- { property: 'cursor', is: 'cursor-press' },
16
- { property: 'transition', is: 'motion-quick ease-out' },
17
- { property: 'background', is: 'colour-negative' },
18
- { property: 'color', is: 'colour-on-negative' },
19
- { property: 'borderWidth', is: 'edge-hair' },
20
- { property: 'borderStyle', is: 'line-off' },
21
- { property: 'borderColor', is: 'colour-clear' },
22
- { property: 'boxShadow', is: 'shadow-0' },
23
- ],
24
- states: [
25
- {
26
- when: ['hover'],
27
- sets: [
28
- { property: 'background', is: 'colour-negative-hover' },
29
- { property: 'transform', is: 'transform-lift' },
30
- ],
31
- },
32
- {
33
- when: ['active'],
34
- sets: [
35
- { property: 'background', is: 'colour-negative-press' },
36
- { property: 'transform', is: 'transform-press' },
37
- ],
38
- },
39
- {
40
- when: ['active', 'hover'],
41
- sets: [
42
- { property: 'background', is: 'colour-negative-press' },
43
- { property: 'transform', is: 'transform-press' },
44
- ],
45
- },
46
- {
47
- when: ['focus'],
48
- sets: [
49
- { property: 'outline', is: 'control-ring line-solid colour-negative' },
50
- { property: 'outlineOffset', is: 'control-ring-offset' },
51
- ],
52
- },
53
- {
54
- when: ['loading'],
55
- sets: [
56
- { property: 'opacity', is: 'opacity-muted' },
57
- ],
58
- },
59
- {
60
- when: ['disabled'],
61
- sets: [
62
- { property: 'cursor', is: 'cursor-refuse' },
63
- { property: 'background', is: 'colour-sunken' },
64
- { property: 'color', is: 'colour-ink-faint' },
65
- ],
66
- },
67
- {
68
- when: ['disabled', 'hover'],
69
- sets: [
70
- { property: 'background', is: 'colour-sunken' },
71
- { property: 'transform', is: 'transform-rest' },
72
- ],
73
- },
74
- ],
75
- reacts: ['active', 'disabled', 'focus', 'hover', 'loading'],
76
- } as const)