@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,72 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveDirective, createBlock, createCommentVNode, openBlock, resolveDynamicComponent, withCtx, withDirectives, createVNode, unref, withModifiers, normalizeClass } from "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/vendors/iconify";
|
|
3
|
+
import { HstJson, HstCheckbox, HstNumber, HstText } from "@poveste/controls";
|
|
4
|
+
"use strict";
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "ControlsComponentPropItem",
|
|
7
|
+
props: {
|
|
8
|
+
variant: {},
|
|
9
|
+
component: {},
|
|
10
|
+
definition: {}
|
|
11
|
+
},
|
|
12
|
+
setup(__props) {
|
|
13
|
+
const props = __props;
|
|
14
|
+
const comp = computed(() => {
|
|
15
|
+
switch (props.definition.types?.[0]) {
|
|
16
|
+
case "string":
|
|
17
|
+
return HstText;
|
|
18
|
+
case "number":
|
|
19
|
+
return HstNumber;
|
|
20
|
+
case "boolean":
|
|
21
|
+
return HstCheckbox;
|
|
22
|
+
case "object":
|
|
23
|
+
default:
|
|
24
|
+
return HstJson;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const model = computed({
|
|
28
|
+
get: () => {
|
|
29
|
+
return props.variant.state._hPropState[props.component.index]?.[props.definition.name];
|
|
30
|
+
},
|
|
31
|
+
set: (value) => {
|
|
32
|
+
if (!props.variant.state._hPropState[props.component.index]) {
|
|
33
|
+
props.variant.state._hPropState[props.component.index] = {};
|
|
34
|
+
}
|
|
35
|
+
props.variant.state._hPropState[props.component.index][props.definition.name] = value;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
function reset() {
|
|
39
|
+
if (props.variant.state._hPropState[props.component.index]) {
|
|
40
|
+
delete props.variant.state._hPropState[props.component.index][props.definition.name];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const canReset = computed(() => props.variant.state?._hPropState?.[props.component.index] && props.definition.name in props.variant.state._hPropState[props.component.index]);
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
46
|
+
return comp.value ? (openBlock(), createBlock(resolveDynamicComponent(comp.value), {
|
|
47
|
+
key: 0,
|
|
48
|
+
modelValue: model.value,
|
|
49
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value = $event),
|
|
50
|
+
placeholder: model.value === void 0 ? __props.definition?.default : null,
|
|
51
|
+
class: "histoire-controls-component-prop-item",
|
|
52
|
+
title: `${__props.definition.name}${canReset.value ? " *" : ""}`
|
|
53
|
+
}, {
|
|
54
|
+
actions: withCtx(() => [
|
|
55
|
+
withDirectives(createVNode(unref(Icon), {
|
|
56
|
+
icon: "carbon:erase",
|
|
57
|
+
class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
58
|
+
canReset.value ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
59
|
+
]]),
|
|
60
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => reset(), ["stop"]))
|
|
61
|
+
}, null, 8, ["class"]), [
|
|
62
|
+
[_directive_tooltip, "Remove override"]
|
|
63
|
+
])
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
}, 8, ["modelValue", "placeholder", "title"])) : createCommentVNode("", true);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
_sfc_main as default
|
|
72
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineComponent, resolveDirective, createElementBlock, openBlock, createElementVNode, withDirectives, createVNode, unref, createTextVNode, toDisplayString, Fragment, renderList, createBlock } from "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/vendors/iconify";
|
|
3
|
+
import "./ControlsComponentPropItem.vue.js";
|
|
4
|
+
import _sfc_main$1 from "./ControlsComponentPropItem.vue2.js";
|
|
5
|
+
"use strict";
|
|
6
|
+
const _hoisted_1 = { class: "histoire-controls-component-props" };
|
|
7
|
+
const _hoisted_2 = { class: "htw-font-mono htw-p-2 htw-flex htw-items-center htw-gap-1" };
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "ControlsComponentProps",
|
|
10
|
+
props: {
|
|
11
|
+
variant: {},
|
|
12
|
+
definition: {}
|
|
13
|
+
},
|
|
14
|
+
setup(__props) {
|
|
15
|
+
return (_ctx, _cache) => {
|
|
16
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
17
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
18
|
+
createElementVNode("div", _hoisted_2, [
|
|
19
|
+
withDirectives(createVNode(unref(Icon), {
|
|
20
|
+
icon: "carbon:flash",
|
|
21
|
+
class: "htw-w-4 htw-h-4 htw-text-primary-500 htw-flex-none"
|
|
22
|
+
}, null, 512), [
|
|
23
|
+
[_directive_tooltip, "Auto-detected props"]
|
|
24
|
+
]),
|
|
25
|
+
createElementVNode("div", null, [
|
|
26
|
+
_cache[0] || (_cache[0] = createElementVNode("span", { class: "htw-opacity-30" }, "<", -1)),
|
|
27
|
+
createTextVNode(toDisplayString(__props.definition.name), 1),
|
|
28
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "htw-opacity-30" }, ">", -1))
|
|
29
|
+
])
|
|
30
|
+
]),
|
|
31
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.definition.props, (prop) => {
|
|
32
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
33
|
+
key: prop.name,
|
|
34
|
+
variant: __props.variant,
|
|
35
|
+
component: __props.definition,
|
|
36
|
+
definition: prop
|
|
37
|
+
}, null, 8, ["variant", "component", "definition"]);
|
|
38
|
+
}), 128))
|
|
39
|
+
]);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
_sfc_main as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveDirective, createElementBlock, openBlock, createElementVNode, withDirectives, createVNode, unref, Fragment, renderList, createBlock } from "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/vendors/iconify";
|
|
3
|
+
import "./ControlsComponentStateItem.vue.js";
|
|
4
|
+
import _sfc_main$1 from "./ControlsComponentStateItem.vue2.js";
|
|
5
|
+
"use strict";
|
|
6
|
+
const _hoisted_1 = { class: "histoire-controls-component-init-state" };
|
|
7
|
+
const _hoisted_2 = { class: "htw-p-2 htw-flex htw-items-center htw-gap-1" };
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "ControlsComponentState",
|
|
10
|
+
props: {
|
|
11
|
+
variant: {}
|
|
12
|
+
},
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const stateKeys = computed(() => Object.keys(props.variant.state || {}).filter((key) => !key.startsWith("_h")));
|
|
16
|
+
return (_ctx, _cache) => {
|
|
17
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
18
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
19
|
+
createElementVNode("div", _hoisted_2, [
|
|
20
|
+
withDirectives(createVNode(unref(Icon), {
|
|
21
|
+
icon: "carbon:data-vis-1",
|
|
22
|
+
class: "htw-w-4 htw-h-4 htw-text-primary-500 htw-flex-none"
|
|
23
|
+
}, null, 512), [
|
|
24
|
+
[_directive_tooltip, "Auto-detected state"]
|
|
25
|
+
]),
|
|
26
|
+
_cache[0] || (_cache[0] = createElementVNode("div", null, " State ", -1))
|
|
27
|
+
]),
|
|
28
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(stateKeys.value, (key) => {
|
|
29
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
30
|
+
key,
|
|
31
|
+
item: key,
|
|
32
|
+
variant: __props.variant
|
|
33
|
+
}, null, 8, ["item", "variant"]);
|
|
34
|
+
}), 128))
|
|
35
|
+
]);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export {
|
|
40
|
+
_sfc_main as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineComponent, computed, createBlock, createCommentVNode, openBlock, resolveDynamicComponent } from "@poveste/vendors/vue";
|
|
2
|
+
import { HstJson, HstCheckbox, HstNumber, HstText } from "@poveste/controls";
|
|
3
|
+
"use strict";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "ControlsComponentStateItem",
|
|
6
|
+
props: {
|
|
7
|
+
variant: {},
|
|
8
|
+
item: {}
|
|
9
|
+
},
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
const comp = computed(() => {
|
|
13
|
+
switch (typeof props.variant.state[props.item]) {
|
|
14
|
+
case "string":
|
|
15
|
+
return HstText;
|
|
16
|
+
case "number":
|
|
17
|
+
return HstNumber;
|
|
18
|
+
case "boolean":
|
|
19
|
+
return HstCheckbox;
|
|
20
|
+
case "object":
|
|
21
|
+
default:
|
|
22
|
+
return HstJson;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const model = computed({
|
|
26
|
+
get: () => {
|
|
27
|
+
return props.variant.state[props.item];
|
|
28
|
+
},
|
|
29
|
+
set: (value) => {
|
|
30
|
+
props.variant.state[props.item] = value;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return comp.value ? (openBlock(), createBlock(resolveDynamicComponent(comp.value), {
|
|
35
|
+
key: 0,
|
|
36
|
+
modelValue: model.value,
|
|
37
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
38
|
+
class: "histoire-controls-component-prop-item",
|
|
39
|
+
title: props.item
|
|
40
|
+
}, null, 8, ["modelValue", "title"])) : createCommentVNode("", true);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export {
|
|
45
|
+
_sfc_main as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { defineComponent, toRefs, computed, createBlock, openBlock, withCtx, createVNode, createTextVNode, normalizeClass, unref, createCommentVNode, toDisplayString } from "@poveste/vendors/vue";
|
|
2
|
+
import { useEventsStore } from "../../stores/events.js";
|
|
3
|
+
import "../base/BaseOverflowMenu.vue.js";
|
|
4
|
+
import BaseOverflowTab from "../base/BaseOverflowTab.vue.js";
|
|
5
|
+
import BaseTab from "../base/BaseTab.vue.js";
|
|
6
|
+
import BaseTag from "../base/BaseTag.vue.js";
|
|
7
|
+
import "./StoryDocs.vue.js";
|
|
8
|
+
import { useStoryDoc } from "./StoryDocs.vue2.js";
|
|
9
|
+
import _sfc_main$1 from "../base/BaseOverflowMenu.vue2.js";
|
|
10
|
+
"use strict";
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "PaneTabs",
|
|
13
|
+
props: {
|
|
14
|
+
story: {},
|
|
15
|
+
variant: {}
|
|
16
|
+
},
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const props = __props;
|
|
19
|
+
const { story } = toRefs(props);
|
|
20
|
+
const { renderedDoc } = useStoryDoc(story);
|
|
21
|
+
const eventsStore = useEventsStore();
|
|
22
|
+
const hasEvents = computed(() => eventsStore.events.length);
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createBlock(_sfc_main$1, { class: "histoire-pane-tabs htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750" }, {
|
|
25
|
+
overflow: withCtx(() => [
|
|
26
|
+
createVNode(BaseOverflowTab, {
|
|
27
|
+
to: { ..._ctx.$route, query: { ..._ctx.$route.query, tab: "" } },
|
|
28
|
+
matched: !_ctx.$route.query.tab
|
|
29
|
+
}, {
|
|
30
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
31
|
+
createTextVNode(" Controls ", -1)
|
|
32
|
+
])]),
|
|
33
|
+
_: 1
|
|
34
|
+
}, 8, ["to", "matched"]),
|
|
35
|
+
createVNode(BaseOverflowTab, {
|
|
36
|
+
to: { ..._ctx.$route, query: { ..._ctx.$route.query, tab: "docs" } },
|
|
37
|
+
matched: _ctx.$route.query.tab === "docs",
|
|
38
|
+
class: normalizeClass({
|
|
39
|
+
"opacity-50": !unref(renderedDoc)
|
|
40
|
+
})
|
|
41
|
+
}, {
|
|
42
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
43
|
+
createTextVNode(" Docs ", -1)
|
|
44
|
+
])]),
|
|
45
|
+
_: 1
|
|
46
|
+
}, 8, ["to", "matched", "class"]),
|
|
47
|
+
createVNode(BaseOverflowTab, {
|
|
48
|
+
to: { ..._ctx.$route, query: { ..._ctx.$route.query, tab: "events" } },
|
|
49
|
+
matched: _ctx.$route.query.tab === "events",
|
|
50
|
+
class: normalizeClass({
|
|
51
|
+
"htw-opacity-50": !hasEvents.value
|
|
52
|
+
})
|
|
53
|
+
}, {
|
|
54
|
+
default: withCtx(() => [
|
|
55
|
+
_cache[5] || (_cache[5] = createTextVNode(" Events ", -1)),
|
|
56
|
+
unref(eventsStore).unseen ? (openBlock(), createBlock(BaseTag, { key: 0 }, {
|
|
57
|
+
default: withCtx(() => [
|
|
58
|
+
createTextVNode(toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)
|
|
59
|
+
]),
|
|
60
|
+
_: 1
|
|
61
|
+
})) : createCommentVNode("", true)
|
|
62
|
+
]),
|
|
63
|
+
_: 1
|
|
64
|
+
}, 8, ["to", "matched", "class"])
|
|
65
|
+
]),
|
|
66
|
+
default: withCtx(() => [
|
|
67
|
+
createVNode(BaseTab, {
|
|
68
|
+
to: { ..._ctx.$route, query: { ..._ctx.$route.query, tab: "" } },
|
|
69
|
+
matched: !_ctx.$route.query.tab
|
|
70
|
+
}, {
|
|
71
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
72
|
+
createTextVNode(" Controls ", -1)
|
|
73
|
+
])]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 8, ["to", "matched"]),
|
|
76
|
+
createVNode(BaseTab, {
|
|
77
|
+
to: { ..._ctx.$route, query: { ..._ctx.$route.query, tab: "docs" } },
|
|
78
|
+
matched: _ctx.$route.query.tab === "docs",
|
|
79
|
+
class: normalizeClass({
|
|
80
|
+
"htw-opacity-50": !unref(renderedDoc)
|
|
81
|
+
})
|
|
82
|
+
}, {
|
|
83
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
84
|
+
createTextVNode(" Docs ", -1)
|
|
85
|
+
])]),
|
|
86
|
+
_: 1
|
|
87
|
+
}, 8, ["to", "matched", "class"]),
|
|
88
|
+
createVNode(BaseTab, {
|
|
89
|
+
to: { ..._ctx.$route, query: { ..._ctx.$route.query, tab: "events" } },
|
|
90
|
+
matched: _ctx.$route.query.tab === "events",
|
|
91
|
+
class: normalizeClass({
|
|
92
|
+
"htw-opacity-50": !hasEvents.value
|
|
93
|
+
})
|
|
94
|
+
}, {
|
|
95
|
+
default: withCtx(() => [
|
|
96
|
+
_cache[2] || (_cache[2] = createTextVNode(" Events ", -1)),
|
|
97
|
+
unref(eventsStore).unseen ? (openBlock(), createBlock(BaseTag, { key: 0 }, {
|
|
98
|
+
default: withCtx(() => [
|
|
99
|
+
createTextVNode(toDisplayString(unref(eventsStore).unseen <= 99 ? unref(eventsStore).unseen : "99+"), 1)
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
})) : createCommentVNode("", true)
|
|
103
|
+
]),
|
|
104
|
+
_: 1
|
|
105
|
+
}, 8, ["to", "matched", "class"])
|
|
106
|
+
]),
|
|
107
|
+
_: 1
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
export {
|
|
113
|
+
_sfc_main as default
|
|
114
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { defineComponent, computed, onMounted, ref, resolveDirective, createElementBlock, openBlock, createElementVNode, withDirectives, createVNode, withKeys, unref, isRef, withCtx, createCommentVNode, toDisplayString, createBlock, withModifiers, vModelText, normalizeClass, nextTick } from "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/vendors/iconify";
|
|
3
|
+
import { clone, omit, applyState } from "@poveste/shared";
|
|
4
|
+
import { useStorage, useTimeoutFn, onClickOutside } from "@poveste/vendors/vue-use";
|
|
5
|
+
import { toRawDeep } from "../../util/state.js";
|
|
6
|
+
import "../base/BaseSelect.vue.js";
|
|
7
|
+
import _sfc_main$1 from "../base/BaseSelect.vue2.js";
|
|
8
|
+
"use strict";
|
|
9
|
+
const _hoisted_1 = { class: "histoire-state-presets htw-flex htw-gap-2 htw-w-full htw-items-center" };
|
|
10
|
+
const _hoisted_2 = ["onUpdate:modelValue"];
|
|
11
|
+
const _hoisted_3 = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "htw-flex htw-items-center htw-gap-2"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_4 = { class: "htw-flex-1 htw-truncate" };
|
|
16
|
+
const _hoisted_5 = { class: "htw-flex htw-gap-2 htw-items-center" };
|
|
17
|
+
const _hoisted_6 = { class: "htw-flex-1 htw-truncate" };
|
|
18
|
+
const DEFAULT_ID = "default";
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
|
+
__name: "StatePresets",
|
|
21
|
+
props: {
|
|
22
|
+
story: {},
|
|
23
|
+
variant: {}
|
|
24
|
+
},
|
|
25
|
+
setup(__props) {
|
|
26
|
+
const props = __props;
|
|
27
|
+
const saveId = computed(() => `${props.story.id}:${props.variant.id}`);
|
|
28
|
+
const omitKeys = ["_hPropDefs"];
|
|
29
|
+
const defaultState = clone(omit(toRawDeep(props.variant.state), omitKeys));
|
|
30
|
+
const selectedOption = useStorage(
|
|
31
|
+
`_histoire-presets/${saveId.value}/selected`,
|
|
32
|
+
DEFAULT_ID
|
|
33
|
+
);
|
|
34
|
+
const presetStates = useStorage(
|
|
35
|
+
`_histoire-presets/${saveId.value}/states`,
|
|
36
|
+
/* @__PURE__ */ new Map()
|
|
37
|
+
);
|
|
38
|
+
const presetsOptions = computed(() => {
|
|
39
|
+
const options = { [DEFAULT_ID]: "Initial state" };
|
|
40
|
+
presetStates.value.forEach((value, key) => {
|
|
41
|
+
options[key] = value.label;
|
|
42
|
+
});
|
|
43
|
+
return options;
|
|
44
|
+
});
|
|
45
|
+
function resetState() {
|
|
46
|
+
selectedOption.value = DEFAULT_ID;
|
|
47
|
+
applyState(props.variant.state, clone(defaultState));
|
|
48
|
+
}
|
|
49
|
+
function applyPreset(id) {
|
|
50
|
+
if (id === DEFAULT_ID) {
|
|
51
|
+
resetState();
|
|
52
|
+
} else if (presetStates.value.has(id)) {
|
|
53
|
+
applyState(props.variant.state, clone(toRawDeep(presetStates.value.get(id).state)));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
onMounted(() => {
|
|
57
|
+
if (selectedOption.value !== DEFAULT_ID) {
|
|
58
|
+
applyPreset(selectedOption.value);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const input = ref();
|
|
62
|
+
const select = ref();
|
|
63
|
+
const canEdit = computed(() => selectedOption.value !== DEFAULT_ID);
|
|
64
|
+
const isEditing = ref(false);
|
|
65
|
+
async function createPreset() {
|
|
66
|
+
const id = (/* @__PURE__ */ new Date()).getTime().toString();
|
|
67
|
+
presetStates.value.set(id, { state: clone(omit(toRawDeep(props.variant.state), omitKeys)), label: "New preset" });
|
|
68
|
+
selectedOption.value = id;
|
|
69
|
+
isEditing.value = true;
|
|
70
|
+
await nextTick();
|
|
71
|
+
input.value.select();
|
|
72
|
+
}
|
|
73
|
+
const savedNotif = ref(false);
|
|
74
|
+
const savedTimeout = useTimeoutFn(() => {
|
|
75
|
+
savedNotif.value = false;
|
|
76
|
+
}, 1e3);
|
|
77
|
+
async function savePreset() {
|
|
78
|
+
if (!canEdit.value) return;
|
|
79
|
+
const preset = presetStates.value.get(selectedOption.value);
|
|
80
|
+
preset.state = clone(omit(toRawDeep(props.variant.state), omitKeys));
|
|
81
|
+
savedNotif.value = true;
|
|
82
|
+
savedTimeout.start();
|
|
83
|
+
}
|
|
84
|
+
function deletePreset(id) {
|
|
85
|
+
if (!confirm("Are you sure you want to delete this preset?")) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (selectedOption.value === id) {
|
|
89
|
+
resetState();
|
|
90
|
+
}
|
|
91
|
+
presetStates.value.delete(id);
|
|
92
|
+
}
|
|
93
|
+
async function startEditing() {
|
|
94
|
+
if (!canEdit.value) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
isEditing.value = true;
|
|
98
|
+
await nextTick();
|
|
99
|
+
input.value.select();
|
|
100
|
+
}
|
|
101
|
+
function stopEditing() {
|
|
102
|
+
isEditing.value = false;
|
|
103
|
+
}
|
|
104
|
+
onClickOutside(select, stopEditing);
|
|
105
|
+
return (_ctx, _cache) => {
|
|
106
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
107
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
108
|
+
createElementVNode("div", {
|
|
109
|
+
ref_key: "select",
|
|
110
|
+
ref: select,
|
|
111
|
+
class: "htw-flex-1 htw-min-w-0"
|
|
112
|
+
}, [
|
|
113
|
+
createVNode(_sfc_main$1, {
|
|
114
|
+
modelValue: unref(selectedOption),
|
|
115
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
|
|
116
|
+
options: presetsOptions.value,
|
|
117
|
+
onDblclick: _cache[3] || (_cache[3] = ($event) => startEditing()),
|
|
118
|
+
onKeydown: [
|
|
119
|
+
_cache[4] || (_cache[4] = withKeys(($event) => stopEditing(), ["enter"])),
|
|
120
|
+
_cache[5] || (_cache[5] = withKeys(($event) => stopEditing(), ["escape"]))
|
|
121
|
+
],
|
|
122
|
+
onSelect: _cache[6] || (_cache[6] = (id) => applyPreset(id))
|
|
123
|
+
}, {
|
|
124
|
+
default: withCtx(({ label }) => [
|
|
125
|
+
isEditing.value ? withDirectives((openBlock(), createElementBlock("input", {
|
|
126
|
+
key: 0,
|
|
127
|
+
ref_key: "input",
|
|
128
|
+
ref: input,
|
|
129
|
+
"onUpdate:modelValue": ($event) => unref(presetStates).get(unref(selectedOption)).label = $event,
|
|
130
|
+
type: "text",
|
|
131
|
+
class: "htw-text-inherit htw-bg-transparent htw-w-full htw-h-full htw-outline-none",
|
|
132
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
133
|
+
}, ["stop", "prevent"]))
|
|
134
|
+
}, null, 8, _hoisted_2)), [
|
|
135
|
+
[vModelText, unref(presetStates).get(unref(selectedOption)).label]
|
|
136
|
+
]) : (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
137
|
+
createElementVNode("span", _hoisted_4, toDisplayString(label), 1),
|
|
138
|
+
canEdit.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
139
|
+
key: 0,
|
|
140
|
+
icon: "carbon:edit",
|
|
141
|
+
class: "htw-flex-none htw-cursor-pointer htw-w-4 htw-h-4 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",
|
|
142
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => startEditing(), ["stop"]))
|
|
143
|
+
}, null, 512)), [
|
|
144
|
+
[_directive_tooltip, "Rename this preset"]
|
|
145
|
+
]) : createCommentVNode("", true)
|
|
146
|
+
]))
|
|
147
|
+
]),
|
|
148
|
+
option: withCtx(({ label, value }) => [
|
|
149
|
+
createElementVNode("div", _hoisted_5, [
|
|
150
|
+
createElementVNode("span", _hoisted_6, toDisplayString(label), 1),
|
|
151
|
+
value !== DEFAULT_ID ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
152
|
+
key: 0,
|
|
153
|
+
icon: "carbon:trash-can",
|
|
154
|
+
class: "htw-flex-none htw-cursor-pointer htw-w-4 htw-h-4 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",
|
|
155
|
+
onClick: withModifiers(($event) => deletePreset(value), ["stop"])
|
|
156
|
+
}, null, 8, ["onClick"])), [
|
|
157
|
+
[_directive_tooltip, "Delete this preset"]
|
|
158
|
+
]) : createCommentVNode("", true)
|
|
159
|
+
])
|
|
160
|
+
]),
|
|
161
|
+
_: 1
|
|
162
|
+
}, 8, ["modelValue", "options"])
|
|
163
|
+
], 512),
|
|
164
|
+
withDirectives(createVNode(unref(Icon), {
|
|
165
|
+
icon: savedNotif.value ? "carbon:checkmark" : "carbon:save",
|
|
166
|
+
class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
167
|
+
canEdit.value ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
168
|
+
]]),
|
|
169
|
+
onClick: _cache[7] || (_cache[7] = ($event) => savePreset())
|
|
170
|
+
}, null, 8, ["icon", "class"]), [
|
|
171
|
+
[_directive_tooltip, savedNotif.value ? "Saved!" : canEdit.value ? "Save to preset" : null]
|
|
172
|
+
]),
|
|
173
|
+
withDirectives(createVNode(unref(Icon), {
|
|
174
|
+
icon: "carbon:add-alt",
|
|
175
|
+
class: "htw-cursor-pointer htw-w-4 htw-h-4 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",
|
|
176
|
+
onClick: _cache[8] || (_cache[8] = ($event) => createPreset())
|
|
177
|
+
}, null, 512), [
|
|
178
|
+
[_directive_tooltip, "Create new preset"]
|
|
179
|
+
]),
|
|
180
|
+
withDirectives(createVNode(unref(Icon), {
|
|
181
|
+
icon: "carbon:reset",
|
|
182
|
+
class: "htw-cursor-pointer htw-w-4 htw-h-4 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",
|
|
183
|
+
onClick: _cache[9] || (_cache[9] = ($event) => resetState())
|
|
184
|
+
}, null, 512), [
|
|
185
|
+
[_directive_tooltip, "Reset to initial state"]
|
|
186
|
+
])
|
|
187
|
+
]);
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
export {
|
|
192
|
+
_sfc_main as default
|
|
193
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, computed, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, createVNode, withCtx, unref, Fragment, renderList } from "@poveste/vendors/vue";
|
|
2
|
+
import { Icon } from "@poveste/vendors/iconify";
|
|
3
|
+
import BaseEmpty from "../base/BaseEmpty.vue.js";
|
|
4
|
+
import "../story/GenericRenderStory.vue.js";
|
|
5
|
+
import "./ControlsComponentProps.vue.js";
|
|
6
|
+
import "./ControlsComponentState.vue.js";
|
|
7
|
+
import "./StatePresets.vue.js";
|
|
8
|
+
import _sfc_main$1 from "./StatePresets.vue2.js";
|
|
9
|
+
import _sfc_main$2 from "../story/GenericRenderStory.vue2.js";
|
|
10
|
+
import _sfc_main$3 from "./ControlsComponentState.vue2.js";
|
|
11
|
+
import _sfc_main$4 from "./ControlsComponentProps.vue2.js";
|
|
12
|
+
"use strict";
|
|
13
|
+
const _hoisted_1 = {
|
|
14
|
+
"data-test-id": "story-controls",
|
|
15
|
+
class: "histoire-story-controls htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-750"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_2 = { class: "htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center" };
|
|
18
|
+
const _hoisted_3 = { key: 1 };
|
|
19
|
+
const _hoisted_4 = { key: 3 };
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
__name: "StoryControls",
|
|
22
|
+
props: {
|
|
23
|
+
variant: {
|
|
24
|
+
type: Object,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
story: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
setup(__props) {
|
|
33
|
+
const props = __props;
|
|
34
|
+
const ready = ref(false);
|
|
35
|
+
watch(() => props.variant, () => {
|
|
36
|
+
ready.value = false;
|
|
37
|
+
});
|
|
38
|
+
const hasCustomControls = computed(() => props.variant.slots().controls || props.story.slots().controls);
|
|
39
|
+
const hasInitState = computed(() => Object.entries(props.variant.state || {}).filter(([key]) => !key.startsWith("_h")).length > 0);
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
42
|
+
createElementVNode("div", _hoisted_2, [
|
|
43
|
+
ready.value || !hasCustomControls.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
44
|
+
key: 0,
|
|
45
|
+
story: __props.story,
|
|
46
|
+
variant: __props.variant
|
|
47
|
+
}, null, 8, ["story", "variant"])) : createCommentVNode("", true)
|
|
48
|
+
]),
|
|
49
|
+
hasCustomControls.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
50
|
+
key: `${__props.story.id}-${__props.variant.id}`,
|
|
51
|
+
"slot-name": "controls",
|
|
52
|
+
variant: __props.variant,
|
|
53
|
+
story: __props.story,
|
|
54
|
+
class: "__histoire-render-custom-controls htw-flex-none",
|
|
55
|
+
onReady: _cache[0] || (_cache[0] = ($event) => ready.value = true)
|
|
56
|
+
}, null, 8, ["variant", "story"])) : hasInitState.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
57
|
+
createVNode(_sfc_main$3, {
|
|
58
|
+
class: "htw-flex-none htw-my-2",
|
|
59
|
+
variant: __props.variant
|
|
60
|
+
}, null, 8, ["variant"])
|
|
61
|
+
])) : !__props.variant.state?._hPropDefs?.length ? (openBlock(), createBlock(BaseEmpty, { key: 2 }, {
|
|
62
|
+
default: withCtx(() => [
|
|
63
|
+
createVNode(unref(Icon), {
|
|
64
|
+
icon: "carbon:audio-console",
|
|
65
|
+
class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
|
|
66
|
+
}),
|
|
67
|
+
_cache[1] || (_cache[1] = createElementVNode("span", null, "No controls available for this story", -1))
|
|
68
|
+
]),
|
|
69
|
+
_: 1
|
|
70
|
+
})) : createCommentVNode("", true),
|
|
71
|
+
__props.variant.state?._hPropDefs?.length ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
72
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.variant.state._hPropDefs, (def, index) => {
|
|
73
|
+
return openBlock(), createBlock(_sfc_main$4, {
|
|
74
|
+
key: index,
|
|
75
|
+
variant: __props.variant,
|
|
76
|
+
definition: def,
|
|
77
|
+
class: "htw-flex-none htw-my-2"
|
|
78
|
+
}, null, 8, ["variant", "definition"]);
|
|
79
|
+
}), 128))
|
|
80
|
+
])) : createCommentVNode("", true)
|
|
81
|
+
]);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export {
|
|
86
|
+
_sfc_main as default
|
|
87
|
+
};
|