@pathscale/ui 2.11.8 → 2.11.9
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/color-wheel/ColorWheel.generated.js +4 -1
- package/dist/components/color-wheel/ComplexColorWheel.css +1 -1
- package/dist/components/color-wheel/ComplexColorWheel.generated.js +180 -173
- package/dist/components/color-wheel-flower/ColorWheelFlower.css +84 -3
- package/dist/components/color-wheel-flower/ColorWheelFlower.generated.d.ts +2 -0
- package/dist/components/color-wheel-flower/ColorWheelFlower.generated.js +18 -247
- package/dist/components/dropdown/Dropdown.generated.js +5 -3
- package/dist/components/inline-edit/InlineEdit.generated.js +19 -15
- package/dist/components/language-switcher/LanguageSwitcher.generated.d.ts +2 -0
- package/dist/components/panel-toggle/PanelToggle.css +72 -0
- package/dist/components/panel-toggle/PanelToggle.generated.d.ts +18 -0
- package/dist/components/panel-toggle/PanelToggle.generated.js +41 -0
- package/dist/components/panel-toggle/PanelToggle.recipe.d.ts +21 -0
- package/dist/components/panel-toggle/PanelToggle.recipe.js +45 -0
- package/dist/components/panel-toggle/index.d.ts +2 -0
- package/dist/components/panel-toggle/index.js +2 -0
- package/dist/components/select/Select.generated.js +116 -88
- package/dist/components/slider/Slider.generated.js +11 -4
- package/dist/components/tabs/Tabs.css +5 -0
- package/dist/components/tabs/Tabs.generated.js +4 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/layouts.manifest.json +4 -1
- package/dist/motion/engine.js +11 -5
- package/dist/purge-manifest.json +106 -8
- package/package.json +5 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent, insert, memo, mergeProps,
|
|
1
|
+
import { createComponent, insert, memo, mergeProps, spread, template } from "@solidjs/web";
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./ColorWheelFlower.css";
|
|
4
4
|
import { For, createMemo, createSignal, createTrackedEffect, onCleanup } from "solid-js";
|
|
@@ -9,7 +9,7 @@ import color_swatch_picker from "../color-swatch-picker/index.js";
|
|
|
9
9
|
import { useColorPickerContext } from "./colorWheelFlowerContext.js";
|
|
10
10
|
import { createColorFromHsl, parseColor, rgbToHex, rgbToHsl } from "./ColorUtils.js";
|
|
11
11
|
import { resolveColorWheelFlowerPalette } from "./ColorWheelFlower.palette.js";
|
|
12
|
-
import {
|
|
12
|
+
import { prefersReducedMotion } from "../../motion/index.js";
|
|
13
13
|
import { CLASSES, componentRecipe } from "./ColorWheelFlower.recipe.js";
|
|
14
14
|
import { flowerPetalPosition } from "./ColorWheelFlower.geometry.js";
|
|
15
15
|
var _tmpl$ = /*#__PURE__*/ template("<div><div><div><div>"), _tmpl$2 = /*#__PURE__*/ template("<div><div><div><span></span><span>");
|
|
@@ -52,67 +52,6 @@ const createColorItem = (id, color, offsetX, offsetY, options)=>{
|
|
|
52
52
|
isCenter: options?.isCenter
|
|
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
|
-
};
|
|
62
|
-
const styles = getComputedStyle(el);
|
|
63
|
-
const opacityValue = Number.parseFloat(styles.opacity);
|
|
64
|
-
const opacity = Number.isFinite(opacityValue) ? opacityValue : 1;
|
|
65
|
-
const transform = styles.transform;
|
|
66
|
-
if (!transform || "none" === transform) return {
|
|
67
|
-
opacity,
|
|
68
|
-
x: 0,
|
|
69
|
-
y: 0,
|
|
70
|
-
scale: 1
|
|
71
|
-
};
|
|
72
|
-
if ("u" > typeof DOMMatrixReadOnly) {
|
|
73
|
-
const matrix = new DOMMatrixReadOnly(transform);
|
|
74
|
-
return {
|
|
75
|
-
opacity,
|
|
76
|
-
x: matrix.m41,
|
|
77
|
-
y: matrix.m42,
|
|
78
|
-
scale: matrix.a
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
const matrixMatch = transform.match(/matrix\(([^)]+)\)/);
|
|
82
|
-
if (!matrixMatch) return {
|
|
83
|
-
opacity,
|
|
84
|
-
x: 0,
|
|
85
|
-
y: 0,
|
|
86
|
-
scale: 1
|
|
87
|
-
};
|
|
88
|
-
const values = matrixMatch[1].split(",").map((value)=>Number.parseFloat(value.trim()));
|
|
89
|
-
return {
|
|
90
|
-
opacity,
|
|
91
|
-
scale: Number.isFinite(values[0]) ? values[0] : 1,
|
|
92
|
-
x: Number.isFinite(values[4]) ? values[4] : 0,
|
|
93
|
-
y: Number.isFinite(values[5]) ? values[5] : 0
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
const applyMotionState = (el, state)=>{
|
|
97
|
-
el.style.opacity = String(state.opacity ?? 1);
|
|
98
|
-
el.style.transform = `translate3d(${state.x ?? 0}px, ${state.y ?? 0}px, 0) scale(${state.scale ?? 1})`;
|
|
99
|
-
};
|
|
100
|
-
const getLiftOffset = (item, distance)=>{
|
|
101
|
-
const radius = Math.sqrt(item.offsetX ** 2 + item.offsetY ** 2);
|
|
102
|
-
if (!Number.isFinite(radius) || 0 === radius) return {
|
|
103
|
-
x: 0,
|
|
104
|
-
y: 0
|
|
105
|
-
};
|
|
106
|
-
return {
|
|
107
|
-
x: item.offsetX / radius * distance,
|
|
108
|
-
y: item.offsetY / radius * distance
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
const easeOutBack = (overshoot = 1.4)=>(t)=>{
|
|
112
|
-
const c1 = overshoot;
|
|
113
|
-
const c3 = c1 + 1;
|
|
114
|
-
return 1 + c3 * (t - 1) ** 3 + c1 * (t - 1) ** 2;
|
|
115
|
-
};
|
|
116
55
|
const toRgba = (rgb, alpha)=>{
|
|
117
56
|
const match = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
|
118
57
|
if (!match) return rgb;
|
|
@@ -291,19 +230,9 @@ function buildColors(palette) {
|
|
|
291
230
|
} : void 0));
|
|
292
231
|
}
|
|
293
232
|
const CENTER_INDEX = LAYOUT.findIndex((l)=>l.isCenter);
|
|
294
|
-
const MAX_RADIUS = Math.max(...LAYOUT.map((l)=>Math.sqrt(l.offsetX ** 2 + l.offsetY ** 2)));
|
|
295
|
-
const MAX_WAVE_DISTANCE = 2 * MAX_RADIUS;
|
|
296
|
-
const MAX_WAVE_DELAY = 0.12;
|
|
297
233
|
const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
298
234
|
const context = useColorPickerContext();
|
|
299
235
|
const [selectedIndex, setSelectedIndex] = createSignal(null);
|
|
300
|
-
const [hoveredIndex, setHoveredIndex] = createSignal(null);
|
|
301
|
-
const [pressedIndex, setPressedIndex] = createSignal(null);
|
|
302
|
-
const [pointer, setPointer] = createSignal({
|
|
303
|
-
x: 0,
|
|
304
|
-
y: 0,
|
|
305
|
-
active: false
|
|
306
|
-
});
|
|
307
236
|
const [pulseState, setPulseState] = createSignal(null);
|
|
308
237
|
const [currentTheme, setCurrentTheme] = createSignal("u" > typeof document && "dark" === document.documentElement.getAttribute("data-theme") ? "dark" : "light");
|
|
309
238
|
if ("u" > typeof window && "u" > typeof MutationObserver) {
|
|
@@ -322,12 +251,6 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
322
251
|
const mode = ()=>p.mode ?? currentTheme();
|
|
323
252
|
const colors = createMemo(()=>buildColors(resolveColorWheelFlowerPalette(mode(), p.palette)));
|
|
324
253
|
const reduceMotion = prefersReducedMotion();
|
|
325
|
-
reduceMotion || (motionDurations.slow, motionEasings.inOut);
|
|
326
|
-
const hoverLift = reduceMotion ? 0 : motionDistances.sm;
|
|
327
|
-
const pressScale = 0.96;
|
|
328
|
-
const pulseScale = 1.12;
|
|
329
|
-
let containerRef;
|
|
330
|
-
let pointerTimeout;
|
|
331
254
|
let pulseTimeout;
|
|
332
255
|
const closestIndex = createMemo(()=>{
|
|
333
256
|
const current = context.color();
|
|
@@ -401,48 +324,20 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
401
324
|
if (!selectedItem) return;
|
|
402
325
|
if (!isNearColor(current, selectedItem)) setSelectedIndex(null);
|
|
403
326
|
});
|
|
404
|
-
const handlePointerMove = (event)=>{
|
|
405
|
-
const node = containerRef;
|
|
406
|
-
if (!node) return;
|
|
407
|
-
const rect = node.getBoundingClientRect();
|
|
408
|
-
const x = event.clientX - rect.left - rect.width / 2;
|
|
409
|
-
const y = event.clientY - rect.top - rect.height / 2;
|
|
410
|
-
setPointer({
|
|
411
|
-
x,
|
|
412
|
-
y,
|
|
413
|
-
active: true
|
|
414
|
-
});
|
|
415
|
-
if (void 0 !== pointerTimeout) clearTimeout(pointerTimeout);
|
|
416
|
-
pointerTimeout = window.setTimeout(()=>{
|
|
417
|
-
setPointer((prev)=>({
|
|
418
|
-
...prev,
|
|
419
|
-
active: false
|
|
420
|
-
}));
|
|
421
|
-
}, 120);
|
|
422
|
-
};
|
|
423
|
-
const handlePointerLeave = ()=>{
|
|
424
|
-
setPointer((prev)=>({
|
|
425
|
-
...prev,
|
|
426
|
-
active: false
|
|
427
|
-
}));
|
|
428
|
-
setHoveredIndex(null);
|
|
429
|
-
if (void 0 !== pointerTimeout) clearTimeout(pointerTimeout);
|
|
430
|
-
};
|
|
431
327
|
onCleanup(()=>{
|
|
432
328
|
if (void 0 !== pulseTimeout) clearTimeout(pulseTimeout);
|
|
433
|
-
if (void 0 !== pointerTimeout) clearTimeout(pointerTimeout);
|
|
434
329
|
});
|
|
435
330
|
const pickerValue = ()=>colors()[visualSelectedIndex()]?.hex;
|
|
436
331
|
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
332
|
+
spread(_el$, mergeProps({
|
|
333
|
+
get id () {
|
|
334
|
+
return p.id;
|
|
335
|
+
}
|
|
336
|
+
}, ()=>({
|
|
440
337
|
class: twMerge(CLASSES.base, clsx({
|
|
441
338
|
[CLASSES.flag.disabled]: context.disabled()
|
|
442
339
|
}), p.class)
|
|
443
340
|
}), {
|
|
444
|
-
onMouseMove: handlePointerMove,
|
|
445
|
-
onMouseLeave: handlePointerLeave,
|
|
446
341
|
"data-slot": "color-wheel-flower",
|
|
447
342
|
get ["data-color-mode"] () {
|
|
448
343
|
return mode();
|
|
@@ -460,7 +355,11 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
460
355
|
spread(_el$4, mergeProps(()=>({
|
|
461
356
|
class: twMerge(CLASSES.ring.base, CLASSES.ring.inner)
|
|
462
357
|
})), false);
|
|
463
|
-
insert(_el$, createComponent(color_swatch_picker, mergeProps(
|
|
358
|
+
insert(_el$, createComponent(color_swatch_picker, mergeProps({
|
|
359
|
+
get id () {
|
|
360
|
+
return memo(()=>!!p.id)() ? `${p.id}-palette` : void 0;
|
|
361
|
+
}
|
|
362
|
+
}, ()=>({
|
|
464
363
|
class: CLASSES.picker
|
|
465
364
|
}), {
|
|
466
365
|
get value () {
|
|
@@ -477,112 +376,10 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
477
376
|
return colors();
|
|
478
377
|
},
|
|
479
378
|
children: (item, index)=>{
|
|
480
|
-
let motionRef;
|
|
481
|
-
let dotControl = null;
|
|
482
|
-
let hasPaintedFinalState = false;
|
|
483
|
-
const isHovered = ()=>hoveredIndex() === index();
|
|
484
|
-
const isPressed = ()=>pressedIndex() === index();
|
|
485
379
|
const isPulsing = ()=>pulseState()?.index === index();
|
|
486
|
-
const dotBaseTarget = createMemo(()=>{
|
|
487
|
-
if (context.disabled()) return {
|
|
488
|
-
opacity: 0.5,
|
|
489
|
-
scale: 1,
|
|
490
|
-
x: 0,
|
|
491
|
-
y: 0
|
|
492
|
-
};
|
|
493
|
-
const pointerState = pointer();
|
|
494
|
-
const anchorIdx = hoveredIndex();
|
|
495
|
-
let scale = 1;
|
|
496
|
-
let offsetX = 0;
|
|
497
|
-
let offsetY = 0;
|
|
498
|
-
if (null !== anchorIdx && pointerState.active) {
|
|
499
|
-
const anchor = colors()[anchorIdx];
|
|
500
|
-
const distance = Math.sqrt((item.offsetX - anchor.offsetX) ** 2 + (item.offsetY - anchor.offsetY) ** 2);
|
|
501
|
-
const waveRadius = 0.9 * MAX_RADIUS;
|
|
502
|
-
const influence = Math.max(0, 1 - distance / waveRadius);
|
|
503
|
-
if (influence > 0) {
|
|
504
|
-
const maxDelta = 16;
|
|
505
|
-
const deltaX = Math.max(-maxDelta, Math.min(maxDelta, pointerState.x - anchor.offsetX));
|
|
506
|
-
const deltaY = Math.max(-maxDelta, Math.min(maxDelta, pointerState.y - anchor.offsetY));
|
|
507
|
-
const waveStrength = isHovered() ? 0.25 : 0.18;
|
|
508
|
-
offsetX += deltaX * influence * waveStrength;
|
|
509
|
-
offsetY += deltaY * influence * waveStrength;
|
|
510
|
-
const liftStrength = isHovered() ? 0.8 : 0.35;
|
|
511
|
-
const lift = getLiftOffset(item, hoverLift * liftStrength);
|
|
512
|
-
offsetX += lift.x * influence;
|
|
513
|
-
offsetY += lift.y * influence;
|
|
514
|
-
const scaleBoost = isHovered() ? 0.06 : 0.03;
|
|
515
|
-
scale += influence * scaleBoost;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
return {
|
|
519
|
-
opacity: 1,
|
|
520
|
-
scale,
|
|
521
|
-
x: offsetX,
|
|
522
|
-
y: offsetY
|
|
523
|
-
};
|
|
524
|
-
});
|
|
525
|
-
const dotTarget = createMemo(()=>{
|
|
526
|
-
const base = dotBaseTarget();
|
|
527
|
-
let scale = base.scale ?? 1;
|
|
528
|
-
if (isPulsing()) scale *= pulseScale;
|
|
529
|
-
if (isPressed()) scale *= pressScale;
|
|
530
|
-
return {
|
|
531
|
-
...base,
|
|
532
|
-
scale
|
|
533
|
-
};
|
|
534
|
-
});
|
|
535
|
-
const glowOpacity = createMemo(()=>{
|
|
536
|
-
if (context.disabled()) return 0;
|
|
537
|
-
if (isHovered()) return 0.6;
|
|
538
|
-
if (isPulsing()) return 0.35;
|
|
539
|
-
return 0;
|
|
540
|
-
});
|
|
541
|
-
const dotTransition = ()=>{
|
|
542
|
-
if (reduceMotion) return {
|
|
543
|
-
duration: 0
|
|
544
|
-
};
|
|
545
|
-
const anchorIdx = hoveredIndex();
|
|
546
|
-
const pointerState = pointer();
|
|
547
|
-
let delay = 0;
|
|
548
|
-
if (null !== anchorIdx && pointerState.active) {
|
|
549
|
-
const anchor = colors()[anchorIdx];
|
|
550
|
-
const distance = Math.sqrt((item.offsetX - anchor.offsetX) ** 2 + (item.offsetY - anchor.offsetY) ** 2);
|
|
551
|
-
delay = Math.min(MAX_WAVE_DELAY, distance / MAX_WAVE_DISTANCE * MAX_WAVE_DELAY);
|
|
552
|
-
}
|
|
553
|
-
if (isPulsing()) return {
|
|
554
|
-
duration: motionDurations.fast,
|
|
555
|
-
easing: easeOutBack(1.25)
|
|
556
|
-
};
|
|
557
|
-
if (isHovered()) return {
|
|
558
|
-
duration: motionDurations.fast,
|
|
559
|
-
easing: motionEasings.out,
|
|
560
|
-
delay
|
|
561
|
-
};
|
|
562
|
-
return {
|
|
563
|
-
duration: motionDurations.base,
|
|
564
|
-
easing: motionEasings.out,
|
|
565
|
-
delay
|
|
566
|
-
};
|
|
567
|
-
};
|
|
568
|
-
createTrackedEffect(()=>{
|
|
569
|
-
if (!motionRef) return;
|
|
570
|
-
const target = dotTarget();
|
|
571
|
-
if (!hasPaintedFinalState) {
|
|
572
|
-
applyMotionState(motionRef, target);
|
|
573
|
-
hasPaintedFinalState = true;
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
const transition = dotTransition();
|
|
577
|
-
dotControl?.stop();
|
|
578
|
-
dotControl = runMotion(motionRef, readMotionState(motionRef), target, transition);
|
|
579
|
-
});
|
|
580
|
-
onCleanup(()=>{
|
|
581
|
-
dotControl?.stop();
|
|
582
|
-
});
|
|
583
380
|
var _el$5 = _tmpl$2(), _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling;
|
|
584
381
|
spread(_el$5, mergeProps(()=>({
|
|
585
|
-
class: CLASSES.dot.base
|
|
382
|
+
class: clsx(CLASSES.dot.base, isPulsing() && "color-wheel-flower__dot--pulsing")
|
|
586
383
|
}), {
|
|
587
384
|
get style () {
|
|
588
385
|
return flowerPetalPosition(item.offsetX, item.offsetY);
|
|
@@ -591,9 +388,6 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
591
388
|
spread(_el$6, mergeProps(()=>({
|
|
592
389
|
class: CLASSES.dot.frame
|
|
593
390
|
})), true);
|
|
594
|
-
ref(()=>(el)=>{
|
|
595
|
-
motionRef = el;
|
|
596
|
-
}, _el$7);
|
|
597
391
|
spread(_el$7, mergeProps(()=>({
|
|
598
392
|
class: CLASSES.dot.motion
|
|
599
393
|
})), true);
|
|
@@ -602,13 +396,14 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
602
396
|
}), {
|
|
603
397
|
get style () {
|
|
604
398
|
return {
|
|
605
|
-
|
|
606
|
-
"box-shadow": `0 0 8px ${toRgba(item.rgb, 0.3)}, 0 0 3px rgba(255,255,255,0.35)`,
|
|
607
|
-
transition: reduceMotion ? "none" : "opacity 200ms ease-out, box-shadow 200ms ease-out"
|
|
399
|
+
"box-shadow": `0 0 8px ${toRgba(item.rgb, 0.3)}, 0 0 3px rgba(255,255,255,0.35)`
|
|
608
400
|
};
|
|
609
401
|
}
|
|
610
402
|
}), false);
|
|
611
403
|
insert(_el$7, createComponent(color_swatch, mergeProps({
|
|
404
|
+
get id () {
|
|
405
|
+
return memo(()=>!!p.id)() ? `${p.id}-petal-${index()}` : void 0;
|
|
406
|
+
},
|
|
612
407
|
get color () {
|
|
613
408
|
return item.hex;
|
|
614
409
|
},
|
|
@@ -621,34 +416,10 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
621
416
|
},
|
|
622
417
|
get state () {
|
|
623
418
|
return context.disabled() ? "disabled" : void 0;
|
|
624
|
-
},
|
|
625
|
-
onMouseEnter: ()=>{
|
|
626
|
-
if (!context.disabled()) setHoveredIndex(index());
|
|
627
|
-
},
|
|
628
|
-
onMouseLeave: ()=>{
|
|
629
|
-
if (!context.disabled()) setHoveredIndex(null);
|
|
630
|
-
},
|
|
631
|
-
onFocus: ()=>{
|
|
632
|
-
if (!context.disabled()) setHoveredIndex(index());
|
|
633
|
-
},
|
|
634
|
-
onBlur: ()=>{
|
|
635
|
-
if (!context.disabled()) setHoveredIndex(null);
|
|
636
|
-
},
|
|
637
|
-
onPointerDown: ()=>{
|
|
638
|
-
if (!context.disabled()) setPressedIndex(index());
|
|
639
|
-
},
|
|
640
|
-
onPointerUp: ()=>{
|
|
641
|
-
if (!context.disabled()) setPressedIndex(null);
|
|
642
|
-
},
|
|
643
|
-
onPointerLeave: ()=>{
|
|
644
|
-
if (!context.disabled()) setPressedIndex(null);
|
|
645
|
-
},
|
|
646
|
-
onPointerCancel: ()=>{
|
|
647
|
-
if (!context.disabled()) setPressedIndex(null);
|
|
648
419
|
}
|
|
649
420
|
})), _el$9);
|
|
650
421
|
spread(_el$9, mergeProps(()=>({
|
|
651
|
-
class: clsx(CLASSES.highlight.base,
|
|
422
|
+
class: clsx(CLASSES.highlight.base, isPulsing() && CLASSES.highlight.pulsing)
|
|
652
423
|
})), false);
|
|
653
424
|
return _el$5;
|
|
654
425
|
}
|
|
@@ -22,9 +22,11 @@ const sortItemsByDomOrder = (items)=>[
|
|
|
22
22
|
});
|
|
23
23
|
const __solidLayoutDropdownRoot = (_stable, p)=>{
|
|
24
24
|
const others = omit(p, "children", "class", "open", "defaultOpen", "onOpenChange", "placement", "autoFlip", "disabled", "dataTheme", "ref");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
25
|
+
const generatedBaseId = createUniqueId();
|
|
26
|
+
const authoredBaseId = "string" == typeof p.id ? p.id.trim() : "";
|
|
27
|
+
const baseId = authoredBaseId || generatedBaseId;
|
|
28
|
+
const triggerId = `${baseId}--trigger`;
|
|
29
|
+
const menuId = `${baseId}--menu`;
|
|
28
30
|
const [internalOpen, setInternalOpen] = createSignal(Boolean(p.defaultOpen));
|
|
29
31
|
const [items, setItems] = createSignal([]);
|
|
30
32
|
const [focusedKey, setFocusedKey] = createSignal(void 0);
|
|
@@ -50,23 +50,27 @@ const __solidLayoutInlineEdit = (_stable, p)=>{
|
|
|
50
50
|
effect(()=>({
|
|
51
51
|
e: CLASSES.slot.read,
|
|
52
52
|
t: CLASSES.slot.value,
|
|
53
|
-
a: p.
|
|
54
|
-
o: p.
|
|
55
|
-
i:
|
|
56
|
-
n: CLASSES.slot.
|
|
57
|
-
s:
|
|
58
|
-
h: p.
|
|
59
|
-
r:
|
|
60
|
-
|
|
53
|
+
a: p.id ? `${p.id}-trigger` : void 0,
|
|
54
|
+
o: p.disabled,
|
|
55
|
+
i: p.label,
|
|
56
|
+
n: CLASSES.slot.trigger,
|
|
57
|
+
s: CLASSES.slot.edit,
|
|
58
|
+
h: p.id ? `${p.id}-field` : void 0,
|
|
59
|
+
r: p.value,
|
|
60
|
+
d: p.label,
|
|
61
|
+
l: twMerge(CLASSES.slot.field, p.fieldClass)
|
|
62
|
+
}), ({ e, t, a, o, i, n, s, h, r, d, l }, _p$)=>{
|
|
61
63
|
className(_el$2, e, _p$?.e);
|
|
62
64
|
className(_el$3, t, _p$?.t);
|
|
63
|
-
a !== _p$?.a && setAttribute(_el$4, "
|
|
64
|
-
o !== _p$?.o && setAttribute(_el$4, "
|
|
65
|
-
|
|
66
|
-
className(_el$
|
|
67
|
-
_el$
|
|
68
|
-
h !== _p$?.h && setAttribute(_el$6, "
|
|
69
|
-
|
|
65
|
+
a !== _p$?.a && setAttribute(_el$4, "id", a);
|
|
66
|
+
o !== _p$?.o && setAttribute(_el$4, "disabled", o);
|
|
67
|
+
i !== _p$?.i && setAttribute(_el$4, "aria-label", i);
|
|
68
|
+
className(_el$4, n, _p$?.n);
|
|
69
|
+
className(_el$5, s, _p$?.s);
|
|
70
|
+
h !== _p$?.h && setAttribute(_el$6, "id", h);
|
|
71
|
+
_el$6.value = r ?? "";
|
|
72
|
+
d !== _p$?.d && setAttribute(_el$6, "aria-label", d);
|
|
73
|
+
className(_el$6, l, _p$?.l);
|
|
70
74
|
});
|
|
71
75
|
return _el$;
|
|
72
76
|
};
|
|
@@ -4,6 +4,8 @@ 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 {
|
|
7
|
+
/** Stable identity for the native language control. */
|
|
8
|
+
id?: string;
|
|
7
9
|
/**
|
|
8
10
|
* The i18n store to use for language state
|
|
9
11
|
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.panel-toggle {
|
|
3
|
+
position: absolute;
|
|
4
|
+
top: 50%;
|
|
5
|
+
z-index: 20;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
width: 0.5rem;
|
|
8
|
+
height: 3rem;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
transform: translateY(-50%);
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
border: 1px solid color-mix(in oklab, var(--color-primary) 40%, transparent);
|
|
14
|
+
padding: 0;
|
|
15
|
+
background: color-mix(in oklab, var(--color-primary) 20%, transparent);
|
|
16
|
+
color: var(--color-primary);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
outline: none;
|
|
19
|
+
transition:
|
|
20
|
+
background-color 150ms ease,
|
|
21
|
+
border-color 150ms ease;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.panel-toggle:hover,
|
|
25
|
+
.panel-toggle[data-hovered="true"] {
|
|
26
|
+
border-color: color-mix(in oklab, var(--color-primary) 60%, transparent);
|
|
27
|
+
background: color-mix(in oklab, var(--color-primary) 30%, transparent);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.panel-toggle:focus-visible,
|
|
31
|
+
.panel-toggle[data-focus-visible="true"] {
|
|
32
|
+
outline: var(--focus-ring-width, 2px) solid var(--color-primary);
|
|
33
|
+
outline-offset: var(--focus-ring-offset, 2px);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.panel-toggle--right {
|
|
37
|
+
left: 100%;
|
|
38
|
+
border-left: 0;
|
|
39
|
+
border-radius: 0 0.5rem 0.5rem 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.panel-toggle--left {
|
|
43
|
+
right: 100%;
|
|
44
|
+
border-right: 0;
|
|
45
|
+
border-radius: 0.5rem 0 0 0.5rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.panel-toggle__indicator {
|
|
49
|
+
width: 0.375rem;
|
|
50
|
+
height: 0.375rem;
|
|
51
|
+
border-right: 0.125rem solid currentColor;
|
|
52
|
+
border-bottom: 0.125rem solid currentColor;
|
|
53
|
+
transition: transform 200ms ease;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.panel-toggle--right[data-expanded="true"] .panel-toggle__indicator,
|
|
57
|
+
.panel-toggle--left[data-expanded="false"] .panel-toggle__indicator {
|
|
58
|
+
transform: rotate(-45deg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.panel-toggle--right[data-expanded="false"] .panel-toggle__indicator,
|
|
62
|
+
.panel-toggle--left[data-expanded="true"] .panel-toggle__indicator {
|
|
63
|
+
transform: rotate(135deg);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media (prefers-reduced-motion: reduce) {
|
|
67
|
+
.panel-toggle,
|
|
68
|
+
.panel-toggle__indicator {
|
|
69
|
+
transition: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Component as __LayoutComponent } from "solid-js";
|
|
2
|
+
import "./PanelToggle.css";
|
|
3
|
+
import type { JSX } from "@solidjs/web";
|
|
4
|
+
import type { UIBaseProps } from "../vocabulary";
|
|
5
|
+
export type PanelToggleSide = "left" | "right";
|
|
6
|
+
export type PanelToggleProps = Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "id" | "aria-label" | "aria-expanded" | "type"> & UIBaseProps & {
|
|
7
|
+
/** Required so inspection and QA can address this control without its copy. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Whether the panel controlled by this gutter tab is visible. */
|
|
10
|
+
expanded: boolean;
|
|
11
|
+
/** The side of the content on which the controlled panel lives. */
|
|
12
|
+
side?: PanelToggleSide;
|
|
13
|
+
/** Names the action in the current state, for example “Hide details”. */
|
|
14
|
+
"aria-label": string;
|
|
15
|
+
/** The id of the panel this button expands and collapses. */
|
|
16
|
+
"aria-controls"?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const PanelToggleLayout: __LayoutComponent<PanelToggleProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { mergeProps, spread, template } from "@solidjs/web";
|
|
2
|
+
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
|
+
import "./PanelToggle.css";
|
|
4
|
+
import { omit } from "solid-js";
|
|
5
|
+
import { panelToggle } from "./PanelToggle.recipe.js";
|
|
6
|
+
var _tmpl$ = /*#__PURE__*/ template("<button><span>");
|
|
7
|
+
const __solidLayoutPanelToggleLayout = (_stable, p)=>{
|
|
8
|
+
const rest = omit(p, "id", "expanded", "side", "aria-label", "aria-controls", "children", "class", "style");
|
|
9
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild;
|
|
10
|
+
spread(_el$, mergeProps(rest, ()=>_stable.slot.root, {
|
|
11
|
+
get id () {
|
|
12
|
+
return p.id;
|
|
13
|
+
},
|
|
14
|
+
type: "button",
|
|
15
|
+
get ["aria-label"] () {
|
|
16
|
+
return p["aria-label"];
|
|
17
|
+
},
|
|
18
|
+
get ["aria-controls"] () {
|
|
19
|
+
return p["aria-controls"];
|
|
20
|
+
},
|
|
21
|
+
get ["aria-expanded"] () {
|
|
22
|
+
return p.expanded ? "true" : "false";
|
|
23
|
+
},
|
|
24
|
+
get ["data-expanded"] () {
|
|
25
|
+
return p.expanded ? "true" : "false";
|
|
26
|
+
},
|
|
27
|
+
get ["data-side"] () {
|
|
28
|
+
return p.side ?? "right";
|
|
29
|
+
}
|
|
30
|
+
}), true);
|
|
31
|
+
spread(_el$2, mergeProps(()=>_stable.slot.indicator, {
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
}), false);
|
|
34
|
+
return _el$;
|
|
35
|
+
};
|
|
36
|
+
const PanelToggleLayout = defineComponent({
|
|
37
|
+
recipe: panelToggle,
|
|
38
|
+
layout: __solidLayoutPanelToggleLayout,
|
|
39
|
+
embedded: true
|
|
40
|
+
});
|
|
41
|
+
export { PanelToggleLayout };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const panelToggle: import("solid-layouts/solid-2").Recipe<{
|
|
2
|
+
readonly component: "panel-toggle";
|
|
3
|
+
readonly element: "button";
|
|
4
|
+
readonly slots: {
|
|
5
|
+
readonly root: {
|
|
6
|
+
readonly base: "panel-toggle";
|
|
7
|
+
};
|
|
8
|
+
readonly indicator: {
|
|
9
|
+
readonly base: "panel-toggle__indicator";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
readonly props: {
|
|
13
|
+
readonly side: {
|
|
14
|
+
readonly left: "panel-toggle--left";
|
|
15
|
+
readonly right: "panel-toggle--right";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly defaults: {
|
|
19
|
+
readonly side: "right";
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { recipe } from "../../lib/layouts/index.js";
|
|
2
|
+
const panelToggle = recipe({
|
|
3
|
+
component: "panel-toggle",
|
|
4
|
+
element: "button",
|
|
5
|
+
slots: {
|
|
6
|
+
root: {
|
|
7
|
+
base: "panel-toggle"
|
|
8
|
+
},
|
|
9
|
+
indicator: {
|
|
10
|
+
base: "panel-toggle__indicator"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
side: {
|
|
15
|
+
left: "panel-toggle--left",
|
|
16
|
+
right: "panel-toggle--right"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaults: {
|
|
20
|
+
side: "right"
|
|
21
|
+
},
|
|
22
|
+
_layouts: {
|
|
23
|
+
slots: {
|
|
24
|
+
root: {
|
|
25
|
+
base: "panel-toggle",
|
|
26
|
+
axes: {
|
|
27
|
+
side: {
|
|
28
|
+
left: "panel-toggle--left",
|
|
29
|
+
right: "panel-toggle--right"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
indicator: {
|
|
34
|
+
base: "panel-toggle__indicator",
|
|
35
|
+
axes: {}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
stateKeys: [],
|
|
39
|
+
slotIds: {
|
|
40
|
+
root: 1,
|
|
41
|
+
indicator: 0
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export { panelToggle };
|