histoire 0.8.4 → 0.9.2

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 (359) hide show
  1. package/client.d.ts +1 -3
  2. package/client.js +1 -0
  3. package/dist/node/alias.d.ts +0 -1
  4. package/dist/node/alias.js +5 -6
  5. package/dist/node/bin.js +1 -0
  6. package/dist/node/build.js +13 -1
  7. package/dist/node/builtin-plugins/tailwind-tokens.js +391 -377
  8. package/dist/node/builtin-plugins/vanilla-support/MountStory.d.ts +14 -0
  9. package/dist/node/builtin-plugins/vanilla-support/MountStory.js +39 -0
  10. package/dist/node/builtin-plugins/vanilla-support/RenderStory.d.ts +38 -0
  11. package/dist/node/builtin-plugins/vanilla-support/RenderStory.js +131 -0
  12. package/dist/node/builtin-plugins/vanilla-support/client.d.ts +3 -0
  13. package/dist/node/builtin-plugins/vanilla-support/client.js +5 -0
  14. package/dist/node/builtin-plugins/vanilla-support/collect.d.ts +2 -0
  15. package/dist/node/builtin-plugins/vanilla-support/collect.js +33 -0
  16. package/dist/node/builtin-plugins/vanilla-support/plugin.d.ts +2 -0
  17. package/dist/node/builtin-plugins/vanilla-support/plugin.js +29 -0
  18. package/dist/node/builtin-plugins/vanilla-support/types.d.ts +35 -0
  19. package/dist/node/builtin-plugins/vanilla-support/types.js +3 -0
  20. package/dist/node/builtin-plugins/vanilla-support/vanilla.story.d.ts +3 -0
  21. package/dist/node/builtin-plugins/vanilla-support/vanilla.story.js +55 -0
  22. package/dist/node/collect/run.js +4 -6
  23. package/dist/node/config.d.ts +9 -0
  24. package/dist/node/config.js +16 -0
  25. package/dist/node/context.d.ts +3 -7
  26. package/dist/node/context.js +2 -0
  27. package/dist/node/plugin.d.ts +5 -1
  28. package/dist/node/server.js +1 -1
  29. package/dist/node/stories.js +15 -1
  30. package/dist/node/vite.d.ts +4 -0
  31. package/dist/node/vite.js +47 -16
  32. package/package.json +11 -21
  33. package/src/node/alias.ts +5 -6
  34. package/src/node/bin.ts +1 -0
  35. package/src/node/build.ts +13 -1
  36. package/src/node/builtin-plugins/tailwind-tokens.ts +394 -377
  37. package/src/node/builtin-plugins/vanilla-support/MountStory.ts +50 -0
  38. package/src/node/builtin-plugins/vanilla-support/RenderStory.ts +166 -0
  39. package/src/node/builtin-plugins/vanilla-support/client.ts +6 -0
  40. package/src/node/builtin-plugins/vanilla-support/collect.ts +42 -0
  41. package/src/node/builtin-plugins/vanilla-support/plugin.ts +35 -0
  42. package/src/node/builtin-plugins/vanilla-support/types.ts +40 -0
  43. package/src/node/builtin-plugins/vanilla-support/vanilla.story.ts +63 -0
  44. package/src/node/collect/run.ts +4 -8
  45. package/src/node/config.ts +26 -0
  46. package/src/node/context.ts +7 -2
  47. package/src/node/plugin.ts +5 -1
  48. package/src/node/server.ts +2 -2
  49. package/src/node/stories.ts +18 -1
  50. package/src/node/vite.ts +56 -16
  51. package/tsconfig.json +2 -11
  52. package/dist/bundled/App.js +0 -166
  53. package/dist/bundled/_virtual/plugin-vue_export-helper.js +0 -8
  54. package/dist/bundled/api.js +0 -1
  55. package/dist/bundled/assets/histoire-text-dark.js +0 -2
  56. package/dist/bundled/assets/histoire-text.js +0 -2
  57. package/dist/bundled/assets/histoire.js +0 -2
  58. package/dist/bundled/components/HomeView.js +0 -24
  59. package/dist/bundled/components/app/AppHeader.js +0 -67
  60. package/dist/bundled/components/app/AppLogo.js +0 -26
  61. package/dist/bundled/components/app/Breadcrumb.js +0 -95
  62. package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  63. package/dist/bundled/components/app/InitialLoading.js +0 -48
  64. package/dist/bundled/components/app/MobileOverlay.js +0 -41
  65. package/dist/bundled/components/base/BaseCheckbox.js +0 -75
  66. package/dist/bundled/components/base/BaseEmpty.js +0 -13
  67. package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  68. package/dist/bundled/components/base/BaseListItemLink.js +0 -50
  69. package/dist/bundled/components/base/BaseOverflowMenu.js +0 -97
  70. package/dist/bundled/components/base/BaseOverflowTab.js +0 -45
  71. package/dist/bundled/components/base/BaseSelect.js +0 -88
  72. package/dist/bundled/components/base/BaseSplitPane.js +0 -184
  73. package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  74. package/dist/bundled/components/base/BaseTab.js +0 -45
  75. package/dist/bundled/components/misc/CheckerboardPattern.js +0 -41
  76. package/dist/bundled/components/misc/HatchedPattern.js +0 -11
  77. package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  78. package/dist/bundled/components/panel/ControlsComponentPropItem.js +0 -98
  79. package/dist/bundled/components/panel/ControlsComponentProps.js +0 -42
  80. package/dist/bundled/components/panel/PaneTabs.js +0 -131
  81. package/dist/bundled/components/panel/StatePresets.js +0 -184
  82. package/dist/bundled/components/panel/StoryControls.js +0 -66
  83. package/dist/bundled/components/panel/StoryDocs.js +0 -58
  84. package/dist/bundled/components/panel/StoryEvent.js +0 -56
  85. package/dist/bundled/components/panel/StoryEvents.js +0 -49
  86. package/dist/bundled/components/panel/StorySidePanel.js +0 -71
  87. package/dist/bundled/components/panel/StorySourceCode.js +0 -110
  88. package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  89. package/dist/bundled/components/search/SearchItem.js +0 -113
  90. package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  91. package/dist/bundled/components/search/SearchLoading.js +0 -19
  92. package/dist/bundled/components/search/SearchModal.js +0 -46
  93. package/dist/bundled/components/search/SearchPane.js +0 -263
  94. package/dist/bundled/components/search/search-docs-data.js +0 -7
  95. package/dist/bundled/components/search/search-title-data.js +0 -7
  96. package/dist/bundled/components/story/StoryResponsivePreview.js +0 -180
  97. package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  98. package/dist/bundled/components/story/StoryVariantGrid.js +0 -94
  99. package/dist/bundled/components/story/StoryVariantGridItem.js +0 -106
  100. package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  101. package/dist/bundled/components/story/StoryVariantListItem.js +0 -58
  102. package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  103. package/dist/bundled/components/story/StoryVariantSingle.js +0 -115
  104. package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  105. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +0 -43
  106. package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +0 -119
  107. package/dist/bundled/components/story/StoryVariantSingleView.js +0 -49
  108. package/dist/bundled/components/story/StoryView.js +0 -107
  109. package/dist/bundled/components/story/StoryViewer.js +0 -57
  110. package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  111. package/dist/bundled/components/toolbar/StoryVariantBackground.js +0 -85
  112. package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  113. package/dist/bundled/components/toolbar/StoryVariantNewTab.js +0 -33
  114. package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +0 -129
  115. package/dist/bundled/components/toolbar/StoryVariantTitle.js +0 -24
  116. package/dist/bundled/components/tree/StoryGroup.js +0 -74
  117. package/dist/bundled/components/tree/StoryList.js +0 -37
  118. package/dist/bundled/components/tree/StoryListFolder.js +0 -89
  119. package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  120. package/dist/bundled/components/tree/StoryListItem.js +0 -72
  121. package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
  122. package/dist/bundled/index.js +0 -29
  123. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +0 -40
  124. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +0 -5
  125. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +0 -11
  126. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +0 -26
  127. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +0 -10
  128. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +0 -50
  129. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +0 -8
  130. package/dist/bundled/router.js +0 -28
  131. package/dist/bundled/sandbox.js +0 -87
  132. package/dist/bundled/stores/events.js +0 -29
  133. package/dist/bundled/stores/folder.js +0 -46
  134. package/dist/bundled/stores/preview-settings.js +0 -15
  135. package/dist/bundled/stores/story.js +0 -43
  136. package/dist/bundled/style.css +0 -102
  137. package/dist/bundled/util/config.js +0 -4
  138. package/dist/bundled/util/const.js +0 -5
  139. package/dist/bundled/util/dark.js +0 -4
  140. package/dist/bundled/util/env.js +0 -2
  141. package/dist/bundled/util/events.js +0 -32
  142. package/dist/bundled/util/keyboard.js +0 -84
  143. package/dist/bundled/util/mapping.js +0 -94
  144. package/dist/bundled/util/preview-settings.js +0 -6
  145. package/dist/bundled/util/responsive.js +0 -3
  146. package/dist/bundled/util/sandbox.js +0 -8
  147. package/dist/bundled/util/scroll.js +0 -28
  148. package/dist/bundled/util/state.js +0 -31
  149. package/dist/bundled/util/tooltip.js +0 -12
  150. package/dist/bundled/util/variant.js +0 -35
  151. package/dist/client/app/App.vue +0 -162
  152. package/dist/client/app/api.d.ts +0 -1
  153. package/dist/client/app/api.js +0 -1
  154. package/dist/client/app/assets/histoire-text-dark.svg +0 -89
  155. package/dist/client/app/assets/histoire-text.svg +0 -89
  156. package/dist/client/app/assets/histoire.svg +0 -51
  157. package/dist/client/app/components/HomeView.vue +0 -17
  158. package/dist/client/app/components/app/AppHeader.vue +0 -64
  159. package/dist/client/app/components/app/AppLogo.vue +0 -24
  160. package/dist/client/app/components/app/Breadcrumb.vue +0 -98
  161. package/dist/client/app/components/app/InitialLoading.vue +0 -44
  162. package/dist/client/app/components/app/MobileOverlay.vue +0 -33
  163. package/dist/client/app/components/base/BaseCheckbox.vue +0 -77
  164. package/dist/client/app/components/base/BaseCopyIcon.vue +0 -34
  165. package/dist/client/app/components/base/BaseEmpty.vue +0 -21
  166. package/dist/client/app/components/base/BaseListItemLink.vue +0 -55
  167. package/dist/client/app/components/base/BaseOverflowMenu.vue +0 -119
  168. package/dist/client/app/components/base/BaseOverflowTab.vue +0 -46
  169. package/dist/client/app/components/base/BaseSelect.vue +0 -72
  170. package/dist/client/app/components/base/BaseSplitPane.vue +0 -240
  171. package/dist/client/app/components/base/BaseTab.vue +0 -46
  172. package/dist/client/app/components/misc/CheckerboardPattern.vue +0 -32
  173. package/dist/client/app/components/misc/HatchedPattern.vue +0 -13
  174. package/dist/client/app/components/panel/ControlsComponentPropItem.vue +0 -103
  175. package/dist/client/app/components/panel/ControlsComponentProps.vue +0 -34
  176. package/dist/client/app/components/panel/PaneTabs.vue +0 -89
  177. package/dist/client/app/components/panel/StatePresets.vue +0 -196
  178. package/dist/client/app/components/panel/StoryControls.vue +0 -68
  179. package/dist/client/app/components/panel/StoryDocs.vue +0 -61
  180. package/dist/client/app/components/panel/StoryEvent.vue +0 -54
  181. package/dist/client/app/components/panel/StoryEvents.vue +0 -45
  182. package/dist/client/app/components/panel/StorySidePanel.vue +0 -69
  183. package/dist/client/app/components/panel/StorySourceCode.vue +0 -116
  184. package/dist/client/app/components/search/SearchItem.vue +0 -110
  185. package/dist/client/app/components/search/SearchLoading.vue +0 -16
  186. package/dist/client/app/components/search/SearchModal.vue +0 -43
  187. package/dist/client/app/components/search/SearchPane.vue +0 -293
  188. package/dist/client/app/components/search/search-docs-data.d.ts +0 -3
  189. package/dist/client/app/components/search/search-docs-data.js +0 -7
  190. package/dist/client/app/components/search/search-title-data.d.ts +0 -3
  191. package/dist/client/app/components/search/search-title-data.js +0 -7
  192. package/dist/client/app/components/search/types.d.ts +0 -7
  193. package/dist/client/app/components/search/types.js +0 -1
  194. package/dist/client/app/components/story/StoryResponsivePreview.vue +0 -204
  195. package/dist/client/app/components/story/StoryVariantGrid.vue +0 -112
  196. package/dist/client/app/components/story/StoryVariantGridItem.vue +0 -110
  197. package/dist/client/app/components/story/StoryVariantListItem.vue +0 -50
  198. package/dist/client/app/components/story/StoryVariantSingle.vue +0 -105
  199. package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +0 -42
  200. package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +0 -139
  201. package/dist/client/app/components/story/StoryVariantSingleView.vue +0 -52
  202. package/dist/client/app/components/story/StoryView.vue +0 -96
  203. package/dist/client/app/components/story/StoryViewer.vue +0 -53
  204. package/dist/client/app/components/toolbar/StoryVariantBackground.vue +0 -67
  205. package/dist/client/app/components/toolbar/StoryVariantNewTab.vue +0 -29
  206. package/dist/client/app/components/toolbar/StoryVariantResponsiveSize.vue +0 -82
  207. package/dist/client/app/components/toolbar/StoryVariantTitle.vue +0 -21
  208. package/dist/client/app/components/tree/StoryGroup.vue +0 -75
  209. package/dist/client/app/components/tree/StoryList.vue +0 -35
  210. package/dist/client/app/components/tree/StoryListFolder.vue +0 -89
  211. package/dist/client/app/components/tree/StoryListItem.vue +0 -71
  212. package/dist/client/app/index.d.ts +0 -2
  213. package/dist/client/app/index.js +0 -28
  214. package/dist/client/app/router.d.ts +0 -2
  215. package/dist/client/app/router.js +0 -26
  216. package/dist/client/app/sandbox.d.ts +0 -1
  217. package/dist/client/app/sandbox.js +0 -87
  218. package/dist/client/app/stores/events.d.ts +0 -29
  219. package/dist/client/app/stores/events.js +0 -25
  220. package/dist/client/app/stores/folder.d.ts +0 -10
  221. package/dist/client/app/stores/folder.js +0 -47
  222. package/dist/client/app/stores/preview-settings.d.ts +0 -8
  223. package/dist/client/app/stores/preview-settings.js +0 -14
  224. package/dist/client/app/stores/story.d.ts +0 -362
  225. package/dist/client/app/stores/story.js +0 -39
  226. package/dist/client/app/style/floating-vue.pcss +0 -34
  227. package/dist/client/app/style/main.pcss +0 -86
  228. package/dist/client/app/style/sandbox.css +0 -19
  229. package/dist/client/app/style/transitions.pcss +0 -51
  230. package/dist/client/app/types.d.ts +0 -34
  231. package/dist/client/app/types.js +0 -1
  232. package/dist/client/app/util/config.d.ts +0 -3
  233. package/dist/client/app/util/config.js +0 -4
  234. package/dist/client/app/util/const.d.ts +0 -4
  235. package/dist/client/app/util/const.js +0 -4
  236. package/dist/client/app/util/dark.d.ts +0 -2
  237. package/dist/client/app/util/dark.js +0 -3
  238. package/dist/client/app/util/env.d.ts +0 -1
  239. package/dist/client/app/util/env.js +0 -1
  240. package/dist/client/app/util/events.d.ts +0 -1
  241. package/dist/client/app/util/events.js +0 -31
  242. package/dist/client/app/util/keyboard.d.ts +0 -8
  243. package/dist/client/app/util/keyboard.js +0 -82
  244. package/dist/client/app/util/mapping.d.ts +0 -3
  245. package/dist/client/app/util/mapping.js +0 -85
  246. package/dist/client/app/util/preview-settings.d.ts +0 -9
  247. package/dist/client/app/util/preview-settings.js +0 -5
  248. package/dist/client/app/util/responsive.d.ts +0 -1
  249. package/dist/client/app/util/responsive.js +0 -2
  250. package/dist/client/app/util/sandbox.d.ts +0 -2
  251. package/dist/client/app/util/sandbox.js +0 -7
  252. package/dist/client/app/util/scroll.d.ts +0 -4
  253. package/dist/client/app/util/scroll.js +0 -27
  254. package/dist/client/app/util/state.d.ts +0 -1
  255. package/dist/client/app/util/state.js +0 -31
  256. package/dist/client/app/util/tooltip.d.ts +0 -6
  257. package/dist/client/app/util/tooltip.js +0 -11
  258. package/dist/client/app/util/variant.d.ts +0 -18
  259. package/dist/client/app/util/variant.js +0 -17
  260. package/dist/client/bundle-index.js +0 -5
  261. package/dist/client/bundle-main.js +0 -5
  262. package/dist/client/bundle-sandbox.js +0 -2
  263. package/dist/client/index.d.ts +0 -9
  264. package/dist/client/index.js +0 -4
  265. package/dist/style.css +0 -2382
  266. package/postcss.config.cjs +0 -8
  267. package/scripts/copy.mjs +0 -12
  268. package/scripts/watchAndCopy.mjs +0 -15
  269. package/src/client/app/App.vue +0 -162
  270. package/src/client/app/api.ts +0 -1
  271. package/src/client/app/assets/histoire-text-dark.svg +0 -89
  272. package/src/client/app/assets/histoire-text.svg +0 -89
  273. package/src/client/app/assets/histoire.svg +0 -51
  274. package/src/client/app/components/HomeView.vue +0 -17
  275. package/src/client/app/components/app/AppHeader.vue +0 -64
  276. package/src/client/app/components/app/AppLogo.vue +0 -24
  277. package/src/client/app/components/app/Breadcrumb.vue +0 -98
  278. package/src/client/app/components/app/InitialLoading.vue +0 -44
  279. package/src/client/app/components/app/MobileOverlay.vue +0 -33
  280. package/src/client/app/components/base/BaseCheckbox.vue +0 -77
  281. package/src/client/app/components/base/BaseCopyIcon.vue +0 -34
  282. package/src/client/app/components/base/BaseEmpty.vue +0 -21
  283. package/src/client/app/components/base/BaseListItemLink.vue +0 -55
  284. package/src/client/app/components/base/BaseOverflowMenu.vue +0 -119
  285. package/src/client/app/components/base/BaseOverflowTab.vue +0 -46
  286. package/src/client/app/components/base/BaseSelect.vue +0 -72
  287. package/src/client/app/components/base/BaseSplitPane.vue +0 -240
  288. package/src/client/app/components/base/BaseTab.vue +0 -46
  289. package/src/client/app/components/misc/CheckerboardPattern.vue +0 -32
  290. package/src/client/app/components/misc/HatchedPattern.vue +0 -13
  291. package/src/client/app/components/panel/ControlsComponentPropItem.vue +0 -103
  292. package/src/client/app/components/panel/ControlsComponentProps.vue +0 -34
  293. package/src/client/app/components/panel/PaneTabs.vue +0 -89
  294. package/src/client/app/components/panel/StatePresets.vue +0 -196
  295. package/src/client/app/components/panel/StoryControls.vue +0 -68
  296. package/src/client/app/components/panel/StoryDocs.vue +0 -61
  297. package/src/client/app/components/panel/StoryEvent.vue +0 -54
  298. package/src/client/app/components/panel/StoryEvents.vue +0 -45
  299. package/src/client/app/components/panel/StorySidePanel.vue +0 -69
  300. package/src/client/app/components/panel/StorySourceCode.vue +0 -116
  301. package/src/client/app/components/search/SearchItem.vue +0 -110
  302. package/src/client/app/components/search/SearchLoading.vue +0 -16
  303. package/src/client/app/components/search/SearchModal.vue +0 -43
  304. package/src/client/app/components/search/SearchPane.vue +0 -293
  305. package/src/client/app/components/search/search-docs-data.ts +0 -10
  306. package/src/client/app/components/search/search-title-data.ts +0 -10
  307. package/src/client/app/components/search/types.ts +0 -4
  308. package/src/client/app/components/story/StoryResponsivePreview.vue +0 -204
  309. package/src/client/app/components/story/StoryVariantGrid.vue +0 -112
  310. package/src/client/app/components/story/StoryVariantGridItem.vue +0 -110
  311. package/src/client/app/components/story/StoryVariantListItem.vue +0 -50
  312. package/src/client/app/components/story/StoryVariantSingle.vue +0 -105
  313. package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +0 -42
  314. package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +0 -139
  315. package/src/client/app/components/story/StoryVariantSingleView.vue +0 -52
  316. package/src/client/app/components/story/StoryView.vue +0 -96
  317. package/src/client/app/components/story/StoryViewer.vue +0 -53
  318. package/src/client/app/components/toolbar/StoryVariantBackground.vue +0 -67
  319. package/src/client/app/components/toolbar/StoryVariantNewTab.vue +0 -29
  320. package/src/client/app/components/toolbar/StoryVariantResponsiveSize.vue +0 -82
  321. package/src/client/app/components/toolbar/StoryVariantTitle.vue +0 -21
  322. package/src/client/app/components/tree/StoryGroup.vue +0 -75
  323. package/src/client/app/components/tree/StoryList.vue +0 -35
  324. package/src/client/app/components/tree/StoryListFolder.vue +0 -89
  325. package/src/client/app/components/tree/StoryListItem.vue +0 -71
  326. package/src/client/app/index.ts +0 -30
  327. package/src/client/app/router.ts +0 -29
  328. package/src/client/app/sandbox.ts +0 -95
  329. package/src/client/app/stores/events.ts +0 -36
  330. package/src/client/app/stores/folder.ts +0 -59
  331. package/src/client/app/stores/preview-settings.ts +0 -17
  332. package/src/client/app/stores/story.ts +0 -47
  333. package/src/client/app/style/floating-vue.pcss +0 -34
  334. package/src/client/app/style/main.pcss +0 -86
  335. package/src/client/app/style/sandbox.css +0 -19
  336. package/src/client/app/style/transitions.pcss +0 -51
  337. package/src/client/app/types.ts +0 -46
  338. package/src/client/app/util/config.ts +0 -6
  339. package/src/client/app/util/const.ts +0 -4
  340. package/src/client/app/util/dark.ts +0 -4
  341. package/src/client/app/util/env.ts +0 -1
  342. package/src/client/app/util/events.ts +0 -30
  343. package/src/client/app/util/keyboard.ts +0 -99
  344. package/src/client/app/util/mapping.ts +0 -91
  345. package/src/client/app/util/preview-settings.ts +0 -8
  346. package/src/client/app/util/responsive.ts +0 -3
  347. package/src/client/app/util/sandbox.ts +0 -10
  348. package/src/client/app/util/scroll.ts +0 -31
  349. package/src/client/app/util/state.ts +0 -37
  350. package/src/client/app/util/tooltip.ts +0 -13
  351. package/src/client/app/util/variant.ts +0 -20
  352. package/src/client/bundle-index.js +0 -5
  353. package/src/client/bundle-main.js +0 -5
  354. package/src/client/bundle-sandbox.js +0 -2
  355. package/src/client/index.ts +0 -13
  356. package/src/client/shim.d.ts +0 -7
  357. package/tailwind.config.cjs +0 -126
  358. package/vite.config.ts +0 -87
  359. package/vue.d.ts +0 -1
@@ -1,53 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed, ref, watch } from 'vue'
3
- import { useStoryStore } from '../../stores/story'
4
- import StoryVariantListItem from './StoryVariantListItem.vue'
5
- import MobileOverlay from '../app/MobileOverlay.vue'
6
- import StoryVariantGrid from './StoryVariantGrid.vue'
7
- import StoryVariantSingle from './StoryVariantSingle.vue'
8
-
9
- const storyStore = useStoryStore()
10
-
11
- const variant = computed(() => storyStore.currentVariant)
12
-
13
- const isMenuOpened = ref(false)
14
-
15
- function closeMenu () {
16
- isMenuOpened.value = false
17
- }
18
-
19
- watch(variant, () => {
20
- isMenuOpened.value = false
21
- })
22
-
23
- </script>
24
-
25
- <template>
26
- <div class="htw-bg-gray-50 htw-h-full dark:htw-bg-gray-750">
27
- <StoryVariantGrid
28
- v-if="storyStore.currentStory.layout.type === 'grid'"
29
- />
30
- <StoryVariantSingle
31
- v-else-if="storyStore.currentStory.layout.type === 'single'"
32
- @open-variant-menu="isMenuOpened = true"
33
- />
34
- </div>
35
-
36
- <MobileOverlay
37
- title="Select a variant"
38
- :opened="isMenuOpened"
39
- @close="closeMenu"
40
- >
41
- <StoryVariantListItem
42
- v-for="(v, index) of storyStore.currentStory.variants"
43
- :key="index"
44
- :variant="v"
45
- />
46
- </MobileOverlay>
47
- </template>
48
-
49
- <style scoped>
50
- .bind-icon-color {
51
- color: v-bind('variant?.iconColor');
52
- }
53
- </style>
@@ -1,67 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Icon } from '@iconify/vue'
3
- import { usePreviewSettingsStore } from '../../stores/preview-settings'
4
- import { histoireConfig } from '../../util/config'
5
- import BaseCheckbox from '../base/BaseCheckbox.vue'
6
-
7
- const settings = usePreviewSettingsStore().currentSettings
8
- </script>
9
-
10
- <template>
11
- <VDropdown
12
- v-if="histoireConfig.backgroundPresets.length"
13
- placement="bottom-end"
14
- :skidding="6"
15
- class="htw-h-full htw-flex-none"
16
- >
17
- <div
18
- v-tooltip="'Background color'"
19
- class="htw-cursor-pointer hover:htw-text-primary-500 htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group"
20
- >
21
- <div
22
- class="bind-preview-bg htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/50 dark:htw-border-white/50"
23
- />
24
- <Icon
25
- icon="carbon:caret-down"
26
- class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
27
- />
28
- </div>
29
-
30
- <template #popper="{ hide }">
31
- <div class="htw-flex htw-flex-col htw-items-stretch">
32
- <BaseCheckbox v-model="settings.checkerboard">
33
- Checkerboard
34
- </BaseCheckbox>
35
-
36
- <button
37
- v-for="(option, index) in histoireConfig.backgroundPresets"
38
- :key="index"
39
- class="htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4"
40
- :class="[
41
- settings.backgroundColor === option.color
42
- ? 'htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
43
- : 'htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700',
44
- ]"
45
- @click="settings.backgroundColor = option.color;hide()"
46
- >
47
- <span class="htw-mr-auto">{{ option.label }}</span>
48
- <template v-if="option.color !== '$checkerboard'">
49
- <span class="htw-ml-auto htw-opacity-70">{{ option.color }}</span>
50
- <div
51
- class="htw-w-4 htw-h-4 htw-rounded-full htw-border htw-border-black/20 dark:htw-border-white/20"
52
- :style="{
53
- backgroundColor: option.color,
54
- }"
55
- />
56
- </template>
57
- </button>
58
- </div>
59
- </template>
60
- </VDropdown>
61
- </template>
62
-
63
- <style scoped>
64
- .bind-preview-bg {
65
- background-color: v-bind('settings.backgroundColor');
66
- }
67
- </style>
@@ -1,29 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Icon } from '@iconify/vue'
3
- import type { Story, Variant } from '../../types'
4
- import { computed } from 'vue'
5
- import { getSandboxUrl } from '../../util/sandbox'
6
-
7
- const props = defineProps<{
8
- variant: Variant
9
- story: Story
10
- }>()
11
-
12
- const sandboxUrl = computed(() => {
13
- return getSandboxUrl(props.story, props.variant)
14
- })
15
- </script>
16
-
17
- <template>
18
- <a
19
- v-tooltip="'Open variant in new tab'"
20
- :href="sandboxUrl"
21
- target="_blank"
22
- class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
23
- >
24
- <Icon
25
- icon="carbon:launch"
26
- class="base-list-item-link-icon htw-w-4 htw-h-4"
27
- />
28
- </a>
29
- </template>
@@ -1,82 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Icon } from '@iconify/vue'
3
- import { usePreviewSettingsStore } from '../../stores/preview-settings'
4
- import { histoireConfig } from '../../util/config'
5
- import BaseCheckbox from '../base/BaseCheckbox.vue'
6
-
7
- const settings = usePreviewSettingsStore().currentSettings
8
- </script>
9
-
10
- <template>
11
- <!-- Responsive size -->
12
- <VDropdown
13
- placement="bottom-end"
14
- :skidding="6"
15
- :disabled="!histoireConfig.responsivePresets?.length"
16
- class="htw-h-full htw-flex-none"
17
- >
18
- <div
19
- v-tooltip="'Responsive sizes'"
20
- class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group"
21
- :class="{
22
- 'htw-cursor-pointer hover:htw-text-primary-500': histoireConfig.responsivePresets?.length,
23
- }"
24
- >
25
- <Icon
26
- icon="carbon:devices"
27
- class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
28
- />
29
- <Icon
30
- icon="carbon:caret-down"
31
- class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
32
- />
33
- </div>
34
-
35
- <template #popper="{ hide }">
36
- <div class="htw-flex htw-flex-col htw-items-stretch">
37
- <BaseCheckbox v-model="settings.rotate">
38
- Rotate
39
- </BaseCheckbox>
40
-
41
- <div class="htw-flex htw-gap-2 htw-px-4 htw-py-3">
42
- <input
43
- v-model.number="settings.responsiveWidth"
44
- v-tooltip="'Responsive width (px)'"
45
- type="number"
46
- class="htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0"
47
- step="16"
48
- placeholder="Auto"
49
- >
50
- <span class="htw-opacity-50">x</span>
51
- <input
52
- v-model.number="settings.responsiveHeight"
53
- v-tooltip="'Responsive height (px)'"
54
- type="number"
55
- class="htw-bg-transparent htw-border htw-border-gray-200 dark:htw-border-gray-850 htw-rounded htw-w-20 htw-opacity-50 focus:htw-opacity-100 htw-flex-1 htw-min-w-0"
56
- step="16"
57
- placeholder="Auto"
58
- >
59
- </div>
60
-
61
- <button
62
- v-for="(preset, index) in histoireConfig.responsivePresets"
63
- :key="index"
64
- class="htw-px-4 htw-py-3 htw-cursor-pointer htw-text-left htw-flex htw-gap-4"
65
- :class="[
66
- settings.responsiveWidth === preset.width && settings.responsiveHeight === preset.height
67
- ? 'htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
68
- : 'htw-bg-transparent hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700',
69
- ]"
70
- @click="settings.responsiveWidth = preset.width;settings.responsiveHeight = preset.height;hide()"
71
- >
72
- {{ preset.label }}
73
- <span class="htw-ml-auto htw-opacity-70 htw-flex htw-gap-1">
74
- <span v-if="preset.width">{{ preset.width }}<span v-if="!preset.height">px</span></span>
75
- <span v-if="preset.width && preset.height">x</span>
76
- <span v-if="preset.height">{{ preset.height }}<span v-if="!preset.width">px</span></span>
77
- </span>
78
- </button>
79
- </div>
80
- </template>
81
- </VDropdown>
82
- </template>
@@ -1,21 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Icon } from '@iconify/vue'
3
- import type { Variant } from '../../types'
4
-
5
- defineProps<{
6
- variant: Variant
7
- }>()
8
- </script>
9
-
10
- <template>
11
- <div class="htw-flex htw-items-center htw-gap-1 htw-text-gray-500 htw-flex-1 htw-truncate htw-min-w-0">
12
- <Icon
13
- :icon="variant.icon ?? 'carbon:cube'"
14
- class="base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50"
15
- :class="[
16
- variant.iconColor ? 'bind-icon-color' : 'htw-text-gray-500',
17
- ]"
18
- />
19
- <span>{{ variant.title }}</span>
20
- </div>
21
- </template>
@@ -1,75 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { Story, TreeGroup } from '../../types'
3
- import StoryListItem from './StoryListItem.vue'
4
- import StoryListFolder from './StoryListFolder.vue'
5
- import { Icon } from '@iconify/vue'
6
- import { computed, withDefaults } from 'vue'
7
- import { useFolderStore } from '../../stores/folder'
8
-
9
- const props = withDefaults(defineProps<{
10
- path?: Array<string>
11
- group: TreeGroup
12
- stories: Story[]
13
- }>(), {
14
- path: () => [],
15
- })
16
-
17
- const folderStore = useFolderStore()
18
-
19
- const folderPath = computed(() => [...props.path, props.group.title])
20
- const isFolderOpen = computed(() => folderStore.isFolderOpened(folderPath.value, true))
21
-
22
- function toggleOpen () {
23
- folderStore.toggleFolder(folderPath.value, false)
24
- }
25
- </script>
26
-
27
- <template>
28
- <div
29
- data-test-id="story-group"
30
- class="htw-my-2 first:htw-mt-0 last:htw-mb-0"
31
- >
32
- <div
33
- v-if="group.title"
34
- role="button"
35
- tabindex="0"
36
- class="htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex htw-items-center htw-gap-1 htw-min-w-0"
37
- @click="toggleOpen"
38
- @keyup.enter="toggleOpen"
39
- @keyup.space="toggleOpen"
40
- >
41
- <Icon
42
- icon="carbon:caret-right"
43
- class="htw-w-4 htw-h-4 htw-transition-transform htw-duration-150 htw-opacity-30 htw-flex-none"
44
- :class="{
45
- 'htw-rotate-90': isFolderOpen,
46
- }"
47
- />
48
- <span class="htw-truncate htw-opacity-50">{{ group.title }}</span>
49
- <span class="htw-h-[1px] htw-flex-1 htw-bg-gray-500/10 htw-mx-2" />
50
- </div>
51
-
52
- <!-- Children -->
53
- <div
54
- v-if="isFolderOpen"
55
- >
56
- <template
57
- v-for="element of group.children"
58
- :key="element.title"
59
- >
60
- <StoryListFolder
61
- v-if="(element as TreeFolder).children"
62
- :path="folderPath"
63
- :folder="(element as TreeFolder)"
64
- :stories="stories"
65
- :depth="0"
66
- />
67
- <StoryListItem
68
- v-else
69
- :story="stories[(element as TreeLeaf).index]"
70
- :depth="0"
71
- />
72
- </template>
73
- </div>
74
- </div>
75
- </template>
@@ -1,35 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { Story, Tree, TreeGroup, TreeFolder, TreeLeaf } from '../../types'
3
- import StoryListItem from './StoryListItem.vue'
4
- import StoryListFolder from './StoryListFolder.vue'
5
- import StoryGroup from './StoryGroup.vue'
6
-
7
- defineProps<{
8
- tree: Tree
9
- stories: Story[]
10
- }>()
11
- </script>
12
-
13
- <template>
14
- <div class="htw-overflow-y-auto">
15
- <template
16
- v-for="element of tree"
17
- :key="element.title"
18
- >
19
- <StoryGroup
20
- v-if="(element as TreeGroup).group"
21
- :group="(element as TreeGroup)"
22
- :stories="stories"
23
- />
24
- <StoryListFolder
25
- v-else-if="(element as TreeFolder).children"
26
- :folder="(element as TreeFolder)"
27
- :stories="stories"
28
- />
29
- <StoryListItem
30
- v-else
31
- :story="stories[(element as TreeLeaf).index]"
32
- />
33
- </template>
34
- </div>
35
- </template>
@@ -1,89 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { Story, TreeFolder, TreeLeaf } from '../../types'
3
- import StoryListItem from './StoryListItem.vue'
4
- import { Icon } from '@iconify/vue'
5
- import { computed, withDefaults } from 'vue'
6
- import { useFolderStore } from '../../stores/folder'
7
-
8
- const props = withDefaults(defineProps<{
9
- path?: Array<string>
10
- folder: TreeFolder
11
- stories: Story[]
12
- depth?: number
13
- }>(), {
14
- depth: 0,
15
- path: () => [],
16
- })
17
-
18
- const folderStore = useFolderStore()
19
-
20
- const folderPath = computed(() => [...props.path, props.folder.title])
21
- const isFolderOpen = computed(() => folderStore.isFolderOpened(folderPath.value))
22
-
23
- function toggleOpen () {
24
- folderStore.toggleFolder(folderPath.value)
25
- }
26
-
27
- const folderPadding = computed(() => {
28
- return (props.depth * 12) + 'px'
29
- })
30
- </script>
31
-
32
- <template>
33
- <div data-test-id="story-list-folder">
34
- <div
35
- role="button"
36
- tabindex="0"
37
- class="htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex"
38
- @click="toggleOpen"
39
- @keyup.enter="toggleOpen"
40
- @keyup.space="toggleOpen"
41
- >
42
- <span class="bind-tree-padding htw-flex htw-items-center htw-gap-2 htw-min-w-0">
43
- <span class="htw-flex htw-flex-none htw-items-center">
44
- <Icon
45
- icon="carbon:caret-right"
46
- class="htw-w-4 htw-h-4 htw-transition-transform htw-duration-150 htw-opacity-30"
47
- :class="{
48
- 'htw-rotate-90': isFolderOpen,
49
- }"
50
- />
51
- <Icon
52
- icon="carbon:folder"
53
- class="htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4"
54
- />
55
- </span>
56
- <span class="htw-truncate">{{ folder.title }}</span>
57
- </span>
58
- </div>
59
-
60
- <!-- Children -->
61
- <div
62
- v-if="isFolderOpen"
63
- >
64
- <template
65
- v-for="element of folder.children"
66
- :key="element.title"
67
- >
68
- <StoryListFolder
69
- v-if="(element as TreeFolder).children"
70
- :path="folderPath"
71
- :folder="(element as TreeFolder)"
72
- :stories="stories"
73
- :depth="depth + 1"
74
- />
75
- <StoryListItem
76
- v-else
77
- :story="stories[(element as TreeLeaf).index]"
78
- :depth="depth + 1"
79
- />
80
- </template>
81
- </div>
82
- </div>
83
- </template>
84
-
85
- <style scoped>
86
- .bind-tree-padding {
87
- padding-left: v-bind(folderPadding);
88
- }
89
- </style>
@@ -1,71 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { Story } from '../../types'
3
- import BaseListItemLink from '../base/BaseListItemLink.vue'
4
- import { Icon } from '@iconify/vue'
5
- import { computed, ref, withDefaults } from 'vue'
6
- import { useRoute } from 'vue-router'
7
- import { useScrollOnActive } from '../../util/scroll'
8
-
9
- const props = withDefaults(defineProps<{
10
- story: Story
11
- depth?: number
12
- }>(), {
13
- depth: 0,
14
- })
15
-
16
- const filePadding = computed(() => {
17
- return (props.depth * 12) + 'px'
18
- })
19
-
20
- const route = useRoute()
21
- const isActive = computed(() => route.params.storyId === props.story.id)
22
- const el = ref<HTMLDivElement>()
23
- useScrollOnActive(isActive, el)
24
- </script>
25
-
26
- <template>
27
- <div
28
- ref="el"
29
- data-test-id="story-list-item"
30
- >
31
- <BaseListItemLink
32
- v-slot="{ active }"
33
- :to="{
34
- name: 'story',
35
- params: {
36
- storyId: story.id,
37
- },
38
- }"
39
- class="htw-pl-0.5 htw-pr-2 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm"
40
- >
41
- <span class="bind-tree-margin htw-flex htw-items-center htw-gap-2 htw-pl-4 htw-min-w-0">
42
- <Icon
43
- :icon="story.icon ?? 'carbon:cube'"
44
- class="base-list-item-link-icon htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none"
45
- :class="{
46
- 'htw-text-primary-500': !active && !story.iconColor,
47
- 'bind-icon-color': !active && story.iconColor,
48
- }"
49
- />
50
- <span class="htw-truncate">{{ story.title }}</span>
51
- </span>
52
-
53
- <span
54
- v-if="!story.docsOnly"
55
- class="htw-opacity-40 htw-text-sm"
56
- >
57
- {{ story.variants.length }}
58
- </span>
59
- </BaseListItemLink>
60
- </div>
61
- </template>
62
-
63
- <style scoped>
64
- .bind-tree-margin {
65
- margin-left: v-bind(filePadding);
66
- }
67
-
68
- .bind-icon-color {
69
- color: v-bind('story.iconColor');
70
- }
71
- </style>
@@ -1,30 +0,0 @@
1
- import '$histoire-theme'
2
- import { createApp } from 'vue'
3
- import { createPinia } from 'pinia'
4
- import { FloatingVue } from 'floating-vue'
5
- import App from './App.vue'
6
- import { router } from './router'
7
-
8
- export function mountMainApp () {
9
- const app = createApp(App)
10
- app.use(createPinia())
11
- app.use(FloatingVue, {
12
- overflowPadding: 4,
13
- arrowPadding: 8,
14
- themes: {
15
- tooltip: {
16
- distance: 8,
17
- },
18
- dropdown: {
19
- computeTransformOrigin: true,
20
- distance: 8,
21
- },
22
- },
23
- })
24
- app.use(router)
25
- app.mount('#app')
26
-
27
- if (import.meta.hot) {
28
- import.meta.hot.send('histoire:mount', {})
29
- }
30
- }
@@ -1,29 +0,0 @@
1
- import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
2
- import { histoireConfig } from './util/config'
3
-
4
- export const base = import.meta.env.BASE_URL as string
5
-
6
- function createRouterHistory () {
7
- switch (histoireConfig.routerMode) {
8
- case 'hash': return createWebHashHistory(base)
9
- case 'history':
10
- default:
11
- return createWebHistory(base)
12
- }
13
- }
14
-
15
- export const router = createRouter({
16
- history: createRouterHistory(),
17
- routes: [
18
- {
19
- path: '/',
20
- name: 'home',
21
- component: () => import('./components/HomeView.vue'),
22
- },
23
- {
24
- path: '/story/:storyId',
25
- name: 'story',
26
- component: () => import('./components/story/StoryView.vue'),
27
- },
28
- ],
29
- })
@@ -1,95 +0,0 @@
1
- import { parseQuery } from 'vue-router'
2
- import { computed, createApp, h, onMounted, ref, watch } from 'vue'
3
- import { createPinia } from 'pinia'
4
- import { applyState } from '@histoire/shared'
5
- import { SandboxVue3, MountStoryVue3 } from '@histoire/plugin-vue/client'
6
- import type { StoryFile } from './types'
7
- import { mapFile } from './util/mapping'
8
- // @ts-expect-error virtual module
9
- import { files } from '$histoire-stories'
10
- import { PREVIEW_SETTINGS_SYNC, STATE_SYNC, SANDBOX_READY } from './util/const.js'
11
- import { applyPreviewSettings } from './util/preview-settings.js'
12
- import { isDark } from './util/dark.js'
13
- import { histoireConfig } from './util/config.js'
14
- import { toRawDeep } from './util/state.js'
15
-
16
- const query = parseQuery(window.location.search)
17
- const file = ref<StoryFile>(mapFile(files.find(f => f.id === query.storyId)))
18
-
19
- const app = createApp({
20
- name: 'SandboxApp',
21
-
22
- setup () {
23
- const story = computed(() => file.value.story)
24
- const variant = computed(() => story.value?.variants.find(v => v.id === query.variantId))
25
-
26
- let synced = false
27
- let mounted = false
28
-
29
- window.addEventListener('message', event => {
30
- // console.log('[sandbox] received message', event.data)
31
- if (event.data?.type === STATE_SYNC) {
32
- if (!mounted) return
33
- synced = true
34
- applyState(variant.value.state, event.data.state)
35
- } else if (event.data?.type === PREVIEW_SETTINGS_SYNC) {
36
- applyPreviewSettings(event.data.settings)
37
- }
38
- })
39
-
40
- watch(() => variant.value.state, value => {
41
- if (synced && mounted) {
42
- synced = false
43
- return
44
- }
45
- window.parent?.postMessage({
46
- type: STATE_SYNC,
47
- state: toRawDeep(value),
48
- })
49
- }, {
50
- deep: true,
51
- })
52
-
53
- onMounted(() => {
54
- mounted = true
55
- })
56
-
57
- return {
58
- story,
59
- variant,
60
- }
61
- },
62
-
63
- render () {
64
- return [
65
- h('div', { class: 'htw-sandbox-hidden' }, [
66
- h(MountStoryVue3, {
67
- story: file.value.story,
68
- }),
69
- ]),
70
- this.story && this.variant
71
- ? h(SandboxVue3, {
72
- story: this.story,
73
- variant: this.variant,
74
- onReady: () => {
75
- window.parent?.postMessage({
76
- type: SANDBOX_READY,
77
- })
78
- },
79
- })
80
- : null,
81
- ]
82
- },
83
- })
84
- app.use(createPinia())
85
- app.mount('#app')
86
-
87
- watch(isDark, value => {
88
- if (value) {
89
- document.documentElement.classList.add(histoireConfig.sandboxDarkClass)
90
- } else {
91
- document.documentElement.classList.remove(histoireConfig.sandboxDarkClass)
92
- }
93
- }, {
94
- immediate: true,
95
- })