@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,146 @@
1
+ import { defineComponent, computed, ref, watch, onMounted, createElementBlock, openBlock, createCommentVNode, createElementVNode, unref, createVNode, createBlock, normalizeStyle, Fragment, renderList } from "@poveste/vendors/vue";
2
+ import { useResizeObserver } from "@poveste/vendors/vue-use";
3
+ import { useStoryStore } from "../../stores/story.js";
4
+ import { isMobile } from "../../util/responsive.js";
5
+ import "../toolbar/DevOnlyToolbarOpenInEditor.vue.js";
6
+ import ToolbarBackground from "../toolbar/ToolbarBackground.vue.js";
7
+ import "../toolbar/ToolbarTextDirection.vue.js";
8
+ import StoryVariantGridItem from "./StoryVariantGridItem.vue.js";
9
+ import _sfc_main$1 from "../toolbar/ToolbarTextDirection.vue2.js";
10
+ import _sfc_main$2 from "../toolbar/DevOnlyToolbarOpenInEditor.vue2.js";
11
+ "use strict";
12
+ const _hoisted_1 = { class: "poveste-story-variant-grid htw-flex htw-flex-col htw-items-stretch htw-h-full __poveste-pane-shadow-from-right" };
13
+ const _hoisted_2 = {
14
+ key: 0,
15
+ class: "htw-flex-none htw-flex htw-items-center htw-justify-end htw-h-8 htw-mx-2 htw-mt-1"
16
+ };
17
+ const _hoisted_3 = { class: "htw-flex htw-w-0 htw-flex-1 htw-mx-4" };
18
+ const margin = 16;
19
+ const gap = 16;
20
+ const _sfc_main = /* @__PURE__ */ defineComponent({
21
+ __name: "StoryVariantGrid",
22
+ setup(__props) {
23
+ const storyStore = useStoryStore();
24
+ const gridTemplateWidth = computed(() => {
25
+ if (storyStore.currentStory.layout.type !== "grid") {
26
+ return;
27
+ }
28
+ const layoutWidth = storyStore.currentStory.layout.width;
29
+ if (!layoutWidth) {
30
+ return "200px";
31
+ }
32
+ if (typeof layoutWidth === "number") {
33
+ return `${layoutWidth}px`;
34
+ }
35
+ return layoutWidth;
36
+ });
37
+ const itemWidth = ref(16);
38
+ const maxItemHeight = ref(0);
39
+ const maxCount = ref(10);
40
+ const countPerRow = ref(0);
41
+ const visibleRows = ref(0);
42
+ const el = ref(null);
43
+ useResizeObserver(el, () => {
44
+ updateMaxCount();
45
+ updateSize();
46
+ });
47
+ function updateMaxCount() {
48
+ if (!maxItemHeight.value) return;
49
+ const width = el.value.clientWidth - margin * 2;
50
+ const height = el.value.clientHeight;
51
+ const scrollTop = el.value.scrollTop;
52
+ countPerRow.value = Math.floor((width + gap) / (itemWidth.value + gap));
53
+ visibleRows.value = Math.ceil((height + scrollTop + gap) / (maxItemHeight.value + gap));
54
+ const newMaxCount = countPerRow.value * visibleRows.value;
55
+ if (maxCount.value < newMaxCount) {
56
+ maxCount.value = newMaxCount;
57
+ }
58
+ if (storyStore.currentVariant) {
59
+ const index = storyStore.currentStory.variants.indexOf(storyStore.currentVariant);
60
+ if (index + 1 > maxCount.value) {
61
+ maxCount.value = index + 1;
62
+ }
63
+ }
64
+ }
65
+ function onItemResize(w, h) {
66
+ itemWidth.value = w;
67
+ if (maxItemHeight.value < h) {
68
+ maxItemHeight.value = h;
69
+ updateMaxCount();
70
+ }
71
+ }
72
+ watch(() => storyStore.currentVariant, () => {
73
+ maxItemHeight.value = 0;
74
+ updateMaxCount();
75
+ });
76
+ const gridEl = ref(null);
77
+ const gridColumnWidth = ref(1);
78
+ const viewWidth = ref(1);
79
+ function updateSize() {
80
+ if (!el.value) return;
81
+ viewWidth.value = el.value.clientWidth;
82
+ if (!gridEl.value) return;
83
+ if (gridTemplateWidth.value.endsWith("%")) {
84
+ gridColumnWidth.value = viewWidth.value * Number.parseInt(gridTemplateWidth.value) / 100 - gap;
85
+ } else {
86
+ gridColumnWidth.value = Number.parseInt(gridTemplateWidth.value);
87
+ }
88
+ }
89
+ onMounted(() => {
90
+ updateSize();
91
+ });
92
+ useResizeObserver(gridEl, () => {
93
+ updateSize();
94
+ });
95
+ const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))));
96
+ return (_ctx, _cache) => {
97
+ return openBlock(), createElementBlock("div", _hoisted_1, [
98
+ !unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
99
+ createVNode(ToolbarBackground),
100
+ createVNode(_sfc_main$1),
101
+ _ctx.__POVESTE_DEV__ ? (openBlock(), createBlock(_sfc_main$2, {
102
+ key: 0,
103
+ file: unref(storyStore).currentStory.file?.filePath,
104
+ tooltip: "Edit story in editor"
105
+ }, null, 8, ["file"])) : createCommentVNode("", true)
106
+ ])) : createCommentVNode("", true),
107
+ createElementVNode("div", {
108
+ ref_key: "el",
109
+ ref: el,
110
+ class: "htw-overflow-y-auto htw-flex htw-flex-1",
111
+ onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
112
+ }, [
113
+ createElementVNode("div", _hoisted_3, [
114
+ createElementVNode("div", {
115
+ class: "htw-m-auto",
116
+ style: normalizeStyle({
117
+ minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
118
+ })
119
+ }, [
120
+ createElementVNode("div", {
121
+ ref_key: "gridEl",
122
+ ref: gridEl,
123
+ class: "htw-grid htw-gap-4 htw-my-4",
124
+ style: normalizeStyle({
125
+ gridTemplateColumns: `repeat(${columnCount.value}, ${gridColumnWidth.value}px)`
126
+ })
127
+ }, [
128
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
129
+ return openBlock(), createBlock(StoryVariantGridItem, {
130
+ key: index,
131
+ variant,
132
+ story: unref(storyStore).currentStory,
133
+ onResize: onItemResize
134
+ }, null, 8, ["variant", "story"]);
135
+ }), 128))
136
+ ], 4)
137
+ ], 4)
138
+ ])
139
+ ], 544)
140
+ ]);
141
+ };
142
+ }
143
+ });
144
+ export {
145
+ _sfc_main as default
146
+ };
@@ -0,0 +1,8 @@
1
+ import _sfc_main from "./StoryVariantGridItem.vue2.js";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ "use strict";
5
+ const StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a3dc7302"]]);
6
+ export {
7
+ StoryVariantGridItem as default
8
+ };
@@ -0,0 +1,155 @@
1
+ import { defineComponent, useCssVars, unref, toRefs, ref, computed, resolveComponent, resolveDirective, createElementBlock, openBlock, createElementVNode, withDirectives, createBlock, normalizeClass, withCtx, createVNode, toDisplayString, withModifiers, createCommentVNode, normalizeStyle } from "@poveste/vendors/vue";
2
+ import { Icon } from "@poveste/vendors/iconify";
3
+ import { HstCopyIcon } from "@poveste/controls";
4
+ import { useResizeObserver } from "@poveste/vendors/vue-use";
5
+ import { useRouter } from "@poveste/vendors/vue-router";
6
+ import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
7
+ import { povesteConfig } from "../../util/config.js";
8
+ import { isDark } from "../../util/dark.js";
9
+ import { getSourceCode } from "../../util/docs.js";
10
+ import { getContrastColor } from "../../util/preview-settings.js";
11
+ import { useScrollOnActive } from "../../util/scroll.js";
12
+ import { useCurrentVariantRoute } from "../../util/variant.js";
13
+ import CheckerboardPattern from "../misc/CheckerboardPattern.vue.js";
14
+ import "../toolbar/ToolbarNewTab.vue.js";
15
+ import "./GenericRenderStory.vue.js";
16
+ import _sfc_main$1 from "../toolbar/ToolbarNewTab.vue2.js";
17
+ import _sfc_main$2 from "./GenericRenderStory.vue2.js";
18
+ "use strict";
19
+ const _hoisted_1 = { class: "htw-flex-none htw-flex htw-items-center" };
20
+ const _hoisted_2 = { class: "htw-truncate htw-flex-1" };
21
+ const _hoisted_3 = { class: "htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center" };
22
+ const _sfc_main = /* @__PURE__ */ defineComponent({
23
+ __name: "StoryVariantGridItem",
24
+ props: {
25
+ variant: {
26
+ type: Object,
27
+ required: true
28
+ },
29
+ story: {
30
+ type: Object,
31
+ required: true
32
+ }
33
+ },
34
+ emits: {
35
+ resize: (_width, _height) => true
36
+ },
37
+ setup(__props, { emit: __emit }) {
38
+ useCssVars((_ctx) => ({
39
+ "v70ef7b9c": unref(variant).iconColor,
40
+ "v960da962": unref(settings).backgroundColor
41
+ }));
42
+ const props = __props;
43
+ const emit = __emit;
44
+ const { variant } = toRefs(props);
45
+ const { isActive, targetRoute } = useCurrentVariantRoute(variant);
46
+ Object.assign(props.variant, {
47
+ previewReady: false
48
+ });
49
+ function onReady() {
50
+ Object.assign(props.variant, {
51
+ previewReady: true
52
+ });
53
+ }
54
+ const router = useRouter();
55
+ function selectVariant() {
56
+ router.push(targetRoute.value);
57
+ }
58
+ const el = ref();
59
+ const { autoScroll } = useScrollOnActive(isActive, el);
60
+ useResizeObserver(el, () => {
61
+ if (props.variant.previewReady) {
62
+ emit("resize", el.value.clientWidth, el.value.clientHeight);
63
+ if (isActive.value) {
64
+ autoScroll();
65
+ }
66
+ }
67
+ });
68
+ const settings = usePreviewSettingsStore().currentSettings;
69
+ const contrastColor = computed(() => getContrastColor(settings));
70
+ const autoApplyContrastColor = computed(() => !!povesteConfig.autoApplyContrastColor);
71
+ return (_ctx, _cache) => {
72
+ const _component_RouterLink = resolveComponent("RouterLink");
73
+ const _directive_tooltip = resolveDirective("tooltip");
74
+ return openBlock(), createElementBlock("div", {
75
+ ref_key: "el",
76
+ ref: el,
77
+ class: "poveste-story-variant-grid-item htw-cursor-default htw-flex htw-flex-col htw-gap-y-1 htw-group"
78
+ }, [
79
+ createElementVNode("div", _hoisted_1, [
80
+ withDirectives((openBlock(), createBlock(_component_RouterLink, {
81
+ to: unref(targetRoute),
82
+ class: normalizeClass(["htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1 htw-flex-shrink", {
83
+ "hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800": !unref(isActive),
84
+ "htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800 dark:htw-bg-primary-700 dark:hover:htw-bg-primary-800 dark:htw-text-primary-200": unref(isActive)
85
+ }])
86
+ }, {
87
+ default: withCtx(() => [
88
+ createVNode(unref(Icon), {
89
+ icon: unref(variant).icon ?? "carbon:cube",
90
+ class: normalizeClass(["htw-w-4 htw-h-4 htw-opacity-50", {
91
+ "htw-text-gray-500": !unref(isActive) && !unref(variant).iconColor,
92
+ "bind-icon-color": !unref(isActive) && unref(variant).iconColor
93
+ }])
94
+ }, null, 8, ["icon", "class"]),
95
+ createElementVNode("span", _hoisted_2, toDisplayString(unref(variant).title), 1)
96
+ ]),
97
+ _: 1
98
+ }, 8, ["to", "class"])), [
99
+ [_directive_tooltip, unref(variant).title]
100
+ ]),
101
+ createElementVNode("div", _hoisted_3, [
102
+ createVNode(unref(HstCopyIcon), {
103
+ content: () => unref(getSourceCode)(__props.story, unref(variant))
104
+ }, null, 8, ["content"]),
105
+ createVNode(_sfc_main$1, {
106
+ variant: unref(variant),
107
+ story: __props.story
108
+ }, null, 8, ["variant", "story"])
109
+ ])
110
+ ]),
111
+ createElementVNode("div", {
112
+ class: normalizeClass(["htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded htw-flex-1 htw-p-4 htw-relative", {
113
+ "htw-border-gray-100 dark:htw-border-gray-800": !unref(isActive),
114
+ "htw-border-primary-200 dark:htw-border-primary-900": unref(isActive)
115
+ }]),
116
+ "data-test-id": "sandbox-render",
117
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop"])),
118
+ onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
119
+ }, [
120
+ _cache[2] || (_cache[2] = createElementVNode("div", {
121
+ class: "htw-absolute htw-inset-0 htw-rounded bind-preview-bg",
122
+ "data-test-id": "responsive-preview-bg"
123
+ }, null, -1)),
124
+ unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
125
+ key: 0,
126
+ class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
127
+ })) : createCommentVNode("", true),
128
+ createElementVNode("div", {
129
+ class: "htw-relative htw-h-full",
130
+ style: normalizeStyle({
131
+ "--poveste-contrast-color": contrastColor.value,
132
+ // Deprecated alias — keep so stories referencing `var(--histoire-contrast-color)` still work.
133
+ "--histoire-contrast-color": contrastColor.value,
134
+ "color": autoApplyContrastColor.value ? contrastColor.value : void 0
135
+ })
136
+ }, [
137
+ (openBlock(), createBlock(_sfc_main$2, {
138
+ key: `${__props.story.id}-${unref(variant).id}`,
139
+ variant: unref(variant),
140
+ story: __props.story,
141
+ dir: unref(settings).textDirection,
142
+ class: normalizeClass({
143
+ [unref(povesteConfig).theme.darkClass]: unref(isDark)
144
+ }),
145
+ onReady
146
+ }, null, 8, ["variant", "story", "dir", "class"]))
147
+ ], 4)
148
+ ], 34)
149
+ ], 512);
150
+ };
151
+ }
152
+ });
153
+ export {
154
+ _sfc_main as default
155
+ };
@@ -0,0 +1,8 @@
1
+ import _sfc_main from "./StoryVariantListItem.vue2.js";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ "use strict";
5
+ const StoryVariantListItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e7e8e2de"]]);
6
+ export {
7
+ StoryVariantListItem as default
8
+ };
@@ -0,0 +1,55 @@
1
+ import { defineComponent, useCssVars, unref, toRefs, ref, createElementBlock, openBlock, createVNode, withCtx, createElementVNode, normalizeClass, toDisplayString } from "@poveste/vendors/vue";
2
+ import { Icon } from "@poveste/vendors/iconify";
3
+ import { useScrollOnActive } from "../../util/scroll.js";
4
+ import { useCurrentVariantRoute } from "../../util/variant.js";
5
+ import BaseListItemLink from "../base/BaseListItemLink.vue.js";
6
+ "use strict";
7
+ const _hoisted_1 = { class: "htw-truncate" };
8
+ const _sfc_main = /* @__PURE__ */ defineComponent({
9
+ __name: "StoryVariantListItem",
10
+ props: {
11
+ variant: {
12
+ type: Object,
13
+ required: true
14
+ }
15
+ },
16
+ setup(__props) {
17
+ useCssVars((_ctx) => ({
18
+ "v6ef859d8": unref(variant).iconColor
19
+ }));
20
+ const props = __props;
21
+ const { variant } = toRefs(props);
22
+ const { isActive, targetRoute } = useCurrentVariantRoute(variant);
23
+ const el = ref();
24
+ useScrollOnActive(isActive, el);
25
+ return (_ctx, _cache) => {
26
+ return openBlock(), createElementBlock("div", {
27
+ ref_key: "el",
28
+ ref: el,
29
+ class: "poveste-story-variant-list-item",
30
+ "data-test-id": "story-variant-list-item"
31
+ }, [
32
+ createVNode(BaseListItemLink, {
33
+ to: unref(targetRoute),
34
+ "is-active": unref(isActive),
35
+ class: "htw-px-2 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm htw-flex htw-items-center htw-gap-2"
36
+ }, {
37
+ default: withCtx(({ active }) => [
38
+ createVNode(unref(Icon), {
39
+ icon: unref(variant).icon ?? "carbon:cube",
40
+ class: normalizeClass(["htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none", {
41
+ "htw-text-gray-500": !active && !unref(variant).iconColor,
42
+ "bind-icon-color": !active && unref(variant).iconColor
43
+ }])
44
+ }, null, 8, ["icon", "class"]),
45
+ createElementVNode("span", _hoisted_1, toDisplayString(unref(variant).title), 1)
46
+ ]),
47
+ _: 1
48
+ }, 8, ["to", "is-active"])
49
+ ], 512);
50
+ };
51
+ }
52
+ });
53
+ export {
54
+ _sfc_main as default
55
+ };
@@ -0,0 +1,8 @@
1
+ import _sfc_main from "./StoryVariantSingle.vue2.js";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ "use strict";
5
+ const StoryVariantSingle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b675426a"]]);
6
+ export {
7
+ StoryVariantSingle as default
8
+ };
@@ -0,0 +1,107 @@
1
+ import { defineComponent, useCssVars, computed, createElementBlock, openBlock, createVNode, unref, Fragment, createBlock, createElementVNode, createCommentVNode, createTextVNode, normalizeClass, toDisplayString, withCtx, renderList } from "@poveste/vendors/vue";
2
+ import { Icon } from "@poveste/vendors/iconify";
3
+ import { useStoryStore } from "../../stores/story.js";
4
+ import { isMobile } from "../../util/responsive.js";
5
+ import BaseSplitPane from "../base/BaseSplitPane.vue.js";
6
+ import StoryVariantListItem from "./StoryVariantListItem.vue.js";
7
+ import "./StoryVariantSingleView.vue.js";
8
+ import _sfc_main$1 from "./StoryVariantSingleView.vue2.js";
9
+ "use strict";
10
+ const _hoisted_1 = {
11
+ key: 0,
12
+ class: "poveste-story-variant-single htw-p-2 htw-h-full __poveste-pane-shadow-from-right"
13
+ };
14
+ const _hoisted_2 = {
15
+ key: 0,
16
+ class: "htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800 htw-h-full htw-flex htw-flex-col"
17
+ };
18
+ const _hoisted_3 = {
19
+ key: 0,
20
+ class: "htw-p-2 htw-h-full"
21
+ };
22
+ const _hoisted_4 = { class: "htw-h-full htw-overflow-y-auto" };
23
+ const _hoisted_5 = {
24
+ key: 0,
25
+ class: "htw-p-2 htw-h-full __poveste-pane-shadow-from-right"
26
+ };
27
+ const _sfc_main = /* @__PURE__ */ defineComponent({
28
+ __name: "StoryVariantSingle",
29
+ emits: {
30
+ openVariantMenu: () => true
31
+ },
32
+ setup(__props) {
33
+ useCssVars((_ctx) => ({
34
+ "v5162df32": variant.value?.iconColor
35
+ }));
36
+ const storyStore = useStoryStore();
37
+ const hasSingleVariant = computed(() => storyStore.currentStory?.variants.length === 1);
38
+ const variant = computed(() => storyStore.currentVariant);
39
+ return (_ctx, _cache) => {
40
+ return hasSingleVariant.value && variant.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
41
+ createVNode(_sfc_main$1, {
42
+ variant: variant.value,
43
+ story: unref(storyStore).currentStory
44
+ }, null, 8, ["variant", "story"])
45
+ ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
46
+ unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
47
+ createElementVNode("a", {
48
+ class: "htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center htw-flex-none",
49
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("openVariantMenu"))
50
+ }, [
51
+ variant.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
52
+ createVNode(unref(Icon), {
53
+ icon: variant.value.icon ?? "carbon:cube",
54
+ class: normalizeClass(["htw-w-5 htw-h-5 htw-flex-none", {
55
+ "htw-text-gray-500": !variant.value.iconColor,
56
+ "bind-icon-color": variant.value.iconColor
57
+ }])
58
+ }, null, 8, ["icon", "class"]),
59
+ createTextVNode(" " + toDisplayString(variant.value.title), 1)
60
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
61
+ createTextVNode(" Select a variant... ")
62
+ ], 64)),
63
+ createVNode(unref(Icon), {
64
+ icon: "carbon:chevron-sort",
65
+ class: "htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
66
+ })
67
+ ]),
68
+ unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_3, [
69
+ createVNode(_sfc_main$1, {
70
+ variant: unref(storyStore).currentVariant,
71
+ story: unref(storyStore).currentStory
72
+ }, null, 8, ["variant", "story"])
73
+ ])) : createCommentVNode("", true)
74
+ ])) : (openBlock(), createBlock(BaseSplitPane, {
75
+ key: 1,
76
+ "save-id": "story-single-main-split",
77
+ min: 5,
78
+ max: 40,
79
+ "default-split": 17
80
+ }, {
81
+ first: withCtx(() => [
82
+ createElementVNode("div", _hoisted_4, [
83
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (v, index) => {
84
+ return openBlock(), createBlock(StoryVariantListItem, {
85
+ key: index,
86
+ variant: v
87
+ }, null, 8, ["variant"]);
88
+ }), 128))
89
+ ])
90
+ ]),
91
+ last: withCtx(() => [
92
+ unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_5, [
93
+ createVNode(_sfc_main$1, {
94
+ variant: unref(storyStore).currentVariant,
95
+ story: unref(storyStore).currentStory
96
+ }, null, 8, ["variant", "story"])
97
+ ])) : createCommentVNode("", true)
98
+ ]),
99
+ _: 1
100
+ }))
101
+ ], 64));
102
+ };
103
+ }
104
+ });
105
+ export {
106
+ _sfc_main as default
107
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./StoryVariantSinglePreviewNative.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,72 @@
1
+ import { defineComponent, computed, createBlock, openBlock, withCtx, createElementVNode, normalizeStyle, unref, normalizeClass } from "@poveste/vendors/vue";
2
+ import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
3
+ import { povesteConfig } from "../../util/config.js";
4
+ import { isDark } from "../../util/dark.js";
5
+ import { getContrastColor } from "../../util/preview-settings.js";
6
+ import "./GenericRenderStory.vue.js";
7
+ import StoryResponsivePreview from "./StoryResponsivePreview.vue.js";
8
+ import _sfc_main$1 from "./GenericRenderStory.vue2.js";
9
+ "use strict";
10
+ const _sfc_main = /* @__PURE__ */ defineComponent({
11
+ __name: "StoryVariantSinglePreviewNative",
12
+ props: {
13
+ story: {},
14
+ variant: {}
15
+ },
16
+ setup(__props) {
17
+ const props = __props;
18
+ Object.assign(props.variant, {
19
+ previewReady: false
20
+ });
21
+ function onReady() {
22
+ Object.assign(props.variant, {
23
+ previewReady: true
24
+ });
25
+ }
26
+ const settings = usePreviewSettingsStore().currentSettings;
27
+ const contrastColor = computed(() => getContrastColor(settings));
28
+ const autoApplyContrastColor = computed(() => !!povesteConfig.autoApplyContrastColor);
29
+ return (_ctx, _cache) => {
30
+ return openBlock(), createBlock(StoryResponsivePreview, {
31
+ class: "poveste-story-variant-single-preview-native",
32
+ variant: __props.variant
33
+ }, {
34
+ default: withCtx(({ isResponsiveEnabled, finalWidth, finalHeight }) => [
35
+ createElementVNode("div", {
36
+ style: normalizeStyle([
37
+ isResponsiveEnabled ? {
38
+ width: finalWidth ? `${finalWidth}px` : "100%",
39
+ height: finalHeight ? `${finalHeight}px` : "100%"
40
+ } : { width: "100%", height: "100%" },
41
+ {
42
+ "--poveste-contrast-color": contrastColor.value,
43
+ // Deprecated alias — keep so stories referencing `var(--histoire-contrast-color)` still work.
44
+ "--histoire-contrast-color": contrastColor.value,
45
+ "color": autoApplyContrastColor.value ? contrastColor.value : void 0
46
+ }
47
+ ]),
48
+ class: "htw-relative",
49
+ "data-test-id": "sandbox-render"
50
+ }, [
51
+ (openBlock(), createBlock(_sfc_main$1, {
52
+ key: `${__props.story.id}-${__props.variant.id}`,
53
+ variant: __props.variant,
54
+ story: __props.story,
55
+ class: normalizeClass(["htw-h-full", {
56
+ [unref(povesteConfig).sandboxDarkClass]: unref(isDark),
57
+ // @TODO remove
58
+ [unref(povesteConfig).theme.darkClass]: unref(isDark)
59
+ }]),
60
+ dir: unref(settings).textDirection,
61
+ onReady
62
+ }, null, 8, ["variant", "story", "class", "dir"]))
63
+ ], 4)
64
+ ]),
65
+ _: 1
66
+ }, 8, ["variant"]);
67
+ };
68
+ }
69
+ });
70
+ export {
71
+ _sfc_main as default
72
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./StoryVariantSinglePreviewRemote.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };