dialkit 1.1.0 → 1.2.0
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/README.md +171 -1
- package/dist/index.cjs +876 -337
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -6
- package/dist/index.d.ts +41 -6
- package/dist/index.js +878 -341
- package/dist/index.js.map +1 -1
- package/dist/solid/index.cjs +1011 -544
- package/dist/solid/index.cjs.map +1 -1
- package/dist/solid/index.d.cts +33 -3
- package/dist/solid/index.d.ts +33 -3
- package/dist/solid/index.js +864 -398
- package/dist/solid/index.js.map +1 -1
- package/dist/store/index.cjs +52 -12
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +25 -3
- package/dist/store/index.d.ts +25 -3
- package/dist/store/index.js +52 -12
- package/dist/store/index.js.map +1 -1
- package/dist/styles.css +256 -25
- package/dist/svelte/components/ControlRenderer.svelte +12 -0
- package/dist/svelte/components/ControlRenderer.svelte.d.ts.map +1 -1
- package/dist/svelte/components/DialRoot.svelte +22 -8
- package/dist/svelte/components/DialRoot.svelte.d.ts +3 -0
- package/dist/svelte/components/DialRoot.svelte.d.ts.map +1 -1
- package/dist/svelte/components/Folder.svelte +17 -8
- package/dist/svelte/components/Folder.svelte.d.ts.map +1 -1
- package/dist/svelte/components/Panel.svelte +14 -9
- package/dist/svelte/components/Panel.svelte.d.ts.map +1 -1
- package/dist/svelte/components/PresetManager.svelte +7 -6
- package/dist/svelte/components/PresetManager.svelte.d.ts.map +1 -1
- package/dist/svelte/components/SegmentedControl.svelte +30 -74
- package/dist/svelte/components/SegmentedControl.svelte.d.ts.map +1 -1
- package/dist/svelte/components/SelectControl.svelte +2 -1
- package/dist/svelte/components/SelectControl.svelte.d.ts.map +1 -1
- package/dist/svelte/components/ShortcutListener.svelte +265 -0
- package/dist/svelte/components/ShortcutListener.svelte.d.ts +13 -0
- package/dist/svelte/components/ShortcutListener.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ShortcutsMenu.svelte +128 -0
- package/dist/svelte/components/ShortcutsMenu.svelte.d.ts +7 -0
- package/dist/svelte/components/ShortcutsMenu.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Slider.svelte +16 -29
- package/dist/svelte/components/Slider.svelte.d.ts +3 -0
- package/dist/svelte/components/Slider.svelte.d.ts.map +1 -1
- package/dist/svelte/components/SpringControl.svelte +17 -15
- package/dist/svelte/components/SpringControl.svelte.d.ts.map +1 -1
- package/dist/svelte/components/Toggle.svelte +13 -2
- package/dist/svelte/components/Toggle.svelte.d.ts +3 -0
- package/dist/svelte/components/Toggle.svelte.d.ts.map +1 -1
- package/dist/svelte/components/TransitionControl.svelte +28 -25
- package/dist/svelte/components/TransitionControl.svelte.d.ts.map +1 -1
- package/dist/svelte/createDialKit.svelte.d.ts +2 -1
- package/dist/svelte/createDialKit.svelte.d.ts.map +1 -1
- package/dist/svelte/createDialKit.svelte.js +1 -1
- package/dist/svelte/index.d.ts +6 -2
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +4 -0
- package/dist/svelte/theme-css.d.ts +1 -1
- package/dist/svelte/theme-css.d.ts.map +1 -1
- package/dist/svelte/theme-css.js +257 -26
- package/dist/vue/index.cjs +3056 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.cts +675 -0
- package/dist/vue/index.d.ts +675 -0
- package/dist/vue/index.js +3014 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +24 -4
package/dist/solid/index.js
CHANGED
|
@@ -14,22 +14,22 @@ var DialStoreClass = class {
|
|
|
14
14
|
this.activePreset = /* @__PURE__ */ new Map();
|
|
15
15
|
this.baseValues = /* @__PURE__ */ new Map();
|
|
16
16
|
}
|
|
17
|
-
registerPanel(id, name, config) {
|
|
18
|
-
const controls = this.parseConfig(config, "");
|
|
17
|
+
registerPanel(id, name, config, shortcuts) {
|
|
18
|
+
const controls = this.parseConfig(config, "", shortcuts);
|
|
19
19
|
const values = this.flattenValues(config, "");
|
|
20
20
|
this.initTransitionModes(config, "", values);
|
|
21
|
-
this.panels.set(id, { id, name, controls, values });
|
|
21
|
+
this.panels.set(id, { id, name, controls, values, shortcuts: shortcuts ?? {} });
|
|
22
22
|
this.snapshots.set(id, { ...values });
|
|
23
23
|
this.baseValues.set(id, { ...values });
|
|
24
24
|
this.notifyGlobal();
|
|
25
25
|
}
|
|
26
|
-
updatePanel(id, name, config) {
|
|
26
|
+
updatePanel(id, name, config, shortcuts) {
|
|
27
27
|
const existing = this.panels.get(id);
|
|
28
28
|
if (!existing) {
|
|
29
|
-
this.registerPanel(id, name, config);
|
|
29
|
+
this.registerPanel(id, name, config, shortcuts);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const controls = this.parseConfig(config, "");
|
|
32
|
+
const controls = this.parseConfig(config, "", shortcuts);
|
|
33
33
|
const controlsByPath = this.mapControlsByPath(controls);
|
|
34
34
|
const defaultValues = this.flattenValues(config, "");
|
|
35
35
|
const nextValues = {};
|
|
@@ -51,7 +51,7 @@ var DialStoreClass = class {
|
|
|
51
51
|
nextValues[path] = mode;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
const nextPanel = { id, name, controls, values: nextValues };
|
|
54
|
+
const nextPanel = { id, name, controls, values: nextValues, shortcuts: shortcuts ?? existing.shortcuts };
|
|
55
55
|
this.panels.set(id, nextPanel);
|
|
56
56
|
this.snapshots.set(id, { ...nextValues });
|
|
57
57
|
const previousBaseValues = this.baseValues.get(id) ?? {};
|
|
@@ -209,6 +209,44 @@ var DialStoreClass = class {
|
|
|
209
209
|
this.activePreset.set(panelId, null);
|
|
210
210
|
this.notify(panelId);
|
|
211
211
|
}
|
|
212
|
+
resolveShortcutTarget(key, modifier) {
|
|
213
|
+
for (const panel of this.panels.values()) {
|
|
214
|
+
for (const [path, shortcut] of Object.entries(panel.shortcuts)) {
|
|
215
|
+
if (!shortcut.key) continue;
|
|
216
|
+
if (shortcut.key.toLowerCase() !== key.toLowerCase()) continue;
|
|
217
|
+
const scMod = shortcut.modifier ?? void 0;
|
|
218
|
+
if (scMod !== modifier) continue;
|
|
219
|
+
const control = this.findControlByPath(panel.controls, path);
|
|
220
|
+
if (control) {
|
|
221
|
+
return { panelId: panel.id, path, control };
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
resolveScrollOnlyTargets() {
|
|
228
|
+
const results = [];
|
|
229
|
+
for (const panel of this.panels.values()) {
|
|
230
|
+
for (const [path, shortcut] of Object.entries(panel.shortcuts)) {
|
|
231
|
+
if ((shortcut.interaction ?? "scroll") !== "scroll-only") continue;
|
|
232
|
+
const control = this.findControlByPath(panel.controls, path);
|
|
233
|
+
if (control) {
|
|
234
|
+
results.push({ panelId: panel.id, path, control, shortcut });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return results;
|
|
239
|
+
}
|
|
240
|
+
findControlByPath(controls, path) {
|
|
241
|
+
for (const control of controls) {
|
|
242
|
+
if (control.path === path) return control;
|
|
243
|
+
if (control.type === "folder" && control.children) {
|
|
244
|
+
const found = this.findControlByPath(control.children, path);
|
|
245
|
+
if (found) return found;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
212
250
|
notify(panelId) {
|
|
213
251
|
this.listeners.get(panelId)?.forEach((fn) => fn());
|
|
214
252
|
}
|
|
@@ -230,12 +268,13 @@ var DialStoreClass = class {
|
|
|
230
268
|
}
|
|
231
269
|
}
|
|
232
270
|
}
|
|
233
|
-
parseConfig(config, prefix) {
|
|
271
|
+
parseConfig(config, prefix, shortcuts) {
|
|
234
272
|
const controls = [];
|
|
235
273
|
for (const [key, value] of Object.entries(config)) {
|
|
236
274
|
if (key === "_collapsed") continue;
|
|
237
275
|
const path = prefix ? `${prefix}.${key}` : key;
|
|
238
276
|
const label = this.formatLabel(key);
|
|
277
|
+
const shortcut = shortcuts?.[path];
|
|
239
278
|
if (Array.isArray(value) && value.length <= 4 && typeof value[0] === "number") {
|
|
240
279
|
controls.push({
|
|
241
280
|
type: "slider",
|
|
@@ -243,13 +282,14 @@ var DialStoreClass = class {
|
|
|
243
282
|
label,
|
|
244
283
|
min: value[1],
|
|
245
284
|
max: value[2],
|
|
246
|
-
step: value[3] ?? this.inferStep(value[1], value[2])
|
|
285
|
+
step: value[3] ?? this.inferStep(value[1], value[2]),
|
|
286
|
+
shortcut
|
|
247
287
|
});
|
|
248
288
|
} else if (typeof value === "number") {
|
|
249
289
|
const { min, max, step } = this.inferRange(value);
|
|
250
|
-
controls.push({ type: "slider", path, label, min, max, step });
|
|
290
|
+
controls.push({ type: "slider", path, label, min, max, step, shortcut });
|
|
251
291
|
} else if (typeof value === "boolean") {
|
|
252
|
-
controls.push({ type: "toggle", path, label });
|
|
292
|
+
controls.push({ type: "toggle", path, label, shortcut });
|
|
253
293
|
} else if (this.isSpringConfig(value) || this.isEasingConfig(value)) {
|
|
254
294
|
controls.push({ type: "transition", path, label });
|
|
255
295
|
} else if (this.isActionConfig(value)) {
|
|
@@ -274,7 +314,7 @@ var DialStoreClass = class {
|
|
|
274
314
|
path,
|
|
275
315
|
label,
|
|
276
316
|
defaultOpen,
|
|
277
|
-
children: this.parseConfig(folderConfig, path)
|
|
317
|
+
children: this.parseConfig(folderConfig, path, shortcuts)
|
|
278
318
|
});
|
|
279
319
|
}
|
|
280
320
|
}
|
|
@@ -431,7 +471,7 @@ function createDialKit(name, config, options) {
|
|
|
431
471
|
DialStore.getValues(panelId)
|
|
432
472
|
);
|
|
433
473
|
onMount(() => {
|
|
434
|
-
DialStore.registerPanel(panelId, name, config);
|
|
474
|
+
DialStore.registerPanel(panelId, name, config, options?.shortcuts);
|
|
435
475
|
setValues(DialStore.getValues(panelId));
|
|
436
476
|
const unsubValues = DialStore.subscribe(panelId, () => {
|
|
437
477
|
setValues(DialStore.getValues(panelId));
|
|
@@ -497,22 +537,373 @@ function getFirstOptionValue(options) {
|
|
|
497
537
|
// src/solid/components/DialRoot.tsx
|
|
498
538
|
import { template as _$template12 } from "solid-js/web";
|
|
499
539
|
import { memo as _$memo8 } from "solid-js/web";
|
|
500
|
-
import { setAttribute as _$
|
|
501
|
-
import { effect as _$
|
|
540
|
+
import { setAttribute as _$setAttribute9 } from "solid-js/web";
|
|
541
|
+
import { effect as _$effect11 } from "solid-js/web";
|
|
502
542
|
import { insert as _$insert12 } from "solid-js/web";
|
|
503
|
-
import { createComponent as _$
|
|
504
|
-
import { createSignal as
|
|
543
|
+
import { createComponent as _$createComponent11 } from "solid-js/web";
|
|
544
|
+
import { createSignal as createSignal11, onMount as onMount8, onCleanup as onCleanup9, Show as Show8, For as For5 } from "solid-js";
|
|
505
545
|
import { Portal as Portal3 } from "solid-js/web";
|
|
506
546
|
|
|
547
|
+
// src/solid/components/ShortcutListener.tsx
|
|
548
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
549
|
+
import { createContext, useContext, createSignal as createSignal2, onMount as onMount2, onCleanup as onCleanup2 } from "solid-js";
|
|
550
|
+
|
|
551
|
+
// src/shortcut-utils.ts
|
|
552
|
+
function decimalsForStep(step) {
|
|
553
|
+
const s = step.toString();
|
|
554
|
+
const dot = s.indexOf(".");
|
|
555
|
+
return dot === -1 ? 0 : s.length - dot - 1;
|
|
556
|
+
}
|
|
557
|
+
function roundValue(val, step) {
|
|
558
|
+
const raw = Math.round(val / step) * step;
|
|
559
|
+
return parseFloat(raw.toFixed(decimalsForStep(step)));
|
|
560
|
+
}
|
|
561
|
+
function getEffectiveStep(control, shortcut) {
|
|
562
|
+
const min = control.min ?? 0;
|
|
563
|
+
const max = control.max ?? 1;
|
|
564
|
+
const range = max - min;
|
|
565
|
+
const mode = shortcut.mode ?? "normal";
|
|
566
|
+
return mode === "fine" ? range * 0.01 : mode === "coarse" ? range * 0.1 : control.step ?? 1;
|
|
567
|
+
}
|
|
568
|
+
function applySliderDelta(panelId, path, control, effectiveStep, direction) {
|
|
569
|
+
const currentValue = DialStore.getValue(panelId, path);
|
|
570
|
+
const min = control.min ?? 0;
|
|
571
|
+
const max = control.max ?? 1;
|
|
572
|
+
const newValue = Math.max(min, Math.min(max, currentValue + direction * effectiveStep));
|
|
573
|
+
DialStore.updateValue(panelId, path, roundValue(newValue, effectiveStep));
|
|
574
|
+
}
|
|
575
|
+
function snapToDecile(rawValue, min, max) {
|
|
576
|
+
const normalized = (rawValue - min) / (max - min);
|
|
577
|
+
const nearest = Math.round(normalized * 10) / 10;
|
|
578
|
+
if (Math.abs(normalized - nearest) <= 0.03125) {
|
|
579
|
+
return min + nearest * (max - min);
|
|
580
|
+
}
|
|
581
|
+
return rawValue;
|
|
582
|
+
}
|
|
583
|
+
function isInputFocused() {
|
|
584
|
+
const el = document.activeElement;
|
|
585
|
+
if (!el) return false;
|
|
586
|
+
const tag = el.tagName;
|
|
587
|
+
if (tag === "INPUT" || tag === "TEXTAREA") return true;
|
|
588
|
+
if (el.contentEditable === "true") return true;
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
function getActiveModifier(e) {
|
|
592
|
+
if (e.altKey) return "alt";
|
|
593
|
+
if (e.shiftKey) return "shift";
|
|
594
|
+
if (e.metaKey) return "meta";
|
|
595
|
+
return void 0;
|
|
596
|
+
}
|
|
597
|
+
function findControl(controls, path) {
|
|
598
|
+
for (const control of controls) {
|
|
599
|
+
if (control.path === path) return control;
|
|
600
|
+
if (control.type === "folder" && control.children) {
|
|
601
|
+
const found = findControl(control.children, path);
|
|
602
|
+
if (found) return found;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return null;
|
|
606
|
+
}
|
|
607
|
+
var DRAG_SENSITIVITY = 4;
|
|
608
|
+
function formatInteractionLabel(interaction) {
|
|
609
|
+
switch (interaction) {
|
|
610
|
+
case "drag":
|
|
611
|
+
return "Drag";
|
|
612
|
+
case "move":
|
|
613
|
+
return "Move";
|
|
614
|
+
case "scroll-only":
|
|
615
|
+
return "Scroll";
|
|
616
|
+
default:
|
|
617
|
+
return "Scroll";
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function formatSliderShortcut(sc) {
|
|
621
|
+
const interaction = sc.interaction ?? "scroll";
|
|
622
|
+
const actionLabel = formatInteractionLabel(interaction);
|
|
623
|
+
if (!sc.key) return actionLabel;
|
|
624
|
+
const mod = formatModifier(sc.modifier);
|
|
625
|
+
return `${mod}${sc.key.toUpperCase()}+${actionLabel}`;
|
|
626
|
+
}
|
|
627
|
+
function formatToggleShortcut(sc) {
|
|
628
|
+
if (!sc.key) return "Press";
|
|
629
|
+
const mod = formatModifier(sc.modifier);
|
|
630
|
+
return `${mod}${sc.key.toUpperCase()}`;
|
|
631
|
+
}
|
|
632
|
+
function formatModifier(modifier) {
|
|
633
|
+
return modifier === "alt" ? "\u2325" : modifier === "shift" ? "\u21E7" : modifier === "meta" ? "\u2318" : "";
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// src/solid/components/ShortcutListener.tsx
|
|
637
|
+
var defaultState = {
|
|
638
|
+
activePanelId: null,
|
|
639
|
+
activePath: null
|
|
640
|
+
};
|
|
641
|
+
var ShortcutContext = createContext(() => defaultState);
|
|
642
|
+
function useShortcutContext() {
|
|
643
|
+
return useContext(ShortcutContext);
|
|
644
|
+
}
|
|
645
|
+
function ShortcutListener(props) {
|
|
646
|
+
const [activeShortcut, setActiveShortcut] = createSignal2(defaultState);
|
|
647
|
+
const activeKeys = /* @__PURE__ */ new Set();
|
|
648
|
+
let isDragging = false;
|
|
649
|
+
let lastMouseX = null;
|
|
650
|
+
let dragAccumulator = 0;
|
|
651
|
+
const resolveActiveTarget = (interaction) => {
|
|
652
|
+
for (const key of activeKeys) {
|
|
653
|
+
const panels = DialStore.getPanels();
|
|
654
|
+
for (const panel of panels) {
|
|
655
|
+
for (const [path, shortcut] of Object.entries(panel.shortcuts)) {
|
|
656
|
+
if (!shortcut.key) continue;
|
|
657
|
+
if (shortcut.key.toLowerCase() !== key) continue;
|
|
658
|
+
if ((shortcut.interaction ?? "scroll") !== interaction) continue;
|
|
659
|
+
const control = DialStore.getPanel(panel.id)?.controls ? findControl(panel.controls, path) : null;
|
|
660
|
+
if (control && control.type === "slider") {
|
|
661
|
+
return {
|
|
662
|
+
panelId: panel.id,
|
|
663
|
+
path,
|
|
664
|
+
control,
|
|
665
|
+
shortcut
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return null;
|
|
672
|
+
};
|
|
673
|
+
onMount2(() => {
|
|
674
|
+
const handleKeyDown = (e) => {
|
|
675
|
+
if (isInputFocused()) return;
|
|
676
|
+
const key = e.key.toLowerCase();
|
|
677
|
+
if (key === "arrowleft" || key === "arrowright" || key === "arrowup" || key === "arrowdown") {
|
|
678
|
+
if (activeKeys.size > 0) {
|
|
679
|
+
const target2 = resolveActiveTarget("scroll") || resolveActiveTarget("drag") || resolveActiveTarget("move");
|
|
680
|
+
if (target2 && target2.control.type === "slider") {
|
|
681
|
+
e.preventDefault();
|
|
682
|
+
const direction = key === "arrowright" || key === "arrowup" ? 1 : -1;
|
|
683
|
+
const effectiveStep = getEffectiveStep(target2.control, target2.shortcut);
|
|
684
|
+
applySliderDelta(target2.panelId, target2.path, target2.control, effectiveStep, direction);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const wasAlreadyHeld = activeKeys.has(key);
|
|
690
|
+
activeKeys.add(key);
|
|
691
|
+
const modifier = getActiveModifier(e);
|
|
692
|
+
const target = DialStore.resolveShortcutTarget(key, modifier);
|
|
693
|
+
if (target) {
|
|
694
|
+
setActiveShortcut({
|
|
695
|
+
activePanelId: target.panelId,
|
|
696
|
+
activePath: target.path
|
|
697
|
+
});
|
|
698
|
+
if (!wasAlreadyHeld && target.control.type === "toggle") {
|
|
699
|
+
const currentValue = DialStore.getValue(target.panelId, target.path);
|
|
700
|
+
DialStore.updateValue(target.panelId, target.path, !currentValue);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
if (!wasAlreadyHeld) {
|
|
704
|
+
lastMouseX = null;
|
|
705
|
+
dragAccumulator = 0;
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
const handleKeyUp = (e) => {
|
|
709
|
+
const key = e.key.toLowerCase();
|
|
710
|
+
activeKeys.delete(key);
|
|
711
|
+
isDragging = false;
|
|
712
|
+
lastMouseX = null;
|
|
713
|
+
dragAccumulator = 0;
|
|
714
|
+
if (activeKeys.size === 0) {
|
|
715
|
+
setActiveShortcut({
|
|
716
|
+
activePanelId: null,
|
|
717
|
+
activePath: null
|
|
718
|
+
});
|
|
719
|
+
} else {
|
|
720
|
+
let found = false;
|
|
721
|
+
for (const remainingKey of activeKeys) {
|
|
722
|
+
const modifier = getActiveModifier(e);
|
|
723
|
+
const target = DialStore.resolveShortcutTarget(remainingKey, modifier);
|
|
724
|
+
if (target) {
|
|
725
|
+
setActiveShortcut({
|
|
726
|
+
activePanelId: target.panelId,
|
|
727
|
+
activePath: target.path
|
|
728
|
+
});
|
|
729
|
+
found = true;
|
|
730
|
+
break;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
if (!found) {
|
|
734
|
+
setActiveShortcut({
|
|
735
|
+
activePanelId: null,
|
|
736
|
+
activePath: null
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
const handleWheel = (e) => {
|
|
742
|
+
if (isInputFocused()) return;
|
|
743
|
+
const modifier = getActiveModifier(e);
|
|
744
|
+
if (activeKeys.size > 0) {
|
|
745
|
+
for (const key of activeKeys) {
|
|
746
|
+
const target = DialStore.resolveShortcutTarget(key, modifier);
|
|
747
|
+
if (!target) continue;
|
|
748
|
+
const {
|
|
749
|
+
panelId,
|
|
750
|
+
path,
|
|
751
|
+
control
|
|
752
|
+
} = target;
|
|
753
|
+
const interaction = control.shortcut?.interaction ?? "scroll";
|
|
754
|
+
if (interaction !== "scroll" || control.type !== "slider") continue;
|
|
755
|
+
e.preventDefault();
|
|
756
|
+
const effectiveStep = getEffectiveStep(control, control.shortcut);
|
|
757
|
+
const direction = e.deltaY > 0 ? -1 : 1;
|
|
758
|
+
applySliderDelta(panelId, path, control, effectiveStep, direction);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
const scrollOnlyTargets = DialStore.resolveScrollOnlyTargets();
|
|
763
|
+
for (const {
|
|
764
|
+
panelId,
|
|
765
|
+
path,
|
|
766
|
+
control,
|
|
767
|
+
shortcut
|
|
768
|
+
} of scrollOnlyTargets) {
|
|
769
|
+
if (control.type !== "slider") continue;
|
|
770
|
+
e.preventDefault();
|
|
771
|
+
const effectiveStep = getEffectiveStep(control, shortcut);
|
|
772
|
+
const direction = e.deltaY > 0 ? -1 : 1;
|
|
773
|
+
applySliderDelta(panelId, path, control, effectiveStep, direction);
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
const handleMouseDown = (e) => {
|
|
778
|
+
if (isInputFocused()) return;
|
|
779
|
+
if (activeKeys.size === 0) return;
|
|
780
|
+
const target = resolveActiveTarget("drag");
|
|
781
|
+
if (target) {
|
|
782
|
+
isDragging = true;
|
|
783
|
+
lastMouseX = e.clientX;
|
|
784
|
+
dragAccumulator = 0;
|
|
785
|
+
e.preventDefault();
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
const handleMouseUp = () => {
|
|
789
|
+
isDragging = false;
|
|
790
|
+
lastMouseX = null;
|
|
791
|
+
dragAccumulator = 0;
|
|
792
|
+
};
|
|
793
|
+
const handleMouseMove = (e) => {
|
|
794
|
+
if (isInputFocused()) return;
|
|
795
|
+
if (activeKeys.size === 0) return;
|
|
796
|
+
if (isDragging) {
|
|
797
|
+
const target = resolveActiveTarget("drag");
|
|
798
|
+
if (target && lastMouseX !== null) {
|
|
799
|
+
const deltaX = e.clientX - lastMouseX;
|
|
800
|
+
lastMouseX = e.clientX;
|
|
801
|
+
dragAccumulator += deltaX;
|
|
802
|
+
const effectiveStep = getEffectiveStep(target.control, target.shortcut);
|
|
803
|
+
const steps = Math.trunc(dragAccumulator / DRAG_SENSITIVITY);
|
|
804
|
+
if (steps !== 0) {
|
|
805
|
+
dragAccumulator -= steps * DRAG_SENSITIVITY;
|
|
806
|
+
applySliderDelta(target.panelId, target.path, target.control, effectiveStep, steps);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
const moveTarget = resolveActiveTarget("move");
|
|
812
|
+
if (moveTarget) {
|
|
813
|
+
if (lastMouseX === null) {
|
|
814
|
+
lastMouseX = e.clientX;
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
const deltaX = e.clientX - lastMouseX;
|
|
818
|
+
lastMouseX = e.clientX;
|
|
819
|
+
dragAccumulator += deltaX;
|
|
820
|
+
const effectiveStep = getEffectiveStep(moveTarget.control, moveTarget.shortcut);
|
|
821
|
+
const steps = Math.trunc(dragAccumulator / DRAG_SENSITIVITY);
|
|
822
|
+
if (steps !== 0) {
|
|
823
|
+
dragAccumulator -= steps * DRAG_SENSITIVITY;
|
|
824
|
+
applySliderDelta(moveTarget.panelId, moveTarget.path, moveTarget.control, effectiveStep, steps);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
const handleWindowBlur = () => {
|
|
829
|
+
activeKeys.clear();
|
|
830
|
+
isDragging = false;
|
|
831
|
+
lastMouseX = null;
|
|
832
|
+
dragAccumulator = 0;
|
|
833
|
+
setActiveShortcut({
|
|
834
|
+
activePanelId: null,
|
|
835
|
+
activePath: null
|
|
836
|
+
});
|
|
837
|
+
};
|
|
838
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
839
|
+
window.addEventListener("keyup", handleKeyUp);
|
|
840
|
+
window.addEventListener("wheel", handleWheel, {
|
|
841
|
+
passive: false
|
|
842
|
+
});
|
|
843
|
+
window.addEventListener("mousedown", handleMouseDown);
|
|
844
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
845
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
846
|
+
window.addEventListener("blur", handleWindowBlur);
|
|
847
|
+
onCleanup2(() => {
|
|
848
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
849
|
+
window.removeEventListener("keyup", handleKeyUp);
|
|
850
|
+
window.removeEventListener("wheel", handleWheel);
|
|
851
|
+
window.removeEventListener("mousedown", handleMouseDown);
|
|
852
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
853
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
854
|
+
window.removeEventListener("blur", handleWindowBlur);
|
|
855
|
+
});
|
|
856
|
+
});
|
|
857
|
+
return _$createComponent(ShortcutContext.Provider, {
|
|
858
|
+
value: activeShortcut,
|
|
859
|
+
get children() {
|
|
860
|
+
return props.children;
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
|
|
507
865
|
// src/solid/components/Panel.tsx
|
|
508
866
|
import { template as _$template11 } from "solid-js/web";
|
|
509
867
|
import { delegateEvents as _$delegateEvents8 } from "solid-js/web";
|
|
868
|
+
import { setAttribute as _$setAttribute8 } from "solid-js/web";
|
|
869
|
+
import { effect as _$effect10 } from "solid-js/web";
|
|
510
870
|
import { use as _$use7 } from "solid-js/web";
|
|
511
871
|
import { insert as _$insert11 } from "solid-js/web";
|
|
872
|
+
import { createComponent as _$createComponent10 } from "solid-js/web";
|
|
512
873
|
import { memo as _$memo7 } from "solid-js/web";
|
|
513
|
-
import {
|
|
514
|
-
import {
|
|
515
|
-
|
|
874
|
+
import { createSignal as createSignal10, createEffect as createEffect7, onMount as onMount7, onCleanup as onCleanup8, For as For4 } from "solid-js";
|
|
875
|
+
import { animate as animate5 } from "motion";
|
|
876
|
+
|
|
877
|
+
// src/icons.ts
|
|
878
|
+
var ICON_CHEVRON = "M6 9.5L12 15.5L18 9.5";
|
|
879
|
+
var ICON_CHECK = "M5 12.75L10 19L19 5";
|
|
880
|
+
var ICON_CLIPBOARD = {
|
|
881
|
+
board: "M8 6C8 4.34315 9.34315 3 11 3H13C14.6569 3 16 4.34315 16 6V7H8V6Z",
|
|
882
|
+
sparkle: "M19.2405 16.1852L18.5436 14.3733C18.4571 14.1484 18.241 14 18 14C17.759 14 17.5429 14.1484 17.4564 14.3733L16.7595 16.1852C16.658 16.4493 16.4493 16.658 16.1852 16.7595L14.3733 17.4564C14.1484 17.5429 14 17.759 14 18C14 18.241 14.1484 18.4571 14.3733 18.5436L16.1852 19.2405C16.4493 19.342 16.658 19.5507 16.7595 19.8148L17.4564 21.6267C17.5429 21.8516 17.759 22 18 22C18.241 22 18.4571 21.8516 18.5436 21.6267L19.2405 19.8148C19.342 19.5507 19.5507 19.342 19.8148 19.2405L21.6267 18.5436C21.8516 18.4571 22 18.241 22 18C22 17.759 21.8516 17.5429 21.6267 17.4564L19.8148 16.7595C19.5507 16.658 19.342 16.4493 19.2405 16.1852Z",
|
|
883
|
+
body: "M16 5H17C18.6569 5 20 6.34315 20 8V11M8 5H7C5.34315 5 4 6.34315 4 8V18C4 19.6569 5.34315 21 7 21H12"
|
|
884
|
+
};
|
|
885
|
+
var ICON_ADD_PRESET = [
|
|
886
|
+
"M4 6H20",
|
|
887
|
+
"M4 12H10",
|
|
888
|
+
"M15 15L21 15",
|
|
889
|
+
"M18 12V18",
|
|
890
|
+
"M4 18H10"
|
|
891
|
+
];
|
|
892
|
+
var ICON_TRASH = [
|
|
893
|
+
"M5 6.5L5.80734 18.2064C5.91582 19.7794 7.22348 21 8.80023 21H15.1998C16.7765 21 18.0842 19.7794 18.1927 18.2064L19 6.5",
|
|
894
|
+
"M10 11V16",
|
|
895
|
+
"M14 11V16",
|
|
896
|
+
"M3.5 6H20.5",
|
|
897
|
+
"M8.07092 5.74621C8.42348 3.89745 10.0485 2.5 12 2.5C13.9515 2.5 15.5765 3.89745 15.9291 5.74621"
|
|
898
|
+
];
|
|
899
|
+
var ICON_PANEL = {
|
|
900
|
+
path: "M6.84766 11.75C6.78583 11.9899 6.75 12.2408 6.75 12.5C6.75 12.7592 6.78583 13.0101 6.84766 13.25H2C1.58579 13.25 1.25 12.9142 1.25 12.5C1.25 12.0858 1.58579 11.75 2 11.75H6.84766ZM14 11.75C14.4142 11.75 14.75 12.0858 14.75 12.5C14.75 12.9142 14.4142 13.25 14 13.25H12.6523C12.7142 13.0101 12.75 12.7592 12.75 12.5C12.75 12.2408 12.7142 11.9899 12.6523 11.75H14ZM3.09766 7.25C3.03583 7.48994 3 7.74075 3 8C3 8.25925 3.03583 8.51006 3.09766 8.75H2C1.58579 8.75 1.25 8.41421 1.25 8C1.25 7.58579 1.58579 7.25 2 7.25H3.09766ZM14 7.25C14.4142 7.25 14.75 7.58579 14.75 8C14.75 8.41421 14.4142 8.75 14 8.75H8.90234C8.96417 8.51006 9 8.25925 9 8C9 7.74075 8.96417 7.48994 8.90234 7.25H14ZM7.59766 2.75C7.53583 2.98994 7.5 3.24075 7.5 3.5C7.5 3.75925 7.53583 4.01006 7.59766 4.25H2C1.58579 4.25 1.25 3.91421 1.25 3.5C1.25 3.08579 1.58579 2.75 2 2.75H7.59766ZM14 2.75C14.4142 2.75 14.75 3.08579 14.75 3.5C14.75 3.91421 14.4142 4.25 14 4.25H13.4023C13.4642 4.01006 13.5 3.75925 13.5 3.5C13.5 3.24075 13.4642 2.98994 13.4023 2.75H14Z",
|
|
901
|
+
circles: [
|
|
902
|
+
{ cx: "6", cy: "8", r: "0.998596" },
|
|
903
|
+
{ cx: "10.4999", cy: "3.5", r: "0.998657" },
|
|
904
|
+
{ cx: "9.75015", cy: "12.5", r: "0.997986" }
|
|
905
|
+
]
|
|
906
|
+
};
|
|
516
907
|
|
|
517
908
|
// src/solid/components/Folder.tsx
|
|
518
909
|
import { template as _$template } from "solid-js/web";
|
|
@@ -521,26 +912,32 @@ import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
|
521
912
|
import { className as _$className } from "solid-js/web";
|
|
522
913
|
import { style as _$style } from "solid-js/web";
|
|
523
914
|
import { effect as _$effect } from "solid-js/web";
|
|
524
|
-
import { createComponent as _$
|
|
915
|
+
import { createComponent as _$createComponent2 } from "solid-js/web";
|
|
525
916
|
import { insert as _$insert } from "solid-js/web";
|
|
526
917
|
import { memo as _$memo } from "solid-js/web";
|
|
527
918
|
import { use as _$use } from "solid-js/web";
|
|
528
|
-
import { createSignal as
|
|
919
|
+
import { createSignal as createSignal3, createEffect, onCleanup as onCleanup3, Show } from "solid-js";
|
|
529
920
|
import { animate } from "motion";
|
|
530
921
|
var _tmpl$ = /* @__PURE__ */ _$template(`<div class=dialkit-panel-toolbar>`);
|
|
531
922
|
var _tmpl$2 = /* @__PURE__ */ _$template(`<div class=dialkit-folder-content><div class=dialkit-folder-inner>`);
|
|
532
923
|
var _tmpl$3 = /* @__PURE__ */ _$template(`<div><div><div class=dialkit-folder-header-top>`);
|
|
533
924
|
var _tmpl$4 = /* @__PURE__ */ _$template(`<div class=dialkit-folder-title-row><span class="dialkit-folder-title dialkit-folder-title-root">`);
|
|
534
925
|
var _tmpl$5 = /* @__PURE__ */ _$template(`<div class=dialkit-folder-title-row><span class=dialkit-folder-title>`);
|
|
535
|
-
var _tmpl$6 = /* @__PURE__ */ _$template(`<svg class=dialkit-panel-icon viewBox="0 0 16 16"fill=none><path opacity=0.5
|
|
536
|
-
var _tmpl$7 = /* @__PURE__ */ _$template(`<svg class=dialkit-folder-icon viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><path
|
|
926
|
+
var _tmpl$6 = /* @__PURE__ */ _$template(`<svg class=dialkit-panel-icon viewBox="0 0 16 16"fill=none><path opacity=0.5 fill=currentColor></path><circle fill=currentColor stroke=currentColor stroke-width=1.25></circle><circle fill=currentColor stroke=currentColor stroke-width=1.25></circle><circle fill=currentColor stroke=currentColor stroke-width=1.25>`);
|
|
927
|
+
var _tmpl$7 = /* @__PURE__ */ _$template(`<svg class=dialkit-folder-icon viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><path>`);
|
|
537
928
|
var _tmpl$8 = /* @__PURE__ */ _$template(`<div class="dialkit-panel-inner dialkit-panel-inline">`);
|
|
538
929
|
var _tmpl$9 = /* @__PURE__ */ _$template(`<div class=dialkit-panel-inner>`);
|
|
539
930
|
function Folder(props) {
|
|
540
|
-
const [isOpen, setIsOpen] =
|
|
541
|
-
const [isCollapsed, setIsCollapsed] =
|
|
542
|
-
const [contentHeight, setContentHeight] =
|
|
543
|
-
const [
|
|
931
|
+
const [isOpen, setIsOpen] = createSignal3(props.defaultOpen ?? true);
|
|
932
|
+
const [isCollapsed, setIsCollapsed] = createSignal3(!(props.defaultOpen ?? true));
|
|
933
|
+
const [contentHeight, setContentHeight] = createSignal3(void 0);
|
|
934
|
+
const [windowHeight, setWindowHeight] = createSignal3(typeof window !== "undefined" ? window.innerHeight : 800);
|
|
935
|
+
if (props.isRoot) {
|
|
936
|
+
const onResize = () => setWindowHeight(window.innerHeight);
|
|
937
|
+
window.addEventListener("resize", onResize);
|
|
938
|
+
onCleanup3(() => window.removeEventListener("resize", onResize));
|
|
939
|
+
}
|
|
940
|
+
const [contentMounted, setContentMounted] = createSignal3(props.defaultOpen ?? true);
|
|
544
941
|
let skipFirstAnim = props.defaultOpen ?? true;
|
|
545
942
|
let sectionContentRef;
|
|
546
943
|
let sectionAnim = null;
|
|
@@ -558,7 +955,7 @@ function Folder(props) {
|
|
|
558
955
|
setContentHeight((prev) => prev === h ? prev : h);
|
|
559
956
|
});
|
|
560
957
|
ro.observe(el);
|
|
561
|
-
|
|
958
|
+
onCleanup3(() => ro.disconnect());
|
|
562
959
|
});
|
|
563
960
|
createEffect(() => {
|
|
564
961
|
if (props.isRoot || !folderChevronRef) return;
|
|
@@ -576,7 +973,7 @@ function Folder(props) {
|
|
|
576
973
|
visualDuration: 0.35,
|
|
577
974
|
bounce: 0.15
|
|
578
975
|
});
|
|
579
|
-
|
|
976
|
+
onCleanup3(() => chevronAnim?.stop());
|
|
580
977
|
});
|
|
581
978
|
const handleToggle = () => {
|
|
582
979
|
if (props.inline && props.isRoot) return;
|
|
@@ -638,7 +1035,7 @@ function Folder(props) {
|
|
|
638
1035
|
_el$2.$$click = handleToggle;
|
|
639
1036
|
_$insert(_el$3, (() => {
|
|
640
1037
|
var _c$ = _$memo(() => !!props.isRoot);
|
|
641
|
-
return () => _c$() ? _$
|
|
1038
|
+
return () => _c$() ? _$createComponent2(Show, {
|
|
642
1039
|
get when() {
|
|
643
1040
|
return isOpen();
|
|
644
1041
|
},
|
|
@@ -655,18 +1052,47 @@ function Folder(props) {
|
|
|
655
1052
|
})(), null);
|
|
656
1053
|
_$insert(_el$3, (() => {
|
|
657
1054
|
var _c$2 = _$memo(() => !!(props.isRoot && !props.inline));
|
|
658
|
-
return () => _c$2() &&
|
|
1055
|
+
return () => _c$2() && (() => {
|
|
1056
|
+
var _el$1 = _tmpl$6(), _el$10 = _el$1.firstChild, _el$11 = _el$10.nextSibling, _el$12 = _el$11.nextSibling, _el$13 = _el$12.nextSibling;
|
|
1057
|
+
_$effect((_p$) => {
|
|
1058
|
+
var _v$3 = ICON_PANEL.path, _v$4 = ICON_PANEL.circles[0].cx, _v$5 = ICON_PANEL.circles[0].cy, _v$6 = ICON_PANEL.circles[0].r, _v$7 = ICON_PANEL.circles[1].cx, _v$8 = ICON_PANEL.circles[1].cy, _v$9 = ICON_PANEL.circles[1].r, _v$0 = ICON_PANEL.circles[2].cx, _v$1 = ICON_PANEL.circles[2].cy, _v$10 = ICON_PANEL.circles[2].r;
|
|
1059
|
+
_v$3 !== _p$.e && _$setAttribute(_el$10, "d", _p$.e = _v$3);
|
|
1060
|
+
_v$4 !== _p$.t && _$setAttribute(_el$11, "cx", _p$.t = _v$4);
|
|
1061
|
+
_v$5 !== _p$.a && _$setAttribute(_el$11, "cy", _p$.a = _v$5);
|
|
1062
|
+
_v$6 !== _p$.o && _$setAttribute(_el$11, "r", _p$.o = _v$6);
|
|
1063
|
+
_v$7 !== _p$.i && _$setAttribute(_el$12, "cx", _p$.i = _v$7);
|
|
1064
|
+
_v$8 !== _p$.n && _$setAttribute(_el$12, "cy", _p$.n = _v$8);
|
|
1065
|
+
_v$9 !== _p$.s && _$setAttribute(_el$12, "r", _p$.s = _v$9);
|
|
1066
|
+
_v$0 !== _p$.h && _$setAttribute(_el$13, "cx", _p$.h = _v$0);
|
|
1067
|
+
_v$1 !== _p$.r && _$setAttribute(_el$13, "cy", _p$.r = _v$1);
|
|
1068
|
+
_v$10 !== _p$.d && _$setAttribute(_el$13, "r", _p$.d = _v$10);
|
|
1069
|
+
return _p$;
|
|
1070
|
+
}, {
|
|
1071
|
+
e: void 0,
|
|
1072
|
+
t: void 0,
|
|
1073
|
+
a: void 0,
|
|
1074
|
+
o: void 0,
|
|
1075
|
+
i: void 0,
|
|
1076
|
+
n: void 0,
|
|
1077
|
+
s: void 0,
|
|
1078
|
+
h: void 0,
|
|
1079
|
+
r: void 0,
|
|
1080
|
+
d: void 0
|
|
1081
|
+
});
|
|
1082
|
+
return _el$1;
|
|
1083
|
+
})();
|
|
659
1084
|
})(), null);
|
|
660
1085
|
_$insert(_el$3, (() => {
|
|
661
1086
|
var _c$3 = _$memo(() => !!!props.isRoot);
|
|
662
1087
|
return () => _c$3() && (() => {
|
|
663
|
-
var _el$
|
|
1088
|
+
var _el$14 = _tmpl$7(), _el$15 = _el$14.firstChild;
|
|
664
1089
|
var _ref$ = folderChevronRef;
|
|
665
|
-
typeof _ref$ === "function" ? _$use(_ref$, _el$
|
|
666
|
-
|
|
1090
|
+
typeof _ref$ === "function" ? _$use(_ref$, _el$14) : folderChevronRef = _el$14;
|
|
1091
|
+
_$setAttribute(_el$15, "d", ICON_CHEVRON);
|
|
1092
|
+
return _el$14;
|
|
667
1093
|
})();
|
|
668
1094
|
})(), null);
|
|
669
|
-
_$insert(_el$2, _$
|
|
1095
|
+
_$insert(_el$2, _$createComponent2(Show, {
|
|
670
1096
|
get when() {
|
|
671
1097
|
return _$memo(() => !!(props.isRoot && props.toolbar))() && isOpen();
|
|
672
1098
|
},
|
|
@@ -677,7 +1103,7 @@ function Folder(props) {
|
|
|
677
1103
|
return _el$4;
|
|
678
1104
|
}
|
|
679
1105
|
}), null);
|
|
680
|
-
_$insert(_el$, _$
|
|
1106
|
+
_$insert(_el$, _$createComponent2(Show, {
|
|
681
1107
|
get when() {
|
|
682
1108
|
return _$memo(() => !!props.isRoot)() ? isOpen() : contentMounted();
|
|
683
1109
|
},
|
|
@@ -726,9 +1152,9 @@ function Folder(props) {
|
|
|
726
1152
|
if (props.isRoot) {
|
|
727
1153
|
if (props.inline) {
|
|
728
1154
|
return (() => {
|
|
729
|
-
var _el$
|
|
730
|
-
_$insert(_el$
|
|
731
|
-
return _el$
|
|
1155
|
+
var _el$16 = _tmpl$8();
|
|
1156
|
+
_$insert(_el$16, folderContent);
|
|
1157
|
+
return _el$16;
|
|
732
1158
|
})();
|
|
733
1159
|
}
|
|
734
1160
|
let panelRef;
|
|
@@ -742,20 +1168,20 @@ function Folder(props) {
|
|
|
742
1168
|
handleToggle();
|
|
743
1169
|
};
|
|
744
1170
|
panelRef.addEventListener("click", handler);
|
|
745
|
-
|
|
1171
|
+
onCleanup3(() => panelRef.removeEventListener("click", handler));
|
|
746
1172
|
});
|
|
747
1173
|
createEffect(() => {
|
|
748
1174
|
if (!panelRef) return;
|
|
749
1175
|
const open = isOpen();
|
|
750
|
-
const measuredOpenHeight = contentHeight() !== void 0 ? contentHeight() +
|
|
1176
|
+
const measuredOpenHeight = contentHeight() !== void 0 ? Math.min(contentHeight() + 10, windowHeight() - 32) : panelRef.getBoundingClientRect().height;
|
|
751
1177
|
const target = {
|
|
752
1178
|
width: open ? 280 : 42,
|
|
753
1179
|
height: open ? measuredOpenHeight : 42,
|
|
754
1180
|
borderRadius: open ? 14 : 21,
|
|
755
|
-
boxShadow: open ? "
|
|
1181
|
+
boxShadow: open ? "var(--dial-shadow)" : "var(--dial-shadow-collapsed)"
|
|
756
1182
|
};
|
|
757
1183
|
panelRef.style.cursor = open ? "" : "pointer";
|
|
758
|
-
panelRef.style.overflow = open ? "" : "hidden";
|
|
1184
|
+
panelRef.style.overflow = open ? "hidden auto" : "hidden";
|
|
759
1185
|
if (!rootPanelInitialized) {
|
|
760
1186
|
rootPanelInitialized = true;
|
|
761
1187
|
panelRef.style.width = `${target.width}px`;
|
|
@@ -782,13 +1208,13 @@ function Folder(props) {
|
|
|
782
1208
|
panelRef.style.height = `${target.height}px`;
|
|
783
1209
|
}
|
|
784
1210
|
});
|
|
785
|
-
|
|
1211
|
+
onCleanup3(() => {
|
|
786
1212
|
rootPanelAnim?.stop();
|
|
787
1213
|
panelTapAnim?.stop();
|
|
788
1214
|
});
|
|
789
1215
|
return (() => {
|
|
790
|
-
var _el$
|
|
791
|
-
_el$
|
|
1216
|
+
var _el$17 = _tmpl$9();
|
|
1217
|
+
_el$17.addEventListener("pointerleave", () => {
|
|
792
1218
|
if (isOpen()) return;
|
|
793
1219
|
panelTapAnim?.stop();
|
|
794
1220
|
panelTapAnim = animate(panelRef, {
|
|
@@ -799,7 +1225,7 @@ function Folder(props) {
|
|
|
799
1225
|
bounce: 0.3
|
|
800
1226
|
});
|
|
801
1227
|
});
|
|
802
|
-
_el$
|
|
1228
|
+
_el$17.addEventListener("pointercancel", () => {
|
|
803
1229
|
if (isOpen()) return;
|
|
804
1230
|
panelTapAnim?.stop();
|
|
805
1231
|
panelTapAnim = animate(panelRef, {
|
|
@@ -810,7 +1236,7 @@ function Folder(props) {
|
|
|
810
1236
|
bounce: 0.3
|
|
811
1237
|
});
|
|
812
1238
|
});
|
|
813
|
-
_el$
|
|
1239
|
+
_el$17.$$pointerup = () => {
|
|
814
1240
|
if (isOpen()) return;
|
|
815
1241
|
panelTapAnim?.stop();
|
|
816
1242
|
panelTapAnim = animate(panelRef, {
|
|
@@ -821,7 +1247,7 @@ function Folder(props) {
|
|
|
821
1247
|
bounce: 0.3
|
|
822
1248
|
});
|
|
823
1249
|
};
|
|
824
|
-
_el$
|
|
1250
|
+
_el$17.$$pointerdown = () => {
|
|
825
1251
|
if (isOpen()) return;
|
|
826
1252
|
document.activeElement?.blur?.();
|
|
827
1253
|
panelTapAnim?.stop();
|
|
@@ -834,10 +1260,10 @@ function Folder(props) {
|
|
|
834
1260
|
});
|
|
835
1261
|
};
|
|
836
1262
|
var _ref$2 = panelRef;
|
|
837
|
-
typeof _ref$2 === "function" ? _$use(_ref$2, _el$
|
|
838
|
-
_$insert(_el$
|
|
839
|
-
_$effect(() => _$setAttribute(_el$
|
|
840
|
-
return _el$
|
|
1263
|
+
typeof _ref$2 === "function" ? _$use(_ref$2, _el$17) : panelRef = _el$17;
|
|
1264
|
+
_$insert(_el$17, folderContent);
|
|
1265
|
+
_$effect(() => _$setAttribute(_el$17, "data-collapsed", String(isCollapsed())));
|
|
1266
|
+
return _el$17;
|
|
841
1267
|
})();
|
|
842
1268
|
}
|
|
843
1269
|
return folderContent();
|
|
@@ -847,39 +1273,23 @@ _$delegateEvents(["click", "pointerdown", "pointerup"]);
|
|
|
847
1273
|
// src/solid/components/Slider.tsx
|
|
848
1274
|
import { template as _$template2 } from "solid-js/web";
|
|
849
1275
|
import { delegateEvents as _$delegateEvents2 } from "solid-js/web";
|
|
1276
|
+
import { memo as _$memo2 } from "solid-js/web";
|
|
1277
|
+
import { createComponent as _$createComponent3 } from "solid-js/web";
|
|
850
1278
|
import { className as _$className2 } from "solid-js/web";
|
|
851
1279
|
import { effect as _$effect2 } from "solid-js/web";
|
|
852
|
-
import { memo as _$memo2 } from "solid-js/web";
|
|
853
1280
|
import { insert as _$insert2 } from "solid-js/web";
|
|
854
1281
|
import { use as _$use2 } from "solid-js/web";
|
|
855
1282
|
import { setStyleProperty as _$setStyleProperty } from "solid-js/web";
|
|
856
|
-
import { createSignal as
|
|
1283
|
+
import { createSignal as createSignal4, createEffect as createEffect2, onMount as onMount3, onCleanup as onCleanup4, Show as Show2 } from "solid-js";
|
|
857
1284
|
import { animate as animate2, motionValue } from "motion";
|
|
858
1285
|
var _tmpl$10 = /* @__PURE__ */ _$template2(`<div class=dialkit-slider-hashmark>`);
|
|
859
|
-
var _tmpl$22 = /* @__PURE__ */ _$template2(`<
|
|
860
|
-
var _tmpl$32 = /* @__PURE__ */ _$template2(`<
|
|
861
|
-
var _tmpl$42 = /* @__PURE__ */ _$template2(`<
|
|
1286
|
+
var _tmpl$22 = /* @__PURE__ */ _$template2(`<span>`);
|
|
1287
|
+
var _tmpl$32 = /* @__PURE__ */ _$template2(`<div class=dialkit-slider-wrapper><div><div class=dialkit-slider-hashmarks></div><div class=dialkit-slider-fill></div><div class=dialkit-slider-handle style="transform:translateY(-50%) scaleX(0.25) scaleY(1);opacity:0"></div><span class=dialkit-slider-label>`);
|
|
1288
|
+
var _tmpl$42 = /* @__PURE__ */ _$template2(`<input type=text class=dialkit-slider-input>`);
|
|
862
1289
|
var CLICK_THRESHOLD = 3;
|
|
863
1290
|
var DEAD_ZONE = 32;
|
|
864
1291
|
var MAX_CURSOR_RANGE = 200;
|
|
865
1292
|
var MAX_STRETCH = 8;
|
|
866
|
-
function decimalsForStep(step) {
|
|
867
|
-
const s = step.toString();
|
|
868
|
-
const dot = s.indexOf(".");
|
|
869
|
-
return dot === -1 ? 0 : s.length - dot - 1;
|
|
870
|
-
}
|
|
871
|
-
function roundValue(val, step) {
|
|
872
|
-
const raw = Math.round(val / step) * step;
|
|
873
|
-
return parseFloat(raw.toFixed(decimalsForStep(step)));
|
|
874
|
-
}
|
|
875
|
-
function snapToDecile(rawValue, min, max) {
|
|
876
|
-
const normalized = (rawValue - min) / (max - min);
|
|
877
|
-
const nearest = Math.round(normalized * 10) / 10;
|
|
878
|
-
if (Math.abs(normalized - nearest) <= 0.03125) {
|
|
879
|
-
return min + nearest * (max - min);
|
|
880
|
-
}
|
|
881
|
-
return rawValue;
|
|
882
|
-
}
|
|
883
1293
|
function Slider(props) {
|
|
884
1294
|
const min = () => props.min ?? 0;
|
|
885
1295
|
const max = () => props.max ?? 1;
|
|
@@ -891,13 +1301,13 @@ function Slider(props) {
|
|
|
891
1301
|
let labelRef;
|
|
892
1302
|
let valueSpanRef;
|
|
893
1303
|
let inputRef;
|
|
894
|
-
const [isInteracting, setIsInteracting] =
|
|
895
|
-
const [isDragging, setIsDragging] =
|
|
896
|
-
const [isHovered, setIsHovered] =
|
|
897
|
-
const [isValueHovered, setIsValueHovered] =
|
|
898
|
-
const [isValueEditable, setIsValueEditable] =
|
|
899
|
-
const [showInput, setShowInput] =
|
|
900
|
-
const [inputValue, setInputValue] =
|
|
1304
|
+
const [isInteracting, setIsInteracting] = createSignal4(false);
|
|
1305
|
+
const [isDragging, setIsDragging] = createSignal4(false);
|
|
1306
|
+
const [isHovered, setIsHovered] = createSignal4(false);
|
|
1307
|
+
const [isValueHovered, setIsValueHovered] = createSignal4(false);
|
|
1308
|
+
const [isValueEditable, setIsValueEditable] = createSignal4(false);
|
|
1309
|
+
const [showInput, setShowInput] = createSignal4(false);
|
|
1310
|
+
const [inputValue, setInputValue] = createSignal4("");
|
|
901
1311
|
const fillPercent = motionValue((props.value - min()) / (max() - min()) * 100);
|
|
902
1312
|
const rubberStretchPx = motionValue(0);
|
|
903
1313
|
const handleOpacityMv = motionValue(0);
|
|
@@ -1039,7 +1449,7 @@ function Slider(props) {
|
|
|
1039
1449
|
const hovered = isValueHovered();
|
|
1040
1450
|
const editing = showInput();
|
|
1041
1451
|
const editable = isValueEditable();
|
|
1042
|
-
|
|
1452
|
+
onCleanup4(() => {
|
|
1043
1453
|
if (hoverTimeout) {
|
|
1044
1454
|
clearTimeout(hoverTimeout);
|
|
1045
1455
|
hoverTimeout = null;
|
|
@@ -1051,7 +1461,7 @@ function Slider(props) {
|
|
|
1051
1461
|
setIsValueEditable(false);
|
|
1052
1462
|
}
|
|
1053
1463
|
});
|
|
1054
|
-
|
|
1464
|
+
onCleanup4(() => {
|
|
1055
1465
|
if (hoverTimeout) clearTimeout(hoverTimeout);
|
|
1056
1466
|
snapAnim?.stop();
|
|
1057
1467
|
rubberAnim?.stop();
|
|
@@ -1059,7 +1469,7 @@ function Slider(props) {
|
|
|
1059
1469
|
handleScaleXAnim?.stop();
|
|
1060
1470
|
handleScaleYAnim?.stop();
|
|
1061
1471
|
});
|
|
1062
|
-
|
|
1472
|
+
onMount3(() => {
|
|
1063
1473
|
const unsubFill = fillPercent.on("change", applyFillStyles);
|
|
1064
1474
|
const unsubRubber = rubberStretchPx.on("change", applyRubberStyles);
|
|
1065
1475
|
const unsubHandleOpacity = handleOpacityMv.on("change", applyHandleVisualStyles);
|
|
@@ -1068,7 +1478,7 @@ function Slider(props) {
|
|
|
1068
1478
|
applyFillStyles(fillPercent.get());
|
|
1069
1479
|
applyRubberStyles(rubberStretchPx.get());
|
|
1070
1480
|
applyHandleVisualStyles();
|
|
1071
|
-
|
|
1481
|
+
onCleanup4(() => {
|
|
1072
1482
|
unsubFill();
|
|
1073
1483
|
unsubRubber();
|
|
1074
1484
|
unsubHandleOpacity();
|
|
@@ -1153,7 +1563,6 @@ function Slider(props) {
|
|
|
1153
1563
|
bounce: 0.1
|
|
1154
1564
|
});
|
|
1155
1565
|
});
|
|
1156
|
-
const fillBackground = () => isActive() ? "rgba(255, 255, 255, 0.15)" : "rgba(255, 255, 255, 0.11)";
|
|
1157
1566
|
const discreteSteps = () => (max() - min()) / step();
|
|
1158
1567
|
const hashMarks = () => {
|
|
1159
1568
|
const ds = discreteSteps();
|
|
@@ -1181,7 +1590,7 @@ function Slider(props) {
|
|
|
1181
1590
|
});
|
|
1182
1591
|
};
|
|
1183
1592
|
return (() => {
|
|
1184
|
-
var _el$3 = _tmpl$
|
|
1593
|
+
var _el$3 = _tmpl$32(), _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$6.nextSibling, _el$8 = _el$7.nextSibling;
|
|
1185
1594
|
var _ref$ = wrapperRef;
|
|
1186
1595
|
typeof _ref$ === "function" ? _$use2(_ref$, _el$3) : wrapperRef = _el$3;
|
|
1187
1596
|
_el$4.addEventListener("mouseleave", () => setIsHovered(false));
|
|
@@ -1199,53 +1608,62 @@ function Slider(props) {
|
|
|
1199
1608
|
typeof _ref$4 === "function" ? _$use2(_ref$4, _el$7) : handleRef = _el$7;
|
|
1200
1609
|
var _ref$5 = labelRef;
|
|
1201
1610
|
typeof _ref$5 === "function" ? _$use2(_ref$5, _el$8) : labelRef = _el$8;
|
|
1202
|
-
_$insert2(_el$8, () => props.label);
|
|
1611
|
+
_$insert2(_el$8, () => props.label, null);
|
|
1612
|
+
_$insert2(_el$8, _$createComponent3(Show2, {
|
|
1613
|
+
get when() {
|
|
1614
|
+
return props.shortcut;
|
|
1615
|
+
},
|
|
1616
|
+
get children() {
|
|
1617
|
+
var _el$9 = _tmpl$22();
|
|
1618
|
+
_$insert2(_el$9, () => formatSliderShortcut(props.shortcut));
|
|
1619
|
+
_$effect2(() => _$className2(_el$9, `dialkit-shortcut-pill${props.shortcutActive ? " dialkit-shortcut-pill-active" : ""}`));
|
|
1620
|
+
return _el$9;
|
|
1621
|
+
}
|
|
1622
|
+
}), null);
|
|
1203
1623
|
_$insert2(_el$4, (() => {
|
|
1204
1624
|
var _c$ = _$memo2(() => !!showInput());
|
|
1205
1625
|
return () => _c$() ? (() => {
|
|
1206
|
-
var _el$
|
|
1207
|
-
_el$
|
|
1208
|
-
_el$
|
|
1209
|
-
_el$
|
|
1210
|
-
_el$
|
|
1211
|
-
_el$
|
|
1626
|
+
var _el$0 = _tmpl$42();
|
|
1627
|
+
_el$0.$$mousedown = (e) => e.stopPropagation();
|
|
1628
|
+
_el$0.$$click = (e) => e.stopPropagation();
|
|
1629
|
+
_el$0.addEventListener("blur", handleInputSubmit);
|
|
1630
|
+
_el$0.$$keydown = handleInputKeyDown;
|
|
1631
|
+
_el$0.$$input = (e) => setInputValue(e.currentTarget.value);
|
|
1212
1632
|
var _ref$6 = inputRef;
|
|
1213
|
-
typeof _ref$6 === "function" ? _$use2(_ref$6, _el$
|
|
1214
|
-
_$effect2(() => _el$
|
|
1215
|
-
return _el$
|
|
1633
|
+
typeof _ref$6 === "function" ? _$use2(_ref$6, _el$0) : inputRef = _el$0;
|
|
1634
|
+
_$effect2(() => _el$0.value = inputValue());
|
|
1635
|
+
return _el$0;
|
|
1216
1636
|
})() : (() => {
|
|
1217
|
-
var _el$
|
|
1218
|
-
_el$
|
|
1219
|
-
_el$
|
|
1220
|
-
_el$
|
|
1221
|
-
_el$
|
|
1637
|
+
var _el$1 = _tmpl$22();
|
|
1638
|
+
_el$1.$$mousedown = (e) => isValueEditable() && e.stopPropagation();
|
|
1639
|
+
_el$1.$$click = handleValueClick;
|
|
1640
|
+
_el$1.addEventListener("mouseleave", () => setIsValueHovered(false));
|
|
1641
|
+
_el$1.addEventListener("mouseenter", () => setIsValueHovered(true));
|
|
1222
1642
|
var _ref$7 = valueSpanRef;
|
|
1223
|
-
typeof _ref$7 === "function" ? _$use2(_ref$7, _el$
|
|
1224
|
-
_$insert2(_el$
|
|
1643
|
+
typeof _ref$7 === "function" ? _$use2(_ref$7, _el$1) : valueSpanRef = _el$1;
|
|
1644
|
+
_$insert2(_el$1, displayValue);
|
|
1225
1645
|
_$effect2((_p$) => {
|
|
1226
|
-
var _v$
|
|
1227
|
-
_v$
|
|
1228
|
-
_v$
|
|
1646
|
+
var _v$4 = `dialkit-slider-value ${isValueEditable() ? "dialkit-slider-value-editable" : ""}`, _v$5 = isValueEditable() ? "text" : "default";
|
|
1647
|
+
_v$4 !== _p$.e && _$className2(_el$1, _p$.e = _v$4);
|
|
1648
|
+
_v$5 !== _p$.t && _$setStyleProperty(_el$1, "cursor", _p$.t = _v$5);
|
|
1229
1649
|
return _p$;
|
|
1230
1650
|
}, {
|
|
1231
1651
|
e: void 0,
|
|
1232
1652
|
t: void 0
|
|
1233
1653
|
});
|
|
1234
|
-
return _el$
|
|
1654
|
+
return _el$1;
|
|
1235
1655
|
})();
|
|
1236
1656
|
})(), null);
|
|
1237
1657
|
_$effect2((_p$) => {
|
|
1238
|
-
var _v$ = `dialkit-slider ${isActive() ? "dialkit-slider-active" : ""}`, _v$2 =
|
|
1658
|
+
var _v$ = `dialkit-slider ${isActive() ? "dialkit-slider-active" : ""}`, _v$2 = `${fillPercent.get()}%`, _v$3 = `max(5px, calc(${fillPercent.get()}% - 9px))`;
|
|
1239
1659
|
_v$ !== _p$.e && _$className2(_el$4, _p$.e = _v$);
|
|
1240
|
-
_v$2 !== _p$.t && _$setStyleProperty(_el$6, "
|
|
1241
|
-
_v$3 !== _p$.a && _$setStyleProperty(_el$
|
|
1242
|
-
_v$4 !== _p$.o && _$setStyleProperty(_el$7, "left", _p$.o = _v$4);
|
|
1660
|
+
_v$2 !== _p$.t && _$setStyleProperty(_el$6, "width", _p$.t = _v$2);
|
|
1661
|
+
_v$3 !== _p$.a && _$setStyleProperty(_el$7, "left", _p$.a = _v$3);
|
|
1243
1662
|
return _p$;
|
|
1244
1663
|
}, {
|
|
1245
1664
|
e: void 0,
|
|
1246
1665
|
t: void 0,
|
|
1247
|
-
a: void 0
|
|
1248
|
-
o: void 0
|
|
1666
|
+
a: void 0
|
|
1249
1667
|
});
|
|
1250
1668
|
return _el$3;
|
|
1251
1669
|
})();
|
|
@@ -1254,9 +1672,12 @@ _$delegateEvents2(["pointerdown", "pointermove", "pointerup", "input", "keydown"
|
|
|
1254
1672
|
|
|
1255
1673
|
// src/solid/components/Toggle.tsx
|
|
1256
1674
|
import { template as _$template4 } from "solid-js/web";
|
|
1257
|
-
import { createComponent as _$createComponent3 } from "solid-js/web";
|
|
1258
1675
|
import { memo as _$memo3 } from "solid-js/web";
|
|
1676
|
+
import { createComponent as _$createComponent5 } from "solid-js/web";
|
|
1677
|
+
import { className as _$className3 } from "solid-js/web";
|
|
1678
|
+
import { effect as _$effect4 } from "solid-js/web";
|
|
1259
1679
|
import { insert as _$insert4 } from "solid-js/web";
|
|
1680
|
+
import { Show as Show4 } from "solid-js";
|
|
1260
1681
|
|
|
1261
1682
|
// src/solid/components/SegmentedControl.tsx
|
|
1262
1683
|
import { template as _$template3 } from "solid-js/web";
|
|
@@ -1265,114 +1686,98 @@ import { setAttribute as _$setAttribute2 } from "solid-js/web";
|
|
|
1265
1686
|
import { setStyleProperty as _$setStyleProperty2 } from "solid-js/web";
|
|
1266
1687
|
import { effect as _$effect3 } from "solid-js/web";
|
|
1267
1688
|
import { insert as _$insert3 } from "solid-js/web";
|
|
1268
|
-
import { createComponent as _$
|
|
1689
|
+
import { createComponent as _$createComponent4 } from "solid-js/web";
|
|
1269
1690
|
import { use as _$use3 } from "solid-js/web";
|
|
1270
|
-
import { createSignal as
|
|
1271
|
-
|
|
1272
|
-
var _tmpl$
|
|
1273
|
-
var _tmpl$
|
|
1691
|
+
import { createSignal as createSignal5, createEffect as createEffect3, For, Show as Show3 } from "solid-js";
|
|
1692
|
+
var _tmpl$11 = /* @__PURE__ */ _$template3(`<div class=dialkit-segmented>`);
|
|
1693
|
+
var _tmpl$23 = /* @__PURE__ */ _$template3(`<div class=dialkit-segmented-pill>`);
|
|
1694
|
+
var _tmpl$33 = /* @__PURE__ */ _$template3(`<button class=dialkit-segmented-button>`);
|
|
1274
1695
|
function SegmentedControl(props) {
|
|
1275
1696
|
let containerRef;
|
|
1276
|
-
let pillRef;
|
|
1277
|
-
const buttonRefs = /* @__PURE__ */ new Map();
|
|
1278
|
-
const [pillReady, setPillReady] = createSignal4(false);
|
|
1279
1697
|
let hasAnimated = false;
|
|
1280
|
-
|
|
1281
|
-
const
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
width: buttonRect.width
|
|
1289
|
-
};
|
|
1290
|
-
};
|
|
1291
|
-
const setPillImmediate = (left, width) => {
|
|
1292
|
-
if (!pillRef) return;
|
|
1293
|
-
pillRef.style.left = `${left}px`;
|
|
1294
|
-
pillRef.style.width = `${width}px`;
|
|
1295
|
-
};
|
|
1296
|
-
const updatePill = (shouldAnimate) => {
|
|
1297
|
-
const next = measurePill();
|
|
1298
|
-
if (!next) return;
|
|
1299
|
-
if (!pillReady()) {
|
|
1300
|
-
setPillImmediate(next.left, next.width);
|
|
1301
|
-
setPillReady(true);
|
|
1302
|
-
return;
|
|
1303
|
-
}
|
|
1304
|
-
if (!shouldAnimate || !hasAnimated) {
|
|
1305
|
-
pillAnim?.stop();
|
|
1306
|
-
pillAnim = null;
|
|
1307
|
-
setPillImmediate(next.left, next.width);
|
|
1308
|
-
return;
|
|
1309
|
-
}
|
|
1310
|
-
pillAnim?.stop();
|
|
1311
|
-
pillAnim = animate3(pillRef, {
|
|
1312
|
-
left: next.left,
|
|
1313
|
-
width: next.width
|
|
1314
|
-
}, {
|
|
1315
|
-
type: "spring",
|
|
1316
|
-
visualDuration: 0.2,
|
|
1317
|
-
bounce: 0.15,
|
|
1318
|
-
onComplete: () => {
|
|
1319
|
-
pillAnim = null;
|
|
1320
|
-
}
|
|
1698
|
+
const [pillStyle, setPillStyle] = createSignal5(null);
|
|
1699
|
+
const measure = () => {
|
|
1700
|
+
if (!containerRef) return;
|
|
1701
|
+
const activeButton = containerRef.querySelector('[data-active="true"]');
|
|
1702
|
+
if (!activeButton) return;
|
|
1703
|
+
setPillStyle({
|
|
1704
|
+
left: activeButton.offsetLeft,
|
|
1705
|
+
width: activeButton.offsetWidth
|
|
1321
1706
|
});
|
|
1322
1707
|
};
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1708
|
+
createEffect3(() => {
|
|
1709
|
+
void props.value;
|
|
1710
|
+
void props.options.length;
|
|
1711
|
+
measure();
|
|
1327
1712
|
});
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1713
|
+
const transition = () => {
|
|
1714
|
+
void props.value;
|
|
1715
|
+
if (!hasAnimated) {
|
|
1331
1716
|
hasAnimated = true;
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
onCleanup4(() => {
|
|
1337
|
-
pillAnim?.stop();
|
|
1338
|
-
ro.disconnect();
|
|
1339
|
-
});
|
|
1340
|
-
});
|
|
1717
|
+
return "none";
|
|
1718
|
+
}
|
|
1719
|
+
return "left 0.2s cubic-bezier(0.25, 1, 0.5, 1), width 0.2s cubic-bezier(0.25, 1, 0.5, 1)";
|
|
1720
|
+
};
|
|
1341
1721
|
return (() => {
|
|
1342
|
-
var _el$ = _tmpl$11()
|
|
1722
|
+
var _el$ = _tmpl$11();
|
|
1343
1723
|
var _ref$ = containerRef;
|
|
1344
1724
|
typeof _ref$ === "function" ? _$use3(_ref$, _el$) : containerRef = _el$;
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1725
|
+
_$insert3(_el$, _$createComponent4(Show3, {
|
|
1726
|
+
get when() {
|
|
1727
|
+
return pillStyle();
|
|
1728
|
+
},
|
|
1729
|
+
children: (style) => (() => {
|
|
1730
|
+
var _el$2 = _tmpl$23();
|
|
1731
|
+
_$effect3((_p$) => {
|
|
1732
|
+
var _v$ = `${style().left}px`, _v$2 = `${style().width}px`, _v$3 = transition();
|
|
1733
|
+
_v$ !== _p$.e && _$setStyleProperty2(_el$2, "left", _p$.e = _v$);
|
|
1734
|
+
_v$2 !== _p$.t && _$setStyleProperty2(_el$2, "width", _p$.t = _v$2);
|
|
1735
|
+
_v$3 !== _p$.a && _$setStyleProperty2(_el$2, "transition", _p$.a = _v$3);
|
|
1736
|
+
return _p$;
|
|
1737
|
+
}, {
|
|
1738
|
+
e: void 0,
|
|
1739
|
+
t: void 0,
|
|
1740
|
+
a: void 0
|
|
1741
|
+
});
|
|
1742
|
+
return _el$2;
|
|
1743
|
+
})()
|
|
1744
|
+
}), null);
|
|
1745
|
+
_$insert3(_el$, _$createComponent4(For, {
|
|
1348
1746
|
get each() {
|
|
1349
1747
|
return props.options;
|
|
1350
1748
|
},
|
|
1351
1749
|
children: (option) => (() => {
|
|
1352
|
-
var _el$3 = _tmpl$
|
|
1750
|
+
var _el$3 = _tmpl$33();
|
|
1353
1751
|
_el$3.$$click = () => props.onChange(option.value);
|
|
1354
|
-
_$use3((el) => {
|
|
1355
|
-
if (!el) return;
|
|
1356
|
-
buttonRefs.set(option.value, el);
|
|
1357
|
-
}, _el$3);
|
|
1358
1752
|
_$insert3(_el$3, () => option.label);
|
|
1359
1753
|
_$effect3(() => _$setAttribute2(_el$3, "data-active", String(props.value === option.value)));
|
|
1360
1754
|
return _el$3;
|
|
1361
1755
|
})()
|
|
1362
1756
|
}), null);
|
|
1363
|
-
_$effect3((_$p) => _$setStyleProperty2(_el$2, "visibility", pillReady() ? "visible" : "hidden"));
|
|
1364
1757
|
return _el$;
|
|
1365
1758
|
})();
|
|
1366
1759
|
}
|
|
1367
1760
|
_$delegateEvents3(["click"]);
|
|
1368
1761
|
|
|
1369
1762
|
// src/solid/components/Toggle.tsx
|
|
1370
|
-
var _tmpl$12 = /* @__PURE__ */ _$template4(`<
|
|
1763
|
+
var _tmpl$12 = /* @__PURE__ */ _$template4(`<span>`);
|
|
1764
|
+
var _tmpl$24 = /* @__PURE__ */ _$template4(`<div class=dialkit-labeled-control><span class=dialkit-labeled-control-label>`);
|
|
1371
1765
|
function Toggle(props) {
|
|
1372
1766
|
return (() => {
|
|
1373
|
-
var _el$ = _tmpl$
|
|
1374
|
-
_$insert4(_el$2, () => props.label);
|
|
1375
|
-
_$insert4(_el
|
|
1767
|
+
var _el$ = _tmpl$24(), _el$2 = _el$.firstChild;
|
|
1768
|
+
_$insert4(_el$2, () => props.label, null);
|
|
1769
|
+
_$insert4(_el$2, _$createComponent5(Show4, {
|
|
1770
|
+
get when() {
|
|
1771
|
+
return props.shortcut;
|
|
1772
|
+
},
|
|
1773
|
+
get children() {
|
|
1774
|
+
var _el$3 = _tmpl$12();
|
|
1775
|
+
_$insert4(_el$3, () => formatToggleShortcut(props.shortcut));
|
|
1776
|
+
_$effect4(() => _$className3(_el$3, `dialkit-shortcut-pill${props.shortcutActive ? " dialkit-shortcut-pill-active" : ""}`));
|
|
1777
|
+
return _el$3;
|
|
1778
|
+
}
|
|
1779
|
+
}), null);
|
|
1780
|
+
_$insert4(_el$, _$createComponent5(SegmentedControl, {
|
|
1376
1781
|
options: [{
|
|
1377
1782
|
value: "off",
|
|
1378
1783
|
label: "Off"
|
|
@@ -1393,17 +1798,17 @@ function Toggle(props) {
|
|
|
1393
1798
|
import { template as _$template6 } from "solid-js/web";
|
|
1394
1799
|
import { memo as _$memo4 } from "solid-js/web";
|
|
1395
1800
|
import { insert as _$insert6 } from "solid-js/web";
|
|
1396
|
-
import { createComponent as _$
|
|
1397
|
-
import { createSignal as
|
|
1801
|
+
import { createComponent as _$createComponent6 } from "solid-js/web";
|
|
1802
|
+
import { createSignal as createSignal6, onMount as onMount4, onCleanup as onCleanup5 } from "solid-js";
|
|
1398
1803
|
|
|
1399
1804
|
// src/solid/components/SpringVisualization.tsx
|
|
1400
1805
|
import { template as _$template5 } from "solid-js/web";
|
|
1401
|
-
import { effect as _$
|
|
1806
|
+
import { effect as _$effect5 } from "solid-js/web";
|
|
1402
1807
|
import { insert as _$insert5 } from "solid-js/web";
|
|
1403
1808
|
import { setAttribute as _$setAttribute3 } from "solid-js/web";
|
|
1404
1809
|
var _tmpl$13 = /* @__PURE__ */ _$template5(`<svg><line y1=0 y2=140 stroke="rgba(255, 255, 255, 0.08)"stroke-width=1></svg>`, false, true, false);
|
|
1405
|
-
var _tmpl$
|
|
1406
|
-
var _tmpl$
|
|
1810
|
+
var _tmpl$25 = /* @__PURE__ */ _$template5(`<svg><line x1=0 x2=256 stroke="rgba(255, 255, 255, 0.08)"stroke-width=1></svg>`, false, true, false);
|
|
1811
|
+
var _tmpl$34 = /* @__PURE__ */ _$template5(`<svg viewBox="0 0 256 140"class=dialkit-spring-viz><line x1=0 y1=70 x2=256 y2=70 stroke="rgba(255, 255, 255, 0.15)"stroke-width=1 stroke-dasharray=4,4></line><path fill=none stroke="rgba(255, 255, 255, 0.6)"stroke-width=2 stroke-linecap=round stroke-linejoin=round>`);
|
|
1407
1812
|
function generateSpringCurve(stiffness, damping, mass, duration) {
|
|
1408
1813
|
const points = [];
|
|
1409
1814
|
const steps = 100;
|
|
@@ -1466,7 +1871,7 @@ function SpringVisualization(props) {
|
|
|
1466
1871
|
_$setAttribute3(_el$, "x2", x);
|
|
1467
1872
|
return _el$;
|
|
1468
1873
|
})(), (() => {
|
|
1469
|
-
var _el$2 = _tmpl$
|
|
1874
|
+
var _el$2 = _tmpl$25();
|
|
1470
1875
|
_$setAttribute3(_el$2, "y1", y);
|
|
1471
1876
|
_$setAttribute3(_el$2, "y2", y);
|
|
1472
1877
|
return _el$2;
|
|
@@ -1475,9 +1880,9 @@ function SpringVisualization(props) {
|
|
|
1475
1880
|
return lines;
|
|
1476
1881
|
};
|
|
1477
1882
|
return (() => {
|
|
1478
|
-
var _el$3 = _tmpl$
|
|
1883
|
+
var _el$3 = _tmpl$34(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
|
|
1479
1884
|
_$insert5(_el$3, gridLines, _el$4);
|
|
1480
|
-
_$
|
|
1885
|
+
_$effect5(() => _$setAttribute3(_el$5, "d", params()));
|
|
1481
1886
|
return _el$3;
|
|
1482
1887
|
})();
|
|
1483
1888
|
}
|
|
@@ -1485,7 +1890,7 @@ function SpringVisualization(props) {
|
|
|
1485
1890
|
// src/solid/components/SpringControl.tsx
|
|
1486
1891
|
var _tmpl$14 = /* @__PURE__ */ _$template6(`<div style=display:flex;flex-direction:column;gap:6px><div class=dialkit-labeled-control><span class=dialkit-labeled-control-label>Type`);
|
|
1487
1892
|
function SpringControl(props) {
|
|
1488
|
-
const [mode, setMode] =
|
|
1893
|
+
const [mode, setMode] = createSignal6(DialStore.getSpringMode(props.panelId, props.path));
|
|
1489
1894
|
onMount4(() => {
|
|
1490
1895
|
const unsub = DialStore.subscribe(props.panelId, () => {
|
|
1491
1896
|
setMode(DialStore.getSpringMode(props.panelId, props.path));
|
|
@@ -1493,34 +1898,30 @@ function SpringControl(props) {
|
|
|
1493
1898
|
onCleanup5(unsub);
|
|
1494
1899
|
});
|
|
1495
1900
|
const isSimpleMode = () => mode() === "simple";
|
|
1901
|
+
const cache = {
|
|
1902
|
+
simple: props.spring.visualDuration !== void 0 ? props.spring : {
|
|
1903
|
+
type: "spring",
|
|
1904
|
+
visualDuration: 0.3,
|
|
1905
|
+
bounce: 0.2
|
|
1906
|
+
},
|
|
1907
|
+
advanced: props.spring.stiffness !== void 0 ? props.spring : {
|
|
1908
|
+
type: "spring",
|
|
1909
|
+
stiffness: 200,
|
|
1910
|
+
damping: 25,
|
|
1911
|
+
mass: 1
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1496
1914
|
const handleModeChange = (newMode) => {
|
|
1915
|
+
if (isSimpleMode()) {
|
|
1916
|
+
cache.simple = props.spring;
|
|
1917
|
+
} else {
|
|
1918
|
+
cache.advanced = props.spring;
|
|
1919
|
+
}
|
|
1497
1920
|
DialStore.updateSpringMode(props.panelId, props.path, newMode);
|
|
1498
1921
|
if (newMode === "simple") {
|
|
1499
|
-
|
|
1500
|
-
stiffness,
|
|
1501
|
-
damping,
|
|
1502
|
-
mass,
|
|
1503
|
-
...rest
|
|
1504
|
-
} = props.spring;
|
|
1505
|
-
props.onChange({
|
|
1506
|
-
...rest,
|
|
1507
|
-
type: "spring",
|
|
1508
|
-
visualDuration: props.spring.visualDuration ?? 0.3,
|
|
1509
|
-
bounce: props.spring.bounce ?? 0.2
|
|
1510
|
-
});
|
|
1922
|
+
props.onChange(cache.simple);
|
|
1511
1923
|
} else {
|
|
1512
|
-
|
|
1513
|
-
visualDuration,
|
|
1514
|
-
bounce,
|
|
1515
|
-
...rest
|
|
1516
|
-
} = props.spring;
|
|
1517
|
-
props.onChange({
|
|
1518
|
-
...rest,
|
|
1519
|
-
type: "spring",
|
|
1520
|
-
stiffness: props.spring.stiffness ?? 200,
|
|
1521
|
-
damping: props.spring.damping ?? 25,
|
|
1522
|
-
mass: props.spring.mass ?? 1
|
|
1523
|
-
});
|
|
1924
|
+
props.onChange(cache.advanced);
|
|
1524
1925
|
}
|
|
1525
1926
|
};
|
|
1526
1927
|
const handleUpdate = (key, value) => {
|
|
@@ -1547,14 +1948,14 @@ function SpringControl(props) {
|
|
|
1547
1948
|
});
|
|
1548
1949
|
}
|
|
1549
1950
|
};
|
|
1550
|
-
return _$
|
|
1951
|
+
return _$createComponent6(Folder, {
|
|
1551
1952
|
get title() {
|
|
1552
1953
|
return props.label;
|
|
1553
1954
|
},
|
|
1554
1955
|
defaultOpen: true,
|
|
1555
1956
|
get children() {
|
|
1556
1957
|
var _el$ = _tmpl$14(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
1557
|
-
_$insert6(_el$, _$
|
|
1958
|
+
_$insert6(_el$, _$createComponent6(SpringVisualization, {
|
|
1558
1959
|
get spring() {
|
|
1559
1960
|
return props.spring;
|
|
1560
1961
|
},
|
|
@@ -1562,7 +1963,7 @@ function SpringControl(props) {
|
|
|
1562
1963
|
return isSimpleMode();
|
|
1563
1964
|
}
|
|
1564
1965
|
}), _el$2);
|
|
1565
|
-
_$insert6(_el$2, _$
|
|
1966
|
+
_$insert6(_el$2, _$createComponent6(SegmentedControl, {
|
|
1566
1967
|
options: [{
|
|
1567
1968
|
value: "simple",
|
|
1568
1969
|
label: "Time"
|
|
@@ -1577,7 +1978,7 @@ function SpringControl(props) {
|
|
|
1577
1978
|
}), null);
|
|
1578
1979
|
_$insert6(_el$, (() => {
|
|
1579
1980
|
var _c$ = _$memo4(() => !!isSimpleMode());
|
|
1580
|
-
return () => _c$() ? [_$
|
|
1981
|
+
return () => _c$() ? [_$createComponent6(Slider, {
|
|
1581
1982
|
label: "Duration",
|
|
1582
1983
|
get value() {
|
|
1583
1984
|
return props.spring.visualDuration ?? 0.3;
|
|
@@ -1587,7 +1988,7 @@ function SpringControl(props) {
|
|
|
1587
1988
|
max: 1,
|
|
1588
1989
|
step: 0.05,
|
|
1589
1990
|
unit: "s"
|
|
1590
|
-
}), _$
|
|
1991
|
+
}), _$createComponent6(Slider, {
|
|
1591
1992
|
label: "Bounce",
|
|
1592
1993
|
get value() {
|
|
1593
1994
|
return props.spring.bounce ?? 0.2;
|
|
@@ -1596,7 +1997,7 @@ function SpringControl(props) {
|
|
|
1596
1997
|
min: 0,
|
|
1597
1998
|
max: 1,
|
|
1598
1999
|
step: 0.05
|
|
1599
|
-
})] : [_$
|
|
2000
|
+
})] : [_$createComponent6(Slider, {
|
|
1600
2001
|
label: "Stiffness",
|
|
1601
2002
|
get value() {
|
|
1602
2003
|
return props.spring.stiffness ?? 400;
|
|
@@ -1605,7 +2006,7 @@ function SpringControl(props) {
|
|
|
1605
2006
|
min: 1,
|
|
1606
2007
|
max: 1e3,
|
|
1607
2008
|
step: 10
|
|
1608
|
-
}), _$
|
|
2009
|
+
}), _$createComponent6(Slider, {
|
|
1609
2010
|
label: "Damping",
|
|
1610
2011
|
get value() {
|
|
1611
2012
|
return props.spring.damping ?? 17;
|
|
@@ -1614,7 +2015,7 @@ function SpringControl(props) {
|
|
|
1614
2015
|
min: 1,
|
|
1615
2016
|
max: 100,
|
|
1616
2017
|
step: 1
|
|
1617
|
-
}), _$
|
|
2018
|
+
}), _$createComponent6(Slider, {
|
|
1618
2019
|
label: "Mass",
|
|
1619
2020
|
get value() {
|
|
1620
2021
|
return props.spring.mass ?? 1;
|
|
@@ -1633,7 +2034,7 @@ function SpringControl(props) {
|
|
|
1633
2034
|
// src/solid/components/TextControl.tsx
|
|
1634
2035
|
import { template as _$template7 } from "solid-js/web";
|
|
1635
2036
|
import { delegateEvents as _$delegateEvents4 } from "solid-js/web";
|
|
1636
|
-
import { effect as _$
|
|
2037
|
+
import { effect as _$effect6 } from "solid-js/web";
|
|
1637
2038
|
import { insert as _$insert7 } from "solid-js/web";
|
|
1638
2039
|
import { setAttribute as _$setAttribute4 } from "solid-js/web";
|
|
1639
2040
|
import { createUniqueId as createUniqueId2 } from "solid-js";
|
|
@@ -1646,8 +2047,8 @@ function TextControl(props) {
|
|
|
1646
2047
|
_$insert7(_el$2, () => props.label);
|
|
1647
2048
|
_el$3.$$input = (e) => props.onChange(e.currentTarget.value);
|
|
1648
2049
|
_$setAttribute4(_el$3, "id", inputId);
|
|
1649
|
-
_$
|
|
1650
|
-
_$
|
|
2050
|
+
_$effect6(() => _$setAttribute4(_el$3, "placeholder", props.placeholder));
|
|
2051
|
+
_$effect6(() => _el$3.value = props.value);
|
|
1651
2052
|
return _el$;
|
|
1652
2053
|
})();
|
|
1653
2054
|
}
|
|
@@ -1656,19 +2057,19 @@ _$delegateEvents4(["input"]);
|
|
|
1656
2057
|
// src/solid/components/SelectControl.tsx
|
|
1657
2058
|
import { template as _$template8 } from "solid-js/web";
|
|
1658
2059
|
import { delegateEvents as _$delegateEvents5 } from "solid-js/web";
|
|
1659
|
-
import { setAttribute as _$setAttribute5 } from "solid-js/web";
|
|
1660
2060
|
import { style as _$style2 } from "solid-js/web";
|
|
1661
|
-
import { effect as _$
|
|
1662
|
-
import { createComponent as _$
|
|
2061
|
+
import { effect as _$effect7 } from "solid-js/web";
|
|
2062
|
+
import { createComponent as _$createComponent7 } from "solid-js/web";
|
|
2063
|
+
import { setAttribute as _$setAttribute5 } from "solid-js/web";
|
|
1663
2064
|
import { memo as _$memo5 } from "solid-js/web";
|
|
1664
2065
|
import { insert as _$insert8 } from "solid-js/web";
|
|
1665
2066
|
import { use as _$use4 } from "solid-js/web";
|
|
1666
|
-
import { createSignal as
|
|
2067
|
+
import { createSignal as createSignal7, createEffect as createEffect4, onMount as onMount5, onCleanup as onCleanup6, Show as Show5, For as For2 } from "solid-js";
|
|
1667
2068
|
import { Portal } from "solid-js/web";
|
|
1668
|
-
import { animate as
|
|
2069
|
+
import { animate as animate3 } from "motion";
|
|
1669
2070
|
var _tmpl$16 = /* @__PURE__ */ _$template8(`<div class=dialkit-select-dropdown>`);
|
|
1670
|
-
var _tmpl$
|
|
1671
|
-
var _tmpl$
|
|
2071
|
+
var _tmpl$26 = /* @__PURE__ */ _$template8(`<div class=dialkit-select-row><button class=dialkit-select-trigger><span class=dialkit-select-label></span><div class=dialkit-select-right><span class=dialkit-select-value></span><svg class=dialkit-select-chevron viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><path>`);
|
|
2072
|
+
var _tmpl$35 = /* @__PURE__ */ _$template8(`<button class=dialkit-select-option>`);
|
|
1672
2073
|
function toTitleCase(s) {
|
|
1673
2074
|
return s.replace(/\b\w/g, (c) => c.toUpperCase());
|
|
1674
2075
|
}
|
|
@@ -1679,10 +2080,10 @@ function normalizeOptions(options) {
|
|
|
1679
2080
|
} : opt);
|
|
1680
2081
|
}
|
|
1681
2082
|
function SelectControl(props) {
|
|
1682
|
-
const [isOpen, setIsOpen] =
|
|
1683
|
-
const [mounted, setMounted] =
|
|
1684
|
-
const [pos, setPos] =
|
|
1685
|
-
const [portalTarget, setPortalTarget] =
|
|
2083
|
+
const [isOpen, setIsOpen] = createSignal7(false);
|
|
2084
|
+
const [mounted, setMounted] = createSignal7(false);
|
|
2085
|
+
const [pos, setPos] = createSignal7(null);
|
|
2086
|
+
const [portalTarget, setPortalTarget] = createSignal7(null);
|
|
1686
2087
|
let triggerRef;
|
|
1687
2088
|
let dropdownRef;
|
|
1688
2089
|
let chevronRef;
|
|
@@ -1701,11 +2102,11 @@ function SelectControl(props) {
|
|
|
1701
2102
|
chevronAnim?.stop();
|
|
1702
2103
|
});
|
|
1703
2104
|
});
|
|
1704
|
-
|
|
2105
|
+
createEffect4(() => {
|
|
1705
2106
|
if (!chevronRef) return;
|
|
1706
2107
|
const open = isOpen();
|
|
1707
2108
|
chevronAnim?.stop();
|
|
1708
|
-
chevronAnim =
|
|
2109
|
+
chevronAnim = animate3(chevronRef, {
|
|
1709
2110
|
rotate: open ? 180 : 0
|
|
1710
2111
|
}, {
|
|
1711
2112
|
type: "spring",
|
|
@@ -1741,7 +2142,7 @@ function SelectControl(props) {
|
|
|
1741
2142
|
}
|
|
1742
2143
|
const above = pos()?.above ?? false;
|
|
1743
2144
|
closeAnim?.stop();
|
|
1744
|
-
closeAnim =
|
|
2145
|
+
closeAnim = animate3(dropdownRef, {
|
|
1745
2146
|
opacity: 0,
|
|
1746
2147
|
y: above ? 8 : -8,
|
|
1747
2148
|
scale: 0.95
|
|
@@ -1755,7 +2156,7 @@ function SelectControl(props) {
|
|
|
1755
2156
|
}
|
|
1756
2157
|
});
|
|
1757
2158
|
};
|
|
1758
|
-
|
|
2159
|
+
createEffect4(() => {
|
|
1759
2160
|
if (!isOpen()) return;
|
|
1760
2161
|
const handleViewportChange = () => updatePos();
|
|
1761
2162
|
const handleClick = (e) => {
|
|
@@ -1791,7 +2192,7 @@ function SelectControl(props) {
|
|
|
1791
2192
|
};
|
|
1792
2193
|
};
|
|
1793
2194
|
return (() => {
|
|
1794
|
-
var _el$ = _tmpl$
|
|
2195
|
+
var _el$ = _tmpl$26(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$6.firstChild;
|
|
1795
2196
|
_el$2.$$click = () => isOpen() ? closeDropdown() : openDropdown();
|
|
1796
2197
|
var _ref$ = triggerRef;
|
|
1797
2198
|
typeof _ref$ === "function" ? _$use4(_ref$, _el$2) : triggerRef = _el$2;
|
|
@@ -1799,26 +2200,27 @@ function SelectControl(props) {
|
|
|
1799
2200
|
_$insert8(_el$5, () => selectedOption()?.label ?? props.value);
|
|
1800
2201
|
var _ref$2 = chevronRef;
|
|
1801
2202
|
typeof _ref$2 === "function" ? _$use4(_ref$2, _el$6) : chevronRef = _el$6;
|
|
1802
|
-
_$
|
|
2203
|
+
_$setAttribute5(_el$7, "d", ICON_CHEVRON);
|
|
2204
|
+
_$insert8(_el$, _$createComponent7(Show5, {
|
|
1803
2205
|
get when() {
|
|
1804
2206
|
return !!portalTarget();
|
|
1805
2207
|
},
|
|
1806
2208
|
get children() {
|
|
1807
|
-
return _$
|
|
2209
|
+
return _$createComponent7(Portal, {
|
|
1808
2210
|
get mount() {
|
|
1809
2211
|
return portalTarget();
|
|
1810
2212
|
},
|
|
1811
2213
|
get children() {
|
|
1812
|
-
return _$
|
|
2214
|
+
return _$createComponent7(Show5, {
|
|
1813
2215
|
get when() {
|
|
1814
2216
|
return _$memo5(() => !!mounted())() && pos();
|
|
1815
2217
|
},
|
|
1816
2218
|
get children() {
|
|
1817
|
-
var _el$
|
|
2219
|
+
var _el$8 = _tmpl$16();
|
|
1818
2220
|
_$use4((el) => {
|
|
1819
2221
|
dropdownRef = el;
|
|
1820
2222
|
const above = pos()?.above ?? false;
|
|
1821
|
-
|
|
2223
|
+
animate3(el, {
|
|
1822
2224
|
opacity: [0, 1],
|
|
1823
2225
|
y: [above ? 8 : -8, 0],
|
|
1824
2226
|
scale: [0.95, 1]
|
|
@@ -1827,31 +2229,31 @@ function SelectControl(props) {
|
|
|
1827
2229
|
visualDuration: 0.15,
|
|
1828
2230
|
bounce: 0
|
|
1829
2231
|
});
|
|
1830
|
-
}, _el$
|
|
1831
|
-
_$insert8(_el$
|
|
2232
|
+
}, _el$8);
|
|
2233
|
+
_$insert8(_el$8, _$createComponent7(For2, {
|
|
1832
2234
|
get each() {
|
|
1833
2235
|
return normalized();
|
|
1834
2236
|
},
|
|
1835
2237
|
children: (option) => (() => {
|
|
1836
|
-
var _el$
|
|
1837
|
-
_el$
|
|
2238
|
+
var _el$9 = _tmpl$35();
|
|
2239
|
+
_el$9.$$click = () => {
|
|
1838
2240
|
props.onChange(option.value);
|
|
1839
2241
|
closeDropdown();
|
|
1840
2242
|
};
|
|
1841
|
-
_$insert8(_el$
|
|
1842
|
-
_$
|
|
1843
|
-
return _el$
|
|
2243
|
+
_$insert8(_el$9, () => option.label);
|
|
2244
|
+
_$effect7(() => _$setAttribute5(_el$9, "data-selected", String(option.value === props.value)));
|
|
2245
|
+
return _el$9;
|
|
1844
2246
|
})()
|
|
1845
2247
|
}));
|
|
1846
|
-
_$
|
|
1847
|
-
return _el$
|
|
2248
|
+
_$effect7((_$p) => _$style2(_el$8, dropdownStyle(), _$p));
|
|
2249
|
+
return _el$8;
|
|
1848
2250
|
}
|
|
1849
2251
|
});
|
|
1850
2252
|
}
|
|
1851
2253
|
});
|
|
1852
2254
|
}
|
|
1853
2255
|
}), null);
|
|
1854
|
-
_$
|
|
2256
|
+
_$effect7(() => _$setAttribute5(_el$2, "data-open", String(isOpen())));
|
|
1855
2257
|
return _el$;
|
|
1856
2258
|
})();
|
|
1857
2259
|
}
|
|
@@ -1862,25 +2264,25 @@ import { template as _$template9 } from "solid-js/web";
|
|
|
1862
2264
|
import { delegateEvents as _$delegateEvents6 } from "solid-js/web";
|
|
1863
2265
|
import { setStyleProperty as _$setStyleProperty3 } from "solid-js/web";
|
|
1864
2266
|
import { use as _$use5 } from "solid-js/web";
|
|
1865
|
-
import { createComponent as _$
|
|
1866
|
-
import { effect as _$
|
|
2267
|
+
import { createComponent as _$createComponent8 } from "solid-js/web";
|
|
2268
|
+
import { effect as _$effect8 } from "solid-js/web";
|
|
1867
2269
|
import { insert as _$insert9 } from "solid-js/web";
|
|
1868
2270
|
import { setAttribute as _$setAttribute6 } from "solid-js/web";
|
|
1869
|
-
import { createSignal as
|
|
2271
|
+
import { createSignal as createSignal8, createEffect as createEffect5, createUniqueId as createUniqueId3, Show as Show6 } from "solid-js";
|
|
1870
2272
|
var _tmpl$17 = /* @__PURE__ */ _$template9(`<input type=text class=dialkit-color-hex-input autofocus>`);
|
|
1871
|
-
var _tmpl$
|
|
1872
|
-
var _tmpl$
|
|
2273
|
+
var _tmpl$27 = /* @__PURE__ */ _$template9(`<div class=dialkit-color-control><label class=dialkit-color-label></label><div class=dialkit-color-inputs><button class=dialkit-color-swatch title="Pick color"></button><input type=color class=dialkit-color-picker-native>`);
|
|
2274
|
+
var _tmpl$36 = /* @__PURE__ */ _$template9(`<span class=dialkit-color-hex>`);
|
|
1873
2275
|
var HEX_COLOR_REGEX = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;
|
|
1874
2276
|
function expandShorthandHex(hex) {
|
|
1875
2277
|
if (hex.length !== 4) return hex;
|
|
1876
2278
|
return `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`;
|
|
1877
2279
|
}
|
|
1878
2280
|
function ColorControl(props) {
|
|
1879
|
-
const [isEditing, setIsEditing] =
|
|
1880
|
-
const [editValue, setEditValue] =
|
|
2281
|
+
const [isEditing, setIsEditing] = createSignal8(false);
|
|
2282
|
+
const [editValue, setEditValue] = createSignal8(props.value);
|
|
1881
2283
|
const textInputId = createUniqueId3();
|
|
1882
2284
|
let colorInputRef;
|
|
1883
|
-
|
|
2285
|
+
createEffect5(() => {
|
|
1884
2286
|
if (!isEditing()) {
|
|
1885
2287
|
setEditValue(props.value);
|
|
1886
2288
|
}
|
|
@@ -1901,16 +2303,16 @@ function ColorControl(props) {
|
|
|
1901
2303
|
}
|
|
1902
2304
|
};
|
|
1903
2305
|
return (() => {
|
|
1904
|
-
var _el$ = _tmpl$
|
|
2306
|
+
var _el$ = _tmpl$27(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$5 = _el$3.firstChild, _el$6 = _el$5.nextSibling;
|
|
1905
2307
|
_$setAttribute6(_el$2, "for", textInputId);
|
|
1906
2308
|
_$insert9(_el$2, () => props.label);
|
|
1907
|
-
_$insert9(_el$3, _$
|
|
2309
|
+
_$insert9(_el$3, _$createComponent8(Show6, {
|
|
1908
2310
|
get when() {
|
|
1909
2311
|
return isEditing();
|
|
1910
2312
|
},
|
|
1911
2313
|
get fallback() {
|
|
1912
2314
|
return (() => {
|
|
1913
|
-
var _el$7 = _tmpl$
|
|
2315
|
+
var _el$7 = _tmpl$36();
|
|
1914
2316
|
_el$7.$$click = () => setIsEditing(true);
|
|
1915
2317
|
_$insert9(_el$7, () => (props.value ?? "").toUpperCase());
|
|
1916
2318
|
return _el$7;
|
|
@@ -1922,7 +2324,7 @@ function ColorControl(props) {
|
|
|
1922
2324
|
_el$4.addEventListener("blur", handleTextSubmit);
|
|
1923
2325
|
_el$4.$$input = (e) => setEditValue(e.currentTarget.value);
|
|
1924
2326
|
_$setAttribute6(_el$4, "id", textInputId);
|
|
1925
|
-
_$
|
|
2327
|
+
_$effect8(() => _el$4.value = editValue());
|
|
1926
2328
|
return _el$4;
|
|
1927
2329
|
}
|
|
1928
2330
|
}), _el$5);
|
|
@@ -1930,7 +2332,7 @@ function ColorControl(props) {
|
|
|
1930
2332
|
_el$6.$$input = (e) => props.onChange(e.currentTarget.value);
|
|
1931
2333
|
var _ref$ = colorInputRef;
|
|
1932
2334
|
typeof _ref$ === "function" ? _$use5(_ref$, _el$6) : colorInputRef = _el$6;
|
|
1933
|
-
_$
|
|
2335
|
+
_$effect8((_p$) => {
|
|
1934
2336
|
var _v$ = props.value, _v$2 = `Pick color for ${props.label}`, _v$3 = `${props.label} color picker`;
|
|
1935
2337
|
_v$ !== _p$.e && _$setStyleProperty3(_el$5, "background-color", _p$.e = _v$);
|
|
1936
2338
|
_v$2 !== _p$.t && _$setAttribute6(_el$5, "aria-label", _p$.t = _v$2);
|
|
@@ -1941,7 +2343,7 @@ function ColorControl(props) {
|
|
|
1941
2343
|
t: void 0,
|
|
1942
2344
|
a: void 0
|
|
1943
2345
|
});
|
|
1944
|
-
_$
|
|
2346
|
+
_$effect8(() => _el$6.value = props.value.length === 4 ? expandShorthandHex(props.value) : props.value.slice(0, 7));
|
|
1945
2347
|
return _el$;
|
|
1946
2348
|
})();
|
|
1947
2349
|
}
|
|
@@ -1950,28 +2352,28 @@ _$delegateEvents6(["input", "keydown", "click"]);
|
|
|
1950
2352
|
// src/solid/components/PresetManager.tsx
|
|
1951
2353
|
import { template as _$template10 } from "solid-js/web";
|
|
1952
2354
|
import { delegateEvents as _$delegateEvents7 } from "solid-js/web";
|
|
1953
|
-
import { setAttribute as _$setAttribute7 } from "solid-js/web";
|
|
1954
2355
|
import { setStyleProperty as _$setStyleProperty4 } from "solid-js/web";
|
|
1955
|
-
import { effect as _$
|
|
1956
|
-
import { createComponent as _$
|
|
2356
|
+
import { effect as _$effect9 } from "solid-js/web";
|
|
2357
|
+
import { createComponent as _$createComponent9 } from "solid-js/web";
|
|
2358
|
+
import { setAttribute as _$setAttribute7 } from "solid-js/web";
|
|
1957
2359
|
import { insert as _$insert10 } from "solid-js/web";
|
|
1958
2360
|
import { memo as _$memo6 } from "solid-js/web";
|
|
1959
2361
|
import { use as _$use6 } from "solid-js/web";
|
|
1960
|
-
import { createSignal as
|
|
2362
|
+
import { createSignal as createSignal9, createEffect as createEffect6, onMount as onMount6, onCleanup as onCleanup7, Show as Show7, For as For3 } from "solid-js";
|
|
1961
2363
|
import { Portal as Portal2 } from "solid-js/web";
|
|
1962
|
-
import { animate as
|
|
2364
|
+
import { animate as animate4 } from "motion";
|
|
1963
2365
|
var _tmpl$18 = /* @__PURE__ */ _$template10(`<div class="dialkit-root dialkit-preset-dropdown"style=position:fixed><div class=dialkit-preset-item><span class=dialkit-preset-name>Version 1`);
|
|
1964
|
-
var _tmpl$
|
|
1965
|
-
var _tmpl$
|
|
2366
|
+
var _tmpl$28 = /* @__PURE__ */ _$template10(`<div class=dialkit-preset-manager><button class=dialkit-preset-trigger><span class=dialkit-preset-label></span><svg class=dialkit-select-chevron viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><path>`);
|
|
2367
|
+
var _tmpl$37 = /* @__PURE__ */ _$template10(`<div class=dialkit-preset-item><span class=dialkit-preset-name></span><button class=dialkit-preset-delete title="Delete preset"><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path></path><path></path><path></path><path></path><path>`);
|
|
1966
2368
|
function PresetManager(props) {
|
|
1967
|
-
const [isOpen, setIsOpen] =
|
|
1968
|
-
const [mounted, setMounted] =
|
|
1969
|
-
const [pos, setPos] =
|
|
2369
|
+
const [isOpen, setIsOpen] = createSignal9(false);
|
|
2370
|
+
const [mounted, setMounted] = createSignal9(false);
|
|
2371
|
+
const [pos, setPos] = createSignal9({
|
|
1970
2372
|
top: 0,
|
|
1971
2373
|
left: 0,
|
|
1972
2374
|
width: 0
|
|
1973
2375
|
});
|
|
1974
|
-
const [portalTarget, setPortalTarget] =
|
|
2376
|
+
const [portalTarget, setPortalTarget] = createSignal9(null);
|
|
1975
2377
|
let triggerRef;
|
|
1976
2378
|
let dropdownRef;
|
|
1977
2379
|
let chevronRef;
|
|
@@ -1991,12 +2393,12 @@ function PresetManager(props) {
|
|
|
1991
2393
|
chevronAnim?.stop();
|
|
1992
2394
|
});
|
|
1993
2395
|
});
|
|
1994
|
-
|
|
2396
|
+
createEffect6(() => {
|
|
1995
2397
|
if (!chevronRef) return;
|
|
1996
2398
|
const open = isOpen();
|
|
1997
2399
|
const has = hasPresets();
|
|
1998
2400
|
chevronAnim?.stop();
|
|
1999
|
-
chevronAnim =
|
|
2401
|
+
chevronAnim = animate4(chevronRef, {
|
|
2000
2402
|
rotate: open ? 180 : 0,
|
|
2001
2403
|
opacity: has ? 0.6 : 0.25
|
|
2002
2404
|
}, {
|
|
@@ -2029,7 +2431,7 @@ function PresetManager(props) {
|
|
|
2029
2431
|
return;
|
|
2030
2432
|
}
|
|
2031
2433
|
closeAnim?.stop();
|
|
2032
|
-
closeAnim =
|
|
2434
|
+
closeAnim = animate4(dropdownRef, {
|
|
2033
2435
|
opacity: 0,
|
|
2034
2436
|
y: 4,
|
|
2035
2437
|
scale: 0.97
|
|
@@ -2047,7 +2449,7 @@ function PresetManager(props) {
|
|
|
2047
2449
|
if (isOpen()) closeDropdown();
|
|
2048
2450
|
else openDropdown();
|
|
2049
2451
|
};
|
|
2050
|
-
|
|
2452
|
+
createEffect6(() => {
|
|
2051
2453
|
if (!isOpen()) return;
|
|
2052
2454
|
const handleViewportChange = () => updatePos();
|
|
2053
2455
|
const handler = (e) => {
|
|
@@ -2075,7 +2477,7 @@ function PresetManager(props) {
|
|
|
2075
2477
|
DialStore.deletePreset(props.panelId, presetId);
|
|
2076
2478
|
};
|
|
2077
2479
|
return (() => {
|
|
2078
|
-
var _el$ = _tmpl$
|
|
2480
|
+
var _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$4.firstChild;
|
|
2079
2481
|
_el$2.$$click = toggle;
|
|
2080
2482
|
var _ref$ = triggerRef;
|
|
2081
2483
|
typeof _ref$ === "function" ? _$use6(_ref$, _el$2) : triggerRef = _el$2;
|
|
@@ -2085,25 +2487,26 @@ function PresetManager(props) {
|
|
|
2085
2487
|
})());
|
|
2086
2488
|
var _ref$2 = chevronRef;
|
|
2087
2489
|
typeof _ref$2 === "function" ? _$use6(_ref$2, _el$4) : chevronRef = _el$4;
|
|
2088
|
-
_$
|
|
2490
|
+
_$setAttribute7(_el$5, "d", ICON_CHEVRON);
|
|
2491
|
+
_$insert10(_el$, _$createComponent9(Show7, {
|
|
2089
2492
|
get when() {
|
|
2090
2493
|
return !!portalTarget();
|
|
2091
2494
|
},
|
|
2092
2495
|
get children() {
|
|
2093
|
-
return _$
|
|
2496
|
+
return _$createComponent9(Portal2, {
|
|
2094
2497
|
get mount() {
|
|
2095
2498
|
return portalTarget();
|
|
2096
2499
|
},
|
|
2097
2500
|
get children() {
|
|
2098
|
-
return _$
|
|
2501
|
+
return _$createComponent9(Show7, {
|
|
2099
2502
|
get when() {
|
|
2100
2503
|
return mounted();
|
|
2101
2504
|
},
|
|
2102
2505
|
get children() {
|
|
2103
|
-
var _el$
|
|
2506
|
+
var _el$6 = _tmpl$18(), _el$7 = _el$6.firstChild;
|
|
2104
2507
|
_$use6((el) => {
|
|
2105
2508
|
dropdownRef = el;
|
|
2106
|
-
|
|
2509
|
+
animate4(el, {
|
|
2107
2510
|
opacity: [0, 1],
|
|
2108
2511
|
y: [4, 0],
|
|
2109
2512
|
scale: [0.97, 1]
|
|
@@ -2112,27 +2515,43 @@ function PresetManager(props) {
|
|
|
2112
2515
|
visualDuration: 0.15,
|
|
2113
2516
|
bounce: 0
|
|
2114
2517
|
});
|
|
2115
|
-
}, _el$
|
|
2116
|
-
_el$
|
|
2117
|
-
_$insert10(_el$
|
|
2518
|
+
}, _el$6);
|
|
2519
|
+
_el$7.$$click = () => handleSelect(null);
|
|
2520
|
+
_$insert10(_el$6, _$createComponent9(For3, {
|
|
2118
2521
|
get each() {
|
|
2119
2522
|
return props.presets;
|
|
2120
2523
|
},
|
|
2121
2524
|
children: (preset) => (() => {
|
|
2122
|
-
var _el$
|
|
2123
|
-
_el$
|
|
2124
|
-
_$insert10(_el$
|
|
2125
|
-
_el$
|
|
2126
|
-
_$
|
|
2127
|
-
|
|
2525
|
+
var _el$8 = _tmpl$37(), _el$9 = _el$8.firstChild, _el$0 = _el$9.nextSibling, _el$1 = _el$0.firstChild, _el$10 = _el$1.firstChild, _el$11 = _el$10.nextSibling, _el$12 = _el$11.nextSibling, _el$13 = _el$12.nextSibling, _el$14 = _el$13.nextSibling;
|
|
2526
|
+
_el$8.$$click = () => handleSelect(preset.id);
|
|
2527
|
+
_$insert10(_el$9, () => preset.name);
|
|
2528
|
+
_el$0.$$click = (e) => handleDelete(e, preset.id);
|
|
2529
|
+
_$effect9((_p$) => {
|
|
2530
|
+
var _v$8 = String(preset.id === props.activePresetId), _v$9 = ICON_TRASH[0], _v$0 = ICON_TRASH[1], _v$1 = ICON_TRASH[2], _v$10 = ICON_TRASH[3], _v$11 = ICON_TRASH[4];
|
|
2531
|
+
_v$8 !== _p$.e && _$setAttribute7(_el$8, "data-active", _p$.e = _v$8);
|
|
2532
|
+
_v$9 !== _p$.t && _$setAttribute7(_el$10, "d", _p$.t = _v$9);
|
|
2533
|
+
_v$0 !== _p$.a && _$setAttribute7(_el$11, "d", _p$.a = _v$0);
|
|
2534
|
+
_v$1 !== _p$.o && _$setAttribute7(_el$12, "d", _p$.o = _v$1);
|
|
2535
|
+
_v$10 !== _p$.i && _$setAttribute7(_el$13, "d", _p$.i = _v$10);
|
|
2536
|
+
_v$11 !== _p$.n && _$setAttribute7(_el$14, "d", _p$.n = _v$11);
|
|
2537
|
+
return _p$;
|
|
2538
|
+
}, {
|
|
2539
|
+
e: void 0,
|
|
2540
|
+
t: void 0,
|
|
2541
|
+
a: void 0,
|
|
2542
|
+
o: void 0,
|
|
2543
|
+
i: void 0,
|
|
2544
|
+
n: void 0
|
|
2545
|
+
});
|
|
2546
|
+
return _el$8;
|
|
2128
2547
|
})()
|
|
2129
2548
|
}), null);
|
|
2130
|
-
_$
|
|
2549
|
+
_$effect9((_p$) => {
|
|
2131
2550
|
var _v$ = `${pos().top}px`, _v$2 = `${pos().left}px`, _v$3 = `${pos().width}px`, _v$4 = String(!props.activePresetId);
|
|
2132
|
-
_v$ !== _p$.e && _$setStyleProperty4(_el$
|
|
2133
|
-
_v$2 !== _p$.t && _$setStyleProperty4(_el$
|
|
2134
|
-
_v$3 !== _p$.a && _$setStyleProperty4(_el$
|
|
2135
|
-
_v$4 !== _p$.o && _$setAttribute7(_el$
|
|
2551
|
+
_v$ !== _p$.e && _$setStyleProperty4(_el$6, "top", _p$.e = _v$);
|
|
2552
|
+
_v$2 !== _p$.t && _$setStyleProperty4(_el$6, "left", _p$.t = _v$2);
|
|
2553
|
+
_v$3 !== _p$.a && _$setStyleProperty4(_el$6, "min-width", _p$.a = _v$3);
|
|
2554
|
+
_v$4 !== _p$.o && _$setAttribute7(_el$7, "data-active", _p$.o = _v$4);
|
|
2136
2555
|
return _p$;
|
|
2137
2556
|
}, {
|
|
2138
2557
|
e: void 0,
|
|
@@ -2140,14 +2559,14 @@ function PresetManager(props) {
|
|
|
2140
2559
|
a: void 0,
|
|
2141
2560
|
o: void 0
|
|
2142
2561
|
});
|
|
2143
|
-
return _el$
|
|
2562
|
+
return _el$6;
|
|
2144
2563
|
}
|
|
2145
2564
|
});
|
|
2146
2565
|
}
|
|
2147
2566
|
});
|
|
2148
2567
|
}
|
|
2149
2568
|
}), null);
|
|
2150
|
-
_$
|
|
2569
|
+
_$effect9((_p$) => {
|
|
2151
2570
|
var _v$5 = String(isOpen()), _v$6 = String(!!activePreset()), _v$7 = String(!hasPresets());
|
|
2152
2571
|
_v$5 !== _p$.e && _$setAttribute7(_el$2, "data-open", _p$.e = _v$5);
|
|
2153
2572
|
_v$6 !== _p$.t && _$setAttribute7(_el$2, "data-has-preset", _p$.t = _v$6);
|
|
@@ -2165,15 +2584,17 @@ _$delegateEvents7(["click"]);
|
|
|
2165
2584
|
|
|
2166
2585
|
// src/solid/components/Panel.tsx
|
|
2167
2586
|
var _tmpl$19 = /* @__PURE__ */ _$template11(`<button class=dialkit-button>`);
|
|
2168
|
-
var _tmpl$
|
|
2169
|
-
var _tmpl$
|
|
2587
|
+
var _tmpl$29 = /* @__PURE__ */ _$template11(`<button class=dialkit-toolbar-add title="Add preset"><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><path></path><path></path><path></path><path></path><path>`);
|
|
2588
|
+
var _tmpl$38 = /* @__PURE__ */ _$template11(`<button class=dialkit-toolbar-copy title="Copy parameters"><span class=dialkit-toolbar-copy-icon-wrap><span class=dialkit-toolbar-copy-icon style=opacity:1;transform:scale(1);filter:blur(0px)><svg viewBox="0 0 24 24"fill=none width=16 height=16><path stroke=currentColor stroke-width=2 stroke-linejoin=round></path><path fill=currentColor></path><path stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path></svg></span><span class=dialkit-toolbar-copy-icon style=opacity:0;transform:scale(0.5);filter:blur(4px)><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round width=16 height=16><path></path></svg></span></span>Copy`);
|
|
2170
2589
|
var _tmpl$43 = /* @__PURE__ */ _$template11(`<div class=dialkit-panel-wrapper>`);
|
|
2171
2590
|
function Panel(props) {
|
|
2172
|
-
const [copied, setCopied] =
|
|
2173
|
-
const [isPanelOpen, setIsPanelOpen] =
|
|
2174
|
-
const
|
|
2175
|
-
const
|
|
2176
|
-
const [
|
|
2591
|
+
const [copied, setCopied] = createSignal10(false);
|
|
2592
|
+
const [isPanelOpen, setIsPanelOpen] = createSignal10(props.defaultOpen ?? true);
|
|
2593
|
+
const shortcutCtx = useShortcutContext();
|
|
2594
|
+
const hasShortcuts = () => Object.keys(props.panel.shortcuts).length > 0;
|
|
2595
|
+
const [values, setValues] = createSignal10(DialStore.getValues(props.panel.id));
|
|
2596
|
+
const [presets, setPresets] = createSignal10(DialStore.getPresets(props.panel.id));
|
|
2597
|
+
const [activePresetId, setActivePresetId] = createSignal10(DialStore.getActivePresetId(props.panel.id));
|
|
2177
2598
|
let addButtonRef;
|
|
2178
2599
|
let copyButtonRef;
|
|
2179
2600
|
let copyClipboardIconRef;
|
|
@@ -2224,7 +2645,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2224
2645
|
setCopied(true);
|
|
2225
2646
|
setTimeout(() => setCopied(false), 1500);
|
|
2226
2647
|
};
|
|
2227
|
-
|
|
2648
|
+
createEffect7(() => {
|
|
2228
2649
|
const isCopied = copied();
|
|
2229
2650
|
if (!copyClipboardIconRef || !copyCheckIconRef) return;
|
|
2230
2651
|
copyClipboardAnim?.stop();
|
|
@@ -2235,12 +2656,12 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2235
2656
|
visualDuration: 0.3,
|
|
2236
2657
|
bounce: 0.2
|
|
2237
2658
|
};
|
|
2238
|
-
copyClipboardAnim =
|
|
2659
|
+
copyClipboardAnim = animate5(copyClipboardIconRef, {
|
|
2239
2660
|
opacity: isCopied ? 0 : 1,
|
|
2240
2661
|
scale: isCopied ? 0.5 : 1,
|
|
2241
2662
|
filter: isCopied ? "blur(4px)" : "blur(0px)"
|
|
2242
2663
|
}, transition);
|
|
2243
|
-
copyCheckAnim =
|
|
2664
|
+
copyCheckAnim = animate5(copyCheckIconRef, {
|
|
2244
2665
|
opacity: isCopied ? 1 : 0,
|
|
2245
2666
|
scale: isCopied ? 1 : 0.5,
|
|
2246
2667
|
filter: isCopied ? "blur(0px)" : "blur(4px)"
|
|
@@ -2255,28 +2676,28 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2255
2676
|
const handleAddTapStart = () => {
|
|
2256
2677
|
if (!addButtonRef) return;
|
|
2257
2678
|
addTapAnim?.stop();
|
|
2258
|
-
addTapAnim =
|
|
2679
|
+
addTapAnim = animate5(addButtonRef, {
|
|
2259
2680
|
scale: 0.9
|
|
2260
2681
|
}, tapTransition);
|
|
2261
2682
|
};
|
|
2262
2683
|
const handleAddTapEnd = () => {
|
|
2263
2684
|
if (!addButtonRef) return;
|
|
2264
2685
|
addTapAnim?.stop();
|
|
2265
|
-
addTapAnim =
|
|
2686
|
+
addTapAnim = animate5(addButtonRef, {
|
|
2266
2687
|
scale: 1
|
|
2267
2688
|
}, tapTransition);
|
|
2268
2689
|
};
|
|
2269
2690
|
const handleCopyTapStart = () => {
|
|
2270
2691
|
if (!copyButtonRef) return;
|
|
2271
2692
|
copyTapAnim?.stop();
|
|
2272
|
-
copyTapAnim =
|
|
2693
|
+
copyTapAnim = animate5(copyButtonRef, {
|
|
2273
2694
|
scale: 0.95
|
|
2274
2695
|
}, tapTransition);
|
|
2275
2696
|
};
|
|
2276
2697
|
const handleCopyTapEnd = () => {
|
|
2277
2698
|
if (!copyButtonRef) return;
|
|
2278
2699
|
copyTapAnim?.stop();
|
|
2279
|
-
copyTapAnim =
|
|
2700
|
+
copyTapAnim = animate5(copyButtonRef, {
|
|
2280
2701
|
scale: 1
|
|
2281
2702
|
}, tapTransition);
|
|
2282
2703
|
};
|
|
@@ -2284,7 +2705,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2284
2705
|
const value = () => values()[control.path];
|
|
2285
2706
|
switch (control.type) {
|
|
2286
2707
|
case "slider":
|
|
2287
|
-
return _$
|
|
2708
|
+
return _$createComponent10(Slider, {
|
|
2288
2709
|
get label() {
|
|
2289
2710
|
return control.label;
|
|
2290
2711
|
},
|
|
@@ -2300,20 +2721,32 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2300
2721
|
},
|
|
2301
2722
|
get step() {
|
|
2302
2723
|
return control.step;
|
|
2724
|
+
},
|
|
2725
|
+
get shortcut() {
|
|
2726
|
+
return control.shortcut;
|
|
2727
|
+
},
|
|
2728
|
+
get shortcutActive() {
|
|
2729
|
+
return _$memo7(() => shortcutCtx().activePanelId === props.panel.id)() && shortcutCtx().activePath === control.path;
|
|
2303
2730
|
}
|
|
2304
2731
|
});
|
|
2305
2732
|
case "toggle":
|
|
2306
|
-
return _$
|
|
2733
|
+
return _$createComponent10(Toggle, {
|
|
2307
2734
|
get label() {
|
|
2308
2735
|
return control.label;
|
|
2309
2736
|
},
|
|
2310
2737
|
get checked() {
|
|
2311
2738
|
return value();
|
|
2312
2739
|
},
|
|
2313
|
-
onChange: (v) => DialStore.updateValue(props.panel.id, control.path, v)
|
|
2740
|
+
onChange: (v) => DialStore.updateValue(props.panel.id, control.path, v),
|
|
2741
|
+
get shortcut() {
|
|
2742
|
+
return control.shortcut;
|
|
2743
|
+
},
|
|
2744
|
+
get shortcutActive() {
|
|
2745
|
+
return _$memo7(() => shortcutCtx().activePanelId === props.panel.id)() && shortcutCtx().activePath === control.path;
|
|
2746
|
+
}
|
|
2314
2747
|
});
|
|
2315
2748
|
case "spring":
|
|
2316
|
-
return _$
|
|
2749
|
+
return _$createComponent10(SpringControl, {
|
|
2317
2750
|
get panelId() {
|
|
2318
2751
|
return props.panel.id;
|
|
2319
2752
|
},
|
|
@@ -2329,7 +2762,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2329
2762
|
onChange: (v) => DialStore.updateValue(props.panel.id, control.path, v)
|
|
2330
2763
|
});
|
|
2331
2764
|
case "folder":
|
|
2332
|
-
return _$
|
|
2765
|
+
return _$createComponent10(Folder, {
|
|
2333
2766
|
get title() {
|
|
2334
2767
|
return control.label;
|
|
2335
2768
|
},
|
|
@@ -2337,7 +2770,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2337
2770
|
return control.defaultOpen ?? true;
|
|
2338
2771
|
},
|
|
2339
2772
|
get children() {
|
|
2340
|
-
return _$
|
|
2773
|
+
return _$createComponent10(For4, {
|
|
2341
2774
|
get each() {
|
|
2342
2775
|
return control.children ?? [];
|
|
2343
2776
|
},
|
|
@@ -2346,7 +2779,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2346
2779
|
}
|
|
2347
2780
|
});
|
|
2348
2781
|
case "text":
|
|
2349
|
-
return _$
|
|
2782
|
+
return _$createComponent10(TextControl, {
|
|
2350
2783
|
get label() {
|
|
2351
2784
|
return control.label;
|
|
2352
2785
|
},
|
|
@@ -2359,7 +2792,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2359
2792
|
}
|
|
2360
2793
|
});
|
|
2361
2794
|
case "select":
|
|
2362
|
-
return _$
|
|
2795
|
+
return _$createComponent10(SelectControl, {
|
|
2363
2796
|
get label() {
|
|
2364
2797
|
return control.label;
|
|
2365
2798
|
},
|
|
@@ -2372,7 +2805,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2372
2805
|
onChange: (v) => DialStore.updateValue(props.panel.id, control.path, v)
|
|
2373
2806
|
});
|
|
2374
2807
|
case "color":
|
|
2375
|
-
return _$
|
|
2808
|
+
return _$createComponent10(ColorControl, {
|
|
2376
2809
|
get label() {
|
|
2377
2810
|
return control.label;
|
|
2378
2811
|
},
|
|
@@ -2386,7 +2819,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2386
2819
|
}
|
|
2387
2820
|
};
|
|
2388
2821
|
const renderControls = () => {
|
|
2389
|
-
return _$
|
|
2822
|
+
return _$createComponent10(For4, {
|
|
2390
2823
|
get each() {
|
|
2391
2824
|
return props.panel.controls;
|
|
2392
2825
|
},
|
|
@@ -2399,7 +2832,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2399
2832
|
});
|
|
2400
2833
|
};
|
|
2401
2834
|
const toolbar = [(() => {
|
|
2402
|
-
var _el$2 = _tmpl$
|
|
2835
|
+
var _el$2 = _tmpl$29(), _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$6 = _el$5.nextSibling, _el$7 = _el$6.nextSibling, _el$8 = _el$7.nextSibling;
|
|
2403
2836
|
_el$2.addEventListener("pointerleave", handleAddTapEnd);
|
|
2404
2837
|
_el$2.addEventListener("pointercancel", handleAddTapEnd);
|
|
2405
2838
|
_el$2.$$pointerup = handleAddTapEnd;
|
|
@@ -2407,8 +2840,23 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2407
2840
|
_el$2.$$click = handleAddPreset;
|
|
2408
2841
|
var _ref$ = addButtonRef;
|
|
2409
2842
|
typeof _ref$ === "function" ? _$use7(_ref$, _el$2) : addButtonRef = _el$2;
|
|
2843
|
+
_$effect10((_p$) => {
|
|
2844
|
+
var _v$ = ICON_ADD_PRESET[0], _v$2 = ICON_ADD_PRESET[1], _v$3 = ICON_ADD_PRESET[2], _v$4 = ICON_ADD_PRESET[3], _v$5 = ICON_ADD_PRESET[4];
|
|
2845
|
+
_v$ !== _p$.e && _$setAttribute8(_el$4, "d", _p$.e = _v$);
|
|
2846
|
+
_v$2 !== _p$.t && _$setAttribute8(_el$5, "d", _p$.t = _v$2);
|
|
2847
|
+
_v$3 !== _p$.a && _$setAttribute8(_el$6, "d", _p$.a = _v$3);
|
|
2848
|
+
_v$4 !== _p$.o && _$setAttribute8(_el$7, "d", _p$.o = _v$4);
|
|
2849
|
+
_v$5 !== _p$.i && _$setAttribute8(_el$8, "d", _p$.i = _v$5);
|
|
2850
|
+
return _p$;
|
|
2851
|
+
}, {
|
|
2852
|
+
e: void 0,
|
|
2853
|
+
t: void 0,
|
|
2854
|
+
a: void 0,
|
|
2855
|
+
o: void 0,
|
|
2856
|
+
i: void 0
|
|
2857
|
+
});
|
|
2410
2858
|
return _el$2;
|
|
2411
|
-
})(), _$
|
|
2859
|
+
})(), _$createComponent10(PresetManager, {
|
|
2412
2860
|
get panelId() {
|
|
2413
2861
|
return props.panel.id;
|
|
2414
2862
|
},
|
|
@@ -2420,23 +2868,35 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2420
2868
|
},
|
|
2421
2869
|
onAdd: handleAddPreset
|
|
2422
2870
|
}), (() => {
|
|
2423
|
-
var _el$
|
|
2424
|
-
_el$
|
|
2425
|
-
_el$
|
|
2426
|
-
_el$
|
|
2427
|
-
_el$
|
|
2428
|
-
_el$
|
|
2871
|
+
var _el$9 = _tmpl$38(), _el$0 = _el$9.firstChild, _el$1 = _el$0.firstChild, _el$10 = _el$1.firstChild, _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling, _el$13 = _el$12.nextSibling, _el$14 = _el$1.nextSibling, _el$15 = _el$14.firstChild, _el$16 = _el$15.firstChild;
|
|
2872
|
+
_el$9.addEventListener("pointerleave", handleCopyTapEnd);
|
|
2873
|
+
_el$9.addEventListener("pointercancel", handleCopyTapEnd);
|
|
2874
|
+
_el$9.$$pointerup = handleCopyTapEnd;
|
|
2875
|
+
_el$9.$$pointerdown = handleCopyTapStart;
|
|
2876
|
+
_el$9.$$click = handleCopy;
|
|
2429
2877
|
var _ref$2 = copyButtonRef;
|
|
2430
|
-
typeof _ref$2 === "function" ? _$use7(_ref$2, _el$
|
|
2878
|
+
typeof _ref$2 === "function" ? _$use7(_ref$2, _el$9) : copyButtonRef = _el$9;
|
|
2431
2879
|
var _ref$3 = copyClipboardIconRef;
|
|
2432
|
-
typeof _ref$3 === "function" ? _$use7(_ref$3, _el$
|
|
2880
|
+
typeof _ref$3 === "function" ? _$use7(_ref$3, _el$1) : copyClipboardIconRef = _el$1;
|
|
2433
2881
|
var _ref$4 = copyCheckIconRef;
|
|
2434
|
-
typeof _ref$4 === "function" ? _$use7(_ref$4, _el$
|
|
2435
|
-
|
|
2882
|
+
typeof _ref$4 === "function" ? _$use7(_ref$4, _el$14) : copyCheckIconRef = _el$14;
|
|
2883
|
+
_$setAttribute8(_el$16, "d", ICON_CHECK);
|
|
2884
|
+
_$effect10((_p$) => {
|
|
2885
|
+
var _v$6 = ICON_CLIPBOARD.board, _v$7 = ICON_CLIPBOARD.sparkle, _v$8 = ICON_CLIPBOARD.body;
|
|
2886
|
+
_v$6 !== _p$.e && _$setAttribute8(_el$11, "d", _p$.e = _v$6);
|
|
2887
|
+
_v$7 !== _p$.t && _$setAttribute8(_el$12, "d", _p$.t = _v$7);
|
|
2888
|
+
_v$8 !== _p$.a && _$setAttribute8(_el$13, "d", _p$.a = _v$8);
|
|
2889
|
+
return _p$;
|
|
2890
|
+
}, {
|
|
2891
|
+
e: void 0,
|
|
2892
|
+
t: void 0,
|
|
2893
|
+
a: void 0
|
|
2894
|
+
});
|
|
2895
|
+
return _el$9;
|
|
2436
2896
|
})()];
|
|
2437
2897
|
return (() => {
|
|
2438
|
-
var _el$
|
|
2439
|
-
_$insert11(_el$
|
|
2898
|
+
var _el$17 = _tmpl$43();
|
|
2899
|
+
_$insert11(_el$17, _$createComponent10(Folder, {
|
|
2440
2900
|
get title() {
|
|
2441
2901
|
return props.panel.name;
|
|
2442
2902
|
},
|
|
@@ -2453,16 +2913,18 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2453
2913
|
return renderControls();
|
|
2454
2914
|
}
|
|
2455
2915
|
}));
|
|
2456
|
-
return _el$
|
|
2916
|
+
return _el$17;
|
|
2457
2917
|
})();
|
|
2458
2918
|
}
|
|
2459
2919
|
_$delegateEvents8(["click", "pointerdown", "pointerup"]);
|
|
2460
2920
|
|
|
2461
2921
|
// src/solid/components/DialRoot.tsx
|
|
2462
2922
|
var _tmpl$20 = /* @__PURE__ */ _$template12(`<div class=dialkit-root><div class=dialkit-panel>`);
|
|
2923
|
+
var isDevDefault = typeof process !== "undefined" && process?.env?.NODE_ENV ? process.env.NODE_ENV !== "production" : typeof import.meta !== "undefined" && import.meta.env?.MODE ? import.meta.env.MODE !== "production" : true;
|
|
2463
2924
|
function DialRoot(props) {
|
|
2464
|
-
|
|
2465
|
-
const [
|
|
2925
|
+
if ((props.productionEnabled ?? isDevDefault) === false) return null;
|
|
2926
|
+
const [panels, setPanels] = createSignal11([]);
|
|
2927
|
+
const [mounted, setMounted] = createSignal11(false);
|
|
2466
2928
|
const inline = () => (props.mode ?? "popover") === "inline";
|
|
2467
2929
|
onMount8(() => {
|
|
2468
2930
|
setMounted(true);
|
|
@@ -2472,41 +2934,45 @@ function DialRoot(props) {
|
|
|
2472
2934
|
});
|
|
2473
2935
|
onCleanup9(unsub);
|
|
2474
2936
|
});
|
|
2475
|
-
const content = () => (
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
children: (panel) => _$createComponent9(Panel, {
|
|
2482
|
-
panel,
|
|
2483
|
-
get defaultOpen() {
|
|
2484
|
-
return inline() || (props.defaultOpen ?? true);
|
|
2937
|
+
const content = () => _$createComponent11(ShortcutListener, {
|
|
2938
|
+
get children() {
|
|
2939
|
+
var _el$ = _tmpl$20(), _el$2 = _el$.firstChild;
|
|
2940
|
+
_$insert12(_el$2, _$createComponent11(For5, {
|
|
2941
|
+
get each() {
|
|
2942
|
+
return panels();
|
|
2485
2943
|
},
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2944
|
+
children: (panel) => _$createComponent11(Panel, {
|
|
2945
|
+
panel,
|
|
2946
|
+
get defaultOpen() {
|
|
2947
|
+
return inline() || (props.defaultOpen ?? true);
|
|
2948
|
+
},
|
|
2949
|
+
get inline() {
|
|
2950
|
+
return inline();
|
|
2951
|
+
}
|
|
2952
|
+
})
|
|
2953
|
+
}));
|
|
2954
|
+
_$effect11((_p$) => {
|
|
2955
|
+
var _v$ = props.mode ?? "popover", _v$2 = props.theme ?? "system", _v$3 = inline() ? void 0 : props.position ?? "top-right", _v$4 = props.mode ?? "popover";
|
|
2956
|
+
_v$ !== _p$.e && _$setAttribute9(_el$, "data-mode", _p$.e = _v$);
|
|
2957
|
+
_v$2 !== _p$.t && _$setAttribute9(_el$, "data-theme", _p$.t = _v$2);
|
|
2958
|
+
_v$3 !== _p$.a && _$setAttribute9(_el$2, "data-position", _p$.a = _v$3);
|
|
2959
|
+
_v$4 !== _p$.o && _$setAttribute9(_el$2, "data-mode", _p$.o = _v$4);
|
|
2960
|
+
return _p$;
|
|
2961
|
+
}, {
|
|
2962
|
+
e: void 0,
|
|
2963
|
+
t: void 0,
|
|
2964
|
+
a: void 0,
|
|
2965
|
+
o: void 0
|
|
2966
|
+
});
|
|
2967
|
+
return _el$;
|
|
2968
|
+
}
|
|
2969
|
+
});
|
|
2970
|
+
return _$createComponent11(Show8, {
|
|
2505
2971
|
get when() {
|
|
2506
2972
|
return _$memo8(() => !!(mounted() && typeof window !== "undefined"))() && panels().length > 0;
|
|
2507
2973
|
},
|
|
2508
2974
|
get children() {
|
|
2509
|
-
return _$
|
|
2975
|
+
return _$createComponent11(Show8, {
|
|
2510
2976
|
get when() {
|
|
2511
2977
|
return !inline();
|
|
2512
2978
|
},
|
|
@@ -2514,7 +2980,7 @@ function DialRoot(props) {
|
|
|
2514
2980
|
return content();
|
|
2515
2981
|
},
|
|
2516
2982
|
get children() {
|
|
2517
|
-
return _$
|
|
2983
|
+
return _$createComponent11(Portal3, {
|
|
2518
2984
|
get mount() {
|
|
2519
2985
|
return document.body;
|
|
2520
2986
|
},
|
|
@@ -2533,19 +2999,19 @@ import { template as _$template13 } from "solid-js/web";
|
|
|
2533
2999
|
import { delegateEvents as _$delegateEvents9 } from "solid-js/web";
|
|
2534
3000
|
import { addEventListener as _$addEventListener } from "solid-js/web";
|
|
2535
3001
|
import { insert as _$insert13 } from "solid-js/web";
|
|
2536
|
-
import { createComponent as _$
|
|
3002
|
+
import { createComponent as _$createComponent12 } from "solid-js/web";
|
|
2537
3003
|
import { For as For6 } from "solid-js";
|
|
2538
3004
|
var _tmpl$21 = /* @__PURE__ */ _$template13(`<div class=dialkit-button-group>`);
|
|
2539
|
-
var _tmpl$
|
|
3005
|
+
var _tmpl$210 = /* @__PURE__ */ _$template13(`<button class=dialkit-button>`);
|
|
2540
3006
|
function ButtonGroup(props) {
|
|
2541
3007
|
return (() => {
|
|
2542
3008
|
var _el$ = _tmpl$21();
|
|
2543
|
-
_$insert13(_el$, _$
|
|
3009
|
+
_$insert13(_el$, _$createComponent12(For6, {
|
|
2544
3010
|
get each() {
|
|
2545
3011
|
return props.buttons;
|
|
2546
3012
|
},
|
|
2547
3013
|
children: (button) => (() => {
|
|
2548
|
-
var _el$2 = _tmpl$
|
|
3014
|
+
var _el$2 = _tmpl$210();
|
|
2549
3015
|
_$addEventListener(_el$2, "click", button.onClick, true);
|
|
2550
3016
|
_$insert13(_el$2, () => button.label);
|
|
2551
3017
|
return _el$2;
|