dialkit 1.0.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 +293 -2
- package/dist/index.cjs +905 -363
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -9
- package/dist/index.d.ts +46 -9
- package/dist/index.js +910 -370
- package/dist/index.js.map +1 -1
- package/dist/solid/index.cjs +1042 -532
- package/dist/solid/index.cjs.map +1 -1
- package/dist/solid/index.d.cts +36 -3
- package/dist/solid/index.d.ts +36 -3
- package/dist/solid/index.js +911 -402
- package/dist/solid/index.js.map +1 -1
- package/dist/store/index.cjs +490 -0
- package/dist/store/index.cjs.map +1 -0
- package/dist/store/index.d.cts +146 -0
- package/dist/store/index.d.ts +146 -0
- package/dist/store/index.js +465 -0
- package/dist/store/index.js.map +1 -0
- package/dist/styles.css +287 -25
- package/dist/svelte/Portal.svelte +30 -0
- package/dist/svelte/Portal.svelte.d.ts +9 -0
- package/dist/svelte/Portal.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ButtonGroup.svelte +16 -0
- package/dist/svelte/components/ButtonGroup.svelte.d.ts +11 -0
- package/dist/svelte/components/ButtonGroup.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ColorControl.svelte +81 -0
- package/dist/svelte/components/ColorControl.svelte.d.ts +9 -0
- package/dist/svelte/components/ColorControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ControlRenderer.svelte +96 -0
- package/dist/svelte/components/ControlRenderer.svelte.d.ts +11 -0
- package/dist/svelte/components/ControlRenderer.svelte.d.ts.map +1 -0
- package/dist/svelte/components/DialRoot.svelte +79 -0
- package/dist/svelte/components/DialRoot.svelte.d.ts +14 -0
- package/dist/svelte/components/DialRoot.svelte.d.ts.map +1 -0
- package/dist/svelte/components/EasingVisualization.svelte +50 -0
- package/dist/svelte/components/EasingVisualization.svelte.d.ts +10 -0
- package/dist/svelte/components/EasingVisualization.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Folder.svelte +213 -0
- package/dist/svelte/components/Folder.svelte.d.ts +14 -0
- package/dist/svelte/components/Folder.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Panel.svelte +149 -0
- package/dist/svelte/components/Panel.svelte.d.ts +10 -0
- package/dist/svelte/components/Panel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PresetManager.svelte +157 -0
- package/dist/svelte/components/PresetManager.svelte.d.ts +10 -0
- package/dist/svelte/components/PresetManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SegmentedControl.svelte +62 -0
- package/dist/svelte/components/SegmentedControl.svelte.d.ts +13 -0
- package/dist/svelte/components/SegmentedControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SelectControl.svelte +152 -0
- package/dist/svelte/components/SelectControl.svelte.d.ts +14 -0
- package/dist/svelte/components/SelectControl.svelte.d.ts.map +1 -0
- 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 +332 -0
- package/dist/svelte/components/Slider.svelte.d.ts +16 -0
- package/dist/svelte/components/Slider.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SpringControl.svelte +126 -0
- package/dist/svelte/components/SpringControl.svelte.d.ts +12 -0
- package/dist/svelte/components/SpringControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SpringVisualization.svelte +115 -0
- package/dist/svelte/components/SpringVisualization.svelte.d.ts +9 -0
- package/dist/svelte/components/SpringVisualization.svelte.d.ts.map +1 -0
- package/dist/svelte/components/TextControl.svelte +19 -0
- package/dist/svelte/components/TextControl.svelte.d.ts +10 -0
- package/dist/svelte/components/TextControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Toggle.svelte +32 -0
- package/dist/svelte/components/Toggle.svelte.d.ts +12 -0
- package/dist/svelte/components/Toggle.svelte.d.ts.map +1 -0
- package/dist/svelte/components/TransitionControl.svelte +203 -0
- package/dist/svelte/components/TransitionControl.svelte.d.ts +12 -0
- package/dist/svelte/components/TransitionControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/transitions.d.ts +6 -0
- package/dist/svelte/components/transitions.d.ts.map +1 -0
- package/dist/svelte/components/transitions.js +14 -0
- package/dist/svelte/createDialKit.svelte.d.ts +8 -0
- package/dist/svelte/createDialKit.svelte.d.ts.map +1 -0
- package/dist/svelte/createDialKit.svelte.js +82 -0
- package/dist/svelte/index.d.ts +23 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +23 -0
- package/dist/svelte/shims.d.ts +9 -0
- package/dist/svelte/theme-css.d.ts +2 -0
- package/dist/svelte/theme-css.d.ts.map +1 -0
- package/dist/svelte/theme-css.js +1328 -0
- 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 +50 -6
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));
|
|
@@ -496,23 +536,374 @@ function getFirstOptionValue(options) {
|
|
|
496
536
|
|
|
497
537
|
// src/solid/components/DialRoot.tsx
|
|
498
538
|
import { template as _$template12 } from "solid-js/web";
|
|
499
|
-
import { setAttribute as _$setAttribute8 } from "solid-js/web";
|
|
500
|
-
import { effect as _$effect9 } from "solid-js/web";
|
|
501
|
-
import { insert as _$insert12 } from "solid-js/web";
|
|
502
|
-
import { createComponent as _$createComponent9 } from "solid-js/web";
|
|
503
539
|
import { memo as _$memo8 } from "solid-js/web";
|
|
504
|
-
import {
|
|
540
|
+
import { setAttribute as _$setAttribute9 } from "solid-js/web";
|
|
541
|
+
import { effect as _$effect11 } from "solid-js/web";
|
|
542
|
+
import { insert as _$insert12 } from "solid-js/web";
|
|
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,25 +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
|
|
537
|
-
var _tmpl$8 = /* @__PURE__ */ _$template(`<div class=dialkit-panel-inner>`);
|
|
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>`);
|
|
928
|
+
var _tmpl$8 = /* @__PURE__ */ _$template(`<div class="dialkit-panel-inner dialkit-panel-inline">`);
|
|
929
|
+
var _tmpl$9 = /* @__PURE__ */ _$template(`<div class=dialkit-panel-inner>`);
|
|
538
930
|
function Folder(props) {
|
|
539
|
-
const [isOpen, setIsOpen] =
|
|
540
|
-
const [isCollapsed, setIsCollapsed] =
|
|
541
|
-
const [contentHeight, setContentHeight] =
|
|
542
|
-
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);
|
|
543
941
|
let skipFirstAnim = props.defaultOpen ?? true;
|
|
544
942
|
let sectionContentRef;
|
|
545
943
|
let sectionAnim = null;
|
|
@@ -557,7 +955,7 @@ function Folder(props) {
|
|
|
557
955
|
setContentHeight((prev) => prev === h ? prev : h);
|
|
558
956
|
});
|
|
559
957
|
ro.observe(el);
|
|
560
|
-
|
|
958
|
+
onCleanup3(() => ro.disconnect());
|
|
561
959
|
});
|
|
562
960
|
createEffect(() => {
|
|
563
961
|
if (props.isRoot || !folderChevronRef) return;
|
|
@@ -575,9 +973,10 @@ function Folder(props) {
|
|
|
575
973
|
visualDuration: 0.35,
|
|
576
974
|
bounce: 0.15
|
|
577
975
|
});
|
|
578
|
-
|
|
976
|
+
onCleanup3(() => chevronAnim?.stop());
|
|
579
977
|
});
|
|
580
978
|
const handleToggle = () => {
|
|
979
|
+
if (props.inline && props.isRoot) return;
|
|
581
980
|
const next = !isOpen();
|
|
582
981
|
setIsOpen(next);
|
|
583
982
|
if (next) {
|
|
@@ -636,7 +1035,7 @@ function Folder(props) {
|
|
|
636
1035
|
_el$2.$$click = handleToggle;
|
|
637
1036
|
_$insert(_el$3, (() => {
|
|
638
1037
|
var _c$ = _$memo(() => !!props.isRoot);
|
|
639
|
-
return () => _c$() ? _$
|
|
1038
|
+
return () => _c$() ? _$createComponent2(Show, {
|
|
640
1039
|
get when() {
|
|
641
1040
|
return isOpen();
|
|
642
1041
|
},
|
|
@@ -652,15 +1051,48 @@ function Folder(props) {
|
|
|
652
1051
|
})();
|
|
653
1052
|
})(), null);
|
|
654
1053
|
_$insert(_el$3, (() => {
|
|
655
|
-
var _c$2 = _$memo(() => !!props.isRoot);
|
|
656
|
-
return () => _c$2()
|
|
657
|
-
var _el$
|
|
1054
|
+
var _c$2 = _$memo(() => !!(props.isRoot && !props.inline));
|
|
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
|
+
})();
|
|
1084
|
+
})(), null);
|
|
1085
|
+
_$insert(_el$3, (() => {
|
|
1086
|
+
var _c$3 = _$memo(() => !!!props.isRoot);
|
|
1087
|
+
return () => _c$3() && (() => {
|
|
1088
|
+
var _el$14 = _tmpl$7(), _el$15 = _el$14.firstChild;
|
|
658
1089
|
var _ref$ = folderChevronRef;
|
|
659
|
-
typeof _ref$ === "function" ? _$use(_ref$, _el$
|
|
660
|
-
|
|
1090
|
+
typeof _ref$ === "function" ? _$use(_ref$, _el$14) : folderChevronRef = _el$14;
|
|
1091
|
+
_$setAttribute(_el$15, "d", ICON_CHEVRON);
|
|
1092
|
+
return _el$14;
|
|
661
1093
|
})();
|
|
662
1094
|
})(), null);
|
|
663
|
-
_$insert(_el$2, _$
|
|
1095
|
+
_$insert(_el$2, _$createComponent2(Show, {
|
|
664
1096
|
get when() {
|
|
665
1097
|
return _$memo(() => !!(props.isRoot && props.toolbar))() && isOpen();
|
|
666
1098
|
},
|
|
@@ -671,7 +1103,7 @@ function Folder(props) {
|
|
|
671
1103
|
return _el$4;
|
|
672
1104
|
}
|
|
673
1105
|
}), null);
|
|
674
|
-
_$insert(_el$, _$
|
|
1106
|
+
_$insert(_el$, _$createComponent2(Show, {
|
|
675
1107
|
get when() {
|
|
676
1108
|
return _$memo(() => !!props.isRoot)() ? isOpen() : contentMounted();
|
|
677
1109
|
},
|
|
@@ -718,6 +1150,13 @@ function Folder(props) {
|
|
|
718
1150
|
return _el$;
|
|
719
1151
|
})();
|
|
720
1152
|
if (props.isRoot) {
|
|
1153
|
+
if (props.inline) {
|
|
1154
|
+
return (() => {
|
|
1155
|
+
var _el$16 = _tmpl$8();
|
|
1156
|
+
_$insert(_el$16, folderContent);
|
|
1157
|
+
return _el$16;
|
|
1158
|
+
})();
|
|
1159
|
+
}
|
|
721
1160
|
let panelRef;
|
|
722
1161
|
let rootPanelAnim = null;
|
|
723
1162
|
let rootPanelInitialized = false;
|
|
@@ -729,20 +1168,20 @@ function Folder(props) {
|
|
|
729
1168
|
handleToggle();
|
|
730
1169
|
};
|
|
731
1170
|
panelRef.addEventListener("click", handler);
|
|
732
|
-
|
|
1171
|
+
onCleanup3(() => panelRef.removeEventListener("click", handler));
|
|
733
1172
|
});
|
|
734
1173
|
createEffect(() => {
|
|
735
1174
|
if (!panelRef) return;
|
|
736
1175
|
const open = isOpen();
|
|
737
|
-
const measuredOpenHeight = contentHeight() !== void 0 ? contentHeight() +
|
|
1176
|
+
const measuredOpenHeight = contentHeight() !== void 0 ? Math.min(contentHeight() + 10, windowHeight() - 32) : panelRef.getBoundingClientRect().height;
|
|
738
1177
|
const target = {
|
|
739
1178
|
width: open ? 280 : 42,
|
|
740
1179
|
height: open ? measuredOpenHeight : 42,
|
|
741
1180
|
borderRadius: open ? 14 : 21,
|
|
742
|
-
boxShadow: open ? "
|
|
1181
|
+
boxShadow: open ? "var(--dial-shadow)" : "var(--dial-shadow-collapsed)"
|
|
743
1182
|
};
|
|
744
1183
|
panelRef.style.cursor = open ? "" : "pointer";
|
|
745
|
-
panelRef.style.overflow = open ? "" : "hidden";
|
|
1184
|
+
panelRef.style.overflow = open ? "hidden auto" : "hidden";
|
|
746
1185
|
if (!rootPanelInitialized) {
|
|
747
1186
|
rootPanelInitialized = true;
|
|
748
1187
|
panelRef.style.width = `${target.width}px`;
|
|
@@ -769,13 +1208,13 @@ function Folder(props) {
|
|
|
769
1208
|
panelRef.style.height = `${target.height}px`;
|
|
770
1209
|
}
|
|
771
1210
|
});
|
|
772
|
-
|
|
1211
|
+
onCleanup3(() => {
|
|
773
1212
|
rootPanelAnim?.stop();
|
|
774
1213
|
panelTapAnim?.stop();
|
|
775
1214
|
});
|
|
776
1215
|
return (() => {
|
|
777
|
-
var _el$
|
|
778
|
-
_el$
|
|
1216
|
+
var _el$17 = _tmpl$9();
|
|
1217
|
+
_el$17.addEventListener("pointerleave", () => {
|
|
779
1218
|
if (isOpen()) return;
|
|
780
1219
|
panelTapAnim?.stop();
|
|
781
1220
|
panelTapAnim = animate(panelRef, {
|
|
@@ -786,7 +1225,7 @@ function Folder(props) {
|
|
|
786
1225
|
bounce: 0.3
|
|
787
1226
|
});
|
|
788
1227
|
});
|
|
789
|
-
_el$
|
|
1228
|
+
_el$17.addEventListener("pointercancel", () => {
|
|
790
1229
|
if (isOpen()) return;
|
|
791
1230
|
panelTapAnim?.stop();
|
|
792
1231
|
panelTapAnim = animate(panelRef, {
|
|
@@ -797,7 +1236,7 @@ function Folder(props) {
|
|
|
797
1236
|
bounce: 0.3
|
|
798
1237
|
});
|
|
799
1238
|
});
|
|
800
|
-
_el$
|
|
1239
|
+
_el$17.$$pointerup = () => {
|
|
801
1240
|
if (isOpen()) return;
|
|
802
1241
|
panelTapAnim?.stop();
|
|
803
1242
|
panelTapAnim = animate(panelRef, {
|
|
@@ -808,7 +1247,7 @@ function Folder(props) {
|
|
|
808
1247
|
bounce: 0.3
|
|
809
1248
|
});
|
|
810
1249
|
};
|
|
811
|
-
_el$
|
|
1250
|
+
_el$17.$$pointerdown = () => {
|
|
812
1251
|
if (isOpen()) return;
|
|
813
1252
|
document.activeElement?.blur?.();
|
|
814
1253
|
panelTapAnim?.stop();
|
|
@@ -821,10 +1260,10 @@ function Folder(props) {
|
|
|
821
1260
|
});
|
|
822
1261
|
};
|
|
823
1262
|
var _ref$2 = panelRef;
|
|
824
|
-
typeof _ref$2 === "function" ? _$use(_ref$2, _el$
|
|
825
|
-
_$insert(_el$
|
|
826
|
-
_$effect(() => _$setAttribute(_el$
|
|
827
|
-
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;
|
|
828
1267
|
})();
|
|
829
1268
|
}
|
|
830
1269
|
return folderContent();
|
|
@@ -834,39 +1273,23 @@ _$delegateEvents(["click", "pointerdown", "pointerup"]);
|
|
|
834
1273
|
// src/solid/components/Slider.tsx
|
|
835
1274
|
import { template as _$template2 } from "solid-js/web";
|
|
836
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";
|
|
837
1278
|
import { className as _$className2 } from "solid-js/web";
|
|
838
1279
|
import { effect as _$effect2 } from "solid-js/web";
|
|
839
|
-
import { memo as _$memo2 } from "solid-js/web";
|
|
840
1280
|
import { insert as _$insert2 } from "solid-js/web";
|
|
841
1281
|
import { use as _$use2 } from "solid-js/web";
|
|
842
1282
|
import { setStyleProperty as _$setStyleProperty } from "solid-js/web";
|
|
843
|
-
import { createSignal as
|
|
1283
|
+
import { createSignal as createSignal4, createEffect as createEffect2, onMount as onMount3, onCleanup as onCleanup4, Show as Show2 } from "solid-js";
|
|
844
1284
|
import { animate as animate2, motionValue } from "motion";
|
|
845
|
-
var _tmpl$
|
|
846
|
-
var _tmpl$22 = /* @__PURE__ */ _$template2(`<
|
|
847
|
-
var _tmpl$32 = /* @__PURE__ */ _$template2(`<
|
|
848
|
-
var _tmpl$42 = /* @__PURE__ */ _$template2(`<
|
|
1285
|
+
var _tmpl$10 = /* @__PURE__ */ _$template2(`<div class=dialkit-slider-hashmark>`);
|
|
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>`);
|
|
849
1289
|
var CLICK_THRESHOLD = 3;
|
|
850
1290
|
var DEAD_ZONE = 32;
|
|
851
1291
|
var MAX_CURSOR_RANGE = 200;
|
|
852
1292
|
var MAX_STRETCH = 8;
|
|
853
|
-
function decimalsForStep(step) {
|
|
854
|
-
const s = step.toString();
|
|
855
|
-
const dot = s.indexOf(".");
|
|
856
|
-
return dot === -1 ? 0 : s.length - dot - 1;
|
|
857
|
-
}
|
|
858
|
-
function roundValue(val, step) {
|
|
859
|
-
const raw = Math.round(val / step) * step;
|
|
860
|
-
return parseFloat(raw.toFixed(decimalsForStep(step)));
|
|
861
|
-
}
|
|
862
|
-
function snapToDecile(rawValue, min, max) {
|
|
863
|
-
const normalized = (rawValue - min) / (max - min);
|
|
864
|
-
const nearest = Math.round(normalized * 10) / 10;
|
|
865
|
-
if (Math.abs(normalized - nearest) <= 0.03125) {
|
|
866
|
-
return min + nearest * (max - min);
|
|
867
|
-
}
|
|
868
|
-
return rawValue;
|
|
869
|
-
}
|
|
870
1293
|
function Slider(props) {
|
|
871
1294
|
const min = () => props.min ?? 0;
|
|
872
1295
|
const max = () => props.max ?? 1;
|
|
@@ -878,13 +1301,13 @@ function Slider(props) {
|
|
|
878
1301
|
let labelRef;
|
|
879
1302
|
let valueSpanRef;
|
|
880
1303
|
let inputRef;
|
|
881
|
-
const [isInteracting, setIsInteracting] =
|
|
882
|
-
const [isDragging, setIsDragging] =
|
|
883
|
-
const [isHovered, setIsHovered] =
|
|
884
|
-
const [isValueHovered, setIsValueHovered] =
|
|
885
|
-
const [isValueEditable, setIsValueEditable] =
|
|
886
|
-
const [showInput, setShowInput] =
|
|
887
|
-
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("");
|
|
888
1311
|
const fillPercent = motionValue((props.value - min()) / (max() - min()) * 100);
|
|
889
1312
|
const rubberStretchPx = motionValue(0);
|
|
890
1313
|
const handleOpacityMv = motionValue(0);
|
|
@@ -1026,7 +1449,7 @@ function Slider(props) {
|
|
|
1026
1449
|
const hovered = isValueHovered();
|
|
1027
1450
|
const editing = showInput();
|
|
1028
1451
|
const editable = isValueEditable();
|
|
1029
|
-
|
|
1452
|
+
onCleanup4(() => {
|
|
1030
1453
|
if (hoverTimeout) {
|
|
1031
1454
|
clearTimeout(hoverTimeout);
|
|
1032
1455
|
hoverTimeout = null;
|
|
@@ -1038,7 +1461,7 @@ function Slider(props) {
|
|
|
1038
1461
|
setIsValueEditable(false);
|
|
1039
1462
|
}
|
|
1040
1463
|
});
|
|
1041
|
-
|
|
1464
|
+
onCleanup4(() => {
|
|
1042
1465
|
if (hoverTimeout) clearTimeout(hoverTimeout);
|
|
1043
1466
|
snapAnim?.stop();
|
|
1044
1467
|
rubberAnim?.stop();
|
|
@@ -1046,7 +1469,7 @@ function Slider(props) {
|
|
|
1046
1469
|
handleScaleXAnim?.stop();
|
|
1047
1470
|
handleScaleYAnim?.stop();
|
|
1048
1471
|
});
|
|
1049
|
-
|
|
1472
|
+
onMount3(() => {
|
|
1050
1473
|
const unsubFill = fillPercent.on("change", applyFillStyles);
|
|
1051
1474
|
const unsubRubber = rubberStretchPx.on("change", applyRubberStyles);
|
|
1052
1475
|
const unsubHandleOpacity = handleOpacityMv.on("change", applyHandleVisualStyles);
|
|
@@ -1055,7 +1478,7 @@ function Slider(props) {
|
|
|
1055
1478
|
applyFillStyles(fillPercent.get());
|
|
1056
1479
|
applyRubberStyles(rubberStretchPx.get());
|
|
1057
1480
|
applyHandleVisualStyles();
|
|
1058
|
-
|
|
1481
|
+
onCleanup4(() => {
|
|
1059
1482
|
unsubFill();
|
|
1060
1483
|
unsubRubber();
|
|
1061
1484
|
unsubHandleOpacity();
|
|
@@ -1140,7 +1563,6 @@ function Slider(props) {
|
|
|
1140
1563
|
bounce: 0.1
|
|
1141
1564
|
});
|
|
1142
1565
|
});
|
|
1143
|
-
const fillBackground = () => isActive() ? "rgba(255, 255, 255, 0.15)" : "rgba(255, 255, 255, 0.11)";
|
|
1144
1566
|
const discreteSteps = () => (max() - min()) / step();
|
|
1145
1567
|
const hashMarks = () => {
|
|
1146
1568
|
const ds = discreteSteps();
|
|
@@ -1150,7 +1572,7 @@ function Slider(props) {
|
|
|
1150
1572
|
}, (_, i) => {
|
|
1151
1573
|
const pct = (i + 1) * step() / (max() - min()) * 100;
|
|
1152
1574
|
return (() => {
|
|
1153
|
-
var _el$ = _tmpl$
|
|
1575
|
+
var _el$ = _tmpl$10();
|
|
1154
1576
|
_$setStyleProperty(_el$, "left", `${pct}%`);
|
|
1155
1577
|
return _el$;
|
|
1156
1578
|
})();
|
|
@@ -1161,14 +1583,14 @@ function Slider(props) {
|
|
|
1161
1583
|
}, (_, i) => {
|
|
1162
1584
|
const pct = (i + 1) * 10;
|
|
1163
1585
|
return (() => {
|
|
1164
|
-
var _el$2 = _tmpl$
|
|
1586
|
+
var _el$2 = _tmpl$10();
|
|
1165
1587
|
_$setStyleProperty(_el$2, "left", `${pct}%`);
|
|
1166
1588
|
return _el$2;
|
|
1167
1589
|
})();
|
|
1168
1590
|
});
|
|
1169
1591
|
};
|
|
1170
1592
|
return (() => {
|
|
1171
|
-
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;
|
|
1172
1594
|
var _ref$ = wrapperRef;
|
|
1173
1595
|
typeof _ref$ === "function" ? _$use2(_ref$, _el$3) : wrapperRef = _el$3;
|
|
1174
1596
|
_el$4.addEventListener("mouseleave", () => setIsHovered(false));
|
|
@@ -1186,53 +1608,62 @@ function Slider(props) {
|
|
|
1186
1608
|
typeof _ref$4 === "function" ? _$use2(_ref$4, _el$7) : handleRef = _el$7;
|
|
1187
1609
|
var _ref$5 = labelRef;
|
|
1188
1610
|
typeof _ref$5 === "function" ? _$use2(_ref$5, _el$8) : labelRef = _el$8;
|
|
1189
|
-
_$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);
|
|
1190
1623
|
_$insert2(_el$4, (() => {
|
|
1191
1624
|
var _c$ = _$memo2(() => !!showInput());
|
|
1192
1625
|
return () => _c$() ? (() => {
|
|
1193
|
-
var _el$
|
|
1194
|
-
_el$
|
|
1195
|
-
_el$
|
|
1196
|
-
_el$
|
|
1197
|
-
_el$
|
|
1198
|
-
_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);
|
|
1199
1632
|
var _ref$6 = inputRef;
|
|
1200
|
-
typeof _ref$6 === "function" ? _$use2(_ref$6, _el$
|
|
1201
|
-
_$effect2(() => _el$
|
|
1202
|
-
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;
|
|
1203
1636
|
})() : (() => {
|
|
1204
|
-
var _el$
|
|
1205
|
-
_el$
|
|
1206
|
-
_el$
|
|
1207
|
-
_el$
|
|
1208
|
-
_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));
|
|
1209
1642
|
var _ref$7 = valueSpanRef;
|
|
1210
|
-
typeof _ref$7 === "function" ? _$use2(_ref$7, _el$
|
|
1211
|
-
_$insert2(_el$
|
|
1643
|
+
typeof _ref$7 === "function" ? _$use2(_ref$7, _el$1) : valueSpanRef = _el$1;
|
|
1644
|
+
_$insert2(_el$1, displayValue);
|
|
1212
1645
|
_$effect2((_p$) => {
|
|
1213
|
-
var _v$
|
|
1214
|
-
_v$
|
|
1215
|
-
_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);
|
|
1216
1649
|
return _p$;
|
|
1217
1650
|
}, {
|
|
1218
1651
|
e: void 0,
|
|
1219
1652
|
t: void 0
|
|
1220
1653
|
});
|
|
1221
|
-
return _el$
|
|
1654
|
+
return _el$1;
|
|
1222
1655
|
})();
|
|
1223
1656
|
})(), null);
|
|
1224
1657
|
_$effect2((_p$) => {
|
|
1225
|
-
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))`;
|
|
1226
1659
|
_v$ !== _p$.e && _$className2(_el$4, _p$.e = _v$);
|
|
1227
|
-
_v$2 !== _p$.t && _$setStyleProperty(_el$6, "
|
|
1228
|
-
_v$3 !== _p$.a && _$setStyleProperty(_el$
|
|
1229
|
-
_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);
|
|
1230
1662
|
return _p$;
|
|
1231
1663
|
}, {
|
|
1232
1664
|
e: void 0,
|
|
1233
1665
|
t: void 0,
|
|
1234
|
-
a: void 0
|
|
1235
|
-
o: void 0
|
|
1666
|
+
a: void 0
|
|
1236
1667
|
});
|
|
1237
1668
|
return _el$3;
|
|
1238
1669
|
})();
|
|
@@ -1241,9 +1672,12 @@ _$delegateEvents2(["pointerdown", "pointermove", "pointerup", "input", "keydown"
|
|
|
1241
1672
|
|
|
1242
1673
|
// src/solid/components/Toggle.tsx
|
|
1243
1674
|
import { template as _$template4 } from "solid-js/web";
|
|
1244
|
-
import { createComponent as _$createComponent3 } from "solid-js/web";
|
|
1245
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";
|
|
1246
1679
|
import { insert as _$insert4 } from "solid-js/web";
|
|
1680
|
+
import { Show as Show4 } from "solid-js";
|
|
1247
1681
|
|
|
1248
1682
|
// src/solid/components/SegmentedControl.tsx
|
|
1249
1683
|
import { template as _$template3 } from "solid-js/web";
|
|
@@ -1252,114 +1686,98 @@ import { setAttribute as _$setAttribute2 } from "solid-js/web";
|
|
|
1252
1686
|
import { setStyleProperty as _$setStyleProperty2 } from "solid-js/web";
|
|
1253
1687
|
import { effect as _$effect3 } from "solid-js/web";
|
|
1254
1688
|
import { insert as _$insert3 } from "solid-js/web";
|
|
1255
|
-
import { createComponent as _$
|
|
1689
|
+
import { createComponent as _$createComponent4 } from "solid-js/web";
|
|
1256
1690
|
import { use as _$use3 } from "solid-js/web";
|
|
1257
|
-
import { createSignal as
|
|
1258
|
-
|
|
1259
|
-
var _tmpl$
|
|
1260
|
-
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>`);
|
|
1261
1695
|
function SegmentedControl(props) {
|
|
1262
1696
|
let containerRef;
|
|
1263
|
-
let pillRef;
|
|
1264
|
-
const buttonRefs = /* @__PURE__ */ new Map();
|
|
1265
|
-
const [pillReady, setPillReady] = createSignal4(false);
|
|
1266
1697
|
let hasAnimated = false;
|
|
1267
|
-
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
width: buttonRect.width
|
|
1276
|
-
};
|
|
1277
|
-
};
|
|
1278
|
-
const setPillImmediate = (left, width) => {
|
|
1279
|
-
if (!pillRef) return;
|
|
1280
|
-
pillRef.style.left = `${left}px`;
|
|
1281
|
-
pillRef.style.width = `${width}px`;
|
|
1282
|
-
};
|
|
1283
|
-
const updatePill = (shouldAnimate) => {
|
|
1284
|
-
const next = measurePill();
|
|
1285
|
-
if (!next) return;
|
|
1286
|
-
if (!pillReady()) {
|
|
1287
|
-
setPillImmediate(next.left, next.width);
|
|
1288
|
-
setPillReady(true);
|
|
1289
|
-
return;
|
|
1290
|
-
}
|
|
1291
|
-
if (!shouldAnimate || !hasAnimated) {
|
|
1292
|
-
pillAnim?.stop();
|
|
1293
|
-
pillAnim = null;
|
|
1294
|
-
setPillImmediate(next.left, next.width);
|
|
1295
|
-
return;
|
|
1296
|
-
}
|
|
1297
|
-
pillAnim?.stop();
|
|
1298
|
-
pillAnim = animate3(pillRef, {
|
|
1299
|
-
left: next.left,
|
|
1300
|
-
width: next.width
|
|
1301
|
-
}, {
|
|
1302
|
-
type: "spring",
|
|
1303
|
-
visualDuration: 0.2,
|
|
1304
|
-
bounce: 0.15,
|
|
1305
|
-
onComplete: () => {
|
|
1306
|
-
pillAnim = null;
|
|
1307
|
-
}
|
|
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
|
|
1308
1706
|
});
|
|
1309
1707
|
};
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1708
|
+
createEffect3(() => {
|
|
1709
|
+
void props.value;
|
|
1710
|
+
void props.options.length;
|
|
1711
|
+
measure();
|
|
1314
1712
|
});
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1713
|
+
const transition = () => {
|
|
1714
|
+
void props.value;
|
|
1715
|
+
if (!hasAnimated) {
|
|
1318
1716
|
hasAnimated = true;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
onCleanup4(() => {
|
|
1324
|
-
pillAnim?.stop();
|
|
1325
|
-
ro.disconnect();
|
|
1326
|
-
});
|
|
1327
|
-
});
|
|
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
|
+
};
|
|
1328
1721
|
return (() => {
|
|
1329
|
-
var _el$ = _tmpl$
|
|
1722
|
+
var _el$ = _tmpl$11();
|
|
1330
1723
|
var _ref$ = containerRef;
|
|
1331
1724
|
typeof _ref$ === "function" ? _$use3(_ref$, _el$) : containerRef = _el$;
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
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, {
|
|
1335
1746
|
get each() {
|
|
1336
1747
|
return props.options;
|
|
1337
1748
|
},
|
|
1338
1749
|
children: (option) => (() => {
|
|
1339
|
-
var _el$3 = _tmpl$
|
|
1750
|
+
var _el$3 = _tmpl$33();
|
|
1340
1751
|
_el$3.$$click = () => props.onChange(option.value);
|
|
1341
|
-
_$use3((el) => {
|
|
1342
|
-
if (!el) return;
|
|
1343
|
-
buttonRefs.set(option.value, el);
|
|
1344
|
-
}, _el$3);
|
|
1345
1752
|
_$insert3(_el$3, () => option.label);
|
|
1346
1753
|
_$effect3(() => _$setAttribute2(_el$3, "data-active", String(props.value === option.value)));
|
|
1347
1754
|
return _el$3;
|
|
1348
1755
|
})()
|
|
1349
1756
|
}), null);
|
|
1350
|
-
_$effect3((_$p) => _$setStyleProperty2(_el$2, "visibility", pillReady() ? "visible" : "hidden"));
|
|
1351
1757
|
return _el$;
|
|
1352
1758
|
})();
|
|
1353
1759
|
}
|
|
1354
1760
|
_$delegateEvents3(["click"]);
|
|
1355
1761
|
|
|
1356
1762
|
// src/solid/components/Toggle.tsx
|
|
1357
|
-
var _tmpl$
|
|
1763
|
+
var _tmpl$12 = /* @__PURE__ */ _$template4(`<span>`);
|
|
1764
|
+
var _tmpl$24 = /* @__PURE__ */ _$template4(`<div class=dialkit-labeled-control><span class=dialkit-labeled-control-label>`);
|
|
1358
1765
|
function Toggle(props) {
|
|
1359
1766
|
return (() => {
|
|
1360
|
-
var _el$ = _tmpl$
|
|
1361
|
-
_$insert4(_el$2, () => props.label);
|
|
1362
|
-
_$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, {
|
|
1363
1781
|
options: [{
|
|
1364
1782
|
value: "off",
|
|
1365
1783
|
label: "Off"
|
|
@@ -1380,17 +1798,17 @@ function Toggle(props) {
|
|
|
1380
1798
|
import { template as _$template6 } from "solid-js/web";
|
|
1381
1799
|
import { memo as _$memo4 } from "solid-js/web";
|
|
1382
1800
|
import { insert as _$insert6 } from "solid-js/web";
|
|
1383
|
-
import { createComponent as _$
|
|
1384
|
-
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";
|
|
1385
1803
|
|
|
1386
1804
|
// src/solid/components/SpringVisualization.tsx
|
|
1387
1805
|
import { template as _$template5 } from "solid-js/web";
|
|
1388
|
-
import { effect as _$
|
|
1806
|
+
import { effect as _$effect5 } from "solid-js/web";
|
|
1389
1807
|
import { insert as _$insert5 } from "solid-js/web";
|
|
1390
1808
|
import { setAttribute as _$setAttribute3 } from "solid-js/web";
|
|
1391
|
-
var _tmpl$
|
|
1392
|
-
var _tmpl$
|
|
1393
|
-
var _tmpl$
|
|
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);
|
|
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>`);
|
|
1394
1812
|
function generateSpringCurve(stiffness, damping, mass, duration) {
|
|
1395
1813
|
const points = [];
|
|
1396
1814
|
const steps = 100;
|
|
@@ -1448,12 +1866,12 @@ function SpringVisualization(props) {
|
|
|
1448
1866
|
const x = width / 4 * i;
|
|
1449
1867
|
const y = height / 4 * i;
|
|
1450
1868
|
lines.push((() => {
|
|
1451
|
-
var _el$ = _tmpl$
|
|
1869
|
+
var _el$ = _tmpl$13();
|
|
1452
1870
|
_$setAttribute3(_el$, "x1", x);
|
|
1453
1871
|
_$setAttribute3(_el$, "x2", x);
|
|
1454
1872
|
return _el$;
|
|
1455
1873
|
})(), (() => {
|
|
1456
|
-
var _el$2 = _tmpl$
|
|
1874
|
+
var _el$2 = _tmpl$25();
|
|
1457
1875
|
_$setAttribute3(_el$2, "y1", y);
|
|
1458
1876
|
_$setAttribute3(_el$2, "y2", y);
|
|
1459
1877
|
return _el$2;
|
|
@@ -1462,17 +1880,17 @@ function SpringVisualization(props) {
|
|
|
1462
1880
|
return lines;
|
|
1463
1881
|
};
|
|
1464
1882
|
return (() => {
|
|
1465
|
-
var _el$3 = _tmpl$
|
|
1883
|
+
var _el$3 = _tmpl$34(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
|
|
1466
1884
|
_$insert5(_el$3, gridLines, _el$4);
|
|
1467
|
-
_$
|
|
1885
|
+
_$effect5(() => _$setAttribute3(_el$5, "d", params()));
|
|
1468
1886
|
return _el$3;
|
|
1469
1887
|
})();
|
|
1470
1888
|
}
|
|
1471
1889
|
|
|
1472
1890
|
// src/solid/components/SpringControl.tsx
|
|
1473
|
-
var _tmpl$
|
|
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`);
|
|
1474
1892
|
function SpringControl(props) {
|
|
1475
|
-
const [mode, setMode] =
|
|
1893
|
+
const [mode, setMode] = createSignal6(DialStore.getSpringMode(props.panelId, props.path));
|
|
1476
1894
|
onMount4(() => {
|
|
1477
1895
|
const unsub = DialStore.subscribe(props.panelId, () => {
|
|
1478
1896
|
setMode(DialStore.getSpringMode(props.panelId, props.path));
|
|
@@ -1480,34 +1898,30 @@ function SpringControl(props) {
|
|
|
1480
1898
|
onCleanup5(unsub);
|
|
1481
1899
|
});
|
|
1482
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
|
+
};
|
|
1483
1914
|
const handleModeChange = (newMode) => {
|
|
1915
|
+
if (isSimpleMode()) {
|
|
1916
|
+
cache.simple = props.spring;
|
|
1917
|
+
} else {
|
|
1918
|
+
cache.advanced = props.spring;
|
|
1919
|
+
}
|
|
1484
1920
|
DialStore.updateSpringMode(props.panelId, props.path, newMode);
|
|
1485
1921
|
if (newMode === "simple") {
|
|
1486
|
-
|
|
1487
|
-
stiffness,
|
|
1488
|
-
damping,
|
|
1489
|
-
mass,
|
|
1490
|
-
...rest
|
|
1491
|
-
} = props.spring;
|
|
1492
|
-
props.onChange({
|
|
1493
|
-
...rest,
|
|
1494
|
-
type: "spring",
|
|
1495
|
-
visualDuration: props.spring.visualDuration ?? 0.3,
|
|
1496
|
-
bounce: props.spring.bounce ?? 0.2
|
|
1497
|
-
});
|
|
1922
|
+
props.onChange(cache.simple);
|
|
1498
1923
|
} else {
|
|
1499
|
-
|
|
1500
|
-
visualDuration,
|
|
1501
|
-
bounce,
|
|
1502
|
-
...rest
|
|
1503
|
-
} = props.spring;
|
|
1504
|
-
props.onChange({
|
|
1505
|
-
...rest,
|
|
1506
|
-
type: "spring",
|
|
1507
|
-
stiffness: props.spring.stiffness ?? 200,
|
|
1508
|
-
damping: props.spring.damping ?? 25,
|
|
1509
|
-
mass: props.spring.mass ?? 1
|
|
1510
|
-
});
|
|
1924
|
+
props.onChange(cache.advanced);
|
|
1511
1925
|
}
|
|
1512
1926
|
};
|
|
1513
1927
|
const handleUpdate = (key, value) => {
|
|
@@ -1534,14 +1948,14 @@ function SpringControl(props) {
|
|
|
1534
1948
|
});
|
|
1535
1949
|
}
|
|
1536
1950
|
};
|
|
1537
|
-
return _$
|
|
1951
|
+
return _$createComponent6(Folder, {
|
|
1538
1952
|
get title() {
|
|
1539
1953
|
return props.label;
|
|
1540
1954
|
},
|
|
1541
1955
|
defaultOpen: true,
|
|
1542
1956
|
get children() {
|
|
1543
|
-
var _el$ = _tmpl$
|
|
1544
|
-
_$insert6(_el$, _$
|
|
1957
|
+
var _el$ = _tmpl$14(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
1958
|
+
_$insert6(_el$, _$createComponent6(SpringVisualization, {
|
|
1545
1959
|
get spring() {
|
|
1546
1960
|
return props.spring;
|
|
1547
1961
|
},
|
|
@@ -1549,7 +1963,7 @@ function SpringControl(props) {
|
|
|
1549
1963
|
return isSimpleMode();
|
|
1550
1964
|
}
|
|
1551
1965
|
}), _el$2);
|
|
1552
|
-
_$insert6(_el$2, _$
|
|
1966
|
+
_$insert6(_el$2, _$createComponent6(SegmentedControl, {
|
|
1553
1967
|
options: [{
|
|
1554
1968
|
value: "simple",
|
|
1555
1969
|
label: "Time"
|
|
@@ -1564,7 +1978,7 @@ function SpringControl(props) {
|
|
|
1564
1978
|
}), null);
|
|
1565
1979
|
_$insert6(_el$, (() => {
|
|
1566
1980
|
var _c$ = _$memo4(() => !!isSimpleMode());
|
|
1567
|
-
return () => _c$() ? [_$
|
|
1981
|
+
return () => _c$() ? [_$createComponent6(Slider, {
|
|
1568
1982
|
label: "Duration",
|
|
1569
1983
|
get value() {
|
|
1570
1984
|
return props.spring.visualDuration ?? 0.3;
|
|
@@ -1574,7 +1988,7 @@ function SpringControl(props) {
|
|
|
1574
1988
|
max: 1,
|
|
1575
1989
|
step: 0.05,
|
|
1576
1990
|
unit: "s"
|
|
1577
|
-
}), _$
|
|
1991
|
+
}), _$createComponent6(Slider, {
|
|
1578
1992
|
label: "Bounce",
|
|
1579
1993
|
get value() {
|
|
1580
1994
|
return props.spring.bounce ?? 0.2;
|
|
@@ -1583,7 +1997,7 @@ function SpringControl(props) {
|
|
|
1583
1997
|
min: 0,
|
|
1584
1998
|
max: 1,
|
|
1585
1999
|
step: 0.05
|
|
1586
|
-
})] : [_$
|
|
2000
|
+
})] : [_$createComponent6(Slider, {
|
|
1587
2001
|
label: "Stiffness",
|
|
1588
2002
|
get value() {
|
|
1589
2003
|
return props.spring.stiffness ?? 400;
|
|
@@ -1592,7 +2006,7 @@ function SpringControl(props) {
|
|
|
1592
2006
|
min: 1,
|
|
1593
2007
|
max: 1e3,
|
|
1594
2008
|
step: 10
|
|
1595
|
-
}), _$
|
|
2009
|
+
}), _$createComponent6(Slider, {
|
|
1596
2010
|
label: "Damping",
|
|
1597
2011
|
get value() {
|
|
1598
2012
|
return props.spring.damping ?? 17;
|
|
@@ -1601,7 +2015,7 @@ function SpringControl(props) {
|
|
|
1601
2015
|
min: 1,
|
|
1602
2016
|
max: 100,
|
|
1603
2017
|
step: 1
|
|
1604
|
-
}), _$
|
|
2018
|
+
}), _$createComponent6(Slider, {
|
|
1605
2019
|
label: "Mass",
|
|
1606
2020
|
get value() {
|
|
1607
2021
|
return props.spring.mass ?? 1;
|
|
@@ -1620,21 +2034,21 @@ function SpringControl(props) {
|
|
|
1620
2034
|
// src/solid/components/TextControl.tsx
|
|
1621
2035
|
import { template as _$template7 } from "solid-js/web";
|
|
1622
2036
|
import { delegateEvents as _$delegateEvents4 } from "solid-js/web";
|
|
1623
|
-
import { effect as _$
|
|
2037
|
+
import { effect as _$effect6 } from "solid-js/web";
|
|
1624
2038
|
import { insert as _$insert7 } from "solid-js/web";
|
|
1625
2039
|
import { setAttribute as _$setAttribute4 } from "solid-js/web";
|
|
1626
2040
|
import { createUniqueId as createUniqueId2 } from "solid-js";
|
|
1627
|
-
var _tmpl$
|
|
2041
|
+
var _tmpl$15 = /* @__PURE__ */ _$template7(`<div class=dialkit-text-control><label class=dialkit-text-label></label><input type=text class=dialkit-text-input>`);
|
|
1628
2042
|
function TextControl(props) {
|
|
1629
2043
|
const inputId = createUniqueId2();
|
|
1630
2044
|
return (() => {
|
|
1631
|
-
var _el$ = _tmpl$
|
|
2045
|
+
var _el$ = _tmpl$15(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
1632
2046
|
_$setAttribute4(_el$2, "for", inputId);
|
|
1633
2047
|
_$insert7(_el$2, () => props.label);
|
|
1634
2048
|
_el$3.$$input = (e) => props.onChange(e.currentTarget.value);
|
|
1635
2049
|
_$setAttribute4(_el$3, "id", inputId);
|
|
1636
|
-
_$
|
|
1637
|
-
_$
|
|
2050
|
+
_$effect6(() => _$setAttribute4(_el$3, "placeholder", props.placeholder));
|
|
2051
|
+
_$effect6(() => _el$3.value = props.value);
|
|
1638
2052
|
return _el$;
|
|
1639
2053
|
})();
|
|
1640
2054
|
}
|
|
@@ -1643,19 +2057,19 @@ _$delegateEvents4(["input"]);
|
|
|
1643
2057
|
// src/solid/components/SelectControl.tsx
|
|
1644
2058
|
import { template as _$template8 } from "solid-js/web";
|
|
1645
2059
|
import { delegateEvents as _$delegateEvents5 } from "solid-js/web";
|
|
1646
|
-
import { setAttribute as _$setAttribute5 } from "solid-js/web";
|
|
1647
2060
|
import { style as _$style2 } from "solid-js/web";
|
|
1648
|
-
import { effect as _$
|
|
1649
|
-
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";
|
|
1650
2064
|
import { memo as _$memo5 } from "solid-js/web";
|
|
1651
2065
|
import { insert as _$insert8 } from "solid-js/web";
|
|
1652
2066
|
import { use as _$use4 } from "solid-js/web";
|
|
1653
|
-
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";
|
|
1654
2068
|
import { Portal } from "solid-js/web";
|
|
1655
|
-
import { animate as
|
|
1656
|
-
var _tmpl$
|
|
1657
|
-
var _tmpl$
|
|
1658
|
-
var _tmpl$
|
|
2069
|
+
import { animate as animate3 } from "motion";
|
|
2070
|
+
var _tmpl$16 = /* @__PURE__ */ _$template8(`<div class=dialkit-select-dropdown>`);
|
|
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>`);
|
|
1659
2073
|
function toTitleCase(s) {
|
|
1660
2074
|
return s.replace(/\b\w/g, (c) => c.toUpperCase());
|
|
1661
2075
|
}
|
|
@@ -1666,10 +2080,10 @@ function normalizeOptions(options) {
|
|
|
1666
2080
|
} : opt);
|
|
1667
2081
|
}
|
|
1668
2082
|
function SelectControl(props) {
|
|
1669
|
-
const [isOpen, setIsOpen] =
|
|
1670
|
-
const [mounted, setMounted] =
|
|
1671
|
-
const [pos, setPos] =
|
|
1672
|
-
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);
|
|
1673
2087
|
let triggerRef;
|
|
1674
2088
|
let dropdownRef;
|
|
1675
2089
|
let chevronRef;
|
|
@@ -1688,11 +2102,11 @@ function SelectControl(props) {
|
|
|
1688
2102
|
chevronAnim?.stop();
|
|
1689
2103
|
});
|
|
1690
2104
|
});
|
|
1691
|
-
|
|
2105
|
+
createEffect4(() => {
|
|
1692
2106
|
if (!chevronRef) return;
|
|
1693
2107
|
const open = isOpen();
|
|
1694
2108
|
chevronAnim?.stop();
|
|
1695
|
-
chevronAnim =
|
|
2109
|
+
chevronAnim = animate3(chevronRef, {
|
|
1696
2110
|
rotate: open ? 180 : 0
|
|
1697
2111
|
}, {
|
|
1698
2112
|
type: "spring",
|
|
@@ -1728,7 +2142,7 @@ function SelectControl(props) {
|
|
|
1728
2142
|
}
|
|
1729
2143
|
const above = pos()?.above ?? false;
|
|
1730
2144
|
closeAnim?.stop();
|
|
1731
|
-
closeAnim =
|
|
2145
|
+
closeAnim = animate3(dropdownRef, {
|
|
1732
2146
|
opacity: 0,
|
|
1733
2147
|
y: above ? 8 : -8,
|
|
1734
2148
|
scale: 0.95
|
|
@@ -1742,7 +2156,7 @@ function SelectControl(props) {
|
|
|
1742
2156
|
}
|
|
1743
2157
|
});
|
|
1744
2158
|
};
|
|
1745
|
-
|
|
2159
|
+
createEffect4(() => {
|
|
1746
2160
|
if (!isOpen()) return;
|
|
1747
2161
|
const handleViewportChange = () => updatePos();
|
|
1748
2162
|
const handleClick = (e) => {
|
|
@@ -1778,7 +2192,7 @@ function SelectControl(props) {
|
|
|
1778
2192
|
};
|
|
1779
2193
|
};
|
|
1780
2194
|
return (() => {
|
|
1781
|
-
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;
|
|
1782
2196
|
_el$2.$$click = () => isOpen() ? closeDropdown() : openDropdown();
|
|
1783
2197
|
var _ref$ = triggerRef;
|
|
1784
2198
|
typeof _ref$ === "function" ? _$use4(_ref$, _el$2) : triggerRef = _el$2;
|
|
@@ -1786,26 +2200,27 @@ function SelectControl(props) {
|
|
|
1786
2200
|
_$insert8(_el$5, () => selectedOption()?.label ?? props.value);
|
|
1787
2201
|
var _ref$2 = chevronRef;
|
|
1788
2202
|
typeof _ref$2 === "function" ? _$use4(_ref$2, _el$6) : chevronRef = _el$6;
|
|
1789
|
-
_$
|
|
2203
|
+
_$setAttribute5(_el$7, "d", ICON_CHEVRON);
|
|
2204
|
+
_$insert8(_el$, _$createComponent7(Show5, {
|
|
1790
2205
|
get when() {
|
|
1791
2206
|
return !!portalTarget();
|
|
1792
2207
|
},
|
|
1793
2208
|
get children() {
|
|
1794
|
-
return _$
|
|
2209
|
+
return _$createComponent7(Portal, {
|
|
1795
2210
|
get mount() {
|
|
1796
2211
|
return portalTarget();
|
|
1797
2212
|
},
|
|
1798
2213
|
get children() {
|
|
1799
|
-
return _$
|
|
2214
|
+
return _$createComponent7(Show5, {
|
|
1800
2215
|
get when() {
|
|
1801
2216
|
return _$memo5(() => !!mounted())() && pos();
|
|
1802
2217
|
},
|
|
1803
2218
|
get children() {
|
|
1804
|
-
var _el$
|
|
2219
|
+
var _el$8 = _tmpl$16();
|
|
1805
2220
|
_$use4((el) => {
|
|
1806
2221
|
dropdownRef = el;
|
|
1807
2222
|
const above = pos()?.above ?? false;
|
|
1808
|
-
|
|
2223
|
+
animate3(el, {
|
|
1809
2224
|
opacity: [0, 1],
|
|
1810
2225
|
y: [above ? 8 : -8, 0],
|
|
1811
2226
|
scale: [0.95, 1]
|
|
@@ -1814,31 +2229,31 @@ function SelectControl(props) {
|
|
|
1814
2229
|
visualDuration: 0.15,
|
|
1815
2230
|
bounce: 0
|
|
1816
2231
|
});
|
|
1817
|
-
}, _el$
|
|
1818
|
-
_$insert8(_el$
|
|
2232
|
+
}, _el$8);
|
|
2233
|
+
_$insert8(_el$8, _$createComponent7(For2, {
|
|
1819
2234
|
get each() {
|
|
1820
2235
|
return normalized();
|
|
1821
2236
|
},
|
|
1822
2237
|
children: (option) => (() => {
|
|
1823
|
-
var _el$
|
|
1824
|
-
_el$
|
|
2238
|
+
var _el$9 = _tmpl$35();
|
|
2239
|
+
_el$9.$$click = () => {
|
|
1825
2240
|
props.onChange(option.value);
|
|
1826
2241
|
closeDropdown();
|
|
1827
2242
|
};
|
|
1828
|
-
_$insert8(_el$
|
|
1829
|
-
_$
|
|
1830
|
-
return _el$
|
|
2243
|
+
_$insert8(_el$9, () => option.label);
|
|
2244
|
+
_$effect7(() => _$setAttribute5(_el$9, "data-selected", String(option.value === props.value)));
|
|
2245
|
+
return _el$9;
|
|
1831
2246
|
})()
|
|
1832
2247
|
}));
|
|
1833
|
-
_$
|
|
1834
|
-
return _el$
|
|
2248
|
+
_$effect7((_$p) => _$style2(_el$8, dropdownStyle(), _$p));
|
|
2249
|
+
return _el$8;
|
|
1835
2250
|
}
|
|
1836
2251
|
});
|
|
1837
2252
|
}
|
|
1838
2253
|
});
|
|
1839
2254
|
}
|
|
1840
2255
|
}), null);
|
|
1841
|
-
_$
|
|
2256
|
+
_$effect7(() => _$setAttribute5(_el$2, "data-open", String(isOpen())));
|
|
1842
2257
|
return _el$;
|
|
1843
2258
|
})();
|
|
1844
2259
|
}
|
|
@@ -1849,25 +2264,25 @@ import { template as _$template9 } from "solid-js/web";
|
|
|
1849
2264
|
import { delegateEvents as _$delegateEvents6 } from "solid-js/web";
|
|
1850
2265
|
import { setStyleProperty as _$setStyleProperty3 } from "solid-js/web";
|
|
1851
2266
|
import { use as _$use5 } from "solid-js/web";
|
|
1852
|
-
import { createComponent as _$
|
|
1853
|
-
import { effect as _$
|
|
2267
|
+
import { createComponent as _$createComponent8 } from "solid-js/web";
|
|
2268
|
+
import { effect as _$effect8 } from "solid-js/web";
|
|
1854
2269
|
import { insert as _$insert9 } from "solid-js/web";
|
|
1855
2270
|
import { setAttribute as _$setAttribute6 } from "solid-js/web";
|
|
1856
|
-
import { createSignal as
|
|
1857
|
-
var _tmpl$
|
|
1858
|
-
var _tmpl$
|
|
1859
|
-
var _tmpl$
|
|
2271
|
+
import { createSignal as createSignal8, createEffect as createEffect5, createUniqueId as createUniqueId3, Show as Show6 } from "solid-js";
|
|
2272
|
+
var _tmpl$17 = /* @__PURE__ */ _$template9(`<input type=text class=dialkit-color-hex-input autofocus>`);
|
|
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>`);
|
|
1860
2275
|
var HEX_COLOR_REGEX = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;
|
|
1861
2276
|
function expandShorthandHex(hex) {
|
|
1862
2277
|
if (hex.length !== 4) return hex;
|
|
1863
2278
|
return `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`;
|
|
1864
2279
|
}
|
|
1865
2280
|
function ColorControl(props) {
|
|
1866
|
-
const [isEditing, setIsEditing] =
|
|
1867
|
-
const [editValue, setEditValue] =
|
|
2281
|
+
const [isEditing, setIsEditing] = createSignal8(false);
|
|
2282
|
+
const [editValue, setEditValue] = createSignal8(props.value);
|
|
1868
2283
|
const textInputId = createUniqueId3();
|
|
1869
2284
|
let colorInputRef;
|
|
1870
|
-
|
|
2285
|
+
createEffect5(() => {
|
|
1871
2286
|
if (!isEditing()) {
|
|
1872
2287
|
setEditValue(props.value);
|
|
1873
2288
|
}
|
|
@@ -1888,28 +2303,28 @@ function ColorControl(props) {
|
|
|
1888
2303
|
}
|
|
1889
2304
|
};
|
|
1890
2305
|
return (() => {
|
|
1891
|
-
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;
|
|
1892
2307
|
_$setAttribute6(_el$2, "for", textInputId);
|
|
1893
2308
|
_$insert9(_el$2, () => props.label);
|
|
1894
|
-
_$insert9(_el$3, _$
|
|
2309
|
+
_$insert9(_el$3, _$createComponent8(Show6, {
|
|
1895
2310
|
get when() {
|
|
1896
2311
|
return isEditing();
|
|
1897
2312
|
},
|
|
1898
2313
|
get fallback() {
|
|
1899
2314
|
return (() => {
|
|
1900
|
-
var _el$7 = _tmpl$
|
|
2315
|
+
var _el$7 = _tmpl$36();
|
|
1901
2316
|
_el$7.$$click = () => setIsEditing(true);
|
|
1902
2317
|
_$insert9(_el$7, () => (props.value ?? "").toUpperCase());
|
|
1903
2318
|
return _el$7;
|
|
1904
2319
|
})();
|
|
1905
2320
|
},
|
|
1906
2321
|
get children() {
|
|
1907
|
-
var _el$4 = _tmpl$
|
|
2322
|
+
var _el$4 = _tmpl$17();
|
|
1908
2323
|
_el$4.$$keydown = handleKeyDown;
|
|
1909
2324
|
_el$4.addEventListener("blur", handleTextSubmit);
|
|
1910
2325
|
_el$4.$$input = (e) => setEditValue(e.currentTarget.value);
|
|
1911
2326
|
_$setAttribute6(_el$4, "id", textInputId);
|
|
1912
|
-
_$
|
|
2327
|
+
_$effect8(() => _el$4.value = editValue());
|
|
1913
2328
|
return _el$4;
|
|
1914
2329
|
}
|
|
1915
2330
|
}), _el$5);
|
|
@@ -1917,7 +2332,7 @@ function ColorControl(props) {
|
|
|
1917
2332
|
_el$6.$$input = (e) => props.onChange(e.currentTarget.value);
|
|
1918
2333
|
var _ref$ = colorInputRef;
|
|
1919
2334
|
typeof _ref$ === "function" ? _$use5(_ref$, _el$6) : colorInputRef = _el$6;
|
|
1920
|
-
_$
|
|
2335
|
+
_$effect8((_p$) => {
|
|
1921
2336
|
var _v$ = props.value, _v$2 = `Pick color for ${props.label}`, _v$3 = `${props.label} color picker`;
|
|
1922
2337
|
_v$ !== _p$.e && _$setStyleProperty3(_el$5, "background-color", _p$.e = _v$);
|
|
1923
2338
|
_v$2 !== _p$.t && _$setAttribute6(_el$5, "aria-label", _p$.t = _v$2);
|
|
@@ -1928,7 +2343,7 @@ function ColorControl(props) {
|
|
|
1928
2343
|
t: void 0,
|
|
1929
2344
|
a: void 0
|
|
1930
2345
|
});
|
|
1931
|
-
_$
|
|
2346
|
+
_$effect8(() => _el$6.value = props.value.length === 4 ? expandShorthandHex(props.value) : props.value.slice(0, 7));
|
|
1932
2347
|
return _el$;
|
|
1933
2348
|
})();
|
|
1934
2349
|
}
|
|
@@ -1937,28 +2352,28 @@ _$delegateEvents6(["input", "keydown", "click"]);
|
|
|
1937
2352
|
// src/solid/components/PresetManager.tsx
|
|
1938
2353
|
import { template as _$template10 } from "solid-js/web";
|
|
1939
2354
|
import { delegateEvents as _$delegateEvents7 } from "solid-js/web";
|
|
1940
|
-
import { setAttribute as _$setAttribute7 } from "solid-js/web";
|
|
1941
2355
|
import { setStyleProperty as _$setStyleProperty4 } from "solid-js/web";
|
|
1942
|
-
import { effect as _$
|
|
1943
|
-
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";
|
|
1944
2359
|
import { insert as _$insert10 } from "solid-js/web";
|
|
1945
2360
|
import { memo as _$memo6 } from "solid-js/web";
|
|
1946
2361
|
import { use as _$use6 } from "solid-js/web";
|
|
1947
|
-
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";
|
|
1948
2363
|
import { Portal as Portal2 } from "solid-js/web";
|
|
1949
|
-
import { animate as
|
|
1950
|
-
var _tmpl$
|
|
1951
|
-
var _tmpl$
|
|
1952
|
-
var _tmpl$
|
|
2364
|
+
import { animate as animate4 } from "motion";
|
|
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`);
|
|
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>`);
|
|
1953
2368
|
function PresetManager(props) {
|
|
1954
|
-
const [isOpen, setIsOpen] =
|
|
1955
|
-
const [mounted, setMounted] =
|
|
1956
|
-
const [pos, setPos] =
|
|
2369
|
+
const [isOpen, setIsOpen] = createSignal9(false);
|
|
2370
|
+
const [mounted, setMounted] = createSignal9(false);
|
|
2371
|
+
const [pos, setPos] = createSignal9({
|
|
1957
2372
|
top: 0,
|
|
1958
2373
|
left: 0,
|
|
1959
2374
|
width: 0
|
|
1960
2375
|
});
|
|
1961
|
-
const [portalTarget, setPortalTarget] =
|
|
2376
|
+
const [portalTarget, setPortalTarget] = createSignal9(null);
|
|
1962
2377
|
let triggerRef;
|
|
1963
2378
|
let dropdownRef;
|
|
1964
2379
|
let chevronRef;
|
|
@@ -1978,12 +2393,12 @@ function PresetManager(props) {
|
|
|
1978
2393
|
chevronAnim?.stop();
|
|
1979
2394
|
});
|
|
1980
2395
|
});
|
|
1981
|
-
|
|
2396
|
+
createEffect6(() => {
|
|
1982
2397
|
if (!chevronRef) return;
|
|
1983
2398
|
const open = isOpen();
|
|
1984
2399
|
const has = hasPresets();
|
|
1985
2400
|
chevronAnim?.stop();
|
|
1986
|
-
chevronAnim =
|
|
2401
|
+
chevronAnim = animate4(chevronRef, {
|
|
1987
2402
|
rotate: open ? 180 : 0,
|
|
1988
2403
|
opacity: has ? 0.6 : 0.25
|
|
1989
2404
|
}, {
|
|
@@ -2016,7 +2431,7 @@ function PresetManager(props) {
|
|
|
2016
2431
|
return;
|
|
2017
2432
|
}
|
|
2018
2433
|
closeAnim?.stop();
|
|
2019
|
-
closeAnim =
|
|
2434
|
+
closeAnim = animate4(dropdownRef, {
|
|
2020
2435
|
opacity: 0,
|
|
2021
2436
|
y: 4,
|
|
2022
2437
|
scale: 0.97
|
|
@@ -2034,7 +2449,7 @@ function PresetManager(props) {
|
|
|
2034
2449
|
if (isOpen()) closeDropdown();
|
|
2035
2450
|
else openDropdown();
|
|
2036
2451
|
};
|
|
2037
|
-
|
|
2452
|
+
createEffect6(() => {
|
|
2038
2453
|
if (!isOpen()) return;
|
|
2039
2454
|
const handleViewportChange = () => updatePos();
|
|
2040
2455
|
const handler = (e) => {
|
|
@@ -2062,7 +2477,7 @@ function PresetManager(props) {
|
|
|
2062
2477
|
DialStore.deletePreset(props.panelId, presetId);
|
|
2063
2478
|
};
|
|
2064
2479
|
return (() => {
|
|
2065
|
-
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;
|
|
2066
2481
|
_el$2.$$click = toggle;
|
|
2067
2482
|
var _ref$ = triggerRef;
|
|
2068
2483
|
typeof _ref$ === "function" ? _$use6(_ref$, _el$2) : triggerRef = _el$2;
|
|
@@ -2072,25 +2487,26 @@ function PresetManager(props) {
|
|
|
2072
2487
|
})());
|
|
2073
2488
|
var _ref$2 = chevronRef;
|
|
2074
2489
|
typeof _ref$2 === "function" ? _$use6(_ref$2, _el$4) : chevronRef = _el$4;
|
|
2075
|
-
_$
|
|
2490
|
+
_$setAttribute7(_el$5, "d", ICON_CHEVRON);
|
|
2491
|
+
_$insert10(_el$, _$createComponent9(Show7, {
|
|
2076
2492
|
get when() {
|
|
2077
2493
|
return !!portalTarget();
|
|
2078
2494
|
},
|
|
2079
2495
|
get children() {
|
|
2080
|
-
return _$
|
|
2496
|
+
return _$createComponent9(Portal2, {
|
|
2081
2497
|
get mount() {
|
|
2082
2498
|
return portalTarget();
|
|
2083
2499
|
},
|
|
2084
2500
|
get children() {
|
|
2085
|
-
return _$
|
|
2501
|
+
return _$createComponent9(Show7, {
|
|
2086
2502
|
get when() {
|
|
2087
2503
|
return mounted();
|
|
2088
2504
|
},
|
|
2089
2505
|
get children() {
|
|
2090
|
-
var _el$
|
|
2506
|
+
var _el$6 = _tmpl$18(), _el$7 = _el$6.firstChild;
|
|
2091
2507
|
_$use6((el) => {
|
|
2092
2508
|
dropdownRef = el;
|
|
2093
|
-
|
|
2509
|
+
animate4(el, {
|
|
2094
2510
|
opacity: [0, 1],
|
|
2095
2511
|
y: [4, 0],
|
|
2096
2512
|
scale: [0.97, 1]
|
|
@@ -2099,27 +2515,43 @@ function PresetManager(props) {
|
|
|
2099
2515
|
visualDuration: 0.15,
|
|
2100
2516
|
bounce: 0
|
|
2101
2517
|
});
|
|
2102
|
-
}, _el$
|
|
2103
|
-
_el$
|
|
2104
|
-
_$insert10(_el$
|
|
2518
|
+
}, _el$6);
|
|
2519
|
+
_el$7.$$click = () => handleSelect(null);
|
|
2520
|
+
_$insert10(_el$6, _$createComponent9(For3, {
|
|
2105
2521
|
get each() {
|
|
2106
2522
|
return props.presets;
|
|
2107
2523
|
},
|
|
2108
2524
|
children: (preset) => (() => {
|
|
2109
|
-
var _el$
|
|
2110
|
-
_el$
|
|
2111
|
-
_$insert10(_el$
|
|
2112
|
-
_el$
|
|
2113
|
-
_$
|
|
2114
|
-
|
|
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;
|
|
2115
2547
|
})()
|
|
2116
2548
|
}), null);
|
|
2117
|
-
_$
|
|
2549
|
+
_$effect9((_p$) => {
|
|
2118
2550
|
var _v$ = `${pos().top}px`, _v$2 = `${pos().left}px`, _v$3 = `${pos().width}px`, _v$4 = String(!props.activePresetId);
|
|
2119
|
-
_v$ !== _p$.e && _$setStyleProperty4(_el$
|
|
2120
|
-
_v$2 !== _p$.t && _$setStyleProperty4(_el$
|
|
2121
|
-
_v$3 !== _p$.a && _$setStyleProperty4(_el$
|
|
2122
|
-
_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);
|
|
2123
2555
|
return _p$;
|
|
2124
2556
|
}, {
|
|
2125
2557
|
e: void 0,
|
|
@@ -2127,14 +2559,14 @@ function PresetManager(props) {
|
|
|
2127
2559
|
a: void 0,
|
|
2128
2560
|
o: void 0
|
|
2129
2561
|
});
|
|
2130
|
-
return _el$
|
|
2562
|
+
return _el$6;
|
|
2131
2563
|
}
|
|
2132
2564
|
});
|
|
2133
2565
|
}
|
|
2134
2566
|
});
|
|
2135
2567
|
}
|
|
2136
2568
|
}), null);
|
|
2137
|
-
_$
|
|
2569
|
+
_$effect9((_p$) => {
|
|
2138
2570
|
var _v$5 = String(isOpen()), _v$6 = String(!!activePreset()), _v$7 = String(!hasPresets());
|
|
2139
2571
|
_v$5 !== _p$.e && _$setAttribute7(_el$2, "data-open", _p$.e = _v$5);
|
|
2140
2572
|
_v$6 !== _p$.t && _$setAttribute7(_el$2, "data-has-preset", _p$.t = _v$6);
|
|
@@ -2151,16 +2583,18 @@ function PresetManager(props) {
|
|
|
2151
2583
|
_$delegateEvents7(["click"]);
|
|
2152
2584
|
|
|
2153
2585
|
// src/solid/components/Panel.tsx
|
|
2154
|
-
var _tmpl$
|
|
2155
|
-
var _tmpl$
|
|
2156
|
-
var _tmpl$
|
|
2586
|
+
var _tmpl$19 = /* @__PURE__ */ _$template11(`<button class=dialkit-button>`);
|
|
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`);
|
|
2157
2589
|
var _tmpl$43 = /* @__PURE__ */ _$template11(`<div class=dialkit-panel-wrapper>`);
|
|
2158
2590
|
function Panel(props) {
|
|
2159
|
-
const [copied, setCopied] =
|
|
2160
|
-
const [isPanelOpen, setIsPanelOpen] =
|
|
2161
|
-
const
|
|
2162
|
-
const
|
|
2163
|
-
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));
|
|
2164
2598
|
let addButtonRef;
|
|
2165
2599
|
let copyButtonRef;
|
|
2166
2600
|
let copyClipboardIconRef;
|
|
@@ -2211,7 +2645,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2211
2645
|
setCopied(true);
|
|
2212
2646
|
setTimeout(() => setCopied(false), 1500);
|
|
2213
2647
|
};
|
|
2214
|
-
|
|
2648
|
+
createEffect7(() => {
|
|
2215
2649
|
const isCopied = copied();
|
|
2216
2650
|
if (!copyClipboardIconRef || !copyCheckIconRef) return;
|
|
2217
2651
|
copyClipboardAnim?.stop();
|
|
@@ -2222,12 +2656,12 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2222
2656
|
visualDuration: 0.3,
|
|
2223
2657
|
bounce: 0.2
|
|
2224
2658
|
};
|
|
2225
|
-
copyClipboardAnim =
|
|
2659
|
+
copyClipboardAnim = animate5(copyClipboardIconRef, {
|
|
2226
2660
|
opacity: isCopied ? 0 : 1,
|
|
2227
2661
|
scale: isCopied ? 0.5 : 1,
|
|
2228
2662
|
filter: isCopied ? "blur(4px)" : "blur(0px)"
|
|
2229
2663
|
}, transition);
|
|
2230
|
-
copyCheckAnim =
|
|
2664
|
+
copyCheckAnim = animate5(copyCheckIconRef, {
|
|
2231
2665
|
opacity: isCopied ? 1 : 0,
|
|
2232
2666
|
scale: isCopied ? 1 : 0.5,
|
|
2233
2667
|
filter: isCopied ? "blur(0px)" : "blur(4px)"
|
|
@@ -2242,28 +2676,28 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2242
2676
|
const handleAddTapStart = () => {
|
|
2243
2677
|
if (!addButtonRef) return;
|
|
2244
2678
|
addTapAnim?.stop();
|
|
2245
|
-
addTapAnim =
|
|
2679
|
+
addTapAnim = animate5(addButtonRef, {
|
|
2246
2680
|
scale: 0.9
|
|
2247
2681
|
}, tapTransition);
|
|
2248
2682
|
};
|
|
2249
2683
|
const handleAddTapEnd = () => {
|
|
2250
2684
|
if (!addButtonRef) return;
|
|
2251
2685
|
addTapAnim?.stop();
|
|
2252
|
-
addTapAnim =
|
|
2686
|
+
addTapAnim = animate5(addButtonRef, {
|
|
2253
2687
|
scale: 1
|
|
2254
2688
|
}, tapTransition);
|
|
2255
2689
|
};
|
|
2256
2690
|
const handleCopyTapStart = () => {
|
|
2257
2691
|
if (!copyButtonRef) return;
|
|
2258
2692
|
copyTapAnim?.stop();
|
|
2259
|
-
copyTapAnim =
|
|
2693
|
+
copyTapAnim = animate5(copyButtonRef, {
|
|
2260
2694
|
scale: 0.95
|
|
2261
2695
|
}, tapTransition);
|
|
2262
2696
|
};
|
|
2263
2697
|
const handleCopyTapEnd = () => {
|
|
2264
2698
|
if (!copyButtonRef) return;
|
|
2265
2699
|
copyTapAnim?.stop();
|
|
2266
|
-
copyTapAnim =
|
|
2700
|
+
copyTapAnim = animate5(copyButtonRef, {
|
|
2267
2701
|
scale: 1
|
|
2268
2702
|
}, tapTransition);
|
|
2269
2703
|
};
|
|
@@ -2271,7 +2705,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2271
2705
|
const value = () => values()[control.path];
|
|
2272
2706
|
switch (control.type) {
|
|
2273
2707
|
case "slider":
|
|
2274
|
-
return _$
|
|
2708
|
+
return _$createComponent10(Slider, {
|
|
2275
2709
|
get label() {
|
|
2276
2710
|
return control.label;
|
|
2277
2711
|
},
|
|
@@ -2287,20 +2721,32 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2287
2721
|
},
|
|
2288
2722
|
get step() {
|
|
2289
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;
|
|
2290
2730
|
}
|
|
2291
2731
|
});
|
|
2292
2732
|
case "toggle":
|
|
2293
|
-
return _$
|
|
2733
|
+
return _$createComponent10(Toggle, {
|
|
2294
2734
|
get label() {
|
|
2295
2735
|
return control.label;
|
|
2296
2736
|
},
|
|
2297
2737
|
get checked() {
|
|
2298
2738
|
return value();
|
|
2299
2739
|
},
|
|
2300
|
-
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
|
+
}
|
|
2301
2747
|
});
|
|
2302
2748
|
case "spring":
|
|
2303
|
-
return _$
|
|
2749
|
+
return _$createComponent10(SpringControl, {
|
|
2304
2750
|
get panelId() {
|
|
2305
2751
|
return props.panel.id;
|
|
2306
2752
|
},
|
|
@@ -2316,7 +2762,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2316
2762
|
onChange: (v) => DialStore.updateValue(props.panel.id, control.path, v)
|
|
2317
2763
|
});
|
|
2318
2764
|
case "folder":
|
|
2319
|
-
return _$
|
|
2765
|
+
return _$createComponent10(Folder, {
|
|
2320
2766
|
get title() {
|
|
2321
2767
|
return control.label;
|
|
2322
2768
|
},
|
|
@@ -2324,7 +2770,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2324
2770
|
return control.defaultOpen ?? true;
|
|
2325
2771
|
},
|
|
2326
2772
|
get children() {
|
|
2327
|
-
return _$
|
|
2773
|
+
return _$createComponent10(For4, {
|
|
2328
2774
|
get each() {
|
|
2329
2775
|
return control.children ?? [];
|
|
2330
2776
|
},
|
|
@@ -2333,7 +2779,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2333
2779
|
}
|
|
2334
2780
|
});
|
|
2335
2781
|
case "text":
|
|
2336
|
-
return _$
|
|
2782
|
+
return _$createComponent10(TextControl, {
|
|
2337
2783
|
get label() {
|
|
2338
2784
|
return control.label;
|
|
2339
2785
|
},
|
|
@@ -2346,7 +2792,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2346
2792
|
}
|
|
2347
2793
|
});
|
|
2348
2794
|
case "select":
|
|
2349
|
-
return _$
|
|
2795
|
+
return _$createComponent10(SelectControl, {
|
|
2350
2796
|
get label() {
|
|
2351
2797
|
return control.label;
|
|
2352
2798
|
},
|
|
@@ -2359,7 +2805,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2359
2805
|
onChange: (v) => DialStore.updateValue(props.panel.id, control.path, v)
|
|
2360
2806
|
});
|
|
2361
2807
|
case "color":
|
|
2362
|
-
return _$
|
|
2808
|
+
return _$createComponent10(ColorControl, {
|
|
2363
2809
|
get label() {
|
|
2364
2810
|
return control.label;
|
|
2365
2811
|
},
|
|
@@ -2373,12 +2819,12 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2373
2819
|
}
|
|
2374
2820
|
};
|
|
2375
2821
|
const renderControls = () => {
|
|
2376
|
-
return _$
|
|
2822
|
+
return _$createComponent10(For4, {
|
|
2377
2823
|
get each() {
|
|
2378
2824
|
return props.panel.controls;
|
|
2379
2825
|
},
|
|
2380
2826
|
children: (control) => _$memo7(() => _$memo7(() => control.type === "action")() ? (() => {
|
|
2381
|
-
var _el$ = _tmpl$
|
|
2827
|
+
var _el$ = _tmpl$19();
|
|
2382
2828
|
_el$.$$click = () => DialStore.triggerAction(props.panel.id, control.path);
|
|
2383
2829
|
_$insert11(_el$, () => control.label);
|
|
2384
2830
|
return _el$;
|
|
@@ -2386,7 +2832,7 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2386
2832
|
});
|
|
2387
2833
|
};
|
|
2388
2834
|
const toolbar = [(() => {
|
|
2389
|
-
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;
|
|
2390
2836
|
_el$2.addEventListener("pointerleave", handleAddTapEnd);
|
|
2391
2837
|
_el$2.addEventListener("pointercancel", handleAddTapEnd);
|
|
2392
2838
|
_el$2.$$pointerup = handleAddTapEnd;
|
|
@@ -2394,8 +2840,23 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2394
2840
|
_el$2.$$click = handleAddPreset;
|
|
2395
2841
|
var _ref$ = addButtonRef;
|
|
2396
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
|
+
});
|
|
2397
2858
|
return _el$2;
|
|
2398
|
-
})(), _$
|
|
2859
|
+
})(), _$createComponent10(PresetManager, {
|
|
2399
2860
|
get panelId() {
|
|
2400
2861
|
return props.panel.id;
|
|
2401
2862
|
},
|
|
@@ -2407,23 +2868,35 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2407
2868
|
},
|
|
2408
2869
|
onAdd: handleAddPreset
|
|
2409
2870
|
}), (() => {
|
|
2410
|
-
var _el$
|
|
2411
|
-
_el$
|
|
2412
|
-
_el$
|
|
2413
|
-
_el$
|
|
2414
|
-
_el$
|
|
2415
|
-
_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;
|
|
2416
2877
|
var _ref$2 = copyButtonRef;
|
|
2417
|
-
typeof _ref$2 === "function" ? _$use7(_ref$2, _el$
|
|
2878
|
+
typeof _ref$2 === "function" ? _$use7(_ref$2, _el$9) : copyButtonRef = _el$9;
|
|
2418
2879
|
var _ref$3 = copyClipboardIconRef;
|
|
2419
|
-
typeof _ref$3 === "function" ? _$use7(_ref$3, _el$
|
|
2880
|
+
typeof _ref$3 === "function" ? _$use7(_ref$3, _el$1) : copyClipboardIconRef = _el$1;
|
|
2420
2881
|
var _ref$4 = copyCheckIconRef;
|
|
2421
|
-
typeof _ref$4 === "function" ? _$use7(_ref$4, _el$
|
|
2422
|
-
|
|
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;
|
|
2423
2896
|
})()];
|
|
2424
2897
|
return (() => {
|
|
2425
|
-
var _el$
|
|
2426
|
-
_$insert11(_el$
|
|
2898
|
+
var _el$17 = _tmpl$43();
|
|
2899
|
+
_$insert11(_el$17, _$createComponent10(Folder, {
|
|
2427
2900
|
get title() {
|
|
2428
2901
|
return props.panel.name;
|
|
2429
2902
|
},
|
|
@@ -2431,22 +2904,28 @@ Apply these values as the new defaults in the createDialKit call.`;
|
|
|
2431
2904
|
return props.defaultOpen ?? true;
|
|
2432
2905
|
},
|
|
2433
2906
|
isRoot: true,
|
|
2907
|
+
get inline() {
|
|
2908
|
+
return props.inline ?? false;
|
|
2909
|
+
},
|
|
2434
2910
|
onOpenChange: setIsPanelOpen,
|
|
2435
2911
|
toolbar,
|
|
2436
2912
|
get children() {
|
|
2437
2913
|
return renderControls();
|
|
2438
2914
|
}
|
|
2439
2915
|
}));
|
|
2440
|
-
return _el$
|
|
2916
|
+
return _el$17;
|
|
2441
2917
|
})();
|
|
2442
2918
|
}
|
|
2443
2919
|
_$delegateEvents8(["click", "pointerdown", "pointerup"]);
|
|
2444
2920
|
|
|
2445
2921
|
// src/solid/components/DialRoot.tsx
|
|
2446
|
-
var _tmpl$
|
|
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;
|
|
2447
2924
|
function DialRoot(props) {
|
|
2448
|
-
|
|
2449
|
-
const [
|
|
2925
|
+
if ((props.productionEnabled ?? isDevDefault) === false) return null;
|
|
2926
|
+
const [panels, setPanels] = createSignal11([]);
|
|
2927
|
+
const [mounted, setMounted] = createSignal11(false);
|
|
2928
|
+
const inline = () => (props.mode ?? "popover") === "inline";
|
|
2450
2929
|
onMount8(() => {
|
|
2451
2930
|
setMounted(true);
|
|
2452
2931
|
setPanels(DialStore.getPanels());
|
|
@@ -2455,30 +2934,60 @@ function DialRoot(props) {
|
|
|
2455
2934
|
});
|
|
2456
2935
|
onCleanup9(unsub);
|
|
2457
2936
|
});
|
|
2458
|
-
|
|
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();
|
|
2943
|
+
},
|
|
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, {
|
|
2459
2971
|
get when() {
|
|
2460
2972
|
return _$memo8(() => !!(mounted() && typeof window !== "undefined"))() && panels().length > 0;
|
|
2461
2973
|
},
|
|
2462
2974
|
get children() {
|
|
2463
|
-
return _$
|
|
2464
|
-
get
|
|
2465
|
-
return
|
|
2975
|
+
return _$createComponent11(Show8, {
|
|
2976
|
+
get when() {
|
|
2977
|
+
return !inline();
|
|
2978
|
+
},
|
|
2979
|
+
get fallback() {
|
|
2980
|
+
return content();
|
|
2466
2981
|
},
|
|
2467
2982
|
get children() {
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
return panels();
|
|
2983
|
+
return _$createComponent11(Portal3, {
|
|
2984
|
+
get mount() {
|
|
2985
|
+
return document.body;
|
|
2472
2986
|
},
|
|
2473
|
-
children
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
}
|
|
2478
|
-
})
|
|
2479
|
-
}));
|
|
2480
|
-
_$effect9(() => _$setAttribute8(_el$2, "data-position", props.position ?? "top-right"));
|
|
2481
|
-
return _el$;
|
|
2987
|
+
get children() {
|
|
2988
|
+
return content();
|
|
2989
|
+
}
|
|
2990
|
+
});
|
|
2482
2991
|
}
|
|
2483
2992
|
});
|
|
2484
2993
|
}
|
|
@@ -2490,19 +2999,19 @@ import { template as _$template13 } from "solid-js/web";
|
|
|
2490
2999
|
import { delegateEvents as _$delegateEvents9 } from "solid-js/web";
|
|
2491
3000
|
import { addEventListener as _$addEventListener } from "solid-js/web";
|
|
2492
3001
|
import { insert as _$insert13 } from "solid-js/web";
|
|
2493
|
-
import { createComponent as _$
|
|
3002
|
+
import { createComponent as _$createComponent12 } from "solid-js/web";
|
|
2494
3003
|
import { For as For6 } from "solid-js";
|
|
2495
|
-
var _tmpl$
|
|
2496
|
-
var _tmpl$
|
|
3004
|
+
var _tmpl$21 = /* @__PURE__ */ _$template13(`<div class=dialkit-button-group>`);
|
|
3005
|
+
var _tmpl$210 = /* @__PURE__ */ _$template13(`<button class=dialkit-button>`);
|
|
2497
3006
|
function ButtonGroup(props) {
|
|
2498
3007
|
return (() => {
|
|
2499
|
-
var _el$ = _tmpl$
|
|
2500
|
-
_$insert13(_el$, _$
|
|
3008
|
+
var _el$ = _tmpl$21();
|
|
3009
|
+
_$insert13(_el$, _$createComponent12(For6, {
|
|
2501
3010
|
get each() {
|
|
2502
3011
|
return props.buttons;
|
|
2503
3012
|
},
|
|
2504
3013
|
children: (button) => (() => {
|
|
2505
|
-
var _el$2 = _tmpl$
|
|
3014
|
+
var _el$2 = _tmpl$210();
|
|
2506
3015
|
_$addEventListener(_el$2, "click", button.onClick, true);
|
|
2507
3016
|
_$insert13(_el$2, () => button.label);
|
|
2508
3017
|
return _el$2;
|