@poveste/app 0.1.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 +22 -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 +1 -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/_plugin-vue_export-helper.js +10 -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 +35 -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 +6 -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 +2626 -0
- package/package.json +56 -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,207 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, unref, ref, onUnmounted, computed, createElementBlock, openBlock, createCommentVNode, createElementVNode, createVNode, normalizeClass, createBlock, createStaticVNode, renderSlot, Fragment, withDirectives } from "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/vendors/iconify";
|
|
3
|
+
import { useEventListener } from "@poveste/vendors/vue-use";
|
|
4
|
+
import { VTooltip } from "@poveste/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
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, createElementBlock, openBlock, createCommentVNode, createElementVNode, unref, createVNode, createBlock, normalizeStyle, Fragment, renderList } from "@poveste/vendors/vue";
|
|
2
|
+
import { useResizeObserver } from "@poveste/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-2cc73400"]]);
|
|
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 "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/vendors/iconify";
|
|
3
|
+
import { HstCopyIcon } from "@poveste/controls";
|
|
4
|
+
import { useResizeObserver } from "@poveste/vendors/vue-use";
|
|
5
|
+
import { useRouter } from "@poveste/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
|
+
"v2f48b1c5": unref(variant).iconColor,
|
|
40
|
+
"v19f135f4": 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 "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/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
|
+
};
|