@histoire/app 0.11.2 → 0.11.3
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/bundled/components/app/Breadcrumb.js +2 -2
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_3c779b73_lang.js +4 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js +6 -32
- package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/bundled/components/story/StoryVariantGridItem.js +2 -2
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +8 -7
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_601cc357_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 -3
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_02816158_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_89489ae4_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue_vue_type_script_setup_true_lang.js +8 -3
- package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +16 -13
- package/dist/bundled/components/toolbar/ToolbarBackground.js +7 -0
- package/dist/bundled/components/toolbar/{StoryVariantBackground.vue_vue_type_script_setup_true_lang.js → ToolbarBackground.vue_vue_type_script_setup_true_lang.js} +3 -3
- package/dist/bundled/components/toolbar/ToolbarBackground.vue_vue_type_style_index_0_scoped_8d0cb17e_lang.js +4 -0
- package/dist/bundled/components/toolbar/ToolbarNewTab.js +5 -0
- package/dist/bundled/components/toolbar/{StoryVariantNewTab.vue_vue_type_script_setup_true_lang.js → ToolbarNewTab.vue_vue_type_script_setup_true_lang.js} +2 -2
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.js +5 -0
- package/dist/bundled/components/toolbar/{StoryVariantResponsiveSize.vue_vue_type_script_setup_true_lang.js → ToolbarResponsiveSize.vue_vue_type_script_setup_true_lang.js} +1 -1
- package/dist/bundled/components/toolbar/ToolbarTextDirection.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/bundled/components/toolbar/ToolbarTitle.js +5 -0
- package/dist/bundled/components/toolbar/{StoryVariantTitle.vue_vue_type_script_setup_true_lang.js → ToolbarTitle.vue_vue_type_script_setup_true_lang.js} +2 -2
- package/dist/bundled/components/tree/StoryListItem.js +2 -2
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_d1a05247_lang.js +4 -0
- package/dist/bundled/stores/preview-settings.js +3 -2
- package/dist/bundled/style.css +16 -16
- package/dist/bundled/util/dark.js +15 -0
- package/dist/bundled/util/preview-settings.js +1 -0
- package/dist/style.css +28 -5
- package/package.json +4 -4
- package/src/app/components/app/Breadcrumb.vue +1 -1
- package/src/app/components/panel/ControlsComponentPropItem.vue +4 -37
- package/src/app/components/story/StoryVariantGrid.vue +4 -2
- package/src/app/components/story/StoryVariantGridItem.vue +4 -3
- package/src/app/components/story/StoryVariantListItem.vue +1 -1
- package/src/app/components/story/StoryVariantSingle.vue +1 -1
- package/src/app/components/story/StoryVariantSinglePreviewNative.vue +7 -0
- package/src/app/components/story/StoryVariantSingleView.vue +10 -8
- package/src/app/components/toolbar/{StoryVariantBackground.vue → ToolbarBackground.vue} +0 -0
- package/src/app/components/toolbar/{StoryVariantNewTab.vue → ToolbarNewTab.vue} +1 -1
- package/src/app/components/toolbar/{StoryVariantResponsiveSize.vue → ToolbarResponsiveSize.vue} +0 -0
- package/src/app/components/toolbar/ToolbarTextDirection.vue +19 -0
- package/src/app/components/toolbar/{StoryVariantTitle.vue → ToolbarTitle.vue} +1 -1
- package/src/app/components/tree/StoryListItem.vue +1 -1
- package/src/app/stores/preview-settings.ts +2 -1
- package/src/app/types.ts +1 -0
- package/src/app/util/dark.ts +17 -0
- package/src/app/util/preview-settings.ts +2 -0
- package/src/shim.d.ts +9 -0
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_afeba72b_lang.js +0 -4
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_5ded7495_lang.js +0 -4
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_cc25ec8b_lang.js +0 -4
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_afe0bbc2_lang.js +0 -4
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +0 -7
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_8dc02d19_lang.js +0 -4
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +0 -5
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +0 -5
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +0 -5
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_313a2f42_lang.js +0 -4
package/dist/bundled/style.css
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
bottom: -.625rem;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.bind-icon-color[data-v-
|
|
28
|
-
color: var(--
|
|
27
|
+
.bind-icon-color[data-v-3c779b73] {
|
|
28
|
+
color: var(--0fe094b1);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.htw-base-empty[data-v-af3328a6]:not(.no-animation) {
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
color: var(--249174dc);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.bind-tree-margin[data-v-
|
|
48
|
-
margin-left: var(--
|
|
47
|
+
.bind-tree-margin[data-v-d1a05247] {
|
|
48
|
+
margin-left: var(--7f500e3a);
|
|
49
49
|
}
|
|
50
|
-
.bind-icon-color[data-v-
|
|
51
|
-
color: var(--
|
|
50
|
+
.bind-icon-color[data-v-d1a05247] {
|
|
51
|
+
color: var(--6930c8c2);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.bind-tree-padding[data-v-41fb5f7e] {
|
|
@@ -60,27 +60,27 @@
|
|
|
60
60
|
font-size: inherit;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.bind-icon-color[data-v-
|
|
64
|
-
color: var(--
|
|
63
|
+
.bind-icon-color[data-v-02816158] {
|
|
64
|
+
color: var(--36260edc);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.bind-icon-color[data-v-
|
|
68
|
-
color: var(--
|
|
67
|
+
.bind-icon-color[data-v-89489ae4] {
|
|
68
|
+
color: var(--513cd7c8);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.bind-icon-color[data-v-b819ed97] {
|
|
72
72
|
color: var(--b88798ec);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.bind-icon-color[data-v-
|
|
76
|
-
color: var(--
|
|
75
|
+
.bind-icon-color[data-v-601cc357] {
|
|
76
|
+
color: var(--f3384526);
|
|
77
77
|
}
|
|
78
|
-
.bind-preview-bg[data-v-
|
|
79
|
-
background-color: var(--
|
|
78
|
+
.bind-preview-bg[data-v-601cc357] {
|
|
79
|
+
background-color: var(--75db4c5e);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.bind-preview-bg[data-v-
|
|
83
|
-
background-color: var(--
|
|
82
|
+
.bind-preview-bg[data-v-8d0cb17e] {
|
|
83
|
+
background-color: var(--25c5213c);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.bind-preview-bg[data-v-1375d05a] {
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
import { watch } from "@histoire/vendors/vue";
|
|
1
2
|
import { useDark, useToggle } from "@histoire/vendors/vue-use";
|
|
2
3
|
const isDark = useDark({ valueDark: "htw-dark" });
|
|
3
4
|
const toggleDark = useToggle(isDark);
|
|
5
|
+
function applyDarkToControls() {
|
|
6
|
+
var _a;
|
|
7
|
+
(_a = window.__hst_controls_dark) == null ? void 0 : _a.forEach((ref) => {
|
|
8
|
+
ref.value = isDark.value;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
watch(isDark, () => {
|
|
12
|
+
applyDarkToControls();
|
|
13
|
+
}, {
|
|
14
|
+
immediate: true
|
|
15
|
+
});
|
|
16
|
+
window.__hst_controls_dark_ready = () => {
|
|
17
|
+
applyDarkToControls();
|
|
18
|
+
};
|
|
4
19
|
export {
|
|
5
20
|
isDark,
|
|
6
21
|
toggleDark
|
|
@@ -2,6 +2,7 @@ import { reactive } from "@histoire/vendors/vue";
|
|
|
2
2
|
const receivedSettings = reactive({});
|
|
3
3
|
function applyPreviewSettings(settings) {
|
|
4
4
|
Object.assign(receivedSettings, settings);
|
|
5
|
+
document.documentElement.setAttribute("dir", settings.textDirection);
|
|
5
6
|
}
|
|
6
7
|
export {
|
|
7
8
|
applyPreviewSettings,
|
package/dist/style.css
CHANGED
|
@@ -297,6 +297,11 @@
|
|
|
297
297
|
grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
.__histoire-json-code[data-v-35a6e314] .cm-editor{
|
|
301
|
+
height:100%;
|
|
302
|
+
min-width:280px
|
|
303
|
+
}
|
|
304
|
+
|
|
300
305
|
/* @TODO custom themes */
|
|
301
306
|
|
|
302
307
|
.v-popper {
|
|
@@ -1448,6 +1453,10 @@ button {
|
|
|
1448
1453
|
height:5rem
|
|
1449
1454
|
}
|
|
1450
1455
|
|
|
1456
|
+
.htw-h-48{
|
|
1457
|
+
height:12rem
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1451
1460
|
.htw-h-1{
|
|
1452
1461
|
height:0.25rem
|
|
1453
1462
|
}
|
|
@@ -1460,6 +1469,10 @@ button {
|
|
|
1460
1469
|
max-height:400px
|
|
1461
1470
|
}
|
|
1462
1471
|
|
|
1472
|
+
.htw-min-h-32{
|
|
1473
|
+
min-height:8rem
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1463
1476
|
.htw-min-h-\[26px\]{
|
|
1464
1477
|
min-height:26px
|
|
1465
1478
|
}
|
|
@@ -2220,11 +2233,6 @@ button {
|
|
|
2220
2233
|
color:rgb(var(--_histoire-color-primary-400) / var(--tw-text-opacity))
|
|
2221
2234
|
}
|
|
2222
2235
|
|
|
2223
|
-
.htw-text-orange-500{
|
|
2224
|
-
--tw-text-opacity:1;
|
|
2225
|
-
color:rgb(249 115 22 / var(--tw-text-opacity))
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
2236
|
.htw-text-inherit{
|
|
2229
2237
|
color:inherit
|
|
2230
2238
|
}
|
|
@@ -2257,6 +2265,11 @@ button {
|
|
|
2257
2265
|
color:rgb(var(--_histoire-color-primary-200) / var(--tw-text-opacity))
|
|
2258
2266
|
}
|
|
2259
2267
|
|
|
2268
|
+
.htw-text-orange-500{
|
|
2269
|
+
--tw-text-opacity:1;
|
|
2270
|
+
color:rgb(249 115 22 / var(--tw-text-opacity))
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2260
2273
|
.htw-text-gray-700{
|
|
2261
2274
|
--tw-text-opacity:1;
|
|
2262
2275
|
color:rgb(var(--_histoire-color-gray-700) / var(--tw-text-opacity))
|
|
@@ -2422,6 +2435,11 @@ body {
|
|
|
2422
2435
|
margin-bottom:0px
|
|
2423
2436
|
}
|
|
2424
2437
|
|
|
2438
|
+
.focus-within\:htw-border-primary-500:focus-within{
|
|
2439
|
+
--tw-border-opacity:1;
|
|
2440
|
+
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2425
2443
|
.hover\:htw-border-primary-500:hover{
|
|
2426
2444
|
--tw-border-opacity:1;
|
|
2427
2445
|
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
@@ -2668,6 +2686,11 @@ body {
|
|
|
2668
2686
|
color:rgb(var(--_histoire-color-primary-200) / var(--tw-text-opacity))
|
|
2669
2687
|
}
|
|
2670
2688
|
|
|
2689
|
+
.htw-dark .dark\:focus-within\:htw-border-primary-500:focus-within{
|
|
2690
|
+
--tw-border-opacity:1;
|
|
2691
|
+
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2671
2694
|
.htw-dark .dark\:hover\:htw-border-primary-500:hover{
|
|
2672
2695
|
--tw-border-opacity:1;
|
|
2673
2696
|
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@histoire/app",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "Pre-bundled UI for Histoire",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"types": "./src/index.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@histoire/controls": "^0.11.
|
|
28
|
-
"@histoire/shared": "^0.11.
|
|
29
|
-
"@histoire/vendors": "^0.11.
|
|
27
|
+
"@histoire/controls": "^0.11.3",
|
|
28
|
+
"@histoire/shared": "^0.11.3",
|
|
29
|
+
"@histoire/vendors": "^0.11.3",
|
|
30
30
|
"@types/flexsearch": "^0.7.3",
|
|
31
31
|
"flexsearch": "^0.7.21",
|
|
32
32
|
"shiki": "0.10.1"
|
|
@@ -55,7 +55,7 @@ watch(story, () => {
|
|
|
55
55
|
<span class="htw-flex htw-items-center htw-gap-2">
|
|
56
56
|
<Icon
|
|
57
57
|
:icon="story.icon ?? 'carbon:cube'"
|
|
58
|
-
class="
|
|
58
|
+
class="htw-w-5 htw-h-5 htw-flex-none"
|
|
59
59
|
:class="{
|
|
60
60
|
'htw-text-primary-500': !story.iconColor,
|
|
61
61
|
'bind-icon-color': story.iconColor,
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
6
|
-
HstText,
|
|
7
|
-
HstNumber,
|
|
8
|
-
HstCheckbox,
|
|
9
|
-
HstTextarea,
|
|
10
|
-
} from '@histoire/controls'
|
|
4
|
+
import type { AutoPropComponentDefinition, PropDefinition } from '@histoire/shared'
|
|
5
|
+
import { HstCheckbox, HstJson, HstNumber, HstText } from '@histoire/controls'
|
|
11
6
|
import type { Variant } from '../../types'
|
|
12
7
|
|
|
13
8
|
const props = defineProps<{
|
|
@@ -26,35 +21,15 @@ const comp = computed(() => {
|
|
|
26
21
|
return HstCheckbox
|
|
27
22
|
case 'object':
|
|
28
23
|
default:
|
|
29
|
-
return
|
|
24
|
+
return HstJson
|
|
30
25
|
}
|
|
31
26
|
})
|
|
32
27
|
|
|
33
|
-
const isJSON = computed(() => comp.value === HstTextarea)
|
|
34
|
-
|
|
35
|
-
const invalidValue = ref('')
|
|
36
|
-
|
|
37
28
|
const model = computed({
|
|
38
29
|
get: () => {
|
|
39
|
-
|
|
40
|
-
return invalidValue.value
|
|
41
|
-
}
|
|
42
|
-
let val = props.variant.state._hPropState[props.component.index]?.[props.definition.name]
|
|
43
|
-
if (val && isJSON.value) {
|
|
44
|
-
val = JSON.stringify(val, null, 2)
|
|
45
|
-
}
|
|
46
|
-
return val
|
|
30
|
+
return props.variant.state._hPropState[props.component.index]?.[props.definition.name]
|
|
47
31
|
},
|
|
48
32
|
set: (value) => {
|
|
49
|
-
invalidValue.value = ''
|
|
50
|
-
if (isJSON.value) {
|
|
51
|
-
try {
|
|
52
|
-
value = JSON.parse(value)
|
|
53
|
-
} catch (e) {
|
|
54
|
-
invalidValue.value = value
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
33
|
if (!props.variant.state._hPropState[props.component.index]) {
|
|
59
34
|
// eslint-disable-next-line vue/no-mutating-props
|
|
60
35
|
props.variant.state._hPropState[props.component.index] = {}
|
|
@@ -80,16 +55,8 @@ const canReset = computed(() => props.variant.state?._hPropState?.[props.compone
|
|
|
80
55
|
v-if="comp"
|
|
81
56
|
v-model="model"
|
|
82
57
|
:title="`${definition.name}${canReset ? ' *' : ''}`"
|
|
83
|
-
:placeholder="isJSON ? 'Enter JSON' : null"
|
|
84
58
|
>
|
|
85
59
|
<template #actions>
|
|
86
|
-
<Icon
|
|
87
|
-
v-if="invalidValue"
|
|
88
|
-
v-tooltip="'JSON error'"
|
|
89
|
-
icon="carbon:warning-alt"
|
|
90
|
-
class="htw-text-orange-500"
|
|
91
|
-
/>
|
|
92
|
-
|
|
93
60
|
<Icon
|
|
94
61
|
v-tooltip="'Remove override'"
|
|
95
62
|
icon="carbon:erase"
|
|
@@ -4,7 +4,8 @@ import { computed, onMounted, ref, watch } from 'vue'
|
|
|
4
4
|
import { useStoryStore } from '../../stores/story'
|
|
5
5
|
import { isMobile } from '../../util/responsive'
|
|
6
6
|
import StoryVariantGridItem from './StoryVariantGridItem.vue'
|
|
7
|
-
import
|
|
7
|
+
import ToolbarBackground from '../toolbar/ToolbarBackground.vue'
|
|
8
|
+
import ToolbarTextDirection from '../toolbar/ToolbarTextDirection.vue'
|
|
8
9
|
|
|
9
10
|
const storyStore = useStoryStore()
|
|
10
11
|
|
|
@@ -116,7 +117,8 @@ const columnCount = computed(() => Math.min(storyStore.currentStory.variants.len
|
|
|
116
117
|
v-if="!isMobile"
|
|
117
118
|
class="htw-flex-none htw-flex htw-items-center htw-justify-end htw-h-8 htw-mx-2 htw-mt-1"
|
|
118
119
|
>
|
|
119
|
-
<
|
|
120
|
+
<ToolbarBackground />
|
|
121
|
+
<ToolbarTextDirection />
|
|
120
122
|
</div>
|
|
121
123
|
|
|
122
124
|
<div
|
|
@@ -8,7 +8,7 @@ import type { Story, Variant } from '../../types'
|
|
|
8
8
|
import { useScrollOnActive } from '../../util/scroll'
|
|
9
9
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
10
10
|
import GenericRenderStory from './GenericRenderStory.vue'
|
|
11
|
-
import
|
|
11
|
+
import ToolbarNewTab from '../toolbar/ToolbarNewTab.vue'
|
|
12
12
|
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
13
13
|
|
|
14
14
|
const props = defineProps({
|
|
@@ -80,7 +80,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
80
80
|
>
|
|
81
81
|
<Icon
|
|
82
82
|
:icon="variant.icon ?? 'carbon:cube'"
|
|
83
|
-
class="
|
|
83
|
+
class="htw-w-4 htw-h-4 htw-opacity-50"
|
|
84
84
|
:class="{
|
|
85
85
|
'htw-text-gray-500': !isActive && !variant.iconColor,
|
|
86
86
|
'bind-icon-color': !isActive && variant.iconColor,
|
|
@@ -91,7 +91,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
91
91
|
|
|
92
92
|
<!-- Toolbar -->
|
|
93
93
|
<div class="htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center">
|
|
94
|
-
<
|
|
94
|
+
<ToolbarNewTab
|
|
95
95
|
:variant="variant"
|
|
96
96
|
:story="story"
|
|
97
97
|
/>
|
|
@@ -121,6 +121,7 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
121
121
|
:key="`${story.id}-${variant.id}`"
|
|
122
122
|
:variant="variant"
|
|
123
123
|
:story="story"
|
|
124
|
+
:dir="settings.textDirection"
|
|
124
125
|
@ready="onReady"
|
|
125
126
|
/>
|
|
126
127
|
</div>
|
|
@@ -32,7 +32,7 @@ useScrollOnActive(isActive, el)
|
|
|
32
32
|
>
|
|
33
33
|
<Icon
|
|
34
34
|
:icon="variant.icon ?? 'carbon:cube'"
|
|
35
|
-
class="
|
|
35
|
+
class="htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none"
|
|
36
36
|
:class="{
|
|
37
37
|
'htw-text-gray-500': !active && !variant.iconColor,
|
|
38
38
|
'bind-icon-color': !active && variant.iconColor,
|
|
@@ -40,7 +40,7 @@ const variant = computed(() => storyStore.currentVariant)
|
|
|
40
40
|
<template v-if="variant">
|
|
41
41
|
<Icon
|
|
42
42
|
:icon="variant.icon ?? 'carbon:cube'"
|
|
43
|
-
class="
|
|
43
|
+
class="htw-w-5 htw-h-5 htw-flex-none"
|
|
44
44
|
:class="{
|
|
45
45
|
'htw-text-gray-500': !variant.iconColor,
|
|
46
46
|
'bind-icon-color': variant.iconColor,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import GenericRenderStory from './GenericRenderStory.vue'
|
|
3
3
|
import type { Story, Variant } from '../../types'
|
|
4
|
+
import { isDark } from '../../util/dark'
|
|
5
|
+
import { histoireConfig } from '../../util/config'
|
|
6
|
+
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
7
|
import StoryResponsivePreview from './StoryResponsivePreview.vue'
|
|
5
8
|
|
|
6
9
|
const props = defineProps<{
|
|
@@ -17,6 +20,8 @@ function onReady () {
|
|
|
17
20
|
previewReady: true,
|
|
18
21
|
})
|
|
19
22
|
}
|
|
23
|
+
|
|
24
|
+
const settings = usePreviewSettingsStore().currentSettings
|
|
20
25
|
</script>
|
|
21
26
|
|
|
22
27
|
<template>
|
|
@@ -37,6 +42,8 @@ function onReady () {
|
|
|
37
42
|
:variant="variant"
|
|
38
43
|
:story="story"
|
|
39
44
|
class="htw-h-full"
|
|
45
|
+
:class="[ isDark ? histoireConfig.sandboxDarkClass : undefined ]"
|
|
46
|
+
:dir="settings.textDirection"
|
|
40
47
|
@ready="onReady"
|
|
41
48
|
/>
|
|
42
49
|
</div>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { Story, Variant } from '../../types'
|
|
3
3
|
import { isMobile } from '../../util/responsive'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import ToolbarTitle from '../toolbar/ToolbarTitle.vue'
|
|
5
|
+
import ToolbarResponsiveSize from '../toolbar/ToolbarResponsiveSize.vue'
|
|
6
|
+
import ToolbarBackground from '../toolbar/ToolbarBackground.vue'
|
|
7
|
+
import ToolbarTextDirection from '../toolbar/ToolbarTextDirection.vue'
|
|
8
|
+
import ToolbarNewTab from '../toolbar/ToolbarNewTab.vue'
|
|
8
9
|
import StoryVariantSinglePreviewNative from './StoryVariantSinglePreviewNative.vue'
|
|
9
10
|
import StoryVariantSinglePreviewRemote from './StoryVariantSinglePreviewRemote.vue'
|
|
10
11
|
|
|
@@ -24,14 +25,15 @@ defineProps<{
|
|
|
24
25
|
v-if="!isMobile"
|
|
25
26
|
class="htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
|
|
26
27
|
>
|
|
27
|
-
<
|
|
28
|
+
<ToolbarTitle
|
|
28
29
|
:variant="variant"
|
|
29
30
|
/>
|
|
30
|
-
<
|
|
31
|
+
<ToolbarResponsiveSize
|
|
31
32
|
v-if="!variant.responsiveDisabled"
|
|
32
33
|
/>
|
|
33
|
-
<
|
|
34
|
-
<
|
|
34
|
+
<ToolbarBackground />
|
|
35
|
+
<ToolbarTextDirection />
|
|
36
|
+
<ToolbarNewTab
|
|
35
37
|
:variant="variant"
|
|
36
38
|
:story="story"
|
|
37
39
|
/>
|
|
File without changes
|
package/src/app/components/toolbar/{StoryVariantResponsiveSize.vue → ToolbarResponsiveSize.vue}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
|
+
|
|
5
|
+
const settings = usePreviewSettingsStore().currentSettings
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<a
|
|
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"
|
|
12
|
+
@click="settings.textDirection = settings.textDirection === 'ltr' ? 'rtl' : 'ltr'"
|
|
13
|
+
>
|
|
14
|
+
<Icon
|
|
15
|
+
:icon="settings.textDirection === 'ltr' ? 'fluent:text-paragraph-direction-right-16-regular' : 'fluent:text-paragraph-direction-left-16-regular'"
|
|
16
|
+
class="htw-w-4 htw-h-4"
|
|
17
|
+
/>
|
|
18
|
+
</a>
|
|
19
|
+
</template>
|
|
@@ -11,7 +11,7 @@ defineProps<{
|
|
|
11
11
|
<div class="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
|
-
class="
|
|
14
|
+
class="htw-w-4 htw-h-4 htw-opacity-50"
|
|
15
15
|
:class="[
|
|
16
16
|
variant.iconColor ? 'bind-icon-color' : 'htw-text-gray-500',
|
|
17
17
|
]"
|
|
@@ -41,7 +41,7 @@ useScrollOnActive(isActive, el)
|
|
|
41
41
|
<span class="bind-tree-margin htw-flex htw-items-center htw-gap-2 htw-pl-4 htw-min-w-0">
|
|
42
42
|
<Icon
|
|
43
43
|
:icon="story.icon ?? 'carbon:cube'"
|
|
44
|
-
class="
|
|
44
|
+
class="htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none"
|
|
45
45
|
:class="{
|
|
46
46
|
'htw-text-primary-500': !active && !story.iconColor,
|
|
47
47
|
'bind-icon-color': !active && story.iconColor,
|
|
@@ -3,12 +3,13 @@ import { useStorage } from '@vueuse/core'
|
|
|
3
3
|
import type { PreviewSettings } from '../types'
|
|
4
4
|
|
|
5
5
|
export const usePreviewSettingsStore = defineStore('preview-settings', () => {
|
|
6
|
-
const currentSettings = useStorage<PreviewSettings>('_histoire-sandbox-settings-
|
|
6
|
+
const currentSettings = useStorage<PreviewSettings>('_histoire-sandbox-settings-v3', {
|
|
7
7
|
responsiveWidth: 720,
|
|
8
8
|
responsiveHeight: null,
|
|
9
9
|
rotate: false,
|
|
10
10
|
backgroundColor: 'transparent',
|
|
11
11
|
checkerboard: false,
|
|
12
|
+
textDirection: 'ltr',
|
|
12
13
|
})
|
|
13
14
|
|
|
14
15
|
return {
|
package/src/app/types.ts
CHANGED
package/src/app/util/dark.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
+
import { watch } from 'vue'
|
|
1
2
|
import { useDark, useToggle } from '@vueuse/core'
|
|
2
3
|
|
|
3
4
|
export const isDark = useDark({ valueDark: 'htw-dark' })
|
|
4
5
|
export const toggleDark = useToggle(isDark)
|
|
6
|
+
|
|
7
|
+
function applyDarkToControls () {
|
|
8
|
+
window.__hst_controls_dark?.forEach(ref => {
|
|
9
|
+
ref.value = isDark.value
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
watch(isDark, () => {
|
|
14
|
+
applyDarkToControls()
|
|
15
|
+
}, {
|
|
16
|
+
immediate: true,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
window.__hst_controls_dark_ready = () => {
|
|
20
|
+
applyDarkToControls()
|
|
21
|
+
}
|
|
@@ -5,4 +5,6 @@ export const receivedSettings = reactive<PreviewSettings>({} as PreviewSettings)
|
|
|
5
5
|
|
|
6
6
|
export function applyPreviewSettings (settings: PreviewSettings) {
|
|
7
7
|
Object.assign(receivedSettings, settings)
|
|
8
|
+
|
|
9
|
+
document.documentElement.setAttribute('dir', settings.textDirection)
|
|
8
10
|
}
|
package/src/shim.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
|
|
3
|
+
import type { Ref } from '@histoire/vendors/vue'
|
|
4
|
+
|
|
3
5
|
declare module '*.vue' {
|
|
4
6
|
import { ComponentOptions } from 'vue'
|
|
5
7
|
const comp: ComponentOptions
|
|
6
8
|
export default comp
|
|
7
9
|
}
|
|
10
|
+
|
|
11
|
+
global {
|
|
12
|
+
interface Window {
|
|
13
|
+
__hst_controls_dark: Ref<boolean>[]
|
|
14
|
+
__hst_controls_dark_ready: () => void
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import _sfc_main from "./StoryVariantBackground.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
-
import "./StoryVariantBackground.vue_vue_type_style_index_0_scoped_8dc02d19_lang.js";
|
|
3
|
-
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const StoryVariantBackground = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8dc02d19"]]);
|
|
5
|
-
export {
|
|
6
|
-
StoryVariantBackground as default
|
|
7
|
-
};
|