@poveste/app 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/style/floating.pcss +4 -4
- package/dist/app/style/main.pcss +2 -2
- package/dist/app/style/sandbox.css +1 -1
- package/dist/bundle-main.js +2 -0
- package/dist/bundled/App.vue2.js +81 -37
- package/dist/bundled/app.css +51 -46
- package/dist/bundled/components/HomeView.vue2.js +3 -3
- package/dist/bundled/components/app/AppActions.vue.js +5 -0
- package/dist/bundled/components/app/AppActions.vue2.js +76 -0
- package/dist/bundled/components/app/AppHeader.vue2.js +5 -47
- package/dist/bundled/components/app/Breadcrumb.vue.js +1 -1
- package/dist/bundled/components/app/Breadcrumb.vue2.js +9 -9
- package/dist/bundled/components/app/HomeCounter.vue2.js +5 -5
- package/dist/bundled/components/app/InitialLoading.vue2.js +5 -5
- package/dist/bundled/components/app/MobileOverlay.vue2.js +5 -5
- package/dist/bundled/components/app/TopBar.vue.js +5 -0
- package/dist/bundled/components/app/TopBar.vue2.js +73 -0
- package/dist/bundled/components/app/TopBarChip.vue.js +13 -0
- package/dist/bundled/components/app/TopBarChipItem.vue.js +13 -0
- package/dist/bundled/components/base/BaseButton.vue2.js +3 -3
- package/dist/bundled/components/base/BaseCheckbox.vue2.js +8 -8
- package/dist/bundled/components/base/BaseEmpty.vue.js +2 -2
- package/dist/bundled/components/base/BaseKeyboardShortcut.vue2.js +1 -1
- package/dist/bundled/components/base/BaseListItem.vue2.js +2 -2
- package/dist/bundled/components/base/BaseListItemLink.vue.js +2 -2
- package/dist/bundled/components/base/BaseOverflowMenu.vue2.js +4 -4
- package/dist/bundled/components/base/BaseOverflowTab.vue.js +3 -3
- package/dist/bundled/components/base/BaseSelect.vue2.js +6 -6
- package/dist/bundled/components/base/BaseSplitPane.vue.js +1 -1
- package/dist/bundled/components/base/BaseSplitPane.vue2.js +20 -16
- package/dist/bundled/components/base/BaseTab.vue.js +3 -3
- package/dist/bundled/components/base/BaseTag.vue.js +1 -1
- package/dist/bundled/components/command/CommandPrompts.vue2.js +5 -5
- package/dist/bundled/components/command/CommandPromptsModal.vue2.js +3 -3
- package/dist/bundled/components/command/PromptSelect.vue2.js +12 -12
- package/dist/bundled/components/command/PromptText.vue2.js +4 -4
- package/dist/bundled/components/layout/LayoutItem.vue.js +5 -0
- package/dist/bundled/components/layout/LayoutItem.vue2.js +44 -0
- package/dist/bundled/components/layout/LayoutItemGroup.vue.js +5 -0
- package/dist/bundled/components/layout/LayoutItemGroup.vue2.js +25 -0
- package/dist/bundled/components/layout/LayoutModal.vue.js +5 -0
- package/dist/bundled/components/layout/LayoutModal.vue2.js +68 -0
- package/dist/bundled/components/layout/LayoutPane.vue.js +5 -0
- package/dist/bundled/components/layout/LayoutPane.vue2.js +59 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue2.js +2 -2
- package/dist/bundled/components/panel/ControlsComponentProps.vue2.js +4 -4
- package/dist/bundled/components/panel/ControlsComponentState.vue2.js +2 -2
- package/dist/bundled/components/panel/PaneTabs.vue2.js +4 -4
- package/dist/bundled/components/panel/StatePresets.vue2.js +13 -13
- package/dist/bundled/components/panel/StoryControls.vue2.js +6 -6
- package/dist/bundled/components/panel/StoryDocs.vue2.js +4 -4
- package/dist/bundled/components/panel/StoryEvent.vue2.js +7 -7
- package/dist/bundled/components/panel/StoryEvents.vue2.js +1 -1
- package/dist/bundled/components/panel/StorySidePanel.vue2.js +58 -47
- package/dist/bundled/components/panel/StorySourceCode.vue.js +1 -1
- package/dist/bundled/components/panel/StorySourceCode.vue2.js +19 -19
- package/dist/bundled/components/search/SearchItem.vue.js +1 -1
- package/dist/bundled/components/search/SearchItem.vue2.js +3 -3
- package/dist/bundled/components/search/SearchItemContent.vue2.js +9 -9
- package/dist/bundled/components/search/SearchLoading.vue2.js +2 -2
- package/dist/bundled/components/search/SearchModal.vue2.js +3 -3
- package/dist/bundled/components/search/SearchPane.vue2.js +4 -4
- package/dist/bundled/components/story/StoryResponsivePreview.vue.js +1 -1
- package/dist/bundled/components/story/StoryResponsivePreview.vue2.js +21 -21
- package/dist/bundled/components/story/StoryVariantGrid.vue2.js +7 -26
- package/dist/bundled/components/story/StoryVariantGridItem.vue.js +1 -1
- package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +36 -21
- package/dist/bundled/components/story/StoryVariantListItem.vue.js +1 -1
- package/dist/bundled/components/story/StoryVariantListItem.vue2.js +5 -5
- package/dist/bundled/components/story/StoryVariantSingle.vue.js +1 -1
- package/dist/bundled/components/story/StoryVariantSingle.vue2.js +10 -10
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +6 -5
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue2.js +33 -8
- package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +8 -39
- package/dist/bundled/components/story/StoryView.vue2.js +21 -11
- package/dist/bundled/components/story/StoryViewer.vue.js +1 -1
- package/dist/bundled/components/story/StoryViewer.vue2.js +2 -2
- package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue2.js +13 -9
- package/dist/bundled/components/toolbar/ToolbarBackground.vue.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarBackground.vue2.js +62 -33
- package/dist/bundled/components/toolbar/ToolbarNewTab.vue2.js +13 -10
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue2.js +14 -14
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue2.js +13 -9
- package/dist/bundled/components/toolbar/ToolbarTitle.vue.js +4 -1
- package/dist/bundled/components/toolbar/ToolbarTitle.vue2.js +30 -7
- package/dist/bundled/components/tree/StoryGroup.vue2.js +5 -5
- package/dist/bundled/components/tree/StoryList.vue2.js +1 -1
- package/dist/bundled/components/tree/StoryListFolder.vue.js +1 -1
- package/dist/bundled/components/tree/StoryListFolder.vue2.js +7 -7
- package/dist/bundled/components/tree/StoryListItem.vue.js +1 -1
- package/dist/bundled/components/tree/StoryListItem.vue2.js +8 -8
- package/dist/bundled/index.js +3 -0
- package/dist/bundled/sandbox.js +41 -15
- package/dist/bundled/stores/layout.js +16 -0
- package/dist/bundled/stores/preview-settings.js +19 -4
- package/dist/bundled/util/color-scheme.js +27 -0
- package/dist/bundled/util/const.js +2 -0
- package/dist/bundled/util/dark.js +3 -3
- package/dist/bundled/util/keyboard.js +60 -32
- package/dist/bundled/util/preview-settings.js +11 -0
- package/dist/bundled/util/tooltip.js +2 -2
- package/dist/style.css +644 -529
- package/package.json +8 -8
- package/src/app/App.vue +109 -66
- package/src/app/components/HomeView.vue +3 -3
- package/src/app/components/app/AppActions.vue +58 -0
- package/src/app/components/app/AppHeader.vue +4 -47
- package/src/app/components/app/Breadcrumb.vue +8 -8
- package/src/app/components/app/HomeCounter.vue +5 -5
- package/src/app/components/app/InitialLoading.vue +5 -5
- package/src/app/components/app/MobileOverlay.vue +5 -5
- package/src/app/components/app/TopBar.vue +60 -0
- package/src/app/components/app/TopBarChip.vue +5 -0
- package/src/app/components/app/TopBarChipItem.vue +7 -0
- package/src/app/components/base/BaseButton.vue +3 -3
- package/src/app/components/base/BaseCheckbox.vue +9 -9
- package/src/app/components/base/BaseCopyIcon.vue +1 -1
- package/src/app/components/base/BaseEmpty.vue +4 -4
- package/src/app/components/base/BaseKeyboardShortcut.vue +1 -1
- package/src/app/components/base/BaseListItem.vue +3 -3
- package/src/app/components/base/BaseListItemLink.vue +3 -3
- package/src/app/components/base/BaseOverflowMenu.vue +4 -4
- package/src/app/components/base/BaseOverflowTab.vue +3 -3
- package/src/app/components/base/BaseSelect.vue +6 -6
- package/src/app/components/base/BaseSplitPane.vue +21 -16
- package/src/app/components/base/BaseTab.vue +3 -3
- package/src/app/components/base/BaseTag.vue +1 -1
- package/src/app/components/command/CommandPrompts.vue +5 -5
- package/src/app/components/command/CommandPromptsModal.vue +3 -3
- package/src/app/components/command/PromptSelect.vue +14 -14
- package/src/app/components/command/PromptText.vue +4 -4
- package/src/app/components/layout/LayoutItem.vue +36 -0
- package/src/app/components/layout/LayoutItemGroup.vue +18 -0
- package/src/app/components/layout/LayoutModal.vue +60 -0
- package/src/app/components/layout/LayoutPane.vue +45 -0
- package/src/app/components/panel/ControlsComponentPropItem.vue +2 -2
- package/src/app/components/panel/ControlsComponentProps.vue +3 -3
- package/src/app/components/panel/ControlsComponentState.vue +2 -2
- package/src/app/components/panel/PaneTabs.vue +4 -4
- package/src/app/components/panel/StatePresets.vue +13 -13
- package/src/app/components/panel/StoryControls.vue +6 -6
- package/src/app/components/panel/StoryDocs.vue +4 -4
- package/src/app/components/panel/StoryEvent.vue +7 -7
- package/src/app/components/panel/StoryEvents.vue +1 -1
- package/src/app/components/panel/StorySidePanel.vue +51 -41
- package/src/app/components/panel/StorySourceCode.vue +19 -19
- package/src/app/components/search/SearchItem.vue +2 -2
- package/src/app/components/search/SearchItemContent.vue +9 -9
- package/src/app/components/search/SearchLoading.vue +2 -2
- package/src/app/components/search/SearchModal.vue +3 -3
- package/src/app/components/search/SearchPane.vue +4 -4
- package/src/app/components/story/StoryResponsivePreview.vue +27 -27
- package/src/app/components/story/StoryVariantGrid.vue +5 -24
- package/src/app/components/story/StoryVariantGridItem.vue +36 -17
- package/src/app/components/story/StoryVariantListItem.vue +4 -4
- package/src/app/components/story/StoryVariantSingle.vue +9 -9
- package/src/app/components/story/StoryVariantSinglePreviewNative.vue +7 -5
- package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +37 -7
- package/src/app/components/story/StoryVariantSingleView.vue +1 -34
- package/src/app/components/story/StoryView.vue +23 -8
- package/src/app/components/story/StoryViewer.vue +1 -1
- package/src/app/components/toolbar/DevOnlyToolbarOpenInEditor.vue +5 -4
- package/src/app/components/toolbar/ToolbarBackground.vue +62 -25
- package/src/app/components/toolbar/ToolbarNewTab.vue +5 -4
- package/src/app/components/toolbar/ToolbarResponsiveSize.vue +15 -15
- package/src/app/components/toolbar/ToolbarTextDirection.vue +5 -4
- package/src/app/components/toolbar/ToolbarTitle.vue +32 -8
- package/src/app/components/tree/StoryGroup.vue +5 -5
- package/src/app/components/tree/StoryList.vue +1 -1
- package/src/app/components/tree/StoryListFolder.vue +6 -6
- package/src/app/components/tree/StoryListItem.vue +6 -6
- package/src/app/index.ts +3 -0
- package/src/app/sandbox.ts +59 -15
- package/src/app/stores/layout.ts +22 -0
- package/src/app/stores/preview-settings.ts +26 -2
- package/src/app/style/floating.pcss +4 -4
- package/src/app/style/main.pcss +2 -2
- package/src/app/style/sandbox.css +1 -1
- package/src/app/types.ts +49 -0
- package/src/app/util/color-scheme.ts +36 -0
- package/src/app/util/const.ts +1 -0
- package/src/app/util/dark.ts +3 -3
- package/src/app/util/keyboard.ts +65 -32
- package/src/app/util/preview-settings.ts +16 -0
- package/src/app/util/tooltip.ts +2 -2
- package/src/bundle-main.js +2 -0
- package/src/shim.d.ts +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
|
-
import { ref, watch } from 'vue'
|
|
3
|
+
import { computed, ref, watch } from 'vue'
|
|
4
4
|
import { useRoute, useRouter } from 'vue-router'
|
|
5
|
+
import { useLayoutStore } from '../../stores/layout'
|
|
5
6
|
import { useStoryStore } from '../../stores/story'
|
|
6
7
|
|
|
7
8
|
import { isMobile } from '../../util/responsive'
|
|
@@ -12,6 +13,15 @@ import StorySidePanel from '../panel/StorySidePanel.vue'
|
|
|
12
13
|
import StoryViewer from './StoryViewer.vue'
|
|
13
14
|
|
|
14
15
|
const storyStore = useStoryStore()
|
|
16
|
+
const layoutStore = useLayoutStore()
|
|
17
|
+
|
|
18
|
+
const effectiveStoryOptionsVisible = computed(() =>
|
|
19
|
+
storyStore.currentStory?.meta?.storyOptions ?? layoutStore.settings.storyOptionsVisible,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const placement = computed(() => layoutStore.settings.storyOptionsPlacement)
|
|
23
|
+
const splitOrientation = computed(() => placement.value === 'bottom' ? 'portrait' : 'landscape')
|
|
24
|
+
const splitDefaultSplit = computed(() => placement.value === 'bottom' ? 60 : 75)
|
|
15
25
|
|
|
16
26
|
const router = useRouter()
|
|
17
27
|
const route = useRoute()
|
|
@@ -67,36 +77,41 @@ function scrollDocsToTop() {
|
|
|
67
77
|
>
|
|
68
78
|
<Icon
|
|
69
79
|
icon="carbon:software-resource-resource"
|
|
70
|
-
class="
|
|
80
|
+
class="ptw-w-16 ptw-h-16 ptw-opacity-50"
|
|
71
81
|
/>
|
|
72
82
|
</BaseEmpty>
|
|
73
83
|
|
|
74
84
|
<div
|
|
75
85
|
v-else
|
|
76
|
-
class="poveste-story-view poveste-with-story
|
|
86
|
+
class="poveste-story-view poveste-with-story ptw-h-full"
|
|
77
87
|
>
|
|
78
88
|
<div
|
|
79
89
|
v-if="storyStore.currentStory.docsOnly"
|
|
80
90
|
ref="docsOnlyScroller"
|
|
81
|
-
class="
|
|
91
|
+
class="ptw-h-full ptw-overflow-auto"
|
|
82
92
|
>
|
|
83
93
|
<StoryDocs
|
|
84
94
|
:story="storyStore.currentStory"
|
|
85
95
|
standalone
|
|
86
|
-
class="md:
|
|
96
|
+
class="md:ptw-p-12 ptw-w-full md:ptw-max-w-[600px] lg:ptw-max-w-[800px] xl:ptw-max-w-[900px]"
|
|
87
97
|
@scroll-top="scrollDocsToTop()"
|
|
88
98
|
/>
|
|
89
99
|
</div>
|
|
90
100
|
<template v-else-if="isMobile">
|
|
91
101
|
<StoryViewer />
|
|
92
102
|
</template>
|
|
103
|
+
<template v-else-if="!effectiveStoryOptionsVisible">
|
|
104
|
+
<StoryViewer />
|
|
105
|
+
</template>
|
|
93
106
|
<BaseSplitPane
|
|
94
107
|
v-else
|
|
95
|
-
save-id="story-main"
|
|
108
|
+
:save-id="`story-main-${placement}`"
|
|
109
|
+
:orientation="splitOrientation"
|
|
96
110
|
:min="30"
|
|
97
111
|
:max="95"
|
|
98
|
-
:default-split="
|
|
99
|
-
|
|
112
|
+
:default-split="splitDefaultSplit"
|
|
113
|
+
:show-divider="false"
|
|
114
|
+
class="ptw-h-full"
|
|
100
115
|
>
|
|
101
116
|
<template #first>
|
|
102
117
|
<StoryViewer />
|
|
@@ -22,7 +22,7 @@ watch(variant, () => {
|
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
24
|
<template>
|
|
25
|
-
<div class="poveste-story-viewer
|
|
25
|
+
<div class="poveste-story-viewer ptw-bg-gray-50 ptw-h-full dark:ptw-bg-gray-750">
|
|
26
26
|
<StoryVariantGrid
|
|
27
27
|
v-if="storyStore.currentStory.layout.type === 'grid'"
|
|
28
28
|
/>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
3
|
import { openInEditor } from '../../util/open-in-editor.js'
|
|
4
|
+
import TopBarChipItem from '../app/TopBarChipItem.vue'
|
|
4
5
|
|
|
5
6
|
defineProps<{
|
|
6
7
|
file: string
|
|
@@ -9,15 +10,15 @@ defineProps<{
|
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<template>
|
|
12
|
-
<
|
|
13
|
+
<TopBarChipItem
|
|
13
14
|
v-tooltip="tooltip"
|
|
14
15
|
target="_blank"
|
|
15
|
-
class="poveste-toolbar-open-in-editor
|
|
16
|
+
class="poveste-toolbar-open-in-editor"
|
|
16
17
|
@click="openInEditor(file)"
|
|
17
18
|
>
|
|
18
19
|
<Icon
|
|
19
20
|
icon="carbon:script-reference"
|
|
20
|
-
class="
|
|
21
|
+
class="ptw-w-4 ptw-h-4"
|
|
21
22
|
/>
|
|
22
|
-
</
|
|
23
|
+
</TopBarChipItem>
|
|
23
24
|
</template>
|
|
@@ -1,44 +1,81 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import type { SandboxColorScheme } from '../../types'
|
|
2
3
|
import { Icon } from '@iconify/vue'
|
|
3
|
-
import { computed } from 'vue'
|
|
4
4
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
5
5
|
import { povesteConfig } from '../../util/config'
|
|
6
|
-
import { getContrastColor } from '../../util/preview-settings'
|
|
7
6
|
import BaseCheckbox from '../base/BaseCheckbox.vue'
|
|
8
7
|
|
|
9
|
-
const
|
|
8
|
+
const previewSettings = usePreviewSettingsStore()
|
|
9
|
+
const settings = previewSettings.currentSettings
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const colorSchemeOptions: { value: SandboxColorScheme, label: string, icon: string }[] = [
|
|
12
|
+
{ value: 'auto', label: 'System', icon: 'carbon:screen' },
|
|
13
|
+
{ value: 'light', label: 'Light', icon: 'carbon:sun' },
|
|
14
|
+
{ value: 'dark', label: 'Dark', icon: 'carbon:moon' },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
// A book that hides the app color scheme switch doesn't want the preview one
|
|
18
|
+
// either — it keeps whatever `theme.defaultColorScheme` says.
|
|
19
|
+
const showColorScheme = !povesteConfig.theme.hideColorSchemeSwitch
|
|
20
|
+
const showDropdown = showColorScheme || !!povesteConfig.backgroundPresets.length
|
|
12
21
|
</script>
|
|
13
22
|
|
|
14
23
|
<template>
|
|
15
24
|
<VDropdown
|
|
16
|
-
v-if="
|
|
25
|
+
v-if="showDropdown"
|
|
17
26
|
placement="bottom-end"
|
|
18
27
|
:skidding="6"
|
|
19
|
-
class="poveste-toolbar-background
|
|
28
|
+
class="poveste-toolbar-background ptw-flex-none"
|
|
20
29
|
data-test-id="toolbar-background"
|
|
21
30
|
>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
>
|
|
31
|
+
<!-- The tooltip would sit on top of the first row of the dropdown, so drop
|
|
32
|
+
it while the dropdown is open. -->
|
|
33
|
+
<template #default="{ shown }">
|
|
26
34
|
<div
|
|
27
|
-
|
|
35
|
+
v-tooltip="shown ? '' : 'Preview appearance'"
|
|
36
|
+
class="ptw-flex ptw-items-center ptw-gap-1 ptw-px-2.5 ptw-py-1.5 hover:ptw-bg-white/50 dark:hover:ptw-bg-white/10 hover:ptw-text-primary-500 dark:hover:ptw-text-primary-400 ptw-cursor-pointer ptw-text-gray-900 dark:ptw-text-gray-100 ptw-transition-colors ptw-group"
|
|
28
37
|
>
|
|
29
|
-
<
|
|
38
|
+
<Icon
|
|
39
|
+
icon="carbon:color-palette"
|
|
40
|
+
class="ptw-w-4 ptw-h-4"
|
|
41
|
+
/>
|
|
42
|
+
<Icon
|
|
43
|
+
icon="carbon:chevron-down"
|
|
44
|
+
class="ptw-w-3 ptw-h-3 ptw-opacity-40 group-hover:ptw-opacity-70"
|
|
45
|
+
/>
|
|
30
46
|
</div>
|
|
31
|
-
|
|
32
|
-
icon="carbon:caret-down"
|
|
33
|
-
class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
47
|
+
</template>
|
|
36
48
|
|
|
37
49
|
<template #popper="{ hide }">
|
|
38
50
|
<div
|
|
39
|
-
class="
|
|
51
|
+
class="ptw-flex ptw-flex-col ptw-items-stretch"
|
|
40
52
|
data-test-id="background-popper"
|
|
41
53
|
>
|
|
54
|
+
<div
|
|
55
|
+
v-if="showColorScheme"
|
|
56
|
+
class="ptw-flex ptw-items-stretch ptw-gap-1 ptw-px-2 ptw-pt-2"
|
|
57
|
+
data-test-id="sandbox-color-scheme"
|
|
58
|
+
>
|
|
59
|
+
<button
|
|
60
|
+
v-for="option in colorSchemeOptions"
|
|
61
|
+
:key="option.value"
|
|
62
|
+
:data-test-id="`sandbox-color-scheme-${option.value}`"
|
|
63
|
+
class="ptw-flex-1 ptw-px-3 ptw-py-1.5 ptw-rounded ptw-flex ptw-items-center ptw-justify-center ptw-gap-1.5 ptw-cursor-pointer ptw-text-sm"
|
|
64
|
+
:class="[
|
|
65
|
+
settings.colorScheme === option.value
|
|
66
|
+
? 'ptw-bg-primary-500 hover:ptw-bg-primary-600 ptw-text-white dark:ptw-text-black'
|
|
67
|
+
: 'ptw-bg-transparent hover:ptw-bg-primary-100 dark:hover:ptw-bg-primary-700',
|
|
68
|
+
]"
|
|
69
|
+
@click="settings.colorScheme = option.value"
|
|
70
|
+
>
|
|
71
|
+
<Icon
|
|
72
|
+
:icon="option.icon"
|
|
73
|
+
class="ptw-w-4 ptw-h-4"
|
|
74
|
+
/>
|
|
75
|
+
<span>{{ option.label }}</span>
|
|
76
|
+
</button>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
42
79
|
<BaseCheckbox v-model="settings.checkerboard">
|
|
43
80
|
Checkerboard
|
|
44
81
|
</BaseCheckbox>
|
|
@@ -46,19 +83,19 @@ const contrastColor = computed(() => getContrastColor(settings))
|
|
|
46
83
|
<button
|
|
47
84
|
v-for="(option, index) in povesteConfig.backgroundPresets"
|
|
48
85
|
:key="index"
|
|
49
|
-
class="
|
|
86
|
+
class="ptw-px-4 ptw-py-3 ptw-cursor-pointer ptw-text-left ptw-flex ptw-items-baseline ptw-gap-4"
|
|
50
87
|
:class="[
|
|
51
88
|
settings.backgroundColor === option.color
|
|
52
|
-
? '
|
|
53
|
-
: '
|
|
89
|
+
? 'ptw-bg-primary-500 hover:ptw-bg-primary-600 ptw-text-white dark:ptw-text-black'
|
|
90
|
+
: 'ptw-bg-transparent hover:ptw-bg-primary-100 dark:hover:ptw-bg-primary-700',
|
|
54
91
|
]"
|
|
55
|
-
@click="
|
|
92
|
+
@click="previewSettings.setBackgroundColor(option.color);hide()"
|
|
56
93
|
>
|
|
57
|
-
<span class="
|
|
94
|
+
<span class="ptw-mr-auto">{{ option.label }}</span>
|
|
58
95
|
<template v-if="option.color !== '$checkerboard'">
|
|
59
|
-
<span class="
|
|
96
|
+
<span class="ptw-ml-auto ptw-opacity-70">{{ option.color }}</span>
|
|
60
97
|
<div
|
|
61
|
-
class="
|
|
98
|
+
class="ptw-w-4 ptw-h-4 ptw-rounded-full ptw-border ptw-border-black/20 dark:ptw-border-white/20 ptw-flex ptw-items-center ptw-justify-center ptw-text-xs"
|
|
62
99
|
:style="{
|
|
63
100
|
backgroundColor: option.color,
|
|
64
101
|
color: option.contrastColor,
|
|
@@ -3,6 +3,7 @@ import type { Story, Variant } from '../../types'
|
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import { computed } from 'vue'
|
|
5
5
|
import { getSandboxUrl } from '../../util/sandbox'
|
|
6
|
+
import TopBarChipItem from '../app/TopBarChipItem.vue'
|
|
6
7
|
|
|
7
8
|
const props = defineProps<{
|
|
8
9
|
variant: Variant
|
|
@@ -15,15 +16,15 @@ const sandboxUrl = computed(() => {
|
|
|
15
16
|
</script>
|
|
16
17
|
|
|
17
18
|
<template>
|
|
18
|
-
<
|
|
19
|
+
<TopBarChipItem
|
|
19
20
|
v-tooltip="'Open variant in new tab'"
|
|
20
21
|
:href="sandboxUrl"
|
|
21
22
|
target="_blank"
|
|
22
|
-
class="poveste-toolbar-new-tab
|
|
23
|
+
class="poveste-toolbar-new-tab"
|
|
23
24
|
>
|
|
24
25
|
<Icon
|
|
25
26
|
icon="carbon:launch"
|
|
26
|
-
class="
|
|
27
|
+
class="ptw-w-4 ptw-h-4"
|
|
27
28
|
/>
|
|
28
|
-
</
|
|
29
|
+
</TopBarChipItem>
|
|
29
30
|
</template>
|
|
@@ -13,46 +13,46 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
13
13
|
placement="bottom-end"
|
|
14
14
|
:skidding="6"
|
|
15
15
|
:disabled="!povesteConfig.responsivePresets?.length"
|
|
16
|
-
class="poveste-toolbar-responsive-size
|
|
16
|
+
class="poveste-toolbar-responsive-size ptw-flex-none"
|
|
17
17
|
>
|
|
18
18
|
<div
|
|
19
19
|
v-tooltip="'Responsive sizes'"
|
|
20
|
-
class="
|
|
20
|
+
class="ptw-flex ptw-items-center ptw-gap-1 ptw-px-2.5 ptw-py-1.5 ptw-text-gray-900 dark:ptw-text-gray-100 ptw-transition-colors ptw-group"
|
|
21
21
|
:class="{
|
|
22
|
-
'
|
|
22
|
+
'hover:ptw-bg-white/50 dark:hover:ptw-bg-white/10 hover:ptw-text-primary-500 dark:hover:ptw-text-primary-400 ptw-cursor-pointer': povesteConfig.responsivePresets?.length,
|
|
23
23
|
}"
|
|
24
24
|
>
|
|
25
25
|
<Icon
|
|
26
26
|
icon="carbon:devices"
|
|
27
|
-
class="
|
|
27
|
+
class="ptw-w-4 ptw-h-4"
|
|
28
28
|
/>
|
|
29
29
|
<Icon
|
|
30
|
-
icon="carbon:
|
|
31
|
-
class="
|
|
30
|
+
icon="carbon:chevron-down"
|
|
31
|
+
class="ptw-w-3 ptw-h-3 ptw-opacity-40 group-hover:ptw-opacity-70"
|
|
32
32
|
/>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
35
|
<template #popper="{ hide }">
|
|
36
|
-
<div class="
|
|
36
|
+
<div class="ptw-flex ptw-flex-col ptw-items-stretch">
|
|
37
37
|
<BaseCheckbox v-model="settings.rotate">
|
|
38
38
|
Rotate
|
|
39
39
|
</BaseCheckbox>
|
|
40
40
|
|
|
41
|
-
<div class="
|
|
41
|
+
<div class="ptw-flex ptw-items-center ptw-gap-2 ptw-px-4 ptw-py-3">
|
|
42
42
|
<input
|
|
43
43
|
v-model.number="settings.responsiveWidth"
|
|
44
44
|
v-tooltip="'Responsive width (px)'"
|
|
45
45
|
type="number"
|
|
46
|
-
class="
|
|
46
|
+
class="ptw-bg-transparent ptw-border ptw-border-gray-200 dark:ptw-border-gray-850 ptw-rounded ptw-w-20 ptw-opacity-50 focus:ptw-opacity-100 ptw-flex-1 ptw-min-w-0"
|
|
47
47
|
step="16"
|
|
48
48
|
placeholder="Auto"
|
|
49
49
|
>
|
|
50
|
-
<span class="
|
|
50
|
+
<span class="ptw-opacity-50">×</span>
|
|
51
51
|
<input
|
|
52
52
|
v-model.number="settings.responsiveHeight"
|
|
53
53
|
v-tooltip="'Responsive height (px)'"
|
|
54
54
|
type="number"
|
|
55
|
-
class="
|
|
55
|
+
class="ptw-bg-transparent ptw-border ptw-border-gray-200 dark:ptw-border-gray-850 ptw-rounded ptw-w-20 ptw-opacity-50 focus:ptw-opacity-100 ptw-flex-1 ptw-min-w-0"
|
|
56
56
|
step="16"
|
|
57
57
|
placeholder="Auto"
|
|
58
58
|
>
|
|
@@ -61,16 +61,16 @@ const settings = usePreviewSettingsStore().currentSettings
|
|
|
61
61
|
<button
|
|
62
62
|
v-for="(preset, index) in povesteConfig.responsivePresets"
|
|
63
63
|
:key="index"
|
|
64
|
-
class="
|
|
64
|
+
class="ptw-px-4 ptw-py-3 ptw-cursor-pointer ptw-text-left ptw-flex ptw-gap-4"
|
|
65
65
|
:class="[
|
|
66
66
|
settings.responsiveWidth === preset.width && settings.responsiveHeight === preset.height
|
|
67
|
-
? '
|
|
68
|
-
: '
|
|
67
|
+
? 'ptw-bg-primary-500 hover:ptw-bg-primary-600 ptw-text-white dark:ptw-text-black'
|
|
68
|
+
: 'ptw-bg-transparent hover:ptw-bg-primary-100 dark:hover:ptw-bg-primary-700',
|
|
69
69
|
]"
|
|
70
70
|
@click="settings.responsiveWidth = preset.width;settings.responsiveHeight = preset.height;hide()"
|
|
71
71
|
>
|
|
72
72
|
{{ preset.label }}
|
|
73
|
-
<span class="
|
|
73
|
+
<span class="ptw-ml-auto ptw-opacity-70 ptw-flex ptw-gap-1">
|
|
74
74
|
<span v-if="preset.width">{{ preset.width }}<span v-if="!preset.height">px</span></span>
|
|
75
75
|
<span v-if="preset.width && preset.height">x</span>
|
|
76
76
|
<span v-if="preset.height">{{ preset.height }}<span v-if="!preset.width">px</span></span>
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
3
|
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
|
+
import TopBarChipItem from '../app/TopBarChipItem.vue'
|
|
4
5
|
|
|
5
6
|
const settings = usePreviewSettingsStore().currentSettings
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<template>
|
|
9
|
-
<
|
|
10
|
+
<TopBarChipItem
|
|
10
11
|
v-tooltip="`Switch to text direction ${settings.textDirection === 'ltr' ? 'Right to Left' : 'Left to Right'}`"
|
|
11
|
-
class="poveste-toolbar-text-direction
|
|
12
|
+
class="poveste-toolbar-text-direction"
|
|
12
13
|
@click="settings.textDirection = settings.textDirection === 'ltr' ? 'rtl' : 'ltr'"
|
|
13
14
|
>
|
|
14
15
|
<Icon
|
|
15
16
|
:icon="settings.textDirection === 'ltr' ? 'fluent:text-paragraph-direction-right-16-regular' : 'fluent:text-paragraph-direction-left-16-regular'"
|
|
16
|
-
class="
|
|
17
|
+
class="ptw-w-4 ptw-h-4"
|
|
17
18
|
/>
|
|
18
|
-
</
|
|
19
|
+
</TopBarChipItem>
|
|
19
20
|
</template>
|
|
@@ -1,21 +1,45 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import type { Variant } from '../../types'
|
|
2
|
+
import type { Story, Variant } from '../../types'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
|
+
import { computed } from 'vue'
|
|
4
5
|
|
|
5
|
-
defineProps<{
|
|
6
|
-
variant
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
variant?: Variant
|
|
8
|
+
story?: Story
|
|
7
9
|
}>()
|
|
10
|
+
|
|
11
|
+
const icon = computed(() => props.variant?.icon ?? props.story?.icon ?? 'carbon:cube')
|
|
12
|
+
const iconColor = computed(() => props.variant?.iconColor ?? props.story?.iconColor)
|
|
13
|
+
const title = computed(() => props.variant?.title ?? props.story?.title ?? '')
|
|
14
|
+
const subtitle = computed(() => {
|
|
15
|
+
if (props.variant && props.story && props.story.title !== props.variant.title) {
|
|
16
|
+
return props.story.title
|
|
17
|
+
}
|
|
18
|
+
return undefined
|
|
19
|
+
})
|
|
8
20
|
</script>
|
|
9
21
|
|
|
10
22
|
<template>
|
|
11
|
-
<div class="poveste-toolbar-title
|
|
23
|
+
<div class="poveste-toolbar-title ptw-flex ptw-items-center ptw-gap-2 ptw-min-w-0">
|
|
12
24
|
<Icon
|
|
13
|
-
:icon="
|
|
14
|
-
class="
|
|
25
|
+
:icon="icon"
|
|
26
|
+
class="ptw-w-4 ptw-h-4 ptw-flex-none"
|
|
15
27
|
:class="[
|
|
16
|
-
|
|
28
|
+
iconColor ? 'bind-icon-color' : 'ptw-text-gray-500 dark:ptw-text-gray-400',
|
|
17
29
|
]"
|
|
18
30
|
/>
|
|
19
|
-
<
|
|
31
|
+
<div class="ptw-flex ptw-flex-col ptw-justify-center ptw-min-w-0 ptw-leading-tight ptw-text-center ptw-h-[2.25rem]">
|
|
32
|
+
<span class="ptw-truncate ptw-text-sm ptw-font-medium ptw-text-gray-900 dark:ptw-text-gray-100">{{ title }}</span>
|
|
33
|
+
<span
|
|
34
|
+
v-if="subtitle"
|
|
35
|
+
class="ptw-truncate ptw-text-xs ptw-text-gray-500 dark:ptw-text-gray-400"
|
|
36
|
+
>{{ subtitle }}</span>
|
|
37
|
+
</div>
|
|
20
38
|
</div>
|
|
21
39
|
</template>
|
|
40
|
+
|
|
41
|
+
<style scoped>
|
|
42
|
+
.bind-icon-color {
|
|
43
|
+
color: v-bind('iconColor');
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -27,23 +27,23 @@ function toggleOpen() {
|
|
|
27
27
|
<template>
|
|
28
28
|
<div
|
|
29
29
|
data-test-id="story-group"
|
|
30
|
-
class="poveste-story-group
|
|
30
|
+
class="poveste-story-group ptw-my-2 first:ptw-mt-0 last:ptw-mb-0 ptw-group"
|
|
31
31
|
>
|
|
32
32
|
<template v-if="group.title">
|
|
33
|
-
<div class="
|
|
33
|
+
<div class="ptw-h-[1px] ptw-bg-gray-500/10 ptw-mx-6 ptw-mb-2 group-first:ptw-hidden" />
|
|
34
34
|
<div
|
|
35
35
|
role="button"
|
|
36
36
|
tabindex="0"
|
|
37
|
-
class="
|
|
37
|
+
class="ptw-px-0.5 ptw-py-2 md:ptw-py-1.5 ptw-mx-1 ptw-rounded-sm hover:ptw-bg-primary-100 dark:hover:ptw-bg-primary-900 ptw-cursor-pointer ptw-select-none ptw-flex ptw-items-center ptw-gap-2 ptw-min-w-0 ptw-opacity-50 hover:ptw-opacity-100"
|
|
38
38
|
@click="toggleOpen"
|
|
39
39
|
@keyup.enter="toggleOpen"
|
|
40
40
|
@keyup.space="toggleOpen"
|
|
41
41
|
>
|
|
42
42
|
<Icon
|
|
43
43
|
:icon="isFolderOpen ? 'ri:subtract-line' : 'ri:add-line'"
|
|
44
|
-
class="
|
|
44
|
+
class="ptw-w-4 ptw-h-4 ptw-ml-4 ptw-rounded-sm ptw-border ptw-border-gray-500/40"
|
|
45
45
|
/>
|
|
46
|
-
<span class="
|
|
46
|
+
<span class="ptw-truncate">{{ group.title }}</span>
|
|
47
47
|
</div>
|
|
48
48
|
</template>
|
|
49
49
|
|
|
@@ -37,22 +37,22 @@ const folderPadding = computed(() => {
|
|
|
37
37
|
<div
|
|
38
38
|
role="button"
|
|
39
39
|
tabindex="0"
|
|
40
|
-
class="poveste-story-list-folder-button
|
|
40
|
+
class="poveste-story-list-folder-button ptw-px-0.5 ptw-py-2 md:ptw-py-1.5 ptw-mx-1 ptw-rounded-sm hover:ptw-bg-primary-100 dark:hover:ptw-bg-primary-900 ptw-cursor-pointer ptw-select-none ptw-flex"
|
|
41
41
|
@click="toggleOpen"
|
|
42
42
|
@keyup.enter="toggleOpen"
|
|
43
43
|
@keyup.space="toggleOpen"
|
|
44
44
|
>
|
|
45
|
-
<span class="bind-tree-padding
|
|
46
|
-
<span class="
|
|
45
|
+
<span class="bind-tree-padding ptw-flex ptw-items-center ptw-gap-2 ptw-min-w-0">
|
|
46
|
+
<span class="ptw-flex ptw-flex-none ptw-items-center ptw-opacity-30 [.poveste-story-list-folder-button:hover_&]:ptw-opacity-100 ptw-ml-4 ptw-w-4 ptw-h-4 ptw-rounded-sm ptw-border ptw-border-gray-500/40">
|
|
47
47
|
<Icon
|
|
48
48
|
icon="carbon:caret-right"
|
|
49
|
-
class="
|
|
49
|
+
class="ptw-w-full ptw-h-full ptw-transition-transform ptw-duration-150"
|
|
50
50
|
:class="{
|
|
51
|
-
'
|
|
51
|
+
'ptw-rotate-90': isFolderOpen,
|
|
52
52
|
}"
|
|
53
53
|
/>
|
|
54
54
|
</span>
|
|
55
|
-
<span class="
|
|
55
|
+
<span class="ptw-truncate">{{ folder.title }}</span>
|
|
56
56
|
</span>
|
|
57
57
|
</div>
|
|
58
58
|
|
|
@@ -37,23 +37,23 @@ useScrollOnActive(isActive, el)
|
|
|
37
37
|
storyId: story.id,
|
|
38
38
|
},
|
|
39
39
|
}"
|
|
40
|
-
class="
|
|
40
|
+
class="ptw-pl-0.5 ptw-pr-2 ptw-py-2 md:ptw-py-1.5 ptw-mx-1 ptw-rounded-sm"
|
|
41
41
|
>
|
|
42
|
-
<span class="bind-tree-margin
|
|
42
|
+
<span class="bind-tree-margin ptw-flex ptw-items-center ptw-gap-2 ptw-pl-4 ptw-min-w-0">
|
|
43
43
|
<Icon
|
|
44
44
|
:icon="story.icon ?? 'carbon:cube'"
|
|
45
|
-
class="
|
|
45
|
+
class="ptw-w-5 ptw-h-5 sm:ptw-w-4 sm:ptw-h-4 ptw-flex-none"
|
|
46
46
|
:class="{
|
|
47
|
-
'
|
|
47
|
+
'ptw-text-primary-500': !active && !story.iconColor,
|
|
48
48
|
'bind-icon-color': !active && story.iconColor,
|
|
49
49
|
}"
|
|
50
50
|
/>
|
|
51
|
-
<span class="
|
|
51
|
+
<span class="ptw-truncate">{{ story.title }}</span>
|
|
52
52
|
</span>
|
|
53
53
|
|
|
54
54
|
<span
|
|
55
55
|
v-if="!story.docsOnly"
|
|
56
|
-
class="
|
|
56
|
+
class="ptw-opacity-40 ptw-text-sm"
|
|
57
57
|
>
|
|
58
58
|
{{ story.variants.length }}
|
|
59
59
|
</span>
|
package/src/app/index.ts
CHANGED
|
@@ -10,6 +10,9 @@ export async function mountMainApp() {
|
|
|
10
10
|
const app = createApp(App)
|
|
11
11
|
app.use(createPinia())
|
|
12
12
|
app.use(FloatingVue, {
|
|
13
|
+
// Anchor poppers inside the chrome scope so the @scope-wrapped chrome CSS
|
|
14
|
+
// reaches them. The default <body> teleport target is outside the scope.
|
|
15
|
+
container: '.poveste-app-root',
|
|
13
16
|
overflowPadding: 4,
|
|
14
17
|
arrowPadding: 8,
|
|
15
18
|
themes: {
|