histoire 0.1.1 → 0.1.4
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 +15 -0
- package/dist/client/app/components/app/AppHeader.vue +6 -6
- package/dist/client/app/components/app/Breadcrumb.vue +98 -0
- package/dist/client/app/components/app/MobileOverlay.vue +34 -0
- package/dist/client/app/components/misc/HatchedPattern.vue +11 -23
- package/dist/client/app/components/search/SearchItem.vue +1 -1
- package/dist/client/app/components/search/SearchModal.vue +2 -2
- package/dist/client/app/components/story/StoryListFolder.vue +2 -2
- package/dist/client/app/components/story/StoryListItem.vue +2 -2
- package/dist/client/app/components/story/StoryResponsivePreview.vue +94 -9
- package/dist/client/app/components/story/StorySidePanel.vue +68 -0
- package/dist/client/app/components/story/StoryVariantListItem.vue +2 -2
- package/dist/client/app/components/story/StoryVariantSingleView.vue +6 -2
- package/dist/client/app/components/story/StoryView.vue +10 -121
- package/dist/client/app/components/story/StoryViewer.vue +157 -0
- package/dist/client/app/stores/story.ts +1 -1
- package/dist/client/app/style/{floating-vue.css → floating-vue.pcss} +0 -0
- package/dist/client/app/style/{main.css → main.pcss} +13 -3
- package/dist/client/app/style/transitions.pcss +26 -0
- package/dist/client/app/util/responsive.d.ts +1 -0
- package/dist/client/app/util/responsive.js +2 -0
- package/dist/client/app/util/responsive.ts +3 -0
- package/dist/node/build.js +7 -0
- package/dist/style.css +158 -73
- package/package.json +4 -5
- package/src/client/app/App.vue +15 -0
- package/src/client/app/components/app/AppHeader.vue +6 -6
- package/src/client/app/components/app/Breadcrumb.vue +98 -0
- package/src/client/app/components/app/MobileOverlay.vue +34 -0
- package/src/client/app/components/misc/HatchedPattern.vue +11 -23
- package/src/client/app/components/search/SearchItem.vue +1 -1
- package/src/client/app/components/search/SearchModal.vue +2 -2
- package/src/client/app/components/story/StoryListFolder.vue +2 -2
- package/src/client/app/components/story/StoryListItem.vue +2 -2
- package/src/client/app/components/story/StoryResponsivePreview.vue +94 -9
- package/src/client/app/components/story/StorySidePanel.vue +68 -0
- package/src/client/app/components/story/StoryVariantListItem.vue +2 -2
- package/src/client/app/components/story/StoryVariantSingleView.vue +6 -2
- package/src/client/app/components/story/StoryView.vue +10 -121
- package/src/client/app/components/story/StoryViewer.vue +157 -0
- package/src/client/app/stores/story.ts +1 -1
- package/src/client/app/style/{floating-vue.css → floating-vue.pcss} +0 -0
- package/src/client/app/style/{main.css → main.pcss} +13 -3
- package/src/client/app/style/transitions.pcss +26 -0
- package/src/client/app/util/responsive.ts +3 -0
- package/src/node/build.ts +7 -0
- package/dist/client/app/style/transitions.css +0 -12
- package/src/client/app/style/transitions.css +0 -12
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {
|
|
2
|
+
import { watch } from 'vue'
|
|
3
3
|
import { useRoute, useRouter } from 'vue-router'
|
|
4
4
|
import { useStoryStore } from '../../stores/story'
|
|
5
5
|
|
|
6
6
|
import BaseSplitPane from '../base/BaseSplitPane.vue'
|
|
7
7
|
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import StoryVariantSingleView from './StoryVariantSingleView.vue'
|
|
12
|
-
import StoryControls from './StoryControls.vue'
|
|
13
|
-
import StoryDocs from './StoryDocs.vue'
|
|
14
|
-
import StorySourceCode from './StorySourceCode.vue'
|
|
8
|
+
import { isMobile } from '../../util/responsive'
|
|
9
|
+
import StoryViewer from './StoryViewer.vue'
|
|
10
|
+
import StorySidePanel from './StorySidePanel.vue'
|
|
15
11
|
|
|
16
12
|
const storyStore = useStoryStore()
|
|
17
13
|
|
|
18
14
|
const router = useRouter()
|
|
19
15
|
const route = useRoute()
|
|
20
16
|
|
|
21
|
-
// Selected variant
|
|
22
|
-
|
|
23
|
-
const hasSingleVariant = computed(() => (storyStore.currentStory?.variants.length === 1))
|
|
24
|
-
|
|
25
17
|
// Restore variant selection
|
|
26
18
|
|
|
27
19
|
watch(() => storyStore.currentVariant, value => {
|
|
@@ -67,7 +59,11 @@ function setVariant (variantId: string) {
|
|
|
67
59
|
v-else
|
|
68
60
|
class="htw-h-full"
|
|
69
61
|
>
|
|
62
|
+
<template v-if="isMobile">
|
|
63
|
+
<StoryViewer />
|
|
64
|
+
</template>
|
|
70
65
|
<BaseSplitPane
|
|
66
|
+
v-else
|
|
71
67
|
save-id="story-main"
|
|
72
68
|
:min="30"
|
|
73
69
|
:max="95"
|
|
@@ -75,118 +71,11 @@ function setVariant (variantId: string) {
|
|
|
75
71
|
class="htw-h-full"
|
|
76
72
|
>
|
|
77
73
|
<template #first>
|
|
78
|
-
<
|
|
79
|
-
<div
|
|
80
|
-
v-if="storyStore.currentStory.layout.type === 'grid'"
|
|
81
|
-
class="htw-h-full htw-overflow-y-auto"
|
|
82
|
-
>
|
|
83
|
-
<div
|
|
84
|
-
class="htw-grid htw-gap-4 htw-m-4"
|
|
85
|
-
:style="{
|
|
86
|
-
gridTemplateColumns: `repeat(auto-fill, ${storyStore.currentStory.layout.width ?? 200}px)`,
|
|
87
|
-
}"
|
|
88
|
-
>
|
|
89
|
-
<StoryVariantGridItem
|
|
90
|
-
v-for="(variant, index) of storyStore.currentStory.variants"
|
|
91
|
-
:key="index"
|
|
92
|
-
:variant="variant"
|
|
93
|
-
:story="storyStore.currentStory"
|
|
94
|
-
/>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<template v-else-if="storyStore.currentStory.layout.type === 'single'">
|
|
99
|
-
<div
|
|
100
|
-
v-if="hasSingleVariant && storyStore.currentVariant"
|
|
101
|
-
class="htw-p-2 htw-h-full"
|
|
102
|
-
>
|
|
103
|
-
<StoryVariantSingleView
|
|
104
|
-
:variant="storyStore.currentVariant"
|
|
105
|
-
:story="storyStore.currentStory"
|
|
106
|
-
/>
|
|
107
|
-
</div>
|
|
108
|
-
<BaseSplitPane
|
|
109
|
-
v-else
|
|
110
|
-
save-id="story-single-main-split"
|
|
111
|
-
:min="5"
|
|
112
|
-
:max="40"
|
|
113
|
-
:default-split="17"
|
|
114
|
-
>
|
|
115
|
-
<template #first>
|
|
116
|
-
<div class="htw-h-full htw-overflow-y-auto">
|
|
117
|
-
<StoryVariantListItem
|
|
118
|
-
v-for="(variant, index) of storyStore.currentStory.variants"
|
|
119
|
-
:key="index"
|
|
120
|
-
:variant="variant"
|
|
121
|
-
/>
|
|
122
|
-
</div>
|
|
123
|
-
</template>
|
|
124
|
-
<template #last>
|
|
125
|
-
<div
|
|
126
|
-
v-if="storyStore.currentVariant"
|
|
127
|
-
class="htw-p-2 htw-h-full"
|
|
128
|
-
>
|
|
129
|
-
<StoryVariantSingleView
|
|
130
|
-
:variant="storyStore.currentVariant"
|
|
131
|
-
:story="storyStore.currentStory"
|
|
132
|
-
/>
|
|
133
|
-
</div>
|
|
134
|
-
</template>
|
|
135
|
-
</BaseSplitPane>
|
|
136
|
-
</template>
|
|
137
|
-
</div>
|
|
74
|
+
<StoryViewer />
|
|
138
75
|
</template>
|
|
139
76
|
|
|
140
77
|
<template #last>
|
|
141
|
-
<
|
|
142
|
-
<span>Select a variant</span>
|
|
143
|
-
</BaseEmpty>
|
|
144
|
-
|
|
145
|
-
<BaseEmpty v-else-if="!storyStore.currentVariant.ready">
|
|
146
|
-
<span>Loading...</span>
|
|
147
|
-
</BaseEmpty>
|
|
148
|
-
|
|
149
|
-
<BaseSplitPane
|
|
150
|
-
v-else
|
|
151
|
-
save-id="story-sidepane"
|
|
152
|
-
orientation="portrait"
|
|
153
|
-
class="htw-h-full"
|
|
154
|
-
>
|
|
155
|
-
<template #first>
|
|
156
|
-
<div class="htw-flex htw-flex-col htw-h-full">
|
|
157
|
-
<nav class="htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750">
|
|
158
|
-
<BaseTab
|
|
159
|
-
:to="{ ...$route, query: { ...$route.query, tab: '' } }"
|
|
160
|
-
:matched="!$route.query.tab"
|
|
161
|
-
>
|
|
162
|
-
Controls
|
|
163
|
-
</BaseTab>
|
|
164
|
-
<BaseTab
|
|
165
|
-
:to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
|
|
166
|
-
:matched="$route.query.tab === 'docs'"
|
|
167
|
-
>
|
|
168
|
-
Docs
|
|
169
|
-
</BaseTab>
|
|
170
|
-
</nav>
|
|
171
|
-
|
|
172
|
-
<component
|
|
173
|
-
:is="$route.query.tab === 'docs'
|
|
174
|
-
? StoryDocs
|
|
175
|
-
: StoryControls"
|
|
176
|
-
:story="storyStore.currentStory"
|
|
177
|
-
:variant="storyStore.currentVariant"
|
|
178
|
-
class="htw-h-full htw-overflow-auto"
|
|
179
|
-
/>
|
|
180
|
-
</div>
|
|
181
|
-
</template>
|
|
182
|
-
|
|
183
|
-
<template #last>
|
|
184
|
-
<StorySourceCode
|
|
185
|
-
:variant="storyStore.currentVariant"
|
|
186
|
-
class="htw-h-full"
|
|
187
|
-
/>
|
|
188
|
-
</template>
|
|
189
|
-
</BaseSplitPane>
|
|
78
|
+
<StorySidePanel />
|
|
190
79
|
</template>
|
|
191
80
|
</BaseSplitPane>
|
|
192
81
|
</div>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref, watch } from 'vue'
|
|
3
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
4
|
+
import { useStoryStore } from '../../stores/story'
|
|
5
|
+
|
|
6
|
+
import BaseSplitPane from '../base/BaseSplitPane.vue'
|
|
7
|
+
import StoryVariantListItem from './StoryVariantListItem.vue'
|
|
8
|
+
import StoryVariantGridItem from './StoryVariantGridItem.vue'
|
|
9
|
+
import StoryVariantSingleView from './StoryVariantSingleView.vue'
|
|
10
|
+
import { isMobile } from '../../util/responsive'
|
|
11
|
+
import { Icon } from '@iconify/vue'
|
|
12
|
+
import MobileOverlay from '../app/MobileOverlay.vue'
|
|
13
|
+
|
|
14
|
+
const storyStore = useStoryStore()
|
|
15
|
+
|
|
16
|
+
const router = useRouter()
|
|
17
|
+
const route = useRoute()
|
|
18
|
+
|
|
19
|
+
const hasSingleVariant = computed(() => (storyStore.currentStory?.variants.length === 1))
|
|
20
|
+
|
|
21
|
+
const variant = computed(() => storyStore.currentVariant)
|
|
22
|
+
|
|
23
|
+
const isMenuOpened = ref(false)
|
|
24
|
+
|
|
25
|
+
function openMenu () {
|
|
26
|
+
isMenuOpened.value = true
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function closeMenu () {
|
|
30
|
+
isMenuOpened.value = false
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
watch(variant, () => {
|
|
34
|
+
isMenuOpened.value = false
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<div class="htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750">
|
|
40
|
+
<div
|
|
41
|
+
v-if="storyStore.currentStory.layout.type === 'grid'"
|
|
42
|
+
class="htw-h-full htw-overflow-y-auto"
|
|
43
|
+
>
|
|
44
|
+
<div
|
|
45
|
+
class="htw-grid htw-gap-4 htw-m-4"
|
|
46
|
+
:style="{
|
|
47
|
+
gridTemplateColumns: `repeat(auto-fill, ${storyStore.currentStory.layout.width ?? 200}px)`,
|
|
48
|
+
}"
|
|
49
|
+
>
|
|
50
|
+
<StoryVariantGridItem
|
|
51
|
+
v-for="(variant, index) of storyStore.currentStory.variants"
|
|
52
|
+
:key="index"
|
|
53
|
+
:variant="variant"
|
|
54
|
+
:story="storyStore.currentStory"
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<template v-else-if="storyStore.currentStory.layout.type === 'single'">
|
|
60
|
+
<div
|
|
61
|
+
v-if="hasSingleVariant && storyStore.currentVariant"
|
|
62
|
+
class="htw-p-2 htw-h-full"
|
|
63
|
+
>
|
|
64
|
+
<StoryVariantSingleView
|
|
65
|
+
:variant="storyStore.currentVariant"
|
|
66
|
+
:story="storyStore.currentStory"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
<template v-else>
|
|
70
|
+
<div
|
|
71
|
+
v-if="isMobile"
|
|
72
|
+
class="htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
|
|
73
|
+
>
|
|
74
|
+
<a
|
|
75
|
+
class="htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center"
|
|
76
|
+
@click="openMenu"
|
|
77
|
+
>
|
|
78
|
+
<template v-if="variant">
|
|
79
|
+
<Icon
|
|
80
|
+
:icon="variant.icon ?? 'carbon:cube'"
|
|
81
|
+
class="base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none"
|
|
82
|
+
:class="{
|
|
83
|
+
'htw-text-gray-500': !variant.iconColor,
|
|
84
|
+
'bind-icon-color': variant.iconColor,
|
|
85
|
+
}"
|
|
86
|
+
/>
|
|
87
|
+
{{ variant.title }}
|
|
88
|
+
</template>
|
|
89
|
+
<template v-else>
|
|
90
|
+
Select a variant...
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<Icon
|
|
94
|
+
icon="carbon:chevron-sort"
|
|
95
|
+
class="htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
96
|
+
/>
|
|
97
|
+
</a>
|
|
98
|
+
<div
|
|
99
|
+
v-if="storyStore.currentVariant"
|
|
100
|
+
class="htw-p-2 htw-h-full"
|
|
101
|
+
>
|
|
102
|
+
<StoryVariantSingleView
|
|
103
|
+
:variant="storyStore.currentVariant"
|
|
104
|
+
:story="storyStore.currentStory"
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
<BaseSplitPane
|
|
109
|
+
v-else
|
|
110
|
+
save-id="story-single-main-split"
|
|
111
|
+
:min="5"
|
|
112
|
+
:max="40"
|
|
113
|
+
:default-split="17"
|
|
114
|
+
>
|
|
115
|
+
<template #first>
|
|
116
|
+
<div class="htw-h-full htw-overflow-y-auto">
|
|
117
|
+
<StoryVariantListItem
|
|
118
|
+
v-for="(variant, index) of storyStore.currentStory.variants"
|
|
119
|
+
:key="index"
|
|
120
|
+
:variant="variant"
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
</template>
|
|
124
|
+
<template #last>
|
|
125
|
+
<div
|
|
126
|
+
v-if="storyStore.currentVariant"
|
|
127
|
+
class="htw-p-2 htw-h-full"
|
|
128
|
+
>
|
|
129
|
+
<StoryVariantSingleView
|
|
130
|
+
:variant="storyStore.currentVariant"
|
|
131
|
+
:story="storyStore.currentStory"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
</template>
|
|
135
|
+
</BaseSplitPane>
|
|
136
|
+
</template>
|
|
137
|
+
</template>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<MobileOverlay
|
|
141
|
+
title="Select a variant"
|
|
142
|
+
:opened="isMenuOpened"
|
|
143
|
+
@close="closeMenu"
|
|
144
|
+
>
|
|
145
|
+
<StoryVariantListItem
|
|
146
|
+
v-for="(variant, index) of storyStore.currentStory.variants"
|
|
147
|
+
:key="index"
|
|
148
|
+
:variant="variant"
|
|
149
|
+
/>
|
|
150
|
+
</MobileOverlay>
|
|
151
|
+
</template>
|
|
152
|
+
|
|
153
|
+
<style scoped>
|
|
154
|
+
.bind-icon-color {
|
|
155
|
+
color: v-bind('variant?.iconColor');
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
File without changes
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
@import url('https://fonts.googleapis.com/css2?family=Lato&display=swap');
|
|
2
2
|
@import 'floating-vue/dist/style.css';
|
|
3
|
-
|
|
4
|
-
@import '
|
|
3
|
+
|
|
4
|
+
@import 'floating-vue.pcss';
|
|
5
|
+
@import 'transitions.pcss';
|
|
5
6
|
|
|
6
7
|
*,
|
|
7
8
|
::before,
|
|
@@ -45,7 +46,16 @@ body,
|
|
|
45
46
|
#app {
|
|
46
47
|
height: 100%;
|
|
47
48
|
font-family: 'Lato', sans-serif;
|
|
48
|
-
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#app {
|
|
52
|
+
font-size: 18px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media (min-width: 640px) {
|
|
56
|
+
#app {
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
}
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
.__histoire-sandbox {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.__histoire-scale-x {
|
|
2
|
+
&-enter-active,
|
|
3
|
+
&-leave-active {
|
|
4
|
+
transition: transform .15s, opacity .15s;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&-enter-from,
|
|
8
|
+
&-leave-to {
|
|
9
|
+
transform: scaleX(0);
|
|
10
|
+
opacity: 0;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.__histoire-fade {
|
|
15
|
+
&-enter-active,
|
|
16
|
+
&-leave-active {
|
|
17
|
+
transition: transform .15s, opacity .15s;
|
|
18
|
+
transform: translateY(0px);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-enter-from,
|
|
22
|
+
&-leave-to {
|
|
23
|
+
transform: translateY(32px);
|
|
24
|
+
opacity: 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isMobile: import("vue").Ref<boolean>;
|
package/dist/node/build.js
CHANGED
|
@@ -44,6 +44,13 @@ export async function build(ctx) {
|
|
|
44
44
|
join(APP_PATH, 'index.ts'),
|
|
45
45
|
join(APP_PATH, 'sandbox.ts'),
|
|
46
46
|
],
|
|
47
|
+
output: {
|
|
48
|
+
manualChunks(id) {
|
|
49
|
+
if (!id.includes('histoire/dist/client') && id.includes('node_modules')) {
|
|
50
|
+
return 'vendor';
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
},
|
|
47
54
|
},
|
|
48
55
|
outDir: ctx.config.outDir,
|
|
49
56
|
emptyOutDir: true,
|