histoire 0.1.2 → 0.1.5

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 (47) hide show
  1. package/dist/client/app/App.vue +16 -1
  2. package/dist/client/app/components/app/AppHeader.vue +6 -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/misc/HatchedPattern.vue +11 -23
  6. package/dist/client/app/components/search/SearchItem.vue +1 -1
  7. package/dist/client/app/components/search/SearchModal.vue +2 -2
  8. package/dist/client/app/components/story/StoryListFolder.vue +2 -2
  9. package/dist/client/app/components/story/StoryListItem.vue +2 -2
  10. package/dist/client/app/components/story/StoryResponsivePreview.vue +94 -9
  11. package/dist/client/app/components/story/StorySidePanel.vue +68 -0
  12. package/dist/client/app/components/story/StoryVariantListItem.vue +2 -2
  13. package/dist/client/app/components/story/StoryVariantSingleView.vue +6 -2
  14. package/dist/client/app/components/story/StoryView.vue +10 -121
  15. package/dist/client/app/components/story/StoryViewer.vue +157 -0
  16. package/dist/client/app/stores/story.js +2 -1
  17. package/dist/client/app/stores/story.ts +6 -2
  18. package/dist/client/app/style/{floating-vue.css → floating-vue.pcss} +0 -0
  19. package/dist/client/app/style/{main.css → main.pcss} +13 -3
  20. package/dist/client/app/style/transitions.pcss +26 -0
  21. package/dist/client/app/util/responsive.d.ts +1 -0
  22. package/dist/client/app/util/responsive.js +2 -0
  23. package/dist/client/app/util/responsive.ts +3 -0
  24. package/dist/style.css +158 -67
  25. package/package.json +4 -4
  26. package/src/client/app/App.vue +16 -1
  27. package/src/client/app/components/app/AppHeader.vue +6 -6
  28. package/src/client/app/components/app/Breadcrumb.vue +98 -0
  29. package/src/client/app/components/app/MobileOverlay.vue +34 -0
  30. package/src/client/app/components/misc/HatchedPattern.vue +11 -23
  31. package/src/client/app/components/search/SearchItem.vue +1 -1
  32. package/src/client/app/components/search/SearchModal.vue +2 -2
  33. package/src/client/app/components/story/StoryListFolder.vue +2 -2
  34. package/src/client/app/components/story/StoryListItem.vue +2 -2
  35. package/src/client/app/components/story/StoryResponsivePreview.vue +94 -9
  36. package/src/client/app/components/story/StorySidePanel.vue +68 -0
  37. package/src/client/app/components/story/StoryVariantListItem.vue +2 -2
  38. package/src/client/app/components/story/StoryVariantSingleView.vue +6 -2
  39. package/src/client/app/components/story/StoryView.vue +10 -121
  40. package/src/client/app/components/story/StoryViewer.vue +157 -0
  41. package/src/client/app/stores/story.ts +6 -2
  42. package/src/client/app/style/{floating-vue.css → floating-vue.pcss} +0 -0
  43. package/src/client/app/style/{main.css → main.pcss} +13 -3
  44. package/src/client/app/style/transitions.pcss +26 -0
  45. package/src/client/app/util/responsive.ts +3 -0
  46. package/dist/client/app/style/transitions.css +0 -12
  47. package/src/client/app/style/transitions.css +0 -12
@@ -11,6 +11,8 @@ import { mapFile } from './util/mapping'
11
11
  import { useTitle } from '@vueuse/core'
12
12
  import { histoireConfig } from './util/config.js'
13
13
  import { onKeyboardShortcut } from './util/keyboard.js'
14
+ import { isMobile } from './util/responsive'
15
+ import Breadcrumb from './components/app/Breadcrumb.vue'
14
16
 
15
17
  const SearchModal = defineAsyncComponent(() => import('./components/search/SearchModal.vue'))
16
18
 
@@ -78,8 +80,21 @@ onKeyboardShortcut(['ctrl+k', 'meta+k'], (event) => {
78
80
  />
79
81
  </div>
80
82
 
81
- <div class="htw-h-screen dark:htw-bg-gray-700 dark:htw-text-gray-100">
83
+ <div class="htw-h-screen htw-bg-white dark:htw-bg-gray-700 dark:htw-text-gray-100">
84
+ <div
85
+ v-if="isMobile"
86
+ class="htw-h-full htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800"
87
+ >
88
+ <AppHeader @search="isSearchOpen = true" />
89
+ <Breadcrumb
90
+ :tree="tree"
91
+ :stories="stories"
92
+ />
93
+ <RouterView class="htw-grow" />
94
+ </div>
95
+
82
96
  <BaseSplitPane
97
+ v-else
83
98
  save-id="main-horiz"
84
99
  :min="5"
85
100
  :max="50"
@@ -16,8 +16,8 @@ const themeIcon = computed(() => {
16
16
  })
17
17
 
18
18
  onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
19
- toggleDark()
20
19
  event.preventDefault()
20
+ toggleDark()
21
21
  })
22
22
  </script>
23
23
 
@@ -25,7 +25,7 @@ onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
25
25
  <div
26
26
  class="htw-px-4 htw-h-16 htw-flex htw-items-center htw-gap-2"
27
27
  >
28
- <div class="htw-py-4 htw-flex-1 htw-h-full htw-flex htw-items-center htw-pr-2">
28
+ <div class="htw-py-3 sm:htw-py-4 htw-flex-1 htw-h-full htw-flex htw-items-center htw-pr-2">
29
29
  <a
30
30
  :href="histoireConfig.theme?.logoHref"
31
31
  target="_blank"
@@ -39,23 +39,23 @@ onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
39
39
  <div class="htw-ml-auto htw-flex-none htw-flex">
40
40
  <a
41
41
  v-tooltip="makeTooltip('Search', ({ isMac }) => isMac ? 'meta+k' : 'ctrl+k')"
42
- class="htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
42
+ class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
43
43
  @click="$emit('search')"
44
44
  >
45
45
  <Icon
46
46
  icon="carbon:search"
47
- class="htw-w-5 htw-h-5"
47
+ class="htw-w-6 htw-h-6 sm:htw-w-4 sm:htw-h-4"
48
48
  />
49
49
  </a>
50
50
 
51
51
  <a
52
52
  v-tooltip="makeTooltip('Toggle dark mode', ({ isMac }) => isMac ? 'meta+shift+d' : 'ctrl+shift+d')"
53
- class="htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
53
+ class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
54
54
  @click="toggleDark()"
55
55
  >
56
56
  <Icon
57
57
  :icon="themeIcon"
58
- class="htw-w-5 htw-h-5"
58
+ class="htw-w-6 htw-h-6 sm:htw-w-4 sm:htw-h-4"
59
59
  />
60
60
  </a>
61
61
  </div>
@@ -0,0 +1,98 @@
1
+ <script lang="ts" setup>
2
+ import { computed, ref, watch } from 'vue'
3
+ import { Icon } from '@iconify/vue'
4
+ import { useStoryStore } from '../../stores/story'
5
+ import { Story, Tree } from '../../types'
6
+ import MobileOverlay from './MobileOverlay.vue'
7
+ import StoryList from '../story/StoryList.vue'
8
+
9
+ const props = defineProps<{
10
+ tree: Tree
11
+ stories: Story[]
12
+ }>()
13
+
14
+ const storyStore = useStoryStore()
15
+
16
+ const story = computed(() => storyStore.currentStory)
17
+
18
+ const folders = computed(() => {
19
+ return story.value.file.path.slice(0, -1)
20
+ })
21
+
22
+ const isMenuOpened = ref(false)
23
+
24
+ function openMenu () {
25
+ isMenuOpened.value = true
26
+ }
27
+
28
+ function closeMenu () {
29
+ isMenuOpened.value = false
30
+ }
31
+
32
+ watch(story, () => {
33
+ isMenuOpened.value = false
34
+ })
35
+ </script>
36
+
37
+ <template>
38
+ <div>
39
+ <a
40
+ 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"
41
+ @click="openMenu"
42
+ >
43
+ <template v-if="story">
44
+ <template
45
+ v-for="(file, key) of folders"
46
+ :key="key"
47
+ >
48
+ <span>
49
+ {{ file }}
50
+ </span>
51
+ <span class="htw-opacity-40">
52
+ /
53
+ </span>
54
+ </template>
55
+ <span class="htw-flex htw-items-center htw-gap-2">
56
+ <Icon
57
+ :icon="story.icon ?? 'carbon:cube'"
58
+ class="base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none"
59
+ :class="{
60
+ 'htw-text-primary-500': !story.iconColor,
61
+ 'bind-icon-color': story.iconColor,
62
+ }"
63
+ />
64
+ {{ story.title }}
65
+ <span class="htw-opacity-40 htw-text-sm">
66
+ {{ story.variants.length }}
67
+ </span>
68
+ </span>
69
+ </template>
70
+ <template v-else>
71
+ Select a story...
72
+ </template>
73
+
74
+ <Icon
75
+ icon="carbon:chevron-sort"
76
+ class="htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
77
+ />
78
+ </a>
79
+ </div>
80
+
81
+ <MobileOverlay
82
+ title="Select a story"
83
+ :opened="isMenuOpened"
84
+ @close="closeMenu"
85
+ >
86
+ <StoryList
87
+ :tree="tree"
88
+ :stories="stories"
89
+ class="htw-flex-1 htw-overflow-y-scroll"
90
+ />
91
+ </MobileOverlay>
92
+ </template>
93
+
94
+ <style scoped>
95
+ .bind-icon-color {
96
+ color: v-bind('story?.iconColor');
97
+ }
98
+ </style>
@@ -0,0 +1,34 @@
1
+ <script lang="ts" setup>
2
+ import { Icon } from '@iconify/vue'
3
+ import { defineEmits } from '@vue/runtime-core'
4
+
5
+ const props = defineProps<{
6
+ title: string
7
+ opened: boolean
8
+ }>()
9
+
10
+ const emits = defineEmits<{(e: 'close'): void}>()
11
+ </script>
12
+
13
+ <template>
14
+ <transition name="__histoire-fade">
15
+ <div
16
+ v-if="opened"
17
+ class="htw-absolute htw-z-10 htw-bg-white dark:htw-bg-gray-700 htw-w-screen htw-h-screen htw-inset-0 htw-overflow-hidden htw-flex htw-flex-col"
18
+ >
19
+ <div class="htw-p-4 htw-h-16 htw-flex htw-border-b htw-border-gray-100 dark:htw-border-gray-800 htw-items-center htw-place-content-between">
20
+ <span class="htw-text-gray-500">{{ title }}</span>
21
+ <a
22
+ class="htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
23
+ @click="emits('close')"
24
+ >
25
+ <Icon
26
+ icon="carbon:close"
27
+ class="htw-w-8 htw-h-8 htw-shrink-0"
28
+ />
29
+ </a>
30
+ </div>
31
+ <slot />
32
+ </div>
33
+ </transition>
34
+ </template>
@@ -1,25 +1,13 @@
1
1
  <template>
2
- <svg fill="none">
3
- <pattern
4
- id="hatch"
5
- width="32"
6
- height="32"
7
- patternUnits="userSpaceOnUse"
8
- >
9
- <path
10
- d="M32,0 L0,32
11
- M-1,1 l2,-2
12
- M31,33 l2,-2"
13
- stroke-width="2"
14
- stroke="currentColor"
15
- />
16
- </pattern>
17
- <rect
18
- x="0"
19
- y="0"
20
- width="100%"
21
- height="100%"
22
- fill="url(#hatch)"
23
- />
24
- </svg>
2
+ <div class="__histoire-hatched-pattern" />
25
3
  </template>
4
+
5
+ <style scoped>
6
+ .__histoire-hatched-pattern {
7
+ background: repeating-linear-gradient(135deg,
8
+ transparent 0px,
9
+ transparent 32px,
10
+ currentColor 32px,
11
+ currentColor 64px);
12
+ }
13
+ </style>
@@ -57,7 +57,7 @@ const kindLabels = {
57
57
  >
58
58
  <Icon
59
59
  :icon="result.icon ?? defaultIcons[result.kind]"
60
- class="htw-w-5 htw-h-5"
60
+ class="htw-w-4 htw-h-4"
61
61
  :class="[
62
62
  !selected ? [
63
63
  result.iconColor
@@ -131,7 +131,7 @@ function selectPrevious () {
131
131
  <template>
132
132
  <div
133
133
  v-show="shown"
134
- class="htw-fixed htw-inset-0 htw-bg-white/80 dark:htw-bg-gray-700/80"
134
+ class="htw-fixed htw-inset-0 htw-bg-white/80 dark:htw-bg-gray-700/80 htw-z-20"
135
135
  >
136
136
  <div
137
137
  class="htw-absolute htw-inset-0"
@@ -144,7 +144,7 @@ function selectPrevious () {
144
144
  >
145
145
  <Icon
146
146
  icon="carbon:search"
147
- class="flex-none htw-w-5 htw-h-5"
147
+ class="flex-none htw-w-4 htw-h-4"
148
148
  />
149
149
 
150
150
  <input
@@ -34,7 +34,7 @@ const folderPadding = computed(() => {
34
34
  <div
35
35
  role="button"
36
36
  tabindex="0"
37
- class="htw-px-0.5 htw-py-1.5 htw-m-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex"
37
+ class="htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex"
38
38
  @click="toggleOpen"
39
39
  @keyup.enter="toggleOpen"
40
40
  @keyup.space="toggleOpen"
@@ -50,7 +50,7 @@ const folderPadding = computed(() => {
50
50
  />
51
51
  <Icon
52
52
  icon="carbon:folder"
53
- class="htw-w-5 htw-h-5"
53
+ class="htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4"
54
54
  />
55
55
  </span>
56
56
  <span class="htw-truncate">{{ folder.title }}</span>
@@ -33,12 +33,12 @@ useScrollOnActive(active, el)
33
33
  storyId: story.id,
34
34
  },
35
35
  }"
36
- class="htw-pl-0.5 htw-pr-2 htw-py-1.5 htw-m-1 htw-rounded-sm"
36
+ class="htw-pl-0.5 htw-pr-2 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm"
37
37
  >
38
38
  <span class="bind-tree-margin htw-flex htw-items-center htw-gap-2 htw-pl-5 htw-min-w-0">
39
39
  <Icon
40
40
  :icon="story.icon ?? 'carbon:cube'"
41
- class="base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none"
41
+ class="base-list-item-link-icon htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none"
42
42
  :class="{
43
43
  'htw-text-primary-500': !active && !story.iconColor,
44
44
  'bind-icon-color': !active && story.iconColor,
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { computed, Ref, ref, toRaw, toRefs, watch } from 'vue'
2
+ import { computed, onUnmounted, Ref, ref, toRaw, watch } from 'vue'
3
3
  import { useEventListener } from '@vueuse/core'
4
4
  import { Icon } from '@iconify/vue'
5
5
  import { STATE_SYNC, PREVIEW_SETTINGS_SYNC, SANDBOX_READY } from '../../util/const'
@@ -8,6 +8,7 @@ import type { Story, Variant } from '../../types'
8
8
  import HatchedPattern from '../misc/HatchedPattern.vue'
9
9
  import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
10
10
  import { toRawDeep } from '../../util/reactivity'
11
+ import { Settings } from 'http2'
11
12
 
12
13
  const props = defineProps<{
13
14
  story: Story
@@ -15,6 +16,10 @@ const props = defineProps<{
15
16
  settings: PreviewSettings
16
17
  }>()
17
18
 
19
+ const emit = defineEmits({
20
+ 'update:settings': (settings: PreviewSettings) => true,
21
+ })
22
+
18
23
  // Iframe
19
24
 
20
25
  const iframe = ref<HTMLIFrameElement>()
@@ -98,29 +103,109 @@ function onIframeLoad () {
98
103
 
99
104
  const resizing = ref(false)
100
105
 
106
+ const onUnmountedCleanupFns: (() => unknown)[] = []
107
+ onUnmounted(() => {
108
+ onUnmountedCleanupFns.forEach(fn => fn())
109
+ })
110
+
111
+ function addWindowListener (event: string, listener: (event: any) => unknown) {
112
+ window.addEventListener(event, listener)
113
+ const removeListener = () => window.removeEventListener(event, listener)
114
+ onUnmountedCleanupFns.push(removeListener)
115
+ return () => {
116
+ removeListener()
117
+ onUnmountedCleanupFns.splice(onUnmountedCleanupFns.indexOf(removeListener), 1)
118
+ }
119
+ }
120
+
101
121
  function useDragger (el: Ref<HTMLDivElement>, value: Ref<number>, min: number, max: number, axis: 'x' | 'y') {
102
- const onMouseDown = (event: MouseEvent) => {
122
+ function onMouseDown (event: MouseEvent) {
103
123
  event.preventDefault()
104
124
  event.stopPropagation()
105
125
  const start = axis === 'x' ? event.clientX : event.clientY
106
126
  const startValue = value.value || (axis === 'x' ? iframe.value.offsetWidth : iframe.value.offsetHeight)
107
127
  resizing.value = true
108
- const onMouseMove = (event: MouseEvent) => {
128
+
129
+ const removeListeners = [
130
+ addWindowListener('mousemove', onMouseMove),
131
+ addWindowListener('mouseup', onMouseUp),
132
+ ]
133
+
134
+ function onMouseMove (event: MouseEvent) {
109
135
  const delta = (axis === 'x' ? event.clientX : event.clientY) - start
110
136
  value.value = Math.max(min, Math.min(max, startValue + delta))
111
137
  }
112
- const onMouseUp = () => {
113
- window.removeEventListener('mousemove', onMouseMove)
114
- window.removeEventListener('mouseup', onMouseUp)
138
+
139
+ function onMouseUp () {
140
+ removeListeners.forEach(fn => fn())
115
141
  resizing.value = false
116
142
  }
117
- window.addEventListener('mousemove', onMouseMove)
118
- window.addEventListener('mouseup', onMouseUp)
119
143
  }
120
144
  useEventListener(el, 'mousedown', onMouseDown)
145
+
146
+ function onTouchStart (event: TouchEvent) {
147
+ event.preventDefault()
148
+ event.stopPropagation()
149
+ const start = axis === 'x' ? event.touches[0].clientX : event.touches[0].clientY
150
+ const startValue = value.value || (axis === 'x' ? iframe.value.offsetWidth : iframe.value.offsetHeight)
151
+ resizing.value = true
152
+
153
+ const removeListeners = [
154
+ addWindowListener('touchmove', onTouchMove),
155
+ addWindowListener('touchend', onTouchEnd),
156
+ addWindowListener('touchcancel', onTouchEnd),
157
+ ]
158
+
159
+ function onTouchMove (event: TouchEvent) {
160
+ const delta = (axis === 'x' ? event.touches[0].clientX : event.touches[0].clientY) - start
161
+ value.value = Math.max(min, Math.min(max, startValue + delta))
162
+ }
163
+
164
+ function onTouchEnd () {
165
+ removeListeners.forEach(fn => fn())
166
+ resizing.value = false
167
+ }
168
+ }
169
+ useEventListener(el, 'touchstart', onTouchStart)
170
+ }
171
+
172
+ // Optimize by batching settings updates to the next frame
173
+ // Prevents sync issues with `useStorage`
174
+ let settingsUpdate: Partial<Settings> = {}
175
+ let settingsUpdateQueued = false
176
+
177
+ function updateSettings (settings: Partial<PreviewSettings>) {
178
+ Object.assign(settingsUpdate, settings)
179
+
180
+ if (!settingsUpdateQueued) {
181
+ settingsUpdateQueued = true
182
+ requestAnimationFrame(() => {
183
+ emit('update:settings', {
184
+ ...props.settings,
185
+ ...settingsUpdate,
186
+ })
187
+ settingsUpdate = {}
188
+ settingsUpdateQueued = false
189
+ })
190
+ }
121
191
  }
122
192
 
123
- const { responsiveWidth, responsiveHeight } = toRefs(props.settings)
193
+ const responsiveWidth = computed({
194
+ get: () => props.settings[props.settings.rotate ? 'responsiveHeight' : 'responsiveWidth'],
195
+ set: (value) => {
196
+ updateSettings({
197
+ [props.settings.rotate ? 'responsiveHeight' : 'responsiveWidth']: value,
198
+ })
199
+ },
200
+ })
201
+ const responsiveHeight = computed({
202
+ get: () => props.settings[props.settings.rotate ? 'responsiveWidth' : 'responsiveHeight'],
203
+ set: (value) => {
204
+ updateSettings({
205
+ [props.settings.rotate ? 'responsiveWidth' : 'responsiveHeight']: value,
206
+ })
207
+ },
208
+ })
124
209
 
125
210
  const horizontalDragger = ref<HTMLDivElement>()
126
211
  const verticalDragger = ref<HTMLDivElement>()
@@ -0,0 +1,68 @@
1
+ <script lang="ts" setup>
2
+ import { useRoute, useRouter } from 'vue-router'
3
+ import { useStoryStore } from '../../stores/story'
4
+
5
+ import BaseSplitPane from '../base/BaseSplitPane.vue'
6
+ import BaseEmpty from '../base/BaseEmpty.vue'
7
+ import BaseTab from '../base/BaseTab.vue'
8
+ import StoryControls from './StoryControls.vue'
9
+ import StoryDocs from './StoryDocs.vue'
10
+ import StorySourceCode from './StorySourceCode.vue'
11
+
12
+ const storyStore = useStoryStore()
13
+
14
+ const router = useRouter()
15
+ const route = useRoute()
16
+ </script>
17
+
18
+ <template>
19
+ <BaseEmpty v-if="!storyStore.currentVariant">
20
+ <span>Select a variant</span>
21
+ </BaseEmpty>
22
+
23
+ <BaseEmpty v-else-if="!storyStore.currentVariant.ready">
24
+ <span>Loading...</span>
25
+ </BaseEmpty>
26
+
27
+ <BaseSplitPane
28
+ v-else
29
+ save-id="story-sidepane"
30
+ orientation="portrait"
31
+ class="htw-h-full"
32
+ >
33
+ <template #first>
34
+ <div class="htw-flex htw-flex-col htw-h-full">
35
+ <nav class="htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750">
36
+ <BaseTab
37
+ :to="{ ...$route, query: { ...$route.query, tab: '' } }"
38
+ :matched="!$route.query.tab"
39
+ >
40
+ Controls
41
+ </BaseTab>
42
+ <BaseTab
43
+ :to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
44
+ :matched="$route.query.tab === 'docs'"
45
+ >
46
+ Docs
47
+ </BaseTab>
48
+ </nav>
49
+
50
+ <component
51
+ :is="$route.query.tab === 'docs'
52
+ ? StoryDocs
53
+ : StoryControls"
54
+ :story="storyStore.currentStory"
55
+ :variant="storyStore.currentVariant"
56
+ class="htw-h-full htw-overflow-auto"
57
+ />
58
+ </div>
59
+ </template>
60
+
61
+ <template #last>
62
+ <StorySourceCode
63
+ :variant="storyStore.currentVariant"
64
+ class="htw-h-full"
65
+ />
66
+ </template>
67
+ </BaseSplitPane>
68
+ </template>
@@ -25,11 +25,11 @@ useScrollOnActive(isActive, el)
25
25
  v-slot="{ active }"
26
26
  :to="targetRoute"
27
27
  :is-active="isActive"
28
- class="htw-px-2 htw-py-1.5 htw-m-1 htw-rounded-sm htw-flex htw-items-center htw-gap-2"
28
+ class="htw-px-2 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm htw-flex htw-items-center htw-gap-2"
29
29
  >
30
30
  <Icon
31
31
  :icon="variant.icon ?? 'carbon:cube'"
32
- class="base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none"
32
+ class="base-list-item-link-icon htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none"
33
33
  :class="{
34
34
  'htw-text-gray-500': !active && !variant.iconColor,
35
35
  'bind-icon-color': !active && variant.iconColor,
@@ -5,6 +5,7 @@ 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 { isMobile } from '../../util/responsive'
8
9
 
9
10
  defineProps({
10
11
  variant: {
@@ -24,7 +25,10 @@ const settings = usePreviewSettings()
24
25
  <template>
25
26
  <div class="htw-h-full htw-flex htw-flex-col">
26
27
  <!-- Toolbar -->
27
- <div class="htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1">
28
+ <div
29
+ v-if="!isMobile"
30
+ class="htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
31
+ >
28
32
  <!-- Variant title -->
29
33
  <div class="htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0">
30
34
  <Icon
@@ -168,9 +172,9 @@ const settings = usePreviewSettings()
168
172
 
169
173
  <!-- Preview -->
170
174
  <StoryResponsivePreview
175
+ v-model:settings="settings"
171
176
  :story="story"
172
177
  :variant="variant"
173
- :settings="settings"
174
178
  />
175
179
  </div>
176
180
  </template>