@histoire/app 0.11.4 → 0.11.6
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/{floating-vue.pcss → floating.pcss} +0 -0
- package/dist/app/style/main.pcss +46 -44
- package/dist/app/style/sandbox.css +1 -1
- package/dist/bundle-main-dev.js +4 -0
- package/dist/bundle-sandbox-dev.js +2 -0
- package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/HomeView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/app/AppHeader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/app/AppLogo.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/bundled/components/app/Breadcrumb.js +2 -2
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_36846ccf_lang.js +4 -0
- package/dist/bundled/components/app/InitialLoading.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/app/MobileOverlay.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/base/BaseCheckbox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/base/BaseEmpty.js +4 -4
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_c5ecfead_lang.js +4 -0
- package/dist/bundled/components/base/BaseListItemLink.js +1 -1
- package/dist/bundled/components/base/BaseOverflowMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/base/BaseOverflowTab.js +1 -1
- package/dist/bundled/components/base/BaseSelect.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/bundled/components/base/BaseSplitPane.js +2 -2
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_ed925107_lang.js +4 -0
- package/dist/bundled/components/base/BaseTab.js +1 -1
- package/dist/bundled/components/base/BaseTag.js +13 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/bundled/components/panel/ControlsComponentProps.vue_vue_type_script_setup_true_lang.js +8 -7
- package/dist/bundled/components/panel/PaneTabs.vue_vue_type_script_setup_true_lang.js +15 -12
- package/dist/bundled/components/panel/StatePresets.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/panel/StoryControls.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/panel/StoryDocs.vue_vue_type_script_setup_true_lang.js +17 -2
- package/dist/bundled/components/panel/StoryEvent.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/panel/StoryEvents.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/bundled/components/panel/StorySidePanel.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/bundled/components/panel/StorySourceCode.js +2 -2
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_36810e45_lang.js +4 -0
- package/dist/bundled/components/search/SearchItem.js +2 -2
- package/dist/bundled/components/search/SearchItem.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_d95fcb03_lang.js +4 -0
- package/dist/bundled/components/search/SearchLoading.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/search/SearchModal.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/search/SearchPane.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/story/GenericMountStory.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/bundled/components/story/GenericRenderStory.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/bundled/components/story/StoryResponsivePreview.js +2 -2
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js +41 -12
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_a83b1911_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/bundled/components/story/StoryVariantGridItem.js +2 -2
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +21 -9
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_f7c98176_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantListItem.js +2 -2
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_ab890d9c_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSingle.js +2 -2
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_ddfc5b4f_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue_vue_type_script_setup_true_lang.js +19 -7
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/bundled/components/story/StoryViewer.js +2 -2
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_6046525f_lang.js +4 -0
- package/dist/bundled/components/toolbar/ToolbarBackground.js +2 -2
- package/dist/bundled/components/toolbar/ToolbarBackground.vue_vue_type_script_setup_true_lang.js +32 -18
- package/dist/bundled/components/toolbar/ToolbarBackground.vue_vue_type_style_index_0_scoped_c48fb2b2_lang.js +4 -0
- package/dist/bundled/components/toolbar/ToolbarNewTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarTitle.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/tree/StoryGroup.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/tree/StoryList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/tree/StoryListFolder.js +2 -2
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_2fedbe45_lang.js +4 -0
- package/dist/bundled/components/tree/StoryListItem.js +2 -2
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_19810958_lang.js +4 -0
- package/dist/bundled/style.css +48 -47
- package/dist/bundled/util/preview-settings.js +11 -0
- package/dist/style.css +55 -55
- package/package.json +4 -4
- package/src/app/App.vue +1 -1
- package/src/app/components/HomeView.vue +1 -1
- package/src/app/components/app/AppHeader.vue +1 -1
- package/src/app/components/app/AppLogo.vue +1 -0
- package/src/app/components/app/Breadcrumb.vue +1 -1
- package/src/app/components/app/InitialLoading.vue +1 -1
- package/src/app/components/app/MobileOverlay.vue +1 -1
- package/src/app/components/base/BaseCheckbox.vue +1 -1
- package/src/app/components/base/BaseCopyIcon.vue +1 -1
- package/src/app/components/base/BaseEmpty.vue +1 -1
- package/src/app/components/base/BaseListItemLink.vue +1 -0
- package/src/app/components/base/BaseOverflowMenu.vue +1 -1
- package/src/app/components/base/BaseOverflowTab.vue +1 -0
- package/src/app/components/base/BaseSelect.vue +1 -0
- package/src/app/components/base/BaseSplitPane.vue +1 -1
- package/src/app/components/base/BaseTab.vue +1 -0
- package/src/app/components/base/BaseTag.vue +5 -0
- package/src/app/components/panel/ControlsComponentPropItem.vue +1 -0
- package/src/app/components/panel/ControlsComponentProps.vue +1 -1
- package/src/app/components/panel/PaneTabs.vue +7 -12
- package/src/app/components/panel/StatePresets.vue +1 -1
- package/src/app/components/panel/StoryControls.vue +1 -1
- package/src/app/components/panel/StoryDocs.vue +30 -1
- package/src/app/components/panel/StoryEvent.vue +1 -1
- package/src/app/components/panel/StoryEvents.vue +4 -1
- package/src/app/components/panel/StorySidePanel.vue +9 -3
- package/src/app/components/panel/StorySourceCode.vue +1 -1
- package/src/app/components/search/SearchItem.vue +1 -0
- package/src/app/components/search/SearchLoading.vue +1 -1
- package/src/app/components/search/SearchModal.vue +1 -1
- package/src/app/components/search/SearchPane.vue +1 -1
- package/src/app/components/story/GenericMountStory.vue +1 -0
- package/src/app/components/story/GenericRenderStory.vue +1 -0
- package/src/app/components/story/StoryResponsivePreview.vue +11 -2
- package/src/app/components/story/StoryVariantGrid.vue +5 -1
- package/src/app/components/story/StoryVariantGridItem.vue +18 -4
- package/src/app/components/story/StoryVariantListItem.vue +1 -0
- package/src/app/components/story/StoryVariantSingle.vue +1 -1
- package/src/app/components/story/StoryVariantSinglePreviewNative.vue +17 -5
- package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +1 -0
- package/src/app/components/story/StoryVariantSingleView.vue +1 -1
- package/src/app/components/story/StoryView.vue +5 -2
- package/src/app/components/story/StoryViewer.vue +1 -1
- package/src/app/components/toolbar/ToolbarBackground.vue +21 -7
- package/src/app/components/toolbar/ToolbarNewTab.vue +1 -1
- package/src/app/components/toolbar/ToolbarResponsiveSize.vue +3 -3
- package/src/app/components/toolbar/ToolbarTextDirection.vue +1 -1
- package/src/app/components/toolbar/ToolbarTitle.vue +1 -1
- package/src/app/components/tree/StoryGroup.vue +1 -1
- package/src/app/components/tree/StoryList.vue +1 -1
- package/src/app/components/tree/StoryListFolder.vue +4 -1
- package/src/app/components/tree/StoryListItem.vue +1 -0
- package/src/app/style/{floating-vue.pcss → floating.pcss} +0 -0
- package/src/app/style/main.pcss +46 -44
- package/src/app/style/sandbox.css +1 -1
- package/src/app/util/preview-settings.ts +13 -0
- package/src/bundle-main-dev.js +4 -0
- package/src/bundle-sandbox-dev.js +2 -0
- package/tailwind.config.cjs +1 -1
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_3c779b73_lang.js +0 -4
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_af3328a6_lang.js +0 -4
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_bb6c600c_lang.js +0 -4
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_0d096b10_lang.js +0 -4
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_b819ed97_lang.js +0 -4
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_1375d05a_lang.js +0 -4
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_601cc357_lang.js +0 -4
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_02816158_lang.js +0 -4
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_89489ae4_lang.js +0 -4
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_54d5a557_lang.js +0 -4
- package/dist/bundled/components/toolbar/ToolbarBackground.vue_vue_type_style_index_0_scoped_8d0cb17e_lang.js +0 -4
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_41fb5f7e_lang.js +0 -4
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_d1a05247_lang.js +0 -4
|
@@ -13,7 +13,7 @@ const emits = defineEmits<{(e: 'close'): void}>()
|
|
|
13
13
|
<transition name="__histoire-fade-bottom">
|
|
14
14
|
<div
|
|
15
15
|
v-if="opened"
|
|
16
|
-
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"
|
|
16
|
+
class="histoire-mobile-overlay 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"
|
|
17
17
|
>
|
|
18
18
|
<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">
|
|
19
19
|
<span class="htw-text-gray-500">{{ title }}</span>
|
|
@@ -35,7 +35,7 @@ watch(path, () => {
|
|
|
35
35
|
<div
|
|
36
36
|
role="checkbox"
|
|
37
37
|
tabindex="0"
|
|
38
|
-
class="htw-flex htw-items-center htw-gap-2 htw-select-none htw-px-4 htw-py-3 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
|
|
38
|
+
class="histoire-base-checkbox htw-flex htw-items-center htw-gap-2 htw-select-none htw-px-4 htw-py-3 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
|
|
39
39
|
@click="toggle()"
|
|
40
40
|
@keydown.enter.prevent="toggle()"
|
|
41
41
|
@keydown.space.prevent="toggle()"
|
|
@@ -28,7 +28,7 @@ const action = () => copy(props.content)
|
|
|
28
28
|
delay: 0,
|
|
29
29
|
}"
|
|
30
30
|
icon="carbon:copy-file"
|
|
31
|
-
class="htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer"
|
|
31
|
+
class="histoire-base-copy-icon htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer"
|
|
32
32
|
@click="action()"
|
|
33
33
|
/>
|
|
34
34
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="htw-base-empty htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 htw-text-lg">
|
|
2
|
+
<div class="histoire-base-empty htw-base-empty htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 htw-text-lg">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -161,7 +161,7 @@ onUnmounted(() => {
|
|
|
161
161
|
<template>
|
|
162
162
|
<div
|
|
163
163
|
ref="el"
|
|
164
|
-
class="htw-flex htw-h-full htw-isolate htw-overflow-auto"
|
|
164
|
+
class="histoire-base-split-pane htw-flex htw-h-full htw-isolate htw-overflow-auto"
|
|
165
165
|
:class="{
|
|
166
166
|
'htw-flex-col': orientation === 'portrait',
|
|
167
167
|
'htw-cursor-ew-resize': dragging && orientation === 'landscape',
|
|
@@ -6,6 +6,7 @@ import type { Story, Variant } from '../../types'
|
|
|
6
6
|
import BaseOverflowMenu from '../base/BaseOverflowMenu.vue'
|
|
7
7
|
import BaseOverflowTab from '../base/BaseOverflowTab.vue'
|
|
8
8
|
import { useStoryDoc } from './StoryDocs.vue'
|
|
9
|
+
import BaseTag from '../base/BaseTag.vue'
|
|
9
10
|
|
|
10
11
|
const props = defineProps<{
|
|
11
12
|
story: Story
|
|
@@ -21,7 +22,7 @@ const hasEvents = computed(() => eventsStore.events.length)
|
|
|
21
22
|
</script>
|
|
22
23
|
|
|
23
24
|
<template>
|
|
24
|
-
<BaseOverflowMenu class="htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750">
|
|
25
|
+
<BaseOverflowMenu class="histoire-pane-tabs htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750">
|
|
25
26
|
<BaseTab
|
|
26
27
|
:to="{ ...$route, query: { ...$route.query, tab: '' } }"
|
|
27
28
|
:matched="!$route.query.tab"
|
|
@@ -45,12 +46,9 @@ const hasEvents = computed(() => eventsStore.events.length)
|
|
|
45
46
|
}"
|
|
46
47
|
>
|
|
47
48
|
Events
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
>
|
|
52
|
-
{{ eventsStore.unseen <=99 ? eventsStore.unseen : "99+" }}
|
|
53
|
-
</span>
|
|
49
|
+
<BaseTag v-if="eventsStore.unseen">
|
|
50
|
+
{{ eventsStore.unseen <= 99 ? eventsStore.unseen : "99+" }}
|
|
51
|
+
</BaseTag>
|
|
54
52
|
</BaseTab>
|
|
55
53
|
|
|
56
54
|
<template #overflow>
|
|
@@ -77,12 +75,9 @@ const hasEvents = computed(() => eventsStore.events.length)
|
|
|
77
75
|
}"
|
|
78
76
|
>
|
|
79
77
|
Events
|
|
80
|
-
<
|
|
81
|
-
v-if="eventsStore.unseen"
|
|
82
|
-
class="htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
|
|
83
|
-
>
|
|
78
|
+
<BaseTag v-if="eventsStore.unseen">
|
|
84
79
|
{{ eventsStore.unseen <= 99 ? eventsStore.unseen : "99+" }}
|
|
85
|
-
</
|
|
80
|
+
</BaseTag>
|
|
86
81
|
</BaseOverflowTab>
|
|
87
82
|
</template>
|
|
88
83
|
</BaseOverflowMenu>
|
|
@@ -115,7 +115,7 @@ onClickOutside(select, stopEditing)
|
|
|
115
115
|
</script>
|
|
116
116
|
|
|
117
117
|
<template>
|
|
118
|
-
<div class="htw-flex htw-gap-2 htw-w-full htw-items-center">
|
|
118
|
+
<div class="histoire-state-presets htw-flex htw-gap-2 htw-w-full htw-items-center">
|
|
119
119
|
<div
|
|
120
120
|
ref="select"
|
|
121
121
|
class="htw-flex-1 htw-min-w-0"
|
|
@@ -32,7 +32,7 @@ const hasCustomControls = computed(() => props.variant.slots().controls || props
|
|
|
32
32
|
<template>
|
|
33
33
|
<div
|
|
34
34
|
data-test-id="story-controls"
|
|
35
|
-
class="htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-750"
|
|
35
|
+
class="histoire-story-controls htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-750"
|
|
36
36
|
>
|
|
37
37
|
<!-- Toolbar -->
|
|
38
38
|
<div
|
|
@@ -47,6 +47,7 @@ export function useStoryDoc (story: Ref<Story>) {
|
|
|
47
47
|
|
|
48
48
|
<script lang="ts" setup>
|
|
49
49
|
import { Icon } from '@iconify/vue'
|
|
50
|
+
import { useRouter } from '@histoire/vendors/vue-router'
|
|
50
51
|
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
51
52
|
|
|
52
53
|
const props = defineProps({
|
|
@@ -59,10 +60,38 @@ const props = defineProps({
|
|
|
59
60
|
const { story } = toRefs(props)
|
|
60
61
|
|
|
61
62
|
const { renderedDoc } = useStoryDoc(story)
|
|
63
|
+
|
|
64
|
+
// Markdown links to other stories
|
|
65
|
+
const router = useRouter()
|
|
66
|
+
|
|
67
|
+
// we are just using URL to parse the pathname and hash - the base doesn't
|
|
68
|
+
// matter and is only passed to support same-host hrefs.
|
|
69
|
+
const fakeHost = `http://a.com`
|
|
70
|
+
|
|
71
|
+
function onClick (e: MouseEvent) {
|
|
72
|
+
const link = (e.target as Element).closest('a')
|
|
73
|
+
if (
|
|
74
|
+
link &&
|
|
75
|
+
link.getAttribute('data-route') &&
|
|
76
|
+
!e.ctrlKey &&
|
|
77
|
+
!e.shiftKey &&
|
|
78
|
+
!e.altKey &&
|
|
79
|
+
!e.metaKey &&
|
|
80
|
+
link.target !== `_blank`
|
|
81
|
+
) {
|
|
82
|
+
e.preventDefault()
|
|
83
|
+
const url = new URL(link.href, fakeHost)
|
|
84
|
+
const targetHref = url.pathname + url.search + url.hash
|
|
85
|
+
router.push(targetHref)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
62
88
|
</script>
|
|
63
89
|
|
|
64
90
|
<template>
|
|
65
|
-
<div
|
|
91
|
+
<div
|
|
92
|
+
class="histoire-story-docs"
|
|
93
|
+
@click.capture="onClick"
|
|
94
|
+
>
|
|
66
95
|
<BaseEmpty
|
|
67
96
|
v-if="!renderedDoc"
|
|
68
97
|
>
|
|
@@ -28,11 +28,17 @@ const panelContentComponent = computed(() => {
|
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
30
|
<template>
|
|
31
|
-
<BaseEmpty
|
|
31
|
+
<BaseEmpty
|
|
32
|
+
v-if="!storyStore.currentVariant"
|
|
33
|
+
class="histoire-story-side-panel histoire-selection"
|
|
34
|
+
>
|
|
32
35
|
<span>Select a variant</span>
|
|
33
36
|
</BaseEmpty>
|
|
34
37
|
|
|
35
|
-
<BaseEmpty
|
|
38
|
+
<BaseEmpty
|
|
39
|
+
v-else-if="!storyStore.currentVariant.configReady || !storyStore.currentVariant.previewReady"
|
|
40
|
+
class="histoire-story-side-panel histoire-loading"
|
|
41
|
+
>
|
|
36
42
|
<span>Loading...</span>
|
|
37
43
|
</BaseEmpty>
|
|
38
44
|
|
|
@@ -40,7 +46,7 @@ const panelContentComponent = computed(() => {
|
|
|
40
46
|
v-else
|
|
41
47
|
save-id="story-sidepane"
|
|
42
48
|
orientation="portrait"
|
|
43
|
-
class="htw-h-full"
|
|
49
|
+
class="histoire-story-side-panel histoire-loaded htw-h-full"
|
|
44
50
|
data-test-id="story-side-panel"
|
|
45
51
|
>
|
|
46
52
|
<template #first>
|
|
@@ -131,7 +131,7 @@ watch(sourceHtml, async () => {
|
|
|
131
131
|
|
|
132
132
|
<template>
|
|
133
133
|
<div
|
|
134
|
-
class="htw-bg-gray-50 dark:htw-bg-gray-750 htw-h-full htw-overflow-hidden htw-flex htw-flex-col"
|
|
134
|
+
class="histoire-story-source-code htw-bg-gray-50 dark:htw-bg-gray-750 htw-h-full htw-overflow-hidden htw-flex htw-flex-col"
|
|
135
135
|
>
|
|
136
136
|
<!-- Toolbar -->
|
|
137
137
|
<div
|
|
@@ -4,7 +4,7 @@ import { Icon } from '@iconify/vue'
|
|
|
4
4
|
|
|
5
5
|
<template>
|
|
6
6
|
<div
|
|
7
|
-
class="htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500 htw-h-[51px] htw-opacity-30"
|
|
7
|
+
class="histoire-search-loading htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500 htw-h-[51px] htw-opacity-30"
|
|
8
8
|
>
|
|
9
9
|
<Icon
|
|
10
10
|
icon="carbon:search"
|
|
@@ -26,7 +26,7 @@ function close () {
|
|
|
26
26
|
<template>
|
|
27
27
|
<div
|
|
28
28
|
v-show="shown"
|
|
29
|
-
class="htw-fixed htw-inset-0 htw-bg-white/80 dark:htw-bg-gray-700/80 htw-z-20"
|
|
29
|
+
class="histoire-search-modal htw-fixed htw-inset-0 htw-bg-white/80 dark:htw-bg-gray-700/80 htw-z-20"
|
|
30
30
|
data-test-id="search-modal"
|
|
31
31
|
>
|
|
32
32
|
<div
|
|
@@ -262,7 +262,7 @@ function selectPrevious () {
|
|
|
262
262
|
|
|
263
263
|
<template>
|
|
264
264
|
<div
|
|
265
|
-
class="htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500"
|
|
265
|
+
class="histoire-search-pane htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500"
|
|
266
266
|
@click="focused = true"
|
|
267
267
|
>
|
|
268
268
|
<Icon
|
|
@@ -6,6 +6,7 @@ import HatchedPattern from '../misc/HatchedPattern.vue'
|
|
|
6
6
|
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
7
7
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
8
8
|
import { Variant } from '../../types'
|
|
9
|
+
import { VTooltip as vTooltip } from 'floating-vue'
|
|
9
10
|
|
|
10
11
|
const props = defineProps<{
|
|
11
12
|
variant: Variant
|
|
@@ -115,10 +116,12 @@ const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth :
|
|
|
115
116
|
// Disabled responsive
|
|
116
117
|
|
|
117
118
|
const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
|
|
119
|
+
|
|
120
|
+
const sizeTooltip = computed(() => (responsiveWidth.value ?? 'Auto') + ' × ' + (responsiveHeight.value ?? 'Auto'))
|
|
118
121
|
</script>
|
|
119
122
|
|
|
120
123
|
<template>
|
|
121
|
-
<div class="htw-w-full htw-h-full htw-flex-1 htw-rounded-lg htw-relative htw-overflow-hidden">
|
|
124
|
+
<div class="histoire-story-responsive-preview htw-w-full htw-h-full htw-flex-1 htw-rounded-lg htw-relative htw-overflow-hidden">
|
|
122
125
|
<div
|
|
123
126
|
v-if="isResponsiveEnabled"
|
|
124
127
|
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"
|
|
@@ -139,7 +142,10 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
|
|
|
139
142
|
'htw-h-fit': !!finalHeight
|
|
140
143
|
} : undefined"
|
|
141
144
|
>
|
|
142
|
-
<div
|
|
145
|
+
<div
|
|
146
|
+
class="bind-preview-bg htw-rounded-lg htw-h-full"
|
|
147
|
+
data-test-id="responsive-preview-bg"
|
|
148
|
+
>
|
|
143
149
|
<CheckerboardPattern
|
|
144
150
|
v-if="settings.checkerboard"
|
|
145
151
|
class="htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
@@ -171,6 +177,7 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
|
|
|
171
177
|
<template v-if="isResponsiveEnabled">
|
|
172
178
|
<div
|
|
173
179
|
ref="horizontalDragger"
|
|
180
|
+
v-tooltip.right="sizeTooltip"
|
|
174
181
|
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
182
|
>
|
|
176
183
|
<Icon
|
|
@@ -180,6 +187,7 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
|
|
|
180
187
|
</div>
|
|
181
188
|
<div
|
|
182
189
|
ref="verticalDragger"
|
|
190
|
+
v-tooltip.bottom="sizeTooltip"
|
|
183
191
|
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
192
|
>
|
|
185
193
|
<Icon
|
|
@@ -189,6 +197,7 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
|
|
|
189
197
|
</div>
|
|
190
198
|
<div
|
|
191
199
|
ref="cornerDragger"
|
|
200
|
+
v-tooltip.bottom="sizeTooltip"
|
|
192
201
|
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"
|
|
193
202
|
/>
|
|
194
203
|
</template>
|
|
@@ -107,11 +107,15 @@ onMounted(() => {
|
|
|
107
107
|
updateSize()
|
|
108
108
|
})
|
|
109
109
|
|
|
110
|
+
useResizeObserver(gridEl, () => {
|
|
111
|
+
updateSize()
|
|
112
|
+
})
|
|
113
|
+
|
|
110
114
|
const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))))
|
|
111
115
|
</script>
|
|
112
116
|
|
|
113
117
|
<template>
|
|
114
|
-
<div class="htw-flex htw-flex-col htw-items-stretch htw-h-full __histoire-pane-shadow-from-right">
|
|
118
|
+
<div class="histoire-story-variant-grid htw-flex htw-flex-col htw-items-stretch htw-h-full __histoire-pane-shadow-from-right">
|
|
115
119
|
<!-- Toolbar -->
|
|
116
120
|
<div
|
|
117
121
|
v-if="!isMobile"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { PropType, ref, toRefs } from 'vue'
|
|
2
|
+
import { computed, 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'
|
|
@@ -7,6 +7,8 @@ import { useCurrentVariantRoute } from '../../util/variant'
|
|
|
7
7
|
import type { Story, Variant } from '../../types'
|
|
8
8
|
import { useScrollOnActive } from '../../util/scroll'
|
|
9
9
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
10
|
+
import { getContrastColor } from '../../util/preview-settings'
|
|
11
|
+
import { histoireConfig } from '../../util/config'
|
|
10
12
|
import GenericRenderStory from './GenericRenderStory.vue'
|
|
11
13
|
import ToolbarNewTab from '../toolbar/ToolbarNewTab.vue'
|
|
12
14
|
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
@@ -60,12 +62,15 @@ useResizeObserver(el, () => {
|
|
|
60
62
|
})
|
|
61
63
|
|
|
62
64
|
const settings = usePreviewSettingsStore().currentSettings
|
|
65
|
+
|
|
66
|
+
const contrastColor = computed(() => getContrastColor(settings))
|
|
67
|
+
const autoApplyContrastColor = computed(() => !!histoireConfig.autoApplyContrastColor)
|
|
63
68
|
</script>
|
|
64
69
|
|
|
65
70
|
<template>
|
|
66
71
|
<div
|
|
67
72
|
ref="el"
|
|
68
|
-
class="htw-cursor-default htw-flex htw-flex-col htw-gap-y-1 htw-group"
|
|
73
|
+
class="histoire-story-variant-grid-item htw-cursor-default htw-flex htw-flex-col htw-gap-y-1 htw-group"
|
|
69
74
|
>
|
|
70
75
|
<!-- Header -->
|
|
71
76
|
<div class="htw-flex-none htw-flex htw-items-center">
|
|
@@ -109,14 +114,23 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
109
114
|
@click.stop="selectVariant()"
|
|
110
115
|
@keyup="selectVariant()"
|
|
111
116
|
>
|
|
112
|
-
<div
|
|
117
|
+
<div
|
|
118
|
+
class="htw-absolute htw-inset-0 htw-rounded bind-preview-bg"
|
|
119
|
+
data-test-id="responsive-preview-bg"
|
|
120
|
+
/>
|
|
113
121
|
|
|
114
122
|
<CheckerboardPattern
|
|
115
123
|
v-if="settings.checkerboard"
|
|
116
124
|
class="htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
117
125
|
/>
|
|
118
126
|
|
|
119
|
-
<div
|
|
127
|
+
<div
|
|
128
|
+
class="htw-relative htw-h-full"
|
|
129
|
+
:style="{
|
|
130
|
+
'--histoire-contrast-color': contrastColor,
|
|
131
|
+
color: autoApplyContrastColor ? contrastColor : undefined,
|
|
132
|
+
}"
|
|
133
|
+
>
|
|
120
134
|
<GenericRenderStory
|
|
121
135
|
:key="`${story.id}-${variant.id}`"
|
|
122
136
|
:variant="variant"
|
|
@@ -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 __histoire-pane-shadow-from-right"
|
|
24
|
+
class="histoire-story-variant-single htw-p-2 htw-h-full __histoire-pane-shadow-from-right"
|
|
25
25
|
>
|
|
26
26
|
<StoryVariantSingleView
|
|
27
27
|
:variant="variant"
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import type { Story, Variant } from '../../types'
|
|
4
4
|
import { isDark } from '../../util/dark'
|
|
5
5
|
import { histoireConfig } from '../../util/config'
|
|
6
6
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
7
|
+
import { getContrastColor } from '../../util/preview-settings'
|
|
8
|
+
import GenericRenderStory from './GenericRenderStory.vue'
|
|
7
9
|
import StoryResponsivePreview from './StoryResponsivePreview.vue'
|
|
8
10
|
|
|
9
11
|
const props = defineProps<{
|
|
@@ -22,18 +24,28 @@ function onReady () {
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const settings = usePreviewSettingsStore().currentSettings
|
|
27
|
+
|
|
28
|
+
const contrastColor = computed(() => getContrastColor(settings))
|
|
29
|
+
const autoApplyContrastColor = computed(() => !!histoireConfig.autoApplyContrastColor)
|
|
25
30
|
</script>
|
|
26
31
|
|
|
27
32
|
<template>
|
|
28
33
|
<StoryResponsivePreview
|
|
29
34
|
v-slot="{ isResponsiveEnabled, finalWidth, finalHeight }"
|
|
35
|
+
class="histoire-story-variant-single-preview-native"
|
|
30
36
|
:variant="variant"
|
|
31
37
|
>
|
|
32
38
|
<div
|
|
33
|
-
:style="
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
:style="[
|
|
40
|
+
isResponsiveEnabled ? {
|
|
41
|
+
width: finalWidth ? `${finalWidth}px` : '100%',
|
|
42
|
+
height: finalHeight ? `${finalHeight}px` : '100%',
|
|
43
|
+
} : { width: '100%', height: '100%' },
|
|
44
|
+
{
|
|
45
|
+
'--histoire-contrast-color': contrastColor,
|
|
46
|
+
color: autoApplyContrastColor ? contrastColor : undefined,
|
|
47
|
+
},
|
|
48
|
+
]"
|
|
37
49
|
class="htw-relative"
|
|
38
50
|
data-test-id="sandbox-render"
|
|
39
51
|
>
|
|
@@ -53,7 +53,10 @@ function setVariant (variantId: string) {
|
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
55
|
<template>
|
|
56
|
-
<BaseEmpty
|
|
56
|
+
<BaseEmpty
|
|
57
|
+
v-if="!storyStore.currentStory"
|
|
58
|
+
class="histoire-story-view histoire-no-story"
|
|
59
|
+
>
|
|
57
60
|
<Icon
|
|
58
61
|
icon="carbon:software-resource-resource"
|
|
59
62
|
class="htw-w-16 htw-h-16 htw-opacity-50"
|
|
@@ -62,7 +65,7 @@ function setVariant (variantId: string) {
|
|
|
62
65
|
|
|
63
66
|
<div
|
|
64
67
|
v-else
|
|
65
|
-
class="htw-h-full"
|
|
68
|
+
class="histoire-story-view histoire-with-story htw-h-full"
|
|
66
69
|
>
|
|
67
70
|
<div
|
|
68
71
|
v-if="storyStore.currentStory.docsOnly"
|
|
@@ -23,7 +23,7 @@ watch(variant, () => {
|
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<template>
|
|
26
|
-
<div class="htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750">
|
|
26
|
+
<div class="histoire-story-viewer htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750">
|
|
27
27
|
<StoryVariantGrid
|
|
28
28
|
v-if="storyStore.currentStory.layout.type === 'grid'"
|
|
29
29
|
/>
|