forgebook 0.0.0-stage → 0.1.0

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 +115 -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 +47 -0
  249. package/dist/src/shell/StageViewport.d.ts.map +1 -0
  250. package/dist/src/shell/StageViewport.js +174 -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,62 @@
1
+ /**
2
+ * The pages opened last, for the home: kept in this browser, the newest first, a page once.
3
+ *
4
+ * @remarks
5
+ * Only this browser's convenience: never in the address nor shared. A page the tree no longer has (a story renamed)
6
+ * stays stored but the home leaves it out.
7
+ *
8
+ * @module
9
+ */
10
+ import { useEffect } from "react";
11
+ import { useStored } from "./useStored.js";
12
+ /** The storage key. */
13
+ const RECENT_KEY = "recent-pages";
14
+ /** The most pages kept. */
15
+ const MOST_RECENT = 8;
16
+ /** Whether a stored value is a recent page. */
17
+ const isRecentPage = (value) => typeof value === "object" &&
18
+ value !== null &&
19
+ "kind" in value &&
20
+ (value.kind === "story" || value.kind === "component") &&
21
+ "id" in value &&
22
+ typeof value.id === "string";
23
+ /** The stored pages, or none when the text holds none (another format, a damaged value). */
24
+ const storedPages = (stored) => {
25
+ if (stored === null)
26
+ return [];
27
+ try {
28
+ const value = JSON.parse(stored);
29
+ return Array.isArray(value) ? value.filter(isRecentPage) : [];
30
+ }
31
+ catch {
32
+ return [];
33
+ }
34
+ };
35
+ /**
36
+ * The list with a page opened now: first, once, the oldest dropped past the limit.
37
+ *
38
+ * @param pages - the list.
39
+ * @param page - the page opened.
40
+ */
41
+ export const withRecentPage = (pages, page) => [page, ...pages.filter((known) => known.kind !== page.kind || known.id !== page.id)].slice(0, MOST_RECENT);
42
+ /**
43
+ * The pages opened last, recording the shown one.
44
+ *
45
+ * @param shown - the page shown now; none on the home or a missing page.
46
+ */
47
+ export const useRecentPages = (shown) => {
48
+ const [pages, setPages] = useStored(RECENT_KEY, storedPages, JSON.stringify);
49
+ const kind = shown?.kind;
50
+ const id = shown?.id;
51
+ useEffect(() => {
52
+ if (kind === undefined || id === undefined)
53
+ return;
54
+ // already the newest: nothing to store, and no new list to render again with
55
+ const [newest] = pages;
56
+ if (newest?.kind === kind && newest.id === id)
57
+ return;
58
+ setPages(withRecentPage(pages, { kind, id }));
59
+ }, [kind, id, pages, setPages]);
60
+ return pages;
61
+ };
62
+ //# sourceMappingURL=useRecentPages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRecentPages.js","sourceRoot":"","sources":["../../../src/shell/useRecentPages.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAU3C,uBAAuB;AACvB,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC,2BAA2B;AAC3B,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,+CAA+C;AAC/C,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE,CAC3D,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,MAAM,IAAI,KAAK;IACf,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;IACtD,IAAI,IAAI,KAAK;IACb,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC;AAE/B,4FAA4F;AAC5F,MAAM,WAAW,GAAG,CAAC,MAAqB,EAAyB,EAAE;IACnE,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA4B,EAAE,IAAgB,EAAyB,EAAE,CACtG,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;AAE7G;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA6B,EAAyB,EAAE;IACrF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC;IACzB,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC;IACrB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,SAAS,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO;QACnD,6EAA6E;QAC7E,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;QACvB,IAAI,MAAM,EAAE,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE;YAAE,OAAO;QACtD,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChC,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Where a page's scrolling part stands when another page comes in: a page opened anew starts at its top, a page the
3
+ * history brings back (back, forward) takes the position it was left at, as a browser does for its own pages.
4
+ *
5
+ * @remarks
6
+ * The component page and the stage each keep one scrolling element from one page to the next (React reuses the node:
7
+ * same component, same place), so without this its offset survives into a page it means nothing for. The shell
8
+ * keeps the positions, by page, across both kinds of page. A position given back is set again whenever the content's
9
+ * size changes while the page loads (its documentation, its frames), until the person scrolls themselves: what
10
+ * arrives may leave it out of reach or move it; meanwhile the scrolling the browser does on its own (clamping,
11
+ * anchoring) is not taken for the page's position.
12
+ *
13
+ * @module
14
+ */
15
+ import { type RefObject } from "react";
16
+ /**
17
+ * A visit of a page: made anew whenever a page is opened or the history moves, never when only the view changes
18
+ * (its args, its theme), so the person stays where they are then; the same page opened again is a new visit.
19
+ */
20
+ export type PageVisit = {
21
+ /** The page shown, whatever the view. */
22
+ readonly pageKey: string;
23
+ /** Whether the history brought the page back (back or forward), rather than a link or a picker opening it. */
24
+ readonly isReturn: boolean;
25
+ };
26
+ /** What a page needs to know of its scroll position: its visit, and every page's last position. */
27
+ export type PageScroll = {
28
+ /** The visit shown. */
29
+ readonly visit: PageVisit;
30
+ /** Each page's last position, by key: kept by the shell, so it outlives the page that wrote it. */
31
+ readonly positions: Map<string, number>;
32
+ };
33
+ /**
34
+ * Puts a page's scrolling element where the page should start, and keeps its position for when it comes back.
35
+ *
36
+ * @param ref - the scrolling element.
37
+ * @param scroll - the visit and the shell's positions.
38
+ */
39
+ export declare const useScrollMemory: (ref: RefObject<HTMLElement | null>, { visit, positions }: PageScroll) => void;
40
+ //# sourceMappingURL=useScrollMemory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollMemory.d.ts","sourceRoot":"","sources":["../../../src/shell/useScrollMemory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,SAAS,EAAsC,MAAM,OAAO,CAAC;AAE3E;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8GAA8G;IAC9G,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,mGAAmG;AACnG,MAAM,MAAM,UAAU,GAAG;IACvB,uBAAuB;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,mGAAmG;IACnG,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,CAAC;AAKF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,sBAAsB,UAAU,KAC/B,IAuCF,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Where a page's scrolling part stands when another page comes in: a page opened anew starts at its top, a page the
3
+ * history brings back (back, forward) takes the position it was left at, as a browser does for its own pages.
4
+ *
5
+ * @remarks
6
+ * The component page and the stage each keep one scrolling element from one page to the next (React reuses the node:
7
+ * same component, same place), so without this its offset survives into a page it means nothing for. The shell
8
+ * keeps the positions, by page, across both kinds of page. A position given back is set again whenever the content's
9
+ * size changes while the page loads (its documentation, its frames), until the person scrolls themselves: what
10
+ * arrives may leave it out of reach or move it; meanwhile the scrolling the browser does on its own (clamping,
11
+ * anchoring) is not taken for the page's position.
12
+ *
13
+ * @module
14
+ */
15
+ import { useEffect, useLayoutEffect, useRef } from "react";
16
+ /** The input that means the person scrolls themselves: a position given back stops being chased. */
17
+ const OWN_SCROLL_EVENTS = ["wheel", "touchstart", "keydown", "pointerdown"];
18
+ /**
19
+ * Puts a page's scrolling element where the page should start, and keeps its position for when it comes back.
20
+ *
21
+ * @param ref - the scrolling element.
22
+ * @param scroll - the visit and the shell's positions.
23
+ */
24
+ export const useScrollMemory = (ref, { visit, positions }) => {
25
+ // read by the scroll listener, which lives as long as the element: the page shown now, and whether its position
26
+ // is still being reached (until then the offset is the browser's clamping, not the page's position)
27
+ const shownKey = useRef(visit.pageKey);
28
+ const isReaching = useRef(false);
29
+ useLayoutEffect(() => {
30
+ const element = ref.current;
31
+ shownKey.current = visit.pageKey;
32
+ isReaching.current = false;
33
+ if (element === null)
34
+ return;
35
+ const top = visit.isReturn ? (positions.get(visit.pageKey) ?? 0) : 0;
36
+ element.scrollTop = top;
37
+ if (top === 0)
38
+ return;
39
+ // the page still loads: what arrives may leave the position out of reach or, above it, move it (the browser's
40
+ // scroll anchoring), so it is put back whenever the content's size changes, until the person scrolls
41
+ isReaching.current = true;
42
+ const stop = () => {
43
+ isReaching.current = false;
44
+ resizes.disconnect();
45
+ for (const name of OWN_SCROLL_EVENTS)
46
+ element.removeEventListener(name, stop);
47
+ };
48
+ const resizes = new ResizeObserver(() => {
49
+ element.scrollTop = top;
50
+ });
51
+ for (const child of element.children)
52
+ resizes.observe(child);
53
+ for (const name of OWN_SCROLL_EVENTS)
54
+ element.addEventListener(name, stop, { passive: true });
55
+ return stop;
56
+ }, [ref, visit, positions]);
57
+ useEffect(() => {
58
+ const element = ref.current;
59
+ if (element === null)
60
+ return;
61
+ const onScroll = () => {
62
+ if (!isReaching.current)
63
+ positions.set(shownKey.current, element.scrollTop);
64
+ };
65
+ element.addEventListener("scroll", onScroll, { passive: true });
66
+ return () => element.removeEventListener("scroll", onScroll);
67
+ }, [ref, positions]);
68
+ };
69
+ //# sourceMappingURL=useScrollMemory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollMemory.js","sourceRoot":"","sources":["../../../src/shell/useScrollMemory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAkB,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAqB3E,oGAAoG;AACpG,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,CAAU,CAAC;AAErF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,GAAkC,EAClC,EAAE,KAAK,EAAE,SAAS,EAAc,EAC1B,EAAE;IACR,gHAAgH;IAChH,oGAAoG;IACpG,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjC,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC5B,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACjC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO;QAC7B,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC;QACxB,IAAI,GAAG,KAAK,CAAC;YAAE,OAAO;QACtB,8GAA8G;QAC9G,qGAAqG;QACrG,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1B,MAAM,IAAI,GAAG,GAAS,EAAE;YACtB,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3B,OAAO,CAAC,UAAU,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,iBAAiB;gBAAE,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChF,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,GAAS,EAAE;YAC5C,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ;YAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7D,KAAK,MAAM,IAAI,IAAI,iBAAiB;YAAE,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAE5B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC5B,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO;QAC7B,MAAM,QAAQ,GAAG,GAAS,EAAE;YAC1B,IAAI,CAAC,UAAU,CAAC,OAAO;gBAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9E,CAAC,CAAC;QACF,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,OAAO,GAAS,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;AACvB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** The sidebar's layout and its setters. */
2
+ export type SidebarLayout = {
3
+ /** Its width, in CSS px. */
4
+ readonly width: number;
5
+ /** Sets its width. */
6
+ readonly setWidth: (width: number) => void;
7
+ /** Whether it is shown. */
8
+ readonly isOpen: boolean;
9
+ /** Shows or hides it. */
10
+ readonly setIsOpen: (isOpen: boolean) => void;
11
+ };
12
+ /** The sidebar's layout. */
13
+ export declare const useSidebarLayout: () => SidebarLayout;
14
+ //# sourceMappingURL=useSidebarLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSidebarLayout.d.ts","sourceRoot":"","sources":["../../../src/shell/useSidebarLayout.ts"],"names":[],"mappings":"AAQA,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG;IAC1B,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sBAAsB;IACtB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,2BAA2B;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C,CAAC;AAQF,4BAA4B;AAC5B,eAAO,MAAM,gBAAgB,QAAO,aAQnC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The sidebar's width and whether it is shown: this browser's convenience, kept for the next visit, not the address's.
3
+ *
4
+ * @module
5
+ */
6
+ import { boundedSidebarWidth, SIDEBAR_WIDTH } from "./SidebarHandle.js";
7
+ import { useStored } from "./useStored.js";
8
+ /** The width a stored text holds, or the default. */
9
+ const storedWidth = (stored) => {
10
+ const width = Number(stored);
11
+ return stored === null || !Number.isFinite(width) ? SIDEBAR_WIDTH.initial : boundedSidebarWidth(width);
12
+ };
13
+ /** The sidebar's layout. */
14
+ export const useSidebarLayout = () => {
15
+ const [width, setWidth] = useStored("sidebar-width", storedWidth, String);
16
+ const [isOpen, setIsOpen] = useStored("sidebar", (stored) => stored !== "hidden", (shown) => (shown ? "shown" : "hidden"));
17
+ return { width, setWidth, isOpen, setIsOpen };
18
+ };
19
+ //# sourceMappingURL=useSidebarLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSidebarLayout.js","sourceRoot":"","sources":["../../../src/shell/useSidebarLayout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAc3C,qDAAqD;AACrD,MAAM,WAAW,GAAG,CAAC,MAAqB,EAAU,EAAE;IACpD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACzG,CAAC,CAAC;AAEF,4BAA4B;AAC5B,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAkB,EAAE;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC1E,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CACnC,SAAS,EACT,CAAC,MAAqB,EAAW,EAAE,CAAC,MAAM,KAAK,QAAQ,EACvD,CAAC,KAAc,EAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CACzD,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAChD,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A value kept in this browser.
3
+ *
4
+ * @param name - the value's name (`dock-height`), stored under the catalogue's id (`acme-ui:dock-height`), so two
5
+ * catalogues on one origin keep their own.
6
+ * @param read - the value a stored text holds, or the default when it holds none.
7
+ * @param write - the text a value is stored as.
8
+ * @returns the value and its setter.
9
+ */
10
+ export declare const useStored: <TValue>(name: string, read: (stored: string | null) => TValue, write: (value: TValue) => string) => [TValue, (value: TValue) => void];
11
+ //# sourceMappingURL=useStored.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStored.d.ts","sourceRoot":"","sources":["../../../src/shell/useStored.ts"],"names":[],"mappings":"AAoDA;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,EAC9B,MAAM,MAAM,EACZ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,EACvC,OAAO,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,KAC/B,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAMlC,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * A value this browser keeps for the next visit (the panel's height, the sidebar's width): a convenience of the
3
+ * person, not part of the page an address shares.
4
+ *
5
+ * @remarks
6
+ * Storage may be missing or refused (a private window, blocked site data): the value then lives only as long as the
7
+ * page, and nothing fails.
8
+ *
9
+ * @module
10
+ */
11
+ import { useEffect, useState } from "react";
12
+ import { useCatalogue } from "./catalogueContext.js";
13
+ /** The stored text under a key, or none when there is none or storage is refused. */
14
+ const readStored = (key) => {
15
+ try {
16
+ return window.localStorage.getItem(key);
17
+ }
18
+ catch {
19
+ return null;
20
+ }
21
+ };
22
+ /** Keeps a text under a key, when storage allows it. */
23
+ const writeStored = (key, value) => {
24
+ try {
25
+ window.localStorage.setItem(key, value);
26
+ }
27
+ catch {
28
+ // a refused storage only loses the convenience
29
+ }
30
+ };
31
+ /**
32
+ * A value stored under the name every catalogue shared (`forgebook:<name>`), moved under the catalogue's key: read
33
+ * once, written under the new key, removed from the old one.
34
+ *
35
+ * @param name - the value's name.
36
+ * @param key - the catalogue's key for it.
37
+ * @returns the value moved; none when there was none.
38
+ */
39
+ const movedStored = (name, key) => {
40
+ const old = readStored(`forgebook:${name}`);
41
+ if (old === null)
42
+ return null;
43
+ writeStored(key, old);
44
+ try {
45
+ window.localStorage.removeItem(`forgebook:${name}`);
46
+ }
47
+ catch {
48
+ // a browser that refuses the storage keeps nothing anyway
49
+ }
50
+ return old;
51
+ };
52
+ /**
53
+ * A value kept in this browser.
54
+ *
55
+ * @param name - the value's name (`dock-height`), stored under the catalogue's id (`acme-ui:dock-height`), so two
56
+ * catalogues on one origin keep their own.
57
+ * @param read - the value a stored text holds, or the default when it holds none.
58
+ * @param write - the text a value is stored as.
59
+ * @returns the value and its setter.
60
+ */
61
+ export const useStored = (name, read, write) => {
62
+ const key = `${useCatalogue().id}:${name}`;
63
+ const [value, setValue] = useState(() => read(readStored(key) ?? movedStored(name, key)));
64
+ const text = write(value);
65
+ useEffect(() => writeStored(key, text), [key, text]);
66
+ return [value, setValue];
67
+ };
68
+ //# sourceMappingURL=useStored.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStored.js","sourceRoot":"","sources":["../../../src/shell/useStored.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qFAAqF;AACrF,MAAM,UAAU,GAAG,CAAC,GAAW,EAAiB,EAAE;IAChD,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,wDAAwD;AACxD,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,KAAa,EAAQ,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,+CAA+C;IACjD,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,GAAW,EAAiB,EAAE;IAC/D,MAAM,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IAC5C,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC9B,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC;QACH,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,0DAA0D;IAC5D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,IAAY,EACZ,IAAuC,EACvC,KAAgC,EACG,EAAE;IACrC,MAAM,GAAG,GAAG,GAAG,YAAY,EAAE,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;IAC3C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A story file's code for the Code card: each story's `render` as written, loaded from the source's `code`.
3
+ *
4
+ * @module
5
+ */
6
+ import type { StoryFileCode } from "@forgebook/story-format/source";
7
+ import { type Loaded } from "./useLoaded.ts";
8
+ /**
9
+ * The code of a story file.
10
+ *
11
+ * @param load - the source's loader for the file; `undefined` when it has none.
12
+ */
13
+ export declare const useStoryCode: (load: (() => Promise<unknown>) | undefined) => Loaded<StoryFileCode>;
14
+ //# sourceMappingURL=useStoryCode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryCode.d.ts","sourceRoot":"","sources":["../../../src/shell/useStoryCode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,KAAK,MAAM,EAAa,MAAM,gBAAgB,CAAC;AA2BxD;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,KAAG,MAAM,CAAC,aAAa,CAClE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { useLoaded } from "./useLoaded.js";
2
+ /** Whether a value is one story's code: its text and its HTML. */
3
+ const isStoryCode = (value) => typeof value === "object" &&
4
+ value !== null &&
5
+ "text" in value &&
6
+ typeof value.text === "string" &&
7
+ "html" in value &&
8
+ typeof value.html === "string";
9
+ /** Whether the plugin's answer is a file's code: each story's text and HTML, by export name. */
10
+ const isStoryFileCode = (value) => typeof value === "object" &&
11
+ value !== null &&
12
+ !("error" in value) &&
13
+ Object.values(value).every(isStoryCode);
14
+ /** What the plugin answered, as a state. */
15
+ const codeState = (value) => {
16
+ if (isStoryFileCode(value))
17
+ return { status: "ready", value };
18
+ if (typeof value === "object" && value !== null && "error" in value && typeof value.error === "string") {
19
+ return { status: "error", message: value.error };
20
+ }
21
+ return { status: "error", message: "The story file's code has an unexpected shape" };
22
+ };
23
+ /**
24
+ * The code of a story file.
25
+ *
26
+ * @param load - the source's loader for the file; `undefined` when it has none.
27
+ */
28
+ export const useStoryCode = (load) => useLoaded(load, codeState);
29
+ //# sourceMappingURL=useStoryCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryCode.js","sourceRoot":"","sources":["../../../src/shell/useStoryCode.ts"],"names":[],"mappings":"AAOA,OAAO,EAAe,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExD,kEAAkE;AAClE,MAAM,WAAW,GAAG,CAAC,KAAc,EAAW,EAAE,CAC9C,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,MAAM,IAAI,KAAK;IACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,MAAM,IAAI,KAAK;IACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEjC,gGAAgG;AAChG,MAAM,eAAe,GAAG,CAAC,KAAc,EAA0B,EAAE,CACjE,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC;IACnB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAE1C,4CAA4C;AAC5C,MAAM,SAAS,GAAG,CAAC,KAAc,EAAyB,EAAE;IAC1D,IAAI,eAAe,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC9D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,+CAA+C,EAAE,CAAC;AACvF,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAA0C,EAAyB,EAAE,CAChG,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type StoryHeights } from "../storyHeights.ts";
2
+ /**
3
+ * The stories' measured heights.
4
+ *
5
+ * @param url - the heights' file, relative to the page; none when the catalogue has none.
6
+ * @returns the heights, or none while they load or when there are none.
7
+ */
8
+ export declare const useStoryHeights: (url: string | undefined) => StoryHeights | undefined;
9
+ //# sourceMappingURL=useStoryHeights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryHeights.d.ts","sourceRoot":"","sources":["../../../src/shell/useStoryHeights.ts"],"names":[],"mappings":"AAYA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOvE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,GAAG,SAAS,KAAG,YAAY,GAAG,SAaxE,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The stories' measured heights, read once from the file the catalogue's configuration names (`heights`), for the
3
+ * loading boxes.
4
+ *
5
+ * @remarks
6
+ * The file is generated (`forgebook-heights`) and may be missing, stale or, on a development server, answered with
7
+ * the page itself: any answer that is not the heights' document is none, and the shell waits as it did without one.
8
+ *
9
+ * @module
10
+ */
11
+ import { useMemo } from "react";
12
+ import { isStoryHeights } from "../storyHeights.js";
13
+ import { useLoaded } from "./useLoaded.js";
14
+ /** The file's answer as a state: the heights, or none for anything else. */
15
+ const heightsState = (value) => isStoryHeights(value) ? { status: "ready", value } : { status: "none" };
16
+ /**
17
+ * The stories' measured heights.
18
+ *
19
+ * @param url - the heights' file, relative to the page; none when the catalogue has none.
20
+ * @returns the heights, or none while they load or when there are none.
21
+ */
22
+ export const useStoryHeights = (url) => {
23
+ const load = useMemo(() => url === undefined
24
+ ? undefined
25
+ : () => fetch(url)
26
+ .then((response) => (response.ok ? response.json() : undefined))
27
+ .catch(() => undefined), [url]);
28
+ const heights = useLoaded(load, heightsState);
29
+ return heights.status === "ready" ? heights.value : undefined;
30
+ };
31
+ //# sourceMappingURL=useStoryHeights.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryHeights.js","sourceRoot":"","sources":["../../../src/shell/useStoryHeights.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAe,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExD,4EAA4E;AAC5E,MAAM,YAAY,GAAG,CAAC,KAAc,EAAwB,EAAE,CAC5D,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAuB,EAA4B,EAAE;IACnF,MAAM,IAAI,GAAG,OAAO,CAClB,GAAG,EAAE,CACH,GAAG,KAAK,SAAS;QACf,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,GAAqB,EAAE,CACrB,KAAK,CAAC,GAAG,CAAC;aACP,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;aAC/D,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EACjC,CAAC,GAAG,CAAC,CACN,CAAC;IACF,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAChE,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Keeps the page's list of story ids current.
3
+ *
4
+ * @param storyIds - every story's id, in the sidebar's order.
5
+ */
6
+ export declare const useStoryIdsElement: (storyIds: readonly string[]) => void;
7
+ //# sourceMappingURL=useStoryIdsElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryIdsElement.d.ts","sourceRoot":"","sources":["../../../src/shell/useStoryIdsElement.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,SAAS,MAAM,EAAE,KAAG,IAWhE,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The catalogue's story ids, written into the page for its command-line tools: `forgebook-heights` opens the
3
+ * catalogue and reads them, so a tool needs no source of its own to know which stories there are.
4
+ *
5
+ * @remarks
6
+ * A `<script type="application/json">` in the head, which the browser never runs: data on the page, not a global.
7
+ *
8
+ * @module
9
+ */
10
+ import { useEffect } from "react";
11
+ import { STORY_IDS_ELEMENT } from "../storyIdsElement.js";
12
+ /**
13
+ * Keeps the page's list of story ids current.
14
+ *
15
+ * @param storyIds - every story's id, in the sidebar's order.
16
+ */
17
+ export const useStoryIdsElement = (storyIds) => {
18
+ useEffect(() => {
19
+ let element = document.getElementById(STORY_IDS_ELEMENT);
20
+ if (element === null) {
21
+ element = document.createElement("script");
22
+ element.id = STORY_IDS_ELEMENT;
23
+ element.setAttribute("type", "application/json");
24
+ document.head.append(element);
25
+ }
26
+ element.textContent = JSON.stringify(storyIds);
27
+ }, [storyIds]);
28
+ };
29
+ //# sourceMappingURL=useStoryIdsElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryIdsElement.js","sourceRoot":"","sources":["../../../src/shell/useStoryIdsElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAA2B,EAAQ,EAAE;IACtE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;QACzD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC3C,OAAO,CAAC,EAAE,GAAG,iBAAiB,CAAC;YAC/B,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type StoryTree } from "../storyTree.ts";
2
+ /**
3
+ * Listens to the keys that walk the stories.
4
+ *
5
+ * @param tree - the tree.
6
+ * @param shownStoryId - the shown story's id; none on a component's page.
7
+ * @param firstOfPage - on a component's page, its first story's id.
8
+ * @param openStory - opens a story by its id.
9
+ */
10
+ export declare const useStoryKeys: (tree: StoryTree, shownStoryId: string | undefined, firstOfPage: string | undefined, openStory: (id: string) => void) => void;
11
+ //# sourceMappingURL=useStoryKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryKeys.d.ts","sourceRoot":"","sources":["../../../src/shell/useStoryKeys.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,iBAAiB,CAAC;AAIlE;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,SAAS,EACf,cAAc,MAAM,GAAG,SAAS,EAChC,aAAa,MAAM,GAAG,SAAS,EAC/B,WAAW,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,KAC9B,IAyBF,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The keys that walk a catalogue's stories: `[` and `]` open the previous and the next story in the sidebar's order;
3
+ * on a component's page `]` opens its first story (`keyboard.ts`).
4
+ *
5
+ * @module
6
+ */
7
+ import { useEffect, useMemo, useRef } from "react";
8
+ import { sidebarStoryIds } from "../storyTree.js";
9
+ import { useCatalogue } from "./catalogueContext.js";
10
+ import { steppedStory, storyStep } from "./keyboard.js";
11
+ /**
12
+ * Listens to the keys that walk the stories.
13
+ *
14
+ * @param tree - the tree.
15
+ * @param shownStoryId - the shown story's id; none on a component's page.
16
+ * @param firstOfPage - on a component's page, its first story's id.
17
+ * @param openStory - opens a story by its id.
18
+ */
19
+ export const useStoryKeys = (tree, shownStoryId, firstOfPage, openStory) => {
20
+ const { storyGroups } = useCatalogue();
21
+ const storyIds = useMemo(() => sidebarStoryIds(tree, storyGroups.map((group) => group.id)), [tree, storyGroups]);
22
+ // the latest opener, without listening again on every render
23
+ const openRef = useRef(openStory);
24
+ openRef.current = openStory;
25
+ useEffect(() => {
26
+ const walk = (event) => {
27
+ const step = storyStep(event);
28
+ if (step === undefined)
29
+ return;
30
+ const id = steppedStory(storyIds, shownStoryId, step, step === 1 ? firstOfPage : undefined);
31
+ if (id === undefined)
32
+ return;
33
+ event.preventDefault();
34
+ openRef.current(id);
35
+ };
36
+ document.addEventListener("keydown", walk);
37
+ return () => document.removeEventListener("keydown", walk);
38
+ }, [storyIds, shownStoryId, firstOfPage]);
39
+ };
40
+ //# sourceMappingURL=useStoryKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoryKeys.js","sourceRoot":"","sources":["../../../src/shell/useStoryKeys.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAkB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAe,EACf,YAAgC,EAChC,WAA+B,EAC/B,SAA+B,EACzB,EAAE;IACR,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,eAAe,CACb,IAAI,EACJ,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CACrC,EACH,CAAC,IAAI,EAAE,WAAW,CAAC,CACpB,CAAC;IACF,6DAA6D;IAC7D,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,CAAC,KAAoB,EAAQ,EAAE;YAC1C,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9B,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO;YAC/B,MAAM,EAAE,GAAG,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC5F,IAAI,EAAE,KAAK,SAAS;gBAAE,OAAO;YAC7B,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACtB,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC3C,OAAO,GAAS,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Whether the system prefers dark; light where there is no window (a test rendering on the server). */
2
+ export declare const useSystemDark: () => boolean;
3
+ //# sourceMappingURL=useSystemDark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSystemDark.d.ts","sourceRoot":"","sources":["../../../src/shell/useSystemDark.ts"],"names":[],"mappings":"AAoBA,wGAAwG;AACxG,eAAO,MAAM,aAAa,QAAO,OAAkE,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Whether the system prefers a dark appearance, kept current: the `system` theme follows it.
3
+ *
4
+ * @module
5
+ */
6
+ import { useSyncExternalStore } from "react";
7
+ /** The media query of a dark appearance. */
8
+ const DARK = "(prefers-color-scheme: dark)";
9
+ /** Listens to the system's appearance. */
10
+ const subscribe = (onChange) => {
11
+ const query = window.matchMedia(DARK);
12
+ query.addEventListener("change", onChange);
13
+ return () => query.removeEventListener("change", onChange);
14
+ };
15
+ /** Whether the system prefers dark now. */
16
+ const isDarkNow = () => window.matchMedia(DARK).matches;
17
+ /** Whether the system prefers dark; light where there is no window (a test rendering on the server). */
18
+ export const useSystemDark = () => useSyncExternalStore(subscribe, isDarkNow, () => false);
19
+ //# sourceMappingURL=useSystemDark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSystemDark.js","sourceRoot":"","sources":["../../../src/shell/useSystemDark.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE7C,4CAA4C;AAC5C,MAAM,IAAI,GAAG,8BAA8B,CAAC;AAE5C,0CAA0C;AAC1C,MAAM,SAAS,GAAG,CAAC,QAAoB,EAAgB,EAAE;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,GAAS,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,2CAA2C;AAC3C,MAAM,SAAS,GAAG,GAAY,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;AAEjE,wGAAwG;AACxG,MAAM,CAAC,MAAM,aAAa,GAAG,GAAY,EAAE,CAAC,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A source's story files as one group: its `?forgebook-files` groups merged, so the tree, the frame and the panel look
3
+ * a file up by its key wherever its pattern was declared.
4
+ *
5
+ * @remarks
6
+ * The keys are paths relative to the module that declared the source, unique across its groups. The merge is kept per
7
+ * source object, so a page that asks on every render merges once. Pure apart from that cache.
8
+ *
9
+ * @module
10
+ */
11
+ import type { StoryFiles, StorySource } from "@forgebook/story-format/source";
12
+ /**
13
+ * A source's story files, every group merged.
14
+ *
15
+ * @param source - the source.
16
+ */
17
+ export declare const sourceFiles: (source: StorySource) => StoryFiles;
18
+ //# sourceMappingURL=sourceFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceFiles.d.ts","sourceRoot":"","sources":["../../src/sourceFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAK9E;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,WAAW,KAAG,UAYjD,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** The merged files of each source seen, by the source object itself. */
2
+ const MERGED = new WeakMap();
3
+ /**
4
+ * A source's story files, every group merged.
5
+ *
6
+ * @param source - the source.
7
+ */
8
+ export const sourceFiles = (source) => {
9
+ const known = MERGED.get(source);
10
+ if (known !== undefined)
11
+ return known;
12
+ const merged = {
13
+ index: Object.assign({}, ...source.files.map((group) => group.index)),
14
+ stories: Object.assign({}, ...source.files.map((group) => group.stories)),
15
+ docs: Object.assign({}, ...source.files.map((group) => group.docs)),
16
+ code: Object.assign({}, ...source.files.map((group) => group.code)),
17
+ pages: Object.assign({}, ...source.files.map((group) => group.pages))
18
+ };
19
+ MERGED.set(source, merged);
20
+ return merged;
21
+ };
22
+ //# sourceMappingURL=sourceFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceFiles.js","sourceRoot":"","sources":["../../src/sourceFiles.ts"],"names":[],"mappings":"AAYA,yEAAyE;AACzE,MAAM,MAAM,GAAG,IAAI,OAAO,EAA2B,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAmB,EAAc,EAAE;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,MAAM,GAAe;QACzB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACtE,CAAC;IACF,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}