histoire 0.1.3 → 0.2.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.
Files changed (76) hide show
  1. package/dist/client/app/App.vue +16 -1
  2. package/dist/client/app/components/app/AppHeader.vue +7 -6
  3. package/dist/client/app/components/app/Breadcrumb.vue +98 -0
  4. package/dist/client/app/components/app/MobileOverlay.vue +34 -0
  5. package/dist/client/app/components/base/BaseCheckbox.vue +76 -0
  6. package/dist/client/app/components/misc/HatchedPattern.vue +11 -23
  7. package/dist/client/app/components/search/SearchItem.vue +5 -2
  8. package/dist/client/app/components/search/SearchModal.vue +6 -6
  9. package/dist/client/app/components/story/StoryControls.vue +1 -1
  10. package/dist/client/app/components/story/StoryDocs.vue +1 -0
  11. package/dist/client/app/components/story/StoryListFolder.vue +3 -3
  12. package/dist/client/app/components/story/StoryListItem.vue +6 -3
  13. package/dist/client/app/components/story/StoryResponsivePreview.vue +53 -8
  14. package/dist/client/app/components/story/StorySidePanel.vue +69 -0
  15. package/dist/client/app/components/story/StorySourceCode.vue +4 -1
  16. package/dist/client/app/components/story/StoryVariantListItem.vue +6 -3
  17. package/dist/client/app/components/story/StoryVariantSingleView.vue +14 -10
  18. package/dist/client/app/components/story/StoryView.vue +10 -121
  19. package/dist/client/app/components/story/StoryViewer.vue +175 -0
  20. package/dist/client/app/stores/story.d.ts +6 -6
  21. package/dist/client/app/stores/story.js +2 -1
  22. package/dist/client/app/stores/story.ts +6 -2
  23. package/dist/client/app/style/{floating-vue.css → floating-vue.pcss} +0 -0
  24. package/dist/client/app/style/{main.css → main.pcss} +13 -3
  25. package/dist/client/app/style/transitions.pcss +26 -0
  26. package/dist/client/app/types.d.ts +1 -1
  27. package/dist/client/app/types.ts +1 -1
  28. package/dist/client/app/util/responsive.d.ts +1 -0
  29. package/dist/client/app/util/responsive.js +2 -0
  30. package/dist/client/app/util/responsive.ts +3 -0
  31. package/dist/node/bin.js +7 -0
  32. package/dist/node/build.js +1 -1
  33. package/dist/node/{collect.d.ts → collect/index.d.ts} +2 -2
  34. package/dist/node/{collect.js → collect/index.js} +37 -27
  35. package/dist/node/collect/worker.d.ts +14 -0
  36. package/dist/node/collect/worker.js +36 -0
  37. package/dist/node/commands/preview.d.ts +4 -0
  38. package/dist/node/commands/preview.js +36 -0
  39. package/dist/node/server.js +1 -1
  40. package/dist/node/types.d.ts +1 -1
  41. package/dist/style.css +231 -104
  42. package/package.json +8 -4
  43. package/src/client/app/App.vue +16 -1
  44. package/src/client/app/components/app/AppHeader.vue +7 -6
  45. package/src/client/app/components/app/Breadcrumb.vue +98 -0
  46. package/src/client/app/components/app/MobileOverlay.vue +34 -0
  47. package/src/client/app/components/base/BaseCheckbox.vue +76 -0
  48. package/src/client/app/components/misc/HatchedPattern.vue +11 -23
  49. package/src/client/app/components/search/SearchItem.vue +5 -2
  50. package/src/client/app/components/search/SearchModal.vue +6 -6
  51. package/src/client/app/components/story/StoryControls.vue +1 -1
  52. package/src/client/app/components/story/StoryDocs.vue +1 -0
  53. package/src/client/app/components/story/StoryListFolder.vue +3 -3
  54. package/src/client/app/components/story/StoryListItem.vue +6 -3
  55. package/src/client/app/components/story/StoryResponsivePreview.vue +53 -8
  56. package/src/client/app/components/story/StorySidePanel.vue +69 -0
  57. package/src/client/app/components/story/StorySourceCode.vue +4 -1
  58. package/src/client/app/components/story/StoryVariantListItem.vue +6 -3
  59. package/src/client/app/components/story/StoryVariantSingleView.vue +14 -10
  60. package/src/client/app/components/story/StoryView.vue +10 -121
  61. package/src/client/app/components/story/StoryViewer.vue +175 -0
  62. package/src/client/app/stores/story.ts +6 -2
  63. package/src/client/app/style/{floating-vue.css → floating-vue.pcss} +0 -0
  64. package/src/client/app/style/{main.css → main.pcss} +13 -3
  65. package/src/client/app/style/transitions.pcss +26 -0
  66. package/src/client/app/types.ts +1 -1
  67. package/src/client/app/util/responsive.ts +3 -0
  68. package/src/node/bin.ts +8 -0
  69. package/src/node/build.ts +1 -1
  70. package/src/node/{collect.ts → collect/index.ts} +48 -30
  71. package/src/node/collect/worker.ts +61 -0
  72. package/src/node/commands/preview.ts +50 -0
  73. package/src/node/server.ts +1 -1
  74. package/src/node/types.ts +1 -1
  75. package/dist/client/app/style/transitions.css +0 -12
  76. package/src/client/app/style/transitions.css +0 -12
@@ -5,6 +5,8 @@ import type { Story, Variant } from '../../types'
5
5
  import { histoireConfig } from '../../util/config'
6
6
  import { usePreviewSettings } from '../../util/preview-settings'
7
7
  import StoryResponsivePreview from './StoryResponsivePreview.vue'
8
+ import BaseCheckbox from '../base/BaseCheckbox.vue'
9
+ import { isMobile } from '../../util/responsive'
8
10
 
9
11
  defineProps({
10
12
  variant: {
@@ -22,9 +24,15 @@ const settings = usePreviewSettings()
22
24
  </script>
23
25
 
24
26
  <template>
25
- <div class="htw-h-full htw-flex htw-flex-col">
27
+ <div
28
+ class="htw-h-full htw-flex htw-flex-col"
29
+ data-test-id="story-variant-single-view"
30
+ >
26
31
  <!-- Toolbar -->
27
- <div class="htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1">
32
+ <div
33
+ v-if="!isMobile"
34
+ class="htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
35
+ >
28
36
  <!-- Variant title -->
29
37
  <div class="htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0">
30
38
  <Icon
@@ -63,11 +71,9 @@ const settings = usePreviewSettings()
63
71
 
64
72
  <template #popper="{ hide }">
65
73
  <div class="htw-flex htw-flex-col htw-items-stretch">
66
- <HstCheckbox
67
- v-model="settings.rotate"
68
- >
74
+ <BaseCheckbox v-model="settings.rotate">
69
75
  Rotate
70
- </HstCheckbox>
76
+ </BaseCheckbox>
71
77
 
72
78
  <div class="htw-flex htw-gap-2 htw-px-4 htw-py-3">
73
79
  <input
@@ -133,11 +139,9 @@ const settings = usePreviewSettings()
133
139
 
134
140
  <template #popper="{ hide }">
135
141
  <div class="htw-flex htw-flex-col htw-items-stretch">
136
- <HstCheckbox
137
- v-model="settings.checkerboard"
138
- >
142
+ <BaseCheckbox v-model="settings.checkerboard">
139
143
  Checkerboard
140
- </HstCheckbox>
144
+ </BaseCheckbox>
141
145
 
142
146
  <button
143
147
  v-for="(option, index) in histoireConfig.backgroundPresets"
@@ -1,27 +1,19 @@
1
1
  <script lang="ts" setup>
2
- import { computed, watch } from 'vue'
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 BaseTab from '../base/BaseTab.vue'
9
- import StoryVariantListItem from './StoryVariantListItem.vue'
10
- import StoryVariantGridItem from './StoryVariantGridItem.vue'
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
- <div class="htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750">
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
- <BaseEmpty v-if="!storyStore.currentVariant">
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,175 @@
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
+
37
+ const templateWidth = computed(() => {
38
+ if (storyStore.currentStory.layout.type !== 'grid') {
39
+ return
40
+ }
41
+
42
+ const layoutWidth = storyStore.currentStory.layout.width
43
+
44
+ if (!layoutWidth) {
45
+ return '200px'
46
+ }
47
+
48
+ if (typeof layoutWidth === 'number') {
49
+ return layoutWidth + 'px'
50
+ }
51
+
52
+ return layoutWidth
53
+ })
54
+ </script>
55
+
56
+ <template>
57
+ <div class="htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750">
58
+ <div
59
+ v-if="storyStore.currentStory.layout.type === 'grid'"
60
+ class="htw-h-full htw-overflow-y-auto"
61
+ >
62
+ <div
63
+ class="htw-grid htw-gap-4 htw-m-4"
64
+ :style="{
65
+ gridTemplateColumns: `repeat(auto-fill, ${templateWidth})`,
66
+ }"
67
+ >
68
+ <StoryVariantGridItem
69
+ v-for="(variant, index) of storyStore.currentStory.variants"
70
+ :key="index"
71
+ :variant="variant"
72
+ :story="storyStore.currentStory"
73
+ />
74
+ </div>
75
+ </div>
76
+
77
+ <template v-else-if="storyStore.currentStory.layout.type === 'single'">
78
+ <div
79
+ v-if="hasSingleVariant && storyStore.currentVariant"
80
+ class="htw-p-2 htw-h-full"
81
+ >
82
+ <StoryVariantSingleView
83
+ :variant="storyStore.currentVariant"
84
+ :story="storyStore.currentStory"
85
+ />
86
+ </div>
87
+ <template v-else>
88
+ <div
89
+ v-if="isMobile"
90
+ class="htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
91
+ >
92
+ <a
93
+ 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"
94
+ @click="openMenu"
95
+ >
96
+ <template v-if="variant">
97
+ <Icon
98
+ :icon="variant.icon ?? 'carbon:cube'"
99
+ class="base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none"
100
+ :class="{
101
+ 'htw-text-gray-500': !variant.iconColor,
102
+ 'bind-icon-color': variant.iconColor,
103
+ }"
104
+ />
105
+ {{ variant.title }}
106
+ </template>
107
+ <template v-else>
108
+ Select a variant...
109
+ </template>
110
+
111
+ <Icon
112
+ icon="carbon:chevron-sort"
113
+ class="htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
114
+ />
115
+ </a>
116
+ <div
117
+ v-if="storyStore.currentVariant"
118
+ class="htw-p-2 htw-h-full"
119
+ >
120
+ <StoryVariantSingleView
121
+ :variant="storyStore.currentVariant"
122
+ :story="storyStore.currentStory"
123
+ />
124
+ </div>
125
+ </div>
126
+ <BaseSplitPane
127
+ v-else
128
+ save-id="story-single-main-split"
129
+ :min="5"
130
+ :max="40"
131
+ :default-split="17"
132
+ >
133
+ <template #first>
134
+ <div class="htw-h-full htw-overflow-y-auto">
135
+ <StoryVariantListItem
136
+ v-for="(variant, index) of storyStore.currentStory.variants"
137
+ :key="index"
138
+ :variant="variant"
139
+ />
140
+ </div>
141
+ </template>
142
+ <template #last>
143
+ <div
144
+ v-if="storyStore.currentVariant"
145
+ class="htw-p-2 htw-h-full"
146
+ >
147
+ <StoryVariantSingleView
148
+ :variant="storyStore.currentVariant"
149
+ :story="storyStore.currentStory"
150
+ />
151
+ </div>
152
+ </template>
153
+ </BaseSplitPane>
154
+ </template>
155
+ </template>
156
+ </div>
157
+
158
+ <MobileOverlay
159
+ title="Select a variant"
160
+ :opened="isMenuOpened"
161
+ @close="closeMenu"
162
+ >
163
+ <StoryVariantListItem
164
+ v-for="(variant, index) of storyStore.currentStory.variants"
165
+ :key="index"
166
+ :variant="variant"
167
+ />
168
+ </MobileOverlay>
169
+ </template>
170
+
171
+ <style scoped>
172
+ .bind-icon-color {
173
+ color: v-bind('variant?.iconColor');
174
+ }
175
+ </style>
@@ -18,7 +18,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
18
18
  type: "single";
19
19
  } | {
20
20
  type: "grid";
21
- width: number;
21
+ width?: string | number;
22
22
  };
23
23
  icon?: string;
24
24
  iconColor?: string;
@@ -60,7 +60,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
60
60
  type: "single";
61
61
  } | {
62
62
  type: "grid";
63
- width: number;
63
+ width?: string | number;
64
64
  };
65
65
  icon?: string;
66
66
  iconColor?: string;
@@ -115,7 +115,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
115
115
  type: "single";
116
116
  } | {
117
117
  type: "grid";
118
- width: number;
118
+ width?: string | number;
119
119
  };
120
120
  icon?: string;
121
121
  iconColor?: string;
@@ -157,7 +157,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
157
157
  type: "single";
158
158
  } | {
159
159
  type: "grid";
160
- width: number;
160
+ width?: string | number;
161
161
  };
162
162
  icon?: string;
163
163
  iconColor?: string;
@@ -212,7 +212,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
212
212
  type: "single";
213
213
  } | {
214
214
  type: "grid";
215
- width: number;
215
+ width?: string | number;
216
216
  };
217
217
  icon?: string;
218
218
  iconColor?: string;
@@ -254,7 +254,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
254
254
  type: "single";
255
255
  } | {
256
256
  type: "grid";
257
- width: number;
257
+ width?: string | number;
258
258
  };
259
259
  icon?: string;
260
260
  iconColor?: string;
@@ -1,6 +1,7 @@
1
1
  import { defineStore } from 'pinia';
2
2
  import { computed, ref, watch } from 'vue';
3
3
  import { router } from '../router';
4
+ import { useStorage } from '@vueuse/core';
4
5
  export const useStoryStore = defineStore('story', () => {
5
6
  const stories = ref([]);
6
7
  function setStories(value) {
@@ -8,7 +9,7 @@ export const useStoryStore = defineStore('story', () => {
8
9
  }
9
10
  const currentStory = computed(() => stories.value.find(s => s.id === router.currentRoute.value.params.storyId));
10
11
  const currentVariant = computed(() => currentStory.value?.variants.find(v => v.id === router.currentRoute.value.query.variantId));
11
- const openedFolders = ref(new Map());
12
+ const openedFolders = useStorage('_histoire-tree-state', new Map());
12
13
  function getStringPath(path) {
13
14
  return path.join('␜');
14
15
  }
@@ -1,7 +1,8 @@
1
1
  import { defineStore } from 'pinia'
2
- import { computed, reactive, ref, watch } from 'vue'
2
+ import { computed, ref, watch } from 'vue'
3
3
  import { router } from '../router'
4
4
  import { Story } from '../types'
5
+ import { useStorage } from '@vueuse/core'
5
6
 
6
7
  export const useStoryStore = defineStore('story', () => {
7
8
  const stories = ref<Story[]>([])
@@ -13,7 +14,10 @@ export const useStoryStore = defineStore('story', () => {
13
14
 
14
15
  const currentVariant = computed(() => currentStory.value?.variants.find(v => v.id === router.currentRoute.value.query.variantId))
15
16
 
16
- const openedFolders = ref(new Map() as Map<string, boolean>)
17
+ const openedFolders = useStorage<Map<string, boolean>>(
18
+ '_histoire-tree-state',
19
+ new Map(),
20
+ )
17
21
 
18
22
  function getStringPath (path: Array<string>) {
19
23
  return path.join('␜')
@@ -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
- @import 'floating-vue.css';
4
- @import 'transitions.css';
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
- font-size: 14px;
49
+ }
50
+
51
+ body {
52
+ font-size: 18px;
53
+ }
54
+
55
+ @media (min-width: 640px) {
56
+ body {
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
+ }
@@ -14,7 +14,7 @@ export interface Story {
14
14
  type: 'single';
15
15
  } | {
16
16
  type: 'grid';
17
- width: number;
17
+ width?: number | string;
18
18
  };
19
19
  icon?: string;
20
20
  iconColor?: string;
@@ -16,7 +16,7 @@ export interface Story {
16
16
  type: 'single'
17
17
  } | {
18
18
  type: 'grid'
19
- width: number
19
+ width?: number | string
20
20
  }
21
21
  icon?: string
22
22
  iconColor?: string
@@ -0,0 +1 @@
1
+ export declare const isMobile: import("vue").Ref<boolean>;
@@ -0,0 +1,2 @@
1
+ import { useMediaQuery } from '@vueuse/core';
2
+ export const isMobile = useMediaQuery('(max-width: 640px)');
@@ -0,0 +1,3 @@
1
+ import { useMediaQuery } from '@vueuse/core'
2
+
3
+ export const isMobile = useMediaQuery('(max-width: 640px)')
package/dist/node/bin.js CHANGED
@@ -19,4 +19,11 @@ program.command('build')
19
19
  const { buildCommand } = await import('./commands/build.js');
20
20
  return buildCommand();
21
21
  });
22
+ program.command('preview')
23
+ .describe('preview the built directory')
24
+ .option('-p, --port <port>', 'Listening port of the server')
25
+ .action(async (options) => {
26
+ const { previewCommand } = await import('./commands/preview.js');
27
+ return previewCommand(options);
28
+ });
22
29
  program.parse(process.argv);
@@ -7,7 +7,7 @@ import { performance } from 'perf_hooks';
7
7
  import { APP_PATH } from './alias.js';
8
8
  import { createVitePlugins } from './plugin.js';
9
9
  import { findAllStories } from './stories.js';
10
- import { useCollectStories } from './collect.js';
10
+ import { useCollectStories } from './collect/index.js';
11
11
  const PRELOAD_MODULES = [
12
12
  'vendor',
13
13
  ];
@@ -1,6 +1,6 @@
1
1
  import type { ViteDevServer } from 'vite';
2
- import type { StoryFile } from './types.js';
3
- import type { Context } from './context.js';
2
+ import type { StoryFile } from '../types.js';
3
+ import type { Context } from '../context.js';
4
4
  export interface UseCollectStoriesOptions {
5
5
  server: ViteDevServer;
6
6
  throws?: boolean;