@histoire/app 0.15.0 → 0.15.2
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/story/GenericRenderStory.vue2.js +1 -3
- package/dist/bundled/components/story/StoryVariantGridItem.vue.js +1 -1
- package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +8 -3
- package/dist/bundled/components/story/StoryVariantGridItem.vue3.js +2 -2
- package/dist/bundled/style.css +16 -16
- package/dist/bundled/util/docs.js +27 -0
- package/package.json +4 -4
- package/src/app/components/story/GenericRenderStory.vue +0 -2
- package/src/app/components/story/StoryVariantGridItem.vue +5 -0
- package/src/app/util/docs.ts +25 -0
|
@@ -14,11 +14,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
14
|
const props = __props;
|
|
15
15
|
const mountComponent = ref(null);
|
|
16
16
|
watchEffect(async () => {
|
|
17
|
-
var _a
|
|
17
|
+
var _a;
|
|
18
18
|
const clientPlugin = clientSupportPlugins[(_a = props.story.file) == null ? void 0 : _a.supportPluginId];
|
|
19
|
-
console.log((_b = props.story.file) == null ? void 0 : _b.supportPluginId, clientPlugin);
|
|
20
19
|
if (clientPlugin) {
|
|
21
|
-
console.log(clientPlugin);
|
|
22
20
|
try {
|
|
23
21
|
const pluginModule = await clientPlugin();
|
|
24
22
|
mountComponent.value = markRaw(pluginModule.RenderStory);
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "./StoryVariantGridItem.vue2.js";
|
|
|
2
2
|
import "./StoryVariantGridItem.vue3.js";
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
"use strict";
|
|
5
|
-
const StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cf76cd68"]]);
|
|
6
6
|
export {
|
|
7
7
|
StoryVariantGridItem as default
|
|
8
8
|
};
|
|
@@ -2,19 +2,21 @@ import { defineComponent, useCssVars, unref, toRefs, ref, computed, resolveCompo
|
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useRouter } from "@histoire/vendors/vue-router";
|
|
4
4
|
import { useResizeObserver } from "@histoire/vendors/vue-use";
|
|
5
|
+
import { HstCopyIcon } from "@histoire/controls";
|
|
5
6
|
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
6
7
|
import { useScrollOnActive } from "../../util/scroll.js";
|
|
7
8
|
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
8
9
|
import { getContrastColor } from "../../util/preview-settings.js";
|
|
9
10
|
import { histoireConfig } from "../../util/config.js";
|
|
10
11
|
import { isDark } from "../../util/dark.js";
|
|
12
|
+
import { getSourceCode } from "../../util/docs.js";
|
|
11
13
|
import "./GenericRenderStory.vue.js";
|
|
12
14
|
import "../toolbar/ToolbarNewTab.vue.js";
|
|
13
15
|
import CheckerboardPattern from "../misc/CheckerboardPattern.vue.js";
|
|
14
16
|
import _sfc_main$1 from "../toolbar/ToolbarNewTab.vue2.js";
|
|
15
17
|
import _sfc_main$2 from "./GenericRenderStory.vue2.js";
|
|
16
18
|
"use strict";
|
|
17
|
-
const _withScopeId = (n) => (pushScopeId("data-v-
|
|
19
|
+
const _withScopeId = (n) => (pushScopeId("data-v-cf76cd68"), n = n(), popScopeId(), n);
|
|
18
20
|
const _hoisted_1 = { class: "htw-flex-none htw-flex htw-items-center" };
|
|
19
21
|
const _hoisted_2 = { class: "htw-truncate htw-flex-1" };
|
|
20
22
|
const _hoisted_3 = { class: "htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center" };
|
|
@@ -41,8 +43,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
43
|
setup(__props, { emit }) {
|
|
42
44
|
const props = __props;
|
|
43
45
|
useCssVars((_ctx) => ({
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
+
"29d8c174": unref(variant).iconColor,
|
|
47
|
+
"0eff7465": unref(settings).backgroundColor
|
|
46
48
|
}));
|
|
47
49
|
const { variant } = toRefs(props);
|
|
48
50
|
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
@@ -102,6 +104,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
102
104
|
[_directive_tooltip, unref(variant).title]
|
|
103
105
|
]),
|
|
104
106
|
createElementVNode("div", _hoisted_3, [
|
|
107
|
+
createVNode(unref(HstCopyIcon), {
|
|
108
|
+
content: () => unref(getSourceCode)(__props.story, unref(variant))
|
|
109
|
+
}, null, 8, ["content"]),
|
|
105
110
|
createVNode(_sfc_main$1, {
|
|
106
111
|
variant: unref(variant),
|
|
107
112
|
story: __props.story
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const StoryVariantGridItem_vue_vue_type_style_index_0_scoped_cf76cd68_lang = "";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
StoryVariantGridItem_vue_vue_type_style_index_0_scoped_cf76cd68_lang as default
|
|
4
4
|
};
|
package/dist/bundled/style.css
CHANGED
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
bottom: -.625rem;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.bind-icon-color[data-v-6046525f] {
|
|
40
|
-
color: var(--663732b6);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
39
|
.bind-icon-color[data-v-36846ccf] {
|
|
44
40
|
color: var(--5792748b);
|
|
45
41
|
}
|
|
46
42
|
|
|
43
|
+
.bind-icon-color[data-v-6046525f] {
|
|
44
|
+
color: var(--663732b6);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
47
|
.bind-tree-padding[data-v-2d2e4786] {
|
|
48
48
|
padding-left: var(--6851b0a7);
|
|
49
49
|
}
|
|
@@ -60,38 +60,38 @@
|
|
|
60
60
|
font-size: inherit;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.bind-icon-color[data-v-ddfc5b4f] {
|
|
64
|
-
color: var(--4d25d048);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
63
|
.bind-icon-color[data-v-ab890d9c] {
|
|
68
64
|
color: var(--89126aaa);
|
|
69
65
|
}
|
|
70
66
|
|
|
67
|
+
.bind-icon-color[data-v-ddfc5b4f] {
|
|
68
|
+
color: var(--4d25d048);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
71
|
.bind-preview-bg[data-v-c48fb2b2] {
|
|
72
72
|
background-color: var(--627bec82);
|
|
73
73
|
color: var(--35068428);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.bind-icon-color[data-v-
|
|
77
|
-
color: var(--
|
|
76
|
+
.bind-icon-color[data-v-cf76cd68] {
|
|
77
|
+
color: var(--29d8c174);
|
|
78
78
|
}
|
|
79
|
-
.bind-preview-bg[data-v-
|
|
80
|
-
background-color: var(--
|
|
79
|
+
.bind-preview-bg[data-v-cf76cd68] {
|
|
80
|
+
background-color: var(--0eff7465);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.bind-icon-color[data-v-6c8e9661] {
|
|
84
84
|
color: var(--a8c1277e);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
.bind-preview-bg[data-v-a83b1911] {
|
|
88
|
-
background-color: var(--03d1950e);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
87
|
img.colorize-black[data-v-74182813] {
|
|
92
88
|
filter: grayscale(100) brightness(0);
|
|
93
89
|
}
|
|
94
90
|
|
|
91
|
+
.bind-preview-bg[data-v-a83b1911] {
|
|
92
|
+
background-color: var(--03d1950e);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
95
|
.__histoire-hatched-pattern[data-v-91561117] {
|
|
96
96
|
background: repeating-linear-gradient(135deg,
|
|
97
97
|
transparent 0px,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { unindent } from "@histoire/shared";
|
|
2
|
+
import { clientSupportPlugins } from "virtual:$histoire-support-plugins-client";
|
|
3
|
+
"use strict";
|
|
4
|
+
async function getSourceCode(story, variant) {
|
|
5
|
+
var _a, _b, _c, _d;
|
|
6
|
+
if (variant.source) {
|
|
7
|
+
return variant.source;
|
|
8
|
+
} else if ((_a = variant.slots) == null ? void 0 : _a.call(variant).source) {
|
|
9
|
+
const source = (_b = variant.slots) == null ? void 0 : _b.call(variant).source()[0].children;
|
|
10
|
+
if (source) {
|
|
11
|
+
return unindent(source);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
const clientPlugin = clientSupportPlugins[(_c = story.file) == null ? void 0 : _c.supportPluginId];
|
|
15
|
+
if (clientPlugin) {
|
|
16
|
+
const pluginModule = await clientPlugin();
|
|
17
|
+
return pluginModule.generateSourceCode(variant);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const sourceLoader = (_d = story.file) == null ? void 0 : _d.source;
|
|
21
|
+
if (sourceLoader) {
|
|
22
|
+
return (await sourceLoader()).default;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
getSourceCode
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@histoire/app",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Pre-bundled UI for Histoire",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"types": "./src/index.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@histoire/controls": "^0.15.
|
|
28
|
-
"@histoire/shared": "^0.15.
|
|
29
|
-
"@histoire/vendors": "^0.15.
|
|
27
|
+
"@histoire/controls": "^0.15.2",
|
|
28
|
+
"@histoire/shared": "^0.15.2",
|
|
29
|
+
"@histoire/vendors": "^0.15.2",
|
|
30
30
|
"@types/flexsearch": "^0.7.3",
|
|
31
31
|
"flexsearch": "0.7.21",
|
|
32
32
|
"shiki-es": "^0.2.0"
|
|
@@ -17,9 +17,7 @@ const mountComponent = ref(null)
|
|
|
17
17
|
|
|
18
18
|
watchEffect(async () => {
|
|
19
19
|
const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId]
|
|
20
|
-
console.log(props.story.file?.supportPluginId, clientPlugin)
|
|
21
20
|
if (clientPlugin) {
|
|
22
|
-
console.log(clientPlugin)
|
|
23
21
|
try {
|
|
24
22
|
const pluginModule = await clientPlugin()
|
|
25
23
|
mountComponent.value = markRaw(pluginModule.RenderStory)
|
|
@@ -3,6 +3,7 @@ import { computed, PropType, ref, toRefs } from 'vue'
|
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import { useRouter } from 'vue-router'
|
|
5
5
|
import { useResizeObserver } from '@vueuse/core'
|
|
6
|
+
import { HstCopyIcon } from '@histoire/controls'
|
|
6
7
|
import { useCurrentVariantRoute } from '../../util/variant'
|
|
7
8
|
import type { Story, Variant } from '../../types'
|
|
8
9
|
import { useScrollOnActive } from '../../util/scroll'
|
|
@@ -10,6 +11,7 @@ import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
|
10
11
|
import { getContrastColor } from '../../util/preview-settings'
|
|
11
12
|
import { histoireConfig } from '../../util/config'
|
|
12
13
|
import { isDark } from '../../util/dark'
|
|
14
|
+
import { getSourceCode } from '../../util/docs'
|
|
13
15
|
import GenericRenderStory from './GenericRenderStory.vue'
|
|
14
16
|
import ToolbarNewTab from '../toolbar/ToolbarNewTab.vue'
|
|
15
17
|
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
@@ -97,6 +99,9 @@ const autoApplyContrastColor = computed(() => !!histoireConfig.autoApplyContrast
|
|
|
97
99
|
|
|
98
100
|
<!-- Toolbar -->
|
|
99
101
|
<div class="htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center">
|
|
102
|
+
<HstCopyIcon
|
|
103
|
+
:content="() => getSourceCode(story, variant)"
|
|
104
|
+
/>
|
|
100
105
|
<ToolbarNewTab
|
|
101
106
|
:variant="variant"
|
|
102
107
|
:story="story"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { unindent } from '@histoire/shared'
|
|
2
|
+
import { clientSupportPlugins } from 'virtual:$histoire-support-plugins-client'
|
|
3
|
+
import type { Variant, Story } from '../types'
|
|
4
|
+
|
|
5
|
+
export async function getSourceCode (story: Story, variant: Variant) {
|
|
6
|
+
if (variant.source) {
|
|
7
|
+
return variant.source
|
|
8
|
+
} else if (variant.slots?.().source) {
|
|
9
|
+
const source = variant.slots?.().source()[0].children
|
|
10
|
+
if (source) {
|
|
11
|
+
return unindent(source)
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
const clientPlugin = clientSupportPlugins[story.file?.supportPluginId]
|
|
15
|
+
if (clientPlugin) {
|
|
16
|
+
const pluginModule = await clientPlugin()
|
|
17
|
+
return pluginModule.generateSourceCode(variant)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const sourceLoader = story.file?.source
|
|
22
|
+
if (sourceLoader) {
|
|
23
|
+
return (await sourceLoader()).default
|
|
24
|
+
}
|
|
25
|
+
}
|