@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,128 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, computed, createBlock, openBlock, withCtx, createElementVNode, normalizeStyle, normalizeClass, toRaw } from "@histoire/vendors/vue";
|
|
2
|
+
import { applyState } from "@histoire/shared";
|
|
3
|
+
import { useEventListener } from "@histoire/vendors/vue-use";
|
|
4
|
+
import { useEventsStore } from "../../stores/events.js";
|
|
5
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
6
|
+
import { SANDBOX_READY, EVENT_SEND, STATE_SYNC, PREVIEW_SETTINGS_SYNC } from "../../util/const.js";
|
|
7
|
+
import { getSandboxUrl } from "../../util/sandbox.js";
|
|
8
|
+
import { toRawDeep } from "../../util/state.js";
|
|
9
|
+
import StoryResponsivePreview from "./StoryResponsivePreview.vue.js";
|
|
10
|
+
"use strict";
|
|
11
|
+
const _hoisted_1 = ["src"];
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
__name: "StoryVariantSinglePreviewRemote",
|
|
14
|
+
props: {
|
|
15
|
+
story: {},
|
|
16
|
+
variant: {}
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
21
|
+
const iframe = ref();
|
|
22
|
+
function syncState() {
|
|
23
|
+
if (iframe.value && props.variant.previewReady) {
|
|
24
|
+
iframe.value.contentWindow.postMessage({
|
|
25
|
+
type: STATE_SYNC,
|
|
26
|
+
state: toRawDeep(props.variant.state, true)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
let synced = false;
|
|
31
|
+
watch(() => props.variant.state, () => {
|
|
32
|
+
if (synced) {
|
|
33
|
+
synced = false;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
syncState();
|
|
37
|
+
}, {
|
|
38
|
+
deep: true,
|
|
39
|
+
immediate: true
|
|
40
|
+
});
|
|
41
|
+
Object.assign(props.variant, {
|
|
42
|
+
previewReady: false
|
|
43
|
+
});
|
|
44
|
+
useEventListener(window, "message", (event) => {
|
|
45
|
+
switch (event.data.type) {
|
|
46
|
+
case STATE_SYNC:
|
|
47
|
+
updateVariantState(event.data.state);
|
|
48
|
+
break;
|
|
49
|
+
case EVENT_SEND:
|
|
50
|
+
logEvent(event.data.event);
|
|
51
|
+
break;
|
|
52
|
+
case SANDBOX_READY:
|
|
53
|
+
setPreviewReady();
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
function updateVariantState(state) {
|
|
58
|
+
synced = true;
|
|
59
|
+
applyState(props.variant.state, state);
|
|
60
|
+
}
|
|
61
|
+
function logEvent(event) {
|
|
62
|
+
const eventsStore = useEventsStore();
|
|
63
|
+
eventsStore.addEvent(event);
|
|
64
|
+
}
|
|
65
|
+
function setPreviewReady() {
|
|
66
|
+
Object.assign(props.variant, {
|
|
67
|
+
previewReady: true
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const sandboxUrl = computed(() => {
|
|
71
|
+
return getSandboxUrl(props.story, props.variant);
|
|
72
|
+
});
|
|
73
|
+
const isIframeLoaded = ref(false);
|
|
74
|
+
watch(sandboxUrl, () => {
|
|
75
|
+
isIframeLoaded.value = false;
|
|
76
|
+
Object.assign(props.variant, {
|
|
77
|
+
previewReady: false
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
function syncSettings() {
|
|
81
|
+
if (iframe.value) {
|
|
82
|
+
iframe.value.contentWindow.postMessage({
|
|
83
|
+
type: PREVIEW_SETTINGS_SYNC,
|
|
84
|
+
settings: toRaw(settings)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
watch(() => settings, () => {
|
|
89
|
+
syncSettings();
|
|
90
|
+
}, {
|
|
91
|
+
deep: true,
|
|
92
|
+
immediate: true
|
|
93
|
+
});
|
|
94
|
+
function onIframeLoad() {
|
|
95
|
+
isIframeLoaded.value = true;
|
|
96
|
+
syncState();
|
|
97
|
+
syncSettings();
|
|
98
|
+
}
|
|
99
|
+
return (_ctx, _cache) => {
|
|
100
|
+
return openBlock(), createBlock(StoryResponsivePreview, {
|
|
101
|
+
class: "histoire-story-variant-single-preview-remote",
|
|
102
|
+
variant: __props.variant
|
|
103
|
+
}, {
|
|
104
|
+
default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight, resizing }) => [
|
|
105
|
+
createElementVNode("iframe", {
|
|
106
|
+
ref_key: "iframe",
|
|
107
|
+
ref: iframe,
|
|
108
|
+
src: sandboxUrl.value,
|
|
109
|
+
class: normalizeClass(["htw-w-full htw-h-full htw-relative", {
|
|
110
|
+
"htw-invisible": !isIframeLoaded.value,
|
|
111
|
+
"htw-pointer-events-none": resizing
|
|
112
|
+
}]),
|
|
113
|
+
style: normalizeStyle(isResponsiveEnabled ? {
|
|
114
|
+
width: finalWidth ? `${finalWidth}px` : null,
|
|
115
|
+
height: finalHeight ? `${finalHeight}px` : null
|
|
116
|
+
} : void 0),
|
|
117
|
+
"data-test-id": "preview-iframe",
|
|
118
|
+
onLoad: _cache[0] || (_cache[0] = ($event) => onIframeLoad())
|
|
119
|
+
}, null, 46, _hoisted_1)
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["variant"]);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
export {
|
|
127
|
+
_sfc_main as default
|
|
128
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createCommentVNode, createBlock, unref, createVNode } from "@histoire/vendors/vue";
|
|
2
|
+
import { isMobile } from "../../util/responsive.js";
|
|
3
|
+
import "../toolbar/DevOnlyToolbarOpenInEditor.vue.js";
|
|
4
|
+
import ToolbarBackground from "../toolbar/ToolbarBackground.vue.js";
|
|
5
|
+
import "../toolbar/ToolbarNewTab.vue.js";
|
|
6
|
+
import "../toolbar/ToolbarResponsiveSize.vue.js";
|
|
7
|
+
import "../toolbar/ToolbarTextDirection.vue.js";
|
|
8
|
+
import "../toolbar/ToolbarTitle.vue.js";
|
|
9
|
+
import "./StoryVariantSinglePreviewNative.vue.js";
|
|
10
|
+
import "./StoryVariantSinglePreviewRemote.vue.js";
|
|
11
|
+
import _sfc_main$1 from "../toolbar/ToolbarTitle.vue2.js";
|
|
12
|
+
import _sfc_main$2 from "../toolbar/ToolbarResponsiveSize.vue2.js";
|
|
13
|
+
import _sfc_main$3 from "../toolbar/ToolbarTextDirection.vue2.js";
|
|
14
|
+
import _sfc_main$4 from "../toolbar/ToolbarNewTab.vue2.js";
|
|
15
|
+
import _sfc_main$5 from "../toolbar/DevOnlyToolbarOpenInEditor.vue2.js";
|
|
16
|
+
import _sfc_main$6 from "./StoryVariantSinglePreviewNative.vue2.js";
|
|
17
|
+
import _sfc_main$7 from "./StoryVariantSinglePreviewRemote.vue2.js";
|
|
18
|
+
"use strict";
|
|
19
|
+
const _hoisted_1 = {
|
|
20
|
+
class: "histoire-story-variant-single-view htw-h-full htw-flex htw-flex-col",
|
|
21
|
+
"data-test-id": "story-variant-single-view"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_2 = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1"
|
|
26
|
+
};
|
|
27
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
28
|
+
__name: "StoryVariantSingleView",
|
|
29
|
+
props: {
|
|
30
|
+
variant: {},
|
|
31
|
+
story: {}
|
|
32
|
+
},
|
|
33
|
+
setup(__props) {
|
|
34
|
+
return (_ctx, _cache) => {
|
|
35
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
36
|
+
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
37
|
+
createVNode(_sfc_main$1, { variant: __props.variant }, null, 8, ["variant"]),
|
|
38
|
+
!__props.variant.responsiveDisabled ? (openBlock(), createBlock(_sfc_main$2, { key: 0 })) : createCommentVNode("", true),
|
|
39
|
+
createVNode(ToolbarBackground),
|
|
40
|
+
createVNode(_sfc_main$3),
|
|
41
|
+
createVNode(_sfc_main$4, {
|
|
42
|
+
variant: __props.variant,
|
|
43
|
+
story: __props.story
|
|
44
|
+
}, null, 8, ["variant", "story"]),
|
|
45
|
+
_ctx.__HISTOIRE_DEV__ ? (openBlock(), createBlock(_sfc_main$5, {
|
|
46
|
+
key: 1,
|
|
47
|
+
file: __props.story.file?.filePath,
|
|
48
|
+
tooltip: "Edit story in editor"
|
|
49
|
+
}, null, 8, ["file"])) : createCommentVNode("", true)
|
|
50
|
+
])) : createCommentVNode("", true),
|
|
51
|
+
__props.story.layout?.iframe === false ? (openBlock(), createBlock(_sfc_main$6, {
|
|
52
|
+
key: 1,
|
|
53
|
+
story: __props.story,
|
|
54
|
+
variant: __props.variant
|
|
55
|
+
}, null, 8, ["story", "variant"])) : (openBlock(), createBlock(_sfc_main$7, {
|
|
56
|
+
key: 2,
|
|
57
|
+
story: __props.story,
|
|
58
|
+
variant: __props.variant
|
|
59
|
+
}, null, 8, ["story", "variant"]))
|
|
60
|
+
]);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
_sfc_main as default
|
|
66
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { defineComponent, watch, ref, createBlock, createElementBlock, unref, openBlock, withCtx, createVNode } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { useRouter, useRoute } from "@histoire/vendors/vue-router";
|
|
4
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
5
|
+
import { isMobile } from "../../util/responsive.js";
|
|
6
|
+
import BaseEmpty from "../base/BaseEmpty.vue.js";
|
|
7
|
+
import BaseSplitPane from "../base/BaseSplitPane.vue.js";
|
|
8
|
+
import "../panel/StoryDocs.vue.js";
|
|
9
|
+
import "../panel/StorySidePanel.vue.js";
|
|
10
|
+
import StoryViewer from "./StoryViewer.vue.js";
|
|
11
|
+
import _sfc_main$1 from "../panel/StoryDocs.vue2.js";
|
|
12
|
+
import _sfc_main$2 from "../panel/StorySidePanel.vue2.js";
|
|
13
|
+
"use strict";
|
|
14
|
+
const _hoisted_1 = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "histoire-story-view histoire-with-story htw-h-full"
|
|
17
|
+
};
|
|
18
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "StoryView",
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const storyStore = useStoryStore();
|
|
22
|
+
const router = useRouter();
|
|
23
|
+
const route = useRoute();
|
|
24
|
+
watch(() => storyStore.currentVariant, (value) => {
|
|
25
|
+
if (value) {
|
|
26
|
+
storyStore.currentStory.lastSelectedVariant = value;
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
immediate: true
|
|
30
|
+
});
|
|
31
|
+
watch(() => [storyStore.currentStory, storyStore.currentVariant], () => {
|
|
32
|
+
if (!storyStore.currentVariant) {
|
|
33
|
+
if (storyStore.currentStory?.lastSelectedVariant) {
|
|
34
|
+
setVariant(storyStore.currentStory.lastSelectedVariant.id);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (storyStore.currentStory?.variants.length === 1) {
|
|
38
|
+
setVariant(storyStore.currentStory.variants[0].id);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
immediate: true
|
|
43
|
+
});
|
|
44
|
+
function setVariant(variantId) {
|
|
45
|
+
router.replace({
|
|
46
|
+
...route,
|
|
47
|
+
query: {
|
|
48
|
+
...route.query,
|
|
49
|
+
variantId
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const docsOnlyScroller = ref(null);
|
|
54
|
+
function scrollDocsToTop() {
|
|
55
|
+
docsOnlyScroller.value?.scrollTo(0, 0);
|
|
56
|
+
}
|
|
57
|
+
return (_ctx, _cache) => {
|
|
58
|
+
return !unref(storyStore).currentStory ? (openBlock(), createBlock(BaseEmpty, {
|
|
59
|
+
key: 0,
|
|
60
|
+
class: "histoire-story-view histoire-no-story"
|
|
61
|
+
}, {
|
|
62
|
+
default: withCtx(() => [
|
|
63
|
+
createVNode(unref(Icon), {
|
|
64
|
+
icon: "carbon:software-resource-resource",
|
|
65
|
+
class: "htw-w-16 htw-h-16 htw-opacity-50"
|
|
66
|
+
})
|
|
67
|
+
]),
|
|
68
|
+
_: 1
|
|
69
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
70
|
+
unref(storyStore).currentStory.docsOnly ? (openBlock(), createElementBlock("div", {
|
|
71
|
+
key: 0,
|
|
72
|
+
ref_key: "docsOnlyScroller",
|
|
73
|
+
ref: docsOnlyScroller,
|
|
74
|
+
class: "htw-h-full htw-overflow-auto"
|
|
75
|
+
}, [
|
|
76
|
+
createVNode(_sfc_main$1, {
|
|
77
|
+
story: unref(storyStore).currentStory,
|
|
78
|
+
standalone: "",
|
|
79
|
+
class: "md:htw-p-12 htw-w-full md:htw-max-w-[600px] lg:htw-max-w-[800px] xl:htw-max-w-[900px]",
|
|
80
|
+
onScrollTop: _cache[0] || (_cache[0] = ($event) => scrollDocsToTop())
|
|
81
|
+
}, null, 8, ["story"])
|
|
82
|
+
], 512)) : unref(isMobile) ? (openBlock(), createBlock(StoryViewer, { key: 1 })) : (openBlock(), createBlock(BaseSplitPane, {
|
|
83
|
+
key: 2,
|
|
84
|
+
"save-id": "story-main",
|
|
85
|
+
min: 30,
|
|
86
|
+
max: 95,
|
|
87
|
+
"default-split": 75,
|
|
88
|
+
class: "htw-h-full"
|
|
89
|
+
}, {
|
|
90
|
+
first: withCtx(() => [
|
|
91
|
+
createVNode(StoryViewer)
|
|
92
|
+
]),
|
|
93
|
+
last: withCtx(() => [
|
|
94
|
+
createVNode(_sfc_main$2)
|
|
95
|
+
]),
|
|
96
|
+
_: 1
|
|
97
|
+
}))
|
|
98
|
+
]));
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
export {
|
|
103
|
+
_sfc_main as default
|
|
104
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./StoryViewer.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const StoryViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-096f6d6e"]]);
|
|
6
|
+
export {
|
|
7
|
+
StoryViewer as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, computed, ref, watch, createElementBlock, openBlock, Fragment, createElementVNode, createVNode, createBlock, createCommentVNode, unref, withCtx, renderList } from "@histoire/vendors/vue";
|
|
2
|
+
import { useStoryStore } from "../../stores/story.js";
|
|
3
|
+
import "../app/MobileOverlay.vue.js";
|
|
4
|
+
import "./StoryVariantGrid.vue.js";
|
|
5
|
+
import StoryVariantListItem from "./StoryVariantListItem.vue.js";
|
|
6
|
+
import StoryVariantSingle from "./StoryVariantSingle.vue.js";
|
|
7
|
+
import _sfc_main$1 from "./StoryVariantGrid.vue2.js";
|
|
8
|
+
import _sfc_main$2 from "../app/MobileOverlay.vue2.js";
|
|
9
|
+
"use strict";
|
|
10
|
+
const _hoisted_1 = { class: "histoire-story-viewer htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750" };
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "StoryViewer",
|
|
13
|
+
setup(__props) {
|
|
14
|
+
useCssVars((_ctx) => ({
|
|
15
|
+
"v0f021d3c": variant.value?.iconColor
|
|
16
|
+
}));
|
|
17
|
+
const storyStore = useStoryStore();
|
|
18
|
+
const variant = computed(() => storyStore.currentVariant);
|
|
19
|
+
const isMenuOpened = ref(false);
|
|
20
|
+
function closeMenu() {
|
|
21
|
+
isMenuOpened.value = false;
|
|
22
|
+
}
|
|
23
|
+
watch(variant, () => {
|
|
24
|
+
isMenuOpened.value = false;
|
|
25
|
+
});
|
|
26
|
+
return (_ctx, _cache) => {
|
|
27
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
28
|
+
createElementVNode("div", _hoisted_1, [
|
|
29
|
+
unref(storyStore).currentStory.layout.type === "grid" ? (openBlock(), createBlock(_sfc_main$1, { key: 0 })) : unref(storyStore).currentStory.layout.type === "single" ? (openBlock(), createBlock(StoryVariantSingle, {
|
|
30
|
+
key: 1,
|
|
31
|
+
onOpenVariantMenu: _cache[0] || (_cache[0] = ($event) => isMenuOpened.value = true)
|
|
32
|
+
})) : createCommentVNode("", true)
|
|
33
|
+
]),
|
|
34
|
+
createVNode(_sfc_main$2, {
|
|
35
|
+
title: "Select a variant",
|
|
36
|
+
opened: isMenuOpened.value,
|
|
37
|
+
onClose: closeMenu
|
|
38
|
+
}, {
|
|
39
|
+
default: withCtx(() => [
|
|
40
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (v, index) => {
|
|
41
|
+
return openBlock(), createBlock(StoryVariantListItem, {
|
|
42
|
+
key: index,
|
|
43
|
+
variant: v
|
|
44
|
+
}, null, 8, ["variant"]);
|
|
45
|
+
}), 128))
|
|
46
|
+
]),
|
|
47
|
+
_: 1
|
|
48
|
+
}, 8, ["opened"])
|
|
49
|
+
], 64);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
_sfc_main as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineComponent, resolveDirective, withDirectives, createElementBlock, openBlock, unref, createVNode } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { openInEditor } from "../../util/open-in-editor.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "DevOnlyToolbarOpenInEditor",
|
|
7
|
+
props: {
|
|
8
|
+
file: {},
|
|
9
|
+
tooltip: {}
|
|
10
|
+
},
|
|
11
|
+
setup(__props) {
|
|
12
|
+
return (_ctx, _cache) => {
|
|
13
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
14
|
+
return withDirectives((openBlock(), createElementBlock("a", {
|
|
15
|
+
target: "_blank",
|
|
16
|
+
class: "histoire-toolbar-open-in-editor htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100",
|
|
17
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(openInEditor)(__props.file))
|
|
18
|
+
}, [
|
|
19
|
+
createVNode(unref(Icon), {
|
|
20
|
+
icon: "carbon:script-reference",
|
|
21
|
+
class: "htw-w-4 htw-h-4"
|
|
22
|
+
})
|
|
23
|
+
])), [
|
|
24
|
+
[_directive_tooltip, __props.tooltip]
|
|
25
|
+
]);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
_sfc_main as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./ToolbarBackground.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const ToolbarBackground = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c48fb2b2"]]);
|
|
6
|
+
export {
|
|
7
|
+
ToolbarBackground as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, computed, unref, resolveComponent, resolveDirective, createBlock, createCommentVNode, openBlock, withCtx, withDirectives, createElementBlock, createElementVNode, createVNode, createTextVNode, Fragment, renderList, normalizeClass, toDisplayString, normalizeStyle } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
4
|
+
import { histoireConfig } from "../../util/config.js";
|
|
5
|
+
import { getContrastColor } from "../../util/preview-settings.js";
|
|
6
|
+
import "../base/BaseCheckbox.vue.js";
|
|
7
|
+
import _sfc_main$1 from "../base/BaseCheckbox.vue2.js";
|
|
8
|
+
"use strict";
|
|
9
|
+
const _hoisted_1 = { class: "htw-cursor-pointer hover:htw-text-primary-500 htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group" };
|
|
10
|
+
const _hoisted_2 = { class: "bind-preview-bg htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/50 dark:htw-border-white/50 htw-flex htw-items-center htw-justify-center htw-text-xs" };
|
|
11
|
+
const _hoisted_3 = { key: 0 };
|
|
12
|
+
const _hoisted_4 = {
|
|
13
|
+
class: "htw-flex htw-flex-col htw-items-stretch",
|
|
14
|
+
"data-test-id": "background-popper"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_5 = ["onClick"];
|
|
17
|
+
const _hoisted_6 = { class: "htw-mr-auto" };
|
|
18
|
+
const _hoisted_7 = { class: "htw-ml-auto htw-opacity-70" };
|
|
19
|
+
const _hoisted_8 = { key: 0 };
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
__name: "ToolbarBackground",
|
|
22
|
+
setup(__props) {
|
|
23
|
+
useCssVars((_ctx) => ({
|
|
24
|
+
"v627bec82": unref(settings).backgroundColor,
|
|
25
|
+
"v35068428": contrastColor.value
|
|
26
|
+
}));
|
|
27
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
28
|
+
const contrastColor = computed(() => getContrastColor(settings));
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
const _component_VDropdown = resolveComponent("VDropdown");
|
|
31
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
32
|
+
return unref(histoireConfig).backgroundPresets.length ? (openBlock(), createBlock(_component_VDropdown, {
|
|
33
|
+
key: 0,
|
|
34
|
+
placement: "bottom-end",
|
|
35
|
+
skidding: 6,
|
|
36
|
+
class: "histoire-toolbar-background htw-h-full htw-flex-none",
|
|
37
|
+
"data-test-id": "toolbar-background"
|
|
38
|
+
}, {
|
|
39
|
+
popper: withCtx(({ hide }) => [
|
|
40
|
+
createElementVNode("div", _hoisted_4, [
|
|
41
|
+
createVNode(_sfc_main$1, {
|
|
42
|
+
modelValue: unref(settings).checkerboard,
|
|
43
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(settings).checkerboard = $event)
|
|
44
|
+
}, {
|
|
45
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
46
|
+
createTextVNode(" Checkerboard ", -1)
|
|
47
|
+
])]),
|
|
48
|
+
_: 1
|
|
49
|
+
}, 8, ["modelValue"]),
|
|
50
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(histoireConfig).backgroundPresets, (option, index) => {
|
|
51
|
+
return openBlock(), createElementBlock("button", {
|
|
52
|
+
key: index,
|
|
53
|
+
class: normalizeClass(["htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-items-baseline htw-gap-4", [
|
|
54
|
+
unref(settings).backgroundColor === option.color ? "htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black" : "htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
|
|
55
|
+
]]),
|
|
56
|
+
onClick: ($event) => {
|
|
57
|
+
unref(settings).backgroundColor = option.color;
|
|
58
|
+
hide();
|
|
59
|
+
}
|
|
60
|
+
}, [
|
|
61
|
+
createElementVNode("span", _hoisted_6, toDisplayString(option.label), 1),
|
|
62
|
+
option.color !== "$checkerboard" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
63
|
+
createElementVNode("span", _hoisted_7, toDisplayString(option.color), 1),
|
|
64
|
+
createElementVNode("div", {
|
|
65
|
+
class: "htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/20 dark:htw-border-white/20 htw-flex htw-items-center htw-justify-center htw-text-xs",
|
|
66
|
+
style: normalizeStyle({
|
|
67
|
+
backgroundColor: option.color,
|
|
68
|
+
color: option.contrastColor
|
|
69
|
+
})
|
|
70
|
+
}, [
|
|
71
|
+
option.contrastColor ? (openBlock(), createElementBlock("span", _hoisted_8, "a")) : createCommentVNode("", true)
|
|
72
|
+
], 4)
|
|
73
|
+
], 64)) : createCommentVNode("", true)
|
|
74
|
+
], 10, _hoisted_5);
|
|
75
|
+
}), 128))
|
|
76
|
+
])
|
|
77
|
+
]),
|
|
78
|
+
default: withCtx(() => [
|
|
79
|
+
withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
|
|
80
|
+
createElementVNode("div", _hoisted_2, [
|
|
81
|
+
contrastColor.value ? (openBlock(), createElementBlock("span", _hoisted_3, "a")) : createCommentVNode("", true)
|
|
82
|
+
]),
|
|
83
|
+
createVNode(unref(Icon), {
|
|
84
|
+
icon: "carbon:caret-down",
|
|
85
|
+
class: "htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
|
|
86
|
+
})
|
|
87
|
+
])), [
|
|
88
|
+
[_directive_tooltip, "Background color"]
|
|
89
|
+
])
|
|
90
|
+
]),
|
|
91
|
+
_: 1
|
|
92
|
+
})) : createCommentVNode("", true);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export {
|
|
97
|
+
_sfc_main as default
|
|
98
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveDirective, withDirectives, createElementBlock, openBlock, createVNode, unref } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { getSandboxUrl } from "../../util/sandbox.js";
|
|
4
|
+
"use strict";
|
|
5
|
+
const _hoisted_1 = ["href"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "ToolbarNewTab",
|
|
8
|
+
props: {
|
|
9
|
+
variant: {},
|
|
10
|
+
story: {}
|
|
11
|
+
},
|
|
12
|
+
setup(__props) {
|
|
13
|
+
const props = __props;
|
|
14
|
+
const sandboxUrl = computed(() => {
|
|
15
|
+
return getSandboxUrl(props.story, props.variant);
|
|
16
|
+
});
|
|
17
|
+
return (_ctx, _cache) => {
|
|
18
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
19
|
+
return withDirectives((openBlock(), createElementBlock("a", {
|
|
20
|
+
href: sandboxUrl.value,
|
|
21
|
+
target: "_blank",
|
|
22
|
+
class: "histoire-toolbar-new-tab htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
|
|
23
|
+
}, [
|
|
24
|
+
createVNode(unref(Icon), {
|
|
25
|
+
icon: "carbon:launch",
|
|
26
|
+
class: "htw-w-4 htw-h-4"
|
|
27
|
+
})
|
|
28
|
+
], 8, _hoisted_1)), [
|
|
29
|
+
[_directive_tooltip, "Open variant in new tab"]
|
|
30
|
+
]);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
_sfc_main as default
|
|
36
|
+
};
|