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,80 @@
1
+ /**
2
+ * Named views: the View menu's values saved under a name ("Dark, Italian, 360") and picked again. A reader's, kept in
3
+ * their browser, and the catalogue's own (`views` in its configuration), offered to the whole team.
4
+ *
5
+ * @remarks
6
+ * A named view holds values, never an arrangement: the switches, the background, the style sheets, the text size and
7
+ * the width. Picking one sets them as choosing each would, so the address carries the values; a name never goes in the
8
+ * address, since another reader may not have it. Pure: views in, views out.
9
+ *
10
+ * @module
11
+ */
12
+ import type { ViewState } from "./viewState.ts";
13
+ /** The values a named view holds: the View menu's. */
14
+ export type ViewValues = Pick<ViewState, "switches" | "backdrop" | "sheets" | "text" | "width">;
15
+ /** A view saved under a name. */
16
+ export type NamedView = {
17
+ /** Its name, as the reader or the catalogue wrote it. */
18
+ readonly name: string;
19
+ /** Its values. */
20
+ readonly values: ViewValues;
21
+ };
22
+ /** A view the catalogue declares, as its configuration writes it. */
23
+ export type CatalogueView = {
24
+ /** Its name. */
25
+ readonly name: string;
26
+ /** Its values, in the address's form (`theme=dark&width=360`) or as words (`"dark it 360"`). */
27
+ readonly view: string;
28
+ };
29
+ /**
30
+ * The values of a view that a named view holds.
31
+ *
32
+ * @param view - the view.
33
+ */
34
+ export declare const viewValues: (view: ViewState) => ViewValues;
35
+ /**
36
+ * The view with a named view's values set.
37
+ *
38
+ * @param view - the view shown.
39
+ * @param values - the named view's values.
40
+ */
41
+ export declare const withViewValues: (view: ViewState, values: ViewValues) => ViewState;
42
+ /**
43
+ * The reader's views with one saved: a view of the same name is replaced where it was, a new one goes last.
44
+ *
45
+ * @param views - the reader's views.
46
+ * @param saved - the view saved; its name trimmed.
47
+ * @returns the views; the same ones for an empty name.
48
+ */
49
+ export declare const withSavedView: (views: readonly NamedView[], saved: NamedView) => NamedView[];
50
+ /**
51
+ * The reader's views without one.
52
+ *
53
+ * @param views - the reader's views.
54
+ * @param name - the removed view's name.
55
+ */
56
+ export declare const withoutView: (views: readonly NamedView[], name: string) => NamedView[];
57
+ /**
58
+ * The reader's views a stored text holds; the ones this module did not write are left out.
59
+ *
60
+ * @param stored - the stored text, or none.
61
+ */
62
+ export declare const readNamedViews: (stored: string | null) => NamedView[];
63
+ /**
64
+ * The text the reader's views are stored as; empty for none.
65
+ *
66
+ * @param views - the reader's views.
67
+ */
68
+ export declare const namedViewsText: (views: readonly NamedView[]) => string;
69
+ /**
70
+ * Whether two sets of values draw the same view: a switch left at its default and one set to it are the same.
71
+ *
72
+ * @param first - one set.
73
+ * @param second - the other.
74
+ * @param switches - the catalogue's switches, for their defaults.
75
+ */
76
+ export declare const isSameView: (first: ViewValues, second: ViewValues, switches: readonly {
77
+ readonly id: string;
78
+ readonly default: string;
79
+ }[]) => boolean;
80
+ //# sourceMappingURL=namedViews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namedViews.d.ts","sourceRoot":"","sources":["../../src/namedViews.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEhG,iCAAiC;AACjC,MAAM,MAAM,SAAS,GAAG;IACtB,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kBAAkB;IAClB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gGAAgG;IAChG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,SAAS,KAAG,UAM3C,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,EAAE,QAAQ,UAAU,KAAG,SAAqC,CAAC;AAE3G;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,SAAS,SAAS,EAAE,EAAE,OAAO,SAAS,KAAG,SAAS,EAOtF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,SAAS,SAAS,EAAE,EAAE,MAAM,MAAM,KAAG,SAAS,EACrC,CAAC;AAgB7C;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,GAAG,IAAI,KAAG,SAAS,EAY/D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,SAAS,EAAE,KAAG,MACZ,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,UAAU,EACjB,QAAQ,UAAU,EAClB,UAAU,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,KACrE,OAO2B,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * The values of a view that a named view holds.
3
+ *
4
+ * @param view - the view.
5
+ */
6
+ export const viewValues = (view) => ({
7
+ switches: view.switches,
8
+ backdrop: view.backdrop,
9
+ sheets: view.sheets,
10
+ text: view.text,
11
+ width: view.width
12
+ });
13
+ /**
14
+ * The view with a named view's values set.
15
+ *
16
+ * @param view - the view shown.
17
+ * @param values - the named view's values.
18
+ */
19
+ export const withViewValues = (view, values) => ({ ...view, ...values });
20
+ /**
21
+ * The reader's views with one saved: a view of the same name is replaced where it was, a new one goes last.
22
+ *
23
+ * @param views - the reader's views.
24
+ * @param saved - the view saved; its name trimmed.
25
+ * @returns the views; the same ones for an empty name.
26
+ */
27
+ export const withSavedView = (views, saved) => {
28
+ const name = saved.name.trim();
29
+ if (name === "")
30
+ return [...views];
31
+ const view = { ...saved, name };
32
+ return views.some((each) => each.name === name)
33
+ ? views.map((each) => (each.name === name ? view : each))
34
+ : [...views, view];
35
+ };
36
+ /**
37
+ * The reader's views without one.
38
+ *
39
+ * @param views - the reader's views.
40
+ * @param name - the removed view's name.
41
+ */
42
+ export const withoutView = (views, name) => views.filter((each) => each.name !== name);
43
+ /** Whether a value is a plain object. */
44
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
45
+ /** Whether a value is a named view's values, as this module stores them. */
46
+ const isViewValues = (value) => isRecord(value) &&
47
+ isRecord(value["switches"]) &&
48
+ Object.values(value["switches"]).every((each) => typeof each === "string") &&
49
+ typeof value["backdrop"] === "string" &&
50
+ (value["sheets"] === "full" || value["sheets"] === "structure" || value["sheets"] === "restyled") &&
51
+ typeof value["text"] === "number" &&
52
+ (value["width"] === "fill" || typeof value["width"] === "number");
53
+ /**
54
+ * The reader's views a stored text holds; the ones this module did not write are left out.
55
+ *
56
+ * @param stored - the stored text, or none.
57
+ */
58
+ export const readNamedViews = (stored) => {
59
+ if (stored === null || stored === "")
60
+ return [];
61
+ let parsed;
62
+ try {
63
+ parsed = JSON.parse(stored);
64
+ }
65
+ catch {
66
+ return [];
67
+ }
68
+ return (Array.isArray(parsed) ? parsed : []).filter((each) => isRecord(each) && typeof each["name"] === "string" && isViewValues(each["values"]));
69
+ };
70
+ /**
71
+ * The text the reader's views are stored as; empty for none.
72
+ *
73
+ * @param views - the reader's views.
74
+ */
75
+ export const namedViewsText = (views) => views.length === 0 ? "" : JSON.stringify(views);
76
+ /**
77
+ * Whether two sets of values draw the same view: a switch left at its default and one set to it are the same.
78
+ *
79
+ * @param first - one set.
80
+ * @param second - the other.
81
+ * @param switches - the catalogue's switches, for their defaults.
82
+ */
83
+ export const isSameView = (first, second, switches) => switches.every((each) => (first.switches[each.id] ?? each.default) === (second.switches[each.id] ?? each.default)) &&
84
+ first.backdrop === second.backdrop &&
85
+ first.sheets === second.sheets &&
86
+ first.text === second.text &&
87
+ first.width === second.width;
88
+ //# sourceMappingURL=namedViews.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namedViews.js","sourceRoot":"","sources":["../../src/namedViews.ts"],"names":[],"mappings":"AAgCA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAe,EAAc,EAAE,CAAC,CAAC;IAC1D,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,KAAK,EAAE,IAAI,CAAC,KAAK;CAClB,CAAC,CA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;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA2B,EAAU,EAAE,CACpE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAAiB,EACjB,MAAkB,EAClB,QAAsE,EAC7D,EAAE,CACX,QAAQ,CAAC,KAAK,CACZ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CACnG;IACD,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;IAClC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;IAC9B,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI;IAC1B,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The shell's appearance menu, at the sidebar's foot: a button showing the appearance picked, which opens Light, Dark
3
+ * and System. A preference about the tool, not the story, so it sits outside the View menu.
4
+ *
5
+ * @module
6
+ */
7
+ import { type ReactNode } from "react";
8
+ import type { AppearanceState } from "./useAppearance.ts";
9
+ /**
10
+ * The appearance menu.
11
+ *
12
+ * @param props - the appearance shown and its setter.
13
+ */
14
+ export declare const AppearanceMenu: ({ appearance, setAppearance }: AppearanceState) => ReactNode;
15
+ //# sourceMappingURL=AppearanceMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppearanceMenu.d.ts","sourceRoot":"","sources":["../../../src/shell/AppearanceMenu.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAmB,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAK/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM1D;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,+BAA+B,eAAe,KAAG,SA8C/E,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * The shell's appearance menu, at the sidebar's foot: a button showing the appearance picked, which opens Light, Dark
4
+ * and System. A preference about the tool, not the story, so it sits outside the View menu.
5
+ *
6
+ * @module
7
+ */
8
+ import { useId } from "react";
9
+ import { APPEARANCES } from "../catalogue.js";
10
+ import { Icon } from "./icons.js";
11
+ import { STRINGS } from "./strings.js";
12
+ import { usePopover } from "./usePopover.js";
13
+ /** Each appearance's icon. */
14
+ const ICONS = { light: "sun", dark: "moon", system: "monitor" };
15
+ /**
16
+ * The appearance menu.
17
+ *
18
+ * @param props - the appearance shown and its setter.
19
+ */
20
+ export const AppearanceMenu = ({ appearance, setAppearance }) => {
21
+ const { isOpen, isDrawn, setIsOpen, buttonRef, panelRef, panelId } = usePopover();
22
+ const name = useId();
23
+ return (_jsxs("div", { className: "forgebook-appearance", children: [_jsxs("button", { ref: buttonRef, type: "button", className: "forgebook-button forgebook-button--quiet", "aria-expanded": isOpen, "aria-controls": panelId, onClick: (event) => setIsOpen(!isOpen, event), children: [_jsx(Icon, { name: ICONS[appearance], size: 14 }), STRINGS.appearanceOf(STRINGS.appearances[appearance])] }), isDrawn ? (_jsx("div", { ref: panelRef, id: panelId, className: "forgebook-popover forgebook-popover--up", role: "dialog", "aria-label": STRINGS.appearance, children: _jsxs("fieldset", { className: "forgebook-choices", children: [_jsx("legend", { className: "forgebook-visually-hidden", children: STRINGS.appearance }), APPEARANCES.map((each) => (_jsxs("label", { className: "forgebook-choice", children: [_jsx("input", { type: "radio", name: name, checked: each === appearance, onChange: () => {
24
+ setAppearance(each);
25
+ setIsOpen(false);
26
+ } }), _jsx(Icon, { name: ICONS[each], size: 14 }), STRINGS.appearances[each]] }, each)))] }) })) : null] }));
27
+ };
28
+ //# sourceMappingURL=AppearanceMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppearanceMenu.js","sourceRoot":"","sources":["../../../src/shell/AppearanceMenu.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,OAAO,EAAmC,KAAK,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAiB,MAAM,YAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,8BAA8B;AAC9B,MAAM,KAAK,GAA2C,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAExG;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,UAAU,EAAE,aAAa,EAAmB,EAAa,EAAE;IAC1F,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC;IAClF,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC;IACrB,OAAO,CACL,eAAK,SAAS,EAAC,sBAAsB,aACnC,kBACE,GAAG,EAAE,SAAS,EACd,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0CAA0C,mBACrC,MAAM,mBACN,OAAO,EACtB,OAAO,EAAE,CAAC,KAAoC,EAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,aAElF,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,EAC1C,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAC/C,EACR,OAAO,CAAC,CAAC,CAAC,CACT,cACE,GAAG,EAAE,QAAQ,EACb,EAAE,EAAE,OAAO,EACX,SAAS,EAAC,yCAAyC,EACnD,IAAI,EAAC,QAAQ,gBACD,OAAO,CAAC,UAAU,YAE9B,oBAAU,SAAS,EAAC,mBAAmB,aACrC,iBAAQ,SAAS,EAAC,2BAA2B,YAAE,OAAO,CAAC,UAAU,GAAU,EAC1E,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACzB,iBAAkB,SAAS,EAAC,kBAAkB,aAC5C,gBACE,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,IAAI,KAAK,UAAU,EAC5B,QAAQ,EAAE,GAAS,EAAE;wCACnB,aAAa,CAAC,IAAI,CAAC,CAAC;wCACpB,SAAS,CAAC,KAAK,CAAC,CAAC;oCACnB,CAAC,GACD,EACF,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,EACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAXhB,IAAI,CAYR,CACT,CAAC,IACO,GACP,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The width of an example's story while its box fills the page: set by the stage's handles or by the presets and the
3
+ * field in the box's bar, for that box only.
4
+ *
5
+ * @remarks
6
+ * The page's width (the toolbar's, in the address) is not changed: the box over the page is a moment's look, and the
7
+ * other examples keep the width they have. The box starts at the page's width and takes it again when it goes back
8
+ * to its place.
9
+ *
10
+ * @module
11
+ */
12
+ import { type ReactNode } from "react";
13
+ import type { StageWidth } from "../viewState.ts";
14
+ /** An example box's width over the page, and what sets it. */
15
+ export type BoxWidth = {
16
+ /** The story's width: the box's own over the page, the page's otherwise. */
17
+ readonly width: StageWidth;
18
+ /** Sets the box's own width; none in the list, where the stage shows no handles. */
19
+ readonly onWidthChange: ((width: StageWidth) => void) | undefined;
20
+ /** The width the story really has, in CSS px, for the field. */
21
+ readonly shownWidth: number | undefined;
22
+ /** Called with the width the story really has; none in the list. */
23
+ readonly onShownWidthChange: ((width: number | undefined) => void) | undefined;
24
+ };
25
+ /**
26
+ * An example box's width over the page.
27
+ *
28
+ * @param isOver - whether the box is over the page.
29
+ * @param pageWidth - the page's width, the toolbar's.
30
+ */
31
+ export declare const useBoxWidth: (isOver: boolean, pageWidth: StageWidth) => BoxWidth;
32
+ /**
33
+ * The width's presets and field in the bar of a box over the page.
34
+ *
35
+ * @param props - the box's width and what sets it.
36
+ */
37
+ export declare const BoxWidthControl: ({ boxWidth }: {
38
+ readonly boxWidth: BoxWidth;
39
+ }) => ReactNode;
40
+ //# sourceMappingURL=BoxWidth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoxWidth.d.ts","sourceRoot":"","sources":["../../../src/shell/BoxWidth.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOlD,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,GAAG;IACrB,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,oFAAoF;IACpF,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAClE,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,oEAAoE;IACpE,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAChF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,OAAO,EAAE,WAAW,UAAU,KAAG,QAWpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc;IAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,KAAG,SAwB/E,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * The width of an example's story while its box fills the page: set by the stage's handles or by the presets and the
4
+ * field in the box's bar, for that box only.
5
+ *
6
+ * @remarks
7
+ * The page's width (the toolbar's, in the address) is not changed: the box over the page is a moment's look, and the
8
+ * other examples keep the width they have. The box starts at the page's width and takes it again when it goes back
9
+ * to its place.
10
+ *
11
+ * @module
12
+ */
13
+ import { useState } from "react";
14
+ import { useCatalogue } from "./catalogueContext.js";
15
+ import { Icon } from "./icons.js";
16
+ import { Segmented } from "./Segmented.js";
17
+ import { STRINGS } from "./strings.js";
18
+ import { WidthField } from "./WidthField.js";
19
+ /**
20
+ * An example box's width over the page.
21
+ *
22
+ * @param isOver - whether the box is over the page.
23
+ * @param pageWidth - the page's width, the toolbar's.
24
+ */
25
+ export const useBoxWidth = (isOver, pageWidth) => {
26
+ const [own, setOwn] = useState(undefined);
27
+ const [shownWidth, setShownWidth] = useState(undefined);
28
+ // back in its place, the box forgets its own width, so it opens at the page's next time
29
+ if (!isOver && own !== undefined)
30
+ setOwn(undefined);
31
+ return {
32
+ width: isOver ? (own ?? pageWidth) : pageWidth,
33
+ onWidthChange: isOver ? setOwn : undefined,
34
+ shownWidth,
35
+ onShownWidthChange: isOver ? setShownWidth : undefined
36
+ };
37
+ };
38
+ /**
39
+ * The width's presets and field in the bar of a box over the page.
40
+ *
41
+ * @param props - the box's width and what sets it.
42
+ */
43
+ export const BoxWidthControl = ({ boxWidth }) => {
44
+ const { widths } = useCatalogue();
45
+ const { width, onWidthChange, shownWidth } = boxWidth;
46
+ if (onWidthChange === undefined)
47
+ return null;
48
+ return (_jsxs("div", { className: "forgebook-example__width", children: [_jsx("span", { className: "forgebook-toolbar__icon", title: STRINGS.width, children: _jsx(Icon, { name: "width", size: 14 }) }), _jsx(Segmented, { label: STRINGS.width, options: [
49
+ { value: "fill", label: STRINGS.widthFill },
50
+ ...widths.map((preset) => ({
51
+ value: preset.width,
52
+ label: preset.label ?? STRINGS.widthPx(preset.width)
53
+ }))
54
+ ], value: width, onValueChange: onWidthChange, after: _jsx(WidthField, { width: width, shownWidth: shownWidth, onWidthChange: onWidthChange }) })] }));
55
+ };
56
+ //# sourceMappingURL=BoxWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoxWidth.js","sourceRoot":"","sources":["../../../src/shell/BoxWidth.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAa,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAc9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAe,EAAE,SAAqB,EAAY,EAAE;IAC9E,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAyB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAC5E,wFAAwF;IACxF,IAAI,CAAC,MAAM,IAAI,GAAG,KAAK,SAAS;QAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI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CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,6 +1,20 @@
1
+ /**
2
+ * A component's page, as a library documents a component: what it is, its demo (the story marked `main`) with
3
+ * its code, the text of its documentation file, its API reference drawn from its types, then every other story as an
4
+ * example.
5
+ *
6
+ * @remarks
7
+ * The demo loads at once; the examples load as they come near the visible part of the page, a few at a time
8
+ * (`useFrameQueue`): a component may have twenty stories. The view's live part reaches every frame as a message, as
9
+ * on the story page; the props panel and Replay belong to a story's own page, which each story's name links to. The
10
+ * documentation file's HTML is the package's own, made at build time (`vite/componentPage.ts`).
11
+ *
12
+ * @module
13
+ */
1
14
  import { type ReactNode } from "react";
2
15
  import { type TreeComponent, type TreeStory } from "../storyTree.ts";
3
16
  import { type ViewState } from "../viewState.ts";
17
+ import { type UsedInProps } from "./UsedIn.tsx";
4
18
  import { type PageScroll } from "./useScrollMemory.ts";
5
19
  /** The component page's props. */
6
20
  export type ComponentPageProps = {
@@ -28,11 +42,13 @@ export type ComponentPageProps = {
28
42
  readonly header: ReactNode;
29
43
  /** Where its scrolling part starts: the shell's visit of the page and every page's last position. */
30
44
  readonly scroll: PageScroll;
45
+ /** What "Used in" reads and opens; none when the catalogue turned it off. */
46
+ readonly usedIn?: Omit<UsedInProps, "title"> | undefined;
31
47
  };
32
48
  /**
33
49
  * A component's page.
34
50
  *
35
51
  * @param props - the component, the view, its loaders and how to open a story.
36
52
  */
37
- export declare const ComponentPage: ({ component, view, frameUrl, hrefOf, onOpen, loadDocs, loadCode, loadPage, heightOf, background, header, scroll }: ComponentPageProps) => ReactNode;
53
+ export declare const ComponentPage: ({ component, view, frameUrl, hrefOf, onOpen, loadDocs, loadCode, loadPage, heightOf, background, header, scroll, usedIn }: ComponentPageProps) => ReactNode;
38
54
  //# sourceMappingURL=ComponentPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentPage.d.ts","sourceRoot":"","sources":["../../../src/shell/ComponentPage.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAmB,K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,CAAC,GAAG,SAAS,CAAC;IACxD,wGAAwG;IACxG,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC3D,gHAAgH;IAChH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,qGAAqG;IACrG,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC1D,CAAC;AAyCF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,2HAc3B,kBAAkB,KAAG,SAgGvB,CAAC"}
@@ -1,70 +1,35 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId, useMemo, useRef, useState } from "react";
2
+ /**
3
+ * A component's page, as a library documents a component: what it is, its demo (the story marked `main`) with
4
+ * its code, the text of its documentation file, its API reference drawn from its types, then every other story as an
5
+ * example.
6
+ *
7
+ * @remarks
8
+ * The demo loads at once; the examples load as they come near the visible part of the page, a few at a time
9
+ * (`useFrameQueue`): a component may have twenty stories. The view's live part reaches every frame as a message, as
10
+ * on the story page; the props panel and Replay belong to a story's own page, which each story's name links to. The
11
+ * documentation file's HTML is the package's own, made at build time (`vite/componentPage.ts`).
12
+ *
13
+ * @module
14
+ */
15
+ import { useMemo, useRef, useState } from "react";
3
16
  import { groupLabel } from "../catalogue.js";
4
17
  import { groupedStories, mainStory } from "../storyTree.js";
5
- import { frameAddress, liveView } from "../viewState.js";
18
+ import { liveView } from "../viewState.js";
6
19
  import { ApiReference } from "./ApiReference.js";
7
20
  import { CodeText } from "./CodeText.js";
8
21
  import { useCatalogue } from "./catalogueContext.js";
9
- import { useCodeWriter } from "./codeWriter.js";
10
- import { FrameView } from "./FrameView.js";
11
- import { Icon } from "./icons.js";
22
+ import { Example } from "./Example.js";
12
23
  import { PackageHtml } from "./PackageHtml.js";
13
- import { StageViewport } from "./StageViewport.js";
14
- import { StoryCodeBlock, storyCodeText } from "./StoryCodeBlock.js";
15
24
  import { STRINGS } from "./strings.js";
25
+ import { UsedIn } from "./UsedIn.js";
16
26
  import { useComponentDocs } from "./useComponentDocs.js";
17
- import { useCopy } from "./useCopy.js";
18
27
  import { useFrameMessages } from "./useFrameMessages.js";
19
28
  import { useFrameQueue } from "./useFrameQueue.js";
20
29
  import { useLiveView, useLoadedView } from "./useLiveView.js";
21
30
  import { usePageDoc } from "./usePageDoc.js";
22
31
  import { useScrollMemory } from "./useScrollMemory.js";
23
32
  import { useStoryCode } from "./useStoryCode.js";
24
- /** The height of a frame before its story reports its own, in CSS px. */
25
- const FALLBACK_HEIGHT = 160;
26
- /** The demo's height before its story reports its own, in CSS px: the demo is the page's first, larger frame. */
27
- const DEMO_FALLBACK_HEIGHT = 280;
28
- /** A link to a story's own page, opened in place unless the user asks for another tab. */
29
- const StoryLink = ({ story, hrefOf, onOpen, className, children }) => (_jsx("a", { className: className, href: hrefOf(story), onClick: (event) => {
30
- if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0)
31
- return;
32
- event.preventDefault();
33
- onOpen(story);
34
- }, children: children }));
35
- /**
36
- * The code under an example: closed until asked for, then opened in place with a button that copies it.
37
- *
38
- * @param props - the story's code and whether it is shown.
39
- */
40
- const ExampleCode = ({ id, source, isShown }) => {
41
- const { isCopied, copy } = useCopy();
42
- const write = useCodeWriter();
43
- return (_jsx("div", { id: id, className: "forgebook-example__code", "data-open": isShown ? "" : undefined, inert: !isShown, children: _jsxs("div", { className: "forgebook-example__code-inner", children: [_jsx("button", { type: "button", className: "forgebook-example__copy", onClick: () => copy(storyCodeText(source, write)), "aria-live": "polite", children: isCopied ? STRINGS.copied : STRINGS.copy }), _jsx(StoryCodeBlock, { ...source })] }) }));
44
- };
45
- /**
46
- * One example: its title and description (the demo has none: it opens the page), its story in a frame, and a bar
47
- * that shows its code.
48
- *
49
- * @param props - the story, whether it is the demo, whether its frame may load, where the queue watches it, and what
50
- * every example shares.
51
- */
52
- const Example = ({ story, isDemo, isMounted, observe, ...context }) => {
53
- const [isCodeShown, setIsCodeShown] = useState(false);
54
- const codeId = useId();
55
- // the story's measured height when there is one; a guess otherwise, larger for the demo; never below the height its
56
- // scene needs, which its frame has from the start
57
- const fallbackHeight = Math.max(story.height ?? 0, context.heightOf(story.id) ?? (isDemo ? DEMO_FALLBACK_HEIGHT : FALLBACK_HEIGHT));
58
- const source = context.code.status === "ready"
59
- ? {
60
- code: context.code.value,
61
- exportName: story.exportName,
62
- componentName: context.componentName,
63
- args: context.argsOf(story.id)
64
- }
65
- : undefined;
66
- return (_jsxs("article", { ref: observe, className: "forgebook-example", "data-demo": isDemo ? "" : undefined, "aria-label": isDemo ? STRINGS.frameTitle(context.component.name, story.name) : story.name, children: [isDemo ? null : (_jsxs("header", { className: "forgebook-example__head", children: [_jsx("h4", { className: "forgebook-example__title", children: _jsx(StoryLink, { story: story, hrefOf: context.hrefOf, onOpen: context.onOpen, className: "forgebook-link", children: story.name }) }), story.description === undefined ? null : (_jsx("p", { className: "forgebook-example__description", children: _jsx(CodeText, { text: story.description }) }))] })), _jsxs("div", { className: "forgebook-example__box", children: [_jsx("div", { className: "forgebook-example__stage", children: _jsx(StageViewport, { width: context.view.width, background: context.background, children: isMounted ? (_jsx(FrameView, { title: STRINGS.frameTitle(context.component.name, story.name), address: frameAddress(context.frameUrl, story.id, context.frameView, context.switches), heights: context.heights, settled: context.settled, fallbackHeight: fallbackHeight, sceneHeight: story.height })) : (_jsx("div", { className: "forgebook-frame-placeholder", style: { height: fallbackHeight } })) }) }), _jsxs("div", { className: "forgebook-example__bar", children: [source === undefined ? null : (_jsxs("button", { type: "button", className: "forgebook-example__toggle", "aria-expanded": isCodeShown, "aria-controls": codeId, onClick: () => setIsCodeShown(!isCodeShown), children: [_jsx(Icon, { name: "chevronRight", size: 12 }), isCodeShown ? STRINGS.hideCode : STRINGS.showCode] })), isDemo ? (_jsxs(StoryLink, { story: story, hrefOf: context.hrefOf, onOpen: context.onOpen, className: "forgebook-example__open", children: [STRINGS.openStory, _jsx(Icon, { name: "external", size: 12 })] })) : null] }), source === undefined ? null : _jsx(ExampleCode, { id: codeId, source: source, isShown: isCodeShown })] })] }));
67
- };
68
33
  /**
69
34
  * The page's lead: what the component is and does, from its file's `@module` comment (its own TSDoc is often a bare
70
35
  * name), read with the documentation file so it comes with the page; else its TSDoc summary, once the docs come.
@@ -94,7 +59,7 @@ const Prose = ({ page }) => {
94
59
  *
95
60
  * @param props - the component, the view, its loaders and how to open a story.
96
61
  */
97
- export const ComponentPage = ({ component, view, frameUrl, hrefOf, onOpen, loadDocs, loadCode, loadPage, heightOf, background, header, scroll }) => {
62
+ export const ComponentPage = ({ component, view, frameUrl, hrefOf, onOpen, loadDocs, loadCode, loadPage, heightOf, background, header, scroll, usedIn }) => {
98
63
  const pageRef = useRef(null);
99
64
  const docs = useComponentDocs(loadDocs);
100
65
  const code = useStoryCode(loadCode);
@@ -141,6 +106,6 @@ export const ComponentPage = ({ component, view, frameUrl, hrefOf, onOpen, loadD
141
106
  heightOf,
142
107
  background
143
108
  };
144
- return (_jsxs("div", { className: "forgebook-workspace", children: [header, _jsx("div", { ref: pageRef, className: "forgebook-scroll", children: _jsxs("div", { className: "forgebook-doc", children: [_jsx(Lead, { page: page, docs: componentDocs }), demo === undefined ? null : _jsx(Example, { ...context, story: demo, isDemo: true, isMounted: true }), _jsx(Prose, { page: page }), componentDocs === undefined || componentDocs.props.length === 0 ? null : (_jsx(ApiReference, { docs: componentDocs })), examples.length === 0 ? null : (_jsxs("section", { className: "forgebook-doc__section", "aria-labelledby": "forgebook-examples", children: [_jsx("h2", { id: "forgebook-examples", children: STRINGS.examples }), groupedStories(examples, catalogue.storyGroups.map((group) => group.id)).map((section) => (_jsxs("section", { className: "forgebook-doc__group", children: [section.group === undefined ? null : (_jsx("h3", { className: "forgebook-doc__group-name", children: groupLabel(catalogue.storyGroups, section.group) })), section.stories.map((story) => (_jsx(Example, { ...context, story: story, isDemo: false, isMounted: queue.mounted.has(story.id), observe: (element) => queue.observe(story.id, element) }, story.id)))] }, section.group ?? "")))] }))] }, `${component.file}|${component.title}`) })] }));
109
+ return (_jsxs("div", { className: "forgebook-workspace", children: [header, _jsx("div", { ref: pageRef, className: "forgebook-scroll", children: _jsxs("div", { className: "forgebook-doc", children: [_jsx(Lead, { page: page, docs: componentDocs }), demo === undefined ? null : _jsx(Example, { ...context, story: demo, isDemo: true, isMounted: true }), _jsx(Prose, { page: page }), componentDocs === undefined || componentDocs.props.length === 0 ? null : (_jsx(ApiReference, { docs: componentDocs })), examples.length === 0 ? null : (_jsxs("section", { className: "forgebook-doc__section", "aria-labelledby": "forgebook-examples", children: [_jsx("h2", { id: "forgebook-examples", children: STRINGS.examples }), groupedStories(examples, catalogue.storyGroups.map((group) => group.id)).map((section) => (_jsxs("section", { className: "forgebook-doc__group", children: [section.group === undefined ? null : (_jsx("h3", { className: "forgebook-doc__group-name", children: groupLabel(catalogue.storyGroups, section.group) })), section.stories.map((story) => (_jsx(Example, { ...context, story: story, isDemo: false, isMounted: queue.mounted.has(story.id), observe: (element) => queue.observe(story.id, element) }, story.id)))] }, section.group ?? "")))] })), usedIn === undefined ? null : _jsx(UsedIn, { title: component.title, ...usedIn })] }, `${component.file}|${component.title}`) })] }));
145
110
  };
146
111
  //# sourceMappingURL=ComponentPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentPage.js","sourceRoot":"","sources":["../../../src/shell/ComponentPage.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAmC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAs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,KAfU,OAAO,CAAC,KAAK,IAAI,EAAE,CAgBvB,CACX,CAAC,IACM,CACX,EACA,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,MAAM,IAAC,KAAK,EAAE,SAAS,CAAC,KAAK,KAAM,MAAM,GAAI,KAlCrE,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,KAAK,EAAE,CAmC1C,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A control's key in its View row: the key shown, and a press on it records another (Backspace takes it away, Escape
3
+ * keeps it). A key the shell or another control has is refused, the reason said in place.
4
+ *
5
+ * @module
6
+ */
7
+ import { type ReactNode } from "react";
8
+ /**
9
+ * The key field.
10
+ *
11
+ * @param props - the control's name, its key, and what gives it another.
12
+ */
13
+ export declare const ControlKeyField: ({ label, shortcut, onKeyChange }: {
14
+ /** The control's name, for the field's own. */
15
+ readonly label: string;
16
+ /** Its key; none when it has none. */
17
+ readonly shortcut: string | undefined;
18
+ /** Gives it another key (`null` takes it away); answers why a key cannot be given. */
19
+ readonly onKeyChange: (key: string | null) => string | undefined;
20
+ }) => ReactNode;
21
+ //# sourceMappingURL=ControlKeyField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControlKeyField.d.ts","sourceRoot":"","sources":["../../../src/shell/ControlKeyField.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAsB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAQrE;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,kCAI7B;IACD,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,sFAAsF;IACtF,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC;CAClE,KAAG,SAyCH,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A control's key in its View row: the key shown, and a press on it records another (Backspace takes it away, Escape
4
+ * keeps it). A key the shell or another control has is refused, the reason said in place.
5
+ *
6
+ * @module
7
+ */
8
+ import { useState } from "react";
9
+ import { keyOf } from "../controlKeys.js";
10
+ import { STRINGS } from "./strings.js";
11
+ /** The keys that take a control's key away while one is recorded. */
12
+ const REMOVE_KEYS = ["Backspace", "Delete"];
13
+ /**
14
+ * The key field.
15
+ *
16
+ * @param props - the control's name, its key, and what gives it another.
17
+ */
18
+ export const ControlKeyField = ({ label, shortcut, onKeyChange }) => {
19
+ const [isRecording, setIsRecording] = useState(false);
20
+ const [problem, setProblem] = useState(undefined);
21
+ const record = (event) => {
22
+ if (!isRecording || event.key === "Tab")
23
+ return;
24
+ // the press is the field's: neither the controls' keys nor the menu's Escape see it
25
+ event.preventDefault();
26
+ event.stopPropagation();
27
+ if (event.key === "Escape") {
28
+ setIsRecording(false);
29
+ return;
30
+ }
31
+ if (event.metaKey || event.ctrlKey || event.altKey)
32
+ return;
33
+ const key = REMOVE_KEYS.includes(event.key) ? null : keyOf(event.key);
34
+ if (key === undefined)
35
+ return;
36
+ const refused = onKeyChange(key);
37
+ setProblem(refused);
38
+ if (refused === undefined)
39
+ setIsRecording(false);
40
+ };
41
+ return (_jsxs("span", { className: "forgebook-key-field", children: [_jsx("button", { type: "button", className: "forgebook-key-field__button", "aria-label": STRINGS.controlKey(label, shortcut), "aria-pressed": isRecording, title: isRecording ? STRINGS.pressAKey : STRINGS.changeKey, onClick: () => {
42
+ setProblem(undefined);
43
+ setIsRecording(!isRecording);
44
+ }, onBlur: () => setIsRecording(false), onKeyDown: record, children: isRecording ? STRINGS.pressAKey : _jsx("kbd", { children: shortcut?.toUpperCase() ?? "–" }) }), _jsx("span", { className: "forgebook-key-field__problem", role: "status", children: problem ?? "" })] }));
45
+ };
46
+ //# sourceMappingURL=ControlKeyField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControlKeyField.js","sourceRoot":"","sources":["../../../src/shell/ControlKeyField.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,OAAO,EAAsC,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,qEAAqE;AACrE,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,WAAW,EAQZ,EAAa,EAAE;IACd,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,CAAC,KAAuC,EAAQ,EAAE;QAC/D,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK;YAAE,OAAO;QAChD,oFAAoF;QACpF,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC3B,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,OAAO;QACT,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM;YAAE,OAAO;QAC3D,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAA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