@pathscale/ui 2.11.5 → 2.11.6
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-flower/ColorWheelFlower.generated.js +10 -0
- package/dist/components/dropdown/Dropdown.css +1 -2
- package/dist/components/dropdown/Dropdown.generated.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.generated.js +38 -42
- package/dist/components/inline-edit/InlineEdit.generated.js +5 -7
- package/dist/components/inline-edit/InlineEdit.interactions.d.ts +3 -3
- package/dist/components/inline-edit/InlineEdit.interactions.js +11 -5
- package/dist/layouts.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -93,6 +93,10 @@ const readMotionState = (el)=>{
|
|
|
93
93
|
y: Number.isFinite(values[5]) ? values[5] : 0
|
|
94
94
|
};
|
|
95
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
|
+
};
|
|
96
100
|
const getLiftOffset = (item, distance)=>{
|
|
97
101
|
const radius = Math.sqrt(item.offsetX ** 2 + item.offsetY ** 2);
|
|
98
102
|
if (!Number.isFinite(radius) || 0 === radius) return {
|
|
@@ -475,6 +479,7 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
475
479
|
children: (item, index)=>{
|
|
476
480
|
let motionRef;
|
|
477
481
|
let dotControl = null;
|
|
482
|
+
let hasPaintedFinalState = false;
|
|
478
483
|
const isHovered = ()=>hoveredIndex() === index();
|
|
479
484
|
const isPressed = ()=>pressedIndex() === index();
|
|
480
485
|
const isPulsing = ()=>pulseState()?.index === index();
|
|
@@ -563,6 +568,11 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
|
|
|
563
568
|
createTrackedEffect(()=>{
|
|
564
569
|
if (!motionRef) return;
|
|
565
570
|
const target = dotTarget();
|
|
571
|
+
if (!hasPaintedFinalState) {
|
|
572
|
+
applyMotionState(motionRef, target);
|
|
573
|
+
hasPaintedFinalState = true;
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
566
576
|
const transition = dotTransition();
|
|
567
577
|
dotControl?.stop();
|
|
568
578
|
dotControl = runMotion(motionRef, readMotionState(motionRef), target, transition);
|
|
@@ -93,8 +93,7 @@
|
|
|
93
93
|
will-change: opacity, transform;
|
|
94
94
|
transition:
|
|
95
95
|
opacity 150ms cubic-bezier(0.22, 1, 0.36, 1),
|
|
96
|
-
transform 150ms cubic-bezier(0.22, 1, 0.36, 1)
|
|
97
|
-
visibility 150ms ease;
|
|
96
|
+
transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
.dropdown__popover[data-open="true"] {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component as __LayoutComponent } from "solid-js";
|
|
2
2
|
import "./Dropdown.css";
|
|
3
|
-
import {
|
|
3
|
+
import type { JSX } from "@solidjs/web";
|
|
4
4
|
import { type OverlayPlacement } from "../_shared/overlayPosition";
|
|
5
5
|
type DropdownAlign = "start" | "end";
|
|
6
6
|
type DropdownPlacement = OverlayPlacement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createComponent, insert, mergeProps, ref, spread, template } from "@solidjs/web";
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./Dropdown.css";
|
|
4
4
|
import { Show, createContext, createSignal, createTrackedEffect, createUniqueId, omit, onCleanup, onSettled, useContext } from "solid-js";
|
|
@@ -337,48 +337,44 @@ const __solidLayoutDropdownMenu = (_stable, p)=>{
|
|
|
337
337
|
return ctx.open();
|
|
338
338
|
},
|
|
339
339
|
get children () {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
get id () {
|
|
347
|
-
return ctx.menuId;
|
|
348
|
-
}
|
|
349
|
-
}, ()=>({
|
|
350
|
-
class: twMerge(CLASSES.slot.popover, p.class)
|
|
351
|
-
}), {
|
|
352
|
-
get role () {
|
|
353
|
-
return p.role ?? "menu";
|
|
354
|
-
},
|
|
355
|
-
"data-slot": "dropdown-popover",
|
|
356
|
-
get ["data-open"] () {
|
|
357
|
-
return ctx.open() ? "true" : "false";
|
|
358
|
-
},
|
|
359
|
-
get ["data-align"] () {
|
|
360
|
-
return p.align ?? "start";
|
|
361
|
-
},
|
|
362
|
-
get ["data-placement"] () {
|
|
363
|
-
return overlayPosition.placement();
|
|
364
|
-
},
|
|
365
|
-
get ["aria-hidden"] () {
|
|
366
|
-
return ctx.open() ? "false" : "true";
|
|
367
|
-
},
|
|
368
|
-
get style () {
|
|
369
|
-
return menuStyle();
|
|
370
|
-
},
|
|
371
|
-
onKeyDown: handleKeyDown
|
|
372
|
-
}), true);
|
|
373
|
-
spread(_el$7, mergeProps(()=>({
|
|
374
|
-
class: CLASSES.slot.menu
|
|
375
|
-
}), {
|
|
376
|
-
"data-slot": "dropdown-menu"
|
|
377
|
-
}), true);
|
|
378
|
-
insert(_el$7, ()=>p.children);
|
|
379
|
-
return _el$6;
|
|
340
|
+
var _el$6 = _tmpl$3(), _el$7 = _el$6.firstChild;
|
|
341
|
+
var _ref$ = ctx.setMenuRef;
|
|
342
|
+
"function" == typeof _ref$ || Array.isArray(_ref$) ? ref(()=>_ref$, _el$6) : ctx.setMenuRef = _el$6;
|
|
343
|
+
spread(_el$6, mergeProps(others, {
|
|
344
|
+
get id () {
|
|
345
|
+
return ctx.menuId;
|
|
380
346
|
}
|
|
381
|
-
})
|
|
347
|
+
}, ()=>({
|
|
348
|
+
class: twMerge(CLASSES.slot.popover, p.class)
|
|
349
|
+
}), {
|
|
350
|
+
get role () {
|
|
351
|
+
return p.role ?? "menu";
|
|
352
|
+
},
|
|
353
|
+
"data-slot": "dropdown-popover",
|
|
354
|
+
get ["data-open"] () {
|
|
355
|
+
return ctx.open() ? "true" : "false";
|
|
356
|
+
},
|
|
357
|
+
get ["data-align"] () {
|
|
358
|
+
return p.align ?? "start";
|
|
359
|
+
},
|
|
360
|
+
get ["data-placement"] () {
|
|
361
|
+
return overlayPosition.placement();
|
|
362
|
+
},
|
|
363
|
+
get ["aria-hidden"] () {
|
|
364
|
+
return ctx.open() ? "false" : "true";
|
|
365
|
+
},
|
|
366
|
+
get style () {
|
|
367
|
+
return menuStyle();
|
|
368
|
+
},
|
|
369
|
+
onKeyDown: handleKeyDown
|
|
370
|
+
}), true);
|
|
371
|
+
spread(_el$7, mergeProps(()=>({
|
|
372
|
+
class: CLASSES.slot.menu
|
|
373
|
+
}), {
|
|
374
|
+
"data-slot": "dropdown-menu"
|
|
375
|
+
}), true);
|
|
376
|
+
insert(_el$7, ()=>p.children);
|
|
377
|
+
return _el$6;
|
|
382
378
|
}
|
|
383
379
|
});
|
|
384
380
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addEvent, className, delegateEvents, effect, insert, mergeProps, ref, setAttribute, spread, template } from "@solidjs/web";
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./InlineEdit.css";
|
|
4
|
-
import {
|
|
4
|
+
import { createEffect, createSignal, omit, onSettled } from "solid-js";
|
|
5
5
|
import { twMerge } from "../../lib/twMerge.js";
|
|
6
6
|
import { bindInlineEditDismissals, createInlineEditInteractions } from "./InlineEdit.interactions.js";
|
|
7
7
|
import { CLASSES, componentRecipe } from "./InlineEdit.recipe.js";
|
|
@@ -10,19 +10,17 @@ const __solidLayoutInlineEdit = (_stable, p)=>{
|
|
|
10
10
|
const others = omit(p, "class", "value", "onCommit", "label", "trigger", "children", "fullWidth", "disabled", "fieldClass", "ref");
|
|
11
11
|
let root;
|
|
12
12
|
let field;
|
|
13
|
+
const [isOpen, setIsOpen] = createSignal(false);
|
|
13
14
|
const interactions = createInlineEditInteractions({
|
|
14
15
|
value: ()=>p.value,
|
|
15
16
|
disabled: ()=>Boolean(p.disabled),
|
|
16
17
|
root: ()=>root,
|
|
17
18
|
field: ()=>field,
|
|
18
|
-
|
|
19
|
+
onOpenChange: setIsOpen,
|
|
19
20
|
onCommit: (value)=>p.onCommit?.(value)
|
|
20
21
|
});
|
|
21
|
-
const rootClasses = ()=>twMerge(CLASSES.base,
|
|
22
|
-
|
|
23
|
-
p.value;
|
|
24
|
-
interactions.syncValue();
|
|
25
|
-
});
|
|
22
|
+
const rootClasses = ()=>twMerge(CLASSES.base, isOpen() && CLASSES.flag.editing, p.fullWidth && CLASSES.flag.fullWidth, p.disabled && CLASSES.flag.disabled, p.class);
|
|
23
|
+
createEffect(()=>p.value, (nextValue)=>interactions.syncValue(nextValue));
|
|
26
24
|
onSettled(()=>bindInlineEditDismissals(document, window, interactions.outside, interactions.windowBlur));
|
|
27
25
|
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild;
|
|
28
26
|
ref(()=>(element)=>{
|
|
@@ -3,9 +3,9 @@ export declare function bindInlineEditDismissals(documentSource: Pick<Document,
|
|
|
3
3
|
export type InlineEditInteractionOptions = {
|
|
4
4
|
value: () => string;
|
|
5
5
|
disabled: () => boolean;
|
|
6
|
-
root: () => Pick<HTMLElement, "
|
|
6
|
+
root: () => Pick<HTMLElement, "contains"> | undefined;
|
|
7
7
|
field: () => InlineEditField | undefined;
|
|
8
|
-
|
|
8
|
+
onOpenChange: (open: boolean) => void;
|
|
9
9
|
onCommit?: (value: string) => void | Promise<unknown>;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
@@ -25,6 +25,6 @@ export declare function createInlineEditInteractions(options: InlineEditInteract
|
|
|
25
25
|
blur: () => void;
|
|
26
26
|
outside: (target: EventTarget | null) => void;
|
|
27
27
|
windowBlur: () => void;
|
|
28
|
-
syncValue: () => void;
|
|
28
|
+
syncValue: (nextValue: string) => void;
|
|
29
29
|
keyDown: (key: string, preventDefault: () => void) => void;
|
|
30
30
|
};
|
|
@@ -2,10 +2,15 @@ function bindInlineEditDismissals(documentSource, windowSource, outside, windowB
|
|
|
2
2
|
const pointerDown = (event)=>{
|
|
3
3
|
outside(event.target);
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
const click = (event)=>{
|
|
6
|
+
outside(event.target);
|
|
7
|
+
};
|
|
8
|
+
documentSource.addEventListener("pointerdown", pointerDown, true);
|
|
9
|
+
documentSource.addEventListener("click", click, true);
|
|
6
10
|
windowSource.addEventListener("blur", windowBlur);
|
|
7
11
|
return ()=>{
|
|
8
|
-
documentSource.removeEventListener("pointerdown", pointerDown);
|
|
12
|
+
documentSource.removeEventListener("pointerdown", pointerDown, true);
|
|
13
|
+
documentSource.removeEventListener("click", click, true);
|
|
9
14
|
windowSource.removeEventListener("blur", windowBlur);
|
|
10
15
|
};
|
|
11
16
|
}
|
|
@@ -16,7 +21,7 @@ function createInlineEditInteractions(options) {
|
|
|
16
21
|
let sourceValue = options.value();
|
|
17
22
|
const apply = (next)=>{
|
|
18
23
|
open = next;
|
|
19
|
-
options.
|
|
24
|
+
options.onOpenChange(next);
|
|
20
25
|
};
|
|
21
26
|
const resetDraft = ()=>{
|
|
22
27
|
draft = options.value();
|
|
@@ -39,6 +44,7 @@ function createInlineEditInteractions(options) {
|
|
|
39
44
|
apply(false);
|
|
40
45
|
};
|
|
41
46
|
const commit = ()=>{
|
|
47
|
+
if (!open) return;
|
|
42
48
|
const next = draft.trim();
|
|
43
49
|
focused = false;
|
|
44
50
|
apply(false);
|
|
@@ -66,8 +72,8 @@ function createInlineEditInteractions(options) {
|
|
|
66
72
|
windowBlur: ()=>{
|
|
67
73
|
if (open) commit();
|
|
68
74
|
},
|
|
69
|
-
syncValue: ()=>{
|
|
70
|
-
if (open &&
|
|
75
|
+
syncValue: (nextValue)=>{
|
|
76
|
+
if (open && nextValue !== sourceValue) cancel();
|
|
71
77
|
},
|
|
72
78
|
keyDown: (key, preventDefault)=>{
|
|
73
79
|
if ("Enter" === key) {
|