@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,70 @@
|
|
|
1
|
+
import { markRaw, reactive } from "@poveste/vendors/vue";
|
|
2
|
+
"use strict";
|
|
3
|
+
const copiedFromExistingVariant = [
|
|
4
|
+
"state",
|
|
5
|
+
"slots",
|
|
6
|
+
"source",
|
|
7
|
+
"responsiveDisabled",
|
|
8
|
+
"autoPropsDisabled",
|
|
9
|
+
"setupApp",
|
|
10
|
+
"configReady",
|
|
11
|
+
"previewReady"
|
|
12
|
+
];
|
|
13
|
+
function mapFile(file, existingFile) {
|
|
14
|
+
let result;
|
|
15
|
+
if (existingFile) {
|
|
16
|
+
result = existingFile;
|
|
17
|
+
for (const key in file) {
|
|
18
|
+
if (key === "story") {
|
|
19
|
+
result.story = {
|
|
20
|
+
...result.story,
|
|
21
|
+
...file.story,
|
|
22
|
+
file: markRaw(result),
|
|
23
|
+
variants: file.story.variants.map((v) => mapVariant(v, existingFile.story.variants.find((item) => item.id === v.id)))
|
|
24
|
+
};
|
|
25
|
+
} else if (key !== "component") {
|
|
26
|
+
result[key] = file[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
result = {
|
|
31
|
+
...file,
|
|
32
|
+
component: markRaw(file.component),
|
|
33
|
+
story: {
|
|
34
|
+
...file.story,
|
|
35
|
+
title: file.story.title,
|
|
36
|
+
file: markRaw(file),
|
|
37
|
+
variants: file.story.variants.map((v) => mapVariant(v)),
|
|
38
|
+
slots: () => ({})
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
function mapVariant(variant, existingVariant) {
|
|
45
|
+
let result;
|
|
46
|
+
if (existingVariant) {
|
|
47
|
+
result = existingVariant;
|
|
48
|
+
for (const key in variant) {
|
|
49
|
+
if (!copiedFromExistingVariant.includes(key)) {
|
|
50
|
+
result[key] = variant[key];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
result = {
|
|
55
|
+
...variant,
|
|
56
|
+
state: reactive({
|
|
57
|
+
_hPropState: {},
|
|
58
|
+
_hPropDefs: {}
|
|
59
|
+
}),
|
|
60
|
+
setupApp: null,
|
|
61
|
+
slots: () => ({}),
|
|
62
|
+
previewReady: false
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
mapFile,
|
|
69
|
+
mapVariant
|
|
70
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { reactive } from "@poveste/vendors/vue";
|
|
2
|
+
import { histoireConfig } from "./config.js";
|
|
3
|
+
"use strict";
|
|
4
|
+
const receivedSettings = reactive({});
|
|
5
|
+
function applyPreviewSettings(settings) {
|
|
6
|
+
Object.assign(receivedSettings, settings);
|
|
7
|
+
document.documentElement.setAttribute("dir", settings.textDirection);
|
|
8
|
+
const contrastColor = getContrastColor(settings);
|
|
9
|
+
document.documentElement.style.setProperty("--histoire-contrast-color", contrastColor);
|
|
10
|
+
if (histoireConfig.autoApplyContrastColor) {
|
|
11
|
+
document.documentElement.style.color = contrastColor;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function getContrastColor(setting) {
|
|
15
|
+
return histoireConfig.backgroundPresets.find((preset) => preset.color === setting.backgroundColor)?.contrastColor ?? "unset";
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
applyPreviewSettings,
|
|
19
|
+
getContrastColor,
|
|
20
|
+
receivedSettings
|
|
21
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { base } from "../router.js";
|
|
2
|
+
"use strict";
|
|
3
|
+
function getSandboxUrl(story, variant) {
|
|
4
|
+
const url = new URLSearchParams();
|
|
5
|
+
url.append("storyId", story.id);
|
|
6
|
+
url.append("variantId", variant.id);
|
|
7
|
+
return `${base}__sandbox.html?${url.toString()}`;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
getSandboxUrl
|
|
11
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import scrollIntoView from "@poveste/vendors/scroll";
|
|
2
|
+
import { watch, onMounted } from "@poveste/vendors/vue";
|
|
3
|
+
"use strict";
|
|
4
|
+
function useScrollOnActive(active, el) {
|
|
5
|
+
watch(active, (value) => {
|
|
6
|
+
if (value) {
|
|
7
|
+
autoScroll();
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
function autoScroll() {
|
|
11
|
+
if (el.value) {
|
|
12
|
+
scrollIntoView(el.value, {
|
|
13
|
+
scrollMode: "if-needed",
|
|
14
|
+
block: "center",
|
|
15
|
+
inline: "nearest",
|
|
16
|
+
behavior: "smooth"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
if (active.value) {
|
|
22
|
+
autoScroll();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
autoScroll
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
useScrollOnActive
|
|
31
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ref, watch, computed } from "@poveste/vendors/vue";
|
|
2
|
+
"use strict";
|
|
3
|
+
function useSelection(list) {
|
|
4
|
+
const selectedIndex = ref(0);
|
|
5
|
+
watch(list, () => {
|
|
6
|
+
selectedIndex.value = 0;
|
|
7
|
+
});
|
|
8
|
+
function selectNext() {
|
|
9
|
+
selectedIndex.value++;
|
|
10
|
+
if (selectedIndex.value > list.value.length - 1) {
|
|
11
|
+
selectedIndex.value = 0;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function selectPrevious() {
|
|
15
|
+
selectedIndex.value--;
|
|
16
|
+
if (selectedIndex.value < 0) {
|
|
17
|
+
selectedIndex.value = list.value.length - 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
selectedIndex: computed(() => selectedIndex.value),
|
|
22
|
+
selectNext,
|
|
23
|
+
selectPrevious
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
useSelection
|
|
28
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isRef, unref } from "@poveste/vendors/vue";
|
|
2
|
+
"use strict";
|
|
3
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
4
|
+
function toRawDeep(val, clean = false, seen = /* @__PURE__ */ new WeakMap()) {
|
|
5
|
+
const unwrappedValue = isRef(val) ? unref(val) : val;
|
|
6
|
+
if (typeof unwrappedValue === "symbol") {
|
|
7
|
+
return unwrappedValue.toString();
|
|
8
|
+
}
|
|
9
|
+
if (!isObject(unwrappedValue)) {
|
|
10
|
+
return unwrappedValue;
|
|
11
|
+
}
|
|
12
|
+
if (seen.has(unwrappedValue)) {
|
|
13
|
+
return seen.get(unwrappedValue);
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(unwrappedValue)) {
|
|
16
|
+
const result = [];
|
|
17
|
+
seen.set(unwrappedValue, result);
|
|
18
|
+
let list = unwrappedValue.map((value) => toRawDeep(value, clean, seen));
|
|
19
|
+
if (clean) {
|
|
20
|
+
list = list.filter((value) => typeof value !== "function");
|
|
21
|
+
}
|
|
22
|
+
result.push(...list);
|
|
23
|
+
return result;
|
|
24
|
+
} else {
|
|
25
|
+
const result = {};
|
|
26
|
+
seen.set(unwrappedValue, result);
|
|
27
|
+
toRawObject(unwrappedValue, result, clean, seen);
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function toRawObject(obj, target, clean = false, seen = /* @__PURE__ */ new WeakMap()) {
|
|
32
|
+
Object.keys(obj).forEach((key) => {
|
|
33
|
+
if (clean && typeof obj[key] === "function") {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
target[key] = toRawDeep(obj[key], clean, seen);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
toRawDeep
|
|
41
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isMac } from "./env.js";
|
|
2
|
+
import { formatKey } from "./keyboard.js";
|
|
3
|
+
"use strict";
|
|
4
|
+
function makeTooltip(descriptionHtml, keyboardShortcut) {
|
|
5
|
+
return {
|
|
6
|
+
content: `<div>${descriptionHtml}</div><div class="htw-flex htw-items-center htw-gap-1 htw-mt-2 htw-text-sm">${genKeyboardShortcutHtml(keyboardShortcut({ isMac }))}</div>`,
|
|
7
|
+
html: true
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function genKeyboardShortcutHtml(shortcut) {
|
|
11
|
+
return `<span class="htw-border htw-border-gray-600 htw-px-1 htw-rounded-sm htw-text-gray-400">${shortcut.split("+").map((k) => formatKey(k.trim())).join(" ")}</span>`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
makeTooltip
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { computed } from "@poveste/vendors/vue";
|
|
2
|
+
import { useRoute } from "@poveste/vendors/vue-router";
|
|
3
|
+
"use strict";
|
|
4
|
+
function useCurrentVariantRoute(variant) {
|
|
5
|
+
const route = useRoute();
|
|
6
|
+
const isActive = computed(() => route.query.variantId === variant.value.id);
|
|
7
|
+
const targetRoute = computed(() => ({
|
|
8
|
+
...route,
|
|
9
|
+
query: {
|
|
10
|
+
...route.query,
|
|
11
|
+
variantId: variant.value.id
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
return {
|
|
15
|
+
isActive,
|
|
16
|
+
targetRoute
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
useCurrentVariantRoute
|
|
21
|
+
};
|