forgebook 0.0.0-stage → 0.1.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 (493) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -2
  3. package/dist/bin/forgebook/catalogueVite.d.ts +16 -0
  4. package/dist/bin/forgebook/catalogueVite.d.ts.map +1 -0
  5. package/dist/bin/forgebook/catalogueVite.js +15 -0
  6. package/dist/bin/forgebook/catalogueVite.js.map +1 -0
  7. package/dist/bin/forgebook/forgebook.d.mts +3 -0
  8. package/dist/bin/forgebook/forgebook.d.mts.map +1 -0
  9. package/dist/bin/forgebook/forgebook.mjs +93 -0
  10. package/dist/bin/forgebook/forgebook.mjs.map +1 -0
  11. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts +90 -0
  12. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts.map +1 -0
  13. package/dist/bin/forgebook-docs/catalogueDocs.types.js +1 -0
  14. package/dist/bin/forgebook-docs/catalogueDocs.types.js.map +1 -0
  15. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts +9 -0
  16. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts.map +1 -0
  17. package/dist/bin/forgebook-docs/catalogueMarkdown.js +132 -0
  18. package/dist/bin/forgebook-docs/catalogueMarkdown.js.map +1 -0
  19. package/dist/bin/forgebook-docs/collectDocs.d.ts +17 -0
  20. package/dist/bin/forgebook-docs/collectDocs.d.ts.map +1 -0
  21. package/dist/bin/forgebook-docs/collectDocs.js +115 -0
  22. package/dist/bin/forgebook-docs/collectDocs.js.map +1 -0
  23. package/dist/bin/forgebook-docs/forgebook-docs.d.mts +3 -0
  24. package/dist/bin/forgebook-docs/forgebook-docs.d.mts.map +1 -0
  25. package/dist/bin/forgebook-docs/forgebook-docs.mjs +114 -0
  26. package/dist/bin/forgebook-docs/forgebook-docs.mjs.map +1 -0
  27. package/dist/bin/forgebook-docs/moduleDocs.d.ts +9 -0
  28. package/dist/bin/forgebook-docs/moduleDocs.d.ts.map +1 -0
  29. package/dist/bin/forgebook-docs/moduleDocs.js +62 -0
  30. package/dist/bin/forgebook-docs/moduleDocs.js.map +1 -0
  31. package/dist/bin/forgebook-docs/sassDocs.d.ts +20 -0
  32. package/dist/bin/forgebook-docs/sassDocs.d.ts.map +1 -0
  33. package/dist/bin/forgebook-docs/sassDocs.js +77 -0
  34. package/dist/bin/forgebook-docs/sassDocs.js.map +1 -0
  35. package/dist/bin/forgebook-texts/forgebook-texts.d.mts +3 -0
  36. package/dist/bin/forgebook-texts/forgebook-texts.d.mts.map +1 -0
  37. package/dist/bin/forgebook-texts/forgebook-texts.mjs +94 -0
  38. package/dist/bin/forgebook-texts/forgebook-texts.mjs.map +1 -0
  39. package/dist/bin/forgebook-texts/storyTextsReport.d.ts +26 -0
  40. package/dist/bin/forgebook-texts/storyTextsReport.d.ts.map +1 -0
  41. package/dist/bin/forgebook-texts/storyTextsReport.js +35 -0
  42. package/dist/bin/forgebook-texts/storyTextsReport.js.map +1 -0
  43. package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts +25 -0
  44. package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts.map +1 -0
  45. package/dist/bin/forgebook-texts/storyTextsReport.types.js +7 -0
  46. package/dist/bin/forgebook-texts/storyTextsReport.types.js.map +1 -0
  47. package/dist/src/a11y.d.ts +28 -0
  48. package/dist/src/a11y.d.ts.map +1 -0
  49. package/dist/src/a11y.js +29 -0
  50. package/dist/src/a11y.js.map +1 -0
  51. package/dist/src/argTypes.d.ts +114 -0
  52. package/dist/src/argTypes.d.ts.map +1 -0
  53. package/dist/src/argTypes.js +254 -0
  54. package/dist/src/argTypes.js.map +1 -0
  55. package/dist/src/backdrops.d.ts +88 -0
  56. package/dist/src/backdrops.d.ts.map +1 -0
  57. package/dist/src/backdrops.js +202 -0
  58. package/dist/src/backdrops.js.map +1 -0
  59. package/dist/src/catalogue.d.ts +120 -0
  60. package/dist/src/catalogue.d.ts.map +1 -0
  61. package/dist/src/catalogue.js +80 -0
  62. package/dist/src/catalogue.js.map +1 -0
  63. package/dist/src/componentDocs.d.ts +98 -0
  64. package/dist/src/componentDocs.d.ts.map +1 -0
  65. package/dist/src/componentDocs.js +47 -0
  66. package/dist/src/componentDocs.js.map +1 -0
  67. package/dist/src/frame/checkStory.d.ts +20 -0
  68. package/dist/src/frame/checkStory.d.ts.map +1 -0
  69. package/dist/src/frame/checkStory.js +31 -0
  70. package/dist/src/frame/checkStory.js.map +1 -0
  71. package/dist/src/frame/frame.css +51 -0
  72. package/dist/src/frame/frameClock.d.ts +53 -0
  73. package/dist/src/frame/frameClock.d.ts.map +1 -0
  74. package/dist/src/frame/frameClock.js +80 -0
  75. package/dist/src/frame/frameClock.js.map +1 -0
  76. package/dist/src/frame/frameStatus.d.ts +8 -0
  77. package/dist/src/frame/frameStatus.d.ts.map +1 -0
  78. package/dist/src/frame/frameStatus.js +8 -0
  79. package/dist/src/frame/frameStatus.js.map +1 -0
  80. package/dist/src/frame/frameView.d.ts +33 -0
  81. package/dist/src/frame/frameView.d.ts.map +1 -0
  82. package/dist/src/frame/frameView.js +134 -0
  83. package/dist/src/frame/frameView.js.map +1 -0
  84. package/dist/src/frame/matrixLayout.d.ts +36 -0
  85. package/dist/src/frame/matrixLayout.d.ts.map +1 -0
  86. package/dist/src/frame/matrixLayout.js +87 -0
  87. package/dist/src/frame/matrixLayout.js.map +1 -0
  88. package/dist/src/frame/measureTools.d.ts +24 -0
  89. package/dist/src/frame/measureTools.d.ts.map +1 -0
  90. package/dist/src/frame/measureTools.js +141 -0
  91. package/dist/src/frame/measureTools.js.map +1 -0
  92. package/dist/src/frame/mountFrame.d.ts +47 -0
  93. package/dist/src/frame/mountFrame.d.ts.map +1 -0
  94. package/dist/src/frame/mountFrame.js +229 -0
  95. package/dist/src/frame/mountFrame.js.map +1 -0
  96. package/dist/src/frame/playStory.d.ts +40 -0
  97. package/dist/src/frame/playStory.d.ts.map +1 -0
  98. package/dist/src/frame/playStory.js +55 -0
  99. package/dist/src/frame/playStory.js.map +1 -0
  100. package/dist/src/frame/renderer.d.ts +85 -0
  101. package/dist/src/frame/renderer.d.ts.map +1 -0
  102. package/dist/src/frame/renderer.js +18 -0
  103. package/dist/src/frame/renderer.js.map +1 -0
  104. package/dist/src/frame/settle.d.ts +24 -0
  105. package/dist/src/frame/settle.d.ts.map +1 -0
  106. package/dist/src/frame/settle.js +25 -0
  107. package/dist/src/frame/settle.js.map +1 -0
  108. package/dist/src/frame/staleModule.d.ts +40 -0
  109. package/dist/src/frame/staleModule.d.ts.map +1 -0
  110. package/dist/src/frame/staleModule.js +74 -0
  111. package/dist/src/frame/staleModule.js.map +1 -0
  112. package/dist/src/frame/storyCanvas.d.ts +21 -0
  113. package/dist/src/frame/storyCanvas.d.ts.map +1 -0
  114. package/dist/src/frame/storyCanvas.js +30 -0
  115. package/dist/src/frame/storyCanvas.js.map +1 -0
  116. package/dist/src/frame/storyHooks.d.ts +31 -0
  117. package/dist/src/frame/storyHooks.d.ts.map +1 -0
  118. package/dist/src/frame/storyHooks.js +59 -0
  119. package/dist/src/frame/storyHooks.js.map +1 -0
  120. package/dist/src/frame/storyModule.d.ts +104 -0
  121. package/dist/src/frame/storyModule.d.ts.map +1 -0
  122. package/dist/src/frame/storyModule.js +205 -0
  123. package/dist/src/frame/storyModule.js.map +1 -0
  124. package/dist/src/frame/storyRun.d.ts +96 -0
  125. package/dist/src/frame/storyRun.d.ts.map +1 -0
  126. package/dist/src/frame/storyRun.js +318 -0
  127. package/dist/src/frame/storyRun.js.map +1 -0
  128. package/dist/src/languages.d.ts +15 -0
  129. package/dist/src/languages.d.ts.map +1 -0
  130. package/dist/src/languages.js +8 -0
  131. package/dist/src/languages.js.map +1 -0
  132. package/dist/src/matrix.d.ts +56 -0
  133. package/dist/src/matrix.d.ts.map +1 -0
  134. package/dist/src/matrix.js +61 -0
  135. package/dist/src/matrix.js.map +1 -0
  136. package/dist/src/messages.d.ts +203 -0
  137. package/dist/src/messages.d.ts.map +1 -0
  138. package/dist/src/messages.js +193 -0
  139. package/dist/src/messages.js.map +1 -0
  140. package/dist/src/namedValues.d.ts +38 -0
  141. package/dist/src/namedValues.d.ts.map +1 -0
  142. package/dist/src/namedValues.js +48 -0
  143. package/dist/src/namedValues.js.map +1 -0
  144. package/dist/src/pageConfig.d.ts +23 -0
  145. package/dist/src/pageConfig.d.ts.map +1 -0
  146. package/dist/src/pageConfig.js +1 -0
  147. package/dist/src/pageConfig.js.map +1 -0
  148. package/dist/src/playTrace.d.ts +41 -0
  149. package/dist/src/playTrace.d.ts.map +1 -0
  150. package/dist/src/playTrace.js +35 -0
  151. package/dist/src/playTrace.js.map +1 -0
  152. package/dist/src/shell/A11yTab.d.ts +44 -0
  153. package/dist/src/shell/A11yTab.d.ts.map +1 -0
  154. package/dist/src/shell/A11yTab.js +30 -0
  155. package/dist/src/shell/A11yTab.js.map +1 -0
  156. package/dist/src/shell/ApiReference.d.ts +18 -0
  157. package/dist/src/shell/ApiReference.d.ts.map +1 -0
  158. package/dist/src/shell/ApiReference.js +41 -0
  159. package/dist/src/shell/ApiReference.js.map +1 -0
  160. package/dist/src/shell/ClockControls.d.ts +43 -0
  161. package/dist/src/shell/ClockControls.d.ts.map +1 -0
  162. package/dist/src/shell/ClockControls.js +53 -0
  163. package/dist/src/shell/ClockControls.js.map +1 -0
  164. package/dist/src/shell/Code.d.ts +16 -0
  165. package/dist/src/shell/Code.d.ts.map +1 -0
  166. package/dist/src/shell/Code.js +9 -0
  167. package/dist/src/shell/Code.js.map +1 -0
  168. package/dist/src/shell/CodeTab.d.ts +17 -0
  169. package/dist/src/shell/CodeTab.d.ts.map +1 -0
  170. package/dist/src/shell/CodeTab.js +17 -0
  171. package/dist/src/shell/CodeTab.js.map +1 -0
  172. package/dist/src/shell/CodeText.d.ts +16 -0
  173. package/dist/src/shell/CodeText.d.ts.map +1 -0
  174. package/dist/src/shell/CodeText.js +10 -0
  175. package/dist/src/shell/CodeText.js.map +1 -0
  176. package/dist/src/shell/ComponentPage.d.ts +38 -0
  177. package/dist/src/shell/ComponentPage.d.ts.map +1 -0
  178. package/dist/src/shell/ComponentPage.js +146 -0
  179. package/dist/src/shell/ComponentPage.js.map +1 -0
  180. package/dist/src/shell/Dock.d.ts +42 -0
  181. package/dist/src/shell/Dock.d.ts.map +1 -0
  182. package/dist/src/shell/Dock.js +90 -0
  183. package/dist/src/shell/Dock.js.map +1 -0
  184. package/dist/src/shell/EventsTab.d.ts +25 -0
  185. package/dist/src/shell/EventsTab.d.ts.map +1 -0
  186. package/dist/src/shell/EventsTab.js +26 -0
  187. package/dist/src/shell/EventsTab.js.map +1 -0
  188. package/dist/src/shell/FrameView.d.ts +49 -0
  189. package/dist/src/shell/FrameView.d.ts.map +1 -0
  190. package/dist/src/shell/FrameView.js +29 -0
  191. package/dist/src/shell/FrameView.js.map +1 -0
  192. package/dist/src/shell/HomePage.d.ts +39 -0
  193. package/dist/src/shell/HomePage.d.ts.map +1 -0
  194. package/dist/src/shell/HomePage.js +85 -0
  195. package/dist/src/shell/HomePage.js.map +1 -0
  196. package/dist/src/shell/InteractionsTab.d.ts +28 -0
  197. package/dist/src/shell/InteractionsTab.d.ts.map +1 -0
  198. package/dist/src/shell/InteractionsTab.js +17 -0
  199. package/dist/src/shell/InteractionsTab.js.map +1 -0
  200. package/dist/src/shell/MatrixPicker.d.ts +24 -0
  201. package/dist/src/shell/MatrixPicker.d.ts.map +1 -0
  202. package/dist/src/shell/MatrixPicker.js +29 -0
  203. package/dist/src/shell/MatrixPicker.js.map +1 -0
  204. package/dist/src/shell/PackageHtml.d.ts +17 -0
  205. package/dist/src/shell/PackageHtml.d.ts.map +1 -0
  206. package/dist/src/shell/PackageHtml.js +13 -0
  207. package/dist/src/shell/PackageHtml.js.map +1 -0
  208. package/dist/src/shell/PartsTab.d.ts +23 -0
  209. package/dist/src/shell/PartsTab.d.ts.map +1 -0
  210. package/dist/src/shell/PartsTab.js +23 -0
  211. package/dist/src/shell/PartsTab.js.map +1 -0
  212. package/dist/src/shell/PropFields.d.ts +31 -0
  213. package/dist/src/shell/PropFields.d.ts.map +1 -0
  214. package/dist/src/shell/PropFields.js +81 -0
  215. package/dist/src/shell/PropFields.js.map +1 -0
  216. package/dist/src/shell/PropsTab.d.ts +45 -0
  217. package/dist/src/shell/PropsTab.d.ts.map +1 -0
  218. package/dist/src/shell/PropsTab.js +81 -0
  219. package/dist/src/shell/PropsTab.js.map +1 -0
  220. package/dist/src/shell/SchemeSwitches.d.ts +24 -0
  221. package/dist/src/shell/SchemeSwitches.d.ts.map +1 -0
  222. package/dist/src/shell/SchemeSwitches.js +36 -0
  223. package/dist/src/shell/SchemeSwitches.js.map +1 -0
  224. package/dist/src/shell/Segmented.d.ts +41 -0
  225. package/dist/src/shell/Segmented.d.ts.map +1 -0
  226. package/dist/src/shell/Segmented.js +19 -0
  227. package/dist/src/shell/Segmented.js.map +1 -0
  228. package/dist/src/shell/Shell.d.ts +49 -0
  229. package/dist/src/shell/Shell.d.ts.map +1 -0
  230. package/dist/src/shell/Shell.js +279 -0
  231. package/dist/src/shell/Shell.js.map +1 -0
  232. package/dist/src/shell/Sidebar.d.ts +52 -0
  233. package/dist/src/shell/Sidebar.d.ts.map +1 -0
  234. package/dist/src/shell/Sidebar.js +132 -0
  235. package/dist/src/shell/Sidebar.js.map +1 -0
  236. package/dist/src/shell/SidebarHandle.d.ts +29 -0
  237. package/dist/src/shell/SidebarHandle.d.ts.map +1 -0
  238. package/dist/src/shell/SidebarHandle.js +46 -0
  239. package/dist/src/shell/SidebarHandle.js.map +1 -0
  240. package/dist/src/shell/Stage.d.ts +68 -0
  241. package/dist/src/shell/Stage.d.ts.map +1 -0
  242. package/dist/src/shell/Stage.js +218 -0
  243. package/dist/src/shell/Stage.js.map +1 -0
  244. package/dist/src/shell/StageTools.d.ts +27 -0
  245. package/dist/src/shell/StageTools.d.ts.map +1 -0
  246. package/dist/src/shell/StageTools.js +34 -0
  247. package/dist/src/shell/StageTools.js.map +1 -0
  248. package/dist/src/shell/StageViewport.d.ts +46 -0
  249. package/dist/src/shell/StageViewport.d.ts.map +1 -0
  250. package/dist/src/shell/StageViewport.js +173 -0
  251. package/dist/src/shell/StageViewport.js.map +1 -0
  252. package/dist/src/shell/StoryCodeBlock.d.ts +35 -0
  253. package/dist/src/shell/StoryCodeBlock.d.ts.map +1 -0
  254. package/dist/src/shell/StoryCodeBlock.js +27 -0
  255. package/dist/src/shell/StoryCodeBlock.js.map +1 -0
  256. package/dist/src/shell/StoryPicker.d.ts +26 -0
  257. package/dist/src/shell/StoryPicker.d.ts.map +1 -0
  258. package/dist/src/shell/StoryPicker.js +32 -0
  259. package/dist/src/shell/StoryPicker.js.map +1 -0
  260. package/dist/src/shell/Toolbar.d.ts +40 -0
  261. package/dist/src/shell/Toolbar.d.ts.map +1 -0
  262. package/dist/src/shell/Toolbar.js +125 -0
  263. package/dist/src/shell/Toolbar.js.map +1 -0
  264. package/dist/src/shell/WidthField.d.ts +24 -0
  265. package/dist/src/shell/WidthField.d.ts.map +1 -0
  266. package/dist/src/shell/WidthField.js +40 -0
  267. package/dist/src/shell/WidthField.js.map +1 -0
  268. package/dist/src/shell/catalogueContext.d.ts +6 -0
  269. package/dist/src/shell/catalogueContext.d.ts.map +1 -0
  270. package/dist/src/shell/catalogueContext.js +14 -0
  271. package/dist/src/shell/catalogueContext.js.map +1 -0
  272. package/dist/src/shell/codeTokens.d.ts +23 -0
  273. package/dist/src/shell/codeTokens.d.ts.map +1 -0
  274. package/dist/src/shell/codeTokens.js +48 -0
  275. package/dist/src/shell/codeTokens.js.map +1 -0
  276. package/dist/src/shell/codeWriter.d.ts +6 -0
  277. package/dist/src/shell/codeWriter.d.ts.map +1 -0
  278. package/dist/src/shell/codeWriter.js +14 -0
  279. package/dist/src/shell/codeWriter.js.map +1 -0
  280. package/dist/src/shell/compareVariants.d.ts +35 -0
  281. package/dist/src/shell/compareVariants.d.ts.map +1 -0
  282. package/dist/src/shell/compareVariants.js +68 -0
  283. package/dist/src/shell/compareVariants.js.map +1 -0
  284. package/dist/src/shell/dockTabs.d.ts +63 -0
  285. package/dist/src/shell/dockTabs.d.ts.map +1 -0
  286. package/dist/src/shell/dockTabs.js +140 -0
  287. package/dist/src/shell/dockTabs.js.map +1 -0
  288. package/dist/src/shell/icons.d.ts +47 -0
  289. package/dist/src/shell/icons.d.ts.map +1 -0
  290. package/dist/src/shell/icons.js +36 -0
  291. package/dist/src/shell/icons.js.map +1 -0
  292. package/dist/src/shell/keyboard.d.ts +35 -0
  293. package/dist/src/shell/keyboard.d.ts.map +1 -0
  294. package/dist/src/shell/keyboard.js +51 -0
  295. package/dist/src/shell/keyboard.js.map +1 -0
  296. package/dist/src/shell/mountShell.d.ts +22 -0
  297. package/dist/src/shell/mountShell.d.ts.map +1 -0
  298. package/dist/src/shell/mountShell.js +39 -0
  299. package/dist/src/shell/mountShell.js.map +1 -0
  300. package/dist/src/shell/shell.css +1831 -0
  301. package/dist/src/shell/strings.d.ts +184 -0
  302. package/dist/src/shell/strings.d.ts.map +1 -0
  303. package/dist/src/shell/strings.js +188 -0
  304. package/dist/src/shell/strings.js.map +1 -0
  305. package/dist/src/shell/switchView.d.ts +23 -0
  306. package/dist/src/shell/switchView.d.ts.map +1 -0
  307. package/dist/src/shell/switchView.js +19 -0
  308. package/dist/src/shell/switchView.js.map +1 -0
  309. package/dist/src/shell/treeSearch.d.ts +35 -0
  310. package/dist/src/shell/treeSearch.d.ts.map +1 -0
  311. package/dist/src/shell/treeSearch.js +60 -0
  312. package/dist/src/shell/treeSearch.js.map +1 -0
  313. package/dist/src/shell/useComponentDocs.d.ts +16 -0
  314. package/dist/src/shell/useComponentDocs.d.ts.map +1 -0
  315. package/dist/src/shell/useComponentDocs.js +25 -0
  316. package/dist/src/shell/useComponentDocs.js.map +1 -0
  317. package/dist/src/shell/useCopy.d.ts +10 -0
  318. package/dist/src/shell/useCopy.d.ts.map +1 -0
  319. package/dist/src/shell/useCopy.js +23 -0
  320. package/dist/src/shell/useCopy.js.map +1 -0
  321. package/dist/src/shell/useFrameMessages.d.ts +54 -0
  322. package/dist/src/shell/useFrameMessages.d.ts.map +1 -0
  323. package/dist/src/shell/useFrameMessages.js +90 -0
  324. package/dist/src/shell/useFrameMessages.js.map +1 -0
  325. package/dist/src/shell/useFrameQueue.d.ts +29 -0
  326. package/dist/src/shell/useFrameQueue.d.ts.map +1 -0
  327. package/dist/src/shell/useFrameQueue.js +72 -0
  328. package/dist/src/shell/useFrameQueue.js.map +1 -0
  329. package/dist/src/shell/useLiveView.d.ts +29 -0
  330. package/dist/src/shell/useLiveView.d.ts.map +1 -0
  331. package/dist/src/shell/useLiveView.js +51 -0
  332. package/dist/src/shell/useLiveView.js.map +1 -0
  333. package/dist/src/shell/useLoaded.d.ts +20 -0
  334. package/dist/src/shell/useLoaded.d.ts.map +1 -0
  335. package/dist/src/shell/useLoaded.js +40 -0
  336. package/dist/src/shell/useLoaded.js.map +1 -0
  337. package/dist/src/shell/usePageDoc.d.ts +20 -0
  338. package/dist/src/shell/usePageDoc.d.ts.map +1 -0
  339. package/dist/src/shell/usePageDoc.js +21 -0
  340. package/dist/src/shell/usePageDoc.js.map +1 -0
  341. package/dist/src/shell/usePopover.d.ts +23 -0
  342. package/dist/src/shell/usePopover.d.ts.map +1 -0
  343. package/dist/src/shell/usePopover.js +39 -0
  344. package/dist/src/shell/usePopover.js.map +1 -0
  345. package/dist/src/shell/useRecentPages.d.ts +21 -0
  346. package/dist/src/shell/useRecentPages.d.ts.map +1 -0
  347. package/dist/src/shell/useRecentPages.js +62 -0
  348. package/dist/src/shell/useRecentPages.js.map +1 -0
  349. package/dist/src/shell/useScrollMemory.d.ts +40 -0
  350. package/dist/src/shell/useScrollMemory.d.ts.map +1 -0
  351. package/dist/src/shell/useScrollMemory.js +69 -0
  352. package/dist/src/shell/useScrollMemory.js.map +1 -0
  353. package/dist/src/shell/useSidebarLayout.d.ts +14 -0
  354. package/dist/src/shell/useSidebarLayout.d.ts.map +1 -0
  355. package/dist/src/shell/useSidebarLayout.js +19 -0
  356. package/dist/src/shell/useSidebarLayout.js.map +1 -0
  357. package/dist/src/shell/useStored.d.ts +11 -0
  358. package/dist/src/shell/useStored.d.ts.map +1 -0
  359. package/dist/src/shell/useStored.js +68 -0
  360. package/dist/src/shell/useStored.js.map +1 -0
  361. package/dist/src/shell/useStoryCode.d.ts +14 -0
  362. package/dist/src/shell/useStoryCode.d.ts.map +1 -0
  363. package/dist/src/shell/useStoryCode.js +29 -0
  364. package/dist/src/shell/useStoryCode.js.map +1 -0
  365. package/dist/src/shell/useStoryHeights.d.ts +9 -0
  366. package/dist/src/shell/useStoryHeights.d.ts.map +1 -0
  367. package/dist/src/shell/useStoryHeights.js +31 -0
  368. package/dist/src/shell/useStoryHeights.js.map +1 -0
  369. package/dist/src/shell/useStoryIdsElement.d.ts +7 -0
  370. package/dist/src/shell/useStoryIdsElement.d.ts.map +1 -0
  371. package/dist/src/shell/useStoryIdsElement.js +29 -0
  372. package/dist/src/shell/useStoryIdsElement.js.map +1 -0
  373. package/dist/src/shell/useStoryKeys.d.ts +11 -0
  374. package/dist/src/shell/useStoryKeys.d.ts.map +1 -0
  375. package/dist/src/shell/useStoryKeys.js +40 -0
  376. package/dist/src/shell/useStoryKeys.js.map +1 -0
  377. package/dist/src/shell/useSystemDark.d.ts +3 -0
  378. package/dist/src/shell/useSystemDark.d.ts.map +1 -0
  379. package/dist/src/shell/useSystemDark.js +19 -0
  380. package/dist/src/shell/useSystemDark.js.map +1 -0
  381. package/dist/src/sourceFiles.d.ts +18 -0
  382. package/dist/src/sourceFiles.d.ts.map +1 -0
  383. package/dist/src/sourceFiles.js +22 -0
  384. package/dist/src/sourceFiles.js.map +1 -0
  385. package/dist/src/storyBackground.d.ts +21 -0
  386. package/dist/src/storyBackground.d.ts.map +1 -0
  387. package/dist/src/storyBackground.js +27 -0
  388. package/dist/src/storyBackground.js.map +1 -0
  389. package/dist/src/storyClock.d.ts +62 -0
  390. package/dist/src/storyClock.d.ts.map +1 -0
  391. package/dist/src/storyClock.js +51 -0
  392. package/dist/src/storyClock.js.map +1 -0
  393. package/dist/src/storyGlobals.d.ts +60 -0
  394. package/dist/src/storyGlobals.d.ts.map +1 -0
  395. package/dist/src/storyGlobals.js +117 -0
  396. package/dist/src/storyGlobals.js.map +1 -0
  397. package/dist/src/storyHeights.d.ts +37 -0
  398. package/dist/src/storyHeights.d.ts.map +1 -0
  399. package/dist/src/storyHeights.js +53 -0
  400. package/dist/src/storyHeights.js.map +1 -0
  401. package/dist/src/storyIdsElement.d.ts +9 -0
  402. package/dist/src/storyIdsElement.d.ts.map +1 -0
  403. package/dist/src/storyIdsElement.js +9 -0
  404. package/dist/src/storyIdsElement.js.map +1 -0
  405. package/dist/src/storyTexts.d.ts +43 -0
  406. package/dist/src/storyTexts.d.ts.map +1 -0
  407. package/dist/src/storyTexts.js +71 -0
  408. package/dist/src/storyTexts.js.map +1 -0
  409. package/dist/src/storyTree.d.ts +215 -0
  410. package/dist/src/storyTree.d.ts.map +1 -0
  411. package/dist/src/storyTree.js +308 -0
  412. package/dist/src/storyTree.js.map +1 -0
  413. package/dist/src/switches.d.ts +156 -0
  414. package/dist/src/switches.d.ts.map +1 -0
  415. package/dist/src/switches.js +193 -0
  416. package/dist/src/switches.js.map +1 -0
  417. package/dist/src/viewState.d.ts +194 -0
  418. package/dist/src/viewState.d.ts.map +1 -0
  419. package/dist/src/viewState.js +303 -0
  420. package/dist/src/viewState.js.map +1 -0
  421. package/dist/src/vite/adapter.d.ts +70 -0
  422. package/dist/src/vite/adapter.d.ts.map +1 -0
  423. package/dist/src/vite/adapter.js +22 -0
  424. package/dist/src/vite/adapter.js.map +1 -0
  425. package/dist/src/vite/autoTitle.d.ts +28 -0
  426. package/dist/src/vite/autoTitle.d.ts.map +1 -0
  427. package/dist/src/vite/autoTitle.js +44 -0
  428. package/dist/src/vite/autoTitle.js.map +1 -0
  429. package/dist/src/vite/componentPage.d.ts +34 -0
  430. package/dist/src/vite/componentPage.d.ts.map +1 -0
  431. package/dist/src/vite/componentPage.js +94 -0
  432. package/dist/src/vite/componentPage.js.map +1 -0
  433. package/dist/src/vite/config.d.ts +72 -0
  434. package/dist/src/vite/config.d.ts.map +1 -0
  435. package/dist/src/vite/config.js +25 -0
  436. package/dist/src/vite/config.js.map +1 -0
  437. package/dist/src/vite/configFile.d.ts +76 -0
  438. package/dist/src/vite/configFile.d.ts.map +1 -0
  439. package/dist/src/vite/configFile.js +190 -0
  440. package/dist/src/vite/configFile.js.map +1 -0
  441. package/dist/src/vite/docsExtractor.d.ts +46 -0
  442. package/dist/src/vite/docsExtractor.d.ts.map +1 -0
  443. package/dist/src/vite/docsExtractor.js +88 -0
  444. package/dist/src/vite/docsExtractor.js.map +1 -0
  445. package/dist/src/vite/docsProgram.d.ts +42 -0
  446. package/dist/src/vite/docsProgram.d.ts.map +1 -0
  447. package/dist/src/vite/docsProgram.js +144 -0
  448. package/dist/src/vite/docsProgram.js.map +1 -0
  449. package/dist/src/vite/docsWorker.d.ts +2 -0
  450. package/dist/src/vite/docsWorker.d.ts.map +1 -0
  451. package/dist/src/vite/docsWorker.js +68 -0
  452. package/dist/src/vite/docsWorker.js.map +1 -0
  453. package/dist/src/vite/forcedStates.d.ts +27 -0
  454. package/dist/src/vite/forcedStates.d.ts.map +1 -0
  455. package/dist/src/vite/forcedStates.js +60 -0
  456. package/dist/src/vite/forcedStates.js.map +1 -0
  457. package/dist/src/vite/forgebookPlugin.d.ts +28 -0
  458. package/dist/src/vite/forgebookPlugin.d.ts.map +1 -0
  459. package/dist/src/vite/forgebookPlugin.js +375 -0
  460. package/dist/src/vite/forgebookPlugin.js.map +1 -0
  461. package/dist/src/vite/highlightCode.d.ts +16 -0
  462. package/dist/src/vite/highlightCode.d.ts.map +1 -0
  463. package/dist/src/vite/highlightCode.js +82 -0
  464. package/dist/src/vite/highlightCode.js.map +1 -0
  465. package/dist/src/vite/indexStoryFile.d.ts +35 -0
  466. package/dist/src/vite/indexStoryFile.d.ts.map +1 -0
  467. package/dist/src/vite/indexStoryFile.js +458 -0
  468. package/dist/src/vite/indexStoryFile.js.map +1 -0
  469. package/dist/src/vite/pages.d.ts +49 -0
  470. package/dist/src/vite/pages.d.ts.map +1 -0
  471. package/dist/src/vite/pages.js +171 -0
  472. package/dist/src/vite/pages.js.map +1 -0
  473. package/dist/src/vite/prebundled.d.ts +30 -0
  474. package/dist/src/vite/prebundled.d.ts.map +1 -0
  475. package/dist/src/vite/prebundled.js +81 -0
  476. package/dist/src/vite/prebundled.js.map +1 -0
  477. package/dist/src/vite/storyCode.d.ts +28 -0
  478. package/dist/src/vite/storyCode.d.ts.map +1 -0
  479. package/dist/src/vite/storyCode.js +80 -0
  480. package/dist/src/vite/storyCode.js.map +1 -0
  481. package/dist/src/vite/storyFilesModule.d.ts +17 -0
  482. package/dist/src/vite/storyFilesModule.d.ts.map +1 -0
  483. package/dist/src/vite/storyFilesModule.js +64 -0
  484. package/dist/src/vite/storyFilesModule.js.map +1 -0
  485. package/dist/src/vite/storyMeta.d.ts +34 -0
  486. package/dist/src/vite/storyMeta.d.ts.map +1 -0
  487. package/dist/src/vite/storyMeta.js +74 -0
  488. package/dist/src/vite/storyMeta.js.map +1 -0
  489. package/dist/src/vite/typeScriptPieces.d.ts +23 -0
  490. package/dist/src/vite/typeScriptPieces.d.ts.map +1 -0
  491. package/dist/src/vite/typeScriptPieces.js +236 -0
  492. package/dist/src/vite/typeScriptPieces.js.map +1 -0
  493. package/package.json +202 -3
@@ -0,0 +1,205 @@
1
+ /**
2
+ * A loaded story file read safely: the module is code the catalogue did not type-check against its own types, so
3
+ * every part the frame uses is checked before use.
4
+ *
5
+ * @remarks
6
+ * Objects, strings and lists are checked for their shape; a function's parameters cannot be checked at run time, so a
7
+ * function is taken with the signature CSF gives it (a render, a play function, a decorator). What a render and a
8
+ * decorator return is the framework's (`unknown` here); its renderer draws it. The meta's component is the framework's
9
+ * too: a function, or an object some frameworks make one of (React's `memo` and `forwardRef`), so the frame passes on
10
+ * whatever the meta names and the renderer reads it.
11
+ *
12
+ * A story is an object (CSF 3) or a function (CSF 2: the function is its render, its args and parameters are
13
+ * properties assigned to it). The meta may give the render and the play function every story without its own uses.
14
+ *
15
+ * @module
16
+ */
17
+ import { controlsOfParameter, mergedArgTypes } from "../argTypes.js";
18
+ /** Whether a value is a plain object. */
19
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
20
+ /**
21
+ * A story's fields: a CSF 3 story's object, or a CSF 2 story's function with the properties assigned to it.
22
+ *
23
+ * @param story - the named export.
24
+ */
25
+ const storyFieldsOf = (story) => {
26
+ if (isRecord(story))
27
+ return story;
28
+ if (typeof story !== "function")
29
+ return undefined;
30
+ // a function story's properties are its own: `Primary.args = …` sets them on the function itself
31
+ const fields = { render: story };
32
+ for (const name of Object.keys(story))
33
+ fields[name] = Reflect.get(story, name);
34
+ return fields;
35
+ };
36
+ /** Whether a value can be called as a component, a render, a play function or a decorator. */
37
+ const isFunction = (value) => typeof value === "function";
38
+ /** An object's parameters, when it has some. */
39
+ const parametersOf = (part) => {
40
+ const parameters = part["parameters"];
41
+ return isRecord(parameters) ? parameters : {};
42
+ };
43
+ /** The forced states a parameter lists. */
44
+ const forcedStates = (value) => {
45
+ const states = Array.isArray(value) ? value : [value];
46
+ return states.filter((state) => state === "hover" ||
47
+ state === "active" ||
48
+ state === "focus" ||
49
+ state === "focus-visible" ||
50
+ state === "focus-within");
51
+ };
52
+ /** A replay parameter, when valid. */
53
+ const replayMode = (value) => {
54
+ if (value === "remount")
55
+ return value;
56
+ if (isRecord(value) && typeof value["toggle"] === "string") {
57
+ const hold = value["hold"];
58
+ return typeof hold === "number" && hold > 0
59
+ ? { toggle: value["toggle"], hold }
60
+ : { toggle: value["toggle"] };
61
+ }
62
+ return undefined;
63
+ };
64
+ /** A clock parameter's start, when it names a valid instant. */
65
+ const clockStartOf = (value) => {
66
+ if (!isRecord(value) || typeof value["start"] !== "string")
67
+ return undefined;
68
+ const start = Date.parse(value["start"]);
69
+ return Number.isNaN(start) ? undefined : start;
70
+ };
71
+ /** The decorators of a part. */
72
+ const decoratorsOf = (part) => {
73
+ const decorators = part["decorators"];
74
+ return Array.isArray(decorators) ? decorators.filter((isFunction)) : [];
75
+ };
76
+ /**
77
+ * The functions a part writes under a name, one or a list (CSF's `loaders` and `beforeEach` take either).
78
+ *
79
+ * @param part - the meta, the story or the preview.
80
+ * @param name - the field.
81
+ */
82
+ const functionsOf = (part, name) => {
83
+ const value = part[name];
84
+ const list = Array.isArray(value) ? value : [value];
85
+ return list.filter((isFunction));
86
+ };
87
+ /**
88
+ * A function the story names, or else the meta's.
89
+ *
90
+ * @param story - the story's fields.
91
+ * @param meta - the meta.
92
+ * @param name - the field (`render`, `play`).
93
+ */
94
+ const ownOrMeta = (story, meta, name) => {
95
+ const own = story[name];
96
+ if (isFunction(own))
97
+ return own;
98
+ const fromMeta = meta[name];
99
+ return isFunction(fromMeta) ? fromMeta : undefined;
100
+ };
101
+ /**
102
+ * The meta and one story of a loaded module, merged.
103
+ *
104
+ * @param module - the module, as `import()` gave it.
105
+ * @param exportName - the story's named export.
106
+ * @param preview - the catalogue's preview: its parameters under the meta's and the story's, its loaders and set-ups
107
+ * before theirs (its decorators are the renderer's to put outside); none by default.
108
+ * @returns what the frame renders, or why it cannot.
109
+ */
110
+ export const readStory = (module, exportName, preview = NO_PREVIEW) => {
111
+ if (!isRecord(module))
112
+ return "The story file did not load as a module";
113
+ const meta = module["default"];
114
+ const story = storyFieldsOf(module[exportName]);
115
+ if (!isRecord(meta))
116
+ return "The story file has no meta (its default export)";
117
+ if (story === undefined)
118
+ return `The story file has no story "${exportName}"`;
119
+ const metaArgs = isRecord(meta["args"]) ? meta["args"] : {};
120
+ const storyArgs = isRecord(story["args"]) ? story["args"] : {};
121
+ const parameters = { ...preview.parameters, ...parametersOf(meta), ...parametersOf(story) };
122
+ const layout = parameters["layout"];
123
+ return {
124
+ component: meta["component"] ?? undefined,
125
+ args: { ...preview.args, ...metaArgs, ...storyArgs },
126
+ render: ownOrMeta(story, meta, "render"),
127
+ play: ownOrMeta(story, meta, "play"),
128
+ decorators: [...decoratorsOf(story), ...decoratorsOf(meta)],
129
+ loaders: [
130
+ ...preview.loaders,
131
+ ...functionsOf(meta, "loaders"),
132
+ ...functionsOf(story, "loaders")
133
+ ],
134
+ beforeEach: [
135
+ ...preview.beforeEach,
136
+ ...functionsOf(meta, "beforeEach"),
137
+ ...functionsOf(story, "beforeEach")
138
+ ],
139
+ forceState: forcedStates(parameters["forceState"]),
140
+ parameters,
141
+ replay: replayMode(parameters["replay"]),
142
+ controls: controlsOfParameter(parameters["controls"]),
143
+ argTypes: mergedArgTypes(mergedArgTypes(preview.argTypes, meta["argTypes"]), story["argTypes"]),
144
+ globals: {
145
+ ...(isRecord(meta["globals"]) ? meta["globals"] : {}),
146
+ ...(isRecord(story["globals"]) ? story["globals"] : {})
147
+ },
148
+ layout: layout === "centered" || layout === "fullscreen" ? layout : "padded",
149
+ clockStart: clockStartOf(parameters["clock"])
150
+ };
151
+ };
152
+ /** The preview of a catalogue that has none. */
153
+ export const NO_PREVIEW = {
154
+ decorators: [],
155
+ loaders: [],
156
+ beforeEach: [],
157
+ args: {},
158
+ argTypes: {},
159
+ parameters: {},
160
+ setup: undefined
161
+ };
162
+ /**
163
+ * A catalogue's preview read safely, as a story file is: from the default export of its module, or the module itself.
164
+ *
165
+ * @param module - the preview's module, as `import()` gave it; none for a catalogue without one.
166
+ */
167
+ export const readPreview = (module) => {
168
+ if (!isRecord(module))
169
+ return NO_PREVIEW;
170
+ const preview = isRecord(module["default"]) ? module["default"] : module;
171
+ const setup = preview["setup"];
172
+ return {
173
+ decorators: decoratorsOf(preview),
174
+ loaders: functionsOf(preview, "loaders"),
175
+ beforeEach: functionsOf(preview, "beforeEach"),
176
+ args: isRecord(preview["args"]) ? preview["args"] : {},
177
+ argTypes: isRecord(preview["argTypes"]) ? preview["argTypes"] : {},
178
+ parameters: parametersOf(preview),
179
+ setup: isFunction(setup) ? setup : undefined
180
+ };
181
+ };
182
+ /**
183
+ * Previews read one after another, as a catalogue's presets and its own: decorators of the later ones outside the
184
+ * earlier ones', parameters of the later ones over the earlier ones', every setup, loader and set-up in order.
185
+ *
186
+ * @param previews - the previews, the catalogue's own last.
187
+ */
188
+ export const mergedPreviews = (previews) => {
189
+ const setups = previews.flatMap((preview) => (preview.setup === undefined ? [] : [preview.setup]));
190
+ return {
191
+ decorators: previews.flatMap((preview) => preview.decorators),
192
+ loaders: previews.flatMap((preview) => preview.loaders),
193
+ beforeEach: previews.flatMap((preview) => preview.beforeEach),
194
+ args: Object.assign({}, ...previews.map((preview) => preview.args)),
195
+ argTypes: previews.reduce((merged, preview) => mergedArgTypes(merged, preview.argTypes), {}),
196
+ parameters: Object.fromEntries(previews.flatMap((preview) => Object.entries(preview.parameters))),
197
+ setup: setups.length === 0
198
+ ? undefined
199
+ : async () => {
200
+ for (const setup of setups)
201
+ await setup();
202
+ }
203
+ };
204
+ };
205
+ //# sourceMappingURL=storyModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storyModule.js","sourceRoot":"","sources":["../../../src/frame/storyModule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAmDrE,yCAAyC;AACzC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAA8C,EAAE,CAC9E,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,KAAc,EAAiD,EAAE;IACtF,IAAI,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,OAAO,KAAK,KAAK,UAAU;QAAE,OAAO,SAAS,CAAC;IAClD,iGAAiG;IACjG,MAAM,MAAM,GAA4B,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AAU,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACjG,KAAK,EACH,MAAM,CAAC,MAAM,KAAK,CAAC;YACjB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,KAAK,IAAmB,EAAE;gBACxB,KAAK,MAAM,KAAK,IAAI,MAAM;oBAAE,MAAM,KAAK,EAAE,CAAC;YAC5C,CAAC;KACR,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * One story run in its frame, whatever framework draws it: the args (the story's, the panel's, the texts named by key,
3
+ * the recorded events), the play function, Replay, the matrix, the story clock a Live story reads and the
4
+ * error shown in place of a story that throws.
5
+ *
6
+ * @remarks
7
+ * The framework only draws (`renderer.ts`); everything a story does over time is here, so each framework behaves the
8
+ * same. The play function runs once per mount, like a test, not on every change of the args, and reads the args of
9
+ * the moment it runs. Every mount runs the story's loaders and set-ups first (`storyHooks.ts`), after the cleanups of
10
+ * the mount before.
11
+ *
12
+ * @module
13
+ */
14
+ import { type StoryTextTable } from "@forgebook/story-format/texts";
15
+ import type { Matrix } from "../matrix.ts";
16
+ import type { PanelArgs } from "../messages.ts";
17
+ import type { PlayTrace } from "../playTrace.ts";
18
+ import type { ClockState } from "../storyClock.ts";
19
+ import type { FrameClock } from "./frameClock.ts";
20
+ import { type PlayToolsLoader } from "./playStory.ts";
21
+ import type { StoryDrawing, StoryIdentity, StoryRenderer } from "./renderer.ts";
22
+ import type { LoadedStory } from "./storyModule.ts";
23
+ /** What the shell can do to a running story. */
24
+ export type StoryControls = {
25
+ /** Replays the story, as it declares. */
26
+ readonly replay: () => Promise<void>;
27
+ /** Sets the props panel's values over the story's own args. */
28
+ readonly setPanelArgs: (args: PanelArgs) => void;
29
+ /** Records the calls of these events. */
30
+ readonly setEvents: (names: readonly string[]) => void;
31
+ /** Draws the story once per value of the matrix's axes; none draws it alone. */
32
+ readonly setMatrix: (matrix: Matrix | undefined) => void;
33
+ /** Mounts the story again, so its play function runs again. */
34
+ readonly playAgain: () => void;
35
+ /** Sets whether the story clock runs, and how fast. */
36
+ readonly setClock: (state: ClockState) => void;
37
+ /**
38
+ * Brings the story clock back to its start and mounts the story again, so its own state starts over too and its
39
+ * play function runs again.
40
+ */
41
+ readonly restartClock: () => void;
42
+ };
43
+ /** What a story run needs. */
44
+ export type StoryRunOptions = {
45
+ /** The element the story, its matrix or its error are drawn in. */
46
+ readonly container: HTMLElement;
47
+ /** The story. */
48
+ readonly story: LoadedStory;
49
+ /** Which story it is: its context's id, name and title. */
50
+ readonly identity: StoryIdentity;
51
+ /** Loads the play tools the project installed, for the first play; none without them. */
52
+ readonly playTools?: PlayToolsLoader;
53
+ /** The framework that draws it. */
54
+ readonly renderer: StoryRenderer;
55
+ /** The story clock the story reads: running from its start for a Live story, held otherwise. */
56
+ readonly clock: FrameClock;
57
+ /** The texts inside the stories in the shown language. */
58
+ readonly texts: StoryTextTable;
59
+ /** The catalogue's decorators, outside the story's own. */
60
+ readonly decorators: StoryDrawing["decorators"];
61
+ /** The values of the switches applied by code, by id. */
62
+ readonly globals: StoryDrawing["globals"];
63
+ /** The panel's values as the story takes them (a named value turned back into the value). */
64
+ readonly resolveArgs: (args: PanelArgs) => Readonly<Record<string, unknown>>;
65
+ /**
66
+ * Called once with the controls, when the story is first drawn and its play function is over (the frame's ready
67
+ * status waits for it, so no check reads a half-played story).
68
+ */
69
+ readonly onControlsReady: (controls: StoryControls) => void;
70
+ /** Called on every call of a recorded event, with its arguments. */
71
+ readonly onEvent: (name: string, values: readonly unknown[]) => void;
72
+ /** Called with the message when the story throws while it is drawn; the frame shows the error instead. */
73
+ readonly onError: (message: string) => void;
74
+ /** Called with the play function's trace after every change. */
75
+ readonly onTrace: (trace: PlayTrace) => void;
76
+ };
77
+ /** What the frame changes in a running story when the shell sends a new view: no new mount, the story keeps its state. */
78
+ export type RunningStory = {
79
+ /** Takes the story away and runs its set-ups' cleanups: the frame's page is being left. */
80
+ readonly leave: () => void;
81
+ /**
82
+ * Draws the story in another language, or with other values of the switches applied by code (the language's
83
+ * provider reads its id among them).
84
+ *
85
+ * @param shown - the texts of the language now shown, and the switches' values.
86
+ */
87
+ readonly setShown: (shown: Pick<StoryDrawing, "texts" | "globals">) => void;
88
+ };
89
+ /**
90
+ * Runs a story in its container.
91
+ *
92
+ * @param options - the story, its framework, its clock, texts and language, and what to tell the shell.
93
+ * @returns what the frame can change while it runs.
94
+ */
95
+ export declare const runStory: (options: StoryRunOptions) => RunningStory;
96
+ //# sourceMappingURL=storyRun.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storyRun.d.ts","sourceRoot":"","sources":["../../../src/frame/storyRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,+BAA+B,CAAC;AAGjF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAkB,KAAK,eAAe,EAAa,MAAM,gBAAgB,CAAC;AACjF,OAAO,KAAK,EAAgB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9F,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE,gDAAgD;AAChD,MAAM,MAAM,aAAa,GAAG;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,+DAA+D;IAC/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E,OAAO,CAAC,CAAC,CAAC;IAC7E;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5D,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,CAAC;IACrE,0GAA0G;IAC1G,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CAC9C,CAAC;AAyBF,0HAA0H;AAC1H,MAAM,MAAM,YAAY,GAAG;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;CAC7E,CAAC;AA4BF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,SAAS,eAAe,KAAG,YAqPnD,CAAC"}
@@ -0,0 +1,318 @@
1
+ /**
2
+ * One story run in its frame, whatever framework draws it: the args (the story's, the panel's, the texts named by key,
3
+ * the recorded events), the play function, Replay, the matrix, the story clock a Live story reads and the
4
+ * error shown in place of a story that throws.
5
+ *
6
+ * @remarks
7
+ * The framework only draws (`renderer.ts`); everything a story does over time is here, so each framework behaves the
8
+ * same. The play function runs once per mount, like a test, not on every change of the args, and reads the args of
9
+ * the moment it runs. Every mount runs the story's loaders and set-ups first (`storyHooks.ts`), after the cleanups of
10
+ * the mount before.
11
+ *
12
+ * @module
13
+ */
14
+ import { storyTextOf } from "@forgebook/story-format/texts";
15
+ import { actionNames, mappedArgs } from "../argTypes.js";
16
+ import { withStoryTexts } from "../storyTexts.js";
17
+ import { matrixLayout } from "./matrixLayout.js";
18
+ import { playStory } from "./playStory.js";
19
+ import { animationsSettled } from "./settle.js";
20
+ import { storyCanvas } from "./storyCanvas.js";
21
+ import { prepareStory } from "./storyHooks.js";
22
+ /**
23
+ * The error shown in place of a story that threw: its message and its stack.
24
+ *
25
+ * @param document - the frame's document.
26
+ * @param error - the error.
27
+ */
28
+ const errorElement = (document, error) => {
29
+ const box = document.createElement("div");
30
+ box.className = "forgebook-frame-error";
31
+ box.setAttribute("role", "alert");
32
+ const message = document.createElement("p");
33
+ message.className = "forgebook-frame-error__message";
34
+ message.textContent = error.message;
35
+ box.append(message);
36
+ if (error.stack !== undefined) {
37
+ const stack = document.createElement("pre");
38
+ stack.className = "forgebook-frame-error__stack";
39
+ stack.textContent = error.stack;
40
+ box.append(stack);
41
+ }
42
+ return box;
43
+ };
44
+ /**
45
+ * Whether an arg is a handler the frame can wrap: a function, taken with the signature an event's handler has.
46
+ *
47
+ * @param value - the arg.
48
+ */
49
+ const isHandler = (value) => typeof value === "function";
50
+ /**
51
+ * Clears the calls of the spies among a story's args, as Storybook does before it draws a story: each mount's play
52
+ * counts its own calls.
53
+ *
54
+ * @param args - the story's args.
55
+ */
56
+ const clearSpies = (args) => {
57
+ for (const value of Object.values(args)) {
58
+ const clear = typeof value === "function" ? Reflect.get(value, "mockClear") : undefined;
59
+ if (typeof clear === "function")
60
+ Reflect.apply(clear, value, []);
61
+ }
62
+ };
63
+ /** A story before its loaders ran, or after its set-ups were undone: nothing loaded, nothing to undo. */
64
+ const NOT_PREPARED = { loaded: {}, cleanup: async () => undefined };
65
+ /**
66
+ * Runs a story in its container.
67
+ *
68
+ * @param options - the story, its framework, its clock, texts and language, and what to tell the shell.
69
+ * @returns what the frame can change while it runs.
70
+ */
71
+ export const runStory = (options) => {
72
+ const { container, story, renderer, clock } = options;
73
+ const document = container.ownerDocument;
74
+ const { decorators } = options;
75
+ let { texts, globals } = options;
76
+ let text = storyTextOf(texts);
77
+ let args = story.args;
78
+ let eventNames = [];
79
+ let matrix;
80
+ let mounted = [];
81
+ let shownError;
82
+ let mountCount = 0;
83
+ let hasPlayed = false;
84
+ let prepared = NOT_PREPARED;
85
+ // the story's actions are recorded whatever the shell names: a spy, an `argTypes` action
86
+ const actions = actionNames(story.args, story.argTypes);
87
+ // every recorded event reports its calls, then runs the story's own handler when it has one; the handler is
88
+ // wrapped, not replaced, so a spy stays one (`expect(args.onPress).toHaveBeenCalled()` reads its calls)
89
+ const recorded = () => Object.fromEntries([...new Set([...eventNames, ...actions])].map((name) => {
90
+ const own = args[name];
91
+ const report = (values) => options.onEvent(name, values);
92
+ if (!isHandler(own)) {
93
+ return [
94
+ name,
95
+ (...values) => {
96
+ report(values);
97
+ return undefined;
98
+ }
99
+ ];
100
+ }
101
+ return [
102
+ name,
103
+ new Proxy(own, {
104
+ apply: (target, thisArg, values) => {
105
+ report(values);
106
+ return Reflect.apply(target, thisArg, values);
107
+ }
108
+ })
109
+ ];
110
+ }));
111
+ // an arg written `storyText("key")` reaches the story as the text of the shown language
112
+ // an arg holding a key of its `mapping` reaches the story as the value the key stands for
113
+ const shownArgs = () => ({
114
+ ...withStoryTexts(mappedArgs(args, story.argTypes), text),
115
+ ...recorded()
116
+ });
117
+ const drawing = (values) => ({
118
+ identity: options.identity,
119
+ story,
120
+ args: { ...shownArgs(), ...values },
121
+ texts,
122
+ clock,
123
+ decorators,
124
+ globals,
125
+ loaded: prepared.loaded
126
+ });
127
+ const clearError = () => {
128
+ shownError?.remove();
129
+ shownError = undefined;
130
+ for (const child of container.children)
131
+ if (child instanceof HTMLElement)
132
+ child.hidden = false;
133
+ };
134
+ const showError = (error) => {
135
+ shownError?.remove();
136
+ for (const child of container.children)
137
+ if (child instanceof HTMLElement)
138
+ child.hidden = true;
139
+ shownError = errorElement(document, error);
140
+ container.append(shownError);
141
+ options.onError(error.message);
142
+ };
143
+ const unmountAll = () => {
144
+ for (const { story: each } of mounted)
145
+ each.unmount();
146
+ mounted = [];
147
+ clearError();
148
+ container.replaceChildren();
149
+ };
150
+ const controls = {
151
+ replay: async () => {
152
+ const mode = story.replay;
153
+ if (mode === undefined)
154
+ return;
155
+ if (mode === "remount") {
156
+ mountStory();
157
+ return;
158
+ }
159
+ // an exit and an entrance: the arg goes false, the exit plays to its end, it stays false for the hold, then it
160
+ // comes back
161
+ args = { ...args, [mode.toggle]: false };
162
+ redraw();
163
+ await animationsSettled(document);
164
+ if (mode.hold !== undefined)
165
+ await new Promise((resolve) => window.setTimeout(resolve, mode.hold));
166
+ args = { ...args, [mode.toggle]: true };
167
+ redraw();
168
+ },
169
+ setPanelArgs: (panelArgs) => {
170
+ args = { ...story.args, ...options.resolveArgs(panelArgs) };
171
+ redraw();
172
+ },
173
+ setEvents: (names) => {
174
+ eventNames = names;
175
+ redraw();
176
+ },
177
+ // the shell sends the matrix when the story is ready: the same one again must not mount the story anew (its play
178
+ // would run twice)
179
+ setMatrix: (next) => {
180
+ if (JSON.stringify(next) === JSON.stringify(matrix))
181
+ return;
182
+ matrix = next;
183
+ mountStory();
184
+ },
185
+ playAgain: () => mountStory(),
186
+ setClock: clock.setState,
187
+ restartClock: () => {
188
+ clock.restart();
189
+ mountStory();
190
+ }
191
+ };
192
+ // new args (the panel, Replay, the events) draw the story again: a value that made it throw can be changed back
193
+ const redraw = () => {
194
+ clearError();
195
+ for (const { story: each, values } of mounted)
196
+ each.update(drawing(values));
197
+ };
198
+ const mountMatrix = (axes) => {
199
+ const layout = matrixLayout(document, story, axes);
200
+ container.append(layout.element);
201
+ mounted = layout.cells.map((cell) => ({
202
+ story: renderer.mount(cell.canvas, drawing(cell.values), showError),
203
+ values: cell.values
204
+ }));
205
+ };
206
+ const mountAlone = () => {
207
+ const count = mountCount;
208
+ const canvas = storyCanvas(document, story);
209
+ container.append(canvas);
210
+ const alone = renderer.mount(canvas, drawing({}), showError);
211
+ mounted = [{ story: alone, values: {} }];
212
+ void alone.drawn.then(async () => {
213
+ // a later mount (Replay, the matrix) replaced this one before it was drawn: its play would drive a gone story
214
+ if (count !== mountCount)
215
+ return;
216
+ const tools = await playTools();
217
+ if (count !== mountCount || tools instanceof Error)
218
+ return;
219
+ // a failed play still ends the wait; its rejection reaches the page as an error the tests record
220
+ void playStory(story.play, {
221
+ ...options.identity,
222
+ args: shownArgs(),
223
+ canvasElement: canvas,
224
+ text,
225
+ clock,
226
+ globals,
227
+ loaded: prepared.loaded,
228
+ parameters: story.parameters
229
+ }, () => {
230
+ if (hasPlayed)
231
+ return;
232
+ hasPlayed = true;
233
+ options.onControlsReady(controls);
234
+ }, options.onTrace, tools);
235
+ });
236
+ };
237
+ // the play tools the project installed, loaded for a story with a play; a failure to load them is shown as the
238
+ // story's error
239
+ const playTools = async () => {
240
+ if (story.play === undefined)
241
+ return undefined;
242
+ try {
243
+ return await options.playTools?.();
244
+ }
245
+ catch (error) {
246
+ const failure = error instanceof Error ? error : new Error(String(error));
247
+ showError(failure);
248
+ return failure;
249
+ }
250
+ };
251
+ // the set-ups of the mount before undone, then the story's loaders and set-ups: whether this mount is still the last
252
+ // one, and may draw
253
+ const prepareMount = async (count) => {
254
+ clearSpies(story.args);
255
+ // taken before waiting: a mount that starts meanwhile must not undo the same set-ups again
256
+ const previous = prepared;
257
+ prepared = NOT_PREPARED;
258
+ try {
259
+ await previous.cleanup();
260
+ const next = await prepareStory(story, {
261
+ ...options.identity,
262
+ args: shownArgs(),
263
+ text,
264
+ clock,
265
+ globals,
266
+ parameters: story.parameters
267
+ });
268
+ // a later mount started while this one loaded: its set-ups are undone, the later one draws
269
+ if (count !== mountCount) {
270
+ await next.cleanup();
271
+ return false;
272
+ }
273
+ prepared = next;
274
+ return true;
275
+ }
276
+ catch (error) {
277
+ if (count === mountCount)
278
+ showError(error instanceof Error ? error : new Error(String(error)));
279
+ return false;
280
+ }
281
+ };
282
+ // a new mount draws the story from scratch: its loaders and set-ups run again, its own state starts over and its
283
+ // play function runs again
284
+ const mountStory = () => {
285
+ unmountAll();
286
+ mountCount += 1;
287
+ void prepareMount(mountCount).then((isLast) => {
288
+ if (!isLast)
289
+ return;
290
+ // a framework may throw while it starts drawing, before its own error capture is in place: shown as any error
291
+ try {
292
+ if (matrix === undefined)
293
+ mountAlone();
294
+ else
295
+ mountMatrix(matrix);
296
+ }
297
+ catch (error) {
298
+ showError(error instanceof Error ? error : new Error(String(error)));
299
+ }
300
+ });
301
+ };
302
+ mountStory();
303
+ return {
304
+ leave: () => {
305
+ mountCount += 1;
306
+ unmountAll();
307
+ const previous = prepared;
308
+ prepared = NOT_PREPARED;
309
+ void previous.cleanup();
310
+ },
311
+ setShown: (shown) => {
312
+ ({ texts, globals } = shown);
313
+ text = storyTextOf(texts);
314
+ redraw();
315
+ }
316
+ };
317
+ };
318
+ //# sourceMappingURL=storyRun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storyRun.js","sourceRoot":"","sources":["../../../src/frame/storyRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAuB,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAwC,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAsB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA2DnE;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,QAAkB,EAAE,KAAY,EAAe,EAAE;IACrE,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,SAAS,GAAG,uBAAuB,CAAC;IACxC,GAAG,CAAC,YAAY,C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