@poveste/app 0.13.0 → 0.14.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.
Files changed (110) hide show
  1. package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +26 -34
  2. package/dist/bundled/app.css +18 -24
  3. package/dist/bundled/components/HomeView.vue_vue_type_script_setup_true_lang.js +1 -1
  4. package/dist/bundled/components/app/AppLogo.vue_vue_type_script_setup_true_lang.js +2 -2
  5. package/dist/bundled/components/app/Breadcrumb.js +1 -1
  6. package/dist/bundled/components/app/Breadcrumb.vue_vue_type_script_setup_true_lang.js +2 -2
  7. package/dist/bundled/components/app/TopBar.vue_vue_type_script_setup_true_lang.js +4 -3
  8. package/dist/bundled/components/base/BaseCheckbox.vue_vue_type_script_setup_true_lang.js +1 -1
  9. package/dist/bundled/components/base/BaseListItemLink.js +6 -3
  10. package/dist/bundled/components/base/BaseListItemLink.vue_vue_type_script_lang.js +10 -4
  11. package/dist/bundled/components/base/BaseOverflowMenu.vue_vue_type_script_setup_true_lang.js +5 -2
  12. package/dist/bundled/components/base/BaseOverflowTab.js +6 -3
  13. package/dist/bundled/components/base/BaseOverflowTab.vue_vue_type_script_lang.js +4 -0
  14. package/dist/bundled/components/base/BaseSplitPane.js +1 -1
  15. package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_script_setup_true_lang.js +6 -4
  16. package/dist/bundled/components/base/BaseTab.js +6 -3
  17. package/dist/bundled/components/base/BaseTab.vue_vue_type_script_lang.js +4 -0
  18. package/dist/bundled/components/command/CommandPrompts.vue_vue_type_script_setup_true_lang.js +1 -1
  19. package/dist/bundled/components/command/CommandPromptsModal.vue_vue_type_script_setup_true_lang.js +4 -3
  20. package/dist/bundled/components/command/PromptSelect.vue_vue_type_script_setup_true_lang.js +1 -1
  21. package/dist/bundled/components/command/PromptText.vue_vue_type_script_setup_true_lang.js +1 -1
  22. package/dist/bundled/components/panel/PaneTabs.vue_vue_type_script_setup_true_lang.js +4 -4
  23. package/dist/bundled/components/panel/StatePresets.vue_vue_type_script_setup_true_lang.js +30 -20
  24. package/dist/bundled/components/panel/StoryControls.vue_vue_type_script_setup_true_lang.js +1 -1
  25. package/dist/bundled/components/panel/StoryDocs.vue_vue_type_script_setup_true_lang.js +3 -1
  26. package/dist/bundled/components/panel/StoryEvent.vue_vue_type_script_setup_true_lang.js +5 -1
  27. package/dist/bundled/components/panel/StoryEvents.vue_vue_type_script_setup_true_lang.js +2 -1
  28. package/dist/bundled/components/panel/StorySidePanel.vue_vue_type_script_setup_true_lang.js +7 -5
  29. package/dist/bundled/components/panel/StorySourceCode.js +1 -1
  30. package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +6 -5
  31. package/dist/bundled/components/search/SearchPane.vue_vue_type_script_setup_true_lang.js +15 -7
  32. package/dist/bundled/components/story/GenericMountStory.vue_vue_type_script_setup_true_lang.js +2 -1
  33. package/dist/bundled/components/story/GenericRenderStory.vue_vue_type_script_setup_true_lang.js +2 -1
  34. package/dist/bundled/components/story/StoryResponsivePreview.js +1 -1
  35. package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js +17 -6
  36. package/dist/bundled/components/story/StoryVariantGrid.js +1 -1
  37. package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js +15 -10
  38. package/dist/bundled/components/story/StoryVariantSingle.js +1 -1
  39. package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +21 -33
  40. package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +1 -1
  41. package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +3 -2
  42. package/dist/bundled/components/story/StoryViewer.js +1 -1
  43. package/dist/bundled/components/story/StoryViewer.vue_vue_type_script_setup_true_lang.js +3 -3
  44. package/dist/bundled/components/toolbar/ToolbarBackground.js +1 -3
  45. package/dist/bundled/components/toolbar/ToolbarBackground.vue_vue_type_script_setup_true_lang.js +2 -6
  46. package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue_vue_type_script_setup_true_lang.js +17 -16
  47. package/dist/bundled/plugin.js +4 -3
  48. package/dist/bundled/sandbox.js +2 -2
  49. package/dist/bundled/stores/folder.js +1 -1
  50. package/dist/bundled/util/commands.js +20 -9
  51. package/dist/bundled/util/docs.js +2 -1
  52. package/dist/bundled/util/grid-slots.js +1 -1
  53. package/dist/bundled/util/highlighter.js +1 -1
  54. package/dist/bundled/util/icons.generated.js +0 -1
  55. package/dist/bundled/util/keyboard.js +1 -0
  56. package/dist/bundled/util/mapping.js +6 -2
  57. package/dist/bundled/util/preview-settings.js +1 -1
  58. package/dist/style.css +14 -2
  59. package/package.json +8 -6
  60. package/src/app/App.vue +36 -29
  61. package/src/app/components/HomeView.vue +1 -1
  62. package/src/app/components/app/AppLogo.vue +6 -2
  63. package/src/app/components/app/Breadcrumb.vue +2 -1
  64. package/src/app/components/app/TopBar.vue +7 -2
  65. package/src/app/components/base/BaseCheckbox.vue +1 -1
  66. package/src/app/components/base/BaseListItemLink.vue +12 -1
  67. package/src/app/components/base/BaseOverflowMenu.vue +9 -3
  68. package/src/app/components/base/BaseOverflowTab.vue +12 -1
  69. package/src/app/components/base/BaseSplitPane.vue +9 -4
  70. package/src/app/components/base/BaseTab.vue +12 -1
  71. package/src/app/components/command/CommandPrompts.vue +10 -2
  72. package/src/app/components/command/CommandPromptsModal.vue +1 -0
  73. package/src/app/components/command/PromptSelect.vue +2 -1
  74. package/src/app/components/command/PromptText.vue +7 -3
  75. package/src/app/components/panel/PaneTabs.vue +4 -4
  76. package/src/app/components/panel/StatePresets.vue +26 -5
  77. package/src/app/components/panel/StoryControls.vue +1 -1
  78. package/src/app/components/panel/StoryDocs.vue +3 -1
  79. package/src/app/components/panel/StoryEvent.vue +7 -2
  80. package/src/app/components/panel/StoryEvents.vue +4 -1
  81. package/src/app/components/panel/StorySidePanel.vue +2 -0
  82. package/src/app/components/panel/StorySourceCode.vue +11 -8
  83. package/src/app/components/search/SearchPane.vue +14 -5
  84. package/src/app/components/story/GenericMountStory.vue +2 -1
  85. package/src/app/components/story/GenericRenderStory.vue +2 -1
  86. package/src/app/components/story/StoryResponsivePreview.vue +30 -5
  87. package/src/app/components/story/StoryVariantGrid.vue +33 -16
  88. package/src/app/components/story/StoryVariantSingle.vue +44 -52
  89. package/src/app/components/story/StoryVariantSingleView.vue +1 -1
  90. package/src/app/components/story/StoryView.vue +7 -3
  91. package/src/app/components/story/StoryViewer.vue +3 -3
  92. package/src/app/components/toolbar/ToolbarBackground.vue +1 -8
  93. package/src/app/components/toolbar/ToolbarResponsiveSize.vue +23 -3
  94. package/src/app/components/tree/StoryGroup.vue +1 -1
  95. package/src/app/plugin.ts +7 -3
  96. package/src/app/sandbox.ts +1 -1
  97. package/src/app/stores/folder.ts +1 -1
  98. package/src/app/types.ts +2 -2
  99. package/src/app/util/commands.ts +26 -16
  100. package/src/app/util/docs.ts +2 -1
  101. package/src/app/util/grid-slots.ts +1 -1
  102. package/src/app/util/highlighter.ts +9 -1
  103. package/src/app/util/icons.generated.ts +1 -1
  104. package/src/app/util/keyboard.ts +3 -0
  105. package/src/app/util/mapping.ts +6 -2
  106. package/src/app/util/preview-settings.ts +1 -1
  107. package/src/app/util/scroll.ts +5 -1
  108. package/src/app/util/state.ts +1 -1
  109. package/src/app/util/variant.ts +4 -1
  110. package/src/app/components/base/BaseCopyIcon.vue +0 -34
@@ -6,14 +6,13 @@ 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 = ["onUpdate:modelValue"];
10
- var _hoisted_3 = {
9
+ var _hoisted_2 = {
11
10
  key: 1,
12
11
  class: "flex items-center gap-2"
13
12
  };
14
- var _hoisted_4 = { class: "flex-1 truncate" };
15
- var _hoisted_5 = { class: "flex gap-2 items-center" };
16
- var _hoisted_6 = { class: "flex-1 truncate" };
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" };
17
16
  var DEFAULT_ID = "default";
18
17
  var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
19
18
  __name: "StatePresets",
@@ -41,7 +40,10 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
41
40
  }
42
41
  function applyPreset(id) {
43
42
  if (id === DEFAULT_ID) resetState();
44
- else if (presetStates.value.has(id)) applyState(props.variant.state, clone(toRawDeep(presetStates.value.get(id).state)));
43
+ else {
44
+ const preset = presetStates.value.get(id);
45
+ if (preset) applyState(props.variant.state, clone(toRawDeep(preset.state)));
46
+ }
45
47
  }
46
48
  onMounted(() => {
47
49
  if (selectedOption.value !== DEFAULT_ID) applyPreset(selectedOption.value);
@@ -59,8 +61,15 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
59
61
  selectedOption.value = id;
60
62
  isEditing.value = true;
61
63
  await nextTick();
62
- input.value.select();
64
+ input.value?.select();
63
65
  }
66
+ const editingLabel = computed({
67
+ get: () => presetStates.value.get(selectedOption.value)?.label ?? "",
68
+ set: (value) => {
69
+ const preset = presetStates.value.get(selectedOption.value);
70
+ if (preset) preset.label = value;
71
+ }
72
+ });
64
73
  const savedNotif = ref(false);
65
74
  const savedTimeout = useTimeoutFn(() => {
66
75
  savedNotif.value = false;
@@ -68,6 +77,7 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
68
77
  async function savePreset() {
69
78
  if (!canEdit.value) return;
70
79
  const preset = presetStates.value.get(selectedOption.value);
80
+ if (!preset) return;
71
81
  preset.state = toPresetState(props.variant.state, omitKeys);
72
82
  savedNotif.value = true;
73
83
  savedTimeout.start();
@@ -81,7 +91,7 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
81
91
  if (!canEdit.value) return;
82
92
  isEditing.value = true;
83
93
  await nextTick();
84
- input.value.select();
94
+ input.value?.select();
85
95
  }
86
96
  function stopEditing() {
87
97
  isEditing.value = false;
@@ -96,27 +106,27 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
96
106
  class: "flex-1 min-w-0"
97
107
  }, [createVNode(BaseSelect_default, {
98
108
  modelValue: unref(selectedOption),
99
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
109
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(selectedOption) ? selectedOption.value = $event : null),
100
110
  options: presetsOptions.value,
101
- onDblclick: _cache[3] || (_cache[3] = ($event) => startEditing()),
102
- onKeydown: [_cache[4] || (_cache[4] = withKeys(($event) => stopEditing(), ["enter"])), _cache[5] || (_cache[5] = withKeys(($event) => stopEditing(), ["escape"]))],
103
- onSelect: _cache[6] || (_cache[6] = (id) => applyPreset(id))
111
+ onDblclick: _cache[4] || (_cache[4] = ($event) => startEditing()),
112
+ onKeydown: [_cache[5] || (_cache[5] = withKeys(($event) => stopEditing(), ["enter"])), _cache[6] || (_cache[6] = withKeys(($event) => stopEditing(), ["escape"]))],
113
+ onSelect: _cache[7] || (_cache[7] = (id) => applyPreset(id))
104
114
  }, {
105
115
  default: withCtx(({ label }) => [isEditing.value ? withDirectives((openBlock(), createElementBlock("input", {
106
116
  key: 0,
107
117
  ref_key: "input",
108
118
  ref: input,
109
- "onUpdate:modelValue": ($event) => unref(presetStates).get(unref(selectedOption)).label = $event,
119
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => editingLabel.value = $event),
110
120
  type: "text",
111
121
  class: "text-inherit bg-transparent w-full h-full outline-none",
112
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop", "prevent"]))
113
- }, null, 8, _hoisted_2)), [[vModelText, unref(presetStates).get(unref(selectedOption)).label]]) : (openBlock(), createElementBlock("div", _hoisted_3, [createElementVNode("span", _hoisted_4, toDisplayString(label), 1), canEdit.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
122
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop", "prevent"]))
123
+ }, null, 512)), [[vModelText, editingLabel.value]]) : (openBlock(), createElementBlock("div", _hoisted_2, [createElementVNode("span", _hoisted_3, toDisplayString(label), 1), canEdit.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
114
124
  key: 0,
115
125
  icon: "carbon:edit",
116
126
  class: "flex-none cursor-pointer w-4 h-4 hover:text-primary-500 opacity-50 hover:opacity-100 dark:hover:text-primary-400 text-gray-900 dark:text-gray-100",
117
- onClick: _cache[1] || (_cache[1] = withModifiers(($event) => startEditing(), ["stop"]))
127
+ onClick: _cache[2] || (_cache[2] = withModifiers(($event) => startEditing(), ["stop"]))
118
128
  }, null, 512)), [[_directive_tooltip, "Rename this preset"]]) : createCommentVNode("", true)]))]),
119
- option: withCtx(({ label, value }) => [createElementVNode("div", _hoisted_5, [createElementVNode("span", _hoisted_6, toDisplayString(label), 1), value !== DEFAULT_ID ? withDirectives((openBlock(), createBlock(unref(Icon), {
129
+ option: withCtx(({ label, value }) => [createElementVNode("div", _hoisted_4, [createElementVNode("span", _hoisted_5, toDisplayString(label), 1), value !== DEFAULT_ID ? withDirectives((openBlock(), createBlock(unref(Icon), {
120
130
  key: 0,
121
131
  icon: "carbon:trash-can",
122
132
  class: "flex-none cursor-pointer w-4 h-4 hover:text-primary-500 opacity-50 hover:opacity-100 dark:hover:text-primary-400 text-gray-900 dark:text-gray-100",
@@ -128,18 +138,18 @@ var StatePresets_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
128
138
  "data-testid": "preset-save",
129
139
  icon: savedNotif.value ? "carbon:checkmark" : "carbon:save",
130
140
  class: normalizeClass(["cursor-pointer w-4 h-4 hover:text-primary-500 dark:hover:text-primary-400 text-gray-900 dark:text-gray-100", [canEdit.value ? "opacity-50 hover:opacity-100" : "opacity-25 pointer-events-none"]]),
131
- onClick: _cache[7] || (_cache[7] = ($event) => savePreset())
141
+ onClick: _cache[8] || (_cache[8] = ($event) => savePreset())
132
142
  }, null, 8, ["icon", "class"]), [[_directive_tooltip, savedNotif.value ? "Saved!" : canEdit.value ? "Save to preset" : null]]),
133
143
  withDirectives(createVNode(unref(Icon), {
134
144
  "data-testid": "preset-create",
135
145
  icon: "carbon:add-alt",
136
146
  class: "cursor-pointer w-4 h-4 hover:text-primary-500 opacity-50 hover:opacity-100 dark:hover:text-primary-400 text-gray-900 dark:text-gray-100",
137
- onClick: _cache[8] || (_cache[8] = ($event) => createPreset())
147
+ onClick: _cache[9] || (_cache[9] = ($event) => createPreset())
138
148
  }, null, 512), [[_directive_tooltip, "Create new preset"]]),
139
149
  withDirectives(createVNode(unref(Icon), {
140
150
  icon: "carbon:reset",
141
151
  class: "cursor-pointer w-4 h-4 hover:text-primary-500 opacity-50 hover:opacity-100 dark:hover:text-primary-400 text-gray-900 dark:text-gray-100",
142
- onClick: _cache[9] || (_cache[9] = ($event) => resetState())
152
+ onClick: _cache[10] || (_cache[10] = ($event) => resetState())
143
153
  }, null, 512), [[_directive_tooltip, "Reset to initial state"]])
144
154
  ]);
145
155
  };
@@ -31,7 +31,7 @@ var StoryControls_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
31
31
  watch(() => props.variant, () => {
32
32
  ready.value = false;
33
33
  });
34
- const hasCustomControls = computed(() => props.variant.slots().controls || props.story.slots().controls);
34
+ const hasCustomControls = computed(() => props.variant.slots?.().controls || props.story.slots?.().controls);
35
35
  const hasInitState = computed(() => Object.entries(props.variant.state || {}).some(([key]) => !key.startsWith("_h")));
36
36
  return (_ctx, _cache) => {
37
37
  return openBlock(), createElementBlock("div", _hoisted_1, [
@@ -10,7 +10,9 @@ var _hoisted_1 = ["innerHTML"];
10
10
  function useStoryDoc(story) {
11
11
  const renderedDoc = ref("");
12
12
  watchEffect(async () => {
13
- const mdKey = story.value.file.filePath.replace(/\.(\w*)$/, ".md");
13
+ const filePath = story.value?.file?.filePath;
14
+ if (!filePath) return;
15
+ const mdKey = filePath.replace(/\.(\w*)$/, ".md");
14
16
  if (markdownFiles[mdKey]) {
15
17
  const md = await markdownFiles[mdKey]();
16
18
  renderedDoc.value = md.html;
@@ -14,7 +14,11 @@ var StoryEvent_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
14
14
  const formattedArgument = computed(() => {
15
15
  switch (typeof props.event.argument) {
16
16
  case "string": return `"${props.event.argument}"`;
17
- case "object": return `{ ${Object.keys(props.event.argument).map((key) => `${key}: ${props.event.argument[key]}`).join(", ")} }`;
17
+ case "object": {
18
+ const argument = props.event.argument;
19
+ if (!argument) return "null";
20
+ return `{ ${Object.keys(argument).map((key) => `${key}: ${argument[key]}`).join(", ")} }`;
21
+ }
18
22
  default: return props.event.argument;
19
23
  }
20
24
  });
@@ -16,7 +16,8 @@ var StoryEvents_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
16
16
  async function resetUnseen() {
17
17
  if (eventsStore.unseen > 0) eventsStore.unseen = 0;
18
18
  await nextTick();
19
- eventsElement.value.scrollTo({ top: eventsElement.value.scrollHeight });
19
+ const events = eventsElement.value;
20
+ events?.scrollTo({ top: events.scrollHeight });
20
21
  }
21
22
  return (_ctx, _cache) => {
22
23
  return openBlock(), createElementBlock("div", {
@@ -7,7 +7,7 @@ import PaneTabs_default from "./PaneTabs.js";
7
7
  import StoryControls_default from "./StoryControls.js";
8
8
  import StoryEvents_default from "./StoryEvents.js";
9
9
  import StorySourceCode_default from "./StorySourceCode.js";
10
- import { computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, resolveDynamicComponent, unref, withCtx } from "@poveste/vendors/vue";
10
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, openBlock, resolveDynamicComponent, unref, withCtx } from "@poveste/vendors/vue";
11
11
  import { useRoute } from "@poveste/vendors/vue-router";
12
12
  //#region src/app/components/panel/StorySidePanel.vue?vue&type=script&setup=true&lang.ts
13
13
  var _hoisted_1 = { class: "h-full w-full p-2" };
@@ -47,19 +47,21 @@ var StorySidePanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
47
47
  class: "poveste-story-side-panel poveste-loaded h-full",
48
48
  "data-testid": "story-side-panel"
49
49
  }, {
50
- first: withCtx(() => [createElementVNode("div", _hoisted_3, [createVNode(PaneTabs_default, {
50
+ first: withCtx(() => [createElementVNode("div", _hoisted_3, [unref(storyStore).currentStory ? (openBlock(), createBlock(PaneTabs_default, {
51
+ key: 0,
51
52
  story: unref(storyStore).currentStory,
52
53
  variant: unref(storyStore).currentVariant
53
- }, null, 8, ["story", "variant"]), (openBlock(), createBlock(resolveDynamicComponent(panelContentComponent.value), {
54
+ }, null, 8, ["story", "variant"])) : createCommentVNode("", true), (openBlock(), createBlock(resolveDynamicComponent(panelContentComponent.value), {
54
55
  story: unref(storyStore).currentStory,
55
56
  variant: unref(storyStore).currentVariant,
56
57
  class: "h-full overflow-auto"
57
58
  }, null, 8, ["story", "variant"]))])]),
58
- last: withCtx(() => [createVNode(StorySourceCode_default, {
59
+ last: withCtx(() => [unref(storyStore).currentStory ? (openBlock(), createBlock(StorySourceCode_default, {
60
+ key: 0,
59
61
  story: unref(storyStore).currentStory,
60
62
  variant: unref(storyStore).currentVariant,
61
63
  class: "h-full"
62
- }, null, 8, ["story", "variant"])]),
64
+ }, null, 8, ["story", "variant"])) : createCommentVNode("", true)]),
63
65
  _: 1
64
66
  }, 8, ["save-id", "orientation"]))])]);
65
67
  };
@@ -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-3d88bdb3"]]);
5
+ var StorySourceCode_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StorySourceCode_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-ec6c2034"]]);
6
6
  //#endregion
7
7
  export { StorySourceCode_default as default };
@@ -27,9 +27,10 @@ var StorySourceCode_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
27
27
  },
28
28
  setup(__props) {
29
29
  const props = __props;
30
- const generateSourceCodeFn = ref(null);
30
+ const generateSourceCodeFn = shallowRef(null);
31
31
  watchEffect(async () => {
32
- const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
32
+ const supportPluginId = props.story.file?.supportPluginId;
33
+ const clientPlugin = supportPluginId ? clientSupportPlugins[supportPluginId] : void 0;
33
34
  if (clientPlugin) {
34
35
  const pluginModule = await clientPlugin();
35
36
  generateSourceCodeFn.value = markRaw(pluginModule.generateSourceCode);
@@ -77,7 +78,7 @@ var StorySourceCode_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
77
78
  });
78
79
  const sourceHtml = computed(() => displayedSourceCode.value ? highlighter.value?.codeToHtml(displayedSourceCode.value, {
79
80
  lang: "html",
80
- theme: isDark.value ? "github-dark" : "github-light"
81
+ theme: isDark.value ? "github-dark" : "github-light-high-contrast"
81
82
  }) : "");
82
83
  let lastScroll = 0;
83
84
  watch(() => props.variant, () => {
@@ -97,13 +98,13 @@ var StorySourceCode_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
97
98
  _cache[2] || (_cache[2] = createElementVNode("div", { class: "text-gray-900 dark:text-gray-100" }, " Source ", -1)),
98
99
  _cache[3] || (_cache[3] = createElementVNode("div", { class: "flex-1" }, null, -1)),
99
100
  createElementVNode("div", _hoisted_3, [withDirectives((openBlock(), createElementBlock("button", {
100
- 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-600 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" : "opacity-50"]]),
101
102
  onClick: _cache[0] || (_cache[0] = ($event) => dynamicSourceCode.value && (displayedSource.value = "dynamic"))
102
103
  }, [createVNode(unref(Icon), {
103
104
  icon: "carbon:flash",
104
105
  class: "w-4 h-4 flex-none"
105
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", {
106
- 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-600 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" : "opacity-50"]]),
107
108
  onClick: _cache[1] || (_cache[1] = ($event) => staticSourceCode.value && (displayedSource.value = "static"))
108
109
  }, [createVNode(unref(Icon), {
109
110
  icon: "carbon:document",
@@ -50,7 +50,7 @@ var SearchPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
50
50
  watch(() => props.shown, (value) => {
51
51
  if (value) requestAnimationFrame(() => {
52
52
  focused.value = true;
53
- input.value.select();
53
+ input.value?.select();
54
54
  });
55
55
  });
56
56
  const searchInputText = ref("");
@@ -95,14 +95,18 @@ var SearchPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
95
95
  const idMapData = titleIdMap[document.item.id];
96
96
  if (!idMapData) continue;
97
97
  switch (idMapData.kind) {
98
- case "story":
99
- list.push(storyResultFactory(storyStore.getStoryById(idMapData.id), rank));
98
+ case "story": {
99
+ const story = storyStore.getStoryById(idMapData.id);
100
+ if (!story) continue;
101
+ list.push(storyResultFactory(story, rank));
100
102
  rank++;
101
103
  break;
104
+ }
102
105
  case "variant": {
103
106
  const [storyId] = idMapData.id.split(":");
104
107
  const story = storyStore.getStoryById(storyId);
105
108
  const variant = storyStore.getVariantById(idMapData.id);
109
+ if (!story || !variant) continue;
106
110
  list.push(variantResultFactory(story, variant, rank));
107
111
  rank++;
108
112
  break;
@@ -121,9 +125,13 @@ var SearchPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
121
125
  const idMapData = docIdMap[document.item.id];
122
126
  if (!idMapData) continue;
123
127
  switch (idMapData.kind) {
124
- case "story":
125
- list.push(storyResultFactory(storyStore.getStoryById(idMapData.id), rank, "docs"));
128
+ case "story": {
129
+ const story = storyStore.getStoryById(idMapData.id);
130
+ if (!story) continue;
131
+ list.push(storyResultFactory(story, rank, "docs"));
126
132
  rank++;
133
+ break;
134
+ }
127
135
  }
128
136
  }
129
137
  docsResults.value = list;
@@ -141,7 +149,7 @@ var SearchPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
141
149
  params: { storyId: story.id },
142
150
  query: { ...type === "docs" ? { tab: "docs" } : {} }
143
151
  },
144
- path: story.file.path.slice(0, -1),
152
+ path: story.file?.path.slice(0, -1) ?? [],
145
153
  icon: story.icon,
146
154
  iconColor: story.iconColor
147
155
  };
@@ -160,7 +168,7 @@ var SearchPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
160
168
  ...type === "docs" ? { tab: "docs" } : {}
161
169
  }
162
170
  },
163
- path: [...story.file.path ?? [], story.title],
171
+ path: [...story.file?.path ?? [], story.title],
164
172
  icon: variant.icon,
165
173
  iconColor: variant.iconColor
166
174
  };
@@ -8,7 +8,8 @@ var GenericMountStory_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
8
8
  const props = __props;
9
9
  const mountComponent = ref(null);
10
10
  watchEffect(async () => {
11
- const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
11
+ const supportPluginId = props.story.file?.supportPluginId;
12
+ const clientPlugin = supportPluginId ? clientSupportPlugins[supportPluginId] : void 0;
12
13
  if (clientPlugin) {
13
14
  const pluginModule = await clientPlugin();
14
15
  mountComponent.value = markRaw(pluginModule.MountStory);
@@ -8,7 +8,8 @@ var GenericRenderStory_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
8
8
  const props = __props;
9
9
  const mountComponent = ref(null);
10
10
  watchEffect(async () => {
11
- const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
11
+ const supportPluginId = props.story.file?.supportPluginId;
12
+ const clientPlugin = supportPluginId ? clientSupportPlugins[supportPluginId] : void 0;
12
13
  if (clientPlugin) try {
13
14
  const pluginModule = await clientPlugin();
14
15
  mountComponent.value = markRaw(pluginModule.RenderStory);
@@ -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-380b627d"]]);
5
+ var StoryResponsivePreview_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-d3057f34"]]);
6
6
  //#endregion
7
7
  export { StoryResponsivePreview_default as default };
@@ -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) => ({ "v0cb511a0": unref(settings).backgroundColor }));
26
+ useCssVars((_ctx) => ({ "v372ee944": unref(settings).backgroundColor }));
27
27
  const props = __props;
28
28
  const settings = usePreviewSettingsStore().currentSettings;
29
29
  const resizing = ref(false);
@@ -42,18 +42,29 @@ var StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default = /*@__PU
42
42
  }
43
43
  const previewWrapper = ref();
44
44
  function useDragger(el, value, min, max, axis) {
45
+ function wrapperSize() {
46
+ const wrapper = previewWrapper.value;
47
+ if (!wrapper) return null;
48
+ return axis === "x" ? wrapper.clientWidth : wrapper.clientHeight;
49
+ }
50
+ function startFrom() {
51
+ if (value.value !== null) return value.value;
52
+ const size = wrapperSize();
53
+ if (size === null) return min;
54
+ return size - (axis === "x" ? 67 : 70);
55
+ }
45
56
  function onMouseDown(event) {
46
57
  event.preventDefault();
47
58
  event.stopPropagation();
48
59
  const start = axis === "x" ? event.clientX : event.clientY;
49
- const startValue = value.value ?? (axis === "x" ? previewWrapper.value.clientWidth - 67 : previewWrapper.value.clientHeight - 70);
60
+ const startValue = startFrom();
50
61
  resizing.value = true;
51
62
  const removeListeners = [addWindowListener("mousemove", onMouseMove), addWindowListener("mouseup", onMouseUp)];
52
63
  function onMouseMove(event) {
53
- const snapTarget = axis === "x" ? previewWrapper.value.clientWidth : previewWrapper.value.clientHeight;
64
+ const snapTarget = wrapperSize();
54
65
  const delta = (axis === "x" ? event.clientX : event.clientY) - start;
55
66
  value.value = Math.max(min, Math.min(max, startValue + delta));
56
- if (Math.abs(value.value - (snapTarget - 67)) < 16) value.value = null;
67
+ if (snapTarget !== null && Math.abs(value.value - (snapTarget - 67)) < 16) value.value = null;
57
68
  }
58
69
  function onMouseUp() {
59
70
  removeListeners.forEach((fn) => fn());
@@ -65,7 +76,7 @@ var StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default = /*@__PU
65
76
  event.preventDefault();
66
77
  event.stopPropagation();
67
78
  const start = axis === "x" ? event.touches[0].clientX : event.touches[0].clientY;
68
- const startValue = value.value;
79
+ const startValue = startFrom();
69
80
  resizing.value = true;
70
81
  const removeListeners = [
71
82
  addWindowListener("touchmove", onTouchMove),
@@ -130,7 +141,7 @@ var StoryResponsivePreview_vue_vue_type_script_setup_true_lang_default = /*@__PU
130
141
  finalWidth: finalWidth.value,
131
142
  finalHeight: finalHeight.value,
132
143
  resizing: resizing.value
133
- }, 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-380b627d></div><div class=\"absolute top-5 right-8 h-2 w-px bg-gray-400/25\" data-v-380b627d></div><div class=\"absolute bottom-5 left-8 h-2 w-px bg-gray-400/25\" data-v-380b627d></div><div class=\"absolute bottom-5 right-8 h-2 w-px bg-gray-400/25\" data-v-380b627d></div><div class=\"absolute left-5 top-8 w-2 h-px bg-gray-400/25\" data-v-380b627d></div><div class=\"absolute left-5 bottom-8 w-2 h-px bg-gray-400/25\" data-v-380b627d></div><div class=\"absolute right-5 top-8 w-2 h-px bg-gray-400/25\" data-v-380b627d></div><div class=\"absolute right-5 bottom-8 w-2 h-px bg-gray-400/25\" data-v-380b627d></div>", 8))], 64)) : createCommentVNode("", true)], 2)], 10, _hoisted_3), isResponsiveEnabled.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
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-d3057f34></div><div class=\"absolute top-5 right-8 h-2 w-px bg-gray-400/25\" data-v-d3057f34></div><div class=\"absolute bottom-5 left-8 h-2 w-px bg-gray-400/25\" data-v-d3057f34></div><div class=\"absolute bottom-5 right-8 h-2 w-px bg-gray-400/25\" data-v-d3057f34></div><div class=\"absolute left-5 top-8 w-2 h-px bg-gray-400/25\" data-v-d3057f34></div><div class=\"absolute left-5 bottom-8 w-2 h-px bg-gray-400/25\" data-v-d3057f34></div><div class=\"absolute right-5 top-8 w-2 h-px bg-gray-400/25\" data-v-d3057f34></div><div class=\"absolute right-5 bottom-8 w-2 h-px bg-gray-400/25\" data-v-d3057f34></div>", 8))], 64)) : createCommentVNode("", true)], 2)], 10, _hoisted_3), isResponsiveEnabled.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
134
145
  withDirectives((openBlock(), createElementBlock("div", {
135
146
  ref_key: "horizontalDragger",
136
147
  ref: horizontalDragger,
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
2
2
  import StoryVariantGrid_vue_vue_type_script_setup_true_lang_default from "./StoryVariantGrid.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region src/app/components/story/StoryVariantGrid.vue
5
- var StoryVariantGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantGrid_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-5f7bc1e1"]]);
5
+ var StoryVariantGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantGrid_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-a753c25f"]]);
6
6
  //#endregion
7
7
  export { StoryVariantGrid_default as default };
@@ -2,7 +2,7 @@ import { useStoryStore } from "../../stores/story.js";
2
2
  import { assignSlots, trimSlots } from "../../util/grid-slots.js";
3
3
  import StoryVariantGridItem_default from "./StoryVariantGridItem.js";
4
4
  import { useDebounceFn, useResizeObserver } from "@poveste/vendors/vue-use";
5
- import { Fragment, computed, createBlock, createElementBlock, createElementVNode, defineComponent, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, unref, watch } from "@poveste/vendors/vue";
5
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, unref, watch } from "@poveste/vendors/vue";
6
6
  //#region src/app/components/story/StoryVariantGrid.vue?vue&type=script&setup=true&lang.ts
7
7
  var _hoisted_1 = { class: "poveste-story-variant-grid flex flex-col items-stretch h-full __poveste-pane-shadow-from-right" };
8
8
  var _hoisted_2 = { class: "flex w-0 flex-1 mx-4" };
@@ -17,17 +17,18 @@ var StoryVariantGrid_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
17
17
  setup(__props) {
18
18
  const storyStore = useStoryStore();
19
19
  const gridTemplateWidth = computed(() => {
20
- if (storyStore.currentStory.layout.type !== "grid") return;
21
- const layoutWidth = storyStore.currentStory.layout.width;
20
+ const layout = storyStore.currentStory?.layout;
21
+ if (layout?.type !== "grid") return;
22
+ const layoutWidth = layout.width;
22
23
  if (!layoutWidth) return "200px";
23
24
  if (typeof layoutWidth === "number") return `${layoutWidth}px`;
24
25
  return layoutWidth;
25
26
  });
26
27
  const maxItemHeight = ref(0);
27
- const el = ref(null);
28
+ const el = ref();
28
29
  const scrollTop = ref(0);
29
30
  const viewportHeight = ref(0);
30
- const variants = computed(() => storyStore.currentStory.variants);
31
+ const variants = computed(() => storyStore.currentStory?.variants ?? []);
31
32
  useResizeObserver(el, () => {
32
33
  updateWindow();
33
34
  updateSize();
@@ -60,14 +61,16 @@ var StoryVariantGrid_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
60
61
  updateWindow();
61
62
  }
62
63
  }
63
- const gridEl = ref(null);
64
+ const gridEl = ref();
64
65
  const gridColumnWidth = ref(1);
65
66
  const viewWidth = ref(1);
66
67
  function updateSize() {
67
68
  if (!el.value) return;
68
69
  viewWidth.value = el.value.clientWidth;
69
70
  if (!gridEl.value) return;
70
- if (gridTemplateWidth.value.endsWith("%")) gridColumnWidth.value = viewWidth.value * Number.parseInt(gridTemplateWidth.value) / 100 - gap;
71
+ const templateWidth = gridTemplateWidth.value;
72
+ if (!templateWidth) return;
73
+ if (templateWidth.endsWith("%")) gridColumnWidth.value = viewWidth.value * Number.parseInt(templateWidth) / 100 - gap;
71
74
  else gridColumnWidth.value = Number.parseInt(gridTemplateWidth.value);
72
75
  }
73
76
  onMounted(() => {
@@ -105,7 +108,9 @@ var StoryVariantGrid_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
105
108
  }, TRIM_DELAY);
106
109
  }
107
110
  watch(visibleVariants, (visible) => {
108
- slots.value = assignSlots(slots.value, storyStore.currentStory.id, visible);
111
+ const story = storyStore.currentStory;
112
+ if (!story) return;
113
+ slots.value = assignSlots(slots.value, story.id, visible);
109
114
  scheduleTrim();
110
115
  }, { immediate: true });
111
116
  onBeforeUnmount(() => {
@@ -143,7 +148,7 @@ var StoryVariantGrid_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
143
148
  gridTemplateColumns: `repeat(${columnCount.value}, ${gridColumnWidth.value}px)`,
144
149
  transform: offsetY.value ? `translateY(${offsetY.value}px)` : void 0
145
150
  })
146
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(slots.value, (slot, index) => {
151
+ }, [unref(storyStore).currentStory ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(slots.value, (slot, index) => {
147
152
  return openBlock(), createBlock(StoryVariantGridItem_default, {
148
153
  key: index,
149
154
  variant: slot.variant,
@@ -158,7 +163,7 @@ var StoryVariantGrid_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
158
163
  "story",
159
164
  "style"
160
165
  ]);
161
- }), 128))], 4)], 4)])], 544)]);
166
+ }), 128)) : createCommentVNode("", true)], 4)], 4)])], 544)]);
162
167
  };
163
168
  }
164
169
  });
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
2
2
  import StoryVariantSingle_vue_vue_type_script_setup_true_lang_default from "./StoryVariantSingle.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region src/app/components/story/StoryVariantSingle.vue
5
- var StoryVariantSingle_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantSingle_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-6805a444"]]);
5
+ var StoryVariantSingle_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantSingle_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-6b31fb1b"]]);
6
6
  //#endregion
7
7
  export { StoryVariantSingle_default as default };
@@ -7,65 +7,53 @@ import StoryVariantSingleView_default from "./StoryVariantSingleView.js";
7
7
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref, useCssVars, withCtx } from "@poveste/vendors/vue";
8
8
  import { Icon } from "@poveste/vendors/iconify";
9
9
  //#region src/app/components/story/StoryVariantSingle.vue?vue&type=script&setup=true&lang.ts
10
- var _hoisted_1 = {
11
- key: 0,
12
- class: "divide-y divide-gray-100 dark:divide-gray-800 h-full flex flex-col"
13
- };
10
+ var _hoisted_1 = { class: "h-full overflow-y-auto" };
14
11
  var _hoisted_2 = {
15
12
  key: 1,
16
13
  class: "poveste-story-variant-single p-2 h-full __poveste-pane-shadow-from-right"
17
14
  };
18
- var _hoisted_3 = { class: "h-full overflow-y-auto" };
19
- var _hoisted_4 = {
20
- key: 0,
21
- class: "poveste-story-variant-single p-2 h-full __poveste-pane-shadow-from-right"
22
- };
23
15
  var StoryVariantSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
24
16
  __name: "StoryVariantSingle",
25
17
  emits: { openVariantMenu: () => true },
26
18
  setup(__props) {
27
- useCssVars((_ctx) => ({ "v72c6d646": variant.value?.iconColor }));
19
+ useCssVars((_ctx) => ({ "v0fc28fe3": variant.value?.iconColor }));
28
20
  const storyStore = useStoryStore();
29
21
  const hasSingleVariant = computed(() => storyStore.currentStory?.variants.length === 1);
30
22
  const variant = computed(() => storyStore.currentVariant ?? null);
31
23
  const showsPreview = computed(() => !!variant.value || autoSelectsVariant(storyStore.currentStory));
32
24
  return (_ctx, _cache) => {
33
- return unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_1, [!hasSingleVariant.value || !variant.value ? (openBlock(), createElementBlock("a", {
34
- key: 0,
35
- class: "px-6 h-12 hover:text-primary-500 dark:hover:text-primary-400 cursor-pointer flex gap-2 flex-wrap w-full items-center flex-none",
36
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("openVariantMenu"))
37
- }, [variant.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(Icon), {
38
- icon: variant.value.icon ?? "carbon:cube",
39
- class: normalizeClass(["w-5 h-5 flex-none", {
40
- "text-gray-500": !variant.value.iconColor,
41
- "bind-icon-color": variant.value.iconColor
42
- }])
43
- }, null, 8, ["icon", "class"]), createTextVNode(" " + toDisplayString(variant.value.title), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(" Select a variant... ")], 64)), createVNode(unref(Icon), {
44
- icon: "carbon:chevron-sort",
45
- class: "w-5 h-5 shrink-0 ml-auto"
46
- })])) : createCommentVNode("", true), showsPreview.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(StoryVariantSingleView_default, {
47
- variant: variant.value,
48
- story: unref(storyStore).currentStory
49
- }, null, 8, ["variant", "story"])])) : createCommentVNode("", true)])) : (openBlock(), createBlock(BaseSplitPane_default, {
50
- key: 1,
25
+ return openBlock(), createBlock(BaseSplitPane_default, {
51
26
  "save-id": "story-single-main-split",
52
27
  min: 5,
53
28
  max: 40,
54
29
  "default-split": 17,
55
- "show-first": !hasSingleVariant.value
30
+ "show-first": !unref(isMobile) && !hasSingleVariant.value
56
31
  }, {
57
- first: withCtx(() => [createElementVNode("div", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory?.variants ?? [], (v, index) => {
32
+ first: withCtx(() => [createElementVNode("div", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory?.variants ?? [], (v, index) => {
58
33
  return openBlock(), createBlock(StoryVariantListItem_default, {
59
34
  key: index,
60
35
  variant: v
61
36
  }, null, 8, ["variant"]);
62
37
  }), 128))])]),
63
- last: withCtx(() => [showsPreview.value ? (openBlock(), createElementBlock("div", _hoisted_4, [createVNode(StoryVariantSingleView_default, {
38
+ last: withCtx(() => [createElementVNode("div", { class: normalizeClass(["h-full flex flex-col", { "divide-y divide-gray-100 dark:divide-gray-800": unref(isMobile) }]) }, [unref(isMobile) && (!hasSingleVariant.value || !variant.value) ? (openBlock(), createElementBlock("a", {
39
+ key: 0,
40
+ class: "px-6 h-12 hover:text-primary-500 dark:hover:text-primary-400 cursor-pointer flex gap-2 flex-wrap w-full items-center flex-none",
41
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("openVariantMenu"))
42
+ }, [variant.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(Icon), {
43
+ icon: variant.value.icon ?? "carbon:cube",
44
+ class: normalizeClass(["w-5 h-5 flex-none", {
45
+ "text-gray-500": !variant.value.iconColor,
46
+ "bind-icon-color": variant.value.iconColor
47
+ }])
48
+ }, null, 8, ["icon", "class"]), createTextVNode(" " + toDisplayString(variant.value.title), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(" Select a variant... ")], 64)), createVNode(unref(Icon), {
49
+ icon: "carbon:chevron-sort",
50
+ class: "w-5 h-5 shrink-0 ml-auto"
51
+ })])) : createCommentVNode("", true), showsPreview.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(StoryVariantSingleView_default, {
64
52
  variant: variant.value,
65
53
  story: unref(storyStore).currentStory
66
- }, null, 8, ["variant", "story"])])) : createCommentVNode("", true)]),
54
+ }, null, 8, ["variant", "story"])])) : createCommentVNode("", true)], 2)]),
67
55
  _: 1
68
- }, 8, ["show-first"]));
56
+ }, 8, ["show-first"]);
69
57
  };
70
58
  }
71
59
  });
@@ -24,7 +24,7 @@ var StoryVariantSingleView_vue_vue_type_script_setup_true_lang_default = /*@__PU
24
24
  return openBlock(), createElementBlock("div", {
25
25
  class: normalizeClass(["poveste-story-variant-single-view h-full flex flex-col", { invisible: !__props.variant }]),
26
26
  "data-testid": "story-variant-single-view"
27
- }, [shown.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [shown.value.story.layout?.iframe === false ? (openBlock(), createBlock(StoryVariantSinglePreviewNative_default, {
27
+ }, [shown.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [shown.value.story.layout?.type === "single" && shown.value.story.layout.iframe === false ? (openBlock(), createBlock(StoryVariantSinglePreviewNative_default, {
28
28
  key: 0,
29
29
  story: shown.value.story,
30
30
  variant: shown.value.variant