@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,272 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, computed, createElementBlock, openBlock, Fragment, createElementVNode, createBlock, createCommentVNode, createVNode, withDirectives, unref, withKeys, withModifiers, vModelText, withCtx, createTextVNode, renderList } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { useFocus, useDebounce } from "@histoire/vendors/vue-use";
|
|
4
|
+
import Fuse from "fuse.js";
|
|
5
|
+
import { registeredCommands } from "../../_virtual/histoire-commands.js";
|
|
6
|
+
import { useCommandStore } from "../../stores/command.js";
|
|
7
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
8
|
+
import { getCommandContext, builtinCommands } from "../../util/commands.js";
|
|
9
|
+
import { useSelection } from "../../util/select.js";
|
|
10
|
+
import BaseEmpty from "../base/BaseEmpty.vue.js";
|
|
11
|
+
import { onUpdate, searchData } from "./search-title-data.js";
|
|
12
|
+
import SearchItem from "./SearchItem.vue.js";
|
|
13
|
+
"use strict";
|
|
14
|
+
const _hoisted_1 = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "htw-max-h-[400px] htw-overflow-y-auto htw-rounded-b-lg"
|
|
17
|
+
};
|
|
18
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "SearchPane",
|
|
20
|
+
props: {
|
|
21
|
+
shown: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
emits: {
|
|
27
|
+
close: () => true
|
|
28
|
+
},
|
|
29
|
+
setup(__props, { emit: __emit }) {
|
|
30
|
+
const DocSearchData = () => import("./search-docs-data.js");
|
|
31
|
+
const props = __props;
|
|
32
|
+
const emit = __emit;
|
|
33
|
+
function close() {
|
|
34
|
+
emit("close");
|
|
35
|
+
}
|
|
36
|
+
const input = ref();
|
|
37
|
+
const { focused } = useFocus(input, {
|
|
38
|
+
initialValue: true
|
|
39
|
+
});
|
|
40
|
+
watch(() => props.shown, (value) => {
|
|
41
|
+
if (value) {
|
|
42
|
+
requestAnimationFrame(() => {
|
|
43
|
+
focused.value = true;
|
|
44
|
+
input.value.select();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const searchInputText = ref("");
|
|
49
|
+
const rateLimitedSearch = useDebounce(searchInputText, 50);
|
|
50
|
+
const storyStore = useStoryStore();
|
|
51
|
+
let titleSearchIndex;
|
|
52
|
+
let titleIdMap;
|
|
53
|
+
function createIndex() {
|
|
54
|
+
return new Fuse([], {
|
|
55
|
+
keys: ["text"]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function loadSearchIndex(data) {
|
|
59
|
+
titleSearchIndex = createIndex();
|
|
60
|
+
for (const document of data.index) {
|
|
61
|
+
titleSearchIndex.add(document);
|
|
62
|
+
}
|
|
63
|
+
titleIdMap = data.idMap;
|
|
64
|
+
}
|
|
65
|
+
loadSearchIndex(searchData);
|
|
66
|
+
onUpdate((searchData2) => {
|
|
67
|
+
loadSearchIndex(searchData2);
|
|
68
|
+
});
|
|
69
|
+
let docSearchIndex;
|
|
70
|
+
let docIdMap;
|
|
71
|
+
async function loadDocSearchIndex() {
|
|
72
|
+
async function load(data) {
|
|
73
|
+
docSearchIndex = createIndex();
|
|
74
|
+
for (const document of data.index) {
|
|
75
|
+
docSearchIndex.add(document);
|
|
76
|
+
}
|
|
77
|
+
docIdMap = data.idMap;
|
|
78
|
+
if (rateLimitedSearch.value) {
|
|
79
|
+
await searchOnDocField(rateLimitedSearch.value);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const searchDataModule = await DocSearchData();
|
|
83
|
+
await load(searchDataModule.searchData);
|
|
84
|
+
searchDataModule.onUpdate((searchData2) => {
|
|
85
|
+
load(searchData2);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
loadDocSearchIndex();
|
|
89
|
+
const titleResults = ref([]);
|
|
90
|
+
watch(rateLimitedSearch, async (value) => {
|
|
91
|
+
const list = [];
|
|
92
|
+
const result = titleSearchIndex.search(value);
|
|
93
|
+
let rank = 0;
|
|
94
|
+
for (const document of result) {
|
|
95
|
+
const idMapData = titleIdMap[document.item.id];
|
|
96
|
+
if (!idMapData) continue;
|
|
97
|
+
switch (idMapData.kind) {
|
|
98
|
+
case "story": {
|
|
99
|
+
list.push(storyResultFactory(storyStore.getStoryById(idMapData.id), rank));
|
|
100
|
+
rank++;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case "variant": {
|
|
104
|
+
const [storyId] = idMapData.id.split(":");
|
|
105
|
+
const story = storyStore.getStoryById(storyId);
|
|
106
|
+
const variant = storyStore.getVariantById(idMapData.id);
|
|
107
|
+
list.push(variantResultFactory(story, variant, rank));
|
|
108
|
+
rank++;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
titleResults.value = list;
|
|
114
|
+
});
|
|
115
|
+
const docsResults = ref([]);
|
|
116
|
+
async function searchOnDocField(query) {
|
|
117
|
+
if (docSearchIndex) {
|
|
118
|
+
const list = [];
|
|
119
|
+
const result = docSearchIndex.search(query);
|
|
120
|
+
let rank = 0;
|
|
121
|
+
for (const document of result) {
|
|
122
|
+
const idMapData = docIdMap[document.item.id];
|
|
123
|
+
if (!idMapData) continue;
|
|
124
|
+
switch (idMapData.kind) {
|
|
125
|
+
case "story": {
|
|
126
|
+
list.push(storyResultFactory(storyStore.getStoryById(idMapData.id), rank, "docs"));
|
|
127
|
+
rank++;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
docsResults.value = list;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
watch(rateLimitedSearch, searchOnDocField);
|
|
136
|
+
function storyResultFactory(story, rank, type = "title") {
|
|
137
|
+
return {
|
|
138
|
+
kind: "story",
|
|
139
|
+
rank,
|
|
140
|
+
id: `story:${story.id}`,
|
|
141
|
+
title: story.title,
|
|
142
|
+
route: {
|
|
143
|
+
name: "story",
|
|
144
|
+
params: {
|
|
145
|
+
storyId: story.id
|
|
146
|
+
},
|
|
147
|
+
query: {
|
|
148
|
+
...type === "docs" ? { tab: "docs" } : {}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
path: story.file.path.slice(0, -1),
|
|
152
|
+
icon: story.icon,
|
|
153
|
+
iconColor: story.iconColor
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function variantResultFactory(story, variant, rank, type = "title") {
|
|
157
|
+
return {
|
|
158
|
+
kind: "variant",
|
|
159
|
+
rank,
|
|
160
|
+
id: `variant:${story.id}:${variant.id}`,
|
|
161
|
+
title: variant.title,
|
|
162
|
+
route: {
|
|
163
|
+
name: "story",
|
|
164
|
+
params: {
|
|
165
|
+
storyId: story.id
|
|
166
|
+
},
|
|
167
|
+
query: {
|
|
168
|
+
variantId: variant.id,
|
|
169
|
+
...type === "docs" ? { tab: "docs" } : {}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
path: [...story.file.path ?? [], story.title],
|
|
173
|
+
icon: variant.icon,
|
|
174
|
+
iconColor: variant.iconColor
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
const allCommands = [
|
|
178
|
+
...builtinCommands,
|
|
179
|
+
...registeredCommands
|
|
180
|
+
];
|
|
181
|
+
const commandResults = computed(() => {
|
|
182
|
+
if (__HISTOIRE_DEV__) {
|
|
183
|
+
const commandCtx = getCommandContext();
|
|
184
|
+
const searchText = searchInputText.value.toLowerCase();
|
|
185
|
+
return allCommands.filter((command) => !command.showIf || command.showIf(commandCtx)).filter((command) => command.label.toLowerCase().includes(searchText) || command.searchText?.toLowerCase().includes(searchText)).map((command) => commandResultFactory(command, 0));
|
|
186
|
+
}
|
|
187
|
+
return [];
|
|
188
|
+
});
|
|
189
|
+
const commandStore = useCommandStore();
|
|
190
|
+
function commandResultFactory(command, rank) {
|
|
191
|
+
return {
|
|
192
|
+
kind: "command",
|
|
193
|
+
rank,
|
|
194
|
+
id: `_command:${command.id}`,
|
|
195
|
+
title: command.label,
|
|
196
|
+
icon: command.icon ?? "carbon:chevron-right",
|
|
197
|
+
onActivate: () => {
|
|
198
|
+
commandStore.activateCommand(command);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const results = computed(() => {
|
|
203
|
+
const list = [
|
|
204
|
+
...commandResults.value,
|
|
205
|
+
...titleResults.value
|
|
206
|
+
];
|
|
207
|
+
const seen = {};
|
|
208
|
+
for (const r of titleResults.value) {
|
|
209
|
+
seen[r.id] = true;
|
|
210
|
+
}
|
|
211
|
+
for (const r of docsResults.value) {
|
|
212
|
+
if (!seen[r.id]) {
|
|
213
|
+
list.push(r);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return list;
|
|
217
|
+
});
|
|
218
|
+
const {
|
|
219
|
+
selectedIndex,
|
|
220
|
+
selectNext,
|
|
221
|
+
selectPrevious
|
|
222
|
+
} = useSelection(results);
|
|
223
|
+
return (_ctx, _cache) => {
|
|
224
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
225
|
+
createElementVNode("div", {
|
|
226
|
+
class: "histoire-search-pane htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500",
|
|
227
|
+
onClick: _cache[4] || (_cache[4] = ($event) => focused.value = true)
|
|
228
|
+
}, [
|
|
229
|
+
createVNode(unref(Icon), {
|
|
230
|
+
icon: "carbon:search",
|
|
231
|
+
class: "flex-none htw-w-4 htw-h-4"
|
|
232
|
+
}),
|
|
233
|
+
withDirectives(createElementVNode("input", {
|
|
234
|
+
ref_key: "input",
|
|
235
|
+
ref: input,
|
|
236
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchInputText.value = $event),
|
|
237
|
+
placeholder: "Search for stories, variants...",
|
|
238
|
+
class: "htw-bg-transparent htw-w-full htw-flex-1 htw-pl-0 htw-pr-6 htw-py-4 htw-outline-none",
|
|
239
|
+
onKeydown: [
|
|
240
|
+
_cache[1] || (_cache[1] = withKeys(withModifiers(($event) => unref(selectNext)(), ["prevent"]), ["down"])),
|
|
241
|
+
_cache[2] || (_cache[2] = withKeys(withModifiers(($event) => unref(selectPrevious)(), ["prevent"]), ["up"])),
|
|
242
|
+
_cache[3] || (_cache[3] = withKeys(($event) => close(), ["escape"]))
|
|
243
|
+
]
|
|
244
|
+
}, null, 544), [
|
|
245
|
+
[vModelText, searchInputText.value]
|
|
246
|
+
])
|
|
247
|
+
]),
|
|
248
|
+
unref(rateLimitedSearch) && !results.value.length ? (openBlock(), createBlock(BaseEmpty, {
|
|
249
|
+
key: 0,
|
|
250
|
+
class: "no-animation"
|
|
251
|
+
}, {
|
|
252
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [
|
|
253
|
+
createTextVNode(" No results ", -1)
|
|
254
|
+
])]),
|
|
255
|
+
_: 1
|
|
256
|
+
})) : results.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
257
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(results.value, (result, index) => {
|
|
258
|
+
return openBlock(), createBlock(SearchItem, {
|
|
259
|
+
key: result.id,
|
|
260
|
+
result,
|
|
261
|
+
selected: index === unref(selectedIndex),
|
|
262
|
+
onClose: _cache[5] || (_cache[5] = ($event) => close())
|
|
263
|
+
}, null, 8, ["result", "selected"]);
|
|
264
|
+
}), 128))
|
|
265
|
+
])) : createCommentVNode("", true)
|
|
266
|
+
], 64);
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
export {
|
|
271
|
+
_sfc_main as default
|
|
272
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { searchData as searchData$1, onUpdate as onUpdate$1 } from "../../_virtual/histoire-search-docs-data.js";
|
|
2
|
+
import { markRaw } from "@histoire/vendors/vue";
|
|
3
|
+
"use strict";
|
|
4
|
+
const searchData = markRaw(searchData$1);
|
|
5
|
+
function onUpdate(cb) {
|
|
6
|
+
onUpdate$1(cb);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
onUpdate,
|
|
10
|
+
searchData
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { searchData as searchData$1, onUpdate as onUpdate$1 } from "../../_virtual/histoire-search-title-data.js";
|
|
2
|
+
import { markRaw } from "@histoire/vendors/vue";
|
|
3
|
+
"use strict";
|
|
4
|
+
const searchData = markRaw(searchData$1);
|
|
5
|
+
function onUpdate(cb) {
|
|
6
|
+
onUpdate$1(cb);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
onUpdate,
|
|
10
|
+
searchData
|
|
11
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent, ref, watchEffect, markRaw, createBlock, createCommentVNode, openBlock, resolveDynamicComponent, mergeProps } from "@histoire/vendors/vue";
|
|
2
|
+
import { clientSupportPlugins } from "../../_virtual/histoire-support-plugins-client.js";
|
|
3
|
+
"use strict";
|
|
4
|
+
const __default__ = {
|
|
5
|
+
inheritAttrs: false
|
|
6
|
+
};
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
...__default__,
|
|
9
|
+
__name: "GenericMountStory",
|
|
10
|
+
props: {
|
|
11
|
+
story: {}
|
|
12
|
+
},
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const mountComponent = ref(null);
|
|
16
|
+
watchEffect(async () => {
|
|
17
|
+
const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
|
|
18
|
+
if (clientPlugin) {
|
|
19
|
+
const pluginModule = await clientPlugin();
|
|
20
|
+
mountComponent.value = markRaw(pluginModule.MountStory);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return mountComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(mountComponent.value), mergeProps({
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "histoire-generic-mount-story",
|
|
27
|
+
story: __props.story
|
|
28
|
+
}, _ctx.$attrs), null, 16, ["story"])) : createCommentVNode("", true);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
_sfc_main as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineComponent, ref, watchEffect, markRaw, createBlock, createCommentVNode, openBlock, resolveDynamicComponent, mergeProps } from "@histoire/vendors/vue";
|
|
2
|
+
import { clientSupportPlugins } from "../../_virtual/histoire-support-plugins-client.js";
|
|
3
|
+
"use strict";
|
|
4
|
+
const __default__ = {
|
|
5
|
+
inheritAttrs: false
|
|
6
|
+
};
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
...__default__,
|
|
9
|
+
__name: "GenericRenderStory",
|
|
10
|
+
props: {
|
|
11
|
+
story: {}
|
|
12
|
+
},
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const mountComponent = ref(null);
|
|
16
|
+
watchEffect(async () => {
|
|
17
|
+
const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
|
|
18
|
+
if (clientPlugin) {
|
|
19
|
+
try {
|
|
20
|
+
const pluginModule = await clientPlugin();
|
|
21
|
+
mountComponent.value = markRaw(pluginModule.RenderStory);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error(e);
|
|
24
|
+
throw e;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
return mountComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(mountComponent.value), mergeProps({
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "histoire-generic-render-story __histoire-render-story",
|
|
32
|
+
story: __props.story
|
|
33
|
+
}, _ctx.$attrs), null, 16, ["story"])) : createCommentVNode("", true);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
_sfc_main as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./StoryResponsivePreview.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const StoryResponsivePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-18122333"]]);
|
|
6
|
+
export {
|
|
7
|
+
StoryResponsivePreview as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, unref, ref, onUnmounted, computed, createElementBlock, openBlock, createCommentVNode, createElementVNode, createVNode, normalizeClass, createBlock, createStaticVNode, renderSlot, Fragment, withDirectives } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { useEventListener } from "@histoire/vendors/vue-use";
|
|
4
|
+
import { VTooltip } from "@histoire/vendors/floating-vue";
|
|
5
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
6
|
+
import CheckerboardPattern from "../misc/CheckerboardPattern.vue.js";
|
|
7
|
+
import HatchedPattern from "../misc/HatchedPattern.vue.js";
|
|
8
|
+
"use strict";
|
|
9
|
+
const _hoisted_1 = { class: "histoire-story-responsive-preview htw-w-full htw-h-full htw-flex-1 htw-rounded-lg htw-relative htw-overflow-hidden" };
|
|
10
|
+
const _hoisted_2 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-bg-gray-100 dark:htw-bg-gray-750 htw-rounded-r-lg htw-border-l-2 htw-border-gray-500/10 dark:htw-border-gray-700/30 htw-overflow-hidden"
|
|
13
|
+
};
|
|
14
|
+
const _hoisted_3 = {
|
|
15
|
+
class: "bind-preview-bg htw-rounded-lg htw-h-full",
|
|
16
|
+
"data-test-id": "responsive-preview-bg"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_4 = { class: "htw-p-8 htw-h-full htw-relative" };
|
|
19
|
+
const _hoisted_5 = { class: "htw-w-full htw-h-full htw-relative" };
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
__name: "StoryResponsivePreview",
|
|
22
|
+
props: {
|
|
23
|
+
variant: {}
|
|
24
|
+
},
|
|
25
|
+
setup(__props) {
|
|
26
|
+
useCssVars((_ctx) => ({
|
|
27
|
+
"v5f6f4ee9": unref(settings).backgroundColor
|
|
28
|
+
}));
|
|
29
|
+
const props = __props;
|
|
30
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
31
|
+
const resizing = ref(false);
|
|
32
|
+
const onUnmountedCleanupFns = [];
|
|
33
|
+
onUnmounted(() => {
|
|
34
|
+
onUnmountedCleanupFns.forEach((fn) => fn());
|
|
35
|
+
});
|
|
36
|
+
function addWindowListener(event, listener) {
|
|
37
|
+
window.addEventListener(event, listener);
|
|
38
|
+
const removeListener = () => window.removeEventListener(event, listener);
|
|
39
|
+
onUnmountedCleanupFns.push(removeListener);
|
|
40
|
+
return () => {
|
|
41
|
+
removeListener();
|
|
42
|
+
onUnmountedCleanupFns.splice(onUnmountedCleanupFns.indexOf(removeListener), 1);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function useDragger(el, value, min, max, axis) {
|
|
46
|
+
function onMouseDown(event) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
const start = axis === "x" ? event.clientX : event.clientY;
|
|
50
|
+
const startValue = value.value ?? (axis === "x" ? previewWrapper.value.clientWidth - 67 : previewWrapper.value.clientHeight - 70);
|
|
51
|
+
resizing.value = true;
|
|
52
|
+
const removeListeners = [
|
|
53
|
+
addWindowListener("mousemove", onMouseMove),
|
|
54
|
+
addWindowListener("mouseup", onMouseUp)
|
|
55
|
+
];
|
|
56
|
+
function onMouseMove(event2) {
|
|
57
|
+
const snapTarget = axis === "x" ? previewWrapper.value.clientWidth : previewWrapper.value.clientHeight;
|
|
58
|
+
const delta = (axis === "x" ? event2.clientX : event2.clientY) - start;
|
|
59
|
+
value.value = Math.max(min, Math.min(max, startValue + delta));
|
|
60
|
+
if (Math.abs(value.value - (snapTarget - 67)) < 16) {
|
|
61
|
+
value.value = null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function onMouseUp() {
|
|
65
|
+
removeListeners.forEach((fn) => fn());
|
|
66
|
+
resizing.value = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
useEventListener(el, "mousedown", onMouseDown);
|
|
70
|
+
function onTouchStart(event) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
const start = axis === "x" ? event.touches[0].clientX : event.touches[0].clientY;
|
|
74
|
+
const startValue = value.value;
|
|
75
|
+
resizing.value = true;
|
|
76
|
+
const removeListeners = [
|
|
77
|
+
addWindowListener("touchmove", onTouchMove),
|
|
78
|
+
addWindowListener("touchend", onTouchEnd),
|
|
79
|
+
addWindowListener("touchcancel", onTouchEnd)
|
|
80
|
+
];
|
|
81
|
+
function onTouchMove(event2) {
|
|
82
|
+
const delta = (axis === "x" ? event2.touches[0].clientX : event2.touches[0].clientY) - start;
|
|
83
|
+
value.value = Math.max(min, Math.min(max, startValue + delta));
|
|
84
|
+
}
|
|
85
|
+
function onTouchEnd() {
|
|
86
|
+
removeListeners.forEach((fn) => fn());
|
|
87
|
+
resizing.value = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
useEventListener(el, "touchstart", onTouchStart);
|
|
91
|
+
}
|
|
92
|
+
const responsiveWidth = computed({
|
|
93
|
+
get: () => settings[settings.rotate ? "responsiveHeight" : "responsiveWidth"],
|
|
94
|
+
set: (value) => {
|
|
95
|
+
settings[settings.rotate ? "responsiveHeight" : "responsiveWidth"] = value;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const responsiveHeight = computed({
|
|
99
|
+
get: () => settings[settings.rotate ? "responsiveWidth" : "responsiveHeight"],
|
|
100
|
+
set: (value) => {
|
|
101
|
+
settings[settings.rotate ? "responsiveWidth" : "responsiveHeight"] = value;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const horizontalDragger = ref();
|
|
105
|
+
const verticalDragger = ref();
|
|
106
|
+
const cornerDragger = ref();
|
|
107
|
+
const previewWrapper = ref();
|
|
108
|
+
useDragger(horizontalDragger, responsiveWidth, 32, 2e4, "x");
|
|
109
|
+
useDragger(verticalDragger, responsiveHeight, 32, 2e4, "y");
|
|
110
|
+
useDragger(cornerDragger, responsiveWidth, 32, 2e4, "x");
|
|
111
|
+
useDragger(cornerDragger, responsiveHeight, 32, 2e4, "y");
|
|
112
|
+
const finalWidth = computed(() => settings.rotate ? settings.responsiveHeight : settings.responsiveWidth);
|
|
113
|
+
const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth : settings.responsiveHeight);
|
|
114
|
+
const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled);
|
|
115
|
+
const sizeTooltip = computed(() => `${responsiveWidth.value ?? "Auto"} × ${responsiveHeight.value ?? "Auto"}`);
|
|
116
|
+
return (_ctx, _cache) => {
|
|
117
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
118
|
+
isResponsiveEnabled.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
119
|
+
createVNode(HatchedPattern, { class: "htw-w-full htw-h-full htw-text-black/[1%] dark:htw-text-white/[1%]" })
|
|
120
|
+
])) : createCommentVNode("", true),
|
|
121
|
+
createElementVNode("div", {
|
|
122
|
+
ref_key: "previewWrapper",
|
|
123
|
+
ref: previewWrapper,
|
|
124
|
+
class: "htw-h-full htw-overflow-auto htw-relative"
|
|
125
|
+
}, [
|
|
126
|
+
createElementVNode("div", {
|
|
127
|
+
class: normalizeClass(["htw-overflow-hidden htw-bg-white dark:htw-bg-gray-700 htw-rounded-lg htw-relative", isResponsiveEnabled.value ? {
|
|
128
|
+
"htw-w-fit": !!finalWidth.value,
|
|
129
|
+
"htw-h-fit": !!finalHeight.value,
|
|
130
|
+
"htw-h-full": !finalHeight.value
|
|
131
|
+
} : "htw-h-full"])
|
|
132
|
+
}, [
|
|
133
|
+
createElementVNode("div", _hoisted_3, [
|
|
134
|
+
unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
|
|
135
|
+
key: 0,
|
|
136
|
+
class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
137
|
+
})) : createCommentVNode("", true),
|
|
138
|
+
createElementVNode("div", _hoisted_4, [
|
|
139
|
+
createElementVNode("div", _hoisted_5, [
|
|
140
|
+
_cache[0] || (_cache[0] = createElementVNode("div", { class: "htw-absolute htw-inset-0" }, null, -1)),
|
|
141
|
+
renderSlot(_ctx.$slots, "default", {
|
|
142
|
+
isResponsiveEnabled: isResponsiveEnabled.value,
|
|
143
|
+
finalWidth: finalWidth.value,
|
|
144
|
+
finalHeight: finalHeight.value,
|
|
145
|
+
resizing: resizing.value
|
|
146
|
+
}, void 0, true)
|
|
147
|
+
]),
|
|
148
|
+
_cache[1] || (_cache[1] = createStaticVNode('<div class="htw-absolute htw-top-5 htw-left-8 htw-h-2 htw-w-px htw-bg-gray-400/25" data-v-18122333></div><div class="htw-absolute htw-top-5 htw-right-8 htw-h-2 htw-w-px htw-bg-gray-400/25" data-v-18122333></div><div class="htw-absolute htw-bottom-5 htw-left-8 htw-h-2 htw-w-px htw-bg-gray-400/25" data-v-18122333></div><div class="htw-absolute htw-bottom-5 htw-right-8 htw-h-2 htw-w-px htw-bg-gray-400/25" data-v-18122333></div><div class="htw-absolute htw-left-5 htw-top-8 htw-w-2 htw-h-px htw-bg-gray-400/25" data-v-18122333></div><div class="htw-absolute htw-left-5 htw-bottom-8 htw-w-2 htw-h-px htw-bg-gray-400/25" data-v-18122333></div><div class="htw-absolute htw-right-5 htw-top-8 htw-w-2 htw-h-px htw-bg-gray-400/25" data-v-18122333></div><div class="htw-absolute htw-right-5 htw-bottom-8 htw-w-2 htw-h-px htw-bg-gray-400/25" data-v-18122333></div>', 8))
|
|
149
|
+
]),
|
|
150
|
+
isResponsiveEnabled.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
151
|
+
withDirectives((openBlock(), createElementBlock("div", {
|
|
152
|
+
ref_key: "horizontalDragger",
|
|
153
|
+
ref: horizontalDragger,
|
|
154
|
+
class: "htw-absolute htw-w-4 htw-top-0 htw-bottom-4 htw-right-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-ew-resize htw-group hover:htw-text-primary-500"
|
|
155
|
+
}, [
|
|
156
|
+
createVNode(unref(Icon), {
|
|
157
|
+
icon: "mdi:drag-vertical-variant",
|
|
158
|
+
class: "htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
|
|
159
|
+
})
|
|
160
|
+
])), [
|
|
161
|
+
[
|
|
162
|
+
unref(VTooltip),
|
|
163
|
+
sizeTooltip.value,
|
|
164
|
+
void 0,
|
|
165
|
+
{ right: true }
|
|
166
|
+
]
|
|
167
|
+
]),
|
|
168
|
+
withDirectives((openBlock(), createElementBlock("div", {
|
|
169
|
+
ref_key: "verticalDragger",
|
|
170
|
+
ref: verticalDragger,
|
|
171
|
+
class: "htw-absolute htw-h-4 htw-left-0 htw-right-4 htw-bottom-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-ns-resize htw-group hover:htw-text-primary-500"
|
|
172
|
+
}, [
|
|
173
|
+
createVNode(unref(Icon), {
|
|
174
|
+
icon: "mdi:drag-horizontal-variant",
|
|
175
|
+
class: "htw-w-4 htw-h-4 htw-opacity-20 group-hover:htw-opacity-90"
|
|
176
|
+
})
|
|
177
|
+
])), [
|
|
178
|
+
[
|
|
179
|
+
unref(VTooltip),
|
|
180
|
+
sizeTooltip.value,
|
|
181
|
+
void 0,
|
|
182
|
+
{ bottom: true }
|
|
183
|
+
]
|
|
184
|
+
]),
|
|
185
|
+
withDirectives(createElementVNode("div", {
|
|
186
|
+
ref_key: "cornerDragger",
|
|
187
|
+
ref: cornerDragger,
|
|
188
|
+
class: "htw-absolute htw-w-4 htw-h-4 htw-right-0 htw-bottom-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-nwse-resize htw-group hover:htw-text-primary-500"
|
|
189
|
+
}, null, 512), [
|
|
190
|
+
[
|
|
191
|
+
unref(VTooltip),
|
|
192
|
+
sizeTooltip.value,
|
|
193
|
+
void 0,
|
|
194
|
+
{ bottom: true }
|
|
195
|
+
]
|
|
196
|
+
])
|
|
197
|
+
], 64)) : createCommentVNode("", true)
|
|
198
|
+
])
|
|
199
|
+
], 2)
|
|
200
|
+
], 512)
|
|
201
|
+
]);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
export {
|
|
206
|
+
_sfc_main as default
|
|
207
|
+
};
|