histoire 0.4.5 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +2 -0
- package/dist/bundled/HomeView.js +1 -0
- package/dist/bundled/MobileOverlay.js +3 -1
- package/dist/bundled/SandboxVue3.js +649 -0
- package/dist/bundled/SearchPane.js +2 -0
- package/dist/bundled/StoryView.js +551 -622
- package/dist/bundled/global-components.js +5 -5
- package/dist/bundled/index2.js +111 -43
- package/dist/bundled/sandbox.js +3 -11
- package/dist/bundled/state.js +55 -0
- package/dist/client/app/App.vue +18 -0
- package/dist/client/app/codegen/serialize-js.js +1 -1
- package/dist/client/app/codegen/vue3.d.ts +2 -0
- package/dist/client/app/codegen/vue3.js +37 -12
- package/dist/client/app/components/app/InitialLoading.vue +46 -0
- package/dist/client/app/components/app/MobileOverlay.vue +1 -1
- package/dist/client/app/components/base/BaseSelect.vue +72 -0
- package/dist/client/app/components/exposed/Story.vue +2 -1
- package/dist/client/app/components/exposed/Variant.vue +4 -4
- package/dist/client/app/components/panel/ControlsComponentPropItem.vue +96 -0
- package/dist/client/app/components/panel/ControlsComponentProps.vue +33 -0
- package/dist/client/app/components/panel/StatePresets.vue +195 -0
- package/dist/client/app/components/panel/StoryControls.vue +31 -2
- package/dist/client/app/components/sandbox/SandboxVue3.vue +70 -2
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +2 -14
- package/dist/client/app/sandbox.js +2 -11
- package/dist/client/app/style/transitions.pcss +12 -0
- package/dist/client/app/types.d.ts +19 -7
- package/dist/client/app/util/state.d.ts +5 -0
- package/dist/client/app/util/state.js +55 -0
- package/dist/client/app/util/variant.d.ts +1 -1
- package/dist/node/build.js +1 -3
- package/dist/node/collect/index.js +6 -0
- package/dist/node/config.d.ts +23 -23
- package/dist/node/plugin.d.ts +2 -2
- package/dist/node/server.js +16 -5
- package/dist/style.css +162 -50
- package/index.d.ts +3 -0
- package/package.json +4 -4
- package/src/client/app/App.vue +18 -0
- package/src/client/app/codegen/serialize-js.ts +1 -1
- package/src/client/app/codegen/vue3.ts +40 -12
- package/src/client/app/components/app/InitialLoading.vue +46 -0
- package/src/client/app/components/app/MobileOverlay.vue +1 -1
- package/src/client/app/components/base/BaseSelect.vue +72 -0
- package/src/client/app/components/exposed/Story.vue +2 -1
- package/src/client/app/components/exposed/Variant.vue +4 -4
- package/src/client/app/components/panel/ControlsComponentPropItem.vue +96 -0
- package/src/client/app/components/panel/ControlsComponentProps.vue +33 -0
- package/src/client/app/components/panel/StatePresets.vue +195 -0
- package/src/client/app/components/panel/StoryControls.vue +31 -2
- package/src/client/app/components/sandbox/SandboxVue3.vue +70 -2
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +2 -14
- package/src/client/app/sandbox.ts +2 -10
- package/src/client/app/style/transitions.pcss +12 -0
- package/src/client/app/types.ts +22 -7
- package/src/client/app/util/state.ts +61 -0
- package/src/client/app/util/variant.ts +1 -1
- package/src/components.d.ts +135 -0
- package/src/node/build.ts +1 -3
- package/src/node/collect/index.ts +7 -0
- package/src/node/server.ts +20 -5
- package/dist/bundled/dark.js +0 -4
- package/dist/bundled/reactivity.js +0 -96
- package/dist/client/app/util/reactivity.d.ts +0 -1
- package/dist/client/app/util/reactivity.js +0 -16
- package/src/client/app/util/reactivity.ts +0 -22
|
@@ -17,22 +17,22 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { computed, pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, openBlock, createElementBlock, createVNode, withCtx, normalizeClass, createElementVNode, toDisplayString, resolveComponent, withModifiers, watch, normalizeStyle, Fragment, renderList, createBlock, withKeys, renderSlot, createTextVNode, resolveDirective, withDirectives, vModelText, createCommentVNode, createStaticVNode, onUnmounted, toRaw,
|
|
20
|
+
import { computed, pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, openBlock, createElementBlock, createVNode, withCtx, normalizeClass, createElementVNode, toDisplayString, resolveComponent, withModifiers, watch, normalizeStyle, Fragment, renderList, createBlock, withKeys, renderSlot, createTextVNode, resolveDirective, withDirectives, vModelText, createCommentVNode, createStaticVNode, onUnmounted, toRaw, mergeProps, onMounted, nextTick, isRef, resolveDynamicComponent, watchEffect, shallowRef, Transition, reactive, onBeforeUnmount, h } from "vue";
|
|
21
21
|
import { useRoute, useRouter } from "vue-router";
|
|
22
22
|
import { Icon } from "@iconify/vue";
|
|
23
23
|
import { u as useStoryStore, b as base } from "./story.js";
|
|
24
|
-
import { u as useScrollOnActive, B as BaseListItemLink, _ as _export_sfc, i as isMobile, b as BaseSplitPane, a as _sfc_main$
|
|
24
|
+
import { u as useScrollOnActive, B as BaseListItemLink, _ as _export_sfc, i as isMobile, b as BaseSplitPane, a as _sfc_main$w } from "./MobileOverlay.js";
|
|
25
25
|
import { B as BaseEmpty } from "./BaseEmpty.js";
|
|
26
|
-
import { useResizeObserver, useStorage, useEventListener } from "@vueuse/core";
|
|
27
|
-
import { _ as _sfc_main$
|
|
26
|
+
import { useResizeObserver, useStorage, useEventListener, useTimeoutFn, onClickOutside } from "@vueuse/core";
|
|
27
|
+
import { _ as _sfc_main$v, u as unindent, g as generateSourceCode } from "./SandboxVue3.js";
|
|
28
28
|
import { defineStore } from "pinia";
|
|
29
29
|
import { h as histoireConfig } from "./config.js";
|
|
30
30
|
import { S as STATE_SYNC, a as SANDBOX_READY, E as EVENT_SEND, P as PREVIEW_SETTINGS_SYNC } from "./const.js";
|
|
31
31
|
import { useEventsStore } from "./events.js";
|
|
32
|
+
import { b as toRawDeep, a as applyStateToVariant, c as clone, o as omit, i as isDark } from "./state.js";
|
|
33
|
+
import { Dropdown } from "floating-vue";
|
|
32
34
|
import { setCDN, getHighlighter } from "shiki";
|
|
33
35
|
import { HstCopyIcon } from "@histoire/controls";
|
|
34
|
-
import { pascal } from "case";
|
|
35
|
-
import { i as isDark } from "./dark.js";
|
|
36
36
|
function useCurrentVariantRoute(variant) {
|
|
37
37
|
const route = useRoute();
|
|
38
38
|
const isActive = computed(() => route.query.variantId === variant.value.id);
|
|
@@ -48,8 +48,9 @@ function useCurrentVariantRoute(variant) {
|
|
|
48
48
|
}
|
|
49
49
|
var StoryVariantListItem_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
50
50
|
const _withScopeId$7 = (n) => (pushScopeId("data-v-2cdc2ac0"), n = n(), popScopeId(), n);
|
|
51
|
-
const _hoisted_1$
|
|
52
|
-
const _sfc_main$
|
|
51
|
+
const _hoisted_1$r = { class: "htw-truncate" };
|
|
52
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
53
|
+
name: "StoryVariantListItem",
|
|
53
54
|
props: {
|
|
54
55
|
variant: {
|
|
55
56
|
type: Object,
|
|
@@ -86,7 +87,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
86
87
|
"bind-icon-color": !active && unref(variant).iconColor
|
|
87
88
|
}])
|
|
88
89
|
}, null, 8, ["icon", "class"]),
|
|
89
|
-
createElementVNode("span", _hoisted_1$
|
|
90
|
+
createElementVNode("span", _hoisted_1$r, toDisplayString(unref(variant).title), 1)
|
|
90
91
|
];
|
|
91
92
|
}),
|
|
92
93
|
_: 1
|
|
@@ -95,11 +96,12 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
95
96
|
};
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
|
-
var StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
99
|
+
var StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-2cdc2ac0"]]);
|
|
99
100
|
var StoryVariantGridItem_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
100
101
|
const _withScopeId$6 = (n) => (pushScopeId("data-v-5c057bcc"), n = n(), popScopeId(), n);
|
|
101
|
-
const _hoisted_1$
|
|
102
|
-
const _sfc_main$
|
|
102
|
+
const _hoisted_1$q = { class: "htw-flex-none htw-flex htw-items-center" };
|
|
103
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
104
|
+
name: "StoryVariantGridItem",
|
|
103
105
|
props: {
|
|
104
106
|
variant: {
|
|
105
107
|
type: Object,
|
|
@@ -149,7 +151,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
149
151
|
ref: el,
|
|
150
152
|
class: "htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
|
|
151
153
|
}, [
|
|
152
|
-
createElementVNode("div", _hoisted_1$
|
|
154
|
+
createElementVNode("div", _hoisted_1$q, [
|
|
153
155
|
createVNode(_component_RouterLink, {
|
|
154
156
|
to: unref(targetRoute),
|
|
155
157
|
class: normalizeClass(["htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1", {
|
|
@@ -181,7 +183,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
181
183
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop", "prevent"])),
|
|
182
184
|
onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
|
|
183
185
|
}, [
|
|
184
|
-
createVNode(_sfc_main$
|
|
186
|
+
createVNode(_sfc_main$v, {
|
|
185
187
|
variant: unref(variant),
|
|
186
188
|
story: __props.story,
|
|
187
189
|
onReady
|
|
@@ -191,8 +193,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
191
193
|
};
|
|
192
194
|
}
|
|
193
195
|
});
|
|
194
|
-
var StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
195
|
-
const _sfc_main$
|
|
196
|
+
var StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-5c057bcc"]]);
|
|
197
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
198
|
+
name: "StoryVariantGrid",
|
|
196
199
|
setup(__props) {
|
|
197
200
|
const storyStore = useStoryStore();
|
|
198
201
|
const gridTemplateWidth = computed(() => {
|
|
@@ -280,15 +283,16 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
280
283
|
};
|
|
281
284
|
}
|
|
282
285
|
});
|
|
283
|
-
const _hoisted_1$
|
|
284
|
-
const _sfc_main$
|
|
286
|
+
const _hoisted_1$p = { class: "htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0" };
|
|
287
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
288
|
+
name: "StoryVariantTitle",
|
|
285
289
|
props: {
|
|
286
290
|
variant: null
|
|
287
291
|
},
|
|
288
292
|
setup(__props) {
|
|
289
293
|
return (_ctx, _cache) => {
|
|
290
294
|
var _a;
|
|
291
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
295
|
+
return openBlock(), createElementBlock("div", _hoisted_1$p, [
|
|
292
296
|
createVNode(unref(Icon), {
|
|
293
297
|
icon: (_a = __props.variant.icon) != null ? _a : "carbon:cube",
|
|
294
298
|
class: normalizeClass(["base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50", [
|
|
@@ -312,15 +316,16 @@ const usePreviewSettingsStore = defineStore("preview-settings", () => {
|
|
|
312
316
|
currentSettings
|
|
313
317
|
};
|
|
314
318
|
});
|
|
315
|
-
const _hoisted_1$
|
|
316
|
-
const _hoisted_2$
|
|
319
|
+
const _hoisted_1$o = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
|
|
320
|
+
const _hoisted_2$k = {
|
|
317
321
|
width: "16",
|
|
318
322
|
height: "16",
|
|
319
323
|
viewBox: "0 0 24 24",
|
|
320
324
|
class: "htw-relative htw-z-10"
|
|
321
325
|
};
|
|
322
|
-
const _hoisted_3$
|
|
323
|
-
const _sfc_main$
|
|
326
|
+
const _hoisted_3$d = ["stroke-dasharray", "stroke-dashoffset"];
|
|
327
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
328
|
+
name: "BaseCheckbox",
|
|
324
329
|
props: {
|
|
325
330
|
modelValue: {
|
|
326
331
|
type: Boolean,
|
|
@@ -356,13 +361,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
356
361
|
_cache[2] || (_cache[2] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["space"]))
|
|
357
362
|
]
|
|
358
363
|
}, [
|
|
359
|
-
createElementVNode("div", _hoisted_1$
|
|
364
|
+
createElementVNode("div", _hoisted_1$o, [
|
|
360
365
|
createElementVNode("div", {
|
|
361
366
|
class: normalizeClass(["htw-border group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out", [
|
|
362
367
|
__props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
|
|
363
368
|
]])
|
|
364
369
|
}, null, 2),
|
|
365
|
-
(openBlock(), createElementBlock("svg", _hoisted_2$
|
|
370
|
+
(openBlock(), createElementBlock("svg", _hoisted_2$k, [
|
|
366
371
|
createElementVNode("path", {
|
|
367
372
|
ref_key: "path",
|
|
368
373
|
ref: path,
|
|
@@ -376,7 +381,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
376
381
|
]]),
|
|
377
382
|
"stroke-dasharray": dasharray.value,
|
|
378
383
|
"stroke-dashoffset": unref(dashoffset)
|
|
379
|
-
}, null, 10, _hoisted_3$
|
|
384
|
+
}, null, 10, _hoisted_3$d)
|
|
380
385
|
]))
|
|
381
386
|
]),
|
|
382
387
|
renderSlot(_ctx.$slots, "default")
|
|
@@ -384,18 +389,19 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
384
389
|
};
|
|
385
390
|
}
|
|
386
391
|
});
|
|
387
|
-
const _hoisted_1$
|
|
388
|
-
const _hoisted_2$
|
|
389
|
-
const _hoisted_3$
|
|
390
|
-
const _hoisted_4$
|
|
391
|
-
const _hoisted_5$
|
|
392
|
-
const _hoisted_6$
|
|
392
|
+
const _hoisted_1$n = { class: "htw-flex htw-flex-col htw-items-stretch" };
|
|
393
|
+
const _hoisted_2$j = /* @__PURE__ */ createTextVNode(" Rotate ");
|
|
394
|
+
const _hoisted_3$c = { class: "htw-flex htw-gap-2 htw-px-4 htw-py-3" };
|
|
395
|
+
const _hoisted_4$9 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-50" }, "x", -1);
|
|
396
|
+
const _hoisted_5$6 = ["onClick"];
|
|
397
|
+
const _hoisted_6$6 = { class: "htw-ml-auto htw-opacity-70 htw-flex htw-gap-1" };
|
|
393
398
|
const _hoisted_7$3 = { key: 0 };
|
|
394
399
|
const _hoisted_8$2 = { key: 0 };
|
|
395
400
|
const _hoisted_9 = { key: 1 };
|
|
396
401
|
const _hoisted_10 = { key: 2 };
|
|
397
402
|
const _hoisted_11 = { key: 0 };
|
|
398
|
-
const _sfc_main$
|
|
403
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
404
|
+
name: "StoryVariantResponsiveSize",
|
|
399
405
|
setup(__props) {
|
|
400
406
|
const settings = usePreviewSettingsStore().currentSettings;
|
|
401
407
|
return (_ctx, _cache) => {
|
|
@@ -409,17 +415,17 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
409
415
|
class: "htw-h-full htw-flex-none"
|
|
410
416
|
}, {
|
|
411
417
|
popper: withCtx(({ hide }) => [
|
|
412
|
-
createElementVNode("div", _hoisted_1$
|
|
413
|
-
createVNode(_sfc_main$
|
|
418
|
+
createElementVNode("div", _hoisted_1$n, [
|
|
419
|
+
createVNode(_sfc_main$q, {
|
|
414
420
|
modelValue: unref(settings).rotate,
|
|
415
421
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).rotate = $event)
|
|
416
422
|
}, {
|
|
417
423
|
default: withCtx(() => [
|
|
418
|
-
_hoisted_2$
|
|
424
|
+
_hoisted_2$j
|
|
419
425
|
]),
|
|
420
426
|
_: 1
|
|
421
427
|
}, 8, ["modelValue"]),
|
|
422
|
-
createElementVNode("div", _hoisted_3$
|
|
428
|
+
createElementVNode("div", _hoisted_3$c, [
|
|
423
429
|
withDirectives(createElementVNode("input", {
|
|
424
430
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(settings).responsiveWidth = $event),
|
|
425
431
|
type: "number",
|
|
@@ -435,7 +441,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
435
441
|
],
|
|
436
442
|
[_directive_tooltip, "Responsive width (px)"]
|
|
437
443
|
]),
|
|
438
|
-
_hoisted_4$
|
|
444
|
+
_hoisted_4$9,
|
|
439
445
|
withDirectives(createElementVNode("input", {
|
|
440
446
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(settings).responsiveHeight = $event),
|
|
441
447
|
type: "number",
|
|
@@ -465,7 +471,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
465
471
|
}
|
|
466
472
|
}, [
|
|
467
473
|
createTextVNode(toDisplayString(preset.label) + " ", 1),
|
|
468
|
-
createElementVNode("span", _hoisted_6$
|
|
474
|
+
createElementVNode("span", _hoisted_6$6, [
|
|
469
475
|
preset.width ? (openBlock(), createElementBlock("span", _hoisted_7$3, [
|
|
470
476
|
createTextVNode(toDisplayString(preset.width), 1),
|
|
471
477
|
!preset.height ? (openBlock(), createElementBlock("span", _hoisted_8$2, "px")) : createCommentVNode("", true)
|
|
@@ -476,7 +482,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
476
482
|
!preset.width ? (openBlock(), createElementBlock("span", _hoisted_11, "px")) : createCommentVNode("", true)
|
|
477
483
|
])) : createCommentVNode("", true)
|
|
478
484
|
])
|
|
479
|
-
], 10, _hoisted_5$
|
|
485
|
+
], 10, _hoisted_5$6);
|
|
480
486
|
}), 128))
|
|
481
487
|
])
|
|
482
488
|
]),
|
|
@@ -508,14 +514,15 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
508
514
|
});
|
|
509
515
|
var StoryVariantBackground_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
510
516
|
const _withScopeId$5 = (n) => (pushScopeId("data-v-bde73868"), n = n(), popScopeId(), n);
|
|
511
|
-
const _hoisted_1$
|
|
512
|
-
const _hoisted_2$
|
|
513
|
-
const _hoisted_3$
|
|
514
|
-
const _hoisted_4$
|
|
515
|
-
const _hoisted_5$
|
|
516
|
-
const _hoisted_6$
|
|
517
|
+
const _hoisted_1$m = { class: "htw-cursor-pointer hover:htw-text-primary-500 htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group" };
|
|
518
|
+
const _hoisted_2$i = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createElementVNode("div", { class: "bind-preview-bg htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/50 dark:htw-border-white/50" }, null, -1));
|
|
519
|
+
const _hoisted_3$b = { class: "htw-flex htw-flex-col htw-items-stretch" };
|
|
520
|
+
const _hoisted_4$8 = /* @__PURE__ */ createTextVNode(" Checkerboard ");
|
|
521
|
+
const _hoisted_5$5 = ["onClick"];
|
|
522
|
+
const _hoisted_6$5 = { class: "htw-mr-auto" };
|
|
517
523
|
const _hoisted_7$2 = { class: "htw-ml-auto htw-opacity-70" };
|
|
518
|
-
const _sfc_main$
|
|
524
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
525
|
+
name: "StoryVariantBackground",
|
|
519
526
|
setup(__props) {
|
|
520
527
|
useCssVars((_ctx) => ({
|
|
521
528
|
"b797c7ca": unref(settings).backgroundColor
|
|
@@ -531,13 +538,13 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
531
538
|
class: "htw-h-full htw-flex-none"
|
|
532
539
|
}, {
|
|
533
540
|
popper: withCtx(({ hide }) => [
|
|
534
|
-
createElementVNode("div", _hoisted_3$
|
|
535
|
-
createVNode(_sfc_main$
|
|
541
|
+
createElementVNode("div", _hoisted_3$b, [
|
|
542
|
+
createVNode(_sfc_main$q, {
|
|
536
543
|
modelValue: unref(settings).checkerboard,
|
|
537
544
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).checkerboard = $event)
|
|
538
545
|
}, {
|
|
539
546
|
default: withCtx(() => [
|
|
540
|
-
_hoisted_4$
|
|
547
|
+
_hoisted_4$8
|
|
541
548
|
]),
|
|
542
549
|
_: 1
|
|
543
550
|
}, 8, ["modelValue"]),
|
|
@@ -552,7 +559,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
552
559
|
hide();
|
|
553
560
|
}
|
|
554
561
|
}, [
|
|
555
|
-
createElementVNode("span", _hoisted_6$
|
|
562
|
+
createElementVNode("span", _hoisted_6$5, toDisplayString(option.label), 1),
|
|
556
563
|
option.color !== "$checkerboard" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
557
564
|
createElementVNode("span", _hoisted_7$2, toDisplayString(option.color), 1),
|
|
558
565
|
createElementVNode("div", {
|
|
@@ -562,13 +569,13 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
562
569
|
})
|
|
563
570
|
}, null, 4)
|
|
564
571
|
], 64)) : createCommentVNode("", true)
|
|
565
|
-
], 10, _hoisted_5$
|
|
572
|
+
], 10, _hoisted_5$5);
|
|
566
573
|
}), 128))
|
|
567
574
|
])
|
|
568
575
|
]),
|
|
569
576
|
default: withCtx(() => [
|
|
570
|
-
withDirectives((openBlock(), createElementBlock("div", _hoisted_1$
|
|
571
|
-
_hoisted_2$
|
|
577
|
+
withDirectives((openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
578
|
+
_hoisted_2$i,
|
|
572
579
|
createVNode(unref(Icon), {
|
|
573
580
|
icon: "carbon:caret-down",
|
|
574
581
|
class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
@@ -582,15 +589,16 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
582
589
|
};
|
|
583
590
|
}
|
|
584
591
|
});
|
|
585
|
-
var StoryVariantBackground = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
592
|
+
var StoryVariantBackground = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-bde73868"]]);
|
|
586
593
|
function getSandboxUrl(story, variant) {
|
|
587
594
|
const url = new URLSearchParams();
|
|
588
595
|
url.append("storyId", story.id);
|
|
589
596
|
url.append("variantId", variant.id);
|
|
590
597
|
return `${base}__sandbox?${url.toString()}`;
|
|
591
598
|
}
|
|
592
|
-
const _hoisted_1$
|
|
593
|
-
const _sfc_main$
|
|
599
|
+
const _hoisted_1$l = ["href"];
|
|
600
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
601
|
+
name: "StoryVariantNewTab",
|
|
594
602
|
props: {
|
|
595
603
|
variant: null,
|
|
596
604
|
story: null
|
|
@@ -611,23 +619,23 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
611
619
|
icon: "carbon:launch",
|
|
612
620
|
class: "base-list-item-link-icon htw-w-4 htw-h-4"
|
|
613
621
|
})
|
|
614
|
-
], 8, _hoisted_1$
|
|
622
|
+
], 8, _hoisted_1$l)), [
|
|
615
623
|
[_directive_tooltip, "Open variant in new tab"]
|
|
616
624
|
]);
|
|
617
625
|
};
|
|
618
626
|
}
|
|
619
627
|
});
|
|
620
628
|
var HatchedPattern_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
621
|
-
const _sfc_main$
|
|
629
|
+
const _sfc_main$m = {};
|
|
622
630
|
const _withScopeId$4 = (n) => (pushScopeId("data-v-250960ac"), n = n(), popScopeId(), n);
|
|
623
|
-
const _hoisted_1$
|
|
631
|
+
const _hoisted_1$k = { class: "__histoire-hatched-pattern" };
|
|
624
632
|
function _sfc_render$3(_ctx, _cache) {
|
|
625
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
633
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k);
|
|
626
634
|
}
|
|
627
|
-
var HatchedPattern = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
628
|
-
const _sfc_main$
|
|
629
|
-
const _hoisted_1$
|
|
630
|
-
const _hoisted_2$
|
|
635
|
+
var HatchedPattern = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$3], ["__scopeId", "data-v-250960ac"]]);
|
|
636
|
+
const _sfc_main$l = {};
|
|
637
|
+
const _hoisted_1$j = { fill: "none" };
|
|
638
|
+
const _hoisted_2$h = /* @__PURE__ */ createElementVNode("pattern", {
|
|
631
639
|
id: "checkerboard",
|
|
632
640
|
width: "64",
|
|
633
641
|
height: "64",
|
|
@@ -648,33 +656,34 @@ const _hoisted_2$e = /* @__PURE__ */ createElementVNode("pattern", {
|
|
|
648
656
|
fill: "currentColor"
|
|
649
657
|
})
|
|
650
658
|
], -1);
|
|
651
|
-
const _hoisted_3$
|
|
659
|
+
const _hoisted_3$a = /* @__PURE__ */ createElementVNode("rect", {
|
|
652
660
|
x: "0",
|
|
653
661
|
y: "0",
|
|
654
662
|
width: "100%",
|
|
655
663
|
height: "100%",
|
|
656
664
|
fill: "url(#checkerboard)"
|
|
657
665
|
}, null, -1);
|
|
658
|
-
const _hoisted_4$
|
|
659
|
-
_hoisted_2$
|
|
660
|
-
_hoisted_3$
|
|
666
|
+
const _hoisted_4$7 = [
|
|
667
|
+
_hoisted_2$h,
|
|
668
|
+
_hoisted_3$a
|
|
661
669
|
];
|
|
662
670
|
function _sfc_render$2(_ctx, _cache) {
|
|
663
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
671
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$j, _hoisted_4$7);
|
|
664
672
|
}
|
|
665
|
-
var CheckerboardPattern = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
673
|
+
var CheckerboardPattern = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2]]);
|
|
666
674
|
var StoryResponsivePreview_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
667
675
|
const _withScopeId$3 = (n) => (pushScopeId("data-v-769a585e"), n = n(), popScopeId(), n);
|
|
668
|
-
const _hoisted_1$
|
|
669
|
-
const _hoisted_2$
|
|
676
|
+
const _hoisted_1$i = { class: "htw-w-full htw-h-full htw-flex-1 htw-border htw-border-gray-100 dark:htw-border-gray-800 htw-rounded-lg htw-relative htw-overflow-hidden" };
|
|
677
|
+
const _hoisted_2$g = {
|
|
670
678
|
key: 0,
|
|
671
679
|
class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-bg-gray-200 dark:htw-bg-gray-850 htw-rounded-r-lg htw-border-l-2 htw-border-gray-500/10 dark:htw-border-gray-700/30 htw-overflow-hidden"
|
|
672
680
|
};
|
|
673
|
-
const _hoisted_3$
|
|
674
|
-
const _hoisted_4$
|
|
675
|
-
const _hoisted_5$
|
|
676
|
-
const _hoisted_6$
|
|
677
|
-
const _sfc_main$
|
|
681
|
+
const _hoisted_3$9 = { class: "htw-p-4 htw-h-full htw-relative" };
|
|
682
|
+
const _hoisted_4$6 = { class: "htw-w-full htw-h-full htw-border htw-border-gray-100 dark:htw-border-gray-800 htw-rounded-sm htw-relative" };
|
|
683
|
+
const _hoisted_5$4 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("div", { class: "bind-preview-bg htw-absolute htw-inset-0" }, null, -1));
|
|
684
|
+
const _hoisted_6$4 = /* @__PURE__ */ createStaticVNode('<div class="htw-absolute htw-top-1 htw-left-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-top-1 htw-right-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-bottom-1 htw-left-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-bottom-1 htw-right-4 htw-h-2 htw-w-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-left-1 htw-top-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-left-1 htw-bottom-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-right-1 htw-top-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div><div class="htw-absolute htw-right-1 htw-bottom-4 htw-w-2 htw-h-px htw-bg-gray-200 dark:htw-bg-gray-800" data-v-769a585e></div>', 8);
|
|
685
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
686
|
+
name: "StoryResponsivePreview",
|
|
678
687
|
props: {
|
|
679
688
|
variant: null
|
|
680
689
|
},
|
|
@@ -769,8 +778,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
769
778
|
const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth : settings.responsiveHeight);
|
|
770
779
|
const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled);
|
|
771
780
|
return (_ctx, _cache) => {
|
|
772
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
773
|
-
unref(isResponsiveEnabled) ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
781
|
+
return openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
782
|
+
unref(isResponsiveEnabled) ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
|
|
774
783
|
createVNode(HatchedPattern, { class: "htw-w-full htw-h-full htw-text-black/[2%] dark:htw-text-white/[2%]" })
|
|
775
784
|
])) : createCommentVNode("", true),
|
|
776
785
|
createElementVNode("div", {
|
|
@@ -784,9 +793,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
784
793
|
"htw-h-fit": !!unref(finalHeight)
|
|
785
794
|
} : void 0])
|
|
786
795
|
}, [
|
|
787
|
-
createElementVNode("div", _hoisted_3$
|
|
788
|
-
createElementVNode("div", _hoisted_4$
|
|
789
|
-
_hoisted_5$
|
|
796
|
+
createElementVNode("div", _hoisted_3$9, [
|
|
797
|
+
createElementVNode("div", _hoisted_4$6, [
|
|
798
|
+
_hoisted_5$4,
|
|
790
799
|
unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
|
|
791
800
|
key: 0,
|
|
792
801
|
class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
@@ -798,7 +807,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
798
807
|
resizing: resizing.value
|
|
799
808
|
}, void 0, true)
|
|
800
809
|
]),
|
|
801
|
-
_hoisted_6$
|
|
810
|
+
_hoisted_6$4
|
|
802
811
|
]),
|
|
803
812
|
unref(isResponsiveEnabled) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
804
813
|
createElementVNode("div", {
|
|
@@ -833,8 +842,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
833
842
|
};
|
|
834
843
|
}
|
|
835
844
|
});
|
|
836
|
-
var StoryResponsivePreview = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
837
|
-
const _sfc_main$
|
|
845
|
+
var StoryResponsivePreview = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-769a585e"]]);
|
|
846
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
847
|
+
name: "StoryVariantSinglePreviewNative",
|
|
838
848
|
props: {
|
|
839
849
|
story: null,
|
|
840
850
|
variant: null
|
|
@@ -858,7 +868,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
858
868
|
height: finalHeight ? `${finalHeight}px` : "100%"
|
|
859
869
|
} : { width: "100%", height: "100%" })
|
|
860
870
|
}, [
|
|
861
|
-
(openBlock(), createBlock(_sfc_main$
|
|
871
|
+
(openBlock(), createBlock(_sfc_main$v, {
|
|
862
872
|
key: `${__props.story.id}-${__props.variant.id}`,
|
|
863
873
|
variant: __props.variant,
|
|
864
874
|
story: __props.story,
|
|
@@ -872,8 +882,9 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
872
882
|
};
|
|
873
883
|
}
|
|
874
884
|
});
|
|
875
|
-
const _hoisted_1$
|
|
876
|
-
const _sfc_main$
|
|
885
|
+
const _hoisted_1$h = ["src"];
|
|
886
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
887
|
+
name: "StoryVariantSinglePreviewRemote",
|
|
877
888
|
props: {
|
|
878
889
|
story: null,
|
|
879
890
|
variant: null
|
|
@@ -919,17 +930,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
919
930
|
});
|
|
920
931
|
function updateVariantState(state) {
|
|
921
932
|
synced = true;
|
|
922
|
-
|
|
923
|
-
for (const key in state) {
|
|
924
|
-
if (typeof props.variant.state[key] === "object") {
|
|
925
|
-
Object.assign(props.variant.state[key], state[key]);
|
|
926
|
-
} else {
|
|
927
|
-
props.variant.state[key] = state[key];
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
} else {
|
|
931
|
-
props.variant.state = state;
|
|
932
|
-
}
|
|
933
|
+
applyStateToVariant(props.variant, state);
|
|
933
934
|
}
|
|
934
935
|
function logEvent(event) {
|
|
935
936
|
const eventsStore = useEventsStore();
|
|
@@ -983,43 +984,44 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
983
984
|
} : void 0),
|
|
984
985
|
"data-test-id": "preview-iframe",
|
|
985
986
|
onLoad: _cache[0] || (_cache[0] = ($event) => onIframeLoad())
|
|
986
|
-
}, null, 46, _hoisted_1$
|
|
987
|
+
}, null, 46, _hoisted_1$h)
|
|
987
988
|
]),
|
|
988
989
|
_: 1
|
|
989
990
|
}, 8, ["variant"]);
|
|
990
991
|
};
|
|
991
992
|
}
|
|
992
993
|
});
|
|
993
|
-
const _hoisted_1$
|
|
994
|
+
const _hoisted_1$g = {
|
|
994
995
|
class: "htw-h-full htw-flex htw-flex-col",
|
|
995
996
|
"data-test-id": "story-variant-single-view"
|
|
996
997
|
};
|
|
997
|
-
const _hoisted_2$
|
|
998
|
+
const _hoisted_2$f = {
|
|
998
999
|
key: 0,
|
|
999
1000
|
class: "htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
|
|
1000
1001
|
};
|
|
1001
|
-
const _sfc_main$
|
|
1002
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
1003
|
+
name: "StoryVariantSingleView",
|
|
1002
1004
|
props: {
|
|
1003
1005
|
variant: null,
|
|
1004
1006
|
story: null
|
|
1005
1007
|
},
|
|
1006
1008
|
setup(__props) {
|
|
1007
1009
|
return (_ctx, _cache) => {
|
|
1008
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1009
|
-
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
1010
|
-
createVNode(_sfc_main$
|
|
1011
|
-
!__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$
|
|
1010
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
1011
|
+
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
|
|
1012
|
+
createVNode(_sfc_main$r, { variant: __props.variant }, null, 8, ["variant"]),
|
|
1013
|
+
!__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$p, { key: 0 })) : createCommentVNode("", true),
|
|
1012
1014
|
createVNode(StoryVariantBackground),
|
|
1013
|
-
createVNode(_sfc_main$
|
|
1015
|
+
createVNode(_sfc_main$n, {
|
|
1014
1016
|
variant: __props.variant,
|
|
1015
1017
|
story: __props.story
|
|
1016
1018
|
}, null, 8, ["variant", "story"])
|
|
1017
1019
|
])) : createCommentVNode("", true),
|
|
1018
|
-
__props.story.layout.iframe === false ? (openBlock(), createBlock(_sfc_main$
|
|
1020
|
+
__props.story.layout.iframe === false ? (openBlock(), createBlock(_sfc_main$j, {
|
|
1019
1021
|
key: 1,
|
|
1020
1022
|
story: __props.story,
|
|
1021
1023
|
variant: __props.variant
|
|
1022
|
-
}, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$
|
|
1024
|
+
}, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$i, {
|
|
1023
1025
|
key: 2,
|
|
1024
1026
|
story: __props.story,
|
|
1025
1027
|
variant: __props.variant
|
|
@@ -1030,25 +1032,26 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
1030
1032
|
});
|
|
1031
1033
|
var StoryVariantSingle_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
1032
1034
|
const _withScopeId$2 = (n) => (pushScopeId("data-v-a52efa6c"), n = n(), popScopeId(), n);
|
|
1033
|
-
const _hoisted_1$
|
|
1035
|
+
const _hoisted_1$f = {
|
|
1034
1036
|
key: 0,
|
|
1035
1037
|
class: "htw-p-2 htw-h-full"
|
|
1036
1038
|
};
|
|
1037
|
-
const _hoisted_2$
|
|
1039
|
+
const _hoisted_2$e = {
|
|
1038
1040
|
key: 0,
|
|
1039
1041
|
class: "htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
|
|
1040
1042
|
};
|
|
1041
|
-
const _hoisted_3$
|
|
1042
|
-
const _hoisted_4$
|
|
1043
|
+
const _hoisted_3$8 = /* @__PURE__ */ createTextVNode(" Select a variant... ");
|
|
1044
|
+
const _hoisted_4$5 = {
|
|
1043
1045
|
key: 0,
|
|
1044
1046
|
class: "htw-p-2 htw-h-full"
|
|
1045
1047
|
};
|
|
1046
|
-
const _hoisted_5$
|
|
1047
|
-
const _hoisted_6$
|
|
1048
|
+
const _hoisted_5$3 = { class: "htw-h-full htw-overflow-y-auto" };
|
|
1049
|
+
const _hoisted_6$3 = {
|
|
1048
1050
|
key: 0,
|
|
1049
1051
|
class: "htw-p-2 htw-h-full"
|
|
1050
1052
|
};
|
|
1051
|
-
const _sfc_main$
|
|
1053
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
1054
|
+
name: "StoryVariantSingle",
|
|
1052
1055
|
setup(__props) {
|
|
1053
1056
|
useCssVars((_ctx) => {
|
|
1054
1057
|
var _a;
|
|
@@ -1068,14 +1071,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1068
1071
|
}
|
|
1069
1072
|
return (_ctx, _cache) => {
|
|
1070
1073
|
var _a;
|
|
1071
|
-
return unref(hasSingleVariant) && unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
1072
|
-
unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$
|
|
1074
|
+
return unref(hasSingleVariant) && unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
1075
|
+
unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$h, {
|
|
1073
1076
|
key: 0,
|
|
1074
1077
|
variant: unref(storyStore).currentVariant,
|
|
1075
1078
|
story: unref(storyStore).currentStory
|
|
1076
1079
|
}, null, 8, ["variant", "story"])) : createCommentVNode("", true)
|
|
1077
1080
|
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1078
|
-
unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
1081
|
+
unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
|
|
1079
1082
|
createElementVNode("a", {
|
|
1080
1083
|
class: "htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center",
|
|
1081
1084
|
onClick: openMenu
|
|
@@ -1090,15 +1093,15 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1090
1093
|
}, null, 8, ["icon", "class"]),
|
|
1091
1094
|
createTextVNode(" " + toDisplayString(unref(variant).title), 1)
|
|
1092
1095
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1093
|
-
_hoisted_3$
|
|
1096
|
+
_hoisted_3$8
|
|
1094
1097
|
], 64)),
|
|
1095
1098
|
createVNode(unref(Icon), {
|
|
1096
1099
|
icon: "carbon:chevron-sort",
|
|
1097
1100
|
class: "htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
1098
1101
|
})
|
|
1099
1102
|
]),
|
|
1100
|
-
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_4$
|
|
1101
|
-
unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$
|
|
1103
|
+
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
|
|
1104
|
+
unref(storyStore).currentVariant.configReady ? (openBlock(), createBlock(_sfc_main$h, {
|
|
1102
1105
|
key: 0,
|
|
1103
1106
|
variant: unref(storyStore).currentVariant,
|
|
1104
1107
|
story: unref(storyStore).currentStory
|
|
@@ -1112,7 +1115,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1112
1115
|
"default-split": 17
|
|
1113
1116
|
}, {
|
|
1114
1117
|
first: withCtx(() => [
|
|
1115
|
-
createElementVNode("div", _hoisted_5$
|
|
1118
|
+
createElementVNode("div", _hoisted_5$3, [
|
|
1116
1119
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (variant2, index) => {
|
|
1117
1120
|
return openBlock(), createBlock(StoryVariantListItem, {
|
|
1118
1121
|
key: index,
|
|
@@ -1122,8 +1125,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1122
1125
|
])
|
|
1123
1126
|
]),
|
|
1124
1127
|
last: withCtx(() => [
|
|
1125
|
-
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_6$
|
|
1126
|
-
createVNode(_sfc_main$
|
|
1128
|
+
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
|
|
1129
|
+
createVNode(_sfc_main$h, {
|
|
1127
1130
|
variant: unref(storyStore).currentVariant,
|
|
1128
1131
|
story: unref(storyStore).currentStory
|
|
1129
1132
|
}, null, 8, ["variant", "story"])
|
|
@@ -1135,11 +1138,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1135
1138
|
};
|
|
1136
1139
|
}
|
|
1137
1140
|
});
|
|
1138
|
-
var StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1141
|
+
var StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-a52efa6c"]]);
|
|
1139
1142
|
var StoryViewer_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
1140
1143
|
const _withScopeId$1 = (n) => (pushScopeId("data-v-141c6b20"), n = n(), popScopeId(), n);
|
|
1141
|
-
const _hoisted_1$
|
|
1142
|
-
const _sfc_main$
|
|
1144
|
+
const _hoisted_1$e = { class: "htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750" };
|
|
1145
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
1146
|
+
name: "StoryViewer",
|
|
1143
1147
|
setup(__props) {
|
|
1144
1148
|
useCssVars((_ctx) => {
|
|
1145
1149
|
var _a;
|
|
@@ -1158,10 +1162,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1158
1162
|
});
|
|
1159
1163
|
return (_ctx, _cache) => {
|
|
1160
1164
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
1161
|
-
createElementVNode("div", _hoisted_1$
|
|
1162
|
-
unref(storyStore).currentStory.layout.type === "grid" ? (openBlock(), createBlock(_sfc_main$
|
|
1165
|
+
createElementVNode("div", _hoisted_1$e, [
|
|
1166
|
+
unref(storyStore).currentStory.layout.type === "grid" ? (openBlock(), createBlock(_sfc_main$s, { key: 0 })) : unref(storyStore).currentStory.layout.type === "single" ? (openBlock(), createBlock(StoryVariantSingle, { key: 1 })) : createCommentVNode("", true)
|
|
1163
1167
|
]),
|
|
1164
|
-
createVNode(_sfc_main$
|
|
1168
|
+
createVNode(_sfc_main$w, {
|
|
1165
1169
|
title: "Select a variant",
|
|
1166
1170
|
opened: isMenuOpened.value,
|
|
1167
1171
|
onClose: closeMenu
|
|
@@ -1180,10 +1184,390 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1180
1184
|
};
|
|
1181
1185
|
}
|
|
1182
1186
|
});
|
|
1183
|
-
var StoryViewer = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1184
|
-
const _hoisted_1$
|
|
1185
|
-
const _hoisted_2$
|
|
1187
|
+
var StoryViewer = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-141c6b20"]]);
|
|
1188
|
+
const _hoisted_1$d = { class: "htw-cursor-pointer htw-w-full htw-outline-none htw-px-2 htw-h-[27px] -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 hover:htw-border-primary-500 dark:hover:htw-border-primary-500 htw-rounded-sm htw-flex htw-gap-2 htw-items-center htw-leading-normal" };
|
|
1189
|
+
const _hoisted_2$d = { class: "htw-flex-1 htw-truncate" };
|
|
1190
|
+
const _hoisted_3$7 = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" };
|
|
1191
|
+
const _hoisted_4$4 = ["onClick"];
|
|
1192
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
1193
|
+
name: "BaseSelect",
|
|
1194
|
+
props: {
|
|
1195
|
+
modelValue: null,
|
|
1196
|
+
options: null
|
|
1197
|
+
},
|
|
1198
|
+
emits: ["update:modelValue", "select"],
|
|
1199
|
+
setup(__props, { emit: emits }) {
|
|
1200
|
+
const props = __props;
|
|
1201
|
+
const formattedOptions = computed(() => {
|
|
1202
|
+
if (Array.isArray(props.options)) {
|
|
1203
|
+
return Object.fromEntries(props.options.map((value) => [value, value]));
|
|
1204
|
+
}
|
|
1205
|
+
return props.options;
|
|
1206
|
+
});
|
|
1207
|
+
const selectedLabel = computed(() => formattedOptions.value[props.modelValue]);
|
|
1208
|
+
function selectValue(value, hide) {
|
|
1209
|
+
emits("update:modelValue", value);
|
|
1210
|
+
emits("select", value);
|
|
1211
|
+
hide();
|
|
1212
|
+
}
|
|
1213
|
+
return (_ctx, _cache) => {
|
|
1214
|
+
return openBlock(), createBlock(unref(Dropdown), { "auto-size": "" }, {
|
|
1215
|
+
popper: withCtx(({ hide }) => [
|
|
1216
|
+
createElementVNode("div", _hoisted_3$7, [
|
|
1217
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOptions), (label, value) => {
|
|
1218
|
+
return openBlock(), createElementBlock("div", mergeProps(__spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
|
|
1219
|
+
key: label,
|
|
1220
|
+
class: ["htw-px-2 htw-py-1 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700", {
|
|
1221
|
+
"htw-bg-primary-200 dark:htw-bg-primary-800": props.modelValue === value
|
|
1222
|
+
}],
|
|
1223
|
+
onClick: ($event) => selectValue(value, hide)
|
|
1224
|
+
}), [
|
|
1225
|
+
renderSlot(_ctx.$slots, "option", {
|
|
1226
|
+
label,
|
|
1227
|
+
value
|
|
1228
|
+
}, () => [
|
|
1229
|
+
createTextVNode(toDisplayString(label), 1)
|
|
1230
|
+
])
|
|
1231
|
+
], 16, _hoisted_4$4);
|
|
1232
|
+
}), 128))
|
|
1233
|
+
])
|
|
1234
|
+
]),
|
|
1235
|
+
default: withCtx(() => [
|
|
1236
|
+
createElementVNode("div", _hoisted_1$d, [
|
|
1237
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
1238
|
+
renderSlot(_ctx.$slots, "default", { label: unref(selectedLabel) }, () => [
|
|
1239
|
+
createTextVNode(toDisplayString(unref(selectedLabel)), 1)
|
|
1240
|
+
])
|
|
1241
|
+
]),
|
|
1242
|
+
createVNode(unref(Icon), {
|
|
1243
|
+
icon: "carbon:chevron-sort",
|
|
1244
|
+
class: "htw-w-4 htw-h-4 htw-flex-none htw-ml-auto"
|
|
1245
|
+
})
|
|
1246
|
+
])
|
|
1247
|
+
]),
|
|
1248
|
+
_: 3
|
|
1249
|
+
});
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
const _hoisted_1$c = { class: "htw-flex htw-gap-2 htw-w-full htw-items-center" };
|
|
1254
|
+
const _hoisted_2$c = ["onUpdate:modelValue"];
|
|
1255
|
+
const _hoisted_3$6 = {
|
|
1256
|
+
key: 1,
|
|
1257
|
+
class: "htw-flex htw-items-center htw-gap-2"
|
|
1258
|
+
};
|
|
1259
|
+
const _hoisted_4$3 = { class: "htw-flex-1 htw-truncate" };
|
|
1260
|
+
const _hoisted_5$2 = { class: "htw-flex htw-gap-2 htw-items-center" };
|
|
1261
|
+
const _hoisted_6$2 = { class: "htw-flex-1 htw-truncate" };
|
|
1262
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
1263
|
+
name: "StatePresets",
|
|
1264
|
+
props: {
|
|
1265
|
+
story: null,
|
|
1266
|
+
variant: null
|
|
1267
|
+
},
|
|
1268
|
+
setup(__props) {
|
|
1269
|
+
const props = __props;
|
|
1270
|
+
const DEFAULT_ID = "default";
|
|
1271
|
+
const saveId = computed(() => `${props.story.id}:${props.variant.id}`);
|
|
1272
|
+
const omitKeys = ["_hPropDefs"];
|
|
1273
|
+
const defaultState = clone(omit(toRawDeep(props.variant.state), omitKeys));
|
|
1274
|
+
const selectedOption = useStorage(`_histoire-presets/${saveId.value}/selected`, DEFAULT_ID);
|
|
1275
|
+
const presetStates = useStorage(`_histoire-presets/${saveId.value}/states`, /* @__PURE__ */ new Map());
|
|
1276
|
+
const presetsOptions = computed(() => {
|
|
1277
|
+
const options = { [DEFAULT_ID]: "Initial state" };
|
|
1278
|
+
presetStates.value.forEach((value, key) => {
|
|
1279
|
+
options[key] = value.label;
|
|
1280
|
+
});
|
|
1281
|
+
return options;
|
|
1282
|
+
});
|
|
1283
|
+
function resetState() {
|
|
1284
|
+
selectedOption.value = DEFAULT_ID;
|
|
1285
|
+
applyStateToVariant(props.variant, clone(defaultState));
|
|
1286
|
+
}
|
|
1287
|
+
function applyPreset(id) {
|
|
1288
|
+
if (id === DEFAULT_ID) {
|
|
1289
|
+
resetState();
|
|
1290
|
+
} else if (presetStates.value.has(id)) {
|
|
1291
|
+
applyStateToVariant(props.variant, clone(presetStates.value.get(id).state));
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
onMounted(() => {
|
|
1295
|
+
if (selectedOption.value !== DEFAULT_ID) {
|
|
1296
|
+
applyPreset(selectedOption.value);
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
const input = ref();
|
|
1300
|
+
const select = ref();
|
|
1301
|
+
const canEdit = computed(() => selectedOption.value !== DEFAULT_ID);
|
|
1302
|
+
const isEditing = ref(false);
|
|
1303
|
+
async function createPreset() {
|
|
1304
|
+
const id = new Date().getTime().toString();
|
|
1305
|
+
presetStates.value.set(id, { state: clone(omit(toRawDeep(props.variant.state), omitKeys)), label: "New preset" });
|
|
1306
|
+
selectedOption.value = id;
|
|
1307
|
+
isEditing.value = true;
|
|
1308
|
+
await nextTick();
|
|
1309
|
+
input.value.select();
|
|
1310
|
+
}
|
|
1311
|
+
const savedNotif = ref(false);
|
|
1312
|
+
const savedTimeout = useTimeoutFn(() => {
|
|
1313
|
+
savedNotif.value = false;
|
|
1314
|
+
}, 1e3);
|
|
1315
|
+
async function savePreset() {
|
|
1316
|
+
if (!canEdit.value)
|
|
1317
|
+
return;
|
|
1318
|
+
const preset = presetStates.value.get(selectedOption.value);
|
|
1319
|
+
preset.state = clone(omit(toRawDeep(props.variant.state), omitKeys));
|
|
1320
|
+
savedNotif.value = true;
|
|
1321
|
+
savedTimeout.start();
|
|
1322
|
+
}
|
|
1323
|
+
function deletePreset(id) {
|
|
1324
|
+
if (!confirm("Are you sure you want to delete this preset?")) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
if (selectedOption.value === id) {
|
|
1328
|
+
resetState();
|
|
1329
|
+
}
|
|
1330
|
+
presetStates.value.delete(id);
|
|
1331
|
+
}
|
|
1332
|
+
async function startEditing() {
|
|
1333
|
+
if (!canEdit.value) {
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
isEditing.value = true;
|
|
1337
|
+
await nextTick();
|
|
1338
|
+
input.value.select();
|
|
1339
|
+
}
|
|
1340
|
+
function stopEditing() {
|
|
1341
|
+
isEditing.value = false;
|
|
1342
|
+
}
|
|
1343
|
+
onClickOutside(select, stopEditing);
|
|
1344
|
+
return (_ctx, _cache) => {
|
|
1345
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
1346
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
1347
|
+
createElementVNode("div", {
|
|
1348
|
+
ref_key: "select",
|
|
1349
|
+
ref: select,
|
|
1350
|
+
class: "htw-flex-1 htw-min-w-0"
|
|
1351
|
+
}, [
|
|
1352
|
+
createVNode(_sfc_main$e, {
|
|
1353
|
+
modelValue: unref(selectedOption),
|
|
1354
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
|
|
1355
|
+
options: unref(presetsOptions),
|
|
1356
|
+
onDblclick: _cache[3] || (_cache[3] = ($event) => startEditing()),
|
|
1357
|
+
onKeydown: [
|
|
1358
|
+
_cache[4] || (_cache[4] = withKeys(($event) => stopEditing(), ["enter"])),
|
|
1359
|
+
_cache[5] || (_cache[5] = withKeys(($event) => stopEditing(), ["escape"]))
|
|
1360
|
+
],
|
|
1361
|
+
onSelect: _cache[6] || (_cache[6] = (id) => applyPreset(id))
|
|
1362
|
+
}, {
|
|
1363
|
+
default: withCtx(({ label }) => [
|
|
1364
|
+
isEditing.value ? withDirectives((openBlock(), createElementBlock("input", {
|
|
1365
|
+
key: 0,
|
|
1366
|
+
ref_key: "input",
|
|
1367
|
+
ref: input,
|
|
1368
|
+
"onUpdate:modelValue": ($event) => unref(presetStates).get(unref(selectedOption)).label = $event,
|
|
1369
|
+
type: "text",
|
|
1370
|
+
class: "htw-text-inherit htw-bg-transparent htw-w-full htw-h-full htw-outline-none",
|
|
1371
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
1372
|
+
}, ["stop", "prevent"]))
|
|
1373
|
+
}, null, 8, _hoisted_2$c)), [
|
|
1374
|
+
[vModelText, unref(presetStates).get(unref(selectedOption)).label]
|
|
1375
|
+
]) : (openBlock(), createElementBlock("div", _hoisted_3$6, [
|
|
1376
|
+
createElementVNode("span", _hoisted_4$3, toDisplayString(label), 1),
|
|
1377
|
+
unref(canEdit) ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
1378
|
+
key: 0,
|
|
1379
|
+
icon: "carbon:edit",
|
|
1380
|
+
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",
|
|
1381
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => startEditing(), ["stop"]))
|
|
1382
|
+
}, null, 512)), [
|
|
1383
|
+
[_directive_tooltip, "Rename this preset"]
|
|
1384
|
+
]) : createCommentVNode("", true)
|
|
1385
|
+
]))
|
|
1386
|
+
]),
|
|
1387
|
+
option: withCtx(({ label, value }) => [
|
|
1388
|
+
createElementVNode("div", _hoisted_5$2, [
|
|
1389
|
+
createElementVNode("span", _hoisted_6$2, toDisplayString(label), 1),
|
|
1390
|
+
value !== DEFAULT_ID ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
1391
|
+
key: 0,
|
|
1392
|
+
icon: "carbon:trash-can",
|
|
1393
|
+
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",
|
|
1394
|
+
onClick: withModifiers(($event) => deletePreset(value), ["stop"])
|
|
1395
|
+
}, null, 8, ["onClick"])), [
|
|
1396
|
+
[_directive_tooltip, "Delete this preset"]
|
|
1397
|
+
]) : createCommentVNode("", true)
|
|
1398
|
+
])
|
|
1399
|
+
]),
|
|
1400
|
+
_: 1
|
|
1401
|
+
}, 8, ["modelValue", "options"])
|
|
1402
|
+
], 512),
|
|
1403
|
+
withDirectives(createVNode(unref(Icon), {
|
|
1404
|
+
icon: savedNotif.value ? "carbon:checkmark" : "carbon:save",
|
|
1405
|
+
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", [
|
|
1406
|
+
unref(canEdit) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
1407
|
+
]]),
|
|
1408
|
+
onClick: _cache[7] || (_cache[7] = ($event) => savePreset())
|
|
1409
|
+
}, null, 8, ["icon", "class"]), [
|
|
1410
|
+
[_directive_tooltip, savedNotif.value ? "Saved!" : unref(canEdit) ? "Save to preset" : null]
|
|
1411
|
+
]),
|
|
1412
|
+
withDirectives(createVNode(unref(Icon), {
|
|
1413
|
+
icon: "carbon:add-alt",
|
|
1414
|
+
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",
|
|
1415
|
+
onClick: _cache[8] || (_cache[8] = ($event) => createPreset())
|
|
1416
|
+
}, null, 512), [
|
|
1417
|
+
[_directive_tooltip, "Create new preset"]
|
|
1418
|
+
]),
|
|
1419
|
+
withDirectives(createVNode(unref(Icon), {
|
|
1420
|
+
icon: "carbon:reset",
|
|
1421
|
+
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",
|
|
1422
|
+
onClick: _cache[9] || (_cache[9] = ($event) => resetState())
|
|
1423
|
+
}, null, 512), [
|
|
1424
|
+
[_directive_tooltip, "Reset to initial state"]
|
|
1425
|
+
])
|
|
1426
|
+
]);
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
1431
|
+
name: "ControlsComponentPropItem",
|
|
1432
|
+
props: {
|
|
1433
|
+
variant: null,
|
|
1434
|
+
component: null,
|
|
1435
|
+
definition: null
|
|
1436
|
+
},
|
|
1437
|
+
setup(__props) {
|
|
1438
|
+
const props = __props;
|
|
1439
|
+
const comp = computed(() => {
|
|
1440
|
+
var _a;
|
|
1441
|
+
switch ((_a = props.definition.types) == null ? void 0 : _a[0]) {
|
|
1442
|
+
case "string":
|
|
1443
|
+
return "HstText";
|
|
1444
|
+
case "number":
|
|
1445
|
+
return "HstNumber";
|
|
1446
|
+
case "boolean":
|
|
1447
|
+
return "HstCheckbox";
|
|
1448
|
+
case "object":
|
|
1449
|
+
default:
|
|
1450
|
+
return "HstTextarea";
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
const isJSON = computed(() => comp.value === "HstTextarea");
|
|
1454
|
+
const invalidValue = ref("");
|
|
1455
|
+
const model = computed({
|
|
1456
|
+
get: () => {
|
|
1457
|
+
var _a;
|
|
1458
|
+
if (invalidValue.value) {
|
|
1459
|
+
return invalidValue.value;
|
|
1460
|
+
}
|
|
1461
|
+
let val = (_a = props.variant.state._hPropState[props.component.index]) == null ? void 0 : _a[props.definition.name];
|
|
1462
|
+
if (val && isJSON.value) {
|
|
1463
|
+
val = JSON.stringify(val, null, 2);
|
|
1464
|
+
}
|
|
1465
|
+
return val;
|
|
1466
|
+
},
|
|
1467
|
+
set: (value) => {
|
|
1468
|
+
invalidValue.value = "";
|
|
1469
|
+
if (isJSON.value) {
|
|
1470
|
+
try {
|
|
1471
|
+
value = JSON.parse(value);
|
|
1472
|
+
} catch (e) {
|
|
1473
|
+
invalidValue.value = value;
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
if (!props.variant.state._hPropState[props.component.index]) {
|
|
1478
|
+
props.variant.state._hPropState[props.component.index] = {};
|
|
1479
|
+
}
|
|
1480
|
+
props.variant.state._hPropState[props.component.index][props.definition.name] = value;
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
function reset() {
|
|
1484
|
+
if (props.variant.state._hPropState[props.component.index]) {
|
|
1485
|
+
delete props.variant.state._hPropState[props.component.index][props.definition.name];
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
const canReset = computed(() => {
|
|
1489
|
+
var _a, _b;
|
|
1490
|
+
return ((_b = (_a = props.variant.state) == null ? void 0 : _a._hPropState) == null ? void 0 : _b[props.component.index]) && props.definition.name in props.variant.state._hPropState[props.component.index];
|
|
1491
|
+
});
|
|
1492
|
+
return (_ctx, _cache) => {
|
|
1493
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
1494
|
+
return unref(comp) ? (openBlock(), createBlock(resolveDynamicComponent(unref(comp)), {
|
|
1495
|
+
key: 0,
|
|
1496
|
+
modelValue: unref(model),
|
|
1497
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(model) ? model.value = $event : null),
|
|
1498
|
+
title: __props.definition.name,
|
|
1499
|
+
placeholder: unref(isJSON) ? "Enter JSON" : null
|
|
1500
|
+
}, {
|
|
1501
|
+
actions: withCtx(() => [
|
|
1502
|
+
invalidValue.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
1503
|
+
key: 0,
|
|
1504
|
+
icon: "carbon:warning-alt",
|
|
1505
|
+
class: "htw-text-orange-500"
|
|
1506
|
+
}, null, 512)), [
|
|
1507
|
+
[_directive_tooltip, "JSON error"]
|
|
1508
|
+
]) : createCommentVNode("", true),
|
|
1509
|
+
withDirectives(createVNode(unref(Icon), {
|
|
1510
|
+
icon: "carbon:erase",
|
|
1511
|
+
class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
1512
|
+
unref(canReset) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
1513
|
+
]]),
|
|
1514
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => reset(), ["stop"]))
|
|
1515
|
+
}, null, 8, ["class"]), [
|
|
1516
|
+
[_directive_tooltip, "Remove override"]
|
|
1517
|
+
])
|
|
1518
|
+
]),
|
|
1519
|
+
_: 1
|
|
1520
|
+
}, 8, ["modelValue", "title", "placeholder"])) : createCommentVNode("", true);
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
|
+
const _hoisted_1$b = { class: "htw-font-mono htw-p-2 htw-flex htw-items-center htw-gap-1" };
|
|
1525
|
+
const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, "<", -1);
|
|
1526
|
+
const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, ">", -1);
|
|
1527
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
1528
|
+
name: "ControlsComponentProps",
|
|
1529
|
+
props: {
|
|
1530
|
+
variant: null,
|
|
1531
|
+
definition: null
|
|
1532
|
+
},
|
|
1533
|
+
setup(__props) {
|
|
1534
|
+
return (_ctx, _cache) => {
|
|
1535
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
1536
|
+
return openBlock(), createElementBlock("div", null, [
|
|
1537
|
+
createElementVNode("div", _hoisted_1$b, [
|
|
1538
|
+
withDirectives(createVNode(unref(Icon), {
|
|
1539
|
+
icon: "carbon:flash",
|
|
1540
|
+
class: "htw-w-4 htw-h-4 htw-text-primary-500 htw-flex-none"
|
|
1541
|
+
}, null, 512), [
|
|
1542
|
+
[_directive_tooltip, "Auto-detected props"]
|
|
1543
|
+
]),
|
|
1544
|
+
createElementVNode("div", null, [
|
|
1545
|
+
_hoisted_2$b,
|
|
1546
|
+
createTextVNode(toDisplayString(__props.definition.name), 1),
|
|
1547
|
+
_hoisted_3$5
|
|
1548
|
+
])
|
|
1549
|
+
]),
|
|
1550
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.definition.props, (prop) => {
|
|
1551
|
+
return openBlock(), createBlock(_sfc_main$c, {
|
|
1552
|
+
key: prop.name,
|
|
1553
|
+
variant: __props.variant,
|
|
1554
|
+
component: __props.definition,
|
|
1555
|
+
definition: prop
|
|
1556
|
+
}, null, 8, ["variant", "component", "definition"]);
|
|
1557
|
+
}), 128))
|
|
1558
|
+
]);
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
const _hoisted_1$a = {
|
|
1563
|
+
"data-test-id": "story-controls",
|
|
1564
|
+
class: "htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-750"
|
|
1565
|
+
};
|
|
1566
|
+
const _hoisted_2$a = { class: "htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center" };
|
|
1567
|
+
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("span", null, "No controls available for this story", -1);
|
|
1568
|
+
const _hoisted_4$2 = { key: 2 };
|
|
1186
1569
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1570
|
+
name: "StoryControls",
|
|
1187
1571
|
props: {
|
|
1188
1572
|
variant: {
|
|
1189
1573
|
type: Object,
|
|
@@ -1196,22 +1580,40 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
1196
1580
|
},
|
|
1197
1581
|
setup(__props) {
|
|
1198
1582
|
return (_ctx, _cache) => {
|
|
1583
|
+
var _a, _b, _c, _d;
|
|
1199
1584
|
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
1200
|
-
|
|
1585
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
1586
|
+
createVNode(_sfc_main$d, {
|
|
1587
|
+
story: __props.story,
|
|
1588
|
+
variant: __props.variant
|
|
1589
|
+
}, null, 8, ["story", "variant"])
|
|
1590
|
+
]),
|
|
1591
|
+
__props.variant.slots().controls || __props.story.slots().controls ? (openBlock(), createBlock(_sfc_main$v, {
|
|
1201
1592
|
key: 0,
|
|
1202
1593
|
"slot-name": "controls",
|
|
1203
1594
|
variant: __props.variant,
|
|
1204
|
-
story: __props.story
|
|
1205
|
-
|
|
1595
|
+
story: __props.story,
|
|
1596
|
+
class: "htw-flex-none"
|
|
1597
|
+
}, null, 8, ["variant", "story"])) : !((_b = (_a = __props.variant.state) == null ? void 0 : _a._hPropDefs) == null ? void 0 : _b.length) ? (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
|
|
1206
1598
|
default: withCtx(() => [
|
|
1207
1599
|
createVNode(unref(Icon), {
|
|
1208
1600
|
icon: "carbon:audio-console",
|
|
1209
1601
|
class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
1210
1602
|
}),
|
|
1211
|
-
|
|
1603
|
+
_hoisted_3$4
|
|
1212
1604
|
]),
|
|
1213
1605
|
_: 1
|
|
1214
|
-
}))
|
|
1606
|
+
})) : createCommentVNode("", true),
|
|
1607
|
+
((_d = (_c = __props.variant.state) == null ? void 0 : _c._hPropDefs) == null ? void 0 : _d.length) ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
|
|
1608
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.variant.state._hPropDefs, (def, index) => {
|
|
1609
|
+
return openBlock(), createBlock(_sfc_main$b, {
|
|
1610
|
+
key: index,
|
|
1611
|
+
variant: __props.variant,
|
|
1612
|
+
definition: def,
|
|
1613
|
+
class: "htw-flex-none htw-my-2"
|
|
1614
|
+
}, null, 8, ["variant", "definition"]);
|
|
1615
|
+
}), 128))
|
|
1616
|
+
])) : createCommentVNode("", true)
|
|
1215
1617
|
]);
|
|
1216
1618
|
};
|
|
1217
1619
|
}
|
|
@@ -1219,6 +1621,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
1219
1621
|
const _hoisted_1$9 = /* @__PURE__ */ createTextVNode(" No documentation available ");
|
|
1220
1622
|
const _hoisted_2$9 = ["innerHTML"];
|
|
1221
1623
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1624
|
+
name: "StoryDocs",
|
|
1222
1625
|
props: {
|
|
1223
1626
|
story: {
|
|
1224
1627
|
type: Object,
|
|
@@ -1266,6 +1669,7 @@ const _hoisted_1$8 = {
|
|
|
1266
1669
|
const _hoisted_2$8 = { class: "htw-overflow-auto htw-max-w-[400px] htw-max-h-[400px]" };
|
|
1267
1670
|
const _hoisted_3$3 = { class: "htw-p-4" };
|
|
1268
1671
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1672
|
+
name: "StoryEvent",
|
|
1269
1673
|
props: {
|
|
1270
1674
|
event: null
|
|
1271
1675
|
},
|
|
@@ -1315,6 +1719,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1315
1719
|
const _hoisted_1$7 = /* @__PURE__ */ createTextVNode(" No event fired ");
|
|
1316
1720
|
const _hoisted_2$7 = { key: 1 };
|
|
1317
1721
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1722
|
+
name: "StoryEvents",
|
|
1318
1723
|
setup(__props) {
|
|
1319
1724
|
const eventsStore = useEventsStore();
|
|
1320
1725
|
const hasEvents = computed(() => eventsStore.events.length);
|
|
@@ -1354,487 +1759,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1354
1759
|
};
|
|
1355
1760
|
}
|
|
1356
1761
|
});
|
|
1357
|
-
function indent(lines, count = 1) {
|
|
1358
|
-
return lines.map((line) => `${" ".repeat(count)}${line}`);
|
|
1359
|
-
}
|
|
1360
|
-
function unindent(code) {
|
|
1361
|
-
const lines = code.split("\n");
|
|
1362
|
-
let indentLevel = -1;
|
|
1363
|
-
let indentText;
|
|
1364
|
-
const linesToAnalyze = lines.filter((line) => line.trim().length > 0);
|
|
1365
|
-
for (const line of linesToAnalyze) {
|
|
1366
|
-
const match = /^\s*/.exec(line);
|
|
1367
|
-
if (match && (indentLevel === -1 || indentLevel > match[0].length)) {
|
|
1368
|
-
indentLevel = match[0].length;
|
|
1369
|
-
indentText = match[0];
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
const result = [];
|
|
1373
|
-
for (const line of lines) {
|
|
1374
|
-
result.push(line.replace(indentText, ""));
|
|
1375
|
-
}
|
|
1376
|
-
return result.join("\n").trim();
|
|
1377
|
-
}
|
|
1378
|
-
function createAutoBuildingObject(format, specialKeysHandler, key = "", depth = 0) {
|
|
1379
|
-
const cache = {};
|
|
1380
|
-
if (depth > 32)
|
|
1381
|
-
return { key, cache, target: {}, proxy: () => key };
|
|
1382
|
-
const target = () => {
|
|
1383
|
-
const k = key + "()";
|
|
1384
|
-
return format ? format(k) : k;
|
|
1385
|
-
};
|
|
1386
|
-
const proxy = new Proxy(target, {
|
|
1387
|
-
get(_, p) {
|
|
1388
|
-
if (p === "__autoBuildingObject") {
|
|
1389
|
-
return true;
|
|
1390
|
-
}
|
|
1391
|
-
if (p === "__autoBuildingObjectGetKey") {
|
|
1392
|
-
return key;
|
|
1393
|
-
}
|
|
1394
|
-
if (specialKeysHandler) {
|
|
1395
|
-
const fn = specialKeysHandler(target, p);
|
|
1396
|
-
if (fn) {
|
|
1397
|
-
return fn();
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
if (p === "toString") {
|
|
1401
|
-
const k = key + ".toString()";
|
|
1402
|
-
return () => format ? format(k) : k;
|
|
1403
|
-
}
|
|
1404
|
-
if (p === Symbol.toPrimitive) {
|
|
1405
|
-
return () => format ? format(key) : key;
|
|
1406
|
-
}
|
|
1407
|
-
if (!cache[p]) {
|
|
1408
|
-
const childKey = key ? `${key}.${p.toString()}` : p.toString();
|
|
1409
|
-
const child = createAutoBuildingObject(format, specialKeysHandler, childKey, depth + 1);
|
|
1410
|
-
cache[p] = __spreadValues({ key: childKey }, child);
|
|
1411
|
-
}
|
|
1412
|
-
return cache[p].proxy;
|
|
1413
|
-
},
|
|
1414
|
-
apply(_, thisArg, args) {
|
|
1415
|
-
const k = `${key}(${args.join(", ")})`;
|
|
1416
|
-
return format ? format(k) : k;
|
|
1417
|
-
}
|
|
1418
|
-
});
|
|
1419
|
-
return {
|
|
1420
|
-
key,
|
|
1421
|
-
cache,
|
|
1422
|
-
target,
|
|
1423
|
-
proxy
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
const KEY_ESCAPE_REG = /[\s-.:|#@$£*%]/;
|
|
1427
|
-
const MAX_SINGLE_LINE_ARRAY_LENGTH = 3;
|
|
1428
|
-
function serializeJs(value) {
|
|
1429
|
-
if (value === void 0) {
|
|
1430
|
-
return "undefined";
|
|
1431
|
-
}
|
|
1432
|
-
if (value === null) {
|
|
1433
|
-
return "null";
|
|
1434
|
-
}
|
|
1435
|
-
if (typeof value === "string") {
|
|
1436
|
-
return `'${value}'`;
|
|
1437
|
-
}
|
|
1438
|
-
if (typeof value === "boolean") {
|
|
1439
|
-
return value ? "true" : "false";
|
|
1440
|
-
}
|
|
1441
|
-
if (Array.isArray(value)) {
|
|
1442
|
-
return printLines(arrayToSourceLines(value));
|
|
1443
|
-
}
|
|
1444
|
-
if (typeof value === "object") {
|
|
1445
|
-
return printLines(objectToSourceLines(value));
|
|
1446
|
-
}
|
|
1447
|
-
if (value == null ? void 0 : value.__autoBuildingObject) {
|
|
1448
|
-
return value;
|
|
1449
|
-
}
|
|
1450
|
-
if (typeof value === "function" && value.name) {
|
|
1451
|
-
return value.name;
|
|
1452
|
-
}
|
|
1453
|
-
return value.toString();
|
|
1454
|
-
}
|
|
1455
|
-
function printLines(lines) {
|
|
1456
|
-
return lines.map((line) => " ".repeat(line.spaces) + line.line).join("\n");
|
|
1457
|
-
}
|
|
1458
|
-
function objectToSourceLines(object, indentCount = 0) {
|
|
1459
|
-
return createLines(indentCount, (lines) => {
|
|
1460
|
-
lines.push("{");
|
|
1461
|
-
lines.push(...createLines(1, (lines2) => {
|
|
1462
|
-
for (const key in object) {
|
|
1463
|
-
const value = object[key];
|
|
1464
|
-
let printedKey = key;
|
|
1465
|
-
if (KEY_ESCAPE_REG.test(key)) {
|
|
1466
|
-
printedKey = `'${printedKey}'`;
|
|
1467
|
-
}
|
|
1468
|
-
addLinesFromValue(lines2, value, `${printedKey}: `, ",");
|
|
1469
|
-
}
|
|
1470
|
-
}));
|
|
1471
|
-
lines.push("}");
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
function arrayToSourceLines(array, indentCount = 0) {
|
|
1475
|
-
return createLines(indentCount, (lines) => {
|
|
1476
|
-
const contentLines = createLines(1, (lines2) => {
|
|
1477
|
-
for (const value of array) {
|
|
1478
|
-
addLinesFromValue(lines2, value, "", ",");
|
|
1479
|
-
}
|
|
1480
|
-
});
|
|
1481
|
-
if (contentLines.length === 0) {
|
|
1482
|
-
lines.push("[]");
|
|
1483
|
-
} else if (contentLines.length <= MAX_SINGLE_LINE_ARRAY_LENGTH) {
|
|
1484
|
-
const [first] = contentLines;
|
|
1485
|
-
first.line = contentLines.map(({ line }) => line.substring(0, line.length - 1)).join(", ");
|
|
1486
|
-
first.line = `[${first.line}]`;
|
|
1487
|
-
first.spaces--;
|
|
1488
|
-
lines.push(first);
|
|
1489
|
-
} else {
|
|
1490
|
-
lines.push("[", ...contentLines, "]");
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
function createLines(indentCount, handler) {
|
|
1495
|
-
const lines = [];
|
|
1496
|
-
handler(lines);
|
|
1497
|
-
return lines.map((line) => {
|
|
1498
|
-
if (line.spaces != null) {
|
|
1499
|
-
line.spaces += indentCount;
|
|
1500
|
-
return line;
|
|
1501
|
-
}
|
|
1502
|
-
return { spaces: indentCount, line };
|
|
1503
|
-
});
|
|
1504
|
-
}
|
|
1505
|
-
function addLinesFromValue(lines, value, before, after) {
|
|
1506
|
-
let result;
|
|
1507
|
-
if (Array.isArray(value)) {
|
|
1508
|
-
lines.push(...wrap(arrayToSourceLines(value), before, after));
|
|
1509
|
-
return;
|
|
1510
|
-
} else if (value && typeof value === "object") {
|
|
1511
|
-
lines.push(...wrap(objectToSourceLines(value), before, after));
|
|
1512
|
-
return;
|
|
1513
|
-
} else if (typeof value === "string") {
|
|
1514
|
-
result = value.includes("'") ? `\`${value}\`` : `'${value}'`;
|
|
1515
|
-
} else if (typeof value === "undefined") {
|
|
1516
|
-
result = "undefined";
|
|
1517
|
-
} else if (value === null) {
|
|
1518
|
-
result = "null";
|
|
1519
|
-
} else if (typeof value === "boolean") {
|
|
1520
|
-
result = value ? "true" : "false";
|
|
1521
|
-
} else {
|
|
1522
|
-
result = value;
|
|
1523
|
-
}
|
|
1524
|
-
lines.push(before + result + after);
|
|
1525
|
-
}
|
|
1526
|
-
function wrap(lines, before, after) {
|
|
1527
|
-
lines[0].line = before + lines[0].line;
|
|
1528
|
-
lines[lines.length - 1].line += after;
|
|
1529
|
-
return lines;
|
|
1530
|
-
}
|
|
1531
|
-
const voidElements = [
|
|
1532
|
-
"area",
|
|
1533
|
-
"base",
|
|
1534
|
-
"br",
|
|
1535
|
-
"col",
|
|
1536
|
-
"embed",
|
|
1537
|
-
"hr",
|
|
1538
|
-
"img",
|
|
1539
|
-
"input",
|
|
1540
|
-
"keygen",
|
|
1541
|
-
"link",
|
|
1542
|
-
"meta",
|
|
1543
|
-
"param",
|
|
1544
|
-
"source",
|
|
1545
|
-
"track",
|
|
1546
|
-
"wbr"
|
|
1547
|
-
];
|
|
1548
|
-
async function generateSourceCode(variant) {
|
|
1549
|
-
var _a, _b, _c, _d;
|
|
1550
|
-
const vnode = (_d = (_c = (_b = variant.slots()).default) == null ? void 0 : _c.call(_b, { state: (_a = variant.state) != null ? _a : {} })) != null ? _d : [];
|
|
1551
|
-
const list = Array.isArray(vnode) ? vnode : [vnode];
|
|
1552
|
-
const lines = [];
|
|
1553
|
-
for (const vnode2 of list) {
|
|
1554
|
-
lines.push(...(await printVNode(vnode2)).lines);
|
|
1555
|
-
}
|
|
1556
|
-
return lines.join("\n");
|
|
1557
|
-
}
|
|
1558
|
-
async function printVNode(vnode) {
|
|
1559
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1560
|
-
if (vnode.type === Text) {
|
|
1561
|
-
return {
|
|
1562
|
-
lines: [vnode.children],
|
|
1563
|
-
isText: true
|
|
1564
|
-
};
|
|
1565
|
-
}
|
|
1566
|
-
const lines = [];
|
|
1567
|
-
if (typeof vnode.type === "object" || typeof vnode.type === "string") {
|
|
1568
|
-
let genDirective = function(dirName, dir, valueCode = null) {
|
|
1569
|
-
var _a2;
|
|
1570
|
-
let modifiers = "";
|
|
1571
|
-
for (const key in dir.modifiers) {
|
|
1572
|
-
if (dir.modifiers[key]) {
|
|
1573
|
-
modifiers += `.${key}`;
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
let arg = "";
|
|
1577
|
-
if (dir.arg) {
|
|
1578
|
-
arg = `:${dir.arg}`;
|
|
1579
|
-
}
|
|
1580
|
-
if (valueCode) {
|
|
1581
|
-
valueCode = valueCode.replace(/^\$(setup|props|data)\./g, "");
|
|
1582
|
-
}
|
|
1583
|
-
const valueLines = valueCode ? [valueCode] : serializeAndCleanJs(dir.value);
|
|
1584
|
-
const attr = [];
|
|
1585
|
-
const dirAttr = `v-${dirName}${arg}${modifiers}="`;
|
|
1586
|
-
if (valueLines.length > 1) {
|
|
1587
|
-
attr.push(`${dirAttr}${valueLines[0]}`);
|
|
1588
|
-
attr.push(...valueLines.slice(1, valueLines.length - 1));
|
|
1589
|
-
attr.push(`${valueLines[valueLines.length - 1]}"`);
|
|
1590
|
-
multilineAttrs = true;
|
|
1591
|
-
} else {
|
|
1592
|
-
attr.push(`${dirAttr}${(_a2 = valueLines[0]) != null ? _a2 : ""}"`);
|
|
1593
|
-
}
|
|
1594
|
-
attrs.push(attr);
|
|
1595
|
-
};
|
|
1596
|
-
if (((_a = vnode.type) == null ? void 0 : _a.__asyncLoader) && !vnode.type.__asyncResolved) {
|
|
1597
|
-
await vnode.type.__asyncLoader();
|
|
1598
|
-
}
|
|
1599
|
-
const attrs = [];
|
|
1600
|
-
let multilineAttrs = false;
|
|
1601
|
-
const skipProps = [
|
|
1602
|
-
"key"
|
|
1603
|
-
];
|
|
1604
|
-
if (vnode.dirs) {
|
|
1605
|
-
for (const dir of vnode.dirs) {
|
|
1606
|
-
if (dir.dir === vModelText || dir.dir === vModelSelect || dir.dir === vModelRadio || dir.dir === vModelCheckbox || dir.dir === vModelDynamic) {
|
|
1607
|
-
const listenerKey = `onUpdate:${(_b = dir.arg) != null ? _b : "modelValue"}`;
|
|
1608
|
-
const listener = vnode.props[listenerKey];
|
|
1609
|
-
let valueCode = null;
|
|
1610
|
-
if (listener) {
|
|
1611
|
-
skipProps.push(listenerKey);
|
|
1612
|
-
const listenerSource = listener.toString();
|
|
1613
|
-
const result = /\(\$event\) => (.*?) = \$event/.exec(listenerSource);
|
|
1614
|
-
if (result) {
|
|
1615
|
-
valueCode = result[1];
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
genDirective("model", dir, valueCode);
|
|
1619
|
-
} else if (dir.instance._ || dir.instance.$) {
|
|
1620
|
-
const target = (_c = dir.instance.$) != null ? _c : dir.instance._;
|
|
1621
|
-
let dirName;
|
|
1622
|
-
for (const directives of [target.directives, target.appContext.directives]) {
|
|
1623
|
-
for (const key in directives) {
|
|
1624
|
-
if (target.directives[key] === dir.dir) {
|
|
1625
|
-
dirName = key;
|
|
1626
|
-
break;
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
if (dirName)
|
|
1630
|
-
break;
|
|
1631
|
-
}
|
|
1632
|
-
if (dirName) {
|
|
1633
|
-
genDirective(dirName, dir);
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
for (const prop in vnode.props) {
|
|
1639
|
-
if (skipProps.includes(prop)) {
|
|
1640
|
-
continue;
|
|
1641
|
-
}
|
|
1642
|
-
const value = vnode.props[prop];
|
|
1643
|
-
if (typeof value !== "string" || ((_d = vnode.dynamicProps) == null ? void 0 : _d.includes(prop))) {
|
|
1644
|
-
let directive = ":";
|
|
1645
|
-
if (prop.startsWith("on")) {
|
|
1646
|
-
directive = "@";
|
|
1647
|
-
}
|
|
1648
|
-
const arg = directive === "@" ? `${prop[2].toLowerCase()}${prop.slice(3)}` : prop;
|
|
1649
|
-
const vmodelListener = `onUpdate:${prop}`;
|
|
1650
|
-
if (directive === ":" && ((_e = vnode.dynamicProps) == null ? void 0 : _e.includes(vmodelListener))) {
|
|
1651
|
-
skipProps.push(vmodelListener);
|
|
1652
|
-
const listener = vnode.props[vmodelListener];
|
|
1653
|
-
const listenerSource = listener.toString();
|
|
1654
|
-
let valueCode;
|
|
1655
|
-
const result = /\(\$event\) => (.*?) = \$event/.exec(listenerSource);
|
|
1656
|
-
if (result) {
|
|
1657
|
-
valueCode = result[1];
|
|
1658
|
-
}
|
|
1659
|
-
const modifiersKey = `${prop === "modelValue" ? "model" : prop}Modifiers`;
|
|
1660
|
-
const modifiers = (_f = vnode.props[modifiersKey]) != null ? _f : {};
|
|
1661
|
-
skipProps.push(modifiersKey);
|
|
1662
|
-
genDirective("model", {
|
|
1663
|
-
arg: prop === "modelValue" ? null : prop,
|
|
1664
|
-
modifiers,
|
|
1665
|
-
value
|
|
1666
|
-
}, valueCode);
|
|
1667
|
-
continue;
|
|
1668
|
-
}
|
|
1669
|
-
let serialized;
|
|
1670
|
-
if (typeof value === "string" && value.startsWith("{{") && value.endsWith("}}")) {
|
|
1671
|
-
serialized = cleanupExpression(value.substring(2, value.length - 2).trim()).split("\n");
|
|
1672
|
-
} else if (typeof value === "function") {
|
|
1673
|
-
let code = cleanupExpression(value.toString().replace(/'/g, "\\'").replace(/"/g, "'"));
|
|
1674
|
-
const testResult = /function ([^\s]+)\(/.exec(code);
|
|
1675
|
-
if (testResult) {
|
|
1676
|
-
serialized = [testResult[1]];
|
|
1677
|
-
} else {
|
|
1678
|
-
if (code.startsWith("($event) => ")) {
|
|
1679
|
-
code = code.substring("($event) => ".length);
|
|
1680
|
-
}
|
|
1681
|
-
serialized = code.split("\n");
|
|
1682
|
-
}
|
|
1683
|
-
} else {
|
|
1684
|
-
serialized = serializeAndCleanJs(value);
|
|
1685
|
-
}
|
|
1686
|
-
if (serialized.length > 1) {
|
|
1687
|
-
multilineAttrs = true;
|
|
1688
|
-
const indented = [`${directive}${arg}="${serialized[0]}`];
|
|
1689
|
-
indented.push(...serialized.slice(1, serialized.length - 1));
|
|
1690
|
-
indented.push(`${serialized[serialized.length - 1]}"`);
|
|
1691
|
-
attrs.push(indented);
|
|
1692
|
-
} else {
|
|
1693
|
-
attrs.push([`${directive}${arg}="${serialized[0]}"`]);
|
|
1694
|
-
}
|
|
1695
|
-
} else {
|
|
1696
|
-
attrs.push([`${prop}="${value}"`]);
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
if (attrs.length > 1) {
|
|
1700
|
-
multilineAttrs = true;
|
|
1701
|
-
}
|
|
1702
|
-
const tagName = getTagName(vnode);
|
|
1703
|
-
let isChildText = false;
|
|
1704
|
-
const childLines = [];
|
|
1705
|
-
if (typeof vnode.children === "string") {
|
|
1706
|
-
if (tagName === "pre") {
|
|
1707
|
-
childLines.push(vnode.children);
|
|
1708
|
-
} else {
|
|
1709
|
-
childLines.push(...vnode.children.split("\n"));
|
|
1710
|
-
}
|
|
1711
|
-
isChildText = true;
|
|
1712
|
-
} else if (Array.isArray(vnode.children)) {
|
|
1713
|
-
let isAllChildText;
|
|
1714
|
-
for (const child of vnode.children) {
|
|
1715
|
-
const result = await printVNode(child);
|
|
1716
|
-
if (result.isText) {
|
|
1717
|
-
if (isAllChildText === void 0) {
|
|
1718
|
-
isAllChildText = true;
|
|
1719
|
-
}
|
|
1720
|
-
const text = result.lines[0];
|
|
1721
|
-
if (!childLines.length || /^\s/.test(text)) {
|
|
1722
|
-
childLines.push(text.trim());
|
|
1723
|
-
} else {
|
|
1724
|
-
childLines[childLines.length - 1] += text;
|
|
1725
|
-
}
|
|
1726
|
-
} else {
|
|
1727
|
-
if (isAllChildText === void 0) {
|
|
1728
|
-
isAllChildText = false;
|
|
1729
|
-
}
|
|
1730
|
-
childLines.push(...result.lines);
|
|
1731
|
-
}
|
|
1732
|
-
}
|
|
1733
|
-
if (isAllChildText !== void 0) {
|
|
1734
|
-
isChildText = isAllChildText;
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
if (vnode.children && typeof vnode.children === "object" && !Array.isArray(vnode.children)) {
|
|
1738
|
-
for (const key in vnode.children) {
|
|
1739
|
-
if (typeof vnode.children[key] === "function") {
|
|
1740
|
-
const autoObject = createAutoBuildingObject((key2) => `{{ ${key2} }}`, (target, p) => {
|
|
1741
|
-
if (p === "__v_isRef") {
|
|
1742
|
-
return () => false;
|
|
1743
|
-
}
|
|
1744
|
-
});
|
|
1745
|
-
const children = vnode.children[key](autoObject.proxy);
|
|
1746
|
-
const slotLines = [];
|
|
1747
|
-
for (const child of children) {
|
|
1748
|
-
slotLines.push(...(await printVNode(child)).lines);
|
|
1749
|
-
}
|
|
1750
|
-
const slotProps = Object.keys(autoObject.cache);
|
|
1751
|
-
if (slotProps.length) {
|
|
1752
|
-
childLines.push(`<template #${key}="{ ${slotProps.join(", ")} }">`);
|
|
1753
|
-
childLines.push(...indent(slotLines));
|
|
1754
|
-
childLines.push("</template>");
|
|
1755
|
-
} else if (key === "default") {
|
|
1756
|
-
childLines.push(...slotLines);
|
|
1757
|
-
} else {
|
|
1758
|
-
childLines.push(`<template #${key}>`);
|
|
1759
|
-
childLines.push(...indent(slotLines));
|
|
1760
|
-
childLines.push(`</template>`);
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
const tag = [`<${tagName}`];
|
|
1766
|
-
if (multilineAttrs) {
|
|
1767
|
-
for (const attrLines of attrs) {
|
|
1768
|
-
tag.push(...indent(attrLines));
|
|
1769
|
-
}
|
|
1770
|
-
if (childLines.length > 0) {
|
|
1771
|
-
tag.push(">");
|
|
1772
|
-
}
|
|
1773
|
-
} else {
|
|
1774
|
-
if (attrs.length === 1) {
|
|
1775
|
-
tag[0] += ` ${attrs[0]}`;
|
|
1776
|
-
}
|
|
1777
|
-
if (childLines.length > 0) {
|
|
1778
|
-
tag[0] += ">";
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
const isVoid = voidElements.includes(tagName.toLowerCase());
|
|
1782
|
-
if (childLines.length > 0) {
|
|
1783
|
-
if (childLines.length === 1 && tag.length === 1 && !attrs.length && isChildText) {
|
|
1784
|
-
lines.push(`${tag[0]}${childLines[0]}</${tagName}>`);
|
|
1785
|
-
} else {
|
|
1786
|
-
lines.push(...tag);
|
|
1787
|
-
lines.push(...indent(childLines));
|
|
1788
|
-
lines.push(`</${tagName}>`);
|
|
1789
|
-
}
|
|
1790
|
-
} else if (tag.length > 1) {
|
|
1791
|
-
lines.push(...tag);
|
|
1792
|
-
lines.push(isVoid ? ">" : "/>");
|
|
1793
|
-
} else {
|
|
1794
|
-
lines.push(`${tag[0]}${isVoid ? "" : " /"}>`);
|
|
1795
|
-
}
|
|
1796
|
-
} else if ((vnode == null ? void 0 : vnode.shapeFlag) & 1 << 4) {
|
|
1797
|
-
for (const child of vnode.children) {
|
|
1798
|
-
lines.push(...(await printVNode(child)).lines);
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
return {
|
|
1802
|
-
lines
|
|
1803
|
-
};
|
|
1804
|
-
}
|
|
1805
|
-
function getTagName(vnode) {
|
|
1806
|
-
var _a, _b, _c, _d, _e;
|
|
1807
|
-
if (typeof vnode.type === "string") {
|
|
1808
|
-
return vnode.type;
|
|
1809
|
-
} else if ((_a = vnode.type) == null ? void 0 : _a.__asyncResolved) {
|
|
1810
|
-
const asyncComp = (_b = vnode.type) == null ? void 0 : _b.__asyncResolved;
|
|
1811
|
-
return (_c = asyncComp.name) != null ? _c : getNameFromFile(asyncComp.__file);
|
|
1812
|
-
} else if ((_d = vnode.type) == null ? void 0 : _d.name) {
|
|
1813
|
-
return vnode.type.name;
|
|
1814
|
-
} else if ((_e = vnode.type) == null ? void 0 : _e.__file) {
|
|
1815
|
-
return getNameFromFile(vnode.type.__file);
|
|
1816
|
-
}
|
|
1817
|
-
return "Anonymous";
|
|
1818
|
-
}
|
|
1819
|
-
function getNameFromFile(file) {
|
|
1820
|
-
const parts = /([^/]+)\.vue$/.exec(file);
|
|
1821
|
-
if (parts) {
|
|
1822
|
-
return pascal(parts[1]);
|
|
1823
|
-
}
|
|
1824
|
-
return "Anonymous";
|
|
1825
|
-
}
|
|
1826
|
-
function serializeAndCleanJs(value) {
|
|
1827
|
-
const isAutoBuildingObject = !!(value == null ? void 0 : value.__autoBuildingObject);
|
|
1828
|
-
const result = serializeJs(value);
|
|
1829
|
-
if (isAutoBuildingObject) {
|
|
1830
|
-
return [cleanupExpression(result.__autoBuildingObjectGetKey)];
|
|
1831
|
-
} else {
|
|
1832
|
-
return cleanupExpression(result).split("\n");
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
function cleanupExpression(expr) {
|
|
1836
|
-
return expr.replace(/\$setup\./g, "");
|
|
1837
|
-
}
|
|
1838
1762
|
var StorySourceCode_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
1839
1763
|
const _withScopeId = (n) => (pushScopeId("data-v-32cb8d14"), n = n(), popScopeId(), n);
|
|
1840
1764
|
const _hoisted_1$6 = { class: "htw-bg-gray-100 dark:htw-bg-gray-800 htw-h-full htw-overflow-hidden htw-flex htw-flex-col" };
|
|
@@ -1856,6 +1780,7 @@ const _hoisted_7$1 = {
|
|
|
1856
1780
|
};
|
|
1857
1781
|
const _hoisted_8$1 = ["innerHTML"];
|
|
1858
1782
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1783
|
+
name: "StorySourceCode",
|
|
1859
1784
|
props: {
|
|
1860
1785
|
variant: {
|
|
1861
1786
|
type: Object,
|
|
@@ -1984,6 +1909,7 @@ const _hoisted_1$4 = {
|
|
|
1984
1909
|
};
|
|
1985
1910
|
const _hoisted_2$4 = { class: "htw-flex htw-flex-col htw-items-stretch" };
|
|
1986
1911
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1912
|
+
name: "BaseOverflowMenu",
|
|
1987
1913
|
setup(__props) {
|
|
1988
1914
|
const overflowButtonWidth = 32;
|
|
1989
1915
|
const el = ref();
|
|
@@ -2126,6 +2052,7 @@ const _hoisted_8 = {
|
|
|
2126
2052
|
class: "htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
|
|
2127
2053
|
};
|
|
2128
2054
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2055
|
+
name: "PaneTabs",
|
|
2129
2056
|
setup(__props) {
|
|
2130
2057
|
const eventsStore = useEventsStore();
|
|
2131
2058
|
return (_ctx, _cache) => {
|
|
@@ -2199,6 +2126,7 @@ const _hoisted_1$1 = /* @__PURE__ */ createElementVNode("span", null, "Select a
|
|
|
2199
2126
|
const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", null, "Loading...", -1);
|
|
2200
2127
|
const _hoisted_3 = { class: "htw-flex htw-flex-col htw-h-full" };
|
|
2201
2128
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2129
|
+
name: "StorySidePanel",
|
|
2202
2130
|
setup(__props) {
|
|
2203
2131
|
const storyStore = useStoryStore();
|
|
2204
2132
|
const route = useRoute();
|
|
@@ -2260,6 +2188,7 @@ const _hoisted_2 = {
|
|
|
2260
2188
|
class: "htw-h-full htw-overflow-auto"
|
|
2261
2189
|
};
|
|
2262
2190
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2191
|
+
name: "StoryView",
|
|
2263
2192
|
setup(__props) {
|
|
2264
2193
|
const storyStore = useStoryStore();
|
|
2265
2194
|
const router = useRouter();
|