@histoire/app 1.0.0-alpha.1 → 1.0.0-alpha.3
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.vue2.js +1 -1
- package/dist/bundled/app.css +7 -7
- package/dist/bundled/components/HomeView.vue2.js +3 -6
- package/dist/bundled/components/app/AppHeader.vue2.js +2 -3
- package/dist/bundled/components/app/AppLogo.vue2.js +4 -5
- package/dist/bundled/components/app/Breadcrumb.vue2.js +4 -7
- package/dist/bundled/components/app/HomeCounter.vue2.js +1 -1
- package/dist/bundled/components/app/InitialLoading.vue2.js +1 -1
- package/dist/bundled/components/app/MobileOverlay.vue2.js +1 -1
- package/dist/bundled/components/base/BaseButton.vue2.js +1 -1
- package/dist/bundled/components/base/BaseCheckbox.vue2.js +2 -3
- package/dist/bundled/components/base/BaseEmpty.vue.js +1 -1
- package/dist/bundled/components/base/BaseIcon.vue2.js +1 -1
- package/dist/bundled/components/base/BaseKeyboardShortcut.vue2.js +1 -1
- package/dist/bundled/components/base/BaseListItem.vue2.js +1 -1
- package/dist/bundled/components/base/BaseListItemLink.vue.js +1 -1
- package/dist/bundled/components/base/BaseOverflowMenu.vue2.js +1 -1
- package/dist/bundled/components/base/BaseOverflowTab.vue.js +1 -1
- package/dist/bundled/components/base/BaseSelect.vue2.js +1 -1
- package/dist/bundled/components/base/BaseSplitPane.vue2.js +1 -1
- package/dist/bundled/components/base/BaseTab.vue.js +1 -1
- package/dist/bundled/components/base/BaseTag.vue.js +1 -1
- package/dist/bundled/components/command/CommandPrompts.vue2.js +10 -11
- package/dist/bundled/components/command/CommandPromptsModal.vue2.js +1 -1
- package/dist/bundled/components/command/PromptSelect.vue2.js +3 -4
- package/dist/bundled/components/command/PromptText.vue2.js +3 -4
- package/dist/bundled/components/misc/CheckerboardPattern.vue.js +1 -1
- package/dist/bundled/components/misc/HatchedPattern.vue.js +1 -1
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue2.js +5 -11
- package/dist/bundled/components/panel/ControlsComponentProps.vue2.js +1 -1
- package/dist/bundled/components/panel/ControlsComponentState.vue2.js +1 -1
- package/dist/bundled/components/panel/ControlsComponentStateItem.vue2.js +1 -1
- package/dist/bundled/components/panel/PaneTabs.vue2.js +1 -1
- package/dist/bundled/components/panel/StatePresets.vue2.js +1 -1
- package/dist/bundled/components/panel/StoryControls.vue2.js +3 -4
- package/dist/bundled/components/panel/StoryDocs.vue2.js +4 -8
- package/dist/bundled/components/panel/StoryEvent.vue2.js +1 -1
- package/dist/bundled/components/panel/StoryEvents.vue2.js +1 -1
- package/dist/bundled/components/panel/StorySidePanel.vue2.js +1 -1
- package/dist/bundled/components/panel/StorySourceCode.vue.js +1 -1
- package/dist/bundled/components/panel/StorySourceCode.vue2.js +12 -21
- package/dist/bundled/components/search/SearchItem.vue2.js +1 -1
- package/dist/bundled/components/search/SearchItemContent.vue2.js +2 -3
- package/dist/bundled/components/search/SearchLoading.vue2.js +1 -1
- package/dist/bundled/components/search/SearchPane.vue2.js +2 -5
- package/dist/bundled/components/story/GenericMountStory.vue2.js +2 -3
- package/dist/bundled/components/story/GenericRenderStory.vue2.js +2 -3
- package/dist/bundled/components/story/StoryResponsivePreview.vue2.js +1 -1
- package/dist/bundled/components/story/StoryVariantGrid.vue2.js +2 -3
- package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +1 -1
- package/dist/bundled/components/story/StoryVariantListItem.vue2.js +1 -1
- package/dist/bundled/components/story/StoryVariantSingle.vue2.js +5 -11
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +1 -1
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue2.js +1 -1
- package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +3 -4
- package/dist/bundled/components/story/StoryView.vue2.js +4 -6
- package/dist/bundled/components/story/StoryViewer.vue2.js +4 -7
- package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue2.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarBackground.vue2.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarNewTab.vue2.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue2.js +20 -24
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue2.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarTitle.vue2.js +1 -1
- package/dist/bundled/components/tree/StoryGroup.vue2.js +1 -1
- package/dist/bundled/components/tree/StoryList.vue2.js +1 -1
- package/dist/bundled/components/tree/StoryListFolder.vue.js +1 -1
- package/dist/bundled/components/tree/StoryListFolder.vue2.js +2 -2
- package/dist/bundled/components/tree/StoryListItem.vue.js +1 -1
- package/dist/bundled/components/tree/StoryListItem.vue2.js +3 -3
- package/dist/bundled/sandbox.js +7 -13
- package/dist/bundled/stores/command.js +2 -3
- package/dist/bundled/stores/events.js +1 -4
- package/dist/bundled/stores/story.js +1 -4
- package/dist/bundled/util/commands.js +3 -5
- package/dist/bundled/util/dark.js +1 -2
- package/dist/bundled/util/docs.js +4 -5
- package/dist/bundled/util/events.js +1 -2
- package/dist/bundled/util/preview-settings.js +1 -2
- package/dist/style.css +0 -2
- package/package.json +6 -6
- package/src/app/components/panel/StorySourceCode.vue +3 -3
- package/src/app/components/tree/StoryGroup.vue +1 -1
- package/src/app/components/tree/StoryListFolder.vue +1 -1
- package/src/app/components/tree/StoryListItem.vue +1 -1
- package/src/app/sandbox.ts +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent, ref, watchEffect, markRaw, shallowRef, watch, computed, onMounted, nextTick, resolveDirective,
|
|
1
|
+
import { defineComponent, ref, watchEffect, markRaw, shallowRef, watch, computed, onMounted, nextTick, resolveDirective, createElementBlock, openBlock, createCommentVNode, createBlock, createElementVNode, createVNode, withDirectives, normalizeClass, unref, toDisplayString, withCtx } from "@histoire/vendors/vue";
|
|
2
2
|
import { HstCopyIcon } from "@histoire/controls";
|
|
3
3
|
import { unindent } from "@histoire/shared";
|
|
4
4
|
import { Icon } from "@histoire/vendors/iconify";
|
|
5
|
-
import {
|
|
5
|
+
import { createHighlighter } from "shiki";
|
|
6
6
|
import { clientSupportPlugins } from "virtual:$histoire-support-plugins-client";
|
|
7
7
|
import { isDark } from "../../util/dark.js";
|
|
8
8
|
import BaseEmpty from "../base/BaseEmpty.vue.js";
|
|
@@ -29,8 +29,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
29
|
const props = __props;
|
|
30
30
|
const generateSourceCodeFn = ref(null);
|
|
31
31
|
watchEffect(async () => {
|
|
32
|
-
|
|
33
|
-
const clientPlugin = clientSupportPlugins[(_a = props.story.file) == null ? void 0 : _a.supportPluginId];
|
|
32
|
+
const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
|
|
34
33
|
if (clientPlugin) {
|
|
35
34
|
const pluginModule = await clientPlugin();
|
|
36
35
|
generateSourceCodeFn.value = markRaw(pluginModule.generateSourceCode);
|
|
@@ -40,15 +39,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40
39
|
const dynamicSourceCode = ref("");
|
|
41
40
|
const error = ref(null);
|
|
42
41
|
watch(() => [props.variant, generateSourceCodeFn.value], async () => {
|
|
43
|
-
var _a, _b, _c, _d;
|
|
44
42
|
if (!generateSourceCodeFn.value) return;
|
|
45
43
|
error.value = null;
|
|
46
44
|
dynamicSourceCode.value = "";
|
|
47
45
|
try {
|
|
48
46
|
if (props.variant.source) {
|
|
49
47
|
dynamicSourceCode.value = props.variant.source;
|
|
50
|
-
} else if (
|
|
51
|
-
const source =
|
|
48
|
+
} else if (props.variant.slots?.().source) {
|
|
49
|
+
const source = props.variant.slots?.().source()[0].children;
|
|
52
50
|
if (source) {
|
|
53
51
|
dynamicSourceCode.value = await unindent(source);
|
|
54
52
|
}
|
|
@@ -67,13 +65,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
67
65
|
immediate: true
|
|
68
66
|
});
|
|
69
67
|
const staticSourceCode = ref("");
|
|
70
|
-
watch(() => {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
return [props.story, (_b = (_a = props.story) == null ? void 0 : _a.file) == null ? void 0 : _b.source];
|
|
73
|
-
}, async () => {
|
|
74
|
-
var _a;
|
|
68
|
+
watch(() => [props.story, props.story?.file?.source], async () => {
|
|
75
69
|
staticSourceCode.value = "";
|
|
76
|
-
const sourceLoader =
|
|
70
|
+
const sourceLoader = props.story.file?.source;
|
|
77
71
|
if (sourceLoader) {
|
|
78
72
|
staticSourceCode.value = (await sourceLoader()).default;
|
|
79
73
|
}
|
|
@@ -88,7 +82,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
88
82
|
return staticSourceCode.value;
|
|
89
83
|
});
|
|
90
84
|
onMounted(async () => {
|
|
91
|
-
highlighter.value = await
|
|
85
|
+
highlighter.value = await createHighlighter({
|
|
92
86
|
langs: [
|
|
93
87
|
"html",
|
|
94
88
|
"jsx"
|
|
@@ -99,13 +93,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
99
93
|
]
|
|
100
94
|
});
|
|
101
95
|
});
|
|
102
|
-
const sourceHtml = computed(() => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
theme: isDark.value ? "github-dark" : "github-light"
|
|
107
|
-
}) : "";
|
|
108
|
-
});
|
|
96
|
+
const sourceHtml = computed(() => displayedSourceCode.value ? highlighter.value?.codeToHtml(displayedSourceCode.value, {
|
|
97
|
+
lang: "html",
|
|
98
|
+
theme: isDark.value ? "github-dark" : "github-light"
|
|
99
|
+
}) : "");
|
|
109
100
|
let lastScroll = 0;
|
|
110
101
|
watch(() => props.variant, () => {
|
|
111
102
|
lastScroll = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, ref, toRefs,
|
|
1
|
+
import { defineComponent, useCssVars, ref, toRefs, createElementBlock, openBlock, unref, createBlock, createCommentVNode, withCtx, createVNode } from "@histoire/vendors/vue";
|
|
2
2
|
import { useRouter } from "@histoire/vendors/vue-router";
|
|
3
3
|
import { onKeyboardShortcut } from "../../util/keyboard.js";
|
|
4
4
|
import { useScrollOnActive } from "../../util/scroll.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, Fragment, createVNode, createElementVNode, normalizeClass, createCommentVNode, createTextVNode, toDisplayString, renderList, createBlock, unref } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import BaseIcon from "../base/BaseIcon.vue.js";
|
|
4
4
|
"use strict";
|
|
@@ -26,7 +26,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26
26
|
command: "Command"
|
|
27
27
|
};
|
|
28
28
|
return (_ctx, _cache) => {
|
|
29
|
-
var _a;
|
|
30
29
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
31
30
|
createVNode(BaseIcon, {
|
|
32
31
|
icon: _ctx.result.icon ?? defaultIcons[_ctx.result.kind],
|
|
@@ -47,7 +46,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
46
|
createTextVNode(toDisplayString(_ctx.result.title) + " ", 1),
|
|
48
47
|
createElementVNode("span", _hoisted_3, toDisplayString(kindLabels[_ctx.result.kind]), 1)
|
|
49
48
|
]),
|
|
50
|
-
|
|
49
|
+
_ctx.result.path?.length ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
51
50
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.result.path, (p, index) => {
|
|
52
51
|
return openBlock(), createElementBlock("div", {
|
|
53
52
|
key: index,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createVNode, createTextVNode, unref } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
"use strict";
|
|
4
4
|
const _hoisted_1 = { class: "histoire-search-loading htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500 htw-h-[51px] htw-opacity-30" };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, computed,
|
|
1
|
+
import { defineComponent, ref, watch, computed, createElementBlock, openBlock, Fragment, createElementVNode, createBlock, createCommentVNode, createVNode, withDirectives, unref, withKeys, withModifiers, vModelText, withCtx, createTextVNode, renderList } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useFocus, useDebounce } from "@histoire/vendors/vue-use";
|
|
4
4
|
import Fuse from "fuse.js";
|
|
@@ -182,10 +182,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
182
182
|
if (__HISTOIRE_DEV__) {
|
|
183
183
|
const commandCtx = getCommandContext();
|
|
184
184
|
const searchText = searchInputText.value.toLowerCase();
|
|
185
|
-
return allCommands.filter((command) => !command.showIf || command.showIf(commandCtx)).filter((command) =>
|
|
186
|
-
var _a;
|
|
187
|
-
return command.label.toLowerCase().includes(searchText) || ((_a = command.searchText) == null ? void 0 : _a.toLowerCase().includes(searchText));
|
|
188
|
-
}).map((command) => commandResultFactory(command, 0));
|
|
185
|
+
return allCommands.filter((command) => !command.showIf || command.showIf(commandCtx)).filter((command) => command.label.toLowerCase().includes(searchText) || command.searchText?.toLowerCase().includes(searchText)).map((command) => commandResultFactory(command, 0));
|
|
189
186
|
}
|
|
190
187
|
return [];
|
|
191
188
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watchEffect, markRaw,
|
|
1
|
+
import { defineComponent, ref, watchEffect, markRaw, createBlock, createCommentVNode, openBlock, resolveDynamicComponent, mergeProps } from "@histoire/vendors/vue";
|
|
2
2
|
import { clientSupportPlugins } from "virtual:$histoire-support-plugins-client";
|
|
3
3
|
"use strict";
|
|
4
4
|
const __default__ = {
|
|
@@ -14,8 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
14
|
const props = __props;
|
|
15
15
|
const mountComponent = ref(null);
|
|
16
16
|
watchEffect(async () => {
|
|
17
|
-
|
|
18
|
-
const clientPlugin = clientSupportPlugins[(_a = props.story.file) == null ? void 0 : _a.supportPluginId];
|
|
17
|
+
const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
|
|
19
18
|
if (clientPlugin) {
|
|
20
19
|
const pluginModule = await clientPlugin();
|
|
21
20
|
mountComponent.value = markRaw(pluginModule.MountStory);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watchEffect, markRaw,
|
|
1
|
+
import { defineComponent, ref, watchEffect, markRaw, createBlock, createCommentVNode, openBlock, resolveDynamicComponent, mergeProps } from "@histoire/vendors/vue";
|
|
2
2
|
import { clientSupportPlugins } from "virtual:$histoire-support-plugins-client";
|
|
3
3
|
"use strict";
|
|
4
4
|
const __default__ = {
|
|
@@ -14,8 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
14
|
const props = __props;
|
|
15
15
|
const mountComponent = ref(null);
|
|
16
16
|
watchEffect(async () => {
|
|
17
|
-
|
|
18
|
-
const clientPlugin = clientSupportPlugins[(_a = props.story.file) == null ? void 0 : _a.supportPluginId];
|
|
17
|
+
const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
|
|
19
18
|
if (clientPlugin) {
|
|
20
19
|
try {
|
|
21
20
|
const pluginModule = await clientPlugin();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, unref, ref, onUnmounted, computed,
|
|
1
|
+
import { defineComponent, useCssVars, unref, ref, onUnmounted, computed, createElementBlock, openBlock, createCommentVNode, createElementVNode, createVNode, normalizeClass, createBlock, createStaticVNode, renderSlot, Fragment, withDirectives } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useEventListener } from "@histoire/vendors/vue-use";
|
|
4
4
|
import { VTooltip } from "@histoire/vendors/floating-vue";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, watch, onMounted, openBlock,
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, createElementBlock, openBlock, createCommentVNode, createElementVNode, unref, createVNode, createBlock, normalizeStyle, Fragment, renderList } from "@histoire/vendors/vue";
|
|
2
2
|
import { useResizeObserver } from "@histoire/vendors/vue-use";
|
|
3
3
|
import { useStoryStore } from "../../stores/story.js";
|
|
4
4
|
import { isMobile } from "../../util/responsive.js";
|
|
@@ -94,14 +94,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
94
|
});
|
|
95
95
|
const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))));
|
|
96
96
|
return (_ctx, _cache) => {
|
|
97
|
-
var _a;
|
|
98
97
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
99
98
|
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
100
99
|
createVNode(ToolbarBackground),
|
|
101
100
|
createVNode(_sfc_main$1),
|
|
102
101
|
_ctx.__HISTOIRE_DEV__ ? (openBlock(), createBlock(_sfc_main$2, {
|
|
103
102
|
key: 0,
|
|
104
|
-
file:
|
|
103
|
+
file: unref(storyStore).currentStory.file?.filePath,
|
|
105
104
|
tooltip: "Edit story in editor"
|
|
106
105
|
}, null, 8, ["file"])) : createCommentVNode("", true)
|
|
107
106
|
])) : createCommentVNode("", true),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, unref, toRefs, ref, computed, resolveComponent, resolveDirective,
|
|
1
|
+
import { defineComponent, useCssVars, unref, toRefs, ref, computed, resolveComponent, resolveDirective, createElementBlock, openBlock, createElementVNode, withDirectives, createBlock, normalizeClass, withCtx, createVNode, toDisplayString, withModifiers, createCommentVNode, normalizeStyle } from "@histoire/vendors/vue";
|
|
2
2
|
import { HstCopyIcon } from "@histoire/controls";
|
|
3
3
|
import { Icon } from "@histoire/vendors/iconify";
|
|
4
4
|
import { useResizeObserver } from "@histoire/vendors/vue-use";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, unref, toRefs, ref,
|
|
1
|
+
import { defineComponent, useCssVars, unref, toRefs, ref, createElementBlock, openBlock, createVNode, withCtx, createElementVNode, normalizeClass, toDisplayString } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useScrollOnActive } from "../../util/scroll.js";
|
|
4
4
|
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, computed,
|
|
1
|
+
import { defineComponent, useCssVars, computed, createElementBlock, openBlock, createVNode, unref, Fragment, createBlock, createElementVNode, createCommentVNode, createTextVNode, normalizeClass, toDisplayString, withCtx, renderList } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useStoryStore } from "../../stores/story.js";
|
|
4
4
|
import { isMobile } from "../../util/responsive.js";
|
|
@@ -30,17 +30,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
openVariantMenu: () => true
|
|
31
31
|
},
|
|
32
32
|
setup(__props) {
|
|
33
|
-
useCssVars((_ctx) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"41c4d268": (_a = variant.value) == null ? void 0 : _a.iconColor
|
|
37
|
-
};
|
|
38
|
-
});
|
|
33
|
+
useCssVars((_ctx) => ({
|
|
34
|
+
"41c4d268": variant.value?.iconColor
|
|
35
|
+
}));
|
|
39
36
|
const storyStore = useStoryStore();
|
|
40
|
-
const hasSingleVariant = computed(() =>
|
|
41
|
-
var _a;
|
|
42
|
-
return ((_a = storyStore.currentStory) == null ? void 0 : _a.variants.length) === 1;
|
|
43
|
-
});
|
|
37
|
+
const hasSingleVariant = computed(() => storyStore.currentStory?.variants.length === 1);
|
|
44
38
|
const variant = computed(() => storyStore.currentVariant);
|
|
45
39
|
return (_ctx, _cache) => {
|
|
46
40
|
return hasSingleVariant.value && variant.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed,
|
|
1
|
+
import { defineComponent, computed, createBlock, openBlock, withCtx, createElementVNode, normalizeStyle, unref, normalizeClass } from "@histoire/vendors/vue";
|
|
2
2
|
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
3
3
|
import { histoireConfig } from "../../util/config.js";
|
|
4
4
|
import { isDark } from "../../util/dark.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, computed,
|
|
1
|
+
import { defineComponent, ref, watch, computed, createBlock, openBlock, withCtx, createElementVNode, normalizeStyle, normalizeClass, toRaw } from "@histoire/vendors/vue";
|
|
2
2
|
import { applyState } from "@histoire/shared";
|
|
3
3
|
import { useEventListener } from "@histoire/vendors/vue-use";
|
|
4
4
|
import { useEventsStore } from "../../stores/events.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createCommentVNode, createBlock, unref, createVNode } from "@histoire/vendors/vue";
|
|
2
2
|
import { isMobile } from "../../util/responsive.js";
|
|
3
3
|
import "../toolbar/DevOnlyToolbarOpenInEditor.vue.js";
|
|
4
4
|
import ToolbarBackground from "../toolbar/ToolbarBackground.vue.js";
|
|
@@ -32,7 +32,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
32
32
|
},
|
|
33
33
|
setup(__props) {
|
|
34
34
|
return (_ctx, _cache) => {
|
|
35
|
-
var _a, _b;
|
|
36
35
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
37
36
|
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
38
37
|
createVNode(_sfc_main$1, { variant: _ctx.variant }, null, 8, ["variant"]),
|
|
@@ -45,11 +44,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
44
|
}, null, 8, ["variant", "story"]),
|
|
46
45
|
_ctx.__HISTOIRE_DEV__ ? (openBlock(), createBlock(_sfc_main$5, {
|
|
47
46
|
key: 1,
|
|
48
|
-
file:
|
|
47
|
+
file: _ctx.story.file?.filePath,
|
|
49
48
|
tooltip: "Edit story in editor"
|
|
50
49
|
}, null, 8, ["file"])) : createCommentVNode("", true)
|
|
51
50
|
])) : createCommentVNode("", true),
|
|
52
|
-
|
|
51
|
+
_ctx.story.layout?.iframe === false ? (openBlock(), createBlock(_sfc_main$6, {
|
|
53
52
|
key: 1,
|
|
54
53
|
story: _ctx.story,
|
|
55
54
|
variant: _ctx.variant
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, watch, ref, unref, openBlock,
|
|
1
|
+
import { defineComponent, watch, ref, createBlock, createElementBlock, unref, openBlock, withCtx, createVNode } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useRouter, useRoute } from "@histoire/vendors/vue-router";
|
|
4
4
|
import { useStoryStore } from "../../stores/story.js";
|
|
@@ -29,13 +29,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
29
|
immediate: true
|
|
30
30
|
});
|
|
31
31
|
watch(() => [storyStore.currentStory, storyStore.currentVariant], () => {
|
|
32
|
-
var _a, _b;
|
|
33
32
|
if (!storyStore.currentVariant) {
|
|
34
|
-
if (
|
|
33
|
+
if (storyStore.currentStory?.lastSelectedVariant) {
|
|
35
34
|
setVariant(storyStore.currentStory.lastSelectedVariant.id);
|
|
36
35
|
return;
|
|
37
36
|
}
|
|
38
|
-
if (
|
|
37
|
+
if (storyStore.currentStory?.variants.length === 1) {
|
|
39
38
|
setVariant(storyStore.currentStory.variants[0].id);
|
|
40
39
|
}
|
|
41
40
|
}
|
|
@@ -53,8 +52,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
53
52
|
}
|
|
54
53
|
const docsOnlyScroller = ref(null);
|
|
55
54
|
function scrollDocsToTop() {
|
|
56
|
-
|
|
57
|
-
(_a = docsOnlyScroller.value) == null ? void 0 : _a.scrollTo(0, 0);
|
|
55
|
+
docsOnlyScroller.value?.scrollTo(0, 0);
|
|
58
56
|
}
|
|
59
57
|
return (_ctx, _cache) => {
|
|
60
58
|
return !unref(storyStore).currentStory ? (openBlock(), createBlock(BaseEmpty, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, computed, ref, watch,
|
|
1
|
+
import { defineComponent, useCssVars, computed, ref, watch, createElementBlock, openBlock, Fragment, createElementVNode, createVNode, createBlock, createCommentVNode, unref, withCtx, renderList } from "@histoire/vendors/vue";
|
|
2
2
|
import { useStoryStore } from "../../stores/story.js";
|
|
3
3
|
import "../app/MobileOverlay.vue.js";
|
|
4
4
|
import "./StoryVariantGrid.vue.js";
|
|
@@ -11,12 +11,9 @@ const _hoisted_1 = { class: "histoire-story-viewer htw-bg-gray-50 htw-h-full dar
|
|
|
11
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
12
|
__name: "StoryViewer",
|
|
13
13
|
setup(__props) {
|
|
14
|
-
useCssVars((_ctx) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"0f021d3c": (_a = variant.value) == null ? void 0 : _a.iconColor
|
|
18
|
-
};
|
|
19
|
-
});
|
|
14
|
+
useCssVars((_ctx) => ({
|
|
15
|
+
"0f021d3c": variant.value?.iconColor
|
|
16
|
+
}));
|
|
20
17
|
const storyStore = useStoryStore();
|
|
21
18
|
const variant = computed(() => storyStore.currentVariant);
|
|
22
19
|
const isMenuOpened = ref(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, resolveDirective, withDirectives,
|
|
1
|
+
import { defineComponent, resolveDirective, withDirectives, createElementBlock, openBlock, unref, createVNode } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { openInEditor } from "../../util/open-in-editor.js";
|
|
4
4
|
"use strict";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars,
|
|
1
|
+
import { defineComponent, useCssVars, computed, unref, resolveComponent, resolveDirective, createBlock, createCommentVNode, openBlock, withCtx, withDirectives, createElementBlock, createElementVNode, createVNode, createTextVNode, Fragment, renderList, normalizeClass, toDisplayString, normalizeStyle } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
4
4
|
import { histoireConfig } from "../../util/config.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveDirective, withDirectives,
|
|
1
|
+
import { defineComponent, computed, resolveDirective, withDirectives, createElementBlock, openBlock, createVNode, unref } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { getSandboxUrl } from "../../util/sandbox.js";
|
|
4
4
|
"use strict";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, resolveComponent, resolveDirective,
|
|
1
|
+
import { defineComponent, resolveComponent, resolveDirective, createBlock, openBlock, unref, withCtx, withDirectives, createElementBlock, normalizeClass, createVNode, createElementVNode, createTextVNode, vModelText, Fragment, renderList, toDisplayString, createCommentVNode } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
4
4
|
import { histoireConfig } from "../../util/config.js";
|
|
@@ -19,13 +19,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
19
19
|
setup(__props) {
|
|
20
20
|
const settings = usePreviewSettingsStore().currentSettings;
|
|
21
21
|
return (_ctx, _cache) => {
|
|
22
|
-
var _a;
|
|
23
22
|
const _component_VDropdown = resolveComponent("VDropdown");
|
|
24
23
|
const _directive_tooltip = resolveDirective("tooltip");
|
|
25
24
|
return openBlock(), createBlock(_component_VDropdown, {
|
|
26
25
|
placement: "bottom-end",
|
|
27
26
|
skidding: 6,
|
|
28
|
-
disabled: !
|
|
27
|
+
disabled: !unref(histoireConfig).responsivePresets?.length,
|
|
29
28
|
class: "histoire-toolbar-responsive-size htw-h-full htw-flex-none"
|
|
30
29
|
}, {
|
|
31
30
|
popper: withCtx(({ hide }) => [
|
|
@@ -100,27 +99,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
100
99
|
}), 128))
|
|
101
100
|
])
|
|
102
101
|
]),
|
|
103
|
-
default: withCtx(() =>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
])
|
|
122
|
-
];
|
|
123
|
-
}),
|
|
102
|
+
default: withCtx(() => [
|
|
103
|
+
withDirectives((openBlock(), createElementBlock("div", {
|
|
104
|
+
class: normalizeClass(["htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group", {
|
|
105
|
+
"htw-cursor-pointer hover:htw-text-primary-500": unref(histoireConfig).responsivePresets?.length
|
|
106
|
+
}])
|
|
107
|
+
}, [
|
|
108
|
+
createVNode(unref(Icon), {
|
|
109
|
+
icon: "carbon:devices",
|
|
110
|
+
class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
111
|
+
}),
|
|
112
|
+
createVNode(unref(Icon), {
|
|
113
|
+
icon: "carbon:caret-down",
|
|
114
|
+
class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
115
|
+
})
|
|
116
|
+
], 2)), [
|
|
117
|
+
[_directive_tooltip, "Responsive sizes"]
|
|
118
|
+
])
|
|
119
|
+
]),
|
|
124
120
|
_: 1
|
|
125
121
|
}, 8, ["disabled"]);
|
|
126
122
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, resolveDirective, withDirectives,
|
|
1
|
+
import { defineComponent, resolveDirective, withDirectives, createElementBlock, openBlock, unref, createVNode } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
4
4
|
"use strict";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createVNode, createElementVNode, unref, normalizeClass, toDisplayString } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
"use strict";
|
|
4
4
|
const _hoisted_1 = { class: "histoire-toolbar-title htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0" };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock,
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, Fragment, createElementVNode, withKeys, createVNode, unref, toDisplayString, renderList, createBlock } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useFolderStore } from "../../stores/folder.js";
|
|
4
4
|
import StoryListFolder from "./StoryListFolder.vue.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, Fragment, renderList, createBlock } from "@histoire/vendors/vue";
|
|
2
2
|
import "./StoryGroup.vue.js";
|
|
3
3
|
import StoryListFolder from "./StoryListFolder.vue.js";
|
|
4
4
|
import StoryListItem from "./StoryListItem.vue.js";
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "./StoryListFolder.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
"use strict";
|
|
5
|
-
const StoryListFolder = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const StoryListFolder = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ee932a0c"]]);
|
|
6
6
|
export {
|
|
7
7
|
StoryListFolder as default
|
|
8
8
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, computed, resolveComponent,
|
|
1
|
+
import { defineComponent, useCssVars, computed, resolveComponent, createElementBlock, openBlock, createElementVNode, createCommentVNode, withKeys, createVNode, unref, normalizeClass, toDisplayString, Fragment, renderList, createBlock } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useFolderStore } from "../../stores/folder.js";
|
|
4
4
|
import StoryListItem from "./StoryListItem.vue.js";
|
|
@@ -21,7 +21,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
21
21
|
},
|
|
22
22
|
setup(__props) {
|
|
23
23
|
useCssVars((_ctx) => ({
|
|
24
|
-
"
|
|
24
|
+
"5352bb71": folderPadding.value
|
|
25
25
|
}));
|
|
26
26
|
const props = __props;
|
|
27
27
|
const folderStore = useFolderStore();
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "./StoryListItem.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
"use strict";
|
|
5
|
-
const StoryListItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const StoryListItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-64c2458f"]]);
|
|
6
6
|
export {
|
|
7
7
|
StoryListItem as default
|
|
8
8
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, computed, ref,
|
|
1
|
+
import { defineComponent, useCssVars, computed, ref, createElementBlock, openBlock, createVNode, withCtx, createElementVNode, createCommentVNode, unref, normalizeClass, toDisplayString } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useRoute } from "@histoire/vendors/vue-router";
|
|
4
4
|
import { useScrollOnActive } from "../../util/scroll.js";
|
|
@@ -18,8 +18,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18
18
|
},
|
|
19
19
|
setup(__props) {
|
|
20
20
|
useCssVars((_ctx) => ({
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"2562213a": filePadding.value,
|
|
22
|
+
"1eff521f": _ctx.story.iconColor
|
|
23
23
|
}));
|
|
24
24
|
const props = __props;
|
|
25
25
|
const filePadding = computed(() => {
|
package/dist/bundled/sandbox.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { applyState } from "@histoire/shared";
|
|
2
2
|
import { createPinia } from "@histoire/vendors/pinia";
|
|
3
3
|
import { files } from "virtual:$histoire-stories";
|
|
4
|
-
import { ref, createApp, computed, watch, onMounted
|
|
4
|
+
import { ref, createApp, h, computed, watch, onMounted } from "@histoire/vendors/vue";
|
|
5
5
|
import { parseQuery } from "@histoire/vendors/vue-router";
|
|
6
6
|
import "./components/story/GenericMountStory.vue.js";
|
|
7
7
|
import "./components/story/GenericRenderStory.vue.js";
|
|
8
8
|
import { setupPluginApi } from "./plugin.js";
|
|
9
9
|
import { histoireConfig } from "./util/config.js";
|
|
10
|
-
import { STATE_SYNC, PREVIEW_SETTINGS_SYNC
|
|
10
|
+
import { SANDBOX_READY, STATE_SYNC, PREVIEW_SETTINGS_SYNC } from "./util/const.js";
|
|
11
11
|
import { isDark } from "./util/dark.js";
|
|
12
12
|
import { mapFile } from "./util/mapping.js";
|
|
13
13
|
import { applyPreviewSettings } from "./util/preview-settings.js";
|
|
@@ -21,29 +21,24 @@ const app = createApp({
|
|
|
21
21
|
name: "SandboxApp",
|
|
22
22
|
setup() {
|
|
23
23
|
const story = computed(() => file.value.story);
|
|
24
|
-
const variant = computed(() =>
|
|
25
|
-
var _a;
|
|
26
|
-
return (_a = story.value) == null ? void 0 : _a.variants.find((v) => v.id === query.variantId);
|
|
27
|
-
});
|
|
24
|
+
const variant = computed(() => story.value?.variants.find((v) => v.id === query.variantId));
|
|
28
25
|
let synced = false;
|
|
29
26
|
let mounted = false;
|
|
30
27
|
window.addEventListener("message", (event) => {
|
|
31
|
-
|
|
32
|
-
if (((_a = event.data) == null ? void 0 : _a.type) === STATE_SYNC) {
|
|
28
|
+
if (event.data?.type === STATE_SYNC) {
|
|
33
29
|
if (!mounted) return;
|
|
34
30
|
synced = true;
|
|
35
31
|
applyState(variant.value.state, event.data.state);
|
|
36
|
-
} else if (
|
|
32
|
+
} else if (event.data?.type === PREVIEW_SETTINGS_SYNC) {
|
|
37
33
|
applyPreviewSettings(event.data.settings);
|
|
38
34
|
}
|
|
39
35
|
});
|
|
40
36
|
watch(() => variant.value.state, (value) => {
|
|
41
|
-
var _a;
|
|
42
37
|
if (synced && mounted) {
|
|
43
38
|
synced = false;
|
|
44
39
|
return;
|
|
45
40
|
}
|
|
46
|
-
|
|
41
|
+
window.parent?.postMessage({
|
|
47
42
|
type: STATE_SYNC,
|
|
48
43
|
state: toRawDeep(value, true)
|
|
49
44
|
});
|
|
@@ -67,8 +62,7 @@ const app = createApp({
|
|
|
67
62
|
})
|
|
68
63
|
]),
|
|
69
64
|
this.story && this.variant ? h(_sfc_main$1, { story: this.story, variant: this.variant, onReady: () => {
|
|
70
|
-
|
|
71
|
-
(_a = window.parent) == null ? void 0 : _a.postMessage({
|
|
65
|
+
window.parent?.postMessage({
|
|
72
66
|
type: SANDBOX_READY
|
|
73
67
|
});
|
|
74
68
|
} }) : null
|
|
@@ -6,12 +6,11 @@ const useCommandStore = defineStore("command", () => {
|
|
|
6
6
|
const selectedCommand = ref(null);
|
|
7
7
|
const showPromptsModal = ref(false);
|
|
8
8
|
function activateCommand(command) {
|
|
9
|
-
var _a, _b;
|
|
10
9
|
selectedCommand.value = command;
|
|
11
|
-
if (
|
|
10
|
+
if (command.prompts?.length) {
|
|
12
11
|
showPromptsModal.value = true;
|
|
13
12
|
} else {
|
|
14
|
-
const params =
|
|
13
|
+
const params = command.getParams?.(getCommandContext()) ?? {};
|
|
15
14
|
executeCommand(command, params);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
@@ -14,10 +14,7 @@ const useEventsStore = defineStore("events", () => {
|
|
|
14
14
|
events.length = 0;
|
|
15
15
|
unseen.value = 0;
|
|
16
16
|
}
|
|
17
|
-
watch(() => {
|
|
18
|
-
var _a;
|
|
19
|
-
return (_a = storyStore.currentVariant) == null ? void 0 : _a.id;
|
|
20
|
-
}, () => {
|
|
17
|
+
watch(() => storyStore.currentVariant?.id, () => {
|
|
21
18
|
reset();
|
|
22
19
|
});
|
|
23
20
|
return {
|