@poveste/shared 0.1.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/LICENSE +22 -0
- package/dist/codegen/const.d.ts +2 -0
- package/dist/codegen/const.d.ts.map +1 -0
- package/dist/codegen/const.js +17 -0
- package/dist/codegen/index.d.ts +4 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +3 -0
- package/dist/codegen/serialize-js.d.ts +2 -0
- package/dist/codegen/serialize-js.d.ts.map +1 -0
- package/dist/codegen/serialize-js.js +126 -0
- package/dist/codegen/util.d.ts +11 -0
- package/dist/codegen/util.d.ts.map +1 -0
- package/dist/codegen/util.js +69 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/state.d.ts +4 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +40 -0
- package/dist/story.d.ts +2 -0
- package/dist/story.d.ts.map +1 -0
- package/dist/story.js +10 -0
- package/dist/type-utils.d.ts +2 -0
- package/dist/type-utils.d.ts.map +1 -0
- package/dist/type-utils.js +1 -0
- package/dist/types/command.d.ts +36 -0
- package/dist/types/command.d.ts.map +1 -0
- package/dist/types/command.js +1 -0
- package/dist/types/config.d.ts +242 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/plugin.d.ts +117 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +1 -0
- package/dist/types/prompt.d.ts +20 -0
- package/dist/types/prompt.d.ts.map +1 -0
- package/dist/types/prompt.js +1 -0
- package/dist/types/story.d.ts +189 -0
- package/dist/types/story.d.ts.map +1 -0
- package/dist/types/story.js +1 -0
- package/package.json +46 -0
- package/src/codegen/const.ts +17 -0
- package/src/codegen/index.ts +3 -0
- package/src/codegen/serialize-js.ts +143 -0
- package/src/codegen/util.ts +77 -0
- package/src/index.ts +5 -0
- package/src/state.ts +42 -0
- package/src/story.ts +10 -0
- package/src/type-utils.ts +1 -0
- package/src/types/command.ts +38 -0
- package/src/types/config.ts +252 -0
- package/src/types/index.ts +5 -0
- package/src/types/plugin.ts +135 -0
- package/src/types/prompt.ts +22 -0
- package/src/types/story.ts +204 -0
- package/tsconfig.json +51 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
export interface StoryFile {
|
|
2
|
+
id: string
|
|
3
|
+
supportPluginId: string
|
|
4
|
+
component: any
|
|
5
|
+
story: Story
|
|
6
|
+
path: string[]
|
|
7
|
+
filePath: string
|
|
8
|
+
docsFilePath?: string
|
|
9
|
+
source: () => Promise<{ default: string }>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type StoryLayout = {
|
|
13
|
+
type: 'single'
|
|
14
|
+
iframe?: boolean
|
|
15
|
+
} | {
|
|
16
|
+
type: 'grid'
|
|
17
|
+
width?: number | string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CommonProps {
|
|
21
|
+
id?: string
|
|
22
|
+
title?: string
|
|
23
|
+
icon?: string
|
|
24
|
+
iconColor?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface InheritedProps {
|
|
28
|
+
setupApp?: (payload: any) => unknown
|
|
29
|
+
source?: string
|
|
30
|
+
responsiveDisabled?: boolean
|
|
31
|
+
autoPropsDisabled?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface VariantProps extends CommonProps, InheritedProps {
|
|
35
|
+
// No additional properties
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface StoryProps extends CommonProps, InheritedProps {
|
|
39
|
+
group?: string
|
|
40
|
+
layout?: StoryLayout
|
|
41
|
+
docsOnly?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface CommonMeta {}
|
|
45
|
+
|
|
46
|
+
export interface StoryMeta extends CommonMeta {}
|
|
47
|
+
|
|
48
|
+
export interface Story {
|
|
49
|
+
id: string
|
|
50
|
+
title: string
|
|
51
|
+
group?: string
|
|
52
|
+
variants: Variant[]
|
|
53
|
+
layout?: StoryLayout
|
|
54
|
+
icon?: string
|
|
55
|
+
iconColor?: string
|
|
56
|
+
docsOnly?: boolean
|
|
57
|
+
file?: StoryFile
|
|
58
|
+
lastSelectedVariant?: Variant
|
|
59
|
+
slots?: () => any
|
|
60
|
+
meta?: StoryMeta
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface VariantMeta extends CommonMeta {}
|
|
64
|
+
|
|
65
|
+
export interface Variant {
|
|
66
|
+
id: string
|
|
67
|
+
title: string
|
|
68
|
+
icon?: string
|
|
69
|
+
iconColor?: string
|
|
70
|
+
setupApp?: (payload: any) => unknown
|
|
71
|
+
slots?: () => { default: any, controls: any, source: any }
|
|
72
|
+
state: any
|
|
73
|
+
source?: string
|
|
74
|
+
responsiveDisabled?: boolean
|
|
75
|
+
autoPropsDisabled?: boolean
|
|
76
|
+
configReady?: boolean
|
|
77
|
+
previewReady?: boolean
|
|
78
|
+
meta?: VariantMeta
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PropDefinition {
|
|
82
|
+
name: string
|
|
83
|
+
types?: string[]
|
|
84
|
+
required?: boolean
|
|
85
|
+
default?: any
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface AutoPropComponentDefinition {
|
|
89
|
+
name: string
|
|
90
|
+
index: number
|
|
91
|
+
props: PropDefinition[]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* SERVER */
|
|
95
|
+
|
|
96
|
+
export interface ServerStoryFile {
|
|
97
|
+
id: string
|
|
98
|
+
/**
|
|
99
|
+
* Absolute path
|
|
100
|
+
*/
|
|
101
|
+
path: string
|
|
102
|
+
/**
|
|
103
|
+
* Relative path
|
|
104
|
+
*/
|
|
105
|
+
relativePath: string
|
|
106
|
+
/**
|
|
107
|
+
* File name without extension
|
|
108
|
+
*/
|
|
109
|
+
fileName: string
|
|
110
|
+
/**
|
|
111
|
+
* Support plugin (Vue, Svelte, etc.)
|
|
112
|
+
*/
|
|
113
|
+
supportPluginId: string
|
|
114
|
+
/**
|
|
115
|
+
* Generated path for tree UI
|
|
116
|
+
*/
|
|
117
|
+
treePath?: string[]
|
|
118
|
+
/**
|
|
119
|
+
* Use the module id in imports to allow HMR
|
|
120
|
+
*/
|
|
121
|
+
moduleId: string
|
|
122
|
+
/**
|
|
123
|
+
* Resolved story data from story file execution
|
|
124
|
+
*/
|
|
125
|
+
story?: ServerStory
|
|
126
|
+
/**
|
|
127
|
+
* Data sent to user tree config functions
|
|
128
|
+
*/
|
|
129
|
+
treeFile?: ServerTreeFile
|
|
130
|
+
/**
|
|
131
|
+
* Is virtual module
|
|
132
|
+
*/
|
|
133
|
+
virtual?: boolean
|
|
134
|
+
/**
|
|
135
|
+
* Virtual module code
|
|
136
|
+
*/
|
|
137
|
+
moduleCode?: string
|
|
138
|
+
/**
|
|
139
|
+
* Related markdown docs
|
|
140
|
+
*/
|
|
141
|
+
markdownFile?: ServerMarkdownFile
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface ServerMarkdownFile {
|
|
145
|
+
id: string
|
|
146
|
+
relativePath: string
|
|
147
|
+
absolutePath: string
|
|
148
|
+
isRelatedToStory: boolean
|
|
149
|
+
frontmatter?: any
|
|
150
|
+
html?: string
|
|
151
|
+
content?: string
|
|
152
|
+
storyFile?: ServerStoryFile
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ServerStory {
|
|
156
|
+
id: string
|
|
157
|
+
title: string
|
|
158
|
+
group?: string
|
|
159
|
+
variants: ServerVariant[]
|
|
160
|
+
layout?: StoryLayout
|
|
161
|
+
icon?: string
|
|
162
|
+
iconColor?: string
|
|
163
|
+
docsOnly?: boolean
|
|
164
|
+
docsText?: string
|
|
165
|
+
meta?: StoryMeta
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface ServerVariant {
|
|
169
|
+
id: string
|
|
170
|
+
title: string
|
|
171
|
+
icon?: string
|
|
172
|
+
iconColor?: string
|
|
173
|
+
meta?: VariantMeta
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface ServerTreeFile {
|
|
177
|
+
title: string
|
|
178
|
+
path: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ServerTreeLeaf {
|
|
182
|
+
title: string
|
|
183
|
+
index: number
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface ServerTreeFolder {
|
|
187
|
+
title: string
|
|
188
|
+
children: (ServerTreeFolder | ServerTreeLeaf)[]
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface ServerTreeGroup {
|
|
192
|
+
group: true
|
|
193
|
+
id: string
|
|
194
|
+
title: string
|
|
195
|
+
children: (ServerTreeFolder | ServerTreeLeaf)[]
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export type ServerTree = (ServerTreeGroup | ServerTreeFolder | ServerTreeLeaf)[]
|
|
199
|
+
|
|
200
|
+
export interface ServerRunPayload {
|
|
201
|
+
file: ServerStoryFile
|
|
202
|
+
storyData: ServerStory[]
|
|
203
|
+
el: HTMLElement
|
|
204
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
// Volar
|
|
5
|
+
"jsx": "preserve",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ESNext",
|
|
8
|
+
"DOM"
|
|
9
|
+
],
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"rootDir": "src",
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
// Alias
|
|
15
|
+
"paths": {
|
|
16
|
+
"floating-vue": ["node_modules/@poveste/vendors/floating-vue"],
|
|
17
|
+
"@iconify/vue": ["node_modules/@poveste/vendors/iconify"],
|
|
18
|
+
"pinia": ["node_modules/@poveste/vendors/pinia"],
|
|
19
|
+
"scroll-into-view-if-needed": ["node_modules/@poveste/vendors/scroll"],
|
|
20
|
+
"vue-router": ["node_modules/@poveste/vendors/vue-router"],
|
|
21
|
+
"@vueuse/core": ["node_modules/@poveste/vendors/vue-use"],
|
|
22
|
+
"vue": ["node_modules/@poveste/vendors/vue"]
|
|
23
|
+
},
|
|
24
|
+
"resolveJsonModule": true,
|
|
25
|
+
"strictBindCallApply": true,
|
|
26
|
+
"strictFunctionTypes": true,
|
|
27
|
+
"alwaysStrict": true,
|
|
28
|
+
// Strict
|
|
29
|
+
"noImplicitAny": false,
|
|
30
|
+
"noImplicitThis": true,
|
|
31
|
+
// Output
|
|
32
|
+
"declaration": true,
|
|
33
|
+
"declarationMap": true,
|
|
34
|
+
"outDir": "dist",
|
|
35
|
+
"removeComments": false,
|
|
36
|
+
"sourceMap": false,
|
|
37
|
+
"allowSyntheticDefaultImports": true,
|
|
38
|
+
"esModuleInterop": true,
|
|
39
|
+
"skipLibCheck": true,
|
|
40
|
+
"preserveWatchOutput": true
|
|
41
|
+
},
|
|
42
|
+
"include": [
|
|
43
|
+
"src"
|
|
44
|
+
],
|
|
45
|
+
"exclude": [
|
|
46
|
+
"node_modules",
|
|
47
|
+
"generated/**/*",
|
|
48
|
+
"dist/**/*",
|
|
49
|
+
"src/**/*.spec.ts"
|
|
50
|
+
]
|
|
51
|
+
}
|