@ohos-ports/histoire-app 1.0.0-beta.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/LICENSE +21 -0
- package/dist/app/assets/histoire-text-dark.svg +89 -0
- package/dist/app/assets/histoire-text.svg +89 -0
- package/dist/app/assets/histoire.svg +51 -0
- package/dist/app/style/floating.pcss +34 -0
- package/dist/app/style/main.pcss +100 -0
- package/dist/app/style/sandbox.css +24 -0
- package/dist/app/style/transitions.pcss +51 -0
- package/dist/bundle-index.js +3 -0
- package/dist/bundle-main-dev.js +4 -0
- package/dist/bundle-main.js +5 -0
- package/dist/bundle-sandbox-dev.js +2 -0
- package/dist/bundle-sandbox.js +2 -0
- package/dist/bundled/App.vue.js +5 -0
- package/dist/bundled/App.vue2.js +167 -0
- package/dist/bundled/_virtual/_node-dom-env.js +188 -0
- package/dist/bundled/_virtual/_node-dom-polyfill.js +152 -0
- package/dist/bundled/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/bundled/_virtual/histoire-commands.js +8 -0
- package/dist/bundled/_virtual/histoire-config.js +42 -0
- package/dist/bundled/_virtual/histoire-markdown-files.js +8 -0
- package/dist/bundled/_virtual/histoire-search-docs-data.js +11 -0
- package/dist/bundled/_virtual/histoire-search-title-data.js +11 -0
- package/dist/bundled/_virtual/histoire-stories.js +17 -0
- package/dist/bundled/_virtual/histoire-support-plugins-client.js +8 -0
- package/dist/bundled/_virtual/histoire-theme.js +8 -0
- package/dist/bundled/api.js +12 -0
- package/dist/bundled/app.css +116 -0
- package/dist/bundled/assets/histoire-text-dark.svg.js +4 -0
- package/dist/bundled/assets/histoire-text.svg.js +4 -0
- package/dist/bundled/assets/histoire.svg.js +4 -0
- package/dist/bundled/components/HomeView.vue.js +5 -0
- package/dist/bundled/components/HomeView.vue2.js +66 -0
- package/dist/bundled/components/app/AppHeader.vue.js +5 -0
- package/dist/bundled/components/app/AppHeader.vue2.js +71 -0
- package/dist/bundled/components/app/AppLogo.vue.js +5 -0
- package/dist/bundled/components/app/AppLogo.vue2.js +29 -0
- package/dist/bundled/components/app/Breadcrumb.vue.js +8 -0
- package/dist/bundled/components/app/Breadcrumb.vue2.js +91 -0
- package/dist/bundled/components/app/HomeCounter.vue.js +5 -0
- package/dist/bundled/components/app/HomeCounter.vue2.js +42 -0
- package/dist/bundled/components/app/InitialLoading.vue.js +5 -0
- package/dist/bundled/components/app/InitialLoading.vue2.js +51 -0
- package/dist/bundled/components/app/MobileOverlay.vue.js +5 -0
- package/dist/bundled/components/app/MobileOverlay.vue2.js +45 -0
- package/dist/bundled/components/base/BaseButton.vue.js +5 -0
- package/dist/bundled/components/base/BaseButton.vue2.js +39 -0
- package/dist/bundled/components/base/BaseCheckbox.vue.js +5 -0
- package/dist/bundled/components/base/BaseCheckbox.vue2.js +78 -0
- package/dist/bundled/components/base/BaseEmpty.vue.js +14 -0
- package/dist/bundled/components/base/BaseIcon.vue.js +8 -0
- package/dist/bundled/components/base/BaseIcon.vue2.js +29 -0
- package/dist/bundled/components/base/BaseKeyboardShortcut.vue.js +5 -0
- package/dist/bundled/components/base/BaseKeyboardShortcut.vue2.js +20 -0
- package/dist/bundled/components/base/BaseListItem.vue.js +5 -0
- package/dist/bundled/components/base/BaseListItem.vue2.js +33 -0
- package/dist/bundled/components/base/BaseListItemLink.vue.js +33 -0
- package/dist/bundled/components/base/BaseListItemLink.vue2.js +26 -0
- package/dist/bundled/components/base/BaseOverflowMenu.vue.js +5 -0
- package/dist/bundled/components/base/BaseOverflowMenu.vue2.js +100 -0
- package/dist/bundled/components/base/BaseOverflowTab.vue.js +36 -0
- package/dist/bundled/components/base/BaseOverflowTab.vue2.js +18 -0
- package/dist/bundled/components/base/BaseSelect.vue.js +5 -0
- package/dist/bundled/components/base/BaseSelect.vue2.js +77 -0
- package/dist/bundled/components/base/BaseSplitPane.vue.js +8 -0
- package/dist/bundled/components/base/BaseSplitPane.vue2.js +183 -0
- package/dist/bundled/components/base/BaseTab.vue.js +36 -0
- package/dist/bundled/components/base/BaseTab.vue2.js +18 -0
- package/dist/bundled/components/base/BaseTag.vue.js +13 -0
- package/dist/bundled/components/command/CommandPrompts.vue.js +5 -0
- package/dist/bundled/components/command/CommandPrompts.vue2.js +91 -0
- package/dist/bundled/components/command/CommandPromptsModal.vue.js +5 -0
- package/dist/bundled/components/command/CommandPromptsModal.vue2.js +45 -0
- package/dist/bundled/components/command/PromptSelect.vue.js +5 -0
- package/dist/bundled/components/command/PromptSelect.vue2.js +142 -0
- package/dist/bundled/components/command/PromptText.vue.js +5 -0
- package/dist/bundled/components/command/PromptText.vue2.js +67 -0
- package/dist/bundled/components/misc/CheckerboardPattern.vue.js +40 -0
- package/dist/bundled/components/misc/HatchedPattern.vue.js +12 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue2.js +72 -0
- package/dist/bundled/components/panel/ControlsComponentProps.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentProps.vue2.js +45 -0
- package/dist/bundled/components/panel/ControlsComponentState.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentState.vue2.js +41 -0
- package/dist/bundled/components/panel/ControlsComponentStateItem.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentStateItem.vue2.js +46 -0
- package/dist/bundled/components/panel/PaneTabs.vue.js +5 -0
- package/dist/bundled/components/panel/PaneTabs.vue2.js +114 -0
- package/dist/bundled/components/panel/StatePresets.vue.js +5 -0
- package/dist/bundled/components/panel/StatePresets.vue2.js +193 -0
- package/dist/bundled/components/panel/StoryControls.vue.js +5 -0
- package/dist/bundled/components/panel/StoryControls.vue2.js +87 -0
- package/dist/bundled/components/panel/StoryDocs.vue.js +7 -0
- package/dist/bundled/components/panel/StoryDocs.vue2.js +161 -0
- package/dist/bundled/components/panel/StoryEvent.vue.js +5 -0
- package/dist/bundled/components/panel/StoryEvent.vue2.js +59 -0
- package/dist/bundled/components/panel/StoryEvents.vue.js +5 -0
- package/dist/bundled/components/panel/StoryEvents.vue2.js +53 -0
- package/dist/bundled/components/panel/StorySidePanel.vue.js +5 -0
- package/dist/bundled/components/panel/StorySidePanel.vue2.js +83 -0
- package/dist/bundled/components/panel/StorySourceCode.vue.js +8 -0
- package/dist/bundled/components/panel/StorySourceCode.vue2.js +204 -0
- package/dist/bundled/components/search/SearchItem.vue.js +8 -0
- package/dist/bundled/components/search/SearchItem.vue2.js +93 -0
- package/dist/bundled/components/search/SearchItemContent.vue.js +5 -0
- package/dist/bundled/components/search/SearchItemContent.vue2.js +71 -0
- package/dist/bundled/components/search/SearchLoading.vue.js +5 -0
- package/dist/bundled/components/search/SearchLoading.vue2.js +21 -0
- package/dist/bundled/components/search/SearchModal.vue.js +5 -0
- package/dist/bundled/components/search/SearchModal.vue2.js +51 -0
- package/dist/bundled/components/search/SearchPane.vue.js +5 -0
- package/dist/bundled/components/search/SearchPane.vue2.js +272 -0
- package/dist/bundled/components/search/search-docs-data.js +11 -0
- package/dist/bundled/components/search/search-title-data.js +11 -0
- package/dist/bundled/components/story/GenericMountStory.vue.js +5 -0
- package/dist/bundled/components/story/GenericMountStory.vue2.js +34 -0
- package/dist/bundled/components/story/GenericRenderStory.vue.js +5 -0
- package/dist/bundled/components/story/GenericRenderStory.vue2.js +39 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue.js +8 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue2.js +207 -0
- package/dist/bundled/components/story/StoryVariantGrid.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantGrid.vue2.js +146 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue.js +8 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +153 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue.js +8 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue2.js +55 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue.js +8 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue2.js +107 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +70 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue2.js +128 -0
- package/dist/bundled/components/story/StoryVariantSingleView.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +66 -0
- package/dist/bundled/components/story/StoryView.vue.js +5 -0
- package/dist/bundled/components/story/StoryView.vue2.js +104 -0
- package/dist/bundled/components/story/StoryViewer.vue.js +8 -0
- package/dist/bundled/components/story/StoryViewer.vue2.js +55 -0
- package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue.js +5 -0
- package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue2.js +31 -0
- package/dist/bundled/components/toolbar/ToolbarBackground.vue.js +8 -0
- package/dist/bundled/components/toolbar/ToolbarBackground.vue2.js +98 -0
- package/dist/bundled/components/toolbar/ToolbarNewTab.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarNewTab.vue2.js +36 -0
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue2.js +127 -0
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue2.js +27 -0
- package/dist/bundled/components/toolbar/ToolbarTitle.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarTitle.vue2.js +26 -0
- package/dist/bundled/components/tree/StoryGroup.vue.js +5 -0
- package/dist/bundled/components/tree/StoryGroup.vue2.js +74 -0
- package/dist/bundled/components/tree/StoryList.vue.js +5 -0
- package/dist/bundled/components/tree/StoryList.vue2.js +41 -0
- package/dist/bundled/components/tree/StoryListFolder.vue.js +8 -0
- package/dist/bundled/components/tree/StoryListFolder.vue2.js +86 -0
- package/dist/bundled/components/tree/StoryListItem.vue.js +8 -0
- package/dist/bundled/components/tree/StoryListItem.vue2.js +69 -0
- package/dist/bundled/index.js +36 -0
- package/dist/bundled/plugin.js +49 -0
- package/dist/bundled/router.js +32 -0
- package/dist/bundled/sandbox.js +87 -0
- package/dist/bundled/stores/command.js +25 -0
- package/dist/bundled/stores/events.js +29 -0
- package/dist/bundled/stores/folder.js +54 -0
- package/dist/bundled/stores/preview-settings.js +19 -0
- package/dist/bundled/stores/story.js +43 -0
- package/dist/bundled/util/commands.js +57 -0
- package/dist/bundled/util/config.js +8 -0
- package/dist/bundled/util/const.js +10 -0
- package/dist/bundled/util/dark.js +28 -0
- package/dist/bundled/util/docs.js +26 -0
- package/dist/bundled/util/env.js +4 -0
- package/dist/bundled/util/events.js +33 -0
- package/dist/bundled/util/keyboard.js +90 -0
- package/dist/bundled/util/mapping.js +70 -0
- package/dist/bundled/util/open-in-editor.js +7 -0
- package/dist/bundled/util/preview-settings.js +21 -0
- package/dist/bundled/util/responsive.js +6 -0
- package/dist/bundled/util/sandbox.js +11 -0
- package/dist/bundled/util/scroll.js +31 -0
- package/dist/bundled/util/select.js +28 -0
- package/dist/bundled/util/state.js +41 -0
- package/dist/bundled/util/tooltip.js +15 -0
- package/dist/bundled/util/variant.js +21 -0
- package/dist/style.css +2853 -0
- package/package.json +62 -0
- package/postcss-scope-wrapper.cjs +35 -0
- package/postcss.config.cjs +9 -0
- package/scripts/copy.mjs +12 -0
- package/scripts/watchAndCopy.mjs +15 -0
- package/src/app/App.vue +172 -0
- package/src/app/api.ts +9 -0
- package/src/app/assets/histoire-text-dark.svg +89 -0
- package/src/app/assets/histoire-text.svg +89 -0
- package/src/app/assets/histoire.svg +51 -0
- package/src/app/components/HomeView.vue +61 -0
- package/src/app/components/app/AppHeader.vue +65 -0
- package/src/app/components/app/AppLogo.vue +25 -0
- package/src/app/components/app/Breadcrumb.vue +98 -0
- package/src/app/components/app/HomeCounter.vue +39 -0
- package/src/app/components/app/InitialLoading.vue +44 -0
- package/src/app/components/app/MobileOverlay.vue +33 -0
- package/src/app/components/base/BaseButton.vue +33 -0
- package/src/app/components/base/BaseCheckbox.vue +76 -0
- package/src/app/components/base/BaseCopyIcon.vue +34 -0
- package/src/app/components/base/BaseEmpty.vue +21 -0
- package/src/app/components/base/BaseIcon.vue +31 -0
- package/src/app/components/base/BaseKeyboardShortcut.vue +16 -0
- package/src/app/components/base/BaseListItem.vue +30 -0
- package/src/app/components/base/BaseListItemLink.vue +56 -0
- package/src/app/components/base/BaseOverflowMenu.vue +119 -0
- package/src/app/components/base/BaseOverflowTab.vue +47 -0
- package/src/app/components/base/BaseSelect.vue +75 -0
- package/src/app/components/base/BaseSplitPane.vue +244 -0
- package/src/app/components/base/BaseTab.vue +47 -0
- package/src/app/components/base/BaseTag.vue +5 -0
- package/src/app/components/command/CommandPrompts.vue +95 -0
- package/src/app/components/command/CommandPromptsModal.vue +41 -0
- package/src/app/components/command/PromptSelect.vue +142 -0
- package/src/app/components/command/PromptText.vue +65 -0
- package/src/app/components/misc/CheckerboardPattern.vue +32 -0
- package/src/app/components/misc/HatchedPattern.vue +13 -0
- package/src/app/components/panel/ControlsComponentPropItem.vue +73 -0
- package/src/app/components/panel/ControlsComponentProps.vue +34 -0
- package/src/app/components/panel/ControlsComponentState.vue +38 -0
- package/src/app/components/panel/ControlsComponentStateItem.vue +44 -0
- package/src/app/components/panel/PaneTabs.vue +84 -0
- package/src/app/components/panel/StatePresets.vue +199 -0
- package/src/app/components/panel/StoryControls.vue +97 -0
- package/src/app/components/panel/StoryDocs.vue +202 -0
- package/src/app/components/panel/StoryEvent.vue +54 -0
- package/src/app/components/panel/StoryEvents.vue +48 -0
- package/src/app/components/panel/StorySidePanel.vue +76 -0
- package/src/app/components/panel/StorySourceCode.vue +248 -0
- package/src/app/components/search/SearchItem.vue +89 -0
- package/src/app/components/search/SearchItemContent.vue +67 -0
- package/src/app/components/search/SearchLoading.vue +16 -0
- package/src/app/components/search/SearchModal.vue +44 -0
- package/src/app/components/search/SearchPane.vue +319 -0
- package/src/app/components/search/search-docs-data.ts +9 -0
- package/src/app/components/search/search-title-data.ts +9 -0
- package/src/app/components/search/types.ts +4 -0
- package/src/app/components/story/GenericMountStory.vue +35 -0
- package/src/app/components/story/GenericRenderStory.vue +41 -0
- package/src/app/components/story/StoryResponsivePreview.vue +216 -0
- package/src/app/components/story/StoryVariantGrid.vue +169 -0
- package/src/app/components/story/StoryVariantGridItem.vue +163 -0
- package/src/app/components/story/StoryVariantListItem.vue +52 -0
- package/src/app/components/story/StoryVariantSingle.vue +105 -0
- package/src/app/components/story/StoryVariantSinglePreviewNative.vue +66 -0
- package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +143 -0
- package/src/app/components/story/StoryVariantSingleView.vue +61 -0
- package/src/app/components/story/StoryView.vue +110 -0
- package/src/app/components/story/StoryViewer.vue +52 -0
- package/src/app/components/toolbar/DevOnlyToolbarOpenInEditor.vue +23 -0
- package/src/app/components/toolbar/ToolbarBackground.vue +81 -0
- package/src/app/components/toolbar/ToolbarNewTab.vue +29 -0
- package/src/app/components/toolbar/ToolbarResponsiveSize.vue +82 -0
- package/src/app/components/toolbar/ToolbarTextDirection.vue +19 -0
- package/src/app/components/toolbar/ToolbarTitle.vue +21 -0
- package/src/app/components/tree/StoryGroup.vue +73 -0
- package/src/app/components/tree/StoryList.vue +35 -0
- package/src/app/components/tree/StoryListFolder.vue +88 -0
- package/src/app/components/tree/StoryListItem.vue +72 -0
- package/src/app/index.ts +33 -0
- package/src/app/plugin.ts +59 -0
- package/src/app/router.ts +29 -0
- package/src/app/sandbox.ts +101 -0
- package/src/app/stores/command.ts +26 -0
- package/src/app/stores/events.ts +36 -0
- package/src/app/stores/folder.ts +63 -0
- package/src/app/stores/preview-settings.ts +18 -0
- package/src/app/stores/story.ts +47 -0
- package/src/app/style/floating.pcss +34 -0
- package/src/app/style/main.pcss +100 -0
- package/src/app/style/sandbox.css +24 -0
- package/src/app/style/transitions.pcss +51 -0
- package/src/app/types.ts +72 -0
- package/src/app/util/commands.ts +57 -0
- package/src/app/util/config.ts +5 -0
- package/src/app/util/const.ts +4 -0
- package/src/app/util/dark.ts +27 -0
- package/src/app/util/docs.ts +27 -0
- package/src/app/util/env.ts +1 -0
- package/src/app/util/events.ts +31 -0
- package/src/app/util/keyboard.ts +103 -0
- package/src/app/util/mapping.ts +80 -0
- package/src/app/util/open-in-editor.ts +3 -0
- package/src/app/util/preview-settings.ts +23 -0
- package/src/app/util/responsive.ts +3 -0
- package/src/app/util/sandbox.ts +9 -0
- package/src/app/util/scroll.ts +32 -0
- package/src/app/util/select.ts +30 -0
- package/src/app/util/state.ts +45 -0
- package/src/app/util/tooltip.ts +13 -0
- package/src/app/util/variant.ts +21 -0
- package/src/bundle-index.js +1 -0
- package/src/bundle-main-dev.js +4 -0
- package/src/bundle-main.js +5 -0
- package/src/bundle-sandbox-dev.js +2 -0
- package/src/bundle-sandbox.js +2 -0
- package/src/index.ts +1 -0
- package/src/shim.d.ts +10 -0
- package/src/virtual.d.ts +7 -0
- package/tailwind.config.cjs +137 -0
- package/tsconfig.json +53 -0
- package/vite.config.ts +88 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, createElementBlock, openBlock, createCommentVNode, createElementVNode, unref, createVNode, createBlock, normalizeStyle, Fragment, renderList } from "@histoire/vendors/vue";
|
|
2
|
+
import { useResizeObserver } from "@histoire/vendors/vue-use";
|
|
3
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
4
|
+
import { isMobile } from "../../util/responsive.js";
|
|
5
|
+
import "../toolbar/DevOnlyToolbarOpenInEditor.vue.js";
|
|
6
|
+
import ToolbarBackground from "../toolbar/ToolbarBackground.vue.js";
|
|
7
|
+
import "../toolbar/ToolbarTextDirection.vue.js";
|
|
8
|
+
import StoryVariantGridItem from "./StoryVariantGridItem.vue.js";
|
|
9
|
+
import _sfc_main$1 from "../toolbar/ToolbarTextDirection.vue2.js";
|
|
10
|
+
import _sfc_main$2 from "../toolbar/DevOnlyToolbarOpenInEditor.vue2.js";
|
|
11
|
+
"use strict";
|
|
12
|
+
const _hoisted_1 = { class: "histoire-story-variant-grid htw-flex htw-flex-col htw-items-stretch htw-h-full __histoire-pane-shadow-from-right" };
|
|
13
|
+
const _hoisted_2 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "htw-flex-none htw-flex htw-items-center htw-justify-end htw-h-8 htw-mx-2 htw-mt-1"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_3 = { class: "htw-flex htw-w-0 htw-flex-1 htw-mx-4" };
|
|
18
|
+
const margin = 16;
|
|
19
|
+
const gap = 16;
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
__name: "StoryVariantGrid",
|
|
22
|
+
setup(__props) {
|
|
23
|
+
const storyStore = useStoryStore();
|
|
24
|
+
const gridTemplateWidth = computed(() => {
|
|
25
|
+
if (storyStore.currentStory.layout.type !== "grid") {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const layoutWidth = storyStore.currentStory.layout.width;
|
|
29
|
+
if (!layoutWidth) {
|
|
30
|
+
return "200px";
|
|
31
|
+
}
|
|
32
|
+
if (typeof layoutWidth === "number") {
|
|
33
|
+
return `${layoutWidth}px`;
|
|
34
|
+
}
|
|
35
|
+
return layoutWidth;
|
|
36
|
+
});
|
|
37
|
+
const itemWidth = ref(16);
|
|
38
|
+
const maxItemHeight = ref(0);
|
|
39
|
+
const maxCount = ref(10);
|
|
40
|
+
const countPerRow = ref(0);
|
|
41
|
+
const visibleRows = ref(0);
|
|
42
|
+
const el = ref(null);
|
|
43
|
+
useResizeObserver(el, () => {
|
|
44
|
+
updateMaxCount();
|
|
45
|
+
updateSize();
|
|
46
|
+
});
|
|
47
|
+
function updateMaxCount() {
|
|
48
|
+
if (!maxItemHeight.value) return;
|
|
49
|
+
const width = el.value.clientWidth - margin * 2;
|
|
50
|
+
const height = el.value.clientHeight;
|
|
51
|
+
const scrollTop = el.value.scrollTop;
|
|
52
|
+
countPerRow.value = Math.floor((width + gap) / (itemWidth.value + gap));
|
|
53
|
+
visibleRows.value = Math.ceil((height + scrollTop + gap) / (maxItemHeight.value + gap));
|
|
54
|
+
const newMaxCount = countPerRow.value * visibleRows.value;
|
|
55
|
+
if (maxCount.value < newMaxCount) {
|
|
56
|
+
maxCount.value = newMaxCount;
|
|
57
|
+
}
|
|
58
|
+
if (storyStore.currentVariant) {
|
|
59
|
+
const index = storyStore.currentStory.variants.indexOf(storyStore.currentVariant);
|
|
60
|
+
if (index + 1 > maxCount.value) {
|
|
61
|
+
maxCount.value = index + 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function onItemResize(w, h) {
|
|
66
|
+
itemWidth.value = w;
|
|
67
|
+
if (maxItemHeight.value < h) {
|
|
68
|
+
maxItemHeight.value = h;
|
|
69
|
+
updateMaxCount();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
watch(() => storyStore.currentVariant, () => {
|
|
73
|
+
maxItemHeight.value = 0;
|
|
74
|
+
updateMaxCount();
|
|
75
|
+
});
|
|
76
|
+
const gridEl = ref(null);
|
|
77
|
+
const gridColumnWidth = ref(1);
|
|
78
|
+
const viewWidth = ref(1);
|
|
79
|
+
function updateSize() {
|
|
80
|
+
if (!el.value) return;
|
|
81
|
+
viewWidth.value = el.value.clientWidth;
|
|
82
|
+
if (!gridEl.value) return;
|
|
83
|
+
if (gridTemplateWidth.value.endsWith("%")) {
|
|
84
|
+
gridColumnWidth.value = viewWidth.value * Number.parseInt(gridTemplateWidth.value) / 100 - gap;
|
|
85
|
+
} else {
|
|
86
|
+
gridColumnWidth.value = Number.parseInt(gridTemplateWidth.value);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
onMounted(() => {
|
|
90
|
+
updateSize();
|
|
91
|
+
});
|
|
92
|
+
useResizeObserver(gridEl, () => {
|
|
93
|
+
updateSize();
|
|
94
|
+
});
|
|
95
|
+
const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))));
|
|
96
|
+
return (_ctx, _cache) => {
|
|
97
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
98
|
+
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
99
|
+
createVNode(ToolbarBackground),
|
|
100
|
+
createVNode(_sfc_main$1),
|
|
101
|
+
_ctx.__HISTOIRE_DEV__ ? (openBlock(), createBlock(_sfc_main$2, {
|
|
102
|
+
key: 0,
|
|
103
|
+
file: unref(storyStore).currentStory.file?.filePath,
|
|
104
|
+
tooltip: "Edit story in editor"
|
|
105
|
+
}, null, 8, ["file"])) : createCommentVNode("", true)
|
|
106
|
+
])) : createCommentVNode("", true),
|
|
107
|
+
createElementVNode("div", {
|
|
108
|
+
ref_key: "el",
|
|
109
|
+
ref: el,
|
|
110
|
+
class: "htw-overflow-y-auto htw-flex htw-flex-1",
|
|
111
|
+
onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
|
|
112
|
+
}, [
|
|
113
|
+
createElementVNode("div", _hoisted_3, [
|
|
114
|
+
createElementVNode("div", {
|
|
115
|
+
class: "htw-m-auto",
|
|
116
|
+
style: normalizeStyle({
|
|
117
|
+
minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
|
|
118
|
+
})
|
|
119
|
+
}, [
|
|
120
|
+
createElementVNode("div", {
|
|
121
|
+
ref_key: "gridEl",
|
|
122
|
+
ref: gridEl,
|
|
123
|
+
class: "htw-grid htw-gap-4 htw-my-4",
|
|
124
|
+
style: normalizeStyle({
|
|
125
|
+
gridTemplateColumns: `repeat(${columnCount.value}, ${gridColumnWidth.value}px)`
|
|
126
|
+
})
|
|
127
|
+
}, [
|
|
128
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
|
|
129
|
+
return openBlock(), createBlock(StoryVariantGridItem, {
|
|
130
|
+
key: index,
|
|
131
|
+
variant,
|
|
132
|
+
story: unref(storyStore).currentStory,
|
|
133
|
+
onResize: onItemResize
|
|
134
|
+
}, null, 8, ["variant", "story"]);
|
|
135
|
+
}), 128))
|
|
136
|
+
], 4)
|
|
137
|
+
], 4)
|
|
138
|
+
])
|
|
139
|
+
], 544)
|
|
140
|
+
]);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
export {
|
|
145
|
+
_sfc_main as default
|
|
146
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./StoryVariantGridItem.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-feff9239"]]);
|
|
6
|
+
export {
|
|
7
|
+
StoryVariantGridItem as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, unref, toRefs, ref, computed, resolveComponent, resolveDirective, createElementBlock, openBlock, createElementVNode, withDirectives, createBlock, normalizeClass, withCtx, createVNode, toDisplayString, withModifiers, createCommentVNode, normalizeStyle } from "@histoire/vendors/vue";
|
|
2
|
+
import { HstCopyIcon } from "@histoire/controls";
|
|
3
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
4
|
+
import { useResizeObserver } from "@histoire/vendors/vue-use";
|
|
5
|
+
import { useRouter } from "@histoire/vendors/vue-router";
|
|
6
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
7
|
+
import { histoireConfig } from "../../util/config.js";
|
|
8
|
+
import { isDark } from "../../util/dark.js";
|
|
9
|
+
import { getSourceCode } from "../../util/docs.js";
|
|
10
|
+
import { getContrastColor } from "../../util/preview-settings.js";
|
|
11
|
+
import { useScrollOnActive } from "../../util/scroll.js";
|
|
12
|
+
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
13
|
+
import CheckerboardPattern from "../misc/CheckerboardPattern.vue.js";
|
|
14
|
+
import "../toolbar/ToolbarNewTab.vue.js";
|
|
15
|
+
import "./GenericRenderStory.vue.js";
|
|
16
|
+
import _sfc_main$1 from "../toolbar/ToolbarNewTab.vue2.js";
|
|
17
|
+
import _sfc_main$2 from "./GenericRenderStory.vue2.js";
|
|
18
|
+
"use strict";
|
|
19
|
+
const _hoisted_1 = { class: "htw-flex-none htw-flex htw-items-center" };
|
|
20
|
+
const _hoisted_2 = { class: "htw-truncate htw-flex-1" };
|
|
21
|
+
const _hoisted_3 = { class: "htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center" };
|
|
22
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
23
|
+
__name: "StoryVariantGridItem",
|
|
24
|
+
props: {
|
|
25
|
+
variant: {
|
|
26
|
+
type: Object,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
story: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
emits: {
|
|
35
|
+
resize: (_width, _height) => true
|
|
36
|
+
},
|
|
37
|
+
setup(__props, { emit: __emit }) {
|
|
38
|
+
useCssVars((_ctx) => ({
|
|
39
|
+
"v60afaf4d": unref(variant).iconColor,
|
|
40
|
+
"v3bd99e7e": unref(settings).backgroundColor
|
|
41
|
+
}));
|
|
42
|
+
const props = __props;
|
|
43
|
+
const emit = __emit;
|
|
44
|
+
const { variant } = toRefs(props);
|
|
45
|
+
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
46
|
+
Object.assign(props.variant, {
|
|
47
|
+
previewReady: false
|
|
48
|
+
});
|
|
49
|
+
function onReady() {
|
|
50
|
+
Object.assign(props.variant, {
|
|
51
|
+
previewReady: true
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const router = useRouter();
|
|
55
|
+
function selectVariant() {
|
|
56
|
+
router.push(targetRoute.value);
|
|
57
|
+
}
|
|
58
|
+
const el = ref();
|
|
59
|
+
const { autoScroll } = useScrollOnActive(isActive, el);
|
|
60
|
+
useResizeObserver(el, () => {
|
|
61
|
+
if (props.variant.previewReady) {
|
|
62
|
+
emit("resize", el.value.clientWidth, el.value.clientHeight);
|
|
63
|
+
if (isActive.value) {
|
|
64
|
+
autoScroll();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
69
|
+
const contrastColor = computed(() => getContrastColor(settings));
|
|
70
|
+
const autoApplyContrastColor = computed(() => !!histoireConfig.autoApplyContrastColor);
|
|
71
|
+
return (_ctx, _cache) => {
|
|
72
|
+
const _component_RouterLink = resolveComponent("RouterLink");
|
|
73
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
74
|
+
return openBlock(), createElementBlock("div", {
|
|
75
|
+
ref_key: "el",
|
|
76
|
+
ref: el,
|
|
77
|
+
class: "histoire-story-variant-grid-item htw-cursor-default htw-flex htw-flex-col htw-gap-y-1 htw-group"
|
|
78
|
+
}, [
|
|
79
|
+
createElementVNode("div", _hoisted_1, [
|
|
80
|
+
withDirectives((openBlock(), createBlock(_component_RouterLink, {
|
|
81
|
+
to: unref(targetRoute),
|
|
82
|
+
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 htw-flex-shrink", {
|
|
83
|
+
"hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800": !unref(isActive),
|
|
84
|
+
"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)
|
|
85
|
+
}])
|
|
86
|
+
}, {
|
|
87
|
+
default: withCtx(() => [
|
|
88
|
+
createVNode(unref(Icon), {
|
|
89
|
+
icon: unref(variant).icon ?? "carbon:cube",
|
|
90
|
+
class: normalizeClass(["htw-w-4 htw-h-4 htw-opacity-50", {
|
|
91
|
+
"htw-text-gray-500": !unref(isActive) && !unref(variant).iconColor,
|
|
92
|
+
"bind-icon-color": !unref(isActive) && unref(variant).iconColor
|
|
93
|
+
}])
|
|
94
|
+
}, null, 8, ["icon", "class"]),
|
|
95
|
+
createElementVNode("span", _hoisted_2, toDisplayString(unref(variant).title), 1)
|
|
96
|
+
]),
|
|
97
|
+
_: 1
|
|
98
|
+
}, 8, ["to", "class"])), [
|
|
99
|
+
[_directive_tooltip, unref(variant).title]
|
|
100
|
+
]),
|
|
101
|
+
createElementVNode("div", _hoisted_3, [
|
|
102
|
+
createVNode(unref(HstCopyIcon), {
|
|
103
|
+
content: () => unref(getSourceCode)(__props.story, unref(variant))
|
|
104
|
+
}, null, 8, ["content"]),
|
|
105
|
+
createVNode(_sfc_main$1, {
|
|
106
|
+
variant: unref(variant),
|
|
107
|
+
story: __props.story
|
|
108
|
+
}, null, 8, ["variant", "story"])
|
|
109
|
+
])
|
|
110
|
+
]),
|
|
111
|
+
createElementVNode("div", {
|
|
112
|
+
class: normalizeClass(["htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded htw-flex-1 htw-p-4 htw-relative", {
|
|
113
|
+
"htw-border-gray-100 dark:htw-border-gray-800": !unref(isActive),
|
|
114
|
+
"htw-border-primary-200 dark:htw-border-primary-900": unref(isActive)
|
|
115
|
+
}]),
|
|
116
|
+
"data-test-id": "sandbox-render",
|
|
117
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop"])),
|
|
118
|
+
onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
|
|
119
|
+
}, [
|
|
120
|
+
_cache[2] || (_cache[2] = createElementVNode("div", {
|
|
121
|
+
class: "htw-absolute htw-inset-0 htw-rounded bind-preview-bg",
|
|
122
|
+
"data-test-id": "responsive-preview-bg"
|
|
123
|
+
}, null, -1)),
|
|
124
|
+
unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
|
|
125
|
+
key: 0,
|
|
126
|
+
class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
127
|
+
})) : createCommentVNode("", true),
|
|
128
|
+
createElementVNode("div", {
|
|
129
|
+
class: "htw-relative htw-h-full",
|
|
130
|
+
style: normalizeStyle({
|
|
131
|
+
"--histoire-contrast-color": contrastColor.value,
|
|
132
|
+
"color": autoApplyContrastColor.value ? contrastColor.value : void 0
|
|
133
|
+
})
|
|
134
|
+
}, [
|
|
135
|
+
(openBlock(), createBlock(_sfc_main$2, {
|
|
136
|
+
key: `${__props.story.id}-${unref(variant).id}`,
|
|
137
|
+
variant: unref(variant),
|
|
138
|
+
story: __props.story,
|
|
139
|
+
dir: unref(settings).textDirection,
|
|
140
|
+
class: normalizeClass({
|
|
141
|
+
[unref(histoireConfig).theme.darkClass]: unref(isDark)
|
|
142
|
+
}),
|
|
143
|
+
onReady
|
|
144
|
+
}, null, 8, ["variant", "story", "dir", "class"]))
|
|
145
|
+
], 4)
|
|
146
|
+
], 34)
|
|
147
|
+
], 512);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
export {
|
|
152
|
+
_sfc_main as default
|
|
153
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./StoryVariantListItem.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1b279b85"]]);
|
|
6
|
+
export {
|
|
7
|
+
StoryVariantListItem as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, unref, toRefs, ref, createElementBlock, openBlock, createVNode, withCtx, createElementVNode, normalizeClass, toDisplayString } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { useScrollOnActive } from "../../util/scroll.js";
|
|
4
|
+
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
5
|
+
import BaseListItemLink from "../base/BaseListItemLink.vue.js";
|
|
6
|
+
"use strict";
|
|
7
|
+
const _hoisted_1 = { class: "htw-truncate" };
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "StoryVariantListItem",
|
|
10
|
+
props: {
|
|
11
|
+
variant: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: true
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
setup(__props) {
|
|
17
|
+
useCssVars((_ctx) => ({
|
|
18
|
+
"ab2181a2": unref(variant).iconColor
|
|
19
|
+
}));
|
|
20
|
+
const props = __props;
|
|
21
|
+
const { variant } = toRefs(props);
|
|
22
|
+
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
23
|
+
const el = ref();
|
|
24
|
+
useScrollOnActive(isActive, el);
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock("div", {
|
|
27
|
+
ref_key: "el",
|
|
28
|
+
ref: el,
|
|
29
|
+
class: "histoire-story-variant-list-item",
|
|
30
|
+
"data-test-id": "story-variant-list-item"
|
|
31
|
+
}, [
|
|
32
|
+
createVNode(BaseListItemLink, {
|
|
33
|
+
to: unref(targetRoute),
|
|
34
|
+
"is-active": unref(isActive),
|
|
35
|
+
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"
|
|
36
|
+
}, {
|
|
37
|
+
default: withCtx(({ active }) => [
|
|
38
|
+
createVNode(unref(Icon), {
|
|
39
|
+
icon: unref(variant).icon ?? "carbon:cube",
|
|
40
|
+
class: normalizeClass(["htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none", {
|
|
41
|
+
"htw-text-gray-500": !active && !unref(variant).iconColor,
|
|
42
|
+
"bind-icon-color": !active && unref(variant).iconColor
|
|
43
|
+
}])
|
|
44
|
+
}, null, 8, ["icon", "class"]),
|
|
45
|
+
createElementVNode("span", _hoisted_1, toDisplayString(unref(variant).title), 1)
|
|
46
|
+
]),
|
|
47
|
+
_: 1
|
|
48
|
+
}, 8, ["to", "is-active"])
|
|
49
|
+
], 512);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
_sfc_main as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./StoryVariantSingle.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c2a43485"]]);
|
|
6
|
+
export {
|
|
7
|
+
StoryVariantSingle as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, computed, createElementBlock, openBlock, createVNode, unref, Fragment, createBlock, createElementVNode, createCommentVNode, createTextVNode, normalizeClass, toDisplayString, withCtx, renderList } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
4
|
+
import { isMobile } from "../../util/responsive.js";
|
|
5
|
+
import BaseSplitPane from "../base/BaseSplitPane.vue.js";
|
|
6
|
+
import StoryVariantListItem from "./StoryVariantListItem.vue.js";
|
|
7
|
+
import "./StoryVariantSingleView.vue.js";
|
|
8
|
+
import _sfc_main$1 from "./StoryVariantSingleView.vue2.js";
|
|
9
|
+
"use strict";
|
|
10
|
+
const _hoisted_1 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "histoire-story-variant-single htw-p-2 htw-h-full __histoire-pane-shadow-from-right"
|
|
13
|
+
};
|
|
14
|
+
const _hoisted_2 = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_3 = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "htw-p-2 htw-h-full"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_4 = { class: "htw-h-full htw-overflow-y-auto" };
|
|
23
|
+
const _hoisted_5 = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "htw-p-2 htw-h-full __histoire-pane-shadow-from-right"
|
|
26
|
+
};
|
|
27
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
28
|
+
__name: "StoryVariantSingle",
|
|
29
|
+
emits: {
|
|
30
|
+
openVariantMenu: () => true
|
|
31
|
+
},
|
|
32
|
+
setup(__props) {
|
|
33
|
+
useCssVars((_ctx) => ({
|
|
34
|
+
"v41c4d268": variant.value?.iconColor
|
|
35
|
+
}));
|
|
36
|
+
const storyStore = useStoryStore();
|
|
37
|
+
const hasSingleVariant = computed(() => storyStore.currentStory?.variants.length === 1);
|
|
38
|
+
const variant = computed(() => storyStore.currentVariant);
|
|
39
|
+
return (_ctx, _cache) => {
|
|
40
|
+
return hasSingleVariant.value && variant.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
41
|
+
createVNode(_sfc_main$1, {
|
|
42
|
+
variant: variant.value,
|
|
43
|
+
story: unref(storyStore).currentStory
|
|
44
|
+
}, null, 8, ["variant", "story"])
|
|
45
|
+
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
46
|
+
unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
47
|
+
createElementVNode("a", {
|
|
48
|
+
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",
|
|
49
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("openVariantMenu"))
|
|
50
|
+
}, [
|
|
51
|
+
variant.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
52
|
+
createVNode(unref(Icon), {
|
|
53
|
+
icon: variant.value.icon ?? "carbon:cube",
|
|
54
|
+
class: normalizeClass(["htw-w-5 htw-h-5 htw-flex-none", {
|
|
55
|
+
"htw-text-gray-500": !variant.value.iconColor,
|
|
56
|
+
"bind-icon-color": variant.value.iconColor
|
|
57
|
+
}])
|
|
58
|
+
}, null, 8, ["icon", "class"]),
|
|
59
|
+
createTextVNode(" " + toDisplayString(variant.value.title), 1)
|
|
60
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
61
|
+
createTextVNode(" Select a variant... ")
|
|
62
|
+
], 64)),
|
|
63
|
+
createVNode(unref(Icon), {
|
|
64
|
+
icon: "carbon:chevron-sort",
|
|
65
|
+
class: "htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
66
|
+
})
|
|
67
|
+
]),
|
|
68
|
+
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
69
|
+
createVNode(_sfc_main$1, {
|
|
70
|
+
variant: unref(storyStore).currentVariant,
|
|
71
|
+
story: unref(storyStore).currentStory
|
|
72
|
+
}, null, 8, ["variant", "story"])
|
|
73
|
+
])) : createCommentVNode("", true)
|
|
74
|
+
])) : (openBlock(), createBlock(BaseSplitPane, {
|
|
75
|
+
key: 1,
|
|
76
|
+
"save-id": "story-single-main-split",
|
|
77
|
+
min: 5,
|
|
78
|
+
max: 40,
|
|
79
|
+
"default-split": 17
|
|
80
|
+
}, {
|
|
81
|
+
first: withCtx(() => [
|
|
82
|
+
createElementVNode("div", _hoisted_4, [
|
|
83
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (v, index) => {
|
|
84
|
+
return openBlock(), createBlock(StoryVariantListItem, {
|
|
85
|
+
key: index,
|
|
86
|
+
variant: v
|
|
87
|
+
}, null, 8, ["variant"]);
|
|
88
|
+
}), 128))
|
|
89
|
+
])
|
|
90
|
+
]),
|
|
91
|
+
last: withCtx(() => [
|
|
92
|
+
unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
93
|
+
createVNode(_sfc_main$1, {
|
|
94
|
+
variant: unref(storyStore).currentVariant,
|
|
95
|
+
story: unref(storyStore).currentStory
|
|
96
|
+
}, null, 8, ["variant", "story"])
|
|
97
|
+
])) : createCommentVNode("", true)
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
}))
|
|
101
|
+
], 64));
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export {
|
|
106
|
+
_sfc_main as default
|
|
107
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineComponent, computed, createBlock, openBlock, withCtx, createElementVNode, normalizeStyle, unref, normalizeClass } from "@histoire/vendors/vue";
|
|
2
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
3
|
+
import { histoireConfig } from "../../util/config.js";
|
|
4
|
+
import { isDark } from "../../util/dark.js";
|
|
5
|
+
import { getContrastColor } from "../../util/preview-settings.js";
|
|
6
|
+
import "./GenericRenderStory.vue.js";
|
|
7
|
+
import StoryResponsivePreview from "./StoryResponsivePreview.vue.js";
|
|
8
|
+
import _sfc_main$1 from "./GenericRenderStory.vue2.js";
|
|
9
|
+
"use strict";
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
__name: "StoryVariantSinglePreviewNative",
|
|
12
|
+
props: {
|
|
13
|
+
story: {},
|
|
14
|
+
variant: {}
|
|
15
|
+
},
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
Object.assign(props.variant, {
|
|
19
|
+
previewReady: false
|
|
20
|
+
});
|
|
21
|
+
function onReady() {
|
|
22
|
+
Object.assign(props.variant, {
|
|
23
|
+
previewReady: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
27
|
+
const contrastColor = computed(() => getContrastColor(settings));
|
|
28
|
+
const autoApplyContrastColor = computed(() => !!histoireConfig.autoApplyContrastColor);
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
return openBlock(), createBlock(StoryResponsivePreview, {
|
|
31
|
+
class: "histoire-story-variant-single-preview-native",
|
|
32
|
+
variant: __props.variant
|
|
33
|
+
}, {
|
|
34
|
+
default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight }) => [
|
|
35
|
+
createElementVNode("div", {
|
|
36
|
+
style: normalizeStyle([
|
|
37
|
+
isResponsiveEnabled ? {
|
|
38
|
+
width: finalWidth ? `${finalWidth}px` : "100%",
|
|
39
|
+
height: finalHeight ? `${finalHeight}px` : "100%"
|
|
40
|
+
} : { width: "100%", height: "100%" },
|
|
41
|
+
{
|
|
42
|
+
"--histoire-contrast-color": contrastColor.value,
|
|
43
|
+
"color": autoApplyContrastColor.value ? contrastColor.value : void 0
|
|
44
|
+
}
|
|
45
|
+
]),
|
|
46
|
+
class: "htw-relative",
|
|
47
|
+
"data-test-id": "sandbox-render"
|
|
48
|
+
}, [
|
|
49
|
+
(openBlock(), createBlock(_sfc_main$1, {
|
|
50
|
+
key: `${__props.story.id}-${__props.variant.id}`,
|
|
51
|
+
variant: __props.variant,
|
|
52
|
+
story: __props.story,
|
|
53
|
+
class: normalizeClass(["htw-h-full", {
|
|
54
|
+
[unref(histoireConfig).sandboxDarkClass]: unref(isDark),
|
|
55
|
+
// @TODO remove
|
|
56
|
+
[unref(histoireConfig).theme.darkClass]: unref(isDark)
|
|
57
|
+
}]),
|
|
58
|
+
dir: unref(settings).textDirection,
|
|
59
|
+
onReady
|
|
60
|
+
}, null, 8, ["variant", "story", "class", "dir"]))
|
|
61
|
+
], 4)
|
|
62
|
+
]),
|
|
63
|
+
_: 1
|
|
64
|
+
}, 8, ["variant"]);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export {
|
|
69
|
+
_sfc_main as default
|
|
70
|
+
};
|