histoire 0.0.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/bin.mjs +4 -0
- package/dist/client/app/App.vue +51 -0
- package/dist/client/app/components/HomeView.vue +3 -0
- package/dist/client/app/components/SandboxVue.vue +57 -0
- package/dist/client/app/components/StoryControls.vue +29 -0
- package/dist/client/app/components/StoryList.vue +22 -0
- package/dist/client/app/components/StoryListItem.vue +34 -0
- package/dist/client/app/components/StoryVariantGridItem.vue +56 -0
- package/dist/client/app/components/StoryVariantItem.vue +29 -0
- package/dist/client/app/components/StoryVariantSingleView.vue +43 -0
- package/dist/client/app/components/StoryView.vue +132 -0
- package/dist/client/app/components/base/BaseEmpty.vue +5 -0
- package/dist/client/app/components/base/BaseSplitPane.vue +203 -0
- package/dist/client/app/components/exposed/Story.vue +77 -0
- package/dist/client/app/components/exposed/Variant.vue +75 -0
- package/dist/client/app/composable/variant.d.ts +18 -0
- package/dist/client/app/composable/variant.js +18 -0
- package/dist/client/app/composable/variant.js.map +1 -0
- package/dist/client/app/global-components.d.ts +2 -0
- package/dist/client/app/global-components.js +9 -0
- package/dist/client/app/global-components.js.map +1 -0
- package/dist/client/app/index.d.ts +1 -0
- package/dist/client/app/index.js +14 -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 +17 -0
- package/dist/client/app/router.js.map +1 -0
- package/dist/client/app/stores/story.d.ts +161 -0
- package/dist/client/app/stores/story.js +29 -0
- package/dist/client/app/stores/story.js.map +1 -0
- package/dist/client/app/style/floating-vue.css +1 -0
- package/dist/client/app/style/main.css +37 -0
- package/dist/client/app/types.d.ts +20 -0
- package/dist/client/app/types.js +2 -0
- package/dist/client/app/types.js.map +1 -0
- package/dist/node/alias.d.ts +2 -0
- package/dist/node/alias.js +6 -0
- package/dist/node/alias.js.map +1 -0
- package/dist/node/bin.d.ts +1 -0
- package/dist/node/bin.js +17 -0
- package/dist/node/bin.js.map +1 -0
- package/dist/node/commands/dev.d.ts +4 -0
- package/dist/node/commands/dev.js +15 -0
- package/dist/node/commands/dev.js.map +1 -0
- package/dist/node/config.d.ts +4 -0
- package/dist/node/config.js +2 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/context.d.ts +4 -0
- package/dist/node/context.js +2 -0
- package/dist/node/context.js.map +1 -0
- package/dist/node/index.d.ts +0 -0
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/plugin.d.ts +5 -0
- package/dist/node/plugin.js +83 -0
- package/dist/node/plugin.js.map +1 -0
- package/dist/node/server.d.ts +2 -0
- package/dist/node/server.js +36 -0
- package/dist/node/server.js.map +1 -0
- package/dist/node/stories.d.ts +10 -0
- package/dist/node/stories.js +43 -0
- package/dist/node/stories.js.map +1 -0
- package/dist/style.css +607 -0
- package/package.json +60 -0
- package/postcss.config.cjs +8 -0
- package/scripts/watchAndCopy.mjs +15 -0
- package/src/client/app/App.vue +51 -0
- package/src/client/app/components/HomeView.vue +3 -0
- package/src/client/app/components/SandboxVue.vue +57 -0
- package/src/client/app/components/StoryControls.vue +29 -0
- package/src/client/app/components/StoryList.vue +22 -0
- package/src/client/app/components/StoryListItem.vue +34 -0
- package/src/client/app/components/StoryVariantGridItem.vue +56 -0
- package/src/client/app/components/StoryVariantItem.vue +29 -0
- package/src/client/app/components/StoryVariantSingleView.vue +43 -0
- package/src/client/app/components/StoryView.vue +132 -0
- package/src/client/app/components/base/BaseEmpty.vue +5 -0
- package/src/client/app/components/base/BaseSplitPane.vue +203 -0
- package/src/client/app/components/exposed/Story.vue +77 -0
- package/src/client/app/components/exposed/Variant.vue +75 -0
- package/src/client/app/composable/variant.ts +20 -0
- package/src/client/app/global-components.ts +10 -0
- package/src/client/app/index.ts +15 -0
- package/src/client/app/router.ts +17 -0
- package/src/client/app/stores/story.ts +34 -0
- package/src/client/app/style/floating-vue.css +1 -0
- package/src/client/app/style/main.css +37 -0
- package/src/client/app/types.ts +21 -0
- package/src/client/shim.d.ts +5 -0
- package/src/node/alias.ts +7 -0
- package/src/node/bin.ts +21 -0
- package/src/node/commands/dev.ts +21 -0
- package/src/node/config.ts +4 -0
- package/src/node/context.ts +5 -0
- package/src/node/index.ts +0 -0
- package/src/node/plugin.ts +92 -0
- package/src/node/server.ts +37 -0
- package/src/node/stories.ts +55 -0
- package/tailwind.config.cjs +9 -0
- package/tsconfig.json +39 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, onBeforeMount, onBeforeUnmount, PropType, provide, ref, useAttrs } from 'vue'
|
|
3
|
+
import { useStoryStore } from '../../stores/story.js'
|
|
4
|
+
import { Story, Variant } from '../../types.js'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
|
|
9
|
+
props: {
|
|
10
|
+
title: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
layout: {
|
|
16
|
+
type: Object as PropType<Story['layout']>,
|
|
17
|
+
default: () => ({ type: 'single' }),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
setup (props) {
|
|
22
|
+
const attrs = useAttrs() as {
|
|
23
|
+
data: {
|
|
24
|
+
id: string
|
|
25
|
+
reloadHandlers: (() => unknown)[]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Story
|
|
30
|
+
|
|
31
|
+
const storyStore = useStoryStore()
|
|
32
|
+
|
|
33
|
+
const story = ref<Story>(null)
|
|
34
|
+
|
|
35
|
+
onBeforeMount(() => {
|
|
36
|
+
story.value = storyStore.addStory({
|
|
37
|
+
id: attrs.data.id,
|
|
38
|
+
title: props.title,
|
|
39
|
+
layout: props.layout,
|
|
40
|
+
variants: [],
|
|
41
|
+
mountTime: Date.now(),
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
storyStore.removeStory(story.value)
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
// Variants
|
|
50
|
+
|
|
51
|
+
provide('story', story)
|
|
52
|
+
|
|
53
|
+
provide('addVariant', (variant: Variant) => {
|
|
54
|
+
story.value.variants.push(variant)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
provide('removeVariant', (variant: Variant) => {
|
|
58
|
+
const index = story.value.variants.indexOf(variant)
|
|
59
|
+
if (index !== -1) {
|
|
60
|
+
story.value.variants.splice(index, 1)
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
story,
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
render () {
|
|
70
|
+
Object.assign(this.story, {
|
|
71
|
+
title: this.title,
|
|
72
|
+
layout: this.layout,
|
|
73
|
+
})
|
|
74
|
+
return this.$slots.default()
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, inject, onBeforeMount, onBeforeUnmount, PropType, reactive, Ref, ref } from 'vue'
|
|
3
|
+
import { Story, Variant } from '../../types'
|
|
4
|
+
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
props: {
|
|
7
|
+
title: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
initState: {
|
|
13
|
+
type: Function as PropType<() => any | Promise<any>>,
|
|
14
|
+
default: null,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
setup (props) {
|
|
19
|
+
const story = inject<Ref<Story>>('story')
|
|
20
|
+
|
|
21
|
+
function generateId () {
|
|
22
|
+
let index = 0
|
|
23
|
+
const idMap = story.value.variants.reduce((acc, variant) => {
|
|
24
|
+
acc[variant.id] = true
|
|
25
|
+
return acc
|
|
26
|
+
}, {} as Record<string, boolean>)
|
|
27
|
+
while (idMap[`${story.value.id}-${index}`]) {
|
|
28
|
+
index++
|
|
29
|
+
}
|
|
30
|
+
return `${story.value.id}-${index}`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getVariantData () {
|
|
34
|
+
return {
|
|
35
|
+
title: props.title,
|
|
36
|
+
initState: async () => {
|
|
37
|
+
if (typeof props.initState === 'function') {
|
|
38
|
+
variant.value.state = await props.initState()
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
slots: () => null,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const variant = ref<Variant>(null)
|
|
46
|
+
|
|
47
|
+
const addVariant = inject('addVariant') as (variant: Variant) => void
|
|
48
|
+
onBeforeMount(() => {
|
|
49
|
+
variant.value = {
|
|
50
|
+
id: generateId(),
|
|
51
|
+
state: reactive<any>({}),
|
|
52
|
+
...getVariantData(),
|
|
53
|
+
}
|
|
54
|
+
addVariant(variant.value)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const removeVariant = inject('removeVariant') as (variant: Variant) => void
|
|
58
|
+
onBeforeUnmount(() => {
|
|
59
|
+
removeVariant(variant.value)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
variant,
|
|
64
|
+
getVariantData,
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
render () {
|
|
69
|
+
Object.assign(this.variant, this.getVariantData(), {
|
|
70
|
+
slots: () => this.$slots,
|
|
71
|
+
})
|
|
72
|
+
return null
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Variant } from '../types';
|
|
3
|
+
export declare function useCurrentVariantRoute(variant: Ref<Variant>): {
|
|
4
|
+
isActive: import("vue").ComputedRef<boolean>;
|
|
5
|
+
targetRoute: import("vue").ComputedRef<{
|
|
6
|
+
query: {
|
|
7
|
+
variantId: string;
|
|
8
|
+
};
|
|
9
|
+
matched: import("vue-router").RouteLocationMatched[];
|
|
10
|
+
path: string;
|
|
11
|
+
fullPath: string;
|
|
12
|
+
hash: string;
|
|
13
|
+
name: import("vue-router").RouteRecordName;
|
|
14
|
+
params: import("vue-router").RouteParams;
|
|
15
|
+
redirectedFrom: import("vue-router").RouteLocation;
|
|
16
|
+
meta: import("vue-router").RouteMeta;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useRoute } from 'vue-router';
|
|
3
|
+
export function useCurrentVariantRoute(variant) {
|
|
4
|
+
const route = useRoute();
|
|
5
|
+
const isActive = computed(() => route.query.variantId === variant.value.id);
|
|
6
|
+
const targetRoute = computed(() => ({
|
|
7
|
+
...route,
|
|
8
|
+
query: {
|
|
9
|
+
...route.query,
|
|
10
|
+
variantId: variant.value.id,
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
return {
|
|
14
|
+
isActive,
|
|
15
|
+
targetRoute,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=variant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant.js","sourceRoot":"","sources":["../../../../src/client/app/composable/variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAO,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,MAAM,UAAU,sBAAsB,CAAE,OAAqB;IAC3D,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC3E,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,GAAG,KAAK;QACR,KAAK,EAAE;YACL,GAAG,KAAK,CAAC,KAAK;YACd,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE;SAC5B;KACF,CAAC,CAAC,CAAA;IAEH,OAAO;QACL,QAAQ;QACR,WAAW;KACZ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Story from './components/exposed/Story.vue';
|
|
2
|
+
import Variant from './components/exposed/Variant.vue';
|
|
3
|
+
export function registerGlobalComponents(app) {
|
|
4
|
+
// eslint-disable-next-line vue/multi-word-component-names
|
|
5
|
+
app.component('Story', Story);
|
|
6
|
+
// eslint-disable-next-line vue/multi-word-component-names
|
|
7
|
+
app.component('Variant', Variant);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=global-components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-components.js","sourceRoot":"","sources":["../../../src/client/app/global-components.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,gCAAgC,CAAA;AAClD,OAAO,OAAO,MAAM,kCAAkC,CAAA;AAEtD,MAAM,UAAU,wBAAwB,CAAE,GAAQ;IAChD,0DAA0D;IAC1D,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC7B,0DAA0D;IAC1D,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../style.css';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../../style.css';
|
|
2
|
+
import { createApp } from 'vue';
|
|
3
|
+
import { createPinia } from 'pinia';
|
|
4
|
+
import FloatingVue from 'floating-vue';
|
|
5
|
+
import App from './App.vue';
|
|
6
|
+
import { registerGlobalComponents } from './global-components.js';
|
|
7
|
+
import { router } from './router';
|
|
8
|
+
const app = createApp(App);
|
|
9
|
+
app.use(createPinia());
|
|
10
|
+
app.use(FloatingVue);
|
|
11
|
+
app.use(router);
|
|
12
|
+
registerGlobalComponents(app);
|
|
13
|
+
app.mount('#app');
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,GAAG,MAAM,WAAW,CAAA;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;AACtB,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AACpB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACf,wBAAwB,CAAC,GAAG,CAAC,CAAA;AAC7B,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const router: import("vue-router").Router;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
|
+
export const router = createRouter({
|
|
3
|
+
history: createWebHistory(),
|
|
4
|
+
routes: [
|
|
5
|
+
{
|
|
6
|
+
path: '/',
|
|
7
|
+
name: 'home',
|
|
8
|
+
component: () => import('./components/HomeView.vue'),
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
path: '/story/:storyId',
|
|
12
|
+
name: 'story',
|
|
13
|
+
component: () => import('./components/StoryView.vue'),
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../src/client/app/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC;IACjC,OAAO,EAAE,gBAAgB,EAAE;IAC3B,MAAM,EAAE;QACN;YACE,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,2BAA2B,CAAC;SACrD;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,4BAA4B,CAAC;SACtD;KACF;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Story } from '../types';
|
|
2
|
+
export declare const useStoryStore: import("pinia").StoreDefinition<"story", import("pinia")._UnwrapAll<Pick<{
|
|
3
|
+
stories: import("vue").Ref<{
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
variants: {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
initState: () => any;
|
|
10
|
+
slots: () => Readonly<any>;
|
|
11
|
+
state: any;
|
|
12
|
+
}[];
|
|
13
|
+
layout?: {
|
|
14
|
+
type: "single";
|
|
15
|
+
} | {
|
|
16
|
+
type: "grid";
|
|
17
|
+
width: number;
|
|
18
|
+
};
|
|
19
|
+
lastSelectedVariant?: {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
initState: () => any;
|
|
23
|
+
slots: () => Readonly<any>;
|
|
24
|
+
state: any;
|
|
25
|
+
};
|
|
26
|
+
mountTime: number;
|
|
27
|
+
}[]>;
|
|
28
|
+
addStory: (story: Story) => Story;
|
|
29
|
+
removeStory: (story: Story) => void;
|
|
30
|
+
currentStory: import("vue").ComputedRef<{
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
variants: {
|
|
34
|
+
id: string;
|
|
35
|
+
title: string;
|
|
36
|
+
initState: () => any;
|
|
37
|
+
slots: () => Readonly<any>;
|
|
38
|
+
state: any;
|
|
39
|
+
}[];
|
|
40
|
+
layout?: {
|
|
41
|
+
type: "single";
|
|
42
|
+
} | {
|
|
43
|
+
type: "grid";
|
|
44
|
+
width: number;
|
|
45
|
+
};
|
|
46
|
+
lastSelectedVariant?: {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
initState: () => any;
|
|
50
|
+
slots: () => Readonly<any>;
|
|
51
|
+
state: any;
|
|
52
|
+
};
|
|
53
|
+
mountTime: number;
|
|
54
|
+
}>;
|
|
55
|
+
}, "stories">>, import("pinia")._UnwrapAll<Pick<{
|
|
56
|
+
stories: import("vue").Ref<{
|
|
57
|
+
id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
variants: {
|
|
60
|
+
id: string;
|
|
61
|
+
title: string;
|
|
62
|
+
initState: () => any;
|
|
63
|
+
slots: () => Readonly<any>;
|
|
64
|
+
state: any;
|
|
65
|
+
}[];
|
|
66
|
+
layout?: {
|
|
67
|
+
type: "single";
|
|
68
|
+
} | {
|
|
69
|
+
type: "grid";
|
|
70
|
+
width: number;
|
|
71
|
+
};
|
|
72
|
+
lastSelectedVariant?: {
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
initState: () => any;
|
|
76
|
+
slots: () => Readonly<any>;
|
|
77
|
+
state: any;
|
|
78
|
+
};
|
|
79
|
+
mountTime: number;
|
|
80
|
+
}[]>;
|
|
81
|
+
addStory: (story: Story) => Story;
|
|
82
|
+
removeStory: (story: Story) => void;
|
|
83
|
+
currentStory: import("vue").ComputedRef<{
|
|
84
|
+
id: string;
|
|
85
|
+
title: string;
|
|
86
|
+
variants: {
|
|
87
|
+
id: string;
|
|
88
|
+
title: string;
|
|
89
|
+
initState: () => any;
|
|
90
|
+
slots: () => Readonly<any>;
|
|
91
|
+
state: any;
|
|
92
|
+
}[];
|
|
93
|
+
layout?: {
|
|
94
|
+
type: "single";
|
|
95
|
+
} | {
|
|
96
|
+
type: "grid";
|
|
97
|
+
width: number;
|
|
98
|
+
};
|
|
99
|
+
lastSelectedVariant?: {
|
|
100
|
+
id: string;
|
|
101
|
+
title: string;
|
|
102
|
+
initState: () => any;
|
|
103
|
+
slots: () => Readonly<any>;
|
|
104
|
+
state: any;
|
|
105
|
+
};
|
|
106
|
+
mountTime: number;
|
|
107
|
+
}>;
|
|
108
|
+
}, "currentStory">>, Pick<{
|
|
109
|
+
stories: import("vue").Ref<{
|
|
110
|
+
id: string;
|
|
111
|
+
title: string;
|
|
112
|
+
variants: {
|
|
113
|
+
id: string;
|
|
114
|
+
title: string;
|
|
115
|
+
initState: () => any;
|
|
116
|
+
slots: () => Readonly<any>;
|
|
117
|
+
state: any;
|
|
118
|
+
}[];
|
|
119
|
+
layout?: {
|
|
120
|
+
type: "single";
|
|
121
|
+
} | {
|
|
122
|
+
type: "grid";
|
|
123
|
+
width: number;
|
|
124
|
+
};
|
|
125
|
+
lastSelectedVariant?: {
|
|
126
|
+
id: string;
|
|
127
|
+
title: string;
|
|
128
|
+
initState: () => any;
|
|
129
|
+
slots: () => Readonly<any>;
|
|
130
|
+
state: any;
|
|
131
|
+
};
|
|
132
|
+
mountTime: number;
|
|
133
|
+
}[]>;
|
|
134
|
+
addStory: (story: Story) => Story;
|
|
135
|
+
removeStory: (story: Story) => void;
|
|
136
|
+
currentStory: import("vue").ComputedRef<{
|
|
137
|
+
id: string;
|
|
138
|
+
title: string;
|
|
139
|
+
variants: {
|
|
140
|
+
id: string;
|
|
141
|
+
title: string;
|
|
142
|
+
initState: () => any;
|
|
143
|
+
slots: () => Readonly<any>;
|
|
144
|
+
state: any;
|
|
145
|
+
}[];
|
|
146
|
+
layout?: {
|
|
147
|
+
type: "single";
|
|
148
|
+
} | {
|
|
149
|
+
type: "grid";
|
|
150
|
+
width: number;
|
|
151
|
+
};
|
|
152
|
+
lastSelectedVariant?: {
|
|
153
|
+
id: string;
|
|
154
|
+
title: string;
|
|
155
|
+
initState: () => any;
|
|
156
|
+
slots: () => Readonly<any>;
|
|
157
|
+
state: any;
|
|
158
|
+
};
|
|
159
|
+
mountTime: number;
|
|
160
|
+
}>;
|
|
161
|
+
}, "addStory" | "removeStory">>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineStore } from 'pinia';
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
import { router } from '../router';
|
|
4
|
+
export const useStoryStore = defineStore('story', () => {
|
|
5
|
+
const stories = ref([]);
|
|
6
|
+
function addStory(story) {
|
|
7
|
+
const existing = stories.value.find(s => s.id === story.id);
|
|
8
|
+
if (existing) {
|
|
9
|
+
Object.assign(existing, story);
|
|
10
|
+
return existing;
|
|
11
|
+
}
|
|
12
|
+
stories.value.push(story);
|
|
13
|
+
return story;
|
|
14
|
+
}
|
|
15
|
+
function removeStory(story) {
|
|
16
|
+
const index = stories.value.findIndex(s => s.id === story.id);
|
|
17
|
+
if (index !== -1) {
|
|
18
|
+
stories.value.splice(index, 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const currentStory = computed(() => stories.value.find(s => s.id === router.currentRoute.value.params.storyId));
|
|
22
|
+
return {
|
|
23
|
+
stories,
|
|
24
|
+
addStory,
|
|
25
|
+
removeStory,
|
|
26
|
+
currentStory,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../../src/client/app/stores/story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlC,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;IACrD,MAAM,OAAO,GAAG,GAAG,CAAU,EAAE,CAAC,CAAA;IAEhC,SAAS,QAAQ,CAAE,KAAY;QAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAA;QAC3D,IAAI,QAAQ,EAAE;YACZ,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;YAC9B,OAAO,QAAQ,CAAA;SAChB;QACD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACzB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,SAAS,WAAW,CAAE,KAAY;QAChC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAA;QAC7D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;SAC/B;IACH,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IAE/G,OAAO;QACL,OAAO;QACP,QAAQ;QACR,WAAW;QACX,YAAY;KACb,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* @TODO custom themes */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Lato&display=swap');
|
|
2
|
+
@import 'floating-vue/dist/style.css';
|
|
3
|
+
@import 'floating-vue.css';
|
|
4
|
+
|
|
5
|
+
*,
|
|
6
|
+
::before,
|
|
7
|
+
::after {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
border-width: 0;
|
|
10
|
+
border-style: solid;
|
|
11
|
+
border-color: #e5e7eb;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
a {
|
|
15
|
+
color: inherit;
|
|
16
|
+
text-decoration: inherit;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@tailwind base;
|
|
20
|
+
@tailwind components;
|
|
21
|
+
@tailwind utilities;
|
|
22
|
+
|
|
23
|
+
body {
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
html,
|
|
28
|
+
body,
|
|
29
|
+
#app {
|
|
30
|
+
height: 100%;
|
|
31
|
+
font-family: 'Lato', sans-serif;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.__histoire-sandbox {
|
|
36
|
+
contain: content;
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Story {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
variants: Variant[];
|
|
5
|
+
layout?: {
|
|
6
|
+
type: 'single';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'grid';
|
|
9
|
+
width: number;
|
|
10
|
+
};
|
|
11
|
+
lastSelectedVariant?: Variant;
|
|
12
|
+
mountTime: number;
|
|
13
|
+
}
|
|
14
|
+
export interface Variant {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
initState: () => any;
|
|
18
|
+
slots: () => Readonly<any>;
|
|
19
|
+
state: any;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/app/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { dirname, join } from 'pathe';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
4
|
+
export const DIST_CLIENT_PATH = join(__dirname, '../client');
|
|
5
|
+
export const APP_PATH = join(DIST_CLIENT_PATH, 'app');
|
|
6
|
+
//# sourceMappingURL=alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","sourceRoot":"","sources":["../../src/node/alias.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC5D,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/node/bin.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { dirname, resolve } from 'pathe';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import sade from 'sade';
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const { version } = JSON.parse(fs.readFileSync(resolve(__dirname, '../../package.json'), 'utf8'));
|
|
7
|
+
const program = sade('histoire');
|
|
8
|
+
program.version(version);
|
|
9
|
+
program.command('dev')
|
|
10
|
+
.describe('open the stories in your browser for development')
|
|
11
|
+
.option('-p, --port <port>', 'Listening port of the server')
|
|
12
|
+
.action(async (options) => {
|
|
13
|
+
const { dev } = await import('./commands/dev.js');
|
|
14
|
+
return dev(options);
|
|
15
|
+
});
|
|
16
|
+
program.parse(process.argv);
|
|
17
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/node/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAEzD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAEjG,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAA;AAChC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAExB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;KACnB,QAAQ,CAAC,kDAAkD,CAAC;KAC5D,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,CAAC;KAC3D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAA;IACjD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;AACrB,CAAC,CAAC,CAAA;AAEJ,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { join } from 'pathe';
|
|
2
|
+
import { createServer } from '../server.js';
|
|
3
|
+
export async function dev(options) {
|
|
4
|
+
const config = {
|
|
5
|
+
sourceDir: join(process.cwd(), 'src'),
|
|
6
|
+
storyMatch: ['**/*.story.vue'],
|
|
7
|
+
};
|
|
8
|
+
const ctx = {
|
|
9
|
+
config,
|
|
10
|
+
};
|
|
11
|
+
const server = await createServer(ctx);
|
|
12
|
+
await server.listen(options.port);
|
|
13
|
+
server.printUrls();
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/node/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAM3C,MAAM,CAAC,KAAK,UAAU,GAAG,CAAE,OAAmB;IAC5C,MAAM,MAAM,GAAmB;QAC7B,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC;QACrC,UAAU,EAAE,CAAC,gBAAgB,CAAC;KAC/B,CAAA;IACD,MAAM,GAAG,GAAY;QACnB,MAAM;KACP,CAAA;IACD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAA;IACtC,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,CAAC,SAAS,EAAE,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/node/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/node/context.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":""}
|