vorma 0.86.0-pre.2 → 0.86.0-pre.3

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 (104) hide show
  1. package/.dist/core/_index.d.ts +1 -0
  2. package/.dist/core/_index.d.ts.map +1 -1
  3. package/.dist/core/_index.js +6 -0
  4. package/.dist/core/_index.js.map +1 -1
  5. package/.dist/core/vorma_client_wasm_bg.wasm +0 -0
  6. package/.dist/ui/solid/solid.js +29 -39
  7. package/.dist/ui/solid/solid.js.map +1 -1
  8. package/core/client_wasm/vorma_client_wasm_bg.wasm +0 -0
  9. package/core/create_client_core.ts +9 -1
  10. package/package.json +1 -16
  11. package/ui/solid/solid.tsx +29 -10
  12. package/.dist/kit/lab/design/components/remix/remix.d.ts +0 -2309
  13. package/.dist/kit/lab/design/components/remix/remix.d.ts.map +0 -1
  14. package/.dist/kit/lab/design/components/remix/remix.js +0 -7022
  15. package/.dist/kit/lab/design/components/remix/remix.js.map +0 -1
  16. package/.dist/kit/lab/design/core/core.d.ts +0 -527
  17. package/.dist/kit/lab/design/core/core.d.ts.map +0 -1
  18. package/.dist/kit/lab/design/core/core.js +0 -668
  19. package/.dist/kit/lab/design/core/core.js.map +0 -1
  20. package/.dist/kit/matcher/matcher.d.ts +0 -78
  21. package/.dist/kit/matcher/matcher.d.ts.map +0 -1
  22. package/.dist/kit/matcher/matcher.js +0 -517
  23. package/.dist/kit/matcher/matcher.js.map +0 -1
  24. package/.dist/ui/remix/remix.d.ts +0 -73
  25. package/.dist/ui/remix/remix.d.ts.map +0 -1
  26. package/.dist/ui/remix/remix.js +0 -409
  27. package/.dist/ui/remix/remix.js.map +0 -1
  28. package/kit/lab/design/components/remix/accordion.ts +0 -474
  29. package/kit/lab/design/components/remix/alert-dialog.ts +0 -512
  30. package/kit/lab/design/components/remix/alert.ts +0 -213
  31. package/kit/lab/design/components/remix/aspect-ratio.ts +0 -111
  32. package/kit/lab/design/components/remix/badge.ts +0 -59
  33. package/kit/lab/design/components/remix/box.ts +0 -49
  34. package/kit/lab/design/components/remix/button.ts +0 -314
  35. package/kit/lab/design/components/remix/callout.ts +0 -127
  36. package/kit/lab/design/components/remix/checkable-state.ts +0 -187
  37. package/kit/lab/design/components/remix/checkbox-group.ts +0 -443
  38. package/kit/lab/design/components/remix/checkbox.ts +0 -215
  39. package/kit/lab/design/components/remix/chip.ts +0 -165
  40. package/kit/lab/design/components/remix/code-block.ts +0 -181
  41. package/kit/lab/design/components/remix/collapsible.ts +0 -325
  42. package/kit/lab/design/components/remix/component-state.ts +0 -55
  43. package/kit/lab/design/components/remix/component-style.ts +0 -364
  44. package/kit/lab/design/components/remix/composite-navigation.ts +0 -71
  45. package/kit/lab/design/components/remix/conditions.ts +0 -25
  46. package/kit/lab/design/components/remix/controllable-state.ts +0 -58
  47. package/kit/lab/design/components/remix/description-list.ts +0 -275
  48. package/kit/lab/design/components/remix/dialog.ts +0 -653
  49. package/kit/lab/design/components/remix/empty-state.ts +0 -146
  50. package/kit/lab/design/components/remix/field.ts +0 -418
  51. package/kit/lab/design/components/remix/fieldset.ts +0 -153
  52. package/kit/lab/design/components/remix/form-mirror.ts +0 -94
  53. package/kit/lab/design/components/remix/form-reset.ts +0 -85
  54. package/kit/lab/design/components/remix/form.ts +0 -109
  55. package/kit/lab/design/components/remix/grid.ts +0 -187
  56. package/kit/lab/design/components/remix/group-label.ts +0 -47
  57. package/kit/lab/design/components/remix/icon.ts +0 -176
  58. package/kit/lab/design/components/remix/input.ts +0 -163
  59. package/kit/lab/design/components/remix/kbd.ts +0 -58
  60. package/kit/lab/design/components/remix/list.ts +0 -120
  61. package/kit/lab/design/components/remix/listbox.ts +0 -1116
  62. package/kit/lab/design/components/remix/menu.ts +0 -1477
  63. package/kit/lab/design/components/remix/ordered-collection.ts +0 -95
  64. package/kit/lab/design/components/remix/popover-scroll-lock.ts +0 -89
  65. package/kit/lab/design/components/remix/popover.ts +0 -576
  66. package/kit/lab/design/components/remix/popup-behavior.ts +0 -96
  67. package/kit/lab/design/components/remix/progress.ts +0 -185
  68. package/kit/lab/design/components/remix/radio-group.ts +0 -420
  69. package/kit/lab/design/components/remix/recipe.ts +0 -70
  70. package/kit/lab/design/components/remix/remix.ts +0 -683
  71. package/kit/lab/design/components/remix/responsive.ts +0 -106
  72. package/kit/lab/design/components/remix/root.ts +0 -137
  73. package/kit/lab/design/components/remix/select.ts +0 -1546
  74. package/kit/lab/design/components/remix/separator.ts +0 -108
  75. package/kit/lab/design/components/remix/slider.ts +0 -308
  76. package/kit/lab/design/components/remix/spinner.ts +0 -114
  77. package/kit/lab/design/components/remix/stack.ts +0 -205
  78. package/kit/lab/design/components/remix/stat.ts +0 -127
  79. package/kit/lab/design/components/remix/surface.ts +0 -71
  80. package/kit/lab/design/components/remix/switch.ts +0 -219
  81. package/kit/lab/design/components/remix/table.ts +0 -395
  82. package/kit/lab/design/components/remix/tabs.ts +0 -404
  83. package/kit/lab/design/components/remix/text.ts +0 -169
  84. package/kit/lab/design/components/remix/textarea.ts +0 -164
  85. package/kit/lab/design/components/remix/toast.ts +0 -299
  86. package/kit/lab/design/components/remix/tooltip.ts +0 -330
  87. package/kit/lab/design/components/remix/typeahead.ts +0 -81
  88. package/kit/lab/design/components/remix/types.ts +0 -19
  89. package/kit/lab/design/components/remix/visually-hidden.ts +0 -100
  90. package/kit/lab/design/core/color.ts +0 -46
  91. package/kit/lab/design/core/core.ts +0 -111
  92. package/kit/lab/design/core/create_primitive.ts +0 -455
  93. package/kit/lab/design/core/create_system.ts +0 -303
  94. package/kit/lab/design/core/css.ts +0 -127
  95. package/kit/lab/design/core/define_system.ts +0 -508
  96. package/kit/lab/design/core/math.ts +0 -12
  97. package/kit/lab/design/core/object.ts +0 -31
  98. package/kit/lab/design/core/recipe/create_recipe.ts +0 -185
  99. package/kit/lab/design/core/recipe/recipe.ts +0 -26
  100. package/kit/lab/design/core/recipe/style.ts +0 -62
  101. package/kit/lab/design/core/recipe/types.ts +0 -160
  102. package/kit/lab/design/core/resolve_token.ts +0 -118
  103. package/kit/lab/design/core/types.ts +0 -636
  104. package/ui/remix/remix.tsx +0 -901
@@ -1,455 +0,0 @@
1
- import { createPalette, formatOKLCH, is_oklch, type OKLCH } from "./color.ts";
2
- import { createCSSVariableReference } from "./css.ts";
3
- import { format_px, format_rem } from "./math.ts";
4
- import { compact_object } from "./object.ts";
5
- import {
6
- is_token_spec,
7
- resolve_raw_record,
8
- resolve_raw_value,
9
- resolve_spec_record,
10
- resolve_token_spec,
11
- } from "./resolve_token.ts";
12
- import {
13
- primitive_token_keys,
14
- token_groups,
15
- type BorderCompositeInput,
16
- type LengthScaleInput,
17
- type ModeName,
18
- type ModularScaleInput,
19
- type NonEmptyReadonlyArray,
20
- type PrimitiveTokens,
21
- type RawTokenValue,
22
- type ShadowCompositeInput,
23
- type ShadowLayerInput,
24
- type SystemInput,
25
- type TextStyleInput,
26
- type TokenSpec,
27
- type TransitionCompositeInput,
28
- type TransitionInput,
29
- } from "./types.ts";
30
-
31
- /////////////////////////////////////////////////////////////////////
32
- /////// Composite Values
33
- /////////////////////////////////////////////////////////////////////
34
-
35
- // Composite tokens keep authoring ergonomic while still compiling to ordinary token strings.
36
- function resolve_composite_value(
37
- value: RawTokenValue | TokenSpec,
38
- variable_prefix: string,
39
- ): string | number {
40
- return resolve_token_spec(value, variable_prefix);
41
- }
42
-
43
- function resolve_border_composite(
44
- input: BorderCompositeInput,
45
- variable_prefix: string,
46
- ): string {
47
- return [
48
- resolve_composite_value(input.width, variable_prefix),
49
- resolve_composite_value(input.style, variable_prefix),
50
- resolve_composite_value(input.color, variable_prefix),
51
- ].join(" ");
52
- }
53
-
54
- function resolve_shadow_layer(input: ShadowLayerInput, variable_prefix: string): string {
55
- return [
56
- resolve_composite_value(input.x, variable_prefix),
57
- resolve_composite_value(input.y, variable_prefix),
58
- resolve_composite_value(input.blur, variable_prefix),
59
- input.spread === undefined
60
- ? undefined
61
- : resolve_composite_value(input.spread, variable_prefix),
62
- resolve_composite_value(input.color, variable_prefix),
63
- ]
64
- .filter((value) => {
65
- return value !== undefined;
66
- })
67
- .join(" ");
68
- }
69
-
70
- function is_shadow_layer_input(input: object): input is ShadowLayerInput {
71
- return "x" in input && "y" in input && "blur" in input && "color" in input;
72
- }
73
-
74
- function resolve_shadow_composite(
75
- input: RawTokenValue | ShadowCompositeInput,
76
- variable_prefix: string,
77
- ): string | number {
78
- if (typeof input === "object" && input !== null && is_token_spec(input)) {
79
- return resolve_token_spec(input, variable_prefix);
80
- }
81
-
82
- if (typeof input === "object" && input !== null && !is_oklch(input)) {
83
- const layers = is_shadow_layer_input(input) ? [input] : input;
84
-
85
- return layers
86
- .map((layer) => {
87
- return resolve_shadow_layer(layer, variable_prefix);
88
- })
89
- .join(", ");
90
- }
91
-
92
- return resolve_raw_value(input);
93
- }
94
-
95
- function resolve_transition(input: TransitionInput, variable_prefix: string): string {
96
- return [
97
- resolve_composite_value(input.property, variable_prefix),
98
- resolve_composite_value(input.duration, variable_prefix),
99
- resolve_composite_value(input.easing, variable_prefix),
100
- input.delay === undefined
101
- ? undefined
102
- : resolve_composite_value(input.delay, variable_prefix),
103
- ]
104
- .filter((value) => {
105
- return value !== undefined;
106
- })
107
- .join(" ");
108
- }
109
-
110
- function is_transition_input(input: object): input is TransitionInput {
111
- return "property" in input && "duration" in input && "easing" in input;
112
- }
113
-
114
- function resolve_transition_composite(
115
- input: RawTokenValue | TransitionCompositeInput,
116
- variable_prefix: string,
117
- ): string | number {
118
- if (typeof input === "object" && input !== null && is_token_spec(input)) {
119
- return resolve_token_spec(input, variable_prefix);
120
- }
121
-
122
- if (typeof input === "object" && input !== null && !is_oklch(input)) {
123
- const transitions = is_transition_input(input) ? [input] : input;
124
-
125
- return transitions
126
- .map((transition) => {
127
- return resolve_transition(transition, variable_prefix);
128
- })
129
- .join(", ");
130
- }
131
-
132
- return resolve_raw_value(input);
133
- }
134
-
135
- /////////////////////////////////////////////////////////////////////
136
- /////// Scales
137
- /////////////////////////////////////////////////////////////////////
138
-
139
- function format_length(
140
- px_value: number,
141
- base_font_size_px: number,
142
- unit: "px" | "rem",
143
- ): string {
144
- if (unit === "px") {
145
- return format_px(px_value);
146
- }
147
-
148
- return format_rem(px_value, base_font_size_px);
149
- }
150
-
151
- function create_required_length_scale<TKey extends string>(
152
- input: LengthScaleInput<TKey>,
153
- ): Record<TKey, string> {
154
- return Object.fromEntries(
155
- (Object.entries(input.multiplier) as [TKey, number][]).map(
156
- ([key, multiplier]) => {
157
- return [
158
- key,
159
- format_length(
160
- input.basePx * multiplier,
161
- input.baseFontSizePx,
162
- input.unit,
163
- ),
164
- ];
165
- },
166
- ),
167
- ) as Record<TKey, string>;
168
- }
169
-
170
- function create_length_scale<TKey extends string>(
171
- input: LengthScaleInput<TKey> | undefined,
172
- ): Record<TKey, string> | undefined {
173
- if (!input) {
174
- return undefined;
175
- }
176
-
177
- return create_required_length_scale(input);
178
- }
179
-
180
- function create_modular_scale<TKey extends string>(
181
- input: ModularScaleInput<TKey> | undefined,
182
- ): Record<TKey, string> | undefined {
183
- if (!input) {
184
- return undefined;
185
- }
186
-
187
- return Object.fromEntries(
188
- (Object.entries(input.step) as [TKey, number][]).map(([key, step]) => {
189
- const px_value = input.basePx * input.ratio ** step;
190
- return [key, format_length(px_value, input.baseFontSizePx, input.unit)];
191
- }),
192
- ) as Record<TKey, string>;
193
- }
194
-
195
- /////////////////////////////////////////////////////////////////////
196
- /////// Typography
197
- /////////////////////////////////////////////////////////////////////
198
-
199
- type PrimitiveTypographyInput = {
200
- family?: Record<string, RawTokenValue>;
201
- [primitive_token_keys.letter_spacing]?: Record<string, RawTokenValue>;
202
- [primitive_token_keys.line_height]?: Record<string, RawTokenValue>;
203
- size?: ModularScaleInput;
204
- [primitive_token_keys.text_style]?: Record<string, TextStyleInput>;
205
- weight?: Record<string, RawTokenValue>;
206
- };
207
-
208
- function create_primitive_typography(
209
- input: PrimitiveTypographyInput | undefined,
210
- variable_prefix: string,
211
- ): PrimitiveTokens["typography"] | undefined {
212
- if (!input) {
213
- return undefined;
214
- }
215
-
216
- const letter_spacing = input[primitive_token_keys.letter_spacing];
217
- const line_height = input[primitive_token_keys.line_height];
218
- const text_styles = input[primitive_token_keys.text_style];
219
- const typography = compact_object({
220
- family: resolve_raw_record(input.family),
221
- [primitive_token_keys.letter_spacing]: resolve_raw_record(letter_spacing),
222
- [primitive_token_keys.line_height]: resolve_raw_record(line_height),
223
- size: create_modular_scale(input.size),
224
- weight: resolve_raw_record(input.weight),
225
- });
226
-
227
- return compact_object({
228
- ...typography,
229
- [primitive_token_keys.text_style]: text_styles
230
- ? Object.fromEntries(
231
- Object.entries(text_styles).map(([name, style]) => {
232
- const text_style = compact_object({
233
- [primitive_token_keys.font_family]:
234
- input.family && style.family in input.family
235
- ? createCSSVariableReference(variable_prefix, [
236
- token_groups.primitive,
237
- "typography",
238
- "family",
239
- style.family,
240
- ])
241
- : undefined,
242
- [primitive_token_keys.font_size]:
243
- input.size && style.size in input.size.step
244
- ? createCSSVariableReference(variable_prefix, [
245
- token_groups.primitive,
246
- "typography",
247
- "size",
248
- style.size,
249
- ])
250
- : undefined,
251
- [primitive_token_keys.font_weight]:
252
- input.weight && style.weight in input.weight
253
- ? createCSSVariableReference(variable_prefix, [
254
- token_groups.primitive,
255
- "typography",
256
- "weight",
257
- style.weight,
258
- ])
259
- : undefined,
260
- [primitive_token_keys.letter_spacing]:
261
- letter_spacing && style.letterSpacing in letter_spacing
262
- ? createCSSVariableReference(variable_prefix, [
263
- token_groups.primitive,
264
- "typography",
265
- primitive_token_keys.letter_spacing,
266
- style.letterSpacing,
267
- ])
268
- : undefined,
269
- [primitive_token_keys.line_height]:
270
- line_height && style.lineHeight in line_height
271
- ? createCSSVariableReference(variable_prefix, [
272
- token_groups.primitive,
273
- "typography",
274
- primitive_token_keys.line_height,
275
- style.lineHeight,
276
- ])
277
- : undefined,
278
- });
279
-
280
- return [name, text_style];
281
- }),
282
- )
283
- : undefined,
284
- }) as PrimitiveTokens["typography"];
285
- }
286
-
287
- /////////////////////////////////////////////////////////////////////
288
- /////// Primitive Tokens
289
- /////////////////////////////////////////////////////////////////////
290
-
291
- export function create_primitive_tokens<
292
- TModes extends NonEmptyReadonlyArray<ModeName>,
293
- TColorSource extends string,
294
- >(
295
- input: SystemInput<TModes, TColorSource>,
296
- mode: TModes[number],
297
- ): PrimitiveTokens | undefined {
298
- if (!input.primitive) {
299
- return undefined;
300
- }
301
-
302
- const variable_prefix = input.css.variablePrefix;
303
- const primitive = input.primitive;
304
- const color_input = primitive.color;
305
- const data_visualization = primitive[primitive_token_keys.data_visualization];
306
- const color = color_input
307
- ? compact_object({
308
- palette: color_input.palette
309
- ? Object.fromEntries(
310
- Object.entries(color_input.palette).map(([name, palette]) => {
311
- const source = color_input.source[palette.source]!;
312
-
313
- return [
314
- name,
315
- createPalette({
316
- chromaLimit: palette.chromaLimit,
317
- curve: palette.curve[mode],
318
- source,
319
- }),
320
- ];
321
- }),
322
- )
323
- : undefined,
324
- source: Object.fromEntries(
325
- (Object.entries(color_input.source) as [string, OKLCH][]).map(
326
- ([name, value]) => {
327
- return [name, formatOKLCH(value)];
328
- },
329
- ),
330
- ),
331
- })
332
- : undefined;
333
- const typography = create_primitive_typography(primitive.typography, variable_prefix);
334
-
335
- return compact_object({
336
- border: primitive.border
337
- ? compact_object({
338
- radius: create_length_scale(primitive.border.radius),
339
- shorthand: resolve_spec_record(
340
- primitive.border.shorthand,
341
- (value) => {
342
- return resolve_border_composite(value, variable_prefix);
343
- },
344
- ),
345
- style: resolve_raw_record(primitive.border.style),
346
- width: create_length_scale(primitive.border.width),
347
- })
348
- : undefined,
349
- color,
350
- content: primitive.content
351
- ? compact_object({
352
- [primitive_token_keys.aspect_ratio]: resolve_raw_record(
353
- primitive.content[primitive_token_keys.aspect_ratio],
354
- ),
355
- measure: resolve_raw_record(primitive.content.measure),
356
- })
357
- : undefined,
358
- [primitive_token_keys.data_visualization]: data_visualization
359
- ? compact_object({
360
- color: resolve_raw_record(data_visualization.color),
361
- shape: resolve_raw_record(data_visualization.shape),
362
- stroke: resolve_raw_record(data_visualization.stroke),
363
- })
364
- : undefined,
365
- dimension: primitive.dimension
366
- ? compact_object({
367
- [primitive_token_keys.aspect_ratio]: resolve_raw_record(
368
- primitive.dimension[primitive_token_keys.aspect_ratio],
369
- ),
370
- measure: resolve_raw_record(primitive.dimension.measure),
371
- size: primitive.dimension.size
372
- ? Object.fromEntries(
373
- Object.entries(primitive.dimension.size).map(
374
- ([name, scale]) => {
375
- return [
376
- name,
377
- create_required_length_scale(scale),
378
- ];
379
- },
380
- ),
381
- )
382
- : undefined,
383
- space: create_length_scale(primitive.dimension.space),
384
- })
385
- : undefined,
386
- effect: primitive.effect
387
- ? compact_object({
388
- blur: resolve_raw_record(primitive.effect.blur),
389
- opacity: resolve_raw_record(primitive.effect.opacity),
390
- shadow: resolve_spec_record(primitive.effect.shadow, (value) => {
391
- return resolve_shadow_composite(value, variable_prefix);
392
- }),
393
- })
394
- : undefined,
395
- focus: primitive.focus
396
- ? compact_object({
397
- ring: resolve_spec_record(primitive.focus.ring, (value) => {
398
- if (
399
- typeof value === "object" &&
400
- value !== null &&
401
- !is_oklch(value)
402
- ) {
403
- return resolve_border_composite(value, variable_prefix);
404
- }
405
-
406
- return resolve_raw_value(value);
407
- }),
408
- })
409
- : undefined,
410
- icon: primitive.icon
411
- ? compact_object({
412
- asset: resolve_raw_record(primitive.icon.asset),
413
- size: create_length_scale(primitive.icon.size),
414
- [primitive_token_keys.stroke_width]: create_length_scale(
415
- primitive.icon[primitive_token_keys.stroke_width],
416
- ),
417
- })
418
- : undefined,
419
- layout: primitive.layout
420
- ? compact_object({
421
- breakpoint: resolve_raw_record(primitive.layout.breakpoint),
422
- container: resolve_raw_record(primitive.layout.container),
423
- grid: resolve_raw_record(primitive.layout.grid),
424
- layer: resolve_raw_record(primitive.layout.layer),
425
- })
426
- : undefined,
427
- motion: primitive.motion
428
- ? compact_object({
429
- distance: resolve_raw_record(primitive.motion.distance),
430
- duration: resolve_raw_record(primitive.motion.duration),
431
- easing: resolve_raw_record(primitive.motion.easing),
432
- transition: resolve_spec_record(
433
- primitive.motion.transition,
434
- (value) => {
435
- return resolve_transition_composite(value, variable_prefix);
436
- },
437
- ),
438
- })
439
- : undefined,
440
- outline: primitive.outline
441
- ? compact_object({
442
- offset: create_length_scale(primitive.outline.offset),
443
- shorthand: resolve_spec_record(
444
- primitive.outline.shorthand,
445
- (value) => {
446
- return resolve_border_composite(value, variable_prefix);
447
- },
448
- ),
449
- style: resolve_raw_record(primitive.outline.style),
450
- width: create_length_scale(primitive.outline.width),
451
- })
452
- : undefined,
453
- typography,
454
- });
455
- }