histoire 0.2.5 → 0.3.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/client/app/App.vue +8 -3
- package/dist/client/app/codegen/const.d.ts +1 -0
- package/dist/client/app/codegen/const.js +3 -0
- package/dist/client/app/codegen/vue3.js +82 -21
- package/dist/client/app/components/base/BaseEmpty.vue +17 -1
- package/dist/client/app/components/exposed/Story.vue +22 -1
- package/dist/client/app/components/exposed/Variant.vue +13 -1
- package/dist/client/app/components/sandbox/SandboxVue3.vue +6 -4
- package/dist/client/app/components/sandbox/lib.js +2 -1
- package/dist/client/app/components/search/SearchLoading.vue +16 -0
- package/dist/client/app/components/search/SearchModal.vue +12 -149
- package/dist/client/app/components/search/SearchPane.vue +210 -0
- package/dist/client/app/components/search/search-data.d.ts +2 -0
- package/dist/client/app/components/search/search-data.js +7 -0
- package/dist/client/app/components/story/StoryControls.vue +5 -0
- package/dist/client/app/components/story/StoryDocs.vue +18 -11
- package/dist/client/app/components/story/StoryEvent.vue +53 -0
- package/dist/client/app/components/story/StoryEvents.vue +45 -0
- package/dist/client/app/components/story/StoryResponsivePreview.vue +41 -8
- package/dist/client/app/components/story/StorySidePanel.vue +28 -3
- package/dist/client/app/components/story/StorySourceCode.vue +24 -14
- package/dist/client/app/components/story/StoryView.vue +16 -2
- package/dist/client/app/components/tree/StoryGroup.vue +4 -4
- package/dist/client/app/components/tree/StoryListFolder.vue +4 -4
- package/dist/client/app/components/tree/StoryListItem.vue +4 -1
- package/dist/client/app/router.d.ts +1 -0
- package/dist/client/app/router.js +3 -1
- package/dist/client/app/sandbox.js +11 -1
- package/dist/client/app/stores/events.d.ts +29 -0
- package/dist/client/app/stores/events.js +25 -0
- package/dist/client/app/stores/folder.d.ts +10 -0
- package/dist/client/app/stores/folder.js +47 -0
- package/dist/client/app/stores/story.d.ts +14 -8
- package/dist/client/app/stores/story.js +20 -33
- package/dist/client/app/style/main.pcss +5 -0
- package/dist/client/app/style/sandbox.css +2 -0
- package/dist/client/app/types.d.ts +1 -0
- package/dist/client/app/util/const.d.ts +1 -0
- package/dist/client/app/util/const.js +1 -0
- package/dist/client/app/util/events.d.ts +1 -0
- package/dist/client/app/util/events.js +31 -0
- package/dist/client/app/util/mapping.js +2 -2
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +2 -1
- package/dist/client/server/Story.server.vue +13 -2
- package/dist/node/alias.d.ts +2 -1
- package/dist/node/alias.js +3 -2
- package/dist/node/build.js +74 -21
- package/dist/node/builtin-plugins/tailwind-tokens.d.ts +5 -0
- package/dist/node/builtin-plugins/tailwind-tokens.js +510 -0
- package/dist/node/collect/index.js +3 -1
- package/dist/node/commands/preview.js +4 -25
- package/dist/node/config.d.ts +103 -3
- package/dist/node/config.js +40 -23
- package/dist/node/context.d.ts +3 -3
- package/dist/node/context.js +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +1 -0
- package/dist/node/load.d.ts +12 -0
- package/dist/node/load.js +42 -0
- package/dist/node/plugin.d.ts +67 -11
- package/dist/node/plugin.js +42 -245
- package/dist/node/preview.d.ts +8 -0
- package/dist/node/preview.js +41 -0
- package/dist/node/search.d.ts +2 -0
- package/dist/node/search.js +68 -0
- package/dist/node/server.js +43 -21
- package/dist/node/stories.d.ts +2 -0
- package/dist/node/stories.js +4 -4
- package/dist/node/types.d.ts +1 -0
- package/dist/node/util/find-up.d.ts +1 -0
- package/dist/node/util/find-up.js +20 -0
- package/dist/node/vite.d.ts +13 -0
- package/dist/node/vite.js +278 -0
- package/dist/style.css +111 -47
- package/package.json +5 -3
- package/scripts/copy.mjs +2 -1
- package/src/client/app/App.vue +8 -3
- package/src/client/app/codegen/const.ts +3 -0
- package/src/client/app/codegen/vue3.ts +80 -22
- package/src/client/app/components/base/BaseEmpty.vue +17 -1
- package/src/client/app/components/exposed/Story.vue +22 -1
- package/src/client/app/components/exposed/Variant.vue +13 -1
- package/src/client/app/components/sandbox/SandboxVue3.vue +6 -4
- package/src/client/app/components/sandbox/lib.ts +3 -1
- package/src/client/app/components/search/SearchLoading.vue +16 -0
- package/src/client/app/components/search/SearchModal.vue +12 -149
- package/src/client/app/components/search/SearchPane.vue +210 -0
- package/src/client/app/components/search/search-data.ts +9 -0
- package/src/client/app/components/story/StoryControls.vue +5 -0
- package/src/client/app/components/story/StoryDocs.vue +18 -11
- package/src/client/app/components/story/StoryEvent.vue +53 -0
- package/src/client/app/components/story/StoryEvents.vue +45 -0
- package/src/client/app/components/story/StoryResponsivePreview.vue +41 -8
- package/src/client/app/components/story/StorySidePanel.vue +28 -3
- package/src/client/app/components/story/StorySourceCode.vue +24 -14
- package/src/client/app/components/story/StoryView.vue +16 -2
- package/src/client/app/components/tree/StoryGroup.vue +4 -4
- package/src/client/app/components/tree/StoryListFolder.vue +4 -4
- package/src/client/app/components/tree/StoryListItem.vue +4 -1
- package/src/client/app/router.ts +4 -1
- package/src/client/app/sandbox.ts +12 -2
- package/src/client/app/stores/events.ts +36 -0
- package/{dist/client/app/stores/story.ts → src/client/app/stores/folder.ts} +16 -23
- package/src/client/app/stores/story.ts +21 -40
- package/src/client/app/style/main.pcss +5 -0
- package/src/client/app/style/sandbox.css +2 -0
- package/src/client/app/types.ts +1 -0
- package/src/client/app/util/const.ts +1 -0
- package/src/client/app/util/events.ts +30 -0
- package/src/client/app/util/mapping.ts +2 -2
- package/src/client/index.ts +2 -1
- package/src/client/server/Story.server.vue +13 -2
- package/src/node/alias.ts +4 -2
- package/src/node/build.ts +86 -21
- package/src/node/builtin-plugins/tailwind-tokens.ts +521 -0
- package/src/node/collect/index.ts +3 -1
- package/src/node/commands/preview.ts +4 -33
- package/src/node/config.ts +53 -27
- package/src/node/context.ts +3 -3
- package/src/node/index.ts +1 -0
- package/src/node/load.ts +63 -0
- package/src/node/plugin.ts +75 -252
- package/src/node/preview.ts +56 -0
- package/src/node/search.ts +75 -0
- package/src/node/server.ts +49 -23
- package/src/node/stories.ts +4 -4
- package/src/node/types.ts +1 -0
- package/src/node/util/find-up.ts +24 -0
- package/src/node/vite.ts +296 -0
- package/tailwind.config.cjs +1 -0
- package/dist/client/app/codegen/serialize-js.ts +0 -119
- package/dist/client/app/codegen/util.ts +0 -79
- package/dist/client/app/codegen/vue3.ts +0 -276
- package/dist/client/app/components/sandbox/lib.ts +0 -8
- package/dist/client/app/global-components.ts +0 -13
- package/dist/client/app/index.ts +0 -28
- package/dist/client/app/router.ts +0 -17
- package/dist/client/app/sandbox.ts +0 -94
- package/dist/client/app/stores/preview-settings.ts +0 -17
- package/dist/client/app/types.ts +0 -78
- package/dist/client/app/util/config.ts +0 -6
- package/dist/client/app/util/const.ts +0 -3
- package/dist/client/app/util/dark.ts +0 -4
- package/dist/client/app/util/env.ts +0 -1
- package/dist/client/app/util/keyboard.ts +0 -99
- package/dist/client/app/util/mapping.ts +0 -48
- package/dist/client/app/util/preview-settings.ts +0 -8
- package/dist/client/app/util/reactivity.ts +0 -22
- package/dist/client/app/util/responsive.ts +0 -3
- package/dist/client/app/util/scroll.ts +0 -31
- package/dist/client/app/util/tooltip.ts +0 -13
- package/dist/client/app/util/variant.ts +0 -20
- package/dist/client/index.ts +0 -12
- package/dist/client/server/index.ts +0 -32
- package/dist/client/shim.d.ts +0 -5
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import { relative, dirname } from 'pathe';
|
|
3
|
+
import { resolveConfig as resolveViteConfig } from 'vite';
|
|
4
|
+
import { lookup as lookupMime } from 'mrmime';
|
|
5
|
+
import { APP_PATH, DIST_PATH, TEMP_PATH } from './alias.js';
|
|
6
|
+
import { notifyStoryChange } from './stories.js';
|
|
7
|
+
import { makeTree } from './tree.js';
|
|
8
|
+
import { parseColor } from './colors.js';
|
|
9
|
+
import { createMarkdownRenderer } from './markdown.js';
|
|
10
|
+
import { generateSearchData } from './search.js';
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
export const STORIES_ID = '$histoire-stories';
|
|
13
|
+
export const RESOLVED_STORIES_ID = `/${STORIES_ID}-resolved`;
|
|
14
|
+
export const SETUP_ID = '$histoire-setup';
|
|
15
|
+
export const NOOP_ID = '/$histoire-noop';
|
|
16
|
+
export const CONFIG_ID = '$histoire-config';
|
|
17
|
+
export const RESOLVED_CONFIG_ID = `/${CONFIG_ID}-resolved`;
|
|
18
|
+
export const THEME_ID = '$histoire-theme';
|
|
19
|
+
export const RESOLVED_THEME_ID = `/${THEME_ID}-resolved.css`;
|
|
20
|
+
export const SEARCH_DATA_ID = '$histoire-search-data';
|
|
21
|
+
export const RESOLVED_SEARCH_DATA_ID = `/${SEARCH_DATA_ID}-resolved`;
|
|
22
|
+
export async function createVitePlugins(ctx) {
|
|
23
|
+
const viteConfig = await resolveViteConfig({}, ctx.mode === 'dev' ? 'serve' : 'build');
|
|
24
|
+
const hasVuePlugin = viteConfig.plugins.find(p => p.name === 'vite:vue');
|
|
25
|
+
const plugins = [];
|
|
26
|
+
if (!hasVuePlugin) {
|
|
27
|
+
plugins.push((await import('@vitejs/plugin-vue')).default());
|
|
28
|
+
}
|
|
29
|
+
if (ctx.config.vite) {
|
|
30
|
+
plugins.push({
|
|
31
|
+
name: 'histoire-vite-config-override',
|
|
32
|
+
config(config, env) {
|
|
33
|
+
return typeof ctx.config.vite === 'function' ? ctx.config.vite(config, env) : ctx.config.vite;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
plugins.push({
|
|
38
|
+
name: 'histoire-vite-plugin',
|
|
39
|
+
config() {
|
|
40
|
+
return {
|
|
41
|
+
optimizeDeps: {
|
|
42
|
+
// force include vue to avoid duplicated copies when linked + optimized
|
|
43
|
+
include: [
|
|
44
|
+
'vue',
|
|
45
|
+
dirname(require.resolve('@vue/runtime-core/package.json')),
|
|
46
|
+
dirname(require.resolve('shiki/package.json')),
|
|
47
|
+
dirname(require.resolve('vscode-textmate/package.json')),
|
|
48
|
+
dirname(require.resolve('vscode-oniguruma/package.json')),
|
|
49
|
+
dirname(require.resolve('case/package.json')),
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
server: {
|
|
53
|
+
fs: {
|
|
54
|
+
allow: [DIST_PATH, TEMP_PATH, viteConfig.root, process.cwd()],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
define: {
|
|
58
|
+
// We need to force this to be able to use `devtoolsRawSetupState`
|
|
59
|
+
__VUE_PROD_DEVTOOLS__: 'true',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
async resolveId(id, importer) {
|
|
64
|
+
if (id.startsWith(STORIES_ID)) {
|
|
65
|
+
return RESOLVED_STORIES_ID;
|
|
66
|
+
}
|
|
67
|
+
if (id.startsWith(SETUP_ID)) {
|
|
68
|
+
if (ctx.config.setupFile) {
|
|
69
|
+
return this.resolve(ctx.config.setupFile, importer, {
|
|
70
|
+
skipSelf: true,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return NOOP_ID;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (id.startsWith(CONFIG_ID)) {
|
|
78
|
+
return RESOLVED_CONFIG_ID;
|
|
79
|
+
}
|
|
80
|
+
if (id.startsWith(THEME_ID)) {
|
|
81
|
+
return RESOLVED_THEME_ID;
|
|
82
|
+
}
|
|
83
|
+
if (id.startsWith(SEARCH_DATA_ID)) {
|
|
84
|
+
return RESOLVED_SEARCH_DATA_ID;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
async load(id) {
|
|
88
|
+
if (id === RESOLVED_STORIES_ID) {
|
|
89
|
+
const resolvedStories = ctx.storyFiles.filter(s => !!s.story);
|
|
90
|
+
const files = resolvedStories.map((file, index) => {
|
|
91
|
+
return {
|
|
92
|
+
id: file.id,
|
|
93
|
+
path: file.treePath,
|
|
94
|
+
story: file.story,
|
|
95
|
+
framework: 'vue3',
|
|
96
|
+
index,
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
return `import { defineAsyncComponent } from 'vue'
|
|
100
|
+
${resolvedStories.map((file, index) => `const Comp${index} = defineAsyncComponent(() => import('${file.path}'))`).join('\n')}
|
|
101
|
+
export let files = [${files.map((file) => `{${JSON.stringify(file).slice(1, -1)}, component: Comp${file.index}}`).join(',\n')}]
|
|
102
|
+
export let tree = ${JSON.stringify(makeTree(ctx.config, resolvedStories))}
|
|
103
|
+
const handlers = []
|
|
104
|
+
export function onUpdate (cb) {
|
|
105
|
+
handlers.push(cb)
|
|
106
|
+
}
|
|
107
|
+
if (import.meta.hot) {
|
|
108
|
+
import.meta.hot.accept(newModule => {
|
|
109
|
+
files = newModule.files
|
|
110
|
+
tree = newModule.tree
|
|
111
|
+
handlers.forEach(h => {
|
|
112
|
+
h(newModule.files, newModule.tree)
|
|
113
|
+
newModule.onUpdate(h)
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
}`;
|
|
117
|
+
}
|
|
118
|
+
if (id === NOOP_ID) {
|
|
119
|
+
return `export default () => {}`;
|
|
120
|
+
}
|
|
121
|
+
if (id === RESOLVED_CONFIG_ID) {
|
|
122
|
+
let js = `export const config = ${JSON.stringify(ctx.config)}\n`;
|
|
123
|
+
if (ctx.config.theme?.logo) {
|
|
124
|
+
for (const key in ctx.config.theme.logo) {
|
|
125
|
+
js += `import Logo_${key} from '${ctx.config.theme.logo[key]}'\n`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
js += `export const logos = {${Object.keys(ctx.config.theme?.logo ?? {}).map(key => `${key}: Logo_${key}`).join(', ')}}\n`;
|
|
129
|
+
return js;
|
|
130
|
+
}
|
|
131
|
+
if (id === RESOLVED_THEME_ID) {
|
|
132
|
+
let css = '*, ::before, ::after {';
|
|
133
|
+
// Colors
|
|
134
|
+
for (const color in ctx.config.theme?.colors ?? {}) {
|
|
135
|
+
for (const key in ctx.config.theme.colors[color]) {
|
|
136
|
+
css += `--_histoire-color-${color}-${key}: ${parseColor(ctx.config.theme.colors[color][key]).color.join(' ')};`;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
css += '}';
|
|
140
|
+
return css;
|
|
141
|
+
}
|
|
142
|
+
if (id === RESOLVED_SEARCH_DATA_ID) {
|
|
143
|
+
return `export let searchData = ${JSON.stringify(await generateSearchData(ctx))}
|
|
144
|
+
const handlers = []
|
|
145
|
+
export function onUpdate (cb) {
|
|
146
|
+
handlers.push(cb)
|
|
147
|
+
}
|
|
148
|
+
if (import.meta.hot) {
|
|
149
|
+
import.meta.hot.accept(newModule => {
|
|
150
|
+
searchData = newModule.searchData
|
|
151
|
+
handlers.forEach(h => {
|
|
152
|
+
h(newModule.searchData)
|
|
153
|
+
newModule.onUpdate(h)
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
}`;
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
handleHotUpdate(updateContext) {
|
|
160
|
+
const story = ctx.storyFiles.find(file => file.path === updateContext.file);
|
|
161
|
+
if (story) {
|
|
162
|
+
notifyStoryChange(story);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
configureServer(server) {
|
|
166
|
+
server.middlewares.use(async (req, res, next) => {
|
|
167
|
+
if (req.url.startsWith(`${server.config.base}__sandbox`)) {
|
|
168
|
+
res.statusCode = 200;
|
|
169
|
+
let html = `
|
|
170
|
+
<!DOCTYPE html>
|
|
171
|
+
<html>
|
|
172
|
+
<head>
|
|
173
|
+
<title></title>
|
|
174
|
+
<meta charset="utf-8">
|
|
175
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
176
|
+
<meta name="description" content="">
|
|
177
|
+
</head>
|
|
178
|
+
<body>
|
|
179
|
+
<div id="app"></div>
|
|
180
|
+
<script>
|
|
181
|
+
// Hide spammy vite messages
|
|
182
|
+
const origConsoleLog = console.log
|
|
183
|
+
console.log = (...args) => {
|
|
184
|
+
if (typeof args[0] !== 'string' || !args[0].startsWith('[vite] connect')) {
|
|
185
|
+
origConsoleLog(...args)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</script>
|
|
189
|
+
<script type="module" src="/@fs/${APP_PATH}/sandbox.js"></script>
|
|
190
|
+
</body>
|
|
191
|
+
</html>`;
|
|
192
|
+
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
|
193
|
+
// also applies HTML transforms from Vite plugins
|
|
194
|
+
html = await server.transformIndexHtml(req.url, html);
|
|
195
|
+
res.end(html);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
next();
|
|
199
|
+
});
|
|
200
|
+
// serve our index.html after vite history fallback
|
|
201
|
+
return () => {
|
|
202
|
+
server.middlewares.use(async (req, res, next) => {
|
|
203
|
+
if (req.url.endsWith('.html')) {
|
|
204
|
+
res.statusCode = 200;
|
|
205
|
+
let html = `
|
|
206
|
+
<!DOCTYPE html>
|
|
207
|
+
<html>
|
|
208
|
+
<head>
|
|
209
|
+
<title></title>
|
|
210
|
+
<link rel="icon" href=""/>
|
|
211
|
+
<meta charset="utf-8">
|
|
212
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
213
|
+
<meta name="description" content="">
|
|
214
|
+
${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${server.config.base}${ctx.config.theme.favicon}"/>` : ''}
|
|
215
|
+
</head>
|
|
216
|
+
<body>
|
|
217
|
+
<div id="app"></div>
|
|
218
|
+
<script type="module" src="/@fs/${APP_PATH}/index.js"></script>
|
|
219
|
+
</body>
|
|
220
|
+
</html>`;
|
|
221
|
+
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
|
222
|
+
// also applies HTML transforms from Vite plugins
|
|
223
|
+
html = await server.transformIndexHtml(req.url, html);
|
|
224
|
+
res.end(html);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
next();
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
// Custom blocks
|
|
233
|
+
plugins.push(...await createCustomBlocksPlugins(ctx));
|
|
234
|
+
if (ctx.mode === 'build') {
|
|
235
|
+
// Add file name in build mode to have components names instead of <Anonymous>
|
|
236
|
+
const include = [/\.vue$/];
|
|
237
|
+
const exclude = [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/];
|
|
238
|
+
plugins.push({
|
|
239
|
+
name: 'histoire-file-name-plugin',
|
|
240
|
+
enforce: 'post',
|
|
241
|
+
transform(code, id) {
|
|
242
|
+
if (exclude.some(r => r.test(id)))
|
|
243
|
+
return;
|
|
244
|
+
if (include.some(r => r.test(id))) {
|
|
245
|
+
const file = relative(viteConfig.root, id);
|
|
246
|
+
const index = code.indexOf('export default');
|
|
247
|
+
const result = `${code.substring(0, index)}_sfc_main.__file = '${file}'\n${code.substring(index)}`;
|
|
248
|
+
return result;
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
return plugins;
|
|
254
|
+
}
|
|
255
|
+
async function createCustomBlocksPlugins(ctx) {
|
|
256
|
+
const plugins = [];
|
|
257
|
+
let md = await createMarkdownRenderer();
|
|
258
|
+
if (ctx.config.markdown) {
|
|
259
|
+
const result = await ctx.config.markdown(md);
|
|
260
|
+
if (result) {
|
|
261
|
+
md = result;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
plugins.push({
|
|
265
|
+
name: 'histoire-vue-docs-block',
|
|
266
|
+
transform(code, id) {
|
|
267
|
+
if (!id.includes('?vue&type=docs'))
|
|
268
|
+
return;
|
|
269
|
+
if (!id.includes('lang.md'))
|
|
270
|
+
return;
|
|
271
|
+
const html = md.render(code);
|
|
272
|
+
return `export default Comp => {
|
|
273
|
+
Comp.doc = ${JSON.stringify(html)}
|
|
274
|
+
}`;
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
return plugins;
|
|
278
|
+
}
|
package/dist/style.css
CHANGED
|
@@ -204,6 +204,10 @@
|
|
|
204
204
|
border-color:#000c
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
.htw-bind-col-size{
|
|
208
|
+
grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))
|
|
209
|
+
}
|
|
210
|
+
|
|
207
211
|
/* @TODO custom themes */
|
|
208
212
|
|
|
209
213
|
.v-popper {
|
|
@@ -649,7 +653,7 @@ button {
|
|
|
649
653
|
--tw-prose-invert-bold:#fff;
|
|
650
654
|
--tw-prose-invert-counters:#9ca3af;
|
|
651
655
|
--tw-prose-invert-bullets:rgb(var(--_histoire-color-gray-500));
|
|
652
|
-
--tw-prose-invert-hr
|
|
656
|
+
--tw-prose-invert-hr:rgb(var(--_histoire-color-gray-800));
|
|
653
657
|
--tw-prose-invert-quotes:#f3f4f6;
|
|
654
658
|
--tw-prose-invert-quote-borders:rgb(var(--_histoire-color-gray-800));
|
|
655
659
|
--tw-prose-invert-captions:#9ca3af;
|
|
@@ -852,14 +856,6 @@ button {
|
|
|
852
856
|
right:0.25rem
|
|
853
857
|
}
|
|
854
858
|
|
|
855
|
-
.htw-top-2{
|
|
856
|
-
top:0.5rem
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
.htw-right-6{
|
|
860
|
-
right:1.5rem
|
|
861
|
-
}
|
|
862
|
-
|
|
863
859
|
.htw-isolate{
|
|
864
860
|
isolation:isolate
|
|
865
861
|
}
|
|
@@ -884,16 +880,16 @@ button {
|
|
|
884
880
|
margin:0.25rem
|
|
885
881
|
}
|
|
886
882
|
|
|
887
|
-
.htw-my-2{
|
|
888
|
-
margin-top:0.5rem;
|
|
889
|
-
margin-bottom:0.5rem
|
|
890
|
-
}
|
|
891
|
-
|
|
892
883
|
.htw-mx-1{
|
|
893
884
|
margin-left:0.25rem;
|
|
894
885
|
margin-right:0.25rem
|
|
895
886
|
}
|
|
896
887
|
|
|
888
|
+
.htw-my-2{
|
|
889
|
+
margin-top:0.5rem;
|
|
890
|
+
margin-bottom:0.5rem
|
|
891
|
+
}
|
|
892
|
+
|
|
897
893
|
.htw-mx-2{
|
|
898
894
|
margin-left:0.5rem;
|
|
899
895
|
margin-right:0.5rem
|
|
@@ -935,6 +931,10 @@ button {
|
|
|
935
931
|
margin-top:0px
|
|
936
932
|
}
|
|
937
933
|
|
|
934
|
+
.htw-mb-6{
|
|
935
|
+
margin-bottom:1.5rem
|
|
936
|
+
}
|
|
937
|
+
|
|
938
938
|
.-htw-mt-1{
|
|
939
939
|
margin-top:-0.25rem
|
|
940
940
|
}
|
|
@@ -1015,6 +1015,10 @@ button {
|
|
|
1015
1015
|
height:1rem
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
+
.htw-h-\[51px\]{
|
|
1019
|
+
height:51px
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1018
1022
|
.htw-h-fit{
|
|
1019
1023
|
height:-webkit-fit-content;
|
|
1020
1024
|
height:-moz-fit-content;
|
|
@@ -1113,6 +1117,10 @@ button {
|
|
|
1113
1117
|
width:max-content
|
|
1114
1118
|
}
|
|
1115
1119
|
|
|
1120
|
+
.htw-w-16{
|
|
1121
|
+
width:4rem
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1116
1124
|
.htw-w-20{
|
|
1117
1125
|
width:5rem
|
|
1118
1126
|
}
|
|
@@ -1121,14 +1129,14 @@ button {
|
|
|
1121
1129
|
width:7rem
|
|
1122
1130
|
}
|
|
1123
1131
|
|
|
1124
|
-
.htw-w-16{
|
|
1125
|
-
width:4rem
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
1132
|
.htw-w-32{
|
|
1129
1133
|
width:8rem
|
|
1130
1134
|
}
|
|
1131
1135
|
|
|
1136
|
+
.htw-min-w-4{
|
|
1137
|
+
min-width:1rem
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1132
1140
|
.htw-min-w-16{
|
|
1133
1141
|
min-width:4rem
|
|
1134
1142
|
}
|
|
@@ -1149,6 +1157,10 @@ button {
|
|
|
1149
1157
|
max-width:none
|
|
1150
1158
|
}
|
|
1151
1159
|
|
|
1160
|
+
.htw-max-w-\[400px\]{
|
|
1161
|
+
max-width:400px
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1152
1164
|
.htw-flex-none{
|
|
1153
1165
|
flex:none
|
|
1154
1166
|
}
|
|
@@ -1237,6 +1249,10 @@ button {
|
|
|
1237
1249
|
align-items:center
|
|
1238
1250
|
}
|
|
1239
1251
|
|
|
1252
|
+
.htw-items-baseline{
|
|
1253
|
+
align-items:baseline
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1240
1256
|
.htw-items-stretch{
|
|
1241
1257
|
align-items:stretch
|
|
1242
1258
|
}
|
|
@@ -1329,14 +1345,14 @@ button {
|
|
|
1329
1345
|
border-radius:0.75rem
|
|
1330
1346
|
}
|
|
1331
1347
|
|
|
1332
|
-
.htw-rounded{
|
|
1333
|
-
border-radius:0.375rem
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
1348
|
.htw-rounded-full{
|
|
1337
1349
|
border-radius:9999px
|
|
1338
1350
|
}
|
|
1339
1351
|
|
|
1352
|
+
.htw-rounded{
|
|
1353
|
+
border-radius:0.375rem
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1340
1356
|
.htw-rounded-b-lg{
|
|
1341
1357
|
border-bottom-right-radius:0.75rem;
|
|
1342
1358
|
border-bottom-left-radius:0.75rem
|
|
@@ -1455,6 +1471,11 @@ button {
|
|
|
1455
1471
|
background-color:transparent
|
|
1456
1472
|
}
|
|
1457
1473
|
|
|
1474
|
+
.htw-bg-primary-50{
|
|
1475
|
+
--tw-bg-opacity:1;
|
|
1476
|
+
background-color:rgb(var(--_histoire-color-primary-50) / var(--tw-bg-opacity))
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1458
1479
|
.htw-bg-gray-200{
|
|
1459
1480
|
--tw-bg-opacity:1;
|
|
1460
1481
|
background-color:rgb(var(--_histoire-color-gray-200) / var(--tw-bg-opacity))
|
|
@@ -1503,10 +1524,6 @@ button {
|
|
|
1503
1524
|
padding:0.25rem
|
|
1504
1525
|
}
|
|
1505
1526
|
|
|
1506
|
-
.htw-p-2\.5{
|
|
1507
|
-
padding:0.625rem
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
1527
|
.htw-px-1{
|
|
1511
1528
|
padding-left:0.25rem;
|
|
1512
1529
|
padding-right:0.25rem
|
|
@@ -1537,21 +1554,6 @@ button {
|
|
|
1537
1554
|
padding-bottom:1rem
|
|
1538
1555
|
}
|
|
1539
1556
|
|
|
1540
|
-
.htw-px-2{
|
|
1541
|
-
padding-left:0.5rem;
|
|
1542
|
-
padding-right:0.5rem
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
.htw-py-0\.5{
|
|
1546
|
-
padding-top:0.125rem;
|
|
1547
|
-
padding-bottom:0.125rem
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
.htw-py-0{
|
|
1551
|
-
padding-top:0px;
|
|
1552
|
-
padding-bottom:0px
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
1557
|
.htw-py-2{
|
|
1556
1558
|
padding-top:0.5rem;
|
|
1557
1559
|
padding-bottom:0.5rem
|
|
@@ -1567,6 +1569,21 @@ button {
|
|
|
1567
1569
|
padding-right:0px
|
|
1568
1570
|
}
|
|
1569
1571
|
|
|
1572
|
+
.htw-px-2{
|
|
1573
|
+
padding-left:0.5rem;
|
|
1574
|
+
padding-right:0.5rem
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
.htw-py-0\.5{
|
|
1578
|
+
padding-top:0.125rem;
|
|
1579
|
+
padding-bottom:0.125rem
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.htw-py-0{
|
|
1583
|
+
padding-top:0px;
|
|
1584
|
+
padding-bottom:0px
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1570
1587
|
.htw-py-1{
|
|
1571
1588
|
padding-top:0.25rem;
|
|
1572
1589
|
padding-bottom:0.25rem
|
|
@@ -1632,6 +1649,10 @@ button {
|
|
|
1632
1649
|
line-height:1
|
|
1633
1650
|
}
|
|
1634
1651
|
|
|
1652
|
+
.htw-leading-normal{
|
|
1653
|
+
line-height:1.5
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1635
1656
|
.htw-text-white\/40{
|
|
1636
1657
|
color:rgb(255 255 255 / 0.4)
|
|
1637
1658
|
}
|
|
@@ -1699,14 +1720,14 @@ button {
|
|
|
1699
1720
|
opacity:0.5
|
|
1700
1721
|
}
|
|
1701
1722
|
|
|
1702
|
-
.htw-opacity-20{
|
|
1703
|
-
opacity:0.2
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
1723
|
.htw-opacity-30{
|
|
1707
1724
|
opacity:0.3
|
|
1708
1725
|
}
|
|
1709
1726
|
|
|
1727
|
+
.htw-opacity-20{
|
|
1728
|
+
opacity:0.2
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1710
1731
|
.htw-opacity-70{
|
|
1711
1732
|
opacity:0.7
|
|
1712
1733
|
}
|
|
@@ -1810,6 +1831,10 @@ body {
|
|
|
1810
1831
|
visibility: hidden;
|
|
1811
1832
|
}
|
|
1812
1833
|
|
|
1834
|
+
.htw-prose hr {
|
|
1835
|
+
margin: 1rem 0;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1813
1838
|
.first\:htw-mt-0:first-child{
|
|
1814
1839
|
margin-top:0px
|
|
1815
1840
|
}
|
|
@@ -1870,8 +1895,13 @@ body {
|
|
|
1870
1895
|
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
1871
1896
|
}
|
|
1872
1897
|
|
|
1873
|
-
.htw-group:
|
|
1874
|
-
|
|
1898
|
+
.htw-group:nth-child(odd) .group-odd\:htw-bg-gray-100\/50{
|
|
1899
|
+
background-color:rgb(var(--_histoire-color-gray-100) / 0.5)
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
.htw-group:hover .group-hover\:htw-bg-primary-100{
|
|
1903
|
+
--tw-bg-opacity:1;
|
|
1904
|
+
background-color:rgb(var(--_histoire-color-primary-100) / var(--tw-bg-opacity))
|
|
1875
1905
|
}
|
|
1876
1906
|
|
|
1877
1907
|
.htw-group:hover .group-hover\:htw-opacity-90{
|
|
@@ -1965,6 +1995,11 @@ body {
|
|
|
1965
1995
|
background-color:rgb(var(--_histoire-color-gray-700) / 0.8)
|
|
1966
1996
|
}
|
|
1967
1997
|
|
|
1998
|
+
.htw-dark .dark\:htw-bg-primary-600{
|
|
1999
|
+
--tw-bg-opacity:1;
|
|
2000
|
+
background-color:rgb(var(--_histoire-color-primary-600) / var(--tw-bg-opacity))
|
|
2001
|
+
}
|
|
2002
|
+
|
|
1968
2003
|
.htw-dark .dark\:htw-bg-gray-850{
|
|
1969
2004
|
--tw-bg-opacity:1;
|
|
1970
2005
|
background-color:rgb(var(--_histoire-color-gray-850) / var(--tw-bg-opacity))
|
|
@@ -2044,6 +2079,15 @@ body {
|
|
|
2044
2079
|
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
2045
2080
|
}
|
|
2046
2081
|
|
|
2082
|
+
.htw-dark .htw-group:nth-child(odd) .dark\:group-odd\:htw-bg-gray-750\/40{
|
|
2083
|
+
background-color:rgb(var(--_histoire-color-gray-750) / 0.4)
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
.htw-dark .htw-group:hover .dark\:group-hover\:htw-bg-primary-700{
|
|
2087
|
+
--tw-bg-opacity:1;
|
|
2088
|
+
background-color:rgb(var(--_histoire-color-primary-700) / var(--tw-bg-opacity))
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2047
2091
|
@media (min-width: 640px){
|
|
2048
2092
|
.sm\:htw-h-4{
|
|
2049
2093
|
height:1rem
|
|
@@ -2073,6 +2117,14 @@ body {
|
|
|
2073
2117
|
margin-top:4rem
|
|
2074
2118
|
}
|
|
2075
2119
|
|
|
2120
|
+
.md\:htw-max-w-\[600px\]{
|
|
2121
|
+
max-width:600px
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
.md\:htw-p-12{
|
|
2125
|
+
padding:3rem
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2076
2128
|
.md\:htw-py-1\.5{
|
|
2077
2129
|
padding-top:0.375rem;
|
|
2078
2130
|
padding-bottom:0.375rem
|
|
@@ -2083,3 +2135,15 @@ body {
|
|
|
2083
2135
|
padding-bottom:0.25rem
|
|
2084
2136
|
}
|
|
2085
2137
|
}
|
|
2138
|
+
|
|
2139
|
+
@media (min-width: 1024px){
|
|
2140
|
+
.lg\:htw-max-w-\[800px\]{
|
|
2141
|
+
max-width:800px
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
@media (min-width: 1280px){
|
|
2146
|
+
.xl\:htw-max-w-\[900px\]{
|
|
2147
|
+
max-width:900px
|
|
2148
|
+
}
|
|
2149
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "histoire",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A fast story book powered by Vite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"histoire": "./bin.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@histoire/controls": "^0.
|
|
36
|
+
"@histoire/controls": "^0.3.0",
|
|
37
37
|
"@iconify/vue": "^3.2.1",
|
|
38
38
|
"@vitejs/plugin-vue": "^2.3.1",
|
|
39
39
|
"@vueuse/core": "^8.2.5",
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
"case": "^1.6.3",
|
|
42
42
|
"chokidar": "^3.5.3",
|
|
43
43
|
"connect": "^3.7.0",
|
|
44
|
-
"defu": "^
|
|
44
|
+
"defu": "^6.0.0",
|
|
45
45
|
"diacritics": "^1.3.0",
|
|
46
|
+
"flexsearch": "^0.7.21",
|
|
46
47
|
"floating-vue": "^2.0.0-beta.14",
|
|
47
48
|
"fs-extra": "^10.0.1",
|
|
48
49
|
"globby": "^13.1.1",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@peeky/test": "^0.13.5",
|
|
72
73
|
"@tailwindcss/typography": "^0.5.2",
|
|
74
|
+
"@types/flexsearch": "^0.7.3",
|
|
73
75
|
"@types/fs-extra": "^9.0.13",
|
|
74
76
|
"@types/markdown-it": "^12.2.3",
|
|
75
77
|
"@types/node": "^17.0.23",
|
package/scripts/copy.mjs
CHANGED
|
@@ -6,6 +6,7 @@ function toDist (file) {
|
|
|
6
6
|
return normalizePath(file).replace(/^src\//, 'dist/')
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
globbySync('src/client
|
|
9
|
+
globbySync('src/client/**/*').forEach((file) => {
|
|
10
|
+
if (file.endsWith('.ts') || file.endsWith('tsconfig.json')) return
|
|
10
11
|
fs.copy(file, toDist(file))
|
|
11
12
|
})
|
package/src/client/app/App.vue
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'HistoireApp',
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
1
7
|
<script lang="ts" setup>
|
|
2
8
|
// @ts-expect-error virtual module
|
|
3
9
|
import { files as rawFiles, tree as rawTree, onUpdate } from '$histoire-stories'
|
|
4
10
|
import StoryList from './components/tree/StoryList.vue'
|
|
5
11
|
import BaseSplitPane from './components/base/BaseSplitPane.vue'
|
|
6
|
-
import { computed, ref, watch
|
|
12
|
+
import { computed, ref, watch } from 'vue'
|
|
7
13
|
import AppHeader from './components/app/AppHeader.vue'
|
|
8
14
|
import type { StoryFile, Tree } from './types'
|
|
9
15
|
import { useStoryStore } from './stores/story'
|
|
@@ -13,8 +19,7 @@ import { histoireConfig } from './util/config.js'
|
|
|
13
19
|
import { onKeyboardShortcut } from './util/keyboard.js'
|
|
14
20
|
import { isMobile } from './util/responsive'
|
|
15
21
|
import Breadcrumb from './components/app/Breadcrumb.vue'
|
|
16
|
-
|
|
17
|
-
const SearchModal = defineAsyncComponent(() => import('./components/search/SearchModal.vue'))
|
|
22
|
+
import SearchModal from './components/search/SearchModal.vue'
|
|
18
23
|
|
|
19
24
|
const files = ref<StoryFile[]>(rawFiles.map(file => mapFile(file)))
|
|
20
25
|
const tree = ref<Tree>(rawTree)
|