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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import { useStoryStore } from '../../stores/story'
|
|
4
4
|
import { Icon } from '@iconify/vue'
|
|
5
5
|
import { isMobile } from '../../util/responsive'
|
|
@@ -20,12 +20,11 @@ const variant = computed(() => storyStore.currentVariant)
|
|
|
20
20
|
|
|
21
21
|
<template>
|
|
22
22
|
<div
|
|
23
|
-
v-if="hasSingleVariant &&
|
|
23
|
+
v-if="hasSingleVariant && variant"
|
|
24
24
|
class="htw-p-2 htw-h-full"
|
|
25
25
|
>
|
|
26
26
|
<StoryVariantSingleView
|
|
27
|
-
|
|
28
|
-
:variant="storyStore.currentVariant"
|
|
27
|
+
:variant="variant"
|
|
29
28
|
:story="storyStore.currentStory"
|
|
30
29
|
/>
|
|
31
30
|
</div>
|
|
@@ -63,7 +62,6 @@ const variant = computed(() => storyStore.currentVariant)
|
|
|
63
62
|
class="htw-p-2 htw-h-full"
|
|
64
63
|
>
|
|
65
64
|
<StoryVariantSingleView
|
|
66
|
-
v-if="storyStore.currentVariant.configReady"
|
|
67
65
|
:variant="storyStore.currentVariant"
|
|
68
66
|
:story="storyStore.currentStory"
|
|
69
67
|
/>
|
|
@@ -79,9 +77,9 @@ const variant = computed(() => storyStore.currentVariant)
|
|
|
79
77
|
<template #first>
|
|
80
78
|
<div class="htw-h-full htw-overflow-y-auto">
|
|
81
79
|
<StoryVariantListItem
|
|
82
|
-
v-for="(
|
|
80
|
+
v-for="(v, index) of storyStore.currentStory.variants"
|
|
83
81
|
:key="index"
|
|
84
|
-
:variant="
|
|
82
|
+
:variant="v"
|
|
85
83
|
/>
|
|
86
84
|
</div>
|
|
87
85
|
</template>
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, ref, toRaw, watch } from 'vue'
|
|
3
3
|
import { useEventListener } from '@vueuse/core'
|
|
4
|
-
import {
|
|
5
|
-
import { applyStateToVariant } from '@histoire/shared'
|
|
4
|
+
import { applyState } from '@histoire/shared'
|
|
6
5
|
import { STATE_SYNC, PREVIEW_SETTINGS_SYNC, SANDBOX_READY, EVENT_SEND } from '../../util/const'
|
|
7
6
|
import type { Story, Variant } from '../../types'
|
|
8
|
-
import HatchedPattern from '../misc/HatchedPattern.vue'
|
|
9
|
-
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
10
7
|
import { getSandboxUrl } from '../../util/sandbox'
|
|
11
8
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
12
9
|
import { HstEvent, useEventsStore } from '../../stores/events'
|
|
@@ -66,7 +63,7 @@ useEventListener(window, 'message', (event) => {
|
|
|
66
63
|
|
|
67
64
|
function updateVariantState (state: any) {
|
|
68
65
|
synced = true
|
|
69
|
-
|
|
66
|
+
applyState(props.variant.state, state)
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
function logEvent (event: HstEvent) {
|
|
@@ -39,9 +39,9 @@ watch(variant, () => {
|
|
|
39
39
|
@close="closeMenu"
|
|
40
40
|
>
|
|
41
41
|
<StoryVariantListItem
|
|
42
|
-
v-for="(
|
|
42
|
+
v-for="(v, index) of storyStore.currentStory.variants"
|
|
43
43
|
:key="index"
|
|
44
|
-
:variant="
|
|
44
|
+
:variant="v"
|
|
45
45
|
/>
|
|
46
46
|
</MobileOverlay>
|
|
47
47
|
</template>
|
|
@@ -18,9 +18,9 @@ const filePadding = computed(() => {
|
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
const route = useRoute()
|
|
21
|
-
const
|
|
21
|
+
const isActive = computed(() => route.params.storyId === props.story.id)
|
|
22
22
|
const el = ref<HTMLDivElement>()
|
|
23
|
-
useScrollOnActive(
|
|
23
|
+
useScrollOnActive(isActive, el)
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<template>
|
package/dist/client/app/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/* eslint-disable import/first */
|
|
2
|
-
// export * from 'vue'
|
|
3
1
|
import '$histoire-theme';
|
|
4
2
|
import { createApp } from 'vue';
|
|
5
3
|
import { createPinia } from 'pinia';
|
|
6
|
-
import FloatingVue from 'floating-vue';
|
|
4
|
+
import { FloatingVue } from 'floating-vue';
|
|
7
5
|
import App from './App.vue';
|
|
8
6
|
import { router } from './router';
|
|
9
7
|
export function mountMainApp() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseQuery } from 'vue-router';
|
|
2
2
|
import { computed, createApp, h, onMounted, ref, watch } from 'vue';
|
|
3
3
|
import { createPinia } from 'pinia';
|
|
4
|
-
import {
|
|
4
|
+
import { applyState } from '@histoire/shared';
|
|
5
5
|
import { SandboxVue3, MountStoryVue3 } from '@histoire/plugin-vue/client';
|
|
6
6
|
import { mapFile } from './util/mapping';
|
|
7
7
|
// @ts-expect-error virtual module
|
|
@@ -21,11 +21,12 @@ const app = createApp({
|
|
|
21
21
|
let synced = false;
|
|
22
22
|
let mounted = false;
|
|
23
23
|
window.addEventListener('message', event => {
|
|
24
|
+
// console.log('[sandbox] received message', event.data)
|
|
24
25
|
if (event.data?.type === STATE_SYNC) {
|
|
25
26
|
if (!mounted)
|
|
26
27
|
return;
|
|
27
28
|
synced = true;
|
|
28
|
-
|
|
29
|
+
applyState(variant.value.state, event.data.state);
|
|
29
30
|
}
|
|
30
31
|
else if (event.data?.type === PREVIEW_SETTINGS_SYNC) {
|
|
31
32
|
applyPreviewSettings(event.data.settings);
|
|
@@ -9,12 +9,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
9
9
|
title: string;
|
|
10
10
|
icon?: string;
|
|
11
11
|
iconColor?: string;
|
|
12
|
-
initState?: () => any;
|
|
13
12
|
setupApp?: (payload: any) => unknown;
|
|
14
13
|
slots?: () => Readonly<any>;
|
|
15
|
-
state
|
|
14
|
+
state: any;
|
|
16
15
|
source?: string;
|
|
17
16
|
responsiveDisabled?: boolean;
|
|
17
|
+
autoPropsDisabled?: boolean;
|
|
18
18
|
configReady?: boolean;
|
|
19
19
|
previewReady?: boolean;
|
|
20
20
|
}[];
|
|
@@ -40,12 +40,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
40
40
|
title: string;
|
|
41
41
|
icon?: string;
|
|
42
42
|
iconColor?: string;
|
|
43
|
-
initState?: () => any;
|
|
44
43
|
setupApp?: (payload: any) => unknown;
|
|
45
44
|
slots?: () => Readonly<any>;
|
|
46
|
-
state
|
|
45
|
+
state: any;
|
|
47
46
|
source?: string;
|
|
48
47
|
responsiveDisabled?: boolean;
|
|
48
|
+
autoPropsDisabled?: boolean;
|
|
49
49
|
configReady?: boolean;
|
|
50
50
|
previewReady?: boolean;
|
|
51
51
|
};
|
|
@@ -61,12 +61,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
61
61
|
title: string;
|
|
62
62
|
icon?: string;
|
|
63
63
|
iconColor?: string;
|
|
64
|
-
initState?: () => any;
|
|
65
64
|
setupApp?: (payload: any) => unknown;
|
|
66
65
|
slots?: () => Readonly<any>;
|
|
67
|
-
state
|
|
66
|
+
state: any;
|
|
68
67
|
source?: string;
|
|
69
68
|
responsiveDisabled?: boolean;
|
|
69
|
+
autoPropsDisabled?: boolean;
|
|
70
70
|
configReady?: boolean;
|
|
71
71
|
previewReady?: boolean;
|
|
72
72
|
}[];
|
|
@@ -92,12 +92,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
92
92
|
title: string;
|
|
93
93
|
icon?: string;
|
|
94
94
|
iconColor?: string;
|
|
95
|
-
initState?: () => any;
|
|
96
95
|
setupApp?: (payload: any) => unknown;
|
|
97
96
|
slots?: () => Readonly<any>;
|
|
98
|
-
state
|
|
97
|
+
state: any;
|
|
99
98
|
source?: string;
|
|
100
99
|
responsiveDisabled?: boolean;
|
|
100
|
+
autoPropsDisabled?: boolean;
|
|
101
101
|
configReady?: boolean;
|
|
102
102
|
previewReady?: boolean;
|
|
103
103
|
};
|
|
@@ -108,12 +108,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
108
108
|
title: string;
|
|
109
109
|
icon?: string;
|
|
110
110
|
iconColor?: string;
|
|
111
|
-
initState?: () => any;
|
|
112
111
|
setupApp?: (payload: any) => unknown;
|
|
113
112
|
slots?: () => Readonly<any>;
|
|
114
|
-
state
|
|
113
|
+
state: any;
|
|
115
114
|
source?: string;
|
|
116
115
|
responsiveDisabled?: boolean;
|
|
116
|
+
autoPropsDisabled?: boolean;
|
|
117
117
|
configReady?: boolean;
|
|
118
118
|
previewReady?: boolean;
|
|
119
119
|
}>;
|
|
@@ -129,12 +129,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
129
129
|
title: string;
|
|
130
130
|
icon?: string;
|
|
131
131
|
iconColor?: string;
|
|
132
|
-
initState?: () => any;
|
|
133
132
|
setupApp?: (payload: any) => unknown;
|
|
134
133
|
slots?: () => Readonly<any>;
|
|
135
|
-
state
|
|
134
|
+
state: any;
|
|
136
135
|
source?: string;
|
|
137
136
|
responsiveDisabled?: boolean;
|
|
137
|
+
autoPropsDisabled?: boolean;
|
|
138
138
|
configReady?: boolean;
|
|
139
139
|
previewReady?: boolean;
|
|
140
140
|
}[];
|
|
@@ -160,12 +160,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
160
160
|
title: string;
|
|
161
161
|
icon?: string;
|
|
162
162
|
iconColor?: string;
|
|
163
|
-
initState?: () => any;
|
|
164
163
|
setupApp?: (payload: any) => unknown;
|
|
165
164
|
slots?: () => Readonly<any>;
|
|
166
|
-
state
|
|
165
|
+
state: any;
|
|
167
166
|
source?: string;
|
|
168
167
|
responsiveDisabled?: boolean;
|
|
168
|
+
autoPropsDisabled?: boolean;
|
|
169
169
|
configReady?: boolean;
|
|
170
170
|
previewReady?: boolean;
|
|
171
171
|
};
|
|
@@ -181,12 +181,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
181
181
|
title: string;
|
|
182
182
|
icon?: string;
|
|
183
183
|
iconColor?: string;
|
|
184
|
-
initState?: () => any;
|
|
185
184
|
setupApp?: (payload: any) => unknown;
|
|
186
185
|
slots?: () => Readonly<any>;
|
|
187
|
-
state
|
|
186
|
+
state: any;
|
|
188
187
|
source?: string;
|
|
189
188
|
responsiveDisabled?: boolean;
|
|
189
|
+
autoPropsDisabled?: boolean;
|
|
190
190
|
configReady?: boolean;
|
|
191
191
|
previewReady?: boolean;
|
|
192
192
|
}[];
|
|
@@ -212,12 +212,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
212
212
|
title: string;
|
|
213
213
|
icon?: string;
|
|
214
214
|
iconColor?: string;
|
|
215
|
-
initState?: () => any;
|
|
216
215
|
setupApp?: (payload: any) => unknown;
|
|
217
216
|
slots?: () => Readonly<any>;
|
|
218
|
-
state
|
|
217
|
+
state: any;
|
|
219
218
|
source?: string;
|
|
220
219
|
responsiveDisabled?: boolean;
|
|
220
|
+
autoPropsDisabled?: boolean;
|
|
221
221
|
configReady?: boolean;
|
|
222
222
|
previewReady?: boolean;
|
|
223
223
|
};
|
|
@@ -228,12 +228,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
228
228
|
title: string;
|
|
229
229
|
icon?: string;
|
|
230
230
|
iconColor?: string;
|
|
231
|
-
initState?: () => any;
|
|
232
231
|
setupApp?: (payload: any) => unknown;
|
|
233
232
|
slots?: () => Readonly<any>;
|
|
234
|
-
state
|
|
233
|
+
state: any;
|
|
235
234
|
source?: string;
|
|
236
235
|
responsiveDisabled?: boolean;
|
|
236
|
+
autoPropsDisabled?: boolean;
|
|
237
237
|
configReady?: boolean;
|
|
238
238
|
previewReady?: boolean;
|
|
239
239
|
}>;
|
|
@@ -249,12 +249,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
249
249
|
title: string;
|
|
250
250
|
icon?: string;
|
|
251
251
|
iconColor?: string;
|
|
252
|
-
initState?: () => any;
|
|
253
252
|
setupApp?: (payload: any) => unknown;
|
|
254
253
|
slots?: () => Readonly<any>;
|
|
255
|
-
state
|
|
254
|
+
state: any;
|
|
256
255
|
source?: string;
|
|
257
256
|
responsiveDisabled?: boolean;
|
|
257
|
+
autoPropsDisabled?: boolean;
|
|
258
258
|
configReady?: boolean;
|
|
259
259
|
previewReady?: boolean;
|
|
260
260
|
}[];
|
|
@@ -280,12 +280,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
280
280
|
title: string;
|
|
281
281
|
icon?: string;
|
|
282
282
|
iconColor?: string;
|
|
283
|
-
initState?: () => any;
|
|
284
283
|
setupApp?: (payload: any) => unknown;
|
|
285
284
|
slots?: () => Readonly<any>;
|
|
286
|
-
state
|
|
285
|
+
state: any;
|
|
287
286
|
source?: string;
|
|
288
287
|
responsiveDisabled?: boolean;
|
|
288
|
+
autoPropsDisabled?: boolean;
|
|
289
289
|
configReady?: boolean;
|
|
290
290
|
previewReady?: boolean;
|
|
291
291
|
};
|
|
@@ -301,12 +301,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
301
301
|
title: string;
|
|
302
302
|
icon?: string;
|
|
303
303
|
iconColor?: string;
|
|
304
|
-
initState?: () => any;
|
|
305
304
|
setupApp?: (payload: any) => unknown;
|
|
306
305
|
slots?: () => Readonly<any>;
|
|
307
|
-
state
|
|
306
|
+
state: any;
|
|
308
307
|
source?: string;
|
|
309
308
|
responsiveDisabled?: boolean;
|
|
309
|
+
autoPropsDisabled?: boolean;
|
|
310
310
|
configReady?: boolean;
|
|
311
311
|
previewReady?: boolean;
|
|
312
312
|
}[];
|
|
@@ -332,12 +332,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
332
332
|
title: string;
|
|
333
333
|
icon?: string;
|
|
334
334
|
iconColor?: string;
|
|
335
|
-
initState?: () => any;
|
|
336
335
|
setupApp?: (payload: any) => unknown;
|
|
337
336
|
slots?: () => Readonly<any>;
|
|
338
|
-
state
|
|
337
|
+
state: any;
|
|
339
338
|
source?: string;
|
|
340
339
|
responsiveDisabled?: boolean;
|
|
340
|
+
autoPropsDisabled?: boolean;
|
|
341
341
|
configReady?: boolean;
|
|
342
342
|
previewReady?: boolean;
|
|
343
343
|
};
|
|
@@ -348,12 +348,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
348
348
|
title: string;
|
|
349
349
|
icon?: string;
|
|
350
350
|
iconColor?: string;
|
|
351
|
-
initState?: () => any;
|
|
352
351
|
setupApp?: (payload: any) => unknown;
|
|
353
352
|
slots?: () => Readonly<any>;
|
|
354
|
-
state
|
|
353
|
+
state: any;
|
|
355
354
|
source?: string;
|
|
356
355
|
responsiveDisabled?: boolean;
|
|
356
|
+
autoPropsDisabled?: boolean;
|
|
357
357
|
configReady?: boolean;
|
|
358
358
|
previewReady?: boolean;
|
|
359
359
|
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const isDark: import("vue").WritableComputedRef<boolean>;
|
|
1
|
+
export declare const isDark: import("vue-demi").WritableComputedRef<boolean>;
|
|
2
2
|
export declare const toggleDark: (value?: boolean) => boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { markRaw } from 'vue';
|
|
2
|
+
import { reactive as _reactive } from '@histoire/vendors/dist/client/vue';
|
|
2
3
|
const copiedFromExistingVariant = [
|
|
3
4
|
'state',
|
|
4
5
|
'slots',
|
|
5
|
-
'initState',
|
|
6
6
|
'source',
|
|
7
7
|
'responsiveDisabled',
|
|
8
|
+
'autoPropsDisabled',
|
|
8
9
|
'setupApp',
|
|
9
10
|
'configReady',
|
|
10
11
|
'previewReady',
|
|
@@ -58,8 +59,7 @@ export function mapVariant(variant, existingVariant) {
|
|
|
58
59
|
// Create
|
|
59
60
|
result = {
|
|
60
61
|
...variant,
|
|
61
|
-
state:
|
|
62
|
-
initState: null,
|
|
62
|
+
state: _reactive({}),
|
|
63
63
|
setupApp: null,
|
|
64
64
|
slots: () => ({}),
|
|
65
65
|
previewReady: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isMobile: import("vue").Ref<boolean>;
|
|
1
|
+
export declare const isMobile: import("vue-demi").Ref<boolean>;
|
package/dist/node/build.js
CHANGED
|
@@ -81,7 +81,7 @@ export async function build(ctx) {
|
|
|
81
81
|
const vuePlugin = config.plugins.find((p) => p.name === 'vite:vue');
|
|
82
82
|
if (vuePlugin) {
|
|
83
83
|
const original = vuePlugin.configureServer.bind(vuePlugin);
|
|
84
|
-
vuePlugin.configureServer = (
|
|
84
|
+
vuePlugin.configureServer = () => {
|
|
85
85
|
original({
|
|
86
86
|
...server,
|
|
87
87
|
config: {
|
package/dist/node/vite.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export declare const RESOLVED_GENERATED_GLOBAL_SETUP: string;
|
|
|
17
17
|
export declare const GENERATED_SETUP_CODE = "$histoire-generated-setup-code";
|
|
18
18
|
export declare const RESOLVED_GENERATED_SETUP_CODE: string;
|
|
19
19
|
export declare function resolveViteConfig(ctx: Context): Promise<ResolvedConfig>;
|
|
20
|
-
export declare function getViteConfigWithPlugins(
|
|
20
|
+
export declare function getViteConfigWithPlugins(isServer: boolean, ctx: Context): Promise<InlineConfig>;
|
package/dist/node/vite.js
CHANGED
|
@@ -46,7 +46,7 @@ async function mergeHistoireViteConfig(viteConfig, ctx) {
|
|
|
46
46
|
}
|
|
47
47
|
return viteConfig;
|
|
48
48
|
}
|
|
49
|
-
export async function getViteConfigWithPlugins(
|
|
49
|
+
export async function getViteConfigWithPlugins(isServer, ctx) {
|
|
50
50
|
const resolvedViteConfig = await resolveViteConfig(ctx);
|
|
51
51
|
const inlineConfig = await mergeHistoireViteConfig({}, ctx);
|
|
52
52
|
const plugins = [];
|
|
@@ -60,7 +60,7 @@ export async function getViteConfigWithPlugins(server, ctx) {
|
|
|
60
60
|
],
|
|
61
61
|
},
|
|
62
62
|
optimizeDeps: {
|
|
63
|
-
disabled:
|
|
63
|
+
disabled: isServer,
|
|
64
64
|
entries: [
|
|
65
65
|
`${APP_PATH}/bundle-main.js`,
|
|
66
66
|
`${APP_PATH}/bundle-sandbox.js`,
|
|
@@ -90,6 +90,8 @@ export async function getViteConfigWithPlugins(server, ctx) {
|
|
|
90
90
|
define: {
|
|
91
91
|
// We need to force this to be able to use `devtoolsRawSetupState`
|
|
92
92
|
__VUE_PROD_DEVTOOLS__: 'true',
|
|
93
|
+
// Disable warnings
|
|
94
|
+
'process.env.NODE_ENV': JSON.stringify(isServer ? 'production' : process.env.NODE_ENV ?? 'development'),
|
|
93
95
|
},
|
|
94
96
|
};
|
|
95
97
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "histoire",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "A fast story book powered by Vite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"histoire": "./bin.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@histoire/controls": "^0.
|
|
37
|
-
"@histoire/plugin-vue": "^0.
|
|
38
|
-
"@histoire/shared": "^0.
|
|
39
|
-
"@
|
|
36
|
+
"@histoire/controls": "^0.8.0",
|
|
37
|
+
"@histoire/plugin-vue": "^0.8.0",
|
|
38
|
+
"@histoire/shared": "^0.8.0",
|
|
39
|
+
"@histoire/vendors": "^0.8.0",
|
|
40
|
+
"@types/flexsearch": "^0.7.3",
|
|
40
41
|
"@types/markdown-it": "^12.2.3",
|
|
41
|
-
"@vueuse/core": "^8.2.5",
|
|
42
42
|
"birpc": "^0.1.1",
|
|
43
43
|
"case": "^1.6.3",
|
|
44
44
|
"chokidar": "^3.5.3",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"defu": "^6.0.0",
|
|
47
47
|
"diacritics": "^1.3.0",
|
|
48
48
|
"flexsearch": "^0.7.21",
|
|
49
|
-
"floating-vue": "^2.0.0-beta.16",
|
|
50
49
|
"fs-extra": "^10.0.1",
|
|
51
50
|
"globby": "^13.1.1",
|
|
52
51
|
"happy-dom": "^2.55.0",
|
|
@@ -57,15 +56,10 @@
|
|
|
57
56
|
"mrmime": "^1.0.0",
|
|
58
57
|
"pathe": "^0.2.0",
|
|
59
58
|
"picocolors": "^1.0.0",
|
|
60
|
-
"pinia": "^2.0.13",
|
|
61
59
|
"sade": "^1.8.1",
|
|
62
|
-
"scroll-into-view-if-needed": "^2.2.29",
|
|
63
|
-
"shiki": "^0.10.1",
|
|
64
60
|
"sirv": "^2.0.2",
|
|
65
61
|
"tinypool": "^0.1.2",
|
|
66
|
-
"vite-node": "0.12.1"
|
|
67
|
-
"vue-router": "^4.0.14",
|
|
68
|
-
"vue": "^3.2.31"
|
|
62
|
+
"vite-node": "0.12.1"
|
|
69
63
|
},
|
|
70
64
|
"peerDependencies": {
|
|
71
65
|
"vite": "^2.9.0"
|
|
@@ -73,7 +67,6 @@
|
|
|
73
67
|
"devDependencies": {
|
|
74
68
|
"@peeky/test": "^0.13.5",
|
|
75
69
|
"@tailwindcss/typography": "^0.5.2",
|
|
76
|
-
"@types/flexsearch": "^0.7.3",
|
|
77
70
|
"@types/fs-extra": "^9.0.13",
|
|
78
71
|
"@types/markdown-it": "^12.2.3",
|
|
79
72
|
"@types/node": "^17.0.32",
|
|
@@ -83,7 +76,7 @@
|
|
|
83
76
|
"postcss": "^8.4.12",
|
|
84
77
|
"postcss-import": "^14.1.0",
|
|
85
78
|
"tailwindcss": "^3.0.23",
|
|
86
|
-
"typescript": "^4.
|
|
79
|
+
"typescript": "^4.7.4",
|
|
87
80
|
"vite": "^2.9.1",
|
|
88
81
|
"vue": "^3.2.31"
|
|
89
82
|
},
|
package/src/client/app/App.vue
CHANGED
|
@@ -9,6 +9,7 @@ const props = defineProps({
|
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
const emit = defineEmits({
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
13
|
'update:modelValue': (newValue: boolean) => true,
|
|
13
14
|
})
|
|
14
15
|
|
|
@@ -25,7 +26,7 @@ const progress = computed(() => props.modelValue ? 1 : 0)
|
|
|
25
26
|
const dashoffset = computed(() => (1 - progress.value) * dasharray.value)
|
|
26
27
|
const animationEnabled = ref(false)
|
|
27
28
|
|
|
28
|
-
watch(path,
|
|
29
|
+
watch(path, () => {
|
|
29
30
|
dasharray.value = path.value.getTotalLength?.() ?? 21.21
|
|
30
31
|
})
|
|
31
32
|
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'HstCopyIcon',
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { Icon } from '@iconify/vue'
|
|
9
|
+
import { useClipboard } from '@vueuse/core'
|
|
10
|
+
import { VTooltip as vTooltip } from 'floating-vue'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
content: string
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const { copy, copied } = useClipboard()
|
|
17
|
+
|
|
18
|
+
const action = () => copy(props.content)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<Icon
|
|
23
|
+
v-tooltip="{
|
|
24
|
+
content: 'Copied!',
|
|
25
|
+
triggers: [],
|
|
26
|
+
shown: copied,
|
|
27
|
+
distance: 12,
|
|
28
|
+
delay: 0,
|
|
29
|
+
}"
|
|
30
|
+
icon="carbon:copy-file"
|
|
31
|
+
class="htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer"
|
|
32
|
+
@click="action()"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ref, computed, nextTick, onMounted } from 'vue'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import { useStorage, onClickOutside, useTimeoutFn } from '@vueuse/core'
|
|
5
|
-
import {
|
|
5
|
+
import { applyState, clone, omit } from '@histoire/shared'
|
|
6
6
|
import BaseSelect from '../base/BaseSelect.vue'
|
|
7
7
|
import { toRawDeep } from '../../util/state'
|
|
8
8
|
import type { Story, Variant } from '../../types'
|
|
@@ -40,14 +40,14 @@ const presetsOptions = computed(() => {
|
|
|
40
40
|
|
|
41
41
|
function resetState () {
|
|
42
42
|
selectedOption.value = DEFAULT_ID
|
|
43
|
-
|
|
43
|
+
applyState(props.variant.state, clone(defaultState))
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function applyPreset (id) {
|
|
47
47
|
if (id === DEFAULT_ID) {
|
|
48
48
|
resetState()
|
|
49
49
|
} else if (presetStates.value.has(id)) {
|
|
50
|
-
|
|
50
|
+
applyState(props.variant.state, clone(presetStates.value.get(id).state))
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -32,7 +32,7 @@ const panelContentComponent = computed(() => {
|
|
|
32
32
|
<span>Select a variant</span>
|
|
33
33
|
</BaseEmpty>
|
|
34
34
|
|
|
35
|
-
<BaseEmpty v-else-if="!storyStore.currentVariant.previewReady">
|
|
35
|
+
<BaseEmpty v-else-if="!storyStore.currentVariant.configReady || !storyStore.currentVariant.previewReady">
|
|
36
36
|
<span>Loading...</span>
|
|
37
37
|
</BaseEmpty>
|
|
38
38
|
|