@poveste/app 0.1.1 → 0.1.3

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 (184) hide show
  1. package/dist/app/assets/poveste-text-dark.svg +15 -0
  2. package/dist/app/assets/poveste-text.svg +15 -0
  3. package/dist/app/assets/poveste.svg +14 -0
  4. package/dist/app/style/floating.pcss +34 -0
  5. package/dist/app/style/main.pcss +100 -0
  6. package/dist/app/style/sandbox.css +24 -0
  7. package/dist/app/style/transitions.pcss +51 -0
  8. package/dist/bundle-index.js +1 -0
  9. package/dist/bundle-main-dev.js +4 -0
  10. package/dist/bundle-main.js +5 -0
  11. package/dist/bundle-sandbox-dev.js +2 -0
  12. package/dist/bundle-sandbox.js +2 -0
  13. package/dist/bundled/App.vue.js +5 -0
  14. package/dist/bundled/App.vue2.js +167 -0
  15. package/dist/bundled/_virtual/_plugin-vue_export-helper.js +10 -0
  16. package/dist/bundled/api.js +12 -0
  17. package/dist/bundled/app.css +116 -0
  18. package/dist/bundled/assets/poveste-text-dark.svg.js +4 -0
  19. package/dist/bundled/assets/poveste-text.svg.js +4 -0
  20. package/dist/bundled/assets/poveste.svg.js +4 -0
  21. package/dist/bundled/components/HomeView.vue.js +5 -0
  22. package/dist/bundled/components/HomeView.vue2.js +66 -0
  23. package/dist/bundled/components/app/AppHeader.vue.js +5 -0
  24. package/dist/bundled/components/app/AppHeader.vue2.js +71 -0
  25. package/dist/bundled/components/app/AppLogo.vue.js +5 -0
  26. package/dist/bundled/components/app/AppLogo.vue2.js +29 -0
  27. package/dist/bundled/components/app/Breadcrumb.vue.js +8 -0
  28. package/dist/bundled/components/app/Breadcrumb.vue2.js +91 -0
  29. package/dist/bundled/components/app/HomeCounter.vue.js +5 -0
  30. package/dist/bundled/components/app/HomeCounter.vue2.js +42 -0
  31. package/dist/bundled/components/app/InitialLoading.vue.js +5 -0
  32. package/dist/bundled/components/app/InitialLoading.vue2.js +51 -0
  33. package/dist/bundled/components/app/MobileOverlay.vue.js +5 -0
  34. package/dist/bundled/components/app/MobileOverlay.vue2.js +45 -0
  35. package/dist/bundled/components/base/BaseButton.vue.js +5 -0
  36. package/dist/bundled/components/base/BaseButton.vue2.js +39 -0
  37. package/dist/bundled/components/base/BaseCheckbox.vue.js +5 -0
  38. package/dist/bundled/components/base/BaseCheckbox.vue2.js +78 -0
  39. package/dist/bundled/components/base/BaseEmpty.vue.js +14 -0
  40. package/dist/bundled/components/base/BaseIcon.vue.js +8 -0
  41. package/dist/bundled/components/base/BaseIcon.vue2.js +29 -0
  42. package/dist/bundled/components/base/BaseKeyboardShortcut.vue.js +5 -0
  43. package/dist/bundled/components/base/BaseKeyboardShortcut.vue2.js +20 -0
  44. package/dist/bundled/components/base/BaseListItem.vue.js +5 -0
  45. package/dist/bundled/components/base/BaseListItem.vue2.js +33 -0
  46. package/dist/bundled/components/base/BaseListItemLink.vue.js +33 -0
  47. package/dist/bundled/components/base/BaseListItemLink.vue2.js +26 -0
  48. package/dist/bundled/components/base/BaseOverflowMenu.vue.js +5 -0
  49. package/dist/bundled/components/base/BaseOverflowMenu.vue2.js +100 -0
  50. package/dist/bundled/components/base/BaseOverflowTab.vue.js +36 -0
  51. package/dist/bundled/components/base/BaseOverflowTab.vue2.js +18 -0
  52. package/dist/bundled/components/base/BaseSelect.vue.js +5 -0
  53. package/dist/bundled/components/base/BaseSelect.vue2.js +77 -0
  54. package/dist/bundled/components/base/BaseSplitPane.vue.js +8 -0
  55. package/dist/bundled/components/base/BaseSplitPane.vue2.js +183 -0
  56. package/dist/bundled/components/base/BaseTab.vue.js +36 -0
  57. package/dist/bundled/components/base/BaseTab.vue2.js +18 -0
  58. package/dist/bundled/components/base/BaseTag.vue.js +13 -0
  59. package/dist/bundled/components/command/CommandPrompts.vue.js +5 -0
  60. package/dist/bundled/components/command/CommandPrompts.vue2.js +91 -0
  61. package/dist/bundled/components/command/CommandPromptsModal.vue.js +5 -0
  62. package/dist/bundled/components/command/CommandPromptsModal.vue2.js +45 -0
  63. package/dist/bundled/components/command/PromptSelect.vue.js +5 -0
  64. package/dist/bundled/components/command/PromptSelect.vue2.js +142 -0
  65. package/dist/bundled/components/command/PromptText.vue.js +5 -0
  66. package/dist/bundled/components/command/PromptText.vue2.js +67 -0
  67. package/dist/bundled/components/misc/CheckerboardPattern.vue.js +40 -0
  68. package/dist/bundled/components/misc/HatchedPattern.vue.js +12 -0
  69. package/dist/bundled/components/panel/ControlsComponentPropItem.vue.js +5 -0
  70. package/dist/bundled/components/panel/ControlsComponentPropItem.vue2.js +72 -0
  71. package/dist/bundled/components/panel/ControlsComponentProps.vue.js +5 -0
  72. package/dist/bundled/components/panel/ControlsComponentProps.vue2.js +45 -0
  73. package/dist/bundled/components/panel/ControlsComponentState.vue.js +5 -0
  74. package/dist/bundled/components/panel/ControlsComponentState.vue2.js +41 -0
  75. package/dist/bundled/components/panel/ControlsComponentStateItem.vue.js +5 -0
  76. package/dist/bundled/components/panel/ControlsComponentStateItem.vue2.js +46 -0
  77. package/dist/bundled/components/panel/PaneTabs.vue.js +5 -0
  78. package/dist/bundled/components/panel/PaneTabs.vue2.js +114 -0
  79. package/dist/bundled/components/panel/StatePresets.vue.js +5 -0
  80. package/dist/bundled/components/panel/StatePresets.vue2.js +193 -0
  81. package/dist/bundled/components/panel/StoryControls.vue.js +5 -0
  82. package/dist/bundled/components/panel/StoryControls.vue2.js +87 -0
  83. package/dist/bundled/components/panel/StoryDocs.vue.js +7 -0
  84. package/dist/bundled/components/panel/StoryDocs.vue2.js +161 -0
  85. package/dist/bundled/components/panel/StoryEvent.vue.js +5 -0
  86. package/dist/bundled/components/panel/StoryEvent.vue2.js +59 -0
  87. package/dist/bundled/components/panel/StoryEvents.vue.js +5 -0
  88. package/dist/bundled/components/panel/StoryEvents.vue2.js +53 -0
  89. package/dist/bundled/components/panel/StorySidePanel.vue.js +5 -0
  90. package/dist/bundled/components/panel/StorySidePanel.vue2.js +83 -0
  91. package/dist/bundled/components/panel/StorySourceCode.vue.js +8 -0
  92. package/dist/bundled/components/panel/StorySourceCode.vue2.js +204 -0
  93. package/dist/bundled/components/search/SearchItem.vue.js +8 -0
  94. package/dist/bundled/components/search/SearchItem.vue2.js +93 -0
  95. package/dist/bundled/components/search/SearchItemContent.vue.js +5 -0
  96. package/dist/bundled/components/search/SearchItemContent.vue2.js +71 -0
  97. package/dist/bundled/components/search/SearchLoading.vue.js +5 -0
  98. package/dist/bundled/components/search/SearchLoading.vue2.js +21 -0
  99. package/dist/bundled/components/search/SearchModal.vue.js +5 -0
  100. package/dist/bundled/components/search/SearchModal.vue2.js +51 -0
  101. package/dist/bundled/components/search/SearchPane.vue.js +5 -0
  102. package/dist/bundled/components/search/SearchPane.vue2.js +272 -0
  103. package/dist/bundled/components/search/search-docs-data.js +11 -0
  104. package/dist/bundled/components/search/search-title-data.js +11 -0
  105. package/dist/bundled/components/story/GenericMountStory.vue.js +5 -0
  106. package/dist/bundled/components/story/GenericMountStory.vue2.js +34 -0
  107. package/dist/bundled/components/story/GenericRenderStory.vue.js +5 -0
  108. package/dist/bundled/components/story/GenericRenderStory.vue2.js +39 -0
  109. package/dist/bundled/components/story/StoryResponsivePreview.vue.js +8 -0
  110. package/dist/bundled/components/story/StoryResponsivePreview.vue2.js +207 -0
  111. package/dist/bundled/components/story/StoryVariantGrid.vue.js +5 -0
  112. package/dist/bundled/components/story/StoryVariantGrid.vue2.js +146 -0
  113. package/dist/bundled/components/story/StoryVariantGridItem.vue.js +8 -0
  114. package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +155 -0
  115. package/dist/bundled/components/story/StoryVariantListItem.vue.js +8 -0
  116. package/dist/bundled/components/story/StoryVariantListItem.vue2.js +55 -0
  117. package/dist/bundled/components/story/StoryVariantSingle.vue.js +8 -0
  118. package/dist/bundled/components/story/StoryVariantSingle.vue2.js +107 -0
  119. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue.js +5 -0
  120. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +72 -0
  121. package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue.js +5 -0
  122. package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue2.js +128 -0
  123. package/dist/bundled/components/story/StoryVariantSingleView.vue.js +5 -0
  124. package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +66 -0
  125. package/dist/bundled/components/story/StoryView.vue.js +5 -0
  126. package/dist/bundled/components/story/StoryView.vue2.js +104 -0
  127. package/dist/bundled/components/story/StoryViewer.vue.js +8 -0
  128. package/dist/bundled/components/story/StoryViewer.vue2.js +55 -0
  129. package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue.js +5 -0
  130. package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue2.js +31 -0
  131. package/dist/bundled/components/toolbar/ToolbarBackground.vue.js +8 -0
  132. package/dist/bundled/components/toolbar/ToolbarBackground.vue2.js +98 -0
  133. package/dist/bundled/components/toolbar/ToolbarNewTab.vue.js +5 -0
  134. package/dist/bundled/components/toolbar/ToolbarNewTab.vue2.js +36 -0
  135. package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue.js +5 -0
  136. package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue2.js +127 -0
  137. package/dist/bundled/components/toolbar/ToolbarTextDirection.vue.js +5 -0
  138. package/dist/bundled/components/toolbar/ToolbarTextDirection.vue2.js +27 -0
  139. package/dist/bundled/components/toolbar/ToolbarTitle.vue.js +5 -0
  140. package/dist/bundled/components/toolbar/ToolbarTitle.vue2.js +26 -0
  141. package/dist/bundled/components/tree/StoryGroup.vue.js +5 -0
  142. package/dist/bundled/components/tree/StoryGroup.vue2.js +74 -0
  143. package/dist/bundled/components/tree/StoryList.vue.js +5 -0
  144. package/dist/bundled/components/tree/StoryList.vue2.js +41 -0
  145. package/dist/bundled/components/tree/StoryListFolder.vue.js +8 -0
  146. package/dist/bundled/components/tree/StoryListFolder.vue2.js +86 -0
  147. package/dist/bundled/components/tree/StoryListItem.vue.js +8 -0
  148. package/dist/bundled/components/tree/StoryListItem.vue2.js +69 -0
  149. package/dist/bundled/index.js +35 -0
  150. package/dist/bundled/plugin.js +49 -0
  151. package/dist/bundled/router.js +32 -0
  152. package/dist/bundled/sandbox.js +87 -0
  153. package/dist/bundled/stores/command.js +25 -0
  154. package/dist/bundled/stores/events.js +29 -0
  155. package/dist/bundled/stores/folder.js +54 -0
  156. package/dist/bundled/stores/preview-settings.js +19 -0
  157. package/dist/bundled/stores/story.js +43 -0
  158. package/dist/bundled/util/commands.js +57 -0
  159. package/dist/bundled/util/config.js +8 -0
  160. package/dist/bundled/util/const.js +10 -0
  161. package/dist/bundled/util/dark.js +28 -0
  162. package/dist/bundled/util/docs.js +26 -0
  163. package/dist/bundled/util/env.js +4 -0
  164. package/dist/bundled/util/events.js +33 -0
  165. package/dist/bundled/util/keyboard.js +90 -0
  166. package/dist/bundled/util/mapping.js +70 -0
  167. package/dist/bundled/util/open-in-editor.js +6 -0
  168. package/dist/bundled/util/preview-settings.js +22 -0
  169. package/dist/bundled/util/responsive.js +6 -0
  170. package/dist/bundled/util/sandbox.js +11 -0
  171. package/dist/bundled/util/scroll.js +31 -0
  172. package/dist/bundled/util/select.js +28 -0
  173. package/dist/bundled/util/state.js +41 -0
  174. package/dist/bundled/util/tooltip.js +15 -0
  175. package/dist/bundled/util/variant.js +21 -0
  176. package/dist/style.css +2853 -0
  177. package/package.json +8 -4
  178. package/postcss-scope-wrapper.cjs +0 -35
  179. package/postcss.config.cjs +0 -9
  180. package/scripts/copy.mjs +0 -12
  181. package/scripts/watchAndCopy.mjs +0 -15
  182. package/tailwind.config.cjs +0 -137
  183. package/tsconfig.json +0 -53
  184. package/vite.config.ts +0 -88
@@ -0,0 +1,53 @@
1
+ import { defineComponent, computed, onMounted, watch, nextTick, ref, createElementBlock, openBlock, createBlock, withCtx, createVNode, createTextVNode, unref, Fragment, renderList } from "@poveste/vendors/vue";
2
+ import { Icon } from "@poveste/vendors/iconify";
3
+ import { useEventsStore } from "../../stores/events.js";
4
+ import BaseEmpty from "../base/BaseEmpty.vue.js";
5
+ import "./StoryEvent.vue.js";
6
+ import _sfc_main$1 from "./StoryEvent.vue2.js";
7
+ "use strict";
8
+ const _hoisted_1 = { key: 1 };
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ __name: "StoryEvents",
11
+ setup(__props) {
12
+ const eventsStore = useEventsStore();
13
+ const hasEvents = computed(() => eventsStore.events.length);
14
+ onMounted(resetUnseen);
15
+ watch(() => eventsStore.unseen, resetUnseen);
16
+ async function resetUnseen() {
17
+ if (eventsStore.unseen > 0) {
18
+ eventsStore.unseen = 0;
19
+ }
20
+ await nextTick();
21
+ eventsElement.value.scrollTo({ top: eventsElement.value.scrollHeight });
22
+ }
23
+ const eventsElement = ref();
24
+ return (_ctx, _cache) => {
25
+ return openBlock(), createElementBlock("div", {
26
+ ref_key: "eventsElement",
27
+ ref: eventsElement,
28
+ class: "poveste-story-events"
29
+ }, [
30
+ !hasEvents.value ? (openBlock(), createBlock(BaseEmpty, { key: 0 }, {
31
+ default: withCtx(() => [
32
+ createVNode(unref(Icon), {
33
+ icon: "carbon:event-schedule",
34
+ class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
35
+ }),
36
+ _cache[0] || (_cache[0] = createTextVNode(" No event fired ", -1))
37
+ ]),
38
+ _: 1
39
+ })) : (openBlock(), createElementBlock("div", _hoisted_1, [
40
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(eventsStore).events, (event, key) => {
41
+ return openBlock(), createBlock(_sfc_main$1, {
42
+ key,
43
+ event
44
+ }, null, 8, ["event"]);
45
+ }), 128))
46
+ ]))
47
+ ], 512);
48
+ };
49
+ }
50
+ });
51
+ export {
52
+ _sfc_main as default
53
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./StorySidePanel.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,83 @@
1
+ import { defineComponent, computed, createBlock, unref, openBlock, withCtx, createElementVNode, createVNode, resolveDynamicComponent } from "@poveste/vendors/vue";
2
+ import { useRoute } from "@poveste/vendors/vue-router";
3
+ import { useStoryStore } from "../../stores/story.js";
4
+ import BaseEmpty from "../base/BaseEmpty.vue.js";
5
+ import BaseSplitPane from "../base/BaseSplitPane.vue.js";
6
+ import "./PaneTabs.vue.js";
7
+ import "./StoryControls.vue.js";
8
+ import "./StoryDocs.vue.js";
9
+ import "./StoryEvents.vue.js";
10
+ import StorySourceCode from "./StorySourceCode.vue.js";
11
+ import _sfc_main$1 from "./StoryControls.vue2.js";
12
+ import _sfc_main$2 from "./StoryEvents.vue2.js";
13
+ import _sfc_main$3 from "./StoryDocs.vue2.js";
14
+ import _sfc_main$4 from "./PaneTabs.vue2.js";
15
+ "use strict";
16
+ const _hoisted_1 = { class: "htw-flex htw-flex-col htw-h-full" };
17
+ const _sfc_main = /* @__PURE__ */ defineComponent({
18
+ __name: "StorySidePanel",
19
+ setup(__props) {
20
+ const storyStore = useStoryStore();
21
+ const route = useRoute();
22
+ const panelContentComponent = computed(() => {
23
+ switch (route.query.tab) {
24
+ case "docs":
25
+ return _sfc_main$3;
26
+ case "events":
27
+ return _sfc_main$2;
28
+ default:
29
+ return _sfc_main$1;
30
+ }
31
+ });
32
+ return (_ctx, _cache) => {
33
+ return !unref(storyStore).currentVariant ? (openBlock(), createBlock(BaseEmpty, {
34
+ key: 0,
35
+ class: "poveste-story-side-panel poveste-selection"
36
+ }, {
37
+ default: withCtx(() => [..._cache[0] || (_cache[0] = [
38
+ createElementVNode("span", null, "Select a variant", -1)
39
+ ])]),
40
+ _: 1
41
+ })) : !unref(storyStore).currentVariant.configReady || !unref(storyStore).currentVariant.previewReady ? (openBlock(), createBlock(BaseEmpty, {
42
+ key: 1,
43
+ class: "poveste-story-side-panel poveste-loading"
44
+ }, {
45
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
46
+ createElementVNode("span", null, "Loading...", -1)
47
+ ])]),
48
+ _: 1
49
+ })) : (openBlock(), createBlock(BaseSplitPane, {
50
+ key: 2,
51
+ "save-id": "story-sidepane",
52
+ orientation: "portrait",
53
+ class: "poveste-story-side-panel poveste-loaded htw-h-full",
54
+ "data-test-id": "story-side-panel"
55
+ }, {
56
+ first: withCtx(() => [
57
+ createElementVNode("div", _hoisted_1, [
58
+ createVNode(_sfc_main$4, {
59
+ story: unref(storyStore).currentStory,
60
+ variant: unref(storyStore).currentVariant
61
+ }, null, 8, ["story", "variant"]),
62
+ (openBlock(), createBlock(resolveDynamicComponent(panelContentComponent.value), {
63
+ story: unref(storyStore).currentStory,
64
+ variant: unref(storyStore).currentVariant,
65
+ class: "htw-h-full htw-overflow-auto"
66
+ }, null, 8, ["story", "variant"]))
67
+ ])
68
+ ]),
69
+ last: withCtx(() => [
70
+ createVNode(StorySourceCode, {
71
+ story: unref(storyStore).currentStory,
72
+ variant: unref(storyStore).currentVariant,
73
+ class: "htw-h-full"
74
+ }, null, 8, ["story", "variant"])
75
+ ]),
76
+ _: 1
77
+ }));
78
+ };
79
+ }
80
+ });
81
+ export {
82
+ _sfc_main as default
83
+ };
@@ -0,0 +1,8 @@
1
+ import _sfc_main from "./StorySourceCode.vue2.js";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ "use strict";
5
+ const StorySourceCode = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-82d96c7f"]]);
6
+ export {
7
+ StorySourceCode as default
8
+ };
@@ -0,0 +1,204 @@
1
+ import { defineComponent, ref, watchEffect, markRaw, shallowRef, watch, computed, onMounted, nextTick, resolveDirective, createElementBlock, openBlock, createCommentVNode, createBlock, createElementVNode, createVNode, withDirectives, normalizeClass, unref, toDisplayString, withCtx } from "@poveste/vendors/vue";
2
+ import { Icon } from "@poveste/vendors/iconify";
3
+ import { HstCopyIcon } from "@poveste/controls";
4
+ import { unindent } from "@poveste/shared";
5
+ import { createHighlighter } from "shiki";
6
+ import { clientSupportPlugins } from "virtual:$poveste-support-plugins-client";
7
+ import { isDark } from "../../util/dark.js";
8
+ import BaseEmpty from "../base/BaseEmpty.vue.js";
9
+ "use strict";
10
+ const _hoisted_1 = { class: "poveste-story-source-code htw-bg-gray-50 dark:htw-bg-gray-750 htw-h-full htw-overflow-hidden htw-flex htw-flex-col" };
11
+ const _hoisted_2 = {
12
+ key: 0,
13
+ class: "htw-h-10 htw-flex-none htw-border-b htw-border-solid htw-border-gray-500/5 htw-px-4 htw-flex htw-items-center htw-gap-2"
14
+ };
15
+ const _hoisted_3 = { class: "htw-flex htw-flex-none htw-gap-px htw-h-full htw-py-2" };
16
+ const _hoisted_4 = {
17
+ key: 1,
18
+ class: "htw-text-red-500 htw-h-full htw-p-2 htw-overflow-auto htw-font-mono htw-text-sm"
19
+ };
20
+ const _hoisted_5 = ["value"];
21
+ const _hoisted_6 = ["innerHTML"];
22
+ const _sfc_main = /* @__PURE__ */ defineComponent({
23
+ __name: "StorySourceCode",
24
+ props: {
25
+ story: {},
26
+ variant: {}
27
+ },
28
+ setup(__props) {
29
+ const props = __props;
30
+ const generateSourceCodeFn = ref(null);
31
+ watchEffect(async () => {
32
+ const clientPlugin = clientSupportPlugins[props.story.file?.supportPluginId];
33
+ if (clientPlugin) {
34
+ const pluginModule = await clientPlugin();
35
+ generateSourceCodeFn.value = markRaw(pluginModule.generateSourceCode);
36
+ }
37
+ });
38
+ const highlighter = shallowRef();
39
+ const dynamicSourceCode = ref("");
40
+ const error = ref(null);
41
+ watch(() => [props.variant, generateSourceCodeFn.value], async () => {
42
+ if (!generateSourceCodeFn.value) return;
43
+ error.value = null;
44
+ dynamicSourceCode.value = "";
45
+ try {
46
+ if (props.variant.source) {
47
+ dynamicSourceCode.value = props.variant.source;
48
+ } else if (props.variant.slots?.().source) {
49
+ const source = props.variant.slots?.().source()[0].children;
50
+ if (source) {
51
+ dynamicSourceCode.value = await unindent(source);
52
+ }
53
+ } else {
54
+ dynamicSourceCode.value = await generateSourceCodeFn.value(props.variant);
55
+ }
56
+ } catch (e) {
57
+ console.error(e);
58
+ error.value = e.message;
59
+ }
60
+ if (!dynamicSourceCode.value) {
61
+ displayedSource.value = "static";
62
+ }
63
+ }, {
64
+ deep: true,
65
+ immediate: true
66
+ });
67
+ const staticSourceCode = ref("");
68
+ watch(() => [props.story, props.story?.file?.source], async () => {
69
+ staticSourceCode.value = "";
70
+ const sourceLoader = props.story.file?.source;
71
+ if (sourceLoader) {
72
+ staticSourceCode.value = (await sourceLoader()).default;
73
+ }
74
+ }, {
75
+ immediate: true
76
+ });
77
+ const displayedSource = ref("dynamic");
78
+ const displayedSourceCode = computed(() => {
79
+ if (displayedSource.value === "dynamic") {
80
+ return dynamicSourceCode.value;
81
+ }
82
+ return staticSourceCode.value;
83
+ });
84
+ onMounted(async () => {
85
+ highlighter.value = await createHighlighter({
86
+ langs: [
87
+ "html",
88
+ "jsx"
89
+ ],
90
+ themes: [
91
+ "github-light",
92
+ "github-dark"
93
+ ]
94
+ });
95
+ });
96
+ const sourceHtml = computed(() => displayedSourceCode.value ? highlighter.value?.codeToHtml(displayedSourceCode.value, {
97
+ lang: "html",
98
+ theme: isDark.value ? "github-dark" : "github-light"
99
+ }) : "");
100
+ let lastScroll = 0;
101
+ watch(() => props.variant, () => {
102
+ lastScroll = 0;
103
+ });
104
+ const scroller = ref();
105
+ function onScroll(event) {
106
+ if (sourceHtml.value) {
107
+ lastScroll = event.target.scrollTop;
108
+ }
109
+ }
110
+ watch(sourceHtml, async () => {
111
+ await nextTick();
112
+ if (scroller.value) {
113
+ scroller.value.scrollTop = lastScroll;
114
+ }
115
+ });
116
+ return (_ctx, _cache) => {
117
+ const _directive_tooltip = resolveDirective("tooltip");
118
+ return openBlock(), createElementBlock("div", _hoisted_1, [
119
+ !error.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
120
+ _cache[2] || (_cache[2] = createElementVNode("div", { class: "htw-text-gray-900 dark:htw-text-gray-100" }, " Source ", -1)),
121
+ _cache[3] || (_cache[3] = createElementVNode("div", { class: "htw-flex-1" }, null, -1)),
122
+ createElementVNode("div", _hoisted_3, [
123
+ withDirectives((openBlock(), createElementBlock("button", {
124
+ class: normalizeClass(["htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-1 htw-bg-gray-500/10 htw-rounded-l htw-transition-all htw-ease-[cubic-bezier(0,1,.6,1)] htw-duration-300 htw-overflow-hidden", [
125
+ displayedSource.value !== "dynamic" ? "htw-max-w-6 htw-opacity-70" : "htw-max-w-[82px] htw-text-primary-600 dark:htw-text-primary-400",
126
+ dynamicSourceCode.value ? "htw-cursor-pointer hover:htw-bg-gray-500/30 active:htw-bg-gray-600/50" : "htw-opacity-50"
127
+ ]]),
128
+ onClick: _cache[0] || (_cache[0] = ($event) => dynamicSourceCode.value && (displayedSource.value = "dynamic"))
129
+ }, [
130
+ createVNode(unref(Icon), {
131
+ icon: "carbon:flash",
132
+ class: "htw-w-4 htw-h-4 htw-flex-none"
133
+ }),
134
+ createElementVNode("span", {
135
+ class: normalizeClass(["transition-opacity duration-300", {
136
+ "opacity-0": displayedSource.value !== "dynamic"
137
+ }])
138
+ }, " Dynamic ", 2)
139
+ ], 2)), [
140
+ [_directive_tooltip, !dynamicSourceCode.value ? "Dynamic source code is not available" : displayedSource.value !== "dynamic" ? "Switch to dynamic source" : null]
141
+ ]),
142
+ withDirectives((openBlock(), createElementBlock("button", {
143
+ class: normalizeClass(["htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-1 htw-bg-gray-500/10 htw-rounded-r htw-transition-all htw-ease-[cubic-bezier(0,1,.6,1)] htw-duration-300 htw-overflow-hidden", [
144
+ displayedSource.value !== "static" ? "htw-max-w-6 htw-opacity-70" : "htw-max-w-[63px] htw-text-primary-600 dark:htw-text-primary-400",
145
+ staticSourceCode.value ? "htw-cursor-pointer hover:htw-bg-gray-500/30 active:htw-bg-gray-600/50" : "htw-opacity-50"
146
+ ]]),
147
+ onClick: _cache[1] || (_cache[1] = ($event) => staticSourceCode.value && (displayedSource.value = "static"))
148
+ }, [
149
+ createVNode(unref(Icon), {
150
+ icon: "carbon:document",
151
+ class: "htw-w-4 htw-h-4 htw-flex-none"
152
+ }),
153
+ createElementVNode("span", {
154
+ class: normalizeClass(["transition-opacity duration-300", {
155
+ "opacity-0": displayedSource.value !== "static"
156
+ }])
157
+ }, " Static ", 2)
158
+ ], 2)), [
159
+ [_directive_tooltip, !staticSourceCode.value ? "Static source code is not available" : displayedSource.value !== "static" ? "Switch to static source" : null]
160
+ ])
161
+ ]),
162
+ createVNode(unref(HstCopyIcon), {
163
+ content: displayedSourceCode.value,
164
+ class: "htw-flex-none"
165
+ }, null, 8, ["content"])
166
+ ])) : createCommentVNode("", true),
167
+ error.value ? (openBlock(), createElementBlock("div", _hoisted_4, " Error: " + toDisplayString(error.value), 1)) : !displayedSourceCode.value ? (openBlock(), createBlock(BaseEmpty, { key: 2 }, {
168
+ default: withCtx(() => [
169
+ createVNode(unref(Icon), {
170
+ icon: "carbon:code-hide",
171
+ class: "htw-w-8 htw-h-8 htw-opacity-50 htw-mb-6"
172
+ }),
173
+ _cache[4] || (_cache[4] = createElementVNode("span", null, "Not available", -1))
174
+ ]),
175
+ _: 1
176
+ })) : !sourceHtml.value ? (openBlock(), createElementBlock("textarea", {
177
+ key: 3,
178
+ ref_key: "scroller",
179
+ ref: scroller,
180
+ class: "__poveste-code-placeholder htw-w-full htw-h-full htw-p-4 htw-outline-none htw-bg-transparent htw-resize-none htw-m-0",
181
+ value: displayedSourceCode.value,
182
+ readonly: "",
183
+ "data-test-id": "story-source-code",
184
+ onScroll
185
+ }, null, 40, _hoisted_5)) : (openBlock(), createElementBlock("div", {
186
+ key: 4,
187
+ ref_key: "scroller",
188
+ ref: scroller,
189
+ class: "htw-w-full htw-h-full htw-overflow-auto",
190
+ "data-test-id": "story-source-code",
191
+ onScroll
192
+ }, [
193
+ createElementVNode("div", {
194
+ class: "__poveste-code __histoire-code htw-p-4 htw-w-fit",
195
+ innerHTML: sourceHtml.value
196
+ }, null, 8, _hoisted_6)
197
+ ], 544))
198
+ ]);
199
+ };
200
+ }
201
+ });
202
+ export {
203
+ _sfc_main as default
204
+ };
@@ -0,0 +1,8 @@
1
+ import _sfc_main from "./SearchItem.vue2.js";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ "use strict";
5
+ const SearchItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0c821aae"]]);
6
+ export {
7
+ SearchItem as default
8
+ };
@@ -0,0 +1,93 @@
1
+ import { defineComponent, useCssVars, ref, toRefs, createElementBlock, openBlock, unref, createBlock, createCommentVNode, withCtx, createVNode } from "@poveste/vendors/vue";
2
+ import { useRouter } from "@poveste/vendors/vue-router";
3
+ import { onKeyboardShortcut } from "../../util/keyboard.js";
4
+ import { useScrollOnActive } from "../../util/scroll.js";
5
+ import "../base/BaseListItem.vue.js";
6
+ import BaseListItemLink from "../base/BaseListItemLink.vue.js";
7
+ import "./SearchItemContent.vue.js";
8
+ import _sfc_main$1 from "./SearchItemContent.vue2.js";
9
+ import _sfc_main$2 from "../base/BaseListItem.vue2.js";
10
+ "use strict";
11
+ const _hoisted_1 = ["data-selected"];
12
+ const _sfc_main = /* @__PURE__ */ defineComponent({
13
+ __name: "SearchItem",
14
+ props: {
15
+ result: {
16
+ type: Object,
17
+ required: true
18
+ },
19
+ selected: {
20
+ type: Boolean,
21
+ default: false
22
+ }
23
+ },
24
+ emits: {
25
+ close: () => true
26
+ },
27
+ setup(__props, { emit: __emit }) {
28
+ useCssVars((_ctx) => ({
29
+ "v12a213a0": __props.result.iconColor
30
+ }));
31
+ const props = __props;
32
+ const emit = __emit;
33
+ const el = ref();
34
+ const { selected } = toRefs(props);
35
+ useScrollOnActive(selected, el);
36
+ const router = useRouter();
37
+ onKeyboardShortcut(["enter"], () => {
38
+ if (!props.selected) return;
39
+ action();
40
+ });
41
+ function action(fromClick = false) {
42
+ if ("route" in props.result && !fromClick) {
43
+ router.push(props.result.route);
44
+ }
45
+ if ("onActivate" in props.result) {
46
+ props.result.onActivate();
47
+ }
48
+ emit("close");
49
+ }
50
+ return (_ctx, _cache) => {
51
+ return openBlock(), createElementBlock("div", {
52
+ ref_key: "el",
53
+ ref: el,
54
+ class: "poveste-search-item",
55
+ "data-test-id": "search-item",
56
+ "data-selected": unref(selected) ? "" : void 0
57
+ }, [
58
+ "route" in __props.result ? (openBlock(), createBlock(BaseListItemLink, {
59
+ key: 0,
60
+ to: __props.result.route,
61
+ "is-active": unref(selected),
62
+ class: "htw-px-6 htw-py-4 htw-gap-4",
63
+ onNavigate: _cache[0] || (_cache[0] = ($event) => action(true))
64
+ }, {
65
+ default: withCtx(() => [
66
+ createVNode(_sfc_main$1, {
67
+ result: __props.result,
68
+ selected: unref(selected)
69
+ }, null, 8, ["result", "selected"])
70
+ ]),
71
+ _: 1
72
+ }, 8, ["to", "is-active"])) : createCommentVNode("", true),
73
+ "onActivate" in __props.result ? (openBlock(), createBlock(_sfc_main$2, {
74
+ key: 1,
75
+ "is-active": unref(selected),
76
+ class: "htw-px-6 htw-py-4 htw-gap-4",
77
+ onNavigate: _cache[1] || (_cache[1] = ($event) => action(true))
78
+ }, {
79
+ default: withCtx(() => [
80
+ createVNode(_sfc_main$1, {
81
+ result: __props.result,
82
+ selected: unref(selected)
83
+ }, null, 8, ["result", "selected"])
84
+ ]),
85
+ _: 1
86
+ }, 8, ["is-active"])) : createCommentVNode("", true)
87
+ ], 8, _hoisted_1);
88
+ };
89
+ }
90
+ });
91
+ export {
92
+ _sfc_main as default
93
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./SearchItemContent.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,71 @@
1
+ import { defineComponent, createElementBlock, openBlock, Fragment, createVNode, createElementVNode, normalizeClass, createCommentVNode, createTextVNode, toDisplayString, renderList, createBlock, unref } from "@poveste/vendors/vue";
2
+ import { Icon } from "@poveste/vendors/iconify";
3
+ import BaseIcon from "../base/BaseIcon.vue.js";
4
+ "use strict";
5
+ const _hoisted_1 = { class: "htw-flex-1" };
6
+ const _hoisted_2 = { class: "htw-flex" };
7
+ const _hoisted_3 = { class: "htw-ml-auto htw-opacity-40" };
8
+ const _hoisted_4 = {
9
+ key: 0,
10
+ class: "htw-flex htw-items-center htw-gap-0.5 htw-opacity-60"
11
+ };
12
+ const _sfc_main = /* @__PURE__ */ defineComponent({
13
+ __name: "SearchItemContent",
14
+ props: {
15
+ result: {},
16
+ selected: { type: Boolean }
17
+ },
18
+ setup(__props) {
19
+ const defaultIcons = {
20
+ story: "carbon:cube",
21
+ variant: "carbon:cube"
22
+ };
23
+ const kindLabels = {
24
+ story: "Story",
25
+ variant: "Variant",
26
+ command: "Command"
27
+ };
28
+ return (_ctx, _cache) => {
29
+ return openBlock(), createElementBlock(Fragment, null, [
30
+ createVNode(BaseIcon, {
31
+ icon: __props.result.icon ?? defaultIcons[__props.result.kind],
32
+ class: normalizeClass(["htw-w-4 htw-h-4", [
33
+ !__props.selected ? [
34
+ __props.result.iconColor ? "bind-icon-color" : {
35
+ "htw-text-primary-500": __props.result.kind === "story",
36
+ "htw-text-gray-500": __props.result.kind === "variant"
37
+ }
38
+ ] : [],
39
+ {
40
+ "colorize-black": __props.selected
41
+ }
42
+ ]])
43
+ }, null, 8, ["icon", "class"]),
44
+ createElementVNode("div", _hoisted_1, [
45
+ createElementVNode("div", _hoisted_2, [
46
+ createTextVNode(toDisplayString(__props.result.title) + " ", 1),
47
+ createElementVNode("span", _hoisted_3, toDisplayString(kindLabels[__props.result.kind]), 1)
48
+ ]),
49
+ __props.result.path?.length ? (openBlock(), createElementBlock("div", _hoisted_4, [
50
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.result.path, (p, index) => {
51
+ return openBlock(), createElementBlock("div", {
52
+ key: index,
53
+ class: "htw-flex htw-items-center htw-gap-0.5"
54
+ }, [
55
+ index > 0 ? (openBlock(), createBlock(unref(Icon), {
56
+ key: 0,
57
+ icon: "carbon:chevron-right",
58
+ class: "htw-w-4 htw-h-4 htw-mt-0.5 htw-opacity-50"
59
+ })) : createCommentVNode("", true),
60
+ createElementVNode("span", null, toDisplayString(p), 1)
61
+ ]);
62
+ }), 128))
63
+ ])) : createCommentVNode("", true)
64
+ ])
65
+ ], 64);
66
+ };
67
+ }
68
+ });
69
+ export {
70
+ _sfc_main as default
71
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./SearchLoading.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,21 @@
1
+ import { defineComponent, createElementBlock, openBlock, createVNode, createTextVNode, unref } from "@poveste/vendors/vue";
2
+ import { Icon } from "@poveste/vendors/iconify";
3
+ "use strict";
4
+ const _hoisted_1 = { class: "poveste-search-loading htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500 htw-h-[51px] htw-opacity-30" };
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "SearchLoading",
7
+ setup(__props) {
8
+ return (_ctx, _cache) => {
9
+ return openBlock(), createElementBlock("div", _hoisted_1, [
10
+ createVNode(unref(Icon), {
11
+ icon: "carbon:search",
12
+ class: "flex-none htw-w-4 htw-h-4"
13
+ }),
14
+ _cache[0] || (_cache[0] = createTextVNode(" Loading... ", -1))
15
+ ]);
16
+ };
17
+ }
18
+ });
19
+ export {
20
+ _sfc_main as default
21
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./SearchModal.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,51 @@
1
+ import { defineComponent, defineAsyncComponent, withDirectives, openBlock, createElementBlock, createElementVNode, createVNode, unref, vShow } from "@poveste/vendors/vue";
2
+ import "./SearchLoading.vue.js";
3
+ import _sfc_main$1 from "./SearchLoading.vue2.js";
4
+ "use strict";
5
+ const _hoisted_1 = {
6
+ class: "poveste-search-modal htw-fixed htw-inset-0 htw-bg-white/80 dark:htw-bg-gray-900/80 htw-z-20",
7
+ "data-test-id": "search-modal"
8
+ };
9
+ const _hoisted_2 = { class: "htw-bg-white dark:htw-bg-gray-900 md:htw-mt-16 md:htw-mx-auto htw-w-screen htw-max-w-[512px] htw-shadow-xl htw-border htw-border-gray-200 dark:htw-border-gray-750 htw-rounded-lg htw-relative htw-divide-y htw-divide-gray-200 dark:htw-divide-gray-850" };
10
+ const _sfc_main = /* @__PURE__ */ defineComponent({
11
+ __name: "SearchModal",
12
+ props: {
13
+ shown: {
14
+ type: Boolean,
15
+ default: false
16
+ }
17
+ },
18
+ emits: {
19
+ close: () => true
20
+ },
21
+ setup(__props, { emit: __emit }) {
22
+ const SearchPane = defineAsyncComponent({
23
+ loader: () => import("./SearchPane.vue.js"),
24
+ loadingComponent: _sfc_main$1,
25
+ delay: 0
26
+ });
27
+ const emit = __emit;
28
+ function close() {
29
+ emit("close");
30
+ }
31
+ return (_ctx, _cache) => {
32
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
33
+ createElementVNode("div", {
34
+ class: "htw-absolute htw-inset-0",
35
+ onClick: _cache[0] || (_cache[0] = ($event) => close())
36
+ }),
37
+ createElementVNode("div", _hoisted_2, [
38
+ createVNode(unref(SearchPane), {
39
+ shown: __props.shown,
40
+ onClose: _cache[1] || (_cache[1] = ($event) => close())
41
+ }, null, 8, ["shown"])
42
+ ])
43
+ ], 512)), [
44
+ [vShow, __props.shown]
45
+ ]);
46
+ };
47
+ }
48
+ });
49
+ export {
50
+ _sfc_main as default
51
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./SearchPane.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };