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,303 +0,0 @@
1
- import { create_primitive_tokens } from "./create_primitive.ts";
2
- import {
3
- createTokenReferences,
4
- createTokenVariables,
5
- type TokenReferences,
6
- } from "./css.ts";
7
- import { compact_object, merge_token_shapes } from "./object.ts";
8
- import type { RecipeStyle } from "./recipe/style.ts";
9
- import type {
10
- RecipeCompoundVariantInput,
11
- RecipeConditionMap,
12
- RecipeSlotInput,
13
- RecipeSlotMapInput,
14
- RecipeVariantSlotMapInput,
15
- RecipeVariantsInput,
16
- } from "./recipe/types.ts";
17
- import { resolve_raw_record, resolve_token_tree } from "./resolve_token.ts";
18
- import {
19
- token_groups,
20
- type AnyGeneratedSystemMetadata,
21
- type GeneratedSystem,
22
- type GeneratedSystemMode,
23
- type ModeName,
24
- type NonEmptyReadonlyArray,
25
- type RecipeStyleDeclarationInput,
26
- type RecipeStyleDefinition,
27
- type RecipeStyleDefinitions,
28
- type ResolvedRecipeStyleDefinition,
29
- type ResolvedRecipeStyleDefinitions,
30
- type SystemInput,
31
- type SystemMetadataForInput,
32
- type SystemTokens,
33
- type SystemTokensForInput,
34
- } from "./types.ts";
35
-
36
- /////////////////////////////////////////////////////////////////////
37
- /////// System Compilation
38
- /////////////////////////////////////////////////////////////////////
39
-
40
- function create_tokens<
41
- TModes extends NonEmptyReadonlyArray<ModeName>,
42
- TColorSource extends string,
43
- >(input: SystemInput<TModes, TColorSource>, mode: TModes[number]): SystemTokens {
44
- return compact_object({
45
- primitive: create_primitive_tokens(input, mode),
46
- semantic: input.semantic?.[mode]
47
- ? resolve_token_tree(input.semantic[mode], input.css.variablePrefix)
48
- : undefined,
49
- });
50
- }
51
-
52
- function create_mode<
53
- TModes extends NonEmptyReadonlyArray<ModeName>,
54
- TColorSource extends string,
55
- >(input: SystemInput<TModes, TColorSource>, mode: TModes[number]): GeneratedSystemMode {
56
- const tokens = create_tokens(input, mode);
57
-
58
- return {
59
- variables: createTokenVariables(input.css.variablePrefix, tokens),
60
- };
61
- }
62
-
63
- function create_token_reference_source<
64
- TModes extends NonEmptyReadonlyArray<ModeName>,
65
- TColorSource extends string,
66
- >(input: SystemInput<TModes, TColorSource>): SystemTokens {
67
- return input.modes.reduce<unknown>((tokens, mode) => {
68
- return merge_token_shapes(tokens, create_tokens(input, mode));
69
- }, undefined) as SystemTokens;
70
- }
71
-
72
- function create_metadata<TInput extends SystemInput>(
73
- input: TInput,
74
- ): SystemMetadataForInput<TInput> {
75
- return compact_object({
76
- breakpoint: resolve_raw_record(input.primitive?.layout?.breakpoint),
77
- }) as SystemMetadataForInput<TInput>;
78
- }
79
-
80
- export type SingleRecipeStyleInput<TRecipes extends object> =
81
- keyof TRecipes extends infer TKey
82
- ? [TKey] extends [never]
83
- ? never
84
- : TKey extends keyof TRecipes
85
- ? Pick<TRecipes, TKey> &
86
- Partial<Record<Exclude<keyof TRecipes, TKey>, never>>
87
- : never
88
- : never;
89
-
90
- export function createSystem<
91
- const TModes extends NonEmptyReadonlyArray<string>,
92
- const TColorSource extends string,
93
- const TFontFamily extends string,
94
- const TLetterSpacing extends string,
95
- const TLineHeight extends string,
96
- const TFontSize extends string,
97
- const TFontWeight extends string,
98
- const TInput extends SystemInput<
99
- TModes,
100
- TColorSource,
101
- TFontFamily,
102
- TLetterSpacing,
103
- TLineHeight,
104
- TFontSize,
105
- TFontWeight
106
- >,
107
- >(
108
- input: SystemInput<
109
- TModes,
110
- TColorSource,
111
- TFontFamily,
112
- TLetterSpacing,
113
- TLineHeight,
114
- TFontSize,
115
- TFontWeight
116
- > &
117
- TInput,
118
- ): GeneratedSystem<
119
- TModes[number],
120
- TokenReferences<SystemTokensForInput<TInput>>,
121
- SystemMetadataForInput<TInput>
122
- > {
123
- const token_reference_source = create_token_reference_source(input);
124
- const generated_modes = Object.fromEntries(
125
- input.modes.map((mode) => {
126
- return [mode, create_mode(input, mode)];
127
- }),
128
- ) as Record<TModes[number], GeneratedSystemMode>;
129
-
130
- return {
131
- metadata: create_metadata(input) as SystemMetadataForInput<TInput>,
132
- modes: generated_modes,
133
- variablePrefix: input.css.variablePrefix,
134
- token: createTokenReferences(
135
- input.css.variablePrefix,
136
- token_reference_source,
137
- ) as TokenReferences<SystemTokensForInput<TInput>>,
138
- };
139
- }
140
-
141
- export type RecipeStyleReferences<TRecipes extends RecipeStyleDefinitions> = {
142
- [token_groups.recipe]: ResolvedRecipeStyleDefinitions<TRecipes>;
143
- };
144
-
145
- function resolve_recipe_style(
146
- style: RecipeStyleDeclarationInput | undefined,
147
- variable_prefix: string,
148
- ): RecipeStyle | undefined {
149
- return style
150
- ? (resolve_token_tree(style, variable_prefix) as RecipeStyle)
151
- : undefined;
152
- }
153
-
154
- function resolve_recipe_condition_map(
155
- conditions: RecipeConditionMap<string, RecipeStyleDeclarationInput> | undefined,
156
- variable_prefix: string,
157
- ): RecipeConditionMap<string, RecipeStyle> | undefined {
158
- if (!conditions) {
159
- return undefined;
160
- }
161
-
162
- return Object.fromEntries(
163
- Object.entries(conditions).map(([condition_name, style]) => {
164
- return [condition_name, resolve_recipe_style(style, variable_prefix)];
165
- }),
166
- ) as RecipeConditionMap<string, RecipeStyle>;
167
- }
168
-
169
- function resolve_recipe_slot_input(
170
- slot: RecipeSlotInput<string, RecipeStyleDeclarationInput>,
171
- variable_prefix: string,
172
- ): RecipeSlotInput<string, RecipeStyle> {
173
- return compact_object({
174
- base: resolve_recipe_style(slot.base, variable_prefix),
175
- conditions: resolve_recipe_condition_map(slot.conditions, variable_prefix),
176
- });
177
- }
178
-
179
- function resolve_recipe_slot_map(
180
- slots:
181
- | RecipeSlotMapInput<string, string, RecipeStyleDeclarationInput>
182
- | RecipeVariantSlotMapInput<string, string, RecipeStyleDeclarationInput>,
183
- variable_prefix: string,
184
- ): RecipeSlotMapInput<string, string, RecipeStyle> {
185
- return Object.fromEntries(
186
- Object.entries(slots).flatMap(([slot_name, slot]) => {
187
- if (!slot) {
188
- return [];
189
- }
190
-
191
- return [[slot_name, resolve_recipe_slot_input(slot, variable_prefix)]];
192
- }),
193
- ) as RecipeSlotMapInput<string, string, RecipeStyle>;
194
- }
195
-
196
- function resolve_recipe_variants(
197
- variants:
198
- | RecipeVariantsInput<string, string, RecipeStyleDeclarationInput>
199
- | undefined,
200
- variable_prefix: string,
201
- ): RecipeVariantsInput<string, string, RecipeStyle> | undefined {
202
- if (!variants) {
203
- return undefined;
204
- }
205
-
206
- return Object.fromEntries(
207
- Object.entries(variants).map(([variant_name, variant_group]) => {
208
- return [
209
- variant_name,
210
- Object.fromEntries(
211
- Object.entries(variant_group).map(([variant_value, slots]) => {
212
- return [
213
- variant_value,
214
- resolve_recipe_slot_map(slots, variable_prefix),
215
- ];
216
- }),
217
- ),
218
- ];
219
- }),
220
- ) as RecipeVariantsInput<string, string, RecipeStyle>;
221
- }
222
-
223
- function resolve_recipe_compound_variants(
224
- compound_variants:
225
- | readonly RecipeCompoundVariantInput<
226
- string,
227
- string,
228
- RecipeStyleDeclarationInput
229
- >[]
230
- | undefined,
231
- variable_prefix: string,
232
- ): readonly RecipeCompoundVariantInput<string, string, RecipeStyle>[] | undefined {
233
- return compound_variants?.map((compound_variant) => {
234
- return {
235
- slots: resolve_recipe_slot_map(compound_variant.slots, variable_prefix),
236
- variants: compound_variant.variants,
237
- };
238
- });
239
- }
240
-
241
- function resolve_recipe_definition<TDefinition extends RecipeStyleDefinition>(
242
- definition: TDefinition,
243
- variable_prefix: string,
244
- ): ResolvedRecipeStyleDefinition<TDefinition> {
245
- return compact_object({
246
- compoundVariants: resolve_recipe_compound_variants(
247
- definition.compoundVariants,
248
- variable_prefix,
249
- ),
250
- defaultVariants: definition.defaultVariants,
251
- slots: resolve_recipe_slot_map(definition.slots, variable_prefix),
252
- variants: resolve_recipe_variants(definition.variants, variable_prefix),
253
- }) as unknown as ResolvedRecipeStyleDefinition<TDefinition>;
254
- }
255
-
256
- function resolve_recipe_definitions<TRecipes extends RecipeStyleDefinitions>(
257
- recipes: TRecipes,
258
- variable_prefix: string,
259
- ): ResolvedRecipeStyleDefinitions<TRecipes> {
260
- return Object.fromEntries(
261
- Object.entries(recipes).map(([recipe_name, definition]) => {
262
- return [recipe_name, resolve_recipe_definition(definition, variable_prefix)];
263
- }),
264
- ) as ResolvedRecipeStyleDefinitions<TRecipes>;
265
- }
266
-
267
- export function createRecipeStyleSystem<
268
- const TSystem extends GeneratedSystem<string, unknown, AnyGeneratedSystemMetadata>,
269
- const TRecipes extends RecipeStyleDefinitions,
270
- >(
271
- system: TSystem,
272
- recipes: TRecipes & SingleRecipeStyleInput<TRecipes>,
273
- ): GeneratedSystem<
274
- TSystem extends GeneratedSystem<infer TMode, unknown, AnyGeneratedSystemMetadata>
275
- ? TMode
276
- : never,
277
- RecipeStyleReferences<TRecipes>,
278
- TSystem extends GeneratedSystem<string, unknown, infer TMetadata>
279
- ? TMetadata
280
- : AnyGeneratedSystemMetadata
281
- > {
282
- const tokens = {
283
- [token_groups.recipe]: resolve_recipe_definitions(recipes, system.variablePrefix),
284
- } as RecipeStyleReferences<TRecipes>;
285
- const generated_modes = Object.fromEntries(
286
- Object.keys(system.modes).map((mode) => {
287
- return [mode, { variables: {} }];
288
- }),
289
- ) as TSystem["modes"];
290
-
291
- return {
292
- metadata: system.metadata as TSystem extends GeneratedSystem<
293
- string,
294
- unknown,
295
- infer TMetadata
296
- >
297
- ? TMetadata
298
- : AnyGeneratedSystemMetadata,
299
- modes: generated_modes,
300
- variablePrefix: system.variablePrefix,
301
- token: tokens,
302
- };
303
- }
@@ -1,127 +0,0 @@
1
- export type CSSVariableName = `--${string}`;
2
- export type CSSVariableMap = Record<CSSVariableName, string | number>;
3
- export type TokenPrimitive = string | number;
4
-
5
- export type TokenReferences<T> = T extends TokenPrimitive
6
- ? string
7
- : {
8
- readonly [K in keyof T]: TokenReferences<T[K]>;
9
- };
10
-
11
- const css_variable_segment_pattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
12
-
13
- /////////////////////////////////////////////////////////////////////
14
- /////// CSS Variable Contract
15
- /////////////////////////////////////////////////////////////////////
16
-
17
- // Token path segments are already contract strings, so we validate them instead of rewriting them.
18
- function assert_css_variable_segment(segment: string, label: string): void {
19
- if (css_variable_segment_pattern.test(segment)) {
20
- return;
21
- }
22
-
23
- throw new Error(
24
- `Invalid CSS variable ${label} "${segment}". Use lowercase ASCII letters and digits separated by single hyphens.`,
25
- );
26
- }
27
-
28
- export function createCSSVariableName(
29
- variablePrefix: string,
30
- path: readonly string[],
31
- ): CSSVariableName {
32
- assert_css_variable_segment(variablePrefix, "prefix");
33
-
34
- for (const segment of path) {
35
- assert_css_variable_segment(segment, "path segment");
36
- }
37
-
38
- return `--${[variablePrefix, ...path].join("-")}` as CSSVariableName;
39
- }
40
-
41
- export function createCSSVariableReference(
42
- variablePrefix: string,
43
- path: readonly string[],
44
- ): string {
45
- return `var(${createCSSVariableName(variablePrefix, path)})`;
46
- }
47
-
48
- function is_token_primitive(value: unknown): value is TokenPrimitive {
49
- return typeof value === "string" || typeof value === "number";
50
- }
51
-
52
- function read_token_object(value: unknown): Record<string, unknown> {
53
- return value as Record<string, unknown>;
54
- }
55
-
56
- function create_token_variables_from_unknown(
57
- variable_prefix: string,
58
- tokens: unknown,
59
- path: readonly string[] = [],
60
- ): CSSVariableMap {
61
- const variables: CSSVariableMap = {};
62
-
63
- if (is_token_primitive(tokens)) {
64
- variables[createCSSVariableName(variable_prefix, path)] = tokens;
65
- return variables;
66
- }
67
-
68
- for (const [key, value] of Object.entries(read_token_object(tokens))) {
69
- Object.assign(
70
- variables,
71
- create_token_variables_from_unknown(variable_prefix, value, [...path, key]),
72
- );
73
- }
74
-
75
- return variables;
76
- }
77
-
78
- export function createTokenVariables<T extends object>(
79
- variablePrefix: string,
80
- tokens: T,
81
- ): CSSVariableMap {
82
- return create_token_variables_from_unknown(variablePrefix, tokens);
83
- }
84
-
85
- function create_token_references_from_unknown(
86
- variable_prefix: string,
87
- tokens: unknown,
88
- path: readonly string[] = [],
89
- ): unknown {
90
- if (is_token_primitive(tokens)) {
91
- return createCSSVariableReference(variable_prefix, path);
92
- }
93
-
94
- const references: Record<string, unknown> = Object.fromEntries(
95
- Object.entries(read_token_object(tokens)).map(([key, value]) => {
96
- return [
97
- key,
98
- create_token_references_from_unknown(variable_prefix, value, [
99
- ...path,
100
- key,
101
- ]),
102
- ];
103
- }),
104
- );
105
-
106
- return references;
107
- }
108
-
109
- export function createTokenReferences<T extends object>(
110
- variablePrefix: string,
111
- tokens: T,
112
- ): TokenReferences<T> {
113
- return create_token_references_from_unknown(
114
- variablePrefix,
115
- tokens,
116
- ) as TokenReferences<T>;
117
- }
118
-
119
- export function renderCSSVariables(selector: string, variables: CSSVariableMap): string {
120
- const declarations = Object.entries(variables)
121
- .map(([property, value]) => {
122
- return `\t${property}: ${value};`;
123
- })
124
- .join("\n");
125
-
126
- return `${selector} {\n${declarations}\n}`;
127
- }