forgebook 0.0.0-stage → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -2
  3. package/dist/bin/forgebook/catalogueVite.d.ts +16 -0
  4. package/dist/bin/forgebook/catalogueVite.d.ts.map +1 -0
  5. package/dist/bin/forgebook/catalogueVite.js +15 -0
  6. package/dist/bin/forgebook/catalogueVite.js.map +1 -0
  7. package/dist/bin/forgebook/forgebook.d.mts +3 -0
  8. package/dist/bin/forgebook/forgebook.d.mts.map +1 -0
  9. package/dist/bin/forgebook/forgebook.mjs +93 -0
  10. package/dist/bin/forgebook/forgebook.mjs.map +1 -0
  11. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts +90 -0
  12. package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts.map +1 -0
  13. package/dist/bin/forgebook-docs/catalogueDocs.types.js +1 -0
  14. package/dist/bin/forgebook-docs/catalogueDocs.types.js.map +1 -0
  15. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts +9 -0
  16. package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts.map +1 -0
  17. package/dist/bin/forgebook-docs/catalogueMarkdown.js +132 -0
  18. package/dist/bin/forgebook-docs/catalogueMarkdown.js.map +1 -0
  19. package/dist/bin/forgebook-docs/collectDocs.d.ts +17 -0
  20. package/dist/bin/forgebook-docs/collectDocs.d.ts.map +1 -0
  21. package/dist/bin/forgebook-docs/collectDocs.js +115 -0
  22. package/dist/bin/forgebook-docs/collectDocs.js.map +1 -0
  23. package/dist/bin/forgebook-docs/forgebook-docs.d.mts +3 -0
  24. package/dist/bin/forgebook-docs/forgebook-docs.d.mts.map +1 -0
  25. package/dist/bin/forgebook-docs/forgebook-docs.mjs +114 -0
  26. package/dist/bin/forgebook-docs/forgebook-docs.mjs.map +1 -0
  27. package/dist/bin/forgebook-docs/moduleDocs.d.ts +9 -0
  28. package/dist/bin/forgebook-docs/moduleDocs.d.ts.map +1 -0
  29. package/dist/bin/forgebook-docs/moduleDocs.js +62 -0
  30. package/dist/bin/forgebook-docs/moduleDocs.js.map +1 -0
  31. package/dist/bin/forgebook-docs/sassDocs.d.ts +20 -0
  32. package/dist/bin/forgebook-docs/sassDocs.d.ts.map +1 -0
  33. package/dist/bin/forgebook-docs/sassDocs.js +77 -0
  34. package/dist/bin/forgebook-docs/sassDocs.js.map +1 -0
  35. package/dist/bin/forgebook-texts/forgebook-texts.d.mts +3 -0
  36. package/dist/bin/forgebook-texts/forgebook-texts.d.mts.map +1 -0
  37. package/dist/bin/forgebook-texts/forgebook-texts.mjs +94 -0
  38. package/dist/bin/forgebook-texts/forgebook-texts.mjs.map +1 -0
  39. package/dist/bin/forgebook-texts/storyTextsReport.d.ts +26 -0
  40. package/dist/bin/forgebook-texts/storyTextsReport.d.ts.map +1 -0
  41. package/dist/bin/forgebook-texts/storyTextsReport.js +35 -0
  42. package/dist/bin/forgebook-texts/storyTextsReport.js.map +1 -0
  43. package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts +25 -0
  44. package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts.map +1 -0
  45. package/dist/bin/forgebook-texts/storyTextsReport.types.js +7 -0
  46. package/dist/bin/forgebook-texts/storyTextsReport.types.js.map +1 -0
  47. package/dist/src/a11y.d.ts +28 -0
  48. package/dist/src/a11y.d.ts.map +1 -0
  49. package/dist/src/a11y.js +29 -0
  50. package/dist/src/a11y.js.map +1 -0
  51. package/dist/src/argTypes.d.ts +114 -0
  52. package/dist/src/argTypes.d.ts.map +1 -0
  53. package/dist/src/argTypes.js +254 -0
  54. package/dist/src/argTypes.js.map +1 -0
  55. package/dist/src/backdrops.d.ts +88 -0
  56. package/dist/src/backdrops.d.ts.map +1 -0
  57. package/dist/src/backdrops.js +202 -0
  58. package/dist/src/backdrops.js.map +1 -0
  59. package/dist/src/catalogue.d.ts +120 -0
  60. package/dist/src/catalogue.d.ts.map +1 -0
  61. package/dist/src/catalogue.js +80 -0
  62. package/dist/src/catalogue.js.map +1 -0
  63. package/dist/src/componentDocs.d.ts +98 -0
  64. package/dist/src/componentDocs.d.ts.map +1 -0
  65. package/dist/src/componentDocs.js +47 -0
  66. package/dist/src/componentDocs.js.map +1 -0
  67. package/dist/src/frame/checkStory.d.ts +20 -0
  68. package/dist/src/frame/checkStory.d.ts.map +1 -0
  69. package/dist/src/frame/checkStory.js +31 -0
  70. package/dist/src/frame/checkStory.js.map +1 -0
  71. package/dist/src/frame/frame.css +51 -0
  72. package/dist/src/frame/frameClock.d.ts +53 -0
  73. package/dist/src/frame/frameClock.d.ts.map +1 -0
  74. package/dist/src/frame/frameClock.js +80 -0
  75. package/dist/src/frame/frameClock.js.map +1 -0
  76. package/dist/src/frame/frameStatus.d.ts +8 -0
  77. package/dist/src/frame/frameStatus.d.ts.map +1 -0
  78. package/dist/src/frame/frameStatus.js +8 -0
  79. package/dist/src/frame/frameStatus.js.map +1 -0
  80. package/dist/src/frame/frameView.d.ts +33 -0
  81. package/dist/src/frame/frameView.d.ts.map +1 -0
  82. package/dist/src/frame/frameView.js +134 -0
  83. package/dist/src/frame/frameView.js.map +1 -0
  84. package/dist/src/frame/matrixLayout.d.ts +36 -0
  85. package/dist/src/frame/matrixLayout.d.ts.map +1 -0
  86. package/dist/src/frame/matrixLayout.js +87 -0
  87. package/dist/src/frame/matrixLayout.js.map +1 -0
  88. package/dist/src/frame/measureTools.d.ts +24 -0
  89. package/dist/src/frame/measureTools.d.ts.map +1 -0
  90. package/dist/src/frame/measureTools.js +141 -0
  91. package/dist/src/frame/measureTools.js.map +1 -0
  92. package/dist/src/frame/mountFrame.d.ts +47 -0
  93. package/dist/src/frame/mountFrame.d.ts.map +1 -0
  94. package/dist/src/frame/mountFrame.js +229 -0
  95. package/dist/src/frame/mountFrame.js.map +1 -0
  96. package/dist/src/frame/playStory.d.ts +40 -0
  97. package/dist/src/frame/playStory.d.ts.map +1 -0
  98. package/dist/src/frame/playStory.js +55 -0
  99. package/dist/src/frame/playStory.js.map +1 -0
  100. package/dist/src/frame/renderer.d.ts +85 -0
  101. package/dist/src/frame/renderer.d.ts.map +1 -0
  102. package/dist/src/frame/renderer.js +18 -0
  103. package/dist/src/frame/renderer.js.map +1 -0
  104. package/dist/src/frame/settle.d.ts +24 -0
  105. package/dist/src/frame/settle.d.ts.map +1 -0
  106. package/dist/src/frame/settle.js +25 -0
  107. package/dist/src/frame/settle.js.map +1 -0
  108. package/dist/src/frame/staleModule.d.ts +40 -0
  109. package/dist/src/frame/staleModule.d.ts.map +1 -0
  110. package/dist/src/frame/staleModule.js +74 -0
  111. package/dist/src/frame/staleModule.js.map +1 -0
  112. package/dist/src/frame/storyCanvas.d.ts +21 -0
  113. package/dist/src/frame/storyCanvas.d.ts.map +1 -0
  114. package/dist/src/frame/storyCanvas.js +30 -0
  115. package/dist/src/frame/storyCanvas.js.map +1 -0
  116. package/dist/src/frame/storyHooks.d.ts +31 -0
  117. package/dist/src/frame/storyHooks.d.ts.map +1 -0
  118. package/dist/src/frame/storyHooks.js +59 -0
  119. package/dist/src/frame/storyHooks.js.map +1 -0
  120. package/dist/src/frame/storyModule.d.ts +104 -0
  121. package/dist/src/frame/storyModule.d.ts.map +1 -0
  122. package/dist/src/frame/storyModule.js +205 -0
  123. package/dist/src/frame/storyModule.js.map +1 -0
  124. package/dist/src/frame/storyRun.d.ts +96 -0
  125. package/dist/src/frame/storyRun.d.ts.map +1 -0
  126. package/dist/src/frame/storyRun.js +318 -0
  127. package/dist/src/frame/storyRun.js.map +1 -0
  128. package/dist/src/languages.d.ts +15 -0
  129. package/dist/src/languages.d.ts.map +1 -0
  130. package/dist/src/languages.js +8 -0
  131. package/dist/src/languages.js.map +1 -0
  132. package/dist/src/matrix.d.ts +56 -0
  133. package/dist/src/matrix.d.ts.map +1 -0
  134. package/dist/src/matrix.js +61 -0
  135. package/dist/src/matrix.js.map +1 -0
  136. package/dist/src/messages.d.ts +203 -0
  137. package/dist/src/messages.d.ts.map +1 -0
  138. package/dist/src/messages.js +193 -0
  139. package/dist/src/messages.js.map +1 -0
  140. package/dist/src/namedValues.d.ts +38 -0
  141. package/dist/src/namedValues.d.ts.map +1 -0
  142. package/dist/src/namedValues.js +48 -0
  143. package/dist/src/namedValues.js.map +1 -0
  144. package/dist/src/pageConfig.d.ts +23 -0
  145. package/dist/src/pageConfig.d.ts.map +1 -0
  146. package/dist/src/pageConfig.js +1 -0
  147. package/dist/src/pageConfig.js.map +1 -0
  148. package/dist/src/playTrace.d.ts +41 -0
  149. package/dist/src/playTrace.d.ts.map +1 -0
  150. package/dist/src/playTrace.js +35 -0
  151. package/dist/src/playTrace.js.map +1 -0
  152. package/dist/src/shell/A11yTab.d.ts +44 -0
  153. package/dist/src/shell/A11yTab.d.ts.map +1 -0
  154. package/dist/src/shell/A11yTab.js +30 -0
  155. package/dist/src/shell/A11yTab.js.map +1 -0
  156. package/dist/src/shell/ApiReference.d.ts +18 -0
  157. package/dist/src/shell/ApiReference.d.ts.map +1 -0
  158. package/dist/src/shell/ApiReference.js +41 -0
  159. package/dist/src/shell/ApiReference.js.map +1 -0
  160. package/dist/src/shell/ClockControls.d.ts +43 -0
  161. package/dist/src/shell/ClockControls.d.ts.map +1 -0
  162. package/dist/src/shell/ClockControls.js +53 -0
  163. package/dist/src/shell/ClockControls.js.map +1 -0
  164. package/dist/src/shell/Code.d.ts +16 -0
  165. package/dist/src/shell/Code.d.ts.map +1 -0
  166. package/dist/src/shell/Code.js +9 -0
  167. package/dist/src/shell/Code.js.map +1 -0
  168. package/dist/src/shell/CodeTab.d.ts +17 -0
  169. package/dist/src/shell/CodeTab.d.ts.map +1 -0
  170. package/dist/src/shell/CodeTab.js +17 -0
  171. package/dist/src/shell/CodeTab.js.map +1 -0
  172. package/dist/src/shell/CodeText.d.ts +16 -0
  173. package/dist/src/shell/CodeText.d.ts.map +1 -0
  174. package/dist/src/shell/CodeText.js +10 -0
  175. package/dist/src/shell/CodeText.js.map +1 -0
  176. package/dist/src/shell/ComponentPage.d.ts +38 -0
  177. package/dist/src/shell/ComponentPage.d.ts.map +1 -0
  178. package/dist/src/shell/ComponentPage.js +146 -0
  179. package/dist/src/shell/ComponentPage.js.map +1 -0
  180. package/dist/src/shell/Dock.d.ts +42 -0
  181. package/dist/src/shell/Dock.d.ts.map +1 -0
  182. package/dist/src/shell/Dock.js +90 -0
  183. package/dist/src/shell/Dock.js.map +1 -0
  184. package/dist/src/shell/EventsTab.d.ts +25 -0
  185. package/dist/src/shell/EventsTab.d.ts.map +1 -0
  186. package/dist/src/shell/EventsTab.js +26 -0
  187. package/dist/src/shell/EventsTab.js.map +1 -0
  188. package/dist/src/shell/FrameView.d.ts +49 -0
  189. package/dist/src/shell/FrameView.d.ts.map +1 -0
  190. package/dist/src/shell/FrameView.js +29 -0
  191. package/dist/src/shell/FrameView.js.map +1 -0
  192. package/dist/src/shell/HomePage.d.ts +39 -0
  193. package/dist/src/shell/HomePage.d.ts.map +1 -0
  194. package/dist/src/shell/HomePage.js +85 -0
  195. package/dist/src/shell/HomePage.js.map +1 -0
  196. package/dist/src/shell/InteractionsTab.d.ts +28 -0
  197. package/dist/src/shell/InteractionsTab.d.ts.map +1 -0
  198. package/dist/src/shell/InteractionsTab.js +17 -0
  199. package/dist/src/shell/InteractionsTab.js.map +1 -0
  200. package/dist/src/shell/MatrixPicker.d.ts +24 -0
  201. package/dist/src/shell/MatrixPicker.d.ts.map +1 -0
  202. package/dist/src/shell/MatrixPicker.js +29 -0
  203. package/dist/src/shell/MatrixPicker.js.map +1 -0
  204. package/dist/src/shell/PackageHtml.d.ts +17 -0
  205. package/dist/src/shell/PackageHtml.d.ts.map +1 -0
  206. package/dist/src/shell/PackageHtml.js +13 -0
  207. package/dist/src/shell/PackageHtml.js.map +1 -0
  208. package/dist/src/shell/PartsTab.d.ts +23 -0
  209. package/dist/src/shell/PartsTab.d.ts.map +1 -0
  210. package/dist/src/shell/PartsTab.js +23 -0
  211. package/dist/src/shell/PartsTab.js.map +1 -0
  212. package/dist/src/shell/PropFields.d.ts +31 -0
  213. package/dist/src/shell/PropFields.d.ts.map +1 -0
  214. package/dist/src/shell/PropFields.js +81 -0
  215. package/dist/src/shell/PropFields.js.map +1 -0
  216. package/dist/src/shell/PropsTab.d.ts +45 -0
  217. package/dist/src/shell/PropsTab.d.ts.map +1 -0
  218. package/dist/src/shell/PropsTab.js +81 -0
  219. package/dist/src/shell/PropsTab.js.map +1 -0
  220. package/dist/src/shell/SchemeSwitches.d.ts +24 -0
  221. package/dist/src/shell/SchemeSwitches.d.ts.map +1 -0
  222. package/dist/src/shell/SchemeSwitches.js +36 -0
  223. package/dist/src/shell/SchemeSwitches.js.map +1 -0
  224. package/dist/src/shell/Segmented.d.ts +41 -0
  225. package/dist/src/shell/Segmented.d.ts.map +1 -0
  226. package/dist/src/shell/Segmented.js +19 -0
  227. package/dist/src/shell/Segmented.js.map +1 -0
  228. package/dist/src/shell/Shell.d.ts +49 -0
  229. package/dist/src/shell/Shell.d.ts.map +1 -0
  230. package/dist/src/shell/Shell.js +279 -0
  231. package/dist/src/shell/Shell.js.map +1 -0
  232. package/dist/src/shell/Sidebar.d.ts +52 -0
  233. package/dist/src/shell/Sidebar.d.ts.map +1 -0
  234. package/dist/src/shell/Sidebar.js +132 -0
  235. package/dist/src/shell/Sidebar.js.map +1 -0
  236. package/dist/src/shell/SidebarHandle.d.ts +29 -0
  237. package/dist/src/shell/SidebarHandle.d.ts.map +1 -0
  238. package/dist/src/shell/SidebarHandle.js +46 -0
  239. package/dist/src/shell/SidebarHandle.js.map +1 -0
  240. package/dist/src/shell/Stage.d.ts +68 -0
  241. package/dist/src/shell/Stage.d.ts.map +1 -0
  242. package/dist/src/shell/Stage.js +218 -0
  243. package/dist/src/shell/Stage.js.map +1 -0
  244. package/dist/src/shell/StageTools.d.ts +27 -0
  245. package/dist/src/shell/StageTools.d.ts.map +1 -0
  246. package/dist/src/shell/StageTools.js +34 -0
  247. package/dist/src/shell/StageTools.js.map +1 -0
  248. package/dist/src/shell/StageViewport.d.ts +46 -0
  249. package/dist/src/shell/StageViewport.d.ts.map +1 -0
  250. package/dist/src/shell/StageViewport.js +173 -0
  251. package/dist/src/shell/StageViewport.js.map +1 -0
  252. package/dist/src/shell/StoryCodeBlock.d.ts +35 -0
  253. package/dist/src/shell/StoryCodeBlock.d.ts.map +1 -0
  254. package/dist/src/shell/StoryCodeBlock.js +27 -0
  255. package/dist/src/shell/StoryCodeBlock.js.map +1 -0
  256. package/dist/src/shell/StoryPicker.d.ts +26 -0
  257. package/dist/src/shell/StoryPicker.d.ts.map +1 -0
  258. package/dist/src/shell/StoryPicker.js +32 -0
  259. package/dist/src/shell/StoryPicker.js.map +1 -0
  260. package/dist/src/shell/Toolbar.d.ts +40 -0
  261. package/dist/src/shell/Toolbar.d.ts.map +1 -0
  262. package/dist/src/shell/Toolbar.js +125 -0
  263. package/dist/src/shell/Toolbar.js.map +1 -0
  264. package/dist/src/shell/WidthField.d.ts +24 -0
  265. package/dist/src/shell/WidthField.d.ts.map +1 -0
  266. package/dist/src/shell/WidthField.js +40 -0
  267. package/dist/src/shell/WidthField.js.map +1 -0
  268. package/dist/src/shell/catalogueContext.d.ts +6 -0
  269. package/dist/src/shell/catalogueContext.d.ts.map +1 -0
  270. package/dist/src/shell/catalogueContext.js +14 -0
  271. package/dist/src/shell/catalogueContext.js.map +1 -0
  272. package/dist/src/shell/codeTokens.d.ts +23 -0
  273. package/dist/src/shell/codeTokens.d.ts.map +1 -0
  274. package/dist/src/shell/codeTokens.js +48 -0
  275. package/dist/src/shell/codeTokens.js.map +1 -0
  276. package/dist/src/shell/codeWriter.d.ts +6 -0
  277. package/dist/src/shell/codeWriter.d.ts.map +1 -0
  278. package/dist/src/shell/codeWriter.js +14 -0
  279. package/dist/src/shell/codeWriter.js.map +1 -0
  280. package/dist/src/shell/compareVariants.d.ts +35 -0
  281. package/dist/src/shell/compareVariants.d.ts.map +1 -0
  282. package/dist/src/shell/compareVariants.js +68 -0
  283. package/dist/src/shell/compareVariants.js.map +1 -0
  284. package/dist/src/shell/dockTabs.d.ts +63 -0
  285. package/dist/src/shell/dockTabs.d.ts.map +1 -0
  286. package/dist/src/shell/dockTabs.js +140 -0
  287. package/dist/src/shell/dockTabs.js.map +1 -0
  288. package/dist/src/shell/icons.d.ts +47 -0
  289. package/dist/src/shell/icons.d.ts.map +1 -0
  290. package/dist/src/shell/icons.js +36 -0
  291. package/dist/src/shell/icons.js.map +1 -0
  292. package/dist/src/shell/keyboard.d.ts +35 -0
  293. package/dist/src/shell/keyboard.d.ts.map +1 -0
  294. package/dist/src/shell/keyboard.js +51 -0
  295. package/dist/src/shell/keyboard.js.map +1 -0
  296. package/dist/src/shell/mountShell.d.ts +22 -0
  297. package/dist/src/shell/mountShell.d.ts.map +1 -0
  298. package/dist/src/shell/mountShell.js +39 -0
  299. package/dist/src/shell/mountShell.js.map +1 -0
  300. package/dist/src/shell/shell.css +1831 -0
  301. package/dist/src/shell/strings.d.ts +184 -0
  302. package/dist/src/shell/strings.d.ts.map +1 -0
  303. package/dist/src/shell/strings.js +188 -0
  304. package/dist/src/shell/strings.js.map +1 -0
  305. package/dist/src/shell/switchView.d.ts +23 -0
  306. package/dist/src/shell/switchView.d.ts.map +1 -0
  307. package/dist/src/shell/switchView.js +19 -0
  308. package/dist/src/shell/switchView.js.map +1 -0
  309. package/dist/src/shell/treeSearch.d.ts +35 -0
  310. package/dist/src/shell/treeSearch.d.ts.map +1 -0
  311. package/dist/src/shell/treeSearch.js +60 -0
  312. package/dist/src/shell/treeSearch.js.map +1 -0
  313. package/dist/src/shell/useComponentDocs.d.ts +16 -0
  314. package/dist/src/shell/useComponentDocs.d.ts.map +1 -0
  315. package/dist/src/shell/useComponentDocs.js +25 -0
  316. package/dist/src/shell/useComponentDocs.js.map +1 -0
  317. package/dist/src/shell/useCopy.d.ts +10 -0
  318. package/dist/src/shell/useCopy.d.ts.map +1 -0
  319. package/dist/src/shell/useCopy.js +23 -0
  320. package/dist/src/shell/useCopy.js.map +1 -0
  321. package/dist/src/shell/useFrameMessages.d.ts +54 -0
  322. package/dist/src/shell/useFrameMessages.d.ts.map +1 -0
  323. package/dist/src/shell/useFrameMessages.js +90 -0
  324. package/dist/src/shell/useFrameMessages.js.map +1 -0
  325. package/dist/src/shell/useFrameQueue.d.ts +29 -0
  326. package/dist/src/shell/useFrameQueue.d.ts.map +1 -0
  327. package/dist/src/shell/useFrameQueue.js +72 -0
  328. package/dist/src/shell/useFrameQueue.js.map +1 -0
  329. package/dist/src/shell/useLiveView.d.ts +29 -0
  330. package/dist/src/shell/useLiveView.d.ts.map +1 -0
  331. package/dist/src/shell/useLiveView.js +51 -0
  332. package/dist/src/shell/useLiveView.js.map +1 -0
  333. package/dist/src/shell/useLoaded.d.ts +20 -0
  334. package/dist/src/shell/useLoaded.d.ts.map +1 -0
  335. package/dist/src/shell/useLoaded.js +40 -0
  336. package/dist/src/shell/useLoaded.js.map +1 -0
  337. package/dist/src/shell/usePageDoc.d.ts +20 -0
  338. package/dist/src/shell/usePageDoc.d.ts.map +1 -0
  339. package/dist/src/shell/usePageDoc.js +21 -0
  340. package/dist/src/shell/usePageDoc.js.map +1 -0
  341. package/dist/src/shell/usePopover.d.ts +23 -0
  342. package/dist/src/shell/usePopover.d.ts.map +1 -0
  343. package/dist/src/shell/usePopover.js +39 -0
  344. package/dist/src/shell/usePopover.js.map +1 -0
  345. package/dist/src/shell/useRecentPages.d.ts +21 -0
  346. package/dist/src/shell/useRecentPages.d.ts.map +1 -0
  347. package/dist/src/shell/useRecentPages.js +62 -0
  348. package/dist/src/shell/useRecentPages.js.map +1 -0
  349. package/dist/src/shell/useScrollMemory.d.ts +40 -0
  350. package/dist/src/shell/useScrollMemory.d.ts.map +1 -0
  351. package/dist/src/shell/useScrollMemory.js +69 -0
  352. package/dist/src/shell/useScrollMemory.js.map +1 -0
  353. package/dist/src/shell/useSidebarLayout.d.ts +14 -0
  354. package/dist/src/shell/useSidebarLayout.d.ts.map +1 -0
  355. package/dist/src/shell/useSidebarLayout.js +19 -0
  356. package/dist/src/shell/useSidebarLayout.js.map +1 -0
  357. package/dist/src/shell/useStored.d.ts +11 -0
  358. package/dist/src/shell/useStored.d.ts.map +1 -0
  359. package/dist/src/shell/useStored.js +68 -0
  360. package/dist/src/shell/useStored.js.map +1 -0
  361. package/dist/src/shell/useStoryCode.d.ts +14 -0
  362. package/dist/src/shell/useStoryCode.d.ts.map +1 -0
  363. package/dist/src/shell/useStoryCode.js +29 -0
  364. package/dist/src/shell/useStoryCode.js.map +1 -0
  365. package/dist/src/shell/useStoryHeights.d.ts +9 -0
  366. package/dist/src/shell/useStoryHeights.d.ts.map +1 -0
  367. package/dist/src/shell/useStoryHeights.js +31 -0
  368. package/dist/src/shell/useStoryHeights.js.map +1 -0
  369. package/dist/src/shell/useStoryIdsElement.d.ts +7 -0
  370. package/dist/src/shell/useStoryIdsElement.d.ts.map +1 -0
  371. package/dist/src/shell/useStoryIdsElement.js +29 -0
  372. package/dist/src/shell/useStoryIdsElement.js.map +1 -0
  373. package/dist/src/shell/useStoryKeys.d.ts +11 -0
  374. package/dist/src/shell/useStoryKeys.d.ts.map +1 -0
  375. package/dist/src/shell/useStoryKeys.js +40 -0
  376. package/dist/src/shell/useStoryKeys.js.map +1 -0
  377. package/dist/src/shell/useSystemDark.d.ts +3 -0
  378. package/dist/src/shell/useSystemDark.d.ts.map +1 -0
  379. package/dist/src/shell/useSystemDark.js +19 -0
  380. package/dist/src/shell/useSystemDark.js.map +1 -0
  381. package/dist/src/sourceFiles.d.ts +18 -0
  382. package/dist/src/sourceFiles.d.ts.map +1 -0
  383. package/dist/src/sourceFiles.js +22 -0
  384. package/dist/src/sourceFiles.js.map +1 -0
  385. package/dist/src/storyBackground.d.ts +21 -0
  386. package/dist/src/storyBackground.d.ts.map +1 -0
  387. package/dist/src/storyBackground.js +27 -0
  388. package/dist/src/storyBackground.js.map +1 -0
  389. package/dist/src/storyClock.d.ts +62 -0
  390. package/dist/src/storyClock.d.ts.map +1 -0
  391. package/dist/src/storyClock.js +51 -0
  392. package/dist/src/storyClock.js.map +1 -0
  393. package/dist/src/storyGlobals.d.ts +60 -0
  394. package/dist/src/storyGlobals.d.ts.map +1 -0
  395. package/dist/src/storyGlobals.js +117 -0
  396. package/dist/src/storyGlobals.js.map +1 -0
  397. package/dist/src/storyHeights.d.ts +37 -0
  398. package/dist/src/storyHeights.d.ts.map +1 -0
  399. package/dist/src/storyHeights.js +53 -0
  400. package/dist/src/storyHeights.js.map +1 -0
  401. package/dist/src/storyIdsElement.d.ts +9 -0
  402. package/dist/src/storyIdsElement.d.ts.map +1 -0
  403. package/dist/src/storyIdsElement.js +9 -0
  404. package/dist/src/storyIdsElement.js.map +1 -0
  405. package/dist/src/storyTexts.d.ts +43 -0
  406. package/dist/src/storyTexts.d.ts.map +1 -0
  407. package/dist/src/storyTexts.js +71 -0
  408. package/dist/src/storyTexts.js.map +1 -0
  409. package/dist/src/storyTree.d.ts +215 -0
  410. package/dist/src/storyTree.d.ts.map +1 -0
  411. package/dist/src/storyTree.js +308 -0
  412. package/dist/src/storyTree.js.map +1 -0
  413. package/dist/src/switches.d.ts +156 -0
  414. package/dist/src/switches.d.ts.map +1 -0
  415. package/dist/src/switches.js +193 -0
  416. package/dist/src/switches.js.map +1 -0
  417. package/dist/src/viewState.d.ts +194 -0
  418. package/dist/src/viewState.d.ts.map +1 -0
  419. package/dist/src/viewState.js +303 -0
  420. package/dist/src/viewState.js.map +1 -0
  421. package/dist/src/vite/adapter.d.ts +70 -0
  422. package/dist/src/vite/adapter.d.ts.map +1 -0
  423. package/dist/src/vite/adapter.js +22 -0
  424. package/dist/src/vite/adapter.js.map +1 -0
  425. package/dist/src/vite/autoTitle.d.ts +28 -0
  426. package/dist/src/vite/autoTitle.d.ts.map +1 -0
  427. package/dist/src/vite/autoTitle.js +44 -0
  428. package/dist/src/vite/autoTitle.js.map +1 -0
  429. package/dist/src/vite/componentPage.d.ts +34 -0
  430. package/dist/src/vite/componentPage.d.ts.map +1 -0
  431. package/dist/src/vite/componentPage.js +94 -0
  432. package/dist/src/vite/componentPage.js.map +1 -0
  433. package/dist/src/vite/config.d.ts +72 -0
  434. package/dist/src/vite/config.d.ts.map +1 -0
  435. package/dist/src/vite/config.js +25 -0
  436. package/dist/src/vite/config.js.map +1 -0
  437. package/dist/src/vite/configFile.d.ts +76 -0
  438. package/dist/src/vite/configFile.d.ts.map +1 -0
  439. package/dist/src/vite/configFile.js +190 -0
  440. package/dist/src/vite/configFile.js.map +1 -0
  441. package/dist/src/vite/docsExtractor.d.ts +46 -0
  442. package/dist/src/vite/docsExtractor.d.ts.map +1 -0
  443. package/dist/src/vite/docsExtractor.js +88 -0
  444. package/dist/src/vite/docsExtractor.js.map +1 -0
  445. package/dist/src/vite/docsProgram.d.ts +42 -0
  446. package/dist/src/vite/docsProgram.d.ts.map +1 -0
  447. package/dist/src/vite/docsProgram.js +144 -0
  448. package/dist/src/vite/docsProgram.js.map +1 -0
  449. package/dist/src/vite/docsWorker.d.ts +2 -0
  450. package/dist/src/vite/docsWorker.d.ts.map +1 -0
  451. package/dist/src/vite/docsWorker.js +68 -0
  452. package/dist/src/vite/docsWorker.js.map +1 -0
  453. package/dist/src/vite/forcedStates.d.ts +27 -0
  454. package/dist/src/vite/forcedStates.d.ts.map +1 -0
  455. package/dist/src/vite/forcedStates.js +60 -0
  456. package/dist/src/vite/forcedStates.js.map +1 -0
  457. package/dist/src/vite/forgebookPlugin.d.ts +28 -0
  458. package/dist/src/vite/forgebookPlugin.d.ts.map +1 -0
  459. package/dist/src/vite/forgebookPlugin.js +375 -0
  460. package/dist/src/vite/forgebookPlugin.js.map +1 -0
  461. package/dist/src/vite/highlightCode.d.ts +16 -0
  462. package/dist/src/vite/highlightCode.d.ts.map +1 -0
  463. package/dist/src/vite/highlightCode.js +82 -0
  464. package/dist/src/vite/highlightCode.js.map +1 -0
  465. package/dist/src/vite/indexStoryFile.d.ts +35 -0
  466. package/dist/src/vite/indexStoryFile.d.ts.map +1 -0
  467. package/dist/src/vite/indexStoryFile.js +458 -0
  468. package/dist/src/vite/indexStoryFile.js.map +1 -0
  469. package/dist/src/vite/pages.d.ts +49 -0
  470. package/dist/src/vite/pages.d.ts.map +1 -0
  471. package/dist/src/vite/pages.js +171 -0
  472. package/dist/src/vite/pages.js.map +1 -0
  473. package/dist/src/vite/prebundled.d.ts +30 -0
  474. package/dist/src/vite/prebundled.d.ts.map +1 -0
  475. package/dist/src/vite/prebundled.js +81 -0
  476. package/dist/src/vite/prebundled.js.map +1 -0
  477. package/dist/src/vite/storyCode.d.ts +28 -0
  478. package/dist/src/vite/storyCode.d.ts.map +1 -0
  479. package/dist/src/vite/storyCode.js +80 -0
  480. package/dist/src/vite/storyCode.js.map +1 -0
  481. package/dist/src/vite/storyFilesModule.d.ts +17 -0
  482. package/dist/src/vite/storyFilesModule.d.ts.map +1 -0
  483. package/dist/src/vite/storyFilesModule.js +64 -0
  484. package/dist/src/vite/storyFilesModule.js.map +1 -0
  485. package/dist/src/vite/storyMeta.d.ts +34 -0
  486. package/dist/src/vite/storyMeta.d.ts.map +1 -0
  487. package/dist/src/vite/storyMeta.js +74 -0
  488. package/dist/src/vite/storyMeta.js.map +1 -0
  489. package/dist/src/vite/typeScriptPieces.d.ts +23 -0
  490. package/dist/src/vite/typeScriptPieces.d.ts.map +1 -0
  491. package/dist/src/vite/typeScriptPieces.js +236 -0
  492. package/dist/src/vite/typeScriptPieces.js.map +1 -0
  493. package/package.json +202 -3
@@ -0,0 +1,144 @@
1
+ /**
2
+ * The TypeScript programs the extractor reads: one per `tsconfig.json`, created on TypeScript 6's compiler API and
3
+ * kept until a source file changes (`markSourcesChanged`), then renewed on the next read, reusing what did not change.
4
+ *
5
+ * @remarks
6
+ * The repo type-checks with TypeScript 7, whose native compiler has no JavaScript API; TypeScript 6 (the version
7
+ * typescript-eslint uses too) reads the same configurations.
8
+ *
9
+ * @module
10
+ */
11
+ import { dirname } from "node:path";
12
+ import ts from "typescript-6";
13
+ /** The last program of each configuration, reused by the next read. */
14
+ const programs = new Map();
15
+ /**
16
+ * The configurations whose program may hold an edited file: renewed on their next read. A program read again without
17
+ * a change answers at once, its type checker kept; renewing it on every read cost seconds a read.
18
+ */
19
+ const outdated = new Set();
20
+ /** Marks every program as maybe holding an edited file: each is renewed on its next read. */
21
+ export const markSourcesChanged = () => {
22
+ for (const configPath of programs.keys())
23
+ outdated.add(configPath);
24
+ };
25
+ /**
26
+ * What a story file is read with when no `tsconfig.json` holds it (a JavaScript project, a `.jsx` story in a project
27
+ * that does not allow JavaScript): its imports resolved as Vite resolves them, JavaScript and JSX allowed.
28
+ */
29
+ const FALLBACK_OPTIONS = {
30
+ allowJs: true,
31
+ jsx: ts.JsxEmit.ReactJSX,
32
+ module: ts.ModuleKind.ESNext,
33
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
34
+ target: ts.ScriptTarget.ES2022,
35
+ skipLibCheck: true,
36
+ noEmit: true
37
+ };
38
+ /**
39
+ * A program from its root files, the one kept under the same key reused while no source changed.
40
+ *
41
+ * @param key - the program's key: its configuration file, or the story file a program of its own is made for.
42
+ * @param rootNames - its root files.
43
+ * @param options - its compiler options.
44
+ */
45
+ const keptProgram = (key, rootNames, options) => {
46
+ const oldProgram = programs.get(key);
47
+ if (oldProgram !== undefined && !outdated.has(key))
48
+ return oldProgram;
49
+ outdated.delete(key);
50
+ const program = ts.createProgram({
51
+ rootNames,
52
+ options,
53
+ ...(oldProgram === undefined ? {} : { oldProgram })
54
+ });
55
+ programs.set(key, program);
56
+ return program;
57
+ };
58
+ /**
59
+ * A program of the story file alone, from which its imports reach the component: for a file no configuration holds.
60
+ *
61
+ * @param file - the story file.
62
+ * @param options - the options of the configuration above it, when there is one; JavaScript is allowed on top.
63
+ */
64
+ const fileProgram = (file, options) => {
65
+ const program = keptProgram(`${file}#own`, [file], { ...options, allowJs: true, noEmit: true });
66
+ return { program, checker: program.getTypeChecker() };
67
+ };
68
+ /**
69
+ * The program that holds a file: the one of the nearest `tsconfig.json` up its folders, or, when none holds it, a
70
+ * program of the file alone (`FALLBACK_OPTIONS`, or the configuration's with JavaScript allowed).
71
+ *
72
+ * @param file - an absolute path to a source file.
73
+ * @returns the program, or a message when the configuration above it cannot be read.
74
+ */
75
+ export const programFor = (file) => {
76
+ const configPath = ts.findConfigFile(dirname(file), ts.sys.fileExists, "tsconfig.json");
77
+ if (configPath === undefined)
78
+ return fileProgram(file, FALLBACK_OPTIONS);
79
+ const parsed = ts.getParsedCommandLineOfConfigFile(configPath, {}, {
80
+ ...ts.sys,
81
+ onUnRecoverableConfigFileDiagnostic: () => undefined
82
+ });
83
+ if (parsed === undefined)
84
+ return `${configPath} could not be read`;
85
+ const program = keptProgram(configPath, parsed.fileNames, parsed.options);
86
+ if (program.getSourceFile(file) === undefined)
87
+ return fileProgram(file, parsed.options);
88
+ return { program, checker: program.getTypeChecker() };
89
+ };
90
+ /**
91
+ * The first paragraph of a symbol's TSDoc.
92
+ *
93
+ * @param symbol - a declared symbol.
94
+ * @param checker - the program's type checker.
95
+ */
96
+ export const summaryOf = (symbol, checker) => (ts.displayPartsToString(symbol.getDocumentationComment(checker)).split(/\n\s*\n/)[0] ?? "")
97
+ .replace(/\s+/g, " ")
98
+ .trim();
99
+ /**
100
+ * The first paragraph of a file's leading comment, its `@module` TSDoc: what the file holds, in a sentence. A
101
+ * component's own TSDoc is often a bare name ("A button."); its file's comment says what it is and does.
102
+ *
103
+ * @param sourceFile - the file.
104
+ * @returns the paragraph on one line, or an empty text when the file does not open with a `@module` comment.
105
+ */
106
+ export const moduleSummaryOf = (sourceFile) => {
107
+ const text = sourceFile.getFullText();
108
+ const [range] = ts.getLeadingCommentRanges(text, 0) ?? [];
109
+ if (range === undefined)
110
+ return "";
111
+ const comment = text.slice(range.pos, range.end);
112
+ if (!comment.startsWith("/**") || !comment.includes("@module"))
113
+ return "";
114
+ const lines = comment
115
+ .replace(/^\/\*\*/, "")
116
+ .replace(/\*\/$/, "")
117
+ .split("\n")
118
+ .map((line) => line.replace(/^\s*\* ?/, "").trimEnd());
119
+ const start = lines.findIndex((line) => line !== "");
120
+ const paragraph = [];
121
+ for (const line of lines.slice(Math.max(start, 0))) {
122
+ if (line === "" || line.startsWith("@"))
123
+ break;
124
+ paragraph.push(line);
125
+ }
126
+ return paragraph.join(" ").replace(/\s+/g, " ").trim();
127
+ };
128
+ /**
129
+ * A TSDoc tag's text, without the backticks it is often written in.
130
+ *
131
+ * @param symbol - a declared symbol.
132
+ * @param checker - the program's type checker.
133
+ * @param name - the tag (`defaultValue`).
134
+ */
135
+ export const tagOf = (symbol, checker, name) => {
136
+ const tag = symbol.getJsDocTags(checker).find((candidate) => candidate.name === name);
137
+ if (tag === undefined)
138
+ return undefined;
139
+ return ts
140
+ .displayPartsToString(tag.text)
141
+ .trim()
142
+ .replace(/^`(.*)`$/, "$1");
143
+ };
144
+ //# sourceMappingURL=docsProgram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docsProgram.js","sourceRoot":"","sources":["../../../src/vite/docsProgram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,cAAc,CAAC;AAU9B,uEAAuE;AACvE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE/C;;;GAGG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;AAEnC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAS,EAAE;IAC3C,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAuB;IAC3C,OAAO,EAAE,IAAI;IACb,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ;IACxB,MAAM,EAAE,EAAE,CAAC,U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,OAAuB,EAAE,IAAY,EAAsB,EAAE;IACpG,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACtF,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,OAAO,EAAE;SACN,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC;SAC9B,IAAI,EAAE;SACN,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=docsWorker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docsWorker.d.ts","sourceRoot":"","sources":["../../../src/vite/docsWorker.ts"],"names":[],"mappings":""}
@@ -0,0 +1,68 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ /**
10
+ * The worker thread that reads the story files' component docs: TypeScript's program for a package takes seconds to
11
+ * build, and built on the dev server's own thread it held every other answer (a frame, a documentation file) until
12
+ * it was done.
13
+ *
14
+ * @remarks
15
+ * Started by `docsExtractor.ts` with the framework's docs module (`adapter.ts`), which it loads once; it keeps the
16
+ * programs of `docsProgram.ts` between requests, so only a package's first
17
+ * read builds one, and a changed source file (`{ kind: "changed" }`) renews them on their next read. A request is `{ id, storyFile }`, the answer `{ id, result }`, `extractStoryComponent`'s result as
18
+ * it is (plain data); a warm-up is a request whose answer nobody reads.
19
+ *
20
+ * @module
21
+ */
22
+ import { parentPort, workerData } from "node:worker_threads";
23
+ import { isDocsModule } from "./adapter.js";
24
+ import { markSourcesChanged } from "./docsProgram.js";
25
+ /** Whether the worker's data names a docs module. */
26
+ const isWorkerData = (value) => typeof value === "object" &&
27
+ value !== null &&
28
+ "docsModule" in value &&
29
+ typeof value.docsModule === "string";
30
+ /** The framework's extractor, or why it could not be loaded: every request is then answered with that. */
31
+ const loadExtractor = async () => {
32
+ if (!isWorkerData(workerData))
33
+ return "The docs' worker was started without a docs module";
34
+ try {
35
+ const module = await import(__rewriteRelativeImportExtension(workerData.docsModule));
36
+ if (isDocsModule(module))
37
+ return module.extractStoryComponent;
38
+ return `${workerData.docsModule} exports no extractStoryComponent`;
39
+ }
40
+ catch (error) {
41
+ return `${workerData.docsModule} could not be loaded: ${error instanceof Error ? error.message : String(error)}`;
42
+ }
43
+ };
44
+ /** The framework's extractor, loaded once, before the first answer. */
45
+ const extractor = loadExtractor();
46
+ /** The extractor's result, or why it threw: a throw would end the worker and every request waiting on it. */
47
+ const extracted = async (storyFile) => {
48
+ const extract = await extractor;
49
+ if (typeof extract === "string")
50
+ return extract;
51
+ try {
52
+ return extract(storyFile);
53
+ }
54
+ catch (error) {
55
+ return `${storyFile}: the docs could not be read: ${error instanceof Error ? error.message : String(error)}`;
56
+ }
57
+ };
58
+ parentPort?.on("message", (request) => {
59
+ if (request.kind === "changed") {
60
+ markSourcesChanged();
61
+ return;
62
+ }
63
+ void extracted(request.storyFile).then((result) => {
64
+ const response = { id: request.id, result };
65
+ parentPort?.postMessage(response);
66
+ });
67
+ });
68
+ //# sourceMappingURL=docsWorker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docsWorker.js","sourceRoot":"","sources":["../../../src/vite/docsWorker.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,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,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAC/G,CAAC;AACH,CAAC,CAAC;AAEF,UAAU,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,OAAoB,EAAQ,EAAE;IACvD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,kBAAkB,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,KAAK,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAiB,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC;QAC1D,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The rewrite that shows interaction states without the pointer or the keyboard: every user-action pseudo-class also
3
+ * matches inside an element that forces it.
4
+ *
5
+ * @remarks
6
+ * `:hover` becomes `:is(:hover, [data-forgebook-force~="hover"], [data-forgebook-force~="hover"] *)`, and so on for
7
+ * `:active`, `:focus`, `:focus-visible` and `:focus-within`, at every depth (inside `:is()`, `:not()`, `:has()`). The
8
+ * real state still works, the specificity stays the same (an attribute weighs what a pseudo-class does), and the
9
+ * library's CSS carries nothing for the catalogue: the rewrite runs only in the catalogue's build, as a Lightning CSS
10
+ * visitor. A story forces a state with `parameters.forceState` (on its root) or `data-forgebook-force` on a
11
+ * part.
12
+ *
13
+ * @module
14
+ */
15
+ import type { CustomAtRules, Selector, Visitor } from "lightningcss";
16
+ /** The attribute that forces states on an element and everything inside it. */
17
+ export declare const FORCE_ATTRIBUTE = "data-forgebook-force";
18
+ /**
19
+ * One selector with every forceable pseudo-class matching its forced form too.
20
+ *
21
+ * @param selector - a selector, as Lightning CSS parses it.
22
+ * @returns the rewritten selector; the same components when it holds no forceable state.
23
+ */
24
+ export declare const forcedSelector: (selector: Selector) => Selector;
25
+ /** The Lightning CSS visitor that applies the rewrite to every style sheet the catalogue builds. */
26
+ export declare const FORCED_STATES_VISITOR: Visitor<CustomAtRules>;
27
+ //# sourceMappingURL=forcedStates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forcedStates.d.ts","sourceRoot":"","sources":["../../../src/vite/forcedStates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAqB,OAAO,EAAE,MAAM,cAAc,CAAC;AAExF,+EAA+E;AAC/E,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAwCtD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,QAAQ,KAAG,QAKjD,CAAC;AAEJ,oGAAoG;AACpG,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,aAAa,CAAgC,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The rewrite that shows interaction states without the pointer or the keyboard: every user-action pseudo-class also
3
+ * matches inside an element that forces it.
4
+ *
5
+ * @remarks
6
+ * `:hover` becomes `:is(:hover, [data-forgebook-force~="hover"], [data-forgebook-force~="hover"] *)`, and so on for
7
+ * `:active`, `:focus`, `:focus-visible` and `:focus-within`, at every depth (inside `:is()`, `:not()`, `:has()`). The
8
+ * real state still works, the specificity stays the same (an attribute weighs what a pseudo-class does), and the
9
+ * library's CSS carries nothing for the catalogue: the rewrite runs only in the catalogue's build, as a Lightning CSS
10
+ * visitor. A story forces a state with `parameters.forceState` (on its root) or `data-forgebook-force` on a
11
+ * part.
12
+ *
13
+ * @module
14
+ */
15
+ /** The attribute that forces states on an element and everything inside it. */
16
+ export const FORCE_ATTRIBUTE = "data-forgebook-force";
17
+ /** The pseudo-classes the rewrite reaches. */
18
+ const FORCEABLE = ["hover", "active", "focus", "focus-visible", "focus-within"];
19
+ /** Whether a pseudo-class kind is one the catalogue forces. */
20
+ const isForceable = (kind) => FORCEABLE.some((state) => state === kind);
21
+ /** `[data-forgebook-force~="<state>"]`. */
22
+ const forcingAttribute = (state) => ({
23
+ type: "attribute",
24
+ name: FORCE_ATTRIBUTE,
25
+ operation: { operator: "includes", value: state }
26
+ });
27
+ /** `:is(:<state>, [force~=state], [force~=state] *)`: the state, real or forced. */
28
+ const realOrForced = (state) => ({
29
+ type: "pseudo-class",
30
+ kind: "is",
31
+ selectors: [
32
+ [{ type: "pseudo-class", kind: state }],
33
+ [forcingAttribute(state)],
34
+ [forcingAttribute(state), { type: "combinator", value: "descendant" }, { type: "universal" }]
35
+ ]
36
+ });
37
+ /** A pseudo-class that holds other selectors, rewritten inside. */
38
+ const withNested = (component) => {
39
+ if (component.type !== "pseudo-class")
40
+ return component;
41
+ if (component.kind === "is" ||
42
+ component.kind === "where" ||
43
+ component.kind === "not" ||
44
+ component.kind === "has") {
45
+ return { ...component, selectors: component.selectors.map(forcedSelector) };
46
+ }
47
+ return component;
48
+ };
49
+ /**
50
+ * One selector with every forceable pseudo-class matching its forced form too.
51
+ *
52
+ * @param selector - a selector, as Lightning CSS parses it.
53
+ * @returns the rewritten selector; the same components when it holds no forceable state.
54
+ */
55
+ export const forcedSelector = (selector) => selector.map((component) => component.type === "pseudo-class" && isForceable(component.kind)
56
+ ? realOrForced(component.kind)
57
+ : withNested(component));
58
+ /** The Lightning CSS visitor that applies the rewrite to every style sheet the catalogue builds. */
59
+ export const FORCED_STATES_VISITOR = { Selector: forcedSelector };
60
+ //# sourceMappingURL=forcedStates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forcedStates.js","sourceRoot":"","sources":["../../../src/vite/forcedStates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAEtD,8CAA8C;AAC9C,MAAM,SAAS,GAA2B,CAAC,OAAO,EA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C,cAAc,CAAC,EAAE,CAAC;IAC9E,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAkB,EAAY,EAAE,CAC7D,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CACzB,SAAS,CAAC,IAAI,KAAK,cAAc,IAAI,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC;IAC9D,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC;IAC9B,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAC1B,CAAC;AAEJ,oGAAoG;AACpG,MAAM,CAAC,MAAM,qBAAqB,GAA2B,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { Plugin } from "vite";
2
+ import type { FrameworkAdapter } from "./adapter.ts";
3
+ import { type ResolvedConfig } from "./configFile.ts";
4
+ /** The plugin's options. */
5
+ export type ForgebookPluginOptions = {
6
+ /**
7
+ * A catalogue's configuration already read (the `forgebook` command passes it). Without it, the plugin reads the
8
+ * `forgebook.config.ts` in Vite's root when there is one, and then makes the catalogue's two pages.
9
+ */
10
+ readonly config?: ResolvedConfig;
11
+ /**
12
+ * The framework the stories are written for, where there is no configuration: a package's own test page of the
13
+ * frame, which the plugin only indexes and documents (`react()` of `@forgebook/react/vite`).
14
+ */
15
+ readonly framework?: FrameworkAdapter;
16
+ /** Folders outside the app the dev server watches for new story files, beside the configuration's `watch`. */
17
+ readonly watch?: readonly string[];
18
+ };
19
+ /**
20
+ * The catalogue's Vite plugin: the story index, the docs, the code and the Markdown of the stories, the forced-states
21
+ * rewrite of every style sheet and, with a configuration, the catalogue's two pages.
22
+ *
23
+ * @param options - the configuration (read from Vite's root when not given), or the framework alone, and the folders
24
+ * to watch.
25
+ * @returns the plugin, for the app's `plugins`.
26
+ */
27
+ export declare const forgebookPlugin: (options?: ForgebookPluginOptions) => Plugin;
28
+ //# sourceMappingURL=forgebookPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forgebookPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/forgebookPlugin.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,MAAM,EAA6B,MAAM,MAAM,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAmD,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAwEvG,4BAA4B;AAC5B,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC,8GAA8G;IAC9G,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC,CAAC;AA+KF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,UAAS,sBAA2B,KAAG,MAqJtE,CAAC"}