@histoire/app 0.10.7 → 0.11.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/app/style/main.pcss +11 -0
- package/dist/bundled/App.js +4 -148
- package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +156 -0
- package/dist/bundled/_virtual/{plugin-vue_export-helper.js → _plugin-vue_export-helper.js} +4 -2
- package/dist/bundled/api.js +4 -1
- package/dist/bundled/assets/histoire-text-dark.js +4 -2
- package/dist/bundled/assets/histoire-text.js +4 -2
- package/dist/bundled/assets/histoire.js +4 -2
- package/dist/bundled/components/HomeView.js +5 -24
- package/dist/bundled/components/HomeView.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/bundled/components/app/AppHeader.js +5 -67
- package/dist/bundled/components/app/AppHeader.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/bundled/components/app/AppLogo.js +5 -26
- package/dist/bundled/components/app/AppLogo.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/bundled/components/app/Breadcrumb.js +7 -95
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_script_setup_true_lang.js +95 -0
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_afeba72b_lang.js +4 -0
- package/dist/bundled/components/app/InitialLoading.js +5 -48
- package/dist/bundled/components/app/InitialLoading.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/bundled/components/app/MobileOverlay.js +4 -40
- package/dist/bundled/components/app/MobileOverlay.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/bundled/components/base/BaseCheckbox.js +4 -74
- package/dist/bundled/components/base/BaseCheckbox.vue_vue_type_script_setup_true_lang.js +77 -0
- package/dist/bundled/components/base/BaseEmpty.js +7 -5
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_af3328a6_lang.js +4 -0
- package/dist/bundled/components/base/BaseListItemLink.js +7 -25
- package/dist/bundled/components/base/BaseListItemLink.vue_vue_type_script_lang.js +25 -0
- package/dist/bundled/components/base/BaseOverflowMenu.js +4 -96
- package/dist/bundled/components/base/BaseOverflowMenu.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/bundled/components/base/BaseOverflowTab.js +7 -17
- package/dist/bundled/components/base/BaseOverflowTab.vue_vue_type_script_lang.js +17 -0
- package/dist/bundled/components/base/BaseSelect.js +5 -69
- package/dist/bundled/components/base/BaseSelect.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/bundled/components/base/BaseSplitPane.js +7 -184
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_script_setup_true_lang.js +183 -0
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_bb6c600c_lang.js +4 -0
- package/dist/bundled/components/base/BaseTab.js +7 -17
- package/dist/bundled/components/base/BaseTab.vue_vue_type_script_lang.js +17 -0
- package/dist/bundled/components/misc/CheckerboardPattern.js +5 -3
- package/dist/bundled/components/misc/HatchedPattern.js +7 -5
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_91561117_lang.js +4 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.js +5 -98
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/bundled/components/panel/ControlsComponentProps.js +5 -42
- package/dist/bundled/components/panel/ControlsComponentProps.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/bundled/components/panel/PaneTabs.js +4 -111
- package/dist/bundled/components/panel/PaneTabs.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/bundled/components/panel/StatePresets.js +4 -189
- package/dist/bundled/components/panel/StatePresets.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/bundled/components/panel/StoryControls.js +4 -72
- package/dist/bundled/components/panel/StoryControls.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/bundled/components/panel/StoryDocs.js +6 -72
- package/dist/bundled/components/panel/StoryDocs.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/bundled/components/panel/StoryEvent.js +4 -55
- package/dist/bundled/components/panel/StoryEvent.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/bundled/components/panel/StoryEvents.js +5 -49
- package/dist/bundled/components/panel/StoryEvents.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/bundled/components/panel/StorySidePanel.js +5 -72
- package/dist/bundled/components/panel/StorySidePanel.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/bundled/components/panel/StorySourceCode.js +6 -130
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_0d096b10_lang.js +4 -0
- package/dist/bundled/components/search/SearchItem.js +6 -112
- package/dist/bundled/components/search/SearchItem.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_b819ed97_lang.js +4 -0
- package/dist/bundled/components/search/SearchLoading.js +5 -19
- package/dist/bundled/components/search/SearchLoading.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/bundled/components/search/SearchModal.js +4 -45
- package/dist/bundled/components/search/SearchModal.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/bundled/components/search/SearchPane.js +4 -268
- package/dist/bundled/components/search/SearchPane.vue_vue_type_script_setup_true_lang.js +270 -0
- package/dist/bundled/components/search/search-docs-data.js +5 -2
- package/dist/bundled/components/search/search-title-data.js +5 -2
- package/dist/bundled/components/story/GenericMountStory.js +4 -30
- package/dist/bundled/components/story/GenericMountStory.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/bundled/components/story/GenericRenderStory.js +4 -30
- package/dist/bundled/components/story/GenericRenderStory.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/bundled/components/story/StoryResponsivePreview.js +6 -180
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js +183 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_1375d05a_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantGrid.js +5 -94
- package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/bundled/components/story/StoryVariantGridItem.js +7 -108
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_be3a417b_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantListItem.js +7 -58
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_cc25ec8b_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSingle.js +6 -114
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_afe0bbc2_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +5 -45
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +5 -122
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/bundled/components/story/StoryVariantSingleView.js +4 -48
- package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/bundled/components/story/StoryView.js +4 -89
- package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/bundled/components/story/StoryViewer.js +7 -57
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_54d5a557_lang.js +4 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +7 -85
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_8dc02d19_lang.js +4 -0
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +5 -33
- package/dist/bundled/components/toolbar/StoryVariantNewTab.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +5 -129
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +5 -24
- package/dist/bundled/components/toolbar/StoryVariantTitle.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/bundled/components/tree/StoryGroup.js +4 -73
- package/dist/bundled/components/tree/StoryGroup.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/bundled/components/tree/StoryList.js +5 -37
- package/dist/bundled/components/tree/StoryList.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/bundled/components/tree/StoryListFolder.js +7 -89
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_41fb5f7e_lang.js +4 -0
- package/dist/bundled/components/tree/StoryListItem.js +6 -71
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_313a2f42_lang.js +4 -0
- package/dist/bundled/index.js +6 -3
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +13 -1
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +11 -1
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +4 -1
- package/dist/bundled/router.js +4 -1
- package/dist/bundled/sandbox.js +5 -3
- package/dist/bundled/stores/events.js +3 -1
- package/dist/bundled/stores/folder.js +6 -2
- package/dist/bundled/stores/preview-settings.js +3 -1
- package/dist/bundled/stores/story.js +3 -1
- package/dist/bundled/style.css +37 -46
- package/dist/bundled/util/config.js +5 -2
- package/dist/bundled/util/const.js +6 -1
- package/dist/bundled/util/dark.js +4 -1
- package/dist/bundled/util/env.js +3 -1
- package/dist/bundled/util/events.js +4 -2
- package/dist/bundled/util/keyboard.js +4 -1
- package/dist/bundled/util/mapping.js +4 -1
- package/dist/bundled/util/preview-settings.js +4 -1
- package/dist/bundled/util/responsive.js +3 -1
- package/dist/bundled/util/sandbox.js +3 -1
- package/dist/bundled/util/scroll.js +3 -1
- package/dist/bundled/util/state.js +3 -1
- package/dist/bundled/util/tooltip.js +3 -1
- package/dist/bundled/util/variant.js +3 -1
- package/dist/style.css +145 -119
- package/package.json +6 -6
- package/src/app/App.vue +2 -2
- package/src/app/api.ts +1 -1
- package/src/app/components/base/BaseSplitPane.vue +2 -2
- package/src/app/components/panel/StorySourceCode.vue +134 -26
- package/src/app/components/search/search-docs-data.ts +1 -1
- package/src/app/components/search/search-title-data.ts +1 -1
- package/src/app/components/story/StoryResponsivePreview.vue +55 -54
- package/src/app/components/story/StoryVariantSingle.vue +2 -2
- package/src/app/index.ts +1 -1
- package/src/app/sandbox.ts +1 -1
- package/src/app/stores/folder.ts +3 -1
- package/src/app/style/main.pcss +11 -0
- package/src/app/util/config.ts +1 -1
- package/src/app/util/events.ts +1 -1
- package/tailwind.config.cjs +12 -0
- package/tsconfig.json +0 -1
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineComponent, computed, onMounted, watch, nextTick, ref, openBlock, createElementBlock, unref, createBlock, withCtx, createVNode, createTextVNode, Fragment, renderList } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import BaseEmpty from "../base/BaseEmpty.js";
|
|
4
|
+
import { useEventsStore } from "../../stores/events.js";
|
|
5
|
+
import "./StoryEvent.js";
|
|
6
|
+
import _sfc_main$1 from "./StoryEvent.vue_vue_type_script_setup_true_lang.js";
|
|
7
|
+
const _hoisted_1 = { key: 1 };
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "StoryEvents",
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const eventsStore = useEventsStore();
|
|
12
|
+
const hasEvents = computed(() => eventsStore.events.length);
|
|
13
|
+
onMounted(resetUnseen);
|
|
14
|
+
watch(() => eventsStore.unseen, resetUnseen);
|
|
15
|
+
async function resetUnseen() {
|
|
16
|
+
if (eventsStore.unseen > 0) {
|
|
17
|
+
eventsStore.unseen = 0;
|
|
18
|
+
}
|
|
19
|
+
await nextTick();
|
|
20
|
+
eventsElement.value.scrollTo({ top: eventsElement.value.scrollHeight });
|
|
21
|
+
}
|
|
22
|
+
const eventsElement = ref();
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createElementBlock("div", {
|
|
25
|
+
ref_key: "eventsElement",
|
|
26
|
+
ref: eventsElement
|
|
27
|
+
}, [
|
|
28
|
+
!unref(hasEvents) ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
|
|
29
|
+
default: withCtx(() => [
|
|
30
|
+
createVNode(unref(Icon), {
|
|
31
|
+
icon: "carbon:event-schedule",
|
|
32
|
+
class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
33
|
+
}),
|
|
34
|
+
createTextVNode(" No event fired ")
|
|
35
|
+
]),
|
|
36
|
+
_: 1
|
|
37
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
38
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(eventsStore).events, (event, key) => {
|
|
39
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
40
|
+
key,
|
|
41
|
+
event
|
|
42
|
+
}, null, 8, ["event"]);
|
|
43
|
+
}), 128))
|
|
44
|
+
]))
|
|
45
|
+
], 512);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
_sfc_main as default
|
|
51
|
+
};
|
|
@@ -1,72 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import _sfc_main$1 from "./StoryControls.js";
|
|
7
|
-
import _sfc_main$3 from "./StoryDocs.js";
|
|
8
|
-
import _sfc_main$2 from "./StoryEvents.js";
|
|
9
|
-
import StorySourceCode from "./StorySourceCode.js";
|
|
10
|
-
import _sfc_main$4 from "./PaneTabs.js";
|
|
11
|
-
const _hoisted_1 = /* @__PURE__ */ createElementVNode("span", null, "Select a variant", -1);
|
|
12
|
-
const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", null, "Loading...", -1);
|
|
13
|
-
const _hoisted_3 = { class: "htw-flex htw-flex-col htw-h-full" };
|
|
14
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
|
-
__name: "StorySidePanel",
|
|
16
|
-
setup(__props) {
|
|
17
|
-
const storyStore = useStoryStore();
|
|
18
|
-
const route = useRoute();
|
|
19
|
-
const panelContentComponent = computed(() => {
|
|
20
|
-
switch (route.query.tab) {
|
|
21
|
-
case "docs":
|
|
22
|
-
return _sfc_main$3;
|
|
23
|
-
case "events":
|
|
24
|
-
return _sfc_main$2;
|
|
25
|
-
default:
|
|
26
|
-
return _sfc_main$1;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return (_ctx, _cache) => {
|
|
30
|
-
return !unref(storyStore).currentVariant ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
|
|
31
|
-
default: withCtx(() => [
|
|
32
|
-
_hoisted_1
|
|
33
|
-
]),
|
|
34
|
-
_: 1
|
|
35
|
-
})) : !unref(storyStore).currentVariant.configReady || !unref(storyStore).currentVariant.previewReady ? (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
|
|
36
|
-
default: withCtx(() => [
|
|
37
|
-
_hoisted_2
|
|
38
|
-
]),
|
|
39
|
-
_: 1
|
|
40
|
-
})) : (openBlock(), createBlock(BaseSplitPane, {
|
|
41
|
-
key: 2,
|
|
42
|
-
"save-id": "story-sidepane",
|
|
43
|
-
orientation: "portrait",
|
|
44
|
-
class: "htw-h-full",
|
|
45
|
-
"data-test-id": "story-side-panel"
|
|
46
|
-
}, {
|
|
47
|
-
first: withCtx(() => [
|
|
48
|
-
createElementVNode("div", _hoisted_3, [
|
|
49
|
-
createVNode(_sfc_main$4, {
|
|
50
|
-
story: unref(storyStore).currentStory,
|
|
51
|
-
variant: unref(storyStore).currentVariant
|
|
52
|
-
}, null, 8, ["story", "variant"]),
|
|
53
|
-
(openBlock(), createBlock(resolveDynamicComponent(unref(panelContentComponent)), {
|
|
54
|
-
story: unref(storyStore).currentStory,
|
|
55
|
-
variant: unref(storyStore).currentVariant,
|
|
56
|
-
class: "htw-h-full htw-overflow-auto"
|
|
57
|
-
}, null, 8, ["story", "variant"]))
|
|
58
|
-
])
|
|
59
|
-
]),
|
|
60
|
-
last: withCtx(() => [
|
|
61
|
-
createVNode(StorySourceCode, {
|
|
62
|
-
story: unref(storyStore).currentStory,
|
|
63
|
-
variant: unref(storyStore).currentVariant,
|
|
64
|
-
class: "htw-h-full"
|
|
65
|
-
}, null, 8, ["story", "variant"])
|
|
66
|
-
]),
|
|
67
|
-
_: 1
|
|
68
|
-
}));
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
export { _sfc_main as default };
|
|
1
|
+
import _sfc_main from "./StorySidePanel.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
import { default as default2 } from "./StorySidePanel.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
export {
|
|
4
|
+
default2 as default
|
|
5
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent, computed, unref, openBlock, createBlock, withCtx, createElementVNode, createVNode, resolveDynamicComponent } from "@histoire/vendors/vue";
|
|
2
|
+
import { useRoute } from "@histoire/vendors/vue-router";
|
|
3
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
4
|
+
import BaseSplitPane from "../base/BaseSplitPane.js";
|
|
5
|
+
import BaseEmpty from "../base/BaseEmpty.js";
|
|
6
|
+
import "./StoryControls.js";
|
|
7
|
+
import "./StoryDocs.js";
|
|
8
|
+
import "./StoryEvents.js";
|
|
9
|
+
import StorySourceCode from "./StorySourceCode.js";
|
|
10
|
+
import "./PaneTabs.js";
|
|
11
|
+
import _sfc_main$1 from "./StoryControls.vue_vue_type_script_setup_true_lang.js";
|
|
12
|
+
import _sfc_main$2 from "./StoryEvents.vue_vue_type_script_setup_true_lang.js";
|
|
13
|
+
import _sfc_main$3 from "./StoryDocs.vue_vue_type_script_setup_true_lang.js";
|
|
14
|
+
import _sfc_main$4 from "./PaneTabs.vue_vue_type_script_setup_true_lang.js";
|
|
15
|
+
const _hoisted_1 = /* @__PURE__ */ createElementVNode("span", null, "Select a variant", -1);
|
|
16
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", null, "Loading...", -1);
|
|
17
|
+
const _hoisted_3 = { class: "htw-flex htw-flex-col htw-h-full" };
|
|
18
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "StorySidePanel",
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const storyStore = useStoryStore();
|
|
22
|
+
const route = useRoute();
|
|
23
|
+
const panelContentComponent = computed(() => {
|
|
24
|
+
switch (route.query.tab) {
|
|
25
|
+
case "docs":
|
|
26
|
+
return _sfc_main$3;
|
|
27
|
+
case "events":
|
|
28
|
+
return _sfc_main$2;
|
|
29
|
+
default:
|
|
30
|
+
return _sfc_main$1;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return !unref(storyStore).currentVariant ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
|
|
35
|
+
default: withCtx(() => [
|
|
36
|
+
_hoisted_1
|
|
37
|
+
]),
|
|
38
|
+
_: 1
|
|
39
|
+
})) : !unref(storyStore).currentVariant.configReady || !unref(storyStore).currentVariant.previewReady ? (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
|
|
40
|
+
default: withCtx(() => [
|
|
41
|
+
_hoisted_2
|
|
42
|
+
]),
|
|
43
|
+
_: 1
|
|
44
|
+
})) : (openBlock(), createBlock(BaseSplitPane, {
|
|
45
|
+
key: 2,
|
|
46
|
+
"save-id": "story-sidepane",
|
|
47
|
+
orientation: "portrait",
|
|
48
|
+
class: "htw-h-full",
|
|
49
|
+
"data-test-id": "story-side-panel"
|
|
50
|
+
}, {
|
|
51
|
+
first: withCtx(() => [
|
|
52
|
+
createElementVNode("div", _hoisted_3, [
|
|
53
|
+
createVNode(_sfc_main$4, {
|
|
54
|
+
story: unref(storyStore).currentStory,
|
|
55
|
+
variant: unref(storyStore).currentVariant
|
|
56
|
+
}, null, 8, ["story", "variant"]),
|
|
57
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(panelContentComponent)), {
|
|
58
|
+
story: unref(storyStore).currentStory,
|
|
59
|
+
variant: unref(storyStore).currentVariant,
|
|
60
|
+
class: "htw-h-full htw-overflow-auto"
|
|
61
|
+
}, null, 8, ["story", "variant"]))
|
|
62
|
+
])
|
|
63
|
+
]),
|
|
64
|
+
last: withCtx(() => [
|
|
65
|
+
createVNode(StorySourceCode, {
|
|
66
|
+
story: unref(storyStore).currentStory,
|
|
67
|
+
variant: unref(storyStore).currentVariant,
|
|
68
|
+
class: "htw-h-full"
|
|
69
|
+
}, null, 8, ["story", "variant"])
|
|
70
|
+
]),
|
|
71
|
+
_: 1
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
_sfc_main as default
|
|
78
|
+
};
|
|
@@ -1,131 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { isDark } from "../../util/dark.js";
|
|
8
|
-
import BaseEmpty from "../base/BaseEmpty.js";
|
|
9
|
-
import "./StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
10
|
-
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
11
|
-
const _withScopeId = (n) => (pushScopeId("data-v-68151bff"), n = n(), popScopeId(), n);
|
|
12
|
-
const _hoisted_1 = { class: "htw-bg-gray-100 dark:htw-bg-gray-800 htw-h-full htw-overflow-hidden htw-flex htw-flex-col" };
|
|
13
|
-
const _hoisted_2 = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "htw-h-10 htw-flex-none htw-border-b htw-border-solid htw-border-gray-150 dark:htw-border-gray-850 htw-px-4 htw-flex htw-items-center"
|
|
1
|
+
import _sfc_main from "./StorySourceCode.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
import "./StorySourceCode.vue_vue_type_style_index_0_scoped_0d096b10_lang.js";
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const StorySourceCode = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0d096b10"]]);
|
|
5
|
+
export {
|
|
6
|
+
StorySourceCode as default
|
|
16
7
|
};
|
|
17
|
-
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "htw-text-gray-900 dark:htw-text-gray-100" }, " Source ", -1));
|
|
18
|
-
const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "htw-flex-1" }, null, -1));
|
|
19
|
-
const _hoisted_5 = {
|
|
20
|
-
key: 1,
|
|
21
|
-
class: "htw-text-red-500 htw-h-full htw-p-2 htw-overflow-auto htw-font-mono htw-text-sm"
|
|
22
|
-
};
|
|
23
|
-
const _hoisted_6 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, "Not available", -1));
|
|
24
|
-
const _hoisted_7 = ["value"];
|
|
25
|
-
const _hoisted_8 = {
|
|
26
|
-
key: 4,
|
|
27
|
-
class: "htw-w-full htw-h-full htw-overflow-auto",
|
|
28
|
-
"data-test-id": "story-source-code"
|
|
29
|
-
};
|
|
30
|
-
const _hoisted_9 = ["innerHTML"];
|
|
31
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
32
|
-
__name: "StorySourceCode",
|
|
33
|
-
props: {
|
|
34
|
-
story: null,
|
|
35
|
-
variant: null
|
|
36
|
-
},
|
|
37
|
-
setup(__props) {
|
|
38
|
-
const props = __props;
|
|
39
|
-
const generateSourceCodeFn = ref(null);
|
|
40
|
-
watchEffect(async () => {
|
|
41
|
-
var _a;
|
|
42
|
-
const clientPlugin = clientSupportPlugins[(_a = props.story.file) == null ? void 0 : _a.supportPluginId];
|
|
43
|
-
if (clientPlugin) {
|
|
44
|
-
const pluginModule = await clientPlugin();
|
|
45
|
-
generateSourceCodeFn.value = markRaw(pluginModule.generateSourceCode);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const sourceCode = ref("");
|
|
49
|
-
const highlighter = shallowRef();
|
|
50
|
-
const error = ref(null);
|
|
51
|
-
onMounted(async () => {
|
|
52
|
-
setCDN("https://unpkg.com/shiki@0.10.1/");
|
|
53
|
-
highlighter.value = await getHighlighter({
|
|
54
|
-
langs: [
|
|
55
|
-
"html",
|
|
56
|
-
"jsx"
|
|
57
|
-
],
|
|
58
|
-
themes: [
|
|
59
|
-
"github-light",
|
|
60
|
-
"github-dark"
|
|
61
|
-
]
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
watch(() => [props.variant, generateSourceCodeFn.value], async () => {
|
|
65
|
-
var _a, _b, _c, _d;
|
|
66
|
-
if (!generateSourceCodeFn.value)
|
|
67
|
-
return;
|
|
68
|
-
error.value = null;
|
|
69
|
-
try {
|
|
70
|
-
if (props.variant.source) {
|
|
71
|
-
sourceCode.value = props.variant.source;
|
|
72
|
-
} else if ((_b = (_a = props.variant).slots) == null ? void 0 : _b.call(_a).source) {
|
|
73
|
-
const source = (_d = (_c = props.variant).slots) == null ? void 0 : _d.call(_c).source()[0].children;
|
|
74
|
-
if (source) {
|
|
75
|
-
sourceCode.value = await unindent(source);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
sourceCode.value = await generateSourceCodeFn.value(props.variant);
|
|
79
|
-
}
|
|
80
|
-
} catch (e) {
|
|
81
|
-
console.error(e);
|
|
82
|
-
error.value = e.message;
|
|
83
|
-
}
|
|
84
|
-
}, {
|
|
85
|
-
deep: true,
|
|
86
|
-
immediate: true
|
|
87
|
-
});
|
|
88
|
-
const sourceHtml = computed(() => {
|
|
89
|
-
var _a;
|
|
90
|
-
return sourceCode.value ? (_a = highlighter.value) == null ? void 0 : _a.codeToHtml(sourceCode.value, {
|
|
91
|
-
lang: "html",
|
|
92
|
-
theme: isDark.value ? "github-dark" : "github-light"
|
|
93
|
-
}) : "";
|
|
94
|
-
});
|
|
95
|
-
return (_ctx, _cache) => {
|
|
96
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
97
|
-
!error.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
98
|
-
_hoisted_3,
|
|
99
|
-
_hoisted_4,
|
|
100
|
-
createVNode(unref(HstCopyIcon), {
|
|
101
|
-
content: sourceCode.value,
|
|
102
|
-
class: "htw-flex-none"
|
|
103
|
-
}, null, 8, ["content"])
|
|
104
|
-
])) : createCommentVNode("", true),
|
|
105
|
-
error.value ? (openBlock(), createElementBlock("div", _hoisted_5, " Error: " + toDisplayString(error.value), 1)) : !sourceCode.value ? (openBlock(), createBlock(BaseEmpty, { key: 2 }, {
|
|
106
|
-
default: withCtx(() => [
|
|
107
|
-
createVNode(unref(Icon), {
|
|
108
|
-
icon: "carbon:code-hide",
|
|
109
|
-
class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
110
|
-
}),
|
|
111
|
-
_hoisted_6
|
|
112
|
-
]),
|
|
113
|
-
_: 1
|
|
114
|
-
})) : !unref(sourceHtml) ? (openBlock(), createElementBlock("textarea", {
|
|
115
|
-
key: 3,
|
|
116
|
-
class: "__histoire-code-placeholder htw-w-full htw-h-full htw-p-4 htw-outline-none htw-bg-transparent htw-resize-none htw-m-0",
|
|
117
|
-
value: sourceCode.value,
|
|
118
|
-
readonly: "",
|
|
119
|
-
"data-test-id": "story-source-code"
|
|
120
|
-
}, null, 8, _hoisted_7)) : (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
121
|
-
createElementVNode("div", {
|
|
122
|
-
class: "__histoire-code htw-p-4 htw-w-fit",
|
|
123
|
-
innerHTML: unref(sourceHtml)
|
|
124
|
-
}, null, 8, _hoisted_9)
|
|
125
|
-
]))
|
|
126
|
-
]);
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
var StorySourceCode = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-68151bff"]]);
|
|
131
|
-
export { StorySourceCode as default };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { defineComponent, ref, watchEffect, markRaw, shallowRef, watch, computed, onMounted, nextTick, resolveDirective, openBlock, createElementBlock, createElementVNode, withDirectives, normalizeClass, createVNode, unref, createCommentVNode, toDisplayString, createBlock, withCtx, pushScopeId, popScopeId } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { setCDN, getHighlighter } from "shiki";
|
|
4
|
+
import { HstCopyIcon } from "@histoire/controls";
|
|
5
|
+
import { unindent } from "@histoire/shared";
|
|
6
|
+
import { clientSupportPlugins } from "virtual:$histoire-support-plugins-client";
|
|
7
|
+
import { isDark } from "../../util/dark.js";
|
|
8
|
+
import BaseEmpty from "../base/BaseEmpty.js";
|
|
9
|
+
const _withScopeId = (n) => (pushScopeId("data-v-0d096b10"), n = n(), popScopeId(), n);
|
|
10
|
+
const _hoisted_1 = { class: "htw-bg-gray-50 dark:htw-bg-gray-750 htw-h-full htw-overflow-hidden htw-flex htw-flex-col" };
|
|
11
|
+
const _hoisted_2 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "htw-h-10 htw-flex-none htw-border-b htw-border-solid htw-border-gray-500/5 htw-px-4 htw-flex htw-items-center htw-gap-2"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "htw-text-gray-900 dark:htw-text-gray-100" }, " Source ", -1));
|
|
16
|
+
const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "htw-flex-1" }, null, -1));
|
|
17
|
+
const _hoisted_5 = { class: "htw-flex htw-flex-none htw-gap-px htw-h-full htw-py-2" };
|
|
18
|
+
const _hoisted_6 = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "htw-text-red-500 htw-h-full htw-p-2 htw-overflow-auto htw-font-mono htw-text-sm"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_7 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, "Not available", -1));
|
|
23
|
+
const _hoisted_8 = ["value"];
|
|
24
|
+
const _hoisted_9 = ["innerHTML"];
|
|
25
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
26
|
+
__name: "StorySourceCode",
|
|
27
|
+
props: {
|
|
28
|
+
story: null,
|
|
29
|
+
variant: null
|
|
30
|
+
},
|
|
31
|
+
setup(__props) {
|
|
32
|
+
const props = __props;
|
|
33
|
+
const generateSourceCodeFn = ref(null);
|
|
34
|
+
watchEffect(async () => {
|
|
35
|
+
var _a;
|
|
36
|
+
const clientPlugin = clientSupportPlugins[(_a = props.story.file) == null ? void 0 : _a.supportPluginId];
|
|
37
|
+
if (clientPlugin) {
|
|
38
|
+
const pluginModule = await clientPlugin();
|
|
39
|
+
generateSourceCodeFn.value = markRaw(pluginModule.generateSourceCode);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const highlighter = shallowRef();
|
|
43
|
+
const dynamicSourceCode = ref("");
|
|
44
|
+
const error = ref(null);
|
|
45
|
+
watch(() => [props.variant, generateSourceCodeFn.value], async () => {
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
|
+
if (!generateSourceCodeFn.value)
|
|
48
|
+
return;
|
|
49
|
+
error.value = null;
|
|
50
|
+
dynamicSourceCode.value = "";
|
|
51
|
+
try {
|
|
52
|
+
if (props.variant.source) {
|
|
53
|
+
dynamicSourceCode.value = props.variant.source;
|
|
54
|
+
} else if ((_b = (_a = props.variant).slots) == null ? void 0 : _b.call(_a).source) {
|
|
55
|
+
const source = (_d = (_c = props.variant).slots) == null ? void 0 : _d.call(_c).source()[0].children;
|
|
56
|
+
if (source) {
|
|
57
|
+
dynamicSourceCode.value = await unindent(source);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
dynamicSourceCode.value = await generateSourceCodeFn.value(props.variant);
|
|
61
|
+
}
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.error(e);
|
|
64
|
+
error.value = e.message;
|
|
65
|
+
}
|
|
66
|
+
if (!dynamicSourceCode.value) {
|
|
67
|
+
displayedSource.value = "static";
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
deep: true,
|
|
71
|
+
immediate: true
|
|
72
|
+
});
|
|
73
|
+
const staticSourceCode = ref("");
|
|
74
|
+
watch(() => {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return [props.story, (_b = (_a = props.story) == null ? void 0 : _a.file) == null ? void 0 : _b.source];
|
|
77
|
+
}, async () => {
|
|
78
|
+
var _a;
|
|
79
|
+
staticSourceCode.value = "";
|
|
80
|
+
const sourceLoader = (_a = props.story.file) == null ? void 0 : _a.source;
|
|
81
|
+
if (sourceLoader) {
|
|
82
|
+
staticSourceCode.value = (await sourceLoader()).default;
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
immediate: true
|
|
86
|
+
});
|
|
87
|
+
const displayedSource = ref("dynamic");
|
|
88
|
+
const displayedSourceCode = computed(() => {
|
|
89
|
+
if (displayedSource.value === "dynamic") {
|
|
90
|
+
return dynamicSourceCode.value;
|
|
91
|
+
}
|
|
92
|
+
return staticSourceCode.value;
|
|
93
|
+
});
|
|
94
|
+
onMounted(async () => {
|
|
95
|
+
setCDN("https://unpkg.com/shiki@0.10.1/");
|
|
96
|
+
highlighter.value = await getHighlighter({
|
|
97
|
+
langs: [
|
|
98
|
+
"html",
|
|
99
|
+
"jsx"
|
|
100
|
+
],
|
|
101
|
+
themes: [
|
|
102
|
+
"github-light",
|
|
103
|
+
"github-dark"
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
const sourceHtml = computed(() => {
|
|
108
|
+
var _a;
|
|
109
|
+
return displayedSourceCode.value ? (_a = highlighter.value) == null ? void 0 : _a.codeToHtml(displayedSourceCode.value, {
|
|
110
|
+
lang: "html",
|
|
111
|
+
theme: isDark.value ? "github-dark" : "github-light"
|
|
112
|
+
}) : "";
|
|
113
|
+
});
|
|
114
|
+
let lastScroll = 0;
|
|
115
|
+
watch(() => props.variant, () => {
|
|
116
|
+
lastScroll = 0;
|
|
117
|
+
});
|
|
118
|
+
const scroller = ref();
|
|
119
|
+
function onScroll(event) {
|
|
120
|
+
if (sourceHtml.value) {
|
|
121
|
+
lastScroll = event.target.scrollTop;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
watch(sourceHtml, async () => {
|
|
125
|
+
await nextTick();
|
|
126
|
+
if (scroller.value) {
|
|
127
|
+
scroller.value.scrollTop = lastScroll;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return (_ctx, _cache) => {
|
|
131
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
132
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
133
|
+
!error.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
134
|
+
_hoisted_3,
|
|
135
|
+
_hoisted_4,
|
|
136
|
+
createElementVNode("div", _hoisted_5, [
|
|
137
|
+
withDirectives((openBlock(), createElementBlock("button", {
|
|
138
|
+
class: normalizeClass(["htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-1 htw-bg-gray-500/10 htw-rounded-l htw-transition-all htw-ease-[cubic-bezier(0,1,.6,1)] htw-duration-300 htw-overflow-hidden", [
|
|
139
|
+
displayedSource.value !== "dynamic" ? "htw-max-w-6 htw-opacity-70" : "htw-max-w-[82px] htw-text-primary-600 dark:htw-text-primary-400",
|
|
140
|
+
dynamicSourceCode.value ? "htw-cursor-pointer hover:htw-bg-gray-500/30 active:htw-bg-gray-600/50" : "htw-opacity-50"
|
|
141
|
+
]]),
|
|
142
|
+
onClick: _cache[0] || (_cache[0] = ($event) => dynamicSourceCode.value && (displayedSource.value = "dynamic"))
|
|
143
|
+
}, [
|
|
144
|
+
createVNode(unref(Icon), {
|
|
145
|
+
icon: "carbon:flash",
|
|
146
|
+
class: "htw-w-4 htw-h-4 htw-flex-none"
|
|
147
|
+
}),
|
|
148
|
+
createElementVNode("span", {
|
|
149
|
+
class: normalizeClass(["transition-opacity duration-300", {
|
|
150
|
+
"opacity-0": displayedSource.value !== "dynamic"
|
|
151
|
+
}])
|
|
152
|
+
}, " Dynamic ", 2)
|
|
153
|
+
], 2)), [
|
|
154
|
+
[_directive_tooltip, !dynamicSourceCode.value ? "Dynamic source code is not available" : displayedSource.value !== "dynamic" ? "Switch to dynamic source" : null]
|
|
155
|
+
]),
|
|
156
|
+
withDirectives((openBlock(), createElementBlock("button", {
|
|
157
|
+
class: normalizeClass(["htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-1 htw-bg-gray-500/10 htw-rounded-r htw-transition-all htw-ease-[cubic-bezier(0,1,.6,1)] htw-duration-300 htw-overflow-hidden", [
|
|
158
|
+
displayedSource.value !== "static" ? "htw-max-w-6 htw-opacity-70" : "htw-max-w-[63px] htw-text-primary-600 dark:htw-text-primary-400",
|
|
159
|
+
staticSourceCode.value ? "htw-cursor-pointer hover:htw-bg-gray-500/30 active:htw-bg-gray-600/50" : "htw-opacity-50"
|
|
160
|
+
]]),
|
|
161
|
+
onClick: _cache[1] || (_cache[1] = ($event) => staticSourceCode.value && (displayedSource.value = "static"))
|
|
162
|
+
}, [
|
|
163
|
+
createVNode(unref(Icon), {
|
|
164
|
+
icon: "carbon:document",
|
|
165
|
+
class: "htw-w-4 htw-h-4 htw-flex-none"
|
|
166
|
+
}),
|
|
167
|
+
createElementVNode("span", {
|
|
168
|
+
class: normalizeClass(["transition-opacity duration-300", {
|
|
169
|
+
"opacity-0": displayedSource.value !== "static"
|
|
170
|
+
}])
|
|
171
|
+
}, " Static ", 2)
|
|
172
|
+
], 2)), [
|
|
173
|
+
[_directive_tooltip, !staticSourceCode.value ? "Static source code is not available" : displayedSource.value !== "static" ? "Switch to static source" : null]
|
|
174
|
+
])
|
|
175
|
+
]),
|
|
176
|
+
createVNode(unref(HstCopyIcon), {
|
|
177
|
+
content: unref(displayedSourceCode),
|
|
178
|
+
class: "htw-flex-none"
|
|
179
|
+
}, null, 8, ["content"])
|
|
180
|
+
])) : createCommentVNode("", true),
|
|
181
|
+
error.value ? (openBlock(), createElementBlock("div", _hoisted_6, " Error: " + toDisplayString(error.value), 1)) : !unref(displayedSourceCode) ? (openBlock(), createBlock(BaseEmpty, { key: 2 }, {
|
|
182
|
+
default: withCtx(() => [
|
|
183
|
+
createVNode(unref(Icon), {
|
|
184
|
+
icon: "carbon:code-hide",
|
|
185
|
+
class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
186
|
+
}),
|
|
187
|
+
_hoisted_7
|
|
188
|
+
]),
|
|
189
|
+
_: 1
|
|
190
|
+
})) : !unref(sourceHtml) ? (openBlock(), createElementBlock("textarea", {
|
|
191
|
+
key: 3,
|
|
192
|
+
ref_key: "scroller",
|
|
193
|
+
ref: scroller,
|
|
194
|
+
class: "__histoire-code-placeholder htw-w-full htw-h-full htw-p-4 htw-outline-none htw-bg-transparent htw-resize-none htw-m-0",
|
|
195
|
+
value: unref(displayedSourceCode),
|
|
196
|
+
readonly: "",
|
|
197
|
+
"data-test-id": "story-source-code",
|
|
198
|
+
onScroll
|
|
199
|
+
}, null, 40, _hoisted_8)) : (openBlock(), createElementBlock("div", {
|
|
200
|
+
key: 4,
|
|
201
|
+
ref_key: "scroller",
|
|
202
|
+
ref: scroller,
|
|
203
|
+
class: "htw-w-full htw-h-full htw-overflow-auto",
|
|
204
|
+
"data-test-id": "story-source-code",
|
|
205
|
+
onScroll
|
|
206
|
+
}, [
|
|
207
|
+
createElementVNode("div", {
|
|
208
|
+
class: "__histoire-code htw-p-4 htw-w-fit",
|
|
209
|
+
innerHTML: unref(sourceHtml)
|
|
210
|
+
}, null, 8, _hoisted_9)
|
|
211
|
+
], 544))
|
|
212
|
+
]);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
export {
|
|
217
|
+
_sfc_main as default
|
|
218
|
+
};
|