histoire 0.3.3 → 0.4.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/BaseEmpty.js +13 -0
- package/dist/bundled/HomeView.js +23 -0
- package/dist/bundled/MobileOverlay.js +303 -0
- package/dist/bundled/SearchPane.js +504 -0
- package/dist/bundled/StoryView.js +2330 -0
- package/dist/bundled/api.js +32 -0
- package/dist/bundled/config.js +4 -0
- package/dist/bundled/const.js +5 -0
- package/dist/bundled/dark.js +4 -0
- package/dist/bundled/events.js +29 -0
- package/dist/bundled/global-components.js +203 -0
- package/dist/bundled/index.js +7 -0
- package/dist/bundled/index2.js +762 -0
- package/dist/bundled/reactivity.js +96 -0
- package/dist/bundled/sandbox.js +97 -0
- package/dist/bundled/search-docs-data.js +7 -0
- package/dist/bundled/story.js +59 -0
- package/dist/bundled/style.css +102 -0
- package/dist/bundled/vue.runtime.esm-bundler.js +8657 -0
- package/dist/client/app/App.vue +2 -2
- package/dist/client/app/api.d.ts +1 -0
- package/dist/client/app/api.js +1 -0
- package/dist/client/app/codegen/vue3.js +1 -2
- package/dist/client/app/components/HomeView.vue +1 -1
- package/dist/client/app/components/app/AppLogo.vue +1 -1
- package/dist/client/app/components/app/MobileOverlay.vue +0 -1
- package/dist/client/app/components/base/BaseOverflowMenu.vue +1 -1
- package/dist/client/app/components/exposed/Story.vue +1 -1
- package/dist/client/app/components/search/SearchItem.vue +1 -1
- package/dist/client/app/components/search/SearchPane.vue +96 -21
- package/dist/client/app/components/search/search-docs-data.d.ts +3 -0
- package/dist/client/app/components/search/{search-data.js → search-docs-data.js} +1 -1
- package/dist/client/app/components/search/search-title-data.d.ts +3 -0
- package/dist/client/app/components/search/search-title-data.js +7 -0
- package/dist/client/app/components/search/{search-data.d.ts → types.d.ts} +0 -2
- package/dist/client/app/components/search/types.js +1 -0
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +6 -3
- package/dist/client/app/components/tree/StoryListItem.vue +1 -1
- package/dist/client/app/index.d.ts +1 -1
- package/dist/client/app/index.js +21 -18
- package/dist/client/app/sandbox.d.ts +1 -1
- package/dist/client/app/sandbox.js +0 -1
- package/dist/client/app/util/events.d.ts +1 -1
- package/dist/client/app/util/events.js +2 -2
- package/dist/client/bundle-index.js +5 -0
- package/dist/client/bundle-main.js +5 -0
- package/dist/client/bundle-sandbox.js +3 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/server/vue3/run.js +8 -0
- package/dist/node/alias.js +1 -1
- package/dist/node/build.js +4 -4
- package/dist/node/builtin-plugins/tailwind-tokens.js +1 -1
- package/dist/node/search.d.ts +9 -1
- package/dist/node/search.js +69 -32
- package/dist/node/server.js +2 -2
- package/dist/node/types.d.ts +1 -0
- package/dist/node/vite.d.ts +4 -2
- package/dist/node/vite.js +22 -29
- package/package.json +7 -6
- package/src/client/app/App.vue +2 -2
- package/src/client/app/api.ts +1 -0
- package/src/client/app/codegen/vue3.ts +1 -2
- package/src/client/app/components/HomeView.vue +1 -1
- package/src/client/app/components/app/AppLogo.vue +1 -1
- package/src/client/app/components/app/MobileOverlay.vue +0 -1
- package/src/client/app/components/base/BaseOverflowMenu.vue +1 -1
- package/src/client/app/components/exposed/Story.vue +1 -1
- package/src/client/app/components/search/SearchItem.vue +1 -1
- package/src/client/app/components/search/SearchPane.vue +96 -21
- package/src/client/app/components/search/{search-data.ts → search-docs-data.ts} +2 -6
- package/src/client/app/components/search/search-title-data.ts +10 -0
- package/src/client/app/components/search/types.ts +4 -0
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +6 -3
- package/src/client/app/components/tree/StoryListItem.vue +1 -1
- package/src/client/app/index.ts +23 -19
- package/src/client/app/sandbox.ts +0 -1
- package/src/client/app/util/events.ts +2 -2
- package/src/client/bundle-index.js +5 -0
- package/src/client/bundle-main.js +5 -0
- package/src/client/bundle-sandbox.js +3 -0
- package/src/client/index.ts +1 -1
- package/src/client/server/vue3/run.ts +11 -0
- package/src/node/alias.ts +1 -1
- package/src/node/build.ts +4 -4
- package/src/node/builtin-plugins/tailwind-tokens.ts +1 -1
- package/src/node/search.ts +77 -33
- package/src/node/server.ts +2 -2
- package/src/node/types.ts +1 -0
- package/src/node/vite.ts +22 -30
- package/vite.config.ts +46 -0
package/dist/client/app/App.vue
CHANGED
|
@@ -15,8 +15,8 @@ import type { StoryFile, Tree } from './types'
|
|
|
15
15
|
import { useStoryStore } from './stores/story'
|
|
16
16
|
import { mapFile } from './util/mapping'
|
|
17
17
|
import { useTitle } from '@vueuse/core'
|
|
18
|
-
import { histoireConfig } from './util/config
|
|
19
|
-
import { onKeyboardShortcut } from './util/keyboard
|
|
18
|
+
import { histoireConfig } from './util/config'
|
|
19
|
+
import { onKeyboardShortcut } from './util/keyboard'
|
|
20
20
|
import { isMobile } from './util/responsive'
|
|
21
21
|
import Breadcrumb from './components/app/Breadcrumb.vue'
|
|
22
22
|
import SearchModal from './components/search/SearchModal.vue'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { hstEvent } from './util/events.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { hstEvent } from './util/events.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// @TODO remove no-check and fix vnode type errors
|
|
3
|
-
import { vModelText, vModelCheckbox, vModelSelect, vModelRadio, vModelDynamic } from 'vue';
|
|
4
|
-
import { Text } from '@vue/runtime-core';
|
|
3
|
+
import { vModelText, vModelCheckbox, vModelSelect, vModelRadio, vModelDynamic, Text } from 'vue';
|
|
5
4
|
import { pascal } from 'case';
|
|
6
5
|
import { createAutoBuildingObject, indent } from './util';
|
|
7
6
|
import { serializeJs } from './serialize-js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
-
import { histoireConfig, customLogos } from '../util/config
|
|
3
|
+
import { histoireConfig, customLogos } from '../util/config'
|
|
4
4
|
import HistoireLogo from '../assets/histoire.svg'
|
|
5
5
|
|
|
6
6
|
const logoUrl = computed(() => histoireConfig.theme?.logo?.square ? customLogos.square : HistoireLogo)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { isDark } from '../../util/dark'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
|
-
import { histoireConfig, customLogos } from '../../util/config
|
|
4
|
+
import { histoireConfig, customLogos } from '../../util/config'
|
|
5
5
|
|
|
6
6
|
import HistoireLogoDark from '../../assets/histoire-text-dark.svg'
|
|
7
7
|
import HistoireLogoLight from '../../assets/histoire-text.svg'
|
|
@@ -70,7 +70,7 @@ const ChildWrapper = {
|
|
|
70
70
|
*/
|
|
71
71
|
const ChildrenRender = (props, { slots }) => {
|
|
72
72
|
const [fragment] = slots.default()
|
|
73
|
-
return fragment.children.map((vnode, index) => h(ChildWrapper, { index }, [vnode]))
|
|
73
|
+
return fragment.children.map((vnode, index) => h(ChildWrapper, { index }, () => [vnode]))
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { computed, defineComponent, provide, useAttrs, VNode, h, PropType, getCurrentInstance } from 'vue'
|
|
3
|
-
import { Story } from '../../types.js'
|
|
3
|
+
import type { Story } from '../../types.js'
|
|
4
4
|
import Variant from './Variant.vue'
|
|
5
5
|
|
|
6
6
|
export default defineComponent({
|
|
@@ -3,7 +3,7 @@ import { PropType, ref, toRefs } from 'vue'
|
|
|
3
3
|
import { useRouter } from 'vue-router'
|
|
4
4
|
import { Icon } from '@iconify/vue'
|
|
5
5
|
import { SearchResult } from '../../types'
|
|
6
|
-
import { onKeyboardShortcut } from '../../util/keyboard
|
|
6
|
+
import { onKeyboardShortcut } from '../../util/keyboard'
|
|
7
7
|
import BaseListItemLink from '../base/BaseListItemLink.vue'
|
|
8
8
|
import { useScrollOnActive } from '../../util/scroll'
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { useFocus, useDebounce } from '@vueuse/core'
|
|
3
|
-
import { ref, watch } from 'vue'
|
|
3
|
+
import { computed, ref, watch } from 'vue'
|
|
4
4
|
import { Icon } from '@iconify/vue'
|
|
5
5
|
import flexsearch from 'flexsearch'
|
|
6
6
|
import charset from 'flexsearch/dist/module/lang/latin/advanced.js'
|
|
@@ -9,7 +9,10 @@ import { useStoryStore } from '../../stores/story'
|
|
|
9
9
|
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
10
10
|
import type { SearchResult, Story, Variant } from '../../types'
|
|
11
11
|
import SearchItem from './SearchItem.vue'
|
|
12
|
-
import { searchData, onUpdate
|
|
12
|
+
import { searchData, onUpdate } from './search-title-data'
|
|
13
|
+
import type { SearchData } from './types'
|
|
14
|
+
|
|
15
|
+
const DocSearchData = () => import('./search-docs-data')
|
|
13
16
|
|
|
14
17
|
const props = defineProps({
|
|
15
18
|
shown: {
|
|
@@ -42,37 +45,40 @@ watch(() => props.shown, value => {
|
|
|
42
45
|
}
|
|
43
46
|
})
|
|
44
47
|
|
|
45
|
-
//
|
|
48
|
+
// Index
|
|
46
49
|
|
|
47
50
|
const searchInputText = ref('')
|
|
48
51
|
const rateLimitedSearch = useDebounce(searchInputText, 50)
|
|
49
52
|
|
|
50
53
|
const storyStore = useStoryStore()
|
|
51
54
|
|
|
52
|
-
let
|
|
53
|
-
let
|
|
55
|
+
let titleSearchIndex: flexsearch.Document<any, any>
|
|
56
|
+
let titleIdMap: SearchData['idMap']
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
function createIndex () {
|
|
59
|
+
return new flexsearch.Document({
|
|
57
60
|
preset: 'match',
|
|
58
61
|
document: {
|
|
59
62
|
id: 'id',
|
|
60
63
|
index: [
|
|
61
|
-
'
|
|
62
|
-
'docs',
|
|
64
|
+
'text',
|
|
63
65
|
],
|
|
64
66
|
},
|
|
65
67
|
worker: true,
|
|
66
68
|
charset,
|
|
67
69
|
language,
|
|
68
|
-
tokenize: '
|
|
70
|
+
tokenize: 'forward',
|
|
69
71
|
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function loadSearchIndex (data: SearchData) {
|
|
75
|
+
titleSearchIndex = createIndex()
|
|
70
76
|
|
|
71
77
|
for (const key of Object.keys(data.index)) {
|
|
72
|
-
await
|
|
78
|
+
await titleSearchIndex.import(key, data.index[key])
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
titleIdMap = data.idMap
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
loadSearchIndex(searchData)
|
|
@@ -81,17 +87,46 @@ onUpdate(searchData => {
|
|
|
81
87
|
loadSearchIndex(searchData)
|
|
82
88
|
})
|
|
83
89
|
|
|
84
|
-
|
|
90
|
+
let docSearchIndex: flexsearch.Document<any, any>
|
|
91
|
+
let docIdMap: SearchData['idMap']
|
|
92
|
+
|
|
93
|
+
async function loadDocSearchIndex () {
|
|
94
|
+
async function load (data: SearchData) {
|
|
95
|
+
docSearchIndex = createIndex()
|
|
96
|
+
|
|
97
|
+
for (const key of Object.keys(data.index)) {
|
|
98
|
+
await docSearchIndex.import(key, data.index[key])
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
docIdMap = data.idMap
|
|
102
|
+
|
|
103
|
+
if (rateLimitedSearch.value) {
|
|
104
|
+
searchOnDocField(rateLimitedSearch.value)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const searchDataModule = await DocSearchData()
|
|
109
|
+
|
|
110
|
+
load(searchDataModule.searchData)
|
|
111
|
+
// Handle HMR
|
|
112
|
+
searchDataModule.onUpdate(searchData => {
|
|
113
|
+
load(searchData)
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
loadDocSearchIndex()
|
|
118
|
+
|
|
119
|
+
// Search
|
|
120
|
+
|
|
121
|
+
const titleResults = ref<SearchResult[]>([])
|
|
85
122
|
|
|
86
123
|
watch(rateLimitedSearch, async value => {
|
|
87
124
|
const list: SearchResult[] = []
|
|
88
|
-
const raw = await
|
|
89
|
-
enrich: true,
|
|
90
|
-
})
|
|
125
|
+
const raw = await titleSearchIndex.search(value)
|
|
91
126
|
let rank = 0
|
|
92
127
|
for (const field of raw) {
|
|
93
128
|
for (const id of field.result) {
|
|
94
|
-
const idMapData =
|
|
129
|
+
const idMapData = titleIdMap[id]
|
|
95
130
|
if (!idMapData) continue
|
|
96
131
|
switch (idMapData.kind) {
|
|
97
132
|
case 'story': {
|
|
@@ -110,14 +145,40 @@ watch(rateLimitedSearch, async value => {
|
|
|
110
145
|
}
|
|
111
146
|
}
|
|
112
147
|
}
|
|
113
|
-
|
|
148
|
+
titleResults.value = list
|
|
114
149
|
})
|
|
115
150
|
|
|
151
|
+
const docsResults = ref<SearchResult[]>([])
|
|
152
|
+
|
|
153
|
+
async function searchOnDocField (query: string) {
|
|
154
|
+
if (docSearchIndex) {
|
|
155
|
+
const list: SearchResult[] = []
|
|
156
|
+
const raw = await docSearchIndex.search(query)
|
|
157
|
+
let rank = 0
|
|
158
|
+
for (const field of raw) {
|
|
159
|
+
for (const id of field.result) {
|
|
160
|
+
const idMapData = docIdMap[id]
|
|
161
|
+
if (!idMapData) continue
|
|
162
|
+
switch (idMapData.kind) {
|
|
163
|
+
case 'story': {
|
|
164
|
+
list.push(storyResultFactory(storyStore.getStoryById(idMapData.id), rank))
|
|
165
|
+
rank++
|
|
166
|
+
break
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
docsResults.value = list
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
watch(rateLimitedSearch, searchOnDocField)
|
|
176
|
+
|
|
116
177
|
function storyResultFactory (story: Story, rank: number): SearchResult {
|
|
117
178
|
return {
|
|
118
179
|
kind: 'story',
|
|
119
180
|
rank,
|
|
120
|
-
id: story.id
|
|
181
|
+
id: `story:${story.id}`,
|
|
121
182
|
title: story.title,
|
|
122
183
|
route: {
|
|
123
184
|
name: 'story',
|
|
@@ -135,7 +196,7 @@ function variantResultFactory (story: Story, variant: Variant, rank: number): Se
|
|
|
135
196
|
return {
|
|
136
197
|
kind: 'variant',
|
|
137
198
|
rank,
|
|
138
|
-
id:
|
|
199
|
+
id: `variant:${story.id}:${variant.id}`,
|
|
139
200
|
title: variant.title,
|
|
140
201
|
route: {
|
|
141
202
|
name: 'story',
|
|
@@ -152,6 +213,20 @@ function variantResultFactory (story: Story, variant: Variant, rank: number): Se
|
|
|
152
213
|
}
|
|
153
214
|
}
|
|
154
215
|
|
|
216
|
+
const results = computed(() => {
|
|
217
|
+
const list = [...titleResults.value]
|
|
218
|
+
const seen = {}
|
|
219
|
+
for (const r of titleResults.value) {
|
|
220
|
+
seen[r.id] = true
|
|
221
|
+
}
|
|
222
|
+
for (const r of docsResults.value) {
|
|
223
|
+
if (!seen[r.id]) {
|
|
224
|
+
list.push(r)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return list
|
|
228
|
+
})
|
|
229
|
+
|
|
155
230
|
// Selection
|
|
156
231
|
|
|
157
232
|
const selectedIndex = ref(0)
|
|
@@ -209,7 +284,7 @@ function selectPrevious () {
|
|
|
209
284
|
>
|
|
210
285
|
<SearchItem
|
|
211
286
|
v-for="(result, index) of results"
|
|
212
|
-
:key="
|
|
287
|
+
:key="result.id"
|
|
213
288
|
:result="result"
|
|
214
289
|
:selected="index === selectedIndex"
|
|
215
290
|
@close="close()"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { markRaw } from 'vue';
|
|
2
2
|
// @ts-expect-error virtual module
|
|
3
|
-
import { searchData as _searchData, onUpdate as _onUpdate } from '$histoire-search-data';
|
|
3
|
+
import { searchData as _searchData, onUpdate as _onUpdate } from '$histoire-search-docs-data';
|
|
4
4
|
export const searchData = markRaw(_searchData);
|
|
5
5
|
export function onUpdate(cb) {
|
|
6
6
|
_onUpdate(cb);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { markRaw } from 'vue';
|
|
2
|
+
// @ts-expect-error virtual module
|
|
3
|
+
import { searchData as _searchData, onUpdate as _onUpdate } from '$histoire-search-title-data';
|
|
4
|
+
export const searchData = markRaw(_searchData);
|
|
5
|
+
export function onUpdate(cb) {
|
|
6
|
+
_onUpdate(cb);
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,7 +6,7 @@ import { useResizeObserver } from '@vueuse/core'
|
|
|
6
6
|
import { useCurrentVariantRoute } from '../../util/variant'
|
|
7
7
|
import type { Story, Variant } from '../../types'
|
|
8
8
|
import SandboxVue3 from '../sandbox/SandboxVue3.vue'
|
|
9
|
-
import { useScrollOnActive } from '../../util/scroll
|
|
9
|
+
import { useScrollOnActive } from '../../util/scroll'
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
variant: {
|
|
@@ -4,7 +4,7 @@ import { useCurrentVariantRoute } from '../../util/variant'
|
|
|
4
4
|
import type { Variant } from '../../types'
|
|
5
5
|
import BaseListItemLink from '../base/BaseListItemLink.vue'
|
|
6
6
|
import { Icon } from '@iconify/vue'
|
|
7
|
-
import { useScrollOnActive } from '../../util/scroll
|
|
7
|
+
import { useScrollOnActive } from '../../util/scroll'
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
variant: {
|
|
@@ -11,6 +11,7 @@ const props = defineProps<{
|
|
|
11
11
|
Object.assign(props.variant, {
|
|
12
12
|
previewReady: false,
|
|
13
13
|
})
|
|
14
|
+
|
|
14
15
|
function onReady () {
|
|
15
16
|
Object.assign(props.variant, {
|
|
16
17
|
previewReady: true,
|
|
@@ -25,13 +26,15 @@ function onReady () {
|
|
|
25
26
|
>
|
|
26
27
|
<div
|
|
27
28
|
:style="isResponsiveEnabled ? {
|
|
28
|
-
width: finalWidth ? `${finalWidth}px` :
|
|
29
|
-
height: finalHeight ? `${finalHeight}px` :
|
|
30
|
-
} :
|
|
29
|
+
width: finalWidth ? `${finalWidth}px` : '100%',
|
|
30
|
+
height: finalHeight ? `${finalHeight}px` : '100%',
|
|
31
|
+
} : { width: '100%', height: '100%' }"
|
|
31
32
|
>
|
|
32
33
|
<SandboxVue3
|
|
34
|
+
:key="`${story.id}-${variant.id}`"
|
|
33
35
|
:variant="variant"
|
|
34
36
|
:story="story"
|
|
37
|
+
class="htw-h-full"
|
|
35
38
|
@ready="onReady"
|
|
36
39
|
/>
|
|
37
40
|
</div>
|
|
@@ -4,7 +4,7 @@ import BaseListItemLink from '../base/BaseListItemLink.vue'
|
|
|
4
4
|
import { Icon } from '@iconify/vue'
|
|
5
5
|
import { computed, ref, withDefaults } from 'vue'
|
|
6
6
|
import { useRoute } from 'vue-router'
|
|
7
|
-
import { useScrollOnActive } from '../../util/scroll
|
|
7
|
+
import { useScrollOnActive } from '../../util/scroll'
|
|
8
8
|
|
|
9
9
|
const props = withDefaults(defineProps<{
|
|
10
10
|
story: Story
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '$histoire-theme';
|
|
2
|
-
|
|
2
|
+
export declare function mountMainApp(): void;
|
package/dist/client/app/index.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
/* eslint-disable import/first */
|
|
2
|
+
// export * from 'vue'
|
|
1
3
|
import '$histoire-theme';
|
|
2
|
-
import '../../style.css';
|
|
3
4
|
import { createApp } from 'vue';
|
|
4
5
|
import { createPinia } from 'pinia';
|
|
5
6
|
import FloatingVue from 'floating-vue';
|
|
6
7
|
import App from './App.vue';
|
|
7
8
|
import { registerGlobalComponents } from './global-components.js';
|
|
8
9
|
import { router } from './router';
|
|
9
|
-
|
|
10
|
-
app
|
|
11
|
-
app.use(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export function mountMainApp() {
|
|
11
|
+
const app = createApp(App);
|
|
12
|
+
app.use(createPinia());
|
|
13
|
+
app.use(FloatingVue, {
|
|
14
|
+
overflowPadding: 4,
|
|
15
|
+
arrowPadding: 8,
|
|
16
|
+
themes: {
|
|
17
|
+
tooltip: {
|
|
18
|
+
distance: 8,
|
|
19
|
+
},
|
|
20
|
+
dropdown: {
|
|
21
|
+
computeTransformOrigin: true,
|
|
22
|
+
distance: 8,
|
|
23
|
+
},
|
|
17
24
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
app.use(router);
|
|
25
|
-
registerGlobalComponents(app);
|
|
26
|
-
app.mount('#app');
|
|
25
|
+
});
|
|
26
|
+
app.use(router);
|
|
27
|
+
registerGlobalComponents(app);
|
|
28
|
+
app.mount('#app');
|
|
29
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function hstEvent(name: string, argument: any): void
|
|
1
|
+
export declare function hstEvent(name: string, argument: any): Promise<void>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { useEventsStore } from '../stores/events.js';
|
|
2
1
|
import { EVENT_SEND } from './const';
|
|
3
|
-
export function hstEvent(name, argument) {
|
|
2
|
+
export async function hstEvent(name, argument) {
|
|
4
3
|
console.log('[histoire] Event fired', { name, argument });
|
|
5
4
|
const event = {
|
|
6
5
|
name,
|
|
@@ -13,6 +12,7 @@ export function hstEvent(name, argument) {
|
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
14
|
else {
|
|
15
|
+
const { useEventsStore } = await import('../stores/events.js');
|
|
16
16
|
useEventsStore().addEvent(event);
|
|
17
17
|
}
|
|
18
18
|
}
|
package/dist/client/index.d.ts
CHANGED
package/dist/client/index.js
CHANGED
|
@@ -28,5 +28,13 @@ export async function run({ file, storyData, el }) {
|
|
|
28
28
|
app.component('Variant', Variant);
|
|
29
29
|
registerVueComponents(app);
|
|
30
30
|
app.mount(el);
|
|
31
|
+
if (Comp.doc) {
|
|
32
|
+
const el = document.createElement('div');
|
|
33
|
+
el.innerHTML = Comp.doc;
|
|
34
|
+
const text = el.textContent;
|
|
35
|
+
storyData.forEach(s => {
|
|
36
|
+
s.docsText = text;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
31
39
|
app.unmount();
|
|
32
40
|
}
|
package/dist/node/alias.js
CHANGED
|
@@ -2,5 +2,5 @@ import { dirname, join } from 'pathe';
|
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
4
4
|
export const DIST_PATH = join(__dirname, '../');
|
|
5
|
-
export const APP_PATH = join(DIST_PATH, 'client'
|
|
5
|
+
export const APP_PATH = join(DIST_PATH, 'client');
|
|
6
6
|
export const TEMP_PATH = join(process.cwd(), 'node_modules', '.histoire');
|
package/dist/node/build.js
CHANGED
|
@@ -57,8 +57,8 @@ export async function build(ctx) {
|
|
|
57
57
|
build: {
|
|
58
58
|
rollupOptions: {
|
|
59
59
|
input: [
|
|
60
|
-
join(APP_PATH, '
|
|
61
|
-
join(APP_PATH, 'sandbox.js'),
|
|
60
|
+
join(APP_PATH, 'bundle-main.js'),
|
|
61
|
+
join(APP_PATH, 'bundle-sandbox.js'),
|
|
62
62
|
],
|
|
63
63
|
output: {
|
|
64
64
|
manualChunks(id) {
|
|
@@ -86,13 +86,13 @@ export async function build(ctx) {
|
|
|
86
86
|
const prefetchOutputs = result.output.filter(o => PREFETCHED_MODULES.includes(o.name) && o.type === 'chunk');
|
|
87
87
|
const prefetchHtml = generateScriptLinks(prefetchOutputs.map(o => o.fileName), 'prefetch', ctx, resolvedViteConfig);
|
|
88
88
|
// Index
|
|
89
|
-
const indexOutput = result.output.find(o => o.name === '
|
|
89
|
+
const indexOutput = result.output.find(o => o.name === 'bundle-main' && o.type === 'chunk');
|
|
90
90
|
const indexHtml = generateEntryHtml(indexOutput.fileName, styleOutput.fileName, {
|
|
91
91
|
HEAD: `${preloadHtml}${prefetchHtml}`,
|
|
92
92
|
}, ctx, resolvedViteConfig);
|
|
93
93
|
await writeFile('index.html', indexHtml, ctx);
|
|
94
94
|
// Sandbox
|
|
95
|
-
const sandboxOutput = result.output.find(o => o.name === 'sandbox' && o.type === 'chunk');
|
|
95
|
+
const sandboxOutput = result.output.find(o => o.name === 'bundle-sandbox' && o.type === 'chunk');
|
|
96
96
|
const sandboxHtml = generateEntryHtml(sandboxOutput.fileName, styleOutput.fileName, {}, ctx, resolvedViteConfig);
|
|
97
97
|
await writeFile('__sandbox.html', sandboxHtml, ctx);
|
|
98
98
|
const duration = performance.now() - startTime;
|
|
@@ -83,7 +83,7 @@ defineExpose({
|
|
|
83
83
|
})
|
|
84
84
|
</script>
|
|
85
85
|
<template>
|
|
86
|
-
<Story id="tailwind" title="Tailwind" group="design-system" icon="mdi:tailwind" responsiveDisabled>
|
|
86
|
+
<Story id="tailwind" title="Tailwind" group="design-system" icon="mdi:tailwind" responsiveDisabled :layout="{ type: 'single', iframe: false }">
|
|
87
87
|
<Variant id="background-color" title="Background Color" icon="carbon:color-palette">
|
|
88
88
|
<HstColorShades
|
|
89
89
|
v-for="(shades, key) of config.theme.backgroundColor"
|
package/dist/node/search.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { Context } from './context.js';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function generateTitleSearchData(ctx: Context): Promise<{
|
|
3
3
|
index: unknown;
|
|
4
4
|
idMap: Record<number, {
|
|
5
5
|
id: string;
|
|
6
6
|
kind: string;
|
|
7
7
|
}>;
|
|
8
8
|
}>;
|
|
9
|
+
export declare function generateDocSearchData(ctx: Context): Promise<{
|
|
10
|
+
index: unknown;
|
|
11
|
+
idMap: Record<number, {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function getSearchDataJS(data: any): string;
|