@histoire/app 0.9.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/LICENSE +21 -0
- package/dist/app/assets/histoire-text-dark.svg +89 -0
- package/dist/app/assets/histoire-text.svg +89 -0
- package/dist/app/assets/histoire.svg +51 -0
- package/dist/app/style/floating-vue.pcss +34 -0
- package/dist/app/style/main.pcss +86 -0
- package/dist/app/style/sandbox.css +19 -0
- package/dist/app/style/transitions.pcss +51 -0
- package/dist/bundle-index.js +1 -0
- package/dist/bundle-main.js +5 -0
- package/dist/bundle-sandbox.js +2 -0
- package/dist/bundled/App.js +148 -0
- package/dist/bundled/_virtual/plugin-vue_export-helper.js +8 -0
- package/dist/bundled/api.js +1 -0
- package/dist/bundled/assets/histoire-text-dark.js +2 -0
- package/dist/bundled/assets/histoire-text.js +2 -0
- package/dist/bundled/assets/histoire.js +2 -0
- 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/components/base/BaseEmpty.js +13 -0
- 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 +69 -0
- package/dist/bundled/components/base/BaseSplitPane.js +184 -0
- 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 +112 -0
- package/dist/bundled/components/panel/StatePresets.js +190 -0
- package/dist/bundled/components/panel/StoryControls.js +66 -0
- package/dist/bundled/components/panel/StoryDocs.js +57 -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 +72 -0
- package/dist/bundled/components/panel/StorySourceCode.js +119 -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/components/search/search-docs-data.js +7 -0
- package/dist/bundled/components/search/search-title-data.js +7 -0
- package/dist/bundled/components/story/GenericMountStory.js +27 -0
- package/dist/bundled/components/story/GenericRenderStory.js +27 -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 +90 -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 +29 -0
- 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 +88 -0
- package/dist/bundled/stores/events.js +29 -0
- package/dist/bundled/stores/folder.js +49 -0
- package/dist/bundled/stores/preview-settings.js +15 -0
- package/dist/bundled/stores/story.js +43 -0
- package/dist/bundled/style.css +102 -0
- package/dist/bundled/util/config.js +4 -0
- package/dist/bundled/util/const.js +5 -0
- 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/util/mapping.js +65 -0
- 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/util/state.js +31 -0
- package/dist/bundled/util/tooltip.js +12 -0
- package/dist/bundled/util/variant.js +18 -0
- package/dist/style.css +2697 -0
- package/package.json +57 -0
- package/postcss.config.cjs +8 -0
- package/scripts/copy.mjs +12 -0
- package/scripts/watchAndCopy.mjs +15 -0
- package/src/app/App.vue +162 -0
- package/src/app/api.ts +1 -0
- package/src/app/assets/histoire-text-dark.svg +89 -0
- package/src/app/assets/histoire-text.svg +89 -0
- package/src/app/assets/histoire.svg +51 -0
- package/src/app/components/HomeView.vue +17 -0
- package/src/app/components/app/AppHeader.vue +64 -0
- package/src/app/components/app/AppLogo.vue +24 -0
- package/src/app/components/app/Breadcrumb.vue +98 -0
- package/src/app/components/app/InitialLoading.vue +44 -0
- package/src/app/components/app/MobileOverlay.vue +33 -0
- package/src/app/components/base/BaseCheckbox.vue +77 -0
- package/src/app/components/base/BaseCopyIcon.vue +34 -0
- package/src/app/components/base/BaseEmpty.vue +21 -0
- package/src/app/components/base/BaseListItemLink.vue +55 -0
- package/src/app/components/base/BaseOverflowMenu.vue +119 -0
- package/src/app/components/base/BaseOverflowTab.vue +46 -0
- package/src/app/components/base/BaseSelect.vue +72 -0
- package/src/app/components/base/BaseSplitPane.vue +240 -0
- package/src/app/components/base/BaseTab.vue +46 -0
- package/src/app/components/misc/CheckerboardPattern.vue +32 -0
- package/src/app/components/misc/HatchedPattern.vue +13 -0
- package/src/app/components/panel/ControlsComponentPropItem.vue +103 -0
- package/src/app/components/panel/ControlsComponentProps.vue +34 -0
- package/src/app/components/panel/PaneTabs.vue +89 -0
- package/src/app/components/panel/StatePresets.vue +196 -0
- package/src/app/components/panel/StoryControls.vue +68 -0
- package/src/app/components/panel/StoryDocs.vue +60 -0
- package/src/app/components/panel/StoryEvent.vue +54 -0
- package/src/app/components/panel/StoryEvents.vue +45 -0
- package/src/app/components/panel/StorySidePanel.vue +70 -0
- package/src/app/components/panel/StorySourceCode.vue +126 -0
- package/src/app/components/search/SearchItem.vue +110 -0
- package/src/app/components/search/SearchLoading.vue +16 -0
- package/src/app/components/search/SearchModal.vue +43 -0
- package/src/app/components/search/SearchPane.vue +293 -0
- package/src/app/components/search/search-docs-data.ts +10 -0
- package/src/app/components/search/search-title-data.ts +10 -0
- package/src/app/components/search/types.ts +4 -0
- package/src/app/components/story/GenericMountStory.vue +28 -0
- package/src/app/components/story/GenericRenderStory.vue +29 -0
- package/src/app/components/story/StoryResponsivePreview.vue +204 -0
- package/src/app/components/story/StoryVariantGrid.vue +112 -0
- package/src/app/components/story/StoryVariantGridItem.vue +110 -0
- package/src/app/components/story/StoryVariantListItem.vue +50 -0
- package/src/app/components/story/StoryVariantSingle.vue +105 -0
- package/src/app/components/story/StoryVariantSinglePreviewNative.vue +42 -0
- package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +139 -0
- package/src/app/components/story/StoryVariantSingleView.vue +52 -0
- package/src/app/components/story/StoryView.vue +96 -0
- package/src/app/components/story/StoryViewer.vue +53 -0
- package/src/app/components/toolbar/StoryVariantBackground.vue +67 -0
- package/src/app/components/toolbar/StoryVariantNewTab.vue +29 -0
- package/src/app/components/toolbar/StoryVariantResponsiveSize.vue +82 -0
- package/src/app/components/toolbar/StoryVariantTitle.vue +21 -0
- package/src/app/components/tree/StoryGroup.vue +75 -0
- package/src/app/components/tree/StoryList.vue +35 -0
- package/src/app/components/tree/StoryListFolder.vue +89 -0
- package/src/app/components/tree/StoryListItem.vue +71 -0
- package/src/app/index.ts +30 -0
- package/src/app/router.ts +29 -0
- package/src/app/sandbox.ts +96 -0
- package/src/app/stores/events.ts +36 -0
- package/src/app/stores/folder.ts +59 -0
- package/src/app/stores/preview-settings.ts +17 -0
- package/src/app/stores/story.ts +47 -0
- package/src/app/style/floating-vue.pcss +34 -0
- package/src/app/style/main.pcss +86 -0
- package/src/app/style/sandbox.css +19 -0
- package/src/app/style/transitions.pcss +51 -0
- package/src/app/types.ts +46 -0
- package/src/app/util/config.ts +6 -0
- package/src/app/util/const.ts +4 -0
- package/src/app/util/dark.ts +4 -0
- package/src/app/util/env.ts +1 -0
- package/src/app/util/events.ts +30 -0
- package/src/app/util/keyboard.ts +99 -0
- package/src/app/util/mapping.ts +76 -0
- package/src/app/util/preview-settings.ts +8 -0
- package/src/app/util/responsive.ts +3 -0
- package/src/app/util/sandbox.ts +10 -0
- package/src/app/util/scroll.ts +31 -0
- package/src/app/util/state.ts +37 -0
- package/src/app/util/tooltip.ts +13 -0
- package/src/app/util/variant.ts +20 -0
- package/src/bundle-index.js +1 -0
- package/src/bundle-main.js +5 -0
- package/src/bundle-sandbox.js +2 -0
- package/src/index.ts +1 -0
- package/src/shim.d.ts +7 -0
- package/tailwind.config.cjs +126 -0
- package/tsconfig.json +54 -0
- package/vite.config.ts +87 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, computed, toRaw, openBlock, createBlock, withCtx, createElementVNode, unref, normalizeClass, normalizeStyle } from "@histoire/vendors/vue";
|
|
2
|
+
import { useEventListener } from "@histoire/vendors/vue-use";
|
|
3
|
+
import { applyState } from "@histoire/shared";
|
|
4
|
+
import { STATE_SYNC, SANDBOX_READY, EVENT_SEND, PREVIEW_SETTINGS_SYNC } from "../../util/const.js";
|
|
5
|
+
import { getSandboxUrl } from "../../util/sandbox.js";
|
|
6
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
7
|
+
import { useEventsStore } from "../../stores/events.js";
|
|
8
|
+
import StoryResponsivePreview from "./StoryResponsivePreview.js";
|
|
9
|
+
import { toRawDeep } from "../../util/state.js";
|
|
10
|
+
const _hoisted_1 = ["src"];
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "StoryVariantSinglePreviewRemote",
|
|
13
|
+
props: {
|
|
14
|
+
story: null,
|
|
15
|
+
variant: null
|
|
16
|
+
},
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const props = __props;
|
|
19
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
20
|
+
const iframe = ref();
|
|
21
|
+
function syncState() {
|
|
22
|
+
if (iframe.value && props.variant.previewReady) {
|
|
23
|
+
iframe.value.contentWindow.postMessage({
|
|
24
|
+
type: STATE_SYNC,
|
|
25
|
+
state: toRawDeep(props.variant.state)
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
let synced = false;
|
|
30
|
+
watch(() => props.variant.state, () => {
|
|
31
|
+
if (synced) {
|
|
32
|
+
synced = false;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
syncState();
|
|
36
|
+
}, {
|
|
37
|
+
deep: true,
|
|
38
|
+
immediate: true
|
|
39
|
+
});
|
|
40
|
+
Object.assign(props.variant, {
|
|
41
|
+
previewReady: false
|
|
42
|
+
});
|
|
43
|
+
useEventListener(window, "message", (event) => {
|
|
44
|
+
switch (event.data.type) {
|
|
45
|
+
case STATE_SYNC:
|
|
46
|
+
updateVariantState(event.data.state);
|
|
47
|
+
break;
|
|
48
|
+
case EVENT_SEND:
|
|
49
|
+
logEvent(event.data.event);
|
|
50
|
+
break;
|
|
51
|
+
case SANDBOX_READY:
|
|
52
|
+
setPreviewReady();
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
function updateVariantState(state) {
|
|
57
|
+
synced = true;
|
|
58
|
+
applyState(props.variant.state, state);
|
|
59
|
+
}
|
|
60
|
+
function logEvent(event) {
|
|
61
|
+
const eventsStore = useEventsStore();
|
|
62
|
+
eventsStore.addEvent(event);
|
|
63
|
+
}
|
|
64
|
+
function setPreviewReady() {
|
|
65
|
+
Object.assign(props.variant, {
|
|
66
|
+
previewReady: true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const sandboxUrl = computed(() => {
|
|
70
|
+
return getSandboxUrl(props.story, props.variant);
|
|
71
|
+
});
|
|
72
|
+
const isIframeLoaded = ref(false);
|
|
73
|
+
watch(sandboxUrl, () => {
|
|
74
|
+
isIframeLoaded.value = false;
|
|
75
|
+
});
|
|
76
|
+
function syncSettings() {
|
|
77
|
+
if (iframe.value) {
|
|
78
|
+
iframe.value.contentWindow.postMessage({
|
|
79
|
+
type: PREVIEW_SETTINGS_SYNC,
|
|
80
|
+
settings: toRaw(settings)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
watch(() => settings, () => {
|
|
85
|
+
syncSettings();
|
|
86
|
+
}, {
|
|
87
|
+
deep: true,
|
|
88
|
+
immediate: true
|
|
89
|
+
});
|
|
90
|
+
function onIframeLoad() {
|
|
91
|
+
isIframeLoaded.value = true;
|
|
92
|
+
syncState();
|
|
93
|
+
syncSettings();
|
|
94
|
+
}
|
|
95
|
+
return (_ctx, _cache) => {
|
|
96
|
+
return openBlock(), createBlock(StoryResponsivePreview, { variant: __props.variant }, {
|
|
97
|
+
default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight, resizing }) => [
|
|
98
|
+
createElementVNode("iframe", {
|
|
99
|
+
ref_key: "iframe",
|
|
100
|
+
ref: iframe,
|
|
101
|
+
src: unref(sandboxUrl),
|
|
102
|
+
class: normalizeClass(["htw-w-full htw-h-full htw-relative", {
|
|
103
|
+
"htw-invisible": !isIframeLoaded.value,
|
|
104
|
+
"htw-pointer-events-none": resizing
|
|
105
|
+
}]),
|
|
106
|
+
style: normalizeStyle(isResponsiveEnabled ? {
|
|
107
|
+
width: finalWidth ? `${finalWidth}px` : null,
|
|
108
|
+
height: finalHeight ? `${finalHeight}px` : null
|
|
109
|
+
} : void 0),
|
|
110
|
+
"data-test-id": "preview-iframe",
|
|
111
|
+
onLoad: _cache[0] || (_cache[0] = ($event) => onIframeLoad())
|
|
112
|
+
}, null, 46, _hoisted_1)
|
|
113
|
+
]),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 8, ["variant"]);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, unref, createVNode, createBlock, createCommentVNode } from "@histoire/vendors/vue";
|
|
2
|
+
import { isMobile } from "../../util/responsive.js";
|
|
3
|
+
import _sfc_main$1 from "../toolbar/StoryVariantTitle.js";
|
|
4
|
+
import _sfc_main$2 from "../toolbar/StoryVariantResponsiveSize.js";
|
|
5
|
+
import StoryVariantBackground from "../toolbar/StoryVariantBackground.js";
|
|
6
|
+
import _sfc_main$3 from "../toolbar/StoryVariantNewTab.js";
|
|
7
|
+
import _sfc_main$4 from "./StoryVariantSinglePreviewNative.js";
|
|
8
|
+
import _sfc_main$5 from "./StoryVariantSinglePreviewRemote.js";
|
|
9
|
+
const _hoisted_1 = {
|
|
10
|
+
class: "htw-h-full htw-flex htw-flex-col",
|
|
11
|
+
"data-test-id": "story-variant-single-view"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_2 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
|
|
16
|
+
};
|
|
17
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
+
__name: "StoryVariantSingleView",
|
|
19
|
+
props: {
|
|
20
|
+
variant: null,
|
|
21
|
+
story: null
|
|
22
|
+
},
|
|
23
|
+
setup(__props) {
|
|
24
|
+
return (_ctx, _cache) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
27
|
+
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
28
|
+
createVNode(_sfc_main$1, { variant: __props.variant }, null, 8, ["variant"]),
|
|
29
|
+
!__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$2, { key: 0 })) : createCommentVNode("", true),
|
|
30
|
+
createVNode(StoryVariantBackground),
|
|
31
|
+
createVNode(_sfc_main$3, {
|
|
32
|
+
variant: __props.variant,
|
|
33
|
+
story: __props.story
|
|
34
|
+
}, null, 8, ["variant", "story"])
|
|
35
|
+
])) : createCommentVNode("", true),
|
|
36
|
+
((_a = __props.story.layout) == null ? void 0 : _a.iframe) === false ? (openBlock(), createBlock(_sfc_main$4, {
|
|
37
|
+
key: 1,
|
|
38
|
+
story: __props.story,
|
|
39
|
+
variant: __props.variant
|
|
40
|
+
}, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$5, {
|
|
41
|
+
key: 2,
|
|
42
|
+
story: __props.story,
|
|
43
|
+
variant: __props.variant
|
|
44
|
+
}, null, 8, ["story", "variant"]))
|
|
45
|
+
]);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineComponent, watch, unref, openBlock, createBlock, withCtx, createVNode, createElementBlock } from "@histoire/vendors/vue";
|
|
2
|
+
import { useRouter, useRoute } from "@histoire/vendors/vue-router";
|
|
3
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
4
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
5
|
+
import BaseSplitPane from "../base/BaseSplitPane.js";
|
|
6
|
+
import BaseEmpty from "../base/BaseEmpty.js";
|
|
7
|
+
import { isMobile } from "../../util/responsive.js";
|
|
8
|
+
import StoryViewer from "./StoryViewer.js";
|
|
9
|
+
import _sfc_main$2 from "../panel/StorySidePanel.js";
|
|
10
|
+
import _sfc_main$1 from "../panel/StoryDocs.js";
|
|
11
|
+
const _hoisted_1 = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "htw-h-full"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_2 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "htw-h-full htw-overflow-auto"
|
|
18
|
+
};
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
|
+
__name: "StoryView",
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const storyStore = useStoryStore();
|
|
23
|
+
const router = useRouter();
|
|
24
|
+
const route = useRoute();
|
|
25
|
+
watch(() => storyStore.currentVariant, (value) => {
|
|
26
|
+
if (value) {
|
|
27
|
+
storyStore.currentStory.lastSelectedVariant = value;
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
immediate: true
|
|
31
|
+
});
|
|
32
|
+
watch(() => [storyStore.currentStory, storyStore.currentVariant], () => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if (!storyStore.currentVariant) {
|
|
35
|
+
if ((_a = storyStore.currentStory) == null ? void 0 : _a.lastSelectedVariant) {
|
|
36
|
+
setVariant(storyStore.currentStory.lastSelectedVariant.id);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (((_b = storyStore.currentStory) == null ? void 0 : _b.variants.length) === 1) {
|
|
40
|
+
setVariant(storyStore.currentStory.variants[0].id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
immediate: true
|
|
45
|
+
});
|
|
46
|
+
function setVariant(variantId) {
|
|
47
|
+
router.replace({
|
|
48
|
+
...route,
|
|
49
|
+
query: {
|
|
50
|
+
...route.query,
|
|
51
|
+
variantId
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return (_ctx, _cache) => {
|
|
56
|
+
return !unref(storyStore).currentStory ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
|
|
57
|
+
default: withCtx(() => [
|
|
58
|
+
createVNode(unref(Icon), {
|
|
59
|
+
icon: "carbon:software-resource-resource",
|
|
60
|
+
class: "htw-w-16 htw-h-16 htw-opacity-50"
|
|
61
|
+
})
|
|
62
|
+
]),
|
|
63
|
+
_: 1
|
|
64
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
65
|
+
unref(storyStore).currentStory.docsOnly ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
66
|
+
createVNode(_sfc_main$1, {
|
|
67
|
+
story: unref(storyStore).currentStory,
|
|
68
|
+
class: "md:htw-p-12 htw-w-full md:htw-max-w-[600px] lg:htw-max-w-[800px] xl:htw-max-w-[900px]"
|
|
69
|
+
}, null, 8, ["story"])
|
|
70
|
+
])) : unref(isMobile) ? (openBlock(), createBlock(StoryViewer, { key: 1 })) : (openBlock(), createBlock(BaseSplitPane, {
|
|
71
|
+
key: 2,
|
|
72
|
+
"save-id": "story-main",
|
|
73
|
+
min: 30,
|
|
74
|
+
max: 95,
|
|
75
|
+
"default-split": 75,
|
|
76
|
+
class: "htw-h-full"
|
|
77
|
+
}, {
|
|
78
|
+
first: withCtx(() => [
|
|
79
|
+
createVNode(StoryViewer)
|
|
80
|
+
]),
|
|
81
|
+
last: withCtx(() => [
|
|
82
|
+
createVNode(_sfc_main$2)
|
|
83
|
+
]),
|
|
84
|
+
_: 1
|
|
85
|
+
}))
|
|
86
|
+
]));
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { pushScopeId, popScopeId, defineComponent, useCssVars, unref, computed, ref, watch, openBlock, createElementBlock, Fragment, createElementVNode, createBlock, createCommentVNode, createVNode, withCtx, renderList } from "@histoire/vendors/vue";
|
|
2
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
3
|
+
import StoryVariantListItem from "./StoryVariantListItem.js";
|
|
4
|
+
import _sfc_main$2 from "../app/MobileOverlay.js";
|
|
5
|
+
import _sfc_main$1 from "./StoryVariantGrid.js";
|
|
6
|
+
import StoryVariantSingle from "./StoryVariantSingle.js";
|
|
7
|
+
import "./StoryViewer.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-b9d4a640"), n = n(), popScopeId(), n);
|
|
10
|
+
const _hoisted_1 = { class: "htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750" };
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "StoryViewer",
|
|
13
|
+
setup(__props) {
|
|
14
|
+
useCssVars((_ctx) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return {
|
|
17
|
+
"10f93ca4": (_a = unref(variant)) == null ? void 0 : _a.iconColor
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const storyStore = useStoryStore();
|
|
21
|
+
const variant = computed(() => storyStore.currentVariant);
|
|
22
|
+
const isMenuOpened = ref(false);
|
|
23
|
+
function closeMenu() {
|
|
24
|
+
isMenuOpened.value = false;
|
|
25
|
+
}
|
|
26
|
+
watch(variant, () => {
|
|
27
|
+
isMenuOpened.value = false;
|
|
28
|
+
});
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
31
|
+
createElementVNode("div", _hoisted_1, [
|
|
32
|
+
unref(storyStore).currentStory.layout.type === "grid" ? (openBlock(), createBlock(_sfc_main$1, { key: 0 })) : unref(storyStore).currentStory.layout.type === "single" ? (openBlock(), createBlock(StoryVariantSingle, {
|
|
33
|
+
key: 1,
|
|
34
|
+
onOpenVariantMenu: _cache[0] || (_cache[0] = ($event) => isMenuOpened.value = true)
|
|
35
|
+
})) : createCommentVNode("", true)
|
|
36
|
+
]),
|
|
37
|
+
createVNode(_sfc_main$2, {
|
|
38
|
+
title: "Select a variant",
|
|
39
|
+
opened: isMenuOpened.value,
|
|
40
|
+
onClose: closeMenu
|
|
41
|
+
}, {
|
|
42
|
+
default: withCtx(() => [
|
|
43
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (v, index) => {
|
|
44
|
+
return openBlock(), createBlock(StoryVariantListItem, {
|
|
45
|
+
key: index,
|
|
46
|
+
variant: v
|
|
47
|
+
}, null, 8, ["variant"]);
|
|
48
|
+
}), 128))
|
|
49
|
+
]),
|
|
50
|
+
_: 1
|
|
51
|
+
}, 8, ["opened"])
|
|
52
|
+
], 64);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var StoryViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b9d4a640"]]);
|
|
57
|
+
export { StoryViewer as default };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { pushScopeId, popScopeId, createElementVNode, createTextVNode, defineComponent, useCssVars, unref, resolveComponent, resolveDirective, openBlock, createBlock, withCtx, createVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, normalizeStyle, createCommentVNode, withDirectives } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
4
|
+
import { histoireConfig } from "../../util/config.js";
|
|
5
|
+
import _sfc_main$1 from "../base/BaseCheckbox.js";
|
|
6
|
+
import "./StoryVariantBackground.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-bc4883a4"), n = n(), popScopeId(), n);
|
|
9
|
+
const _hoisted_1 = { 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" };
|
|
10
|
+
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__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));
|
|
11
|
+
const _hoisted_3 = { class: "htw-flex htw-flex-col htw-items-stretch" };
|
|
12
|
+
const _hoisted_4 = /* @__PURE__ */ createTextVNode(" Checkerboard ");
|
|
13
|
+
const _hoisted_5 = ["onClick"];
|
|
14
|
+
const _hoisted_6 = { class: "htw-mr-auto" };
|
|
15
|
+
const _hoisted_7 = { class: "htw-ml-auto htw-opacity-70" };
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
__name: "StoryVariantBackground",
|
|
18
|
+
setup(__props) {
|
|
19
|
+
useCssVars((_ctx) => ({
|
|
20
|
+
"6bcdf233": unref(settings).backgroundColor
|
|
21
|
+
}));
|
|
22
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
const _component_VDropdown = resolveComponent("VDropdown");
|
|
25
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
26
|
+
return unref(histoireConfig).backgroundPresets.length ? (openBlock(), createBlock(_component_VDropdown, {
|
|
27
|
+
key: 0,
|
|
28
|
+
placement: "bottom-end",
|
|
29
|
+
skidding: 6,
|
|
30
|
+
class: "htw-h-full htw-flex-none"
|
|
31
|
+
}, {
|
|
32
|
+
popper: withCtx(({ hide }) => [
|
|
33
|
+
createElementVNode("div", _hoisted_3, [
|
|
34
|
+
createVNode(_sfc_main$1, {
|
|
35
|
+
modelValue: unref(settings).checkerboard,
|
|
36
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).checkerboard = $event)
|
|
37
|
+
}, {
|
|
38
|
+
default: withCtx(() => [
|
|
39
|
+
_hoisted_4
|
|
40
|
+
]),
|
|
41
|
+
_: 1
|
|
42
|
+
}, 8, ["modelValue"]),
|
|
43
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(histoireConfig).backgroundPresets, (option, index) => {
|
|
44
|
+
return openBlock(), createElementBlock("button", {
|
|
45
|
+
key: index,
|
|
46
|
+
class: normalizeClass(["htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4", [
|
|
47
|
+
unref(settings).backgroundColor === option.color ? "htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black" : "htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
|
|
48
|
+
]]),
|
|
49
|
+
onClick: ($event) => {
|
|
50
|
+
unref(settings).backgroundColor = option.color;
|
|
51
|
+
hide();
|
|
52
|
+
}
|
|
53
|
+
}, [
|
|
54
|
+
createElementVNode("span", _hoisted_6, toDisplayString(option.label), 1),
|
|
55
|
+
option.color !== "$checkerboard" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
56
|
+
createElementVNode("span", _hoisted_7, toDisplayString(option.color), 1),
|
|
57
|
+
createElementVNode("div", {
|
|
58
|
+
class: "htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/20 dark:htw-border-white/20",
|
|
59
|
+
style: normalizeStyle({
|
|
60
|
+
backgroundColor: option.color
|
|
61
|
+
})
|
|
62
|
+
}, null, 4)
|
|
63
|
+
], 64)) : createCommentVNode("", true)
|
|
64
|
+
], 10, _hoisted_5);
|
|
65
|
+
}), 128))
|
|
66
|
+
])
|
|
67
|
+
]),
|
|
68
|
+
default: withCtx(() => [
|
|
69
|
+
withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
|
|
70
|
+
_hoisted_2,
|
|
71
|
+
createVNode(unref(Icon), {
|
|
72
|
+
icon: "carbon:caret-down",
|
|
73
|
+
class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
74
|
+
})
|
|
75
|
+
])), [
|
|
76
|
+
[_directive_tooltip, "Background color"]
|
|
77
|
+
])
|
|
78
|
+
]),
|
|
79
|
+
_: 1
|
|
80
|
+
})) : createCommentVNode("", true);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
var StoryVariantBackground = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bc4883a4"]]);
|
|
85
|
+
export { StoryVariantBackground as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveDirective, withDirectives, openBlock, createElementBlock, unref, createVNode } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { getSandboxUrl } from "../../util/sandbox.js";
|
|
4
|
+
const _hoisted_1 = ["href"];
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "StoryVariantNewTab",
|
|
7
|
+
props: {
|
|
8
|
+
variant: null,
|
|
9
|
+
story: null
|
|
10
|
+
},
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const props = __props;
|
|
13
|
+
const sandboxUrl = computed(() => {
|
|
14
|
+
return getSandboxUrl(props.story, props.variant);
|
|
15
|
+
});
|
|
16
|
+
return (_ctx, _cache) => {
|
|
17
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
18
|
+
return withDirectives((openBlock(), createElementBlock("a", {
|
|
19
|
+
href: unref(sandboxUrl),
|
|
20
|
+
target: "_blank",
|
|
21
|
+
class: "htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
|
|
22
|
+
}, [
|
|
23
|
+
createVNode(unref(Icon), {
|
|
24
|
+
icon: "carbon:launch",
|
|
25
|
+
class: "base-list-item-link-icon htw-w-4 htw-h-4"
|
|
26
|
+
})
|
|
27
|
+
], 8, _hoisted_1)), [
|
|
28
|
+
[_directive_tooltip, "Open variant in new tab"]
|
|
29
|
+
]);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createTextVNode, createElementVNode, defineComponent, resolveComponent, resolveDirective, openBlock, createBlock, unref, withCtx, createVNode, withDirectives, vModelText, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
4
|
+
import { histoireConfig } from "../../util/config.js";
|
|
5
|
+
import _sfc_main$1 from "../base/BaseCheckbox.js";
|
|
6
|
+
const _hoisted_1 = { class: "htw-flex htw-flex-col htw-items-stretch" };
|
|
7
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode(" Rotate ");
|
|
8
|
+
const _hoisted_3 = { class: "htw-flex htw-gap-2 htw-px-4 htw-py-3" };
|
|
9
|
+
const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-50" }, "x", -1);
|
|
10
|
+
const _hoisted_5 = ["onClick"];
|
|
11
|
+
const _hoisted_6 = { class: "htw-ml-auto htw-opacity-70 htw-flex htw-gap-1" };
|
|
12
|
+
const _hoisted_7 = { key: 0 };
|
|
13
|
+
const _hoisted_8 = { key: 0 };
|
|
14
|
+
const _hoisted_9 = { key: 1 };
|
|
15
|
+
const _hoisted_10 = { key: 2 };
|
|
16
|
+
const _hoisted_11 = { key: 0 };
|
|
17
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
+
__name: "StoryVariantResponsiveSize",
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
var _a;
|
|
23
|
+
const _component_VDropdown = resolveComponent("VDropdown");
|
|
24
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
25
|
+
return openBlock(), createBlock(_component_VDropdown, {
|
|
26
|
+
placement: "bottom-end",
|
|
27
|
+
skidding: 6,
|
|
28
|
+
disabled: !((_a = unref(histoireConfig).responsivePresets) == null ? void 0 : _a.length),
|
|
29
|
+
class: "htw-h-full htw-flex-none"
|
|
30
|
+
}, {
|
|
31
|
+
popper: withCtx(({ hide }) => [
|
|
32
|
+
createElementVNode("div", _hoisted_1, [
|
|
33
|
+
createVNode(_sfc_main$1, {
|
|
34
|
+
modelValue: unref(settings).rotate,
|
|
35
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).rotate = $event)
|
|
36
|
+
}, {
|
|
37
|
+
default: withCtx(() => [
|
|
38
|
+
_hoisted_2
|
|
39
|
+
]),
|
|
40
|
+
_: 1
|
|
41
|
+
}, 8, ["modelValue"]),
|
|
42
|
+
createElementVNode("div", _hoisted_3, [
|
|
43
|
+
withDirectives(createElementVNode("input", {
|
|
44
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(settings).responsiveWidth = $event),
|
|
45
|
+
type: "number",
|
|
46
|
+
class: "htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0",
|
|
47
|
+
step: "16",
|
|
48
|
+
placeholder: "Auto"
|
|
49
|
+
}, null, 512), [
|
|
50
|
+
[
|
|
51
|
+
vModelText,
|
|
52
|
+
unref(settings).responsiveWidth,
|
|
53
|
+
void 0,
|
|
54
|
+
{ number: true }
|
|
55
|
+
],
|
|
56
|
+
[_directive_tooltip, "Responsive width (px)"]
|
|
57
|
+
]),
|
|
58
|
+
_hoisted_4,
|
|
59
|
+
withDirectives(createElementVNode("input", {
|
|
60
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(settings).responsiveHeight = $event),
|
|
61
|
+
type: "number",
|
|
62
|
+
class: "htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0",
|
|
63
|
+
step: "16",
|
|
64
|
+
placeholder: "Auto"
|
|
65
|
+
}, null, 512), [
|
|
66
|
+
[
|
|
67
|
+
vModelText,
|
|
68
|
+
unref(settings).responsiveHeight,
|
|
69
|
+
void 0,
|
|
70
|
+
{ number: true }
|
|
71
|
+
],
|
|
72
|
+
[_directive_tooltip, "Responsive height (px)"]
|
|
73
|
+
])
|
|
74
|
+
]),
|
|
75
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(histoireConfig).responsivePresets, (preset, index) => {
|
|
76
|
+
return openBlock(), createElementBlock("button", {
|
|
77
|
+
key: index,
|
|
78
|
+
class: normalizeClass(["htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4", [
|
|
79
|
+
unref(settings).responsiveWidth === preset.width && unref(settings).responsiveHeight === preset.height ? "htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black" : "htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
|
|
80
|
+
]]),
|
|
81
|
+
onClick: ($event) => {
|
|
82
|
+
unref(settings).responsiveWidth = preset.width;
|
|
83
|
+
unref(settings).responsiveHeight = preset.height;
|
|
84
|
+
hide();
|
|
85
|
+
}
|
|
86
|
+
}, [
|
|
87
|
+
createTextVNode(toDisplayString(preset.label) + " ", 1),
|
|
88
|
+
createElementVNode("span", _hoisted_6, [
|
|
89
|
+
preset.width ? (openBlock(), createElementBlock("span", _hoisted_7, [
|
|
90
|
+
createTextVNode(toDisplayString(preset.width), 1),
|
|
91
|
+
!preset.height ? (openBlock(), createElementBlock("span", _hoisted_8, "px")) : createCommentVNode("", true)
|
|
92
|
+
])) : createCommentVNode("", true),
|
|
93
|
+
preset.width && preset.height ? (openBlock(), createElementBlock("span", _hoisted_9, "x")) : createCommentVNode("", true),
|
|
94
|
+
preset.height ? (openBlock(), createElementBlock("span", _hoisted_10, [
|
|
95
|
+
createTextVNode(toDisplayString(preset.height), 1),
|
|
96
|
+
!preset.width ? (openBlock(), createElementBlock("span", _hoisted_11, "px")) : createCommentVNode("", true)
|
|
97
|
+
])) : createCommentVNode("", true)
|
|
98
|
+
])
|
|
99
|
+
], 10, _hoisted_5);
|
|
100
|
+
}), 128))
|
|
101
|
+
])
|
|
102
|
+
]),
|
|
103
|
+
default: withCtx(() => {
|
|
104
|
+
var _a2;
|
|
105
|
+
return [
|
|
106
|
+
withDirectives((openBlock(), createElementBlock("div", {
|
|
107
|
+
class: normalizeClass(["htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group", {
|
|
108
|
+
"htw-cursor-pointer hover:htw-text-primary-500": (_a2 = unref(histoireConfig).responsivePresets) == null ? void 0 : _a2.length
|
|
109
|
+
}])
|
|
110
|
+
}, [
|
|
111
|
+
createVNode(unref(Icon), {
|
|
112
|
+
icon: "carbon:devices",
|
|
113
|
+
class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
114
|
+
}),
|
|
115
|
+
createVNode(unref(Icon), {
|
|
116
|
+
icon: "carbon:caret-down",
|
|
117
|
+
class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
118
|
+
})
|
|
119
|
+
], 2)), [
|
|
120
|
+
[_directive_tooltip, "Responsive sizes"]
|
|
121
|
+
])
|
|
122
|
+
];
|
|
123
|
+
}),
|
|
124
|
+
_: 1
|
|
125
|
+
}, 8, ["disabled"]);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createVNode, unref, normalizeClass, createElementVNode, toDisplayString } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
const _hoisted_1 = { class: "htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0" };
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "StoryVariantTitle",
|
|
6
|
+
props: {
|
|
7
|
+
variant: null
|
|
8
|
+
},
|
|
9
|
+
setup(__props) {
|
|
10
|
+
return (_ctx, _cache) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
13
|
+
createVNode(unref(Icon), {
|
|
14
|
+
icon: (_a = __props.variant.icon) != null ? _a : "carbon:cube",
|
|
15
|
+
class: normalizeClass(["base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50", [
|
|
16
|
+
__props.variant.iconColor ? "bind-icon-color" : "htw-text-gray-500"
|
|
17
|
+
]])
|
|
18
|
+
}, null, 8, ["icon", "class"]),
|
|
19
|
+
createElementVNode("span", null, toDisplayString(__props.variant.title), 1)
|
|
20
|
+
]);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createElementVNode, defineComponent, computed, openBlock, createElementBlock, withKeys, createVNode, unref, normalizeClass, toDisplayString, createCommentVNode, Fragment, renderList, createBlock } from "@histoire/vendors/vue";
|
|
2
|
+
import StoryListItem from "./StoryListItem.js";
|
|
3
|
+
import StoryListFolder from "./StoryListFolder.js";
|
|
4
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
5
|
+
import { useFolderStore } from "../../stores/folder.js";
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
"data-test-id": "story-group",
|
|
8
|
+
class: "htw-my-2 first:htw-mt-0 last:htw-mb-0"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_2 = ["onKeyup"];
|
|
11
|
+
const _hoisted_3 = { class: "htw-truncate htw-opacity-50" };
|
|
12
|
+
const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "htw-h-[1px] htw-flex-1 htw-bg-gray-500/10 htw-mx-2" }, null, -1);
|
|
13
|
+
const _hoisted_5 = { key: 1 };
|
|
14
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
|
+
__name: "StoryGroup",
|
|
16
|
+
props: {
|
|
17
|
+
path: { default: () => [] },
|
|
18
|
+
group: null,
|
|
19
|
+
stories: null
|
|
20
|
+
},
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const folderStore = useFolderStore();
|
|
24
|
+
const folderPath = computed(() => [...props.path, props.group.title]);
|
|
25
|
+
const isFolderOpen = computed(() => folderStore.isFolderOpened(folderPath.value, true));
|
|
26
|
+
function toggleOpen() {
|
|
27
|
+
folderStore.toggleFolder(folderPath.value, false);
|
|
28
|
+
}
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
31
|
+
__props.group.title ? (openBlock(), createElementBlock("div", {
|
|
32
|
+
key: 0,
|
|
33
|
+
role: "button",
|
|
34
|
+
tabindex: "0",
|
|
35
|
+
class: "htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex htw-items-center htw-gap-1 htw-min-w-0",
|
|
36
|
+
onClick: toggleOpen,
|
|
37
|
+
onKeyup: [
|
|
38
|
+
withKeys(toggleOpen, ["enter"]),
|
|
39
|
+
withKeys(toggleOpen, ["space"])
|
|
40
|
+
]
|
|
41
|
+
}, [
|
|
42
|
+
createVNode(unref(Icon), {
|
|
43
|
+
icon: "carbon:caret-right",
|
|
44
|
+
class: normalizeClass(["htw-w-4 htw-h-4 htw-transition-transform htw-duration-150 htw-opacity-30 htw-flex-none", {
|
|
45
|
+
"htw-rotate-90": unref(isFolderOpen)
|
|
46
|
+
}])
|
|
47
|
+
}, null, 8, ["class"]),
|
|
48
|
+
createElementVNode("span", _hoisted_3, toDisplayString(__props.group.title), 1),
|
|
49
|
+
_hoisted_4
|
|
50
|
+
], 40, _hoisted_2)) : createCommentVNode("", true),
|
|
51
|
+
unref(isFolderOpen) ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
52
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.group.children, (element) => {
|
|
53
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
54
|
+
key: element.title
|
|
55
|
+
}, [
|
|
56
|
+
element.children ? (openBlock(), createBlock(StoryListFolder, {
|
|
57
|
+
key: 0,
|
|
58
|
+
path: unref(folderPath),
|
|
59
|
+
folder: element,
|
|
60
|
+
stories: __props.stories,
|
|
61
|
+
depth: 0
|
|
62
|
+
}, null, 8, ["path", "folder", "stories"])) : (openBlock(), createBlock(StoryListItem, {
|
|
63
|
+
key: 1,
|
|
64
|
+
story: __props.stories[element.index],
|
|
65
|
+
depth: 0
|
|
66
|
+
}, null, 8, ["story"]))
|
|
67
|
+
], 64);
|
|
68
|
+
}), 128))
|
|
69
|
+
])) : createCommentVNode("", true)
|
|
70
|
+
]);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export { _sfc_main as default };
|