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.
- package/.dist/core/_index.d.ts +1 -0
- package/.dist/core/_index.d.ts.map +1 -1
- package/.dist/core/_index.js +6 -0
- package/.dist/core/_index.js.map +1 -1
- package/.dist/core/vorma_client_wasm_bg.wasm +0 -0
- package/.dist/ui/solid/solid.js +29 -39
- package/.dist/ui/solid/solid.js.map +1 -1
- package/core/client_wasm/vorma_client_wasm_bg.wasm +0 -0
- package/core/create_client_core.ts +9 -1
- package/package.json +1 -16
- package/ui/solid/solid.tsx +29 -10
- package/.dist/kit/lab/design/components/remix/remix.d.ts +0 -2309
- package/.dist/kit/lab/design/components/remix/remix.d.ts.map +0 -1
- package/.dist/kit/lab/design/components/remix/remix.js +0 -7022
- package/.dist/kit/lab/design/components/remix/remix.js.map +0 -1
- package/.dist/kit/lab/design/core/core.d.ts +0 -527
- package/.dist/kit/lab/design/core/core.d.ts.map +0 -1
- package/.dist/kit/lab/design/core/core.js +0 -668
- package/.dist/kit/lab/design/core/core.js.map +0 -1
- package/.dist/kit/matcher/matcher.d.ts +0 -78
- package/.dist/kit/matcher/matcher.d.ts.map +0 -1
- package/.dist/kit/matcher/matcher.js +0 -517
- package/.dist/kit/matcher/matcher.js.map +0 -1
- package/.dist/ui/remix/remix.d.ts +0 -73
- package/.dist/ui/remix/remix.d.ts.map +0 -1
- package/.dist/ui/remix/remix.js +0 -409
- package/.dist/ui/remix/remix.js.map +0 -1
- package/kit/lab/design/components/remix/accordion.ts +0 -474
- package/kit/lab/design/components/remix/alert-dialog.ts +0 -512
- package/kit/lab/design/components/remix/alert.ts +0 -213
- package/kit/lab/design/components/remix/aspect-ratio.ts +0 -111
- package/kit/lab/design/components/remix/badge.ts +0 -59
- package/kit/lab/design/components/remix/box.ts +0 -49
- package/kit/lab/design/components/remix/button.ts +0 -314
- package/kit/lab/design/components/remix/callout.ts +0 -127
- package/kit/lab/design/components/remix/checkable-state.ts +0 -187
- package/kit/lab/design/components/remix/checkbox-group.ts +0 -443
- package/kit/lab/design/components/remix/checkbox.ts +0 -215
- package/kit/lab/design/components/remix/chip.ts +0 -165
- package/kit/lab/design/components/remix/code-block.ts +0 -181
- package/kit/lab/design/components/remix/collapsible.ts +0 -325
- package/kit/lab/design/components/remix/component-state.ts +0 -55
- package/kit/lab/design/components/remix/component-style.ts +0 -364
- package/kit/lab/design/components/remix/composite-navigation.ts +0 -71
- package/kit/lab/design/components/remix/conditions.ts +0 -25
- package/kit/lab/design/components/remix/controllable-state.ts +0 -58
- package/kit/lab/design/components/remix/description-list.ts +0 -275
- package/kit/lab/design/components/remix/dialog.ts +0 -653
- package/kit/lab/design/components/remix/empty-state.ts +0 -146
- package/kit/lab/design/components/remix/field.ts +0 -418
- package/kit/lab/design/components/remix/fieldset.ts +0 -153
- package/kit/lab/design/components/remix/form-mirror.ts +0 -94
- package/kit/lab/design/components/remix/form-reset.ts +0 -85
- package/kit/lab/design/components/remix/form.ts +0 -109
- package/kit/lab/design/components/remix/grid.ts +0 -187
- package/kit/lab/design/components/remix/group-label.ts +0 -47
- package/kit/lab/design/components/remix/icon.ts +0 -176
- package/kit/lab/design/components/remix/input.ts +0 -163
- package/kit/lab/design/components/remix/kbd.ts +0 -58
- package/kit/lab/design/components/remix/list.ts +0 -120
- package/kit/lab/design/components/remix/listbox.ts +0 -1116
- package/kit/lab/design/components/remix/menu.ts +0 -1477
- package/kit/lab/design/components/remix/ordered-collection.ts +0 -95
- package/kit/lab/design/components/remix/popover-scroll-lock.ts +0 -89
- package/kit/lab/design/components/remix/popover.ts +0 -576
- package/kit/lab/design/components/remix/popup-behavior.ts +0 -96
- package/kit/lab/design/components/remix/progress.ts +0 -185
- package/kit/lab/design/components/remix/radio-group.ts +0 -420
- package/kit/lab/design/components/remix/recipe.ts +0 -70
- package/kit/lab/design/components/remix/remix.ts +0 -683
- package/kit/lab/design/components/remix/responsive.ts +0 -106
- package/kit/lab/design/components/remix/root.ts +0 -137
- package/kit/lab/design/components/remix/select.ts +0 -1546
- package/kit/lab/design/components/remix/separator.ts +0 -108
- package/kit/lab/design/components/remix/slider.ts +0 -308
- package/kit/lab/design/components/remix/spinner.ts +0 -114
- package/kit/lab/design/components/remix/stack.ts +0 -205
- package/kit/lab/design/components/remix/stat.ts +0 -127
- package/kit/lab/design/components/remix/surface.ts +0 -71
- package/kit/lab/design/components/remix/switch.ts +0 -219
- package/kit/lab/design/components/remix/table.ts +0 -395
- package/kit/lab/design/components/remix/tabs.ts +0 -404
- package/kit/lab/design/components/remix/text.ts +0 -169
- package/kit/lab/design/components/remix/textarea.ts +0 -164
- package/kit/lab/design/components/remix/toast.ts +0 -299
- package/kit/lab/design/components/remix/tooltip.ts +0 -330
- package/kit/lab/design/components/remix/typeahead.ts +0 -81
- package/kit/lab/design/components/remix/types.ts +0 -19
- package/kit/lab/design/components/remix/visually-hidden.ts +0 -100
- package/kit/lab/design/core/color.ts +0 -46
- package/kit/lab/design/core/core.ts +0 -111
- package/kit/lab/design/core/create_primitive.ts +0 -455
- package/kit/lab/design/core/create_system.ts +0 -303
- package/kit/lab/design/core/css.ts +0 -127
- package/kit/lab/design/core/define_system.ts +0 -508
- package/kit/lab/design/core/math.ts +0 -12
- package/kit/lab/design/core/object.ts +0 -31
- package/kit/lab/design/core/recipe/create_recipe.ts +0 -185
- package/kit/lab/design/core/recipe/recipe.ts +0 -26
- package/kit/lab/design/core/recipe/style.ts +0 -62
- package/kit/lab/design/core/recipe/types.ts +0 -160
- package/kit/lab/design/core/resolve_token.ts +0 -118
- package/kit/lab/design/core/types.ts +0 -636
- package/ui/remix/remix.tsx +0 -901
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { createElement, type Props, type RemixNode } from "remix/ui";
|
|
2
|
-
import {
|
|
3
|
-
createRecipe,
|
|
4
|
-
type AnyGeneratedSystemMetadata,
|
|
5
|
-
type RecipeWithVariantGroups,
|
|
6
|
-
} from "../../core/core.ts";
|
|
7
|
-
import {
|
|
8
|
-
createComponentAnatomyAttrs,
|
|
9
|
-
createComponentSlotProps,
|
|
10
|
-
createComponentStyleTargets,
|
|
11
|
-
} from "./component-style.ts";
|
|
12
|
-
import { commonConditions } from "./conditions.ts";
|
|
13
|
-
import type { ComponentStyle, ComponentStyleSystem, RemixComponent } from "./types.ts";
|
|
14
|
-
|
|
15
|
-
export const separatorDecorativeRole = "presentation";
|
|
16
|
-
export const separatorHiddenAttribute = "aria-hidden";
|
|
17
|
-
export const separatorOrientation = {
|
|
18
|
-
horizontal: "horizontal",
|
|
19
|
-
vertical: "vertical",
|
|
20
|
-
} as const;
|
|
21
|
-
export const separatorOrientationAttribute = "data-orientation";
|
|
22
|
-
export const separatorRole = "separator";
|
|
23
|
-
|
|
24
|
-
export type SeparatorOrientation =
|
|
25
|
-
(typeof separatorOrientation)[keyof typeof separatorOrientation];
|
|
26
|
-
|
|
27
|
-
export type SeparatorRecipeInput = RecipeWithVariantGroups<
|
|
28
|
-
"root",
|
|
29
|
-
string,
|
|
30
|
-
ComponentStyle,
|
|
31
|
-
Record<never, string>
|
|
32
|
-
>;
|
|
33
|
-
|
|
34
|
-
export type SeparatorStyleSystem<
|
|
35
|
-
TMode extends string = string,
|
|
36
|
-
TRecipe extends SeparatorRecipeInput = SeparatorRecipeInput,
|
|
37
|
-
TMetadata extends AnyGeneratedSystemMetadata = AnyGeneratedSystemMetadata,
|
|
38
|
-
> = ComponentStyleSystem<
|
|
39
|
-
TMode,
|
|
40
|
-
{
|
|
41
|
-
recipe: {
|
|
42
|
-
separator: TRecipe;
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
TMetadata
|
|
46
|
-
>;
|
|
47
|
-
|
|
48
|
-
export type SeparatorProps = Omit<
|
|
49
|
-
Props<"div">,
|
|
50
|
-
"children" | "role" | "style" | "tabIndex"
|
|
51
|
-
> & {
|
|
52
|
-
children?: never;
|
|
53
|
-
decorative?: boolean;
|
|
54
|
-
orientation?: SeparatorOrientation;
|
|
55
|
-
style?: never;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const separator_scope = "separator";
|
|
59
|
-
|
|
60
|
-
export function createSeparator<
|
|
61
|
-
TMode extends string,
|
|
62
|
-
TRecipe extends SeparatorRecipeInput,
|
|
63
|
-
TMetadata extends AnyGeneratedSystemMetadata,
|
|
64
|
-
>(
|
|
65
|
-
style_system: SeparatorStyleSystem<TMode, TRecipe, TMetadata>,
|
|
66
|
-
): RemixComponent<SeparatorProps> {
|
|
67
|
-
const recipe = createRecipe(style_system.token.recipe.separator);
|
|
68
|
-
|
|
69
|
-
return () => {
|
|
70
|
-
return (props: SeparatorProps): RemixNode => {
|
|
71
|
-
const {
|
|
72
|
-
decorative = false,
|
|
73
|
-
mix,
|
|
74
|
-
orientation = separatorOrientation.horizontal,
|
|
75
|
-
...host_props
|
|
76
|
-
} = props;
|
|
77
|
-
const resolved = recipe.resolve();
|
|
78
|
-
const parts = createComponentStyleTargets({
|
|
79
|
-
targets: {
|
|
80
|
-
root: {
|
|
81
|
-
host: "root",
|
|
82
|
-
conditions: commonConditions,
|
|
83
|
-
resolveSlot: () => {
|
|
84
|
-
return resolved.slots.root;
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
props: {},
|
|
89
|
-
styleSystem: style_system,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return createElement(
|
|
93
|
-
"div",
|
|
94
|
-
createComponentSlotProps({
|
|
95
|
-
attrs: createComponentAnatomyAttrs(separator_scope, "root"),
|
|
96
|
-
mix: parts.hosts.root.mix,
|
|
97
|
-
props: {
|
|
98
|
-
...host_props,
|
|
99
|
-
[separatorHiddenAttribute]: decorative ? "true" : undefined,
|
|
100
|
-
[separatorOrientationAttribute]: orientation,
|
|
101
|
-
mix,
|
|
102
|
-
role: decorative ? separatorDecorativeRole : separatorRole,
|
|
103
|
-
},
|
|
104
|
-
}),
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
}
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createElement,
|
|
3
|
-
createMixin,
|
|
4
|
-
type ElementProps,
|
|
5
|
-
type Props,
|
|
6
|
-
type RemixNode,
|
|
7
|
-
} from "remix/ui";
|
|
8
|
-
import {
|
|
9
|
-
createRecipe,
|
|
10
|
-
type AnyGeneratedSystemMetadata,
|
|
11
|
-
type RecipeVariantPropsFor,
|
|
12
|
-
type RecipeVariantValue,
|
|
13
|
-
type RecipeWithVariantGroups,
|
|
14
|
-
} from "../../core/core.ts";
|
|
15
|
-
import {
|
|
16
|
-
createComponentAnatomyAttrs,
|
|
17
|
-
createComponentSlotProps,
|
|
18
|
-
createComponentStyleTargets,
|
|
19
|
-
} from "./component-style.ts";
|
|
20
|
-
import { type RecipeConditionSelectorMap } from "./recipe.ts";
|
|
21
|
-
import { type BreakpointForStyleSystem, type ResponsiveProps } from "./responsive.ts";
|
|
22
|
-
import type { ComponentStyle, ComponentStyleSystem, RemixComponent } from "./types.ts";
|
|
23
|
-
|
|
24
|
-
export type SliderRecipeCondition = "disabled" | "focusVisible";
|
|
25
|
-
|
|
26
|
-
const slider_slot = {
|
|
27
|
-
progress: "progress",
|
|
28
|
-
root: "root",
|
|
29
|
-
thumb: "thumb",
|
|
30
|
-
track: "track",
|
|
31
|
-
} as const;
|
|
32
|
-
|
|
33
|
-
export type SliderRecipeSlot = (typeof slider_slot)[keyof typeof slider_slot];
|
|
34
|
-
|
|
35
|
-
export type SliderStyleTarget =
|
|
36
|
-
| SliderRecipeSlot
|
|
37
|
-
| "thumbMoz"
|
|
38
|
-
| "thumbWebkit"
|
|
39
|
-
| "trackMoz"
|
|
40
|
-
| "trackWebkit";
|
|
41
|
-
|
|
42
|
-
export type SliderTargetStyles = Partial<
|
|
43
|
-
Readonly<Record<SliderStyleTarget, ComponentStyle>>
|
|
44
|
-
>;
|
|
45
|
-
|
|
46
|
-
type SliderHost = "root";
|
|
47
|
-
|
|
48
|
-
export type SliderRecipeInput<TLayout extends string = string> = RecipeWithVariantGroups<
|
|
49
|
-
SliderRecipeSlot,
|
|
50
|
-
string,
|
|
51
|
-
ComponentStyle,
|
|
52
|
-
{
|
|
53
|
-
layout: TLayout;
|
|
54
|
-
}
|
|
55
|
-
>;
|
|
56
|
-
|
|
57
|
-
export type SliderRecipeLayout<TRecipe extends SliderRecipeInput> = RecipeVariantValue<
|
|
58
|
-
TRecipe,
|
|
59
|
-
"layout"
|
|
60
|
-
>;
|
|
61
|
-
export type SliderRecipeSelection<TRecipe extends SliderRecipeInput> =
|
|
62
|
-
RecipeVariantPropsFor<TRecipe, "layout">;
|
|
63
|
-
|
|
64
|
-
export type SliderStyleSystem<
|
|
65
|
-
TMode extends string = string,
|
|
66
|
-
TRecipe extends SliderRecipeInput = SliderRecipeInput,
|
|
67
|
-
TMetadata extends AnyGeneratedSystemMetadata = AnyGeneratedSystemMetadata,
|
|
68
|
-
> = ComponentStyleSystem<TMode, { recipe: { slider: TRecipe } }, TMetadata>;
|
|
69
|
-
|
|
70
|
-
export type SliderStyleProps<TLayout extends string = string> = {
|
|
71
|
-
layout?: TLayout;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export type SliderProps<
|
|
75
|
-
TLayout extends string = string,
|
|
76
|
-
TBreakpoint extends string = string,
|
|
77
|
-
> = Omit<Props<"input">, "style" | "type"> &
|
|
78
|
-
SliderStyleProps<TLayout> &
|
|
79
|
-
ResponsiveProps<SliderStyleProps<TLayout>, TBreakpoint> & {
|
|
80
|
-
style?: never;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export type SliderOptions = {
|
|
84
|
-
progressVariable?: string;
|
|
85
|
-
targetStyles?: SliderTargetStyles;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const input_conditions = {
|
|
89
|
-
disabled: "&:disabled",
|
|
90
|
-
focusVisible: "&:focus-visible",
|
|
91
|
-
} as const satisfies RecipeConditionSelectorMap<SliderRecipeCondition>;
|
|
92
|
-
|
|
93
|
-
const slider_scope = "slider";
|
|
94
|
-
export const sliderProgressVariable = "--vorma-slider-progress";
|
|
95
|
-
const slider_progress_selectors = ["&::-moz-range-progress"] as const;
|
|
96
|
-
const slider_thumb_selectors = [
|
|
97
|
-
"&::-webkit-slider-thumb",
|
|
98
|
-
"&::-moz-range-thumb",
|
|
99
|
-
] as const;
|
|
100
|
-
const slider_thumb_moz_selectors = ["&::-moz-range-thumb"] as const;
|
|
101
|
-
const slider_thumb_webkit_selectors = ["&::-webkit-slider-thumb"] as const;
|
|
102
|
-
const slider_track_selectors = [
|
|
103
|
-
"&::-webkit-slider-runnable-track",
|
|
104
|
-
"&::-moz-range-track",
|
|
105
|
-
] as const;
|
|
106
|
-
const slider_track_moz_selectors = ["&::-moz-range-track"] as const;
|
|
107
|
-
const slider_track_webkit_selectors = ["&::-webkit-slider-runnable-track"] as const;
|
|
108
|
-
const slider_empty_slot = {
|
|
109
|
-
base: {},
|
|
110
|
-
conditions: {},
|
|
111
|
-
} as const;
|
|
112
|
-
|
|
113
|
-
function read_range_number(value: string, fallback: number): number {
|
|
114
|
-
const numeric_value = Number(value);
|
|
115
|
-
if (Number.isFinite(numeric_value)) {
|
|
116
|
-
return numeric_value;
|
|
117
|
-
}
|
|
118
|
-
return fallback;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function update_slider_progress(node: HTMLInputElement, progress_variable: string): void {
|
|
122
|
-
const min = read_range_number(node.min, 0);
|
|
123
|
-
const max = read_range_number(node.max, 100);
|
|
124
|
-
const fallback_value = min + (max - min) / 2;
|
|
125
|
-
const value = read_range_number(node.value, fallback_value);
|
|
126
|
-
const raw_progress = max <= min ? 0 : ((value - min) / (max - min)) * 100;
|
|
127
|
-
const progress = Math.min(100, Math.max(0, raw_progress));
|
|
128
|
-
|
|
129
|
-
node.style.setProperty(progress_variable, `${progress.toFixed(4)}%`);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const slider_progress_mixin = createMixin<
|
|
133
|
-
HTMLInputElement,
|
|
134
|
-
[progressVariable: string],
|
|
135
|
-
ElementProps
|
|
136
|
-
>((handle) => {
|
|
137
|
-
let current_node: HTMLInputElement | undefined;
|
|
138
|
-
let current_progress_variable = sliderProgressVariable;
|
|
139
|
-
|
|
140
|
-
function handle_input(event: Event): void {
|
|
141
|
-
update_slider_progress(
|
|
142
|
-
event.currentTarget as HTMLInputElement,
|
|
143
|
-
current_progress_variable,
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
handle.addEventListener("insert", (event) => {
|
|
148
|
-
current_node = event.node;
|
|
149
|
-
current_node.addEventListener("input", handle_input);
|
|
150
|
-
update_slider_progress(current_node, current_progress_variable);
|
|
151
|
-
});
|
|
152
|
-
handle.addEventListener("commit", (event) => {
|
|
153
|
-
update_slider_progress(event.node, current_progress_variable);
|
|
154
|
-
});
|
|
155
|
-
handle.addEventListener("remove", () => {
|
|
156
|
-
current_node?.removeEventListener("input", handle_input);
|
|
157
|
-
current_node = undefined;
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
return (progress_variable) => {
|
|
161
|
-
current_progress_variable = progress_variable;
|
|
162
|
-
if (current_node) {
|
|
163
|
-
update_slider_progress(current_node, current_progress_variable);
|
|
164
|
-
}
|
|
165
|
-
return handle.element;
|
|
166
|
-
};
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
export function createSlider<
|
|
170
|
-
TMode extends string,
|
|
171
|
-
TRecipe extends SliderRecipeInput,
|
|
172
|
-
TMetadata extends AnyGeneratedSystemMetadata,
|
|
173
|
-
>(
|
|
174
|
-
style_system: SliderStyleSystem<TMode, TRecipe, TMetadata>,
|
|
175
|
-
options: SliderOptions = {},
|
|
176
|
-
): RemixComponent<
|
|
177
|
-
SliderProps<
|
|
178
|
-
SliderRecipeLayout<TRecipe>,
|
|
179
|
-
BreakpointForStyleSystem<typeof style_system>
|
|
180
|
-
>
|
|
181
|
-
> {
|
|
182
|
-
type TLayout = SliderRecipeLayout<TRecipe>;
|
|
183
|
-
type TBreakpoint = BreakpointForStyleSystem<typeof style_system>;
|
|
184
|
-
const slider_recipe = createRecipe(style_system.token.recipe.slider);
|
|
185
|
-
|
|
186
|
-
function resolve_slot(
|
|
187
|
-
slot: SliderRecipeSlot,
|
|
188
|
-
props: Partial<SliderStyleProps<TLayout>>,
|
|
189
|
-
): ReturnType<typeof slider_recipe.resolve>["slots"][SliderRecipeSlot] {
|
|
190
|
-
return slider_recipe.resolve({
|
|
191
|
-
layout: props.layout,
|
|
192
|
-
} satisfies SliderRecipeSelection<TRecipe>).slots[slot];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return () => {
|
|
196
|
-
return (props: SliderProps<TLayout, TBreakpoint>): RemixNode => {
|
|
197
|
-
const { at, layout, mix, ...input_props } = props;
|
|
198
|
-
const progress_variable = options.progressVariable ?? sliderProgressVariable;
|
|
199
|
-
const style_props = { layout };
|
|
200
|
-
const targets = createComponentStyleTargets({
|
|
201
|
-
at,
|
|
202
|
-
hostElements: {
|
|
203
|
-
root: "input",
|
|
204
|
-
},
|
|
205
|
-
targets: {
|
|
206
|
-
root: {
|
|
207
|
-
conditions: input_conditions,
|
|
208
|
-
host: "root",
|
|
209
|
-
resolveSlot: (current_style_props) => {
|
|
210
|
-
return resolve_slot("root", current_style_props);
|
|
211
|
-
},
|
|
212
|
-
style: options.targetStyles?.root,
|
|
213
|
-
},
|
|
214
|
-
progress: {
|
|
215
|
-
conditions: input_conditions,
|
|
216
|
-
host: "root",
|
|
217
|
-
resolveSlot: (current_style_props) => {
|
|
218
|
-
return resolve_slot("progress", current_style_props);
|
|
219
|
-
},
|
|
220
|
-
selectors: slider_progress_selectors,
|
|
221
|
-
style: options.targetStyles?.progress,
|
|
222
|
-
},
|
|
223
|
-
thumb: {
|
|
224
|
-
conditions: input_conditions,
|
|
225
|
-
host: "root",
|
|
226
|
-
resolveSlot: (current_style_props) => {
|
|
227
|
-
return resolve_slot("thumb", current_style_props);
|
|
228
|
-
},
|
|
229
|
-
selectors: slider_thumb_selectors,
|
|
230
|
-
style: options.targetStyles?.thumb,
|
|
231
|
-
},
|
|
232
|
-
thumbMoz: {
|
|
233
|
-
host: "root",
|
|
234
|
-
resolveSlot: () => {
|
|
235
|
-
return slider_empty_slot;
|
|
236
|
-
},
|
|
237
|
-
selectors: slider_thumb_moz_selectors,
|
|
238
|
-
style: options.targetStyles?.thumbMoz,
|
|
239
|
-
},
|
|
240
|
-
thumbWebkit: {
|
|
241
|
-
host: "root",
|
|
242
|
-
resolveSlot: () => {
|
|
243
|
-
return slider_empty_slot;
|
|
244
|
-
},
|
|
245
|
-
selectors: slider_thumb_webkit_selectors,
|
|
246
|
-
style: options.targetStyles?.thumbWebkit,
|
|
247
|
-
},
|
|
248
|
-
track: {
|
|
249
|
-
conditions: input_conditions,
|
|
250
|
-
host: "root",
|
|
251
|
-
resolveSlot: (current_style_props) => {
|
|
252
|
-
return resolve_slot("track", current_style_props);
|
|
253
|
-
},
|
|
254
|
-
selectors: slider_track_selectors,
|
|
255
|
-
style: options.targetStyles?.track,
|
|
256
|
-
},
|
|
257
|
-
trackMoz: {
|
|
258
|
-
host: "root",
|
|
259
|
-
resolveSlot: () => {
|
|
260
|
-
return slider_empty_slot;
|
|
261
|
-
},
|
|
262
|
-
selectors: slider_track_moz_selectors,
|
|
263
|
-
style: options.targetStyles?.trackMoz,
|
|
264
|
-
},
|
|
265
|
-
trackWebkit: {
|
|
266
|
-
host: "root",
|
|
267
|
-
resolveSlot: () => {
|
|
268
|
-
return slider_empty_slot;
|
|
269
|
-
},
|
|
270
|
-
selectors: slider_track_webkit_selectors,
|
|
271
|
-
style: options.targetStyles?.trackWebkit,
|
|
272
|
-
},
|
|
273
|
-
} satisfies Record<
|
|
274
|
-
SliderStyleTarget,
|
|
275
|
-
{
|
|
276
|
-
conditions?: RecipeConditionSelectorMap<SliderRecipeCondition>;
|
|
277
|
-
host: SliderHost;
|
|
278
|
-
resolveSlot: (
|
|
279
|
-
props: Partial<SliderStyleProps<TLayout>>,
|
|
280
|
-
) => ReturnType<
|
|
281
|
-
typeof slider_recipe.resolve
|
|
282
|
-
>["slots"][SliderRecipeSlot];
|
|
283
|
-
selectors?: readonly string[];
|
|
284
|
-
style?: ComponentStyle;
|
|
285
|
-
}
|
|
286
|
-
>,
|
|
287
|
-
props: style_props,
|
|
288
|
-
styleSystem: style_system,
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
return createElement(
|
|
292
|
-
"input",
|
|
293
|
-
createComponentSlotProps({
|
|
294
|
-
attrs: createComponentAnatomyAttrs(slider_scope, "root"),
|
|
295
|
-
mix: [
|
|
296
|
-
slider_progress_mixin(progress_variable),
|
|
297
|
-
targets.hosts.root.mix,
|
|
298
|
-
],
|
|
299
|
-
props: {
|
|
300
|
-
...input_props,
|
|
301
|
-
mix,
|
|
302
|
-
type: "range",
|
|
303
|
-
},
|
|
304
|
-
}),
|
|
305
|
-
);
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { createElement, type Props, type RemixNode } from "remix/ui";
|
|
2
|
-
import {
|
|
3
|
-
createRecipe,
|
|
4
|
-
type AnyGeneratedSystemMetadata,
|
|
5
|
-
type RecipeVariantPropsFor,
|
|
6
|
-
type RecipeVariantValue,
|
|
7
|
-
type RecipeWithVariantGroups,
|
|
8
|
-
} from "../../core/core.ts";
|
|
9
|
-
import {
|
|
10
|
-
createComponentAnatomyAttrs,
|
|
11
|
-
createComponentSlotProps,
|
|
12
|
-
createComponentStyleTargets,
|
|
13
|
-
} from "./component-style.ts";
|
|
14
|
-
import { commonConditions } from "./conditions.ts";
|
|
15
|
-
import type { ComponentStyle, ComponentStyleSystem, RemixComponent } from "./types.ts";
|
|
16
|
-
|
|
17
|
-
export type SpinnerRecipeInput<
|
|
18
|
-
TTone extends string = string,
|
|
19
|
-
TSize extends string = string,
|
|
20
|
-
> = RecipeWithVariantGroups<
|
|
21
|
-
"root",
|
|
22
|
-
string,
|
|
23
|
-
ComponentStyle,
|
|
24
|
-
{
|
|
25
|
-
size: TSize;
|
|
26
|
-
tone: TTone;
|
|
27
|
-
}
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
|
-
export type SpinnerRecipeTone<TRecipe extends SpinnerRecipeInput> = RecipeVariantValue<
|
|
31
|
-
TRecipe,
|
|
32
|
-
"tone"
|
|
33
|
-
>;
|
|
34
|
-
|
|
35
|
-
export type SpinnerRecipeSize<TRecipe extends SpinnerRecipeInput> = RecipeVariantValue<
|
|
36
|
-
TRecipe,
|
|
37
|
-
"size"
|
|
38
|
-
>;
|
|
39
|
-
|
|
40
|
-
export type SpinnerRecipeSelection<TRecipe extends SpinnerRecipeInput> =
|
|
41
|
-
RecipeVariantPropsFor<TRecipe, "size" | "tone">;
|
|
42
|
-
|
|
43
|
-
export type SpinnerStyleSystem<
|
|
44
|
-
TMode extends string = string,
|
|
45
|
-
TRecipe extends SpinnerRecipeInput = SpinnerRecipeInput,
|
|
46
|
-
TMetadata extends AnyGeneratedSystemMetadata = AnyGeneratedSystemMetadata,
|
|
47
|
-
> = ComponentStyleSystem<
|
|
48
|
-
TMode,
|
|
49
|
-
{
|
|
50
|
-
recipe: {
|
|
51
|
-
spinner: TRecipe;
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
TMetadata
|
|
55
|
-
>;
|
|
56
|
-
|
|
57
|
-
export type SpinnerProps<
|
|
58
|
-
TTone extends string = string,
|
|
59
|
-
TSize extends string = string,
|
|
60
|
-
> = Omit<Props<"span">, "style"> &
|
|
61
|
-
Partial<SpinnerRecipeSelection<SpinnerRecipeInput<TTone, TSize>>> & {
|
|
62
|
-
idle?: boolean;
|
|
63
|
-
style?: never;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const spinner_scope = "spinner";
|
|
67
|
-
|
|
68
|
-
export function createSpinner<
|
|
69
|
-
TMode extends string,
|
|
70
|
-
TRecipe extends SpinnerRecipeInput,
|
|
71
|
-
TMetadata extends AnyGeneratedSystemMetadata,
|
|
72
|
-
>(
|
|
73
|
-
style_system: SpinnerStyleSystem<TMode, TRecipe, TMetadata>,
|
|
74
|
-
): RemixComponent<SpinnerProps<SpinnerRecipeTone<TRecipe>, SpinnerRecipeSize<TRecipe>>> {
|
|
75
|
-
const recipe = createRecipe(style_system.token.recipe.spinner);
|
|
76
|
-
|
|
77
|
-
return () => {
|
|
78
|
-
return (
|
|
79
|
-
props: SpinnerProps<SpinnerRecipeTone<TRecipe>, SpinnerRecipeSize<TRecipe>>,
|
|
80
|
-
): RemixNode => {
|
|
81
|
-
const { idle = false, mix, size, tone, ...host_props } = props;
|
|
82
|
-
const resolved = recipe.resolve({
|
|
83
|
-
size,
|
|
84
|
-
tone,
|
|
85
|
-
} satisfies SpinnerRecipeSelection<TRecipe>);
|
|
86
|
-
const parts = createComponentStyleTargets({
|
|
87
|
-
targets: {
|
|
88
|
-
root: {
|
|
89
|
-
host: "root",
|
|
90
|
-
conditions: commonConditions,
|
|
91
|
-
resolveSlot: () => {
|
|
92
|
-
return resolved.slots.root;
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
props: {},
|
|
97
|
-
styleSystem: style_system,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
return createElement(
|
|
101
|
-
"span",
|
|
102
|
-
createComponentSlotProps({
|
|
103
|
-
attrs: createComponentAnatomyAttrs(spinner_scope, "root"),
|
|
104
|
-
mix: parts.hosts.root.mix,
|
|
105
|
-
props: {
|
|
106
|
-
...host_props,
|
|
107
|
-
"data-idle": idle || undefined,
|
|
108
|
-
mix,
|
|
109
|
-
},
|
|
110
|
-
}),
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
}
|