dialkit 0.2.2 → 1.1.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.
Files changed (85) hide show
  1. package/README.md +135 -2
  2. package/dist/index.cjs +512 -176
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +40 -8
  5. package/dist/index.d.ts +40 -8
  6. package/dist/index.js +484 -150
  7. package/dist/index.js.map +1 -1
  8. package/dist/solid/index.cjs +2612 -0
  9. package/dist/solid/index.cjs.map +1 -0
  10. package/dist/solid/index.d.cts +228 -0
  11. package/dist/solid/index.d.ts +228 -0
  12. package/dist/solid/index.js +2573 -0
  13. package/dist/solid/index.js.map +1 -0
  14. package/dist/store/index.cjs +450 -0
  15. package/dist/store/index.cjs.map +1 -0
  16. package/dist/store/index.d.cts +124 -0
  17. package/dist/store/index.d.ts +124 -0
  18. package/dist/store/index.js +425 -0
  19. package/dist/store/index.js.map +1 -0
  20. package/dist/styles.css +38 -1
  21. package/dist/svelte/Portal.svelte +30 -0
  22. package/dist/svelte/Portal.svelte.d.ts +9 -0
  23. package/dist/svelte/Portal.svelte.d.ts.map +1 -0
  24. package/dist/svelte/components/ButtonGroup.svelte +16 -0
  25. package/dist/svelte/components/ButtonGroup.svelte.d.ts +11 -0
  26. package/dist/svelte/components/ButtonGroup.svelte.d.ts.map +1 -0
  27. package/dist/svelte/components/ColorControl.svelte +81 -0
  28. package/dist/svelte/components/ColorControl.svelte.d.ts +9 -0
  29. package/dist/svelte/components/ColorControl.svelte.d.ts.map +1 -0
  30. package/dist/svelte/components/ControlRenderer.svelte +84 -0
  31. package/dist/svelte/components/ControlRenderer.svelte.d.ts +11 -0
  32. package/dist/svelte/components/ControlRenderer.svelte.d.ts.map +1 -0
  33. package/dist/svelte/components/DialRoot.svelte +65 -0
  34. package/dist/svelte/components/DialRoot.svelte.d.ts +11 -0
  35. package/dist/svelte/components/DialRoot.svelte.d.ts.map +1 -0
  36. package/dist/svelte/components/EasingVisualization.svelte +50 -0
  37. package/dist/svelte/components/EasingVisualization.svelte.d.ts +10 -0
  38. package/dist/svelte/components/EasingVisualization.svelte.d.ts.map +1 -0
  39. package/dist/svelte/components/Folder.svelte +204 -0
  40. package/dist/svelte/components/Folder.svelte.d.ts +14 -0
  41. package/dist/svelte/components/Folder.svelte.d.ts.map +1 -0
  42. package/dist/svelte/components/Panel.svelte +144 -0
  43. package/dist/svelte/components/Panel.svelte.d.ts +10 -0
  44. package/dist/svelte/components/Panel.svelte.d.ts.map +1 -0
  45. package/dist/svelte/components/PresetManager.svelte +156 -0
  46. package/dist/svelte/components/PresetManager.svelte.d.ts +10 -0
  47. package/dist/svelte/components/PresetManager.svelte.d.ts.map +1 -0
  48. package/dist/svelte/components/SegmentedControl.svelte +106 -0
  49. package/dist/svelte/components/SegmentedControl.svelte.d.ts +13 -0
  50. package/dist/svelte/components/SegmentedControl.svelte.d.ts.map +1 -0
  51. package/dist/svelte/components/SelectControl.svelte +151 -0
  52. package/dist/svelte/components/SelectControl.svelte.d.ts +14 -0
  53. package/dist/svelte/components/SelectControl.svelte.d.ts.map +1 -0
  54. package/dist/svelte/components/Slider.svelte +345 -0
  55. package/dist/svelte/components/Slider.svelte.d.ts +13 -0
  56. package/dist/svelte/components/Slider.svelte.d.ts.map +1 -0
  57. package/dist/svelte/components/SpringControl.svelte +124 -0
  58. package/dist/svelte/components/SpringControl.svelte.d.ts +12 -0
  59. package/dist/svelte/components/SpringControl.svelte.d.ts.map +1 -0
  60. package/dist/svelte/components/SpringVisualization.svelte +115 -0
  61. package/dist/svelte/components/SpringVisualization.svelte.d.ts +9 -0
  62. package/dist/svelte/components/SpringVisualization.svelte.d.ts.map +1 -0
  63. package/dist/svelte/components/TextControl.svelte +19 -0
  64. package/dist/svelte/components/TextControl.svelte.d.ts +10 -0
  65. package/dist/svelte/components/TextControl.svelte.d.ts.map +1 -0
  66. package/dist/svelte/components/Toggle.svelte +21 -0
  67. package/dist/svelte/components/Toggle.svelte.d.ts +9 -0
  68. package/dist/svelte/components/Toggle.svelte.d.ts.map +1 -0
  69. package/dist/svelte/components/TransitionControl.svelte +200 -0
  70. package/dist/svelte/components/TransitionControl.svelte.d.ts +12 -0
  71. package/dist/svelte/components/TransitionControl.svelte.d.ts.map +1 -0
  72. package/dist/svelte/components/transitions.d.ts +6 -0
  73. package/dist/svelte/components/transitions.d.ts.map +1 -0
  74. package/dist/svelte/components/transitions.js +14 -0
  75. package/dist/svelte/createDialKit.svelte.d.ts +7 -0
  76. package/dist/svelte/createDialKit.svelte.d.ts.map +1 -0
  77. package/dist/svelte/createDialKit.svelte.js +82 -0
  78. package/dist/svelte/index.d.ts +19 -0
  79. package/dist/svelte/index.d.ts.map +1 -0
  80. package/dist/svelte/index.js +19 -0
  81. package/dist/svelte/shims.d.ts +9 -0
  82. package/dist/svelte/theme-css.d.ts +2 -0
  83. package/dist/svelte/theme-css.d.ts.map +1 -0
  84. package/dist/svelte/theme-css.js +1097 -0
  85. package/package.json +56 -10
package/dist/index.cjs CHANGED
@@ -25,6 +25,7 @@ __export(index_exports, {
25
25
  ColorControl: () => ColorControl,
26
26
  DialRoot: () => DialRoot,
27
27
  DialStore: () => DialStore,
28
+ EasingVisualization: () => EasingVisualization,
28
29
  Folder: () => Folder,
29
30
  PresetManager: () => PresetManager,
30
31
  SelectControl: () => SelectControl,
@@ -33,6 +34,7 @@ __export(index_exports, {
33
34
  SpringVisualization: () => SpringVisualization,
34
35
  TextControl: () => TextControl,
35
36
  Toggle: () => Toggle,
37
+ TransitionControl: () => TransitionControl,
36
38
  useDialKit: () => useDialKit
37
39
  });
38
40
  module.exports = __toCommonJS(index_exports);
@@ -56,15 +58,67 @@ var DialStoreClass = class {
56
58
  registerPanel(id, name, config) {
57
59
  const controls = this.parseConfig(config, "");
58
60
  const values = this.flattenValues(config, "");
61
+ this.initTransitionModes(config, "", values);
59
62
  this.panels.set(id, { id, name, controls, values });
60
63
  this.snapshots.set(id, { ...values });
61
64
  this.baseValues.set(id, { ...values });
62
65
  this.notifyGlobal();
63
66
  }
67
+ updatePanel(id, name, config) {
68
+ const existing = this.panels.get(id);
69
+ if (!existing) {
70
+ this.registerPanel(id, name, config);
71
+ return;
72
+ }
73
+ const controls = this.parseConfig(config, "");
74
+ const controlsByPath = this.mapControlsByPath(controls);
75
+ const defaultValues = this.flattenValues(config, "");
76
+ const nextValues = {};
77
+ for (const [path, defaultValue] of Object.entries(defaultValues)) {
78
+ nextValues[path] = this.normalizePreservedValue(
79
+ existing.values[path],
80
+ defaultValue,
81
+ controlsByPath.get(path)
82
+ );
83
+ }
84
+ this.initTransitionModes(config, "", nextValues);
85
+ for (const [path, mode] of Object.entries(existing.values)) {
86
+ if (!path.endsWith(".__mode")) {
87
+ continue;
88
+ }
89
+ const transitionPath = path.slice(0, -"__mode".length - 1);
90
+ const transitionControl = controlsByPath.get(transitionPath);
91
+ if (transitionControl?.type === "transition") {
92
+ nextValues[path] = mode;
93
+ }
94
+ }
95
+ const nextPanel = { id, name, controls, values: nextValues };
96
+ this.panels.set(id, nextPanel);
97
+ this.snapshots.set(id, { ...nextValues });
98
+ const previousBaseValues = this.baseValues.get(id) ?? {};
99
+ const nextBaseValues = {};
100
+ for (const [path, defaultValue] of Object.entries(defaultValues)) {
101
+ nextBaseValues[path] = this.normalizePreservedValue(
102
+ previousBaseValues[path],
103
+ defaultValue,
104
+ controlsByPath.get(path)
105
+ );
106
+ }
107
+ for (const [path, value] of Object.entries(nextValues)) {
108
+ if (path.endsWith(".__mode")) {
109
+ nextBaseValues[path] = value;
110
+ }
111
+ }
112
+ this.baseValues.set(id, nextBaseValues);
113
+ this.notify(id);
114
+ this.notifyGlobal();
115
+ }
64
116
  unregisterPanel(id) {
65
117
  this.panels.delete(id);
66
118
  this.listeners.delete(id);
67
119
  this.snapshots.delete(id);
120
+ this.actionListeners.delete(id);
121
+ this.baseValues.delete(id);
68
122
  this.notifyGlobal();
69
123
  }
70
124
  updateValue(panelId, path, value) {
@@ -84,13 +138,21 @@ var DialStoreClass = class {
84
138
  this.notify(panelId);
85
139
  }
86
140
  updateSpringMode(panelId, path, mode) {
141
+ this.updateTransitionMode(panelId, path, mode);
142
+ }
143
+ getSpringMode(panelId, path) {
144
+ const mode = this.getTransitionMode(panelId, path);
145
+ if (mode === "easing") return "simple";
146
+ return mode;
147
+ }
148
+ updateTransitionMode(panelId, path, mode) {
87
149
  const panel = this.panels.get(panelId);
88
150
  if (!panel) return;
89
151
  panel.values[`${path}.__mode`] = mode;
90
152
  this.snapshots.set(panelId, { ...panel.values });
91
153
  this.notify(panelId);
92
154
  }
93
- getSpringMode(panelId, path) {
155
+ getTransitionMode(panelId, path) {
94
156
  const panel = this.panels.get(panelId);
95
157
  if (!panel) return "simple";
96
158
  return panel.values[`${path}.__mode`] || "simple";
@@ -194,6 +256,21 @@ var DialStoreClass = class {
194
256
  notifyGlobal() {
195
257
  this.globalListeners.forEach((fn) => fn());
196
258
  }
259
+ initTransitionModes(config, prefix, values) {
260
+ for (const [key, value] of Object.entries(config)) {
261
+ if (key === "_collapsed") continue;
262
+ const path = prefix ? `${prefix}.${key}` : key;
263
+ if (this.isEasingConfig(value)) {
264
+ values[`${path}.__mode`] = "easing";
265
+ } else if (this.isSpringConfig(value)) {
266
+ const hasPhysics = value.stiffness !== void 0 || value.damping !== void 0 || value.mass !== void 0;
267
+ const hasTime = value.visualDuration !== void 0 || value.bounce !== void 0;
268
+ values[`${path}.__mode`] = hasPhysics && !hasTime ? "advanced" : "simple";
269
+ } else if (typeof value === "object" && value !== null && !Array.isArray(value) && !this.isActionConfig(value) && !this.isSelectConfig(value) && !this.isColorConfig(value) && !this.isTextConfig(value)) {
270
+ this.initTransitionModes(value, path, values);
271
+ }
272
+ }
273
+ }
197
274
  parseConfig(config, prefix) {
198
275
  const controls = [];
199
276
  for (const [key, value] of Object.entries(config)) {
@@ -214,8 +291,8 @@ var DialStoreClass = class {
214
291
  controls.push({ type: "slider", path, label, min, max, step });
215
292
  } else if (typeof value === "boolean") {
216
293
  controls.push({ type: "toggle", path, label });
217
- } else if (this.isSpringConfig(value)) {
218
- controls.push({ type: "spring", path, label });
294
+ } else if (this.isSpringConfig(value) || this.isEasingConfig(value)) {
295
+ controls.push({ type: "transition", path, label });
219
296
  } else if (this.isActionConfig(value)) {
220
297
  controls.push({ type: "action", path, label: value.label || label });
221
298
  } else if (this.isSelectConfig(value)) {
@@ -253,7 +330,7 @@ var DialStoreClass = class {
253
330
  values[path] = value[0];
254
331
  } else if (typeof value === "number" || typeof value === "boolean" || typeof value === "string") {
255
332
  values[path] = value;
256
- } else if (this.isSpringConfig(value)) {
333
+ } else if (this.isSpringConfig(value) || this.isEasingConfig(value)) {
257
334
  values[path] = value;
258
335
  } else if (this.isActionConfig(value)) {
259
336
  values[path] = value;
@@ -274,6 +351,9 @@ var DialStoreClass = class {
274
351
  isSpringConfig(value) {
275
352
  return typeof value === "object" && value !== null && "type" in value && value.type === "spring";
276
353
  }
354
+ isEasingConfig(value) {
355
+ return typeof value === "object" && value !== null && "type" in value && value.type === "easing";
356
+ }
277
357
  isActionConfig(value) {
278
358
  return typeof value === "object" && value !== null && "type" in value && value.type === "action";
279
359
  }
@@ -312,6 +392,75 @@ var DialStoreClass = class {
312
392
  if (range <= 100) return 1;
313
393
  return 10;
314
394
  }
395
+ normalizePreservedValue(existingValue, defaultValue, control) {
396
+ if (existingValue === void 0 || !control) {
397
+ return defaultValue;
398
+ }
399
+ switch (control.type) {
400
+ case "slider": {
401
+ if (typeof existingValue !== "number" || typeof defaultValue !== "number") {
402
+ return defaultValue;
403
+ }
404
+ const min = control.min ?? Number.NEGATIVE_INFINITY;
405
+ const max = control.max ?? Number.POSITIVE_INFINITY;
406
+ const clamped = Math.min(max, Math.max(min, existingValue));
407
+ if (typeof control.step !== "number" || control.step <= 0) {
408
+ return clamped;
409
+ }
410
+ return this.roundToStep(clamped, min, max, control.step);
411
+ }
412
+ case "toggle":
413
+ return typeof existingValue === "boolean" ? existingValue : defaultValue;
414
+ case "select": {
415
+ if (typeof existingValue !== "string") {
416
+ return defaultValue;
417
+ }
418
+ const options = control.options ?? [];
419
+ const validValues = new Set(options.map((option) => typeof option === "string" ? option : option.value));
420
+ return validValues.has(existingValue) ? existingValue : defaultValue;
421
+ }
422
+ case "color":
423
+ case "text":
424
+ return typeof existingValue === "string" ? existingValue : defaultValue;
425
+ case "transition":
426
+ if (this.isSpringConfig(defaultValue)) {
427
+ return this.isSpringConfig(existingValue) ? existingValue : defaultValue;
428
+ }
429
+ if (this.isEasingConfig(defaultValue)) {
430
+ return this.isEasingConfig(existingValue) ? existingValue : defaultValue;
431
+ }
432
+ return defaultValue;
433
+ case "action":
434
+ return defaultValue;
435
+ default:
436
+ return defaultValue;
437
+ }
438
+ }
439
+ roundToStep(value, min, max, step) {
440
+ const snapped = min + Math.round((value - min) / step) * step;
441
+ const clamped = Math.min(max, Math.max(min, snapped));
442
+ const precision = this.stepPrecision(step);
443
+ return Number(clamped.toFixed(precision));
444
+ }
445
+ stepPrecision(step) {
446
+ const text = String(step);
447
+ const decimalIndex = text.indexOf(".");
448
+ return decimalIndex === -1 ? 0 : text.length - decimalIndex - 1;
449
+ }
450
+ mapControlsByPath(controls) {
451
+ const map = /* @__PURE__ */ new Map();
452
+ const visit = (nodes) => {
453
+ for (const node of nodes) {
454
+ if (node.type === "folder" && node.children) {
455
+ visit(node.children);
456
+ continue;
457
+ }
458
+ map.set(node.path, node);
459
+ }
460
+ };
461
+ visit(controls);
462
+ return map;
463
+ }
315
464
  };
316
465
  var DialStore = new DialStoreClass();
317
466
 
@@ -320,12 +469,22 @@ function useDialKit(name, config, options) {
320
469
  const instanceId = (0, import_react.useId)();
321
470
  const panelId = `${name}-${instanceId}`;
322
471
  const configRef = (0, import_react.useRef)(config);
472
+ const serializedConfig = JSON.stringify(config);
473
+ configRef.current = config;
323
474
  const onActionRef = (0, import_react.useRef)(options?.onAction);
324
475
  onActionRef.current = options?.onAction;
325
476
  (0, import_react.useEffect)(() => {
326
477
  DialStore.registerPanel(panelId, name, configRef.current);
327
478
  return () => DialStore.unregisterPanel(panelId);
328
479
  }, [panelId, name]);
480
+ const mountedRef = (0, import_react.useRef)(false);
481
+ (0, import_react.useEffect)(() => {
482
+ if (!mountedRef.current) {
483
+ mountedRef.current = true;
484
+ return;
485
+ }
486
+ DialStore.updatePanel(panelId, name, configRef.current);
487
+ }, [panelId, name, serializedConfig]);
329
488
  (0, import_react.useEffect)(() => {
330
489
  return DialStore.subscribeActions(panelId, (action) => {
331
490
  onActionRef.current?.(action);
@@ -347,7 +506,7 @@ function buildResolvedValues(config, flatValues, prefix) {
347
506
  result[key] = flatValues[path] ?? configValue[0];
348
507
  } else if (typeof configValue === "number" || typeof configValue === "boolean" || typeof configValue === "string") {
349
508
  result[key] = flatValues[path] ?? configValue;
350
- } else if (isSpringConfig(configValue)) {
509
+ } else if (isSpringConfig(configValue) || isEasingConfig(configValue)) {
351
510
  result[key] = flatValues[path] ?? configValue;
352
511
  } else if (isActionConfig(configValue)) {
353
512
  result[key] = flatValues[path] ?? configValue;
@@ -370,6 +529,9 @@ function hasType(value, type) {
370
529
  function isSpringConfig(value) {
371
530
  return hasType(value, "spring");
372
531
  }
532
+ function isEasingConfig(value) {
533
+ return hasType(value, "easing");
534
+ }
373
535
  function isActionConfig(value) {
374
536
  return hasType(value, "action");
375
537
  }
@@ -388,18 +550,18 @@ function getFirstOptionValue(options) {
388
550
  }
389
551
 
390
552
  // src/components/DialRoot.tsx
391
- var import_react16 = require("react");
553
+ var import_react17 = require("react");
392
554
  var import_react_dom3 = require("react-dom");
393
555
 
394
556
  // src/components/Panel.tsx
395
- var import_react14 = require("react");
396
- var import_react15 = require("motion/react");
557
+ var import_react15 = require("react");
558
+ var import_react16 = require("motion/react");
397
559
 
398
560
  // src/components/Folder.tsx
399
561
  var import_react2 = require("react");
400
562
  var import_react3 = require("motion/react");
401
563
  var import_jsx_runtime = require("react/jsx-runtime");
402
- function Folder({ title, children, defaultOpen = true, isRoot = false, onOpenChange, toolbar }) {
564
+ function Folder({ title, children, defaultOpen = true, isRoot = false, inline = false, onOpenChange, toolbar }) {
403
565
  const [isOpen, setIsOpen] = (0, import_react2.useState)(defaultOpen);
404
566
  const [isCollapsed, setIsCollapsed] = (0, import_react2.useState)(!defaultOpen);
405
567
  const contentRef = (0, import_react2.useRef)(null);
@@ -417,6 +579,7 @@ function Folder({ title, children, defaultOpen = true, isRoot = false, onOpenCha
417
579
  return () => ro.disconnect();
418
580
  }, [isOpen]);
419
581
  const handleToggle = () => {
582
+ if (inline && isRoot) return;
420
583
  const next = !isOpen;
421
584
  setIsOpen(next);
422
585
  if (next) {
@@ -430,40 +593,35 @@ function Folder({ title, children, defaultOpen = true, isRoot = false, onOpenCha
430
593
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `dialkit-folder-header ${isRoot ? "dialkit-panel-header" : ""}`, onClick: handleToggle, children: [
431
594
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dialkit-folder-header-top", children: [
432
595
  isRoot ? isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dialkit-folder-title-row", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dialkit-folder-title dialkit-folder-title-root", children: title }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dialkit-folder-title-row", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dialkit-folder-title", children: title }) }),
433
- isRoot ? (
434
- // Root panel icon — fixed position, container morphs around it
435
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
436
- "svg",
437
- {
438
- className: "dialkit-panel-icon",
439
- viewBox: "0 0 16 16",
440
- fill: "none",
441
- children: [
442
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { opacity: "0.5", d: "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", fill: "currentColor" }),
443
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "6", cy: "8", r: "0.998596", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.25" }),
444
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10.4999", cy: "3.5", r: "0.998657", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.25" }),
445
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "9.75015", cy: "12.5", r: "0.997986", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.25" })
446
- ]
447
- }
448
- )
449
- ) : (
450
- // Section folders use rotating chevron with gentle spring
451
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
452
- import_react3.motion.svg,
453
- {
454
- className: "dialkit-folder-icon",
455
- viewBox: "0 0 24 24",
456
- fill: "none",
457
- stroke: "currentColor",
458
- strokeWidth: "2.5",
459
- strokeLinecap: "round",
460
- strokeLinejoin: "round",
461
- initial: false,
462
- animate: { rotate: isOpen ? 0 : 180 },
463
- transition: { type: "spring", visualDuration: 0.35, bounce: 0.15 },
464
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 9.5L12 15.5L18 9.5" })
465
- }
466
- )
596
+ isRoot && !inline && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
597
+ "svg",
598
+ {
599
+ className: "dialkit-panel-icon",
600
+ viewBox: "0 0 16 16",
601
+ fill: "none",
602
+ children: [
603
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { opacity: "0.5", d: "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", fill: "currentColor" }),
604
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "6", cy: "8", r: "0.998596", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.25" }),
605
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10.4999", cy: "3.5", r: "0.998657", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.25" }),
606
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "9.75015", cy: "12.5", r: "0.997986", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.25" })
607
+ ]
608
+ }
609
+ ),
610
+ !isRoot && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
611
+ import_react3.motion.svg,
612
+ {
613
+ className: "dialkit-folder-icon",
614
+ viewBox: "0 0 24 24",
615
+ fill: "none",
616
+ stroke: "currentColor",
617
+ strokeWidth: "2.5",
618
+ strokeLinecap: "round",
619
+ strokeLinejoin: "round",
620
+ initial: false,
621
+ animate: { rotate: isOpen ? 0 : 180 },
622
+ transition: { type: "spring", visualDuration: 0.35, bounce: 0.15 },
623
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 9.5L12 15.5L18 9.5" })
624
+ }
467
625
  )
468
626
  ] }),
469
627
  isRoot && toolbar && isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dialkit-panel-toolbar", onClick: (e) => e.stopPropagation(), children: toolbar })
@@ -482,6 +640,9 @@ function Folder({ title, children, defaultOpen = true, isRoot = false, onOpenCha
482
640
  ) })
483
641
  ] });
484
642
  if (isRoot) {
643
+ if (inline) {
644
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dialkit-panel-inner dialkit-panel-inline", children: folderContent });
645
+ }
485
646
  const panelStyle = isOpen ? { width: 280, height: contentHeight !== void 0 ? contentHeight + 24 : "auto", borderRadius: 14, boxShadow: "0 8px 32px rgba(0, 0, 0, 0.5)", cursor: void 0 } : { width: 42, height: 42, borderRadius: 21, boxShadow: "0 4px 16px rgba(0, 0, 0, 0.25)", overflow: "hidden", cursor: "pointer" };
486
647
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
487
648
  import_react3.motion.div,
@@ -1156,12 +1317,180 @@ function SpringControl({ panelId, path, label, spring, onChange }) {
1156
1317
  ] }) });
1157
1318
  }
1158
1319
 
1159
- // src/components/TextControl.tsx
1320
+ // src/components/EasingVisualization.tsx
1160
1321
  var import_jsx_runtime7 = require("react/jsx-runtime");
1322
+ function EasingVisualization({ easing }) {
1323
+ const ease = easing.ease;
1324
+ const s = 200;
1325
+ const pad = 10;
1326
+ const inner = s - pad * 2;
1327
+ const unit = inner / 2;
1328
+ const toSvg = (nx, ny) => ({
1329
+ x: pad + (nx + 0.5) * unit,
1330
+ y: pad + (1.5 - ny) * unit
1331
+ });
1332
+ const start = toSvg(0, 0);
1333
+ const end = toSvg(1, 1);
1334
+ const p1 = toSvg(ease[0], ease[1]);
1335
+ const p2 = toSvg(ease[2], ease[3]);
1336
+ const curvePath = `M ${start.x} ${start.y} C ${p1.x} ${p1.y}, ${p2.x} ${p2.y}, ${end.x} ${end.y}`;
1337
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1338
+ "svg",
1339
+ {
1340
+ viewBox: `0 0 ${s} ${s}`,
1341
+ preserveAspectRatio: "xMidYMid slice",
1342
+ className: "dialkit-spring-viz dialkit-easing-viz",
1343
+ children: [
1344
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1345
+ "line",
1346
+ {
1347
+ x1: start.x,
1348
+ y1: start.y,
1349
+ x2: end.x,
1350
+ y2: end.y,
1351
+ stroke: "rgba(255, 255, 255, 0.15)",
1352
+ strokeWidth: "1",
1353
+ strokeDasharray: "4,4"
1354
+ }
1355
+ ),
1356
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: curvePath, fill: "none", stroke: "rgba(255, 255, 255, 0.6)", strokeWidth: "2", strokeLinecap: "round" })
1357
+ ]
1358
+ }
1359
+ );
1360
+ }
1361
+
1362
+ // src/components/TransitionControl.tsx
1363
+ var import_react9 = require("react");
1364
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1365
+ function TransitionControl({ panelId, path, label, value, onChange }) {
1366
+ const mode = (0, import_react9.useSyncExternalStore)(
1367
+ (cb) => DialStore.subscribe(panelId, cb),
1368
+ () => DialStore.getTransitionMode(panelId, path),
1369
+ () => DialStore.getTransitionMode(panelId, path)
1370
+ );
1371
+ const isEasing = mode === "easing";
1372
+ const isSimpleSpring = mode === "simple";
1373
+ const spring = value.type === "spring" ? value : { type: "spring", visualDuration: 0.3, bounce: 0.2 };
1374
+ const easing = value.type === "easing" ? value : { type: "easing", duration: 0.3, ease: [1, -0.4, 0.5, 1] };
1375
+ const handleModeChange = (newMode) => {
1376
+ DialStore.updateTransitionMode(panelId, path, newMode);
1377
+ if (newMode === "easing") {
1378
+ const duration = value.type === "spring" ? value.visualDuration ?? 0.3 : value.duration;
1379
+ onChange({ type: "easing", duration, ease: easing.ease });
1380
+ } else if (newMode === "simple") {
1381
+ onChange({
1382
+ type: "spring",
1383
+ visualDuration: spring.visualDuration ?? (value.type === "easing" ? value.duration : 0.3),
1384
+ bounce: spring.bounce ?? 0.2
1385
+ });
1386
+ } else {
1387
+ onChange({
1388
+ type: "spring",
1389
+ stiffness: spring.stiffness ?? 200,
1390
+ damping: spring.damping ?? 25,
1391
+ mass: spring.mass ?? 1
1392
+ });
1393
+ }
1394
+ };
1395
+ const handleSpringUpdate = (key, val) => {
1396
+ if (isSimpleSpring) {
1397
+ const { stiffness, damping, mass, ...rest } = spring;
1398
+ onChange({ ...rest, [key]: val });
1399
+ } else {
1400
+ const { visualDuration, bounce, ...rest } = spring;
1401
+ onChange({ ...rest, [key]: val });
1402
+ }
1403
+ };
1404
+ const updateEase = (index, val) => {
1405
+ const newEase = [...easing.ease];
1406
+ newEase[index] = val;
1407
+ onChange({ ...easing, ease: newEase });
1408
+ };
1409
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Folder, { title: label, defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
1410
+ isEasing ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(EasingVisualization, { easing }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SpringVisualization, { spring, isSimpleMode: isSimpleSpring }),
1411
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dialkit-labeled-control", children: [
1412
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "dialkit-labeled-control-label", children: "Type" }),
1413
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1414
+ SegmentedControl,
1415
+ {
1416
+ options: [
1417
+ { value: "easing", label: "Easing" },
1418
+ { value: "simple", label: "Time" },
1419
+ { value: "advanced", label: "Physics" }
1420
+ ],
1421
+ value: mode,
1422
+ onChange: handleModeChange
1423
+ }
1424
+ )
1425
+ ] }),
1426
+ isEasing ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1427
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "x1", value: easing.ease[0], onChange: (v) => updateEase(0, v), min: 0, max: 1, step: 0.01 }),
1428
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "y1", value: easing.ease[1], onChange: (v) => updateEase(1, v), min: -1, max: 2, step: 0.01 }),
1429
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "x2", value: easing.ease[2], onChange: (v) => updateEase(2, v), min: 0, max: 1, step: 0.01 }),
1430
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "y2", value: easing.ease[3], onChange: (v) => updateEase(3, v), min: -1, max: 2, step: 0.01 }),
1431
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "Duration", value: easing.duration, onChange: (v) => onChange({ ...easing, duration: v }), min: 0.1, max: 2, step: 0.05, unit: "s" }),
1432
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(EaseTextInput, { ease: easing.ease, onChange: (newEase) => onChange({ ...easing, ease: newEase }) })
1433
+ ] }) : isSimpleSpring ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1434
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "Duration", value: spring.visualDuration ?? 0.3, onChange: (v) => handleSpringUpdate("visualDuration", v), min: 0.1, max: 1, step: 0.05, unit: "s" }),
1435
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "Bounce", value: spring.bounce ?? 0.2, onChange: (v) => handleSpringUpdate("bounce", v), min: 0, max: 1, step: 0.05 })
1436
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1437
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "Stiffness", value: spring.stiffness ?? 400, onChange: (v) => handleSpringUpdate("stiffness", v), min: 1, max: 1e3, step: 10 }),
1438
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "Damping", value: spring.damping ?? 17, onChange: (v) => handleSpringUpdate("damping", v), min: 1, max: 100, step: 1 }),
1439
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Slider, { label: "Mass", value: spring.mass ?? 1, onChange: (v) => handleSpringUpdate("mass", v), min: 0.1, max: 10, step: 0.1 })
1440
+ ] })
1441
+ ] }) });
1442
+ }
1443
+ function formatEase(ease) {
1444
+ return ease.map((v) => parseFloat(v.toFixed(2))).join(", ");
1445
+ }
1446
+ function parseEase(str) {
1447
+ const parts = str.split(",").map((s) => parseFloat(s.trim()));
1448
+ if (parts.length === 4 && parts.every((n) => !isNaN(n))) {
1449
+ return parts;
1450
+ }
1451
+ return null;
1452
+ }
1453
+ function EaseTextInput({ ease, onChange }) {
1454
+ const [editing, setEditing] = (0, import_react9.useState)(false);
1455
+ const [draft, setDraft] = (0, import_react9.useState)("");
1456
+ const handleFocus = () => {
1457
+ setDraft(formatEase(ease));
1458
+ setEditing(true);
1459
+ };
1460
+ const handleBlur = () => {
1461
+ const parsed = parseEase(draft);
1462
+ if (parsed) onChange(parsed);
1463
+ setEditing(false);
1464
+ };
1465
+ const handleKeyDown = (e) => {
1466
+ if (e.key === "Enter") {
1467
+ e.target.blur();
1468
+ }
1469
+ };
1470
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dialkit-labeled-control", children: [
1471
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "dialkit-labeled-control-label", children: "Ease" }),
1472
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1473
+ "input",
1474
+ {
1475
+ type: "text",
1476
+ className: "dialkit-text-input",
1477
+ value: editing ? draft : formatEase(ease),
1478
+ onChange: (e) => setDraft(e.target.value),
1479
+ onFocus: handleFocus,
1480
+ onBlur: handleBlur,
1481
+ onKeyDown: handleKeyDown,
1482
+ spellCheck: false
1483
+ }
1484
+ )
1485
+ ] });
1486
+ }
1487
+
1488
+ // src/components/TextControl.tsx
1489
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1161
1490
  function TextControl({ label, value, onChange, placeholder }) {
1162
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dialkit-text-control", children: [
1163
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { className: "dialkit-text-label", children: label }),
1164
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1491
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "dialkit-text-control", children: [
1492
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "dialkit-text-label", children: label }),
1493
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1165
1494
  "input",
1166
1495
  {
1167
1496
  type: "text",
@@ -1175,10 +1504,10 @@ function TextControl({ label, value, onChange, placeholder }) {
1175
1504
  }
1176
1505
 
1177
1506
  // src/components/SelectControl.tsx
1178
- var import_react9 = require("react");
1507
+ var import_react10 = require("react");
1179
1508
  var import_react_dom = require("react-dom");
1180
- var import_react10 = require("motion/react");
1181
- var import_jsx_runtime8 = require("react/jsx-runtime");
1509
+ var import_react11 = require("motion/react");
1510
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1182
1511
  function toTitleCase(s) {
1183
1512
  return s.replace(/\b\w/g, (c) => c.toUpperCase());
1184
1513
  }
@@ -1188,14 +1517,14 @@ function normalizeOptions(options) {
1188
1517
  );
1189
1518
  }
1190
1519
  function SelectControl({ label, value, options, onChange }) {
1191
- const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
1192
- const triggerRef = (0, import_react9.useRef)(null);
1193
- const dropdownRef = (0, import_react9.useRef)(null);
1194
- const [portalTarget, setPortalTarget] = (0, import_react9.useState)(null);
1195
- const [pos, setPos] = (0, import_react9.useState)(null);
1520
+ const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
1521
+ const triggerRef = (0, import_react10.useRef)(null);
1522
+ const dropdownRef = (0, import_react10.useRef)(null);
1523
+ const [portalTarget, setPortalTarget] = (0, import_react10.useState)(null);
1524
+ const [pos, setPos] = (0, import_react10.useState)(null);
1196
1525
  const normalized = normalizeOptions(options);
1197
1526
  const selectedOption = normalized.find((o) => o.value === value);
1198
- const updatePos = (0, import_react9.useCallback)(() => {
1527
+ const updatePos = (0, import_react10.useCallback)(() => {
1199
1528
  const el = triggerRef.current;
1200
1529
  if (!el) return;
1201
1530
  const rect = el.getBoundingClientRect();
@@ -1209,15 +1538,15 @@ function SelectControl({ label, value, options, onChange }) {
1209
1538
  above
1210
1539
  });
1211
1540
  }, [normalized.length]);
1212
- (0, import_react9.useEffect)(() => {
1541
+ (0, import_react10.useEffect)(() => {
1213
1542
  const root = triggerRef.current?.closest(".dialkit-root");
1214
1543
  setPortalTarget(root ?? document.body);
1215
1544
  }, []);
1216
- (0, import_react9.useEffect)(() => {
1545
+ (0, import_react10.useEffect)(() => {
1217
1546
  if (!isOpen) return;
1218
1547
  updatePos();
1219
1548
  }, [isOpen, updatePos]);
1220
- (0, import_react9.useEffect)(() => {
1549
+ (0, import_react10.useEffect)(() => {
1221
1550
  if (!isOpen) return;
1222
1551
  const handleClick = (e) => {
1223
1552
  const target = e.target;
@@ -1228,8 +1557,8 @@ function SelectControl({ label, value, options, onChange }) {
1228
1557
  document.addEventListener("mousedown", handleClick);
1229
1558
  return () => document.removeEventListener("mousedown", handleClick);
1230
1559
  }, [isOpen]);
1231
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dialkit-select-row", children: [
1232
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1560
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dialkit-select-row", children: [
1561
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1233
1562
  "button",
1234
1563
  {
1235
1564
  ref: triggerRef,
@@ -1237,11 +1566,11 @@ function SelectControl({ label, value, options, onChange }) {
1237
1566
  onClick: () => setIsOpen(!isOpen),
1238
1567
  "data-open": String(isOpen),
1239
1568
  children: [
1240
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "dialkit-select-label", children: label }),
1241
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dialkit-select-right", children: [
1242
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "dialkit-select-value", children: selectedOption?.label ?? value }),
1243
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1244
- import_react10.motion.svg,
1569
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dialkit-select-label", children: label }),
1570
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dialkit-select-right", children: [
1571
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dialkit-select-value", children: selectedOption?.label ?? value }),
1572
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1573
+ import_react11.motion.svg,
1245
1574
  {
1246
1575
  className: "dialkit-select-chevron",
1247
1576
  viewBox: "0 0 24 24",
@@ -1252,7 +1581,7 @@ function SelectControl({ label, value, options, onChange }) {
1252
1581
  strokeLinejoin: "round",
1253
1582
  animate: { rotate: isOpen ? 180 : 0 },
1254
1583
  transition: { type: "spring", visualDuration: 0.2, bounce: 0.15 },
1255
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M6 9.5L12 15.5L18 9.5" })
1584
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 9.5L12 15.5L18 9.5" })
1256
1585
  }
1257
1586
  )
1258
1587
  ] })
@@ -1260,8 +1589,8 @@ function SelectControl({ label, value, options, onChange }) {
1260
1589
  }
1261
1590
  ),
1262
1591
  portalTarget && (0, import_react_dom.createPortal)(
1263
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react10.AnimatePresence, { children: isOpen && pos && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1264
- import_react10.motion.div,
1592
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.AnimatePresence, { children: isOpen && pos && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1593
+ import_react11.motion.div,
1265
1594
  {
1266
1595
  ref: dropdownRef,
1267
1596
  className: "dialkit-select-dropdown",
@@ -1275,7 +1604,7 @@ function SelectControl({ label, value, options, onChange }) {
1275
1604
  width: pos.width,
1276
1605
  ...pos.above ? { bottom: window.innerHeight - pos.top, transformOrigin: "bottom" } : { top: pos.top, transformOrigin: "top" }
1277
1606
  },
1278
- children: normalized.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1607
+ children: normalized.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1279
1608
  "button",
1280
1609
  {
1281
1610
  className: "dialkit-select-option",
@@ -1296,14 +1625,14 @@ function SelectControl({ label, value, options, onChange }) {
1296
1625
  }
1297
1626
 
1298
1627
  // src/components/ColorControl.tsx
1299
- var import_react11 = require("react");
1300
- var import_jsx_runtime9 = require("react/jsx-runtime");
1628
+ var import_react12 = require("react");
1629
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1301
1630
  var HEX_COLOR_REGEX = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;
1302
1631
  function ColorControl({ label, value, onChange }) {
1303
- const [isEditing, setIsEditing] = (0, import_react11.useState)(false);
1304
- const [editValue, setEditValue] = (0, import_react11.useState)(value);
1305
- const colorInputRef = (0, import_react11.useRef)(null);
1306
- (0, import_react11.useEffect)(() => {
1632
+ const [isEditing, setIsEditing] = (0, import_react12.useState)(false);
1633
+ const [editValue, setEditValue] = (0, import_react12.useState)(value);
1634
+ const colorInputRef = (0, import_react12.useRef)(null);
1635
+ (0, import_react12.useEffect)(() => {
1307
1636
  if (!isEditing) {
1308
1637
  setEditValue(value);
1309
1638
  }
@@ -1324,10 +1653,10 @@ function ColorControl({ label, value, onChange }) {
1324
1653
  setEditValue(value);
1325
1654
  }
1326
1655
  }
1327
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "dialkit-color-control", children: [
1328
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "dialkit-color-label", children: label }),
1329
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "dialkit-color-inputs", children: [
1330
- isEditing ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1656
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "dialkit-color-control", children: [
1657
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "dialkit-color-label", children: label }),
1658
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "dialkit-color-inputs", children: [
1659
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1331
1660
  "input",
1332
1661
  {
1333
1662
  type: "text",
@@ -1338,7 +1667,7 @@ function ColorControl({ label, value, onChange }) {
1338
1667
  onKeyDown: handleKeyDown,
1339
1668
  autoFocus: true
1340
1669
  }
1341
- ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1670
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1342
1671
  "span",
1343
1672
  {
1344
1673
  className: "dialkit-color-hex",
@@ -1346,7 +1675,7 @@ function ColorControl({ label, value, onChange }) {
1346
1675
  children: (value ?? "").toUpperCase()
1347
1676
  }
1348
1677
  ),
1349
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1678
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1350
1679
  "button",
1351
1680
  {
1352
1681
  className: "dialkit-color-swatch",
@@ -1355,7 +1684,7 @@ function ColorControl({ label, value, onChange }) {
1355
1684
  title: "Pick color"
1356
1685
  }
1357
1686
  ),
1358
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1687
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1359
1688
  "input",
1360
1689
  {
1361
1690
  ref: colorInputRef,
@@ -1374,18 +1703,18 @@ function expandShorthandHex(hex) {
1374
1703
  }
1375
1704
 
1376
1705
  // src/components/PresetManager.tsx
1377
- var import_react12 = require("react");
1706
+ var import_react13 = require("react");
1378
1707
  var import_react_dom2 = require("react-dom");
1379
- var import_react13 = require("motion/react");
1380
- var import_jsx_runtime10 = require("react/jsx-runtime");
1708
+ var import_react14 = require("motion/react");
1709
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1381
1710
  function PresetManager({ panelId, presets, activePresetId, onAdd }) {
1382
- const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
1383
- const triggerRef = (0, import_react12.useRef)(null);
1384
- const dropdownRef = (0, import_react12.useRef)(null);
1385
- const [pos, setPos] = (0, import_react12.useState)({ top: 0, left: 0, width: 0 });
1711
+ const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
1712
+ const triggerRef = (0, import_react13.useRef)(null);
1713
+ const dropdownRef = (0, import_react13.useRef)(null);
1714
+ const [pos, setPos] = (0, import_react13.useState)({ top: 0, left: 0, width: 0 });
1386
1715
  const hasPresets = presets.length > 0;
1387
1716
  const activePreset = presets.find((p) => p.id === activePresetId);
1388
- const open = (0, import_react12.useCallback)(() => {
1717
+ const open = (0, import_react13.useCallback)(() => {
1389
1718
  if (!hasPresets) return;
1390
1719
  const rect = triggerRef.current?.getBoundingClientRect();
1391
1720
  if (rect) {
@@ -1393,12 +1722,12 @@ function PresetManager({ panelId, presets, activePresetId, onAdd }) {
1393
1722
  }
1394
1723
  setIsOpen(true);
1395
1724
  }, [hasPresets]);
1396
- const close = (0, import_react12.useCallback)(() => setIsOpen(false), []);
1397
- const toggle = (0, import_react12.useCallback)(() => {
1725
+ const close = (0, import_react13.useCallback)(() => setIsOpen(false), []);
1726
+ const toggle = (0, import_react13.useCallback)(() => {
1398
1727
  if (isOpen) close();
1399
1728
  else open();
1400
1729
  }, [isOpen, open, close]);
1401
- (0, import_react12.useEffect)(() => {
1730
+ (0, import_react13.useEffect)(() => {
1402
1731
  if (!isOpen) return;
1403
1732
  const handler = (e) => {
1404
1733
  const target = e.target;
@@ -1420,8 +1749,8 @@ function PresetManager({ panelId, presets, activePresetId, onAdd }) {
1420
1749
  e.stopPropagation();
1421
1750
  DialStore.deletePreset(panelId, presetId);
1422
1751
  };
1423
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dialkit-preset-manager", children: [
1424
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1752
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "dialkit-preset-manager", children: [
1753
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1425
1754
  "button",
1426
1755
  {
1427
1756
  ref: triggerRef,
@@ -1431,9 +1760,9 @@ function PresetManager({ panelId, presets, activePresetId, onAdd }) {
1431
1760
  "data-has-preset": String(!!activePreset),
1432
1761
  "data-disabled": String(!hasPresets),
1433
1762
  children: [
1434
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dialkit-preset-label", children: activePreset ? activePreset.name : "Version 1" }),
1435
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1436
- import_react13.motion.svg,
1763
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "dialkit-preset-label", children: activePreset ? activePreset.name : "Version 1" }),
1764
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1765
+ import_react14.motion.svg,
1437
1766
  {
1438
1767
  className: "dialkit-select-chevron",
1439
1768
  viewBox: "0 0 24 24",
@@ -1444,15 +1773,15 @@ function PresetManager({ panelId, presets, activePresetId, onAdd }) {
1444
1773
  strokeLinejoin: "round",
1445
1774
  animate: { rotate: isOpen ? 180 : 0, opacity: hasPresets ? 0.6 : 0.25 },
1446
1775
  transition: { type: "spring", visualDuration: 0.2, bounce: 0.15 },
1447
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 9.5L12 15.5L18 9.5" })
1776
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M6 9.5L12 15.5L18 9.5" })
1448
1777
  }
1449
1778
  )
1450
1779
  ]
1451
1780
  }
1452
1781
  ),
1453
1782
  (0, import_react_dom2.createPortal)(
1454
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react13.AnimatePresence, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1455
- import_react13.motion.div,
1783
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.AnimatePresence, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1784
+ import_react14.motion.div,
1456
1785
  {
1457
1786
  ref: dropdownRef,
1458
1787
  className: "dialkit-root dialkit-preset-dropdown",
@@ -1462,35 +1791,35 @@ function PresetManager({ panelId, presets, activePresetId, onAdd }) {
1462
1791
  exit: { opacity: 0, y: 4, scale: 0.97, pointerEvents: "none" },
1463
1792
  transition: { type: "spring", visualDuration: 0.15, bounce: 0 },
1464
1793
  children: [
1465
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1794
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1466
1795
  "div",
1467
1796
  {
1468
1797
  className: "dialkit-preset-item",
1469
1798
  "data-active": String(!activePresetId),
1470
1799
  onClick: () => handleSelect(null),
1471
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dialkit-preset-name", children: "Version 1" })
1800
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "dialkit-preset-name", children: "Version 1" })
1472
1801
  }
1473
1802
  ),
1474
- presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1803
+ presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1475
1804
  "div",
1476
1805
  {
1477
1806
  className: "dialkit-preset-item",
1478
1807
  "data-active": String(preset.id === activePresetId),
1479
1808
  onClick: () => handleSelect(preset.id),
1480
1809
  children: [
1481
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dialkit-preset-name", children: preset.name }),
1482
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1810
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "dialkit-preset-name", children: preset.name }),
1811
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1483
1812
  "button",
1484
1813
  {
1485
1814
  className: "dialkit-preset-delete",
1486
1815
  onClick: (e) => handleDelete(e, preset.id),
1487
1816
  title: "Delete preset",
1488
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1489
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "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" }),
1490
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M10 11V16" }),
1491
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 11V16" }),
1492
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M3.5 6H20.5" }),
1493
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "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" })
1817
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1818
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "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" }),
1819
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M10 11V16" }),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M14 11V16" }),
1821
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M3.5 6H20.5" }),
1822
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "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" })
1494
1823
  ] })
1495
1824
  }
1496
1825
  )
@@ -1507,11 +1836,11 @@ function PresetManager({ panelId, presets, activePresetId, onAdd }) {
1507
1836
  }
1508
1837
 
1509
1838
  // src/components/Panel.tsx
1510
- var import_jsx_runtime11 = require("react/jsx-runtime");
1511
- function Panel({ panel }) {
1512
- const [copied, setCopied] = (0, import_react14.useState)(false);
1513
- const [isPanelOpen, setIsPanelOpen] = (0, import_react14.useState)(true);
1514
- const values = (0, import_react14.useSyncExternalStore)(
1839
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1840
+ function Panel({ panel, defaultOpen = true, inline = false }) {
1841
+ const [copied, setCopied] = (0, import_react15.useState)(false);
1842
+ const [isPanelOpen, setIsPanelOpen] = (0, import_react15.useState)(defaultOpen);
1843
+ const values = (0, import_react15.useSyncExternalStore)(
1515
1844
  (cb) => DialStore.subscribe(panel.id, cb),
1516
1845
  () => DialStore.getValues(panel.id),
1517
1846
  () => DialStore.getValues(panel.id)
@@ -1539,7 +1868,7 @@ Apply these values as the new defaults in the useDialKit call.`;
1539
1868
  const value = values[control.path];
1540
1869
  switch (control.type) {
1541
1870
  case "slider":
1542
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1871
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1543
1872
  Slider,
1544
1873
  {
1545
1874
  label: control.label,
@@ -1552,7 +1881,7 @@ Apply these values as the new defaults in the useDialKit call.`;
1552
1881
  control.path
1553
1882
  );
1554
1883
  case "toggle":
1555
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1884
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1556
1885
  Toggle,
1557
1886
  {
1558
1887
  label: control.label,
@@ -1562,7 +1891,7 @@ Apply these values as the new defaults in the useDialKit call.`;
1562
1891
  control.path
1563
1892
  );
1564
1893
  case "spring":
1565
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1894
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1566
1895
  SpringControl,
1567
1896
  {
1568
1897
  panelId: panel.id,
@@ -1573,10 +1902,22 @@ Apply these values as the new defaults in the useDialKit call.`;
1573
1902
  },
1574
1903
  control.path
1575
1904
  );
1905
+ case "transition":
1906
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1907
+ TransitionControl,
1908
+ {
1909
+ panelId: panel.id,
1910
+ path: control.path,
1911
+ label: control.label,
1912
+ value,
1913
+ onChange: (v) => DialStore.updateValue(panel.id, control.path, v)
1914
+ },
1915
+ control.path
1916
+ );
1576
1917
  case "folder":
1577
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Folder, { title: control.label, defaultOpen: control.defaultOpen ?? true, children: control.children?.map(renderControl) }, control.path);
1918
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Folder, { title: control.label, defaultOpen: control.defaultOpen ?? true, children: control.children?.map(renderControl) }, control.path);
1578
1919
  case "text":
1579
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1920
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1580
1921
  TextControl,
1581
1922
  {
1582
1923
  label: control.label,
@@ -1587,7 +1928,7 @@ Apply these values as the new defaults in the useDialKit call.`;
1587
1928
  control.path
1588
1929
  );
1589
1930
  case "select":
1590
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1931
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1591
1932
  SelectControl,
1592
1933
  {
1593
1934
  label: control.label,
@@ -1598,7 +1939,7 @@ Apply these values as the new defaults in the useDialKit call.`;
1598
1939
  control.path
1599
1940
  );
1600
1941
  case "color":
1601
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1942
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1602
1943
  ColorControl,
1603
1944
  {
1604
1945
  label: control.label,
@@ -1607,54 +1948,43 @@ Apply these values as the new defaults in the useDialKit call.`;
1607
1948
  },
1608
1949
  control.path
1609
1950
  );
1951
+ case "action":
1952
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1953
+ "button",
1954
+ {
1955
+ className: "dialkit-button",
1956
+ onClick: () => DialStore.triggerAction(panel.id, control.path),
1957
+ children: control.label
1958
+ },
1959
+ control.path
1960
+ );
1610
1961
  default:
1611
1962
  return null;
1612
1963
  }
1613
1964
  };
1614
1965
  const renderControls = () => {
1615
- const result = [];
1616
- let i = 0;
1617
- while (i < panel.controls.length) {
1618
- const control = panel.controls[i];
1619
- if (control.type === "action") {
1620
- result.push(
1621
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1622
- "button",
1623
- {
1624
- className: "dialkit-button",
1625
- onClick: () => DialStore.triggerAction(panel.id, control.path),
1626
- children: control.label
1627
- },
1628
- control.path
1629
- )
1630
- );
1631
- } else {
1632
- result.push(renderControl(control));
1633
- }
1634
- i++;
1635
- }
1636
- return result;
1966
+ return panel.controls.map(renderControl);
1637
1967
  };
1638
1968
  const iconTransition = { type: "spring", visualDuration: 0.4, bounce: 0.1 };
1639
- const toolbar = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1640
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1641
- import_react15.motion.button,
1969
+ const toolbar = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1970
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1971
+ import_react16.motion.button,
1642
1972
  {
1643
1973
  className: "dialkit-toolbar-add",
1644
1974
  onClick: handleAddPreset,
1645
1975
  title: "Add preset",
1646
1976
  whileTap: { scale: 0.9 },
1647
1977
  transition: { type: "spring", visualDuration: 0.15, bounce: 0.3 },
1648
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1649
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M4 6H20" }),
1650
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M4 12H10" }),
1651
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M15 15L21 15" }),
1652
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M18 12V18" }),
1653
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M4 18H10" })
1978
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1979
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M4 6H20" }),
1980
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M4 12H10" }),
1981
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M15 15L21 15" }),
1982
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M18 12V18" }),
1983
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M4 18H10" })
1654
1984
  ] })
1655
1985
  }
1656
1986
  ),
1657
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1987
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1658
1988
  PresetManager,
1659
1989
  {
1660
1990
  panelId: panel.id,
@@ -1663,8 +1993,8 @@ Apply these values as the new defaults in the useDialKit call.`;
1663
1993
  onAdd: handleAddPreset
1664
1994
  }
1665
1995
  ),
1666
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1667
- import_react15.motion.button,
1996
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1997
+ import_react16.motion.button,
1668
1998
  {
1669
1999
  className: "dialkit-toolbar-copy",
1670
2000
  onClick: handleCopy,
@@ -1672,8 +2002,8 @@ Apply these values as the new defaults in the useDialKit call.`;
1672
2002
  whileTap: { scale: 0.95 },
1673
2003
  transition: { type: "spring", visualDuration: 0.15, bounce: 0.3 },
1674
2004
  children: [
1675
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "dialkit-toolbar-copy-icon-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react15.AnimatePresence, { initial: false, mode: "popLayout", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1676
- import_react15.motion.svg,
2005
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dialkit-toolbar-copy-icon-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react16.AnimatePresence, { initial: false, mode: "popLayout", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2006
+ import_react16.motion.svg,
1677
2007
  {
1678
2008
  className: "dialkit-toolbar-copy-icon",
1679
2009
  viewBox: "0 0 24 24",
@@ -1686,11 +2016,11 @@ Apply these values as the new defaults in the useDialKit call.`;
1686
2016
  animate: { scale: 1, opacity: 1, filter: "blur(0px)" },
1687
2017
  exit: { scale: 0.5, opacity: 0, filter: "blur(4px)" },
1688
2018
  transition: { type: "spring", visualDuration: 0.3, bounce: 0.2 },
1689
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M5 12.75L10 19L19 5" })
2019
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M5 12.75L10 19L19 5" })
1690
2020
  },
1691
2021
  "check"
1692
- ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1693
- import_react15.motion.svg,
2022
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2023
+ import_react16.motion.svg,
1694
2024
  {
1695
2025
  className: "dialkit-toolbar-copy-icon",
1696
2026
  viewBox: "0 0 24 24",
@@ -1700,9 +2030,9 @@ Apply these values as the new defaults in the useDialKit call.`;
1700
2030
  exit: { scale: 0.5, opacity: 0, filter: "blur(4px)" },
1701
2031
  transition: { type: "spring", visualDuration: 0.3, bounce: 0.2 },
1702
2032
  children: [
1703
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M8 6C8 4.34315 9.34315 3 11 3H13C14.6569 3 16 4.34315 16 6V7H8V6Z", stroke: "currentColor", strokeWidth: "2", strokeLinejoin: "round" }),
1704
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "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", fill: "currentColor" }),
1705
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M16 5H17C18.6569 5 20 6.34315 20 8V11M8 5H7C5.34315 5 4 6.34315 4 8V18C4 19.6569 5.34315 21 7 21H12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
2033
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M8 6C8 4.34315 9.34315 3 11 3H13C14.6569 3 16 4.34315 16 6V7H8V6Z", stroke: "currentColor", strokeWidth: "2", strokeLinejoin: "round" }),
2034
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "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", fill: "currentColor" }),
2035
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M16 5H17C18.6569 5 20 6.34315 20 8V11M8 5H7C5.34315 5 4 6.34315 4 8V18C4 19.6569 5.34315 21 7 21H12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
1706
2036
  ]
1707
2037
  },
1708
2038
  "clipboard"
@@ -1712,15 +2042,16 @@ Apply these values as the new defaults in the useDialKit call.`;
1712
2042
  }
1713
2043
  )
1714
2044
  ] });
1715
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "dialkit-panel-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Folder, { title: panel.name, defaultOpen: true, isRoot: true, onOpenChange: setIsPanelOpen, toolbar, children: renderControls() }) });
2045
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "dialkit-panel-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Folder, { title: panel.name, defaultOpen, isRoot: true, inline, onOpenChange: setIsPanelOpen, toolbar, children: renderControls() }) });
1716
2046
  }
1717
2047
 
1718
2048
  // src/components/DialRoot.tsx
1719
- var import_jsx_runtime12 = require("react/jsx-runtime");
1720
- function DialRoot({ position = "top-right" }) {
1721
- const [panels, setPanels] = (0, import_react16.useState)([]);
1722
- const [mounted, setMounted] = (0, import_react16.useState)(false);
1723
- (0, import_react16.useEffect)(() => {
2049
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2050
+ function DialRoot({ position = "top-right", defaultOpen = true, mode = "popover" }) {
2051
+ const [panels, setPanels] = (0, import_react17.useState)([]);
2052
+ const [mounted, setMounted] = (0, import_react17.useState)(false);
2053
+ const inline = mode === "inline";
2054
+ (0, import_react17.useEffect)(() => {
1724
2055
  setMounted(true);
1725
2056
  setPanels(DialStore.getPanels());
1726
2057
  const unsubscribe = DialStore.subscribeGlobal(() => {
@@ -1734,14 +2065,17 @@ function DialRoot({ position = "top-right" }) {
1734
2065
  if (panels.length === 0) {
1735
2066
  return null;
1736
2067
  }
1737
- const content = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "dialkit-root", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "dialkit-panel", "data-position": position, children: panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Panel, { panel }, panel.id)) }) });
2068
+ const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "dialkit-root", "data-mode": mode, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "dialkit-panel", "data-position": inline ? void 0 : position, "data-mode": mode, children: panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Panel, { panel, defaultOpen: inline || defaultOpen, inline }, panel.id)) }) });
2069
+ if (inline) {
2070
+ return content;
2071
+ }
1738
2072
  return (0, import_react_dom3.createPortal)(content, document.body);
1739
2073
  }
1740
2074
 
1741
2075
  // src/components/ButtonGroup.tsx
1742
- var import_jsx_runtime13 = require("react/jsx-runtime");
2076
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1743
2077
  function ButtonGroup({ buttons }) {
1744
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "dialkit-button-group", children: buttons.map((button, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2078
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dialkit-button-group", children: buttons.map((button, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1745
2079
  "button",
1746
2080
  {
1747
2081
  className: "dialkit-button",
@@ -1757,6 +2091,7 @@ function ButtonGroup({ buttons }) {
1757
2091
  ColorControl,
1758
2092
  DialRoot,
1759
2093
  DialStore,
2094
+ EasingVisualization,
1760
2095
  Folder,
1761
2096
  PresetManager,
1762
2097
  SelectControl,
@@ -1765,6 +2100,7 @@ function ButtonGroup({ buttons }) {
1765
2100
  SpringVisualization,
1766
2101
  TextControl,
1767
2102
  Toggle,
2103
+ TransitionControl,
1768
2104
  useDialKit
1769
2105
  });
1770
2106
  //# sourceMappingURL=index.cjs.map