histoire 0.7.8 → 0.8.1
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 +55 -55
- 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} +4 -3
- 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/client/app/util/state.js +2 -1
- package/dist/node/build.js +1 -1
- package/dist/node/vite.d.ts +1 -1
- package/dist/node/vite.js +6 -2
- package/dist/style.css +21 -0
- package/package.json +8 -14
- 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/client/app/util/state.ts +2 -1
- package/src/node/build.ts +1 -1
- package/src/node/vite.ts +6 -2
- package/tsconfig.json +11 -0
- package/vite.config.ts +20 -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
|
@@ -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
|
|
|
@@ -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/src/client/app/index.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
/* eslint-disable import/first */
|
|
2
|
-
|
|
3
|
-
// export * from 'vue'
|
|
4
|
-
|
|
5
1
|
import '$histoire-theme'
|
|
6
2
|
import { createApp } from 'vue'
|
|
7
3
|
import { createPinia } from 'pinia'
|
|
8
|
-
import FloatingVue from 'floating-vue'
|
|
4
|
+
import { FloatingVue } from 'floating-vue'
|
|
9
5
|
import App from './App.vue'
|
|
10
6
|
import { router } from './router'
|
|
11
7
|
|
|
@@ -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 type { StoryFile } from './types'
|
|
7
7
|
import { mapFile } from './util/mapping'
|
|
@@ -27,10 +27,11 @@ const app = createApp({
|
|
|
27
27
|
let mounted = false
|
|
28
28
|
|
|
29
29
|
window.addEventListener('message', event => {
|
|
30
|
+
// console.log('[sandbox] received message', event.data)
|
|
30
31
|
if (event.data?.type === STATE_SYNC) {
|
|
31
32
|
if (!mounted) return
|
|
32
33
|
synced = true
|
|
33
|
-
|
|
34
|
+
applyState(variant.value.state, event.data.state)
|
|
34
35
|
} else if (event.data?.type === PREVIEW_SETTINGS_SYNC) {
|
|
35
36
|
applyPreviewSettings(event.data.settings)
|
|
36
37
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { markRaw } from 'vue'
|
|
2
|
+
import { reactive as _reactive } from '@histoire/vendors/dist/client/vue'
|
|
2
3
|
import type { StoryFile, Variant } from '../types'
|
|
3
4
|
|
|
4
5
|
const copiedFromExistingVariant = [
|
|
5
6
|
'state',
|
|
6
7
|
'slots',
|
|
7
|
-
'initState',
|
|
8
8
|
'source',
|
|
9
9
|
'responsiveDisabled',
|
|
10
|
+
'autoPropsDisabled',
|
|
10
11
|
'setupApp',
|
|
11
12
|
'configReady',
|
|
12
13
|
'previewReady',
|
|
@@ -62,8 +63,7 @@ export function mapVariant (variant: Variant, existingVariant?: Variant): Varian
|
|
|
62
63
|
// Create
|
|
63
64
|
result = {
|
|
64
65
|
...variant,
|
|
65
|
-
state:
|
|
66
|
-
initState: null,
|
|
66
|
+
state: _reactive({}),
|
|
67
67
|
setupApp: null,
|
|
68
68
|
slots: () => ({}),
|
|
69
69
|
previewReady: false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { watch, onMounted, Ref } from 'vue'
|
|
2
|
-
import scrollIntoView from 'scroll-into-view-if-needed'
|
|
2
|
+
import { scrollIntoView } from 'scroll-into-view-if-needed'
|
|
3
3
|
|
|
4
4
|
export function useScrollOnActive (active: Ref<boolean>, el: Ref<HTMLElement>) {
|
|
5
5
|
watch(active, value => {
|
|
@@ -4,8 +4,9 @@ const isObject = (val) => val !== null && typeof val === 'object'
|
|
|
4
4
|
|
|
5
5
|
export function toRawDeep (val, seen = new Set()) {
|
|
6
6
|
const unwrappedValue = isRef(val) ? unref(val) : val
|
|
7
|
+
const valueType = typeof unwrappedValue
|
|
7
8
|
|
|
8
|
-
if (
|
|
9
|
+
if (valueType === 'symbol' || valueType === 'function') {
|
|
9
10
|
return unwrappedValue.toString()
|
|
10
11
|
}
|
|
11
12
|
|
package/src/node/build.ts
CHANGED
|
@@ -100,7 +100,7 @@ export async function build (ctx: Context) {
|
|
|
100
100
|
const vuePlugin = config.plugins.find((p: any) => p.name === 'vite:vue') as VitePlugin
|
|
101
101
|
if (vuePlugin) {
|
|
102
102
|
const original = vuePlugin.configureServer.bind(vuePlugin)
|
|
103
|
-
vuePlugin.configureServer = (
|
|
103
|
+
vuePlugin.configureServer = () => {
|
|
104
104
|
original({
|
|
105
105
|
...server,
|
|
106
106
|
config: {
|
package/src/node/vite.ts
CHANGED
|
@@ -59,7 +59,7 @@ async function mergeHistoireViteConfig (viteConfig: InlineConfig, ctx: Context)
|
|
|
59
59
|
return viteConfig
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export async function getViteConfigWithPlugins (
|
|
62
|
+
export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context): Promise<InlineConfig> {
|
|
63
63
|
const resolvedViteConfig = await resolveViteConfig(ctx)
|
|
64
64
|
|
|
65
65
|
const inlineConfig = await mergeHistoireViteConfig({}, ctx)
|
|
@@ -76,7 +76,7 @@ export async function getViteConfigWithPlugins (server: boolean, ctx: Context):
|
|
|
76
76
|
],
|
|
77
77
|
},
|
|
78
78
|
optimizeDeps: {
|
|
79
|
-
disabled:
|
|
79
|
+
disabled: isServer,
|
|
80
80
|
entries: [
|
|
81
81
|
`${APP_PATH}/bundle-main.js`,
|
|
82
82
|
`${APP_PATH}/bundle-sandbox.js`,
|
|
@@ -106,6 +106,8 @@ export async function getViteConfigWithPlugins (server: boolean, ctx: Context):
|
|
|
106
106
|
define: {
|
|
107
107
|
// We need to force this to be able to use `devtoolsRawSetupState`
|
|
108
108
|
__VUE_PROD_DEVTOOLS__: 'true',
|
|
109
|
+
// Disable warnings
|
|
110
|
+
'process.env.NODE_ENV': JSON.stringify(isServer ? 'production' : process.env.NODE_ENV ?? 'development'),
|
|
109
111
|
},
|
|
110
112
|
}
|
|
111
113
|
},
|
|
@@ -275,6 +277,7 @@ if (import.meta.hot) {
|
|
|
275
277
|
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
|
276
278
|
// also applies HTML transforms from Vite plugins
|
|
277
279
|
html = await server.transformIndexHtml(req.url, html)
|
|
280
|
+
res.setHeader('content-type', 'text/html; charset=UTF-8')
|
|
278
281
|
res.end(html)
|
|
279
282
|
return
|
|
280
283
|
}
|
|
@@ -306,6 +309,7 @@ if (import.meta.hot) {
|
|
|
306
309
|
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
|
307
310
|
// also applies HTML transforms from Vite plugins
|
|
308
311
|
html = await server.transformIndexHtml(req.url, html)
|
|
312
|
+
res.setHeader('content-type', 'text/html; charset=UTF-8')
|
|
309
313
|
res.end(html)
|
|
310
314
|
return
|
|
311
315
|
}
|
package/tsconfig.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"sourceMap": false,
|
|
22
22
|
"preserveWatchOutput": true,
|
|
23
23
|
"preserveSymlinks": true,
|
|
24
|
+
"declaration": true,
|
|
24
25
|
// Strict
|
|
25
26
|
"noImplicitAny": false,
|
|
26
27
|
"noImplicitThis": true,
|
|
@@ -29,6 +30,16 @@
|
|
|
29
30
|
"strictFunctionTypes": true,
|
|
30
31
|
// Volar
|
|
31
32
|
"jsx": "preserve",
|
|
33
|
+
// Alias
|
|
34
|
+
"paths": {
|
|
35
|
+
"floating-vue": ["./node_modules/@histoire/vendors/dist/client/floating-vue"],
|
|
36
|
+
"@iconify/vue": ["./node_modules/@histoire/vendors/dist/client/iconify"],
|
|
37
|
+
"pinia": ["./node_modules/@histoire/vendors/dist/client/pinia"],
|
|
38
|
+
"scroll-into-view-if-needed": ["./node_modules/@histoire/vendors/dist/client/scroll"],
|
|
39
|
+
"vue-router": ["./node_modules/@histoire/vendors/dist/client/vue-router"],
|
|
40
|
+
"@vueuse/core": ["./node_modules/@histoire/vendors/dist/client/vue-use"],
|
|
41
|
+
"vue": ["./node_modules/@histoire/vendors/dist/client/vue"]
|
|
42
|
+
}
|
|
32
43
|
},
|
|
33
44
|
"include": [
|
|
34
45
|
"src"
|
package/vite.config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from 'vite'
|
|
2
2
|
import vue from '@vitejs/plugin-vue'
|
|
3
3
|
import fs from 'fs-extra'
|
|
4
|
-
import
|
|
4
|
+
import { globbySync } from 'globby'
|
|
5
5
|
|
|
6
6
|
export default defineConfig({
|
|
7
7
|
plugins: [
|
|
@@ -18,14 +18,11 @@ export default defineConfig({
|
|
|
18
18
|
},
|
|
19
19
|
closeBundle () {
|
|
20
20
|
try {
|
|
21
|
-
const files =
|
|
21
|
+
const files = globbySync('./dist/bundled/**/*.js')
|
|
22
22
|
for (const file of files) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (content.includes('import__meta')) {
|
|
27
|
-
fs.writeFileSync(filePath, content.replace(/import__meta/g, 'import.meta'), 'utf-8')
|
|
28
|
-
}
|
|
23
|
+
const content = fs.readFileSync(file, 'utf-8')
|
|
24
|
+
if (content.includes('import__meta')) {
|
|
25
|
+
fs.writeFileSync(file, content.replace(/import__meta/g, 'import.meta'), 'utf-8')
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
} catch (e) {
|
|
@@ -35,6 +32,18 @@ export default defineConfig({
|
|
|
35
32
|
},
|
|
36
33
|
],
|
|
37
34
|
|
|
35
|
+
resolve: {
|
|
36
|
+
alias: {
|
|
37
|
+
'floating-vue': '@histoire/vendors/dist/client/floating-vue.js',
|
|
38
|
+
'@iconify/vue': '@histoire/vendors/dist/client/iconify.js',
|
|
39
|
+
pinia: '@histoire/vendors/dist/client/pinia.js',
|
|
40
|
+
'scroll-into-view-if-needed': '@histoire/vendors/dist/client/scroll.js',
|
|
41
|
+
'vue-router': '@histoire/vendors/dist/client/vue-router.js',
|
|
42
|
+
'@vueuse/core': '@histoire/vendors/dist/client/vue-use.js',
|
|
43
|
+
vue: '@histoire/vendors/dist/client/vue.js',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
38
47
|
build: {
|
|
39
48
|
emptyOutDir: false,
|
|
40
49
|
outDir: 'dist/bundled',
|
|
@@ -46,7 +55,6 @@ export default defineConfig({
|
|
|
46
55
|
external: [
|
|
47
56
|
/\$histoire/,
|
|
48
57
|
/@histoire/,
|
|
49
|
-
/@vue\/*/,
|
|
50
58
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
51
59
|
...Object.keys(require('./package.json').dependencies),
|
|
52
60
|
],
|
|
@@ -66,7 +74,9 @@ export default defineConfig({
|
|
|
66
74
|
entryFileNames: '[name].js',
|
|
67
75
|
chunkFileNames: '[name].js',
|
|
68
76
|
assetFileNames: '[name][extname]',
|
|
69
|
-
hoistTransitiveImports: false,
|
|
77
|
+
// hoistTransitiveImports: false,
|
|
78
|
+
preserveModules: true,
|
|
79
|
+
preserveModulesRoot: 'src/client/app',
|
|
70
80
|
},
|
|
71
81
|
treeshake: false,
|
|
72
82
|
preserveEntrySignatures: 'strict',
|