@histoire/app 0.11.5 → 0.11.7
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 +5 -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 +37 -29
- 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 +46 -45
- package/dist/bundled/util/preview-settings.js +11 -0
- package/dist/style.css +77 -64
- 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 +32 -24
- 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 +5 -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
|
@@ -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>
|
|
@@ -82,6 +82,7 @@ function onItemResize (w: number, h: number) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
watch(() => storyStore.currentVariant, () => {
|
|
85
|
+
maxItemHeight.value = 0 // Reset max height
|
|
85
86
|
updateMaxCount()
|
|
86
87
|
})
|
|
87
88
|
|
|
@@ -97,21 +98,26 @@ function updateSize () {
|
|
|
97
98
|
|
|
98
99
|
if (!gridEl.value) return
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (gridTemplateWidth.value.endsWith('%')) {
|
|
102
|
+
gridColumnWidth.value = viewWidth.value * parseInt(gridTemplateWidth.value) / 100 - gap
|
|
103
|
+
} else {
|
|
104
|
+
gridColumnWidth.value = parseInt(gridTemplateWidth.value)
|
|
105
|
+
}
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
onMounted(() => {
|
|
107
109
|
updateSize()
|
|
108
110
|
})
|
|
109
111
|
|
|
112
|
+
useResizeObserver(gridEl, () => {
|
|
113
|
+
updateSize()
|
|
114
|
+
})
|
|
115
|
+
|
|
110
116
|
const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))))
|
|
111
117
|
</script>
|
|
112
118
|
|
|
113
119
|
<template>
|
|
114
|
-
<div class="htw-flex htw-flex-col htw-items-stretch htw-h-full __histoire-pane-shadow-from-right">
|
|
120
|
+
<div class="histoire-story-variant-grid htw-flex htw-flex-col htw-items-stretch htw-h-full __histoire-pane-shadow-from-right">
|
|
115
121
|
<!-- Toolbar -->
|
|
116
122
|
<div
|
|
117
123
|
v-if="!isMobile"
|
|
@@ -121,31 +127,33 @@ const columnCount = computed(() => Math.min(storyStore.currentStory.variants.len
|
|
|
121
127
|
<ToolbarTextDirection />
|
|
122
128
|
</div>
|
|
123
129
|
|
|
124
|
-
<div
|
|
125
|
-
ref="el"
|
|
126
|
-
class="htw-overflow-y-auto htw-flex htw-flex-1"
|
|
127
|
-
@scroll="updateMaxCount()"
|
|
128
|
-
>
|
|
130
|
+
<div class="htw-overflow-y-auto htw-flex htw-flex-1">
|
|
129
131
|
<div
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}"
|
|
132
|
+
ref="el"
|
|
133
|
+
class="htw-flex htw-w-0 htw-flex-1 htw-mx-4"
|
|
134
|
+
@scroll="updateMaxCount()"
|
|
134
135
|
>
|
|
135
136
|
<div
|
|
136
|
-
|
|
137
|
-
class="htw-grid htw-gap-4 htw-m-4"
|
|
137
|
+
class="htw-m-auto"
|
|
138
138
|
:style="{
|
|
139
|
-
|
|
139
|
+
minHeight: `${(storyStore.currentStory.variants.length / countPerRow) * (maxItemHeight + gap) - gap}px`,
|
|
140
140
|
}"
|
|
141
141
|
>
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
<div
|
|
143
|
+
ref="gridEl"
|
|
144
|
+
class="htw-grid htw-gap-4 htw-my-4"
|
|
145
|
+
:style="{
|
|
146
|
+
gridTemplateColumns: `repeat(${columnCount}, ${gridColumnWidth}px)`,
|
|
147
|
+
}"
|
|
148
|
+
>
|
|
149
|
+
<StoryVariantGridItem
|
|
150
|
+
v-for="(variant, index) of storyStore.currentStory.variants.slice(0, maxCount)"
|
|
151
|
+
:key="index"
|
|
152
|
+
:variant="variant"
|
|
153
|
+
:story="storyStore.currentStory"
|
|
154
|
+
@resize="onItemResize"
|
|
155
|
+
/>
|
|
156
|
+
</div>
|
|
149
157
|
</div>
|
|
150
158
|
</div>
|
|
151
159
|
</div>
|
|
@@ -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
|
/>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
|
+
import { computed } from 'vue'
|
|
3
4
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
5
|
import { histoireConfig } from '../../util/config'
|
|
6
|
+
import { getContrastColor } from '../../util/preview-settings'
|
|
5
7
|
import BaseCheckbox from '../base/BaseCheckbox.vue'
|
|
6
8
|
|
|
7
9
|
const settings = usePreviewSettingsStore().currentSettings
|
|
10
|
+
|
|
11
|
+
const contrastColor = computed(() => getContrastColor(settings))
|
|
8
12
|
</script>
|
|
9
13
|
|
|
10
14
|
<template>
|
|
@@ -12,15 +16,18 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
12
16
|
v-if="histoireConfig.backgroundPresets.length"
|
|
13
17
|
placement="bottom-end"
|
|
14
18
|
:skidding="6"
|
|
15
|
-
class="htw-h-full htw-flex-none"
|
|
19
|
+
class="histoire-toolbar-background htw-h-full htw-flex-none"
|
|
20
|
+
data-test-id="toolbar-background"
|
|
16
21
|
>
|
|
17
22
|
<div
|
|
18
23
|
v-tooltip="'Background color'"
|
|
19
24
|
class="htw-cursor-pointer hover:htw-text-primary-500 htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group"
|
|
20
25
|
>
|
|
21
26
|
<div
|
|
22
|
-
class="bind-preview-bg htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/50 dark:htw-border-white/50"
|
|
23
|
-
|
|
27
|
+
class="bind-preview-bg htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/50 dark:htw-border-white/50 htw-flex htw-items-center htw-justify-center htw-text-xs"
|
|
28
|
+
>
|
|
29
|
+
<span v-if="contrastColor">a</span>
|
|
30
|
+
</div>
|
|
24
31
|
<Icon
|
|
25
32
|
icon="carbon:caret-down"
|
|
26
33
|
class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
@@ -28,7 +35,10 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
28
35
|
</div>
|
|
29
36
|
|
|
30
37
|
<template #popper="{ hide }">
|
|
31
|
-
<div
|
|
38
|
+
<div
|
|
39
|
+
class="htw-flex htw-flex-col htw-items-stretch"
|
|
40
|
+
data-test-id="background-popper"
|
|
41
|
+
>
|
|
32
42
|
<BaseCheckbox v-model="settings.checkerboard">
|
|
33
43
|
Checkerboard
|
|
34
44
|
</BaseCheckbox>
|
|
@@ -36,7 +46,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
36
46
|
<button
|
|
37
47
|
v-for="(option, index) in histoireConfig.backgroundPresets"
|
|
38
48
|
:key="index"
|
|
39
|
-
class="htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4"
|
|
49
|
+
class="htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-items-baseline htw-gap-4"
|
|
40
50
|
:class="[
|
|
41
51
|
settings.backgroundColor === option.color
|
|
42
52
|
? 'htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
|
|
@@ -48,11 +58,14 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
48
58
|
<template v-if="option.color !== '$checkerboard'">
|
|
49
59
|
<span class="htw-ml-auto htw-opacity-70">{{ option.color }}</span>
|
|
50
60
|
<div
|
|
51
|
-
class="htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/20 dark:htw-border-white/20"
|
|
61
|
+
class="htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/20 dark:htw-border-white/20 htw-flex htw-items-center htw-justify-center htw-text-xs"
|
|
52
62
|
:style="{
|
|
53
63
|
backgroundColor: option.color,
|
|
64
|
+
color: option.contrastColor,
|
|
54
65
|
}"
|
|
55
|
-
|
|
66
|
+
>
|
|
67
|
+
<span v-if="option.contrastColor">a</span>
|
|
68
|
+
</div>
|
|
56
69
|
</template>
|
|
57
70
|
</button>
|
|
58
71
|
</div>
|
|
@@ -63,5 +76,6 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
63
76
|
<style scoped>
|
|
64
77
|
.bind-preview-bg {
|
|
65
78
|
background-color: v-bind('settings.backgroundColor');
|
|
79
|
+
color: v-bind('contrastColor');
|
|
66
80
|
}
|
|
67
81
|
</style>
|
|
@@ -19,7 +19,7 @@ const sandboxUrl = computed(() => {
|
|
|
19
19
|
v-tooltip="'Open variant in new tab'"
|
|
20
20
|
:href="sandboxUrl"
|
|
21
21
|
target="_blank"
|
|
22
|
-
class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
|
|
22
|
+
class="histoire-toolbar-new-tab htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
|
|
23
23
|
>
|
|
24
24
|
<Icon
|
|
25
25
|
icon="carbon:launch"
|
|
@@ -13,7 +13,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
13
13
|
placement="bottom-end"
|
|
14
14
|
:skidding="6"
|
|
15
15
|
:disabled="!histoireConfig.responsivePresets?.length"
|
|
16
|
-
class="htw-h-full htw-flex-none"
|
|
16
|
+
class="histoire-toolbar-responsive-size htw-h-full htw-flex-none"
|
|
17
17
|
>
|
|
18
18
|
<div
|
|
19
19
|
v-tooltip="'Responsive sizes'"
|
|
@@ -38,7 +38,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
38
38
|
Rotate
|
|
39
39
|
</BaseCheckbox>
|
|
40
40
|
|
|
41
|
-
<div class="htw-flex htw-gap-2 htw-px-4 htw-py-3">
|
|
41
|
+
<div class="htw-flex htw-items-center htw-gap-2 htw-px-4 htw-py-3">
|
|
42
42
|
<input
|
|
43
43
|
v-model.number="settings.responsiveWidth"
|
|
44
44
|
v-tooltip="'Responsive width (px)'"
|
|
@@ -47,7 +47,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
47
47
|
step="16"
|
|
48
48
|
placeholder="Auto"
|
|
49
49
|
>
|
|
50
|
-
<span class="htw-opacity-50"
|
|
50
|
+
<span class="htw-opacity-50">×</span>
|
|
51
51
|
<input
|
|
52
52
|
v-model.number="settings.responsiveHeight"
|
|
53
53
|
v-tooltip="'Responsive height (px)'"
|
|
@@ -8,7 +8,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
8
8
|
<template>
|
|
9
9
|
<a
|
|
10
10
|
v-tooltip="`Switch to text direction ${settings.textDirection === 'ltr' ? 'Right to Left' : 'Left to Right'}`"
|
|
11
|
-
class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
|
|
11
|
+
class="histoire-toolbar-text-direction htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
|
|
12
12
|
@click="settings.textDirection = settings.textDirection === 'ltr' ? 'rtl' : 'ltr'"
|
|
13
13
|
>
|
|
14
14
|
<Icon
|
|
@@ -8,7 +8,7 @@ defineProps<{
|
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<template>
|
|
11
|
-
<div class="htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0">
|
|
11
|
+
<div class="histoire-toolbar-title htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0">
|
|
12
12
|
<Icon
|
|
13
13
|
:icon="variant.icon ?? 'carbon:cube'"
|
|
14
14
|
class="htw-w-4 htw-h-4 htw-opacity-50"
|
|
File without changes
|
package/src/app/style/main.pcss
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@import url('https://fonts.googleapis.com/css2?family=
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Display&display=swap');
|
|
2
2
|
@import 'floating-vue/dist/style.css';
|
|
3
3
|
@import '@histoire/controls/dist/style.css';
|
|
4
4
|
|
|
5
|
-
@import 'floating
|
|
5
|
+
@import 'floating.pcss';
|
|
6
6
|
@import 'transitions.pcss';
|
|
7
7
|
|
|
8
8
|
*,
|
|
@@ -37,61 +37,63 @@ button {
|
|
|
37
37
|
@tailwind components;
|
|
38
38
|
@tailwind utilities;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
html,
|
|
46
|
-
body,
|
|
47
|
-
#app {
|
|
48
|
-
height: 100%;
|
|
49
|
-
}
|
|
40
|
+
@layer base {
|
|
41
|
+
body,
|
|
42
|
+
pre {
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
50
45
|
|
|
51
|
-
html
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
html,
|
|
47
|
+
body,
|
|
48
|
+
#app {
|
|
49
|
+
height: 100%;
|
|
50
|
+
}
|
|
55
51
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
html {
|
|
53
|
+
font-family: 'Noto Sans Display', system-ui, sans-serif;
|
|
54
|
+
font-size: 1rem;
|
|
55
|
+
}
|
|
59
56
|
|
|
60
|
-
@media (min-width: 640px) {
|
|
61
57
|
body {
|
|
62
|
-
font-size: .
|
|
58
|
+
font-size: 1.125rem;
|
|
63
59
|
}
|
|
64
|
-
}
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
@media (min-width: 640px) {
|
|
62
|
+
body {
|
|
63
|
+
font-size: .875rem;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
69
66
|
|
|
70
|
-
.
|
|
71
|
-
|
|
72
|
-
}
|
|
67
|
+
.htw-sandbox-contain {
|
|
68
|
+
contain: content;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.__histoire-code .shiki {
|
|
72
|
+
background: transparent !important;
|
|
73
|
+
}
|
|
73
74
|
|
|
74
|
-
.htw-prose {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
.htw-prose {
|
|
76
|
+
h1, h2, h3, h4 {
|
|
77
|
+
&:not(:hover) {
|
|
78
|
+
.header-anchor[aria-hidden="true"] {
|
|
79
|
+
visibility: hidden;
|
|
80
|
+
}
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
}
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
hr {
|
|
85
|
+
margin: 1rem 0;
|
|
86
|
+
}
|
|
85
87
|
}
|
|
86
|
-
}
|
|
87
88
|
|
|
88
|
-
.__histoire-pane-shadow-from-right {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
.__histoire-pane-shadow-from-right {
|
|
90
|
+
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0));
|
|
91
|
+
background-size: 24px;
|
|
92
|
+
background-repeat: no-repeat;
|
|
93
|
+
background-position: right;
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
.htw-dark & {
|
|
96
|
+
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
|
|
97
|
+
}
|
|
96
98
|
}
|
|
97
99
|
}
|
|
@@ -11,9 +11,13 @@ body {
|
|
|
11
11
|
|
|
12
12
|
html {
|
|
13
13
|
font-size: 1rem;
|
|
14
|
-
font-family: '
|
|
14
|
+
font-family: 'Noto Sans Display', system-ui, sans-serif;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.htw-sandbox-hidden {
|
|
18
18
|
display: none;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
.htw-sandbox-contain {
|
|
22
|
+
contain: content;
|
|
23
|
+
}
|