@poveste/app 0.14.0 → 0.15.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/dist/bundled/app.css +26 -26
- package/dist/bundled/components/app/TopBarChipItem.js +1 -1
- package/dist/bundled/components/base/BaseEmpty.js +2 -2
- package/dist/bundled/components/base/BaseOverflowMenu.vue_vue_type_script_setup_true_lang.js +14 -14
- package/dist/bundled/components/base/BaseSelect.vue_vue_type_script_setup_true_lang.js +158 -26
- package/dist/bundled/components/base/BaseSplitPane.js +1 -1
- package/dist/bundled/components/command/PromptSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js +20 -14
- package/dist/bundled/components/panel/PaneTabs.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/bundled/components/panel/StatePresets.vue_vue_type_script_setup_true_lang.js +78 -49
- package/dist/bundled/components/panel/StorySidePanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/panel/StorySourceCode.js +1 -1
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/bundled/components/search/SearchItemContent.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/bundled/components/search/SearchPane.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/bundled/components/story/StoryResponsivePreview.js +1 -1
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js +8 -4
- package/dist/bundled/components/story/StoryVariantGridItem.js +1 -1
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue_vue_type_script_setup_true_lang.js +9 -6
- package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/bundled/components/toolbar/ToolbarTitle.js +1 -1
- package/dist/bundled/components/toolbar/ToolbarTitle.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/tree/StoryGroup.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/bundled/components/tree/StoryList.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/tree/StoryListFolder.js +1 -1
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/tree/StoryListItem.js +1 -1
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/sandbox.js +3 -2
- package/dist/bundled/stores/story.js +2 -2
- package/dist/bundled/util/commands.js +1 -1
- package/dist/bundled/util/dark.js +1 -1
- package/dist/bundled/util/events.js +1 -1
- package/dist/bundled/util/grid-slots.js +1 -1
- package/dist/bundled/util/keyboard.js +8 -14
- package/dist/bundled/util/mapping.js +2 -2
- package/dist/bundled/util/render-tracker.js +33 -0
- package/dist/bundled/util/variant.js +12 -2
- package/dist/style.css +23 -1
- package/package.json +13 -17
- package/src/__tests__/render-tracker.spec.ts +38 -0
- package/src/app/App.vue +1 -1
- package/src/app/components/app/TopBarChipItem.vue +1 -1
- package/src/app/components/base/BaseEmpty.vue +1 -1
- package/src/app/components/base/BaseListItemLink.vue +4 -2
- package/src/app/components/base/BaseOverflowMenu.vue +17 -16
- package/src/app/components/base/BaseSelect.vue +171 -15
- package/src/app/components/base/BaseSplitPane.vue +2 -2
- package/src/app/components/command/PromptSelect.vue +1 -1
- package/src/app/components/panel/ControlsComponentPropItem.vue +26 -15
- package/src/app/components/panel/PaneTabs.vue +6 -6
- package/src/app/components/panel/StatePresets.vue +100 -64
- package/src/app/components/panel/StorySidePanel.vue +1 -1
- package/src/app/components/panel/StorySourceCode.vue +6 -5
- package/src/app/components/search/SearchItemContent.vue +2 -1
- package/src/app/components/search/SearchPane.vue +2 -3
- package/src/app/components/story/StoryResponsivePreview.vue +6 -2
- package/src/app/components/story/StoryVariantGridItem.vue +1 -1
- package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +14 -8
- package/src/app/components/story/StoryView.vue +3 -1
- package/src/app/components/toolbar/ToolbarTitle.vue +2 -2
- package/src/app/components/tree/StoryGroup.vue +2 -2
- package/src/app/components/tree/StoryList.vue +2 -2
- package/src/app/components/tree/StoryListFolder.vue +2 -2
- package/src/app/components/tree/StoryListItem.vue +1 -1
- package/src/app/sandbox.ts +8 -2
- package/src/app/stores/story.ts +2 -2
- package/src/app/types.ts +4 -4
- package/src/app/util/commands.ts +1 -1
- package/src/app/util/dark.ts +1 -1
- package/src/app/util/env.ts +0 -1
- package/src/app/util/events.ts +6 -5
- package/src/app/util/grid-slots.ts +1 -1
- package/src/app/util/keyboard.ts +7 -11
- package/src/app/util/mapping.ts +2 -2
- package/src/app/util/render-tracker.ts +31 -0
- package/src/app/util/state.ts +3 -3
- package/src/app/util/variant.ts +12 -2
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { toPresetState, toRawDeep } from "../../util/state.js";
|
|
2
2
|
import BaseSelect_default from "../base/BaseSelect.js";
|
|
3
|
-
import { onClickOutside, useStorage, useTimeoutFn } from "@poveste/vendors/vue-use";
|
|
4
|
-
import { computed, createBlock,
|
|
3
|
+
import { onClickOutside, useLiveAnnouncer, useStorage, useTimeoutFn } from "@poveste/vendors/vue-use";
|
|
4
|
+
import { computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, isRef, nextTick, normalizeClass, onMounted, openBlock, ref, resolveDirective, unref, vModelText, withDirectives, withKeys } from "@poveste/vendors/vue";
|
|
5
5
|
import { Icon } from "@poveste/vendors/iconify";
|
|
6
6
|
import { applyState, clone } from "@poveste/shared";
|
|
7
7
|
//#region src/app/components/panel/StatePresets.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var _hoisted_1 = { class: "poveste-state-presets flex gap-2 w-full items-center" };
|
|
9
|
-
var _hoisted_2 =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
var _hoisted_3 = { class: "flex-1 truncate" };
|
|
14
|
-
var _hoisted_4 = { class: "flex gap-2 items-center" };
|
|
15
|
-
var _hoisted_5 = { class: "flex-1 truncate" };
|
|
9
|
+
var _hoisted_2 = ["disabled"];
|
|
10
|
+
var _hoisted_3 = ["disabled"];
|
|
11
|
+
var _hoisted_4 = ["disabled"];
|
|
16
12
|
var DEFAULT_ID = "default";
|
|
17
13
|
var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
18
14
|
__name: "StatePresets",
|
|
@@ -50,6 +46,7 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
50
46
|
});
|
|
51
47
|
const input = ref();
|
|
52
48
|
const select = ref();
|
|
49
|
+
const picker = ref();
|
|
53
50
|
const canEdit = computed(() => selectedOption.value !== DEFAULT_ID);
|
|
54
51
|
const isEditing = ref(false);
|
|
55
52
|
async function createPreset() {
|
|
@@ -71,6 +68,7 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
71
68
|
}
|
|
72
69
|
});
|
|
73
70
|
const savedNotif = ref(false);
|
|
71
|
+
const { polite } = useLiveAnnouncer();
|
|
74
72
|
const savedTimeout = useTimeoutFn(() => {
|
|
75
73
|
savedNotif.value = false;
|
|
76
74
|
}, 1e3);
|
|
@@ -81,6 +79,7 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
81
79
|
preset.state = toPresetState(props.variant.state, omitKeys);
|
|
82
80
|
savedNotif.value = true;
|
|
83
81
|
savedTimeout.start();
|
|
82
|
+
polite("Preset saved");
|
|
84
83
|
}
|
|
85
84
|
function deletePreset(id) {
|
|
86
85
|
if (!confirm("Are you sure you want to delete this preset?")) return;
|
|
@@ -93,10 +92,15 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
93
92
|
await nextTick();
|
|
94
93
|
input.value?.select();
|
|
95
94
|
}
|
|
96
|
-
function stopEditing() {
|
|
95
|
+
async function stopEditing(refocus = false) {
|
|
96
|
+
if (!isEditing.value) return;
|
|
97
97
|
isEditing.value = false;
|
|
98
|
+
if (refocus) {
|
|
99
|
+
await nextTick();
|
|
100
|
+
picker.value?.focus();
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
|
-
onClickOutside(select, stopEditing);
|
|
103
|
+
onClickOutside(select, () => stopEditing());
|
|
100
104
|
return (_ctx, _cache) => {
|
|
101
105
|
const _directive_tooltip = resolveDirective("tooltip");
|
|
102
106
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
@@ -104,53 +108,78 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
104
108
|
ref_key: "select",
|
|
105
109
|
ref: select,
|
|
106
110
|
class: "flex-1 min-w-0"
|
|
107
|
-
}, [
|
|
111
|
+
}, [isEditing.value ? withDirectives((openBlock(), createElementBlock("input", {
|
|
112
|
+
key: 0,
|
|
113
|
+
ref_key: "input",
|
|
114
|
+
ref: input,
|
|
115
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => editingLabel.value = $event),
|
|
116
|
+
type: "text",
|
|
117
|
+
"aria-label": "Preset name",
|
|
118
|
+
class: "text-inherit bg-transparent w-full px-2 h-[27px] -my-1 border border-solid border-primary-500 rounded-sm outline-none",
|
|
119
|
+
onKeydown: [_cache[1] || (_cache[1] = withKeys(($event) => stopEditing(true), ["enter"])), _cache[2] || (_cache[2] = withKeys(($event) => stopEditing(true), ["escape"]))]
|
|
120
|
+
}, null, 544)), [[vModelText, editingLabel.value]]) : (openBlock(), createBlock(BaseSelect_default, {
|
|
121
|
+
key: 1,
|
|
122
|
+
ref_key: "picker",
|
|
123
|
+
ref: picker,
|
|
108
124
|
modelValue: unref(selectedOption),
|
|
109
125
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
|
|
126
|
+
label: "Preset",
|
|
110
127
|
options: presetsOptions.value,
|
|
111
128
|
onDblclick: _cache[4] || (_cache[4] = ($event) => startEditing()),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
onSelect: _cache[5] || (_cache[5] = (id) => applyPreset(id))
|
|
130
|
+
}, null, 8, ["modelValue", "options"]))], 512),
|
|
131
|
+
withDirectives((openBlock(), createElementBlock("button", {
|
|
132
|
+
type: "button",
|
|
133
|
+
"data-testid": "preset-rename",
|
|
134
|
+
"aria-label": "Rename preset",
|
|
135
|
+
disabled: !canEdit.value,
|
|
136
|
+
class: normalizeClass(["flex-none flex p-0 bg-transparent border-0 cursor-pointer text-gray-900 dark:text-gray-100 hover:text-primary-500 dark:hover:text-primary-400", [canEdit.value ? "opacity-50 hover:opacity-100 focus-visible:opacity-100" : "opacity-25 pointer-events-none"]]),
|
|
137
|
+
onClick: _cache[6] || (_cache[6] = ($event) => startEditing())
|
|
138
|
+
}, [createVNode(unref(Icon), {
|
|
139
|
+
icon: "carbon:edit",
|
|
140
|
+
class: "w-4 h-4"
|
|
141
|
+
})], 10, _hoisted_2)), [[_directive_tooltip, canEdit.value ? "Rename this preset" : null]]),
|
|
142
|
+
withDirectives((openBlock(), createElementBlock("button", {
|
|
143
|
+
type: "button",
|
|
144
|
+
"data-testid": "preset-delete",
|
|
145
|
+
"aria-label": "Delete preset",
|
|
146
|
+
disabled: !canEdit.value,
|
|
147
|
+
class: normalizeClass(["flex-none flex p-0 bg-transparent border-0 cursor-pointer text-gray-900 dark:text-gray-100 hover:text-primary-500 dark:hover:text-primary-400", [canEdit.value ? "opacity-50 hover:opacity-100 focus-visible:opacity-100" : "opacity-25 pointer-events-none"]]),
|
|
148
|
+
onClick: _cache[7] || (_cache[7] = ($event) => deletePreset(unref(selectedOption)))
|
|
149
|
+
}, [createVNode(unref(Icon), {
|
|
150
|
+
icon: "carbon:trash-can",
|
|
151
|
+
class: "w-4 h-4"
|
|
152
|
+
})], 10, _hoisted_3)), [[_directive_tooltip, canEdit.value ? "Delete this preset" : null]]),
|
|
153
|
+
withDirectives((openBlock(), createElementBlock("button", {
|
|
154
|
+
type: "button",
|
|
138
155
|
"data-testid": "preset-save",
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
"aria-label": "Save to preset",
|
|
157
|
+
disabled: !canEdit.value,
|
|
158
|
+
class: normalizeClass(["flex-none flex p-0 bg-transparent border-0 cursor-pointer text-gray-900 dark:text-gray-100 hover:text-primary-500 dark:hover:text-primary-400", [canEdit.value ? "opacity-50 hover:opacity-100 focus-visible:opacity-100" : "opacity-25 pointer-events-none"]]),
|
|
141
159
|
onClick: _cache[8] || (_cache[8] = ($event) => savePreset())
|
|
142
|
-
},
|
|
143
|
-
|
|
160
|
+
}, [createVNode(unref(Icon), {
|
|
161
|
+
icon: savedNotif.value ? "carbon:checkmark" : "carbon:save",
|
|
162
|
+
class: "w-4 h-4"
|
|
163
|
+
}, null, 8, ["icon"])], 10, _hoisted_4)), [[_directive_tooltip, savedNotif.value ? "Saved!" : canEdit.value ? "Save to preset" : null]]),
|
|
164
|
+
withDirectives((openBlock(), createElementBlock("button", {
|
|
165
|
+
type: "button",
|
|
144
166
|
"data-testid": "preset-create",
|
|
145
|
-
|
|
146
|
-
class: "cursor-pointer
|
|
167
|
+
"aria-label": "Create new preset",
|
|
168
|
+
class: "flex-none flex p-0 bg-transparent border-0 cursor-pointer text-gray-900 dark:text-gray-100 hover:text-primary-500 dark:hover:text-primary-400 opacity-50 hover:opacity-100 focus-visible:opacity-100",
|
|
147
169
|
onClick: _cache[9] || (_cache[9] = ($event) => createPreset())
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
170
|
+
}, [createVNode(unref(Icon), {
|
|
171
|
+
icon: "carbon:add-alt",
|
|
172
|
+
class: "w-4 h-4"
|
|
173
|
+
})])), [[_directive_tooltip, "Create new preset"]]),
|
|
174
|
+
withDirectives((openBlock(), createElementBlock("button", {
|
|
175
|
+
type: "button",
|
|
176
|
+
"aria-label": "Reset to initial state",
|
|
177
|
+
class: "flex-none flex p-0 bg-transparent border-0 cursor-pointer text-gray-900 dark:text-gray-100 hover:text-primary-500 dark:hover:text-primary-400 opacity-50 hover:opacity-100 focus-visible:opacity-100",
|
|
152
178
|
onClick: _cache[10] || (_cache[10] = ($event) => resetState())
|
|
153
|
-
},
|
|
179
|
+
}, [createVNode(unref(Icon), {
|
|
180
|
+
icon: "carbon:reset",
|
|
181
|
+
class: "w-4 h-4"
|
|
182
|
+
})])), [[_directive_tooltip, "Reset to initial state"]])
|
|
154
183
|
]);
|
|
155
184
|
};
|
|
156
185
|
}
|
|
@@ -21,7 +21,7 @@ var StorySidePanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
|
|
|
21
21
|
const innerOrientation = computed(() => layoutStore.settings.storyOptionsPlacement === "bottom" ? "landscape" : "portrait");
|
|
22
22
|
const route = useRoute();
|
|
23
23
|
const panelContentComponent = computed(() => {
|
|
24
|
-
switch (route.query
|
|
24
|
+
switch (route.query["tab"]) {
|
|
25
25
|
case "docs": return StoryDocs_default;
|
|
26
26
|
case "events": return StoryEvents_default;
|
|
27
27
|
default: return StoryControls_default;
|
|
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import StorySourceCode_vue_vue_type_script_setup_true_lang_default from "./StorySourceCode.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/app/components/panel/StorySourceCode.vue
|
|
5
|
-
var StorySourceCode_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StorySourceCode_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var StorySourceCode_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StorySourceCode_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-b595e0d4"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { StorySourceCode_default as default };
|
package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -52,7 +52,7 @@ var StorySourceCode_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
52
52
|
} else dynamicSourceCode.value = await generateSourceCodeFn.value(props.variant);
|
|
53
53
|
} catch (e) {
|
|
54
54
|
console.error(e);
|
|
55
|
-
error.value = e.message;
|
|
55
|
+
error.value = e instanceof Error ? e.message : String(e);
|
|
56
56
|
}
|
|
57
57
|
if (!dynamicSourceCode.value) displayedSource.value = "static";
|
|
58
58
|
}, {
|
|
@@ -86,7 +86,7 @@ var StorySourceCode_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
86
86
|
});
|
|
87
87
|
const scroller = ref();
|
|
88
88
|
function onScroll(event) {
|
|
89
|
-
if (sourceHtml.value) lastScroll = event.target.scrollTop;
|
|
89
|
+
if (sourceHtml.value && event.target instanceof HTMLElement) lastScroll = event.target.scrollTop;
|
|
90
90
|
}
|
|
91
91
|
watch(sourceHtml, async () => {
|
|
92
92
|
await nextTick();
|
|
@@ -98,13 +98,13 @@ var StorySourceCode_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
98
98
|
_cache[2] || (_cache[2] = createElementVNode("div", { class: "text-gray-900 dark:text-gray-100" }, " Source ", -1)),
|
|
99
99
|
_cache[3] || (_cache[3] = createElementVNode("div", { class: "flex-1" }, null, -1)),
|
|
100
100
|
createElementVNode("div", _hoisted_3, [withDirectives((openBlock(), createElementBlock("button", {
|
|
101
|
-
class: normalizeClass(["flex items-center gap-1 h-full px-1 bg-gray-500/10 rounded-l transition-all ease-[cubic-bezier(0,1,.6,1)] duration-300 overflow-hidden", [displayedSource.value !== "dynamic" ? "max-w-6 opacity-70" : "max-w-[82px] text-primary-800 dark:text-primary-400", dynamicSourceCode.value ? "cursor-pointer hover:bg-gray-500/30 active:bg-gray-600/50" : "opacity-50"]]),
|
|
101
|
+
class: normalizeClass(["flex items-center gap-1 h-full px-1 bg-gray-500/10 rounded-l transition-all ease-[cubic-bezier(0,1,.6,1)] duration-300 overflow-hidden", [displayedSource.value !== "dynamic" ? "max-w-6 opacity-70" : "max-w-[82px] text-primary-800 dark:text-primary-400", dynamicSourceCode.value ? "cursor-pointer hover:bg-gray-500/30 active:bg-gray-600/50" : displayedSource.value !== "dynamic" && "opacity-50"]]),
|
|
102
102
|
onClick: _cache[0] || (_cache[0] = ($event) => dynamicSourceCode.value && (displayedSource.value = "dynamic"))
|
|
103
103
|
}, [createVNode(unref(Icon), {
|
|
104
104
|
icon: "carbon:flash",
|
|
105
105
|
class: "w-4 h-4 flex-none"
|
|
106
106
|
}), createElementVNode("span", { class: normalizeClass(["transition-opacity duration-300", { "opacity-0": displayedSource.value !== "dynamic" }]) }, " Dynamic ", 2)], 2)), [[_directive_tooltip, !dynamicSourceCode.value ? "Dynamic source code is not available" : displayedSource.value !== "dynamic" ? "Switch to dynamic source" : null]]), withDirectives((openBlock(), createElementBlock("button", {
|
|
107
|
-
class: normalizeClass(["flex items-center gap-1 h-full px-1 bg-gray-500/10 rounded-r transition-all ease-[cubic-bezier(0,1,.6,1)] duration-300 overflow-hidden", [displayedSource.value !== "static" ? "max-w-6 opacity-70" : "max-w-[63px] text-primary-800 dark:text-primary-400", staticSourceCode.value ? "cursor-pointer hover:bg-gray-500/30 active:bg-gray-600/50" : "opacity-50"]]),
|
|
107
|
+
class: normalizeClass(["flex items-center gap-1 h-full px-1 bg-gray-500/10 rounded-r transition-all ease-[cubic-bezier(0,1,.6,1)] duration-300 overflow-hidden", [displayedSource.value !== "static" ? "max-w-6 opacity-70" : "max-w-[63px] text-primary-800 dark:text-primary-400", staticSourceCode.value ? "cursor-pointer hover:bg-gray-500/30 active:bg-gray-600/50" : displayedSource.value !== "static" && "opacity-50"]]),
|
|
108
108
|
onClick: _cache[1] || (_cache[1] = ($event) => staticSourceCode.value && (displayedSource.value = "static"))
|
|
109
109
|
}, [createVNode(unref(Icon), {
|
|
110
110
|
icon: "carbon:document",
|
|
@@ -126,6 +126,7 @@ var StorySourceCode_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
126
126
|
ref: scroller,
|
|
127
127
|
class: "__poveste-code-placeholder w-full h-full p-4 outline-none bg-transparent resize-none m-0",
|
|
128
128
|
value: displayedSourceCode.value,
|
|
129
|
+
"aria-label": "Source code",
|
|
129
130
|
readonly: "",
|
|
130
131
|
"data-testid": "story-source-code",
|
|
131
132
|
onScroll
|
package/dist/bundled/components/search/SearchItemContent.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -18,7 +18,8 @@ var SearchItemContent_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
18
18
|
setup(__props) {
|
|
19
19
|
const defaultIcons = {
|
|
20
20
|
story: "carbon:cube",
|
|
21
|
-
variant: "carbon:cube"
|
|
21
|
+
variant: "carbon:cube",
|
|
22
|
+
command: "carbon:chevron-right"
|
|
22
23
|
};
|
|
23
24
|
const kindLabels = {
|
|
24
25
|
story: "Story",
|
|
@@ -103,8 +103,7 @@ var SearchPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
case "variant": {
|
|
106
|
-
const
|
|
107
|
-
const story = storyStore.getStoryById(storyId);
|
|
106
|
+
const story = storyStore.getStoryById(idMapData.id.replace(/:.*$/s, ""));
|
|
108
107
|
const variant = storyStore.getVariantById(idMapData.id);
|
|
109
108
|
if (!story || !variant) continue;
|
|
110
109
|
list.push(variantResultFactory(story, variant, rank));
|
|
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default from "./StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/app/components/story/StoryResponsivePreview.vue
|
|
5
|
-
var StoryResponsivePreview_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var StoryResponsivePreview_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-13932615"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { StoryResponsivePreview_default as default };
|
package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -23,7 +23,7 @@ var StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default = /*@__PU
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
setup(__props) {
|
|
26
|
-
useCssVars((_ctx) => ({ "
|
|
26
|
+
useCssVars((_ctx) => ({ "v538c65b8": unref(settings).backgroundColor }));
|
|
27
27
|
const props = __props;
|
|
28
28
|
const settings = usePreviewSettingsStore().currentSettings;
|
|
29
29
|
const resizing = ref(false);
|
|
@@ -75,7 +75,9 @@ var StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default = /*@__PU
|
|
|
75
75
|
function onTouchStart(event) {
|
|
76
76
|
event.preventDefault();
|
|
77
77
|
event.stopPropagation();
|
|
78
|
-
const
|
|
78
|
+
const [touch] = event.touches;
|
|
79
|
+
if (!touch) return;
|
|
80
|
+
const start = axis === "x" ? touch.clientX : touch.clientY;
|
|
79
81
|
const startValue = startFrom();
|
|
80
82
|
resizing.value = true;
|
|
81
83
|
const removeListeners = [
|
|
@@ -84,7 +86,9 @@ var StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default = /*@__PU
|
|
|
84
86
|
addWindowListener("touchcancel", onTouchEnd)
|
|
85
87
|
];
|
|
86
88
|
function onTouchMove(event) {
|
|
87
|
-
const
|
|
89
|
+
const [touch] = event.touches;
|
|
90
|
+
if (!touch) return;
|
|
91
|
+
const delta = (axis === "x" ? touch.clientX : touch.clientY) - start;
|
|
88
92
|
value.value = Math.max(min, Math.min(max, startValue + delta));
|
|
89
93
|
}
|
|
90
94
|
function onTouchEnd() {
|
|
@@ -141,7 +145,7 @@ var StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default = /*@__PU
|
|
|
141
145
|
finalWidth: finalWidth.value,
|
|
142
146
|
finalHeight: finalHeight.value,
|
|
143
147
|
resizing: resizing.value
|
|
144
|
-
}, void 0, true)]), isResponsiveEnabled.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[1] || (_cache[1] = createStaticVNode("<div class=\"absolute top-5 left-8 h-2 w-px bg-gray-400/25\" data-v-
|
|
148
|
+
}, void 0, true)]), isResponsiveEnabled.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[1] || (_cache[1] = createStaticVNode("<div class=\"absolute top-5 left-8 h-2 w-px bg-gray-400/25\" data-v-13932615></div><div class=\"absolute top-5 right-8 h-2 w-px bg-gray-400/25\" data-v-13932615></div><div class=\"absolute bottom-5 left-8 h-2 w-px bg-gray-400/25\" data-v-13932615></div><div class=\"absolute bottom-5 right-8 h-2 w-px bg-gray-400/25\" data-v-13932615></div><div class=\"absolute left-5 top-8 w-2 h-px bg-gray-400/25\" data-v-13932615></div><div class=\"absolute left-5 bottom-8 w-2 h-px bg-gray-400/25\" data-v-13932615></div><div class=\"absolute right-5 top-8 w-2 h-px bg-gray-400/25\" data-v-13932615></div><div class=\"absolute right-5 bottom-8 w-2 h-px bg-gray-400/25\" data-v-13932615></div>", 8))], 64)) : createCommentVNode("", true)], 2)], 10, _hoisted_3), isResponsiveEnabled.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
145
149
|
withDirectives((openBlock(), createElementBlock("div", {
|
|
146
150
|
ref_key: "horizontalDragger",
|
|
147
151
|
ref: horizontalDragger,
|
|
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import StoryVariantGridItem_vue_vue_type_script_setup_true_lang_default from "./StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/app/components/story/StoryVariantGridItem.vue
|
|
5
|
-
var StoryVariantGridItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantGridItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var StoryVariantGridItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantGridItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-ae85762b"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { StoryVariantGridItem_default as default };
|
package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -18,7 +18,7 @@ import { HstCopyIcon } from "@poveste/controls";
|
|
|
18
18
|
//#region src/app/components/story/StoryVariantGridItem.vue?vue&type=script&setup=true&lang.ts
|
|
19
19
|
var _hoisted_1 = { class: "flex-none flex items-center" };
|
|
20
20
|
var _hoisted_2 = { class: "truncate flex-1" };
|
|
21
|
-
var _hoisted_3 = { class: "flex-none ml-auto hidden group-hover:flex items-center" };
|
|
21
|
+
var _hoisted_3 = { class: "flex-none ml-auto hidden group-hover:flex group-focus-within:flex items-center" };
|
|
22
22
|
var StoryVariantGridItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
23
23
|
__name: "StoryVariantGridItem",
|
|
24
24
|
props: {
|
|
@@ -34,8 +34,8 @@ var StoryVariantGridItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE
|
|
|
34
34
|
emits: { resize: (_width, _height) => true },
|
|
35
35
|
setup(__props, { emit: __emit }) {
|
|
36
36
|
useCssVars((_ctx) => ({
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"v2b77a04a": unref(variant).iconColor,
|
|
38
|
+
"v8dc7fba0": unref(settings).backgroundColor
|
|
39
39
|
}));
|
|
40
40
|
const props = __props;
|
|
41
41
|
const emit = __emit;
|
|
@@ -8,6 +8,7 @@ import { createStateBridge } from "../../util/state-bridge.js";
|
|
|
8
8
|
import { toRawDeep } from "../../util/state.js";
|
|
9
9
|
import { useEventsStore } from "../../stores/events.js";
|
|
10
10
|
import { firstReportedHeight } from "../../util/grid-cell-height.js";
|
|
11
|
+
import { createRenderTracker } from "../../util/render-tracker.js";
|
|
11
12
|
import StoryResponsivePreview_default from "./StoryResponsivePreview.js";
|
|
12
13
|
import { useEventListener } from "@poveste/vendors/vue-use";
|
|
13
14
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, ref, toDisplayString, toRaw, unref, watch, withCtx } from "@poveste/vendors/vue";
|
|
@@ -49,9 +50,7 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
|
|
|
49
50
|
const settings = usePreviewSettingsStore().currentSettings;
|
|
50
51
|
const errorStore = useStoryErrorStore();
|
|
51
52
|
const storyError = computed(() => errorStore.forVariant(props.story.id, props.variant.id));
|
|
52
|
-
|
|
53
|
-
errorStore.clear(props.story.id, props.variant.id);
|
|
54
|
-
});
|
|
53
|
+
const render = createRenderTracker();
|
|
55
54
|
const iframe = ref();
|
|
56
55
|
function postState(changes) {
|
|
57
56
|
iframe.value?.contentWindow?.postMessage({
|
|
@@ -88,10 +87,12 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
|
|
|
88
87
|
break;
|
|
89
88
|
case SANDBOX_READY:
|
|
90
89
|
if (!fromCurrentOccupant(event.data)) break;
|
|
90
|
+
if (render.wasClean()) errorStore.clear(props.story.id, props.variant.id);
|
|
91
91
|
setPreviewReady();
|
|
92
92
|
break;
|
|
93
93
|
case SANDBOX_ERROR:
|
|
94
94
|
if (!fromCurrentOccupant(event.data)) break;
|
|
95
|
+
render.threw();
|
|
95
96
|
errorStore.report({
|
|
96
97
|
message: event.data.message,
|
|
97
98
|
stack: event.data.stack,
|
|
@@ -139,6 +140,7 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
|
|
|
139
140
|
let stopTrackKeyboard;
|
|
140
141
|
let unmounted = false;
|
|
141
142
|
function reload(url) {
|
|
143
|
+
render.begin();
|
|
142
144
|
retargets = 0;
|
|
143
145
|
retargeting.value = false;
|
|
144
146
|
clearTimeout(retargetTimer);
|
|
@@ -151,6 +153,7 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
|
|
|
151
153
|
iframeSrc.value = url;
|
|
152
154
|
}
|
|
153
155
|
watch(sandboxUrl, (url) => {
|
|
156
|
+
render.begin();
|
|
154
157
|
bridge = createStateBridge(postState);
|
|
155
158
|
if (servedVariant && servedVariant !== props.variant) storyStore.setPreviewReady(servedVariant, false);
|
|
156
159
|
servedVariant = props.variant;
|
|
@@ -195,10 +198,10 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
|
|
|
195
198
|
function previewStyle(isResponsiveEnabled, finalWidth, finalHeight) {
|
|
196
199
|
const style = {};
|
|
197
200
|
if (isResponsiveEnabled) {
|
|
198
|
-
if (finalWidth) style
|
|
199
|
-
if (finalHeight) style
|
|
201
|
+
if (finalWidth) style["width"] = `${finalWidth}px`;
|
|
202
|
+
if (finalHeight) style["height"] = `${finalHeight}px`;
|
|
200
203
|
}
|
|
201
|
-
if (props.autoHeight) style
|
|
204
|
+
if (props.autoHeight) style["height"] = `${Math.min(reportedHeight.value ?? placeholderHeight.value, MAX_AUTO_HEIGHT)}px`;
|
|
202
205
|
return style;
|
|
203
206
|
}
|
|
204
207
|
function onIframeLoad() {
|
|
@@ -31,7 +31,10 @@ var StoryView_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
31
31
|
if (value && story) story.lastSelectedVariant = value;
|
|
32
32
|
}, { immediate: true });
|
|
33
33
|
watch(() => [storyStore.currentStory, storyStore.currentVariant], () => {
|
|
34
|
-
if (!storyStore.currentVariant && autoSelectsVariant(storyStore.currentStory))
|
|
34
|
+
if (!storyStore.currentVariant && autoSelectsVariant(storyStore.currentStory)) {
|
|
35
|
+
const variant = storyStore.currentStory.lastSelectedVariant ?? storyStore.currentStory.variants[0];
|
|
36
|
+
if (variant) setVariant(variant.id);
|
|
37
|
+
}
|
|
35
38
|
}, { immediate: true });
|
|
36
39
|
function setVariant(variantId) {
|
|
37
40
|
router.replace({
|
|
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import ToolbarTitle_vue_vue_type_script_setup_true_lang_default from "./ToolbarTitle.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/app/components/toolbar/ToolbarTitle.vue
|
|
5
|
-
var ToolbarTitle_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ToolbarTitle_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var ToolbarTitle_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ToolbarTitle_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-30c06406"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ToolbarTitle_default as default };
|
|
@@ -15,7 +15,7 @@ var ToolbarTitle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
15
15
|
story: {}
|
|
16
16
|
},
|
|
17
17
|
setup(__props) {
|
|
18
|
-
useCssVars((_ctx) => ({ "
|
|
18
|
+
useCssVars((_ctx) => ({ "v5947d534": iconColor.value }));
|
|
19
19
|
const props = __props;
|
|
20
20
|
const icon = computed(() => props.variant?.icon ?? props.story?.icon ?? "carbon:cube");
|
|
21
21
|
const iconColor = computed(() => props.variant?.iconColor ?? props.story?.iconColor);
|
|
@@ -46,11 +46,11 @@ var StoryGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
46
46
|
"path",
|
|
47
47
|
"folder",
|
|
48
48
|
"stories"
|
|
49
|
-
])) : (openBlock(), createBlock(StoryListItem_default, {
|
|
49
|
+
])) : __props.stories[element.index] ? (openBlock(), createBlock(StoryListItem_default, {
|
|
50
50
|
key: 1,
|
|
51
51
|
story: __props.stories[element.index],
|
|
52
52
|
depth: 0
|
|
53
|
-
}, null, 8, ["story"]))], 64);
|
|
53
|
+
}, null, 8, ["story"])) : createCommentVNode("", true)], 64);
|
|
54
54
|
}), 128))])) : createCommentVNode("", true)]);
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import StoryListItem_default from "./StoryListItem.js";
|
|
2
2
|
import StoryListFolder_default from "./StoryListFolder.js";
|
|
3
3
|
import StoryGroup_default from "./StoryGroup.js";
|
|
4
|
-
import { Fragment, createBlock, createElementBlock, defineComponent, openBlock, renderList } from "@poveste/vendors/vue";
|
|
4
|
+
import { Fragment, createBlock, createCommentVNode, createElementBlock, defineComponent, openBlock, renderList } from "@poveste/vendors/vue";
|
|
5
5
|
//#region src/app/components/tree/StoryList.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var _hoisted_1 = { class: "poveste-story-list overflow-y-auto" };
|
|
7
7
|
var StoryList_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
@@ -21,10 +21,10 @@ var StoryList_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
21
21
|
key: 1,
|
|
22
22
|
folder: element,
|
|
23
23
|
stories: __props.stories
|
|
24
|
-
}, null, 8, ["folder", "stories"])) : (openBlock(), createBlock(StoryListItem_default, {
|
|
24
|
+
}, null, 8, ["folder", "stories"])) : __props.stories[element.index] ? (openBlock(), createBlock(StoryListItem_default, {
|
|
25
25
|
key: 2,
|
|
26
26
|
story: __props.stories[element.index]
|
|
27
|
-
}, null, 8, ["story"]))], 64);
|
|
27
|
+
}, null, 8, ["story"])) : createCommentVNode("", true)], 64);
|
|
28
28
|
}), 128))]);
|
|
29
29
|
};
|
|
30
30
|
}
|
|
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import StoryListFolder_vue_vue_type_script_setup_true_lang_default from "./StoryListFolder.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/app/components/tree/StoryListFolder.vue
|
|
5
|
-
var StoryListFolder_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryListFolder_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var StoryListFolder_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryListFolder_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-9702f44e"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { StoryListFolder_default as default };
|
|
@@ -20,7 +20,7 @@ var StoryListFolder_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
20
20
|
depth: { default: 0 }
|
|
21
21
|
},
|
|
22
22
|
setup(__props) {
|
|
23
|
-
useCssVars((_ctx) => ({ "
|
|
23
|
+
useCssVars((_ctx) => ({ "v716b068e": folderPadding.value }));
|
|
24
24
|
const props = __props;
|
|
25
25
|
const folderStore = useFolderStore();
|
|
26
26
|
const folderPath = computed(() => [...props.path, props.folder.title]);
|
|
@@ -54,11 +54,11 @@ var StoryListFolder_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
54
54
|
"folder",
|
|
55
55
|
"stories",
|
|
56
56
|
"depth"
|
|
57
|
-
])) : (openBlock(), createBlock(StoryListItem_default, {
|
|
57
|
+
])) : __props.stories[element.index] ? (openBlock(), createBlock(StoryListItem_default, {
|
|
58
58
|
key: 1,
|
|
59
59
|
story: __props.stories[element.index],
|
|
60
60
|
depth: __props.depth + 1
|
|
61
|
-
}, null, 8, ["story", "depth"]))], 64);
|
|
61
|
+
}, null, 8, ["story", "depth"])) : createCommentVNode("", true)], 64);
|
|
62
62
|
}), 128))])) : createCommentVNode("", true)]);
|
|
63
63
|
};
|
|
64
64
|
}
|
|
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import StoryListItem_vue_vue_type_script_setup_true_lang_default from "./StoryListItem.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/app/components/tree/StoryListItem.vue
|
|
5
|
-
var StoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryListItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var StoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryListItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-83161585"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { StoryListItem_default as default };
|
|
@@ -16,8 +16,8 @@ var StoryListItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
16
16
|
},
|
|
17
17
|
setup(__props) {
|
|
18
18
|
useCssVars((_ctx) => ({
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"v0299061e": filePadding.value,
|
|
20
|
+
"v80ccd94c": _ctx.story.iconColor
|
|
21
21
|
}));
|
|
22
22
|
const props = __props;
|
|
23
23
|
const errorStore = useStoryErrorStore();
|
|
@@ -26,7 +26,7 @@ var StoryListItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
26
26
|
return `${props.depth * 12}px`;
|
|
27
27
|
});
|
|
28
28
|
const route = useRoute();
|
|
29
|
-
const isActive = computed(() => route.params
|
|
29
|
+
const isActive = computed(() => route.params["storyId"] === props.story.id);
|
|
30
30
|
const el = ref();
|
|
31
31
|
useScrollOnActive(isActive, el);
|
|
32
32
|
return (_ctx, _cache) => {
|
package/dist/bundled/sandbox.js
CHANGED
|
@@ -17,8 +17,8 @@ import { parseQuery } from "@poveste/vendors/vue-router";
|
|
|
17
17
|
import { reportStoryError } from "@poveste/shared";
|
|
18
18
|
//#region src/app/sandbox.ts
|
|
19
19
|
var query = parseQuery(window.location.search);
|
|
20
|
-
var storyId = ref(typeof query
|
|
21
|
-
var variantId = ref(typeof query
|
|
20
|
+
var storyId = ref(typeof query["storyId"] === "string" ? query["storyId"] : null);
|
|
21
|
+
var variantId = ref(typeof query["variantId"] === "string" ? query["variantId"] : null);
|
|
22
22
|
watchEffect(() => {
|
|
23
23
|
occupant.storyId = storyId.value;
|
|
24
24
|
occupant.variantId = variantId.value;
|
|
@@ -73,6 +73,7 @@ var app = createApp({
|
|
|
73
73
|
let bridge = createStateBridge(postState);
|
|
74
74
|
let mounted = false;
|
|
75
75
|
window.addEventListener("message", (event) => {
|
|
76
|
+
if (event.origin !== window.location.origin) return;
|
|
76
77
|
if (event.data?.type === "__poveste:state-sync") {
|
|
77
78
|
if (!mounted || !variant.value) return;
|
|
78
79
|
bridge.receive(variant.value.state, event.data.state);
|
|
@@ -7,8 +7,8 @@ var useStoryStore = defineStore("story", () => {
|
|
|
7
7
|
function setStories(value) {
|
|
8
8
|
stories.value = value;
|
|
9
9
|
}
|
|
10
|
-
const currentStory = computed(() => stories.value.find((s) => s.id === router.currentRoute.value.params
|
|
11
|
-
const currentVariant = computed(() => currentStory.value?.variants.find((v) => v.id === router.currentRoute.value.query
|
|
10
|
+
const currentStory = computed(() => stories.value.find((s) => s.id === router.currentRoute.value.params["storyId"]));
|
|
11
|
+
const currentVariant = computed(() => currentStory.value?.variants.find((v) => v.id === router.currentRoute.value.query["variantId"]));
|
|
12
12
|
const maps = computed(() => {
|
|
13
13
|
const storyMap = /* @__PURE__ */ new Map();
|
|
14
14
|
const variantMap = /* @__PURE__ */ new Map();
|
|
@@ -33,7 +33,7 @@ var builtinCommands = [{
|
|
|
33
33
|
label: "Open Poveste Documentation",
|
|
34
34
|
icon: "carbon:help",
|
|
35
35
|
clientAction: () => {
|
|
36
|
-
window.open("https://poveste.dev/guide/getting-started
|
|
36
|
+
window.open("https://poveste.dev/guide/getting-started", "_blank");
|
|
37
37
|
}
|
|
38
38
|
}];
|
|
39
39
|
function executeCommand(command, params) {
|
|
@@ -4,7 +4,7 @@ import { watch } from "@poveste/vendors/vue";
|
|
|
4
4
|
//#region src/app/util/dark.ts
|
|
5
5
|
var isDark = useDark({
|
|
6
6
|
valueDark: "ptw-dark",
|
|
7
|
-
initialValue: povesteConfig.theme.defaultColorScheme,
|
|
7
|
+
...povesteConfig.theme.defaultColorScheme ? { initialValue: povesteConfig.theme.defaultColorScheme } : {},
|
|
8
8
|
storageKey: "poveste-color-scheme",
|
|
9
9
|
storage: povesteConfig.theme.storeColorScheme ? localStorage : sessionStorage
|
|
10
10
|
});
|
|
@@ -19,7 +19,7 @@ async function logEvent(name, argument) {
|
|
|
19
19
|
}
|
|
20
20
|
function stringifyEvent(e) {
|
|
21
21
|
const obj = {};
|
|
22
|
-
for (const k in e) obj[k] = e
|
|
22
|
+
for (const k in e) obj[k] = Reflect.get(e, k);
|
|
23
23
|
return JSON.stringify(obj, (k, v) => {
|
|
24
24
|
if (v instanceof Node) return "Node";
|
|
25
25
|
if (v instanceof Window) return "Window";
|