@pathscale/ui 2.9.1 → 2.9.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/components/_shared/controlledState.d.ts +14 -0
- package/dist/components/_shared/controlledState.js +7 -0
- package/dist/components/button/Button.generated.d.ts +1 -1
- package/dist/components/button/Button.generated.js +94 -70
- package/dist/components/color-wheel/ComplexColorWheel.generated.js +23 -22
- package/dist/components/color-wheel-flower/ColorWheelFlower.generated.js +9 -5
- package/dist/components/color-wheel-flower/ColorWheelFlower.geometry.d.ts +13 -0
- package/dist/components/color-wheel-flower/ColorWheelFlower.geometry.js +9 -0
- package/dist/components/language-switcher/LanguageSwitcher.generated.d.ts +1 -1
- package/dist/components/language-switcher/LanguageSwitcher.generated.js +49 -79
- package/dist/components/metal-border/MetalBorder.generated.js +2 -2
- package/dist/components/popover/Popover.css +6 -0
- package/dist/components/popover/Popover.generated.d.ts +3 -3
- package/dist/components/popover/Popover.generated.js +19 -16
- package/dist/components/slider/Slider.generated.js +6 -5
- package/dist/components/slider/Slider.interactions.d.ts +2 -0
- package/dist/components/slider/Slider.interactions.js +1 -1
- package/dist/components/theme-color-picker/hueShift.js +1 -1
- package/dist/layouts.manifest.json +1 -1
- package/dist/motion/engine.js +1 -0
- package/dist/purge-manifest.json +1 -2
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply one requested controlled/uncontrolled boolean-state transition.
|
|
3
|
+
*
|
|
4
|
+
* Capture whether the request changes the current value before mutating local
|
|
5
|
+
* state. Reactive setters may update synchronously; checking again afterwards
|
|
6
|
+
* can incorrectly suppress the owner's change callback.
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyBooleanStateRequest(options: {
|
|
9
|
+
current: boolean;
|
|
10
|
+
next: boolean;
|
|
11
|
+
controlled: boolean;
|
|
12
|
+
setInternal: (next: boolean) => void;
|
|
13
|
+
onChange?: (next: boolean) => void;
|
|
14
|
+
}): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component as __LayoutComponent } from "solid-js";
|
|
2
2
|
import "./Button.css";
|
|
3
|
-
import {
|
|
3
|
+
import type { JSX } from "@solidjs/web";
|
|
4
4
|
import type { Flavor, IconSlotProps, Radius, Size, State, UIBaseProps, Variant, Width } from "../vocabulary";
|
|
5
5
|
export type ButtonProps = Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "type"> & UIBaseProps & IconSlotProps & {
|
|
6
6
|
variant?: Variant;
|
|
@@ -1,86 +1,110 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { claimElement, createComponent, insert, memo, mergeProps, spread, template } from "@solidjs/web";
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./Button.css";
|
|
4
4
|
import { Show } from "solid-js";
|
|
5
5
|
import { button as external_Button_recipe_js_button } from "./Button.recipe.js";
|
|
6
6
|
import { buttonElement, buttonHref, buttonRel } from "./Button.interactions.js";
|
|
7
|
-
var _tmpl$ = /*#__PURE__*/ template("<span>");
|
|
7
|
+
var _tmpl$ = /*#__PURE__*/ template("<span>"), _tmpl$2 = /*#__PURE__*/ template("<a>"), _tmpl$3 = /*#__PURE__*/ template("<button>");
|
|
8
8
|
const __solidLayoutButtonLayout = (_stable, p)=>{
|
|
9
9
|
const loading = ()=>"loading" === p.state;
|
|
10
10
|
const inert = ()=>loading() || "disabled" === p.state || Boolean(p.disabled);
|
|
11
11
|
const element = ()=>buttonElement(p.href);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
12
|
+
const content = ()=>[
|
|
13
|
+
createComponent(Show, {
|
|
14
|
+
get when () {
|
|
15
|
+
return loading();
|
|
16
|
+
},
|
|
17
|
+
get children () {
|
|
18
|
+
var _el$ = _tmpl$();
|
|
19
|
+
spread(_el$, mergeProps(()=>_stable.slot.spinner, {
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}), false);
|
|
22
|
+
return _el$;
|
|
23
|
+
}
|
|
24
|
+
}),
|
|
25
|
+
createComponent(Show, {
|
|
26
|
+
get when () {
|
|
27
|
+
return p.startIcon;
|
|
28
|
+
},
|
|
29
|
+
get children () {
|
|
30
|
+
var _el$2 = _tmpl$();
|
|
31
|
+
spread(_el$2, mergeProps(()=>_stable.slot.startIcon), true);
|
|
32
|
+
insert(_el$2, ()=>p.startIcon);
|
|
33
|
+
return _el$2;
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
memo(()=>_stable.children),
|
|
37
|
+
createComponent(Show, {
|
|
38
|
+
get when () {
|
|
39
|
+
return p.endIcon;
|
|
40
|
+
},
|
|
41
|
+
get children () {
|
|
42
|
+
var _el$3 = _tmpl$();
|
|
43
|
+
spread(_el$3, mergeProps(()=>_stable.slot.endIcon), true);
|
|
44
|
+
insert(_el$3, ()=>p.endIcon);
|
|
45
|
+
return _el$3;
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
];
|
|
49
|
+
return createComponent(Show, {
|
|
50
|
+
get when () {
|
|
51
|
+
return "a" === element();
|
|
40
52
|
},
|
|
41
|
-
get
|
|
42
|
-
|
|
53
|
+
get fallback () {
|
|
54
|
+
var _el$5 = _tmpl$3();
|
|
55
|
+
spread(_el$5, mergeProps(()=>_stable.slot.root, {
|
|
56
|
+
get type () {
|
|
57
|
+
return p.type ?? "button";
|
|
58
|
+
},
|
|
59
|
+
get disabled () {
|
|
60
|
+
return inert();
|
|
61
|
+
},
|
|
62
|
+
get ["aria-disabled"] () {
|
|
63
|
+
return inert() ? "true" : "false";
|
|
64
|
+
},
|
|
65
|
+
get ["aria-busy"] () {
|
|
66
|
+
return loading() ? "true" : void 0;
|
|
67
|
+
},
|
|
68
|
+
get ["data-state"] () {
|
|
69
|
+
return p.state ?? "default";
|
|
70
|
+
},
|
|
71
|
+
get ["data-flavor"] () {
|
|
72
|
+
return p.flavor ?? "primary";
|
|
73
|
+
}
|
|
74
|
+
}), true);
|
|
75
|
+
insert(_el$5, content);
|
|
76
|
+
return _el$5;
|
|
43
77
|
},
|
|
44
78
|
get children () {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return p.endIcon;
|
|
73
|
-
},
|
|
74
|
-
get children () {
|
|
75
|
-
var _el$3 = _tmpl$();
|
|
76
|
-
spread(_el$3, mergeProps(()=>_stable.slot.endIcon), true);
|
|
77
|
-
insert(_el$3, ()=>p.endIcon);
|
|
78
|
-
return _el$3;
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
];
|
|
79
|
+
var _el$4 = _tmpl$2();
|
|
80
|
+
claimElement(_el$4);
|
|
81
|
+
spread(_el$4, mergeProps(()=>_stable.slot.root, {
|
|
82
|
+
get href () {
|
|
83
|
+
return buttonHref(p.href, inert());
|
|
84
|
+
},
|
|
85
|
+
get target () {
|
|
86
|
+
return p.target;
|
|
87
|
+
},
|
|
88
|
+
get rel () {
|
|
89
|
+
return buttonRel(p.rel, p.target);
|
|
90
|
+
},
|
|
91
|
+
get ["aria-disabled"] () {
|
|
92
|
+
return inert() ? "true" : "false";
|
|
93
|
+
},
|
|
94
|
+
get ["aria-busy"] () {
|
|
95
|
+
return loading() ? "true" : void 0;
|
|
96
|
+
},
|
|
97
|
+
get ["data-state"] () {
|
|
98
|
+
return p.state ?? "default";
|
|
99
|
+
},
|
|
100
|
+
get ["data-flavor"] () {
|
|
101
|
+
return p.flavor ?? "primary";
|
|
102
|
+
}
|
|
103
|
+
}), true);
|
|
104
|
+
insert(_el$4, content);
|
|
105
|
+
return _el$4;
|
|
82
106
|
}
|
|
83
|
-
})
|
|
107
|
+
});
|
|
84
108
|
};
|
|
85
109
|
const ButtonLayout = defineComponent({
|
|
86
110
|
recipe: external_Button_recipe_js_button,
|
|
@@ -63,26 +63,27 @@ const __solidLayoutComplexColorWheelLayout = (_stable, p)=>createComponent(card,
|
|
|
63
63
|
get each () {
|
|
64
64
|
return p.adjustments;
|
|
65
65
|
},
|
|
66
|
+
keyed: false,
|
|
66
67
|
children: (adjustment)=>(()=>{
|
|
67
68
|
var _el$5 = _tmpl$4(), _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$7.nextSibling, _el$9 = _el$6.nextSibling;
|
|
68
69
|
spread(_el$5, mergeProps(()=>_stable.slot.axis, {
|
|
69
70
|
get ["data-axis"] () {
|
|
70
|
-
return adjustment.id;
|
|
71
|
+
return adjustment().id;
|
|
71
72
|
}
|
|
72
73
|
}), true);
|
|
73
74
|
spread(_el$6, mergeProps(()=>_stable.slot.axisHeading), true);
|
|
74
|
-
insert(_el$7, ()=>adjustment.label);
|
|
75
|
-
insert(_el$8, ()=>adjustment.formatValue?.(adjustment.value) ?? adjustment.value);
|
|
75
|
+
insert(_el$7, ()=>adjustment().label);
|
|
76
|
+
insert(_el$8, ()=>adjustment().formatValue?.(adjustment().value) ?? adjustment().value);
|
|
76
77
|
spread(_el$9, mergeProps(()=>_stable.slot.axisControl), true);
|
|
77
78
|
insert(_el$9, createComponent(Show, {
|
|
78
79
|
get when () {
|
|
79
|
-
return memo(()=>!!adjustment.stops?.length)() ? adjustment.stops : void 0;
|
|
80
|
+
return memo(()=>!!adjustment().stops?.length)() ? adjustment().stops : void 0;
|
|
80
81
|
},
|
|
81
82
|
get fallback () {
|
|
82
83
|
return [
|
|
83
84
|
createComponent(Show, {
|
|
84
85
|
get when () {
|
|
85
|
-
return adjustment.preview;
|
|
86
|
+
return adjustment().preview;
|
|
86
87
|
},
|
|
87
88
|
get children () {
|
|
88
89
|
var _el$1 = _tmpl$3();
|
|
@@ -90,7 +91,7 @@ const __solidLayoutComplexColorWheelLayout = (_stable, p)=>createComponent(card,
|
|
|
90
91
|
"aria-hidden": "true",
|
|
91
92
|
get style () {
|
|
92
93
|
return {
|
|
93
|
-
"background-color": adjustment.preview?.(adjustment.value, p.value)
|
|
94
|
+
"background-color": adjustment().preview?.(adjustment().value, p.value)
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
}), false);
|
|
@@ -99,31 +100,31 @@ const __solidLayoutComplexColorWheelLayout = (_stable, p)=>createComponent(card,
|
|
|
99
100
|
}),
|
|
100
101
|
createComponent(slider, {
|
|
101
102
|
get label () {
|
|
102
|
-
return adjustment.label;
|
|
103
|
+
return adjustment().label;
|
|
103
104
|
},
|
|
104
105
|
get value () {
|
|
105
|
-
return adjustment.value;
|
|
106
|
+
return adjustment().value;
|
|
106
107
|
},
|
|
107
108
|
get min () {
|
|
108
|
-
return adjustment.min ?? 0;
|
|
109
|
+
return adjustment().min ?? 0;
|
|
109
110
|
},
|
|
110
111
|
get max () {
|
|
111
|
-
return adjustment.max ?? 100;
|
|
112
|
+
return adjustment().max ?? 100;
|
|
112
113
|
},
|
|
113
114
|
get step () {
|
|
114
|
-
return adjustment.step;
|
|
115
|
+
return adjustment().step;
|
|
115
116
|
},
|
|
116
117
|
get disabled () {
|
|
117
118
|
return p.isDisabled;
|
|
118
119
|
},
|
|
119
120
|
get onChange () {
|
|
120
|
-
return adjustment.onChange;
|
|
121
|
+
return adjustment().onChange;
|
|
121
122
|
},
|
|
122
123
|
get onChangeEnd () {
|
|
123
|
-
return adjustment.onChangeEnd;
|
|
124
|
+
return adjustment().onChangeEnd;
|
|
124
125
|
},
|
|
125
126
|
get formatValue () {
|
|
126
|
-
return adjustment.formatValue;
|
|
127
|
+
return adjustment().formatValue;
|
|
127
128
|
},
|
|
128
129
|
size: "sm"
|
|
129
130
|
})
|
|
@@ -141,29 +142,29 @@ const __solidLayoutComplexColorWheelLayout = (_stable, p)=>createComponent(card,
|
|
|
141
142
|
size: "sm",
|
|
142
143
|
variant: "ghost",
|
|
143
144
|
get ["aria-label"] () {
|
|
144
|
-
return `${adjustment.label} ${adjustment.formatValue?.(stop) ?? stop}`;
|
|
145
|
+
return `${adjustment().label} ${adjustment().formatValue?.(stop) ?? stop}`;
|
|
145
146
|
},
|
|
146
147
|
get ["aria-pressed"] () {
|
|
147
|
-
return Math.abs(adjustment.value - stop) < 0.001 ? "true" : "false";
|
|
148
|
+
return Math.abs(adjustment().value - stop) < 0.001 ? "true" : "false";
|
|
148
149
|
},
|
|
149
150
|
get disabled () {
|
|
150
151
|
return p.isDisabled;
|
|
151
152
|
},
|
|
152
|
-
onClick: ()=>adjustment.onChange(stop),
|
|
153
|
+
onClick: ()=>adjustment().onChange(stop),
|
|
153
154
|
get children () {
|
|
154
155
|
var _el$11 = _tmpl$3();
|
|
155
156
|
spread(_el$11, mergeProps(()=>_stable.slot.stopPreview, {
|
|
156
157
|
"aria-hidden": "true",
|
|
157
158
|
get style () {
|
|
158
159
|
return {
|
|
159
|
-
"background-color": adjustment.preview?.(stop, p.value),
|
|
160
|
-
color: adjustment.ink?.(stop, p.value)
|
|
160
|
+
"background-color": adjustment().preview?.(stop, p.value),
|
|
161
|
+
color: adjustment().ink?.(stop, p.value)
|
|
161
162
|
};
|
|
162
163
|
}
|
|
163
164
|
}), true);
|
|
164
165
|
insert(_el$11, createComponent(Show, {
|
|
165
166
|
get when () {
|
|
166
|
-
return adjustment.ink;
|
|
167
|
+
return adjustment().ink;
|
|
167
168
|
},
|
|
168
169
|
children: "A"
|
|
169
170
|
}));
|
|
@@ -176,12 +177,12 @@ const __solidLayoutComplexColorWheelLayout = (_stable, p)=>createComponent(card,
|
|
|
176
177
|
}));
|
|
177
178
|
insert(_el$5, createComponent(Show, {
|
|
178
179
|
get when () {
|
|
179
|
-
return adjustment.hint;
|
|
180
|
+
return adjustment().hint;
|
|
180
181
|
},
|
|
181
182
|
get children () {
|
|
182
183
|
var _el$0 = _tmpl$3();
|
|
183
184
|
spread(_el$0, mergeProps(()=>_stable.slot.hint), true);
|
|
184
|
-
insert(_el$0, ()=>adjustment.hint);
|
|
185
|
+
insert(_el$0, ()=>adjustment().hint);
|
|
185
186
|
return _el$0;
|
|
186
187
|
}
|
|
187
188
|
}), null);
|
|
@@ -11,6 +11,7 @@ import { createColorFromHsl, parseColor, rgbToHex, rgbToHsl } from "./ColorUtils
|
|
|
11
11
|
import { resolveColorWheelFlowerPalette } from "./ColorWheelFlower.palette.js";
|
|
12
12
|
import { motionDistances, motionDurations, motionEasings, prefersReducedMotion, runMotion } from "../../motion/index.js";
|
|
13
13
|
import { CLASSES, componentRecipe } from "./ColorWheelFlower.recipe.js";
|
|
14
|
+
import { flowerPetalPosition } from "./ColorWheelFlower.geometry.js";
|
|
14
15
|
var _tmpl$ = /*#__PURE__*/ template("<div><div><div><div></div></div><div><div>"), _tmpl$2 = /*#__PURE__*/ template("<div><div><div><span></span><span>");
|
|
15
16
|
const parseRgbToHsl = (rgbString)=>{
|
|
16
17
|
const match = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
|
@@ -52,6 +53,12 @@ const createColorItem = (id, color, offsetX, offsetY, options)=>{
|
|
|
52
53
|
};
|
|
53
54
|
};
|
|
54
55
|
const readMotionState = (el)=>{
|
|
56
|
+
if ("u" < typeof getComputedStyle) return {
|
|
57
|
+
opacity: 1,
|
|
58
|
+
x: 0,
|
|
59
|
+
y: 0,
|
|
60
|
+
scale: 1
|
|
61
|
+
};
|
|
55
62
|
const styles = getComputedStyle(el);
|
|
56
63
|
const opacityValue = Number.parseFloat(styles.opacity);
|
|
57
64
|
const opacity = Number.isFinite(opacityValue) ? opacityValue : 1;
|
|
@@ -295,7 +302,7 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
295
302
|
});
|
|
296
303
|
const [pulseState, setPulseState] = createSignal(null);
|
|
297
304
|
const [currentTheme, setCurrentTheme] = createSignal("u" > typeof document && "dark" === document.documentElement.getAttribute("data-theme") ? "dark" : "light");
|
|
298
|
-
if ("u" > typeof window) {
|
|
305
|
+
if ("u" > typeof window && "u" > typeof MutationObserver) {
|
|
299
306
|
const observer = new MutationObserver(()=>{
|
|
300
307
|
const t = document.documentElement.getAttribute("data-theme");
|
|
301
308
|
setCurrentTheme("dark" === t ? "dark" : "light");
|
|
@@ -636,10 +643,7 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
636
643
|
class: CLASSES.dot.base
|
|
637
644
|
}), {
|
|
638
645
|
get style () {
|
|
639
|
-
return
|
|
640
|
-
left: `calc(50% + ${item.offsetX}px)`,
|
|
641
|
-
top: `calc(50% + ${item.offsetY}px)`
|
|
642
|
-
};
|
|
646
|
+
return flowerPetalPosition(item.offsetX, item.offsetY);
|
|
643
647
|
}
|
|
644
648
|
}), true);
|
|
645
649
|
spread(_el$8, mergeProps(()=>({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Place one petal around the wheel centre using properties Blitz supports.
|
|
3
|
+
*
|
|
4
|
+
* Keeping the percentage anchor separate from the pixel offset is deliberate:
|
|
5
|
+
* browser engines accept `calc(50% + …px)`, while Blitz currently drops that
|
|
6
|
+
* mixed-unit position and piles every petal onto the centre.
|
|
7
|
+
*/
|
|
8
|
+
export declare function flowerPetalPosition(offsetX: number, offsetY: number): {
|
|
9
|
+
readonly left: "50%";
|
|
10
|
+
readonly top: "50%";
|
|
11
|
+
readonly "margin-left": `${number}px`;
|
|
12
|
+
readonly "margin-top": `${number}px`;
|
|
13
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component as __LayoutComponent } from "solid-js";
|
|
2
2
|
import "./LanguageSwitcher.css";
|
|
3
|
-
import {
|
|
3
|
+
import type { DropdownAlign } from "../dropdown";
|
|
4
4
|
import type { UIBaseProps } from "../vocabulary";
|
|
5
5
|
import type { I18nStore } from "./createI18n";
|
|
6
6
|
export interface LanguageSwitcherProps extends UIBaseProps {
|
|
@@ -1,102 +1,72 @@
|
|
|
1
|
-
import { createComponent, insert, mergeProps, spread, template } from "@solidjs/web";
|
|
1
|
+
import { createComponent, effect, insert, mergeProps, spread, template } from "@solidjs/web";
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./LanguageSwitcher.css";
|
|
4
|
-
import { For,
|
|
4
|
+
import { For, omit } from "solid-js";
|
|
5
5
|
import { twMerge } from "../../lib/twMerge.js";
|
|
6
|
-
import dropdown from "../dropdown/index.js";
|
|
7
|
-
import icon from "../icon/index.js";
|
|
8
6
|
import { CLASSES, componentRecipe } from "./LanguageSwitcher.recipe.js";
|
|
9
|
-
var _tmpl$ = /*#__PURE__*/ template("<
|
|
7
|
+
var _tmpl$ = /*#__PURE__*/ template("<select>"), _tmpl$2 = /*#__PURE__*/ template("<option>");
|
|
10
8
|
const __solidLayoutLanguageSwitcher = (_stable, p)=>{
|
|
11
9
|
const others = omit(p, "i18n", "class", "style", "aria-label", "currentLanguageLabel", "optionsLabel", "loadingLabel", "align", "onLanguageChange");
|
|
12
10
|
const currentLanguageName = ()=>p.i18n.languageNames[p.i18n.locale];
|
|
13
|
-
const isSelected = (lang)=>p.i18n.locale === lang;
|
|
14
11
|
const handleSelect = async (lang)=>{
|
|
15
12
|
await p.i18n.setLocale(lang);
|
|
16
13
|
p.onLanguageChange?.(lang);
|
|
17
14
|
};
|
|
18
|
-
const classes = ()=>twMerge(CLASSES.base, p.class);
|
|
19
|
-
|
|
15
|
+
const classes = ()=>twMerge(CLASSES.base, CLASSES.trigger, p.class);
|
|
16
|
+
const move = (direction)=>{
|
|
17
|
+
const languages = p.i18n.languages;
|
|
18
|
+
const current = languages.findIndex((language)=>language.code === p.i18n.locale);
|
|
19
|
+
const next = (Math.max(0, current) + direction + languages.length) % languages.length;
|
|
20
|
+
const language = languages[next];
|
|
21
|
+
if (language) handleSelect(language.code);
|
|
22
|
+
};
|
|
23
|
+
var _el$ = _tmpl$();
|
|
24
|
+
spread(_el$, mergeProps(others, ()=>({
|
|
20
25
|
class: classes()
|
|
21
26
|
}), {
|
|
22
27
|
get style () {
|
|
23
28
|
return p.style;
|
|
24
29
|
},
|
|
25
|
-
|
|
30
|
+
get value () {
|
|
31
|
+
return p.i18n.locale;
|
|
32
|
+
},
|
|
33
|
+
get disabled () {
|
|
34
|
+
return p.i18n.isLoading;
|
|
35
|
+
},
|
|
36
|
+
get ["aria-busy"] () {
|
|
37
|
+
return p.i18n.isLoading ? "true" : void 0;
|
|
38
|
+
},
|
|
26
39
|
get ["aria-label"] () {
|
|
27
|
-
return p
|
|
40
|
+
return `${p.currentLanguageLabel ?? "Current language"}: ${currentLanguageName()}`;
|
|
41
|
+
},
|
|
42
|
+
get title () {
|
|
43
|
+
return p.optionsLabel ?? p["aria-label"] ?? "Language selector";
|
|
28
44
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return createComponent(Show, {
|
|
39
|
-
get when () {
|
|
40
|
-
return !p.i18n.isLoading;
|
|
41
|
-
},
|
|
42
|
-
get fallback () {
|
|
43
|
-
return createComponent(icon, mergeProps({
|
|
44
|
-
src: "icon-[mdi--loading]"
|
|
45
|
-
}, ()=>({
|
|
46
|
-
class: CLASSES.loadingIcon
|
|
47
|
-
}), {
|
|
48
|
-
width: 16,
|
|
49
|
-
height: 16,
|
|
50
|
-
get ["aria-label"] () {
|
|
51
|
-
return p.loadingLabel ?? "Loading language";
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
54
|
-
},
|
|
55
|
-
get children () {
|
|
56
|
-
var _el$ = _tmpl$();
|
|
57
|
-
spread(_el$, mergeProps(()=>({
|
|
58
|
-
class: CLASSES.locale
|
|
59
|
-
}), {
|
|
60
|
-
"aria-hidden": "true"
|
|
61
|
-
}), true);
|
|
62
|
-
insert(_el$, ()=>p.i18n.locale.toUpperCase());
|
|
63
|
-
return _el$;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
})),
|
|
68
|
-
createComponent(dropdown.Menu, mergeProps(()=>({
|
|
69
|
-
class: CLASSES.menu
|
|
70
|
-
}), {
|
|
71
|
-
get align () {
|
|
72
|
-
return p.align;
|
|
73
|
-
},
|
|
74
|
-
get ["aria-label"] () {
|
|
75
|
-
return p.optionsLabel ?? "Language options";
|
|
76
|
-
},
|
|
77
|
-
get children () {
|
|
78
|
-
return createComponent(For, {
|
|
79
|
-
get each () {
|
|
80
|
-
return p.i18n.languages;
|
|
81
|
-
},
|
|
82
|
-
children: (lang)=>createComponent(dropdown.Item, mergeProps({
|
|
83
|
-
onClick: ()=>handleSelect(lang.code)
|
|
84
|
-
}, ()=>({
|
|
85
|
-
class: twMerge(CLASSES.item, isSelected(lang.code) && CLASSES.itemSelected)
|
|
86
|
-
}), {
|
|
87
|
-
get ["aria-current"] () {
|
|
88
|
-
return isSelected(lang.code) ? "true" : void 0;
|
|
89
|
-
},
|
|
90
|
-
get children () {
|
|
91
|
-
return lang.name;
|
|
92
|
-
}
|
|
93
|
-
}))
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}))
|
|
97
|
-
];
|
|
45
|
+
onChange: (event)=>void handleSelect(event.currentTarget.value),
|
|
46
|
+
onKeyDown: (event)=>{
|
|
47
|
+
if ("ArrowDown" === event.key) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
move(1);
|
|
50
|
+
} else if ("ArrowUp" === event.key) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
move(-1);
|
|
53
|
+
}
|
|
98
54
|
}
|
|
55
|
+
}), true);
|
|
56
|
+
insert(_el$, createComponent(For, {
|
|
57
|
+
get each () {
|
|
58
|
+
return p.i18n.languages;
|
|
59
|
+
},
|
|
60
|
+
children: (lang)=>(()=>{
|
|
61
|
+
var _el$2 = _tmpl$2();
|
|
62
|
+
insert(_el$2, ()=>lang.name);
|
|
63
|
+
effect(()=>lang.code, (_v$)=>{
|
|
64
|
+
_el$2.value = _v$;
|
|
65
|
+
});
|
|
66
|
+
return _el$2;
|
|
67
|
+
})()
|
|
99
68
|
}));
|
|
69
|
+
return _el$;
|
|
100
70
|
};
|
|
101
71
|
const LanguageSwitcher = defineComponent({
|
|
102
72
|
recipe: componentRecipe,
|
|
@@ -20,7 +20,7 @@ const toRadiusCssValue = (value)=>{
|
|
|
20
20
|
return value;
|
|
21
21
|
};
|
|
22
22
|
const readRadiusPx = (element)=>{
|
|
23
|
-
if (!element || "u" < typeof window) return 0;
|
|
23
|
+
if (!element || "u" < typeof window || "function" != typeof window.getComputedStyle) return 0;
|
|
24
24
|
const computed = window.getComputedStyle(element);
|
|
25
25
|
const candidates = [
|
|
26
26
|
computed.borderTopLeftRadius,
|
|
@@ -145,7 +145,7 @@ const __solidLayoutMetalBorder = (_stable, p)=>{
|
|
|
145
145
|
setPrefersReduced(prefersReducedMotion());
|
|
146
146
|
};
|
|
147
147
|
mediaQueryList?.addEventListener?.("change", handleMotionChange);
|
|
148
|
-
if (hostRef) {
|
|
148
|
+
if (hostRef && "u" > typeof MutationObserver) {
|
|
149
149
|
const themeRoot = hostRef.closest("[data-theme]") ?? document.documentElement;
|
|
150
150
|
mutationObserver = new MutationObserver(()=>{
|
|
151
151
|
syncResolvedTheme();
|
|
@@ -2,8 +2,8 @@ import type { Component as __LayoutComponent } from "solid-js";
|
|
|
2
2
|
import "./Popover.css";
|
|
3
3
|
import { type JSX } from "@solidjs/web";
|
|
4
4
|
import "../_shared/material.css";
|
|
5
|
-
import type { Material, UIBaseProps } from "../vocabulary";
|
|
6
5
|
import { type OverlayAnchorRect, type OverlayPlacement } from "../_shared/overlayPosition";
|
|
6
|
+
import type { Material, UIBaseProps } from "../vocabulary";
|
|
7
7
|
export type PopoverPlacement = OverlayPlacement;
|
|
8
8
|
export type PopoverAnchorRect = OverlayAnchorRect;
|
|
9
9
|
export type PopoverAnchor = PopoverAnchorRect | (() => PopoverAnchorRect | undefined);
|
|
@@ -21,7 +21,7 @@ export type PopoverRootProps = UIBaseProps & Omit<JSX.HTMLAttributes<HTMLDivElem
|
|
|
21
21
|
onInteractOutside?: (event: Event) => void;
|
|
22
22
|
};
|
|
23
23
|
declare const PopoverRoot: __LayoutComponent<PopoverRootProps>;
|
|
24
|
-
export type PopoverTriggerProps = UIBaseProps & Omit<JSX.
|
|
24
|
+
export type PopoverTriggerProps = UIBaseProps & Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
25
25
|
children: JSX.Element;
|
|
26
26
|
};
|
|
27
27
|
declare const PopoverTrigger: __LayoutComponent<PopoverTriggerProps>;
|
|
@@ -53,4 +53,4 @@ declare const Popover: __LayoutComponent<PopoverRootProps> & {
|
|
|
53
53
|
Heading: __LayoutComponent<PopoverHeadingProps>;
|
|
54
54
|
};
|
|
55
55
|
export default Popover;
|
|
56
|
-
export {
|
|
56
|
+
export { PopoverArrow, PopoverContent, PopoverDialog, PopoverHeading, PopoverRoot, PopoverTrigger, };
|
|
@@ -4,9 +4,10 @@ import "./Popover.css";
|
|
|
4
4
|
import { Show, createContext, createMemo, createSignal, createTrackedEffect, omit, onSettled, useContext } from "solid-js";
|
|
5
5
|
import { twMerge } from "../../lib/twMerge.js";
|
|
6
6
|
import "../_shared/material.css";
|
|
7
|
+
import { applyBooleanStateRequest } from "../_shared/controlledState.js";
|
|
7
8
|
import { createOverlayPosition } from "../_shared/overlayPosition.js";
|
|
8
9
|
import { CLASSES, componentRecipe } from "./Popover.recipe.js";
|
|
9
|
-
var _tmpl$ = /*#__PURE__*/ template("<div>"), _tmpl$2 = /*#__PURE__*/ template('<svg aria-hidden=true data-slot=popover-arrow-svg height=12 viewBox="0 0 12 12"width=12><path d="M0 0C5.48483 8 6.5 8 12 0Z"fill=currentColor>'), _tmpl$
|
|
10
|
+
var _tmpl$ = /*#__PURE__*/ template("<div>"), _tmpl$2 = /*#__PURE__*/ template("<button>"), _tmpl$3 = /*#__PURE__*/ template('<svg aria-hidden=true data-slot=popover-arrow-svg height=12 viewBox="0 0 12 12"width=12><path d="M0 0C5.48483 8 6.5 8 12 0Z"fill=currentColor>'), _tmpl$4 = /*#__PURE__*/ template("<span>"), _tmpl$5 = /*#__PURE__*/ template("<h3>");
|
|
10
11
|
const PopoverContext = createContext(null);
|
|
11
12
|
const usePopoverContext = ()=>{
|
|
12
13
|
const ctx = useContext(PopoverContext);
|
|
@@ -24,8 +25,13 @@ const __solidLayoutPopoverRoot = (_stable, p)=>{
|
|
|
24
25
|
const isControlled = createMemo(()=>void 0 !== p.open);
|
|
25
26
|
const isOpen = createMemo(()=>isControlled() ? Boolean(p.open) : internalOpen());
|
|
26
27
|
const setIsOpen = (next, options)=>{
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
applyBooleanStateRequest({
|
|
29
|
+
current: isOpen(),
|
|
30
|
+
next,
|
|
31
|
+
controlled: isControlled(),
|
|
32
|
+
setInternal: setInternalOpen,
|
|
33
|
+
onChange: p.onOpenChange
|
|
34
|
+
});
|
|
29
35
|
if (!next && options?.focusTrigger) triggerRef()?.focus();
|
|
30
36
|
};
|
|
31
37
|
const preferredPlacement = ()=>p.placement ?? "bottom";
|
|
@@ -105,7 +111,7 @@ const PopoverRoot = defineComponent({
|
|
|
105
111
|
embedded: true
|
|
106
112
|
});
|
|
107
113
|
const __solidLayoutPopoverTrigger = (_stable, p)=>{
|
|
108
|
-
const others = omit(p, "children", "class", "dataTheme", "style", "onClick", "onKeyDown");
|
|
114
|
+
const others = omit(p, "children", "class", "dataTheme", "style", "type", "onClick", "onKeyDown");
|
|
109
115
|
const ctx = usePopoverContext();
|
|
110
116
|
const handleClick = (event)=>{
|
|
111
117
|
if ("function" == typeof p.onClick) p.onClick(event);
|
|
@@ -115,10 +121,6 @@ const __solidLayoutPopoverTrigger = (_stable, p)=>{
|
|
|
115
121
|
const handleKeyDown = (event)=>{
|
|
116
122
|
if ("function" == typeof p.onKeyDown) p.onKeyDown(event);
|
|
117
123
|
if (event.defaultPrevented) return;
|
|
118
|
-
if ("Enter" === event.key || " " === event.key) {
|
|
119
|
-
event.preventDefault();
|
|
120
|
-
ctx.setIsOpen(!ctx.isOpen());
|
|
121
|
-
}
|
|
122
124
|
if ("Escape" === event.key && ctx.isOpen()) {
|
|
123
125
|
event.preventDefault();
|
|
124
126
|
ctx.setIsOpen(false, {
|
|
@@ -126,14 +128,15 @@ const __solidLayoutPopoverTrigger = (_stable, p)=>{
|
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
};
|
|
129
|
-
var _el$2 = _tmpl$();
|
|
131
|
+
var _el$2 = _tmpl$2();
|
|
130
132
|
ref(()=>(el)=>ctx.setTriggerRef(el), _el$2);
|
|
131
133
|
spread(_el$2, mergeProps(others, {
|
|
134
|
+
get type () {
|
|
135
|
+
return p.type ?? "button";
|
|
136
|
+
},
|
|
132
137
|
get id () {
|
|
133
138
|
return ctx.triggerId();
|
|
134
|
-
}
|
|
135
|
-
role: "button",
|
|
136
|
-
tabindex: 0
|
|
139
|
+
}
|
|
137
140
|
}, ()=>({
|
|
138
141
|
class: twMerge(CLASSES.slot.trigger, p.class)
|
|
139
142
|
}), {
|
|
@@ -226,7 +229,7 @@ const __solidLayoutPopoverContent = (_stable, p)=>{
|
|
|
226
229
|
return style();
|
|
227
230
|
},
|
|
228
231
|
get ["aria-labelledby"] () {
|
|
229
|
-
return ctx.triggerRef() ? ctx.triggerId() : void 0;
|
|
232
|
+
return p["aria-labelledby"] ?? (ctx.triggerRef() ? ctx.triggerId() : void 0);
|
|
230
233
|
},
|
|
231
234
|
get ["aria-hidden"] () {
|
|
232
235
|
return ctx.isOpen() ? "false" : "true";
|
|
@@ -269,8 +272,8 @@ const PopoverDialog = defineComponent({
|
|
|
269
272
|
const __solidLayoutPopoverArrow = (_stable, p)=>{
|
|
270
273
|
const others = omit(p, "children", "class", "dataTheme", "style");
|
|
271
274
|
const ctx = usePopoverContext();
|
|
272
|
-
const defaultArrow = _tmpl$
|
|
273
|
-
var _el$6 = _tmpl$
|
|
275
|
+
const defaultArrow = _tmpl$3();
|
|
276
|
+
var _el$6 = _tmpl$4();
|
|
274
277
|
spread(_el$6, mergeProps(others, ()=>({
|
|
275
278
|
class: twMerge(CLASSES.slot.arrow, p.class)
|
|
276
279
|
}), {
|
|
@@ -296,7 +299,7 @@ const PopoverArrow = defineComponent({
|
|
|
296
299
|
});
|
|
297
300
|
const __solidLayoutPopoverHeading = (_stable, p)=>{
|
|
298
301
|
const others = omit(p, "children", "class", "dataTheme", "style");
|
|
299
|
-
var _el$7 = _tmpl$
|
|
302
|
+
var _el$7 = _tmpl$5();
|
|
300
303
|
spread(_el$7, mergeProps(others, ()=>({
|
|
301
304
|
class: twMerge(CLASSES.slot.heading, p.class)
|
|
302
305
|
}), {
|
|
@@ -3,8 +3,8 @@ import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
|
3
3
|
import "./Slider.css";
|
|
4
4
|
import { Show, createSignal, createUniqueId } from "solid-js";
|
|
5
5
|
import { twMerge } from "../../lib/twMerge.js";
|
|
6
|
-
import { CLASSES, componentRecipe } from "./Slider.recipe.js";
|
|
7
6
|
import { createSliderInteractionHandlers } from "./Slider.interactions.js";
|
|
7
|
+
import { CLASSES, componentRecipe } from "./Slider.recipe.js";
|
|
8
8
|
var _tmpl$ = /*#__PURE__*/ template("<span>"), _tmpl$2 = /*#__PURE__*/ template("<div><div><div></div><div>");
|
|
9
9
|
function clamp(val, min, max) {
|
|
10
10
|
return Math.min(Math.max(val, min), max);
|
|
@@ -101,6 +101,7 @@ const __solidLayoutSlider = (_stable, p)=>{
|
|
|
101
101
|
dragGeometry = active ? measureTrack() : void 0;
|
|
102
102
|
},
|
|
103
103
|
isThumb: (target)=>Boolean(thumbRef && target === thumbRef),
|
|
104
|
+
focusThumb: ()=>thumbRef?.focus(),
|
|
104
105
|
onChange: (value)=>p.onChange(value),
|
|
105
106
|
onChangeEnd: (value)=>p.onChangeEnd?.(value),
|
|
106
107
|
onDraggingChange: setDragging
|
|
@@ -203,10 +204,10 @@ const __solidLayoutSlider = (_stable, p)=>{
|
|
|
203
204
|
left: thumbLeft()
|
|
204
205
|
};
|
|
205
206
|
},
|
|
206
|
-
role: "slider"
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
},
|
|
207
|
+
role: "slider"
|
|
208
|
+
}, ()=>({
|
|
209
|
+
tabindex: isDisabled() ? -1 : 0
|
|
210
|
+
}), {
|
|
210
211
|
get ["aria-valuemin"] () {
|
|
211
212
|
return min();
|
|
212
213
|
},
|
|
@@ -6,6 +6,8 @@ export type SliderInteractionOptions = {
|
|
|
6
6
|
onDragGeometry?: (active: boolean) => void;
|
|
7
7
|
/** Whether a press landed on the thumb rather than on the bare track. */
|
|
8
8
|
isThumb?: (target: EventTarget | null) => boolean;
|
|
9
|
+
/** Focus the keyboard-operable thumb as a fallback for synthetic pointers. */
|
|
10
|
+
focusThumb: () => void;
|
|
9
11
|
valueFromKey: (key: string, currentValue: number) => number | undefined;
|
|
10
12
|
onChange: (value: number) => void;
|
|
11
13
|
onChangeEnd: (value: number) => void;
|
|
@@ -51,7 +51,7 @@ const createSliderInteractionHandlers = (options)=>{
|
|
|
51
51
|
return {
|
|
52
52
|
onPointerDown (event) {
|
|
53
53
|
if (options.isDisabled() || void 0 !== pointerId) return;
|
|
54
|
-
|
|
54
|
+
options.focusThumb();
|
|
55
55
|
const target = event.currentTarget;
|
|
56
56
|
target.setPointerCapture(event.pointerId);
|
|
57
57
|
pointerId = event.pointerId;
|
|
@@ -170,7 +170,7 @@ function createHueShiftStore(storagePrefix) {
|
|
|
170
170
|
applyThemeColor(color);
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
|
-
if ("u" > typeof window) {
|
|
173
|
+
if ("u" > typeof window && "u" > typeof MutationObserver) {
|
|
174
174
|
const observer = new MutationObserver((mutations)=>{
|
|
175
175
|
for (const mutation of mutations)if ("attributes" === mutation.type && "data-theme" === mutation.attributeName) requestAnimationFrame(reapplyThemeColor);
|
|
176
176
|
});
|
package/dist/motion/engine.js
CHANGED
|
@@ -3,6 +3,7 @@ import { resolveEase } from "./easing.js";
|
|
|
3
3
|
const resolveDuration = (transition)=>Math.max(0, (transition?.duration ?? 0) * 1000);
|
|
4
4
|
const resolveDelay = (transition)=>Math.max(0, (transition?.delay ?? 0) * 1000);
|
|
5
5
|
const readOpacity = (el)=>{
|
|
6
|
+
if ("u" < typeof getComputedStyle) return 1;
|
|
6
7
|
const value = Number.parseFloat(getComputedStyle(el).opacity);
|
|
7
8
|
return Number.isFinite(value) ? value : 1;
|
|
8
9
|
};
|
package/dist/purge-manifest.json
CHANGED