histoire 0.8.2 → 0.9.0
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/client.d.ts +1 -3
- package/client.js +1 -0
- package/dist/node/alias.d.ts +0 -1
- package/dist/node/alias.js +5 -6
- package/dist/node/build.js +1 -1
- package/dist/node/builtin-plugins/tailwind-tokens.js +19 -12
- package/dist/node/collect/run.js +4 -6
- package/dist/node/config.d.ts +9 -0
- package/dist/node/config.js +14 -0
- package/dist/node/context.d.ts +3 -7
- package/dist/node/context.js +2 -0
- package/dist/node/plugin.d.ts +5 -1
- package/dist/node/stories.js +15 -1
- package/dist/node/vite.d.ts +4 -0
- package/dist/node/vite.js +44 -9
- package/package.json +11 -21
- package/src/node/alias.ts +5 -6
- package/src/node/build.ts +1 -1
- package/src/node/builtin-plugins/tailwind-tokens.ts +19 -12
- package/src/node/collect/run.ts +4 -8
- package/src/node/config.ts +24 -0
- package/src/node/context.ts +7 -2
- package/src/node/plugin.ts +5 -1
- package/src/node/stories.ts +18 -1
- package/src/node/vite.ts +53 -9
- package/tsconfig.json +2 -11
- package/dist/bundled/App.js +0 -166
- package/dist/bundled/_virtual/plugin-vue_export-helper.js +0 -8
- package/dist/bundled/api.js +0 -1
- package/dist/bundled/assets/histoire-text-dark.js +0 -2
- package/dist/bundled/assets/histoire-text.js +0 -2
- package/dist/bundled/assets/histoire.js +0 -2
- package/dist/bundled/components/HomeView.js +0 -24
- package/dist/bundled/components/app/AppHeader.js +0 -67
- package/dist/bundled/components/app/AppLogo.js +0 -26
- package/dist/bundled/components/app/Breadcrumb.js +0 -95
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/app/InitialLoading.js +0 -48
- package/dist/bundled/components/app/MobileOverlay.js +0 -41
- package/dist/bundled/components/base/BaseCheckbox.js +0 -75
- package/dist/bundled/components/base/BaseEmpty.js +0 -13
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseListItemLink.js +0 -50
- package/dist/bundled/components/base/BaseOverflowMenu.js +0 -97
- package/dist/bundled/components/base/BaseOverflowTab.js +0 -45
- package/dist/bundled/components/base/BaseSelect.js +0 -88
- package/dist/bundled/components/base/BaseSplitPane.js +0 -184
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseTab.js +0 -45
- package/dist/bundled/components/misc/CheckerboardPattern.js +0 -41
- package/dist/bundled/components/misc/HatchedPattern.js +0 -11
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/panel/ControlsComponentPropItem.js +0 -98
- package/dist/bundled/components/panel/ControlsComponentProps.js +0 -42
- package/dist/bundled/components/panel/PaneTabs.js +0 -110
- package/dist/bundled/components/panel/StatePresets.js +0 -184
- package/dist/bundled/components/panel/StoryControls.js +0 -66
- package/dist/bundled/components/panel/StoryDocs.js +0 -48
- package/dist/bundled/components/panel/StoryEvent.js +0 -56
- package/dist/bundled/components/panel/StoryEvents.js +0 -49
- package/dist/bundled/components/panel/StorySidePanel.js +0 -68
- package/dist/bundled/components/panel/StorySourceCode.js +0 -110
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/search/SearchItem.js +0 -113
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/search/SearchLoading.js +0 -19
- package/dist/bundled/components/search/SearchModal.js +0 -46
- package/dist/bundled/components/search/SearchPane.js +0 -263
- package/dist/bundled/components/search/search-docs-data.js +0 -7
- package/dist/bundled/components/search/search-title-data.js +0 -7
- package/dist/bundled/components/story/StoryResponsivePreview.js +0 -180
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantGrid.js +0 -94
- package/dist/bundled/components/story/StoryVariantGridItem.js +0 -106
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantListItem.js +0 -58
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantSingle.js +0 -115
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +0 -43
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +0 -119
- package/dist/bundled/components/story/StoryVariantSingleView.js +0 -49
- package/dist/bundled/components/story/StoryView.js +0 -107
- package/dist/bundled/components/story/StoryViewer.js +0 -57
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +0 -85
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +0 -33
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +0 -129
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +0 -24
- package/dist/bundled/components/tree/StoryGroup.js +0 -74
- package/dist/bundled/components/tree/StoryList.js +0 -37
- package/dist/bundled/components/tree/StoryListFolder.js +0 -89
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/tree/StoryListItem.js +0 -72
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/index.js +0 -29
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +0 -40
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +0 -5
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +0 -11
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +0 -26
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +0 -10
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +0 -50
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +0 -8
- package/dist/bundled/router.js +0 -28
- package/dist/bundled/sandbox.js +0 -87
- package/dist/bundled/stores/events.js +0 -29
- package/dist/bundled/stores/folder.js +0 -46
- package/dist/bundled/stores/preview-settings.js +0 -15
- package/dist/bundled/stores/story.js +0 -43
- package/dist/bundled/style.css +0 -102
- package/dist/bundled/util/config.js +0 -4
- package/dist/bundled/util/const.js +0 -5
- package/dist/bundled/util/dark.js +0 -4
- package/dist/bundled/util/env.js +0 -2
- package/dist/bundled/util/events.js +0 -32
- package/dist/bundled/util/keyboard.js +0 -84
- package/dist/bundled/util/mapping.js +0 -78
- package/dist/bundled/util/preview-settings.js +0 -6
- package/dist/bundled/util/responsive.js +0 -3
- package/dist/bundled/util/sandbox.js +0 -8
- package/dist/bundled/util/scroll.js +0 -28
- package/dist/bundled/util/state.js +0 -27
- package/dist/bundled/util/tooltip.js +0 -12
- package/dist/bundled/util/variant.js +0 -35
- package/dist/client/app/App.vue +0 -162
- package/dist/client/app/api.d.ts +0 -1
- package/dist/client/app/api.js +0 -1
- package/dist/client/app/assets/histoire-text-dark.svg +0 -89
- package/dist/client/app/assets/histoire-text.svg +0 -89
- package/dist/client/app/assets/histoire.svg +0 -51
- package/dist/client/app/components/HomeView.vue +0 -17
- package/dist/client/app/components/app/AppHeader.vue +0 -64
- package/dist/client/app/components/app/AppLogo.vue +0 -24
- package/dist/client/app/components/app/Breadcrumb.vue +0 -98
- package/dist/client/app/components/app/InitialLoading.vue +0 -44
- package/dist/client/app/components/app/MobileOverlay.vue +0 -33
- package/dist/client/app/components/base/BaseCheckbox.vue +0 -77
- package/dist/client/app/components/base/BaseCopyIcon.vue +0 -34
- package/dist/client/app/components/base/BaseEmpty.vue +0 -21
- package/dist/client/app/components/base/BaseListItemLink.vue +0 -55
- package/dist/client/app/components/base/BaseOverflowMenu.vue +0 -119
- package/dist/client/app/components/base/BaseOverflowTab.vue +0 -46
- package/dist/client/app/components/base/BaseSelect.vue +0 -72
- package/dist/client/app/components/base/BaseSplitPane.vue +0 -240
- package/dist/client/app/components/base/BaseTab.vue +0 -46
- package/dist/client/app/components/misc/CheckerboardPattern.vue +0 -32
- package/dist/client/app/components/misc/HatchedPattern.vue +0 -13
- package/dist/client/app/components/panel/ControlsComponentPropItem.vue +0 -103
- package/dist/client/app/components/panel/ControlsComponentProps.vue +0 -34
- package/dist/client/app/components/panel/PaneTabs.vue +0 -64
- package/dist/client/app/components/panel/StatePresets.vue +0 -196
- package/dist/client/app/components/panel/StoryControls.vue +0 -68
- package/dist/client/app/components/panel/StoryDocs.vue +0 -45
- package/dist/client/app/components/panel/StoryEvent.vue +0 -54
- package/dist/client/app/components/panel/StoryEvents.vue +0 -45
- package/dist/client/app/components/panel/StorySidePanel.vue +0 -66
- package/dist/client/app/components/panel/StorySourceCode.vue +0 -116
- package/dist/client/app/components/search/SearchItem.vue +0 -110
- package/dist/client/app/components/search/SearchLoading.vue +0 -16
- package/dist/client/app/components/search/SearchModal.vue +0 -43
- package/dist/client/app/components/search/SearchPane.vue +0 -293
- package/dist/client/app/components/search/search-docs-data.d.ts +0 -3
- package/dist/client/app/components/search/search-docs-data.js +0 -7
- package/dist/client/app/components/search/search-title-data.d.ts +0 -3
- package/dist/client/app/components/search/search-title-data.js +0 -7
- package/dist/client/app/components/search/types.d.ts +0 -7
- package/dist/client/app/components/search/types.js +0 -1
- package/dist/client/app/components/story/StoryResponsivePreview.vue +0 -204
- package/dist/client/app/components/story/StoryVariantGrid.vue +0 -112
- package/dist/client/app/components/story/StoryVariantGridItem.vue +0 -110
- package/dist/client/app/components/story/StoryVariantListItem.vue +0 -50
- package/dist/client/app/components/story/StoryVariantSingle.vue +0 -105
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +0 -42
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +0 -139
- package/dist/client/app/components/story/StoryVariantSingleView.vue +0 -52
- package/dist/client/app/components/story/StoryView.vue +0 -96
- package/dist/client/app/components/story/StoryViewer.vue +0 -53
- package/dist/client/app/components/toolbar/StoryVariantBackground.vue +0 -67
- package/dist/client/app/components/toolbar/StoryVariantNewTab.vue +0 -29
- package/dist/client/app/components/toolbar/StoryVariantResponsiveSize.vue +0 -82
- package/dist/client/app/components/toolbar/StoryVariantTitle.vue +0 -21
- package/dist/client/app/components/tree/StoryGroup.vue +0 -75
- package/dist/client/app/components/tree/StoryList.vue +0 -35
- package/dist/client/app/components/tree/StoryListFolder.vue +0 -89
- package/dist/client/app/components/tree/StoryListItem.vue +0 -71
- package/dist/client/app/index.d.ts +0 -2
- package/dist/client/app/index.js +0 -28
- package/dist/client/app/router.d.ts +0 -2
- package/dist/client/app/router.js +0 -26
- package/dist/client/app/sandbox.d.ts +0 -1
- package/dist/client/app/sandbox.js +0 -87
- package/dist/client/app/stores/events.d.ts +0 -29
- package/dist/client/app/stores/events.js +0 -25
- package/dist/client/app/stores/folder.d.ts +0 -10
- package/dist/client/app/stores/folder.js +0 -47
- package/dist/client/app/stores/preview-settings.d.ts +0 -8
- package/dist/client/app/stores/preview-settings.js +0 -14
- package/dist/client/app/stores/story.d.ts +0 -362
- package/dist/client/app/stores/story.js +0 -39
- package/dist/client/app/style/floating-vue.pcss +0 -34
- package/dist/client/app/style/main.pcss +0 -86
- package/dist/client/app/style/sandbox.css +0 -19
- package/dist/client/app/style/transitions.pcss +0 -51
- package/dist/client/app/types.d.ts +0 -34
- package/dist/client/app/types.js +0 -1
- package/dist/client/app/util/config.d.ts +0 -3
- package/dist/client/app/util/config.js +0 -4
- package/dist/client/app/util/const.d.ts +0 -4
- package/dist/client/app/util/const.js +0 -4
- package/dist/client/app/util/dark.d.ts +0 -2
- package/dist/client/app/util/dark.js +0 -3
- package/dist/client/app/util/env.d.ts +0 -1
- package/dist/client/app/util/env.js +0 -1
- package/dist/client/app/util/events.d.ts +0 -1
- package/dist/client/app/util/events.js +0 -31
- package/dist/client/app/util/keyboard.d.ts +0 -8
- package/dist/client/app/util/keyboard.js +0 -82
- package/dist/client/app/util/mapping.d.ts +0 -3
- package/dist/client/app/util/mapping.js +0 -69
- package/dist/client/app/util/preview-settings.d.ts +0 -9
- package/dist/client/app/util/preview-settings.js +0 -5
- package/dist/client/app/util/responsive.d.ts +0 -1
- package/dist/client/app/util/responsive.js +0 -2
- package/dist/client/app/util/sandbox.d.ts +0 -2
- package/dist/client/app/util/sandbox.js +0 -7
- package/dist/client/app/util/scroll.d.ts +0 -4
- package/dist/client/app/util/scroll.js +0 -27
- package/dist/client/app/util/state.d.ts +0 -1
- package/dist/client/app/util/state.js +0 -27
- package/dist/client/app/util/tooltip.d.ts +0 -6
- package/dist/client/app/util/tooltip.js +0 -11
- package/dist/client/app/util/variant.d.ts +0 -18
- package/dist/client/app/util/variant.js +0 -17
- package/dist/client/bundle-index.js +0 -5
- package/dist/client/bundle-main.js +0 -5
- package/dist/client/bundle-sandbox.js +0 -2
- package/dist/client/index.d.ts +0 -9
- package/dist/client/index.js +0 -4
- package/dist/style.css +0 -2382
- package/postcss.config.cjs +0 -8
- package/scripts/copy.mjs +0 -12
- package/scripts/watchAndCopy.mjs +0 -15
- package/src/client/app/App.vue +0 -162
- package/src/client/app/api.ts +0 -1
- package/src/client/app/assets/histoire-text-dark.svg +0 -89
- package/src/client/app/assets/histoire-text.svg +0 -89
- package/src/client/app/assets/histoire.svg +0 -51
- package/src/client/app/components/HomeView.vue +0 -17
- package/src/client/app/components/app/AppHeader.vue +0 -64
- package/src/client/app/components/app/AppLogo.vue +0 -24
- package/src/client/app/components/app/Breadcrumb.vue +0 -98
- package/src/client/app/components/app/InitialLoading.vue +0 -44
- package/src/client/app/components/app/MobileOverlay.vue +0 -33
- package/src/client/app/components/base/BaseCheckbox.vue +0 -77
- package/src/client/app/components/base/BaseCopyIcon.vue +0 -34
- package/src/client/app/components/base/BaseEmpty.vue +0 -21
- package/src/client/app/components/base/BaseListItemLink.vue +0 -55
- package/src/client/app/components/base/BaseOverflowMenu.vue +0 -119
- package/src/client/app/components/base/BaseOverflowTab.vue +0 -46
- package/src/client/app/components/base/BaseSelect.vue +0 -72
- package/src/client/app/components/base/BaseSplitPane.vue +0 -240
- package/src/client/app/components/base/BaseTab.vue +0 -46
- package/src/client/app/components/misc/CheckerboardPattern.vue +0 -32
- package/src/client/app/components/misc/HatchedPattern.vue +0 -13
- package/src/client/app/components/panel/ControlsComponentPropItem.vue +0 -103
- package/src/client/app/components/panel/ControlsComponentProps.vue +0 -34
- package/src/client/app/components/panel/PaneTabs.vue +0 -64
- package/src/client/app/components/panel/StatePresets.vue +0 -196
- package/src/client/app/components/panel/StoryControls.vue +0 -68
- package/src/client/app/components/panel/StoryDocs.vue +0 -45
- package/src/client/app/components/panel/StoryEvent.vue +0 -54
- package/src/client/app/components/panel/StoryEvents.vue +0 -45
- package/src/client/app/components/panel/StorySidePanel.vue +0 -66
- package/src/client/app/components/panel/StorySourceCode.vue +0 -116
- package/src/client/app/components/search/SearchItem.vue +0 -110
- package/src/client/app/components/search/SearchLoading.vue +0 -16
- package/src/client/app/components/search/SearchModal.vue +0 -43
- package/src/client/app/components/search/SearchPane.vue +0 -293
- package/src/client/app/components/search/search-docs-data.ts +0 -10
- package/src/client/app/components/search/search-title-data.ts +0 -10
- package/src/client/app/components/search/types.ts +0 -4
- package/src/client/app/components/story/StoryResponsivePreview.vue +0 -204
- package/src/client/app/components/story/StoryVariantGrid.vue +0 -112
- package/src/client/app/components/story/StoryVariantGridItem.vue +0 -110
- package/src/client/app/components/story/StoryVariantListItem.vue +0 -50
- package/src/client/app/components/story/StoryVariantSingle.vue +0 -105
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +0 -42
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +0 -139
- package/src/client/app/components/story/StoryVariantSingleView.vue +0 -52
- package/src/client/app/components/story/StoryView.vue +0 -96
- package/src/client/app/components/story/StoryViewer.vue +0 -53
- package/src/client/app/components/toolbar/StoryVariantBackground.vue +0 -67
- package/src/client/app/components/toolbar/StoryVariantNewTab.vue +0 -29
- package/src/client/app/components/toolbar/StoryVariantResponsiveSize.vue +0 -82
- package/src/client/app/components/toolbar/StoryVariantTitle.vue +0 -21
- package/src/client/app/components/tree/StoryGroup.vue +0 -75
- package/src/client/app/components/tree/StoryList.vue +0 -35
- package/src/client/app/components/tree/StoryListFolder.vue +0 -89
- package/src/client/app/components/tree/StoryListItem.vue +0 -71
- package/src/client/app/index.ts +0 -30
- package/src/client/app/router.ts +0 -29
- package/src/client/app/sandbox.ts +0 -95
- package/src/client/app/stores/events.ts +0 -36
- package/src/client/app/stores/folder.ts +0 -59
- package/src/client/app/stores/preview-settings.ts +0 -17
- package/src/client/app/stores/story.ts +0 -47
- package/src/client/app/style/floating-vue.pcss +0 -34
- package/src/client/app/style/main.pcss +0 -86
- package/src/client/app/style/sandbox.css +0 -19
- package/src/client/app/style/transitions.pcss +0 -51
- package/src/client/app/types.ts +0 -46
- package/src/client/app/util/config.ts +0 -6
- package/src/client/app/util/const.ts +0 -4
- package/src/client/app/util/dark.ts +0 -4
- package/src/client/app/util/env.ts +0 -1
- package/src/client/app/util/events.ts +0 -30
- package/src/client/app/util/keyboard.ts +0 -99
- package/src/client/app/util/mapping.ts +0 -74
- package/src/client/app/util/preview-settings.ts +0 -8
- package/src/client/app/util/responsive.ts +0 -3
- package/src/client/app/util/sandbox.ts +0 -10
- package/src/client/app/util/scroll.ts +0 -31
- package/src/client/app/util/state.ts +0 -36
- package/src/client/app/util/tooltip.ts +0 -13
- package/src/client/app/util/variant.ts +0 -20
- package/src/client/bundle-index.js +0 -5
- package/src/client/bundle-main.js +0 -5
- package/src/client/bundle-sandbox.js +0 -2
- package/src/client/index.ts +0 -13
- package/src/client/shim.d.ts +0 -7
- package/tailwind.config.cjs +0 -126
- package/vite.config.ts +0 -87
- package/vue.d.ts +0 -1
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref, toRaw, watch } from 'vue'
|
|
3
|
-
import { useEventListener } from '@vueuse/core'
|
|
4
|
-
import { applyState } from '@histoire/shared'
|
|
5
|
-
import { STATE_SYNC, PREVIEW_SETTINGS_SYNC, SANDBOX_READY, EVENT_SEND } from '../../util/const'
|
|
6
|
-
import type { Story, Variant } from '../../types'
|
|
7
|
-
import { getSandboxUrl } from '../../util/sandbox'
|
|
8
|
-
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
9
|
-
import { HstEvent, useEventsStore } from '../../stores/events'
|
|
10
|
-
import StoryResponsivePreview from './StoryResponsivePreview.vue'
|
|
11
|
-
import { toRawDeep } from '../../util/state'
|
|
12
|
-
|
|
13
|
-
const props = defineProps<{
|
|
14
|
-
story: Story
|
|
15
|
-
variant: Variant
|
|
16
|
-
}>()
|
|
17
|
-
|
|
18
|
-
const settings = usePreviewSettingsStore().currentSettings
|
|
19
|
-
|
|
20
|
-
// Iframe
|
|
21
|
-
|
|
22
|
-
const iframe = ref<HTMLIFrameElement>()
|
|
23
|
-
|
|
24
|
-
function syncState () {
|
|
25
|
-
if (iframe.value && props.variant.previewReady) {
|
|
26
|
-
iframe.value.contentWindow.postMessage({
|
|
27
|
-
type: STATE_SYNC,
|
|
28
|
-
state: toRawDeep(props.variant.state),
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let synced = false
|
|
34
|
-
|
|
35
|
-
watch(() => props.variant.state, () => {
|
|
36
|
-
if (synced) {
|
|
37
|
-
synced = false
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
syncState()
|
|
41
|
-
}, {
|
|
42
|
-
deep: true,
|
|
43
|
-
immediate: true,
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
Object.assign(props.variant, {
|
|
47
|
-
previewReady: false,
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
useEventListener(window, 'message', (event) => {
|
|
51
|
-
switch (event.data.type) {
|
|
52
|
-
case STATE_SYNC:
|
|
53
|
-
updateVariantState(event.data.state)
|
|
54
|
-
break
|
|
55
|
-
case EVENT_SEND:
|
|
56
|
-
logEvent(event.data.event)
|
|
57
|
-
break
|
|
58
|
-
case SANDBOX_READY:
|
|
59
|
-
setPreviewReady()
|
|
60
|
-
break
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
function updateVariantState (state: any) {
|
|
65
|
-
synced = true
|
|
66
|
-
applyState(props.variant.state, state)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function logEvent (event: HstEvent) {
|
|
70
|
-
const eventsStore = useEventsStore()
|
|
71
|
-
eventsStore.addEvent(event)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function setPreviewReady () {
|
|
75
|
-
Object.assign(props.variant, {
|
|
76
|
-
previewReady: true,
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const sandboxUrl = computed(() => {
|
|
81
|
-
return getSandboxUrl(props.story, props.variant)
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
const isIframeLoaded = ref(false)
|
|
85
|
-
|
|
86
|
-
watch(sandboxUrl, () => {
|
|
87
|
-
isIframeLoaded.value = false
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
// Settings
|
|
91
|
-
|
|
92
|
-
function syncSettings () {
|
|
93
|
-
if (iframe.value) {
|
|
94
|
-
iframe.value.contentWindow.postMessage({
|
|
95
|
-
type: PREVIEW_SETTINGS_SYNC,
|
|
96
|
-
settings: toRaw(settings),
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
watch(() => settings, () => {
|
|
102
|
-
syncSettings()
|
|
103
|
-
}, {
|
|
104
|
-
deep: true,
|
|
105
|
-
immediate: true,
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
// Iframe load
|
|
109
|
-
|
|
110
|
-
function onIframeLoad () {
|
|
111
|
-
isIframeLoaded.value = true
|
|
112
|
-
syncState()
|
|
113
|
-
syncSettings()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
</script>
|
|
117
|
-
|
|
118
|
-
<template>
|
|
119
|
-
<StoryResponsivePreview
|
|
120
|
-
v-slot="{ isResponsiveEnabled, finalWidth, finalHeight, resizing }"
|
|
121
|
-
:variant="variant"
|
|
122
|
-
>
|
|
123
|
-
<iframe
|
|
124
|
-
ref="iframe"
|
|
125
|
-
:src="sandboxUrl"
|
|
126
|
-
class="htw-w-full htw-h-full htw-relative"
|
|
127
|
-
:class="{
|
|
128
|
-
'htw-invisible': !isIframeLoaded,
|
|
129
|
-
'htw-pointer-events-none': resizing,
|
|
130
|
-
}"
|
|
131
|
-
:style="isResponsiveEnabled ? {
|
|
132
|
-
width: finalWidth ? `${finalWidth}px` : null,
|
|
133
|
-
height: finalHeight ? `${finalHeight}px` : null,
|
|
134
|
-
} : undefined"
|
|
135
|
-
data-test-id="preview-iframe"
|
|
136
|
-
@load="onIframeLoad()"
|
|
137
|
-
/>
|
|
138
|
-
</StoryResponsivePreview>
|
|
139
|
-
</template>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { Story, Variant } from '../../types'
|
|
3
|
-
import { isMobile } from '../../util/responsive'
|
|
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'
|
|
10
|
-
|
|
11
|
-
defineProps<{
|
|
12
|
-
variant: Variant
|
|
13
|
-
story: Story
|
|
14
|
-
}>()
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<div
|
|
19
|
-
class="htw-h-full htw-flex htw-flex-col"
|
|
20
|
-
data-test-id="story-variant-single-view"
|
|
21
|
-
>
|
|
22
|
-
<!-- Toolbar -->
|
|
23
|
-
<div
|
|
24
|
-
v-if="!isMobile"
|
|
25
|
-
class="htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
|
|
26
|
-
>
|
|
27
|
-
<StoryVariantTitle
|
|
28
|
-
:variant="variant"
|
|
29
|
-
/>
|
|
30
|
-
<StoryVariantResponsiveSize
|
|
31
|
-
v-if="!variant.responsiveDisabled"
|
|
32
|
-
/>
|
|
33
|
-
<StoryVariantBackground />
|
|
34
|
-
<StoryVariantNewTab
|
|
35
|
-
:variant="variant"
|
|
36
|
-
:story="story"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<!-- Preview -->
|
|
41
|
-
<StoryVariantSinglePreviewNative
|
|
42
|
-
v-if="story.layout?.iframe === false"
|
|
43
|
-
:story="story"
|
|
44
|
-
:variant="variant"
|
|
45
|
-
/>
|
|
46
|
-
<StoryVariantSinglePreviewRemote
|
|
47
|
-
v-else
|
|
48
|
-
:story="story"
|
|
49
|
-
:variant="variant"
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { watch } from 'vue'
|
|
3
|
-
import { useRoute, useRouter } from 'vue-router'
|
|
4
|
-
import { Icon } from '@iconify/vue'
|
|
5
|
-
import { useStoryStore } from '../../stores/story'
|
|
6
|
-
|
|
7
|
-
import BaseSplitPane from '../base/BaseSplitPane.vue'
|
|
8
|
-
import BaseEmpty from '../base/BaseEmpty.vue'
|
|
9
|
-
import { isMobile } from '../../util/responsive'
|
|
10
|
-
import StoryViewer from './StoryViewer.vue'
|
|
11
|
-
import StorySidePanel from '../panel/StorySidePanel.vue'
|
|
12
|
-
import StoryDocs from '../panel/StoryDocs.vue'
|
|
13
|
-
|
|
14
|
-
const storyStore = useStoryStore()
|
|
15
|
-
|
|
16
|
-
const router = useRouter()
|
|
17
|
-
const route = useRoute()
|
|
18
|
-
|
|
19
|
-
// Restore variant selection
|
|
20
|
-
|
|
21
|
-
watch(() => storyStore.currentVariant, value => {
|
|
22
|
-
if (value) {
|
|
23
|
-
storyStore.currentStory.lastSelectedVariant = value
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
immediate: true,
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
watch(() => [storyStore.currentStory, storyStore.currentVariant], () => {
|
|
30
|
-
if (!storyStore.currentVariant) {
|
|
31
|
-
if (storyStore.currentStory?.lastSelectedVariant) {
|
|
32
|
-
setVariant(storyStore.currentStory.lastSelectedVariant.id)
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (storyStore.currentStory?.variants.length === 1) {
|
|
37
|
-
setVariant(storyStore.currentStory.variants[0].id)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, {
|
|
41
|
-
immediate: true,
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
function setVariant (variantId: string) {
|
|
45
|
-
router.replace({
|
|
46
|
-
...route,
|
|
47
|
-
query: {
|
|
48
|
-
...route.query,
|
|
49
|
-
variantId,
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<template>
|
|
56
|
-
<BaseEmpty v-if="!storyStore.currentStory">
|
|
57
|
-
<Icon
|
|
58
|
-
icon="carbon:software-resource-resource"
|
|
59
|
-
class="htw-w-16 htw-h-16 htw-opacity-50"
|
|
60
|
-
/>
|
|
61
|
-
</BaseEmpty>
|
|
62
|
-
|
|
63
|
-
<div
|
|
64
|
-
v-else
|
|
65
|
-
class="htw-h-full"
|
|
66
|
-
>
|
|
67
|
-
<div
|
|
68
|
-
v-if="storyStore.currentStory.docsOnly"
|
|
69
|
-
class="htw-h-full htw-overflow-auto"
|
|
70
|
-
>
|
|
71
|
-
<StoryDocs
|
|
72
|
-
:story="storyStore.currentStory"
|
|
73
|
-
class="md:htw-p-12 htw-w-full md:htw-max-w-[600px] lg:htw-max-w-[800px] xl:htw-max-w-[900px]"
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
<template v-else-if="isMobile">
|
|
77
|
-
<StoryViewer />
|
|
78
|
-
</template>
|
|
79
|
-
<BaseSplitPane
|
|
80
|
-
v-else
|
|
81
|
-
save-id="story-main"
|
|
82
|
-
:min="30"
|
|
83
|
-
:max="95"
|
|
84
|
-
:default-split="75"
|
|
85
|
-
class="htw-h-full"
|
|
86
|
-
>
|
|
87
|
-
<template #first>
|
|
88
|
-
<StoryViewer />
|
|
89
|
-
</template>
|
|
90
|
-
|
|
91
|
-
<template #last>
|
|
92
|
-
<StorySidePanel />
|
|
93
|
-
</template>
|
|
94
|
-
</BaseSplitPane>
|
|
95
|
-
</div>
|
|
96
|
-
</template>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref, watch } from 'vue'
|
|
3
|
-
import { useStoryStore } from '../../stores/story'
|
|
4
|
-
import StoryVariantListItem from './StoryVariantListItem.vue'
|
|
5
|
-
import MobileOverlay from '../app/MobileOverlay.vue'
|
|
6
|
-
import StoryVariantGrid from './StoryVariantGrid.vue'
|
|
7
|
-
import StoryVariantSingle from './StoryVariantSingle.vue'
|
|
8
|
-
|
|
9
|
-
const storyStore = useStoryStore()
|
|
10
|
-
|
|
11
|
-
const variant = computed(() => storyStore.currentVariant)
|
|
12
|
-
|
|
13
|
-
const isMenuOpened = ref(false)
|
|
14
|
-
|
|
15
|
-
function closeMenu () {
|
|
16
|
-
isMenuOpened.value = false
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
watch(variant, () => {
|
|
20
|
-
isMenuOpened.value = false
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<template>
|
|
26
|
-
<div class="htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750">
|
|
27
|
-
<StoryVariantGrid
|
|
28
|
-
v-if="storyStore.currentStory.layout.type === 'grid'"
|
|
29
|
-
/>
|
|
30
|
-
<StoryVariantSingle
|
|
31
|
-
v-else-if="storyStore.currentStory.layout.type === 'single'"
|
|
32
|
-
@open-variant-menu="isMenuOpened = true"
|
|
33
|
-
/>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<MobileOverlay
|
|
37
|
-
title="Select a variant"
|
|
38
|
-
:opened="isMenuOpened"
|
|
39
|
-
@close="closeMenu"
|
|
40
|
-
>
|
|
41
|
-
<StoryVariantListItem
|
|
42
|
-
v-for="(v, index) of storyStore.currentStory.variants"
|
|
43
|
-
:key="index"
|
|
44
|
-
:variant="v"
|
|
45
|
-
/>
|
|
46
|
-
</MobileOverlay>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<style scoped>
|
|
50
|
-
.bind-icon-color {
|
|
51
|
-
color: v-bind('variant?.iconColor');
|
|
52
|
-
}
|
|
53
|
-
</style>
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Icon } from '@iconify/vue'
|
|
3
|
-
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
|
-
import { histoireConfig } from '../../util/config'
|
|
5
|
-
import BaseCheckbox from '../base/BaseCheckbox.vue'
|
|
6
|
-
|
|
7
|
-
const settings = usePreviewSettingsStore().currentSettings
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<VDropdown
|
|
12
|
-
v-if="histoireConfig.backgroundPresets.length"
|
|
13
|
-
placement="bottom-end"
|
|
14
|
-
:skidding="6"
|
|
15
|
-
class="htw-h-full htw-flex-none"
|
|
16
|
-
>
|
|
17
|
-
<div
|
|
18
|
-
v-tooltip="'Background color'"
|
|
19
|
-
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
|
-
>
|
|
21
|
-
<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
|
-
/>
|
|
24
|
-
<Icon
|
|
25
|
-
icon="carbon:caret-down"
|
|
26
|
-
class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<template #popper="{ hide }">
|
|
31
|
-
<div class="htw-flex htw-flex-col htw-items-stretch">
|
|
32
|
-
<BaseCheckbox v-model="settings.checkerboard">
|
|
33
|
-
Checkerboard
|
|
34
|
-
</BaseCheckbox>
|
|
35
|
-
|
|
36
|
-
<button
|
|
37
|
-
v-for="(option, index) in histoireConfig.backgroundPresets"
|
|
38
|
-
:key="index"
|
|
39
|
-
class="htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4"
|
|
40
|
-
:class="[
|
|
41
|
-
settings.backgroundColor === option.color
|
|
42
|
-
? 'htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
|
|
43
|
-
: 'htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700',
|
|
44
|
-
]"
|
|
45
|
-
@click="settings.backgroundColor = option.color;hide()"
|
|
46
|
-
>
|
|
47
|
-
<span class="htw-mr-auto">{{ option.label }}</span>
|
|
48
|
-
<template v-if="option.color !== '$checkerboard'">
|
|
49
|
-
<span class="htw-ml-auto htw-opacity-70">{{ option.color }}</span>
|
|
50
|
-
<div
|
|
51
|
-
class="htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/20 dark:htw-border-white/20"
|
|
52
|
-
:style="{
|
|
53
|
-
backgroundColor: option.color,
|
|
54
|
-
}"
|
|
55
|
-
/>
|
|
56
|
-
</template>
|
|
57
|
-
</button>
|
|
58
|
-
</div>
|
|
59
|
-
</template>
|
|
60
|
-
</VDropdown>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
|
-
<style scoped>
|
|
64
|
-
.bind-preview-bg {
|
|
65
|
-
background-color: v-bind('settings.backgroundColor');
|
|
66
|
-
}
|
|
67
|
-
</style>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Icon } from '@iconify/vue'
|
|
3
|
-
import type { Story, Variant } from '../../types'
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
import { getSandboxUrl } from '../../util/sandbox'
|
|
6
|
-
|
|
7
|
-
const props = defineProps<{
|
|
8
|
-
variant: Variant
|
|
9
|
-
story: Story
|
|
10
|
-
}>()
|
|
11
|
-
|
|
12
|
-
const sandboxUrl = computed(() => {
|
|
13
|
-
return getSandboxUrl(props.story, props.variant)
|
|
14
|
-
})
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<a
|
|
19
|
-
v-tooltip="'Open variant in new tab'"
|
|
20
|
-
:href="sandboxUrl"
|
|
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"
|
|
23
|
-
>
|
|
24
|
-
<Icon
|
|
25
|
-
icon="carbon:launch"
|
|
26
|
-
class="base-list-item-link-icon htw-w-4 htw-h-4"
|
|
27
|
-
/>
|
|
28
|
-
</a>
|
|
29
|
-
</template>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Icon } from '@iconify/vue'
|
|
3
|
-
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
4
|
-
import { histoireConfig } from '../../util/config'
|
|
5
|
-
import BaseCheckbox from '../base/BaseCheckbox.vue'
|
|
6
|
-
|
|
7
|
-
const settings = usePreviewSettingsStore().currentSettings
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<!-- Responsive size -->
|
|
12
|
-
<VDropdown
|
|
13
|
-
placement="bottom-end"
|
|
14
|
-
:skidding="6"
|
|
15
|
-
:disabled="!histoireConfig.responsivePresets?.length"
|
|
16
|
-
class="htw-h-full htw-flex-none"
|
|
17
|
-
>
|
|
18
|
-
<div
|
|
19
|
-
v-tooltip="'Responsive sizes'"
|
|
20
|
-
class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group"
|
|
21
|
-
:class="{
|
|
22
|
-
'htw-cursor-pointer hover:htw-text-primary-500': histoireConfig.responsivePresets?.length,
|
|
23
|
-
}"
|
|
24
|
-
>
|
|
25
|
-
<Icon
|
|
26
|
-
icon="carbon:devices"
|
|
27
|
-
class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
28
|
-
/>
|
|
29
|
-
<Icon
|
|
30
|
-
icon="carbon:caret-down"
|
|
31
|
-
class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<template #popper="{ hide }">
|
|
36
|
-
<div class="htw-flex htw-flex-col htw-items-stretch">
|
|
37
|
-
<BaseCheckbox v-model="settings.rotate">
|
|
38
|
-
Rotate
|
|
39
|
-
</BaseCheckbox>
|
|
40
|
-
|
|
41
|
-
<div class="htw-flex htw-gap-2 htw-px-4 htw-py-3">
|
|
42
|
-
<input
|
|
43
|
-
v-model.number="settings.responsiveWidth"
|
|
44
|
-
v-tooltip="'Responsive width (px)'"
|
|
45
|
-
type="number"
|
|
46
|
-
class="htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0"
|
|
47
|
-
step="16"
|
|
48
|
-
placeholder="Auto"
|
|
49
|
-
>
|
|
50
|
-
<span class="htw-opacity-50">x</span>
|
|
51
|
-
<input
|
|
52
|
-
v-model.number="settings.responsiveHeight"
|
|
53
|
-
v-tooltip="'Responsive height (px)'"
|
|
54
|
-
type="number"
|
|
55
|
-
class="htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0"
|
|
56
|
-
step="16"
|
|
57
|
-
placeholder="Auto"
|
|
58
|
-
>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<button
|
|
62
|
-
v-for="(preset, index) in histoireConfig.responsivePresets"
|
|
63
|
-
:key="index"
|
|
64
|
-
class="htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4"
|
|
65
|
-
:class="[
|
|
66
|
-
settings.responsiveWidth === preset.width && settings.responsiveHeight === preset.height
|
|
67
|
-
? 'htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
|
|
68
|
-
: 'htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700',
|
|
69
|
-
]"
|
|
70
|
-
@click="settings.responsiveWidth = preset.width;settings.responsiveHeight = preset.height;hide()"
|
|
71
|
-
>
|
|
72
|
-
{{ preset.label }}
|
|
73
|
-
<span class="htw-ml-auto htw-opacity-70 htw-flex htw-gap-1">
|
|
74
|
-
<span v-if="preset.width">{{ preset.width }}<span v-if="!preset.height">px</span></span>
|
|
75
|
-
<span v-if="preset.width && preset.height">x</span>
|
|
76
|
-
<span v-if="preset.height">{{ preset.height }}<span v-if="!preset.width">px</span></span>
|
|
77
|
-
</span>
|
|
78
|
-
</button>
|
|
79
|
-
</div>
|
|
80
|
-
</template>
|
|
81
|
-
</VDropdown>
|
|
82
|
-
</template>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Icon } from '@iconify/vue'
|
|
3
|
-
import type { Variant } from '../../types'
|
|
4
|
-
|
|
5
|
-
defineProps<{
|
|
6
|
-
variant: Variant
|
|
7
|
-
}>()
|
|
8
|
-
</script>
|
|
9
|
-
|
|
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">
|
|
12
|
-
<Icon
|
|
13
|
-
:icon="variant.icon ?? 'carbon:cube'"
|
|
14
|
-
class="base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50"
|
|
15
|
-
:class="[
|
|
16
|
-
variant.iconColor ? 'bind-icon-color' : 'htw-text-gray-500',
|
|
17
|
-
]"
|
|
18
|
-
/>
|
|
19
|
-
<span>{{ variant.title }}</span>
|
|
20
|
-
</div>
|
|
21
|
-
</template>
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { Story, TreeGroup } from '../../types'
|
|
3
|
-
import StoryListItem from './StoryListItem.vue'
|
|
4
|
-
import StoryListFolder from './StoryListFolder.vue'
|
|
5
|
-
import { Icon } from '@iconify/vue'
|
|
6
|
-
import { computed, withDefaults } from 'vue'
|
|
7
|
-
import { useFolderStore } from '../../stores/folder'
|
|
8
|
-
|
|
9
|
-
const props = withDefaults(defineProps<{
|
|
10
|
-
path?: Array<string>
|
|
11
|
-
group: TreeGroup
|
|
12
|
-
stories: Story[]
|
|
13
|
-
}>(), {
|
|
14
|
-
path: () => [],
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const folderStore = useFolderStore()
|
|
18
|
-
|
|
19
|
-
const folderPath = computed(() => [...props.path, props.group.title])
|
|
20
|
-
const isFolderOpen = computed(() => folderStore.isFolderOpened(folderPath.value, true))
|
|
21
|
-
|
|
22
|
-
function toggleOpen () {
|
|
23
|
-
folderStore.toggleFolder(folderPath.value, false)
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<div
|
|
29
|
-
data-test-id="story-group"
|
|
30
|
-
class="htw-my-2 first:htw-mt-0 last:htw-mb-0"
|
|
31
|
-
>
|
|
32
|
-
<div
|
|
33
|
-
v-if="group.title"
|
|
34
|
-
role="button"
|
|
35
|
-
tabindex="0"
|
|
36
|
-
class="htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex htw-items-center htw-gap-1 htw-min-w-0"
|
|
37
|
-
@click="toggleOpen"
|
|
38
|
-
@keyup.enter="toggleOpen"
|
|
39
|
-
@keyup.space="toggleOpen"
|
|
40
|
-
>
|
|
41
|
-
<Icon
|
|
42
|
-
icon="carbon:caret-right"
|
|
43
|
-
class="htw-w-4 htw-h-4 htw-transition-transform htw-duration-150 htw-opacity-30 htw-flex-none"
|
|
44
|
-
:class="{
|
|
45
|
-
'htw-rotate-90': isFolderOpen,
|
|
46
|
-
}"
|
|
47
|
-
/>
|
|
48
|
-
<span class="htw-truncate htw-opacity-50">{{ group.title }}</span>
|
|
49
|
-
<span class="htw-h-[1px] htw-flex-1 htw-bg-gray-500/10 htw-mx-2" />
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
<!-- Children -->
|
|
53
|
-
<div
|
|
54
|
-
v-if="isFolderOpen"
|
|
55
|
-
>
|
|
56
|
-
<template
|
|
57
|
-
v-for="element of group.children"
|
|
58
|
-
:key="element.title"
|
|
59
|
-
>
|
|
60
|
-
<StoryListFolder
|
|
61
|
-
v-if="(element as TreeFolder).children"
|
|
62
|
-
:path="folderPath"
|
|
63
|
-
:folder="(element as TreeFolder)"
|
|
64
|
-
:stories="stories"
|
|
65
|
-
:depth="0"
|
|
66
|
-
/>
|
|
67
|
-
<StoryListItem
|
|
68
|
-
v-else
|
|
69
|
-
:story="stories[(element as TreeLeaf).index]"
|
|
70
|
-
:depth="0"
|
|
71
|
-
/>
|
|
72
|
-
</template>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</template>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { Story, Tree, TreeGroup, TreeFolder, TreeLeaf } from '../../types'
|
|
3
|
-
import StoryListItem from './StoryListItem.vue'
|
|
4
|
-
import StoryListFolder from './StoryListFolder.vue'
|
|
5
|
-
import StoryGroup from './StoryGroup.vue'
|
|
6
|
-
|
|
7
|
-
defineProps<{
|
|
8
|
-
tree: Tree
|
|
9
|
-
stories: Story[]
|
|
10
|
-
}>()
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<template>
|
|
14
|
-
<div class="htw-overflow-y-auto">
|
|
15
|
-
<template
|
|
16
|
-
v-for="element of tree"
|
|
17
|
-
:key="element.title"
|
|
18
|
-
>
|
|
19
|
-
<StoryGroup
|
|
20
|
-
v-if="(element as TreeGroup).group"
|
|
21
|
-
:group="(element as TreeGroup)"
|
|
22
|
-
:stories="stories"
|
|
23
|
-
/>
|
|
24
|
-
<StoryListFolder
|
|
25
|
-
v-else-if="(element as TreeFolder).children"
|
|
26
|
-
:folder="(element as TreeFolder)"
|
|
27
|
-
:stories="stories"
|
|
28
|
-
/>
|
|
29
|
-
<StoryListItem
|
|
30
|
-
v-else
|
|
31
|
-
:story="stories[(element as TreeLeaf).index]"
|
|
32
|
-
/>
|
|
33
|
-
</template>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|