histoire 0.7.9 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/App.js +166 -0
- package/dist/bundled/_virtual/plugin-vue_export-helper.js +8 -0
- package/dist/bundled/api.js +1 -32
- package/dist/bundled/assets/histoire-text-dark.js +2 -0
- package/dist/bundled/assets/histoire-text.js +2 -0
- package/dist/bundled/{HomeView.js → assets/histoire.js} +1 -23
- package/dist/bundled/components/HomeView.js +24 -0
- package/dist/bundled/components/app/AppHeader.js +67 -0
- package/dist/bundled/components/app/AppLogo.js +26 -0
- package/dist/bundled/components/app/Breadcrumb.js +95 -0
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/app/InitialLoading.js +48 -0
- package/dist/bundled/components/app/MobileOverlay.js +41 -0
- package/dist/bundled/components/base/BaseCheckbox.js +75 -0
- package/dist/bundled/{BaseEmpty.js → components/base/BaseEmpty.js} +4 -4
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/base/BaseListItemLink.js +50 -0
- package/dist/bundled/components/base/BaseOverflowMenu.js +97 -0
- package/dist/bundled/components/base/BaseOverflowTab.js +45 -0
- package/dist/bundled/components/base/BaseSelect.js +88 -0
- package/dist/bundled/{MobileOverlay.js → components/base/BaseSplitPane.js} +9 -130
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/base/BaseTab.js +45 -0
- package/dist/bundled/components/misc/CheckerboardPattern.js +41 -0
- package/dist/bundled/components/misc/HatchedPattern.js +11 -0
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.js +98 -0
- package/dist/bundled/components/panel/ControlsComponentProps.js +42 -0
- package/dist/bundled/components/panel/PaneTabs.js +110 -0
- package/dist/bundled/components/panel/StatePresets.js +184 -0
- package/dist/bundled/components/panel/StoryControls.js +66 -0
- package/dist/bundled/components/panel/StoryDocs.js +48 -0
- package/dist/bundled/components/panel/StoryEvent.js +56 -0
- package/dist/bundled/components/panel/StoryEvents.js +49 -0
- package/dist/bundled/components/panel/StorySidePanel.js +68 -0
- package/dist/bundled/components/panel/StorySourceCode.js +110 -0
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/search/SearchItem.js +113 -0
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/search/SearchLoading.js +19 -0
- package/dist/bundled/components/search/SearchModal.js +46 -0
- package/dist/bundled/components/search/SearchPane.js +263 -0
- package/dist/bundled/{search-docs-data.js → components/search/search-docs-data.js} +1 -1
- package/dist/bundled/components/search/search-title-data.js +7 -0
- package/dist/bundled/components/story/StoryResponsivePreview.js +180 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantGrid.js +94 -0
- package/dist/bundled/components/story/StoryVariantGridItem.js +106 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantListItem.js +58 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantSingle.js +115 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +43 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +119 -0
- package/dist/bundled/components/story/StoryVariantSingleView.js +49 -0
- package/dist/bundled/components/story/StoryView.js +107 -0
- package/dist/bundled/components/story/StoryViewer.js +57 -0
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +85 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +33 -0
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +129 -0
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +24 -0
- package/dist/bundled/components/tree/StoryGroup.js +74 -0
- package/dist/bundled/components/tree/StoryList.js +37 -0
- package/dist/bundled/components/tree/StoryListFolder.js +89 -0
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/tree/StoryListItem.js +72 -0
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/index.js +28 -5
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +40 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +5 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +11 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +26 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +10 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +50 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +8 -0
- package/dist/bundled/router.js +28 -0
- package/dist/bundled/sandbox.js +11 -14
- package/dist/bundled/{events.js → stores/events.js} +3 -3
- package/dist/bundled/stores/folder.js +46 -0
- package/dist/bundled/stores/preview-settings.js +15 -0
- package/dist/bundled/{story.js → stores/story.js} +4 -30
- package/dist/bundled/style.css +56 -56
- package/dist/bundled/{config.js → util/config.js} +1 -1
- package/dist/bundled/{const.js → util/const.js} +1 -1
- package/dist/bundled/util/dark.js +4 -0
- package/dist/bundled/util/env.js +2 -0
- package/dist/bundled/util/events.js +32 -0
- package/dist/bundled/util/keyboard.js +84 -0
- package/dist/bundled/{mapping.js → util/mapping.js} +5 -5
- package/dist/bundled/util/preview-settings.js +6 -0
- package/dist/bundled/util/responsive.js +3 -0
- package/dist/bundled/util/sandbox.js +8 -0
- package/dist/bundled/util/scroll.js +28 -0
- package/dist/bundled/{state.js → util/state.js} +2 -2
- package/dist/bundled/util/tooltip.js +12 -0
- package/dist/bundled/util/variant.js +35 -0
- package/dist/client/app/App.vue +0 -1
- package/dist/client/app/components/app/Breadcrumb.vue +1 -1
- package/dist/client/app/components/app/MobileOverlay.vue +1 -1
- package/dist/client/app/components/base/BaseCheckbox.vue +2 -1
- package/dist/client/app/components/base/BaseCopyIcon.vue +34 -0
- package/dist/client/app/components/base/BaseOverflowMenu.vue +1 -0
- package/dist/client/app/components/base/BaseSplitPane.vue +1 -0
- package/dist/client/app/components/panel/StatePresets.vue +3 -3
- package/dist/client/app/components/panel/StorySidePanel.vue +1 -1
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -0
- package/dist/client/app/components/story/StoryVariantSingle.vue +5 -7
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
- package/dist/client/app/components/story/StoryViewer.vue +2 -2
- package/dist/client/app/components/tree/StoryList.vue +1 -1
- package/dist/client/app/components/tree/StoryListItem.vue +2 -2
- package/dist/client/app/index.js +1 -3
- package/dist/client/app/sandbox.js +3 -2
- package/dist/client/app/stores/story.d.ts +30 -30
- package/dist/client/app/util/dark.d.ts +1 -1
- package/dist/client/app/util/mapping.js +3 -3
- package/dist/client/app/util/responsive.d.ts +1 -1
- package/dist/client/app/util/scroll.js +1 -1
- package/dist/node/build.js +1 -1
- package/dist/node/vite.d.ts +1 -1
- package/dist/node/vite.js +4 -2
- package/package.json +8 -15
- package/src/client/app/App.vue +0 -1
- package/src/client/app/components/app/Breadcrumb.vue +1 -1
- package/src/client/app/components/app/MobileOverlay.vue +1 -1
- package/src/client/app/components/base/BaseCheckbox.vue +2 -1
- package/src/client/app/components/base/BaseCopyIcon.vue +34 -0
- package/src/client/app/components/base/BaseOverflowMenu.vue +1 -0
- package/src/client/app/components/base/BaseSplitPane.vue +1 -0
- package/src/client/app/components/panel/StatePresets.vue +3 -3
- package/src/client/app/components/panel/StorySidePanel.vue +1 -1
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -0
- package/src/client/app/components/story/StoryVariantSingle.vue +5 -7
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
- package/src/client/app/components/story/StoryViewer.vue +2 -2
- package/src/client/app/components/tree/StoryList.vue +1 -1
- package/src/client/app/components/tree/StoryListItem.vue +2 -2
- package/src/client/app/index.ts +1 -5
- package/src/client/app/sandbox.ts +3 -2
- package/src/client/app/util/mapping.ts +3 -3
- package/src/client/app/util/scroll.ts +1 -1
- package/src/node/build.ts +1 -1
- package/src/node/vite.ts +4 -2
- package/tsconfig.json +12 -0
- package/vite.config.ts +21 -10
- package/dist/bundled/SearchPane.js +0 -506
- package/dist/bundled/StoryView.js +0 -2264
- package/dist/bundled/dark.js +0 -4
- package/dist/bundled/index2.js +0 -843
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, resolveDirective, unref, openBlock, createBlock, resolveDynamicComponent, isRef, withCtx, withDirectives, createCommentVNode, createVNode, normalizeClass, withModifiers } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
+
import { HstTextarea, HstCheckbox, HstNumber, HstText } from "@histoire/controls";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
name: "ControlsComponentPropItem",
|
|
6
|
+
props: {
|
|
7
|
+
variant: null,
|
|
8
|
+
component: null,
|
|
9
|
+
definition: null
|
|
10
|
+
},
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const props = __props;
|
|
13
|
+
const comp = computed(() => {
|
|
14
|
+
var _a;
|
|
15
|
+
switch ((_a = props.definition.types) == null ? void 0 : _a[0]) {
|
|
16
|
+
case "string":
|
|
17
|
+
return HstText;
|
|
18
|
+
case "number":
|
|
19
|
+
return HstNumber;
|
|
20
|
+
case "boolean":
|
|
21
|
+
return HstCheckbox;
|
|
22
|
+
case "object":
|
|
23
|
+
default:
|
|
24
|
+
return HstTextarea;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const isJSON = computed(() => comp.value === HstTextarea);
|
|
28
|
+
const invalidValue = ref("");
|
|
29
|
+
const model = computed({
|
|
30
|
+
get: () => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (invalidValue.value) {
|
|
33
|
+
return invalidValue.value;
|
|
34
|
+
}
|
|
35
|
+
let val = (_a = props.variant.state._hPropState[props.component.index]) == null ? void 0 : _a[props.definition.name];
|
|
36
|
+
if (val && isJSON.value) {
|
|
37
|
+
val = JSON.stringify(val, null, 2);
|
|
38
|
+
}
|
|
39
|
+
return val;
|
|
40
|
+
},
|
|
41
|
+
set: (value) => {
|
|
42
|
+
invalidValue.value = "";
|
|
43
|
+
if (isJSON.value) {
|
|
44
|
+
try {
|
|
45
|
+
value = JSON.parse(value);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
invalidValue.value = value;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!props.variant.state._hPropState[props.component.index]) {
|
|
52
|
+
props.variant.state._hPropState[props.component.index] = {};
|
|
53
|
+
}
|
|
54
|
+
props.variant.state._hPropState[props.component.index][props.definition.name] = value;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
function reset() {
|
|
58
|
+
if (props.variant.state._hPropState[props.component.index]) {
|
|
59
|
+
delete props.variant.state._hPropState[props.component.index][props.definition.name];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const canReset = computed(() => {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
return ((_b = (_a = props.variant.state) == null ? void 0 : _a._hPropState) == null ? void 0 : _b[props.component.index]) && props.definition.name in props.variant.state._hPropState[props.component.index];
|
|
65
|
+
});
|
|
66
|
+
return (_ctx, _cache) => {
|
|
67
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
68
|
+
return unref(comp) ? (openBlock(), createBlock(resolveDynamicComponent(unref(comp)), {
|
|
69
|
+
key: 0,
|
|
70
|
+
modelValue: unref(model),
|
|
71
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(model) ? model.value = $event : null),
|
|
72
|
+
title: `${__props.definition.name}${unref(canReset) ? " *" : ""}`,
|
|
73
|
+
placeholder: unref(isJSON) ? "Enter JSON" : null
|
|
74
|
+
}, {
|
|
75
|
+
actions: withCtx(() => [
|
|
76
|
+
invalidValue.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
77
|
+
key: 0,
|
|
78
|
+
icon: "carbon:warning-alt",
|
|
79
|
+
class: "htw-text-orange-500"
|
|
80
|
+
}, null, 512)), [
|
|
81
|
+
[_directive_tooltip, "JSON error"]
|
|
82
|
+
]) : createCommentVNode("", true),
|
|
83
|
+
withDirectives(createVNode(unref(Icon), {
|
|
84
|
+
icon: "carbon:erase",
|
|
85
|
+
class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
86
|
+
unref(canReset) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
87
|
+
]]),
|
|
88
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => reset(), ["stop"]))
|
|
89
|
+
}, null, 8, ["class"]), [
|
|
90
|
+
[_directive_tooltip, "Remove override"]
|
|
91
|
+
])
|
|
92
|
+
]),
|
|
93
|
+
_: 1
|
|
94
|
+
}, 8, ["modelValue", "title", "placeholder"])) : createCommentVNode("", true);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createElementVNode, defineComponent, resolveDirective, openBlock, createElementBlock, withDirectives, createVNode, unref, createTextVNode, toDisplayString, Fragment, renderList, createBlock } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
+
import _sfc_main$1 from "./ControlsComponentPropItem.js";
|
|
4
|
+
const _hoisted_1 = { class: "htw-font-mono htw-p-2 htw-flex htw-items-center htw-gap-1" };
|
|
5
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, "<", -1);
|
|
6
|
+
const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-30" }, ">", -1);
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "ControlsComponentProps",
|
|
9
|
+
props: {
|
|
10
|
+
variant: null,
|
|
11
|
+
definition: null
|
|
12
|
+
},
|
|
13
|
+
setup(__props) {
|
|
14
|
+
return (_ctx, _cache) => {
|
|
15
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
16
|
+
return openBlock(), createElementBlock("div", null, [
|
|
17
|
+
createElementVNode("div", _hoisted_1, [
|
|
18
|
+
withDirectives(createVNode(unref(Icon), {
|
|
19
|
+
icon: "carbon:flash",
|
|
20
|
+
class: "htw-w-4 htw-h-4 htw-text-primary-500 htw-flex-none"
|
|
21
|
+
}, null, 512), [
|
|
22
|
+
[_directive_tooltip, "Auto-detected props"]
|
|
23
|
+
]),
|
|
24
|
+
createElementVNode("div", null, [
|
|
25
|
+
_hoisted_2,
|
|
26
|
+
createTextVNode(toDisplayString(__props.definition.name), 1),
|
|
27
|
+
_hoisted_3
|
|
28
|
+
])
|
|
29
|
+
]),
|
|
30
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.definition.props, (prop) => {
|
|
31
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
32
|
+
key: prop.name,
|
|
33
|
+
variant: __props.variant,
|
|
34
|
+
component: __props.definition,
|
|
35
|
+
definition: prop
|
|
36
|
+
}, null, 8, ["variant", "component", "definition"]);
|
|
37
|
+
}), 128))
|
|
38
|
+
]);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { createTextVNode, defineComponent, openBlock, createBlock, withCtx, createVNode, unref, createElementBlock, toDisplayString, createCommentVNode } from "@histoire/vendors/dist/client/vue.js";
|
|
21
|
+
import BaseTab from "../base/BaseTab.js";
|
|
22
|
+
import { useEventsStore } from "../../stores/events.js";
|
|
23
|
+
import _sfc_main$1 from "../base/BaseOverflowMenu.js";
|
|
24
|
+
import BaseOverflowTab from "../base/BaseOverflowTab.js";
|
|
25
|
+
const _hoisted_1 = /* @__PURE__ */ createTextVNode(" Controls ");
|
|
26
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode(" Docs ");
|
|
27
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode(" Events ");
|
|
28
|
+
const _hoisted_4 = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
|
|
31
|
+
};
|
|
32
|
+
const _hoisted_5 = /* @__PURE__ */ createTextVNode(" Controls ");
|
|
33
|
+
const _hoisted_6 = /* @__PURE__ */ createTextVNode(" Docs ");
|
|
34
|
+
const _hoisted_7 = /* @__PURE__ */ createTextVNode(" Events ");
|
|
35
|
+
const _hoisted_8 = {
|
|
36
|
+
key: 0,
|
|
37
|
+
class: "htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
|
|
38
|
+
};
|
|
39
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
40
|
+
name: "PaneTabs",
|
|
41
|
+
setup(__props) {
|
|
42
|
+
const eventsStore = useEventsStore();
|
|
43
|
+
return (_ctx, _cache) => {
|
|
44
|
+
return openBlock(), createBlock(_sfc_main$1, { class: "htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750" }, {
|
|
45
|
+
overflow: withCtx(() => [
|
|
46
|
+
createVNode(BaseOverflowTab, {
|
|
47
|
+
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "" }) }),
|
|
48
|
+
matched: !_ctx.$route.query.tab
|
|
49
|
+
}, {
|
|
50
|
+
default: withCtx(() => [
|
|
51
|
+
_hoisted_5
|
|
52
|
+
]),
|
|
53
|
+
_: 1
|
|
54
|
+
}, 8, ["to", "matched"]),
|
|
55
|
+
createVNode(BaseOverflowTab, {
|
|
56
|
+
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "docs" }) }),
|
|
57
|
+
matched: _ctx.$route.query.tab === "docs"
|
|
58
|
+
}, {
|
|
59
|
+
default: withCtx(() => [
|
|
60
|
+
_hoisted_6
|
|
61
|
+
]),
|
|
62
|
+
_: 1
|
|
63
|
+
}, 8, ["to", "matched"]),
|
|
64
|
+
createVNode(BaseOverflowTab, {
|
|
65
|
+
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "events" }) }),
|
|
66
|
+
matched: _ctx.$route.query.tab === "events"
|
|
67
|
+
}, {
|
|
68
|
+
default: withCtx(() => [
|
|
69
|
+
_hoisted_7,
|
|
70
|
+
unref(eventsStore).unseen ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)) : createCommentVNode("", true)
|
|
71
|
+
]),
|
|
72
|
+
_: 1
|
|
73
|
+
}, 8, ["to", "matched"])
|
|
74
|
+
]),
|
|
75
|
+
default: withCtx(() => [
|
|
76
|
+
createVNode(BaseTab, {
|
|
77
|
+
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "" }) }),
|
|
78
|
+
matched: !_ctx.$route.query.tab
|
|
79
|
+
}, {
|
|
80
|
+
default: withCtx(() => [
|
|
81
|
+
_hoisted_1
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}, 8, ["to", "matched"]),
|
|
85
|
+
createVNode(BaseTab, {
|
|
86
|
+
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "docs" }) }),
|
|
87
|
+
matched: _ctx.$route.query.tab === "docs"
|
|
88
|
+
}, {
|
|
89
|
+
default: withCtx(() => [
|
|
90
|
+
_hoisted_2
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
}, 8, ["to", "matched"]),
|
|
94
|
+
createVNode(BaseTab, {
|
|
95
|
+
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "events" }) }),
|
|
96
|
+
matched: _ctx.$route.query.tab === "events"
|
|
97
|
+
}, {
|
|
98
|
+
default: withCtx(() => [
|
|
99
|
+
_hoisted_3,
|
|
100
|
+
unref(eventsStore).unseen ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)) : createCommentVNode("", true)
|
|
101
|
+
]),
|
|
102
|
+
_: 1
|
|
103
|
+
}, 8, ["to", "matched"])
|
|
104
|
+
]),
|
|
105
|
+
_: 1
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { defineComponent, computed, onMounted, ref, nextTick, resolveDirective, openBlock, createElementBlock, createElementVNode, createVNode, unref, isRef, withKeys, withCtx, withDirectives, withModifiers, vModelText, toDisplayString, createBlock, createCommentVNode, normalizeClass } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
+
import { useStorage, useTimeoutFn, onClickOutside } from "@histoire/vendors/dist/client/vue-use.js";
|
|
4
|
+
import { clone, omit, applyState } from "@histoire/shared";
|
|
5
|
+
import _sfc_main$1 from "../base/BaseSelect.js";
|
|
6
|
+
import { toRawDeep } from "../../util/state.js";
|
|
7
|
+
const _hoisted_1 = { class: "htw-flex htw-gap-2 htw-w-full htw-items-center" };
|
|
8
|
+
const _hoisted_2 = ["onUpdate:modelValue"];
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "htw-flex htw-items-center htw-gap-2"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_4 = { class: "htw-flex-1 htw-truncate" };
|
|
14
|
+
const _hoisted_5 = { class: "htw-flex htw-gap-2 htw-items-center" };
|
|
15
|
+
const _hoisted_6 = { class: "htw-flex-1 htw-truncate" };
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
name: "StatePresets",
|
|
18
|
+
props: {
|
|
19
|
+
story: null,
|
|
20
|
+
variant: null
|
|
21
|
+
},
|
|
22
|
+
setup(__props) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const DEFAULT_ID = "default";
|
|
25
|
+
const saveId = computed(() => `${props.story.id}:${props.variant.id}`);
|
|
26
|
+
const omitKeys = ["_hPropDefs"];
|
|
27
|
+
const defaultState = clone(omit(toRawDeep(props.variant.state), omitKeys));
|
|
28
|
+
const selectedOption = useStorage(`_histoire-presets/${saveId.value}/selected`, DEFAULT_ID);
|
|
29
|
+
const presetStates = useStorage(`_histoire-presets/${saveId.value}/states`, /* @__PURE__ */ new Map());
|
|
30
|
+
const presetsOptions = computed(() => {
|
|
31
|
+
const options = { [DEFAULT_ID]: "Initial state" };
|
|
32
|
+
presetStates.value.forEach((value, key) => {
|
|
33
|
+
options[key] = value.label;
|
|
34
|
+
});
|
|
35
|
+
return options;
|
|
36
|
+
});
|
|
37
|
+
function resetState() {
|
|
38
|
+
selectedOption.value = DEFAULT_ID;
|
|
39
|
+
applyState(props.variant.state, clone(defaultState));
|
|
40
|
+
}
|
|
41
|
+
function applyPreset(id) {
|
|
42
|
+
if (id === DEFAULT_ID) {
|
|
43
|
+
resetState();
|
|
44
|
+
} else if (presetStates.value.has(id)) {
|
|
45
|
+
applyState(props.variant.state, clone(presetStates.value.get(id).state));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
if (selectedOption.value !== DEFAULT_ID) {
|
|
50
|
+
applyPreset(selectedOption.value);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const input = ref();
|
|
54
|
+
const select = ref();
|
|
55
|
+
const canEdit = computed(() => selectedOption.value !== DEFAULT_ID);
|
|
56
|
+
const isEditing = ref(false);
|
|
57
|
+
async function createPreset() {
|
|
58
|
+
const id = new Date().getTime().toString();
|
|
59
|
+
presetStates.value.set(id, { state: clone(omit(toRawDeep(props.variant.state), omitKeys)), label: "New preset" });
|
|
60
|
+
selectedOption.value = id;
|
|
61
|
+
isEditing.value = true;
|
|
62
|
+
await nextTick();
|
|
63
|
+
input.value.select();
|
|
64
|
+
}
|
|
65
|
+
const savedNotif = ref(false);
|
|
66
|
+
const savedTimeout = useTimeoutFn(() => {
|
|
67
|
+
savedNotif.value = false;
|
|
68
|
+
}, 1e3);
|
|
69
|
+
async function savePreset() {
|
|
70
|
+
if (!canEdit.value)
|
|
71
|
+
return;
|
|
72
|
+
const preset = presetStates.value.get(selectedOption.value);
|
|
73
|
+
preset.state = clone(omit(toRawDeep(props.variant.state), omitKeys));
|
|
74
|
+
savedNotif.value = true;
|
|
75
|
+
savedTimeout.start();
|
|
76
|
+
}
|
|
77
|
+
function deletePreset(id) {
|
|
78
|
+
if (!confirm("Are you sure you want to delete this preset?")) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (selectedOption.value === id) {
|
|
82
|
+
resetState();
|
|
83
|
+
}
|
|
84
|
+
presetStates.value.delete(id);
|
|
85
|
+
}
|
|
86
|
+
async function startEditing() {
|
|
87
|
+
if (!canEdit.value) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
isEditing.value = true;
|
|
91
|
+
await nextTick();
|
|
92
|
+
input.value.select();
|
|
93
|
+
}
|
|
94
|
+
function stopEditing() {
|
|
95
|
+
isEditing.value = false;
|
|
96
|
+
}
|
|
97
|
+
onClickOutside(select, stopEditing);
|
|
98
|
+
return (_ctx, _cache) => {
|
|
99
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
100
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
101
|
+
createElementVNode("div", {
|
|
102
|
+
ref_key: "select",
|
|
103
|
+
ref: select,
|
|
104
|
+
class: "htw-flex-1 htw-min-w-0"
|
|
105
|
+
}, [
|
|
106
|
+
createVNode(_sfc_main$1, {
|
|
107
|
+
modelValue: unref(selectedOption),
|
|
108
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
|
|
109
|
+
options: unref(presetsOptions),
|
|
110
|
+
onDblclick: _cache[3] || (_cache[3] = ($event) => startEditing()),
|
|
111
|
+
onKeydown: [
|
|
112
|
+
_cache[4] || (_cache[4] = withKeys(($event) => stopEditing(), ["enter"])),
|
|
113
|
+
_cache[5] || (_cache[5] = withKeys(($event) => stopEditing(), ["escape"]))
|
|
114
|
+
],
|
|
115
|
+
onSelect: _cache[6] || (_cache[6] = (id) => applyPreset(id))
|
|
116
|
+
}, {
|
|
117
|
+
default: withCtx(({ label }) => [
|
|
118
|
+
isEditing.value ? withDirectives((openBlock(), createElementBlock("input", {
|
|
119
|
+
key: 0,
|
|
120
|
+
ref_key: "input",
|
|
121
|
+
ref: input,
|
|
122
|
+
"onUpdate:modelValue": ($event) => unref(presetStates).get(unref(selectedOption)).label = $event,
|
|
123
|
+
type: "text",
|
|
124
|
+
class: "htw-text-inherit htw-bg-transparent htw-w-full htw-h-full htw-outline-none",
|
|
125
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
126
|
+
}, ["stop", "prevent"]))
|
|
127
|
+
}, null, 8, _hoisted_2)), [
|
|
128
|
+
[vModelText, unref(presetStates).get(unref(selectedOption)).label]
|
|
129
|
+
]) : (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
130
|
+
createElementVNode("span", _hoisted_4, toDisplayString(label), 1),
|
|
131
|
+
unref(canEdit) ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
132
|
+
key: 0,
|
|
133
|
+
icon: "carbon:edit",
|
|
134
|
+
class: "htw-flex-none htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
|
|
135
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => startEditing(), ["stop"]))
|
|
136
|
+
}, null, 512)), [
|
|
137
|
+
[_directive_tooltip, "Rename this preset"]
|
|
138
|
+
]) : createCommentVNode("", true)
|
|
139
|
+
]))
|
|
140
|
+
]),
|
|
141
|
+
option: withCtx(({ label, value }) => [
|
|
142
|
+
createElementVNode("div", _hoisted_5, [
|
|
143
|
+
createElementVNode("span", _hoisted_6, toDisplayString(label), 1),
|
|
144
|
+
value !== DEFAULT_ID ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
145
|
+
key: 0,
|
|
146
|
+
icon: "carbon:trash-can",
|
|
147
|
+
class: "htw-flex-none htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
|
|
148
|
+
onClick: withModifiers(($event) => deletePreset(value), ["stop"])
|
|
149
|
+
}, null, 8, ["onClick"])), [
|
|
150
|
+
[_directive_tooltip, "Delete this preset"]
|
|
151
|
+
]) : createCommentVNode("", true)
|
|
152
|
+
])
|
|
153
|
+
]),
|
|
154
|
+
_: 1
|
|
155
|
+
}, 8, ["modelValue", "options"])
|
|
156
|
+
], 512),
|
|
157
|
+
withDirectives(createVNode(unref(Icon), {
|
|
158
|
+
icon: savedNotif.value ? "carbon:checkmark" : "carbon:save",
|
|
159
|
+
class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
160
|
+
unref(canEdit) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
161
|
+
]]),
|
|
162
|
+
onClick: _cache[7] || (_cache[7] = ($event) => savePreset())
|
|
163
|
+
}, null, 8, ["icon", "class"]), [
|
|
164
|
+
[_directive_tooltip, savedNotif.value ? "Saved!" : unref(canEdit) ? "Save to preset" : null]
|
|
165
|
+
]),
|
|
166
|
+
withDirectives(createVNode(unref(Icon), {
|
|
167
|
+
icon: "carbon:add-alt",
|
|
168
|
+
class: "htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
|
|
169
|
+
onClick: _cache[8] || (_cache[8] = ($event) => createPreset())
|
|
170
|
+
}, null, 512), [
|
|
171
|
+
[_directive_tooltip, "Create new preset"]
|
|
172
|
+
]),
|
|
173
|
+
withDirectives(createVNode(unref(Icon), {
|
|
174
|
+
icon: "carbon:reset",
|
|
175
|
+
class: "htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
|
|
176
|
+
onClick: _cache[9] || (_cache[9] = ($event) => resetState())
|
|
177
|
+
}, null, 512), [
|
|
178
|
+
[_directive_tooltip, "Reset to initial state"]
|
|
179
|
+
])
|
|
180
|
+
]);
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createElementVNode, defineComponent, openBlock, createElementBlock, createVNode, createBlock, unref, withCtx, createCommentVNode, Fragment, renderList } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
+
import { SandboxVue3 } from "@histoire/plugin-vue/client";
|
|
4
|
+
import BaseEmpty from "../base/BaseEmpty.js";
|
|
5
|
+
import _sfc_main$1 from "./StatePresets.js";
|
|
6
|
+
import _sfc_main$2 from "./ControlsComponentProps.js";
|
|
7
|
+
const _hoisted_1 = {
|
|
8
|
+
"data-test-id": "story-controls",
|
|
9
|
+
class: "htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-750"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_2 = { class: "htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center" };
|
|
12
|
+
const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", null, "No controls available for this story", -1);
|
|
13
|
+
const _hoisted_4 = { key: 2 };
|
|
14
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
|
+
name: "StoryControls",
|
|
16
|
+
props: {
|
|
17
|
+
variant: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
story: {
|
|
22
|
+
type: Object,
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(__props) {
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
30
|
+
createElementVNode("div", _hoisted_2, [
|
|
31
|
+
createVNode(_sfc_main$1, {
|
|
32
|
+
story: __props.story,
|
|
33
|
+
variant: __props.variant
|
|
34
|
+
}, null, 8, ["story", "variant"])
|
|
35
|
+
]),
|
|
36
|
+
__props.variant.slots().controls || __props.story.slots().controls ? (openBlock(), createBlock(unref(SandboxVue3), {
|
|
37
|
+
key: 0,
|
|
38
|
+
"slot-name": "controls",
|
|
39
|
+
variant: __props.variant,
|
|
40
|
+
story: __props.story,
|
|
41
|
+
class: "htw-flex-none"
|
|
42
|
+
}, null, 8, ["variant", "story"])) : !((_b = (_a = __props.variant.state) == null ? void 0 : _a._hPropDefs) == null ? void 0 : _b.length) ? (openBlock(), createBlock(BaseEmpty, { key: 1 }, {
|
|
43
|
+
default: withCtx(() => [
|
|
44
|
+
createVNode(unref(Icon), {
|
|
45
|
+
icon: "carbon:audio-console",
|
|
46
|
+
class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
47
|
+
}),
|
|
48
|
+
_hoisted_3
|
|
49
|
+
]),
|
|
50
|
+
_: 1
|
|
51
|
+
})) : createCommentVNode("", true),
|
|
52
|
+
((_d = (_c = __props.variant.state) == null ? void 0 : _c._hPropDefs) == null ? void 0 : _d.length) ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
53
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.variant.state._hPropDefs, (def, index) => {
|
|
54
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
55
|
+
key: index,
|
|
56
|
+
variant: __props.variant,
|
|
57
|
+
definition: def,
|
|
58
|
+
class: "htw-flex-none htw-my-2"
|
|
59
|
+
}, null, 8, ["variant", "definition"]);
|
|
60
|
+
}), 128))
|
|
61
|
+
])) : createCommentVNode("", true)
|
|
62
|
+
]);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createTextVNode, defineComponent, ref, watchEffect, openBlock, createElementBlock, createBlock, withCtx, createVNode, unref } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
+
import BaseEmpty from "../base/BaseEmpty.js";
|
|
4
|
+
const _hoisted_1 = /* @__PURE__ */ createTextVNode(" No documentation available ");
|
|
5
|
+
const _hoisted_2 = ["innerHTML"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
name: "StoryDocs",
|
|
8
|
+
props: {
|
|
9
|
+
story: {
|
|
10
|
+
type: Object,
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const props = __props;
|
|
16
|
+
const renderedDoc = ref("");
|
|
17
|
+
watchEffect(async () => {
|
|
18
|
+
var _a;
|
|
19
|
+
let comp = (_a = props.story.file) == null ? void 0 : _a.component;
|
|
20
|
+
if (comp.__asyncResolved) {
|
|
21
|
+
comp = comp.__asyncResolved;
|
|
22
|
+
} else if (comp.__asyncLoader) {
|
|
23
|
+
comp = await comp.__asyncLoader();
|
|
24
|
+
}
|
|
25
|
+
renderedDoc.value = comp.doc;
|
|
26
|
+
});
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
return openBlock(), createElementBlock("div", null, [
|
|
29
|
+
!renderedDoc.value ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
|
|
30
|
+
default: withCtx(() => [
|
|
31
|
+
createVNode(unref(Icon), {
|
|
32
|
+
icon: "carbon:document-unknown",
|
|
33
|
+
class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
34
|
+
}),
|
|
35
|
+
_hoisted_1
|
|
36
|
+
]),
|
|
37
|
+
_: 1
|
|
38
|
+
})) : (openBlock(), createElementBlock("div", {
|
|
39
|
+
key: 1,
|
|
40
|
+
class: "htw-prose dark:htw-prose-invert htw-p-4 htw-max-w-none",
|
|
41
|
+
"data-test-id": "story-docs",
|
|
42
|
+
innerHTML: renderedDoc.value
|
|
43
|
+
}, null, 8, _hoisted_2))
|
|
44
|
+
]);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, toDisplayString, createElementBlock, unref, createCommentVNode } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
const _hoisted_1 = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "htw-text-xs htw-opacity-50 htw-truncate"
|
|
5
|
+
};
|
|
6
|
+
const _hoisted_2 = { class: "htw-overflow-auto htw-max-w-[400px] htw-max-h-[400px]" };
|
|
7
|
+
const _hoisted_3 = { class: "htw-p-4" };
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
name: "StoryEvent",
|
|
10
|
+
props: {
|
|
11
|
+
event: null
|
|
12
|
+
},
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const formattedArgument = computed(() => {
|
|
16
|
+
switch (typeof props.event.argument) {
|
|
17
|
+
case "string":
|
|
18
|
+
return `"${props.event.argument}"`;
|
|
19
|
+
case "object":
|
|
20
|
+
return `{ ${Object.keys(props.event.argument).map((key) => `${key}: ${props.event.argument[key]}`).join(", ")} }`;
|
|
21
|
+
default:
|
|
22
|
+
return props.event.argument;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
const _component_VDropdown = resolveComponent("VDropdown");
|
|
27
|
+
return openBlock(), createBlock(_component_VDropdown, {
|
|
28
|
+
class: "htw-group",
|
|
29
|
+
placement: "right",
|
|
30
|
+
"data-test-id": "event-item"
|
|
31
|
+
}, {
|
|
32
|
+
default: withCtx(({ shown }) => [
|
|
33
|
+
createElementVNode("div", {
|
|
34
|
+
class: normalizeClass(["group-hover:htw-bg-primary-100 dark:group-hover:htw-bg-primary-700 htw-cursor-pointer htw-py-2 htw-px-4 htw-flex htw-items-baseline htw-gap-1 htw-leading-normal", [
|
|
35
|
+
shown ? "htw-bg-primary-50 dark:htw-bg-primary-600" : "group-odd:htw-bg-gray-100/50 dark:group-odd:htw-bg-gray-750/40"
|
|
36
|
+
]])
|
|
37
|
+
}, [
|
|
38
|
+
createElementVNode("span", {
|
|
39
|
+
class: normalizeClass({
|
|
40
|
+
"htw-text-primary-500": shown
|
|
41
|
+
})
|
|
42
|
+
}, toDisplayString(__props.event.name), 3),
|
|
43
|
+
__props.event.argument ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(unref(formattedArgument)), 1)) : createCommentVNode("", true)
|
|
44
|
+
], 2)
|
|
45
|
+
]),
|
|
46
|
+
popper: withCtx(() => [
|
|
47
|
+
createElementVNode("div", _hoisted_2, [
|
|
48
|
+
createElementVNode("pre", _hoisted_3, toDisplayString(__props.event.argument), 1)
|
|
49
|
+
])
|
|
50
|
+
]),
|
|
51
|
+
_: 1
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createTextVNode, defineComponent, computed, onMounted, watch, nextTick, ref, openBlock, createElementBlock, unref, createBlock, withCtx, createVNode, Fragment, renderList } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
+
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
+
import BaseEmpty from "../base/BaseEmpty.js";
|
|
4
|
+
import { useEventsStore } from "../../stores/events.js";
|
|
5
|
+
import _sfc_main$1 from "./StoryEvent.js";
|
|
6
|
+
const _hoisted_1 = /* @__PURE__ */ createTextVNode(" No event fired ");
|
|
7
|
+
const _hoisted_2 = { 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
|
+
_hoisted_1
|
|
35
|
+
]),
|
|
36
|
+
_: 1
|
|
37
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
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 { _sfc_main as default };
|