@histoire/app 0.10.7 → 0.11.1
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/app/style/main.pcss +12 -1
- package/dist/bundled/App.js +4 -148
- package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +156 -0
- package/dist/bundled/_virtual/{plugin-vue_export-helper.js → _plugin-vue_export-helper.js} +4 -2
- package/dist/bundled/api.js +4 -1
- package/dist/bundled/assets/histoire-text-dark.js +4 -2
- package/dist/bundled/assets/histoire-text.js +4 -2
- package/dist/bundled/assets/histoire.js +4 -2
- package/dist/bundled/components/HomeView.js +5 -24
- package/dist/bundled/components/HomeView.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/bundled/components/app/AppHeader.js +5 -67
- package/dist/bundled/components/app/AppHeader.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/bundled/components/app/AppLogo.js +5 -26
- package/dist/bundled/components/app/AppLogo.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/bundled/components/app/Breadcrumb.js +7 -95
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_script_setup_true_lang.js +95 -0
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_afeba72b_lang.js +4 -0
- package/dist/bundled/components/app/InitialLoading.js +5 -48
- package/dist/bundled/components/app/InitialLoading.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/bundled/components/app/MobileOverlay.js +4 -40
- package/dist/bundled/components/app/MobileOverlay.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/bundled/components/base/BaseCheckbox.js +4 -74
- package/dist/bundled/components/base/BaseCheckbox.vue_vue_type_script_setup_true_lang.js +77 -0
- package/dist/bundled/components/base/BaseEmpty.js +7 -5
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_af3328a6_lang.js +4 -0
- package/dist/bundled/components/base/BaseListItemLink.js +7 -25
- package/dist/bundled/components/base/BaseListItemLink.vue_vue_type_script_lang.js +25 -0
- package/dist/bundled/components/base/BaseOverflowMenu.js +4 -96
- package/dist/bundled/components/base/BaseOverflowMenu.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/bundled/components/base/BaseOverflowTab.js +7 -17
- package/dist/bundled/components/base/BaseOverflowTab.vue_vue_type_script_lang.js +17 -0
- package/dist/bundled/components/base/BaseSelect.js +5 -69
- package/dist/bundled/components/base/BaseSelect.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/bundled/components/base/BaseSplitPane.js +7 -184
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_script_setup_true_lang.js +183 -0
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_bb6c600c_lang.js +4 -0
- package/dist/bundled/components/base/BaseTab.js +7 -17
- package/dist/bundled/components/base/BaseTab.vue_vue_type_script_lang.js +17 -0
- package/dist/bundled/components/misc/CheckerboardPattern.js +5 -3
- package/dist/bundled/components/misc/HatchedPattern.js +7 -5
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_91561117_lang.js +4 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.js +5 -98
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/bundled/components/panel/ControlsComponentProps.js +5 -42
- package/dist/bundled/components/panel/ControlsComponentProps.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/bundled/components/panel/PaneTabs.js +4 -111
- package/dist/bundled/components/panel/PaneTabs.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/bundled/components/panel/StatePresets.js +4 -189
- package/dist/bundled/components/panel/StatePresets.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/bundled/components/panel/StoryControls.js +4 -72
- package/dist/bundled/components/panel/StoryControls.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/bundled/components/panel/StoryDocs.js +6 -72
- package/dist/bundled/components/panel/StoryDocs.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/bundled/components/panel/StoryEvent.js +4 -55
- package/dist/bundled/components/panel/StoryEvent.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/bundled/components/panel/StoryEvents.js +5 -49
- package/dist/bundled/components/panel/StoryEvents.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/bundled/components/panel/StorySidePanel.js +5 -72
- package/dist/bundled/components/panel/StorySidePanel.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/bundled/components/panel/StorySourceCode.js +6 -130
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_0d096b10_lang.js +4 -0
- package/dist/bundled/components/search/SearchItem.js +6 -112
- package/dist/bundled/components/search/SearchItem.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_b819ed97_lang.js +4 -0
- package/dist/bundled/components/search/SearchLoading.js +5 -19
- package/dist/bundled/components/search/SearchLoading.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/bundled/components/search/SearchModal.js +4 -45
- package/dist/bundled/components/search/SearchModal.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/bundled/components/search/SearchPane.js +4 -268
- package/dist/bundled/components/search/SearchPane.vue_vue_type_script_setup_true_lang.js +270 -0
- package/dist/bundled/components/search/search-docs-data.js +5 -2
- package/dist/bundled/components/search/search-title-data.js +5 -2
- package/dist/bundled/components/story/GenericMountStory.js +4 -30
- package/dist/bundled/components/story/GenericMountStory.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/bundled/components/story/GenericRenderStory.js +4 -30
- package/dist/bundled/components/story/GenericRenderStory.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/bundled/components/story/StoryResponsivePreview.js +6 -180
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js +183 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_1375d05a_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantGrid.js +5 -94
- package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/bundled/components/story/StoryVariantGridItem.js +7 -108
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +134 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_5ded7495_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantListItem.js +7 -58
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_cc25ec8b_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSingle.js +6 -114
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_afe0bbc2_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +5 -45
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +5 -122
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/bundled/components/story/StoryVariantSingleView.js +4 -48
- package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/bundled/components/story/StoryView.js +4 -89
- package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/bundled/components/story/StoryViewer.js +7 -57
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_54d5a557_lang.js +4 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +7 -85
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_8dc02d19_lang.js +4 -0
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +5 -33
- package/dist/bundled/components/toolbar/StoryVariantNewTab.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +5 -129
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +5 -24
- package/dist/bundled/components/toolbar/StoryVariantTitle.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/bundled/components/tree/StoryGroup.js +4 -73
- package/dist/bundled/components/tree/StoryGroup.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/bundled/components/tree/StoryList.js +5 -37
- package/dist/bundled/components/tree/StoryList.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/bundled/components/tree/StoryListFolder.js +7 -89
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_41fb5f7e_lang.js +4 -0
- package/dist/bundled/components/tree/StoryListItem.js +6 -71
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_313a2f42_lang.js +4 -0
- package/dist/bundled/index.js +6 -3
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +13 -1
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +11 -1
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +4 -1
- package/dist/bundled/router.js +4 -1
- package/dist/bundled/sandbox.js +5 -3
- package/dist/bundled/stores/events.js +3 -1
- package/dist/bundled/stores/folder.js +6 -2
- package/dist/bundled/stores/preview-settings.js +3 -1
- package/dist/bundled/stores/story.js +3 -1
- package/dist/bundled/style.css +40 -46
- package/dist/bundled/util/config.js +5 -2
- package/dist/bundled/util/const.js +6 -1
- package/dist/bundled/util/dark.js +4 -1
- package/dist/bundled/util/env.js +3 -1
- package/dist/bundled/util/events.js +4 -2
- package/dist/bundled/util/keyboard.js +4 -1
- package/dist/bundled/util/mapping.js +4 -1
- package/dist/bundled/util/preview-settings.js +4 -1
- package/dist/bundled/util/responsive.js +3 -1
- package/dist/bundled/util/sandbox.js +3 -1
- package/dist/bundled/util/scroll.js +3 -1
- package/dist/bundled/util/state.js +3 -1
- package/dist/bundled/util/tooltip.js +3 -1
- package/dist/bundled/util/variant.js +3 -1
- package/dist/style.css +203 -122
- package/package.json +6 -6
- package/src/app/App.vue +2 -2
- package/src/app/api.ts +1 -1
- package/src/app/components/base/BaseSplitPane.vue +2 -2
- package/src/app/components/panel/StoryControls.vue +5 -3
- package/src/app/components/panel/StorySourceCode.vue +134 -26
- package/src/app/components/search/search-docs-data.ts +1 -1
- package/src/app/components/search/search-title-data.ts +1 -1
- package/src/app/components/story/StoryResponsivePreview.vue +55 -54
- package/src/app/components/story/StoryVariantGrid.vue +57 -18
- package/src/app/components/story/StoryVariantGridItem.vue +37 -10
- package/src/app/components/story/StoryVariantSingle.vue +2 -2
- package/src/app/index.ts +1 -1
- package/src/app/sandbox.ts +1 -1
- package/src/app/stores/folder.ts +3 -1
- package/src/app/style/main.pcss +12 -1
- package/src/app/util/config.ts +1 -1
- package/src/app/util/events.ts +1 -1
- package/tailwind.config.cjs +12 -0
- package/tsconfig.json +0 -1
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
|
@@ -173,7 +173,7 @@ onUnmounted(() => {
|
|
|
173
173
|
class="htw-relative htw-top-0 htw-left-0 htw-z-20"
|
|
174
174
|
:class="{
|
|
175
175
|
'htw-pointer-events-none': dragging,
|
|
176
|
-
'htw-border-r htw-border-gray-
|
|
176
|
+
'htw-border-r htw-border-gray-300/30 dark:htw-border-gray-800': orientation === 'landscape',
|
|
177
177
|
'htw-flex-none': fixed,
|
|
178
178
|
}"
|
|
179
179
|
:style="leftStyle"
|
|
@@ -195,7 +195,7 @@ onUnmounted(() => {
|
|
|
195
195
|
class="htw-relative htw-bottom-0 htw-right-0"
|
|
196
196
|
:class="{
|
|
197
197
|
'htw-pointer-events-none': dragging,
|
|
198
|
-
'htw-border-t htw-border-gray-
|
|
198
|
+
'htw-border-t htw-border-gray-300/30 dark:htw-border-gray-800': orientation === 'portrait',
|
|
199
199
|
'htw-flex-1': fixed,
|
|
200
200
|
}"
|
|
201
201
|
:style="rightStyle"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { PropType, ref, watch } from 'vue'
|
|
2
|
+
import { computed, PropType, ref, watch } from 'vue'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import GenericRenderStory from '../story/GenericRenderStory.vue'
|
|
5
5
|
import type { Story, Variant } from '../../types'
|
|
@@ -25,6 +25,8 @@ const ready = ref(false)
|
|
|
25
25
|
watch(() => props.variant, () => {
|
|
26
26
|
ready.value = false
|
|
27
27
|
})
|
|
28
|
+
|
|
29
|
+
const hasCustomControls = computed(() => props.variant.slots().controls || props.story.slots().controls)
|
|
28
30
|
</script>
|
|
29
31
|
|
|
30
32
|
<template>
|
|
@@ -37,7 +39,7 @@ watch(() => props.variant, () => {
|
|
|
37
39
|
class="htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center"
|
|
38
40
|
>
|
|
39
41
|
<StatePresets
|
|
40
|
-
v-if="ready"
|
|
42
|
+
v-if="ready || !hasCustomControls"
|
|
41
43
|
:story="story"
|
|
42
44
|
:variant="variant"
|
|
43
45
|
/>
|
|
@@ -45,7 +47,7 @@ watch(() => props.variant, () => {
|
|
|
45
47
|
|
|
46
48
|
<!-- Custom controls -->
|
|
47
49
|
<GenericRenderStory
|
|
48
|
-
v-if="
|
|
50
|
+
v-if="hasCustomControls"
|
|
49
51
|
:key="`${story.id}-${variant.id}`"
|
|
50
52
|
slot-name="controls"
|
|
51
53
|
:variant="variant"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, markRaw, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'
|
|
2
|
+
import { computed, markRaw, nextTick, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import { getHighlighter, Highlighter, setCDN } from 'shiki'
|
|
5
5
|
import { HstCopyIcon } from '@histoire/controls'
|
|
@@ -25,70 +25,174 @@ watchEffect(async () => {
|
|
|
25
25
|
}
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
const sourceCode = ref('')
|
|
29
28
|
const highlighter = shallowRef<Highlighter>()
|
|
30
|
-
const error = ref<string>(null)
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
highlighter.value = await getHighlighter({
|
|
35
|
-
langs: [
|
|
36
|
-
'html',
|
|
37
|
-
'jsx',
|
|
38
|
-
],
|
|
39
|
-
themes: [
|
|
40
|
-
'github-light',
|
|
41
|
-
'github-dark',
|
|
42
|
-
],
|
|
43
|
-
})
|
|
44
|
-
})
|
|
30
|
+
const dynamicSourceCode = ref('')
|
|
31
|
+
const error = ref<string>(null)
|
|
45
32
|
|
|
46
33
|
watch(() => [props.variant, generateSourceCodeFn.value], async () => {
|
|
47
34
|
if (!generateSourceCodeFn.value) return
|
|
48
35
|
error.value = null
|
|
36
|
+
dynamicSourceCode.value = ''
|
|
49
37
|
try {
|
|
50
38
|
if (props.variant.source) {
|
|
51
|
-
|
|
39
|
+
dynamicSourceCode.value = props.variant.source
|
|
52
40
|
} else if (props.variant.slots?.().source) {
|
|
53
41
|
const source = props.variant.slots?.().source()[0].children
|
|
54
42
|
if (source) {
|
|
55
|
-
|
|
43
|
+
dynamicSourceCode.value = await unindent(source)
|
|
56
44
|
}
|
|
57
45
|
} else {
|
|
58
|
-
|
|
46
|
+
dynamicSourceCode.value = await generateSourceCodeFn.value(props.variant)
|
|
59
47
|
}
|
|
60
48
|
} catch (e) {
|
|
61
49
|
console.error(e)
|
|
62
50
|
error.value = e.message
|
|
63
51
|
}
|
|
52
|
+
|
|
53
|
+
// Auto-switch
|
|
54
|
+
if (!dynamicSourceCode.value) {
|
|
55
|
+
displayedSource.value = 'static'
|
|
56
|
+
}
|
|
64
57
|
}, {
|
|
65
58
|
deep: true,
|
|
66
59
|
immediate: true,
|
|
67
60
|
})
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
// Static file source
|
|
63
|
+
|
|
64
|
+
const staticSourceCode = ref('')
|
|
65
|
+
watch(() => [props.story, props.story?.file?.source], async () => {
|
|
66
|
+
staticSourceCode.value = ''
|
|
67
|
+
const sourceLoader = props.story.file?.source
|
|
68
|
+
if (sourceLoader) {
|
|
69
|
+
staticSourceCode.value = (await sourceLoader()).default
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
immediate: true,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const displayedSource = ref<'dynamic' | 'static'>('dynamic')
|
|
76
|
+
|
|
77
|
+
const displayedSourceCode = computed(() => {
|
|
78
|
+
if (displayedSource.value === 'dynamic') {
|
|
79
|
+
return dynamicSourceCode.value
|
|
80
|
+
}
|
|
81
|
+
return staticSourceCode.value
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// HTML render
|
|
85
|
+
|
|
86
|
+
onMounted(async () => {
|
|
87
|
+
setCDN('https://unpkg.com/shiki@0.10.1/')
|
|
88
|
+
highlighter.value = await getHighlighter({
|
|
89
|
+
langs: [
|
|
90
|
+
'html',
|
|
91
|
+
'jsx',
|
|
92
|
+
],
|
|
93
|
+
themes: [
|
|
94
|
+
'github-light',
|
|
95
|
+
'github-dark',
|
|
96
|
+
],
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const sourceHtml = computed(() => displayedSourceCode.value
|
|
101
|
+
? highlighter.value?.codeToHtml(displayedSourceCode.value, {
|
|
71
102
|
lang: 'html',
|
|
72
103
|
theme: isDark.value ? 'github-dark' : 'github-light',
|
|
73
104
|
})
|
|
74
105
|
: '')
|
|
106
|
+
|
|
107
|
+
// Scrolling
|
|
108
|
+
|
|
109
|
+
let lastScroll = 0
|
|
110
|
+
|
|
111
|
+
// Reset
|
|
112
|
+
watch(() => props.variant, () => {
|
|
113
|
+
lastScroll = 0
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const scroller = ref<HTMLElement>()
|
|
117
|
+
|
|
118
|
+
function onScroll (event) {
|
|
119
|
+
if (sourceHtml.value) {
|
|
120
|
+
lastScroll = event.target.scrollTop
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
watch(sourceHtml, async () => {
|
|
125
|
+
await nextTick()
|
|
126
|
+
if (scroller.value) {
|
|
127
|
+
scroller.value.scrollTop = lastScroll
|
|
128
|
+
}
|
|
129
|
+
})
|
|
75
130
|
</script>
|
|
76
131
|
|
|
77
132
|
<template>
|
|
78
133
|
<div
|
|
79
|
-
class="htw-bg-gray-
|
|
134
|
+
class="htw-bg-gray-50 dark:htw-bg-gray-750 htw-h-full htw-overflow-hidden htw-flex htw-flex-col"
|
|
80
135
|
>
|
|
81
136
|
<!-- Toolbar -->
|
|
82
137
|
<div
|
|
83
138
|
v-if="!error"
|
|
84
|
-
class="htw-h-10 htw-flex-none htw-border-b htw-border-solid htw-border-gray-
|
|
139
|
+
class="htw-h-10 htw-flex-none htw-border-b htw-border-solid htw-border-gray-500/5 htw-px-4 htw-flex htw-items-center htw-gap-2"
|
|
85
140
|
>
|
|
86
141
|
<div class="htw-text-gray-900 dark:htw-text-gray-100">
|
|
87
142
|
Source
|
|
88
143
|
</div>
|
|
89
144
|
<div class="htw-flex-1" />
|
|
145
|
+
|
|
146
|
+
<!-- Display source modes -->
|
|
147
|
+
<div class="htw-flex htw-flex-none htw-gap-px htw-h-full htw-py-2">
|
|
148
|
+
<button
|
|
149
|
+
v-tooltip="!dynamicSourceCode ? 'Dynamic source code is not available' : displayedSource !== 'dynamic' ? 'Switch to dynamic source' : null"
|
|
150
|
+
class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-1 htw-bg-gray-500/10 htw-rounded-l htw-transition-all htw-ease-[cubic-bezier(0,1,.6,1)] htw-duration-300 htw-overflow-hidden"
|
|
151
|
+
:class="[
|
|
152
|
+
displayedSource !== 'dynamic' ? 'htw-max-w-6 htw-opacity-70' : 'htw-max-w-[82px] htw-text-primary-600 dark:htw-text-primary-400',
|
|
153
|
+
dynamicSourceCode ? 'htw-cursor-pointer hover:htw-bg-gray-500/30 active:htw-bg-gray-600/50' : 'htw-opacity-50',
|
|
154
|
+
]"
|
|
155
|
+
@click="dynamicSourceCode && (displayedSource = 'dynamic')"
|
|
156
|
+
>
|
|
157
|
+
<Icon
|
|
158
|
+
icon="carbon:flash"
|
|
159
|
+
class="htw-w-4 htw-h-4 htw-flex-none"
|
|
160
|
+
/>
|
|
161
|
+
<span
|
|
162
|
+
class="transition-opacity duration-300"
|
|
163
|
+
:class="{
|
|
164
|
+
'opacity-0': displayedSource !== 'dynamic',
|
|
165
|
+
}"
|
|
166
|
+
>
|
|
167
|
+
Dynamic
|
|
168
|
+
</span>
|
|
169
|
+
</button>
|
|
170
|
+
<button
|
|
171
|
+
v-tooltip="!staticSourceCode ? 'Static source code is not available' : displayedSource !== 'static' ? 'Switch to static source' : null"
|
|
172
|
+
class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-1 htw-bg-gray-500/10 htw-rounded-r htw-transition-all htw-ease-[cubic-bezier(0,1,.6,1)] htw-duration-300 htw-overflow-hidden"
|
|
173
|
+
:class="[
|
|
174
|
+
displayedSource !== 'static' ? 'htw-max-w-6 htw-opacity-70' : 'htw-max-w-[63px] htw-text-primary-600 dark:htw-text-primary-400',
|
|
175
|
+
staticSourceCode ? 'htw-cursor-pointer hover:htw-bg-gray-500/30 active:htw-bg-gray-600/50' : 'htw-opacity-50',
|
|
176
|
+
]"
|
|
177
|
+
@click="staticSourceCode && (displayedSource = 'static')"
|
|
178
|
+
>
|
|
179
|
+
<Icon
|
|
180
|
+
icon="carbon:document"
|
|
181
|
+
class="htw-w-4 htw-h-4 htw-flex-none"
|
|
182
|
+
/>
|
|
183
|
+
<span
|
|
184
|
+
class="transition-opacity duration-300"
|
|
185
|
+
:class="{
|
|
186
|
+
'opacity-0': displayedSource !== 'static',
|
|
187
|
+
}"
|
|
188
|
+
>
|
|
189
|
+
Static
|
|
190
|
+
</span>
|
|
191
|
+
</button>
|
|
192
|
+
</div>
|
|
193
|
+
|
|
90
194
|
<HstCopyIcon
|
|
91
|
-
:content="
|
|
195
|
+
:content="displayedSourceCode"
|
|
92
196
|
class="htw-flex-none"
|
|
93
197
|
/>
|
|
94
198
|
</div>
|
|
@@ -100,7 +204,7 @@ const sourceHtml = computed(() => sourceCode.value
|
|
|
100
204
|
Error: {{ error }}
|
|
101
205
|
</div>
|
|
102
206
|
|
|
103
|
-
<BaseEmpty v-else-if="!
|
|
207
|
+
<BaseEmpty v-else-if="!displayedSourceCode">
|
|
104
208
|
<Icon
|
|
105
209
|
icon="carbon:code-hide"
|
|
106
210
|
class="htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
@@ -110,16 +214,20 @@ const sourceHtml = computed(() => sourceCode.value
|
|
|
110
214
|
|
|
111
215
|
<textarea
|
|
112
216
|
v-else-if="!sourceHtml"
|
|
217
|
+
ref="scroller"
|
|
113
218
|
class="__histoire-code-placeholder htw-w-full htw-h-full htw-p-4 htw-outline-none htw-bg-transparent htw-resize-none htw-m-0"
|
|
114
|
-
:value="
|
|
219
|
+
:value="displayedSourceCode"
|
|
115
220
|
readonly
|
|
116
221
|
data-test-id="story-source-code"
|
|
222
|
+
@scroll="onScroll"
|
|
117
223
|
/>
|
|
118
224
|
<!-- eslint-disable vue/no-v-html -->
|
|
119
225
|
<div
|
|
120
226
|
v-else
|
|
227
|
+
ref="scroller"
|
|
121
228
|
class="htw-w-full htw-h-full htw-overflow-auto"
|
|
122
229
|
data-test-id="story-source-code"
|
|
230
|
+
@scroll="onScroll"
|
|
123
231
|
>
|
|
124
232
|
<div
|
|
125
233
|
class="__histoire-code htw-p-4 htw-w-fit"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { markRaw } from 'vue'
|
|
2
2
|
// @ts-expect-error virtual module
|
|
3
|
-
import { searchData as _searchData, onUpdate as _onUpdate } from '
|
|
3
|
+
import { searchData as _searchData, onUpdate as _onUpdate } from 'virtual:$histoire-search-docs-data'
|
|
4
4
|
import type { SearchData } from './types.js'
|
|
5
5
|
|
|
6
6
|
export const searchData: SearchData = markRaw(_searchData)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { markRaw } from 'vue'
|
|
2
2
|
// @ts-expect-error virtual module
|
|
3
|
-
import { searchData as _searchData, onUpdate as _onUpdate } from '
|
|
3
|
+
import { searchData as _searchData, onUpdate as _onUpdate } from 'virtual:$histoire-search-title-data'
|
|
4
4
|
import type { SearchData } from './types.js'
|
|
5
5
|
|
|
6
6
|
export const searchData: SearchData = markRaw(_searchData)
|
|
@@ -118,13 +118,13 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
|
|
|
118
118
|
</script>
|
|
119
119
|
|
|
120
120
|
<template>
|
|
121
|
-
<div class="htw-w-full htw-h-full htw-flex-1 htw-
|
|
121
|
+
<div class="htw-w-full htw-h-full htw-flex-1 htw-rounded-lg htw-relative htw-overflow-hidden">
|
|
122
122
|
<div
|
|
123
123
|
v-if="isResponsiveEnabled"
|
|
124
|
-
class="htw-absolute htw-inset-0 htw-w-full htw-h-full htw-bg-gray-
|
|
124
|
+
class="htw-absolute htw-inset-0 htw-w-full htw-h-full htw-bg-gray-100 dark:htw-bg-gray-750 htw-rounded-r-lg htw-border-l-2 htw-border-gray-500/10 dark:htw-border-gray-700/30 htw-overflow-hidden"
|
|
125
125
|
>
|
|
126
126
|
<HatchedPattern
|
|
127
|
-
class="htw-w-full htw-h-full htw-text-black/[
|
|
127
|
+
class="htw-w-full htw-h-full htw-text-black/[1%] dark:htw-text-white/[1%]"
|
|
128
128
|
/>
|
|
129
129
|
</div>
|
|
130
130
|
|
|
@@ -133,65 +133,66 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
|
|
|
133
133
|
class="htw-h-full htw-overflow-auto htw-relative"
|
|
134
134
|
>
|
|
135
135
|
<div
|
|
136
|
-
class="htw-h-full htw-
|
|
136
|
+
class="htw-h-full htw-overflow-hidden htw-bg-white dark:htw-bg-gray-700 htw-rounded-lg htw-relative"
|
|
137
137
|
:class="isResponsiveEnabled ? {
|
|
138
138
|
'htw-w-fit': !!finalWidth,
|
|
139
139
|
'htw-h-fit': !!finalHeight
|
|
140
140
|
} : undefined"
|
|
141
141
|
>
|
|
142
|
-
<div class="htw-
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
142
|
+
<div class="bind-preview-bg htw-rounded-lg htw-h-full">
|
|
143
|
+
<CheckerboardPattern
|
|
144
|
+
v-if="settings.checkerboard"
|
|
145
|
+
class="htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
146
|
+
/>
|
|
147
|
+
<div class="htw-p-8 htw-h-full htw-relative">
|
|
148
|
+
<div class="htw-w-full htw-h-full htw-relative">
|
|
149
|
+
<div class="htw-absolute htw-inset-0" />
|
|
150
|
+
|
|
151
|
+
<slot
|
|
152
|
+
:is-responsive-enabled="isResponsiveEnabled"
|
|
153
|
+
:final-width="finalWidth"
|
|
154
|
+
:final-height="finalHeight"
|
|
155
|
+
:resizing="resizing"
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<!-- Markers -->
|
|
160
|
+
<div class="htw-absolute htw-top-5 htw-left-8 htw-h-2 htw-w-px htw-bg-gray-400/25" />
|
|
161
|
+
<div class="htw-absolute htw-top-5 htw-right-8 htw-h-2 htw-w-px htw-bg-gray-400/25" />
|
|
162
|
+
<div class="htw-absolute htw-bottom-5 htw-left-8 htw-h-2 htw-w-px htw-bg-gray-400/25" />
|
|
163
|
+
<div class="htw-absolute htw-bottom-5 htw-right-8 htw-h-2 htw-w-px htw-bg-gray-400/25" />
|
|
164
|
+
<div class="htw-absolute htw-left-5 htw-top-8 htw-w-2 htw-h-px htw-bg-gray-400/25" />
|
|
165
|
+
<div class="htw-absolute htw-left-5 htw-bottom-8 htw-w-2 htw-h-px htw-bg-gray-400/25" />
|
|
166
|
+
<div class="htw-absolute htw-right-5 htw-top-8 htw-w-2 htw-h-px htw-bg-gray-400/25" />
|
|
167
|
+
<div class="htw-absolute htw-right-5 htw-bottom-8 htw-w-2 htw-h-px htw-bg-gray-400/25" />
|
|
157
168
|
</div>
|
|
158
169
|
|
|
159
|
-
<!--
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
ref="verticalDragger"
|
|
183
|
-
class="htw-absolute htw-h-4 htw-left-0 htw-right-4 htw-bottom-0 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-items-center htw-justify-center htw-cursor-ns-resize htw-group hover:htw-text-primary-500"
|
|
184
|
-
>
|
|
185
|
-
<Icon
|
|
186
|
-
icon="mdi:drag-horizontal-variant"
|
|
187
|
-
class="htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
|
|
170
|
+
<!-- Resize Dragger -->
|
|
171
|
+
<template v-if="isResponsiveEnabled">
|
|
172
|
+
<div
|
|
173
|
+
ref="horizontalDragger"
|
|
174
|
+
class="htw-absolute htw-w-4 htw-top-0 htw-bottom-4 htw-right-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-ew-resize htw-group hover:htw-text-primary-500"
|
|
175
|
+
>
|
|
176
|
+
<Icon
|
|
177
|
+
icon="mdi:drag-vertical-variant"
|
|
178
|
+
class="htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
<div
|
|
182
|
+
ref="verticalDragger"
|
|
183
|
+
class="htw-absolute htw-h-4 htw-left-0 htw-right-4 htw-bottom-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-ns-resize htw-group hover:htw-text-primary-500"
|
|
184
|
+
>
|
|
185
|
+
<Icon
|
|
186
|
+
icon="mdi:drag-horizontal-variant"
|
|
187
|
+
class="htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
<div
|
|
191
|
+
ref="cornerDragger"
|
|
192
|
+
class="htw-absolute htw-w-4 htw-h-4 htw-right-0 htw-bottom-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-nwse-resize htw-group hover:htw-text-primary-500"
|
|
188
193
|
/>
|
|
189
|
-
</
|
|
190
|
-
|
|
191
|
-
ref="cornerDragger"
|
|
192
|
-
class="htw-absolute htw-w-4 htw-h-4 htw-right-0 htw-bottom-0 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-items-center htw-justify-center htw-cursor-nwse-resize htw-group hover:htw-text-primary-500"
|
|
193
|
-
/>
|
|
194
|
-
</template>
|
|
194
|
+
</template>
|
|
195
|
+
</div>
|
|
195
196
|
</div>
|
|
196
197
|
</div>
|
|
197
198
|
</div>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { useResizeObserver } from '@vueuse/core'
|
|
3
|
-
import { computed, ref, watch } from 'vue'
|
|
3
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
4
4
|
import { useStoryStore } from '../../stores/story'
|
|
5
|
+
import { isMobile } from '../../util/responsive'
|
|
5
6
|
import StoryVariantGridItem from './StoryVariantGridItem.vue'
|
|
7
|
+
import StoryVariantBackground from '../toolbar/StoryVariantBackground.vue'
|
|
6
8
|
|
|
7
9
|
const storyStore = useStoryStore()
|
|
8
10
|
|
|
@@ -37,6 +39,7 @@ const el = ref<HTMLDivElement>(null)
|
|
|
37
39
|
|
|
38
40
|
useResizeObserver(el, () => {
|
|
39
41
|
updateMaxCount()
|
|
42
|
+
updateSize()
|
|
40
43
|
})
|
|
41
44
|
|
|
42
45
|
function updateMaxCount () {
|
|
@@ -80,32 +83,68 @@ function onItemResize (w: number, h: number) {
|
|
|
80
83
|
watch(() => storyStore.currentVariant, () => {
|
|
81
84
|
updateMaxCount()
|
|
82
85
|
})
|
|
86
|
+
|
|
87
|
+
// Grid size
|
|
88
|
+
|
|
89
|
+
const gridEl = ref<HTMLDivElement>(null)
|
|
90
|
+
const gridColumnWidth = ref(1)
|
|
91
|
+
const viewWidth = ref(1)
|
|
92
|
+
|
|
93
|
+
function updateSize () {
|
|
94
|
+
if (!el.value) return
|
|
95
|
+
viewWidth.value = el.value.clientWidth
|
|
96
|
+
|
|
97
|
+
if (!gridEl.value) return
|
|
98
|
+
|
|
99
|
+
const firstCellEl = gridEl.value.children[0] as HTMLDivElement
|
|
100
|
+
if (!firstCellEl) return
|
|
101
|
+
|
|
102
|
+
gridColumnWidth.value = firstCellEl.clientWidth
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
onMounted(() => {
|
|
106
|
+
updateSize()
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))))
|
|
83
110
|
</script>
|
|
84
111
|
|
|
85
112
|
<template>
|
|
86
|
-
<div
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
<div class="htw-flex htw-flex-col htw-items-stretch htw-h-full">
|
|
114
|
+
<!-- Toolbar -->
|
|
115
|
+
<div
|
|
116
|
+
v-if="!isMobile"
|
|
117
|
+
class="htw-flex-none htw-flex htw-items-center htw-justify-end htw-h-8 htw-mx-2 htw-mt-1"
|
|
118
|
+
>
|
|
119
|
+
<StoryVariantBackground />
|
|
120
|
+
</div>
|
|
121
|
+
|
|
91
122
|
<div
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
ref="el"
|
|
124
|
+
class="htw-overflow-y-auto __histoire-pane-shadow-from-right htw-flex htw-flex-1"
|
|
125
|
+
@scroll="updateMaxCount()"
|
|
95
126
|
>
|
|
96
127
|
<div
|
|
97
|
-
class="htw-
|
|
128
|
+
class="htw-m-auto"
|
|
98
129
|
:style="{
|
|
99
|
-
|
|
130
|
+
minHeight: `${(storyStore.currentStory.variants.length / countPerRow) * (maxItemHeight + gap) - gap}px`,
|
|
100
131
|
}"
|
|
101
132
|
>
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
133
|
+
<div
|
|
134
|
+
ref="gridEl"
|
|
135
|
+
class="htw-grid htw-gap-4 htw-m-4"
|
|
136
|
+
:style="{
|
|
137
|
+
gridTemplateColumns: `repeat(${columnCount}, ${gridTemplateWidth})`,
|
|
138
|
+
}"
|
|
139
|
+
>
|
|
140
|
+
<StoryVariantGridItem
|
|
141
|
+
v-for="(variant, index) of storyStore.currentStory.variants.slice(0, maxCount)"
|
|
142
|
+
:key="index"
|
|
143
|
+
:variant="variant"
|
|
144
|
+
:story="storyStore.currentStory"
|
|
145
|
+
@resize="onItemResize"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
109
148
|
</div>
|
|
110
149
|
</div>
|
|
111
150
|
</div>
|
|
@@ -3,10 +3,13 @@ import { PropType, ref, toRefs } from 'vue'
|
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import { useRouter } from 'vue-router'
|
|
5
5
|
import { useResizeObserver } from '@vueuse/core'
|
|
6
|
-
import GenericRenderStory from './GenericRenderStory.vue'
|
|
7
6
|
import { useCurrentVariantRoute } from '../../util/variant'
|
|
8
7
|
import type { Story, Variant } from '../../types'
|
|
9
8
|
import { useScrollOnActive } from '../../util/scroll'
|
|
9
|
+
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
10
|
+
import GenericRenderStory from './GenericRenderStory.vue'
|
|
11
|
+
import StoryVariantNewTab from '../toolbar/StoryVariantNewTab.vue'
|
|
12
|
+
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
10
13
|
|
|
11
14
|
const props = defineProps({
|
|
12
15
|
variant: {
|
|
@@ -55,18 +58,21 @@ useResizeObserver(el, () => {
|
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
})
|
|
61
|
+
|
|
62
|
+
const settings = usePreviewSettingsStore().currentSettings
|
|
58
63
|
</script>
|
|
59
64
|
|
|
60
65
|
<template>
|
|
61
66
|
<div
|
|
62
67
|
ref="el"
|
|
63
|
-
class="htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
|
|
68
|
+
class="htw-cursor-default htw-flex htw-flex-col htw-gap-y-1 htw-group"
|
|
64
69
|
>
|
|
65
70
|
<!-- Header -->
|
|
66
71
|
<div class="htw-flex-none htw-flex htw-items-center">
|
|
67
72
|
<RouterLink
|
|
73
|
+
v-tooltip="variant.title"
|
|
68
74
|
:to="targetRoute"
|
|
69
|
-
class="htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1"
|
|
75
|
+
class="htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1 htw-flex-shrink"
|
|
70
76
|
:class="{
|
|
71
77
|
'hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800': !isActive,
|
|
72
78
|
'htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800 dark:htw-bg-primary-700 dark:hover:htw-bg-primary-800 dark:htw-text-primary-200': isActive,
|
|
@@ -80,13 +86,21 @@ useResizeObserver(el, () => {
|
|
|
80
86
|
'bind-icon-color': !isActive && variant.iconColor,
|
|
81
87
|
}"
|
|
82
88
|
/>
|
|
83
|
-
<span>{{ variant.title }}</span>
|
|
89
|
+
<span class="htw-truncate htw-flex-1">{{ variant.title }}</span>
|
|
84
90
|
</RouterLink>
|
|
91
|
+
|
|
92
|
+
<!-- Toolbar -->
|
|
93
|
+
<div class="htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center">
|
|
94
|
+
<StoryVariantNewTab
|
|
95
|
+
:variant="variant"
|
|
96
|
+
:story="story"
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
85
99
|
</div>
|
|
86
100
|
|
|
87
101
|
<!-- Body -->
|
|
88
102
|
<div
|
|
89
|
-
class="htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded
|
|
103
|
+
class="htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded htw-flex-1 htw-p-4 htw-relative"
|
|
90
104
|
:class="{
|
|
91
105
|
'htw-border-gray-100 dark:htw-border-gray-800': !isActive,
|
|
92
106
|
'htw-border-primary-200 dark:htw-border-primary-900': isActive,
|
|
@@ -95,12 +109,21 @@ useResizeObserver(el, () => {
|
|
|
95
109
|
@click.stop="selectVariant()"
|
|
96
110
|
@keyup="selectVariant()"
|
|
97
111
|
>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
<div class="htw-absolute htw-inset-0 htw-rounded bind-preview-bg" />
|
|
113
|
+
|
|
114
|
+
<CheckerboardPattern
|
|
115
|
+
v-if="settings.checkerboard"
|
|
116
|
+
class="htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
103
117
|
/>
|
|
118
|
+
|
|
119
|
+
<div class="htw-relative htw-h-full">
|
|
120
|
+
<GenericRenderStory
|
|
121
|
+
:key="`${story.id}-${variant.id}`"
|
|
122
|
+
:variant="variant"
|
|
123
|
+
:story="story"
|
|
124
|
+
@ready="onReady"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
104
127
|
</div>
|
|
105
128
|
</div>
|
|
106
129
|
</template>
|
|
@@ -109,4 +132,8 @@ useResizeObserver(el, () => {
|
|
|
109
132
|
.bind-icon-color {
|
|
110
133
|
color: v-bind('variant.iconColor');
|
|
111
134
|
}
|
|
135
|
+
|
|
136
|
+
.bind-preview-bg {
|
|
137
|
+
background-color: v-bind('settings.backgroundColor');
|
|
138
|
+
}
|
|
112
139
|
</style>
|
|
@@ -21,7 +21,7 @@ const variant = computed(() => storyStore.currentVariant)
|
|
|
21
21
|
<template>
|
|
22
22
|
<div
|
|
23
23
|
v-if="hasSingleVariant && variant"
|
|
24
|
-
class="htw-p-2 htw-h-full"
|
|
24
|
+
class="htw-p-2 htw-h-full __histoire-pane-shadow-from-right"
|
|
25
25
|
>
|
|
26
26
|
<StoryVariantSingleView
|
|
27
27
|
:variant="variant"
|
|
@@ -86,7 +86,7 @@ const variant = computed(() => storyStore.currentVariant)
|
|
|
86
86
|
<template #last>
|
|
87
87
|
<div
|
|
88
88
|
v-if="storyStore.currentVariant"
|
|
89
|
-
class="htw-p-2 htw-h-full"
|
|
89
|
+
class="htw-p-2 htw-h-full __histoire-pane-shadow-from-right"
|
|
90
90
|
>
|
|
91
91
|
<StoryVariantSingleView
|
|
92
92
|
:variant="storyStore.currentVariant"
|