histoire 0.3.1 → 0.3.2
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/client/app/codegen/vue3.js +1 -0
- package/dist/client/app/codegen/vue3.js.map +1 -0
- package/dist/client/app/components/base/BaseOverflowMenu.vue +118 -0
- package/dist/client/app/components/base/BaseOverflowTab.vue +46 -0
- package/dist/client/app/components/exposed/Story.vue +12 -1
- package/dist/client/app/components/exposed/Variant.vue +6 -0
- package/dist/client/app/components/panel/PaneTabs.vue +64 -0
- package/dist/client/app/components/{story → panel}/StoryControls.vue +1 -1
- package/dist/client/app/components/{story → panel}/StoryDocs.vue +0 -0
- package/dist/client/app/components/{story → panel}/StoryEvent.vue +0 -0
- package/dist/client/app/components/{story → panel}/StoryEvents.vue +0 -0
- package/dist/client/app/components/{story → panel}/StorySidePanel.vue +3 -31
- package/dist/client/app/components/{story → panel}/StorySourceCode.vue +0 -0
- package/dist/client/app/components/sandbox/SandboxVue3.vue +10 -0
- package/dist/client/app/components/search/search-data.js +1 -0
- package/dist/client/app/components/search/search-data.js.map +1 -0
- package/dist/client/app/components/story/StoryResponsivePreview.vue +9 -131
- package/dist/client/app/components/story/StoryVariantSingle.vue +109 -0
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +39 -0
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
- package/dist/client/app/components/story/StoryVariantSingleView.vue +13 -6
- package/dist/client/app/components/story/StoryView.vue +2 -2
- package/dist/client/app/components/story/StoryViewer.vue +2 -92
- package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantBackground.vue +3 -3
- package/dist/client/app/components/{story/toolbar → toolbar}/StoryVariantNewTab.vue +2 -2
- package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantResponsiveSize.vue +3 -3
- package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantTitle.vue +1 -1
- package/dist/client/app/global-components.js +1 -0
- package/dist/client/app/global-components.js.map +1 -0
- package/dist/client/app/index.js +1 -0
- package/dist/client/app/index.js.map +1 -0
- package/dist/client/app/sandbox.js +1 -0
- package/dist/client/app/sandbox.js.map +1 -0
- package/dist/client/app/stores/events.d.ts +1 -1
- package/dist/client/app/stores/events.js +1 -0
- package/dist/client/app/stores/events.js.map +1 -0
- package/dist/client/app/stores/folder.js +1 -0
- package/dist/client/app/stores/folder.js.map +1 -0
- package/dist/client/app/stores/story.d.ts +27 -0
- package/dist/client/app/stores/story.js +1 -0
- package/dist/client/app/stores/story.js.map +1 -0
- package/dist/client/app/style/transitions.pcss +13 -0
- package/dist/client/app/types.d.ts +3 -0
- package/dist/client/app/types.js +1 -0
- package/dist/client/app/types.js.map +1 -0
- package/dist/client/app/util/events.js +1 -0
- package/dist/client/app/util/events.js.map +1 -0
- package/dist/client/app/util/keyboard.js +1 -0
- package/dist/client/app/util/keyboard.js.map +1 -0
- package/dist/client/app/util/mapping.js +3 -0
- package/dist/client/app/util/mapping.js.map +1 -0
- package/dist/client/app/util/preview-settings.js +1 -0
- package/dist/client/app/util/preview-settings.js.map +1 -0
- package/dist/client/app/util/reactivity.js +1 -0
- package/dist/client/app/util/reactivity.js.map +1 -0
- package/dist/client/app/util/scroll.js +1 -0
- package/dist/client/app/util/scroll.js.map +1 -0
- package/dist/client/app/util/variant.js +1 -0
- package/dist/client/app/util/variant.js.map +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/server/vue3/Story.vue +1 -1
- package/dist/client/server/vue3/run.js +1 -0
- package/dist/client/server/vue3/run.js.map +1 -0
- package/dist/controls.js +1 -0
- package/dist/controls.js.map +1 -0
- package/dist/style.css +93 -69
- package/package.json +2 -2
- package/src/client/app/components/base/BaseOverflowMenu.vue +118 -0
- package/src/client/app/components/base/BaseOverflowTab.vue +46 -0
- package/src/client/app/components/exposed/Story.vue +12 -1
- package/src/client/app/components/exposed/Variant.vue +6 -0
- package/src/client/app/components/panel/PaneTabs.vue +64 -0
- package/src/client/app/components/{story → panel}/StoryControls.vue +1 -1
- package/src/client/app/components/{story → panel}/StoryDocs.vue +0 -0
- package/src/client/app/components/{story → panel}/StoryEvent.vue +0 -0
- package/src/client/app/components/{story → panel}/StoryEvents.vue +0 -0
- package/src/client/app/components/{story → panel}/StorySidePanel.vue +3 -31
- package/src/client/app/components/{story → panel}/StorySourceCode.vue +0 -0
- package/src/client/app/components/sandbox/SandboxVue3.vue +10 -0
- package/src/client/app/components/story/StoryResponsivePreview.vue +9 -131
- package/src/client/app/components/story/StoryVariantSingle.vue +109 -0
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +39 -0
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
- package/src/client/app/components/story/StoryVariantSingleView.vue +13 -6
- package/src/client/app/components/story/StoryView.vue +2 -2
- package/src/client/app/components/story/StoryViewer.vue +2 -92
- package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantBackground.vue +3 -3
- package/src/client/app/components/{story/toolbar → toolbar}/StoryVariantNewTab.vue +2 -2
- package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantResponsiveSize.vue +3 -3
- package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantTitle.vue +1 -1
- package/src/client/app/sandbox.ts +1 -1
- package/src/client/app/style/transitions.pcss +13 -0
- package/src/client/app/types.ts +4 -0
- package/src/client/app/util/mapping.ts +2 -0
- package/src/client/server/vue3/Story.vue +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { useStoryStore } from '../../stores/story'
|
|
4
|
+
import { Icon } from '@iconify/vue'
|
|
5
|
+
import { isMobile } from '../../util/responsive'
|
|
6
|
+
import BaseSplitPane from '../base/BaseSplitPane.vue'
|
|
7
|
+
import StoryVariantListItem from './StoryVariantListItem.vue'
|
|
8
|
+
import StoryVariantSingleView from './StoryVariantSingleView.vue'
|
|
9
|
+
|
|
10
|
+
const storyStore = useStoryStore()
|
|
11
|
+
|
|
12
|
+
const hasSingleVariant = computed(() => (storyStore.currentStory?.variants.length === 1))
|
|
13
|
+
|
|
14
|
+
const variant = computed(() => storyStore.currentVariant)
|
|
15
|
+
|
|
16
|
+
const isMenuOpened = ref(false)
|
|
17
|
+
|
|
18
|
+
function openMenu () {
|
|
19
|
+
isMenuOpened.value = true
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
v-if="hasSingleVariant && storyStore.currentVariant"
|
|
26
|
+
class="htw-p-2 htw-h-full"
|
|
27
|
+
>
|
|
28
|
+
<StoryVariantSingleView
|
|
29
|
+
v-if="storyStore.currentVariant.configReady"
|
|
30
|
+
:variant="storyStore.currentVariant"
|
|
31
|
+
:story="storyStore.currentStory"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
<template v-else>
|
|
35
|
+
<div
|
|
36
|
+
v-if="isMobile"
|
|
37
|
+
class="htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
|
|
38
|
+
>
|
|
39
|
+
<a
|
|
40
|
+
class="htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center"
|
|
41
|
+
@click="openMenu"
|
|
42
|
+
>
|
|
43
|
+
<template v-if="variant">
|
|
44
|
+
<Icon
|
|
45
|
+
:icon="variant.icon ?? 'carbon:cube'"
|
|
46
|
+
class="base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none"
|
|
47
|
+
:class="{
|
|
48
|
+
'htw-text-gray-500': !variant.iconColor,
|
|
49
|
+
'bind-icon-color': variant.iconColor,
|
|
50
|
+
}"
|
|
51
|
+
/>
|
|
52
|
+
{{ variant.title }}
|
|
53
|
+
</template>
|
|
54
|
+
<template v-else>
|
|
55
|
+
Select a variant...
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<Icon
|
|
59
|
+
icon="carbon:chevron-sort"
|
|
60
|
+
class="htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
61
|
+
/>
|
|
62
|
+
</a>
|
|
63
|
+
<div
|
|
64
|
+
v-if="storyStore.currentVariant"
|
|
65
|
+
class="htw-p-2 htw-h-full"
|
|
66
|
+
>
|
|
67
|
+
<StoryVariantSingleView
|
|
68
|
+
v-if="storyStore.currentVariant.configReady"
|
|
69
|
+
:variant="storyStore.currentVariant"
|
|
70
|
+
:story="storyStore.currentStory"
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<BaseSplitPane
|
|
75
|
+
v-else
|
|
76
|
+
save-id="story-single-main-split"
|
|
77
|
+
:min="5"
|
|
78
|
+
:max="40"
|
|
79
|
+
:default-split="17"
|
|
80
|
+
>
|
|
81
|
+
<template #first>
|
|
82
|
+
<div class="htw-h-full htw-overflow-y-auto">
|
|
83
|
+
<StoryVariantListItem
|
|
84
|
+
v-for="(variant, index) of storyStore.currentStory.variants"
|
|
85
|
+
:key="index"
|
|
86
|
+
:variant="variant"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
<template #last>
|
|
91
|
+
<div
|
|
92
|
+
v-if="storyStore.currentVariant"
|
|
93
|
+
class="htw-p-2 htw-h-full"
|
|
94
|
+
>
|
|
95
|
+
<StoryVariantSingleView
|
|
96
|
+
:variant="storyStore.currentVariant"
|
|
97
|
+
:story="storyStore.currentStory"
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
</template>
|
|
101
|
+
</BaseSplitPane>
|
|
102
|
+
</template>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<style scoped>
|
|
106
|
+
.bind-icon-color {
|
|
107
|
+
color: v-bind('variant?.iconColor');
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { Story, Variant } from '../../types'
|
|
3
|
+
import SandboxVue3 from '../sandbox/SandboxVue3.vue'
|
|
4
|
+
import StoryResponsivePreview from './StoryResponsivePreview.vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
story: Story
|
|
8
|
+
variant: Variant
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
Object.assign(props.variant, {
|
|
12
|
+
previewReady: false,
|
|
13
|
+
})
|
|
14
|
+
function onReady () {
|
|
15
|
+
Object.assign(props.variant, {
|
|
16
|
+
previewReady: true,
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<StoryResponsivePreview
|
|
23
|
+
v-slot="{ isResponsiveEnabled, finalWidth, finalHeight }"
|
|
24
|
+
:variant="variant"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
:style="isResponsiveEnabled ? {
|
|
28
|
+
width: finalWidth ? `${finalWidth}px` : null,
|
|
29
|
+
height: finalHeight ? `${finalHeight}px` : null,
|
|
30
|
+
} : undefined"
|
|
31
|
+
>
|
|
32
|
+
<SandboxVue3
|
|
33
|
+
:variant="variant"
|
|
34
|
+
:story="story"
|
|
35
|
+
@ready="onReady"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</StoryResponsivePreview>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, onUnmounted, Ref, ref, toRaw, watch } from 'vue'
|
|
3
|
+
import { useEventListener } from '@vueuse/core'
|
|
4
|
+
import { Icon } from '@iconify/vue'
|
|
5
|
+
import { STATE_SYNC, PREVIEW_SETTINGS_SYNC, SANDBOX_READY, EVENT_SEND } from '../../util/const'
|
|
6
|
+
import type { Story, Variant } from '../../types'
|
|
7
|
+
import HatchedPattern from '../misc/HatchedPattern.vue'
|
|
8
|
+
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
9
|
+
import { toRawDeep } from '../../util/reactivity'
|
|
10
|
+
import { getSandboxUrl } from '../sandbox/lib'
|
|
11
|
+
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
12
|
+
import { HstEvent, useEventsStore } from '../../stores/events'
|
|
13
|
+
import StoryResponsivePreview from './StoryResponsivePreview.vue'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
story: Story
|
|
17
|
+
variant: Variant
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const settings = usePreviewSettingsStore().currentSettings
|
|
21
|
+
|
|
22
|
+
// Iframe
|
|
23
|
+
|
|
24
|
+
const iframe = ref<HTMLIFrameElement>()
|
|
25
|
+
|
|
26
|
+
function syncState () {
|
|
27
|
+
if (iframe.value && props.variant.previewReady) {
|
|
28
|
+
iframe.value.contentWindow.postMessage({
|
|
29
|
+
type: STATE_SYNC,
|
|
30
|
+
state: toRawDeep(props.variant.state),
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let synced = false
|
|
36
|
+
|
|
37
|
+
watch(() => props.variant.state, () => {
|
|
38
|
+
if (synced) {
|
|
39
|
+
synced = false
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
syncState()
|
|
43
|
+
}, {
|
|
44
|
+
deep: true,
|
|
45
|
+
immediate: true,
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
Object.assign(props.variant, {
|
|
49
|
+
previewReady: false,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
useEventListener(window, 'message', (event) => {
|
|
53
|
+
switch (event.data.type) {
|
|
54
|
+
case STATE_SYNC:
|
|
55
|
+
updateVariantState(event.data.state)
|
|
56
|
+
break
|
|
57
|
+
case EVENT_SEND:
|
|
58
|
+
logEvent(event.data.event)
|
|
59
|
+
break
|
|
60
|
+
case SANDBOX_READY:
|
|
61
|
+
setPreviewReady()
|
|
62
|
+
break
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
function updateVariantState (state: any) {
|
|
67
|
+
synced = true
|
|
68
|
+
if (props.variant.state) {
|
|
69
|
+
for (const key in state) {
|
|
70
|
+
if (typeof props.variant.state[key] === 'object') {
|
|
71
|
+
Object.assign(props.variant.state[key], state[key])
|
|
72
|
+
} else {
|
|
73
|
+
// eslint-disable-next-line vue/no-mutating-props
|
|
74
|
+
props.variant.state[key] = state[key]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
// eslint-disable-next-line vue/no-mutating-props
|
|
79
|
+
props.variant.state = state
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function logEvent (event: HstEvent) {
|
|
84
|
+
const eventsStore = useEventsStore()
|
|
85
|
+
eventsStore.addEvent(event)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function setPreviewReady () {
|
|
89
|
+
Object.assign(props.variant, {
|
|
90
|
+
previewReady: true,
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const sandboxUrl = computed(() => {
|
|
95
|
+
return getSandboxUrl(props.story, props.variant)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const isIframeLoaded = ref(false)
|
|
99
|
+
|
|
100
|
+
watch(sandboxUrl, () => {
|
|
101
|
+
isIframeLoaded.value = false
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// Settings
|
|
105
|
+
|
|
106
|
+
function syncSettings () {
|
|
107
|
+
if (iframe.value) {
|
|
108
|
+
iframe.value.contentWindow.postMessage({
|
|
109
|
+
type: PREVIEW_SETTINGS_SYNC,
|
|
110
|
+
settings: toRaw(settings),
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
watch(() => settings, () => {
|
|
116
|
+
syncSettings()
|
|
117
|
+
}, {
|
|
118
|
+
deep: true,
|
|
119
|
+
immediate: true,
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// Iframe load
|
|
123
|
+
|
|
124
|
+
function onIframeLoad () {
|
|
125
|
+
isIframeLoaded.value = true
|
|
126
|
+
syncState()
|
|
127
|
+
syncSettings()
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<template>
|
|
133
|
+
<StoryResponsivePreview
|
|
134
|
+
v-slot="{ isResponsiveEnabled, finalWidth, finalHeight, resizing }"
|
|
135
|
+
:variant="variant"
|
|
136
|
+
>
|
|
137
|
+
<iframe
|
|
138
|
+
ref="iframe"
|
|
139
|
+
:src="sandboxUrl"
|
|
140
|
+
class="htw-w-full htw-h-full htw-relative"
|
|
141
|
+
:class="{
|
|
142
|
+
'htw-invisible': !isIframeLoaded,
|
|
143
|
+
'htw-pointer-events-none': resizing,
|
|
144
|
+
}"
|
|
145
|
+
:style="isResponsiveEnabled ? {
|
|
146
|
+
width: finalWidth ? `${finalWidth}px` : null,
|
|
147
|
+
height: finalHeight ? `${finalHeight}px` : null,
|
|
148
|
+
} : undefined"
|
|
149
|
+
data-test-id="preview-iframe"
|
|
150
|
+
@load="onIframeLoad()"
|
|
151
|
+
/>
|
|
152
|
+
</StoryResponsivePreview>
|
|
153
|
+
</template>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { Story, Variant } from '../../types'
|
|
3
|
-
import StoryResponsivePreview from './StoryResponsivePreview.vue'
|
|
4
3
|
import { isMobile } from '../../util/responsive'
|
|
5
|
-
import StoryVariantTitle from '
|
|
6
|
-
import StoryVariantResponsiveSize from '
|
|
7
|
-
import StoryVariantBackground from '
|
|
8
|
-
import StoryVariantNewTab from '
|
|
4
|
+
import StoryVariantTitle from '../toolbar/StoryVariantTitle.vue'
|
|
5
|
+
import StoryVariantResponsiveSize from '../toolbar/StoryVariantResponsiveSize.vue'
|
|
6
|
+
import StoryVariantBackground from '../toolbar/StoryVariantBackground.vue'
|
|
7
|
+
import StoryVariantNewTab from '../toolbar/StoryVariantNewTab.vue'
|
|
8
|
+
import StoryVariantSinglePreviewNative from './StoryVariantSinglePreviewNative.vue'
|
|
9
|
+
import StoryVariantSinglePreviewRemote from './StoryVariantSinglePreviewRemote.vue'
|
|
9
10
|
|
|
10
11
|
defineProps<{
|
|
11
12
|
variant: Variant
|
|
@@ -37,7 +38,13 @@ defineProps<{
|
|
|
37
38
|
</div>
|
|
38
39
|
|
|
39
40
|
<!-- Preview -->
|
|
40
|
-
<
|
|
41
|
+
<StoryVariantSinglePreviewNative
|
|
42
|
+
v-if="story.layout.iframe === false"
|
|
43
|
+
:story="story"
|
|
44
|
+
:variant="variant"
|
|
45
|
+
/>
|
|
46
|
+
<StoryVariantSinglePreviewRemote
|
|
47
|
+
v-else
|
|
41
48
|
:story="story"
|
|
42
49
|
:variant="variant"
|
|
43
50
|
/>
|
|
@@ -8,8 +8,8 @@ import BaseSplitPane from '../base/BaseSplitPane.vue'
|
|
|
8
8
|
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
9
9
|
import { isMobile } from '../../util/responsive'
|
|
10
10
|
import StoryViewer from './StoryViewer.vue'
|
|
11
|
-
import StorySidePanel from '
|
|
12
|
-
import StoryDocs from '
|
|
11
|
+
import StorySidePanel from '../panel/StorySidePanel.vue'
|
|
12
|
+
import StoryDocs from '../panel/StoryDocs.vue'
|
|
13
13
|
|
|
14
14
|
const storyStore = useStoryStore()
|
|
15
15
|
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref, watch } from 'vue'
|
|
3
3
|
import { useStoryStore } from '../../stores/story'
|
|
4
|
-
import { Icon } from '@iconify/vue'
|
|
5
|
-
import { isMobile } from '../../util/responsive'
|
|
6
|
-
import BaseSplitPane from '../base/BaseSplitPane.vue'
|
|
7
4
|
import StoryVariantListItem from './StoryVariantListItem.vue'
|
|
8
|
-
import StoryVariantSingleView from './StoryVariantSingleView.vue'
|
|
9
5
|
import MobileOverlay from '../app/MobileOverlay.vue'
|
|
10
6
|
import StoryVariantGrid from './StoryVariantGrid.vue'
|
|
7
|
+
import StoryVariantSingle from './StoryVariantSingle.vue'
|
|
11
8
|
|
|
12
9
|
const storyStore = useStoryStore()
|
|
13
10
|
|
|
14
|
-
const hasSingleVariant = computed(() => (storyStore.currentStory?.variants.length === 1))
|
|
15
|
-
|
|
16
11
|
const variant = computed(() => storyStore.currentVariant)
|
|
17
12
|
|
|
18
13
|
const isMenuOpened = ref(false)
|
|
19
14
|
|
|
20
|
-
function openMenu () {
|
|
21
|
-
isMenuOpened.value = true
|
|
22
|
-
}
|
|
23
|
-
|
|
24
15
|
function closeMenu () {
|
|
25
16
|
isMenuOpened.value = false
|
|
26
17
|
}
|
|
@@ -36,88 +27,7 @@ watch(variant, () => {
|
|
|
36
27
|
<StoryVariantGrid
|
|
37
28
|
v-if="storyStore.currentStory.layout.type === 'grid'"
|
|
38
29
|
/>
|
|
39
|
-
|
|
40
|
-
<template v-else-if="storyStore.currentStory.layout.type === 'single'">
|
|
41
|
-
<div
|
|
42
|
-
v-if="hasSingleVariant && storyStore.currentVariant"
|
|
43
|
-
class="htw-p-2 htw-h-full"
|
|
44
|
-
>
|
|
45
|
-
<StoryVariantSingleView
|
|
46
|
-
v-if="storyStore.currentVariant.configReady"
|
|
47
|
-
:variant="storyStore.currentVariant"
|
|
48
|
-
:story="storyStore.currentStory"
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
<template v-else>
|
|
52
|
-
<div
|
|
53
|
-
v-if="isMobile"
|
|
54
|
-
class="htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
|
|
55
|
-
>
|
|
56
|
-
<a
|
|
57
|
-
class="htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center"
|
|
58
|
-
@click="openMenu"
|
|
59
|
-
>
|
|
60
|
-
<template v-if="variant">
|
|
61
|
-
<Icon
|
|
62
|
-
:icon="variant.icon ?? 'carbon:cube'"
|
|
63
|
-
class="base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none"
|
|
64
|
-
:class="{
|
|
65
|
-
'htw-text-gray-500': !variant.iconColor,
|
|
66
|
-
'bind-icon-color': variant.iconColor,
|
|
67
|
-
}"
|
|
68
|
-
/>
|
|
69
|
-
{{ variant.title }}
|
|
70
|
-
</template>
|
|
71
|
-
<template v-else>
|
|
72
|
-
Select a variant...
|
|
73
|
-
</template>
|
|
74
|
-
|
|
75
|
-
<Icon
|
|
76
|
-
icon="carbon:chevron-sort"
|
|
77
|
-
class="htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
78
|
-
/>
|
|
79
|
-
</a>
|
|
80
|
-
<div
|
|
81
|
-
v-if="storyStore.currentVariant"
|
|
82
|
-
class="htw-p-2 htw-h-full"
|
|
83
|
-
>
|
|
84
|
-
<StoryVariantSingleView
|
|
85
|
-
v-if="storyStore.currentVariant.configReady"
|
|
86
|
-
:variant="storyStore.currentVariant"
|
|
87
|
-
:story="storyStore.currentStory"
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
<BaseSplitPane
|
|
92
|
-
v-else
|
|
93
|
-
save-id="story-single-main-split"
|
|
94
|
-
:min="5"
|
|
95
|
-
:max="40"
|
|
96
|
-
:default-split="17"
|
|
97
|
-
>
|
|
98
|
-
<template #first>
|
|
99
|
-
<div class="htw-h-full htw-overflow-y-auto">
|
|
100
|
-
<StoryVariantListItem
|
|
101
|
-
v-for="(variant, index) of storyStore.currentStory.variants"
|
|
102
|
-
:key="index"
|
|
103
|
-
:variant="variant"
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
</template>
|
|
107
|
-
<template #last>
|
|
108
|
-
<div
|
|
109
|
-
v-if="storyStore.currentVariant"
|
|
110
|
-
class="htw-p-2 htw-h-full"
|
|
111
|
-
>
|
|
112
|
-
<StoryVariantSingleView
|
|
113
|
-
:variant="storyStore.currentVariant"
|
|
114
|
-
:story="storyStore.currentStory"
|
|
115
|
-
/>
|
|
116
|
-
</div>
|
|
117
|
-
</template>
|
|
118
|
-
</BaseSplitPane>
|
|
119
|
-
</template>
|
|
120
|
-
</template>
|
|
30
|
+
<StoryVariantSingle v-else-if="storyStore.currentStory.layout.type === 'single'" />
|
|
121
31
|
</div>
|
|
122
32
|
|
|
123
33
|
<MobileOverlay
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
|
-
import { usePreviewSettingsStore } from '
|
|
4
|
-
import { histoireConfig } from '
|
|
5
|
-
import BaseCheckbox from '
|
|
3
|
+
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
|
+
import { histoireConfig } from '../../util/config'
|
|
5
|
+
import BaseCheckbox from '../base/BaseCheckbox.vue'
|
|
6
6
|
|
|
7
7
|
const settings = usePreviewSettingsStore().currentSettings
|
|
8
8
|
</script>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
|
-
import type { Story, Variant } from '
|
|
3
|
+
import type { Story, Variant } from '../../types'
|
|
4
4
|
import { computed } from 'vue'
|
|
5
|
-
import { getSandboxUrl } from '
|
|
5
|
+
import { getSandboxUrl } from '../sandbox/lib'
|
|
6
6
|
|
|
7
7
|
const props = defineProps<{
|
|
8
8
|
variant: Variant
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
|
-
import { usePreviewSettingsStore } from '
|
|
4
|
-
import { histoireConfig } from '
|
|
5
|
-
import BaseCheckbox from '
|
|
3
|
+
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
|
+
import { histoireConfig } from '../../util/config'
|
|
5
|
+
import BaseCheckbox from '../base/BaseCheckbox.vue'
|
|
6
6
|
|
|
7
7
|
const settings = usePreviewSettingsStore().currentSettings
|
|
8
8
|
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-components.js","sourceRoot":"","sources":["../../../src/client/app/global-components.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,MAAM,gCAAgC,CAAA;AAClD,OAAO,OAAO,MAAM,kCAAkC,CAAA;AAEtD,MAAM,UAAU,wBAAwB,CAAE,GAAQ;IAChD,0DAA0D;IAC1D,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC7B,0DAA0D;IAC1D,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAEjC,qBAAqB,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC"}
|
package/dist/client/app/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,iBAAiB,CAAA;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,GAAG,MAAM,WAAW,CAAA;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;AACtB,G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