histoire 0.4.6 → 0.5.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 (52) hide show
  1. package/dist/bundled/HomeView.js +1 -0
  2. package/dist/bundled/MobileOverlay.js +3 -1
  3. package/dist/bundled/SandboxVue3.js +649 -0
  4. package/dist/bundled/SearchPane.js +2 -0
  5. package/dist/bundled/StoryView.js +307 -618
  6. package/dist/bundled/global-components.js +5 -5
  7. package/dist/bundled/index2.js +111 -43
  8. package/dist/bundled/sandbox.js +2 -2
  9. package/dist/bundled/state.js +16 -83
  10. package/dist/client/app/App.vue +18 -0
  11. package/dist/client/app/codegen/serialize-js.js +1 -1
  12. package/dist/client/app/codegen/vue3.d.ts +2 -0
  13. package/dist/client/app/codegen/vue3.js +37 -12
  14. package/dist/client/app/components/app/InitialLoading.vue +46 -0
  15. package/dist/client/app/components/app/MobileOverlay.vue +1 -1
  16. package/dist/client/app/components/exposed/Story.vue +2 -1
  17. package/dist/client/app/components/exposed/Variant.vue +4 -4
  18. package/dist/client/app/components/panel/ControlsComponentPropItem.vue +96 -0
  19. package/dist/client/app/components/panel/ControlsComponentProps.vue +33 -0
  20. package/dist/client/app/components/panel/StatePresets.vue +8 -6
  21. package/dist/client/app/components/panel/StoryControls.vue +18 -3
  22. package/dist/client/app/components/sandbox/SandboxVue3.vue +70 -2
  23. package/dist/client/app/style/transitions.pcss +12 -0
  24. package/dist/client/app/types.d.ts +11 -0
  25. package/dist/client/app/util/state.d.ts +1 -0
  26. package/dist/client/app/util/state.js +11 -2
  27. package/dist/node/build.js +1 -3
  28. package/dist/node/collect/index.js +6 -0
  29. package/dist/node/config.d.ts +23 -23
  30. package/dist/node/plugin.d.ts +2 -2
  31. package/dist/node/server.js +16 -5
  32. package/dist/style.css +92 -13
  33. package/package.json +2 -2
  34. package/src/client/app/App.vue +18 -0
  35. package/src/client/app/codegen/serialize-js.ts +1 -1
  36. package/src/client/app/codegen/vue3.ts +40 -12
  37. package/src/client/app/components/app/InitialLoading.vue +46 -0
  38. package/src/client/app/components/app/MobileOverlay.vue +1 -1
  39. package/src/client/app/components/exposed/Story.vue +2 -1
  40. package/src/client/app/components/exposed/Variant.vue +4 -4
  41. package/src/client/app/components/panel/ControlsComponentPropItem.vue +96 -0
  42. package/src/client/app/components/panel/ControlsComponentProps.vue +33 -0
  43. package/src/client/app/components/panel/StatePresets.vue +8 -6
  44. package/src/client/app/components/panel/StoryControls.vue +18 -3
  45. package/src/client/app/components/sandbox/SandboxVue3.vue +70 -2
  46. package/src/client/app/style/transitions.pcss +12 -0
  47. package/src/client/app/types.ts +13 -0
  48. package/src/client/app/util/state.ts +12 -2
  49. package/src/node/build.ts +1 -3
  50. package/src/node/collect/index.ts +7 -0
  51. package/src/node/server.ts +20 -5
  52. package/dist/bundled/dark.js +0 -4
@@ -17,23 +17,22 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { computed, pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, openBlock, createElementBlock, createVNode, withCtx, normalizeClass, createElementVNode, toDisplayString, resolveComponent, withModifiers, watch, normalizeStyle, Fragment, renderList, createBlock, withKeys, renderSlot, createTextVNode, resolveDirective, withDirectives, vModelText, createCommentVNode, createStaticVNode, onUnmounted, toRaw, mergeProps, onMounted, nextTick, isRef, watchEffect, Text, vModelSelect, vModelRadio, vModelCheckbox, vModelDynamic, shallowRef, Transition, reactive, onBeforeUnmount, h, resolveDynamicComponent } from "vue";
20
+ import { computed, pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, openBlock, createElementBlock, createVNode, withCtx, normalizeClass, createElementVNode, toDisplayString, resolveComponent, withModifiers, watch, normalizeStyle, Fragment, renderList, createBlock, withKeys, renderSlot, createTextVNode, resolveDirective, withDirectives, vModelText, createCommentVNode, createStaticVNode, onUnmounted, toRaw, mergeProps, onMounted, nextTick, isRef, resolveDynamicComponent, watchEffect, shallowRef, Transition, reactive, onBeforeUnmount, h } from "vue";
21
21
  import { useRoute, useRouter } from "vue-router";
22
22
  import { Icon } from "@iconify/vue";
23
23
  import { u as useStoryStore, b as base } from "./story.js";
24
- import { u as useScrollOnActive, B as BaseListItemLink, _ as _export_sfc, i as isMobile, b as BaseSplitPane, a as _sfc_main$u } from "./MobileOverlay.js";
24
+ import { u as useScrollOnActive, B as BaseListItemLink, _ as _export_sfc, i as isMobile, b as BaseSplitPane, a as _sfc_main$w } from "./MobileOverlay.js";
25
25
  import { B as BaseEmpty } from "./BaseEmpty.js";
26
26
  import { useResizeObserver, useStorage, useEventListener, useTimeoutFn, onClickOutside } from "@vueuse/core";
27
- import { _ as _sfc_main$t, t as toRawDeep, a as applyStateToVariant, c as clone } from "./state.js";
27
+ import { _ as _sfc_main$v, u as unindent, g as generateSourceCode } from "./SandboxVue3.js";
28
28
  import { defineStore } from "pinia";
29
29
  import { h as histoireConfig } from "./config.js";
30
30
  import { S as STATE_SYNC, a as SANDBOX_READY, E as EVENT_SEND, P as PREVIEW_SETTINGS_SYNC } from "./const.js";
31
31
  import { useEventsStore } from "./events.js";
32
+ import { b as toRawDeep, a as applyStateToVariant, c as clone, o as omit, i as isDark } from "./state.js";
32
33
  import { Dropdown } from "floating-vue";
33
34
  import { setCDN, getHighlighter } from "shiki";
34
35
  import { HstCopyIcon } from "@histoire/controls";
35
- import { pascal } from "case";
36
- import { i as isDark } from "./dark.js";
37
36
  function useCurrentVariantRoute(variant) {
38
37
  const route = useRoute();
39
38
  const isActive = computed(() => route.query.variantId === variant.value.id);
@@ -49,8 +48,9 @@ function useCurrentVariantRoute(variant) {
49
48
  }
50
49
  var StoryVariantListItem_vue_vue_type_style_index_0_scoped_true_lang = "";
51
50
  const _withScopeId$7 = (n) => (pushScopeId("data-v-2cdc2ac0"), n = n(), popScopeId(), n);
52
- const _hoisted_1$q = { class: "htw-truncate" };
53
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
51
+ const _hoisted_1$r = { class: "htw-truncate" };
52
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
53
+ name: "StoryVariantListItem",
54
54
  props: {
55
55
  variant: {
56
56
  type: Object,
@@ -87,7 +87,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
87
87
  "bind-icon-color": !active && unref(variant).iconColor
88
88
  }])
89
89
  }, null, 8, ["icon", "class"]),
90
- createElementVNode("span", _hoisted_1$q, toDisplayString(unref(variant).title), 1)
90
+ createElementVNode("span", _hoisted_1$r, toDisplayString(unref(variant).title), 1)
91
91
  ];
92
92
  }),
93
93
  _: 1
@@ -96,11 +96,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
96
96
  };
97
97
  }
98
98
  });
99
- var StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-2cdc2ac0"]]);
99
+ var StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-2cdc2ac0"]]);
100
100
  var StoryVariantGridItem_vue_vue_type_style_index_0_scoped_true_lang = "";
101
101
  const _withScopeId$6 = (n) => (pushScopeId("data-v-5c057bcc"), n = n(), popScopeId(), n);
102
- const _hoisted_1$p = { class: "htw-flex-none htw-flex htw-items-center" };
103
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
102
+ const _hoisted_1$q = { class: "htw-flex-none htw-flex htw-items-center" };
103
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
104
+ name: "StoryVariantGridItem",
104
105
  props: {
105
106
  variant: {
106
107
  type: Object,
@@ -150,7 +151,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
150
151
  ref: el,
151
152
  class: "htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
152
153
  }, [
153
- createElementVNode("div", _hoisted_1$p, [
154
+ createElementVNode("div", _hoisted_1$q, [
154
155
  createVNode(_component_RouterLink, {
155
156
  to: unref(targetRoute),
156
157
  class: normalizeClass(["htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1", {
@@ -182,7 +183,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
182
183
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop", "prevent"])),
183
184
  onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
184
185
  }, [
185
- createVNode(_sfc_main$t, {
186
+ createVNode(_sfc_main$v, {
186
187
  variant: unref(variant),
187
188
  story: __props.story,
188
189
  onReady
@@ -192,8 +193,9 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
192
193
  };
193
194
  }
194
195
  });
195
- var StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-5c057bcc"]]);
196
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
196
+ var StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-5c057bcc"]]);
197
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
198
+ name: "StoryVariantGrid",
197
199
  setup(__props) {
198
200
  const storyStore = useStoryStore();
199
201
  const gridTemplateWidth = computed(() => {
@@ -281,15 +283,16 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
281
283
  };
282
284
  }
283
285
  });
284
- const _hoisted_1$o = { class: "htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0" };
285
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
286
+ const _hoisted_1$p = { class: "htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0" };
287
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
288
+ name: "StoryVariantTitle",
286
289
  props: {
287
290
  variant: null
288
291
  },
289
292
  setup(__props) {
290
293
  return (_ctx, _cache) => {
291
294
  var _a;
292
- return openBlock(), createElementBlock("div", _hoisted_1$o, [
295
+ return openBlock(), createElementBlock("div", _hoisted_1$p, [
293
296
  createVNode(unref(Icon), {
294
297
  icon: (_a = __props.variant.icon) != null ? _a : "carbon:cube",
295
298
  class: normalizeClass(["base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50", [
@@ -313,15 +316,16 @@ const usePreviewSettingsStore = defineStore("preview-settings", () => {
313
316
  currentSettings
314
317
  };
315
318
  });
316
- const _hoisted_1$n = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
317
- const _hoisted_2$j = {
319
+ const _hoisted_1$o = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
320
+ const _hoisted_2$k = {
318
321
  width: "16",
319
322
  height: "16",
320
323
  viewBox: "0 0 24 24",
321
324
  class: "htw-relative htw-z-10"
322
325
  };
323
- const _hoisted_3$c = ["stroke-dasharray", "stroke-dashoffset"];
324
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
326
+ const _hoisted_3$d = ["stroke-dasharray", "stroke-dashoffset"];
327
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
328
+ name: "BaseCheckbox",
325
329
  props: {
326
330
  modelValue: {
327
331
  type: Boolean,
@@ -357,13 +361,13 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
357
361
  _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["space"]))
358
362
  ]
359
363
  }, [
360
- createElementVNode("div", _hoisted_1$n, [
364
+ createElementVNode("div", _hoisted_1$o, [
361
365
  createElementVNode("div", {
362
366
  class: normalizeClass(["htw-border group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out", [
363
367
  __props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
364
368
  ]])
365
369
  }, null, 2),
366
- (openBlock(), createElementBlock("svg", _hoisted_2$j, [
370
+ (openBlock(), createElementBlock("svg", _hoisted_2$k, [
367
371
  createElementVNode("path", {
368
372
  ref_key: "path",
369
373
  ref: path,
@@ -377,7 +381,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
377
381
  ]]),
378
382
  "stroke-dasharray": dasharray.value,
379
383
  "stroke-dashoffset": unref(dashoffset)
380
- }, null, 10, _hoisted_3$c)
384
+ }, null, 10, _hoisted_3$d)
381
385
  ]))
382
386
  ]),
383
387
  renderSlot(_ctx.$slots, "default")
@@ -385,10 +389,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
385
389
  };
386
390
  }
387
391
  });
388
- const _hoisted_1$m = { class: "htw-flex htw-flex-col htw-items-stretch" };
389
- const _hoisted_2$i = /* @__PURE__ */ createTextVNode(" Rotate ");
390
- const _hoisted_3$b = { class: "htw-flex htw-gap-2 htw-px-4 htw-py-3" };
391
- const _hoisted_4$8 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-50" }, "x", -1);
392
+ const _hoisted_1$n = { class: "htw-flex htw-flex-col htw-items-stretch" };
393
+ const _hoisted_2$j = /* @__PURE__ */ createTextVNode(" Rotate ");
394
+ const _hoisted_3$c = { class: "htw-flex htw-gap-2 htw-px-4 htw-py-3" };
395
+ const _hoisted_4$9 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-50" }, "x", -1);
392
396
  const _hoisted_5$6 = ["onClick"];
393
397
  const _hoisted_6$6 = { class: "htw-ml-auto htw-opacity-70 htw-flex htw-gap-1" };
394
398
  const _hoisted_7$3 = { key: 0 };
@@ -396,7 +400,8 @@ const _hoisted_8$2 = { key: 0 };
396
400
  const _hoisted_9 = { key: 1 };
397
401
  const _hoisted_10 = { key: 2 };
398
402
  const _hoisted_11 = { key: 0 };
399
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
403
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
404
+ name: "StoryVariantResponsiveSize",
400
405
  setup(__props) {
401
406
  const settings = usePreviewSettingsStore().currentSettings;
402
407
  return (_ctx, _cache) => {
@@ -410,17 +415,17 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
410
415
  class: "htw-h-full htw-flex-none"
411
416
  }, {
412
417
  popper: withCtx(({ hide }) => [
413
- createElementVNode("div", _hoisted_1$m, [
414
- createVNode(_sfc_main$o, {
418
+ createElementVNode("div", _hoisted_1$n, [
419
+ createVNode(_sfc_main$q, {
415
420
  modelValue: unref(settings).rotate,
416
421
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).rotate = $event)
417
422
  }, {
418
423
  default: withCtx(() => [
419
- _hoisted_2$i
424
+ _hoisted_2$j
420
425
  ]),
421
426
  _: 1
422
427
  }, 8, ["modelValue"]),
423
- createElementVNode("div", _hoisted_3$b, [
428
+ createElementVNode("div", _hoisted_3$c, [
424
429
  withDirectives(createElementVNode("input", {
425
430
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(settings).responsiveWidth = $event),
426
431
  type: "number",
@@ -436,7 +441,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
436
441
  ],
437
442
  [_directive_tooltip, "Responsive width (px)"]
438
443
  ]),
439
- _hoisted_4$8,
444
+ _hoisted_4$9,
440
445
  withDirectives(createElementVNode("input", {
441
446
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(settings).responsiveHeight = $event),
442
447
  type: "number",
@@ -509,14 +514,15 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
509
514
  });
510
515
  var StoryVariantBackground_vue_vue_type_style_index_0_scoped_true_lang = "";
511
516
  const _withScopeId$5 = (n) => (pushScopeId("data-v-bde73868"), n = n(), popScopeId(), n);
512
- const _hoisted_1$l = { class: "htw-cursor-pointer hover:htw-text-primary-500 htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group" };
513
- const _hoisted_2$h = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createElementVNode("div", { class: "bind-preview-bg htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/50 dark:htw-border-white/50" }, null, -1));
514
- const _hoisted_3$a = { class: "htw-flex htw-flex-col htw-items-stretch" };
515
- const _hoisted_4$7 = /* @__PURE__ */ createTextVNode(" Checkerboard ");
517
+ const _hoisted_1$m = { class: "htw-cursor-pointer hover:htw-text-primary-500 htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group" };
518
+ const _hoisted_2$i = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createElementVNode("div", { class: "bind-preview-bg htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/50 dark:htw-border-white/50" }, null, -1));
519
+ const _hoisted_3$b = { class: "htw-flex htw-flex-col htw-items-stretch" };
520
+ const _hoisted_4$8 = /* @__PURE__ */ createTextVNode(" Checkerboard ");
516
521
  const _hoisted_5$5 = ["onClick"];
517
522
  const _hoisted_6$5 = { class: "htw-mr-auto" };
518
523
  const _hoisted_7$2 = { class: "htw-ml-auto htw-opacity-70" };
519
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
524
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
525
+ name: "StoryVariantBackground",
520
526
  setup(__props) {
521
527
  useCssVars((_ctx) => ({
522
528
  "b797c7ca": unref(settings).backgroundColor
@@ -532,13 +538,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
532
538
  class: "htw-h-full htw-flex-none"
533
539
  }, {
534
540
  popper: withCtx(({ hide }) => [
535
- createElementVNode("div", _hoisted_3$a, [
536
- createVNode(_sfc_main$o, {
541
+ createElementVNode("div", _hoisted_3$b, [
542
+ createVNode(_sfc_main$q, {
537
543
  modelValue: unref(settings).checkerboard,
538
544
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).checkerboard = $event)
539
545
  }, {
540
546
  default: withCtx(() => [
541
- _hoisted_4$7
547
+ _hoisted_4$8
542
548
  ]),
543
549
  _: 1
544
550
  }, 8, ["modelValue"]),
@@ -568,8 +574,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
568
574
  ])
569
575
  ]),
570
576
  default: withCtx(() => [
571
- withDirectives((openBlock(), createElementBlock("div", _hoisted_1$l, [
572
- _hoisted_2$h,
577
+ withDirectives((openBlock(), createElementBlock("div", _hoisted_1$m, [
578
+ _hoisted_2$i,
573
579
  createVNode(unref(Icon), {
574
580
  icon: "carbon:caret-down",
575
581
  class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
@@ -583,15 +589,16 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
583
589
  };
584
590
  }
585
591
  });
586
- var StoryVariantBackground = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-bde73868"]]);
592
+ var StoryVariantBackground = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-bde73868"]]);
587
593
  function getSandboxUrl(story, variant) {
588
594
  const url = new URLSearchParams();
589
595
  url.append("storyId", story.id);
590
596
  url.append("variantId", variant.id);
591
597
  return `${base}__sandbox?${url.toString()}`;
592
598
  }
593
- const _hoisted_1$k = ["href"];
594
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
599
+ const _hoisted_1$l = ["href"];
600
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
601
+ name: "StoryVariantNewTab",
595
602
  props: {
596
603
  variant: null,
597
604
  story: null
@@ -612,23 +619,23 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
612
619
  icon: "carbon:launch",
613
620
  class: "base-list-item-link-icon htw-w-4 htw-h-4"
614
621
  })
615
- ], 8, _hoisted_1$k)), [
622
+ ], 8, _hoisted_1$l)), [
616
623
  [_directive_tooltip, "Open variant in new tab"]
617
624
  ]);
618
625
  };
619
626
  }
620
627
  });
621
628
  var HatchedPattern_vue_vue_type_style_index_0_scoped_true_lang = "";
622
- const _sfc_main$k = {};
629
+ const _sfc_main$m = {};
623
630
  const _withScopeId$4 = (n) => (pushScopeId("data-v-250960ac"), n = n(), popScopeId(), n);
624
- const _hoisted_1$j = { class: "__histoire-hatched-pattern" };
631
+ const _hoisted_1$k = { class: "__histoire-hatched-pattern" };
625
632
  function _sfc_render$3(_ctx, _cache) {
626
- return openBlock(), createElementBlock("div", _hoisted_1$j);
633
+ return openBlock(), createElementBlock("div", _hoisted_1$k);
627
634
  }
628
- var HatchedPattern = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$3], ["__scopeId", "data-v-250960ac"]]);
629
- const _sfc_main$j = {};
630
- const _hoisted_1$i = { fill: "none" };
631
- const _hoisted_2$g = /* @__PURE__ */ createElementVNode("pattern", {
635
+ var HatchedPattern = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$3], ["__scopeId", "data-v-250960ac"]]);
636
+ const _sfc_main$l = {};
637
+ const _hoisted_1$j = { fill: "none" };
638
+ const _hoisted_2$h = /* @__PURE__ */ createElementVNode("pattern", {
632
639
  id: "checkerboard",
633
640
  width: "64",
634
641
  height: "64",
@@ -649,33 +656,34 @@ const _hoisted_2$g = /* @__PURE__ */ createElementVNode("pattern", {
649
656
  fill: "currentColor"
650
657
  })
651
658
  ], -1);
652
- const _hoisted_3$9 = /* @__PURE__ */ createElementVNode("rect", {
659
+ const _hoisted_3$a = /* @__PURE__ */ createElementVNode("rect", {
653
660
  x: "0",
654
661
  y: "0",
655
662
  width: "100%",
656
663
  height: "100%",
657
664
  fill: "url(#checkerboard)"
658
665
  }, null, -1);
659
- const _hoisted_4$6 = [
660
- _hoisted_2$g,
661
- _hoisted_3$9
666
+ const _hoisted_4$7 = [
667
+ _hoisted_2$h,
668
+ _hoisted_3$a
662
669
  ];
663
670
  function _sfc_render$2(_ctx, _cache) {
664
- return openBlock(), createElementBlock("svg", _hoisted_1$i, _hoisted_4$6);
671
+ return openBlock(), createElementBlock("svg", _hoisted_1$j, _hoisted_4$7);
665
672
  }
666
- var CheckerboardPattern = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$2]]);
673
+ var CheckerboardPattern = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2]]);
667
674
  var StoryResponsivePreview_vue_vue_type_style_index_0_scoped_true_lang = "";
668
675
  const _withScopeId$3 = (n) => (pushScopeId("data-v-769a585e"), n = n(), popScopeId(), n);
669
- const _hoisted_1$h = { class: "htw-w-full htw-h-full htw-flex-1 htw-border htw-border-gray-100 dark:htw-border-gray-800 htw-rounded-lg htw-relative htw-overflow-hidden" };
670
- const _hoisted_2$f = {
676
+ const _hoisted_1$i = { class: "htw-w-full htw-h-full htw-flex-1 htw-border htw-border-gray-100 dark:htw-border-gray-800 htw-rounded-lg htw-relative htw-overflow-hidden" };
677
+ const _hoisted_2$g = {
671
678
  key: 0,
672
679
  class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-bg-gray-200 dark:htw-bg-gray-850 htw-rounded-r-lg htw-border-l-2 htw-border-gray-500/10 dark:htw-border-gray-700/30 htw-overflow-hidden"
673
680
  };
674
- const _hoisted_3$8 = { class: "htw-p-4 htw-h-full htw-relative" };
675
- const _hoisted_4$5 = { class: "htw-w-full htw-h-full htw-border htw-border-gray-100 dark:htw-border-gray-800 htw-rounded-sm htw-relative" };
681
+ const _hoisted_3$9 = { class: "htw-p-4 htw-h-full htw-relative" };
682
+ const _hoisted_4$6 = { class: "htw-w-full htw-h-full htw-border htw-border-gray-100 dark:htw-border-gray-800 htw-rounded-sm htw-relative" };
676
683
  const _hoisted_5$4 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("div", { class: "bind-preview-bg htw-absolute htw-inset-0" }, null, -1));
677
684
  const _hoisted_6$4 = /* @__PURE__ */ createStaticVNode('<div class="htw-absolute htw-top-1 htw-left-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-top-1 htw-right-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-bottom-1 htw-left-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-bottom-1 htw-right-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-left-1 htw-top-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-left-1 htw-bottom-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-right-1 htw-top-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-right-1 htw-bottom-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div>', 8);
678
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
685
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
686
+ name: "StoryResponsivePreview",
679
687
  props: {
680
688
  variant: null
681
689
  },
@@ -770,8 +778,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
770
778
  const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth : settings.responsiveHeight);
771
779
  const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled);
772
780
  return (_ctx, _cache) => {
773
- return openBlock(), createElementBlock("div", _hoisted_1$h, [
774
- unref(isResponsiveEnabled) ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
781
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
782
+ unref(isResponsiveEnabled) ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
775
783
  createVNode(HatchedPattern, { class: "htw-w-full htw-h-full htw-text-black/[2%] dark:htw-text-white/[2%]" })
776
784
  ])) : createCommentVNode("", true),
777
785
  createElementVNode("div", {
@@ -785,8 +793,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
785
793
  "htw-h-fit": !!unref(finalHeight)
786
794
  } : void 0])
787
795
  }, [
788
- createElementVNode("div", _hoisted_3$8, [
789
- createElementVNode("div", _hoisted_4$5, [
796
+ createElementVNode("div", _hoisted_3$9, [
797
+ createElementVNode("div", _hoisted_4$6, [
790
798
  _hoisted_5$4,
791
799
  unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
792
800
  key: 0,
@@ -834,8 +842,9 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
834
842
  };
835
843
  }
836
844
  });
837
- var StoryResponsivePreview = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-769a585e"]]);
838
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
845
+ var StoryResponsivePreview = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-769a585e"]]);
846
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
847
+ name: "StoryVariantSinglePreviewNative",
839
848
  props: {
840
849
  story: null,
841
850
  variant: null
@@ -859,7 +868,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
859
868
  height: finalHeight ? `${finalHeight}px` : "100%"
860
869
  } : { width: "100%", height: "100%" })
861
870
  }, [
862
- (openBlock(), createBlock(_sfc_main$t, {
871
+ (openBlock(), createBlock(_sfc_main$v, {
863
872
  key: `${__props.story.id}-${__props.variant.id}`,
864
873
  variant: __props.variant,
865
874
  story: __props.story,
@@ -873,8 +882,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
873
882
  };
874
883
  }
875
884
  });
876
- const _hoisted_1$g = ["src"];
877
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
885
+ const _hoisted_1$h = ["src"];
886
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
887
+ name: "StoryVariantSinglePreviewRemote",
878
888
  props: {
879
889
  story: null,
880
890
  variant: null
@@ -974,43 +984,44 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
974
984
  } : void 0),
975
985
  "data-test-id": "preview-iframe",
976
986
  onLoad: _cache[0] || (_cache[0] = ($event) => onIframeLoad())
977
- }, null, 46, _hoisted_1$g)
987
+ }, null, 46, _hoisted_1$h)
978
988
  ]),
979
989
  _: 1
980
990
  }, 8, ["variant"]);
981
991
  };
982
992
  }
983
993
  });
984
- const _hoisted_1$f = {
994
+ const _hoisted_1$g = {
985
995
  class: "htw-h-full htw-flex htw-flex-col",
986
996
  "data-test-id": "story-variant-single-view"
987
997
  };
988
- const _hoisted_2$e = {
998
+ const _hoisted_2$f = {
989
999
  key: 0,
990
1000
  class: "htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
991
1001
  };
992
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
1002
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
1003
+ name: "StoryVariantSingleView",
993
1004
  props: {
994
1005
  variant: null,
995
1006
  story: null
996
1007
  },
997
1008
  setup(__props) {
998
1009
  return (_ctx, _cache) => {
999
- return openBlock(), createElementBlock("div", _hoisted_1$f, [
1000
- !unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
1001
- createVNode(_sfc_main$p, { variant: __props.variant }, null, 8, ["variant"]),
1002
- !__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$n, { key: 0 })) : createCommentVNode("", true),
1010
+ return openBlock(), createElementBlock("div", _hoisted_1$g, [
1011
+ !unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
1012
+ createVNode(_sfc_main$r, { variant: __props.variant }, null, 8, ["variant"]),
1013
+ !__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$p, { key: 0 })) : createCommentVNode("", true),
1003
1014
  createVNode(StoryVariantBackground),
1004
- createVNode(_sfc_main$l, {
1015
+ createVNode(_sfc_main$n, {
1005
1016
  variant: __props.variant,
1006
1017
  story: __props.story
1007
1018
  }, null, 8, ["variant", "story"])
1008
1019
  ])) : createCommentVNode("", true),
1009
- __props.story.layout.iframe === false ? (openBlock(), createBlock(_sfc_main$h, {
1020
+ __props.story.layout.iframe === false ? (openBlock(), createBlock(_sfc_main$j, {
1010
1021
  key: 1,
1011
1022
  story: __props.story,
1012
1023
  variant: __props.variant
1013
- }, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$g, {
1024
+ }, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$i, {
1014
1025
  key: 2,
1015
1026
  story: __props.story,
1016
1027
  variant: __props.variant
@@ -1021,16 +1032,16 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
1021
1032
  });
1022
1033
  var StoryVariantSingle_vue_vue_type_style_index_0_scoped_true_lang = "";
1023
1034
  const _withScopeId$2 = (n) => (pushScopeId("data-v-a52efa6c"), n = n(), popScopeId(), n);
1024
- const _hoisted_1$e = {
1035
+ const _hoisted_1$f = {
1025
1036
  key: 0,
1026
1037
  class: "htw-p-2 htw-h-full"
1027
1038
  };
1028
- const _hoisted_2$d = {
1039
+ const _hoisted_2$e = {
1029
1040
  key: 0,
1030
1041
  class: "htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
1031
1042
  };
1032
- const _hoisted_3$7 = /* @__PURE__ */ createTextVNode(" Select a variant... ");
1033
- const _hoisted_4$4 = {
1043
+ const _hoisted_3$8 = /* @__PURE__ */ createTextVNode(" Select a variant... ");
1044
+ const _hoisted_4$5 = {
1034
1045
  key: 0,
1035
1046
  class: "htw-p-2 htw-h-full"
1036
1047
  };
@@ -1039,7 +1050,8 @@ const _hoisted_6$3 = {
1039
1050
  key: 0,
1040
1051
  class: "htw-p-2 htw-h-full"
1041
1052
  };
1042
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
1053
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1054
+ name: "StoryVariantSingle",
1043
1055
  setup(__props) {
1044
1056
  useCssVars((_ctx) => {
1045
1057
  var _a;
@@ -1059,14 +1071,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1059
1071
  }
1060
1072
  return (_ctx, _cache) => {
1061
1073
  var _a;
1062
- return unref(hasSingleVariant) && unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_1$e, [
1063
- unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$f, {
1074
+ return unref(hasSingleVariant) && unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
1075
+ unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$h, {
1064
1076
  key: 0,
1065
1077
  variant: unref(storyStore).currentVariant,
1066
1078
  story: unref(storyStore).currentStory
1067
1079
  }, null, 8, ["variant", "story"])) : createCommentVNode("", true)
1068
1080
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1069
- unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$d, [
1081
+ unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
1070
1082
  createElementVNode("a", {
1071
1083
  class: "htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center",
1072
1084
  onClick: openMenu
@@ -1081,15 +1093,15 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1081
1093
  }, null, 8, ["icon", "class"]),
1082
1094
  createTextVNode(" " + toDisplayString(unref(variant).title), 1)
1083
1095
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1084
- _hoisted_3$7
1096
+ _hoisted_3$8
1085
1097
  ], 64)),
1086
1098
  createVNode(unref(Icon), {
1087
1099
  icon: "carbon:chevron-sort",
1088
1100
  class: "htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
1089
1101
  })
1090
1102
  ]),
1091
- unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_4$4, [
1092
- unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$f, {
1103
+ unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
1104
+ unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$h, {
1093
1105
  key: 0,
1094
1106
  variant: unref(storyStore).currentVariant,
1095
1107
  story: unref(storyStore).currentStory
@@ -1114,7 +1126,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1114
1126
  ]),
1115
1127
  last: withCtx(() => [
1116
1128
  unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
1117
- createVNode(_sfc_main$f, {
1129
+ createVNode(_sfc_main$h, {
1118
1130
  variant: unref(storyStore).currentVariant,
1119
1131
  story: unref(storyStore).currentStory
1120
1132
  }, null, 8, ["variant", "story"])
@@ -1126,11 +1138,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1126
1138
  };
1127
1139
  }
1128
1140
  });
1129
- var StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-a52efa6c"]]);
1141
+ var StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-a52efa6c"]]);
1130
1142
  var StoryViewer_vue_vue_type_style_index_0_scoped_true_lang = "";
1131
1143
  const _withScopeId$1 = (n) => (pushScopeId("data-v-141c6b20"), n = n(), popScopeId(), n);
1132
- const _hoisted_1$d = { class: "htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750" };
1133
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
1144
+ const _hoisted_1$e = { class: "htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750" };
1145
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
1146
+ name: "StoryViewer",
1134
1147
  setup(__props) {
1135
1148
  useCssVars((_ctx) => {
1136
1149
  var _a;
@@ -1149,10 +1162,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1149
1162
  });
1150
1163
  return (_ctx, _cache) => {
1151
1164
  return openBlock(), createElementBlock(Fragment, null, [
1152
- createElementVNode("div", _hoisted_1$d, [
1153
- unref(storyStore).currentStory.layout.type === "grid" ? (openBlock(), createBlock(_sfc_main$q, { key: 0 })) : unref(storyStore).currentStory.layout.type === "single" ? (openBlock(), createBlock(StoryVariantSingle, { key: 1 })) : createCommentVNode("", true)
1165
+ createElementVNode("div", _hoisted_1$e, [
1166
+ unref(storyStore).currentStory.layout.type === "grid" ? (openBlock(), createBlock(_sfc_main$s, { key: 0 })) : unref(storyStore).currentStory.layout.type === "single" ? (openBlock(), createBlock(StoryVariantSingle, { key: 1 })) : createCommentVNode("", true)
1154
1167
  ]),
1155
- createVNode(_sfc_main$u, {
1168
+ createVNode(_sfc_main$w, {
1156
1169
  title: "Select a variant",
1157
1170
  opened: isMenuOpened.value,
1158
1171
  onClose: closeMenu
@@ -1171,12 +1184,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1171
1184
  };
1172
1185
  }
1173
1186
  });
1174
- var StoryViewer = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-141c6b20"]]);
1175
- const _hoisted_1$c = { class: "htw-cursor-pointer htw-w-full htw-outline-none htw-px-2 htw-h-[27px] -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 hover:htw-border-primary-500 dark:hover:htw-border-primary-500 htw-rounded-sm htw-flex htw-gap-2 htw-items-center htw-leading-normal" };
1176
- const _hoisted_2$c = { class: "htw-flex-1 htw-truncate" };
1177
- const _hoisted_3$6 = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" };
1178
- const _hoisted_4$3 = ["onClick"];
1179
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1187
+ var StoryViewer = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-141c6b20"]]);
1188
+ const _hoisted_1$d = { class: "htw-cursor-pointer htw-w-full htw-outline-none htw-px-2 htw-h-[27px] -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 hover:htw-border-primary-500 dark:hover:htw-border-primary-500 htw-rounded-sm htw-flex htw-gap-2 htw-items-center htw-leading-normal" };
1189
+ const _hoisted_2$d = { class: "htw-flex-1 htw-truncate" };
1190
+ const _hoisted_3$7 = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" };
1191
+ const _hoisted_4$4 = ["onClick"];
1192
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1193
+ name: "BaseSelect",
1180
1194
  props: {
1181
1195
  modelValue: null,
1182
1196
  options: null
@@ -1199,7 +1213,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1199
1213
  return (_ctx, _cache) => {
1200
1214
  return openBlock(), createBlock(unref(Dropdown), { "auto-size": "" }, {
1201
1215
  popper: withCtx(({ hide }) => [
1202
- createElementVNode("div", _hoisted_3$6, [
1216
+ createElementVNode("div", _hoisted_3$7, [
1203
1217
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOptions), (label, value) => {
1204
1218
  return openBlock(), createElementBlock("div", mergeProps(__spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
1205
1219
  key: label,
@@ -1214,13 +1228,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1214
1228
  }, () => [
1215
1229
  createTextVNode(toDisplayString(label), 1)
1216
1230
  ])
1217
- ], 16, _hoisted_4$3);
1231
+ ], 16, _hoisted_4$4);
1218
1232
  }), 128))
1219
1233
  ])
1220
1234
  ]),
1221
1235
  default: withCtx(() => [
1222
- createElementVNode("div", _hoisted_1$c, [
1223
- createElementVNode("div", _hoisted_2$c, [
1236
+ createElementVNode("div", _hoisted_1$d, [
1237
+ createElementVNode("div", _hoisted_2$d, [
1224
1238
  renderSlot(_ctx.$slots, "default", { label: unref(selectedLabel) }, () => [
1225
1239
  createTextVNode(toDisplayString(unref(selectedLabel)), 1)
1226
1240
  ])
@@ -1236,16 +1250,17 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1236
1250
  };
1237
1251
  }
1238
1252
  });
1239
- const _hoisted_1$b = { class: "htw-flex htw-gap-2 htw-w-full htw-items-center" };
1240
- const _hoisted_2$b = ["onUpdate:modelValue"];
1241
- const _hoisted_3$5 = {
1253
+ const _hoisted_1$c = { class: "htw-flex htw-gap-2 htw-w-full htw-items-center" };
1254
+ const _hoisted_2$c = ["onUpdate:modelValue"];
1255
+ const _hoisted_3$6 = {
1242
1256
  key: 1,
1243
1257
  class: "htw-flex htw-items-center htw-gap-2"
1244
1258
  };
1245
- const _hoisted_4$2 = { class: "htw-flex-1 htw-truncate" };
1259
+ const _hoisted_4$3 = { class: "htw-flex-1 htw-truncate" };
1246
1260
  const _hoisted_5$2 = { class: "htw-flex htw-gap-2 htw-items-center" };
1247
1261
  const _hoisted_6$2 = { class: "htw-flex-1 htw-truncate" };
1248
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
1262
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1263
+ name: "StatePresets",
1249
1264
  props: {
1250
1265
  story: null,
1251
1266
  variant: null
@@ -1254,7 +1269,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1254
1269
  const props = __props;
1255
1270
  const DEFAULT_ID = "default";
1256
1271
  const saveId = computed(() => `${props.story.id}:${props.variant.id}`);
1257
- const defaultState = clone(toRawDeep(props.variant.state));
1272
+ const omitKeys = ["_hPropDefs"];
1273
+ const defaultState = clone(omit(toRawDeep(props.variant.state), omitKeys));
1258
1274
  const selectedOption = useStorage(`_histoire-presets/${saveId.value}/selected`, DEFAULT_ID);
1259
1275
  const presetStates = useStorage(`_histoire-presets/${saveId.value}/states`, /* @__PURE__ */ new Map());
1260
1276
  const presetsOptions = computed(() => {
@@ -1266,13 +1282,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1266
1282
  });
1267
1283
  function resetState() {
1268
1284
  selectedOption.value = DEFAULT_ID;
1269
- applyStateToVariant(props.variant, defaultState);
1285
+ applyStateToVariant(props.variant, clone(defaultState));
1270
1286
  }
1271
1287
  function applyPreset(id) {
1272
1288
  if (id === DEFAULT_ID) {
1273
1289
  resetState();
1274
1290
  } else if (presetStates.value.has(id)) {
1275
- applyStateToVariant(props.variant, presetStates.value.get(id).state);
1291
+ applyStateToVariant(props.variant, clone(presetStates.value.get(id).state));
1276
1292
  }
1277
1293
  }
1278
1294
  onMounted(() => {
@@ -1286,7 +1302,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1286
1302
  const isEditing = ref(false);
1287
1303
  async function createPreset() {
1288
1304
  const id = new Date().getTime().toString();
1289
- presetStates.value.set(id, { state: clone(toRawDeep(props.variant.state)), label: "New preset" });
1305
+ presetStates.value.set(id, { state: clone(omit(toRawDeep(props.variant.state), omitKeys)), label: "New preset" });
1290
1306
  selectedOption.value = id;
1291
1307
  isEditing.value = true;
1292
1308
  await nextTick();
@@ -1300,7 +1316,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1300
1316
  if (!canEdit.value)
1301
1317
  return;
1302
1318
  const preset = presetStates.value.get(selectedOption.value);
1303
- preset.state = clone(toRawDeep(props.variant.state));
1319
+ preset.state = clone(omit(toRawDeep(props.variant.state), omitKeys));
1304
1320
  savedNotif.value = true;
1305
1321
  savedTimeout.start();
1306
1322
  }
@@ -1327,13 +1343,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1327
1343
  onClickOutside(select, stopEditing);
1328
1344
  return (_ctx, _cache) => {
1329
1345
  const _directive_tooltip = resolveDirective("tooltip");
1330
- return openBlock(), createElementBlock("div", _hoisted_1$b, [
1346
+ return openBlock(), createElementBlock("div", _hoisted_1$c, [
1331
1347
  createElementVNode("div", {
1332
1348
  ref_key: "select",
1333
1349
  ref: select,
1334
1350
  class: "htw-flex-1 htw-min-w-0"
1335
1351
  }, [
1336
- createVNode(_sfc_main$c, {
1352
+ createVNode(_sfc_main$e, {
1337
1353
  modelValue: unref(selectedOption),
1338
1354
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
1339
1355
  options: unref(presetsOptions),
@@ -1354,10 +1370,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1354
1370
  class: "htw-text-inherit htw-bg-transparent htw-w-full htw-h-full htw-outline-none",
1355
1371
  onClick: _cache[0] || (_cache[0] = withModifiers(() => {
1356
1372
  }, ["stop", "prevent"]))
1357
- }, null, 8, _hoisted_2$b)), [
1373
+ }, null, 8, _hoisted_2$c)), [
1358
1374
  [vModelText, unref(presetStates).get(unref(selectedOption)).label]
1359
- ]) : (openBlock(), createElementBlock("div", _hoisted_3$5, [
1360
- createElementVNode("span", _hoisted_4$2, toDisplayString(label), 1),
1375
+ ]) : (openBlock(), createElementBlock("div", _hoisted_3$6, [
1376
+ createElementVNode("span", _hoisted_4$3, toDisplayString(label), 1),
1361
1377
  unref(canEdit) ? withDirectives((openBlock(), createBlock(unref(Icon), {
1362
1378
  key: 0,
1363
1379
  icon: "carbon:edit",
@@ -1411,13 +1427,147 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1411
1427
  };
1412
1428
  }
1413
1429
  });
1430
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1431
+ name: "ControlsComponentPropItem",
1432
+ props: {
1433
+ variant: null,
1434
+ component: null,
1435
+ definition: null
1436
+ },
1437
+ setup(__props) {
1438
+ const props = __props;
1439
+ const comp = computed(() => {
1440
+ var _a;
1441
+ switch ((_a = props.definition.types) == null ? void 0 : _a[0]) {
1442
+ case "string":
1443
+ return "HstText";
1444
+ case "number":
1445
+ return "HstNumber";
1446
+ case "boolean":
1447
+ return "HstCheckbox";
1448
+ case "object":
1449
+ default:
1450
+ return "HstTextarea";
1451
+ }
1452
+ });
1453
+ const isJSON = computed(() => comp.value === "HstTextarea");
1454
+ const invalidValue = ref("");
1455
+ const model = computed({
1456
+ get: () => {
1457
+ var _a;
1458
+ if (invalidValue.value) {
1459
+ return invalidValue.value;
1460
+ }
1461
+ let val = (_a = props.variant.state._hPropState[props.component.index]) == null ? void 0 : _a[props.definition.name];
1462
+ if (val && isJSON.value) {
1463
+ val = JSON.stringify(val, null, 2);
1464
+ }
1465
+ return val;
1466
+ },
1467
+ set: (value) => {
1468
+ invalidValue.value = "";
1469
+ if (isJSON.value) {
1470
+ try {
1471
+ value = JSON.parse(value);
1472
+ } catch (e) {
1473
+ invalidValue.value = value;
1474
+ return;
1475
+ }
1476
+ }
1477
+ if (!props.variant.state._hPropState[props.component.index]) {
1478
+ props.variant.state._hPropState[props.component.index] = {};
1479
+ }
1480
+ props.variant.state._hPropState[props.component.index][props.definition.name] = value;
1481
+ }
1482
+ });
1483
+ function reset() {
1484
+ if (props.variant.state._hPropState[props.component.index]) {
1485
+ delete props.variant.state._hPropState[props.component.index][props.definition.name];
1486
+ }
1487
+ }
1488
+ const canReset = computed(() => {
1489
+ var _a, _b;
1490
+ return ((_b = (_a = props.variant.state) == null ? void 0 : _a._hPropState) == null ? void 0 : _b[props.component.index]) && props.definition.name in props.variant.state._hPropState[props.component.index];
1491
+ });
1492
+ return (_ctx, _cache) => {
1493
+ const _directive_tooltip = resolveDirective("tooltip");
1494
+ return unref(comp) ? (openBlock(), createBlock(resolveDynamicComponent(unref(comp)), {
1495
+ key: 0,
1496
+ modelValue: unref(model),
1497
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(model) ? model.value = $event : null),
1498
+ title: __props.definition.name,
1499
+ placeholder: unref(isJSON) ? "Enter JSON" : null
1500
+ }, {
1501
+ actions: withCtx(() => [
1502
+ invalidValue.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
1503
+ key: 0,
1504
+ icon: "carbon:warning-alt",
1505
+ class: "htw-text-orange-500"
1506
+ }, null, 512)), [
1507
+ [_directive_tooltip, "JSON error"]
1508
+ ]) : createCommentVNode("", true),
1509
+ withDirectives(createVNode(unref(Icon), {
1510
+ icon: "carbon:erase",
1511
+ class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
1512
+ unref(canReset) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
1513
+ ]]),
1514
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => reset(), ["stop"]))
1515
+ }, null, 8, ["class"]), [
1516
+ [_directive_tooltip, "Remove override"]
1517
+ ])
1518
+ ]),
1519
+ _: 1
1520
+ }, 8, ["modelValue", "title", "placeholder"])) : createCommentVNode("", true);
1521
+ };
1522
+ }
1523
+ });
1524
+ const _hoisted_1$b = { class: "htw-font-mono htw-p-2 htw-flex htw-items-center htw-gap-1" };
1525
+ const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, "<", -1);
1526
+ const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, ">", -1);
1527
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1528
+ name: "ControlsComponentProps",
1529
+ props: {
1530
+ variant: null,
1531
+ definition: null
1532
+ },
1533
+ setup(__props) {
1534
+ return (_ctx, _cache) => {
1535
+ const _directive_tooltip = resolveDirective("tooltip");
1536
+ return openBlock(), createElementBlock("div", null, [
1537
+ createElementVNode("div", _hoisted_1$b, [
1538
+ withDirectives(createVNode(unref(Icon), {
1539
+ icon: "carbon:flash",
1540
+ class: "htw-w-4 htw-h-4 htw-text-primary-500 htw-flex-none"
1541
+ }, null, 512), [
1542
+ [_directive_tooltip, "Auto-detected props"]
1543
+ ]),
1544
+ createElementVNode("div", null, [
1545
+ _hoisted_2$b,
1546
+ createTextVNode(toDisplayString(__props.definition.name), 1),
1547
+ _hoisted_3$5
1548
+ ])
1549
+ ]),
1550
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.definition.props, (prop) => {
1551
+ return openBlock(), createBlock(_sfc_main$c, {
1552
+ key: prop.name,
1553
+ variant: __props.variant,
1554
+ component: __props.definition,
1555
+ definition: prop
1556
+ }, null, 8, ["variant", "component", "definition"]);
1557
+ }), 128))
1558
+ ]);
1559
+ };
1560
+ }
1561
+ });
1414
1562
  const _hoisted_1$a = {
1415
1563
  "data-test-id": "story-controls",
1416
- class: "htw-flex htw-flex-col"
1564
+ class: "htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-750"
1417
1565
  };
1418
- const _hoisted_2$a = { class: "htw-h-9 htw-flex-none htw-border-b htw-border-solid htw-border-gray-100 dark:htw-border-gray-750 htw-px-2 htw-flex htw-items-center" };
1566
+ const _hoisted_2$a = { class: "htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center" };
1419
1567
  const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("span", null, "No controls available for this story", -1);
1568
+ const _hoisted_4$2 = { key: 2 };
1420
1569
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
1570
+ name: "StoryControls",
1421
1571
  props: {
1422
1572
  variant: {
1423
1573
  type: Object,
@@ -1430,19 +1580,21 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1430
1580
  },
1431
1581
  setup(__props) {
1432
1582
  return (_ctx, _cache) => {
1583
+ var _a, _b, _c, _d;
1433
1584
  return openBlock(), createElementBlock("div", _hoisted_1$a, [
1434
1585
  createElementVNode("div", _hoisted_2$a, [
1435
- createVNode(_sfc_main$b, {
1586
+ createVNode(_sfc_main$d, {
1436
1587
  story: __props.story,
1437
1588
  variant: __props.variant
1438
1589
  }, null, 8, ["story", "variant"])
1439
1590
  ]),
1440
- __props.variant.slots().controls || __props.story.slots().controls ? (openBlock(), createBlock(_sfc_main$t, {
1591
+ __props.variant.slots().controls || __props.story.slots().controls ? (openBlock(), createBlock(_sfc_main$v, {
1441
1592
  key: 0,
1442
1593
  "slot-name": "controls",
1443
1594
  variant: __props.variant,
1444
- story: __props.story
1445
- }, null, 8, ["variant", "story"])) : (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
1595
+ story: __props.story,
1596
+ class: "htw-flex-none"
1597
+ }, null, 8, ["variant", "story"])) : !((_b = (_a = __props.variant.state) == null ? void 0 : _a._hPropDefs) == null ? void 0 : _b.length) ? (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
1446
1598
  default: withCtx(() => [
1447
1599
  createVNode(unref(Icon), {
1448
1600
  icon: "carbon:audio-console",
@@ -1451,7 +1603,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1451
1603
  _hoisted_3$4
1452
1604
  ]),
1453
1605
  _: 1
1454
- }))
1606
+ })) : createCommentVNode("", true),
1607
+ ((_d = (_c = __props.variant.state) == null ? void 0 : _c._hPropDefs) == null ? void 0 : _d.length) ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
1608
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.variant.state._hPropDefs, (def, index) => {
1609
+ return openBlock(), createBlock(_sfc_main$b, {
1610
+ key: index,
1611
+ variant: __props.variant,
1612
+ definition: def,
1613
+ class: "htw-flex-none htw-my-2"
1614
+ }, null, 8, ["variant", "definition"]);
1615
+ }), 128))
1616
+ ])) : createCommentVNode("", true)
1455
1617
  ]);
1456
1618
  };
1457
1619
  }
@@ -1459,6 +1621,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1459
1621
  const _hoisted_1$9 = /* @__PURE__ */ createTextVNode(" No documentation available ");
1460
1622
  const _hoisted_2$9 = ["innerHTML"];
1461
1623
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1624
+ name: "StoryDocs",
1462
1625
  props: {
1463
1626
  story: {
1464
1627
  type: Object,
@@ -1506,6 +1669,7 @@ const _hoisted_1$8 = {
1506
1669
  const _hoisted_2$8 = { class: "htw-overflow-auto htw-max-w-[400px] htw-max-h-[400px]" };
1507
1670
  const _hoisted_3$3 = { class: "htw-p-4" };
1508
1671
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1672
+ name: "StoryEvent",
1509
1673
  props: {
1510
1674
  event: null
1511
1675
  },
@@ -1555,6 +1719,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1555
1719
  const _hoisted_1$7 = /* @__PURE__ */ createTextVNode(" No event fired ");
1556
1720
  const _hoisted_2$7 = { key: 1 };
1557
1721
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1722
+ name: "StoryEvents",
1558
1723
  setup(__props) {
1559
1724
  const eventsStore = useEventsStore();
1560
1725
  const hasEvents = computed(() => eventsStore.events.length);
@@ -1594,487 +1759,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1594
1759
  };
1595
1760
  }
1596
1761
  });
1597
- function indent(lines, count = 1) {
1598
- return lines.map((line) => `${" ".repeat(count)}${line}`);
1599
- }
1600
- function unindent(code) {
1601
- const lines = code.split("\n");
1602
- let indentLevel = -1;
1603
- let indentText;
1604
- const linesToAnalyze = lines.filter((line) => line.trim().length > 0);
1605
- for (const line of linesToAnalyze) {
1606
- const match = /^\s*/.exec(line);
1607
- if (match && (indentLevel === -1 || indentLevel > match[0].length)) {
1608
- indentLevel = match[0].length;
1609
- indentText = match[0];
1610
- }
1611
- }
1612
- const result = [];
1613
- for (const line of lines) {
1614
- result.push(line.replace(indentText, ""));
1615
- }
1616
- return result.join("\n").trim();
1617
- }
1618
- function createAutoBuildingObject(format, specialKeysHandler, key = "", depth = 0) {
1619
- const cache = {};
1620
- if (depth > 32)
1621
- return { key, cache, target: {}, proxy: () => key };
1622
- const target = () => {
1623
- const k = key + "()";
1624
- return format ? format(k) : k;
1625
- };
1626
- const proxy = new Proxy(target, {
1627
- get(_, p) {
1628
- if (p === "__autoBuildingObject") {
1629
- return true;
1630
- }
1631
- if (p === "__autoBuildingObjectGetKey") {
1632
- return key;
1633
- }
1634
- if (specialKeysHandler) {
1635
- const fn = specialKeysHandler(target, p);
1636
- if (fn) {
1637
- return fn();
1638
- }
1639
- }
1640
- if (p === "toString") {
1641
- const k = key + ".toString()";
1642
- return () => format ? format(k) : k;
1643
- }
1644
- if (p === Symbol.toPrimitive) {
1645
- return () => format ? format(key) : key;
1646
- }
1647
- if (!cache[p]) {
1648
- const childKey = key ? `${key}.${p.toString()}` : p.toString();
1649
- const child = createAutoBuildingObject(format, specialKeysHandler, childKey, depth + 1);
1650
- cache[p] = __spreadValues({ key: childKey }, child);
1651
- }
1652
- return cache[p].proxy;
1653
- },
1654
- apply(_, thisArg, args) {
1655
- const k = `${key}(${args.join(", ")})`;
1656
- return format ? format(k) : k;
1657
- }
1658
- });
1659
- return {
1660
- key,
1661
- cache,
1662
- target,
1663
- proxy
1664
- };
1665
- }
1666
- const KEY_ESCAPE_REG = /[\s-.:|#@$£*%]/;
1667
- const MAX_SINGLE_LINE_ARRAY_LENGTH = 3;
1668
- function serializeJs(value) {
1669
- if (value === void 0) {
1670
- return "undefined";
1671
- }
1672
- if (value === null) {
1673
- return "null";
1674
- }
1675
- if (typeof value === "string") {
1676
- return `'${value}'`;
1677
- }
1678
- if (typeof value === "boolean") {
1679
- return value ? "true" : "false";
1680
- }
1681
- if (Array.isArray(value)) {
1682
- return printLines(arrayToSourceLines(value));
1683
- }
1684
- if (typeof value === "object") {
1685
- return printLines(objectToSourceLines(value));
1686
- }
1687
- if (value == null ? void 0 : value.__autoBuildingObject) {
1688
- return value;
1689
- }
1690
- if (typeof value === "function" && value.name) {
1691
- return value.name;
1692
- }
1693
- return value.toString();
1694
- }
1695
- function printLines(lines) {
1696
- return lines.map((line) => " ".repeat(line.spaces) + line.line).join("\n");
1697
- }
1698
- function objectToSourceLines(object, indentCount = 0) {
1699
- return createLines(indentCount, (lines) => {
1700
- lines.push("{");
1701
- lines.push(...createLines(1, (lines2) => {
1702
- for (const key in object) {
1703
- const value = object[key];
1704
- let printedKey = key;
1705
- if (KEY_ESCAPE_REG.test(key)) {
1706
- printedKey = `'${printedKey}'`;
1707
- }
1708
- addLinesFromValue(lines2, value, `${printedKey}: `, ",");
1709
- }
1710
- }));
1711
- lines.push("}");
1712
- });
1713
- }
1714
- function arrayToSourceLines(array, indentCount = 0) {
1715
- return createLines(indentCount, (lines) => {
1716
- const contentLines = createLines(1, (lines2) => {
1717
- for (const value of array) {
1718
- addLinesFromValue(lines2, value, "", ",");
1719
- }
1720
- });
1721
- if (contentLines.length === 0) {
1722
- lines.push("[]");
1723
- } else if (contentLines.length <= MAX_SINGLE_LINE_ARRAY_LENGTH) {
1724
- const [first] = contentLines;
1725
- first.line = contentLines.map(({ line }) => line.substring(0, line.length - 1)).join(", ");
1726
- first.line = `[${first.line}]`;
1727
- first.spaces--;
1728
- lines.push(first);
1729
- } else {
1730
- lines.push("[", ...contentLines, "]");
1731
- }
1732
- });
1733
- }
1734
- function createLines(indentCount, handler) {
1735
- const lines = [];
1736
- handler(lines);
1737
- return lines.map((line) => {
1738
- if (line.spaces != null) {
1739
- line.spaces += indentCount;
1740
- return line;
1741
- }
1742
- return { spaces: indentCount, line };
1743
- });
1744
- }
1745
- function addLinesFromValue(lines, value, before, after) {
1746
- let result;
1747
- if (Array.isArray(value)) {
1748
- lines.push(...wrap(arrayToSourceLines(value), before, after));
1749
- return;
1750
- } else if (value && typeof value === "object") {
1751
- lines.push(...wrap(objectToSourceLines(value), before, after));
1752
- return;
1753
- } else if (typeof value === "string") {
1754
- result = value.includes("'") ? `\`${value}\`` : `'${value}'`;
1755
- } else if (typeof value === "undefined") {
1756
- result = "undefined";
1757
- } else if (value === null) {
1758
- result = "null";
1759
- } else if (typeof value === "boolean") {
1760
- result = value ? "true" : "false";
1761
- } else {
1762
- result = value;
1763
- }
1764
- lines.push(before + result + after);
1765
- }
1766
- function wrap(lines, before, after) {
1767
- lines[0].line = before + lines[0].line;
1768
- lines[lines.length - 1].line += after;
1769
- return lines;
1770
- }
1771
- const voidElements = [
1772
- "area",
1773
- "base",
1774
- "br",
1775
- "col",
1776
- "embed",
1777
- "hr",
1778
- "img",
1779
- "input",
1780
- "keygen",
1781
- "link",
1782
- "meta",
1783
- "param",
1784
- "source",
1785
- "track",
1786
- "wbr"
1787
- ];
1788
- async function generateSourceCode(variant) {
1789
- var _a, _b, _c, _d;
1790
- const vnode = (_d = (_c = (_b = variant.slots()).default) == null ? void 0 : _c.call(_b, { state: (_a = variant.state) != null ? _a : {} })) != null ? _d : [];
1791
- const list = Array.isArray(vnode) ? vnode : [vnode];
1792
- const lines = [];
1793
- for (const vnode2 of list) {
1794
- lines.push(...(await printVNode(vnode2)).lines);
1795
- }
1796
- return lines.join("\n");
1797
- }
1798
- async function printVNode(vnode) {
1799
- var _a, _b, _c, _d, _e, _f;
1800
- if (vnode.type === Text) {
1801
- return {
1802
- lines: [vnode.children],
1803
- isText: true
1804
- };
1805
- }
1806
- const lines = [];
1807
- if (typeof vnode.type === "object" || typeof vnode.type === "string") {
1808
- let genDirective = function(dirName, dir, valueCode = null) {
1809
- var _a2;
1810
- let modifiers = "";
1811
- for (const key in dir.modifiers) {
1812
- if (dir.modifiers[key]) {
1813
- modifiers += `.${key}`;
1814
- }
1815
- }
1816
- let arg = "";
1817
- if (dir.arg) {
1818
- arg = `:${dir.arg}`;
1819
- }
1820
- if (valueCode) {
1821
- valueCode = valueCode.replace(/^\$(setup|props|data)\./g, "");
1822
- }
1823
- const valueLines = valueCode ? [valueCode] : serializeAndCleanJs(dir.value);
1824
- const attr = [];
1825
- const dirAttr = `v-${dirName}${arg}${modifiers}="`;
1826
- if (valueLines.length > 1) {
1827
- attr.push(`${dirAttr}${valueLines[0]}`);
1828
- attr.push(...valueLines.slice(1, valueLines.length - 1));
1829
- attr.push(`${valueLines[valueLines.length - 1]}"`);
1830
- multilineAttrs = true;
1831
- } else {
1832
- attr.push(`${dirAttr}${(_a2 = valueLines[0]) != null ? _a2 : ""}"`);
1833
- }
1834
- attrs.push(attr);
1835
- };
1836
- if (((_a = vnode.type) == null ? void 0 : _a.__asyncLoader) && !vnode.type.__asyncResolved) {
1837
- await vnode.type.__asyncLoader();
1838
- }
1839
- const attrs = [];
1840
- let multilineAttrs = false;
1841
- const skipProps = [
1842
- "key"
1843
- ];
1844
- if (vnode.dirs) {
1845
- for (const dir of vnode.dirs) {
1846
- if (dir.dir === vModelText || dir.dir === vModelSelect || dir.dir === vModelRadio || dir.dir === vModelCheckbox || dir.dir === vModelDynamic) {
1847
- const listenerKey = `onUpdate:${(_b = dir.arg) != null ? _b : "modelValue"}`;
1848
- const listener = vnode.props[listenerKey];
1849
- let valueCode = null;
1850
- if (listener) {
1851
- skipProps.push(listenerKey);
1852
- const listenerSource = listener.toString();
1853
- const result = /\(\$event\) => (.*?) = \$event/.exec(listenerSource);
1854
- if (result) {
1855
- valueCode = result[1];
1856
- }
1857
- }
1858
- genDirective("model", dir, valueCode);
1859
- } else if (dir.instance._ || dir.instance.$) {
1860
- const target = (_c = dir.instance.$) != null ? _c : dir.instance._;
1861
- let dirName;
1862
- for (const directives of [target.directives, target.appContext.directives]) {
1863
- for (const key in directives) {
1864
- if (target.directives[key] === dir.dir) {
1865
- dirName = key;
1866
- break;
1867
- }
1868
- }
1869
- if (dirName)
1870
- break;
1871
- }
1872
- if (dirName) {
1873
- genDirective(dirName, dir);
1874
- }
1875
- }
1876
- }
1877
- }
1878
- for (const prop in vnode.props) {
1879
- if (skipProps.includes(prop)) {
1880
- continue;
1881
- }
1882
- const value = vnode.props[prop];
1883
- if (typeof value !== "string" || ((_d = vnode.dynamicProps) == null ? void 0 : _d.includes(prop))) {
1884
- let directive = ":";
1885
- if (prop.startsWith("on")) {
1886
- directive = "@";
1887
- }
1888
- const arg = directive === "@" ? `${prop[2].toLowerCase()}${prop.slice(3)}` : prop;
1889
- const vmodelListener = `onUpdate:${prop}`;
1890
- if (directive === ":" && ((_e = vnode.dynamicProps) == null ? void 0 : _e.includes(vmodelListener))) {
1891
- skipProps.push(vmodelListener);
1892
- const listener = vnode.props[vmodelListener];
1893
- const listenerSource = listener.toString();
1894
- let valueCode;
1895
- const result = /\(\$event\) => (.*?) = \$event/.exec(listenerSource);
1896
- if (result) {
1897
- valueCode = result[1];
1898
- }
1899
- const modifiersKey = `${prop === "modelValue" ? "model" : prop}Modifiers`;
1900
- const modifiers = (_f = vnode.props[modifiersKey]) != null ? _f : {};
1901
- skipProps.push(modifiersKey);
1902
- genDirective("model", {
1903
- arg: prop === "modelValue" ? null : prop,
1904
- modifiers,
1905
- value
1906
- }, valueCode);
1907
- continue;
1908
- }
1909
- let serialized;
1910
- if (typeof value === "string" && value.startsWith("{{") && value.endsWith("}}")) {
1911
- serialized = cleanupExpression(value.substring(2, value.length - 2).trim()).split("\n");
1912
- } else if (typeof value === "function") {
1913
- let code = cleanupExpression(value.toString().replace(/'/g, "\\'").replace(/"/g, "'"));
1914
- const testResult = /function ([^\s]+)\(/.exec(code);
1915
- if (testResult) {
1916
- serialized = [testResult[1]];
1917
- } else {
1918
- if (code.startsWith("($event) => ")) {
1919
- code = code.substring("($event) => ".length);
1920
- }
1921
- serialized = code.split("\n");
1922
- }
1923
- } else {
1924
- serialized = serializeAndCleanJs(value);
1925
- }
1926
- if (serialized.length > 1) {
1927
- multilineAttrs = true;
1928
- const indented = [`${directive}${arg}="${serialized[0]}`];
1929
- indented.push(...serialized.slice(1, serialized.length - 1));
1930
- indented.push(`${serialized[serialized.length - 1]}"`);
1931
- attrs.push(indented);
1932
- } else {
1933
- attrs.push([`${directive}${arg}="${serialized[0]}"`]);
1934
- }
1935
- } else {
1936
- attrs.push([`${prop}="${value}"`]);
1937
- }
1938
- }
1939
- if (attrs.length > 1) {
1940
- multilineAttrs = true;
1941
- }
1942
- const tagName = getTagName(vnode);
1943
- let isChildText = false;
1944
- const childLines = [];
1945
- if (typeof vnode.children === "string") {
1946
- if (tagName === "pre") {
1947
- childLines.push(vnode.children);
1948
- } else {
1949
- childLines.push(...vnode.children.split("\n"));
1950
- }
1951
- isChildText = true;
1952
- } else if (Array.isArray(vnode.children)) {
1953
- let isAllChildText;
1954
- for (const child of vnode.children) {
1955
- const result = await printVNode(child);
1956
- if (result.isText) {
1957
- if (isAllChildText === void 0) {
1958
- isAllChildText = true;
1959
- }
1960
- const text = result.lines[0];
1961
- if (!childLines.length || /^\s/.test(text)) {
1962
- childLines.push(text.trim());
1963
- } else {
1964
- childLines[childLines.length - 1] += text;
1965
- }
1966
- } else {
1967
- if (isAllChildText === void 0) {
1968
- isAllChildText = false;
1969
- }
1970
- childLines.push(...result.lines);
1971
- }
1972
- }
1973
- if (isAllChildText !== void 0) {
1974
- isChildText = isAllChildText;
1975
- }
1976
- }
1977
- if (vnode.children && typeof vnode.children === "object" && !Array.isArray(vnode.children)) {
1978
- for (const key in vnode.children) {
1979
- if (typeof vnode.children[key] === "function") {
1980
- const autoObject = createAutoBuildingObject((key2) => `{{ ${key2} }}`, (target, p) => {
1981
- if (p === "__v_isRef") {
1982
- return () => false;
1983
- }
1984
- });
1985
- const children = vnode.children[key](autoObject.proxy);
1986
- const slotLines = [];
1987
- for (const child of children) {
1988
- slotLines.push(...(await printVNode(child)).lines);
1989
- }
1990
- const slotProps = Object.keys(autoObject.cache);
1991
- if (slotProps.length) {
1992
- childLines.push(`<template #${key}="{ ${slotProps.join(", ")} }">`);
1993
- childLines.push(...indent(slotLines));
1994
- childLines.push("</template>");
1995
- } else if (key === "default") {
1996
- childLines.push(...slotLines);
1997
- } else {
1998
- childLines.push(`<template #${key}>`);
1999
- childLines.push(...indent(slotLines));
2000
- childLines.push(`</template>`);
2001
- }
2002
- }
2003
- }
2004
- }
2005
- const tag = [`<${tagName}`];
2006
- if (multilineAttrs) {
2007
- for (const attrLines of attrs) {
2008
- tag.push(...indent(attrLines));
2009
- }
2010
- if (childLines.length > 0) {
2011
- tag.push(">");
2012
- }
2013
- } else {
2014
- if (attrs.length === 1) {
2015
- tag[0] += ` ${attrs[0]}`;
2016
- }
2017
- if (childLines.length > 0) {
2018
- tag[0] += ">";
2019
- }
2020
- }
2021
- const isVoid = voidElements.includes(tagName.toLowerCase());
2022
- if (childLines.length > 0) {
2023
- if (childLines.length === 1 && tag.length === 1 && !attrs.length && isChildText) {
2024
- lines.push(`${tag[0]}${childLines[0]}</${tagName}>`);
2025
- } else {
2026
- lines.push(...tag);
2027
- lines.push(...indent(childLines));
2028
- lines.push(`</${tagName}>`);
2029
- }
2030
- } else if (tag.length > 1) {
2031
- lines.push(...tag);
2032
- lines.push(isVoid ? ">" : "/>");
2033
- } else {
2034
- lines.push(`${tag[0]}${isVoid ? "" : " /"}>`);
2035
- }
2036
- } else if ((vnode == null ? void 0 : vnode.shapeFlag) & 1 << 4) {
2037
- for (const child of vnode.children) {
2038
- lines.push(...(await printVNode(child)).lines);
2039
- }
2040
- }
2041
- return {
2042
- lines
2043
- };
2044
- }
2045
- function getTagName(vnode) {
2046
- var _a, _b, _c, _d, _e;
2047
- if (typeof vnode.type === "string") {
2048
- return vnode.type;
2049
- } else if ((_a = vnode.type) == null ? void 0 : _a.__asyncResolved) {
2050
- const asyncComp = (_b = vnode.type) == null ? void 0 : _b.__asyncResolved;
2051
- return (_c = asyncComp.name) != null ? _c : getNameFromFile(asyncComp.__file);
2052
- } else if ((_d = vnode.type) == null ? void 0 : _d.name) {
2053
- return vnode.type.name;
2054
- } else if ((_e = vnode.type) == null ? void 0 : _e.__file) {
2055
- return getNameFromFile(vnode.type.__file);
2056
- }
2057
- return "Anonymous";
2058
- }
2059
- function getNameFromFile(file) {
2060
- const parts = /([^/]+)\.vue$/.exec(file);
2061
- if (parts) {
2062
- return pascal(parts[1]);
2063
- }
2064
- return "Anonymous";
2065
- }
2066
- function serializeAndCleanJs(value) {
2067
- const isAutoBuildingObject = !!(value == null ? void 0 : value.__autoBuildingObject);
2068
- const result = serializeJs(value);
2069
- if (isAutoBuildingObject) {
2070
- return [cleanupExpression(result.__autoBuildingObjectGetKey)];
2071
- } else {
2072
- return cleanupExpression(result).split("\n");
2073
- }
2074
- }
2075
- function cleanupExpression(expr) {
2076
- return expr.replace(/\$setup\./g, "");
2077
- }
2078
1762
  var StorySourceCode_vue_vue_type_style_index_0_scoped_true_lang = "";
2079
1763
  const _withScopeId = (n) => (pushScopeId("data-v-32cb8d14"), n = n(), popScopeId(), n);
2080
1764
  const _hoisted_1$6 = { class: "htw-bg-gray-100 dark:htw-bg-gray-800 htw-h-full htw-overflow-hidden htw-flex htw-flex-col" };
@@ -2096,6 +1780,7 @@ const _hoisted_7$1 = {
2096
1780
  };
2097
1781
  const _hoisted_8$1 = ["innerHTML"];
2098
1782
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1783
+ name: "StorySourceCode",
2099
1784
  props: {
2100
1785
  variant: {
2101
1786
  type: Object,
@@ -2224,6 +1909,7 @@ const _hoisted_1$4 = {
2224
1909
  };
2225
1910
  const _hoisted_2$4 = { class: "htw-flex htw-flex-col htw-items-stretch" };
2226
1911
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1912
+ name: "BaseOverflowMenu",
2227
1913
  setup(__props) {
2228
1914
  const overflowButtonWidth = 32;
2229
1915
  const el = ref();
@@ -2366,6 +2052,7 @@ const _hoisted_8 = {
2366
2052
  class: "htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
2367
2053
  };
2368
2054
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2055
+ name: "PaneTabs",
2369
2056
  setup(__props) {
2370
2057
  const eventsStore = useEventsStore();
2371
2058
  return (_ctx, _cache) => {
@@ -2439,6 +2126,7 @@ const _hoisted_1$1 = /* @__PURE__ */ createElementVNode("span", null, "Select a
2439
2126
  const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", null, "Loading...", -1);
2440
2127
  const _hoisted_3 = { class: "htw-flex htw-flex-col htw-h-full" };
2441
2128
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2129
+ name: "StorySidePanel",
2442
2130
  setup(__props) {
2443
2131
  const storyStore = useStoryStore();
2444
2132
  const route = useRoute();
@@ -2500,6 +2188,7 @@ const _hoisted_2 = {
2500
2188
  class: "htw-h-full htw-overflow-auto"
2501
2189
  };
2502
2190
  const _sfc_main = /* @__PURE__ */ defineComponent({
2191
+ name: "StoryView",
2503
2192
  setup(__props) {
2504
2193
  const storyStore = useStoryStore();
2505
2194
  const router = useRouter();