histoire 0.7.2 → 0.7.5
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/client.d.ts +1 -1
- package/dist/bundled/StoryView.js +22 -19
- package/dist/bundled/dark.js +4 -0
- package/dist/bundled/index.js +0 -1
- package/dist/bundled/index2.js +6 -6
- package/dist/bundled/mapping.js +78 -0
- package/dist/bundled/sandbox.js +7 -6
- package/dist/bundled/state.js +13 -44
- package/dist/bundled/style.css +3 -3
- package/dist/client/app/App.vue +2 -2
- package/dist/client/app/components/panel/ControlsComponentPropItem.vue +13 -6
- package/dist/client/app/components/panel/ControlsComponentProps.vue +2 -1
- package/dist/client/app/components/panel/StatePresets.vue +2 -1
- package/dist/client/app/components/panel/StoryControls.vue +1 -1
- package/dist/client/app/components/panel/StorySourceCode.vue +2 -2
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +1 -1
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -2
- package/dist/client/app/components/story/StoryVariantSingleView.vue +1 -1
- package/dist/client/app/components/toolbar/StoryVariantNewTab.vue +1 -1
- package/dist/client/app/components/tree/StoryGroup.vue +1 -1
- package/dist/client/app/index.js +0 -2
- package/dist/client/app/sandbox.js +4 -5
- package/dist/client/app/types.d.ts +1 -52
- package/dist/client/app/util/mapping.d.ts +1 -1
- package/dist/client/app/util/mapping.js +50 -36
- package/dist/client/app/{components/sandbox/lib.d.ts → util/sandbox.d.ts} +1 -1
- package/dist/client/app/{components/sandbox/lib.js → util/sandbox.js} +1 -1
- package/dist/client/app/util/state.d.ts +1 -5
- package/dist/client/app/util/state.js +12 -44
- package/dist/node/collect/index.d.ts +2 -2
- package/dist/node/collect/index.js +3 -0
- package/dist/node/collect/run.d.ts +2 -0
- package/dist/{client/server/index.js → node/collect/run.js} +1 -1
- package/dist/node/collect/worker.d.ts +3 -3
- package/dist/node/collect/worker.js +4 -1
- package/dist/node/config.d.ts +3 -3
- package/dist/node/context.d.ts +2 -2
- package/dist/node/plugin.d.ts +3 -3
- package/dist/node/stories.d.ts +4 -4
- package/dist/node/tree.d.ts +3 -22
- package/dist/node/vite.js +1 -0
- package/dist/style.css +76 -0
- package/package.json +4 -2
- package/src/client/app/App.vue +2 -2
- package/src/client/app/components/panel/ControlsComponentPropItem.vue +13 -6
- package/src/client/app/components/panel/ControlsComponentProps.vue +2 -1
- package/src/client/app/components/panel/StatePresets.vue +2 -1
- package/src/client/app/components/panel/StoryControls.vue +1 -1
- package/src/client/app/components/panel/StorySourceCode.vue +2 -2
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +1 -1
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -2
- package/src/client/app/components/story/StoryVariantSingleView.vue +1 -1
- package/src/client/app/components/toolbar/StoryVariantNewTab.vue +1 -1
- package/src/client/app/components/tree/StoryGroup.vue +1 -1
- package/src/client/app/index.ts +0 -2
- package/src/client/app/sandbox.ts +4 -5
- package/src/client/app/types.ts +6 -57
- package/src/client/app/util/mapping.ts +47 -34
- package/src/client/app/{components/sandbox/lib.ts → util/sandbox.ts} +2 -2
- package/src/client/app/util/state.ts +15 -44
- package/src/node/collect/index.ts +5 -2
- package/src/node/collect/run.ts +13 -0
- package/src/node/collect/worker.ts +8 -6
- package/src/node/config.ts +3 -3
- package/src/node/context.ts +2 -2
- package/src/node/plugin.ts +2 -2
- package/src/node/server.ts +2 -2
- package/src/node/stories.ts +4 -4
- package/src/node/tree.ts +7 -31
- package/src/node/vite.ts +1 -0
- package/vite.config.ts +12 -7
- package/dist/bundled/SandboxVue3.js +0 -706
- package/dist/bundled/global-components.js +0 -213
- package/dist/client/app/codegen/const.d.ts +0 -1
- package/dist/client/app/codegen/const.js +0 -3
- package/dist/client/app/codegen/serialize-js.d.ts +0 -1
- package/dist/client/app/codegen/serialize-js.js +0 -113
- package/dist/client/app/codegen/util.d.ts +0 -10
- package/dist/client/app/codegen/util.js +0 -70
- package/dist/client/app/codegen/vue3.d.ts +0 -4
- package/dist/client/app/codegen/vue3.js +0 -357
- package/dist/client/app/components/exposed/Story.vue +0 -106
- package/dist/client/app/components/exposed/Variant.vue +0 -78
- package/dist/client/app/components/sandbox/RouterLinkStub.d.ts +0 -21
- package/dist/client/app/components/sandbox/RouterLinkStub.js +0 -43
- package/dist/client/app/components/sandbox/SandboxVue3.vue +0 -185
- package/dist/client/app/global-components.d.ts +0 -2
- package/dist/client/app/global-components.js +0 -10
- package/dist/client/server/index.d.ts +0 -7
- package/dist/client/server/vue3/Story.vue +0 -120
- package/dist/client/server/vue3/Variant.vue +0 -52
- package/dist/client/server/vue3/run.d.ts +0 -2
- package/dist/client/server/vue3/run.js +0 -45
- package/dist/node/types.d.ts +0 -50
- package/dist/node/types.js +0 -1
- package/src/client/app/codegen/const.ts +0 -3
- package/src/client/app/codegen/serialize-js.ts +0 -119
- package/src/client/app/codegen/util.ts +0 -79
- package/src/client/app/codegen/vue3.ts +0 -361
- package/src/client/app/components/exposed/Story.vue +0 -106
- package/src/client/app/components/exposed/Variant.vue +0 -78
- package/src/client/app/components/sandbox/RouterLinkStub.ts +0 -49
- package/src/client/app/components/sandbox/SandboxVue3.vue +0 -185
- package/src/client/app/global-components.ts +0 -13
- package/src/client/server/index.ts +0 -19
- package/src/client/server/vue3/Story.vue +0 -120
- package/src/client/server/vue3/Variant.vue +0 -52
- package/src/client/server/vue3/run.ts +0 -55
- package/src/components.d.ts +0 -143
- package/src/node/types.ts +0 -53
package/src/node/tree.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
import pc from 'picocolors'
|
|
2
|
+
import type { ServerStoryFile, ServerTree, ServerTreeFile } from '@histoire/shared'
|
|
2
3
|
import type { HistoireConfig, TreeGroupConfig } from './config.js'
|
|
3
|
-
import type { StoryFile } from './types.js'
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
title: string
|
|
7
|
-
path: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface TreeLeaf {
|
|
11
|
-
title: string
|
|
12
|
-
index: number
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface TreeFolder {
|
|
16
|
-
title: string
|
|
17
|
-
children: (TreeFolder | TreeLeaf)[]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface TreeGroup {
|
|
21
|
-
group: true
|
|
22
|
-
id: string
|
|
23
|
-
title: string
|
|
24
|
-
children: (TreeFolder | TreeLeaf)[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type Tree = (TreeGroup | TreeFolder | TreeLeaf)[]
|
|
28
|
-
|
|
29
|
-
export function createPath (config: HistoireConfig, file: TreeFile) {
|
|
5
|
+
export function createPath (config: HistoireConfig, file: ServerTreeFile) {
|
|
30
6
|
if (config.tree.file === 'title') {
|
|
31
7
|
return file.title.split('/')
|
|
32
8
|
}
|
|
@@ -41,7 +17,7 @@ export function createPath (config: HistoireConfig, file: TreeFile) {
|
|
|
41
17
|
return config.tree.file(file)
|
|
42
18
|
}
|
|
43
19
|
|
|
44
|
-
export function makeTree (config: HistoireConfig, files:
|
|
20
|
+
export function makeTree (config: HistoireConfig, files: ServerStoryFile[]) {
|
|
45
21
|
interface ITreeObject {
|
|
46
22
|
[index: string]: number | ITreeObject
|
|
47
23
|
}
|
|
@@ -71,7 +47,7 @@ export function makeTree (config: HistoireConfig, files: StoryFile[]) {
|
|
|
71
47
|
sortingFunction = config.tree.order
|
|
72
48
|
}
|
|
73
49
|
|
|
74
|
-
const result:
|
|
50
|
+
const result: ServerTree = []
|
|
75
51
|
|
|
76
52
|
for (const group of groups) {
|
|
77
53
|
if (group === defaultGroup) {
|
|
@@ -88,7 +64,7 @@ export function makeTree (config: HistoireConfig, files: StoryFile[]) {
|
|
|
88
64
|
|
|
89
65
|
return result
|
|
90
66
|
|
|
91
|
-
function getGroup (file:
|
|
67
|
+
function getGroup (file: ServerStoryFile): ITreeGroup {
|
|
92
68
|
if (file.story?.group) {
|
|
93
69
|
const group = groups.find(g => g.groupConfig?.id === file.story.group)
|
|
94
70
|
if (group) {
|
|
@@ -142,8 +118,8 @@ export function makeTree (config: HistoireConfig, files: StoryFile[]) {
|
|
|
142
118
|
}
|
|
143
119
|
}
|
|
144
120
|
|
|
145
|
-
function buildTree (treeObject: ITreeObject):
|
|
146
|
-
const tree:
|
|
121
|
+
function buildTree (treeObject: ITreeObject): ServerTree {
|
|
122
|
+
const tree: ServerTree = []
|
|
147
123
|
|
|
148
124
|
for (const [key, element] of Object.entries(treeObject)) {
|
|
149
125
|
if (Number.isInteger(element)) {
|
package/src/node/vite.ts
CHANGED
package/vite.config.ts
CHANGED
|
@@ -17,15 +17,19 @@ export default defineConfig({
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
closeBundle () {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
try {
|
|
21
|
+
const files = fs.readdirSync('./dist/bundled')
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
if (file.endsWith('.js')) {
|
|
24
|
+
const filePath = path.join('./dist/bundled', file)
|
|
25
|
+
const content = fs.readFileSync(filePath, 'utf-8')
|
|
26
|
+
if (content.includes('import__meta')) {
|
|
27
|
+
fs.writeFileSync(filePath, content.replace(/import__meta/g, 'import.meta'), 'utf-8')
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
}
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.error(e)
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
},
|
|
@@ -41,6 +45,7 @@ export default defineConfig({
|
|
|
41
45
|
rollupOptions: {
|
|
42
46
|
external: [
|
|
43
47
|
/\$histoire/,
|
|
48
|
+
/@histoire/,
|
|
44
49
|
/@vue\/*/,
|
|
45
50
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
46
51
|
...Object.keys(require('./package.json').dependencies),
|