histoire 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/App.js +166 -0
- package/dist/bundled/_virtual/plugin-vue_export-helper.js +8 -0
- package/dist/bundled/api.js +1 -32
- package/dist/bundled/assets/histoire-text-dark.js +2 -0
- package/dist/bundled/assets/histoire-text.js +2 -0
- package/dist/bundled/{HomeView.js → assets/histoire.js} +1 -23
- package/dist/bundled/components/HomeView.js +24 -0
- package/dist/bundled/components/app/AppHeader.js +67 -0
- package/dist/bundled/components/app/AppLogo.js +26 -0
- package/dist/bundled/components/app/Breadcrumb.js +95 -0
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/app/InitialLoading.js +48 -0
- package/dist/bundled/components/app/MobileOverlay.js +41 -0
- package/dist/bundled/components/base/BaseCheckbox.js +75 -0
- package/dist/bundled/{BaseEmpty.js → components/base/BaseEmpty.js} +4 -4
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/base/BaseListItemLink.js +50 -0
- package/dist/bundled/components/base/BaseOverflowMenu.js +97 -0
- package/dist/bundled/components/base/BaseOverflowTab.js +45 -0
- package/dist/bundled/components/base/BaseSelect.js +88 -0
- package/dist/bundled/{MobileOverlay.js → components/base/BaseSplitPane.js} +9 -130
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/base/BaseTab.js +45 -0
- package/dist/bundled/components/misc/CheckerboardPattern.js +41 -0
- package/dist/bundled/components/misc/HatchedPattern.js +11 -0
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.js +98 -0
- package/dist/bundled/components/panel/ControlsComponentProps.js +42 -0
- package/dist/bundled/components/panel/PaneTabs.js +110 -0
- package/dist/bundled/components/panel/StatePresets.js +184 -0
- package/dist/bundled/components/panel/StoryControls.js +66 -0
- package/dist/bundled/components/panel/StoryDocs.js +48 -0
- package/dist/bundled/components/panel/StoryEvent.js +56 -0
- package/dist/bundled/components/panel/StoryEvents.js +49 -0
- package/dist/bundled/components/panel/StorySidePanel.js +68 -0
- package/dist/bundled/components/panel/StorySourceCode.js +110 -0
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/search/SearchItem.js +113 -0
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/search/SearchLoading.js +19 -0
- package/dist/bundled/components/search/SearchModal.js +46 -0
- package/dist/bundled/components/search/SearchPane.js +263 -0
- package/dist/bundled/{search-docs-data.js → components/search/search-docs-data.js} +1 -1
- package/dist/bundled/components/search/search-title-data.js +7 -0
- package/dist/bundled/components/story/StoryResponsivePreview.js +180 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantGrid.js +94 -0
- package/dist/bundled/components/story/StoryVariantGridItem.js +106 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantListItem.js +58 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantSingle.js +115 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +43 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +119 -0
- package/dist/bundled/components/story/StoryVariantSingleView.js +49 -0
- package/dist/bundled/components/story/StoryView.js +107 -0
- package/dist/bundled/components/story/StoryViewer.js +57 -0
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +85 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +33 -0
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +129 -0
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +24 -0
- package/dist/bundled/components/tree/StoryGroup.js +74 -0
- package/dist/bundled/components/tree/StoryList.js +37 -0
- package/dist/bundled/components/tree/StoryListFolder.js +89 -0
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/tree/StoryListItem.js +72 -0
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/index.js +28 -5
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +40 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +5 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +11 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +26 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +10 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +50 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +8 -0
- package/dist/bundled/router.js +28 -0
- package/dist/bundled/sandbox.js +11 -14
- package/dist/bundled/{events.js → stores/events.js} +3 -3
- package/dist/bundled/stores/folder.js +46 -0
- package/dist/bundled/stores/preview-settings.js +15 -0
- package/dist/bundled/{story.js → stores/story.js} +4 -30
- package/dist/bundled/style.css +56 -56
- package/dist/bundled/{config.js → util/config.js} +1 -1
- package/dist/bundled/{const.js → util/const.js} +1 -1
- package/dist/bundled/util/dark.js +4 -0
- package/dist/bundled/util/env.js +2 -0
- package/dist/bundled/util/events.js +32 -0
- package/dist/bundled/util/keyboard.js +84 -0
- package/dist/bundled/{mapping.js → util/mapping.js} +5 -5
- package/dist/bundled/util/preview-settings.js +6 -0
- package/dist/bundled/util/responsive.js +3 -0
- package/dist/bundled/util/sandbox.js +8 -0
- package/dist/bundled/util/scroll.js +28 -0
- package/dist/bundled/{state.js → util/state.js} +4 -3
- package/dist/bundled/util/tooltip.js +12 -0
- package/dist/bundled/util/variant.js +35 -0
- package/dist/client/app/App.vue +0 -1
- package/dist/client/app/components/app/Breadcrumb.vue +1 -1
- package/dist/client/app/components/app/MobileOverlay.vue +1 -1
- package/dist/client/app/components/base/BaseCheckbox.vue +2 -1
- package/dist/client/app/components/base/BaseCopyIcon.vue +34 -0
- package/dist/client/app/components/base/BaseOverflowMenu.vue +1 -0
- package/dist/client/app/components/base/BaseSplitPane.vue +1 -0
- package/dist/client/app/components/panel/StatePresets.vue +3 -3
- package/dist/client/app/components/panel/StorySidePanel.vue +1 -1
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -0
- package/dist/client/app/components/story/StoryVariantSingle.vue +5 -7
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
- package/dist/client/app/components/story/StoryViewer.vue +2 -2
- package/dist/client/app/components/tree/StoryList.vue +1 -1
- package/dist/client/app/components/tree/StoryListItem.vue +2 -2
- package/dist/client/app/index.js +1 -3
- package/dist/client/app/sandbox.js +3 -2
- package/dist/client/app/stores/story.d.ts +30 -30
- package/dist/client/app/util/dark.d.ts +1 -1
- package/dist/client/app/util/mapping.js +3 -3
- package/dist/client/app/util/responsive.d.ts +1 -1
- package/dist/client/app/util/scroll.js +1 -1
- package/dist/client/app/util/state.js +2 -1
- package/dist/node/build.js +8 -1
- package/dist/node/commands/dev.js +1 -1
- package/dist/node/server.js +5 -4
- package/dist/node/util/log.d.ts +1 -0
- package/dist/node/util/log.js +9 -0
- package/dist/node/vite.d.ts +1 -1
- package/dist/node/vite.js +5 -3
- package/dist/style.css +21 -0
- package/index.d.ts +0 -2
- package/package.json +8 -15
- package/src/client/app/App.vue +0 -1
- package/src/client/app/components/app/Breadcrumb.vue +1 -1
- package/src/client/app/components/app/MobileOverlay.vue +1 -1
- package/src/client/app/components/base/BaseCheckbox.vue +2 -1
- package/src/client/app/components/base/BaseCopyIcon.vue +34 -0
- package/src/client/app/components/base/BaseOverflowMenu.vue +1 -0
- package/src/client/app/components/base/BaseSplitPane.vue +1 -0
- package/src/client/app/components/panel/StatePresets.vue +3 -3
- package/src/client/app/components/panel/StorySidePanel.vue +1 -1
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -0
- package/src/client/app/components/story/StoryVariantSingle.vue +5 -7
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
- package/src/client/app/components/story/StoryViewer.vue +2 -2
- package/src/client/app/components/tree/StoryList.vue +1 -1
- package/src/client/app/components/tree/StoryListItem.vue +2 -2
- package/src/client/app/index.ts +1 -5
- package/src/client/app/sandbox.ts +3 -2
- package/src/client/app/util/mapping.ts +3 -3
- package/src/client/app/util/scroll.ts +1 -1
- package/src/client/app/util/state.ts +2 -1
- package/src/node/build.ts +13 -3
- package/src/node/commands/dev.ts +1 -1
- package/src/node/server.ts +5 -4
- package/src/node/util/log.ts +9 -0
- package/src/node/vite.ts +5 -3
- package/tsconfig.json +12 -0
- package/vite.config.ts +21 -10
- package/vue.d.ts +1 -0
- package/dist/bundled/SearchPane.js +0 -506
- package/dist/bundled/StoryView.js +0 -2264
- package/dist/bundled/dark.js +0 -4
- package/dist/bundled/index2.js +0 -843
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { pushScopeId, popScopeId, createElementVNode, createStaticVNode, defineComponent, useCssVars, unref, ref, onUnmounted, computed, openBlock, createElementBlock, createVNode, createCommentVNode, normalizeClass, createBlock, renderSlot, Fragment } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { useEventListener } from "@histoire/vendors/dist/client/vue-use.js";
|
|
3
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
4
|
+
import HatchedPattern from "../misc/HatchedPattern.js";
|
|
5
|
+
import CheckerboardPattern from "../misc/CheckerboardPattern.js";
|
|
6
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
7
|
+
import "./StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
8
|
+
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
9
|
+
const _withScopeId = (n) => (pushScopeId("data-v-769a585e"), n = n(), popScopeId(), n);
|
|
10
|
+
const _hoisted_1 = { 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" };
|
|
11
|
+
const _hoisted_2 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
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"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_3 = { class: "htw-p-4 htw-h-full htw-relative" };
|
|
16
|
+
const _hoisted_4 = { class: "htw-w-full htw-h-full htw-border htw-border-gray-100 dark:htw-border-gray-800 htw-rounded-sm htw-relative" };
|
|
17
|
+
const _hoisted_5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "bind-preview-bg htw-absolute htw-inset-0" }, null, -1));
|
|
18
|
+
const _hoisted_6 = /* @__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);
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
|
+
name: "StoryResponsivePreview",
|
|
21
|
+
props: {
|
|
22
|
+
variant: null
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
useCssVars((_ctx) => ({
|
|
27
|
+
"700caecc": unref(settings).backgroundColor
|
|
28
|
+
}));
|
|
29
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
30
|
+
const resizing = ref(false);
|
|
31
|
+
const onUnmountedCleanupFns = [];
|
|
32
|
+
onUnmounted(() => {
|
|
33
|
+
onUnmountedCleanupFns.forEach((fn) => fn());
|
|
34
|
+
});
|
|
35
|
+
function addWindowListener(event, listener) {
|
|
36
|
+
window.addEventListener(event, listener);
|
|
37
|
+
const removeListener = () => window.removeEventListener(event, listener);
|
|
38
|
+
onUnmountedCleanupFns.push(removeListener);
|
|
39
|
+
return () => {
|
|
40
|
+
removeListener();
|
|
41
|
+
onUnmountedCleanupFns.splice(onUnmountedCleanupFns.indexOf(removeListener), 1);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function useDragger(el, value, min, max, axis) {
|
|
45
|
+
function onMouseDown(event) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
const start = axis === "x" ? event.clientX : event.clientY;
|
|
49
|
+
const startValue = value.value;
|
|
50
|
+
resizing.value = true;
|
|
51
|
+
const removeListeners = [
|
|
52
|
+
addWindowListener("mousemove", onMouseMove),
|
|
53
|
+
addWindowListener("mouseup", onMouseUp)
|
|
54
|
+
];
|
|
55
|
+
function onMouseMove(event2) {
|
|
56
|
+
const snapTarget = axis === "x" ? previewWrapper.value.clientWidth : previewWrapper.value.clientHeight;
|
|
57
|
+
const delta = (axis === "x" ? event2.clientX : event2.clientY) - start;
|
|
58
|
+
value.value = Math.max(min, Math.min(max, startValue + delta));
|
|
59
|
+
if (Math.abs(value.value - (snapTarget - 67)) < 16) {
|
|
60
|
+
value.value = null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function onMouseUp() {
|
|
64
|
+
removeListeners.forEach((fn) => fn());
|
|
65
|
+
resizing.value = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
useEventListener(el, "mousedown", onMouseDown);
|
|
69
|
+
function onTouchStart(event) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
const start = axis === "x" ? event.touches[0].clientX : event.touches[0].clientY;
|
|
73
|
+
const startValue = value.value;
|
|
74
|
+
resizing.value = true;
|
|
75
|
+
const removeListeners = [
|
|
76
|
+
addWindowListener("touchmove", onTouchMove),
|
|
77
|
+
addWindowListener("touchend", onTouchEnd),
|
|
78
|
+
addWindowListener("touchcancel", onTouchEnd)
|
|
79
|
+
];
|
|
80
|
+
function onTouchMove(event2) {
|
|
81
|
+
const delta = (axis === "x" ? event2.touches[0].clientX : event2.touches[0].clientY) - start;
|
|
82
|
+
value.value = Math.max(min, Math.min(max, startValue + delta));
|
|
83
|
+
}
|
|
84
|
+
function onTouchEnd() {
|
|
85
|
+
removeListeners.forEach((fn) => fn());
|
|
86
|
+
resizing.value = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
useEventListener(el, "touchstart", onTouchStart);
|
|
90
|
+
}
|
|
91
|
+
const responsiveWidth = computed({
|
|
92
|
+
get: () => settings[settings.rotate ? "responsiveHeight" : "responsiveWidth"],
|
|
93
|
+
set: (value) => {
|
|
94
|
+
settings[settings.rotate ? "responsiveHeight" : "responsiveWidth"] = value;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const responsiveHeight = computed({
|
|
98
|
+
get: () => settings[settings.rotate ? "responsiveWidth" : "responsiveHeight"],
|
|
99
|
+
set: (value) => {
|
|
100
|
+
settings[settings.rotate ? "responsiveWidth" : "responsiveHeight"] = value;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const horizontalDragger = ref();
|
|
104
|
+
const verticalDragger = ref();
|
|
105
|
+
const cornerDragger = ref();
|
|
106
|
+
const previewWrapper = ref();
|
|
107
|
+
useDragger(horizontalDragger, responsiveWidth, 32, 2e4, "x");
|
|
108
|
+
useDragger(verticalDragger, responsiveHeight, 32, 2e4, "y");
|
|
109
|
+
useDragger(cornerDragger, responsiveWidth, 32, 2e4, "x");
|
|
110
|
+
useDragger(cornerDragger, responsiveHeight, 32, 2e4, "y");
|
|
111
|
+
const finalWidth = computed(() => settings.rotate ? settings.responsiveHeight : settings.responsiveWidth);
|
|
112
|
+
const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth : settings.responsiveHeight);
|
|
113
|
+
const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled);
|
|
114
|
+
return (_ctx, _cache) => {
|
|
115
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
116
|
+
unref(isResponsiveEnabled) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
117
|
+
createVNode(HatchedPattern, { class: "htw-w-full htw-h-full htw-text-black/[2%] dark:htw-text-white/[2%]" })
|
|
118
|
+
])) : createCommentVNode("", true),
|
|
119
|
+
createElementVNode("div", {
|
|
120
|
+
ref_key: "previewWrapper",
|
|
121
|
+
ref: previewWrapper,
|
|
122
|
+
class: "htw-h-full htw-overflow-auto htw-relative"
|
|
123
|
+
}, [
|
|
124
|
+
createElementVNode("div", {
|
|
125
|
+
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) ? {
|
|
126
|
+
"htw-w-fit": !!unref(finalWidth),
|
|
127
|
+
"htw-h-fit": !!unref(finalHeight)
|
|
128
|
+
} : void 0])
|
|
129
|
+
}, [
|
|
130
|
+
createElementVNode("div", _hoisted_3, [
|
|
131
|
+
createElementVNode("div", _hoisted_4, [
|
|
132
|
+
_hoisted_5,
|
|
133
|
+
unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
|
|
134
|
+
key: 0,
|
|
135
|
+
class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
136
|
+
})) : createCommentVNode("", true),
|
|
137
|
+
renderSlot(_ctx.$slots, "default", {
|
|
138
|
+
isResponsiveEnabled: unref(isResponsiveEnabled),
|
|
139
|
+
finalWidth: unref(finalWidth),
|
|
140
|
+
finalHeight: unref(finalHeight),
|
|
141
|
+
resizing: resizing.value
|
|
142
|
+
}, void 0, true)
|
|
143
|
+
]),
|
|
144
|
+
_hoisted_6
|
|
145
|
+
]),
|
|
146
|
+
unref(isResponsiveEnabled) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
147
|
+
createElementVNode("div", {
|
|
148
|
+
ref_key: "horizontalDragger",
|
|
149
|
+
ref: horizontalDragger,
|
|
150
|
+
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"
|
|
151
|
+
}, [
|
|
152
|
+
createVNode(unref(Icon), {
|
|
153
|
+
icon: "mdi:drag-vertical-variant",
|
|
154
|
+
class: "htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
|
|
155
|
+
})
|
|
156
|
+
], 512),
|
|
157
|
+
createElementVNode("div", {
|
|
158
|
+
ref_key: "verticalDragger",
|
|
159
|
+
ref: verticalDragger,
|
|
160
|
+
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"
|
|
161
|
+
}, [
|
|
162
|
+
createVNode(unref(Icon), {
|
|
163
|
+
icon: "mdi:drag-horizontal-variant",
|
|
164
|
+
class: "htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
|
|
165
|
+
})
|
|
166
|
+
], 512),
|
|
167
|
+
createElementVNode("div", {
|
|
168
|
+
ref_key: "cornerDragger",
|
|
169
|
+
ref: cornerDragger,
|
|
170
|
+
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"
|
|
171
|
+
}, null, 512)
|
|
172
|
+
], 64)) : createCommentVNode("", true)
|
|
173
|
+
], 2)
|
|
174
|
+
], 512)
|
|
175
|
+
]);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
var StoryResponsivePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-769a585e"]]);
|
|
180
|
+
export { StoryResponsivePreview as default };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, watch, openBlock, createElementBlock, createElementVNode, normalizeStyle, unref, Fragment, renderList, createBlock } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { useResizeObserver } from "@histoire/vendors/dist/client/vue-use.js";
|
|
3
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
4
|
+
import StoryVariantGridItem from "./StoryVariantGridItem.js";
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
name: "StoryVariantGrid",
|
|
7
|
+
setup(__props) {
|
|
8
|
+
const storyStore = useStoryStore();
|
|
9
|
+
const gridTemplateWidth = computed(() => {
|
|
10
|
+
if (storyStore.currentStory.layout.type !== "grid") {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const layoutWidth = storyStore.currentStory.layout.width;
|
|
14
|
+
if (!layoutWidth) {
|
|
15
|
+
return "200px";
|
|
16
|
+
}
|
|
17
|
+
if (typeof layoutWidth === "number") {
|
|
18
|
+
return layoutWidth + "px";
|
|
19
|
+
}
|
|
20
|
+
return layoutWidth;
|
|
21
|
+
});
|
|
22
|
+
const margin = 16;
|
|
23
|
+
const gap = 16;
|
|
24
|
+
const itemWidth = ref(16);
|
|
25
|
+
const maxItemHeight = ref(0);
|
|
26
|
+
const maxCount = ref(10);
|
|
27
|
+
const countPerRow = ref(0);
|
|
28
|
+
const visibleRows = ref(0);
|
|
29
|
+
const el = ref(null);
|
|
30
|
+
useResizeObserver(el, () => {
|
|
31
|
+
updateMaxCount();
|
|
32
|
+
});
|
|
33
|
+
function updateMaxCount() {
|
|
34
|
+
if (!maxItemHeight.value)
|
|
35
|
+
return;
|
|
36
|
+
const width = el.value.clientWidth - margin * 2;
|
|
37
|
+
const height = el.value.clientHeight;
|
|
38
|
+
const scrollTop = el.value.scrollTop;
|
|
39
|
+
countPerRow.value = Math.floor((width + gap) / (itemWidth.value + gap));
|
|
40
|
+
visibleRows.value = Math.ceil((height + scrollTop + gap) / (maxItemHeight.value + gap));
|
|
41
|
+
const newMaxCount = countPerRow.value * visibleRows.value;
|
|
42
|
+
if (maxCount.value < newMaxCount) {
|
|
43
|
+
maxCount.value = newMaxCount;
|
|
44
|
+
}
|
|
45
|
+
if (storyStore.currentVariant) {
|
|
46
|
+
const index = storyStore.currentStory.variants.indexOf(storyStore.currentVariant);
|
|
47
|
+
if (index + 1 > maxCount.value) {
|
|
48
|
+
maxCount.value = index + 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function onItemResize(w, h) {
|
|
53
|
+
itemWidth.value = w;
|
|
54
|
+
if (maxItemHeight.value < h) {
|
|
55
|
+
maxItemHeight.value = h;
|
|
56
|
+
updateMaxCount();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
watch(() => storyStore.currentVariant, () => {
|
|
60
|
+
updateMaxCount();
|
|
61
|
+
});
|
|
62
|
+
return (_ctx, _cache) => {
|
|
63
|
+
return openBlock(), createElementBlock("div", {
|
|
64
|
+
ref_key: "el",
|
|
65
|
+
ref: el,
|
|
66
|
+
class: "htw-h-full htw-overflow-y-auto",
|
|
67
|
+
onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
|
|
68
|
+
}, [
|
|
69
|
+
createElementVNode("div", {
|
|
70
|
+
style: normalizeStyle({
|
|
71
|
+
minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
|
|
72
|
+
})
|
|
73
|
+
}, [
|
|
74
|
+
createElementVNode("div", {
|
|
75
|
+
class: "htw-grid htw-gap-4 htw-m-4",
|
|
76
|
+
style: normalizeStyle({
|
|
77
|
+
gridTemplateColumns: `repeat(auto-fill, ${unref(gridTemplateWidth)})`
|
|
78
|
+
})
|
|
79
|
+
}, [
|
|
80
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
|
|
81
|
+
return openBlock(), createBlock(StoryVariantGridItem, {
|
|
82
|
+
key: index,
|
|
83
|
+
variant,
|
|
84
|
+
story: unref(storyStore).currentStory,
|
|
85
|
+
onResize: onItemResize
|
|
86
|
+
}, null, 8, ["variant", "story"]);
|
|
87
|
+
}), 128))
|
|
88
|
+
], 4)
|
|
89
|
+
], 4)
|
|
90
|
+
], 544);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, normalizeClass, withCtx, toDisplayString, withModifiers } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
+
import { useRouter } from "@histoire/vendors/dist/client/vue-router.js";
|
|
4
|
+
import { useResizeObserver } from "@histoire/vendors/dist/client/vue-use.js";
|
|
5
|
+
import { SandboxVue3 } from "@histoire/plugin-vue/client";
|
|
6
|
+
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
7
|
+
import { useScrollOnActive } from "../../util/scroll.js";
|
|
8
|
+
import "./StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
9
|
+
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
10
|
+
const _withScopeId = (n) => (pushScopeId("data-v-307653da"), n = n(), popScopeId(), n);
|
|
11
|
+
const _hoisted_1 = { class: "htw-flex-none htw-flex htw-items-center" };
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
name: "StoryVariantGridItem",
|
|
14
|
+
props: {
|
|
15
|
+
variant: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
story: {
|
|
20
|
+
type: Object,
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
emits: {
|
|
25
|
+
resize: (width, height) => true
|
|
26
|
+
},
|
|
27
|
+
setup(__props, { emit }) {
|
|
28
|
+
const props = __props;
|
|
29
|
+
useCssVars((_ctx) => ({
|
|
30
|
+
"5f94a358": unref(variant).iconColor
|
|
31
|
+
}));
|
|
32
|
+
const { variant } = toRefs(props);
|
|
33
|
+
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
34
|
+
Object.assign(props.variant, {
|
|
35
|
+
previewReady: false
|
|
36
|
+
});
|
|
37
|
+
function onReady() {
|
|
38
|
+
Object.assign(props.variant, {
|
|
39
|
+
previewReady: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const router = useRouter();
|
|
43
|
+
function selectVariant() {
|
|
44
|
+
router.push(targetRoute.value);
|
|
45
|
+
}
|
|
46
|
+
const el = ref();
|
|
47
|
+
const { autoScroll } = useScrollOnActive(isActive, el);
|
|
48
|
+
useResizeObserver(el, () => {
|
|
49
|
+
if (props.variant.previewReady) {
|
|
50
|
+
emit("resize", el.value.clientWidth, el.value.clientHeight);
|
|
51
|
+
if (isActive.value) {
|
|
52
|
+
autoScroll();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return (_ctx, _cache) => {
|
|
57
|
+
const _component_RouterLink = resolveComponent("RouterLink");
|
|
58
|
+
return openBlock(), createElementBlock("div", {
|
|
59
|
+
ref_key: "el",
|
|
60
|
+
ref: el,
|
|
61
|
+
class: "htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
|
|
62
|
+
}, [
|
|
63
|
+
createElementVNode("div", _hoisted_1, [
|
|
64
|
+
createVNode(_component_RouterLink, {
|
|
65
|
+
to: unref(targetRoute),
|
|
66
|
+
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", {
|
|
67
|
+
"hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800": !unref(isActive),
|
|
68
|
+
"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)
|
|
69
|
+
}])
|
|
70
|
+
}, {
|
|
71
|
+
default: withCtx(() => {
|
|
72
|
+
var _a;
|
|
73
|
+
return [
|
|
74
|
+
createVNode(unref(Icon), {
|
|
75
|
+
icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
|
|
76
|
+
class: normalizeClass(["base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50", {
|
|
77
|
+
"htw-text-gray-500": !unref(isActive) && !unref(variant).iconColor,
|
|
78
|
+
"bind-icon-color": !unref(isActive) && unref(variant).iconColor
|
|
79
|
+
}])
|
|
80
|
+
}, null, 8, ["icon", "class"]),
|
|
81
|
+
createElementVNode("span", null, toDisplayString(unref(variant).title), 1)
|
|
82
|
+
];
|
|
83
|
+
}),
|
|
84
|
+
_: 1
|
|
85
|
+
}, 8, ["to", "class"])
|
|
86
|
+
]),
|
|
87
|
+
createElementVNode("div", {
|
|
88
|
+
class: normalizeClass(["htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded-lg htw-flex-1 htw-p-4", {
|
|
89
|
+
"htw-border-gray-100 dark:htw-border-gray-800": !unref(isActive),
|
|
90
|
+
"htw-border-primary-200 dark:htw-border-primary-900": unref(isActive)
|
|
91
|
+
}]),
|
|
92
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop", "prevent"])),
|
|
93
|
+
onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
|
|
94
|
+
}, [
|
|
95
|
+
createVNode(unref(SandboxVue3), {
|
|
96
|
+
variant: unref(variant),
|
|
97
|
+
story: __props.story,
|
|
98
|
+
onReady
|
|
99
|
+
}, null, 8, ["variant", "story"])
|
|
100
|
+
], 34)
|
|
101
|
+
], 512);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
var StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-307653da"]]);
|
|
106
|
+
export { StoryVariantGridItem as default };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, openBlock, createElementBlock, createVNode, withCtx, normalizeClass, createElementVNode, toDisplayString } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
3
|
+
import BaseListItemLink from "../base/BaseListItemLink.js";
|
|
4
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
5
|
+
import { useScrollOnActive } from "../../util/scroll.js";
|
|
6
|
+
import "./StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
7
|
+
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
8
|
+
const _withScopeId = (n) => (pushScopeId("data-v-2cdc2ac0"), n = n(), popScopeId(), n);
|
|
9
|
+
const _hoisted_1 = { class: "htw-truncate" };
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
name: "StoryVariantListItem",
|
|
12
|
+
props: {
|
|
13
|
+
variant: {
|
|
14
|
+
type: Object,
|
|
15
|
+
required: true
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
useCssVars((_ctx) => ({
|
|
21
|
+
"3c4190ff": unref(variant).iconColor
|
|
22
|
+
}));
|
|
23
|
+
const { variant } = toRefs(props);
|
|
24
|
+
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
25
|
+
const el = ref();
|
|
26
|
+
useScrollOnActive(isActive, el);
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
return openBlock(), createElementBlock("div", {
|
|
29
|
+
ref_key: "el",
|
|
30
|
+
ref: el,
|
|
31
|
+
"data-test-id": "story-variant-list-item"
|
|
32
|
+
}, [
|
|
33
|
+
createVNode(BaseListItemLink, {
|
|
34
|
+
to: unref(targetRoute),
|
|
35
|
+
"is-active": unref(isActive),
|
|
36
|
+
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"
|
|
37
|
+
}, {
|
|
38
|
+
default: withCtx(({ active }) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return [
|
|
41
|
+
createVNode(unref(Icon), {
|
|
42
|
+
icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
|
|
43
|
+
class: normalizeClass(["base-list-item-link-icon htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none", {
|
|
44
|
+
"htw-text-gray-500": !active && !unref(variant).iconColor,
|
|
45
|
+
"bind-icon-color": !active && unref(variant).iconColor
|
|
46
|
+
}])
|
|
47
|
+
}, null, 8, ["icon", "class"]),
|
|
48
|
+
createElementVNode("span", _hoisted_1, toDisplayString(unref(variant).title), 1)
|
|
49
|
+
];
|
|
50
|
+
}),
|
|
51
|
+
_: 1
|
|
52
|
+
}, 8, ["to", "is-active"])
|
|
53
|
+
], 512);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
var StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2cdc2ac0"]]);
|
|
58
|
+
export { StoryVariantListItem as default };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { pushScopeId, popScopeId, createTextVNode, defineComponent, useCssVars, unref, computed, openBlock, createElementBlock, createVNode, Fragment, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, createBlock, withCtx, renderList } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
3
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
4
|
+
import { isMobile } from "../../util/responsive.js";
|
|
5
|
+
import BaseSplitPane from "../base/BaseSplitPane.js";
|
|
6
|
+
import StoryVariantListItem from "./StoryVariantListItem.js";
|
|
7
|
+
import _sfc_main$1 from "./StoryVariantSingleView.js";
|
|
8
|
+
import "./StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
9
|
+
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
10
|
+
const _withScopeId = (n) => (pushScopeId("data-v-30bcb922"), n = n(), popScopeId(), n);
|
|
11
|
+
const _hoisted_1 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "htw-p-2 htw-h-full"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_2 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode(" Select a variant... ");
|
|
20
|
+
const _hoisted_4 = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "htw-p-2 htw-h-full"
|
|
23
|
+
};
|
|
24
|
+
const _hoisted_5 = { class: "htw-h-full htw-overflow-y-auto" };
|
|
25
|
+
const _hoisted_6 = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "htw-p-2 htw-h-full"
|
|
28
|
+
};
|
|
29
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
30
|
+
name: "StoryVariantSingle",
|
|
31
|
+
emits: {
|
|
32
|
+
"open-variant-menu": () => true
|
|
33
|
+
},
|
|
34
|
+
setup(__props) {
|
|
35
|
+
useCssVars((_ctx) => {
|
|
36
|
+
var _a;
|
|
37
|
+
return {
|
|
38
|
+
"33d9fc01": (_a = unref(variant)) == null ? void 0 : _a.iconColor
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
const storyStore = useStoryStore();
|
|
42
|
+
const hasSingleVariant = computed(() => {
|
|
43
|
+
var _a;
|
|
44
|
+
return ((_a = storyStore.currentStory) == null ? void 0 : _a.variants.length) === 1;
|
|
45
|
+
});
|
|
46
|
+
const variant = computed(() => storyStore.currentVariant);
|
|
47
|
+
return (_ctx, _cache) => {
|
|
48
|
+
var _a;
|
|
49
|
+
return unref(hasSingleVariant) && unref(variant) ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
50
|
+
createVNode(_sfc_main$1, {
|
|
51
|
+
variant: unref(variant),
|
|
52
|
+
story: unref(storyStore).currentStory
|
|
53
|
+
}, null, 8, ["variant", "story"])
|
|
54
|
+
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
55
|
+
unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
56
|
+
createElementVNode("a", {
|
|
57
|
+
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",
|
|
58
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("open-variant-menu"))
|
|
59
|
+
}, [
|
|
60
|
+
unref(variant) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
61
|
+
createVNode(unref(Icon), {
|
|
62
|
+
icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
|
|
63
|
+
class: normalizeClass(["base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none", {
|
|
64
|
+
"htw-text-gray-500": !unref(variant).iconColor,
|
|
65
|
+
"bind-icon-color": unref(variant).iconColor
|
|
66
|
+
}])
|
|
67
|
+
}, null, 8, ["icon", "class"]),
|
|
68
|
+
createTextVNode(" " + toDisplayString(unref(variant).title), 1)
|
|
69
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
70
|
+
_hoisted_3
|
|
71
|
+
], 64)),
|
|
72
|
+
createVNode(unref(Icon), {
|
|
73
|
+
icon: "carbon:chevron-sort",
|
|
74
|
+
class: "htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
75
|
+
})
|
|
76
|
+
]),
|
|
77
|
+
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
78
|
+
createVNode(_sfc_main$1, {
|
|
79
|
+
variant: unref(storyStore).currentVariant,
|
|
80
|
+
story: unref(storyStore).currentStory
|
|
81
|
+
}, null, 8, ["variant", "story"])
|
|
82
|
+
])) : createCommentVNode("", true)
|
|
83
|
+
])) : (openBlock(), createBlock(BaseSplitPane, {
|
|
84
|
+
key: 1,
|
|
85
|
+
"save-id": "story-single-main-split",
|
|
86
|
+
min: 5,
|
|
87
|
+
max: 40,
|
|
88
|
+
"default-split": 17
|
|
89
|
+
}, {
|
|
90
|
+
first: withCtx(() => [
|
|
91
|
+
createElementVNode("div", _hoisted_5, [
|
|
92
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (v, index) => {
|
|
93
|
+
return openBlock(), createBlock(StoryVariantListItem, {
|
|
94
|
+
key: index,
|
|
95
|
+
variant: v
|
|
96
|
+
}, null, 8, ["variant"]);
|
|
97
|
+
}), 128))
|
|
98
|
+
])
|
|
99
|
+
]),
|
|
100
|
+
last: withCtx(() => [
|
|
101
|
+
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
102
|
+
createVNode(_sfc_main$1, {
|
|
103
|
+
variant: unref(storyStore).currentVariant,
|
|
104
|
+
story: unref(storyStore).currentStory
|
|
105
|
+
}, null, 8, ["variant", "story"])
|
|
106
|
+
])) : createCommentVNode("", true)
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
}))
|
|
110
|
+
], 64));
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-30bcb922"]]);
|
|
115
|
+
export { StoryVariantSingle as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, unref } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { SandboxVue3 } from "@histoire/plugin-vue/client";
|
|
3
|
+
import StoryResponsivePreview from "./StoryResponsivePreview.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
name: "StoryVariantSinglePreviewNative",
|
|
6
|
+
props: {
|
|
7
|
+
story: null,
|
|
8
|
+
variant: null
|
|
9
|
+
},
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
Object.assign(props.variant, {
|
|
13
|
+
previewReady: false
|
|
14
|
+
});
|
|
15
|
+
function onReady() {
|
|
16
|
+
Object.assign(props.variant, {
|
|
17
|
+
previewReady: true
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return (_ctx, _cache) => {
|
|
21
|
+
return openBlock(), createBlock(StoryResponsivePreview, { variant: __props.variant }, {
|
|
22
|
+
default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight }) => [
|
|
23
|
+
createElementVNode("div", {
|
|
24
|
+
style: normalizeStyle(isResponsiveEnabled ? {
|
|
25
|
+
width: finalWidth ? `${finalWidth}px` : "100%",
|
|
26
|
+
height: finalHeight ? `${finalHeight}px` : "100%"
|
|
27
|
+
} : { width: "100%", height: "100%" })
|
|
28
|
+
}, [
|
|
29
|
+
(openBlock(), createBlock(unref(SandboxVue3), {
|
|
30
|
+
key: `${__props.story.id}-${__props.variant.id}`,
|
|
31
|
+
variant: __props.variant,
|
|
32
|
+
story: __props.story,
|
|
33
|
+
class: "htw-h-full",
|
|
34
|
+
onReady
|
|
35
|
+
}, null, 8, ["variant", "story"]))
|
|
36
|
+
], 4)
|
|
37
|
+
]),
|
|
38
|
+
_: 1
|
|
39
|
+
}, 8, ["variant"]);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export { _sfc_main as default };
|