histoire 0.2.5 → 0.3.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/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 +83 -21
- package/dist/client/app/codegen/vue3.js.map +1 -0
- package/dist/client/app/components/base/BaseEmpty.vue +17 -1
- package/dist/client/app/components/base/BaseOverflowMenu.vue +118 -0
- package/dist/client/app/components/base/BaseOverflowTab.vue +46 -0
- package/dist/client/app/components/exposed/Story.vue +33 -1
- package/dist/client/app/components/exposed/Variant.vue +19 -1
- package/dist/client/app/components/panel/PaneTabs.vue +64 -0
- package/dist/client/app/components/{story → panel}/StoryControls.vue +6 -1
- package/dist/client/app/components/{story → panel}/StoryDocs.vue +18 -11
- package/dist/client/app/components/panel/StoryEvent.vue +53 -0
- package/dist/client/app/components/panel/StoryEvents.vue +45 -0
- package/{src/client/app/components/story → dist/client/app/components/panel}/StorySidePanel.vue +17 -20
- package/{src/client/app/components/story → dist/client/app/components/panel}/StorySourceCode.vue +24 -14
- package/dist/client/app/components/sandbox/SandboxVue3.vue +16 -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 +8 -0
- package/dist/client/app/components/search/search-data.js.map +1 -0
- package/dist/client/app/components/story/StoryResponsivePreview.vue +9 -98
- package/dist/client/app/components/story/StoryVariantSingle.vue +109 -0
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +39 -0
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
- package/dist/client/app/components/story/StoryVariantSingleView.vue +13 -6
- package/dist/client/app/components/story/StoryView.vue +17 -3
- package/dist/client/app/components/story/StoryViewer.vue +2 -92
- package/dist/client/app/components/{story/toolbar → toolbar}/StoryVariantBackground.vue +3 -3
- package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantNewTab.vue +2 -2
- package/dist/client/app/components/{story/toolbar → toolbar}/StoryVariantResponsiveSize.vue +3 -3
- package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantTitle.vue +1 -1
- 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/global-components.js +1 -0
- package/dist/client/app/global-components.js.map +1 -0
- package/dist/client/app/index.js +1 -0
- package/dist/client/app/index.js.map +1 -0
- package/dist/client/app/router.d.ts +1 -0
- package/dist/client/app/router.js +3 -1
- package/dist/client/app/sandbox.js +12 -1
- package/dist/client/app/sandbox.js.map +1 -0
- package/dist/client/app/stores/events.d.ts +29 -0
- package/dist/client/app/stores/events.js +26 -0
- package/dist/client/app/stores/events.js.map +1 -0
- package/dist/client/app/stores/folder.d.ts +10 -0
- package/dist/client/app/stores/folder.js +48 -0
- package/dist/client/app/stores/folder.js.map +1 -0
- package/dist/client/app/stores/story.d.ts +41 -8
- package/dist/client/app/stores/story.js +21 -33
- package/dist/client/app/stores/story.js.map +1 -0
- package/dist/client/app/style/main.pcss +5 -0
- package/dist/client/app/style/sandbox.css +2 -0
- package/dist/client/app/style/transitions.pcss +13 -0
- package/dist/client/app/types.d.ts +4 -0
- package/dist/client/app/types.js +1 -0
- package/dist/client/app/types.js.map +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 +32 -0
- package/dist/client/app/util/events.js.map +1 -0
- package/dist/client/app/util/keyboard.js +1 -0
- package/dist/client/app/util/keyboard.js.map +1 -0
- package/dist/client/app/util/mapping.js +5 -2
- package/dist/client/app/util/mapping.js.map +1 -0
- package/dist/client/app/util/preview-settings.js +1 -0
- package/dist/client/app/util/preview-settings.js.map +1 -0
- package/dist/client/app/util/reactivity.js +1 -0
- package/dist/client/app/util/reactivity.js.map +1 -0
- package/dist/client/app/util/scroll.js +1 -0
- package/dist/client/app/util/scroll.js.map +1 -0
- package/dist/client/app/util/variant.js +1 -0
- package/dist/client/app/util/variant.js.map +1 -0
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +3 -1
- package/dist/client/index.js.map +1 -0
- package/dist/client/server/index.d.ts +7 -2
- package/dist/client/server/index.js +8 -26
- package/{src/client/server/Story.server.vue → dist/client/server/vue3/Story.vue} +14 -3
- package/dist/client/server/{Variant.server.vue → vue3/Variant.vue} +0 -0
- package/dist/client/server/vue3/run.d.ts +2 -0
- package/dist/client/server/vue3/run.js +33 -0
- package/dist/client/server/vue3/run.js.map +1 -0
- package/dist/controls.js +1 -0
- package/dist/controls.js.map +1 -0
- 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/collect/worker.js +6 -2
- 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 +174 -86
- package/package.json +7 -6
- 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/base/BaseOverflowMenu.vue +118 -0
- package/src/client/app/components/base/BaseOverflowTab.vue +46 -0
- package/src/client/app/components/exposed/Story.vue +33 -1
- package/src/client/app/components/exposed/Variant.vue +19 -1
- package/src/client/app/components/panel/PaneTabs.vue +64 -0
- package/src/client/app/components/{story → panel}/StoryControls.vue +6 -1
- package/src/client/app/components/{story → panel}/StoryDocs.vue +18 -11
- package/src/client/app/components/panel/StoryEvent.vue +53 -0
- package/src/client/app/components/panel/StoryEvents.vue +45 -0
- package/{dist/client/app/components/story → src/client/app/components/panel}/StorySidePanel.vue +17 -20
- package/{dist/client/app/components/story → src/client/app/components/panel}/StorySourceCode.vue +24 -14
- package/src/client/app/components/sandbox/SandboxVue3.vue +16 -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/StoryResponsivePreview.vue +9 -98
- package/src/client/app/components/story/StoryVariantSingle.vue +109 -0
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +39 -0
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
- package/src/client/app/components/story/StoryVariantSingleView.vue +13 -6
- package/src/client/app/components/story/StoryView.vue +17 -3
- package/src/client/app/components/story/StoryViewer.vue +2 -92
- package/src/client/app/components/{story/toolbar → toolbar}/StoryVariantBackground.vue +3 -3
- package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantNewTab.vue +2 -2
- package/src/client/app/components/{story/toolbar → toolbar}/StoryVariantResponsiveSize.vue +3 -3
- package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantTitle.vue +1 -1
- 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 +11 -1
- 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/style/transitions.pcss +13 -0
- package/src/client/app/types.ts +5 -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 +4 -2
- package/src/client/index.ts +4 -3
- package/src/client/server/index.ts +14 -27
- package/{dist/client/server/Story.server.vue → src/client/server/vue3/Story.vue} +14 -3
- package/src/client/server/{Variant.server.vue → vue3/Variant.vue} +0 -0
- package/{dist/client/server/index.ts → src/client/server/vue3/run.ts} +10 -4
- 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/collect/worker.ts +7 -2
- 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/shim.d.ts +0 -5
package/dist/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)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const voidElements: string[];
|
|
@@ -5,18 +5,22 @@ import { Text } from '@vue/runtime-core';
|
|
|
5
5
|
import { pascal } from 'case';
|
|
6
6
|
import { createAutoBuildingObject, indent } from './util';
|
|
7
7
|
import { serializeJs } from './serialize-js';
|
|
8
|
+
import { voidElements } from './const';
|
|
8
9
|
export async function generateSourceCode(variant) {
|
|
9
|
-
const vnode = variant.slots().default?.({ state: variant.state }) ?? [];
|
|
10
|
+
const vnode = variant.slots().default?.({ state: variant.state ?? {} }) ?? [];
|
|
10
11
|
const list = Array.isArray(vnode) ? vnode : [vnode];
|
|
11
12
|
const lines = [];
|
|
12
13
|
for (const vnode of list) {
|
|
13
|
-
lines.push(...await printVNode(vnode));
|
|
14
|
+
lines.push(...(await printVNode(vnode)).lines);
|
|
14
15
|
}
|
|
15
16
|
return lines.join('\n');
|
|
16
17
|
}
|
|
17
18
|
async function printVNode(vnode) {
|
|
18
19
|
if (vnode.type === Text) {
|
|
19
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
lines: [vnode.children],
|
|
22
|
+
isText: true,
|
|
23
|
+
};
|
|
20
24
|
}
|
|
21
25
|
const lines = [];
|
|
22
26
|
if (typeof vnode.type === 'object' || typeof vnode.type === 'string') {
|
|
@@ -41,6 +45,10 @@ async function printVNode(vnode) {
|
|
|
41
45
|
if (dir.arg) {
|
|
42
46
|
arg = `:${dir.arg}`;
|
|
43
47
|
}
|
|
48
|
+
if (valueCode) {
|
|
49
|
+
// Cleanup render code
|
|
50
|
+
valueCode = valueCode.replace(/^\$(setup|props|data)\./g, '');
|
|
51
|
+
}
|
|
44
52
|
const valueLines = valueCode ? [valueCode] : serializeAndCleanJs(dir.value);
|
|
45
53
|
const attr = [];
|
|
46
54
|
const dirAttr = `v-${dirName}${arg}${modifiers}="`;
|
|
@@ -72,11 +80,12 @@ async function printVNode(vnode) {
|
|
|
72
80
|
}
|
|
73
81
|
genDirective('model', dir, valueCode);
|
|
74
82
|
}
|
|
75
|
-
else {
|
|
83
|
+
else if (dir.instance._ || dir.instance.$) {
|
|
84
|
+
const target = dir.instance.$ ?? dir.instance._;
|
|
76
85
|
let dirName;
|
|
77
|
-
for (const directives of [
|
|
86
|
+
for (const directives of [target.directives, target.appContext.directives]) {
|
|
78
87
|
for (const key in directives) {
|
|
79
|
-
if (
|
|
88
|
+
if (target.directives[key] === dir.dir) {
|
|
80
89
|
dirName = key;
|
|
81
90
|
break;
|
|
82
91
|
}
|
|
@@ -129,10 +138,22 @@ async function printVNode(vnode) {
|
|
|
129
138
|
let serialized;
|
|
130
139
|
if (typeof value === 'string' && value.startsWith('{{') && value.endsWith('}}')) {
|
|
131
140
|
// It was formatted from auto building object (slot props)
|
|
132
|
-
serialized =
|
|
141
|
+
serialized = cleanupExpression(value.substring(2, value.length - 2).trim()).split('\n');
|
|
133
142
|
}
|
|
134
143
|
else if (typeof value === 'function') {
|
|
135
|
-
|
|
144
|
+
let code = cleanupExpression(value.toString().replace(/'/g, '\\\'').replace(/"/g, '\''));
|
|
145
|
+
const testResult = /function ([^\s]+)\(/.exec(code);
|
|
146
|
+
if (testResult) {
|
|
147
|
+
// Function name only
|
|
148
|
+
serialized = [testResult[1]];
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
if (code.startsWith('($event) => ')) {
|
|
152
|
+
// Remove unnecessary `($event) => `
|
|
153
|
+
code = code.substring('($event) => '.length);
|
|
154
|
+
}
|
|
155
|
+
serialized = code.split('\n');
|
|
156
|
+
}
|
|
136
157
|
}
|
|
137
158
|
else {
|
|
138
159
|
serialized = serializeAndCleanJs(value);
|
|
@@ -158,13 +179,42 @@ async function printVNode(vnode) {
|
|
|
158
179
|
// Tags
|
|
159
180
|
const tagName = getTagName(vnode);
|
|
160
181
|
// Children
|
|
182
|
+
let isChildText = false;
|
|
161
183
|
const childLines = [];
|
|
162
184
|
if (typeof vnode.children === 'string') {
|
|
163
|
-
|
|
185
|
+
if (tagName === 'pre') {
|
|
186
|
+
childLines.push(vnode.children);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
childLines.push(...vnode.children.split('\n'));
|
|
190
|
+
}
|
|
191
|
+
isChildText = true;
|
|
164
192
|
}
|
|
165
193
|
else if (Array.isArray(vnode.children)) {
|
|
194
|
+
let isAllChildText;
|
|
166
195
|
for (const child of vnode.children) {
|
|
167
|
-
|
|
196
|
+
const result = await printVNode(child);
|
|
197
|
+
if (result.isText) {
|
|
198
|
+
if (isAllChildText === undefined) {
|
|
199
|
+
isAllChildText = true;
|
|
200
|
+
}
|
|
201
|
+
const text = result.lines[0];
|
|
202
|
+
if (!childLines.length || /^\s/.test(text)) {
|
|
203
|
+
childLines.push(text.trim());
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
childLines[childLines.length - 1] += text;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
if (isAllChildText === undefined) {
|
|
211
|
+
isAllChildText = false;
|
|
212
|
+
}
|
|
213
|
+
childLines.push(...result.lines);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (isAllChildText !== undefined) {
|
|
217
|
+
isChildText = isAllChildText;
|
|
168
218
|
}
|
|
169
219
|
}
|
|
170
220
|
// Slots
|
|
@@ -180,7 +230,7 @@ async function printVNode(vnode) {
|
|
|
180
230
|
const children = vnode.children[key](autoObject.proxy);
|
|
181
231
|
const slotLines = [];
|
|
182
232
|
for (const child of children) {
|
|
183
|
-
slotLines.push(...await printVNode(child));
|
|
233
|
+
slotLines.push(...(await printVNode(child)).lines);
|
|
184
234
|
}
|
|
185
235
|
const slotProps = Object.keys(autoObject.cache);
|
|
186
236
|
if (slotProps.length) {
|
|
@@ -217,25 +267,33 @@ async function printVNode(vnode) {
|
|
|
217
267
|
tag[0] += '>';
|
|
218
268
|
}
|
|
219
269
|
}
|
|
270
|
+
const isVoid = voidElements.includes(tagName.toLowerCase());
|
|
220
271
|
if (childLines.length > 0) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
272
|
+
if (childLines.length === 1 && tag.length === 1 && !attrs.length && isChildText) {
|
|
273
|
+
lines.push(`${tag[0]}${childLines[0]}</${tagName}>`);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
lines.push(...tag);
|
|
277
|
+
lines.push(...indent(childLines));
|
|
278
|
+
lines.push(`</${tagName}>`);
|
|
279
|
+
}
|
|
224
280
|
}
|
|
225
281
|
else if (tag.length > 1) {
|
|
226
282
|
lines.push(...tag);
|
|
227
|
-
lines.push('/>');
|
|
283
|
+
lines.push(isVoid ? '>' : '/>');
|
|
228
284
|
}
|
|
229
285
|
else {
|
|
230
|
-
lines.push(`${tag[0]}
|
|
286
|
+
lines.push(`${tag[0]}${isVoid ? '' : ' /'}>`);
|
|
231
287
|
}
|
|
232
288
|
}
|
|
233
289
|
else if (vnode?.shapeFlag & 1 << 4) {
|
|
234
290
|
for (const child of vnode.children) {
|
|
235
|
-
lines.push(...await printVNode(child));
|
|
291
|
+
lines.push(...(await printVNode(child)).lines);
|
|
236
292
|
}
|
|
237
293
|
}
|
|
238
|
-
return
|
|
294
|
+
return {
|
|
295
|
+
lines,
|
|
296
|
+
};
|
|
239
297
|
}
|
|
240
298
|
function getTagName(vnode) {
|
|
241
299
|
if (typeof vnode.type === 'string') {
|
|
@@ -254,7 +312,7 @@ function getTagName(vnode) {
|
|
|
254
312
|
return 'Anonymous';
|
|
255
313
|
}
|
|
256
314
|
function getNameFromFile(file) {
|
|
257
|
-
const parts =
|
|
315
|
+
const parts = /([^/]+)\.vue$/.exec(file);
|
|
258
316
|
if (parts) {
|
|
259
317
|
return pascal(parts[1]);
|
|
260
318
|
}
|
|
@@ -264,9 +322,13 @@ function serializeAndCleanJs(value) {
|
|
|
264
322
|
const isAutoBuildingObject = !!value?.__autoBuildingObject;
|
|
265
323
|
const result = serializeJs(value);
|
|
266
324
|
if (isAutoBuildingObject) {
|
|
267
|
-
return [result.__autoBuildingObjectGetKey];
|
|
325
|
+
return [cleanupExpression(result.__autoBuildingObjectGetKey)];
|
|
268
326
|
}
|
|
269
327
|
else {
|
|
270
|
-
return result
|
|
328
|
+
return cleanupExpression(result).split('\n');
|
|
271
329
|
}
|
|
272
330
|
}
|
|
331
|
+
function cleanupExpression(expr) {
|
|
332
|
+
return expr.replace(/\$setup\./g, '');
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue3.js","sourceRoot":"","sources":["../../../../src/client/app/codegen/vue3.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,kDAAkD;AAElD,OAAO,EAAS,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAE,OAAgB;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,K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AAA;KACvB;SAAM,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE;QAC7B,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;KAC1C;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,SAAS,eAAe,CAAE,IAAY;IACpC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxC,IAAI,KAAK,EAAE;QACT,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;KACxB;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,SAAS,mBAAmB,CAAE,KAAU;IACtC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,CAAA;IAC1D,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;IACjC,IAAI,oBAAoB,EAAE;QACxB,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAA;KAC9D;SAAM;QACL,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;KAC7C;AACH,CAAC;AAED,SAAS,iBAAiB,CAAE,IAAY;IACtC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AACvC,CAAC"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 htw-text-lg">
|
|
2
|
+
<div class="htw-base-empty htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 htw-text-lg">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
|
+
|
|
7
|
+
<style scoped>
|
|
8
|
+
.htw-base-empty {
|
|
9
|
+
animation: htw-base-empty .3s 1s both;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@keyframes htw-base-empty {
|
|
13
|
+
0% {
|
|
14
|
+
opacity: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
100% {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, h, onBeforeUnmount, reactive, computed } from 'vue'
|
|
3
|
+
import { useResizeObserver } from '@vueuse/core'
|
|
4
|
+
import { Icon } from '@iconify/vue'
|
|
5
|
+
|
|
6
|
+
// Container
|
|
7
|
+
|
|
8
|
+
const overflowButtonWidth = 32
|
|
9
|
+
|
|
10
|
+
const el = ref<HTMLDivElement>()
|
|
11
|
+
|
|
12
|
+
const availableWidth = ref(0)
|
|
13
|
+
|
|
14
|
+
useResizeObserver(el, (entries) => {
|
|
15
|
+
const containerWidth = entries[0].contentRect.width
|
|
16
|
+
availableWidth.value = containerWidth - overflowButtonWidth
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
// Children
|
|
20
|
+
|
|
21
|
+
interface ChildState {
|
|
22
|
+
width: number
|
|
23
|
+
index: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const children = ref(new Map<HTMLElement, ChildState>())
|
|
27
|
+
|
|
28
|
+
const visibleChildrenCount = computed(() => {
|
|
29
|
+
let width = 0
|
|
30
|
+
const c = [...children.value.values()].sort((a, b) => a.index - b.index)
|
|
31
|
+
for (let i = 0; i < c.length; i++) {
|
|
32
|
+
width += c[i].width
|
|
33
|
+
if (width > availableWidth.value) {
|
|
34
|
+
return i
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return c.length
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Watches for the size of each child and automatically hide them
|
|
42
|
+
*/
|
|
43
|
+
const ChildWrapper = {
|
|
44
|
+
props: ['index'],
|
|
45
|
+
setup (props, { slots }) {
|
|
46
|
+
const el = ref<HTMLDivElement>()
|
|
47
|
+
|
|
48
|
+
const state = reactive({ width: 0, index: props.index })
|
|
49
|
+
|
|
50
|
+
useResizeObserver(el, (entries) => {
|
|
51
|
+
const width = entries[0].contentRect.width
|
|
52
|
+
if (!children.value.has(el.value)) {
|
|
53
|
+
children.value.set(el.value, state)
|
|
54
|
+
}
|
|
55
|
+
state.width = width
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
onBeforeUnmount(() => {
|
|
59
|
+
children.value.delete(el.value)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const visible = computed(() => visibleChildrenCount.value > state.index)
|
|
63
|
+
|
|
64
|
+
return () => h('div', { ref: el, style: { visibility: visible.value ? 'visible' : 'hidden' } }, slots.default())
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Wraps each child with a <ChildWrapper>
|
|
70
|
+
*/
|
|
71
|
+
const ChildrenRender = (props, { slots }) => {
|
|
72
|
+
const [fragment] = slots.default()
|
|
73
|
+
return fragment.children.map((vnode, index) => h(ChildWrapper, { index }, [vnode]))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Only renders a part of a children list
|
|
78
|
+
*/
|
|
79
|
+
const ChildrenSlice = (props, { slots }) => {
|
|
80
|
+
const [fragment] = slots.default()
|
|
81
|
+
return fragment.children.slice(props.start, props.end)
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<template>
|
|
86
|
+
<div
|
|
87
|
+
ref="el"
|
|
88
|
+
class="htw-flex htw-overflow-hidden htw-relative"
|
|
89
|
+
>
|
|
90
|
+
<ChildrenRender>
|
|
91
|
+
<slot />
|
|
92
|
+
</ChildrenRender>
|
|
93
|
+
|
|
94
|
+
<VDropdown
|
|
95
|
+
v-if="visibleChildrenCount < children.size"
|
|
96
|
+
>
|
|
97
|
+
<div
|
|
98
|
+
role="button"
|
|
99
|
+
class="htw-cursor-pointer hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-w-8 htw-h-full htw-flex htw-items-center htw-justify-center htw-absolute htw-top-0 htw-right-0"
|
|
100
|
+
>
|
|
101
|
+
<Icon
|
|
102
|
+
icon="carbon:caret-down"
|
|
103
|
+
class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<template #popper>
|
|
108
|
+
<div class="htw-flex htw-flex-col htw-items-stretch">
|
|
109
|
+
<ChildrenSlice
|
|
110
|
+
:start="visibleChildrenCount"
|
|
111
|
+
>
|
|
112
|
+
<slot name="overflow" />
|
|
113
|
+
</ChildrenSlice>
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
</VDropdown>
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
|
|
7
|
+
props: {
|
|
8
|
+
exact: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false,
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
matched: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: null,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<router-link
|
|
23
|
+
v-slot="{ isActive, isExactActive, href, navigate }"
|
|
24
|
+
v-bind="$attrs"
|
|
25
|
+
custom
|
|
26
|
+
>
|
|
27
|
+
<a
|
|
28
|
+
v-bind="$attrs"
|
|
29
|
+
:href="href"
|
|
30
|
+
class="htw-px-4 htw-h-10 htw-min-w-[150px] htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative htw-text-gray-900 dark:htw-text-gray-100"
|
|
31
|
+
:class="{
|
|
32
|
+
'htw-text-primary-500 dark:htw-text-primary-400': matched != null ? matched : (exact && isExactActive) || (!exact && isActive),
|
|
33
|
+
}"
|
|
34
|
+
@click="navigate"
|
|
35
|
+
>
|
|
36
|
+
<slot />
|
|
37
|
+
|
|
38
|
+
<transition name="__histoire-scale-y">
|
|
39
|
+
<div
|
|
40
|
+
v-if="matched != null ? matched : (exact && isExactActive) || (!exact && isActive)"
|
|
41
|
+
class="htw-absolute htw-top-0 htw-left-0 htw-h-full htw-w-[2px] htw-bg-primary-500 dark:htw-bg-primary-400"
|
|
42
|
+
/>
|
|
43
|
+
</transition>
|
|
44
|
+
</a>
|
|
45
|
+
</router-link>
|
|
46
|
+
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { computed, defineComponent, provide, useAttrs, VNode, h, PropType } from 'vue'
|
|
2
|
+
import { computed, defineComponent, provide, useAttrs, VNode, h, PropType, getCurrentInstance } from 'vue'
|
|
3
3
|
import { Story } from '../../types.js'
|
|
4
4
|
import Variant from './Variant.vue'
|
|
5
5
|
|
|
@@ -18,6 +18,8 @@ export default defineComponent({
|
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
setup () {
|
|
21
|
+
const vm = getCurrentInstance()
|
|
22
|
+
|
|
21
23
|
const attrs = useAttrs() as {
|
|
22
24
|
story: Story
|
|
23
25
|
}
|
|
@@ -25,12 +27,42 @@ export default defineComponent({
|
|
|
25
27
|
const story = computed(() => attrs.story)
|
|
26
28
|
provide('story', story)
|
|
27
29
|
|
|
30
|
+
const storyComponent: any = vm.parent
|
|
31
|
+
// Allows tracking reactivity with watchers to sync state
|
|
32
|
+
const implicitState = {
|
|
33
|
+
$data: storyComponent.data,
|
|
34
|
+
}
|
|
35
|
+
function addImplicitState (key, value) {
|
|
36
|
+
if (typeof value === 'function' || (value && value.__file)) {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
implicitState[key] = value
|
|
40
|
+
}
|
|
41
|
+
// From `<script setup>`'s `defineExpose`
|
|
42
|
+
for (const key in storyComponent.exposed) {
|
|
43
|
+
addImplicitState(key, storyComponent.exposed[key])
|
|
44
|
+
}
|
|
45
|
+
// We needs __VUE_PROD_DEVTOOLS__ flag set to `true` to enable `devtoolsRawSetupState`
|
|
46
|
+
for (const key in storyComponent.devtoolsRawSetupState) {
|
|
47
|
+
addImplicitState(key, storyComponent.devtoolsRawSetupState[key])
|
|
48
|
+
}
|
|
49
|
+
provide('implicitState', () => implicitState)
|
|
50
|
+
|
|
51
|
+
function updateStory () {
|
|
52
|
+
Object.assign(attrs.story, {
|
|
53
|
+
slots: () => vm.proxy.$slots,
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
28
57
|
return {
|
|
29
58
|
story,
|
|
59
|
+
updateStory,
|
|
30
60
|
}
|
|
31
61
|
},
|
|
32
62
|
|
|
33
63
|
render () {
|
|
64
|
+
this.updateStory()
|
|
65
|
+
|
|
34
66
|
const [firstVariant] = this.story.variants
|
|
35
67
|
if (firstVariant.id === '_default') {
|
|
36
68
|
return h(Variant, {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { defineComponent, getCurrentInstance, PropType, useAttrs } from 'vue'
|
|
2
|
+
import { defineComponent, getCurrentInstance, inject, PropType, useAttrs, watch } from 'vue'
|
|
3
3
|
import { Variant } from '../../types'
|
|
4
4
|
|
|
5
|
+
// const logLocation = location.href.includes('__sandbox') ? '[Sandbox]' : '[Host]'
|
|
6
|
+
|
|
5
7
|
export default defineComponent({
|
|
6
8
|
// eslint-disable-next-line vue/multi-word-component-names
|
|
7
9
|
name: 'Variant',
|
|
@@ -22,6 +24,11 @@ export default defineComponent({
|
|
|
22
24
|
type: Boolean,
|
|
23
25
|
default: false,
|
|
24
26
|
},
|
|
27
|
+
|
|
28
|
+
setupApp: {
|
|
29
|
+
type: Function,
|
|
30
|
+
default: null,
|
|
31
|
+
},
|
|
25
32
|
},
|
|
26
33
|
|
|
27
34
|
setup (props) {
|
|
@@ -31,6 +38,16 @@ export default defineComponent({
|
|
|
31
38
|
|
|
32
39
|
const vm = getCurrentInstance()
|
|
33
40
|
|
|
41
|
+
const implicitState = inject<() => any>('implicitState')
|
|
42
|
+
|
|
43
|
+
watch(() => implicitState, value => {
|
|
44
|
+
if (typeof props.initState !== 'function') {
|
|
45
|
+
attrs.variant.state = value()
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
immediate: true,
|
|
49
|
+
})
|
|
50
|
+
|
|
34
51
|
function updateVariant () {
|
|
35
52
|
Object.assign(attrs.variant, {
|
|
36
53
|
initState: async () => {
|
|
@@ -41,6 +58,7 @@ export default defineComponent({
|
|
|
41
58
|
slots: () => vm.proxy.$slots,
|
|
42
59
|
source: props.source,
|
|
43
60
|
responsiveDisabled: props.responsiveDisabled,
|
|
61
|
+
setupApp: props.setupApp,
|
|
44
62
|
configReady: true,
|
|
45
63
|
})
|
|
46
64
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import BaseTab from '../base/BaseTab.vue'
|
|
3
|
+
import { useEventsStore } from '../../stores/events'
|
|
4
|
+
import BaseOverflowMenu from '../base/BaseOverflowMenu.vue'
|
|
5
|
+
import BaseOverflowTab from '../base/BaseOverflowTab.vue'
|
|
6
|
+
|
|
7
|
+
const eventsStore = useEventsStore()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<BaseOverflowMenu class="htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750">
|
|
12
|
+
<BaseTab
|
|
13
|
+
:to="{ ...$route, query: { ...$route.query, tab: '' } }"
|
|
14
|
+
:matched="!$route.query.tab"
|
|
15
|
+
>
|
|
16
|
+
Controls
|
|
17
|
+
</BaseTab>
|
|
18
|
+
<BaseTab
|
|
19
|
+
:to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
|
|
20
|
+
:matched="$route.query.tab === 'docs'"
|
|
21
|
+
>
|
|
22
|
+
Docs
|
|
23
|
+
</BaseTab>
|
|
24
|
+
<BaseTab
|
|
25
|
+
:to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
|
|
26
|
+
:matched="$route.query.tab === 'events'"
|
|
27
|
+
>
|
|
28
|
+
Events
|
|
29
|
+
<span
|
|
30
|
+
v-if="eventsStore.unseen"
|
|
31
|
+
class="htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
|
|
32
|
+
>
|
|
33
|
+
{{ eventsStore.unseen <=99 ? eventsStore.unseen : "99+" }}
|
|
34
|
+
</span>
|
|
35
|
+
</BaseTab>
|
|
36
|
+
|
|
37
|
+
<template #overflow>
|
|
38
|
+
<BaseOverflowTab
|
|
39
|
+
:to="{ ...$route, query: { ...$route.query, tab: '' } }"
|
|
40
|
+
:matched="!$route.query.tab"
|
|
41
|
+
>
|
|
42
|
+
Controls
|
|
43
|
+
</BaseOverflowTab>
|
|
44
|
+
<BaseOverflowTab
|
|
45
|
+
:to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
|
|
46
|
+
:matched="$route.query.tab === 'docs'"
|
|
47
|
+
>
|
|
48
|
+
Docs
|
|
49
|
+
</BaseOverflowTab>
|
|
50
|
+
<BaseOverflowTab
|
|
51
|
+
:to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
|
|
52
|
+
:matched="$route.query.tab === 'events'"
|
|
53
|
+
>
|
|
54
|
+
Events
|
|
55
|
+
<span
|
|
56
|
+
v-if="eventsStore.unseen"
|
|
57
|
+
class="htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
|
|
58
|
+
>
|
|
59
|
+
{{ eventsStore.unseen <=99 ? eventsStore.unseen : "99+" }}
|
|
60
|
+
</span>
|
|
61
|
+
</BaseOverflowTab>
|
|
62
|
+
</template>
|
|
63
|
+
</BaseOverflowMenu>
|
|
64
|
+
</template>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { PropType } from 'vue'
|
|
3
|
+
import { Icon } from '@iconify/vue'
|
|
3
4
|
import type { Story, Variant } from '../../types'
|
|
4
5
|
import SandboxVue3 from '../sandbox/SandboxVue3.vue'
|
|
5
6
|
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
@@ -21,13 +22,17 @@ defineProps({
|
|
|
21
22
|
<div data-test-id="story-controls">
|
|
22
23
|
<!-- Custom controls -->
|
|
23
24
|
<SandboxVue3
|
|
24
|
-
v-if="variant.slots().controls"
|
|
25
|
+
v-if="variant.slots().controls || story.slots().controls"
|
|
25
26
|
slot-name="controls"
|
|
26
27
|
:variant="variant"
|
|
27
28
|
:story="story"
|
|
28
29
|
/>
|
|
29
30
|
|
|
30
31
|
<BaseEmpty v-else>
|
|
32
|
+
<Icon
|
|
33
|
+
icon="carbon:audio-console"
|
|
34
|
+
class="htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
35
|
+
/>
|
|
31
36
|
<span>No controls available for this story</span>
|
|
32
37
|
</BaseEmpty>
|
|
33
38
|
</div>
|