histoire 0.8.3 → 0.8.4
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/components/base/BaseEmpty.js +2 -2
- package/dist/bundled/components/panel/PaneTabs.js +30 -9
- package/dist/bundled/components/panel/StoryDocs.js +26 -16
- package/dist/bundled/components/panel/StorySidePanel.js +4 -1
- package/dist/bundled/style.css +15 -15
- package/dist/client/app/components/base/BaseEmpty.vue +1 -1
- package/dist/client/app/components/panel/PaneTabs.vue +26 -1
- package/dist/client/app/components/panel/StoryDocs.vue +28 -12
- package/dist/client/app/components/panel/StorySidePanel.vue +4 -1
- package/dist/node/vite.js +1 -1
- package/package.json +5 -5
- package/src/client/app/components/base/BaseEmpty.vue +1 -1
- package/src/client/app/components/panel/PaneTabs.vue +26 -1
- package/src/client/app/components/panel/StoryDocs.vue +28 -12
- package/src/client/app/components/panel/StorySidePanel.vue +4 -1
- package/src/node/vite.ts +1 -1
|
@@ -2,12 +2,12 @@ import { pushScopeId, popScopeId, openBlock, createElementBlock, renderSlot } fr
|
|
|
2
2
|
import "./BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
3
3
|
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
4
4
|
const _sfc_main = {};
|
|
5
|
-
const _withScopeId = (n) => (pushScopeId("data-v-
|
|
5
|
+
const _withScopeId = (n) => (pushScopeId("data-v-046d52e2"), n = n(), popScopeId(), n);
|
|
6
6
|
const _hoisted_1 = { class: "htw-base-empty htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 htw-text-lg" };
|
|
7
7
|
function _sfc_render(_ctx, _cache) {
|
|
8
8
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
9
9
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
10
10
|
]);
|
|
11
11
|
}
|
|
12
|
-
var BaseEmpty = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
12
|
+
var BaseEmpty = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-046d52e2"]]);
|
|
13
13
|
export { BaseEmpty as default };
|
|
@@ -17,11 +17,12 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
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";
|
|
20
|
+
import { createTextVNode, defineComponent, toRefs, computed, openBlock, createBlock, withCtx, createVNode, normalizeClass, unref, createElementBlock, toDisplayString, createCommentVNode } from "@histoire/vendors/dist/client/vue.js";
|
|
21
21
|
import BaseTab from "../base/BaseTab.js";
|
|
22
22
|
import { useEventsStore } from "../../stores/events.js";
|
|
23
23
|
import _sfc_main$1 from "../base/BaseOverflowMenu.js";
|
|
24
24
|
import BaseOverflowTab from "../base/BaseOverflowTab.js";
|
|
25
|
+
import { useStoryDoc } from "./StoryDocs.js";
|
|
25
26
|
const _hoisted_1 = /* @__PURE__ */ createTextVNode(" Controls ");
|
|
26
27
|
const _hoisted_2 = /* @__PURE__ */ createTextVNode(" Docs ");
|
|
27
28
|
const _hoisted_3 = /* @__PURE__ */ createTextVNode(" Events ");
|
|
@@ -38,8 +39,16 @@ const _hoisted_8 = {
|
|
|
38
39
|
};
|
|
39
40
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
40
41
|
name: "PaneTabs",
|
|
42
|
+
props: {
|
|
43
|
+
story: null,
|
|
44
|
+
variant: null
|
|
45
|
+
},
|
|
41
46
|
setup(__props) {
|
|
47
|
+
const props = __props;
|
|
48
|
+
const { story } = toRefs(props);
|
|
49
|
+
const { renderedDoc } = useStoryDoc(story);
|
|
42
50
|
const eventsStore = useEventsStore();
|
|
51
|
+
const hasEvents = computed(() => eventsStore.events.length);
|
|
43
52
|
return (_ctx, _cache) => {
|
|
44
53
|
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
54
|
overflow: withCtx(() => [
|
|
@@ -54,23 +63,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
54
63
|
}, 8, ["to", "matched"]),
|
|
55
64
|
createVNode(BaseOverflowTab, {
|
|
56
65
|
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "docs" }) }),
|
|
57
|
-
matched: _ctx.$route.query.tab === "docs"
|
|
66
|
+
matched: _ctx.$route.query.tab === "docs",
|
|
67
|
+
class: normalizeClass({
|
|
68
|
+
"opacity-50": !unref(renderedDoc)
|
|
69
|
+
})
|
|
58
70
|
}, {
|
|
59
71
|
default: withCtx(() => [
|
|
60
72
|
_hoisted_6
|
|
61
73
|
]),
|
|
62
74
|
_: 1
|
|
63
|
-
}, 8, ["to", "matched"]),
|
|
75
|
+
}, 8, ["to", "matched", "class"]),
|
|
64
76
|
createVNode(BaseOverflowTab, {
|
|
65
77
|
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "events" }) }),
|
|
66
|
-
matched: _ctx.$route.query.tab === "events"
|
|
78
|
+
matched: _ctx.$route.query.tab === "events",
|
|
79
|
+
class: normalizeClass({
|
|
80
|
+
"htw-opacity-50": !unref(hasEvents)
|
|
81
|
+
})
|
|
67
82
|
}, {
|
|
68
83
|
default: withCtx(() => [
|
|
69
84
|
_hoisted_7,
|
|
70
85
|
unref(eventsStore).unseen ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)) : createCommentVNode("", true)
|
|
71
86
|
]),
|
|
72
87
|
_: 1
|
|
73
|
-
}, 8, ["to", "matched"])
|
|
88
|
+
}, 8, ["to", "matched", "class"])
|
|
74
89
|
]),
|
|
75
90
|
default: withCtx(() => [
|
|
76
91
|
createVNode(BaseTab, {
|
|
@@ -84,23 +99,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
84
99
|
}, 8, ["to", "matched"]),
|
|
85
100
|
createVNode(BaseTab, {
|
|
86
101
|
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "docs" }) }),
|
|
87
|
-
matched: _ctx.$route.query.tab === "docs"
|
|
102
|
+
matched: _ctx.$route.query.tab === "docs",
|
|
103
|
+
class: normalizeClass({
|
|
104
|
+
"htw-opacity-50": !unref(renderedDoc)
|
|
105
|
+
})
|
|
88
106
|
}, {
|
|
89
107
|
default: withCtx(() => [
|
|
90
108
|
_hoisted_2
|
|
91
109
|
]),
|
|
92
110
|
_: 1
|
|
93
|
-
}, 8, ["to", "matched"]),
|
|
111
|
+
}, 8, ["to", "matched", "class"]),
|
|
94
112
|
createVNode(BaseTab, {
|
|
95
113
|
to: __spreadProps(__spreadValues({}, _ctx.$route), { query: __spreadProps(__spreadValues({}, _ctx.$route.query), { tab: "events" }) }),
|
|
96
|
-
matched: _ctx.$route.query.tab === "events"
|
|
114
|
+
matched: _ctx.$route.query.tab === "events",
|
|
115
|
+
class: normalizeClass({
|
|
116
|
+
"htw-opacity-50": !unref(hasEvents)
|
|
117
|
+
})
|
|
97
118
|
}, {
|
|
98
119
|
default: withCtx(() => [
|
|
99
120
|
_hoisted_3,
|
|
100
121
|
unref(eventsStore).unseen ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)) : createCommentVNode("", true)
|
|
101
122
|
]),
|
|
102
123
|
_: 1
|
|
103
|
-
}, 8, ["to", "matched"])
|
|
124
|
+
}, 8, ["to", "matched", "class"])
|
|
104
125
|
]),
|
|
105
126
|
_: 1
|
|
106
127
|
});
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import { createTextVNode,
|
|
1
|
+
import { createTextVNode, ref, watchEffect, defineComponent, toRefs, openBlock, createElementBlock, unref, createBlock, withCtx, createVNode } from "@histoire/vendors/dist/client/vue.js";
|
|
2
2
|
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
3
|
import BaseEmpty from "../base/BaseEmpty.js";
|
|
4
4
|
const _hoisted_1 = /* @__PURE__ */ createTextVNode(" No documentation available ");
|
|
5
5
|
const _hoisted_2 = ["innerHTML"];
|
|
6
|
-
|
|
6
|
+
function useStoryDoc(story) {
|
|
7
|
+
const renderedDoc = ref("");
|
|
8
|
+
watchEffect(async () => {
|
|
9
|
+
var _a;
|
|
10
|
+
let comp = (_a = story.value.file) == null ? void 0 : _a.component;
|
|
11
|
+
console.log(comp);
|
|
12
|
+
if (comp) {
|
|
13
|
+
if (comp.__asyncResolved) {
|
|
14
|
+
comp = comp.__asyncResolved;
|
|
15
|
+
} else if (comp.__asyncLoader) {
|
|
16
|
+
comp = await comp.__asyncLoader();
|
|
17
|
+
}
|
|
18
|
+
renderedDoc.value = comp.doc;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
renderedDoc
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const _sfc_main = defineComponent({
|
|
7
26
|
name: "StoryDocs",
|
|
8
27
|
props: {
|
|
9
28
|
story: {
|
|
@@ -13,20 +32,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13
32
|
},
|
|
14
33
|
setup(__props) {
|
|
15
34
|
const props = __props;
|
|
16
|
-
const
|
|
17
|
-
|
|
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
|
-
});
|
|
35
|
+
const { story } = toRefs(props);
|
|
36
|
+
const { renderedDoc } = useStoryDoc(story);
|
|
27
37
|
return (_ctx, _cache) => {
|
|
28
38
|
return openBlock(), createElementBlock("div", null, [
|
|
29
|
-
!renderedDoc
|
|
39
|
+
!unref(renderedDoc) ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
|
|
30
40
|
default: withCtx(() => [
|
|
31
41
|
createVNode(unref(Icon), {
|
|
32
42
|
icon: "carbon:document-unknown",
|
|
@@ -39,10 +49,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39
49
|
key: 1,
|
|
40
50
|
class: "htw-prose dark:htw-prose-invert htw-p-4 htw-max-w-none",
|
|
41
51
|
"data-test-id": "story-docs",
|
|
42
|
-
innerHTML: renderedDoc
|
|
52
|
+
innerHTML: unref(renderedDoc)
|
|
43
53
|
}, null, 8, _hoisted_2))
|
|
44
54
|
]);
|
|
45
55
|
};
|
|
46
56
|
}
|
|
47
57
|
});
|
|
48
|
-
export { _sfc_main as default };
|
|
58
|
+
export { _sfc_main as default, useStoryDoc };
|
|
@@ -46,7 +46,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
46
46
|
}, {
|
|
47
47
|
first: withCtx(() => [
|
|
48
48
|
createElementVNode("div", _hoisted_3, [
|
|
49
|
-
createVNode(_sfc_main$4
|
|
49
|
+
createVNode(_sfc_main$4, {
|
|
50
|
+
story: unref(storyStore).currentStory,
|
|
51
|
+
variant: unref(storyStore).currentVariant
|
|
52
|
+
}, null, 8, ["story", "variant"]),
|
|
50
53
|
(openBlock(), createBlock(resolveDynamicComponent(unref(panelContentComponent)), {
|
|
51
54
|
story: unref(storyStore).currentStory,
|
|
52
55
|
variant: unref(storyStore).currentVariant,
|
package/dist/bundled/style.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
.htw-base-empty[data-v-
|
|
3
|
-
-webkit-animation: htw-base-empty-
|
|
4
|
-
animation: htw-base-empty-
|
|
2
|
+
.htw-base-empty[data-v-046d52e2]:not(.no-animation) {
|
|
3
|
+
-webkit-animation: htw-base-empty-046d52e2 .15s .2s both;
|
|
4
|
+
animation: htw-base-empty-046d52e2 .15s .2s both;
|
|
5
5
|
}
|
|
6
|
-
@-webkit-keyframes htw-base-empty-
|
|
6
|
+
@-webkit-keyframes htw-base-empty-046d52e2 {
|
|
7
7
|
0% {
|
|
8
8
|
opacity: 0;
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
opacity: 1;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
@keyframes htw-base-empty-
|
|
14
|
+
@keyframes htw-base-empty-046d52e2 {
|
|
15
15
|
0% {
|
|
16
16
|
opacity: 0;
|
|
17
17
|
}
|
|
@@ -53,10 +53,6 @@
|
|
|
53
53
|
bottom: -.625rem;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.bind-icon-color[data-v-2cdc2ac0] {
|
|
57
|
-
color: var(--3c4190ff);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
56
|
.bind-tree-margin[data-v-1b0b957a] {
|
|
61
57
|
margin-left: var(--2101d9b6);
|
|
62
58
|
}
|
|
@@ -64,8 +60,8 @@
|
|
|
64
60
|
color: var(--0fbedaf2);
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
.bind-
|
|
68
|
-
|
|
63
|
+
.bind-icon-color[data-v-2cdc2ac0] {
|
|
64
|
+
color: var(--3c4190ff);
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
.__histoire-code-placeholder[data-v-19579c98] {
|
|
@@ -73,18 +69,22 @@
|
|
|
73
69
|
font-size: inherit;
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
.bind-
|
|
77
|
-
|
|
72
|
+
.bind-tree-padding[data-v-1a78012e] {
|
|
73
|
+
padding-left: var(--27f98670);
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
.bind-icon-color[data-v-
|
|
81
|
-
color: var(--
|
|
76
|
+
.bind-icon-color[data-v-30bcb922] {
|
|
77
|
+
color: var(--33d9fc01);
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
.bind-icon-color[data-v-307653da] {
|
|
85
81
|
color: var(--5f94a358);
|
|
86
82
|
}
|
|
87
83
|
|
|
84
|
+
.bind-icon-color[data-v-7856c5b0] {
|
|
85
|
+
color: var(--0e1c785e);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
88
|
.bind-preview-bg[data-v-bde73868] {
|
|
89
89
|
background-color: var(--b797c7ca);
|
|
90
90
|
}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { computed, toRefs } from 'vue'
|
|
2
3
|
import BaseTab from '../base/BaseTab.vue'
|
|
3
4
|
import { useEventsStore } from '../../stores/events'
|
|
5
|
+
import type { Story, Variant } from '../../types'
|
|
4
6
|
import BaseOverflowMenu from '../base/BaseOverflowMenu.vue'
|
|
5
7
|
import BaseOverflowTab from '../base/BaseOverflowTab.vue'
|
|
8
|
+
import { useStoryDoc } from './StoryDocs.vue'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
story: Story
|
|
12
|
+
variant: Variant
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const { story } = toRefs(props)
|
|
16
|
+
|
|
17
|
+
const { renderedDoc } = useStoryDoc(story)
|
|
6
18
|
|
|
7
19
|
const eventsStore = useEventsStore()
|
|
20
|
+
const hasEvents = computed(() => eventsStore.events.length)
|
|
8
21
|
</script>
|
|
9
22
|
|
|
10
23
|
<template>
|
|
@@ -18,12 +31,18 @@ const eventsStore = useEventsStore()
|
|
|
18
31
|
<BaseTab
|
|
19
32
|
:to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
|
|
20
33
|
:matched="$route.query.tab === 'docs'"
|
|
34
|
+
:class="{
|
|
35
|
+
'htw-opacity-50': !renderedDoc,
|
|
36
|
+
}"
|
|
21
37
|
>
|
|
22
38
|
Docs
|
|
23
39
|
</BaseTab>
|
|
24
40
|
<BaseTab
|
|
25
41
|
:to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
|
|
26
42
|
:matched="$route.query.tab === 'events'"
|
|
43
|
+
:class="{
|
|
44
|
+
'htw-opacity-50': !hasEvents,
|
|
45
|
+
}"
|
|
27
46
|
>
|
|
28
47
|
Events
|
|
29
48
|
<span
|
|
@@ -44,19 +63,25 @@ const eventsStore = useEventsStore()
|
|
|
44
63
|
<BaseOverflowTab
|
|
45
64
|
:to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
|
|
46
65
|
:matched="$route.query.tab === 'docs'"
|
|
66
|
+
:class="{
|
|
67
|
+
'opacity-50': !renderedDoc,
|
|
68
|
+
}"
|
|
47
69
|
>
|
|
48
70
|
Docs
|
|
49
71
|
</BaseOverflowTab>
|
|
50
72
|
<BaseOverflowTab
|
|
51
73
|
:to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
|
|
52
74
|
:matched="$route.query.tab === 'events'"
|
|
75
|
+
:class="{
|
|
76
|
+
'htw-opacity-50': !hasEvents,
|
|
77
|
+
}"
|
|
53
78
|
>
|
|
54
79
|
Events
|
|
55
80
|
<span
|
|
56
81
|
v-if="eventsStore.unseen"
|
|
57
82
|
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"
|
|
58
83
|
>
|
|
59
|
-
{{ eventsStore.unseen <=99 ? eventsStore.unseen : "99+" }}
|
|
84
|
+
{{ eventsStore.unseen <= 99 ? eventsStore.unseen : "99+" }}
|
|
60
85
|
</span>
|
|
61
86
|
</BaseOverflowTab>
|
|
62
87
|
</template>
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, ref, toRefs, watchEffect } from 'vue'
|
|
3
|
+
import type { Story } from '../../types'
|
|
4
|
+
|
|
5
|
+
export function useStoryDoc (story: Ref<Story>) {
|
|
6
|
+
const renderedDoc = ref('')
|
|
7
|
+
|
|
8
|
+
watchEffect(async () => {
|
|
9
|
+
let comp = story.value.file?.component
|
|
10
|
+
console.log(comp)
|
|
11
|
+
if (comp) {
|
|
12
|
+
if (comp.__asyncResolved) {
|
|
13
|
+
comp = comp.__asyncResolved
|
|
14
|
+
} else if (comp.__asyncLoader) {
|
|
15
|
+
comp = await comp.__asyncLoader()
|
|
16
|
+
}
|
|
17
|
+
renderedDoc.value = comp.doc
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
renderedDoc,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
1
27
|
<script lang="ts" setup>
|
|
2
|
-
import { PropType, ref, watchEffect } from 'vue'
|
|
3
28
|
import { Icon } from '@iconify/vue'
|
|
4
|
-
import type { Story } from '../../types'
|
|
5
29
|
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
6
30
|
|
|
7
31
|
const props = defineProps({
|
|
@@ -11,17 +35,9 @@ const props = defineProps({
|
|
|
11
35
|
},
|
|
12
36
|
})
|
|
13
37
|
|
|
14
|
-
const
|
|
38
|
+
const { story } = toRefs(props)
|
|
15
39
|
|
|
16
|
-
|
|
17
|
-
let comp = props.story.file?.component
|
|
18
|
-
if (comp.__asyncResolved) {
|
|
19
|
-
comp = comp.__asyncResolved
|
|
20
|
-
} else if (comp.__asyncLoader) {
|
|
21
|
-
comp = await comp.__asyncLoader()
|
|
22
|
-
}
|
|
23
|
-
renderedDoc.value = comp.doc
|
|
24
|
-
})
|
|
40
|
+
const { renderedDoc } = useStoryDoc(story)
|
|
25
41
|
</script>
|
|
26
42
|
|
|
27
43
|
<template>
|
|
@@ -45,7 +45,10 @@ const panelContentComponent = computed(() => {
|
|
|
45
45
|
>
|
|
46
46
|
<template #first>
|
|
47
47
|
<div class="htw-flex htw-flex-col htw-h-full">
|
|
48
|
-
<PaneTabs
|
|
48
|
+
<PaneTabs
|
|
49
|
+
:story="storyStore.currentStory"
|
|
50
|
+
:variant="storyStore.currentVariant"
|
|
51
|
+
/>
|
|
49
52
|
|
|
50
53
|
<component
|
|
51
54
|
:is="panelContentComponent"
|
package/dist/node/vite.js
CHANGED
|
@@ -49,7 +49,7 @@ async function mergeHistoireViteConfig(viteConfig, ctx) {
|
|
|
49
49
|
export async function getViteConfigWithPlugins(isServer, ctx) {
|
|
50
50
|
const resolvedViteConfig = await resolveViteConfig(ctx);
|
|
51
51
|
const userViteConfig = await loadViteConfigFromFile({ command: ctx.mode === 'dev' ? 'serve' : 'build', mode: ctx.mode });
|
|
52
|
-
const inlineConfig = await mergeHistoireViteConfig(userViteConfig
|
|
52
|
+
const inlineConfig = await mergeHistoireViteConfig(userViteConfig?.config ?? {}, ctx);
|
|
53
53
|
const plugins = [];
|
|
54
54
|
plugins.push({
|
|
55
55
|
name: 'histoire-vite-plugin',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "histoire",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "A fast story book powered by Vite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"histoire": "./bin.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@histoire/controls": "^0.8.
|
|
37
|
-
"@histoire/plugin-vue": "^0.8.
|
|
38
|
-
"@histoire/shared": "^0.8.
|
|
39
|
-
"@histoire/vendors": "^0.8.
|
|
36
|
+
"@histoire/controls": "^0.8.4",
|
|
37
|
+
"@histoire/plugin-vue": "^0.8.4",
|
|
38
|
+
"@histoire/shared": "^0.8.4",
|
|
39
|
+
"@histoire/vendors": "^0.8.4",
|
|
40
40
|
"@types/flexsearch": "^0.7.3",
|
|
41
41
|
"@types/markdown-it": "^12.2.3",
|
|
42
42
|
"birpc": "^0.1.1",
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { computed, toRefs } from 'vue'
|
|
2
3
|
import BaseTab from '../base/BaseTab.vue'
|
|
3
4
|
import { useEventsStore } from '../../stores/events'
|
|
5
|
+
import type { Story, Variant } from '../../types'
|
|
4
6
|
import BaseOverflowMenu from '../base/BaseOverflowMenu.vue'
|
|
5
7
|
import BaseOverflowTab from '../base/BaseOverflowTab.vue'
|
|
8
|
+
import { useStoryDoc } from './StoryDocs.vue'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
story: Story
|
|
12
|
+
variant: Variant
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const { story } = toRefs(props)
|
|
16
|
+
|
|
17
|
+
const { renderedDoc } = useStoryDoc(story)
|
|
6
18
|
|
|
7
19
|
const eventsStore = useEventsStore()
|
|
20
|
+
const hasEvents = computed(() => eventsStore.events.length)
|
|
8
21
|
</script>
|
|
9
22
|
|
|
10
23
|
<template>
|
|
@@ -18,12 +31,18 @@ const eventsStore = useEventsStore()
|
|
|
18
31
|
<BaseTab
|
|
19
32
|
:to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
|
|
20
33
|
:matched="$route.query.tab === 'docs'"
|
|
34
|
+
:class="{
|
|
35
|
+
'htw-opacity-50': !renderedDoc,
|
|
36
|
+
}"
|
|
21
37
|
>
|
|
22
38
|
Docs
|
|
23
39
|
</BaseTab>
|
|
24
40
|
<BaseTab
|
|
25
41
|
:to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
|
|
26
42
|
:matched="$route.query.tab === 'events'"
|
|
43
|
+
:class="{
|
|
44
|
+
'htw-opacity-50': !hasEvents,
|
|
45
|
+
}"
|
|
27
46
|
>
|
|
28
47
|
Events
|
|
29
48
|
<span
|
|
@@ -44,19 +63,25 @@ const eventsStore = useEventsStore()
|
|
|
44
63
|
<BaseOverflowTab
|
|
45
64
|
:to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
|
|
46
65
|
:matched="$route.query.tab === 'docs'"
|
|
66
|
+
:class="{
|
|
67
|
+
'opacity-50': !renderedDoc,
|
|
68
|
+
}"
|
|
47
69
|
>
|
|
48
70
|
Docs
|
|
49
71
|
</BaseOverflowTab>
|
|
50
72
|
<BaseOverflowTab
|
|
51
73
|
:to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
|
|
52
74
|
:matched="$route.query.tab === 'events'"
|
|
75
|
+
:class="{
|
|
76
|
+
'htw-opacity-50': !hasEvents,
|
|
77
|
+
}"
|
|
53
78
|
>
|
|
54
79
|
Events
|
|
55
80
|
<span
|
|
56
81
|
v-if="eventsStore.unseen"
|
|
57
82
|
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"
|
|
58
83
|
>
|
|
59
|
-
{{ eventsStore.unseen <=99 ? eventsStore.unseen : "99+" }}
|
|
84
|
+
{{ eventsStore.unseen <= 99 ? eventsStore.unseen : "99+" }}
|
|
60
85
|
</span>
|
|
61
86
|
</BaseOverflowTab>
|
|
62
87
|
</template>
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, ref, toRefs, watchEffect } from 'vue'
|
|
3
|
+
import type { Story } from '../../types'
|
|
4
|
+
|
|
5
|
+
export function useStoryDoc (story: Ref<Story>) {
|
|
6
|
+
const renderedDoc = ref('')
|
|
7
|
+
|
|
8
|
+
watchEffect(async () => {
|
|
9
|
+
let comp = story.value.file?.component
|
|
10
|
+
console.log(comp)
|
|
11
|
+
if (comp) {
|
|
12
|
+
if (comp.__asyncResolved) {
|
|
13
|
+
comp = comp.__asyncResolved
|
|
14
|
+
} else if (comp.__asyncLoader) {
|
|
15
|
+
comp = await comp.__asyncLoader()
|
|
16
|
+
}
|
|
17
|
+
renderedDoc.value = comp.doc
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
renderedDoc,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
1
27
|
<script lang="ts" setup>
|
|
2
|
-
import { PropType, ref, watchEffect } from 'vue'
|
|
3
28
|
import { Icon } from '@iconify/vue'
|
|
4
|
-
import type { Story } from '../../types'
|
|
5
29
|
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
6
30
|
|
|
7
31
|
const props = defineProps({
|
|
@@ -11,17 +35,9 @@ const props = defineProps({
|
|
|
11
35
|
},
|
|
12
36
|
})
|
|
13
37
|
|
|
14
|
-
const
|
|
38
|
+
const { story } = toRefs(props)
|
|
15
39
|
|
|
16
|
-
|
|
17
|
-
let comp = props.story.file?.component
|
|
18
|
-
if (comp.__asyncResolved) {
|
|
19
|
-
comp = comp.__asyncResolved
|
|
20
|
-
} else if (comp.__asyncLoader) {
|
|
21
|
-
comp = await comp.__asyncLoader()
|
|
22
|
-
}
|
|
23
|
-
renderedDoc.value = comp.doc
|
|
24
|
-
})
|
|
40
|
+
const { renderedDoc } = useStoryDoc(story)
|
|
25
41
|
</script>
|
|
26
42
|
|
|
27
43
|
<template>
|
|
@@ -45,7 +45,10 @@ const panelContentComponent = computed(() => {
|
|
|
45
45
|
>
|
|
46
46
|
<template #first>
|
|
47
47
|
<div class="htw-flex htw-flex-col htw-h-full">
|
|
48
|
-
<PaneTabs
|
|
48
|
+
<PaneTabs
|
|
49
|
+
:story="storyStore.currentStory"
|
|
50
|
+
:variant="storyStore.currentVariant"
|
|
51
|
+
/>
|
|
49
52
|
|
|
50
53
|
<component
|
|
51
54
|
:is="panelContentComponent"
|
package/src/node/vite.ts
CHANGED
|
@@ -65,7 +65,7 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context)
|
|
|
65
65
|
|
|
66
66
|
const userViteConfig = await loadViteConfigFromFile({ command: ctx.mode === 'dev' ? 'serve' : 'build', mode: ctx.mode })
|
|
67
67
|
|
|
68
|
-
const inlineConfig = await mergeHistoireViteConfig(userViteConfig
|
|
68
|
+
const inlineConfig = await mergeHistoireViteConfig(userViteConfig?.config ?? {}, ctx)
|
|
69
69
|
const plugins: VitePlugin[] = []
|
|
70
70
|
|
|
71
71
|
plugins.push({
|