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,146 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useMemo, useRef, useState } from "react";
3
+ import { groupLabel } from "../catalogue.js";
4
+ import { groupedStories, mainStory } from "../storyTree.js";
5
+ import { frameAddress, liveView } from "../viewState.js";
6
+ import { ApiReference } from "./ApiReference.js";
7
+ import { CodeText } from "./CodeText.js";
8
+ import { useCatalogue } from "./catalogueContext.js";
9
+ import { useCodeWriter } from "./codeWriter.js";
10
+ import { FrameView } from "./FrameView.js";
11
+ import { Icon } from "./icons.js";
12
+ import { PackageHtml } from "./PackageHtml.js";
13
+ import { StageViewport } from "./StageViewport.js";
14
+ import { StoryCodeBlock, storyCodeText } from "./StoryCodeBlock.js";
15
+ import { STRINGS } from "./strings.js";
16
+ import { useComponentDocs } from "./useComponentDocs.js";
17
+ import { useCopy } from "./useCopy.js";
18
+ import { useFrameMessages } from "./useFrameMessages.js";
19
+ import { useFrameQueue } from "./useFrameQueue.js";
20
+ import { useLiveView, useLoadedView } from "./useLiveView.js";
21
+ import { usePageDoc } from "./usePageDoc.js";
22
+ import { useScrollMemory } from "./useScrollMemory.js";
23
+ import { useStoryCode } from "./useStoryCode.js";
24
+ /** The height of a frame before its story reports its own, in CSS px. */
25
+ const FALLBACK_HEIGHT = 160;
26
+ /** The demo's height before its story reports its own, in CSS px: the demo is the page's first, larger frame. */
27
+ const DEMO_FALLBACK_HEIGHT = 280;
28
+ /** A link to a story's own page, opened in place unless the user asks for another tab. */
29
+ const StoryLink = ({ story, hrefOf, onOpen, className, children }) => (_jsx("a", { className: className, href: hrefOf(story), onClick: (event) => {
30
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0)
31
+ return;
32
+ event.preventDefault();
33
+ onOpen(story);
34
+ }, children: children }));
35
+ /**
36
+ * The code under an example: closed until asked for, then opened in place with a button that copies it.
37
+ *
38
+ * @param props - the story's code and whether it is shown.
39
+ */
40
+ const ExampleCode = ({ id, source, isShown }) => {
41
+ const { isCopied, copy } = useCopy();
42
+ const write = useCodeWriter();
43
+ return (_jsx("div", { id: id, className: "forgebook-example__code", "data-open": isShown ? "" : undefined, inert: !isShown, children: _jsxs("div", { className: "forgebook-example__code-inner", children: [_jsx("button", { type: "button", className: "forgebook-example__copy", onClick: () => copy(storyCodeText(source, write)), "aria-live": "polite", children: isCopied ? STRINGS.copied : STRINGS.copy }), _jsx(StoryCodeBlock, { ...source })] }) }));
44
+ };
45
+ /**
46
+ * One example: its title and description (the demo has none: it opens the page), its story in a frame, and a bar
47
+ * that shows its code.
48
+ *
49
+ * @param props - the story, whether it is the demo, whether its frame may load, where the queue watches it, and what
50
+ * every example shares.
51
+ */
52
+ const Example = ({ story, isDemo, isMounted, observe, ...context }) => {
53
+ const [isCodeShown, setIsCodeShown] = useState(false);
54
+ const codeId = useId();
55
+ // the story's measured height when there is one; a guess otherwise, larger for the demo; never below the height its
56
+ // scene needs, which its frame has from the start
57
+ const fallbackHeight = Math.max(story.height ?? 0, context.heightOf(story.id) ?? (isDemo ? DEMO_FALLBACK_HEIGHT : FALLBACK_HEIGHT));
58
+ const source = context.code.status === "ready"
59
+ ? {
60
+ code: context.code.value,
61
+ exportName: story.exportName,
62
+ componentName: context.componentName,
63
+ args: context.argsOf(story.id)
64
+ }
65
+ : undefined;
66
+ return (_jsxs("article", { ref: observe, className: "forgebook-example", "data-demo": isDemo ? "" : undefined, "aria-label": isDemo ? STRINGS.frameTitle(context.component.name, story.name) : story.name, children: [isDemo ? null : (_jsxs("header", { className: "forgebook-example__head", children: [_jsx("h4", { className: "forgebook-example__title", children: _jsx(StoryLink, { story: story, hrefOf: context.hrefOf, onOpen: context.onOpen, className: "forgebook-link", children: story.name }) }), story.description === undefined ? null : (_jsx("p", { className: "forgebook-example__description", children: _jsx(CodeText, { text: story.description }) }))] })), _jsxs("div", { className: "forgebook-example__box", children: [_jsx("div", { className: "forgebook-example__stage", children: _jsx(StageViewport, { width: context.view.width, background: context.background, children: isMounted ? (_jsx(FrameView, { title: STRINGS.frameTitle(context.component.name, story.name), address: frameAddress(context.frameUrl, story.id, context.frameView, context.switches), heights: context.heights, settled: context.settled, fallbackHeight: fallbackHeight, sceneHeight: story.height })) : (_jsx("div", { className: "forgebook-frame-placeholder", style: { height: fallbackHeight } })) }) }), _jsxs("div", { className: "forgebook-example__bar", children: [source === undefined ? null : (_jsxs("button", { type: "button", className: "forgebook-example__toggle", "aria-expanded": isCodeShown, "aria-controls": codeId, onClick: () => setIsCodeShown(!isCodeShown), children: [_jsx(Icon, { name: "chevronRight", size: 12 }), isCodeShown ? STRINGS.hideCode : STRINGS.showCode] })), isDemo ? (_jsxs(StoryLink, { story: story, hrefOf: context.hrefOf, onOpen: context.onOpen, className: "forgebook-example__open", children: [STRINGS.openStory, _jsx(Icon, { name: "external", size: 12 })] })) : null] }), source === undefined ? null : _jsx(ExampleCode, { id: codeId, source: source, isShown: isCodeShown })] })] }));
67
+ };
68
+ /**
69
+ * The page's lead: what the component is and does, from its file's `@module` comment (its own TSDoc is often a bare
70
+ * name), read with the documentation file so it comes with the page; else its TSDoc summary, once the docs come.
71
+ *
72
+ * @param props - the loaded page and the component's docs.
73
+ */
74
+ const Lead = ({ page, docs }) => {
75
+ const summary = page.status === "ready" ? page.value.summary : "";
76
+ const lead = summary || docs?.summary || docs?.description || "";
77
+ return lead === "" ? null : (_jsx("p", { className: "forgebook-doc__lead", children: _jsx(CodeText, { text: lead }) }));
78
+ };
79
+ /**
80
+ * The documentation file's text, or why it could not be read.
81
+ *
82
+ * @param props - the loaded page.
83
+ */
84
+ const Prose = ({ page }) => {
85
+ if (page.status === "error") {
86
+ return (_jsxs("p", { className: "forgebook-problems", role: "alert", children: [STRINGS.pageError, ": ", page.message] }));
87
+ }
88
+ if (page.status !== "ready" || page.value.html === "")
89
+ return null;
90
+ return _jsx(PackageHtml, { className: "forgebook-prose", html: page.value.html });
91
+ };
92
+ /**
93
+ * A component's page.
94
+ *
95
+ * @param props - the component, the view, its loaders and how to open a story.
96
+ */
97
+ export const ComponentPage = ({ component, view, frameUrl, hrefOf, onOpen, loadDocs, loadCode, loadPage, heightOf, background, header, scroll }) => {
98
+ const pageRef = useRef(null);
99
+ const docs = useComponentDocs(loadDocs);
100
+ const code = useStoryCode(loadCode);
101
+ const page = usePageDoc(loadPage);
102
+ // each story's own args, as its frame reports them: the code of a story drawn from its args is written from them
103
+ const [storyArgs, setStoryArgs] = useState(new Map());
104
+ const demo = mainStory(component);
105
+ const examples = useMemo(() => component.stories.filter((story) => story.id !== demo?.id), [component, demo]);
106
+ // the frames keep the view they loaded with; only the style sheets load them again, the rest of the view (the
107
+ // switches, the language among them) is sent to them live
108
+ const frameView = useLoadedView(view.sheets, view);
109
+ const catalogue = useCatalogue();
110
+ const { switches } = catalogue;
111
+ const exampleIds = useMemo(() => examples.map((story) => story.id), [examples]);
112
+ const queue = useFrameQueue(exampleIds, pageRef);
113
+ const { heights, settled } = useFrameMessages({
114
+ onReady: (frame, message) => {
115
+ queue.markReady(message.storyId);
116
+ setStoryArgs((current) => new Map(current).set(message.storyId, message.args));
117
+ const send = (shellMessage) => frame.postMessage(shellMessage, window.location.origin);
118
+ send({ type: "forgebook:view", view: liveView(view) });
119
+ send({ type: "forgebook:tools", tools: view.tools });
120
+ },
121
+ onCall: () => undefined,
122
+ // a frame that failed is over too: its place in the queue goes to the next one
123
+ onFailed: queue.markReady
124
+ });
125
+ useLiveView(pageRef, view, true);
126
+ useScrollMemory(pageRef, scroll);
127
+ const componentDocs = docs.status === "ready" ? docs.value : undefined;
128
+ const context = {
129
+ component,
130
+ view,
131
+ frameUrl,
132
+ hrefOf,
133
+ onOpen,
134
+ frameView,
135
+ switches,
136
+ heights,
137
+ settled,
138
+ code,
139
+ componentName: componentDocs?.name ?? component.name,
140
+ argsOf: (storyId) => storyArgs.get(storyId) ?? {},
141
+ heightOf,
142
+ background
143
+ };
144
+ return (_jsxs("div", { className: "forgebook-workspace", children: [header, _jsx("div", { ref: pageRef, className: "forgebook-scroll", children: _jsxs("div", { className: "forgebook-doc", children: [_jsx(Lead, { page: page, docs: componentDocs }), demo === undefined ? null : _jsx(Example, { ...context, story: demo, isDemo: true, isMounted: true }), _jsx(Prose, { page: page }), componentDocs === undefined || componentDocs.props.length === 0 ? null : (_jsx(ApiReference, { docs: componentDocs })), examples.length === 0 ? null : (_jsxs("section", { className: "forgebook-doc__section", "aria-labelledby": "forgebook-examples", children: [_jsx("h2", { id: "forgebook-examples", children: STRINGS.examples }), groupedStories(examples, catalogue.storyGroups.map((group) => group.id)).map((section) => (_jsxs("section", { className: "forgebook-doc__group", children: [section.group === undefined ? null : (_jsx("h3", { className: "forgebook-doc__group-name", children: groupLabel(catalogue.storyGroups, section.group) })), section.stories.map((story) => (_jsx(Example, { ...context, story: story, isDemo: false, isMounted: queue.mounted.has(story.id), observe: (element) => queue.observe(story.id, element) }, story.id)))] }, section.group ?? "")))] }))] }, `${component.file}|${component.title}`) })] }));
145
+ };
146
+ //# sourceMappingURL=ComponentPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentPage.js","sourceRoot":"","sources":["../../../src/shell/ComponentPage.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAmC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAsC,MAAM,iBAAiB,CAAC;AAEhG,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAkB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAa,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAwB,aAAa,EAAE,MAAM,qBAAsB,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAA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,EAAE,KAAK,EACZ,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EACtC,OAAO,EAAE,CAAC,OAA2B,EAAQ,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,IAL3E,KAAK,CAAC,EAAE,CAMb,CACH,CAAC,KAfU,OAAO,CAAC,KAAK,IAAI,EAAE,CAgBvB,CACX,CAAC,IACM,CACX,KAjCO,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,KAAK,EAAE,CAkC1C,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The panel docked under a story: a row of tabs (Props, Events, Parts and styling, Code, Accessibility) and the chosen
3
+ * tab's content, which scrolls on its own, so reading the props or the code never moves the story away.
4
+ *
5
+ * @remarks
6
+ * The tabs follow the ARIA tabs pattern: the arrow keys move between them, Home and End go to the ends. The handle on
7
+ * the top edge sets the panel's height (dragged, or with the arrow keys); the height is a convenience of this browser,
8
+ * kept in its storage, not in the address. Only the tabs the story has something for are shown.
9
+ *
10
+ * @module
11
+ */
12
+ import { type ReactNode } from "react";
13
+ import type { PanelTab } from "../viewState.ts";
14
+ /** One tab of the panel. */
15
+ export type DockTab = {
16
+ /** The tab's id, kept in the address. */
17
+ readonly id: PanelTab;
18
+ /** The tab's name. */
19
+ readonly label: string;
20
+ /** A short note beside the name (a count); none by default. */
21
+ readonly hint?: string | undefined;
22
+ /** What the tab shows. */
23
+ readonly content: ReactNode;
24
+ };
25
+ /** The dock's props. */
26
+ export type DockProps = {
27
+ /** The tabs the story has something for, in order. */
28
+ readonly tabs: readonly DockTab[];
29
+ /** The chosen tab; the first tab shows when the story has nothing for it. */
30
+ readonly activeTab: PanelTab;
31
+ /** Called with the tab chosen. */
32
+ readonly onTabChange: (tab: PanelTab) => void;
33
+ /** Closes the panel. */
34
+ readonly onClose: () => void;
35
+ };
36
+ /**
37
+ * The panel under a story.
38
+ *
39
+ * @param props - the tabs, the chosen one and the setters.
40
+ */
41
+ export declare const Dock: ({ tabs, activeTab, onTabChange, onClose }: DockProps) => ReactNode;
42
+ //# sourceMappingURL=Dock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dock.d.ts","sourceRoot":"","sources":["../../../src/shell/Dock.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAyC,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAKhD,4BAA4B;AAC5B,MAAM,MAAM,OAAO,GAAG;IACpB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,0BAA0B;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;CAC7B,CAAC;AAEF,wBAAwB;AACxB,MAAM,MAAM,SAAS,GAAG;IACtB,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC9C,wBAAwB;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAkBF;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,2CAA2C,SAAS,KAAG,SA+G3E,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * The panel docked under a story: a row of tabs (Props, Events, Parts and styling, Code, Accessibility) and the chosen
4
+ * tab's content, which scrolls on its own, so reading the props or the code never moves the story away.
5
+ *
6
+ * @remarks
7
+ * The tabs follow the ARIA tabs pattern: the arrow keys move between them, Home and End go to the ends. The handle on
8
+ * the top edge sets the panel's height (dragged, or with the arrow keys); the height is a convenience of this browser,
9
+ * kept in its storage, not in the address. Only the tabs the story has something for are shown.
10
+ *
11
+ * @module
12
+ */
13
+ import { useId, useRef } from "react";
14
+ import { Icon } from "./icons.js";
15
+ import { STRINGS } from "./strings.js";
16
+ import { useStored } from "./useStored.js";
17
+ /** The panel's height, in CSS px: the default, the bounds a drag keeps to, and one arrow key's step. */
18
+ const HEIGHT = { initial: 300, min: 120, step: 24 };
19
+ /** Where this browser keeps the panel's height. */
20
+ const HEIGHT_KEY = "dock-height";
21
+ /** The height a stored text holds, or the default. */
22
+ const storedHeight = (stored) => {
23
+ const value = Number(stored);
24
+ return stored !== null && Number.isFinite(value) && value >= HEIGHT.min ? value : HEIGHT.initial;
25
+ };
26
+ /** A height kept between the minimum and most of the window, so the story always keeps some room. */
27
+ const boundedHeight = (height) => Math.round(Math.min(window.innerHeight * 0.8, Math.max(HEIGHT.min, height)));
28
+ /**
29
+ * The panel under a story.
30
+ *
31
+ * @param props - the tabs, the chosen one and the setters.
32
+ */
33
+ export const Dock = ({ tabs, activeTab, onTabChange, onClose }) => {
34
+ const [height, setHeight] = useStored(HEIGHT_KEY, storedHeight, (value) => String(Math.round(value)));
35
+ const tabRefs = useRef(new Map());
36
+ const baseId = useId();
37
+ const shown = tabs.find((tab) => tab.id === activeTab) ?? tabs[0];
38
+ const startResize = (event) => {
39
+ if (event.button !== 0)
40
+ return;
41
+ event.preventDefault();
42
+ const handle = event.currentTarget;
43
+ handle.setPointerCapture(event.pointerId);
44
+ const startY = event.clientY;
45
+ const startHeight = height;
46
+ const move = (moveEvent) => setHeight(boundedHeight(startHeight + startY - moveEvent.clientY));
47
+ const end = () => {
48
+ handle.removeEventListener("pointermove", move);
49
+ handle.removeEventListener("pointerup", end);
50
+ handle.removeEventListener("pointercancel", end);
51
+ };
52
+ handle.addEventListener("pointermove", move);
53
+ handle.addEventListener("pointerup", end);
54
+ handle.addEventListener("pointercancel", end);
55
+ };
56
+ const resizeWithKeys = (event) => {
57
+ if (event.key === "ArrowUp")
58
+ setHeight(boundedHeight(height + HEIGHT.step));
59
+ else if (event.key === "ArrowDown")
60
+ setHeight(boundedHeight(height - HEIGHT.step));
61
+ else
62
+ return;
63
+ event.preventDefault();
64
+ };
65
+ const moveFocus = (event) => {
66
+ const index = tabs.findIndex((tab) => tab.id === shown?.id);
67
+ const targets = {
68
+ ArrowRight: (index + 1) % tabs.length,
69
+ ArrowLeft: (index - 1 + tabs.length) % tabs.length,
70
+ Home: 0,
71
+ End: tabs.length - 1
72
+ };
73
+ const next = tabs[targets[event.key] ?? -1];
74
+ if (next === undefined)
75
+ return;
76
+ event.preventDefault();
77
+ onTabChange(next.id);
78
+ tabRefs.current.get(next.id)?.focus();
79
+ };
80
+ return (_jsxs("section", { className: "forgebook-dock", style: { height }, "aria-label": STRINGS.panel, children: [_jsx("div", { className: "forgebook-dock__handle", role: "separator", "aria-orientation": "horizontal", "aria-label": STRINGS.panelHeight, "aria-valuenow": height, "aria-valuemin": HEIGHT.min, tabIndex: 0, onPointerDown: startResize, onKeyDown: resizeWithKeys }), _jsxs("div", { className: "forgebook-dock__bar", children: [_jsx("div", { className: "forgebook-dock__tabs", role: "tablist", "aria-label": STRINGS.panel, onKeyDown: moveFocus, children: tabs.map((tab) => {
81
+ const isActive = tab.id === shown?.id;
82
+ return (_jsxs("button", { ref: (element) => {
83
+ if (element === null)
84
+ tabRefs.current.delete(tab.id);
85
+ else
86
+ tabRefs.current.set(tab.id, element);
87
+ }, type: "button", role: "tab", id: `${baseId}-${tab.id}`, className: "forgebook-dock__tab", "aria-selected": isActive, "aria-controls": `${baseId}-panel`, tabIndex: isActive ? 0 : -1, onClick: () => onTabChange(tab.id), children: [tab.label, tab.hint === undefined ? null : _jsx("span", { className: "forgebook-dock__hint", children: tab.hint })] }, tab.id));
88
+ }) }), _jsx("button", { type: "button", className: "forgebook-icon-button", title: STRINGS.closePanel, "aria-label": STRINGS.closePanel, onClick: onClose, children: _jsx(Icon, { name: "close", size: 14 }) })] }), shown === undefined ? null : (_jsx("div", { id: `${baseId}-panel`, className: "forgebook-dock__body", role: "tabpanel", "aria-labelledby": `${baseId}-${shown.id}`, children: shown.content }))] }));
89
+ };
90
+ //# sourceMappingURL=Dock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dock.js","sourceRoot":"","sources":["../../../src/shell/Dock.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAyD,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG7F,OAAO,EAAE,IAAI,EAAE,MAAM,YAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA0B3C,wGAAwG;AACxG,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAW,CAAC;AAE7D,mDAAmD;AACnD,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC,sDAAsD;AACtD,MAAM,YAAY,GAAG,CAAC,MAAqB,EAAU,EAAE;IACrD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AACnG,CAAC,CAAC;AAEF,qGAAqG;AACrG,MAAM,aAAa,GAAG,CAAC,MAAc,EAAU,EAAE,CAC/C,I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ACb,IAAI,EAAC,KAAK,EACV,EAAE,EAAE,GAAG,MAAM,IAAI,GAAG,CAAC,EAAE,EAAE,EACzB,SAAS,EAAC,qBAAqB,mBAChB,QAAQ,mBACR,GAAG,MAAM,QAAQ,EAChC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,GAAS,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,aAEvC,GAAG,CAAC,KAAK,EACT,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,sBAAsB,YAAE,GAAG,CAAC,IAAI,GAAQ,KAfpF,GAAG,CAAC,EAAE,CAgBJ,CACV,CAAC;wBACJ,CAAC,CAAC,GACE,EACN,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,uBAAuB,EACjC,KAAK,EAAE,OAAO,CAAC,UAAU,gBACb,OAAO,CAAC,UAAU,EAC9B,OAAO,EAAE,OAAO,YAEhB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAE,EAAE,GAAI,GACxB,IACL,EACL,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5B,cACE,EAAE,EAAE,GAAG,MAAM,QAAQ,EACrB,SAAS,EAAC,sBAAsB,EAChC,IAAI,EAAC,UAAU,qBACE,GAAG,MAAM,IAAI,KAAK,CAAC,EAAE,EAAE,YAEvC,KAAK,CAAC,OAAO,GACV,CACP,IACO,CACX,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The panel's Events tab: each event of the component with its signature highlighted and its description, then the
3
+ * calls the story made, newest first.
4
+ *
5
+ * @module
6
+ */
7
+ import type { ReactNode } from "react";
8
+ import type { PropDocs } from "../componentDocs.ts";
9
+ import type { EventCall } from "./useFrameMessages.ts";
10
+ /** The tab's props. */
11
+ export type EventsTabProps = {
12
+ /** The component's events (its `on…` props). */
13
+ readonly events: readonly PropDocs[];
14
+ /** The calls received, newest first. */
15
+ readonly calls: readonly EventCall[];
16
+ /** Clears the calls. */
17
+ readonly onClearCalls: () => void;
18
+ };
19
+ /**
20
+ * The Events tab.
21
+ *
22
+ * @param props - the events, the calls and how to clear them.
23
+ */
24
+ export declare const EventsTab: ({ events, calls, onClearCalls }: EventsTabProps) => ReactNode;
25
+ //# sourceMappingURL=EventsTab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventsTab.d.ts","sourceRoot":"","sources":["../../../src/shell/EventsTab.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,uBAAuB;AACvB,MAAM,MAAM,cAAc,GAAG;IAC3B,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;IACrC,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,wBAAwB;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AA2BF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,iCAAiC,cAAc,KAAG,SAmC3E,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Code } from "./Code.js";
3
+ import { STRINGS } from "./strings.js";
4
+ /** An event's signature as TypeScript would write it. */
5
+ const signatureText = (event) => event.signature === undefined
6
+ ? event.type
7
+ : `(${event.signature.parameters.map((parameter) => `${parameter.name}: ${parameter.type}`).join(", ")}) => ${event.signature.returns}`;
8
+ /**
9
+ * One call: the event with its arguments written short, opening on their content when one is an object or a list.
10
+ *
11
+ * @param props - the call.
12
+ */
13
+ const CallLine = ({ call }) => {
14
+ const line = _jsx(Code, { text: `${call.name}(${call.values.join(", ")})`, names: [call.name] });
15
+ const details = call.details.filter((detail) => detail !== null);
16
+ if (details.length === 0)
17
+ return line;
18
+ return (_jsxs("details", { className: "forgebook-calls__details", children: [_jsx("summary", { children: line }), _jsx("pre", { className: "forgebook-code-block", children: _jsx(Code, { text: details.join("\n"), names: [] }) })] }));
19
+ };
20
+ /**
21
+ * The Events tab.
22
+ *
23
+ * @param props - the events, the calls and how to clear them.
24
+ */
25
+ export const EventsTab = ({ events, calls, onClearCalls }) => (_jsxs("div", { className: "forgebook-tab-columns", children: [_jsxs("div", { className: "forgebook-prop-group", children: [_jsx("h3", { className: "forgebook-prop-group__title", children: STRINGS.events }), events.map((event) => (_jsxs("div", { className: "forgebook-event", children: [_jsx("code", { className: "forgebook-prop__name", children: event.name }), _jsx(Code, { text: signatureText(event), names: event.signature?.parameters.map((parameter) => parameter.name) ?? [] }), _jsx("p", { className: "forgebook-prop__description", children: event.description })] }, event.name)))] }), _jsxs("div", { className: "forgebook-prop-group forgebook-calls", children: [_jsxs("div", { className: "forgebook-calls__head", children: [_jsx("h3", { className: "forgebook-prop-group__title", children: STRINGS.calls }), _jsx("button", { type: "button", className: "forgebook-text-button", onClick: onClearCalls, children: STRINGS.clearCalls })] }), calls.length === 0 ? _jsx("p", { className: "forgebook-prop__description", children: STRINGS.noCalls }) : null, _jsx("ol", { className: "forgebook-calls__list", "aria-live": "polite", children: calls.map((call) => (_jsxs("li", { className: "forgebook-calls__item", children: [_jsx(CallLine, { call: call }), _jsx("time", { className: "forgebook-calls__time", dateTime: new Date(call.time).toISOString(), children: new Date(call.time).toLocaleTimeString() })] }, `${call.time}-${call.name}-${call.values.join(",")}`))) })] })] }));
26
+ //# sourceMappingURL=EventsTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventsTab.js","sour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uB,aAC9F,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,GAAI,EACxB,eAAM,SAAS,EAAC,uBAAuB,EAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,YAChF,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,GACpC,KAJA,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAKxD,CACN,CAAC,GACC,IACD,IACF,CACP,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * A story's frame as the shell shows it, as tall as its story (or the room its scene declares) and showing that it loads until it is ready, and how the shell talks to the frames of a page: the
3
+ * story page and the component page use both.
4
+ *
5
+ * @module
6
+ */
7
+ import type { ReactNode, Ref } from "react";
8
+ import type { ShellMessage } from "../messages.ts";
9
+ /** The frame view's props. */
10
+ export type FrameViewProps = {
11
+ /** The frame's accessible title. */
12
+ readonly title: string;
13
+ /** The frame's address. */
14
+ readonly address: string;
15
+ /** Each frame's reported height, by its address. */
16
+ readonly heights: ReadonlyMap<string, number>;
17
+ /** The height until the frame reports its own, in CSS px. */
18
+ readonly fallbackHeight: number;
19
+ /**
20
+ * The height the story's scene needs (its `parameters.height`), in CSS px: the frame is never shorter, from the
21
+ * start, so the window an overlay is placed in has that room while the story's document stays as tall as its
22
+ * content. None by default.
23
+ */
24
+ readonly sceneHeight?: number | undefined;
25
+ /**
26
+ * A height set on the stage (the foot handle, note 142), in CSS px: the frame takes it whatever its story's;
27
+ * none by default.
28
+ */
29
+ readonly fixedHeight?: number | undefined;
30
+ /** The addresses of the frames that finished loading: until its own is there, the frame shows that it loads. */
31
+ readonly settled: ReadonlySet<string>;
32
+ /** The iframe. */
33
+ readonly ref?: Ref<HTMLIFrameElement>;
34
+ };
35
+ /**
36
+ * A story's frame, as tall as its story.
37
+ *
38
+ * @param props - the frame's title, address, the reported heights, the height until its own arrives, and the frames
39
+ * that finished loading.
40
+ */
41
+ export declare const FrameView: ({ title, address, heights, fallbackHeight, settled, sceneHeight, fixedHeight, ref }: FrameViewProps) => ReactNode;
42
+ /**
43
+ * Sends a message to every frame inside an element.
44
+ *
45
+ * @param container - the element that holds the frames.
46
+ * @param message - the message.
47
+ */
48
+ export declare const tellFrames: (container: HTMLElement | null, message: ShellMessage) => void;
49
+ //# sourceMappingURL=FrameView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameView.d.ts","sourceRoot":"","sources":["../../../src/shell/FrameView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,8BAA8B;AAC9B,MAAM,MAAM,cAAc,GAAG;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,6DAA6D;IAC7D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,gHAAgH;IAChH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,kBAAkB;IAClB,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,qFASvB,cAAc,KAAG,SAqBnB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,WAAW,GAAG,IAAI,EAAE,SAAS,YAAY,KAAG,IAIjF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { STRINGS } from "./strings.js";
3
+ /**
4
+ * A story's frame, as tall as its story.
5
+ *
6
+ * @param props - the frame's title, address, the reported heights, the height until its own arrives, and the frames
7
+ * that finished loading.
8
+ */
9
+ export const FrameView = ({ title, address, heights, fallbackHeight, settled, sceneHeight = 0, fixedHeight, ref }) => {
10
+ const isLoading = !settled.has(address);
11
+ // while it loads, an empty document reports a height of nothing: the box keeps its waiting height until the story
12
+ // is there, then takes the story's
13
+ const reported = heights.get(address);
14
+ const contentHeight = isLoading ? Math.max(reported ?? 0, fallbackHeight) : (reported ?? fallbackHeight);
15
+ const height = fixedHeight ?? Math.max(contentHeight, sceneHeight);
16
+ return (_jsxs("div", { className: "forgebook-frame-box", "data-loading": isLoading ? "" : undefined, children: [_jsx("iframe", { ref: ref, className: "forgebook-frame-view", title: title, src: address, style: { height } }), isLoading ? (_jsx("div", { className: "forgebook-frame-loading", role: "status", children: _jsxs("span", { className: "forgebook-frame-loading__label", children: [_jsx("span", { className: "forgebook-spinner", "aria-hidden": "true" }), STRINGS.loadingStory] }) })) : null] }));
17
+ };
18
+ /**
19
+ * Sends a message to every frame inside an element.
20
+ *
21
+ * @param container - the element that holds the frames.
22
+ * @param message - the message.
23
+ */
24
+ export const tellFrames = (container, message) => {
25
+ for (const frame of container?.querySelectorAll("iframe") ?? []) {
26
+ frame.contentWindow?.postMessage(message, window.location.origin);
27
+ }
28
+ };
29
+ //# sourceMappingURL=FrameView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameView.js","sourceRoot":"","sources":["../../../src/shell/FrameView.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,OAAO,EAAE,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,EAAE;IACvF,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,gBAAgB,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QAChE,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpE,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The catalogue's home: the pages opened last, then each source with its own introduction and its families, each
3
+ * family a card of its components. The logo opens it, and so does an address that names no page.
4
+ *
5
+ * @remarks
6
+ * Everything but a source's introduction is drawn from the tree, so it never goes stale; the introduction is the
7
+ * package's own Markdown (`StorySource.home`), rendered by the plugin. No story loads here: a home of frames would load
8
+ * dozens of them before anyone picked one.
9
+ *
10
+ * @module
11
+ */
12
+ import type { StorySource } from "@forgebook/story-format/source";
13
+ import { type ReactNode } from "react";
14
+ import { type StoryTree } from "../storyTree.ts";
15
+ import type { RecentPage } from "./useRecentPages.ts";
16
+ /** The home's props. */
17
+ export type HomePageProps = {
18
+ /** The catalogue's title. */
19
+ readonly title: string;
20
+ /** The tree. */
21
+ readonly tree: StoryTree;
22
+ /** The sources, for their introductions. */
23
+ readonly sources: readonly StorySource[];
24
+ /** The pages opened last, the newest first. */
25
+ readonly recent: readonly RecentPage[];
26
+ /** A page's address, for its link. */
27
+ readonly hrefOf: (page: RecentPage) => string;
28
+ /** Opens a page. */
29
+ readonly onOpen: (page: RecentPage) => void;
30
+ /** What stays above the home: the index's problems, when it has some. */
31
+ readonly header: ReactNode;
32
+ };
33
+ /**
34
+ * The home.
35
+ *
36
+ * @param props - the title, the tree, the sources, the recent pages, and how to open a page.
37
+ */
38
+ export declare const HomePage: ({ title, tree, sources, recent, hrefOf, onOpen, header }: HomePageProps) => ReactNode;
39
+ //# sourceMappingURL=HomePage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../../src/shell/HomePage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAmB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAElE,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKtD,wBAAwB;AACxB,MAAM,MAAM,aAAa,GAAG;IAC1B,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC;IAC9C,oBAAoB;IACpB,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IAC5C,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;CAC5B,CAAC;AAgJF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,0DAQtB,aAAa,KAAG,SA2ElB,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { componentId, findComponent, findStory } from "../storyTree.js";
4
+ import { PackageHtml } from "./PackageHtml.js";
5
+ import { STRINGS } from "./strings.js";
6
+ import { useLoaded } from "./useLoaded.js";
7
+ /** The most components a family's card lists before "Show all". */
8
+ const CARD_COMPONENTS = 6;
9
+ /** A link to a page, opened in place unless the user asks for another tab. */
10
+ const PageLink = ({ page, hrefOf, onOpen, className, children }) => (_jsx("a", { className: className, href: hrefOf(page), onClick: (event) => {
11
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0)
12
+ return;
13
+ event.preventDefault();
14
+ onOpen(page);
15
+ }, children: children }));
16
+ /**
17
+ * The recent pages the tree still has, with their names and places.
18
+ *
19
+ * @param tree - the tree.
20
+ * @param recent - the pages opened last.
21
+ */
22
+ const recentEntries = (tree, recent) => recent.flatMap((page) => {
23
+ if (page.kind === "story") {
24
+ const location = findStory(tree, page.id);
25
+ if (location === undefined)
26
+ return [];
27
+ const place = [location.source.name, location.family.name, location.component.name].join(" · ");
28
+ return [{ page, name: location.story.name, place }];
29
+ }
30
+ const location = findComponent(tree, page.id);
31
+ if (location === undefined)
32
+ return [];
33
+ const place = [location.source.name, location.family.name, location.group.name]
34
+ .filter((part) => part !== undefined)
35
+ .join(" · ");
36
+ return [{ page, name: location.component.name, place }];
37
+ });
38
+ /** What the plugin answered for a source's introduction, as a state. */
39
+ const introState = (value) => {
40
+ const markdown = typeof value === "object" && value !== null && "default" in value ? value.default : undefined;
41
+ if (typeof markdown === "object" &&
42
+ markdown !== null &&
43
+ "html" in markdown &&
44
+ typeof markdown.html === "string") {
45
+ return { status: "ready", value: { html: markdown.html } };
46
+ }
47
+ return { status: "error", message: "The source's introduction has an unexpected shape" };
48
+ };
49
+ /**
50
+ * A source's introduction, as its package wrote it; nothing while it loads or when the source has none.
51
+ *
52
+ * @param props - the loader.
53
+ */
54
+ const SourceIntro = ({ load }) => {
55
+ const intro = useLoaded(load, introState);
56
+ if (intro.status === "error") {
57
+ return (_jsxs("p", { className: "forgebook-problems", role: "alert", children: [STRINGS.homeIntroError, ": ", intro.message] }));
58
+ }
59
+ return intro.status === "ready" ? (_jsx(PackageHtml, { className: "forgebook-prose", html: intro.value.html })) : null;
60
+ };
61
+ /**
62
+ * A family's card: its name and how many components it has, then its components, the first few until asked for all.
63
+ *
64
+ * @param props - the source, the family, and how to open a component.
65
+ */
66
+ const FamilyCard = ({ source, family, hrefOf, onOpen }) => {
67
+ const [isOpen, setIsOpen] = useState(false);
68
+ const components = family.groups.flatMap((group) => [...group.components]);
69
+ const shown = isOpen ? components : components.slice(0, CARD_COMPONENTS);
70
+ return (_jsxs("article", { className: "forgebook-home__card", "aria-label": family.name, children: [_jsxs("h3", { className: "forgebook-home__card-title", children: [family.name, _jsx("span", { className: "forgebook-home__count", children: STRINGS.componentsCount(components.length) })] }), _jsx("ul", { className: "forgebook-home__components", children: shown.map((component) => (_jsx("li", { children: _jsx(PageLink, { page: { kind: "component", id: componentId(source.id, component.title) }, hrefOf: hrefOf, onOpen: onOpen, className: "forgebook-link", children: component.name }) }, component.title))) }), components.length > CARD_COMPONENTS ? (_jsx("button", { type: "button", className: "forgebook-text-button", "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), children: isOpen ? STRINGS.showFewer : STRINGS.showAll(components.length) })) : null] }));
71
+ };
72
+ /**
73
+ * The home.
74
+ *
75
+ * @param props - the title, the tree, the sources, the recent pages, and how to open a page.
76
+ */
77
+ export const HomePage = ({ title, tree, sources, recent, hrefOf, onOpen, header }) => {
78
+ const entries = recentEntries(tree, recent);
79
+ const componentCount = tree.sources.reduce((total, source) => total +
80
+ source.families.reduce((sum, family) => sum + family.groups.reduce((count, group) => count + group.components.length, 0), 0), 0);
81
+ return (_jsxs("div", { className: "forgebook-workspace", children: [header, _jsx("div", { className: "forgebook-scroll", children: _jsxs("div", { className: "forgebook-home", children: [_jsxs("header", { className: "forgebook-home__head", children: [_jsx("h1", { className: "forgebook-home__title", children: title }), _jsx("p", { className: "forgebook-doc__lead", children: tree.sources.length === 0
82
+ ? STRINGS.homeEmpty
83
+ : STRINGS.homeSummary(componentCount, tree.sources.length) })] }), entries.length === 0 ? null : (_jsxs("section", { className: "forgebook-doc__section", "aria-labelledby": "forgebook-recent", children: [_jsx("h2", { id: "forgebook-recent", children: STRINGS.recentlyOpened }), _jsx("ul", { className: "forgebook-home__recent", children: entries.map((entry) => (_jsx("li", { children: _jsxs(PageLink, { page: entry.page, hrefOf: hrefOf, onOpen: onOpen, className: "forgebook-home__recent-link", children: [_jsx("span", { className: "forgebook-home__recent-name", children: entry.name }), _jsx("span", { className: "forgebook-home__recent-place", children: entry.place })] }) }, `${entry.page.kind}:${entry.page.id}`))) })] })), tree.sources.map((source) => (_jsxs("section", { className: "forgebook-doc__section", "aria-labelledby": `forgebook-source-${source.id}`, children: [_jsxs("h2", { id: `forgebook-source-${source.id}`, className: "forgebook-home__source", children: [source.logo === undefined ? null : (_jsx("img", { className: "forgebook-source-logo", src: source.logo, alt: "", width: 28, height: 28 })), source.name] }), _jsx(SourceIntro, { load: sources.find((candidate) => candidate.id === source.id)?.home }), _jsx("div", { className: "forgebook-home__families", children: source.families.map((family) => (_jsx(FamilyCard, { source: source, family: family, hrefOf: hrefOf, onOpen: onOpen }, family.name))) })] }, source.id)))] }) })] }));
84
+ };
85
+ //# sourceMappingURL=HomePage.js.map