forgebook 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -2
  3. package/dist/bin/forgebook/catalogueVite.d.ts +16 -0
  4. package/dist/bin/forgebook/catalogueVite.d.ts.map +1 -0
  5. package/dist/bin/forgebook/catalogueVite.js +15 -0
  6. package/dist/bin/forgebook/catalogueVite.js.map +1 -0
  7. package/dist/bin/forgebook/forgebook.d.mts +3 -0
  8. package/dist/bin/forgebook/forgebook.d.mts.map +1 -0
  9. package/dist/bin/forgebook/forgebook.mjs +93 -0
  10. package/dist/bin/forgebook/forgebook.mjs.map +1 -0
  11. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts +90 -0
  12. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts.map +1 -0
  13. package/dist/bin/forgebook-docs/catalogueDocs.types.js +1 -0
  14. package/dist/bin/forgebook-docs/catalogueDocs.types.js.map +1 -0
  15. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts +9 -0
  16. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts.map +1 -0
  17. package/dist/bin/forgebook-docs/catalogueMarkdown.js +132 -0
  18. package/dist/bin/forgebook-docs/catalogueMarkdown.js.map +1 -0
  19. package/dist/bin/forgebook-docs/collectDocs.d.ts +17 -0
  20. package/dist/bin/forgebook-docs/collectDocs.d.ts.map +1 -0
  21. package/dist/bin/forgebook-docs/collectDocs.js +115 -0
  22. package/dist/bin/forgebook-docs/collectDocs.js.map +1 -0
  23. package/dist/bin/forgebook-docs/forgebook-docs.d.mts +3 -0
  24. package/dist/bin/forgebook-docs/forgebook-docs.d.mts.map +1 -0
  25. package/dist/bin/forgebook-docs/forgebook-docs.mjs +115 -0
  26. package/dist/bin/forgebook-docs/forgebook-docs.mjs.map +1 -0
  27. package/dist/bin/forgebook-docs/moduleDocs.d.ts +9 -0
  28. package/dist/bin/forgebook-docs/moduleDocs.d.ts.map +1 -0
  29. package/dist/bin/forgebook-docs/moduleDocs.js +62 -0
  30. package/dist/bin/forgebook-docs/moduleDocs.js.map +1 -0
  31. package/dist/bin/forgebook-docs/sassDocs.d.ts +20 -0
  32. package/dist/bin/forgebook-docs/sassDocs.d.ts.map +1 -0
  33. package/dist/bin/forgebook-docs/sassDocs.js +77 -0
  34. package/dist/bin/forgebook-docs/sassDocs.js.map +1 -0
  35. package/dist/bin/forgebook-texts/forgebook-texts.d.mts +3 -0
  36. package/dist/bin/forgebook-texts/forgebook-texts.d.mts.map +1 -0
  37. package/dist/bin/forgebook-texts/forgebook-texts.mjs +94 -0
  38. package/dist/bin/forgebook-texts/forgebook-texts.mjs.map +1 -0
  39. package/dist/bin/forgebook-texts/storyTextsReport.d.ts +26 -0
  40. package/dist/bin/forgebook-texts/storyTextsReport.d.ts.map +1 -0
  41. package/dist/bin/forgebook-texts/storyTextsReport.js +35 -0
  42. package/dist/bin/forgebook-texts/storyTextsReport.js.map +1 -0
  43. package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts +25 -0
  44. package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts.map +1 -0
  45. package/dist/bin/forgebook-texts/storyTextsReport.types.js +7 -0
  46. package/dist/bin/forgebook-texts/storyTextsReport.types.js.map +1 -0
  47. package/dist/src/a11y.d.ts +28 -0
  48. package/dist/src/a11y.d.ts.map +1 -0
  49. package/dist/src/a11y.js +29 -0
  50. package/dist/src/a11y.js.map +1 -0
  51. package/dist/src/argTypes.d.ts +114 -0
  52. package/dist/src/argTypes.d.ts.map +1 -0
  53. package/dist/src/argTypes.js +254 -0
  54. package/dist/src/argTypes.js.map +1 -0
  55. package/dist/src/backdrops.d.ts +88 -0
  56. package/dist/src/backdrops.d.ts.map +1 -0
  57. package/dist/src/backdrops.js +202 -0
  58. package/dist/src/backdrops.js.map +1 -0
  59. package/dist/src/catalogue.d.ts +120 -0
  60. package/dist/src/catalogue.d.ts.map +1 -0
  61. package/dist/src/catalogue.js +80 -0
  62. package/dist/src/catalogue.js.map +1 -0
  63. package/dist/src/componentDocs.d.ts +98 -0
  64. package/dist/src/componentDocs.d.ts.map +1 -0
  65. package/dist/src/componentDocs.js +47 -0
  66. package/dist/src/componentDocs.js.map +1 -0
  67. package/dist/src/frame/checkStory.d.ts +20 -0
  68. package/dist/src/frame/checkStory.d.ts.map +1 -0
  69. package/dist/src/frame/checkStory.js +31 -0
  70. package/dist/src/frame/checkStory.js.map +1 -0
  71. package/dist/src/frame/frame.css +51 -0
  72. package/dist/src/frame/frameClock.d.ts +53 -0
  73. package/dist/src/frame/frameClock.d.ts.map +1 -0
  74. package/dist/src/frame/frameClock.js +80 -0
  75. package/dist/src/frame/frameClock.js.map +1 -0
  76. package/dist/src/frame/frameStatus.d.ts +8 -0
  77. package/dist/src/frame/frameStatus.d.ts.map +1 -0
  78. package/dist/src/frame/frameStatus.js +8 -0
  79. package/dist/src/frame/frameStatus.js.map +1 -0
  80. package/dist/src/frame/frameView.d.ts +33 -0
  81. package/dist/src/frame/frameView.d.ts.map +1 -0
  82. package/dist/src/frame/frameView.js +134 -0
  83. package/dist/src/frame/frameView.js.map +1 -0
  84. package/dist/src/frame/matrixLayout.d.ts +36 -0
  85. package/dist/src/frame/matrixLayout.d.ts.map +1 -0
  86. package/dist/src/frame/matrixLayout.js +87 -0
  87. package/dist/src/frame/matrixLayout.js.map +1 -0
  88. package/dist/src/frame/measureTools.d.ts +24 -0
  89. package/dist/src/frame/measureTools.d.ts.map +1 -0
  90. package/dist/src/frame/measureTools.js +141 -0
  91. package/dist/src/frame/measureTools.js.map +1 -0
  92. package/dist/src/frame/mountFrame.d.ts +47 -0
  93. package/dist/src/frame/mountFrame.d.ts.map +1 -0
  94. package/dist/src/frame/mountFrame.js +229 -0
  95. package/dist/src/frame/mountFrame.js.map +1 -0
  96. package/dist/src/frame/playStory.d.ts +40 -0
  97. package/dist/src/frame/playStory.d.ts.map +1 -0
  98. package/dist/src/frame/playStory.js +55 -0
  99. package/dist/src/frame/playStory.js.map +1 -0
  100. package/dist/src/frame/renderer.d.ts +85 -0
  101. package/dist/src/frame/renderer.d.ts.map +1 -0
  102. package/dist/src/frame/renderer.js +18 -0
  103. package/dist/src/frame/renderer.js.map +1 -0
  104. package/dist/src/frame/settle.d.ts +24 -0
  105. package/dist/src/frame/settle.d.ts.map +1 -0
  106. package/dist/src/frame/settle.js +25 -0
  107. package/dist/src/frame/settle.js.map +1 -0
  108. package/dist/src/frame/staleModule.d.ts +40 -0
  109. package/dist/src/frame/staleModule.d.ts.map +1 -0
  110. package/dist/src/frame/staleModule.js +74 -0
  111. package/dist/src/frame/staleModule.js.map +1 -0
  112. package/dist/src/frame/storyCanvas.d.ts +21 -0
  113. package/dist/src/frame/storyCanvas.d.ts.map +1 -0
  114. package/dist/src/frame/storyCanvas.js +30 -0
  115. package/dist/src/frame/storyCanvas.js.map +1 -0
  116. package/dist/src/frame/storyHooks.d.ts +31 -0
  117. package/dist/src/frame/storyHooks.d.ts.map +1 -0
  118. package/dist/src/frame/storyHooks.js +59 -0
  119. package/dist/src/frame/storyHooks.js.map +1 -0
  120. package/dist/src/frame/storyModule.d.ts +104 -0
  121. package/dist/src/frame/storyModule.d.ts.map +1 -0
  122. package/dist/src/frame/storyModule.js +205 -0
  123. package/dist/src/frame/storyModule.js.map +1 -0
  124. package/dist/src/frame/storyRun.d.ts +96 -0
  125. package/dist/src/frame/storyRun.d.ts.map +1 -0
  126. package/dist/src/frame/storyRun.js +318 -0
  127. package/dist/src/frame/storyRun.js.map +1 -0
  128. package/dist/src/languages.d.ts +15 -0
  129. package/dist/src/languages.d.ts.map +1 -0
  130. package/dist/src/languages.js +8 -0
  131. package/dist/src/languages.js.map +1 -0
  132. package/dist/src/matrix.d.ts +56 -0
  133. package/dist/src/matrix.d.ts.map +1 -0
  134. package/dist/src/matrix.js +61 -0
  135. package/dist/src/matrix.js.map +1 -0
  136. package/dist/src/messages.d.ts +203 -0
  137. package/dist/src/messages.d.ts.map +1 -0
  138. package/dist/src/messages.js +193 -0
  139. package/dist/src/messages.js.map +1 -0
  140. package/dist/src/namedValues.d.ts +38 -0
  141. package/dist/src/namedValues.d.ts.map +1 -0
  142. package/dist/src/namedValues.js +48 -0
  143. package/dist/src/namedValues.js.map +1 -0
  144. package/dist/src/pageConfig.d.ts +23 -0
  145. package/dist/src/pageConfig.d.ts.map +1 -0
  146. package/dist/src/pageConfig.js +1 -0
  147. package/dist/src/pageConfig.js.map +1 -0
  148. package/dist/src/playTrace.d.ts +41 -0
  149. package/dist/src/playTrace.d.ts.map +1 -0
  150. package/dist/src/playTrace.js +35 -0
  151. package/dist/src/playTrace.js.map +1 -0
  152. package/dist/src/shell/A11yTab.d.ts +44 -0
  153. package/dist/src/shell/A11yTab.d.ts.map +1 -0
  154. package/dist/src/shell/A11yTab.js +30 -0
  155. package/dist/src/shell/A11yTab.js.map +1 -0
  156. package/dist/src/shell/ApiReference.d.ts +18 -0
  157. package/dist/src/shell/ApiReference.d.ts.map +1 -0
  158. package/dist/src/shell/ApiReference.js +41 -0
  159. package/dist/src/shell/ApiReference.js.map +1 -0
  160. package/dist/src/shell/ClockControls.d.ts +43 -0
  161. package/dist/src/shell/ClockControls.d.ts.map +1 -0
  162. package/dist/src/shell/ClockControls.js +53 -0
  163. package/dist/src/shell/ClockControls.js.map +1 -0
  164. package/dist/src/shell/Code.d.ts +16 -0
  165. package/dist/src/shell/Code.d.ts.map +1 -0
  166. package/dist/src/shell/Code.js +9 -0
  167. package/dist/src/shell/Code.js.map +1 -0
  168. package/dist/src/shell/CodeTab.d.ts +17 -0
  169. package/dist/src/shell/CodeTab.d.ts.map +1 -0
  170. package/dist/src/shell/CodeTab.js +17 -0
  171. package/dist/src/shell/CodeTab.js.map +1 -0
  172. package/dist/src/shell/CodeText.d.ts +16 -0
  173. package/dist/src/shell/CodeText.d.ts.map +1 -0
  174. package/dist/src/shell/CodeText.js +10 -0
  175. package/dist/src/shell/CodeText.js.map +1 -0
  176. package/dist/src/shell/ComponentPage.d.ts +38 -0
  177. package/dist/src/shell/ComponentPage.d.ts.map +1 -0
  178. package/dist/src/shell/ComponentPage.js +146 -0
  179. package/dist/src/shell/ComponentPage.js.map +1 -0
  180. package/dist/src/shell/Dock.d.ts +42 -0
  181. package/dist/src/shell/Dock.d.ts.map +1 -0
  182. package/dist/src/shell/Dock.js +90 -0
  183. package/dist/src/shell/Dock.js.map +1 -0
  184. package/dist/src/shell/EventsTab.d.ts +25 -0
  185. package/dist/src/shell/EventsTab.d.ts.map +1 -0
  186. package/dist/src/shell/EventsTab.js +26 -0
  187. package/dist/src/shell/EventsTab.js.map +1 -0
  188. package/dist/src/shell/FrameView.d.ts +49 -0
  189. package/dist/src/shell/FrameView.d.ts.map +1 -0
  190. package/dist/src/shell/FrameView.js +29 -0
  191. package/dist/src/shell/FrameView.js.map +1 -0
  192. package/dist/src/shell/HomePage.d.ts +39 -0
  193. package/dist/src/shell/HomePage.d.ts.map +1 -0
  194. package/dist/src/shell/HomePage.js +85 -0
  195. package/dist/src/shell/HomePage.js.map +1 -0
  196. package/dist/src/shell/InteractionsTab.d.ts +28 -0
  197. package/dist/src/shell/InteractionsTab.d.ts.map +1 -0
  198. package/dist/src/shell/InteractionsTab.js +17 -0
  199. package/dist/src/shell/InteractionsTab.js.map +1 -0
  200. package/dist/src/shell/MatrixPicker.d.ts +24 -0
  201. package/dist/src/shell/MatrixPicker.d.ts.map +1 -0
  202. package/dist/src/shell/MatrixPicker.js +29 -0
  203. package/dist/src/shell/MatrixPicker.js.map +1 -0
  204. package/dist/src/shell/PackageHtml.d.ts +17 -0
  205. package/dist/src/shell/PackageHtml.d.ts.map +1 -0
  206. package/dist/src/shell/PackageHtml.js +13 -0
  207. package/dist/src/shell/PackageHtml.js.map +1 -0
  208. package/dist/src/shell/PartsTab.d.ts +23 -0
  209. package/dist/src/shell/PartsTab.d.ts.map +1 -0
  210. package/dist/src/shell/PartsTab.js +23 -0
  211. package/dist/src/shell/PartsTab.js.map +1 -0
  212. package/dist/src/shell/PropFields.d.ts +31 -0
  213. package/dist/src/shell/PropFields.d.ts.map +1 -0
  214. package/dist/src/shell/PropFields.js +81 -0
  215. package/dist/src/shell/PropFields.js.map +1 -0
  216. package/dist/src/shell/PropsTab.d.ts +45 -0
  217. package/dist/src/shell/PropsTab.d.ts.map +1 -0
  218. package/dist/src/shell/PropsTab.js +81 -0
  219. package/dist/src/shell/PropsTab.js.map +1 -0
  220. package/dist/src/shell/SchemeSwitches.d.ts +24 -0
  221. package/dist/src/shell/SchemeSwitches.d.ts.map +1 -0
  222. package/dist/src/shell/SchemeSwitches.js +36 -0
  223. package/dist/src/shell/SchemeSwitches.js.map +1 -0
  224. package/dist/src/shell/Segmented.d.ts +41 -0
  225. package/dist/src/shell/Segmented.d.ts.map +1 -0
  226. package/dist/src/shell/Segmented.js +19 -0
  227. package/dist/src/shell/Segmented.js.map +1 -0
  228. package/dist/src/shell/Shell.d.ts +49 -0
  229. package/dist/src/shell/Shell.d.ts.map +1 -0
  230. package/dist/src/shell/Shell.js +279 -0
  231. package/dist/src/shell/Shell.js.map +1 -0
  232. package/dist/src/shell/Sidebar.d.ts +52 -0
  233. package/dist/src/shell/Sidebar.d.ts.map +1 -0
  234. package/dist/src/shell/Sidebar.js +132 -0
  235. package/dist/src/shell/Sidebar.js.map +1 -0
  236. package/dist/src/shell/SidebarHandle.d.ts +29 -0
  237. package/dist/src/shell/SidebarHandle.d.ts.map +1 -0
  238. package/dist/src/shell/SidebarHandle.js +46 -0
  239. package/dist/src/shell/SidebarHandle.js.map +1 -0
  240. package/dist/src/shell/Stage.d.ts +68 -0
  241. package/dist/src/shell/Stage.d.ts.map +1 -0
  242. package/dist/src/shell/Stage.js +218 -0
  243. package/dist/src/shell/Stage.js.map +1 -0
  244. package/dist/src/shell/StageTools.d.ts +27 -0
  245. package/dist/src/shell/StageTools.d.ts.map +1 -0
  246. package/dist/src/shell/StageTools.js +34 -0
  247. package/dist/src/shell/StageTools.js.map +1 -0
  248. package/dist/src/shell/StageViewport.d.ts +47 -0
  249. package/dist/src/shell/StageViewport.d.ts.map +1 -0
  250. package/dist/src/shell/StageViewport.js +174 -0
  251. package/dist/src/shell/StageViewport.js.map +1 -0
  252. package/dist/src/shell/StoryCodeBlock.d.ts +35 -0
  253. package/dist/src/shell/StoryCodeBlock.d.ts.map +1 -0
  254. package/dist/src/shell/StoryCodeBlock.js +27 -0
  255. package/dist/src/shell/StoryCodeBlock.js.map +1 -0
  256. package/dist/src/shell/StoryPicker.d.ts +26 -0
  257. package/dist/src/shell/StoryPicker.d.ts.map +1 -0
  258. package/dist/src/shell/StoryPicker.js +32 -0
  259. package/dist/src/shell/StoryPicker.js.map +1 -0
  260. package/dist/src/shell/Toolbar.d.ts +40 -0
  261. package/dist/src/shell/Toolbar.d.ts.map +1 -0
  262. package/dist/src/shell/Toolbar.js +125 -0
  263. package/dist/src/shell/Toolbar.js.map +1 -0
  264. package/dist/src/shell/WidthField.d.ts +24 -0
  265. package/dist/src/shell/WidthField.d.ts.map +1 -0
  266. package/dist/src/shell/WidthField.js +40 -0
  267. package/dist/src/shell/WidthField.js.map +1 -0
  268. package/dist/src/shell/catalogueContext.d.ts +6 -0
  269. package/dist/src/shell/catalogueContext.d.ts.map +1 -0
  270. package/dist/src/shell/catalogueContext.js +14 -0
  271. package/dist/src/shell/catalogueContext.js.map +1 -0
  272. package/dist/src/shell/codeTokens.d.ts +23 -0
  273. package/dist/src/shell/codeTokens.d.ts.map +1 -0
  274. package/dist/src/shell/codeTokens.js +48 -0
  275. package/dist/src/shell/codeTokens.js.map +1 -0
  276. package/dist/src/shell/codeWriter.d.ts +6 -0
  277. package/dist/src/shell/codeWriter.d.ts.map +1 -0
  278. package/dist/src/shell/codeWriter.js +14 -0
  279. package/dist/src/shell/codeWriter.js.map +1 -0
  280. package/dist/src/shell/compareVariants.d.ts +35 -0
  281. package/dist/src/shell/compareVariants.d.ts.map +1 -0
  282. package/dist/src/shell/compareVariants.js +68 -0
  283. package/dist/src/shell/compareVariants.js.map +1 -0
  284. package/dist/src/shell/dockTabs.d.ts +63 -0
  285. package/dist/src/shell/dockTabs.d.ts.map +1 -0
  286. package/dist/src/shell/dockTabs.js +140 -0
  287. package/dist/src/shell/dockTabs.js.map +1 -0
  288. package/dist/src/shell/icons.d.ts +47 -0
  289. package/dist/src/shell/icons.d.ts.map +1 -0
  290. package/dist/src/shell/icons.js +36 -0
  291. package/dist/src/shell/icons.js.map +1 -0
  292. package/dist/src/shell/keyboard.d.ts +35 -0
  293. package/dist/src/shell/keyboard.d.ts.map +1 -0
  294. package/dist/src/shell/keyboard.js +51 -0
  295. package/dist/src/shell/keyboard.js.map +1 -0
  296. package/dist/src/shell/mountShell.d.ts +22 -0
  297. package/dist/src/shell/mountShell.d.ts.map +1 -0
  298. package/dist/src/shell/mountShell.js +39 -0
  299. package/dist/src/shell/mountShell.js.map +1 -0
  300. package/dist/src/shell/shell.css +1831 -0
  301. package/dist/src/shell/strings.d.ts +184 -0
  302. package/dist/src/shell/strings.d.ts.map +1 -0
  303. package/dist/src/shell/strings.js +188 -0
  304. package/dist/src/shell/strings.js.map +1 -0
  305. package/dist/src/shell/switchView.d.ts +23 -0
  306. package/dist/src/shell/switchView.d.ts.map +1 -0
  307. package/dist/src/shell/switchView.js +19 -0
  308. package/dist/src/shell/switchView.js.map +1 -0
  309. package/dist/src/shell/treeSearch.d.ts +35 -0
  310. package/dist/src/shell/treeSearch.d.ts.map +1 -0
  311. package/dist/src/shell/treeSearch.js +60 -0
  312. package/dist/src/shell/treeSearch.js.map +1 -0
  313. package/dist/src/shell/useComponentDocs.d.ts +16 -0
  314. package/dist/src/shell/useComponentDocs.d.ts.map +1 -0
  315. package/dist/src/shell/useComponentDocs.js +25 -0
  316. package/dist/src/shell/useComponentDocs.js.map +1 -0
  317. package/dist/src/shell/useCopy.d.ts +10 -0
  318. package/dist/src/shell/useCopy.d.ts.map +1 -0
  319. package/dist/src/shell/useCopy.js +23 -0
  320. package/dist/src/shell/useCopy.js.map +1 -0
  321. package/dist/src/shell/useFrameMessages.d.ts +54 -0
  322. package/dist/src/shell/useFrameMessages.d.ts.map +1 -0
  323. package/dist/src/shell/useFrameMessages.js +90 -0
  324. package/dist/src/shell/useFrameMessages.js.map +1 -0
  325. package/dist/src/shell/useFrameQueue.d.ts +29 -0
  326. package/dist/src/shell/useFrameQueue.d.ts.map +1 -0
  327. package/dist/src/shell/useFrameQueue.js +72 -0
  328. package/dist/src/shell/useFrameQueue.js.map +1 -0
  329. package/dist/src/shell/useLiveView.d.ts +29 -0
  330. package/dist/src/shell/useLiveView.d.ts.map +1 -0
  331. package/dist/src/shell/useLiveView.js +51 -0
  332. package/dist/src/shell/useLiveView.js.map +1 -0
  333. package/dist/src/shell/useLoaded.d.ts +20 -0
  334. package/dist/src/shell/useLoaded.d.ts.map +1 -0
  335. package/dist/src/shell/useLoaded.js +40 -0
  336. package/dist/src/shell/useLoaded.js.map +1 -0
  337. package/dist/src/shell/usePageDoc.d.ts +20 -0
  338. package/dist/src/shell/usePageDoc.d.ts.map +1 -0
  339. package/dist/src/shell/usePageDoc.js +21 -0
  340. package/dist/src/shell/usePageDoc.js.map +1 -0
  341. package/dist/src/shell/usePopover.d.ts +23 -0
  342. package/dist/src/shell/usePopover.d.ts.map +1 -0
  343. package/dist/src/shell/usePopover.js +39 -0
  344. package/dist/src/shell/usePopover.js.map +1 -0
  345. package/dist/src/shell/useRecentPages.d.ts +21 -0
  346. package/dist/src/shell/useRecentPages.d.ts.map +1 -0
  347. package/dist/src/shell/useRecentPages.js +62 -0
  348. package/dist/src/shell/useRecentPages.js.map +1 -0
  349. package/dist/src/shell/useScrollMemory.d.ts +40 -0
  350. package/dist/src/shell/useScrollMemory.d.ts.map +1 -0
  351. package/dist/src/shell/useScrollMemory.js +69 -0
  352. package/dist/src/shell/useScrollMemory.js.map +1 -0
  353. package/dist/src/shell/useSidebarLayout.d.ts +14 -0
  354. package/dist/src/shell/useSidebarLayout.d.ts.map +1 -0
  355. package/dist/src/shell/useSidebarLayout.js +19 -0
  356. package/dist/src/shell/useSidebarLayout.js.map +1 -0
  357. package/dist/src/shell/useStored.d.ts +11 -0
  358. package/dist/src/shell/useStored.d.ts.map +1 -0
  359. package/dist/src/shell/useStored.js +68 -0
  360. package/dist/src/shell/useStored.js.map +1 -0
  361. package/dist/src/shell/useStoryCode.d.ts +14 -0
  362. package/dist/src/shell/useStoryCode.d.ts.map +1 -0
  363. package/dist/src/shell/useStoryCode.js +29 -0
  364. package/dist/src/shell/useStoryCode.js.map +1 -0
  365. package/dist/src/shell/useStoryHeights.d.ts +9 -0
  366. package/dist/src/shell/useStoryHeights.d.ts.map +1 -0
  367. package/dist/src/shell/useStoryHeights.js +31 -0
  368. package/dist/src/shell/useStoryHeights.js.map +1 -0
  369. package/dist/src/shell/useStoryIdsElement.d.ts +7 -0
  370. package/dist/src/shell/useStoryIdsElement.d.ts.map +1 -0
  371. package/dist/src/shell/useStoryIdsElement.js +29 -0
  372. package/dist/src/shell/useStoryIdsElement.js.map +1 -0
  373. package/dist/src/shell/useStoryKeys.d.ts +11 -0
  374. package/dist/src/shell/useStoryKeys.d.ts.map +1 -0
  375. package/dist/src/shell/useStoryKeys.js +40 -0
  376. package/dist/src/shell/useStoryKeys.js.map +1 -0
  377. package/dist/src/shell/useSystemDark.d.ts +3 -0
  378. package/dist/src/shell/useSystemDark.d.ts.map +1 -0
  379. package/dist/src/shell/useSystemDark.js +19 -0
  380. package/dist/src/shell/useSystemDark.js.map +1 -0
  381. package/dist/src/sourceFiles.d.ts +18 -0
  382. package/dist/src/sourceFiles.d.ts.map +1 -0
  383. package/dist/src/sourceFiles.js +22 -0
  384. package/dist/src/sourceFiles.js.map +1 -0
  385. package/dist/src/storyBackground.d.ts +21 -0
  386. package/dist/src/storyBackground.d.ts.map +1 -0
  387. package/dist/src/storyBackground.js +27 -0
  388. package/dist/src/storyBackground.js.map +1 -0
  389. package/dist/src/storyClock.d.ts +62 -0
  390. package/dist/src/storyClock.d.ts.map +1 -0
  391. package/dist/src/storyClock.js +51 -0
  392. package/dist/src/storyClock.js.map +1 -0
  393. package/dist/src/storyGlobals.d.ts +60 -0
  394. package/dist/src/storyGlobals.d.ts.map +1 -0
  395. package/dist/src/storyGlobals.js +117 -0
  396. package/dist/src/storyGlobals.js.map +1 -0
  397. package/dist/src/storyHeights.d.ts +37 -0
  398. package/dist/src/storyHeights.d.ts.map +1 -0
  399. package/dist/src/storyHeights.js +53 -0
  400. package/dist/src/storyHeights.js.map +1 -0
  401. package/dist/src/storyIdsElement.d.ts +9 -0
  402. package/dist/src/storyIdsElement.d.ts.map +1 -0
  403. package/dist/src/storyIdsElement.js +9 -0
  404. package/dist/src/storyIdsElement.js.map +1 -0
  405. package/dist/src/storyTexts.d.ts +43 -0
  406. package/dist/src/storyTexts.d.ts.map +1 -0
  407. package/dist/src/storyTexts.js +71 -0
  408. package/dist/src/storyTexts.js.map +1 -0
  409. package/dist/src/storyTree.d.ts +215 -0
  410. package/dist/src/storyTree.d.ts.map +1 -0
  411. package/dist/src/storyTree.js +308 -0
  412. package/dist/src/storyTree.js.map +1 -0
  413. package/dist/src/switches.d.ts +156 -0
  414. package/dist/src/switches.d.ts.map +1 -0
  415. package/dist/src/switches.js +193 -0
  416. package/dist/src/switches.js.map +1 -0
  417. package/dist/src/viewState.d.ts +194 -0
  418. package/dist/src/viewState.d.ts.map +1 -0
  419. package/dist/src/viewState.js +303 -0
  420. package/dist/src/viewState.js.map +1 -0
  421. package/dist/src/vite/adapter.d.ts +70 -0
  422. package/dist/src/vite/adapter.d.ts.map +1 -0
  423. package/dist/src/vite/adapter.js +22 -0
  424. package/dist/src/vite/adapter.js.map +1 -0
  425. package/dist/src/vite/autoTitle.d.ts +28 -0
  426. package/dist/src/vite/autoTitle.d.ts.map +1 -0
  427. package/dist/src/vite/autoTitle.js +44 -0
  428. package/dist/src/vite/autoTitle.js.map +1 -0
  429. package/dist/src/vite/componentPage.d.ts +34 -0
  430. package/dist/src/vite/componentPage.d.ts.map +1 -0
  431. package/dist/src/vite/componentPage.js +94 -0
  432. package/dist/src/vite/componentPage.js.map +1 -0
  433. package/dist/src/vite/config.d.ts +72 -0
  434. package/dist/src/vite/config.d.ts.map +1 -0
  435. package/dist/src/vite/config.js +25 -0
  436. package/dist/src/vite/config.js.map +1 -0
  437. package/dist/src/vite/configFile.d.ts +76 -0
  438. package/dist/src/vite/configFile.d.ts.map +1 -0
  439. package/dist/src/vite/configFile.js +190 -0
  440. package/dist/src/vite/configFile.js.map +1 -0
  441. package/dist/src/vite/docsExtractor.d.ts +46 -0
  442. package/dist/src/vite/docsExtractor.d.ts.map +1 -0
  443. package/dist/src/vite/docsExtractor.js +88 -0
  444. package/dist/src/vite/docsExtractor.js.map +1 -0
  445. package/dist/src/vite/docsProgram.d.ts +42 -0
  446. package/dist/src/vite/docsProgram.d.ts.map +1 -0
  447. package/dist/src/vite/docsProgram.js +144 -0
  448. package/dist/src/vite/docsProgram.js.map +1 -0
  449. package/dist/src/vite/docsWorker.d.ts +2 -0
  450. package/dist/src/vite/docsWorker.d.ts.map +1 -0
  451. package/dist/src/vite/docsWorker.js +68 -0
  452. package/dist/src/vite/docsWorker.js.map +1 -0
  453. package/dist/src/vite/forcedStates.d.ts +27 -0
  454. package/dist/src/vite/forcedStates.d.ts.map +1 -0
  455. package/dist/src/vite/forcedStates.js +60 -0
  456. package/dist/src/vite/forcedStates.js.map +1 -0
  457. package/dist/src/vite/forgebookPlugin.d.ts +28 -0
  458. package/dist/src/vite/forgebookPlugin.d.ts.map +1 -0
  459. package/dist/src/vite/forgebookPlugin.js +375 -0
  460. package/dist/src/vite/forgebookPlugin.js.map +1 -0
  461. package/dist/src/vite/highlightCode.d.ts +16 -0
  462. package/dist/src/vite/highlightCode.d.ts.map +1 -0
  463. package/dist/src/vite/highlightCode.js +82 -0
  464. package/dist/src/vite/highlightCode.js.map +1 -0
  465. package/dist/src/vite/indexStoryFile.d.ts +35 -0
  466. package/dist/src/vite/indexStoryFile.d.ts.map +1 -0
  467. package/dist/src/vite/indexStoryFile.js +458 -0
  468. package/dist/src/vite/indexStoryFile.js.map +1 -0
  469. package/dist/src/vite/pages.d.ts +49 -0
  470. package/dist/src/vite/pages.d.ts.map +1 -0
  471. package/dist/src/vite/pages.js +171 -0
  472. package/dist/src/vite/pages.js.map +1 -0
  473. package/dist/src/vite/prebundled.d.ts +30 -0
  474. package/dist/src/vite/prebundled.d.ts.map +1 -0
  475. package/dist/src/vite/prebundled.js +81 -0
  476. package/dist/src/vite/prebundled.js.map +1 -0
  477. package/dist/src/vite/storyCode.d.ts +28 -0
  478. package/dist/src/vite/storyCode.d.ts.map +1 -0
  479. package/dist/src/vite/storyCode.js +80 -0
  480. package/dist/src/vite/storyCode.js.map +1 -0
  481. package/dist/src/vite/storyFilesModule.d.ts +17 -0
  482. package/dist/src/vite/storyFilesModule.d.ts.map +1 -0
  483. package/dist/src/vite/storyFilesModule.js +64 -0
  484. package/dist/src/vite/storyFilesModule.js.map +1 -0
  485. package/dist/src/vite/storyMeta.d.ts +34 -0
  486. package/dist/src/vite/storyMeta.d.ts.map +1 -0
  487. package/dist/src/vite/storyMeta.js +74 -0
  488. package/dist/src/vite/storyMeta.js.map +1 -0
  489. package/dist/src/vite/typeScriptPieces.d.ts +23 -0
  490. package/dist/src/vite/typeScriptPieces.d.ts.map +1 -0
  491. package/dist/src/vite/typeScriptPieces.js +236 -0
  492. package/dist/src/vite/typeScriptPieces.js.map +1 -0
  493. package/package.json +202 -3
@@ -0,0 +1,202 @@
1
+ /**
2
+ * A text written inside an SVG document, with the characters XML reserves escaped.
3
+ *
4
+ * @param text - the text.
5
+ */
6
+ const xmlText = (text) => text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
7
+ /**
8
+ * An SVG document as a CSS image.
9
+ *
10
+ * @param width - the picture's width, in its own units.
11
+ * @param height - the picture's height, in its own units.
12
+ * @param content - the SVG elements inside the root.
13
+ */
14
+ const svgImage = (width, height, content) => {
15
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" ` +
16
+ `viewBox="0 0 ${width} ${height}" preserveAspectRatio="xMidYMid slice">${content}</svg>`;
17
+ return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
18
+ };
19
+ /** The same look in both themes: a backdrop that does not follow the theme. */
20
+ const fixed = (look) => ({ light: look, dark: look });
21
+ /** The checkerboard: grey and white squares of 8 px, the usual sign of a transparent picture. */
22
+ const CHECKERBOARD = {
23
+ color: "#ffffff",
24
+ layers: "repeating-conic-gradient(#d6d6d6 0% 25%, #ffffff 0% 50%) 0 0 / 16px 16px"
25
+ };
26
+ /** The vivid picture's shapes, in its tile of 480 px. */
27
+ const VIVID_SHAPES = svgImage(480, 480, '<circle cx="96" cy="104" r="64" fill="#ffd60a"/>' +
28
+ '<circle cx="372" cy="336" r="88" fill="#22d3ee"/>' +
29
+ '<rect x="248" y="56" width="176" height="56" rx="28" fill="#ffffff" fill-opacity="0.85"/>' +
30
+ '<rect x="40" y="300" width="56" height="140" rx="12" fill="#34d399"/>' +
31
+ '<path d="M150 240 L330 240 L240 420 Z" fill="#ff4d8d"/>' +
32
+ '<g stroke="#111827" stroke-width="10" stroke-opacity="0.55">' +
33
+ '<line x1="300" y1="160" x2="460" y2="160"/><line x1="300" y1="190" x2="460" y2="190"/>' +
34
+ '<line x1="300" y1="220" x2="460" y2="220"/></g>');
35
+ /**
36
+ * The vivid picture: crisp circles, bars and stripes on a saturated gradient, the shapes repeated every 480 px, so a
37
+ * surface's blur shows on sharp edges wherever it sits.
38
+ */
39
+ const GRADIENT = {
40
+ color: "#7c3aed",
41
+ layers: `${VIVID_SHAPES} 0 0 / 480px 480px repeat, linear-gradient(135deg, #5b21b6 0%, #db2777 55%, #f97316 100%)`
42
+ };
43
+ /**
44
+ * Rolling hills under a sky, the shape of a desktop picture.
45
+ *
46
+ * @param colors - the sky's two colours, top and bottom, a glow's colour, and the three hills', back to front.
47
+ */
48
+ const hills = (colors) => svgImage(1600, 1000, '<defs><linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">' +
49
+ `<stop offset="0" stop-color="${colors.skyTop}"/><stop offset="1" stop-color="${colors.skyBottom}"/>` +
50
+ '</linearGradient><radialGradient id="glow" cx="0.72" cy="0.3" r="0.4">' +
51
+ `<stop offset="0" stop-color="${colors.glow}" stop-opacity="0.9"/>` +
52
+ `<stop offset="1" stop-color="${colors.glow}" stop-opacity="0"/></radialGradient></defs>` +
53
+ '<rect width="1600" height="1000" fill="url(#sky)"/>' +
54
+ '<rect width="1600" height="1000" fill="url(#glow)"/>' +
55
+ `<path d="M0 560 C260 470 520 640 820 560 S1360 430 1600 520 L1600 1000 L0 1000 Z" fill="${colors.hills[0]}"/>` +
56
+ `<path d="M0 700 C320 600 640 780 960 690 S1420 600 1600 660 L1600 1000 L0 1000 Z" fill="${colors.hills[1]}"/>` +
57
+ `<path d="M0 840 C360 760 700 900 1040 830 S1460 760 1600 800 L1600 1000 L0 1000 Z" fill="${colors.hills[2]}"/>`);
58
+ /** The light desktop: pale hills under a morning sky. */
59
+ const LIGHT_DESKTOP = {
60
+ color: "#e4ecf8",
61
+ layers: `${hills({
62
+ skyTop: "#cfe0fa",
63
+ skyBottom: "#f8e6ee",
64
+ glow: "#fff4d6",
65
+ hills: ["#b7cdf0", "#e8b9cf", "#9fc9b4"]
66
+ })} center / cover no-repeat`
67
+ };
68
+ /** The dark desktop: deep hills under a night sky with a violet glow. */
69
+ const DARK_DESKTOP = {
70
+ color: "#0d1226",
71
+ layers: `${hills({
72
+ skyTop: "#070b1a",
73
+ skyBottom: "#1d1547",
74
+ glow: "#7c3aed",
75
+ hills: ["#23306b", "#3b2a7a", "#0f3a55"]
76
+ })} center / cover no-repeat`
77
+ };
78
+ /** A paragraph of the page, one line per entry: SVG text does not wrap. */
79
+ const PARAGRAPH = [
80
+ "Start the tomatoes indoors six weeks before the last frost, then move",
81
+ "them out once the nights stay warm. Keep the herbs near the kitchen",
82
+ "door, where they are easy to reach, and the squash at the far end."
83
+ ];
84
+ /** The rows of the page: a title, a line under it, a value at the end. */
85
+ const ROWS = [
86
+ ["Seed trays", "Delivered on Tuesday", "12"],
87
+ ["Watering schedule", "Every other morning", "3 zones"],
88
+ ["Compost bins", "Turned last week", "2"],
89
+ ["Tool shed", "Needs a new hinge", "1 task"]
90
+ ];
91
+ /** The font of the page's text: the system's, the only one a picture drawn as an image can use. */
92
+ const PAGE_FONT = "system-ui, -apple-system, Segoe UI, sans-serif";
93
+ /**
94
+ * A page of content as an app shows it, in a tile of 720 × 600 px repeated: a heading, a paragraph, a coloured
95
+ * picture and a list of rows.
96
+ *
97
+ * @param palette - the theme's colours.
98
+ */
99
+ const contentPage = (palette) => {
100
+ const paragraph = PARAGRAPH.map((line, index) => `<text x="40" y="${104 + index * 24}" font-size="15" fill="${palette.text}">${xmlText(line)}</text>`).join("");
101
+ const rows = ROWS.map(([title, detail, value], index) => {
102
+ const top = 312 + index * 68;
103
+ const icon = palette.icons[index] ?? palette.secondary;
104
+ return (`<rect x="40" y="${top + 12}" width="36" height="36" rx="8" fill="${icon}"/>` +
105
+ `<text x="92" y="${top + 27}" font-size="15" font-weight="600" fill="${palette.text}">${xmlText(title)}</text>` +
106
+ `<text x="92" y="${top + 47}" font-size="13" fill="${palette.secondary}">${xmlText(detail)}</text>` +
107
+ `<text x="680" y="${top + 36}" font-size="14" text-anchor="end" fill="${palette.secondary}">` +
108
+ `${xmlText(value)}</text>` +
109
+ `<line x1="40" y1="${top + 64}" x2="680" y2="${top + 64}" stroke="${palette.divider}"/>`);
110
+ }).join("");
111
+ return {
112
+ color: palette.page,
113
+ layers: `${svgImage(720, 600, `<rect width="720" height="600" fill="${palette.page}"/>` +
114
+ `<g font-family="${PAGE_FONT}">` +
115
+ `<text x="40" y="64" font-size="26" font-weight="700" fill="${palette.text}">Spring garden plan</text>` +
116
+ paragraph +
117
+ '<defs><linearGradient id="picture" x1="0" y1="0" x2="1" y2="1">' +
118
+ '<stop offset="0" stop-color="#4f7cff"/><stop offset="0.5" stop-color="#a855f7"/>' +
119
+ '<stop offset="1" stop-color="#f97316"/></linearGradient></defs>' +
120
+ '<rect x="40" y="184" width="640" height="104" rx="12" fill="url(#picture)"/>' +
121
+ '<circle cx="600" cy="236" r="30" fill="#ffd60a"/>' +
122
+ rows +
123
+ "</g>")} 0 0 / 720px 600px repeat`
124
+ };
125
+ };
126
+ /** The page of content, in both schemes. */
127
+ const CONTENT = {
128
+ light: contentPage({
129
+ page: "#ffffff",
130
+ text: "#1f2328",
131
+ secondary: "#656d76",
132
+ divider: "#d8dee4",
133
+ icons: ["#4f7cff", "#22c55e", "#f59e0b", "#ec4899"]
134
+ }),
135
+ dark: contentPage({
136
+ page: "#16181d",
137
+ text: "#e6e8eb",
138
+ secondary: "#9aa1ab",
139
+ divider: "#2d3139",
140
+ icons: ["#6b8cff", "#34d399", "#fbbf24", "#f472b6"]
141
+ })
142
+ };
143
+ /** The backdrops Forgebook draws, in the View menu's order: every one but the page's own colour. */
144
+ export const BUILT_IN_BACKDROPS = [
145
+ { id: "checkerboard", label: "Checkerboard", drawn: fixed(CHECKERBOARD) },
146
+ { id: "gradient", label: "Vivid picture", drawn: fixed(GRADIENT) },
147
+ { id: "lightDesktop", label: "Light desktop", drawn: fixed(LIGHT_DESKTOP) },
148
+ { id: "darkDesktop", label: "Dark desktop", drawn: fixed(DARK_DESKTOP) },
149
+ { id: "content", label: "Page of content", drawn: CONTENT }
150
+ ];
151
+ /**
152
+ * A catalogue's own backdrop, drawn as the built-in ones are.
153
+ *
154
+ * @param custom - the backdrop as the configuration writes it.
155
+ */
156
+ export const customBackdrop = (custom) => {
157
+ const look = (written) => ({
158
+ color: written.color,
159
+ layers: written.layers ?? "none"
160
+ });
161
+ return {
162
+ id: custom.id,
163
+ label: custom.label,
164
+ drawn: { light: look(custom.light), dark: look(custom.dark ?? custom.light) }
165
+ };
166
+ };
167
+ /**
168
+ * The colour a backdrop is drawn on, which the box of a loading story waits on.
169
+ *
170
+ * @param backdrop - the backdrop; none for the page's own colour.
171
+ * @param isDark - whether the story is drawn in the dark scheme (a backdrop may follow it).
172
+ * @returns the CSS colour; none for the page's own colour.
173
+ */
174
+ export const backdropColor = (backdrop, isDark) => backdrop === undefined ? undefined : (isDark ? backdrop.drawn.dark : backdrop.drawn.light).color;
175
+ /** A `body` rule that draws a look over whatever background the source's sheets set. */
176
+ const bodyRule = (selector, look) => `${selector} { background: ${look.layers}, ${look.color} !important; }`;
177
+ /**
178
+ * The style sheet that draws a backdrop behind a frame's story.
179
+ *
180
+ * @remarks
181
+ * The rule sits on `body`, where the sources set their page colour, and wins over it with `!important`, so the
182
+ * story's own elements keep every colour they set. The dark look follows the scheme the view draws in (its colour
183
+ * scheme switch's, `switches.ts`), the system's preference for `system`; with forced colours the sheet draws nothing.
184
+ *
185
+ * @param backdrop - the backdrop; none for the page's own colour.
186
+ * @param scheme - the scheme the story is drawn in.
187
+ * @returns the CSS; empty for the page's own colour.
188
+ */
189
+ export const backdropSheet = (backdrop, scheme) => {
190
+ if (backdrop === undefined)
191
+ return "";
192
+ const { light, dark } = backdrop.drawn;
193
+ if (light === dark || scheme === "light")
194
+ return `@media (forced-colors: none) { ${bodyRule("body", light)} }`;
195
+ if (scheme === "dark")
196
+ return `@media (forced-colors: none) { ${bodyRule("body", dark)} }`;
197
+ return [
198
+ `@media (forced-colors: none) { ${bodyRule("body", light)} }`,
199
+ `@media (forced-colors: none) and (prefers-color-scheme: dark) { ${bodyRule("body", dark)} }`
200
+ ].join("\n");
201
+ };
202
+ //# sourceMappingURL=backdrops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backdrops.js","sourceRoot":"","sources":["../../src/backdrops.ts"],"names":[],"mappings":"AAwDA;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE,CACvC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,M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KAAK,CAAC,IAAI,CAAC;IACvE,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,kCAAkC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;IAC3F,OAAO;QACL,kCAAkC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI;QAC7D,mEAAmE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI;KAC9F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * The lists a catalogue sets besides its switches (its widths, zoom steps, text sizes, backgrounds, story groups,
3
+ * panel tabs, accessibility rules, grid step, storage name and shell texts), as its configuration writes them, and
4
+ * as the shell and the frame read them, today's defaults filled in.
5
+ *
6
+ * @remarks
7
+ * Every list is optional: a catalogue that sets none looks as Forgebook always did. 100 % stays a zoom step and a text
8
+ * size, since it is the view without change. A preset may give any list; the catalogue's own wins (`configFile.ts`).
9
+ * Pure.
10
+ *
11
+ * @module
12
+ */
13
+ import { type Backdrop, type CustomBackdrop } from "./backdrops.ts";
14
+ import type { ViewSwitch } from "./switches.ts";
15
+ /** A preset width of the toolbar. */
16
+ export type StageWidthPreset = {
17
+ /** The width, in CSS px. */
18
+ readonly width: number;
19
+ /** Its name in the toolbar; the number by default. */
20
+ readonly label?: string;
21
+ };
22
+ /** A group of stories in the sidebar, as a catalogue names it. */
23
+ export type StoryGroupSetting = {
24
+ /** The group's id, as a story's `parameters.group` writes it (`states`). */
25
+ readonly id: string;
26
+ /** Its heading in the sidebar (`States`). */
27
+ readonly label: string;
28
+ };
29
+ /** The tabs of the panel under a story. */
30
+ export declare const PANEL_TAB_IDS: readonly ["props", "events", "play", "parts", "code", "a11y"];
31
+ /** A tab of the panel under a story. */
32
+ export type PanelTabId = (typeof PANEL_TAB_IDS)[number];
33
+ /** The accessibility rules the Accessibility tab and the generated tests check. */
34
+ export type A11ySettings = {
35
+ /** The axe tags whose rules apply. */
36
+ readonly tags: readonly string[];
37
+ /** Rules turned off by id (`color-contrast`). */
38
+ readonly disabledRules: readonly string[];
39
+ };
40
+ /** The lists a configuration may set, every one optional. */
41
+ export type CatalogueLists = {
42
+ /** The catalogue's id, the prefix of what the browser stores for it; from its title by default. */
43
+ readonly id?: string;
44
+ /** The toolbar's preset widths. */
45
+ readonly widths?: readonly StageWidthPreset[];
46
+ /** The narrowest and widest a story may be set, in CSS px. */
47
+ readonly widthRange?: {
48
+ readonly min: number;
49
+ readonly max: number;
50
+ };
51
+ /** The zoom steps, in percent; 100 among them. */
52
+ readonly zooms?: readonly number[];
53
+ /** The text sizes, in percent of the browser's; 100 among them. */
54
+ readonly textSizes?: readonly number[];
55
+ /** The backgrounds: which built-in ones (`false` for none) and the catalogue's own. */
56
+ readonly backgrounds?: {
57
+ /** The built-in backgrounds offered, by id, or none; all of them by default. */
58
+ readonly builtIn?: false | readonly string[];
59
+ /** The catalogue's own, after the built-in ones. */
60
+ readonly custom?: readonly CustomBackdrop[];
61
+ };
62
+ /** The story groups, in the sidebar's order, with their headings. */
63
+ readonly storyGroups?: readonly StoryGroupSetting[];
64
+ /** The panel's tabs turned off (`{ a11y: false }`). */
65
+ readonly tabs?: Readonly<Partial<Record<PanelTabId, false>>>;
66
+ /** The accessibility rules. */
67
+ readonly a11y?: Partial<A11ySettings>;
68
+ /** The measuring grid's step, in CSS px. */
69
+ readonly gridStep?: number;
70
+ /** Texts of the shell replaced, by their name in `STRINGS` (a translation, another word). */
71
+ readonly strings?: Readonly<Record<string, string>>;
72
+ };
73
+ /** A catalogue's lists with the defaults filled in, and its switches: what the shell and the frame read. */
74
+ export type CatalogueSettings = {
75
+ /** The prefix of what the browser stores for the catalogue. */
76
+ readonly id: string;
77
+ /** The switches of the toolbar and the View menu. */
78
+ readonly switches: readonly ViewSwitch[];
79
+ /** The toolbar's preset widths. */
80
+ readonly widths: readonly StageWidthPreset[];
81
+ /** The narrowest and widest a story may be set, in CSS px. */
82
+ readonly widthRange: {
83
+ readonly min: number;
84
+ readonly max: number;
85
+ };
86
+ /** The zoom steps, in percent. */
87
+ readonly zooms: readonly number[];
88
+ /** The text sizes, in percent. */
89
+ readonly textSizes: readonly number[];
90
+ /** The backgrounds the View menu offers besides the page's own colour. */
91
+ readonly backdrops: readonly Backdrop[];
92
+ /** The named story groups, in their order. */
93
+ readonly storyGroups: readonly StoryGroupSetting[];
94
+ /** The panel's tabs shown, in their order. */
95
+ readonly tabs: readonly PanelTabId[];
96
+ /** The accessibility rules. */
97
+ readonly a11y: A11ySettings;
98
+ /** The measuring grid's step, in CSS px. */
99
+ readonly gridStep: number;
100
+ /** The shell's texts replaced, by name. */
101
+ readonly strings: Readonly<Record<string, string>>;
102
+ };
103
+ /** WCAG 2.2 at levels A and AA: the rules every story passes by default. */
104
+ export declare const DEFAULT_A11Y_TAGS: readonly string[];
105
+ /**
106
+ * A catalogue's settings, its lists' defaults filled in.
107
+ *
108
+ * @param title - the catalogue's title, for its storage's id.
109
+ * @param switches - its switches.
110
+ * @param lists - the lists its configuration sets.
111
+ */
112
+ export declare const catalogueSettings: (title: string, switches: readonly ViewSwitch[], lists?: CatalogueLists) => CatalogueSettings;
113
+ /**
114
+ * A story group's heading: the catalogue's name for it, or its id when it names none.
115
+ *
116
+ * @param groups - the catalogue's named groups.
117
+ * @param id - the group's id.
118
+ */
119
+ export declare const groupLabel: (groups: readonly StoryGroupSetting[], id: string) => string;
120
+ //# sourceMappingURL=catalogue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../src/catalogue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAsB,KAAK,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,qCAAqC;AACrC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,4BAA4B;IAC5B,QA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8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACnD,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAC;IACrC,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAA6D,CAAC;AA+B7G;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,MAAM,EACb,UAAU,SAAS,UAAU,EAAE,EAC/B,QAAO,cAAmB,KACzB,iBAwBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,SAAS,iBAAiB,EAAE,EAAE,IAAI,MAAM,KAAG,MACxB,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The lists a catalogue sets besides its switches (its widths, zoom steps, text sizes, backgrounds, story groups,
3
+ * panel tabs, accessibility rules, grid step, storage name and shell texts), as its configuration writes them, and
4
+ * as the shell and the frame read them, today's defaults filled in.
5
+ *
6
+ * @remarks
7
+ * Every list is optional: a catalogue that sets none looks as Forgebook always did. 100 % stays a zoom step and a text
8
+ * size, since it is the view without change. A preset may give any list; the catalogue's own wins (`configFile.ts`).
9
+ * Pure.
10
+ *
11
+ * @module
12
+ */
13
+ import { BUILT_IN_BACKDROPS, customBackdrop } from "./backdrops.js";
14
+ /** The tabs of the panel under a story. */
15
+ export const PANEL_TAB_IDS = ["props", "events", "play", "parts", "code", "a11y"];
16
+ /** WCAG 2.2 at levels A and AA: the rules every story passes by default. */
17
+ export const DEFAULT_A11Y_TAGS = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"];
18
+ /** The toolbar's widths by default: a phone, the stage beside the props panel (the tests' narrow variant), a tablet, a laptop. */
19
+ const DEFAULT_WIDTHS = [
20
+ { width: 360 },
21
+ { width: 560 },
22
+ { width: 768 },
23
+ { width: 1024 }
24
+ ];
25
+ /**
26
+ * An id for the browser's storage from a catalogue's title: lower case, words joined by hyphens.
27
+ *
28
+ * @param title - the title.
29
+ */
30
+ const idOf = (title) => title
31
+ .toLowerCase()
32
+ .normalize("NFKD")
33
+ .replace(/[^a-z0-9]+/g, "-")
34
+ .replace(/^-|-$/g, "") || "catalogue";
35
+ /**
36
+ * A list of percents with 100 in it, in order: the configured one when it has 100, the default otherwise.
37
+ *
38
+ * @param list - the configured list.
39
+ * @param fallback - the default.
40
+ */
41
+ const withHundred = (list, fallback) => list?.includes(100) ? [...list].sort((first, second) => first - second) : fallback;
42
+ /**
43
+ * A catalogue's settings, its lists' defaults filled in.
44
+ *
45
+ * @param title - the catalogue's title, for its storage's id.
46
+ * @param switches - its switches.
47
+ * @param lists - the lists its configuration sets.
48
+ */
49
+ export const catalogueSettings = (title, switches, lists = {}) => {
50
+ const builtIn = lists.backgrounds?.builtIn;
51
+ const offered = builtIn === false
52
+ ? []
53
+ : BUILT_IN_BACKDROPS.filter((backdrop) => builtIn === undefined || builtIn.includes(backdrop.id));
54
+ const tabsOff = lists.tabs ?? {};
55
+ return {
56
+ id: lists.id ?? idOf(title),
57
+ switches,
58
+ widths: lists.widths ?? DEFAULT_WIDTHS,
59
+ widthRange: lists.widthRange ?? { min: 240, max: 2560 },
60
+ zooms: withHundred(lists.zooms, [50, 75, 100, 125, 150, 200]),
61
+ textSizes: withHundred(lists.textSizes, [100, 125, 150]),
62
+ backdrops: [...offered, ...(lists.backgrounds?.custom ?? []).map(customBackdrop)],
63
+ storyGroups: lists.storyGroups ?? [],
64
+ tabs: PANEL_TAB_IDS.filter((tab) => tabsOff[tab] !== false),
65
+ a11y: {
66
+ tags: lists.a11y?.tags ?? DEFAULT_A11Y_TAGS,
67
+ disabledRules: lists.a11y?.disabledRules ?? []
68
+ },
69
+ gridStep: lists.gridStep ?? 8,
70
+ strings: lists.strings ?? {}
71
+ };
72
+ };
73
+ /**
74
+ * A story group's heading: the catalogue's name for it, or its id when it names none.
75
+ *
76
+ * @param groups - the catalogue's named groups.
77
+ * @param id - the group's id.
78
+ */
79
+ export const groupLabel = (groups, id) => groups.find((group) => group.id === id)?.label ?? id;
80
+ //# sourceMappingURL=catalogue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../../src/catalogue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAiB,kBAAkB,EAAuB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAmBxG,2CAA2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAwE3F,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE7G,kIAAkI;AAClI,MAAM,cAAc,GAAgC;IAClD,EAAE,KAAK,EAAE,GAAG,EAAE;IACd,EAAE,KAAK,EAAE,GAAG,EAAE;IACd,EAAE,KAAK,EAAE,GAAG,EAAE;IACd,EAAE,KAAK,EAAE,IAAI,EAAE;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,IAAI,GAAG,CAAC,KAAa,EAAU,EAAE,CACrC,KAAK;KACF,WAAW,EAAE;KACb,SAAS,CAAC,MAAM,CAAC;KACjB,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;KAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,GAAG,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KAAK,CAAC,WAAW,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACjF,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,EAAE;QACpC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;QAC3D,IAAI,EAAE;YACJ,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,IAAI,iBAAiB;YAC3C,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,aAAa,IAAI,EAAE;SAC/C;QACD,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC;QAC7B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE;KAC7B,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAoC,EAAE,EAAU,EAAU,EAAE,CACrF,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * What the catalogue knows about a story file's component, read from its types and TSDoc: the props panel's data,
3
+ * shared by the plugin that extracts it (Node) and the shell that shows it (the page).
4
+ *
5
+ * @remarks
6
+ * Every prop has a kind, decided from its type, which is the panel's group and control (D-58, D-64): a union of
7
+ * literals is a choice, `string` text, `number` a number, `boolean` a toggle, a function named `on<Something>` an
8
+ * event; anything else cannot be set from the panel. The data crosses from the plugin to the page as JSON, so the
9
+ * shell checks it on arrival (`isComponentDocs`).
10
+ *
11
+ * @module
12
+ */
13
+ /** How a prop is set from the panel, and the group it is listed in. */
14
+ export type PropKind = "choice" | "text" | "number" | "toggle" | "event" | "other";
15
+ /** One parameter of an event's signature. */
16
+ export type SignatureParameter = {
17
+ /** The parameter's name. */
18
+ readonly name: string;
19
+ /** Its type, as the source writes it. */
20
+ readonly type: string;
21
+ };
22
+ /** An event's signature: what the callback receives and returns. */
23
+ export type EventSignature = {
24
+ /** The parameters, in order. */
25
+ readonly parameters: readonly SignatureParameter[];
26
+ /** The return type, as the source writes it. */
27
+ readonly returns: string;
28
+ };
29
+ /** One prop of a component. */
30
+ export type PropDocs = {
31
+ /** The prop's name. */
32
+ readonly name: string;
33
+ /** How it is set, and its group. */
34
+ readonly kind: PropKind;
35
+ /**
36
+ * Its type as the source writes it (`ReactNode`, `Ref<HTMLElement>`), without `undefined`, `null` and the `never` of
37
+ * a branch that forbids it; a choice's values in the order the source writes them. The checker's own text orders a
38
+ * union by the types it happened to meet first, so it changed between reads of a program kept in memory.
39
+ */
40
+ readonly type: string;
41
+ /** The first paragraph of its TSDoc; empty when it has none. */
42
+ readonly description: string;
43
+ /** Its `@defaultValue`, when the TSDoc gives one. */
44
+ readonly defaultValue?: string;
45
+ /** Whether the prop must be passed. */
46
+ readonly isRequired: boolean;
47
+ /** For a choice, its values in the order of the type. */
48
+ readonly choices?: readonly (string | number)[];
49
+ /** For an event, its signature. */
50
+ readonly signature?: EventSignature;
51
+ /**
52
+ * For a prop of kind `other` (a node, a union), whether a plain text can be passed: the panel then offers a text
53
+ * field for it. Left out when `false`.
54
+ */
55
+ readonly canTakeText?: boolean;
56
+ };
57
+ /** A part the component is used with, named in the meta's `subcomponents`: listed under it on its page. */
58
+ export type SubcomponentDocs = {
59
+ /** The name the meta gives it: its key in `subcomponents`. */
60
+ readonly name: string;
61
+ /** The first paragraph of its TSDoc. */
62
+ readonly description: string;
63
+ /** Its props declared in the package, in the same order as the component's. */
64
+ readonly props: readonly PropDocs[];
65
+ };
66
+ /** A story file's component. */
67
+ export type ComponentDocs = {
68
+ /** The component's name. */
69
+ readonly name: string;
70
+ /** The first paragraph of its TSDoc. */
71
+ readonly description: string;
72
+ /**
73
+ * The first paragraph of its file's `@module` comment: what it is and does, the component page's lead. Empty when
74
+ * the file has none.
75
+ */
76
+ readonly summary: string;
77
+ /**
78
+ * Its props declared in the package (the HTML attributes it passes on are left out), in declaration order: those of
79
+ * the component's own folder first, then the ones it takes from elsewhere, each by file and position.
80
+ */
81
+ readonly props: readonly PropDocs[];
82
+ /** Its parts: the keys of its `classNames`, `styles` and `refs` maps. */
83
+ readonly parts: readonly string[];
84
+ /** The parts the meta names in `subcomponents`, in the order it writes them; empty when it names none. */
85
+ readonly subcomponents: readonly SubcomponentDocs[];
86
+ };
87
+ /** What the plugin answers for a story file whose meta names no component (a foundations page). */
88
+ export type NoComponentDocs = {
89
+ /** No component. */
90
+ readonly name: null;
91
+ };
92
+ /**
93
+ * Whether a value received from the plugin is a component's docs.
94
+ *
95
+ * @param value - the module's default export.
96
+ */
97
+ export declare const isComponentDocs: (value: unknown) => value is ComponentDocs;
98
+ //# sourceMappingURL=componentDocs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentDocs.d.ts","sourceRoot":"","sources":["../../src/componentDocs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,uEAAuE;AACvE,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnF,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,+BAA+B;AAC/B,MAAM,MAAM,QAAQ,GAAG;IACrB,uBAAuB;IACvB,QAAQ,C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BAAgB,EAAE,CAAC;CACrD,CAAC;AAEF,mGAAmG;AACnG,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,CAAC;AA+BF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,aASR,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * What the catalogue knows about a story file's component, read from its types and TSDoc: the props panel's data,
3
+ * shared by the plugin that extracts it (Node) and the shell that shows it (the page).
4
+ *
5
+ * @remarks
6
+ * Every prop has a kind, decided from its type, which is the panel's group and control (D-58, D-64): a union of
7
+ * literals is a choice, `string` text, `number` a number, `boolean` a toggle, a function named `on<Something>` an
8
+ * event; anything else cannot be set from the panel. The data crosses from the plugin to the page as JSON, so the
9
+ * shell checks it on arrival (`isComponentDocs`).
10
+ *
11
+ * @module
12
+ */
13
+ /** Whether a value is a plain object. */
14
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
15
+ /** Whether a value is a list of strings. */
16
+ const isStringList = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
17
+ /** The prop kinds, for the check. */
18
+ const PROP_KINDS = ["choice", "text", "number", "toggle", "event", "other"];
19
+ /** Whether a value is one prop's docs. */
20
+ const isPropDocs = (value) => isRecord(value) &&
21
+ typeof value["name"] === "string" &&
22
+ PROP_KINDS.some((kind) => kind === value["kind"]) &&
23
+ typeof value["type"] === "string" &&
24
+ typeof value["description"] === "string" &&
25
+ typeof value["isRequired"] === "boolean" &&
26
+ (value["canTakeText"] === undefined || typeof value["canTakeText"] === "boolean");
27
+ /** Whether a value is a subcomponent's docs. */
28
+ const isSubcomponentDocs = (value) => isRecord(value) &&
29
+ typeof value["name"] === "string" &&
30
+ typeof value["description"] === "string" &&
31
+ Array.isArray(value["props"]) &&
32
+ value["props"].every(isPropDocs);
33
+ /**
34
+ * Whether a value received from the plugin is a component's docs.
35
+ *
36
+ * @param value - the module's default export.
37
+ */
38
+ export const isComponentDocs = (value) => isRecord(value) &&
39
+ typeof value["name"] === "string" &&
40
+ typeof value["description"] === "string" &&
41
+ typeof value["summary"] === "string" &&
42
+ Array.isArray(value["props"]) &&
43
+ value["props"].every(isPropDocs) &&
44
+ isStringList(value["parts"]) &&
45
+ Array.isArray(value["subcomponents"]) &&
46
+ value["subcomponents"].every(isSubcomponentDocs);
47
+ //# sourceMappingURL=componentDocs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentDocs.js","sourceRoot":"","sources":["../../src/componentDocs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwFH,yCAAyC;AACzC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAA8C,EAAE,CAC9E,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,4CAA4C;AAC5C,MAAM,YAAY,GAAG,CAAC,KAAc,EAA8B,EAAE,CAClE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;AAE1E,qCAAqC;AACrC,MAAM,UAAU,GAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEjG,0CAA0C;AAC1C,MAAM,UAAU,GAAG,CAAC,KAAc,EAAqB,EAAE,CACvD,QAAQ,CAAC,KAAK,CAAC;IACf,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ;IACjC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ;IACjC,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,QAAQ;IACxC,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,SAAS;IACxC,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,SAAS,CAAC,CAAC;AAEpF,gDAAgD;AAChD,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA6B,EAAE,CACvE,QAAQ,CAAC,KAAK,CAAC;IACf,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ;IACjC,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,QAAQ;IACxC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAA0B,EAAE,CACxE,QAAQ,CAAC,KAAK,CAAC;IACf,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ;IACjC,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,QAAQ;IACxC,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,QAAQ;IACpC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;IAChC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACrC,KAAK,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The Accessibility card's check, run in a story's frame: axe on the whole document (a story may put a menu or a
3
+ * dialog on `body`), with the rules the generated tests use.
4
+ *
5
+ * @remarks
6
+ * axe is loaded only when the card asks: a frame that is never checked never downloads it.
7
+ *
8
+ * @module
9
+ */
10
+ import type { Violation } from "../a11y.ts";
11
+ import type { A11ySettings } from "../catalogue.ts";
12
+ /**
13
+ * The rules the document breaks now.
14
+ *
15
+ * @param document - the frame's document.
16
+ * @param rules - the catalogue's accessibility rules: its tags and the rules it turns off.
17
+ * @returns each broken rule with the elements that break it.
18
+ */
19
+ export declare const checkStory: (document: Document, rules: A11ySettings) => Promise<Violation[]>;
20
+ //# sourceMappingURL=checkStory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkStory.d.ts","sourceRoot":"","sources":["../../../src/frame/checkStory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAU,UAAU,QAAQ,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,SAAS,EAAE,CAa7F,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The Accessibility card's check, run in a story's frame: axe on the whole document (a story may put a menu or a
3
+ * dialog on `body`), with the rules the generated tests use.
4
+ *
5
+ * @remarks
6
+ * axe is loaded only when the card asks: a frame that is never checked never downloads it.
7
+ *
8
+ * @module
9
+ */
10
+ /**
11
+ * The rules the document breaks now.
12
+ *
13
+ * @param document - the frame's document.
14
+ * @param rules - the catalogue's accessibility rules: its tags and the rules it turns off.
15
+ * @returns each broken rule with the elements that break it.
16
+ */
17
+ export const checkStory = async (document, rules) => {
18
+ const { default: axe } = await import("axe-core");
19
+ const results = await axe.run(document, {
20
+ runOnly: { type: "tag", values: [...rules.tags] },
21
+ rules: Object.fromEntries(rules.disabledRules.map((rule) => [rule, { enabled: false }]))
22
+ });
23
+ return results.violations.map((violation) => ({
24
+ id: violation.id,
25
+ help: violation.help,
26
+ impact: violation.impact ?? undefined,
27
+ helpUrl: violation.helpUrl,
28
+ targets: violation.nodes.map((node) => node.target.map(String).join(" "))
29
+ }));
30
+ };
31
+ //# sourceMappingURL=checkStory.js.map