histoire 0.8.4 → 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 +43 -8
- 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 +52 -8
- 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 -131
- 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 -58
- 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 -71
- 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 -94
- 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 -31
- 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 -89
- 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 -61
- 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 -69
- 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 -85
- 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 -31
- 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 -89
- 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 -61
- 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 -69
- 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 -91
- 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 -37
- 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,94 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, watch, openBlock, createElementBlock, createElementVNode, normalizeStyle, unref, Fragment, renderList, createBlock } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
-
import { useResizeObserver } from "@histoire/vendors/dist/client/vue-use.js";
|
|
3
|
-
import { useStoryStore } from "../../stores/story.js";
|
|
4
|
-
import StoryVariantGridItem from "./StoryVariantGridItem.js";
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
-
name: "StoryVariantGrid",
|
|
7
|
-
setup(__props) {
|
|
8
|
-
const storyStore = useStoryStore();
|
|
9
|
-
const gridTemplateWidth = computed(() => {
|
|
10
|
-
if (storyStore.currentStory.layout.type !== "grid") {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const layoutWidth = storyStore.currentStory.layout.width;
|
|
14
|
-
if (!layoutWidth) {
|
|
15
|
-
return "200px";
|
|
16
|
-
}
|
|
17
|
-
if (typeof layoutWidth === "number") {
|
|
18
|
-
return layoutWidth + "px";
|
|
19
|
-
}
|
|
20
|
-
return layoutWidth;
|
|
21
|
-
});
|
|
22
|
-
const margin = 16;
|
|
23
|
-
const gap = 16;
|
|
24
|
-
const itemWidth = ref(16);
|
|
25
|
-
const maxItemHeight = ref(0);
|
|
26
|
-
const maxCount = ref(10);
|
|
27
|
-
const countPerRow = ref(0);
|
|
28
|
-
const visibleRows = ref(0);
|
|
29
|
-
const el = ref(null);
|
|
30
|
-
useResizeObserver(el, () => {
|
|
31
|
-
updateMaxCount();
|
|
32
|
-
});
|
|
33
|
-
function updateMaxCount() {
|
|
34
|
-
if (!maxItemHeight.value)
|
|
35
|
-
return;
|
|
36
|
-
const width = el.value.clientWidth - margin * 2;
|
|
37
|
-
const height = el.value.clientHeight;
|
|
38
|
-
const scrollTop = el.value.scrollTop;
|
|
39
|
-
countPerRow.value = Math.floor((width + gap) / (itemWidth.value + gap));
|
|
40
|
-
visibleRows.value = Math.ceil((height + scrollTop + gap) / (maxItemHeight.value + gap));
|
|
41
|
-
const newMaxCount = countPerRow.value * visibleRows.value;
|
|
42
|
-
if (maxCount.value < newMaxCount) {
|
|
43
|
-
maxCount.value = newMaxCount;
|
|
44
|
-
}
|
|
45
|
-
if (storyStore.currentVariant) {
|
|
46
|
-
const index = storyStore.currentStory.variants.indexOf(storyStore.currentVariant);
|
|
47
|
-
if (index + 1 > maxCount.value) {
|
|
48
|
-
maxCount.value = index + 1;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function onItemResize(w, h) {
|
|
53
|
-
itemWidth.value = w;
|
|
54
|
-
if (maxItemHeight.value < h) {
|
|
55
|
-
maxItemHeight.value = h;
|
|
56
|
-
updateMaxCount();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
watch(() => storyStore.currentVariant, () => {
|
|
60
|
-
updateMaxCount();
|
|
61
|
-
});
|
|
62
|
-
return (_ctx, _cache) => {
|
|
63
|
-
return openBlock(), createElementBlock("div", {
|
|
64
|
-
ref_key: "el",
|
|
65
|
-
ref: el,
|
|
66
|
-
class: "htw-h-full htw-overflow-y-auto",
|
|
67
|
-
onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
|
|
68
|
-
}, [
|
|
69
|
-
createElementVNode("div", {
|
|
70
|
-
style: normalizeStyle({
|
|
71
|
-
minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
|
|
72
|
-
})
|
|
73
|
-
}, [
|
|
74
|
-
createElementVNode("div", {
|
|
75
|
-
class: "htw-grid htw-gap-4 htw-m-4",
|
|
76
|
-
style: normalizeStyle({
|
|
77
|
-
gridTemplateColumns: `repeat(auto-fill, ${unref(gridTemplateWidth)})`
|
|
78
|
-
})
|
|
79
|
-
}, [
|
|
80
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
|
|
81
|
-
return openBlock(), createBlock(StoryVariantGridItem, {
|
|
82
|
-
key: index,
|
|
83
|
-
variant,
|
|
84
|
-
story: unref(storyStore).currentStory,
|
|
85
|
-
onResize: onItemResize
|
|
86
|
-
}, null, 8, ["variant", "story"]);
|
|
87
|
-
}), 128))
|
|
88
|
-
], 4)
|
|
89
|
-
], 4)
|
|
90
|
-
], 544);
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
export { _sfc_main as default };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, normalizeClass, withCtx, toDisplayString, withModifiers } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
-
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
3
|
-
import { useRouter } from "@histoire/vendors/dist/client/vue-router.js";
|
|
4
|
-
import { useResizeObserver } from "@histoire/vendors/dist/client/vue-use.js";
|
|
5
|
-
import { SandboxVue3 } from "@histoire/plugin-vue/client";
|
|
6
|
-
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
7
|
-
import { useScrollOnActive } from "../../util/scroll.js";
|
|
8
|
-
import "./StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
9
|
-
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
10
|
-
const _withScopeId = (n) => (pushScopeId("data-v-307653da"), n = n(), popScopeId(), n);
|
|
11
|
-
const _hoisted_1 = { class: "htw-flex-none htw-flex htw-items-center" };
|
|
12
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
-
name: "StoryVariantGridItem",
|
|
14
|
-
props: {
|
|
15
|
-
variant: {
|
|
16
|
-
type: Object,
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
story: {
|
|
20
|
-
type: Object,
|
|
21
|
-
required: true
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
emits: {
|
|
25
|
-
resize: (width, height) => true
|
|
26
|
-
},
|
|
27
|
-
setup(__props, { emit }) {
|
|
28
|
-
const props = __props;
|
|
29
|
-
useCssVars((_ctx) => ({
|
|
30
|
-
"5f94a358": unref(variant).iconColor
|
|
31
|
-
}));
|
|
32
|
-
const { variant } = toRefs(props);
|
|
33
|
-
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
34
|
-
Object.assign(props.variant, {
|
|
35
|
-
previewReady: false
|
|
36
|
-
});
|
|
37
|
-
function onReady() {
|
|
38
|
-
Object.assign(props.variant, {
|
|
39
|
-
previewReady: true
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
const router = useRouter();
|
|
43
|
-
function selectVariant() {
|
|
44
|
-
router.push(targetRoute.value);
|
|
45
|
-
}
|
|
46
|
-
const el = ref();
|
|
47
|
-
const { autoScroll } = useScrollOnActive(isActive, el);
|
|
48
|
-
useResizeObserver(el, () => {
|
|
49
|
-
if (props.variant.previewReady) {
|
|
50
|
-
emit("resize", el.value.clientWidth, el.value.clientHeight);
|
|
51
|
-
if (isActive.value) {
|
|
52
|
-
autoScroll();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return (_ctx, _cache) => {
|
|
57
|
-
const _component_RouterLink = resolveComponent("RouterLink");
|
|
58
|
-
return openBlock(), createElementBlock("div", {
|
|
59
|
-
ref_key: "el",
|
|
60
|
-
ref: el,
|
|
61
|
-
class: "htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
|
|
62
|
-
}, [
|
|
63
|
-
createElementVNode("div", _hoisted_1, [
|
|
64
|
-
createVNode(_component_RouterLink, {
|
|
65
|
-
to: unref(targetRoute),
|
|
66
|
-
class: normalizeClass(["htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1", {
|
|
67
|
-
"hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800": !unref(isActive),
|
|
68
|
-
"htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800 dark:htw-bg-primary-700 dark:hover:htw-bg-primary-800 dark:htw-text-primary-200": unref(isActive)
|
|
69
|
-
}])
|
|
70
|
-
}, {
|
|
71
|
-
default: withCtx(() => {
|
|
72
|
-
var _a;
|
|
73
|
-
return [
|
|
74
|
-
createVNode(unref(Icon), {
|
|
75
|
-
icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
|
|
76
|
-
class: normalizeClass(["base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50", {
|
|
77
|
-
"htw-text-gray-500": !unref(isActive) && !unref(variant).iconColor,
|
|
78
|
-
"bind-icon-color": !unref(isActive) && unref(variant).iconColor
|
|
79
|
-
}])
|
|
80
|
-
}, null, 8, ["icon", "class"]),
|
|
81
|
-
createElementVNode("span", null, toDisplayString(unref(variant).title), 1)
|
|
82
|
-
];
|
|
83
|
-
}),
|
|
84
|
-
_: 1
|
|
85
|
-
}, 8, ["to", "class"])
|
|
86
|
-
]),
|
|
87
|
-
createElementVNode("div", {
|
|
88
|
-
class: normalizeClass(["htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded-lg htw-flex-1 htw-p-4", {
|
|
89
|
-
"htw-border-gray-100 dark:htw-border-gray-800": !unref(isActive),
|
|
90
|
-
"htw-border-primary-200 dark:htw-border-primary-900": unref(isActive)
|
|
91
|
-
}]),
|
|
92
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop", "prevent"])),
|
|
93
|
-
onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
|
|
94
|
-
}, [
|
|
95
|
-
createVNode(unref(SandboxVue3), {
|
|
96
|
-
variant: unref(variant),
|
|
97
|
-
story: __props.story,
|
|
98
|
-
onReady
|
|
99
|
-
}, null, 8, ["variant", "story"])
|
|
100
|
-
], 34)
|
|
101
|
-
], 512);
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
var StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-307653da"]]);
|
|
106
|
-
export { StoryVariantGridItem as default };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { pushScopeId, popScopeId, defineComponent, useCssVars, unref, toRefs, ref, openBlock, createElementBlock, createVNode, withCtx, normalizeClass, createElementVNode, toDisplayString } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
-
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
3
|
-
import BaseListItemLink from "../base/BaseListItemLink.js";
|
|
4
|
-
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
5
|
-
import { useScrollOnActive } from "../../util/scroll.js";
|
|
6
|
-
import "./StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
7
|
-
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
8
|
-
const _withScopeId = (n) => (pushScopeId("data-v-2cdc2ac0"), n = n(), popScopeId(), n);
|
|
9
|
-
const _hoisted_1 = { class: "htw-truncate" };
|
|
10
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
-
name: "StoryVariantListItem",
|
|
12
|
-
props: {
|
|
13
|
-
variant: {
|
|
14
|
-
type: Object,
|
|
15
|
-
required: true
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
setup(__props) {
|
|
19
|
-
const props = __props;
|
|
20
|
-
useCssVars((_ctx) => ({
|
|
21
|
-
"3c4190ff": unref(variant).iconColor
|
|
22
|
-
}));
|
|
23
|
-
const { variant } = toRefs(props);
|
|
24
|
-
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
25
|
-
const el = ref();
|
|
26
|
-
useScrollOnActive(isActive, el);
|
|
27
|
-
return (_ctx, _cache) => {
|
|
28
|
-
return openBlock(), createElementBlock("div", {
|
|
29
|
-
ref_key: "el",
|
|
30
|
-
ref: el,
|
|
31
|
-
"data-test-id": "story-variant-list-item"
|
|
32
|
-
}, [
|
|
33
|
-
createVNode(BaseListItemLink, {
|
|
34
|
-
to: unref(targetRoute),
|
|
35
|
-
"is-active": unref(isActive),
|
|
36
|
-
class: "htw-px-2 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm htw-flex htw-items-center htw-gap-2"
|
|
37
|
-
}, {
|
|
38
|
-
default: withCtx(({ active }) => {
|
|
39
|
-
var _a;
|
|
40
|
-
return [
|
|
41
|
-
createVNode(unref(Icon), {
|
|
42
|
-
icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
|
|
43
|
-
class: normalizeClass(["base-list-item-link-icon htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none", {
|
|
44
|
-
"htw-text-gray-500": !active && !unref(variant).iconColor,
|
|
45
|
-
"bind-icon-color": !active && unref(variant).iconColor
|
|
46
|
-
}])
|
|
47
|
-
}, null, 8, ["icon", "class"]),
|
|
48
|
-
createElementVNode("span", _hoisted_1, toDisplayString(unref(variant).title), 1)
|
|
49
|
-
];
|
|
50
|
-
}),
|
|
51
|
-
_: 1
|
|
52
|
-
}, 8, ["to", "is-active"])
|
|
53
|
-
], 512);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
var StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2cdc2ac0"]]);
|
|
58
|
-
export { StoryVariantListItem as default };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { pushScopeId, popScopeId, createTextVNode, defineComponent, useCssVars, unref, computed, openBlock, createElementBlock, createVNode, Fragment, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, createBlock, withCtx, renderList } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
-
import { useStoryStore } from "../../stores/story.js";
|
|
3
|
-
import { Icon } from "@histoire/vendors/dist/client/iconify.js";
|
|
4
|
-
import { isMobile } from "../../util/responsive.js";
|
|
5
|
-
import BaseSplitPane from "../base/BaseSplitPane.js";
|
|
6
|
-
import StoryVariantListItem from "./StoryVariantListItem.js";
|
|
7
|
-
import _sfc_main$1 from "./StoryVariantSingleView.js";
|
|
8
|
-
import "./StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js";
|
|
9
|
-
import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
|
|
10
|
-
const _withScopeId = (n) => (pushScopeId("data-v-30bcb922"), n = n(), popScopeId(), n);
|
|
11
|
-
const _hoisted_1 = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "htw-p-2 htw-h-full"
|
|
14
|
-
};
|
|
15
|
-
const _hoisted_2 = {
|
|
16
|
-
key: 0,
|
|
17
|
-
class: "htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
|
|
18
|
-
};
|
|
19
|
-
const _hoisted_3 = /* @__PURE__ */ createTextVNode(" Select a variant... ");
|
|
20
|
-
const _hoisted_4 = {
|
|
21
|
-
key: 0,
|
|
22
|
-
class: "htw-p-2 htw-h-full"
|
|
23
|
-
};
|
|
24
|
-
const _hoisted_5 = { class: "htw-h-full htw-overflow-y-auto" };
|
|
25
|
-
const _hoisted_6 = {
|
|
26
|
-
key: 0,
|
|
27
|
-
class: "htw-p-2 htw-h-full"
|
|
28
|
-
};
|
|
29
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
30
|
-
name: "StoryVariantSingle",
|
|
31
|
-
emits: {
|
|
32
|
-
"open-variant-menu": () => true
|
|
33
|
-
},
|
|
34
|
-
setup(__props) {
|
|
35
|
-
useCssVars((_ctx) => {
|
|
36
|
-
var _a;
|
|
37
|
-
return {
|
|
38
|
-
"33d9fc01": (_a = unref(variant)) == null ? void 0 : _a.iconColor
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
const storyStore = useStoryStore();
|
|
42
|
-
const hasSingleVariant = computed(() => {
|
|
43
|
-
var _a;
|
|
44
|
-
return ((_a = storyStore.currentStory) == null ? void 0 : _a.variants.length) === 1;
|
|
45
|
-
});
|
|
46
|
-
const variant = computed(() => storyStore.currentVariant);
|
|
47
|
-
return (_ctx, _cache) => {
|
|
48
|
-
var _a;
|
|
49
|
-
return unref(hasSingleVariant) && unref(variant) ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
50
|
-
createVNode(_sfc_main$1, {
|
|
51
|
-
variant: unref(variant),
|
|
52
|
-
story: unref(storyStore).currentStory
|
|
53
|
-
}, null, 8, ["variant", "story"])
|
|
54
|
-
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
55
|
-
unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
56
|
-
createElementVNode("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 htw-flex-none",
|
|
58
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("open-variant-menu"))
|
|
59
|
-
}, [
|
|
60
|
-
unref(variant) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
61
|
-
createVNode(unref(Icon), {
|
|
62
|
-
icon: (_a = unref(variant).icon) != null ? _a : "carbon:cube",
|
|
63
|
-
class: normalizeClass(["base-list-item-link-icon htw-w-5 htw-h-5 htw-flex-none", {
|
|
64
|
-
"htw-text-gray-500": !unref(variant).iconColor,
|
|
65
|
-
"bind-icon-color": unref(variant).iconColor
|
|
66
|
-
}])
|
|
67
|
-
}, null, 8, ["icon", "class"]),
|
|
68
|
-
createTextVNode(" " + toDisplayString(unref(variant).title), 1)
|
|
69
|
-
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
70
|
-
_hoisted_3
|
|
71
|
-
], 64)),
|
|
72
|
-
createVNode(unref(Icon), {
|
|
73
|
-
icon: "carbon:chevron-sort",
|
|
74
|
-
class: "htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
75
|
-
})
|
|
76
|
-
]),
|
|
77
|
-
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
78
|
-
createVNode(_sfc_main$1, {
|
|
79
|
-
variant: unref(storyStore).currentVariant,
|
|
80
|
-
story: unref(storyStore).currentStory
|
|
81
|
-
}, null, 8, ["variant", "story"])
|
|
82
|
-
])) : createCommentVNode("", true)
|
|
83
|
-
])) : (openBlock(), createBlock(BaseSplitPane, {
|
|
84
|
-
key: 1,
|
|
85
|
-
"save-id": "story-single-main-split",
|
|
86
|
-
min: 5,
|
|
87
|
-
max: 40,
|
|
88
|
-
"default-split": 17
|
|
89
|
-
}, {
|
|
90
|
-
first: withCtx(() => [
|
|
91
|
-
createElementVNode("div", _hoisted_5, [
|
|
92
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (v, index) => {
|
|
93
|
-
return openBlock(), createBlock(StoryVariantListItem, {
|
|
94
|
-
key: index,
|
|
95
|
-
variant: v
|
|
96
|
-
}, null, 8, ["variant"]);
|
|
97
|
-
}), 128))
|
|
98
|
-
])
|
|
99
|
-
]),
|
|
100
|
-
last: withCtx(() => [
|
|
101
|
-
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
102
|
-
createVNode(_sfc_main$1, {
|
|
103
|
-
variant: unref(storyStore).currentVariant,
|
|
104
|
-
story: unref(storyStore).currentStory
|
|
105
|
-
}, null, 8, ["variant", "story"])
|
|
106
|
-
])) : createCommentVNode("", true)
|
|
107
|
-
]),
|
|
108
|
-
_: 1
|
|
109
|
-
}))
|
|
110
|
-
], 64));
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
var StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-30bcb922"]]);
|
|
115
|
-
export { StoryVariantSingle as default };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, unref } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
-
import { SandboxVue3 } from "@histoire/plugin-vue/client";
|
|
3
|
-
import StoryResponsivePreview from "./StoryResponsivePreview.js";
|
|
4
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
-
name: "StoryVariantSinglePreviewNative",
|
|
6
|
-
props: {
|
|
7
|
-
story: null,
|
|
8
|
-
variant: null
|
|
9
|
-
},
|
|
10
|
-
setup(__props) {
|
|
11
|
-
const props = __props;
|
|
12
|
-
Object.assign(props.variant, {
|
|
13
|
-
previewReady: false
|
|
14
|
-
});
|
|
15
|
-
function onReady() {
|
|
16
|
-
Object.assign(props.variant, {
|
|
17
|
-
previewReady: true
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return (_ctx, _cache) => {
|
|
21
|
-
return openBlock(), createBlock(StoryResponsivePreview, { variant: __props.variant }, {
|
|
22
|
-
default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight }) => [
|
|
23
|
-
createElementVNode("div", {
|
|
24
|
-
style: normalizeStyle(isResponsiveEnabled ? {
|
|
25
|
-
width: finalWidth ? `${finalWidth}px` : "100%",
|
|
26
|
-
height: finalHeight ? `${finalHeight}px` : "100%"
|
|
27
|
-
} : { width: "100%", height: "100%" })
|
|
28
|
-
}, [
|
|
29
|
-
(openBlock(), createBlock(unref(SandboxVue3), {
|
|
30
|
-
key: `${__props.story.id}-${__props.variant.id}`,
|
|
31
|
-
variant: __props.variant,
|
|
32
|
-
story: __props.story,
|
|
33
|
-
class: "htw-h-full",
|
|
34
|
-
onReady
|
|
35
|
-
}, null, 8, ["variant", "story"]))
|
|
36
|
-
], 4)
|
|
37
|
-
]),
|
|
38
|
-
_: 1
|
|
39
|
-
}, 8, ["variant"]);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
export { _sfc_main as default };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, computed, toRaw, openBlock, createBlock, withCtx, createElementVNode, unref, normalizeClass, normalizeStyle } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
-
import { useEventListener } from "@histoire/vendors/dist/client/vue-use.js";
|
|
3
|
-
import { applyState } from "@histoire/shared";
|
|
4
|
-
import { STATE_SYNC, SANDBOX_READY, EVENT_SEND, PREVIEW_SETTINGS_SYNC } from "../../util/const.js";
|
|
5
|
-
import { getSandboxUrl } from "../../util/sandbox.js";
|
|
6
|
-
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
7
|
-
import { useEventsStore } from "../../stores/events.js";
|
|
8
|
-
import StoryResponsivePreview from "./StoryResponsivePreview.js";
|
|
9
|
-
import { toRawDeep } from "../../util/state.js";
|
|
10
|
-
const _hoisted_1 = ["src"];
|
|
11
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
-
name: "StoryVariantSinglePreviewRemote",
|
|
13
|
-
props: {
|
|
14
|
-
story: null,
|
|
15
|
-
variant: null
|
|
16
|
-
},
|
|
17
|
-
setup(__props) {
|
|
18
|
-
const props = __props;
|
|
19
|
-
const settings = usePreviewSettingsStore().currentSettings;
|
|
20
|
-
const iframe = ref();
|
|
21
|
-
function syncState() {
|
|
22
|
-
if (iframe.value && props.variant.previewReady) {
|
|
23
|
-
iframe.value.contentWindow.postMessage({
|
|
24
|
-
type: STATE_SYNC,
|
|
25
|
-
state: toRawDeep(props.variant.state)
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
let synced = false;
|
|
30
|
-
watch(() => props.variant.state, () => {
|
|
31
|
-
if (synced) {
|
|
32
|
-
synced = false;
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
syncState();
|
|
36
|
-
}, {
|
|
37
|
-
deep: true,
|
|
38
|
-
immediate: true
|
|
39
|
-
});
|
|
40
|
-
Object.assign(props.variant, {
|
|
41
|
-
previewReady: false
|
|
42
|
-
});
|
|
43
|
-
useEventListener(window, "message", (event) => {
|
|
44
|
-
switch (event.data.type) {
|
|
45
|
-
case STATE_SYNC:
|
|
46
|
-
updateVariantState(event.data.state);
|
|
47
|
-
break;
|
|
48
|
-
case EVENT_SEND:
|
|
49
|
-
logEvent(event.data.event);
|
|
50
|
-
break;
|
|
51
|
-
case SANDBOX_READY:
|
|
52
|
-
setPreviewReady();
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
function updateVariantState(state) {
|
|
57
|
-
synced = true;
|
|
58
|
-
applyState(props.variant.state, state);
|
|
59
|
-
}
|
|
60
|
-
function logEvent(event) {
|
|
61
|
-
const eventsStore = useEventsStore();
|
|
62
|
-
eventsStore.addEvent(event);
|
|
63
|
-
}
|
|
64
|
-
function setPreviewReady() {
|
|
65
|
-
Object.assign(props.variant, {
|
|
66
|
-
previewReady: true
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
const sandboxUrl = computed(() => {
|
|
70
|
-
return getSandboxUrl(props.story, props.variant);
|
|
71
|
-
});
|
|
72
|
-
const isIframeLoaded = ref(false);
|
|
73
|
-
watch(sandboxUrl, () => {
|
|
74
|
-
isIframeLoaded.value = false;
|
|
75
|
-
});
|
|
76
|
-
function syncSettings() {
|
|
77
|
-
if (iframe.value) {
|
|
78
|
-
iframe.value.contentWindow.postMessage({
|
|
79
|
-
type: PREVIEW_SETTINGS_SYNC,
|
|
80
|
-
settings: toRaw(settings)
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
watch(() => settings, () => {
|
|
85
|
-
syncSettings();
|
|
86
|
-
}, {
|
|
87
|
-
deep: true,
|
|
88
|
-
immediate: true
|
|
89
|
-
});
|
|
90
|
-
function onIframeLoad() {
|
|
91
|
-
isIframeLoaded.value = true;
|
|
92
|
-
syncState();
|
|
93
|
-
syncSettings();
|
|
94
|
-
}
|
|
95
|
-
return (_ctx, _cache) => {
|
|
96
|
-
return openBlock(), createBlock(StoryResponsivePreview, { variant: __props.variant }, {
|
|
97
|
-
default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight, resizing }) => [
|
|
98
|
-
createElementVNode("iframe", {
|
|
99
|
-
ref_key: "iframe",
|
|
100
|
-
ref: iframe,
|
|
101
|
-
src: unref(sandboxUrl),
|
|
102
|
-
class: normalizeClass(["htw-w-full htw-h-full htw-relative", {
|
|
103
|
-
"htw-invisible": !isIframeLoaded.value,
|
|
104
|
-
"htw-pointer-events-none": resizing
|
|
105
|
-
}]),
|
|
106
|
-
style: normalizeStyle(isResponsiveEnabled ? {
|
|
107
|
-
width: finalWidth ? `${finalWidth}px` : null,
|
|
108
|
-
height: finalHeight ? `${finalHeight}px` : null
|
|
109
|
-
} : void 0),
|
|
110
|
-
"data-test-id": "preview-iframe",
|
|
111
|
-
onLoad: _cache[0] || (_cache[0] = ($event) => onIframeLoad())
|
|
112
|
-
}, null, 46, _hoisted_1)
|
|
113
|
-
]),
|
|
114
|
-
_: 1
|
|
115
|
-
}, 8, ["variant"]);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
export { _sfc_main as default };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, unref, createVNode, createBlock, createCommentVNode } from "@histoire/vendors/dist/client/vue.js";
|
|
2
|
-
import { isMobile } from "../../util/responsive.js";
|
|
3
|
-
import _sfc_main$1 from "../toolbar/StoryVariantTitle.js";
|
|
4
|
-
import _sfc_main$2 from "../toolbar/StoryVariantResponsiveSize.js";
|
|
5
|
-
import StoryVariantBackground from "../toolbar/StoryVariantBackground.js";
|
|
6
|
-
import _sfc_main$3 from "../toolbar/StoryVariantNewTab.js";
|
|
7
|
-
import _sfc_main$4 from "./StoryVariantSinglePreviewNative.js";
|
|
8
|
-
import _sfc_main$5 from "./StoryVariantSinglePreviewRemote.js";
|
|
9
|
-
const _hoisted_1 = {
|
|
10
|
-
class: "htw-h-full htw-flex htw-flex-col",
|
|
11
|
-
"data-test-id": "story-variant-single-view"
|
|
12
|
-
};
|
|
13
|
-
const _hoisted_2 = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
|
|
16
|
-
};
|
|
17
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
-
name: "StoryVariantSingleView",
|
|
19
|
-
props: {
|
|
20
|
-
variant: null,
|
|
21
|
-
story: null
|
|
22
|
-
},
|
|
23
|
-
setup(__props) {
|
|
24
|
-
return (_ctx, _cache) => {
|
|
25
|
-
var _a;
|
|
26
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
27
|
-
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
28
|
-
createVNode(_sfc_main$1, { variant: __props.variant }, null, 8, ["variant"]),
|
|
29
|
-
!__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$2, { key: 0 })) : createCommentVNode("", true),
|
|
30
|
-
createVNode(StoryVariantBackground),
|
|
31
|
-
createVNode(_sfc_main$3, {
|
|
32
|
-
variant: __props.variant,
|
|
33
|
-
story: __props.story
|
|
34
|
-
}, null, 8, ["variant", "story"])
|
|
35
|
-
])) : createCommentVNode("", true),
|
|
36
|
-
((_a = __props.story.layout) == null ? void 0 : _a.iframe) === false ? (openBlock(), createBlock(_sfc_main$4, {
|
|
37
|
-
key: 1,
|
|
38
|
-
story: __props.story,
|
|
39
|
-
variant: __props.variant
|
|
40
|
-
}, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$5, {
|
|
41
|
-
key: 2,
|
|
42
|
-
story: __props.story,
|
|
43
|
-
variant: __props.variant
|
|
44
|
-
}, null, 8, ["story", "variant"]))
|
|
45
|
-
]);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
export { _sfc_main as default };
|