forgebook 0.1.3 → 0.1.4

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 (339) hide show
  1. package/README.md +74 -6
  2. package/dist/bin/forgebook/agentClient.d.ts +17 -0
  3. package/dist/bin/forgebook/agentClient.d.ts.map +1 -1
  4. package/dist/bin/forgebook/agentClient.js +21 -0
  5. package/dist/bin/forgebook/agentClient.js.map +1 -1
  6. package/dist/bin/forgebook/agentLoopCommands.d.mts +9 -0
  7. package/dist/bin/forgebook/agentLoopCommands.d.mts.map +1 -0
  8. package/dist/bin/forgebook/agentLoopCommands.mjs +217 -0
  9. package/dist/bin/forgebook/agentLoopCommands.mjs.map +1 -0
  10. package/dist/bin/forgebook/agentText.d.ts +37 -1
  11. package/dist/bin/forgebook/agentText.d.ts.map +1 -1
  12. package/dist/bin/forgebook/agentText.js +49 -2
  13. package/dist/bin/forgebook/agentText.js.map +1 -1
  14. package/dist/bin/forgebook/agents.md +46 -0
  15. package/dist/bin/forgebook/agentsText.d.ts +29 -0
  16. package/dist/bin/forgebook/agentsText.d.ts.map +1 -0
  17. package/dist/bin/forgebook/agentsText.js +48 -0
  18. package/dist/bin/forgebook/agentsText.js.map +1 -0
  19. package/dist/bin/forgebook/catalogueCommands.d.ts +51 -0
  20. package/dist/bin/forgebook/catalogueCommands.d.ts.map +1 -0
  21. package/dist/bin/forgebook/catalogueCommands.js +90 -0
  22. package/dist/bin/forgebook/catalogueCommands.js.map +1 -0
  23. package/dist/bin/forgebook/errorsRun.d.ts +27 -0
  24. package/dist/bin/forgebook/errorsRun.d.ts.map +1 -0
  25. package/dist/bin/forgebook/errorsRun.js +60 -0
  26. package/dist/bin/forgebook/errorsRun.js.map +1 -0
  27. package/dist/bin/forgebook/forgebook.mjs +109 -84
  28. package/dist/bin/forgebook/forgebook.mjs.map +1 -1
  29. package/dist/bin/forgebook/importers/storybook.d.ts +53 -0
  30. package/dist/bin/forgebook/importers/storybook.d.ts.map +1 -0
  31. package/dist/bin/forgebook/importers/storybook.js +318 -0
  32. package/dist/bin/forgebook/importers/storybook.js.map +1 -0
  33. package/dist/bin/forgebook/initCommands.d.mts +9 -0
  34. package/dist/bin/forgebook/initCommands.d.mts.map +1 -0
  35. package/dist/bin/forgebook/initCommands.mjs +86 -0
  36. package/dist/bin/forgebook/initCommands.mjs.map +1 -0
  37. package/dist/bin/forgebook/initConfig.d.ts +22 -0
  38. package/dist/bin/forgebook/initConfig.d.ts.map +1 -0
  39. package/dist/bin/forgebook/initConfig.js +51 -0
  40. package/dist/bin/forgebook/initConfig.js.map +1 -0
  41. package/dist/bin/forgebook/mcpTools.d.ts +29 -3
  42. package/dist/bin/forgebook/mcpTools.d.ts.map +1 -1
  43. package/dist/bin/forgebook/mcpTools.js +130 -7
  44. package/dist/bin/forgebook/mcpTools.js.map +1 -1
  45. package/dist/bin/forgebook/newStories.d.ts +27 -0
  46. package/dist/bin/forgebook/newStories.d.ts.map +1 -0
  47. package/dist/bin/forgebook/newStories.js +109 -0
  48. package/dist/bin/forgebook/newStories.js.map +1 -0
  49. package/dist/bin/forgebook/newStoriesFile.d.ts +18 -0
  50. package/dist/bin/forgebook/newStoriesFile.d.ts.map +1 -0
  51. package/dist/bin/forgebook/newStoriesFile.js +58 -0
  52. package/dist/bin/forgebook/newStoriesFile.js.map +1 -0
  53. package/dist/bin/forgebook/storyCheckRun.d.ts +39 -0
  54. package/dist/bin/forgebook/storyCheckRun.d.ts.map +1 -0
  55. package/dist/bin/forgebook/storyCheckRun.js +177 -0
  56. package/dist/bin/forgebook/storyCheckRun.js.map +1 -0
  57. package/dist/bin/forgebook-docs/catalogueDocs.d.ts +24 -0
  58. package/dist/bin/forgebook-docs/catalogueDocs.d.ts.map +1 -0
  59. package/dist/bin/forgebook-docs/catalogueDocs.js +71 -0
  60. package/dist/bin/forgebook-docs/catalogueDocs.js.map +1 -0
  61. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts +8 -0
  62. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts.map +1 -1
  63. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts +3 -1
  64. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts.map +1 -1
  65. package/dist/bin/forgebook-docs/catalogueMarkdown.js +62 -42
  66. package/dist/bin/forgebook-docs/catalogueMarkdown.js.map +1 -1
  67. package/dist/bin/forgebook-docs/catalogueOptions.d.ts +39 -0
  68. package/dist/bin/forgebook-docs/catalogueOptions.d.ts.map +1 -0
  69. package/dist/bin/forgebook-docs/catalogueOptions.js +76 -0
  70. package/dist/bin/forgebook-docs/catalogueOptions.js.map +1 -0
  71. package/dist/bin/forgebook-docs/collectDocs.d.ts +3 -1
  72. package/dist/bin/forgebook-docs/collectDocs.d.ts.map +1 -1
  73. package/dist/bin/forgebook-docs/collectDocs.js +37 -13
  74. package/dist/bin/forgebook-docs/collectDocs.js.map +1 -1
  75. package/dist/bin/forgebook-docs/forgebook-docs.mjs +17 -80
  76. package/dist/bin/forgebook-docs/forgebook-docs.mjs.map +1 -1
  77. package/dist/bin/forgebook-docs/llmsText.d.ts +24 -0
  78. package/dist/bin/forgebook-docs/llmsText.d.ts.map +1 -0
  79. package/dist/bin/forgebook-docs/llmsText.js +33 -0
  80. package/dist/bin/forgebook-docs/llmsText.js.map +1 -0
  81. package/dist/bin/forgebook-docs/sourceId.d.ts +9 -0
  82. package/dist/bin/forgebook-docs/sourceId.d.ts.map +1 -0
  83. package/dist/bin/forgebook-docs/sourceId.js +45 -0
  84. package/dist/bin/forgebook-docs/sourceId.js.map +1 -0
  85. package/dist/bin/frameworkDocs.d.ts +10 -0
  86. package/dist/bin/frameworkDocs.d.ts.map +1 -0
  87. package/dist/bin/frameworkDocs.js +43 -0
  88. package/dist/bin/frameworkDocs.js.map +1 -0
  89. package/dist/src/argTypes.d.ts +23 -0
  90. package/dist/src/argTypes.d.ts.map +1 -1
  91. package/dist/src/argTypes.js +27 -0
  92. package/dist/src/argTypes.js.map +1 -1
  93. package/dist/src/catalogue.d.ts +70 -3
  94. package/dist/src/catalogue.d.ts.map +1 -1
  95. package/dist/src/catalogue.js +85 -3
  96. package/dist/src/catalogue.js.map +1 -1
  97. package/dist/src/controlKeys.d.ts +85 -0
  98. package/dist/src/controlKeys.d.ts.map +1 -0
  99. package/dist/src/controlKeys.js +118 -0
  100. package/dist/src/controlKeys.js.map +1 -0
  101. package/dist/src/frame/frame.css +33 -2
  102. package/dist/src/frame/frameView.d.ts +2 -2
  103. package/dist/src/frame/frameView.d.ts.map +1 -1
  104. package/dist/src/frame/frameView.js +7 -3
  105. package/dist/src/frame/frameView.js.map +1 -1
  106. package/dist/src/frame/mountFrame.d.ts.map +1 -1
  107. package/dist/src/frame/mountFrame.js +26 -2
  108. package/dist/src/frame/mountFrame.js.map +1 -1
  109. package/dist/src/frame/spillOutline.d.ts +10 -0
  110. package/dist/src/frame/spillOutline.d.ts.map +1 -0
  111. package/dist/src/frame/spillOutline.js +80 -0
  112. package/dist/src/frame/spillOutline.js.map +1 -0
  113. package/dist/src/liveErrors.d.ts +57 -0
  114. package/dist/src/liveErrors.d.ts.map +1 -0
  115. package/dist/src/liveErrors.js +52 -0
  116. package/dist/src/liveErrors.js.map +1 -0
  117. package/dist/src/messages.d.ts +12 -0
  118. package/dist/src/messages.d.ts.map +1 -1
  119. package/dist/src/messages.js +4 -0
  120. package/dist/src/messages.js.map +1 -1
  121. package/dist/src/namedViews.d.ts +80 -0
  122. package/dist/src/namedViews.d.ts.map +1 -0
  123. package/dist/src/namedViews.js +88 -0
  124. package/dist/src/namedViews.js.map +1 -0
  125. package/dist/src/shell/AppearanceMenu.d.ts +15 -0
  126. package/dist/src/shell/AppearanceMenu.d.ts.map +1 -0
  127. package/dist/src/shell/AppearanceMenu.js +28 -0
  128. package/dist/src/shell/AppearanceMenu.js.map +1 -0
  129. package/dist/src/shell/BoxWidth.d.ts +40 -0
  130. package/dist/src/shell/BoxWidth.d.ts.map +1 -0
  131. package/dist/src/shell/BoxWidth.js +56 -0
  132. package/dist/src/shell/BoxWidth.js.map +1 -0
  133. package/dist/src/shell/ComponentPage.d.ts +17 -1
  134. package/dist/src/shell/ComponentPage.d.ts.map +1 -1
  135. package/dist/src/shell/ComponentPage.js +19 -54
  136. package/dist/src/shell/ComponentPage.js.map +1 -1
  137. package/dist/src/shell/ControlKeyField.d.ts +21 -0
  138. package/dist/src/shell/ControlKeyField.d.ts.map +1 -0
  139. package/dist/src/shell/ControlKeyField.js +46 -0
  140. package/dist/src/shell/ControlKeyField.js.map +1 -0
  141. package/dist/src/shell/ControlRow.d.ts +31 -0
  142. package/dist/src/shell/ControlRow.d.ts.map +1 -0
  143. package/dist/src/shell/ControlRow.js +27 -0
  144. package/dist/src/shell/ControlRow.js.map +1 -0
  145. package/dist/src/shell/Example.d.ts +58 -0
  146. package/dist/src/shell/Example.d.ts.map +1 -0
  147. package/dist/src/shell/Example.js +89 -0
  148. package/dist/src/shell/Example.js.map +1 -0
  149. package/dist/src/shell/NamedViews.d.ts +23 -0
  150. package/dist/src/shell/NamedViews.d.ts.map +1 -0
  151. package/dist/src/shell/NamedViews.js +49 -0
  152. package/dist/src/shell/NamedViews.js.map +1 -0
  153. package/dist/src/shell/PinnedControl.d.ts +25 -0
  154. package/dist/src/shell/PinnedControl.d.ts.map +1 -0
  155. package/dist/src/shell/PinnedControl.js +81 -0
  156. package/dist/src/shell/PinnedControl.js.map +1 -0
  157. package/dist/src/shell/PropsTab.d.ts +5 -2
  158. package/dist/src/shell/PropsTab.d.ts.map +1 -1
  159. package/dist/src/shell/PropsTab.js +12 -15
  160. package/dist/src/shell/PropsTab.js.map +1 -1
  161. package/dist/src/shell/Shell.d.ts.map +1 -1
  162. package/dist/src/shell/Shell.js +27 -2
  163. package/dist/src/shell/Shell.js.map +1 -1
  164. package/dist/src/shell/Sidebar.d.ts +11 -9
  165. package/dist/src/shell/Sidebar.d.ts.map +1 -1
  166. package/dist/src/shell/Sidebar.js +48 -42
  167. package/dist/src/shell/Sidebar.js.map +1 -1
  168. package/dist/src/shell/SidebarEntries.d.ts +50 -0
  169. package/dist/src/shell/SidebarEntries.d.ts.map +1 -0
  170. package/dist/src/shell/SidebarEntries.js +51 -0
  171. package/dist/src/shell/SidebarEntries.js.map +1 -0
  172. package/dist/src/shell/Stage.d.ts.map +1 -1
  173. package/dist/src/shell/Stage.js +19 -2
  174. package/dist/src/shell/Stage.js.map +1 -1
  175. package/dist/src/shell/Toolbar.d.ts +7 -3
  176. package/dist/src/shell/Toolbar.d.ts.map +1 -1
  177. package/dist/src/shell/Toolbar.js +38 -68
  178. package/dist/src/shell/Toolbar.js.map +1 -1
  179. package/dist/src/shell/ToolbarControl.d.ts +47 -0
  180. package/dist/src/shell/ToolbarControl.d.ts.map +1 -0
  181. package/dist/src/shell/ToolbarControl.js +150 -0
  182. package/dist/src/shell/ToolbarControl.js.map +1 -0
  183. package/dist/src/shell/UsedIn.d.ts +38 -0
  184. package/dist/src/shell/UsedIn.d.ts.map +1 -0
  185. package/dist/src/shell/UsedIn.js +77 -0
  186. package/dist/src/shell/UsedIn.js.map +1 -0
  187. package/dist/src/shell/ViewMenu.d.ts +37 -0
  188. package/dist/src/shell/ViewMenu.d.ts.map +1 -0
  189. package/dist/src/shell/ViewMenu.js +216 -0
  190. package/dist/src/shell/ViewMenu.js.map +1 -0
  191. package/dist/src/shell/controlCycle.d.ts +28 -0
  192. package/dist/src/shell/controlCycle.d.ts.map +1 -0
  193. package/dist/src/shell/controlCycle.js +51 -0
  194. package/dist/src/shell/controlCycle.js.map +1 -0
  195. package/dist/src/shell/dockTabs.d.ts +3 -0
  196. package/dist/src/shell/dockTabs.d.ts.map +1 -1
  197. package/dist/src/shell/dockTabs.js +1 -1
  198. package/dist/src/shell/dockTabs.js.map +1 -1
  199. package/dist/src/shell/icons.d.ts +6 -0
  200. package/dist/src/shell/icons.d.ts.map +1 -1
  201. package/dist/src/shell/icons.js +7 -1
  202. package/dist/src/shell/icons.js.map +1 -1
  203. package/dist/src/shell/keyboard.d.ts +2 -1
  204. package/dist/src/shell/keyboard.d.ts.map +1 -1
  205. package/dist/src/shell/keyboard.js +5 -2
  206. package/dist/src/shell/keyboard.js.map +1 -1
  207. package/dist/src/shell/shell.css +826 -243
  208. package/dist/src/shell/strings.d.ts +45 -0
  209. package/dist/src/shell/strings.d.ts.map +1 -1
  210. package/dist/src/shell/strings.js +45 -0
  211. package/dist/src/shell/strings.js.map +1 -1
  212. package/dist/src/shell/useAppearance.d.ts +17 -0
  213. package/dist/src/shell/useAppearance.d.ts.map +1 -0
  214. package/dist/src/shell/useAppearance.js +36 -0
  215. package/dist/src/shell/useAppearance.js.map +1 -0
  216. package/dist/src/shell/useControlKeys.d.ts +23 -0
  217. package/dist/src/shell/useControlKeys.d.ts.map +1 -0
  218. package/dist/src/shell/useControlKeys.js +44 -0
  219. package/dist/src/shell/useControlKeys.js.map +1 -0
  220. package/dist/src/shell/useFold.d.ts +27 -0
  221. package/dist/src/shell/useFold.d.ts.map +1 -0
  222. package/dist/src/shell/useFold.js +87 -0
  223. package/dist/src/shell/useFold.js.map +1 -0
  224. package/dist/src/shell/useFrameMessages.d.ts +2 -0
  225. package/dist/src/shell/useFrameMessages.d.ts.map +1 -1
  226. package/dist/src/shell/useFrameMessages.js +3 -0
  227. package/dist/src/shell/useFrameMessages.js.map +1 -1
  228. package/dist/src/shell/useFullPage.d.ts +45 -0
  229. package/dist/src/shell/useFullPage.d.ts.map +1 -0
  230. package/dist/src/shell/useFullPage.js +149 -0
  231. package/dist/src/shell/useFullPage.js.map +1 -0
  232. package/dist/src/shell/usePopover.d.ts +17 -3
  233. package/dist/src/shell/usePopover.d.ts.map +1 -1
  234. package/dist/src/shell/usePopover.js +65 -4
  235. package/dist/src/shell/usePopover.js.map +1 -1
  236. package/dist/src/shell/useStored.d.ts +13 -2
  237. package/dist/src/shell/useStored.d.ts.map +1 -1
  238. package/dist/src/shell/useStored.js +1 -1
  239. package/dist/src/shell/useStored.js.map +1 -1
  240. package/dist/src/shell/useToolbarLayout.d.ts +39 -0
  241. package/dist/src/shell/useToolbarLayout.d.ts.map +1 -0
  242. package/dist/src/shell/useToolbarLayout.js +58 -0
  243. package/dist/src/shell/useToolbarLayout.js.map +1 -0
  244. package/dist/src/shell/useToolbarOverflow.d.ts +31 -0
  245. package/dist/src/shell/useToolbarOverflow.d.ts.map +1 -0
  246. package/dist/src/shell/useToolbarOverflow.js +62 -0
  247. package/dist/src/shell/useToolbarOverflow.js.map +1 -0
  248. package/dist/src/shell/useWorstCase.d.ts +46 -0
  249. package/dist/src/shell/useWorstCase.d.ts.map +1 -0
  250. package/dist/src/shell/useWorstCase.js +42 -0
  251. package/dist/src/shell/useWorstCase.js.map +1 -0
  252. package/dist/src/shell/worstArgs.d.ts +42 -0
  253. package/dist/src/shell/worstArgs.d.ts.map +1 -0
  254. package/dist/src/shell/worstArgs.js +47 -0
  255. package/dist/src/shell/worstArgs.js.map +1 -0
  256. package/dist/src/spills.d.ts +31 -0
  257. package/dist/src/spills.d.ts.map +1 -0
  258. package/dist/src/spills.js +65 -0
  259. package/dist/src/spills.js.map +1 -0
  260. package/dist/src/storyCheck.d.ts +105 -0
  261. package/dist/src/storyCheck.d.ts.map +1 -0
  262. package/dist/src/storyCheck.js +63 -0
  263. package/dist/src/storyCheck.js.map +1 -0
  264. package/dist/src/switches.d.ts +16 -4
  265. package/dist/src/switches.d.ts.map +1 -1
  266. package/dist/src/switches.js +30 -5
  267. package/dist/src/switches.js.map +1 -1
  268. package/dist/src/toolbarLayout.d.ts +119 -0
  269. package/dist/src/toolbarLayout.d.ts.map +1 -0
  270. package/dist/src/toolbarLayout.js +155 -0
  271. package/dist/src/toolbarLayout.js.map +1 -0
  272. package/dist/src/usedIn.d.ts +60 -0
  273. package/dist/src/usedIn.d.ts.map +1 -0
  274. package/dist/src/usedIn.js +92 -0
  275. package/dist/src/usedIn.js.map +1 -0
  276. package/dist/src/viewState.d.ts +6 -10
  277. package/dist/src/viewState.d.ts.map +1 -1
  278. package/dist/src/viewState.js +20 -18
  279. package/dist/src/viewState.js.map +1 -1
  280. package/dist/src/viewWords.d.ts +26 -0
  281. package/dist/src/viewWords.d.ts.map +1 -0
  282. package/dist/src/viewWords.js +29 -0
  283. package/dist/src/viewWords.js.map +1 -0
  284. package/dist/src/vite/adapter.d.ts +13 -4
  285. package/dist/src/vite/adapter.d.ts.map +1 -1
  286. package/dist/src/vite/adapter.js +4 -2
  287. package/dist/src/vite/adapter.js.map +1 -1
  288. package/dist/src/vite/agent.types.d.ts +32 -2
  289. package/dist/src/vite/agent.types.d.ts.map +1 -1
  290. package/dist/src/vite/agentApi.d.ts +15 -3
  291. package/dist/src/vite/agentApi.d.ts.map +1 -1
  292. package/dist/src/vite/agentApi.js +63 -9
  293. package/dist/src/vite/agentApi.js.map +1 -1
  294. package/dist/src/vite/agentRoutes.d.ts +8 -3
  295. package/dist/src/vite/agentRoutes.d.ts.map +1 -1
  296. package/dist/src/vite/agentRoutes.js +84 -23
  297. package/dist/src/vite/agentRoutes.js.map +1 -1
  298. package/dist/src/vite/configFile.d.ts +2 -1
  299. package/dist/src/vite/configFile.d.ts.map +1 -1
  300. package/dist/src/vite/configFile.js +29 -11
  301. package/dist/src/vite/configFile.js.map +1 -1
  302. package/dist/src/vite/docsExtractor.d.ts +26 -2
  303. package/dist/src/vite/docsExtractor.d.ts.map +1 -1
  304. package/dist/src/vite/docsExtractor.js +12 -9
  305. package/dist/src/vite/docsExtractor.js.map +1 -1
  306. package/dist/src/vite/docsWorker.js +18 -2
  307. package/dist/src/vite/docsWorker.js.map +1 -1
  308. package/dist/src/vite/forgebookPlugin.d.ts.map +1 -1
  309. package/dist/src/vite/forgebookPlugin.js +109 -16
  310. package/dist/src/vite/forgebookPlugin.js.map +1 -1
  311. package/dist/src/vite/indexStoryFile.d.ts +14 -0
  312. package/dist/src/vite/indexStoryFile.d.ts.map +1 -1
  313. package/dist/src/vite/indexStoryFile.js +13 -4
  314. package/dist/src/vite/indexStoryFile.js.map +1 -1
  315. package/dist/src/vite/mcpProtocol.d.ts +9 -0
  316. package/dist/src/vite/mcpProtocol.d.ts.map +1 -1
  317. package/dist/src/vite/mcpProtocol.js +6 -3
  318. package/dist/src/vite/mcpProtocol.js.map +1 -1
  319. package/dist/src/vite/storyFilesModule.d.ts +28 -1
  320. package/dist/src/vite/storyFilesModule.d.ts.map +1 -1
  321. package/dist/src/vite/storyFilesModule.js +34 -14
  322. package/dist/src/vite/storyFilesModule.js.map +1 -1
  323. package/dist/src/vite/usageGraph.d.ts +45 -0
  324. package/dist/src/vite/usageGraph.d.ts.map +1 -0
  325. package/dist/src/vite/usageGraph.js +246 -0
  326. package/dist/src/vite/usageGraph.js.map +1 -0
  327. package/dist/src/vite/usageModule.d.ts +33 -0
  328. package/dist/src/vite/usageModule.d.ts.map +1 -0
  329. package/dist/src/vite/usageModule.js +135 -0
  330. package/dist/src/vite/usageModule.js.map +1 -0
  331. package/dist/src/worstCase.d.ts +16 -0
  332. package/dist/src/worstCase.d.ts.map +1 -0
  333. package/dist/src/worstCase.js +16 -0
  334. package/dist/src/worstCase.js.map +1 -0
  335. package/package.json +14 -2
  336. package/dist/src/shell/SchemeSwitches.d.ts +0 -24
  337. package/dist/src/shell/SchemeSwitches.d.ts.map +0 -1
  338. package/dist/src/shell/SchemeSwitches.js +0 -36
  339. package/dist/src/shell/SchemeSwitches.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A view written the short way, as words (`dark it 360`), turned into the address's form (`theme=dark&lang=it&width=360`),
3
+ * for `forgebook check`, `forgebook shot` and their MCP tools.
4
+ *
5
+ * @remarks
6
+ * A word is a value of exactly one of the catalogue's switches, or a number, the story's width. The words are
7
+ * separated by spaces or `+` (a comma would split the option into several views). A view that already holds `=` is the
8
+ * address's form and is kept as it is. A word no switch has, or one two switches share, is refused with what to write
9
+ * instead. Pure.
10
+ *
11
+ * @module
12
+ */
13
+ import type { ViewSwitch } from "./switches.ts";
14
+ /**
15
+ * A view in the address's form.
16
+ *
17
+ * @param text - the view: the address's form, or words.
18
+ * @param switches - the catalogue's switches.
19
+ * @returns the address's form, or why a word cannot be read.
20
+ */
21
+ export declare const viewQuery: (text: string, switches: readonly ViewSwitch[]) => {
22
+ readonly query: string;
23
+ } | {
24
+ readonly error: string;
25
+ };
26
+ //# sourceMappingURL=viewWords.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewWords.d.ts","sourceRoot":"","sources":["../../src/viewWords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GACpB,MAAM,MAAM,EACZ,UAAU,SAAS,UAAU,EAAE,KAC9B;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAkBvD,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A view in the address's form.
3
+ *
4
+ * @param text - the view: the address's form, or words.
5
+ * @param switches - the catalogue's switches.
6
+ * @returns the address's form, or why a word cannot be read.
7
+ */
8
+ export const viewQuery = (text, switches) => {
9
+ if (text.includes("="))
10
+ return { query: text };
11
+ const parts = [];
12
+ for (const word of text.split(/[\s+]+/).filter((each) => each !== "")) {
13
+ if (/^\d+$/.test(word)) {
14
+ parts.push(`width=${word}`);
15
+ continue;
16
+ }
17
+ const owners = switches.filter((each) => each.values.some((value) => value.value === word));
18
+ const [owner] = owners;
19
+ if (owner === undefined)
20
+ return { error: `No switch has the value "${word}"` };
21
+ if (owners.length > 1)
22
+ return {
23
+ error: `"${word}" is a value of ${owners.map((each) => each.id).join(" and ")}: write ${owner.id}=${word}`
24
+ };
25
+ parts.push(`${owner.id}=${word}`);
26
+ }
27
+ return { query: parts.join("&") };
28
+ };
29
+ //# sourceMappingURL=viewWords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewWords.js","sourceR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C,CAAC;IACpC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACpC,CAAC,CAAC"}
@@ -59,12 +59,21 @@ export type FrameworkAdapter = {
59
59
  /** The Vite plugins the framework needs in a catalogue (React's Fast Refresh); none by default. */
60
60
  readonly vitePlugins?: () => Promise<readonly PluginOption[]>;
61
61
  };
62
+ /** Reads the component a file exports (`forgebook new`): the export named, or the file's only component. */
63
+ export type ExtractFileComponent = (file: string, exportName?: string) => StoryComponentResult;
64
+ /** A framework's docs module, as the plugin and the commands load it. */
65
+ export type DocsModule = {
66
+ /** Reads a story file's component. */
67
+ readonly extractStoryComponent: ExtractStoryComponent;
68
+ /** Reads a component a file exports; none in a framework package that does not offer it yet. */
69
+ readonly extractFileComponent?: ExtractFileComponent;
70
+ /** The module a story file imports its types from (`@forgebook/react`); none when not given. */
71
+ readonly storyTypesModule?: string;
72
+ };
62
73
  /**
63
- * Whether a loaded module is a docs module: it exports an `extractStoryComponent` function.
74
+ * Whether a module is a framework's docs module.
64
75
  *
65
76
  * @param module - the module, as `import()` gave it.
66
77
  */
67
- export declare const isDocsModule: (module: unknown) => module is {
68
- readonly extractStoryComponent: ExtractStoryComponent;
69
- };
78
+ export declare const isDocsModule: (module: unknown) => module is DocsModule;
70
79
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/vite/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE1E,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG;IAC3B,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,sDAAsD;IACtD,QAAQ,CAAC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QAAQ,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IACrD,gGAAgG;IAChG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,OAAO,KAAG,MAAM,IAAI,UAMyB,CAAC"}
@@ -11,12 +11,14 @@
11
11
  * @module
12
12
  */
13
13
  /**
14
- * Whether a loaded module is a docs module: it exports an `extractStoryComponent` function.
14
+ * Whether a module is a framework's docs module.
15
15
  *
16
16
  * @param module - the module, as `import()` gave it.
17
17
  */
18
18
  export const isDocsModule = (module) => typeof module === "object" &&
19
19
  module !== null &&
20
20
  "extractStoryComponent" in module &&
21
- typeof module.extractStoryComponent === "function";
21
+ typeof module.extractStoryComponent === "function" &&
22
+ (!("extractFileComponent" in module) || typeof module.extractFileComponent === "function") &&
23
+ (!("storyTypesModule" in module) || typeof module.storyTypesModule === "string");
22
24
  //# sourceMappingURL=adapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/vite/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuDH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAe,EACsD,EAAE,CACvE,OAAO,MAAM,KAAK,QAAQ;IAC1B,MAAM,KAAK,IAAI;IACf,uBAAuB,IAAI,MAAM;IACjC,OAAO,MAAM,CAAC,qBAAqB,KAAK,UAAU,CAAC"}
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/vite/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAoEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAe,EAAwB,EAAE,CACpE,OAAO,MAAM,KAAK,QAAQ;IAC1B,MAAM,KAAK,IAAI;IACf,uBAAuB,IAAI,MAAM;IACjC,OAAO,MAAM,CAAC,qBAAqB,KAAK,UAAU;IAClD,CAAC,CAAC,CAAC,sBAAsB,IAAI,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,oBAAoB,KAAK,UAAU,CAAC;IAC1F,CAAC,CAAC,CAAC,kBAAkB,IAAI,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,QAAQ,CAAC,CAAC"}
@@ -10,6 +10,7 @@
10
10
  * @module
11
11
  */
12
12
  import type { ComponentDocs } from "../componentDocs.ts";
13
+ import type { LiveError } from "../liveErrors.ts";
13
14
  /** The version of the documents' shape. */
14
15
  export type AgentSchema = 1;
15
16
  /** Where a story opens, in the view the answer describes. */
@@ -33,9 +34,22 @@ export type AgentStory = {
33
34
  readonly tags: readonly string[];
34
35
  /** Whether it is listed nowhere (`!dev`), opened only by its address. */
35
36
  readonly isUnlisted: boolean;
37
+ /** The height its scene declares (`parameters.height`), in CSS px, when it declares one. */
38
+ readonly height?: number;
36
39
  /** Where it opens. */
37
40
  readonly links: StoryLinks;
38
41
  };
42
+ /** A component whose stories use another ("Used in"). */
43
+ export type AgentUsingComponent = {
44
+ /** Its id, as `AgentComponent.id`. */
45
+ readonly id: string;
46
+ /** Its title. */
47
+ readonly title: string;
48
+ /** Whether one of its stories renders the component itself, not only through another component. */
49
+ readonly isDirect: boolean;
50
+ /** The ids of its stories that use the component. */
51
+ readonly stories: readonly string[];
52
+ };
39
53
  /** A component (a story file) and its stories. */
40
54
  export type AgentComponent = {
41
55
  /** `<source>:<title>` in kebab case. */
@@ -48,6 +62,11 @@ export type AgentComponent = {
48
62
  readonly file: string;
49
63
  /** Its stories: the listed ones in the catalogue's order, then the unlisted ones. */
50
64
  readonly stories: readonly AgentStory[];
65
+ /**
66
+ * The other components of its source whose stories use it, direct users first; only when asked for (it reads the
67
+ * package's import graph) and the catalogue offers it.
68
+ */
69
+ readonly usedIn?: readonly AgentUsingComponent[];
51
70
  };
52
71
  /** A source of stories: a package's, or the project's own. */
53
72
  export type AgentSource = {
@@ -75,8 +94,8 @@ export type StoryDocument = {
75
94
  readonly schema: AgentSchema;
76
95
  /** The story, with its links in the view asked for. */
77
96
  readonly story: AgentStory;
78
- /** Its component's id and title. */
79
- readonly component: Pick<AgentComponent, "id" | "title" | "source" | "file">;
97
+ /** Its component's id and title, and its "Used in" when the catalogue offers it. */
98
+ readonly component: Pick<AgentComponent, "id" | "title" | "source" | "file" | "usedIn">;
80
99
  /**
81
100
  * The component's docs as the props panel reads them (its props, their types, defaults and TSDoc); none when the
82
101
  * story file names no component, or its docs could not be read (the reason is then in `problems`).
@@ -87,4 +106,15 @@ export type StoryDocument = {
87
106
  /** What went wrong while reading it: its module failing to load, its docs failing to be read. */
88
107
  readonly problems: readonly string[];
89
108
  };
109
+ /** What the open frames reported while someone edited, and the story index's problems. */
110
+ export type ErrorsDocument = {
111
+ /** The shape's version. */
112
+ readonly schema: AgentSchema;
113
+ /** The errors after the number asked for, oldest first: render errors and failed plays. */
114
+ readonly errors: readonly LiveError[];
115
+ /** The number of the last error so far: ask for the errors since it next time. */
116
+ readonly last: number;
117
+ /** The story index's problems now (a broken story file, a title taken twice). */
118
+ readonly problems: readonly string[];
119
+ };
90
120
  //# sourceMappingURL=agent.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.types.d.ts","sourceRoot":"","sources":["../../../src/vite/agent.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC;AAE5B,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG;IACvB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG;IACvB,gFAAgF;IAChF,QAAQ,CAAC,EA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C;IACtC,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC"}
@@ -7,7 +7,8 @@
7
7
  */
8
8
  import { type LoadedPreview } from "../frame/storyModule.ts";
9
9
  import { type StoryLocation, type StoryTree } from "../storyTree.ts";
10
- import type { StoriesDocument, StoryDocument, StoryLinks } from "./agent.types.ts";
10
+ import type { UsageIndex } from "../usedIn.ts";
11
+ import type { ErrorsDocument, StoriesDocument, StoryDocument, StoryLinks } from "./agent.types.ts";
11
12
  /** Where the catalogue is served, for the links: its page and its frame page. */
12
13
  export type CataloguePages = {
13
14
  /** The catalogue's page (`http://localhost:5173/`). */
@@ -30,8 +31,9 @@ export declare const storyLinks: (pages: CataloguePages, id: string, view: strin
30
31
  * @param tree - its story tree.
31
32
  * @param pages - where it is served, for the links.
32
33
  * @param view - the view the links open in; empty for the default view.
34
+ * @param usage - each source's "Used in", by source id, when asked for.
33
35
  */
34
- export declare const storiesDocument: (title: string, tree: StoryTree, pages: CataloguePages, view: string) => StoriesDocument;
36
+ export declare const storiesDocument: (title: string, tree: StoryTree, pages: CataloguePages, view: string, usage?: ReadonlyMap<string, UsageIndex>) => StoriesDocument;
35
37
  /**
36
38
  * A value as JSON keeps it: functions, symbols, `undefined` and cycles dropped, so a story's args can be printed
37
39
  * whatever a story passes (an `fn()` spy, a React element is an object and stays as its JSON).
@@ -63,8 +65,12 @@ export type LoadedStoryParts = {
63
65
  * @param parts - its module and its docs, as the dev server loaded them.
64
66
  * @param pages - where the catalogue is served, for the links.
65
67
  * @param view - the view the links open in; empty for the default view.
68
+ * @param usage - the tree and the story's source's "Used in", when the catalogue offers it.
66
69
  */
67
- export declare const storyDocument: (location: StoryLocation, parts: LoadedStoryParts, pages: CataloguePages, view: string) => StoryDocument;
70
+ export declare const storyDocument: (location: StoryLocation, parts: LoadedStoryParts, pages: CataloguePages, view: string, usage?: {
71
+ readonly tree: StoryTree;
72
+ readonly index: UsageIndex;
73
+ }) => StoryDocument;
68
74
  /** Which part of the catalogue a list keeps. */
69
75
  export type StoriesFilter = {
70
76
  /** A source's id; every source when none. */
@@ -79,6 +85,12 @@ export type StoriesFilter = {
79
85
  * @param filter - the source and the text to keep.
80
86
  */
81
87
  export declare const filteredStories: (document: StoriesDocument, filter: StoriesFilter) => StoriesDocument;
88
+ /**
89
+ * Whether a value is the errors document, as a client receives it over HTTP.
90
+ *
91
+ * @param value - the answer's body.
92
+ */
93
+ export declare const isErrorsDocument: (value: unknown) => value is ErrorsDocument;
82
94
  /**
83
95
  * Whether a value is the stories document, as a client receives it over HTTP.
84
96
  *
@@ -1 +1 @@
1
- {"version":3,"file":"agentApi.d.ts","sourceRoot":"","sources":["../../../src/vite/agentApi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,KAAK,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAe,KAAK,aAAa,EAAE,KAAK,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAElG,OAAO,KAAK,EAGV,eAAe,EACf,aAAa,EACb,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,cAAc,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,KAAG,UAG3E,CAAC;AAqCH;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,EACb,MAAM,SAAS,EACf,OAAO,cAAc,EACrB,MAAM,MAAM,KACX,eAYD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,OA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;;;GAQG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,aAAa,EACvB,OAAO,gBAAgB,EACvB,OAAO,cAAc,EACrB,MAAM,MAAM,EACZ,QAAQ;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,KAC/D,aAgCF,CAAC;AAEF,gDAAgD;AAChD,MAAM,MAAM,aAAa,GAAG;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,sFAAsF;IACtF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,eAAe,EAAE,QAAQ,aAAa,KAAG,eAUlF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,cAkB5B,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAI1B,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,aACgD,CAAC"}
@@ -7,7 +7,8 @@
7
7
  */
8
8
  import { isComponentDocs } from "../componentDocs.js";
9
9
  import { NO_PREVIEW, readStory } from "../frame/storyModule.js";
10
- import { componentId } from "../storyTree.js";
10
+ import { isLiveErrorReport } from "../liveErrors.js";
11
+ import { componentId, findComponent } from "../storyTree.js";
11
12
  import { frameAddressOf, storyAddressOf } from "../viewState.js";
12
13
  /**
13
14
  * A story's links in a view.
@@ -28,10 +29,29 @@ const agentStory = (story, isUnlisted, pages, view) => ({
28
29
  description: story.description,
29
30
  tags: story.tags,
30
31
  isUnlisted,
32
+ ...(story.height === undefined ? {} : { height: story.height }),
31
33
  links: storyLinks(pages, story.id, view)
32
34
  });
33
- /** A component of the tree as the documents give it, its listed stories first. */
34
- const agentComponent = (location, pages, view) => {
35
+ /**
36
+ * A component's "Used in" as the documents give it: the users the tree still has, by their ids and their stories' ids.
37
+ *
38
+ * @param tree - the story tree.
39
+ * @param sourceId - the component's source.
40
+ * @param usage - the source's usage.
41
+ * @param title - the component's title.
42
+ */
43
+ const agentUsers = (tree, sourceId, usage, title) => (usage[title] ?? []).flatMap((user) => {
44
+ const id = componentId(sourceId, user.title);
45
+ const found = findComponent(tree, id)?.component;
46
+ if (found === undefined)
47
+ return [];
48
+ const stories = [...found.stories, ...found.unlisted]
49
+ .filter((story) => user.stories.includes(story.exportName))
50
+ .map((story) => story.id);
51
+ return [{ id, title: user.title, isDirect: user.isDirect, stories }];
52
+ });
53
+ /** A component of the tree as the documents give it, its listed stories first, its "Used in" when given. */
54
+ const agentComponent = (location, pages, view, usage) => {
35
55
  const { source, component } = location;
36
56
  return {
37
57
  id: componentId(source.id, component.title),
@@ -41,7 +61,10 @@ const agentComponent = (location, pages, view) => {
41
61
  stories: [
42
62
  ...component.stories.map((story) => agentStory(story, false, pages, view)),
43
63
  ...component.unlisted.map((story) => agentStory(story, true, pages, view))
44
- ]
64
+ ],
65
+ ...(usage === undefined
66
+ ? {}
67
+ : { usedIn: agentUsers(usage.tree, source.id, usage.index, component.title) })
45
68
  };
46
69
  };
47
70
  /**
@@ -51,12 +74,16 @@ const agentComponent = (location, pages, view) => {
51
74
  * @param tree - its story tree.
52
75
  * @param pages - where it is served, for the links.
53
76
  * @param view - the view the links open in; empty for the default view.
77
+ * @param usage - each source's "Used in", by source id, when asked for.
54
78
  */
55
- export const storiesDocument = (title, tree, pages, view) => ({
79
+ export const storiesDocument = (title, tree, pages, view, usage) => ({
56
80
  schema: 1,
57
81
  title,
58
82
  sources: tree.sources.map((source) => ({ id: source.id, name: source.name })),
59
- components: tree.sources.flatMap((source) => source.families.flatMap((family) => family.groups.flatMap((group) => group.components.map((component) => agentComponent({ source, family, group, component }, pages, view))))),
83
+ components: tree.sources.flatMap((source) => source.families.flatMap((family) => family.groups.flatMap((group) => group.components.map((component) => {
84
+ const index = usage?.get(source.id);
85
+ return agentComponent({ source, family, group, component }, pages, view, index === undefined ? undefined : { tree, index });
86
+ })))),
60
87
  problems: tree.problems
61
88
  });
62
89
  /**
@@ -99,9 +126,10 @@ const docsOf = (loaded) => {
99
126
  * @param parts - its module and its docs, as the dev server loaded them.
100
127
  * @param pages - where the catalogue is served, for the links.
101
128
  * @param view - the view the links open in; empty for the default view.
129
+ * @param usage - the tree and the story's source's "Used in", when the catalogue offers it.
102
130
  */
103
- export const storyDocument = (location, parts, pages, view) => {
104
- const component = agentComponent(location, pages, view);
131
+ export const storyDocument = (location, parts, pages, view, usage) => {
132
+ const component = agentComponent(location, pages, view, usage);
105
133
  const story = component.stories.find((each) => each.id === location.story.id) ??
106
134
  agentStory(location.story, false, pages, view);
107
135
  const problems = [];
@@ -124,7 +152,13 @@ export const storyDocument = (location, parts, pages, view) => {
124
152
  return {
125
153
  schema: 1,
126
154
  story,
127
- component: { id: component.id, title: component.title, source: component.source, file: component.file },
155
+ component: {
156
+ id: component.id,
157
+ title: component.title,
158
+ source: component.source,
159
+ file: component.file,
160
+ ...(component.usedIn === undefined ? {} : { usedIn: component.usedIn })
161
+ },
128
162
  docs,
129
163
  args,
130
164
  problems
@@ -144,6 +178,26 @@ export const filteredStories = (document, filter) => {
144
178
  (text === undefined || component.title.toLowerCase().includes(text)))
145
179
  };
146
180
  };
181
+ /**
182
+ * Whether a value is the errors document, as a client receives it over HTTP.
183
+ *
184
+ * @param value - the answer's body.
185
+ */
186
+ export const isErrorsDocument = (value) => typeof value === "object" &&
187
+ value !== null &&
188
+ "schema" in value &&
189
+ value.schema === 1 &&
190
+ "errors" in value &&
191
+ Array.isArray(value.errors) &&
192
+ value.errors.every((error) => isLiveErrorReport(error) &&
193
+ "n" in error &&
194
+ typeof error.n === "number" &&
195
+ "at" in error &&
196
+ typeof error.at === "string") &&
197
+ "last" in value &&
198
+ typeof value.last === "number" &&
199
+ "problems" in value &&
200
+ Array.isArray(value.problems);
147
201
  /**
148
202
  * Whether a value is the stories document, as a client receives it over HTTP.
149
203
  *
@@ -1 +1 @@
1
- {"version":3,"file":"agentApi.js","sourceRoot":"","sources":["../../../src/vite/agentApi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAsB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAsB,UAAU,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAsD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAiBjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAqB,EAAE,EAAU,EAAE,IAAY,EAAc,EAAE,CAAC,CAAC;IAC1F,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC;IAC7C,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC;CAC7C,CAAC,CAAC;AAEH,oDAAoD;AACpD,MAAM,UAAU,GAAG,CACjB,KAAgB,EAChB,UAAmB,EACnB,KAAqB,EACrB,IAAY,EACA,EAAE,CAAC,CAAC;IAChB,EAAE,EAAE,KAAK,CAAC,EAAE;IACZ,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,UAAU,EAAE,KAAK,CAAC,UAAU;IAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;IAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,UAAU;IACV,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC;CACzC,CAAC,CAAC;AAEH,kFAAkF;AAClF,MAAM,cAAc,GAAG,CACrB,QAAsC,EACtC,KAAqB,EACrB,IAAY,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,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,KAAK,CAAC,MAAM,CAAC,KAAK,CAChB,CAAC,KAAc,EAAE,EAAE,CACjB,iBAAiB,CAAC,KAAK,CAAC;QACxB,GAAG,IAAI,KAAK;QACZ,OAAO,KAAK,CAAC,CAAC,KAAK,QAAQ;QAC3B,IAAI,IAAI,KAAK;QACb,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAC/B;IACD,MAAM,IAAI,KAAK;IACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,UAAU,IAAI,KAAK;IACnB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEhC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAA4B,EAAE,CAC5E,QAAQ,CAAC,KAAK,CAAC;IACf,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;IACrB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAA0B,EAAE,CACxE,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC"}
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import type { IncomingMessage, ServerResponse } from "node:http";
14
14
  import type { ViteDevServer } from "vite";
15
+ import type { LiveErrors } from "../liveErrors.ts";
15
16
  import type { ResolvedConfig } from "./configFile.ts";
16
17
  /** The path the answers live under. */
17
18
  export declare const AGENT_API = "/__forgebook/api/";
@@ -30,16 +31,20 @@ export declare const ROOT_HEADER = "forgebook-root";
30
31
  * @param load - loads a module on the server (the dev server's `ssrLoadModule`).
31
32
  * @param config - the catalogue's configuration.
32
33
  * @param route - the path under `AGENT_API` (`stories`, `story`).
33
- * @param params - the query: `id` for a story, `view` for the links.
34
+ * @param params - the query: `id` for a story, `view` for the links, `usedIn=true` for the list's "Used in" (a
35
+ * story's comes with it when the catalogue offers it).
34
36
  * @param origin - where the catalogue is served (`http://localhost:5173`), for the links.
37
+ * @param live - the errors the open frames reported, on a dev server a browser uses; none for a server of the
38
+ * command's own, which no frame reports to.
35
39
  */
36
- export declare const agentAnswer: (load: (id: string) => Promise<unknown>, config: ResolvedConfig, route: string, params: URLSearchParams, origin: string) => Promise<AgentAnswer>;
40
+ export declare const agentAnswer: (load: (id: string) => Promise<unknown>, config: ResolvedConfig, route: string, params: URLSearchParams, origin: string, live?: LiveErrors) => Promise<AgentAnswer>;
37
41
  /**
38
42
  * The middleware that answers under `AGENT_API`, for a catalogue's dev server.
39
43
  *
40
44
  * @param server - the dev server, which loads the modules.
41
45
  * @param config - the catalogue's configuration.
46
+ * @param live - the errors the open frames report.
42
47
  * @returns a Connect middleware: it answers its own paths and passes every other request on.
43
48
  */
44
- export declare const agentMiddleware: (server: ViteDevServer, config: ResolvedConfig) => (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => void;
49
+ export declare const agentMiddleware: (server: ViteDevServer, config: ResolvedConfig, live: LiveErrors) => (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => void;
45
50
  //# sourceMappingURL=agentRoutes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentRoutes.d.ts","sourceRoot":"","sources":["../../../src/vite/agentRoutes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAM1C,OAAO,KAAK,EAAE,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IACxB,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,gHAAgH;AAChH,eAAO,MAAM,WAAW,mBAAmB,CAAC;AA0E5C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EACtC,QAAQ,cAAc,EACtB,OAAO,MAAM,EACb,QAAQ,eAAe,EACvB,QAAQ,MAAM,EACd,OAAO,UAAU,KAChB,OAAO,CAAC,WAAW,CAkBrB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GACzB,QAAQ,aAAa,EAAE,QAAQ,cAAc,EAAE,MAAM,UAAU,MAC/D,SAAS,eAAe,EAAE,UAAU,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,KAAG,IAoBtF,CAAC"}
@@ -2,6 +2,7 @@ import { join } from "node:path";
2
2
  import { mergedPreviews, readPreview } from "../frame/storyModule.js";
3
3
  import { sourceFiles } from "../sourceFiles.js";
4
4
  import { findStory, storyTree } from "../storyTree.js";
5
+ import { sourceUsage } from "../usedIn.js";
5
6
  import { storiesDocument, storyDocument } from "./agentApi.js";
6
7
  import { AGENT_SOURCES_FILE } from "./pages.js";
7
8
  /** The path the answers live under. */
@@ -31,40 +32,99 @@ const settled = async (load) => {
31
32
  return { error: error instanceof Error ? error.message : String(error) };
32
33
  }
33
34
  };
35
+ /**
36
+ * Each source's "Used in", by source id; a source whose usage cannot be read is left out.
37
+ *
38
+ * @param sources - the sources.
39
+ */
40
+ const usageBySource = async (sources) => {
41
+ const answers = await Promise.all(sources.map(async (source) => [source.id, await sourceUsage(source)]));
42
+ return new Map(answers.flatMap(([id, index]) => (typeof index === "string" ? [] : [[id, index]])));
43
+ };
34
44
  /** The header that names the catalogue's folder, so a client knows the server it found serves its catalogue. */
35
45
  export const ROOT_HEADER = "forgebook-root";
46
+ /**
47
+ * The errors the open frames reported after the number asked for, and the index's problems.
48
+ *
49
+ * @param context - what the routes read.
50
+ * @param live - the errors, when frames report to this server.
51
+ */
52
+ const errorsAnswer = (context, live) => {
53
+ const since = Number(context.params.get("since") ?? "0");
54
+ const body = {
55
+ schema: 1,
56
+ errors: live?.since(Number.isFinite(since) ? since : 0) ?? [],
57
+ last: live?.last() ?? 0,
58
+ problems: context.tree.problems
59
+ };
60
+ return { status: 200, body };
61
+ };
62
+ /**
63
+ * The stories, with each component's "Used in" when asked for and offered.
64
+ *
65
+ * @param context - what the routes read.
66
+ */
67
+ const storiesAnswer = async (context) => {
68
+ const { config, params, tree, pages, view, loaded } = context;
69
+ const usage = config.lists.usedIn !== false && params.get("usedIn") === "true"
70
+ ? await usageBySource(loaded.sources)
71
+ : undefined;
72
+ return { status: 200, body: storiesDocument(config.title, tree, pages, view, usage) };
73
+ };
74
+ /**
75
+ * One story in detail, its component's "Used in" when offered.
76
+ *
77
+ * @param context - what the routes read.
78
+ */
79
+ const storyAnswer = async (context) => {
80
+ const { config, params, tree, pages, view, loaded } = context;
81
+ const id = params.get("id") ?? "";
82
+ const location = findStory(tree, id);
83
+ const source = loaded.sources.find((each) => each.id === location?.source.id);
84
+ if (location === undefined || source === undefined)
85
+ return { status: 404, body: { error: `No story "${id}"` } };
86
+ const files = sourceFiles(source);
87
+ const file = location.component.file;
88
+ const parts = {
89
+ module: await settled(files.stories[file]),
90
+ docs: await settled(files.docs[file]),
91
+ preview: loaded.preview
92
+ };
93
+ const index = config.lists.usedIn === false ? undefined : await sourceUsage(source);
94
+ // a usage that cannot be read leaves "Used in" out, never the story
95
+ const usage = index === undefined || typeof index === "string" ? undefined : { tree, index };
96
+ return { status: 200, body: storyDocument(location, parts, pages, view, usage) };
97
+ };
36
98
  /**
37
99
  * Answers one of the API's paths.
38
100
  *
39
101
  * @param load - loads a module on the server (the dev server's `ssrLoadModule`).
40
102
  * @param config - the catalogue's configuration.
41
103
  * @param route - the path under `AGENT_API` (`stories`, `story`).
42
- * @param params - the query: `id` for a story, `view` for the links.
104
+ * @param params - the query: `id` for a story, `view` for the links, `usedIn=true` for the list's "Used in" (a
105
+ * story's comes with it when the catalogue offers it).
43
106
  * @param origin - where the catalogue is served (`http://localhost:5173`), for the links.
107
+ * @param live - the errors the open frames reported, on a dev server a browser uses; none for a server of the
108
+ * command's own, which no frame reports to.
44
109
  */
45
- export const agentAnswer = async (load, config, route, params, origin) => {
46
- const view = params.get("view") ?? "";
47
- const pages = { page: `${origin}/`, frame: `${origin}/frame.html` };
110
+ export const agentAnswer = async (load, config, route, params, origin, live) => {
48
111
  try {
49
112
  const loaded = agentModuleOf(await load(join(config.dir, AGENT_SOURCES_FILE)));
50
- const tree = storyTree(loaded.sources);
51
- if (route === "stories")
52
- return { status: 200, body: storiesDocument(config.title, tree, pages, view) };
53
- if (route !== "story")
54
- return { status: 404, body: { error: `No answer at ${AGENT_API}${route}` } };
55
- const id = params.get("id") ?? "";
56
- const location = findStory(tree, id);
57
- const source = loaded.sources.find((each) => each.id === location?.source.id);
58
- if (location === undefined || source === undefined)
59
- return { status: 404, body: { error: `No story "${id}"` } };
60
- const files = sourceFiles(source);
61
- const file = location.component.file;
62
- const parts = {
63
- module: await settled(files.stories[file]),
64
- docs: await settled(files.docs[file]),
65
- preview: loaded.preview
113
+ const context = {
114
+ loaded,
115
+ tree: storyTree(loaded.sources),
116
+ config,
117
+ params,
118
+ pages: { page: `${origin}/`, frame: `${origin}/frame.html` },
119
+ view: params.get("view") ?? ""
66
120
  };
67
- return { status: 200, body: storyDocument(location, parts, pages, view) };
121
+ if (route === "errors")
122
+ return errorsAnswer(context, live);
123
+ if (route === "stories")
124
+ return await storiesAnswer(context);
125
+ if (route === "story")
126
+ return await storyAnswer(context);
127
+ return { status: 404, body: { error: `No answer at ${AGENT_API}${route}` } };
68
128
  }
69
129
  catch (error) {
70
130
  return { status: 500, body: { error: error instanceof Error ? error.message : String(error) } };
@@ -75,16 +135,17 @@ export const agentAnswer = async (load, config, route, params, origin) => {
75
135
  *
76
136
  * @param server - the dev server, which loads the modules.
77
137
  * @param config - the catalogue's configuration.
138
+ * @param live - the errors the open frames report.
78
139
  * @returns a Connect middleware: it answers its own paths and passes every other request on.
79
140
  */
80
- export const agentMiddleware = (server, config) => (request, response, next) => {
141
+ export const agentMiddleware = (server, config, live) => (request, response, next) => {
81
142
  const url = new URL(request.url ?? "/", `http://${request.headers.host ?? "localhost"}`);
82
143
  if (!url.pathname.startsWith(AGENT_API)) {
83
144
  next();
84
145
  return;
85
146
  }
86
147
  const route = url.pathname.slice(AGENT_API.length);
87
- void agentAnswer((id) => server.ssrLoadModule(id), config, route, url.searchParams, url.origin).then(({ status, body }) => {
148
+ void agentAnswer((id) => server.ssrLoadModule(id), config, route, url.searchParams, url.origin, live).then(({ status, body }) => {
88
149
  response.statusCode = status;
89
150
  response.setHeader("Content-Type", "application/json");
90
151
  response.setHeader(ROOT_HEADER, config.dir);