histoire 0.7.9 → 0.8.2

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 (160) hide show
  1. package/dist/bundled/App.js +166 -0
  2. package/dist/bundled/_virtual/plugin-vue_export-helper.js +8 -0
  3. package/dist/bundled/api.js +1 -32
  4. package/dist/bundled/assets/histoire-text-dark.js +2 -0
  5. package/dist/bundled/assets/histoire-text.js +2 -0
  6. package/dist/bundled/{HomeView.js → assets/histoire.js} +1 -23
  7. package/dist/bundled/components/HomeView.js +24 -0
  8. package/dist/bundled/components/app/AppHeader.js +67 -0
  9. package/dist/bundled/components/app/AppLogo.js +26 -0
  10. package/dist/bundled/components/app/Breadcrumb.js +95 -0
  11. package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  12. package/dist/bundled/components/app/InitialLoading.js +48 -0
  13. package/dist/bundled/components/app/MobileOverlay.js +41 -0
  14. package/dist/bundled/components/base/BaseCheckbox.js +75 -0
  15. package/dist/bundled/{BaseEmpty.js → components/base/BaseEmpty.js} +4 -4
  16. package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  17. package/dist/bundled/components/base/BaseListItemLink.js +50 -0
  18. package/dist/bundled/components/base/BaseOverflowMenu.js +97 -0
  19. package/dist/bundled/components/base/BaseOverflowTab.js +45 -0
  20. package/dist/bundled/components/base/BaseSelect.js +88 -0
  21. package/dist/bundled/{MobileOverlay.js → components/base/BaseSplitPane.js} +9 -130
  22. package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  23. package/dist/bundled/components/base/BaseTab.js +45 -0
  24. package/dist/bundled/components/misc/CheckerboardPattern.js +41 -0
  25. package/dist/bundled/components/misc/HatchedPattern.js +11 -0
  26. package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  27. package/dist/bundled/components/panel/ControlsComponentPropItem.js +98 -0
  28. package/dist/bundled/components/panel/ControlsComponentProps.js +42 -0
  29. package/dist/bundled/components/panel/PaneTabs.js +110 -0
  30. package/dist/bundled/components/panel/StatePresets.js +184 -0
  31. package/dist/bundled/components/panel/StoryControls.js +66 -0
  32. package/dist/bundled/components/panel/StoryDocs.js +48 -0
  33. package/dist/bundled/components/panel/StoryEvent.js +56 -0
  34. package/dist/bundled/components/panel/StoryEvents.js +49 -0
  35. package/dist/bundled/components/panel/StorySidePanel.js +68 -0
  36. package/dist/bundled/components/panel/StorySourceCode.js +110 -0
  37. package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  38. package/dist/bundled/components/search/SearchItem.js +113 -0
  39. package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  40. package/dist/bundled/components/search/SearchLoading.js +19 -0
  41. package/dist/bundled/components/search/SearchModal.js +46 -0
  42. package/dist/bundled/components/search/SearchPane.js +263 -0
  43. package/dist/bundled/{search-docs-data.js → components/search/search-docs-data.js} +1 -1
  44. package/dist/bundled/components/search/search-title-data.js +7 -0
  45. package/dist/bundled/components/story/StoryResponsivePreview.js +180 -0
  46. package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  47. package/dist/bundled/components/story/StoryVariantGrid.js +94 -0
  48. package/dist/bundled/components/story/StoryVariantGridItem.js +106 -0
  49. package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  50. package/dist/bundled/components/story/StoryVariantListItem.js +58 -0
  51. package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  52. package/dist/bundled/components/story/StoryVariantSingle.js +115 -0
  53. package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  54. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +43 -0
  55. package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +119 -0
  56. package/dist/bundled/components/story/StoryVariantSingleView.js +49 -0
  57. package/dist/bundled/components/story/StoryView.js +107 -0
  58. package/dist/bundled/components/story/StoryViewer.js +57 -0
  59. package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  60. package/dist/bundled/components/toolbar/StoryVariantBackground.js +85 -0
  61. package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  62. package/dist/bundled/components/toolbar/StoryVariantNewTab.js +33 -0
  63. package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +129 -0
  64. package/dist/bundled/components/toolbar/StoryVariantTitle.js +24 -0
  65. package/dist/bundled/components/tree/StoryGroup.js +74 -0
  66. package/dist/bundled/components/tree/StoryList.js +37 -0
  67. package/dist/bundled/components/tree/StoryListFolder.js +89 -0
  68. package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  69. package/dist/bundled/components/tree/StoryListItem.js +72 -0
  70. package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
  71. package/dist/bundled/index.js +28 -5
  72. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +40 -0
  73. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +5 -0
  74. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +11 -0
  75. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +26 -0
  76. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +10 -0
  77. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +50 -0
  78. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +8 -0
  79. package/dist/bundled/router.js +28 -0
  80. package/dist/bundled/sandbox.js +11 -14
  81. package/dist/bundled/{events.js → stores/events.js} +3 -3
  82. package/dist/bundled/stores/folder.js +46 -0
  83. package/dist/bundled/stores/preview-settings.js +15 -0
  84. package/dist/bundled/{story.js → stores/story.js} +4 -30
  85. package/dist/bundled/style.css +58 -58
  86. package/dist/bundled/{config.js → util/config.js} +1 -1
  87. package/dist/bundled/{const.js → util/const.js} +1 -1
  88. package/dist/bundled/util/dark.js +4 -0
  89. package/dist/bundled/util/env.js +2 -0
  90. package/dist/bundled/util/events.js +32 -0
  91. package/dist/bundled/util/keyboard.js +84 -0
  92. package/dist/bundled/{mapping.js → util/mapping.js} +5 -5
  93. package/dist/bundled/util/preview-settings.js +6 -0
  94. package/dist/bundled/util/responsive.js +3 -0
  95. package/dist/bundled/util/sandbox.js +8 -0
  96. package/dist/bundled/util/scroll.js +28 -0
  97. package/dist/bundled/util/state.js +27 -0
  98. package/dist/bundled/util/tooltip.js +12 -0
  99. package/dist/bundled/util/variant.js +35 -0
  100. package/dist/client/app/App.vue +0 -1
  101. package/dist/client/app/components/app/Breadcrumb.vue +1 -1
  102. package/dist/client/app/components/app/MobileOverlay.vue +1 -1
  103. package/dist/client/app/components/base/BaseCheckbox.vue +2 -1
  104. package/dist/client/app/components/base/BaseCopyIcon.vue +34 -0
  105. package/dist/client/app/components/base/BaseOverflowMenu.vue +1 -0
  106. package/dist/client/app/components/base/BaseSplitPane.vue +1 -0
  107. package/dist/client/app/components/panel/StatePresets.vue +3 -3
  108. package/dist/client/app/components/panel/StorySidePanel.vue +1 -1
  109. package/dist/client/app/components/panel/StorySourceCode.vue +1 -1
  110. package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -0
  111. package/dist/client/app/components/story/StoryVariantSingle.vue +5 -7
  112. package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
  113. package/dist/client/app/components/story/StoryViewer.vue +2 -2
  114. package/dist/client/app/components/tree/StoryList.vue +1 -1
  115. package/dist/client/app/components/tree/StoryListItem.vue +2 -2
  116. package/dist/client/app/index.js +1 -3
  117. package/dist/client/app/sandbox.js +3 -2
  118. package/dist/client/app/stores/story.d.ts +30 -30
  119. package/dist/client/app/util/dark.d.ts +1 -1
  120. package/dist/client/app/util/mapping.js +3 -3
  121. package/dist/client/app/util/responsive.d.ts +1 -1
  122. package/dist/client/app/util/scroll.js +1 -1
  123. package/dist/client/app/util/state.d.ts +1 -1
  124. package/dist/client/app/util/state.js +11 -8
  125. package/dist/node/build.js +1 -1
  126. package/dist/node/config.js +24 -5
  127. package/dist/node/vite.d.ts +1 -1
  128. package/dist/node/vite.js +10 -4
  129. package/package.json +9 -15
  130. package/src/client/app/App.vue +0 -1
  131. package/src/client/app/components/app/Breadcrumb.vue +1 -1
  132. package/src/client/app/components/app/MobileOverlay.vue +1 -1
  133. package/src/client/app/components/base/BaseCheckbox.vue +2 -1
  134. package/src/client/app/components/base/BaseCopyIcon.vue +34 -0
  135. package/src/client/app/components/base/BaseOverflowMenu.vue +1 -0
  136. package/src/client/app/components/base/BaseSplitPane.vue +1 -0
  137. package/src/client/app/components/panel/StatePresets.vue +3 -3
  138. package/src/client/app/components/panel/StorySidePanel.vue +1 -1
  139. package/src/client/app/components/panel/StorySourceCode.vue +1 -1
  140. package/src/client/app/components/story/StoryVariantGridItem.vue +1 -0
  141. package/src/client/app/components/story/StoryVariantSingle.vue +5 -7
  142. package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
  143. package/src/client/app/components/story/StoryViewer.vue +2 -2
  144. package/src/client/app/components/tree/StoryList.vue +1 -1
  145. package/src/client/app/components/tree/StoryListItem.vue +2 -2
  146. package/src/client/app/index.ts +1 -5
  147. package/src/client/app/sandbox.ts +3 -2
  148. package/src/client/app/util/mapping.ts +3 -3
  149. package/src/client/app/util/scroll.ts +1 -1
  150. package/src/client/app/util/state.ts +11 -8
  151. package/src/node/build.ts +1 -1
  152. package/src/node/config.ts +24 -5
  153. package/src/node/vite.ts +11 -3
  154. package/tsconfig.json +11 -0
  155. package/vite.config.ts +20 -10
  156. package/dist/bundled/SearchPane.js +0 -506
  157. package/dist/bundled/StoryView.js +0 -2264
  158. package/dist/bundled/dark.js +0 -4
  159. package/dist/bundled/index2.js +0 -843
  160. package/dist/bundled/state.js +0 -25
@@ -1,2264 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
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, resolveDynamicComponent, watchEffect, shallowRef, Transition, reactive, onBeforeUnmount, h } from "vue";
21
- import { useRoute, useRouter } from "vue-router";
22
- import { Icon } from "@iconify/vue";
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$v } from "./MobileOverlay.js";
25
- import { B as BaseEmpty } from "./BaseEmpty.js";
26
- import { useResizeObserver, useStorage, useEventListener, useTimeoutFn, onClickOutside } from "@vueuse/core";
27
- import { SandboxVue3, generateSourceCode } from "@histoire/plugin-vue/client";
28
- import { defineStore } from "pinia";
29
- import { h as histoireConfig } from "./config.js";
30
- import { applyStateToVariant, clone, omit, unindent } from "@histoire/shared";
31
- import { S as STATE_SYNC, a as SANDBOX_READY, E as EVENT_SEND, P as PREVIEW_SETTINGS_SYNC } from "./const.js";
32
- import { useEventsStore } from "./events.js";
33
- import { t as toRawDeep } from "./state.js";
34
- import { Dropdown } from "floating-vue";
35
- import { HstTextarea, HstCheckbox, HstNumber, HstText, HstCopyIcon } from "@histoire/controls";
36
- import { setCDN, getHighlighter } from "shiki";
37
- import { i as isDark } from "./dark.js";
38
- function useCurrentVariantRoute(variant) {
39
- const route = useRoute();
40
- const isActive = computed(() => route.query.variantId === variant.value.id);
41
- const targetRoute = computed(() => __spreadProps(__spreadValues({}, route), {
42
- query: __spreadProps(__spreadValues({}, route.query), {
43
- variantId: variant.value.id
44
- })
45
- }));
46
- return {
47
- isActive,
48
- targetRoute
49
- };
50
- }
51
- var StoryVariantListItem_vue_vue_type_style_index_0_scoped_true_lang = "";
52
- const _withScopeId$7 = (n) => (pushScopeId("data-v-2cdc2ac0"), n = n(), popScopeId(), n);
53
- const _hoisted_1$r = { class: "htw-truncate" };
54
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
55
- name: "StoryVariantListItem",
56
- props: {
57
- variant: {
58
- type: Object,
59
- required: true
60
- }
61
- },
62
- setup(__props) {
63
- const props = __props;
64
- useCssVars((_ctx) => ({
65
- "3c4190ff": unref(variant).iconColor
66
- }));
67
- const { variant } = toRefs(props);
68
- const { isActive, targetRoute } = useCurrentVariantRoute(variant);
69
- const el = ref();
70
- useScrollOnActive(isActive, el);
71
- return (_ctx, _cache) => {
72
- return openBlock(), createElementBlock("div", {
73
- ref_key: "el",
74
- ref: el,
75
- "data-test-id": "story-variant-list-item"
76
- }, [
77
- createVNode(BaseListItemLink, {
78
- to: unref(targetRoute),
79
- "is-active": unref(isActive),
80
- class: "htw-px-2 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm htw-flex htw-items-center htw-gap-2"
81
- }, {
82
- default: withCtx(({ active }) => {
83
- var _a;
84
- return [
85
- createVNode(unref(Icon), {
86
- icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
87
- class: normalizeClass(["base-list-item-link-icon htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none", {
88
- "htw-text-gray-500": !active && !unref(variant).iconColor,
89
- "bind-icon-color": !active && unref(variant).iconColor
90
- }])
91
- }, null, 8, ["icon", "class"]),
92
- createElementVNode("span", _hoisted_1$r, toDisplayString(unref(variant).title), 1)
93
- ];
94
- }),
95
- _: 1
96
- }, 8, ["to", "is-active"])
97
- ], 512);
98
- };
99
- }
100
- });
101
- var StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-2cdc2ac0"]]);
102
- var StoryVariantGridItem_vue_vue_type_style_index_0_scoped_true_lang = "";
103
- const _withScopeId$6 = (n) => (pushScopeId("data-v-265ac8e3"), n = n(), popScopeId(), n);
104
- const _hoisted_1$q = { class: "htw-flex-none htw-flex htw-items-center" };
105
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
106
- name: "StoryVariantGridItem",
107
- props: {
108
- variant: {
109
- type: Object,
110
- required: true
111
- },
112
- story: {
113
- type: Object,
114
- required: true
115
- }
116
- },
117
- emits: {
118
- resize: (width, height) => true
119
- },
120
- setup(__props, { emit }) {
121
- const props = __props;
122
- useCssVars((_ctx) => ({
123
- "7d3aedf8": unref(variant).iconColor
124
- }));
125
- const { variant } = toRefs(props);
126
- const { isActive, targetRoute } = useCurrentVariantRoute(variant);
127
- Object.assign(props.variant, {
128
- previewReady: false
129
- });
130
- function onReady() {
131
- Object.assign(props.variant, {
132
- previewReady: true
133
- });
134
- }
135
- const router = useRouter();
136
- function selectVariant() {
137
- router.push(targetRoute.value);
138
- }
139
- const el = ref();
140
- const { autoScroll } = useScrollOnActive(isActive, el);
141
- useResizeObserver(el, () => {
142
- if (props.variant.previewReady) {
143
- emit("resize", el.value.clientWidth, el.value.clientHeight);
144
- if (isActive.value) {
145
- autoScroll();
146
- }
147
- }
148
- });
149
- return (_ctx, _cache) => {
150
- const _component_RouterLink = resolveComponent("RouterLink");
151
- return openBlock(), createElementBlock("div", {
152
- ref_key: "el",
153
- ref: el,
154
- class: "htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
155
- }, [
156
- createElementVNode("div", _hoisted_1$q, [
157
- createVNode(_component_RouterLink, {
158
- to: unref(targetRoute),
159
- 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", {
160
- "hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800": !unref(isActive),
161
- "htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800 dark:htw-bg-primary-700 dark:hover:htw-bg-primary-800 dark:htw-text-primary-200": unref(isActive)
162
- }])
163
- }, {
164
- default: withCtx(() => {
165
- var _a;
166
- return [
167
- createVNode(unref(Icon), {
168
- icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
169
- class: normalizeClass(["base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50", {
170
- "htw-text-gray-500": !unref(isActive) && !unref(variant).iconColor,
171
- "bind-icon-color": !unref(isActive) && unref(variant).iconColor
172
- }])
173
- }, null, 8, ["icon", "class"]),
174
- createElementVNode("span", null, toDisplayString(unref(variant).title), 1)
175
- ];
176
- }),
177
- _: 1
178
- }, 8, ["to", "class"])
179
- ]),
180
- createElementVNode("div", {
181
- class: normalizeClass(["htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded-lg htw-flex-1 htw-p-4", {
182
- "htw-border-gray-100 dark:htw-border-gray-800": !unref(isActive),
183
- "htw-border-primary-200 dark:htw-border-primary-900": unref(isActive)
184
- }]),
185
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop", "prevent"])),
186
- onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
187
- }, [
188
- createVNode(unref(SandboxVue3), {
189
- variant: unref(variant),
190
- story: __props.story,
191
- onReady
192
- }, null, 8, ["variant", "story"])
193
- ], 34)
194
- ], 512);
195
- };
196
- }
197
- });
198
- var StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-265ac8e3"]]);
199
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
200
- name: "StoryVariantGrid",
201
- setup(__props) {
202
- const storyStore = useStoryStore();
203
- const gridTemplateWidth = computed(() => {
204
- if (storyStore.currentStory.layout.type !== "grid") {
205
- return;
206
- }
207
- const layoutWidth = storyStore.currentStory.layout.width;
208
- if (!layoutWidth) {
209
- return "200px";
210
- }
211
- if (typeof layoutWidth === "number") {
212
- return layoutWidth + "px";
213
- }
214
- return layoutWidth;
215
- });
216
- const margin = 16;
217
- const gap = 16;
218
- const itemWidth = ref(16);
219
- const maxItemHeight = ref(0);
220
- const maxCount = ref(10);
221
- const countPerRow = ref(0);
222
- const visibleRows = ref(0);
223
- const el = ref(null);
224
- useResizeObserver(el, () => {
225
- updateMaxCount();
226
- });
227
- function updateMaxCount() {
228
- if (!maxItemHeight.value)
229
- return;
230
- const width = el.value.clientWidth - margin * 2;
231
- const height = el.value.clientHeight;
232
- const scrollTop = el.value.scrollTop;
233
- countPerRow.value = Math.floor((width + gap) / (itemWidth.value + gap));
234
- visibleRows.value = Math.ceil((height + scrollTop + gap) / (maxItemHeight.value + gap));
235
- const newMaxCount = countPerRow.value * visibleRows.value;
236
- if (maxCount.value < newMaxCount) {
237
- maxCount.value = newMaxCount;
238
- }
239
- if (storyStore.currentVariant) {
240
- const index = storyStore.currentStory.variants.indexOf(storyStore.currentVariant);
241
- if (index + 1 > maxCount.value) {
242
- maxCount.value = index + 1;
243
- }
244
- }
245
- }
246
- function onItemResize(w, h2) {
247
- itemWidth.value = w;
248
- if (maxItemHeight.value < h2) {
249
- maxItemHeight.value = h2;
250
- updateMaxCount();
251
- }
252
- }
253
- watch(() => storyStore.currentVariant, () => {
254
- updateMaxCount();
255
- });
256
- return (_ctx, _cache) => {
257
- return openBlock(), createElementBlock("div", {
258
- ref_key: "el",
259
- ref: el,
260
- class: "htw-h-full htw-overflow-y-auto",
261
- onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
262
- }, [
263
- createElementVNode("div", {
264
- style: normalizeStyle({
265
- minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
266
- })
267
- }, [
268
- createElementVNode("div", {
269
- class: "htw-grid htw-gap-4 htw-m-4",
270
- style: normalizeStyle({
271
- gridTemplateColumns: `repeat(auto-fill, ${unref(gridTemplateWidth)})`
272
- })
273
- }, [
274
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
275
- return openBlock(), createBlock(StoryVariantGridItem, {
276
- key: index,
277
- variant,
278
- story: unref(storyStore).currentStory,
279
- onResize: onItemResize
280
- }, null, 8, ["variant", "story"]);
281
- }), 128))
282
- ], 4)
283
- ], 4)
284
- ], 544);
285
- };
286
- }
287
- });
288
- 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" };
289
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
290
- name: "StoryVariantTitle",
291
- props: {
292
- variant: null
293
- },
294
- setup(__props) {
295
- return (_ctx, _cache) => {
296
- var _a;
297
- return openBlock(), createElementBlock("div", _hoisted_1$p, [
298
- createVNode(unref(Icon), {
299
- icon: (_a = __props.variant.icon) != null ? _a : "carbon:cube",
300
- class: normalizeClass(["base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50", [
301
- __props.variant.iconColor ? "bind-icon-color" : "htw-text-gray-500"
302
- ]])
303
- }, null, 8, ["icon", "class"]),
304
- createElementVNode("span", null, toDisplayString(__props.variant.title), 1)
305
- ]);
306
- };
307
- }
308
- });
309
- const usePreviewSettingsStore = defineStore("preview-settings", () => {
310
- const currentSettings = useStorage("_histoire-sandbox-settings-v2", {
311
- responsiveWidth: 720,
312
- responsiveHeight: null,
313
- rotate: false,
314
- backgroundColor: "transparent",
315
- checkerboard: false
316
- });
317
- return {
318
- currentSettings
319
- };
320
- });
321
- const _hoisted_1$o = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
322
- const _hoisted_2$k = {
323
- width: "16",
324
- height: "16",
325
- viewBox: "0 0 24 24",
326
- class: "htw-relative htw-z-10"
327
- };
328
- const _hoisted_3$d = ["stroke-dasharray", "stroke-dashoffset"];
329
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
330
- name: "BaseCheckbox",
331
- props: {
332
- modelValue: {
333
- type: Boolean,
334
- default: false
335
- }
336
- },
337
- emits: {
338
- "update:modelValue": (newValue) => true
339
- },
340
- setup(__props, { emit }) {
341
- const props = __props;
342
- function toggle() {
343
- emit("update:modelValue", !props.modelValue);
344
- animationEnabled.value = true;
345
- }
346
- const path = ref();
347
- const dasharray = ref(0);
348
- const progress = computed(() => props.modelValue ? 1 : 0);
349
- const dashoffset = computed(() => (1 - progress.value) * dasharray.value);
350
- const animationEnabled = ref(false);
351
- watch(path, (value) => {
352
- var _a, _b, _c;
353
- dasharray.value = (_c = (_b = (_a = path.value).getTotalLength) == null ? void 0 : _b.call(_a)) != null ? _c : 21.21;
354
- });
355
- return (_ctx, _cache) => {
356
- return openBlock(), createElementBlock("div", {
357
- role: "checkbox",
358
- tabindex: "0",
359
- class: "htw-flex htw-items-center htw-gap-2 htw-select-none htw-px-4 htw-py-3 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700",
360
- onClick: _cache[0] || (_cache[0] = ($event) => toggle()),
361
- onKeydown: [
362
- _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["enter"])),
363
- _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["space"]))
364
- ]
365
- }, [
366
- createElementVNode("div", _hoisted_1$o, [
367
- createElementVNode("div", {
368
- 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", [
369
- __props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
370
- ]])
371
- }, null, 2),
372
- (openBlock(), createElementBlock("svg", _hoisted_2$k, [
373
- createElementVNode("path", {
374
- ref_key: "path",
375
- ref: path,
376
- d: "m 4 12 l 5 5 l 10 -10",
377
- fill: "none",
378
- class: normalizeClass(["htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out", [
379
- animationEnabled.value ? "htw-transition-all" : "htw-transition-none",
380
- {
381
- "htw-delay-150": __props.modelValue
382
- }
383
- ]]),
384
- "stroke-dasharray": dasharray.value,
385
- "stroke-dashoffset": unref(dashoffset)
386
- }, null, 10, _hoisted_3$d)
387
- ]))
388
- ]),
389
- renderSlot(_ctx.$slots, "default")
390
- ], 32);
391
- };
392
- }
393
- });
394
- const _hoisted_1$n = { class: "htw-flex htw-flex-col htw-items-stretch" };
395
- const _hoisted_2$j = /* @__PURE__ */ createTextVNode(" Rotate ");
396
- const _hoisted_3$c = { class: "htw-flex htw-gap-2 htw-px-4 htw-py-3" };
397
- const _hoisted_4$9 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-50" }, "x", -1);
398
- const _hoisted_5$6 = ["onClick"];
399
- const _hoisted_6$6 = { class: "htw-ml-auto htw-opacity-70 htw-flex htw-gap-1" };
400
- const _hoisted_7$3 = { key: 0 };
401
- const _hoisted_8$2 = { key: 0 };
402
- const _hoisted_9 = { key: 1 };
403
- const _hoisted_10 = { key: 2 };
404
- const _hoisted_11 = { key: 0 };
405
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
406
- name: "StoryVariantResponsiveSize",
407
- setup(__props) {
408
- const settings = usePreviewSettingsStore().currentSettings;
409
- return (_ctx, _cache) => {
410
- var _a;
411
- const _component_VDropdown = resolveComponent("VDropdown");
412
- const _directive_tooltip = resolveDirective("tooltip");
413
- return openBlock(), createBlock(_component_VDropdown, {
414
- placement: "bottom-end",
415
- skidding: 6,
416
- disabled: !((_a = unref(histoireConfig).responsivePresets) == null ? void 0 : _a.length),
417
- class: "htw-h-full htw-flex-none"
418
- }, {
419
- popper: withCtx(({ hide }) => [
420
- createElementVNode("div", _hoisted_1$n, [
421
- createVNode(_sfc_main$q, {
422
- modelValue: unref(settings).rotate,
423
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).rotate = $event)
424
- }, {
425
- default: withCtx(() => [
426
- _hoisted_2$j
427
- ]),
428
- _: 1
429
- }, 8, ["modelValue"]),
430
- createElementVNode("div", _hoisted_3$c, [
431
- withDirectives(createElementVNode("input", {
432
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(settings).responsiveWidth = $event),
433
- type: "number",
434
- class: "htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0",
435
- step: "16",
436
- placeholder: "Auto"
437
- }, null, 512), [
438
- [
439
- vModelText,
440
- unref(settings).responsiveWidth,
441
- void 0,
442
- { number: true }
443
- ],
444
- [_directive_tooltip, "Responsive width (px)"]
445
- ]),
446
- _hoisted_4$9,
447
- withDirectives(createElementVNode("input", {
448
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(settings).responsiveHeight = $event),
449
- type: "number",
450
- class: "htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0",
451
- step: "16",
452
- placeholder: "Auto"
453
- }, null, 512), [
454
- [
455
- vModelText,
456
- unref(settings).responsiveHeight,
457
- void 0,
458
- { number: true }
459
- ],
460
- [_directive_tooltip, "Responsive height (px)"]
461
- ])
462
- ]),
463
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(histoireConfig).responsivePresets, (preset, index) => {
464
- return openBlock(), createElementBlock("button", {
465
- key: index,
466
- class: normalizeClass(["htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4", [
467
- unref(settings).responsiveWidth === preset.width && unref(settings).responsiveHeight === preset.height ? "htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black" : "htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
468
- ]]),
469
- onClick: ($event) => {
470
- unref(settings).responsiveWidth = preset.width;
471
- unref(settings).responsiveHeight = preset.height;
472
- hide();
473
- }
474
- }, [
475
- createTextVNode(toDisplayString(preset.label) + " ", 1),
476
- createElementVNode("span", _hoisted_6$6, [
477
- preset.width ? (openBlock(), createElementBlock("span", _hoisted_7$3, [
478
- createTextVNode(toDisplayString(preset.width), 1),
479
- !preset.height ? (openBlock(), createElementBlock("span", _hoisted_8$2, "px")) : createCommentVNode("", true)
480
- ])) : createCommentVNode("", true),
481
- preset.width && preset.height ? (openBlock(), createElementBlock("span", _hoisted_9, "x")) : createCommentVNode("", true),
482
- preset.height ? (openBlock(), createElementBlock("span", _hoisted_10, [
483
- createTextVNode(toDisplayString(preset.height), 1),
484
- !preset.width ? (openBlock(), createElementBlock("span", _hoisted_11, "px")) : createCommentVNode("", true)
485
- ])) : createCommentVNode("", true)
486
- ])
487
- ], 10, _hoisted_5$6);
488
- }), 128))
489
- ])
490
- ]),
491
- default: withCtx(() => {
492
- var _a2;
493
- return [
494
- withDirectives((openBlock(), createElementBlock("div", {
495
- class: normalizeClass(["htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group", {
496
- "htw-cursor-pointer hover:htw-text-primary-500": (_a2 = unref(histoireConfig).responsivePresets) == null ? void 0 : _a2.length
497
- }])
498
- }, [
499
- createVNode(unref(Icon), {
500
- icon: "carbon:devices",
501
- class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
502
- }),
503
- createVNode(unref(Icon), {
504
- icon: "carbon:caret-down",
505
- class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
506
- })
507
- ], 2)), [
508
- [_directive_tooltip, "Responsive sizes"]
509
- ])
510
- ];
511
- }),
512
- _: 1
513
- }, 8, ["disabled"]);
514
- };
515
- }
516
- });
517
- var StoryVariantBackground_vue_vue_type_style_index_0_scoped_true_lang = "";
518
- const _withScopeId$5 = (n) => (pushScopeId("data-v-bde73868"), n = n(), popScopeId(), n);
519
- 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" };
520
- 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));
521
- const _hoisted_3$b = { class: "htw-flex htw-flex-col htw-items-stretch" };
522
- const _hoisted_4$8 = /* @__PURE__ */ createTextVNode(" Checkerboard ");
523
- const _hoisted_5$5 = ["onClick"];
524
- const _hoisted_6$5 = { class: "htw-mr-auto" };
525
- const _hoisted_7$2 = { class: "htw-ml-auto htw-opacity-70" };
526
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
527
- name: "StoryVariantBackground",
528
- setup(__props) {
529
- useCssVars((_ctx) => ({
530
- "b797c7ca": unref(settings).backgroundColor
531
- }));
532
- const settings = usePreviewSettingsStore().currentSettings;
533
- return (_ctx, _cache) => {
534
- const _component_VDropdown = resolveComponent("VDropdown");
535
- const _directive_tooltip = resolveDirective("tooltip");
536
- return unref(histoireConfig).backgroundPresets.length ? (openBlock(), createBlock(_component_VDropdown, {
537
- key: 0,
538
- placement: "bottom-end",
539
- skidding: 6,
540
- class: "htw-h-full htw-flex-none"
541
- }, {
542
- popper: withCtx(({ hide }) => [
543
- createElementVNode("div", _hoisted_3$b, [
544
- createVNode(_sfc_main$q, {
545
- modelValue: unref(settings).checkerboard,
546
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).checkerboard = $event)
547
- }, {
548
- default: withCtx(() => [
549
- _hoisted_4$8
550
- ]),
551
- _: 1
552
- }, 8, ["modelValue"]),
553
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(histoireConfig).backgroundPresets, (option, index) => {
554
- return openBlock(), createElementBlock("button", {
555
- key: index,
556
- class: normalizeClass(["htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4", [
557
- unref(settings).backgroundColor === option.color ? "htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black" : "htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
558
- ]]),
559
- onClick: ($event) => {
560
- unref(settings).backgroundColor = option.color;
561
- hide();
562
- }
563
- }, [
564
- createElementVNode("span", _hoisted_6$5, toDisplayString(option.label), 1),
565
- option.color !== "$checkerboard" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
566
- createElementVNode("span", _hoisted_7$2, toDisplayString(option.color), 1),
567
- createElementVNode("div", {
568
- class: "htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/20 dark:htw-border-white/20",
569
- style: normalizeStyle({
570
- backgroundColor: option.color
571
- })
572
- }, null, 4)
573
- ], 64)) : createCommentVNode("", true)
574
- ], 10, _hoisted_5$5);
575
- }), 128))
576
- ])
577
- ]),
578
- default: withCtx(() => [
579
- withDirectives((openBlock(), createElementBlock("div", _hoisted_1$m, [
580
- _hoisted_2$i,
581
- createVNode(unref(Icon), {
582
- icon: "carbon:caret-down",
583
- class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
584
- })
585
- ])), [
586
- [_directive_tooltip, "Background color"]
587
- ])
588
- ]),
589
- _: 1
590
- })) : createCommentVNode("", true);
591
- };
592
- }
593
- });
594
- var StoryVariantBackground = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-bde73868"]]);
595
- function getSandboxUrl(story, variant) {
596
- const url = new URLSearchParams();
597
- url.append("storyId", story.id);
598
- url.append("variantId", variant.id);
599
- return `${base}__sandbox.html?${url.toString()}`;
600
- }
601
- const _hoisted_1$l = ["href"];
602
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
603
- name: "StoryVariantNewTab",
604
- props: {
605
- variant: null,
606
- story: null
607
- },
608
- setup(__props) {
609
- const props = __props;
610
- const sandboxUrl = computed(() => {
611
- return getSandboxUrl(props.story, props.variant);
612
- });
613
- return (_ctx, _cache) => {
614
- const _directive_tooltip = resolveDirective("tooltip");
615
- return withDirectives((openBlock(), createElementBlock("a", {
616
- href: unref(sandboxUrl),
617
- target: "_blank",
618
- class: "htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
619
- }, [
620
- createVNode(unref(Icon), {
621
- icon: "carbon:launch",
622
- class: "base-list-item-link-icon htw-w-4 htw-h-4"
623
- })
624
- ], 8, _hoisted_1$l)), [
625
- [_directive_tooltip, "Open variant in new tab"]
626
- ]);
627
- };
628
- }
629
- });
630
- var HatchedPattern_vue_vue_type_style_index_0_scoped_true_lang = "";
631
- const _sfc_main$m = {};
632
- const _withScopeId$4 = (n) => (pushScopeId("data-v-250960ac"), n = n(), popScopeId(), n);
633
- const _hoisted_1$k = { class: "__histoire-hatched-pattern" };
634
- function _sfc_render$3(_ctx, _cache) {
635
- return openBlock(), createElementBlock("div", _hoisted_1$k);
636
- }
637
- var HatchedPattern = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$3], ["__scopeId", "data-v-250960ac"]]);
638
- const _sfc_main$l = {};
639
- const _hoisted_1$j = { fill: "none" };
640
- const _hoisted_2$h = /* @__PURE__ */ createElementVNode("pattern", {
641
- id: "checkerboard",
642
- width: "64",
643
- height: "64",
644
- patternUnits: "userSpaceOnUse"
645
- }, [
646
- /* @__PURE__ */ createElementVNode("rect", {
647
- x: "0",
648
- y: "0",
649
- width: "32",
650
- height: "32",
651
- fill: "currentColor"
652
- }),
653
- /* @__PURE__ */ createElementVNode("rect", {
654
- x: "32",
655
- y: "32",
656
- width: "32",
657
- height: "32",
658
- fill: "currentColor"
659
- })
660
- ], -1);
661
- const _hoisted_3$a = /* @__PURE__ */ createElementVNode("rect", {
662
- x: "0",
663
- y: "0",
664
- width: "100%",
665
- height: "100%",
666
- fill: "url(#checkerboard)"
667
- }, null, -1);
668
- const _hoisted_4$7 = [
669
- _hoisted_2$h,
670
- _hoisted_3$a
671
- ];
672
- function _sfc_render$2(_ctx, _cache) {
673
- return openBlock(), createElementBlock("svg", _hoisted_1$j, _hoisted_4$7);
674
- }
675
- var CheckerboardPattern = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2]]);
676
- var StoryResponsivePreview_vue_vue_type_style_index_0_scoped_true_lang = "";
677
- const _withScopeId$3 = (n) => (pushScopeId("data-v-769a585e"), n = n(), popScopeId(), n);
678
- 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" };
679
- const _hoisted_2$g = {
680
- key: 0,
681
- 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"
682
- };
683
- const _hoisted_3$9 = { class: "htw-p-4 htw-h-full htw-relative" };
684
- 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" };
685
- const _hoisted_5$4 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("div", { class: "bind-preview-bg htw-absolute htw-inset-0" }, null, -1));
686
- 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);
687
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
688
- name: "StoryResponsivePreview",
689
- props: {
690
- variant: null
691
- },
692
- setup(__props) {
693
- const props = __props;
694
- useCssVars((_ctx) => ({
695
- "700caecc": unref(settings).backgroundColor
696
- }));
697
- const settings = usePreviewSettingsStore().currentSettings;
698
- const resizing = ref(false);
699
- const onUnmountedCleanupFns = [];
700
- onUnmounted(() => {
701
- onUnmountedCleanupFns.forEach((fn) => fn());
702
- });
703
- function addWindowListener(event, listener) {
704
- window.addEventListener(event, listener);
705
- const removeListener = () => window.removeEventListener(event, listener);
706
- onUnmountedCleanupFns.push(removeListener);
707
- return () => {
708
- removeListener();
709
- onUnmountedCleanupFns.splice(onUnmountedCleanupFns.indexOf(removeListener), 1);
710
- };
711
- }
712
- function useDragger(el, value, min, max, axis) {
713
- function onMouseDown(event) {
714
- event.preventDefault();
715
- event.stopPropagation();
716
- const start = axis === "x" ? event.clientX : event.clientY;
717
- const startValue = value.value;
718
- resizing.value = true;
719
- const removeListeners = [
720
- addWindowListener("mousemove", onMouseMove),
721
- addWindowListener("mouseup", onMouseUp)
722
- ];
723
- function onMouseMove(event2) {
724
- const snapTarget = axis === "x" ? previewWrapper.value.clientWidth : previewWrapper.value.clientHeight;
725
- const delta = (axis === "x" ? event2.clientX : event2.clientY) - start;
726
- value.value = Math.max(min, Math.min(max, startValue + delta));
727
- if (Math.abs(value.value - (snapTarget - 67)) < 16) {
728
- value.value = null;
729
- }
730
- }
731
- function onMouseUp() {
732
- removeListeners.forEach((fn) => fn());
733
- resizing.value = false;
734
- }
735
- }
736
- useEventListener(el, "mousedown", onMouseDown);
737
- function onTouchStart(event) {
738
- event.preventDefault();
739
- event.stopPropagation();
740
- const start = axis === "x" ? event.touches[0].clientX : event.touches[0].clientY;
741
- const startValue = value.value;
742
- resizing.value = true;
743
- const removeListeners = [
744
- addWindowListener("touchmove", onTouchMove),
745
- addWindowListener("touchend", onTouchEnd),
746
- addWindowListener("touchcancel", onTouchEnd)
747
- ];
748
- function onTouchMove(event2) {
749
- const delta = (axis === "x" ? event2.touches[0].clientX : event2.touches[0].clientY) - start;
750
- value.value = Math.max(min, Math.min(max, startValue + delta));
751
- }
752
- function onTouchEnd() {
753
- removeListeners.forEach((fn) => fn());
754
- resizing.value = false;
755
- }
756
- }
757
- useEventListener(el, "touchstart", onTouchStart);
758
- }
759
- const responsiveWidth = computed({
760
- get: () => settings[settings.rotate ? "responsiveHeight" : "responsiveWidth"],
761
- set: (value) => {
762
- settings[settings.rotate ? "responsiveHeight" : "responsiveWidth"] = value;
763
- }
764
- });
765
- const responsiveHeight = computed({
766
- get: () => settings[settings.rotate ? "responsiveWidth" : "responsiveHeight"],
767
- set: (value) => {
768
- settings[settings.rotate ? "responsiveWidth" : "responsiveHeight"] = value;
769
- }
770
- });
771
- const horizontalDragger = ref();
772
- const verticalDragger = ref();
773
- const cornerDragger = ref();
774
- const previewWrapper = ref();
775
- useDragger(horizontalDragger, responsiveWidth, 32, 2e4, "x");
776
- useDragger(verticalDragger, responsiveHeight, 32, 2e4, "y");
777
- useDragger(cornerDragger, responsiveWidth, 32, 2e4, "x");
778
- useDragger(cornerDragger, responsiveHeight, 32, 2e4, "y");
779
- const finalWidth = computed(() => settings.rotate ? settings.responsiveHeight : settings.responsiveWidth);
780
- const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth : settings.responsiveHeight);
781
- const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled);
782
- return (_ctx, _cache) => {
783
- return openBlock(), createElementBlock("div", _hoisted_1$i, [
784
- unref(isResponsiveEnabled) ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
785
- createVNode(HatchedPattern, { class: "htw-w-full htw-h-full htw-text-black/[2%] dark:htw-text-white/[2%]" })
786
- ])) : createCommentVNode("", true),
787
- createElementVNode("div", {
788
- ref_key: "previewWrapper",
789
- ref: previewWrapper,
790
- class: "htw-h-full htw-overflow-auto htw-relative"
791
- }, [
792
- createElementVNode("div", {
793
- class: normalizeClass(["htw-h-full htw-p-4 htw-overflow-hidden htw-bg-white dark:htw-bg-gray-700 htw-rounded-lg htw-relative", unref(isResponsiveEnabled) ? {
794
- "htw-w-fit": !!unref(finalWidth),
795
- "htw-h-fit": !!unref(finalHeight)
796
- } : void 0])
797
- }, [
798
- createElementVNode("div", _hoisted_3$9, [
799
- createElementVNode("div", _hoisted_4$6, [
800
- _hoisted_5$4,
801
- unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
802
- key: 0,
803
- class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
804
- })) : createCommentVNode("", true),
805
- renderSlot(_ctx.$slots, "default", {
806
- isResponsiveEnabled: unref(isResponsiveEnabled),
807
- finalWidth: unref(finalWidth),
808
- finalHeight: unref(finalHeight),
809
- resizing: resizing.value
810
- }, void 0, true)
811
- ]),
812
- _hoisted_6$4
813
- ]),
814
- unref(isResponsiveEnabled) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
815
- createElementVNode("div", {
816
- ref_key: "horizontalDragger",
817
- ref: horizontalDragger,
818
- class: "htw-absolute htw-w-4 htw-top-0 htw-bottom-4 htw-right-0 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-items-center htw-justify-center htw-cursor-ew-resize htw-group hover:htw-text-primary-500"
819
- }, [
820
- createVNode(unref(Icon), {
821
- icon: "mdi:drag-vertical-variant",
822
- class: "htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
823
- })
824
- ], 512),
825
- createElementVNode("div", {
826
- ref_key: "verticalDragger",
827
- ref: verticalDragger,
828
- class: "htw-absolute htw-h-4 htw-left-0 htw-right-4 htw-bottom-0 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-items-center htw-justify-center htw-cursor-ns-resize htw-group hover:htw-text-primary-500"
829
- }, [
830
- createVNode(unref(Icon), {
831
- icon: "mdi:drag-horizontal-variant",
832
- class: "htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
833
- })
834
- ], 512),
835
- createElementVNode("div", {
836
- ref_key: "cornerDragger",
837
- ref: cornerDragger,
838
- class: "htw-absolute htw-w-4 htw-h-4 htw-right-0 htw-bottom-0 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-items-center htw-justify-center htw-cursor-nwse-resize htw-group hover:htw-text-primary-500"
839
- }, null, 512)
840
- ], 64)) : createCommentVNode("", true)
841
- ], 2)
842
- ], 512)
843
- ]);
844
- };
845
- }
846
- });
847
- var StoryResponsivePreview = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-769a585e"]]);
848
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
849
- name: "StoryVariantSinglePreviewNative",
850
- props: {
851
- story: null,
852
- variant: null
853
- },
854
- setup(__props) {
855
- const props = __props;
856
- Object.assign(props.variant, {
857
- previewReady: false
858
- });
859
- function onReady() {
860
- Object.assign(props.variant, {
861
- previewReady: true
862
- });
863
- }
864
- return (_ctx, _cache) => {
865
- return openBlock(), createBlock(StoryResponsivePreview, { variant: __props.variant }, {
866
- default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight }) => [
867
- createElementVNode("div", {
868
- style: normalizeStyle(isResponsiveEnabled ? {
869
- width: finalWidth ? `${finalWidth}px` : "100%",
870
- height: finalHeight ? `${finalHeight}px` : "100%"
871
- } : { width: "100%", height: "100%" })
872
- }, [
873
- (openBlock(), createBlock(unref(SandboxVue3), {
874
- key: `${__props.story.id}-${__props.variant.id}`,
875
- variant: __props.variant,
876
- story: __props.story,
877
- class: "htw-h-full",
878
- onReady
879
- }, null, 8, ["variant", "story"]))
880
- ], 4)
881
- ]),
882
- _: 1
883
- }, 8, ["variant"]);
884
- };
885
- }
886
- });
887
- const _hoisted_1$h = ["src"];
888
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
889
- name: "StoryVariantSinglePreviewRemote",
890
- props: {
891
- story: null,
892
- variant: null
893
- },
894
- setup(__props) {
895
- const props = __props;
896
- const settings = usePreviewSettingsStore().currentSettings;
897
- const iframe = ref();
898
- function syncState() {
899
- if (iframe.value && props.variant.previewReady) {
900
- iframe.value.contentWindow.postMessage({
901
- type: STATE_SYNC,
902
- state: toRawDeep(props.variant.state)
903
- });
904
- }
905
- }
906
- let synced = false;
907
- watch(() => props.variant.state, () => {
908
- if (synced) {
909
- synced = false;
910
- return;
911
- }
912
- syncState();
913
- }, {
914
- deep: true,
915
- immediate: true
916
- });
917
- Object.assign(props.variant, {
918
- previewReady: false
919
- });
920
- useEventListener(window, "message", (event) => {
921
- switch (event.data.type) {
922
- case STATE_SYNC:
923
- updateVariantState(event.data.state);
924
- break;
925
- case EVENT_SEND:
926
- logEvent(event.data.event);
927
- break;
928
- case SANDBOX_READY:
929
- setPreviewReady();
930
- break;
931
- }
932
- });
933
- function updateVariantState(state) {
934
- synced = true;
935
- applyStateToVariant(props.variant, state);
936
- }
937
- function logEvent(event) {
938
- const eventsStore = useEventsStore();
939
- eventsStore.addEvent(event);
940
- }
941
- function setPreviewReady() {
942
- Object.assign(props.variant, {
943
- previewReady: true
944
- });
945
- }
946
- const sandboxUrl = computed(() => {
947
- return getSandboxUrl(props.story, props.variant);
948
- });
949
- const isIframeLoaded = ref(false);
950
- watch(sandboxUrl, () => {
951
- isIframeLoaded.value = false;
952
- });
953
- function syncSettings() {
954
- if (iframe.value) {
955
- iframe.value.contentWindow.postMessage({
956
- type: PREVIEW_SETTINGS_SYNC,
957
- settings: toRaw(settings)
958
- });
959
- }
960
- }
961
- watch(() => settings, () => {
962
- syncSettings();
963
- }, {
964
- deep: true,
965
- immediate: true
966
- });
967
- function onIframeLoad() {
968
- isIframeLoaded.value = true;
969
- syncState();
970
- syncSettings();
971
- }
972
- return (_ctx, _cache) => {
973
- return openBlock(), createBlock(StoryResponsivePreview, { variant: __props.variant }, {
974
- default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight, resizing }) => [
975
- createElementVNode("iframe", {
976
- ref_key: "iframe",
977
- ref: iframe,
978
- src: unref(sandboxUrl),
979
- class: normalizeClass(["htw-w-full htw-h-full htw-relative", {
980
- "htw-invisible": !isIframeLoaded.value,
981
- "htw-pointer-events-none": resizing
982
- }]),
983
- style: normalizeStyle(isResponsiveEnabled ? {
984
- width: finalWidth ? `${finalWidth}px` : null,
985
- height: finalHeight ? `${finalHeight}px` : null
986
- } : void 0),
987
- "data-test-id": "preview-iframe",
988
- onLoad: _cache[0] || (_cache[0] = ($event) => onIframeLoad())
989
- }, null, 46, _hoisted_1$h)
990
- ]),
991
- _: 1
992
- }, 8, ["variant"]);
993
- };
994
- }
995
- });
996
- const _hoisted_1$g = {
997
- class: "htw-h-full htw-flex htw-flex-col",
998
- "data-test-id": "story-variant-single-view"
999
- };
1000
- const _hoisted_2$f = {
1001
- key: 0,
1002
- class: "htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
1003
- };
1004
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
1005
- name: "StoryVariantSingleView",
1006
- props: {
1007
- variant: null,
1008
- story: null
1009
- },
1010
- setup(__props) {
1011
- return (_ctx, _cache) => {
1012
- var _a;
1013
- return openBlock(), createElementBlock("div", _hoisted_1$g, [
1014
- !unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
1015
- createVNode(_sfc_main$r, { variant: __props.variant }, null, 8, ["variant"]),
1016
- !__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$p, { key: 0 })) : createCommentVNode("", true),
1017
- createVNode(StoryVariantBackground),
1018
- createVNode(_sfc_main$n, {
1019
- variant: __props.variant,
1020
- story: __props.story
1021
- }, null, 8, ["variant", "story"])
1022
- ])) : createCommentVNode("", true),
1023
- ((_a = __props.story.layout) == null ? void 0 : _a.iframe) === false ? (openBlock(), createBlock(_sfc_main$j, {
1024
- key: 1,
1025
- story: __props.story,
1026
- variant: __props.variant
1027
- }, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$i, {
1028
- key: 2,
1029
- story: __props.story,
1030
- variant: __props.variant
1031
- }, null, 8, ["story", "variant"]))
1032
- ]);
1033
- };
1034
- }
1035
- });
1036
- var StoryVariantSingle_vue_vue_type_style_index_0_scoped_true_lang = "";
1037
- const _withScopeId$2 = (n) => (pushScopeId("data-v-39eaa600"), n = n(), popScopeId(), n);
1038
- const _hoisted_1$f = {
1039
- key: 0,
1040
- class: "htw-p-2 htw-h-full"
1041
- };
1042
- const _hoisted_2$e = {
1043
- key: 0,
1044
- class: "htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
1045
- };
1046
- const _hoisted_3$8 = /* @__PURE__ */ createTextVNode(" Select a variant... ");
1047
- const _hoisted_4$5 = {
1048
- key: 0,
1049
- class: "htw-p-2 htw-h-full"
1050
- };
1051
- const _hoisted_5$3 = { class: "htw-h-full htw-overflow-y-auto" };
1052
- const _hoisted_6$3 = {
1053
- key: 0,
1054
- class: "htw-p-2 htw-h-full"
1055
- };
1056
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
1057
- name: "StoryVariantSingle",
1058
- emits: {
1059
- "open-variant-menu": () => true
1060
- },
1061
- setup(__props) {
1062
- useCssVars((_ctx) => {
1063
- var _a;
1064
- return {
1065
- "22451fc3": (_a = unref(variant)) == null ? void 0 : _a.iconColor
1066
- };
1067
- });
1068
- const storyStore = useStoryStore();
1069
- const hasSingleVariant = computed(() => {
1070
- var _a;
1071
- return ((_a = storyStore.currentStory) == null ? void 0 : _a.variants.length) === 1;
1072
- });
1073
- const variant = computed(() => storyStore.currentVariant);
1074
- return (_ctx, _cache) => {
1075
- var _a;
1076
- return unref(hasSingleVariant) && unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
1077
- unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$h, {
1078
- key: 0,
1079
- variant: unref(storyStore).currentVariant,
1080
- story: unref(storyStore).currentStory
1081
- }, null, 8, ["variant", "story"])) : createCommentVNode("", true)
1082
- ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1083
- unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
1084
- createElementVNode("a", {
1085
- 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 htw-flex-none",
1086
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("open-variant-menu"))
1087
- }, [
1088
- unref(variant) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1089
- createVNode(unref(Icon), {
1090
- icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
1091
- class: normalizeClass(["base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none", {
1092
- "htw-text-gray-500": !unref(variant).iconColor,
1093
- "bind-icon-color": unref(variant).iconColor
1094
- }])
1095
- }, null, 8, ["icon", "class"]),
1096
- createTextVNode(" " + toDisplayString(unref(variant).title), 1)
1097
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1098
- _hoisted_3$8
1099
- ], 64)),
1100
- createVNode(unref(Icon), {
1101
- icon: "carbon:chevron-sort",
1102
- class: "htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
1103
- })
1104
- ]),
1105
- unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
1106
- unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$h, {
1107
- key: 0,
1108
- variant: unref(storyStore).currentVariant,
1109
- story: unref(storyStore).currentStory
1110
- }, null, 8, ["variant", "story"])) : createCommentVNode("", true)
1111
- ])) : createCommentVNode("", true)
1112
- ])) : (openBlock(), createBlock(BaseSplitPane, {
1113
- key: 1,
1114
- "save-id": "story-single-main-split",
1115
- min: 5,
1116
- max: 40,
1117
- "default-split": 17
1118
- }, {
1119
- first: withCtx(() => [
1120
- createElementVNode("div", _hoisted_5$3, [
1121
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (variant2, index) => {
1122
- return openBlock(), createBlock(StoryVariantListItem, {
1123
- key: index,
1124
- variant: variant2
1125
- }, null, 8, ["variant"]);
1126
- }), 128))
1127
- ])
1128
- ]),
1129
- last: withCtx(() => [
1130
- unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
1131
- createVNode(_sfc_main$h, {
1132
- variant: unref(storyStore).currentVariant,
1133
- story: unref(storyStore).currentStory
1134
- }, null, 8, ["variant", "story"])
1135
- ])) : createCommentVNode("", true)
1136
- ]),
1137
- _: 1
1138
- }))
1139
- ], 64));
1140
- };
1141
- }
1142
- });
1143
- var StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-39eaa600"]]);
1144
- var StoryViewer_vue_vue_type_style_index_0_scoped_true_lang = "";
1145
- const _withScopeId$1 = (n) => (pushScopeId("data-v-3c153cb8"), n = n(), popScopeId(), n);
1146
- const _hoisted_1$e = { class: "htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750" };
1147
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
1148
- name: "StoryViewer",
1149
- setup(__props) {
1150
- useCssVars((_ctx) => {
1151
- var _a;
1152
- return {
1153
- "d1b61db4": (_a = unref(variant)) == null ? void 0 : _a.iconColor
1154
- };
1155
- });
1156
- const storyStore = useStoryStore();
1157
- const variant = computed(() => storyStore.currentVariant);
1158
- const isMenuOpened = ref(false);
1159
- function closeMenu() {
1160
- isMenuOpened.value = false;
1161
- }
1162
- watch(variant, () => {
1163
- isMenuOpened.value = false;
1164
- });
1165
- return (_ctx, _cache) => {
1166
- return openBlock(), createElementBlock(Fragment, null, [
1167
- createElementVNode("div", _hoisted_1$e, [
1168
- unref(storyStore).currentStory.layout.type === "grid" ? (openBlock(), createBlock(_sfc_main$s, { key: 0 })) : unref(storyStore).currentStory.layout.type === "single" ? (openBlock(), createBlock(StoryVariantSingle, {
1169
- key: 1,
1170
- onOpenVariantMenu: _cache[0] || (_cache[0] = ($event) => isMenuOpened.value = true)
1171
- })) : createCommentVNode("", true)
1172
- ]),
1173
- createVNode(_sfc_main$v, {
1174
- title: "Select a variant",
1175
- opened: isMenuOpened.value,
1176
- onClose: closeMenu
1177
- }, {
1178
- default: withCtx(() => [
1179
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (variant2, index) => {
1180
- return openBlock(), createBlock(StoryVariantListItem, {
1181
- key: index,
1182
- variant: variant2
1183
- }, null, 8, ["variant"]);
1184
- }), 128))
1185
- ]),
1186
- _: 1
1187
- }, 8, ["opened"])
1188
- ], 64);
1189
- };
1190
- }
1191
- });
1192
- var StoryViewer = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-3c153cb8"]]);
1193
- 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" };
1194
- const _hoisted_2$d = { class: "htw-flex-1 htw-truncate" };
1195
- const _hoisted_3$7 = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" };
1196
- const _hoisted_4$4 = ["onClick"];
1197
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
1198
- name: "BaseSelect",
1199
- props: {
1200
- modelValue: null,
1201
- options: null
1202
- },
1203
- emits: ["update:modelValue", "select"],
1204
- setup(__props, { emit: emits }) {
1205
- const props = __props;
1206
- const formattedOptions = computed(() => {
1207
- if (Array.isArray(props.options)) {
1208
- return Object.fromEntries(props.options.map((value) => [value, value]));
1209
- }
1210
- return props.options;
1211
- });
1212
- const selectedLabel = computed(() => formattedOptions.value[props.modelValue]);
1213
- function selectValue(value, hide) {
1214
- emits("update:modelValue", value);
1215
- emits("select", value);
1216
- hide();
1217
- }
1218
- return (_ctx, _cache) => {
1219
- return openBlock(), createBlock(unref(Dropdown), { "auto-size": "" }, {
1220
- popper: withCtx(({ hide }) => [
1221
- createElementVNode("div", _hoisted_3$7, [
1222
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOptions), (label, value) => {
1223
- return openBlock(), createElementBlock("div", mergeProps(__spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
1224
- key: label,
1225
- class: ["htw-px-2 htw-py-1 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700", {
1226
- "htw-bg-primary-200 dark:htw-bg-primary-800": props.modelValue === value
1227
- }],
1228
- onClick: ($event) => selectValue(value, hide)
1229
- }), [
1230
- renderSlot(_ctx.$slots, "option", {
1231
- label,
1232
- value
1233
- }, () => [
1234
- createTextVNode(toDisplayString(label), 1)
1235
- ])
1236
- ], 16, _hoisted_4$4);
1237
- }), 128))
1238
- ])
1239
- ]),
1240
- default: withCtx(() => [
1241
- createElementVNode("div", _hoisted_1$d, [
1242
- createElementVNode("div", _hoisted_2$d, [
1243
- renderSlot(_ctx.$slots, "default", { label: unref(selectedLabel) }, () => [
1244
- createTextVNode(toDisplayString(unref(selectedLabel)), 1)
1245
- ])
1246
- ]),
1247
- createVNode(unref(Icon), {
1248
- icon: "carbon:chevron-sort",
1249
- class: "htw-w-4 htw-h-4 htw-flex-none htw-ml-auto"
1250
- })
1251
- ])
1252
- ]),
1253
- _: 3
1254
- });
1255
- };
1256
- }
1257
- });
1258
- const _hoisted_1$c = { class: "htw-flex htw-gap-2 htw-w-full htw-items-center" };
1259
- const _hoisted_2$c = ["onUpdate:modelValue"];
1260
- const _hoisted_3$6 = {
1261
- key: 1,
1262
- class: "htw-flex htw-items-center htw-gap-2"
1263
- };
1264
- const _hoisted_4$3 = { class: "htw-flex-1 htw-truncate" };
1265
- const _hoisted_5$2 = { class: "htw-flex htw-gap-2 htw-items-center" };
1266
- const _hoisted_6$2 = { class: "htw-flex-1 htw-truncate" };
1267
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
1268
- name: "StatePresets",
1269
- props: {
1270
- story: null,
1271
- variant: null
1272
- },
1273
- setup(__props) {
1274
- const props = __props;
1275
- const DEFAULT_ID = "default";
1276
- const saveId = computed(() => `${props.story.id}:${props.variant.id}`);
1277
- const omitKeys = ["_hPropDefs"];
1278
- const defaultState = clone(omit(toRawDeep(props.variant.state), omitKeys));
1279
- const selectedOption = useStorage(`_histoire-presets/${saveId.value}/selected`, DEFAULT_ID);
1280
- const presetStates = useStorage(`_histoire-presets/${saveId.value}/states`, /* @__PURE__ */ new Map());
1281
- const presetsOptions = computed(() => {
1282
- const options = { [DEFAULT_ID]: "Initial state" };
1283
- presetStates.value.forEach((value, key) => {
1284
- options[key] = value.label;
1285
- });
1286
- return options;
1287
- });
1288
- function resetState() {
1289
- selectedOption.value = DEFAULT_ID;
1290
- applyStateToVariant(props.variant, clone(defaultState));
1291
- }
1292
- function applyPreset(id) {
1293
- if (id === DEFAULT_ID) {
1294
- resetState();
1295
- } else if (presetStates.value.has(id)) {
1296
- applyStateToVariant(props.variant, clone(presetStates.value.get(id).state));
1297
- }
1298
- }
1299
- onMounted(() => {
1300
- if (selectedOption.value !== DEFAULT_ID) {
1301
- applyPreset(selectedOption.value);
1302
- }
1303
- });
1304
- const input = ref();
1305
- const select = ref();
1306
- const canEdit = computed(() => selectedOption.value !== DEFAULT_ID);
1307
- const isEditing = ref(false);
1308
- async function createPreset() {
1309
- const id = new Date().getTime().toString();
1310
- presetStates.value.set(id, { state: clone(omit(toRawDeep(props.variant.state), omitKeys)), label: "New preset" });
1311
- selectedOption.value = id;
1312
- isEditing.value = true;
1313
- await nextTick();
1314
- input.value.select();
1315
- }
1316
- const savedNotif = ref(false);
1317
- const savedTimeout = useTimeoutFn(() => {
1318
- savedNotif.value = false;
1319
- }, 1e3);
1320
- async function savePreset() {
1321
- if (!canEdit.value)
1322
- return;
1323
- const preset = presetStates.value.get(selectedOption.value);
1324
- preset.state = clone(omit(toRawDeep(props.variant.state), omitKeys));
1325
- savedNotif.value = true;
1326
- savedTimeout.start();
1327
- }
1328
- function deletePreset(id) {
1329
- if (!confirm("Are you sure you want to delete this preset?")) {
1330
- return;
1331
- }
1332
- if (selectedOption.value === id) {
1333
- resetState();
1334
- }
1335
- presetStates.value.delete(id);
1336
- }
1337
- async function startEditing() {
1338
- if (!canEdit.value) {
1339
- return;
1340
- }
1341
- isEditing.value = true;
1342
- await nextTick();
1343
- input.value.select();
1344
- }
1345
- function stopEditing() {
1346
- isEditing.value = false;
1347
- }
1348
- onClickOutside(select, stopEditing);
1349
- return (_ctx, _cache) => {
1350
- const _directive_tooltip = resolveDirective("tooltip");
1351
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
1352
- createElementVNode("div", {
1353
- ref_key: "select",
1354
- ref: select,
1355
- class: "htw-flex-1 htw-min-w-0"
1356
- }, [
1357
- createVNode(_sfc_main$e, {
1358
- modelValue: unref(selectedOption),
1359
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
1360
- options: unref(presetsOptions),
1361
- onDblclick: _cache[3] || (_cache[3] = ($event) => startEditing()),
1362
- onKeydown: [
1363
- _cache[4] || (_cache[4] = withKeys(($event) => stopEditing(), ["enter"])),
1364
- _cache[5] || (_cache[5] = withKeys(($event) => stopEditing(), ["escape"]))
1365
- ],
1366
- onSelect: _cache[6] || (_cache[6] = (id) => applyPreset(id))
1367
- }, {
1368
- default: withCtx(({ label }) => [
1369
- isEditing.value ? withDirectives((openBlock(), createElementBlock("input", {
1370
- key: 0,
1371
- ref_key: "input",
1372
- ref: input,
1373
- "onUpdate:modelValue": ($event) => unref(presetStates).get(unref(selectedOption)).label = $event,
1374
- type: "text",
1375
- class: "htw-text-inherit htw-bg-transparent htw-w-full htw-h-full htw-outline-none",
1376
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
1377
- }, ["stop", "prevent"]))
1378
- }, null, 8, _hoisted_2$c)), [
1379
- [vModelText, unref(presetStates).get(unref(selectedOption)).label]
1380
- ]) : (openBlock(), createElementBlock("div", _hoisted_3$6, [
1381
- createElementVNode("span", _hoisted_4$3, toDisplayString(label), 1),
1382
- unref(canEdit) ? withDirectives((openBlock(), createBlock(unref(Icon), {
1383
- key: 0,
1384
- icon: "carbon:edit",
1385
- class: "htw-flex-none htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
1386
- onClick: _cache[1] || (_cache[1] = withModifiers(($event) => startEditing(), ["stop"]))
1387
- }, null, 512)), [
1388
- [_directive_tooltip, "Rename this preset"]
1389
- ]) : createCommentVNode("", true)
1390
- ]))
1391
- ]),
1392
- option: withCtx(({ label, value }) => [
1393
- createElementVNode("div", _hoisted_5$2, [
1394
- createElementVNode("span", _hoisted_6$2, toDisplayString(label), 1),
1395
- value !== DEFAULT_ID ? withDirectives((openBlock(), createBlock(unref(Icon), {
1396
- key: 0,
1397
- icon: "carbon:trash-can",
1398
- class: "htw-flex-none htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
1399
- onClick: withModifiers(($event) => deletePreset(value), ["stop"])
1400
- }, null, 8, ["onClick"])), [
1401
- [_directive_tooltip, "Delete this preset"]
1402
- ]) : createCommentVNode("", true)
1403
- ])
1404
- ]),
1405
- _: 1
1406
- }, 8, ["modelValue", "options"])
1407
- ], 512),
1408
- withDirectives(createVNode(unref(Icon), {
1409
- icon: savedNotif.value ? "carbon:checkmark" : "carbon:save",
1410
- 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", [
1411
- unref(canEdit) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
1412
- ]]),
1413
- onClick: _cache[7] || (_cache[7] = ($event) => savePreset())
1414
- }, null, 8, ["icon", "class"]), [
1415
- [_directive_tooltip, savedNotif.value ? "Saved!" : unref(canEdit) ? "Save to preset" : null]
1416
- ]),
1417
- withDirectives(createVNode(unref(Icon), {
1418
- icon: "carbon:add-alt",
1419
- class: "htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
1420
- onClick: _cache[8] || (_cache[8] = ($event) => createPreset())
1421
- }, null, 512), [
1422
- [_directive_tooltip, "Create new preset"]
1423
- ]),
1424
- withDirectives(createVNode(unref(Icon), {
1425
- icon: "carbon:reset",
1426
- class: "htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
1427
- onClick: _cache[9] || (_cache[9] = ($event) => resetState())
1428
- }, null, 512), [
1429
- [_directive_tooltip, "Reset to initial state"]
1430
- ])
1431
- ]);
1432
- };
1433
- }
1434
- });
1435
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1436
- name: "ControlsComponentPropItem",
1437
- props: {
1438
- variant: null,
1439
- component: null,
1440
- definition: null
1441
- },
1442
- setup(__props) {
1443
- const props = __props;
1444
- const comp = computed(() => {
1445
- var _a;
1446
- switch ((_a = props.definition.types) == null ? void 0 : _a[0]) {
1447
- case "string":
1448
- return HstText;
1449
- case "number":
1450
- return HstNumber;
1451
- case "boolean":
1452
- return HstCheckbox;
1453
- case "object":
1454
- default:
1455
- return HstTextarea;
1456
- }
1457
- });
1458
- const isJSON = computed(() => comp.value === HstTextarea);
1459
- const invalidValue = ref("");
1460
- const model = computed({
1461
- get: () => {
1462
- var _a;
1463
- if (invalidValue.value) {
1464
- return invalidValue.value;
1465
- }
1466
- let val = (_a = props.variant.state._hPropState[props.component.index]) == null ? void 0 : _a[props.definition.name];
1467
- if (val && isJSON.value) {
1468
- val = JSON.stringify(val, null, 2);
1469
- }
1470
- return val;
1471
- },
1472
- set: (value) => {
1473
- invalidValue.value = "";
1474
- if (isJSON.value) {
1475
- try {
1476
- value = JSON.parse(value);
1477
- } catch (e) {
1478
- invalidValue.value = value;
1479
- return;
1480
- }
1481
- }
1482
- if (!props.variant.state._hPropState[props.component.index]) {
1483
- props.variant.state._hPropState[props.component.index] = {};
1484
- }
1485
- props.variant.state._hPropState[props.component.index][props.definition.name] = value;
1486
- }
1487
- });
1488
- function reset() {
1489
- if (props.variant.state._hPropState[props.component.index]) {
1490
- delete props.variant.state._hPropState[props.component.index][props.definition.name];
1491
- }
1492
- }
1493
- const canReset = computed(() => {
1494
- var _a, _b;
1495
- 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];
1496
- });
1497
- return (_ctx, _cache) => {
1498
- const _directive_tooltip = resolveDirective("tooltip");
1499
- return unref(comp) ? (openBlock(), createBlock(resolveDynamicComponent(unref(comp)), {
1500
- key: 0,
1501
- modelValue: unref(model),
1502
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(model) ? model.value = $event : null),
1503
- title: `${__props.definition.name}${unref(canReset) ? " *" : ""}`,
1504
- placeholder: unref(isJSON) ? "Enter JSON" : null
1505
- }, {
1506
- actions: withCtx(() => [
1507
- invalidValue.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
1508
- key: 0,
1509
- icon: "carbon:warning-alt",
1510
- class: "htw-text-orange-500"
1511
- }, null, 512)), [
1512
- [_directive_tooltip, "JSON error"]
1513
- ]) : createCommentVNode("", true),
1514
- withDirectives(createVNode(unref(Icon), {
1515
- icon: "carbon:erase",
1516
- 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", [
1517
- unref(canReset) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
1518
- ]]),
1519
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => reset(), ["stop"]))
1520
- }, null, 8, ["class"]), [
1521
- [_directive_tooltip, "Remove override"]
1522
- ])
1523
- ]),
1524
- _: 1
1525
- }, 8, ["modelValue", "title", "placeholder"])) : createCommentVNode("", true);
1526
- };
1527
- }
1528
- });
1529
- const _hoisted_1$b = { class: "htw-font-mono htw-p-2 htw-flex htw-items-center htw-gap-1" };
1530
- const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, "<", -1);
1531
- const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, ">", -1);
1532
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
1533
- name: "ControlsComponentProps",
1534
- props: {
1535
- variant: null,
1536
- definition: null
1537
- },
1538
- setup(__props) {
1539
- return (_ctx, _cache) => {
1540
- const _directive_tooltip = resolveDirective("tooltip");
1541
- return openBlock(), createElementBlock("div", null, [
1542
- createElementVNode("div", _hoisted_1$b, [
1543
- withDirectives(createVNode(unref(Icon), {
1544
- icon: "carbon:flash",
1545
- class: "htw-w-4 htw-h-4 htw-text-primary-500 htw-flex-none"
1546
- }, null, 512), [
1547
- [_directive_tooltip, "Auto-detected props"]
1548
- ]),
1549
- createElementVNode("div", null, [
1550
- _hoisted_2$b,
1551
- createTextVNode(toDisplayString(__props.definition.name), 1),
1552
- _hoisted_3$5
1553
- ])
1554
- ]),
1555
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.definition.props, (prop) => {
1556
- return openBlock(), createBlock(_sfc_main$c, {
1557
- key: prop.name,
1558
- variant: __props.variant,
1559
- component: __props.definition,
1560
- definition: prop
1561
- }, null, 8, ["variant", "component", "definition"]);
1562
- }), 128))
1563
- ]);
1564
- };
1565
- }
1566
- });
1567
- const _hoisted_1$a = {
1568
- "data-test-id": "story-controls",
1569
- class: "htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-750"
1570
- };
1571
- const _hoisted_2$a = { class: "htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center" };
1572
- const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("span", null, "No controls available for this story", -1);
1573
- const _hoisted_4$2 = { key: 2 };
1574
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
1575
- name: "StoryControls",
1576
- props: {
1577
- variant: {
1578
- type: Object,
1579
- required: true
1580
- },
1581
- story: {
1582
- type: Object,
1583
- required: true
1584
- }
1585
- },
1586
- setup(__props) {
1587
- return (_ctx, _cache) => {
1588
- var _a, _b, _c, _d;
1589
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
1590
- createElementVNode("div", _hoisted_2$a, [
1591
- createVNode(_sfc_main$d, {
1592
- story: __props.story,
1593
- variant: __props.variant
1594
- }, null, 8, ["story", "variant"])
1595
- ]),
1596
- __props.variant.slots().controls || __props.story.slots().controls ? (openBlock(), createBlock(unref(SandboxVue3), {
1597
- key: 0,
1598
- "slot-name": "controls",
1599
- variant: __props.variant,
1600
- story: __props.story,
1601
- class: "htw-flex-none"
1602
- }, null, 8, ["variant", "story"])) : !((_b = (_a = __props.variant.state) == null ? void 0 : _a._hPropDefs) == null ? void 0 : _b.length) ? (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
1603
- default: withCtx(() => [
1604
- createVNode(unref(Icon), {
1605
- icon: "carbon:audio-console",
1606
- class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
1607
- }),
1608
- _hoisted_3$4
1609
- ]),
1610
- _: 1
1611
- })) : createCommentVNode("", true),
1612
- ((_d = (_c = __props.variant.state) == null ? void 0 : _c._hPropDefs) == null ? void 0 : _d.length) ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
1613
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.variant.state._hPropDefs, (def, index) => {
1614
- return openBlock(), createBlock(_sfc_main$b, {
1615
- key: index,
1616
- variant: __props.variant,
1617
- definition: def,
1618
- class: "htw-flex-none htw-my-2"
1619
- }, null, 8, ["variant", "definition"]);
1620
- }), 128))
1621
- ])) : createCommentVNode("", true)
1622
- ]);
1623
- };
1624
- }
1625
- });
1626
- const _hoisted_1$9 = /* @__PURE__ */ createTextVNode(" No documentation available ");
1627
- const _hoisted_2$9 = ["innerHTML"];
1628
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1629
- name: "StoryDocs",
1630
- props: {
1631
- story: {
1632
- type: Object,
1633
- required: true
1634
- }
1635
- },
1636
- setup(__props) {
1637
- const props = __props;
1638
- const renderedDoc = ref("");
1639
- watchEffect(async () => {
1640
- var _a;
1641
- let comp = (_a = props.story.file) == null ? void 0 : _a.component;
1642
- if (comp.__asyncResolved) {
1643
- comp = comp.__asyncResolved;
1644
- } else if (comp.__asyncLoader) {
1645
- comp = await comp.__asyncLoader();
1646
- }
1647
- renderedDoc.value = comp.doc;
1648
- });
1649
- return (_ctx, _cache) => {
1650
- return openBlock(), createElementBlock("div", null, [
1651
- !renderedDoc.value ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
1652
- default: withCtx(() => [
1653
- createVNode(unref(Icon), {
1654
- icon: "carbon:document-unknown",
1655
- class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
1656
- }),
1657
- _hoisted_1$9
1658
- ]),
1659
- _: 1
1660
- })) : (openBlock(), createElementBlock("div", {
1661
- key: 1,
1662
- class: "htw-prose dark:htw-prose-invert htw-p-4 htw-max-w-none",
1663
- "data-test-id": "story-docs",
1664
- innerHTML: renderedDoc.value
1665
- }, null, 8, _hoisted_2$9))
1666
- ]);
1667
- };
1668
- }
1669
- });
1670
- const _hoisted_1$8 = {
1671
- key: 0,
1672
- class: "htw-text-xs htw-opacity-50 htw-truncate"
1673
- };
1674
- const _hoisted_2$8 = { class: "htw-overflow-auto htw-max-w-[400px] htw-max-h-[400px]" };
1675
- const _hoisted_3$3 = { class: "htw-p-4" };
1676
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1677
- name: "StoryEvent",
1678
- props: {
1679
- event: null
1680
- },
1681
- setup(__props) {
1682
- const props = __props;
1683
- const formattedArgument = computed(() => {
1684
- switch (typeof props.event.argument) {
1685
- case "string":
1686
- return `"${props.event.argument}"`;
1687
- case "object":
1688
- return `{ ${Object.keys(props.event.argument).map((key) => `${key}: ${props.event.argument[key]}`).join(", ")} }`;
1689
- default:
1690
- return props.event.argument;
1691
- }
1692
- });
1693
- return (_ctx, _cache) => {
1694
- const _component_VDropdown = resolveComponent("VDropdown");
1695
- return openBlock(), createBlock(_component_VDropdown, {
1696
- class: "htw-group",
1697
- placement: "right",
1698
- "data-test-id": "event-item"
1699
- }, {
1700
- default: withCtx(({ shown }) => [
1701
- createElementVNode("div", {
1702
- class: normalizeClass(["group-hover:htw-bg-primary-100 dark:group-hover:htw-bg-primary-700 htw-cursor-pointer htw-py-2 htw-px-4 htw-flex htw-items-baseline htw-gap-1 htw-leading-normal", [
1703
- shown ? "htw-bg-primary-50 dark:htw-bg-primary-600" : "group-odd:htw-bg-gray-100/50 dark:group-odd:htw-bg-gray-750/40"
1704
- ]])
1705
- }, [
1706
- createElementVNode("span", {
1707
- class: normalizeClass({
1708
- "htw-text-primary-500": shown
1709
- })
1710
- }, toDisplayString(__props.event.name), 3),
1711
- __props.event.argument ? (openBlock(), createElementBlock("span", _hoisted_1$8, toDisplayString(unref(formattedArgument)), 1)) : createCommentVNode("", true)
1712
- ], 2)
1713
- ]),
1714
- popper: withCtx(() => [
1715
- createElementVNode("div", _hoisted_2$8, [
1716
- createElementVNode("pre", _hoisted_3$3, toDisplayString(__props.event.argument), 1)
1717
- ])
1718
- ]),
1719
- _: 1
1720
- });
1721
- };
1722
- }
1723
- });
1724
- const _hoisted_1$7 = /* @__PURE__ */ createTextVNode(" No event fired ");
1725
- const _hoisted_2$7 = { key: 1 };
1726
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1727
- name: "StoryEvents",
1728
- setup(__props) {
1729
- const eventsStore = useEventsStore();
1730
- const hasEvents = computed(() => eventsStore.events.length);
1731
- onMounted(resetUnseen);
1732
- watch(() => eventsStore.unseen, resetUnseen);
1733
- async function resetUnseen() {
1734
- if (eventsStore.unseen > 0) {
1735
- eventsStore.unseen = 0;
1736
- }
1737
- await nextTick();
1738
- eventsElement.value.scrollTo({ top: eventsElement.value.scrollHeight });
1739
- }
1740
- const eventsElement = ref();
1741
- return (_ctx, _cache) => {
1742
- return openBlock(), createElementBlock("div", {
1743
- ref_key: "eventsElement",
1744
- ref: eventsElement
1745
- }, [
1746
- !unref(hasEvents) ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
1747
- default: withCtx(() => [
1748
- createVNode(unref(Icon), {
1749
- icon: "carbon:event-schedule",
1750
- class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
1751
- }),
1752
- _hoisted_1$7
1753
- ]),
1754
- _: 1
1755
- })) : (openBlock(), createElementBlock("div", _hoisted_2$7, [
1756
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(eventsStore).events, (event, key) => {
1757
- return openBlock(), createBlock(_sfc_main$8, {
1758
- key,
1759
- event
1760
- }, null, 8, ["event"]);
1761
- }), 128))
1762
- ]))
1763
- ], 512);
1764
- };
1765
- }
1766
- });
1767
- var StorySourceCode_vue_vue_type_style_index_0_scoped_true_lang = "";
1768
- const _withScopeId = (n) => (pushScopeId("data-v-8b318638"), n = n(), popScopeId(), n);
1769
- 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" };
1770
- const _hoisted_2$6 = {
1771
- key: 0,
1772
- class: "htw-h-10 htw-flex-none htw-border-b htw-border-solid htw-border-gray-150 dark:htw-border-gray-850 htw-px-4 htw-flex htw-items-center"
1773
- };
1774
- const _hoisted_3$2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "htw-text-gray-900 dark:htw-text-gray-100" }, " Source ", -1));
1775
- const _hoisted_4$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "htw-flex-1" }, null, -1));
1776
- const _hoisted_5$1 = {
1777
- key: 1,
1778
- class: "htw-text-red-500 htw-h-full htw-p-2 htw-overflow-auto htw-font-mono htw-text-sm"
1779
- };
1780
- const _hoisted_6$1 = ["value"];
1781
- const _hoisted_7$1 = {
1782
- key: 3,
1783
- class: "htw-w-full htw-h-full htw-overflow-auto",
1784
- "data-test-id": "story-source-code"
1785
- };
1786
- const _hoisted_8$1 = ["innerHTML"];
1787
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1788
- name: "StorySourceCode",
1789
- props: {
1790
- variant: {
1791
- type: Object,
1792
- required: true
1793
- }
1794
- },
1795
- setup(__props) {
1796
- const props = __props;
1797
- const sourceCode = ref("");
1798
- const highlighter = shallowRef();
1799
- const error = ref(null);
1800
- onMounted(async () => {
1801
- setCDN("https://unpkg.com/shiki/");
1802
- highlighter.value = await getHighlighter({
1803
- langs: [
1804
- "html",
1805
- "jsx"
1806
- ],
1807
- themes: [
1808
- "github-light",
1809
- "github-dark"
1810
- ]
1811
- });
1812
- });
1813
- watch(() => props.variant, async (value) => {
1814
- var _a, _b;
1815
- error.value = null;
1816
- try {
1817
- if (value.source) {
1818
- sourceCode.value = value.source;
1819
- } else if ((_a = value.slots) == null ? void 0 : _a.call(value).source) {
1820
- const source = (_b = value.slots) == null ? void 0 : _b.call(value).source()[0].children;
1821
- if (source) {
1822
- sourceCode.value = await unindent(source);
1823
- }
1824
- } else {
1825
- sourceCode.value = await generateSourceCode(value);
1826
- }
1827
- } catch (e) {
1828
- console.error(e);
1829
- error.value = e.message;
1830
- }
1831
- }, {
1832
- deep: true,
1833
- immediate: true
1834
- });
1835
- const sourceHtml = computed(() => {
1836
- var _a;
1837
- return (_a = highlighter.value) == null ? void 0 : _a.codeToHtml(sourceCode.value, {
1838
- lang: "html",
1839
- theme: isDark.value ? "github-dark" : "github-light"
1840
- });
1841
- });
1842
- return (_ctx, _cache) => {
1843
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
1844
- !error.value ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
1845
- _hoisted_3$2,
1846
- _hoisted_4$1,
1847
- createVNode(unref(HstCopyIcon), {
1848
- content: sourceCode.value,
1849
- class: "htw-flex-none"
1850
- }, null, 8, ["content"])
1851
- ])) : createCommentVNode("", true),
1852
- error.value ? (openBlock(), createElementBlock("div", _hoisted_5$1, " Error: " + toDisplayString(error.value), 1)) : !unref(sourceHtml) ? (openBlock(), createElementBlock("textarea", {
1853
- key: 2,
1854
- class: "__histoire-code-placeholder htw-w-full htw-h-full htw-p-4 htw-outline-none htw-bg-transparent htw-resize-none htw-m-0",
1855
- value: sourceCode.value,
1856
- readonly: "",
1857
- "data-test-id": "story-source-code"
1858
- }, null, 8, _hoisted_6$1)) : (openBlock(), createElementBlock("div", _hoisted_7$1, [
1859
- createElementVNode("div", {
1860
- class: "__histoire-code htw-p-4 htw-w-fit",
1861
- innerHTML: unref(sourceHtml)
1862
- }, null, 8, _hoisted_8$1)
1863
- ]))
1864
- ]);
1865
- };
1866
- }
1867
- });
1868
- var StorySourceCode = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-8b318638"]]);
1869
- const _sfc_main$5 = defineComponent({
1870
- inheritAttrs: false,
1871
- props: {
1872
- exact: {
1873
- type: Boolean,
1874
- default: false
1875
- },
1876
- matched: {
1877
- type: Boolean,
1878
- default: null
1879
- }
1880
- }
1881
- });
1882
- const _hoisted_1$5 = ["href", "onClick"];
1883
- const _hoisted_2$5 = {
1884
- key: 0,
1885
- class: "htw-absolute htw-bottom-0 htw-left-0 htw-w-full htw-h-[2px] htw-bg-primary-500 dark:htw-bg-primary-400"
1886
- };
1887
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1888
- const _component_router_link = resolveComponent("router-link");
1889
- return openBlock(), createBlock(_component_router_link, mergeProps(_ctx.$attrs, { custom: "" }), {
1890
- default: withCtx(({ isActive, isExactActive, href, navigate }) => [
1891
- createElementVNode("a", mergeProps(_ctx.$attrs, {
1892
- href,
1893
- class: ["htw-px-4 htw-h-full htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative htw-text-gray-900 dark:htw-text-gray-100", {
1894
- "htw-text-primary-500 dark:htw-text-primary-400": _ctx.matched != null ? _ctx.matched : _ctx.exact && isExactActive || !_ctx.exact && isActive
1895
- }],
1896
- onClick: navigate
1897
- }), [
1898
- renderSlot(_ctx.$slots, "default"),
1899
- createVNode(Transition, { name: "__histoire-scale-x" }, {
1900
- default: withCtx(() => [
1901
- (_ctx.matched != null ? _ctx.matched : _ctx.exact && isExactActive || !_ctx.exact && isActive) ? (openBlock(), createElementBlock("div", _hoisted_2$5)) : createCommentVNode("", true)
1902
- ]),
1903
- _: 2
1904
- }, 1024)
1905
- ], 16, _hoisted_1$5)
1906
- ]),
1907
- _: 3
1908
- }, 16);
1909
- }
1910
- var BaseTab = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]);
1911
- const _hoisted_1$4 = {
1912
- role: "button",
1913
- class: "htw-cursor-pointer hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-w-8 htw-h-full htw-flex htw-items-center htw-justify-center htw-absolute htw-top-0 htw-right-0"
1914
- };
1915
- const _hoisted_2$4 = { class: "htw-flex htw-flex-col htw-items-stretch" };
1916
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1917
- name: "BaseOverflowMenu",
1918
- setup(__props) {
1919
- const overflowButtonWidth = 32;
1920
- const el = ref();
1921
- const availableWidth = ref(0);
1922
- useResizeObserver(el, (entries) => {
1923
- const containerWidth = entries[0].contentRect.width;
1924
- availableWidth.value = containerWidth - overflowButtonWidth;
1925
- });
1926
- const children = ref(/* @__PURE__ */ new Map());
1927
- const visibleChildrenCount = computed(() => {
1928
- let width = 0;
1929
- const c = [...children.value.values()].sort((a, b) => a.index - b.index);
1930
- for (let i = 0; i < c.length; i++) {
1931
- width += c[i].width;
1932
- if (width > availableWidth.value) {
1933
- return i;
1934
- }
1935
- }
1936
- return c.length;
1937
- });
1938
- const ChildWrapper = {
1939
- props: ["index"],
1940
- setup(props, { slots }) {
1941
- const el2 = ref();
1942
- const state = reactive({ width: 0, index: props.index });
1943
- useResizeObserver(el2, (entries) => {
1944
- const width = entries[0].contentRect.width;
1945
- if (!children.value.has(el2.value)) {
1946
- children.value.set(el2.value, state);
1947
- }
1948
- state.width = width;
1949
- });
1950
- onBeforeUnmount(() => {
1951
- children.value.delete(el2.value);
1952
- });
1953
- const visible = computed(() => visibleChildrenCount.value > state.index);
1954
- return () => h("div", { ref: el2, style: { visibility: visible.value ? "visible" : "hidden" } }, slots.default());
1955
- }
1956
- };
1957
- const ChildrenRender = (props, { slots }) => {
1958
- const [fragment] = slots.default();
1959
- return fragment.children.map((vnode, index) => h(ChildWrapper, { index }, () => [vnode]));
1960
- };
1961
- const ChildrenSlice = (props, { slots }) => {
1962
- const [fragment] = slots.default();
1963
- return fragment.children.slice(props.start, props.end);
1964
- };
1965
- return (_ctx, _cache) => {
1966
- const _component_VDropdown = resolveComponent("VDropdown");
1967
- return openBlock(), createElementBlock("div", {
1968
- ref_key: "el",
1969
- ref: el,
1970
- class: "htw-flex htw-overflow-hidden htw-relative"
1971
- }, [
1972
- createVNode(ChildrenRender, null, {
1973
- default: withCtx(() => [
1974
- renderSlot(_ctx.$slots, "default")
1975
- ]),
1976
- _: 3
1977
- }),
1978
- unref(visibleChildrenCount) < children.value.size ? (openBlock(), createBlock(_component_VDropdown, { key: 0 }, {
1979
- popper: withCtx(() => [
1980
- createElementVNode("div", _hoisted_2$4, [
1981
- createVNode(ChildrenSlice, { start: unref(visibleChildrenCount) }, {
1982
- default: withCtx(() => [
1983
- renderSlot(_ctx.$slots, "overflow")
1984
- ]),
1985
- _: 3
1986
- }, 8, ["start"])
1987
- ])
1988
- ]),
1989
- default: withCtx(() => [
1990
- createElementVNode("div", _hoisted_1$4, [
1991
- createVNode(unref(Icon), {
1992
- icon: "carbon:caret-down",
1993
- class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
1994
- })
1995
- ])
1996
- ]),
1997
- _: 3
1998
- })) : createCommentVNode("", true)
1999
- ], 512);
2000
- };
2001
- }
2002
- });
2003
- const _sfc_main$3 = defineComponent({
2004
- inheritAttrs: false,
2005
- props: {
2006
- exact: {
2007
- type: Boolean,
2008
- default: false
2009
- },
2010
- matched: {
2011
- type: Boolean,
2012
- default: null
2013
- }
2014
- }
2015
- });
2016
- const _hoisted_1$3 = ["href", "onClick"];
2017
- const _hoisted_2$3 = {
2018
- key: 0,
2019
- class: "htw-absolute htw-top-0 htw-left-0 htw-h-full htw-w-[2px] htw-bg-primary-500 dark:htw-bg-primary-400"
2020
- };
2021
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2022
- const _component_router_link = resolveComponent("router-link");
2023
- return openBlock(), createBlock(_component_router_link, mergeProps(_ctx.$attrs, { custom: "" }), {
2024
- default: withCtx(({ isActive, isExactActive, href, navigate }) => [
2025
- createElementVNode("a", mergeProps(_ctx.$attrs, {
2026
- href,
2027
- class: ["htw-px-4 htw-h-10 htw-min-w-[150px] htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative htw-text-gray-900 dark:htw-text-gray-100", {
2028
- "htw-text-primary-500 dark:htw-text-primary-400": _ctx.matched != null ? _ctx.matched : _ctx.exact && isExactActive || !_ctx.exact && isActive
2029
- }],
2030
- onClick: navigate
2031
- }), [
2032
- renderSlot(_ctx.$slots, "default"),
2033
- createVNode(Transition, { name: "__histoire-scale-y" }, {
2034
- default: withCtx(() => [
2035
- (_ctx.matched != null ? _ctx.matched : _ctx.exact && isExactActive || !_ctx.exact && isActive) ? (openBlock(), createElementBlock("div", _hoisted_2$3)) : createCommentVNode("", true)
2036
- ]),
2037
- _: 2
2038
- }, 1024)
2039
- ], 16, _hoisted_1$3)
2040
- ]),
2041
- _: 3
2042
- }, 16);
2043
- }
2044
- var BaseOverflowTab = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
2045
- const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" Controls ");
2046
- const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" Docs ");
2047
- const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" Events ");
2048
- const _hoisted_4 = {
2049
- key: 0,
2050
- 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"
2051
- };
2052
- const _hoisted_5 = /* @__PURE__ */ createTextVNode(" Controls ");
2053
- const _hoisted_6 = /* @__PURE__ */ createTextVNode(" Docs ");
2054
- const _hoisted_7 = /* @__PURE__ */ createTextVNode(" Events ");
2055
- const _hoisted_8 = {
2056
- key: 0,
2057
- 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"
2058
- };
2059
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2060
- name: "PaneTabs",
2061
- setup(__props) {
2062
- const eventsStore = useEventsStore();
2063
- return (_ctx, _cache) => {
2064
- return openBlock(), createBlock(_sfc_main$4, { class: "htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750" }, {
2065
- overflow: withCtx(() => [
2066
- createVNode(BaseOverflowTab, {
2067
- to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "" }) }),
2068
- matched: !_ctx.$route.query.tab
2069
- }, {
2070
- default: withCtx(() => [
2071
- _hoisted_5
2072
- ]),
2073
- _: 1
2074
- }, 8, ["to", "matched"]),
2075
- createVNode(BaseOverflowTab, {
2076
- to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "docs" }) }),
2077
- matched: _ctx.$route.query.tab === "docs"
2078
- }, {
2079
- default: withCtx(() => [
2080
- _hoisted_6
2081
- ]),
2082
- _: 1
2083
- }, 8, ["to", "matched"]),
2084
- createVNode(BaseOverflowTab, {
2085
- to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "events" }) }),
2086
- matched: _ctx.$route.query.tab === "events"
2087
- }, {
2088
- default: withCtx(() => [
2089
- _hoisted_7,
2090
- unref(eventsStore).unseen ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)) : createCommentVNode("", true)
2091
- ]),
2092
- _: 1
2093
- }, 8, ["to", "matched"])
2094
- ]),
2095
- default: withCtx(() => [
2096
- createVNode(BaseTab, {
2097
- to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "" }) }),
2098
- matched: !_ctx.$route.query.tab
2099
- }, {
2100
- default: withCtx(() => [
2101
- _hoisted_1$2
2102
- ]),
2103
- _: 1
2104
- }, 8, ["to", "matched"]),
2105
- createVNode(BaseTab, {
2106
- to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "docs" }) }),
2107
- matched: _ctx.$route.query.tab === "docs"
2108
- }, {
2109
- default: withCtx(() => [
2110
- _hoisted_2$2
2111
- ]),
2112
- _: 1
2113
- }, 8, ["to", "matched"]),
2114
- createVNode(BaseTab, {
2115
- to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "events" }) }),
2116
- matched: _ctx.$route.query.tab === "events"
2117
- }, {
2118
- default: withCtx(() => [
2119
- _hoisted_3$1,
2120
- unref(eventsStore).unseen ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)) : createCommentVNode("", true)
2121
- ]),
2122
- _: 1
2123
- }, 8, ["to", "matched"])
2124
- ]),
2125
- _: 1
2126
- });
2127
- };
2128
- }
2129
- });
2130
- const _hoisted_1$1 = /* @__PURE__ */ createElementVNode("span", null, "Select a variant", -1);
2131
- const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", null, "Loading...", -1);
2132
- const _hoisted_3 = { class: "htw-flex htw-flex-col htw-h-full" };
2133
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2134
- name: "StorySidePanel",
2135
- setup(__props) {
2136
- const storyStore = useStoryStore();
2137
- const route = useRoute();
2138
- const panelContentComponent = computed(() => {
2139
- switch (route.query.tab) {
2140
- case "docs":
2141
- return _sfc_main$9;
2142
- case "events":
2143
- return _sfc_main$7;
2144
- default:
2145
- return _sfc_main$a;
2146
- }
2147
- });
2148
- return (_ctx, _cache) => {
2149
- return !unref(storyStore).currentVariant ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
2150
- default: withCtx(() => [
2151
- _hoisted_1$1
2152
- ]),
2153
- _: 1
2154
- })) : !unref(storyStore).currentVariant.previewReady ? (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
2155
- default: withCtx(() => [
2156
- _hoisted_2$1
2157
- ]),
2158
- _: 1
2159
- })) : (openBlock(), createBlock(BaseSplitPane, {
2160
- key: 2,
2161
- "save-id": "story-sidepane",
2162
- orientation: "portrait",
2163
- class: "htw-h-full",
2164
- "data-test-id": "story-side-panel"
2165
- }, {
2166
- first: withCtx(() => [
2167
- createElementVNode("div", _hoisted_3, [
2168
- createVNode(_sfc_main$2),
2169
- (openBlock(), createBlock(resolveDynamicComponent(unref(panelContentComponent)), {
2170
- story: unref(storyStore).currentStory,
2171
- variant: unref(storyStore).currentVariant,
2172
- class: "htw-h-full htw-overflow-auto"
2173
- }, null, 8, ["story", "variant"]))
2174
- ])
2175
- ]),
2176
- last: withCtx(() => [
2177
- createVNode(StorySourceCode, {
2178
- variant: unref(storyStore).currentVariant,
2179
- class: "htw-h-full"
2180
- }, null, 8, ["variant"])
2181
- ]),
2182
- _: 1
2183
- }));
2184
- };
2185
- }
2186
- });
2187
- const _hoisted_1 = {
2188
- key: 1,
2189
- class: "htw-h-full"
2190
- };
2191
- const _hoisted_2 = {
2192
- key: 0,
2193
- class: "htw-h-full htw-overflow-auto"
2194
- };
2195
- const _sfc_main = /* @__PURE__ */ defineComponent({
2196
- name: "StoryView",
2197
- setup(__props) {
2198
- const storyStore = useStoryStore();
2199
- const router = useRouter();
2200
- const route = useRoute();
2201
- watch(() => storyStore.currentVariant, (value) => {
2202
- if (value) {
2203
- storyStore.currentStory.lastSelectedVariant = value;
2204
- }
2205
- }, {
2206
- immediate: true
2207
- });
2208
- watch(() => [storyStore.currentStory, storyStore.currentVariant], () => {
2209
- var _a, _b;
2210
- if (!storyStore.currentVariant) {
2211
- if ((_a = storyStore.currentStory) == null ? void 0 : _a.lastSelectedVariant) {
2212
- setVariant(storyStore.currentStory.lastSelectedVariant.id);
2213
- return;
2214
- }
2215
- if (((_b = storyStore.currentStory) == null ? void 0 : _b.variants.length) === 1) {
2216
- setVariant(storyStore.currentStory.variants[0].id);
2217
- }
2218
- }
2219
- }, {
2220
- immediate: true
2221
- });
2222
- function setVariant(variantId) {
2223
- router.replace(__spreadProps(__spreadValues({}, route), {
2224
- query: __spreadProps(__spreadValues({}, route.query), {
2225
- variantId
2226
- })
2227
- }));
2228
- }
2229
- return (_ctx, _cache) => {
2230
- return !unref(storyStore).currentStory ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
2231
- default: withCtx(() => [
2232
- createVNode(unref(Icon), {
2233
- icon: "carbon:software-resource-resource",
2234
- class: "htw-w-16 htw-h-16 htw-opacity-50"
2235
- })
2236
- ]),
2237
- _: 1
2238
- })) : (openBlock(), createElementBlock("div", _hoisted_1, [
2239
- unref(storyStore).currentStory.docsOnly ? (openBlock(), createElementBlock("div", _hoisted_2, [
2240
- createVNode(_sfc_main$9, {
2241
- story: unref(storyStore).currentStory,
2242
- class: "md:htw-p-12 htw-w-full md:htw-max-w-[600px] lg:htw-max-w-[800px] xl:htw-max-w-[900px]"
2243
- }, null, 8, ["story"])
2244
- ])) : unref(isMobile) ? (openBlock(), createBlock(StoryViewer, { key: 1 })) : (openBlock(), createBlock(BaseSplitPane, {
2245
- key: 2,
2246
- "save-id": "story-main",
2247
- min: 30,
2248
- max: 95,
2249
- "default-split": 75,
2250
- class: "htw-h-full"
2251
- }, {
2252
- first: withCtx(() => [
2253
- createVNode(StoryViewer)
2254
- ]),
2255
- last: withCtx(() => [
2256
- createVNode(_sfc_main$1)
2257
- ]),
2258
- _: 1
2259
- }))
2260
- ]));
2261
- };
2262
- }
2263
- });
2264
- export { _sfc_main as default };