@aussieljk/forkbook 0.0.1-2 → 0.0.1-21

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 (536) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +35 -53
  3. package/assets/addon-vitest/templates/vitest.config.4.template.ts +2 -2
  4. package/assets/browser/favicon-wrapper.svg +4 -4
  5. package/assets/browser/favicon.svg +1 -1
  6. package/assets/browser/inter-LICENSE.txt +92 -0
  7. package/assets/browser/inter-variable-italic.woff2 +0 -0
  8. package/assets/browser/inter-variable.woff2 +0 -0
  9. package/assets/browser/mirror-ball.png +0 -0
  10. package/assets/builder-vite/iframe.html +8 -24
  11. package/assets/create/rendererAssets/common/Configure.mdx +100 -100
  12. package/assets/create/rendererAssets/common/button.css +7 -7
  13. package/assets/create/rendererAssets/common/header.css +6 -6
  14. package/assets/create/rendererAssets/common/page.css +12 -12
  15. package/assets/create/templates/react-native/index.expo.js +4 -4
  16. package/assets/create/templates/react-native/index.js +5 -5
  17. package/assets/server/base-preview-body.html +32 -32
  18. package/assets/server/base-preview-head.html +86 -86
  19. package/assets/server/template.ejs +31 -26
  20. package/dist/_browser-chunks/{Color-PCLE2J36.js → Color-7FO5YFB5.js} +8 -8
  21. package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
  22. package/dist/_browser-chunks/WithTooltip-QWFSUQZP.js +199 -0
  23. package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
  24. package/dist/_browser-chunks/{chunk-PFRNG3UC.js → chunk-2WZWS7GJ.js} +5 -5
  25. package/dist/_browser-chunks/{chunk-52CW7FF7.js → chunk-3QNZOMD7.js} +8 -3
  26. package/dist/_browser-chunks/{chunk-LV5PIKV4.js → chunk-3QPZOXB7.js} +6 -8
  27. package/dist/_browser-chunks/{chunk-ODVJ3XZJ.js → chunk-4BOJAE7P.js} +14 -10
  28. package/dist/_browser-chunks/{chunk-2MEPHP35.js → chunk-4KIQBRD2.js} +1 -1
  29. package/dist/_browser-chunks/{chunk-KQ7CRO2B.js → chunk-5Z3MWCFR.js} +12 -12
  30. package/dist/_browser-chunks/chunk-6AKCRYVX.js +6 -0
  31. package/dist/_browser-chunks/{chunk-W5M6NPS3.js → chunk-6SL45YM3.js} +15 -18
  32. package/dist/_browser-chunks/{chunk-2SCZVUKW.js → chunk-AN2LJG5I.js} +1 -1
  33. package/dist/_browser-chunks/{chunk-P6PK47TQ.js → chunk-BLCZ3C5M.js} +48 -83
  34. package/dist/_browser-chunks/{chunk-RSPAQWVJ.js → chunk-BNP234B4.js} +1 -1
  35. package/dist/_browser-chunks/{chunk-JYVGARBG.js → chunk-BSYOFSF6.js} +770 -720
  36. package/dist/_browser-chunks/{chunk-JSBKXXXF.js → chunk-DHTLVXAL.js} +38 -45
  37. package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-DISGPOF4.js} +54 -51
  38. package/dist/_browser-chunks/chunk-DNJ3OSLB.js +6021 -0
  39. package/dist/_browser-chunks/{chunk-6SXYJQST.js → chunk-E6QKKKLO.js} +21 -6
  40. package/dist/_browser-chunks/{chunk-FJGWSWL5.js → chunk-EBSOKHFG.js} +10 -4
  41. package/dist/_browser-chunks/{chunk-CFAOWGL7.js → chunk-ECMVTOVD.js} +1 -1
  42. package/dist/_browser-chunks/{chunk-CFWWCCZV.js → chunk-ENHFQXYS.js} +9 -7
  43. package/dist/_browser-chunks/{chunk-YTIT5NA5.js → chunk-EW2M3URL.js} +91 -84
  44. package/dist/_browser-chunks/chunk-FAOLWWRN.js +20 -0
  45. package/dist/_browser-chunks/{chunk-MFMDGWP6.js → chunk-FCULT3AE.js} +3 -3
  46. package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
  47. package/dist/_browser-chunks/chunk-HZFHNYRC.js +53 -0
  48. package/dist/_browser-chunks/chunk-IFADVEQE.js +669 -0
  49. package/dist/_browser-chunks/{chunk-OQWFVDIN.js → chunk-KQJ4T6JL.js} +31 -25
  50. package/dist/_browser-chunks/{chunk-RNTIV5CE.js → chunk-LYYXDWR2.js} +9 -9
  51. package/dist/_browser-chunks/{chunk-V5M7Q4HT.js → chunk-MJIDTL3X.js} +4 -14
  52. package/dist/_browser-chunks/{chunk-V2G23FV7.js → chunk-N5WQGLI7.js} +1 -1
  53. package/dist/_browser-chunks/{chunk-EIYAKDGP.js → chunk-NA4ITZTK.js} +127 -105
  54. package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-NK5SGJNG.js} +22 -17
  55. package/dist/_browser-chunks/chunk-NPNIBOPF.js +18 -0
  56. package/dist/_browser-chunks/{chunk-YEKO6BHJ.js → chunk-ONTSNQON.js} +1 -1
  57. package/dist/_browser-chunks/chunk-OOETBSA7.js +502 -0
  58. package/dist/_browser-chunks/chunk-PFYL47RM.js +45 -0
  59. package/dist/_browser-chunks/{chunk-OD6IBQCC.js → chunk-PQRPDA4U.js} +5 -5
  60. package/dist/_browser-chunks/{chunk-2JDQ35OA.js → chunk-PU7D2WDP.js} +0 -11
  61. package/dist/_browser-chunks/chunk-PZQRXPVR.js +21 -0
  62. package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-QFO2B4X2.js} +31 -28
  63. package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
  64. package/dist/_browser-chunks/{chunk-ZTQ5MEJ5.js → chunk-UMGDO2ZM.js} +3 -37
  65. package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
  66. package/dist/_browser-chunks/chunk-XKTORVEQ.js +255 -0
  67. package/dist/_browser-chunks/chunk-XSVERCGB.js +91 -0
  68. package/dist/_browser-chunks/{chunk-FVSEPWWX.js → chunk-XTQCLWVH.js} +325 -1635
  69. package/dist/_browser-chunks/{chunk-MDOL7KML.js → chunk-YJO5BK52.js} +7 -3
  70. package/dist/_browser-chunks/{chunk-66OCZ54D.js → chunk-ZF37BMDS.js} +6 -2
  71. package/dist/_browser-chunks/{chunk-C3D4HEFY.js → chunk-ZIZCGWCG.js} +348 -170
  72. package/dist/_browser-chunks/{matchers-YLBYSYAF.js → matchers-2HVLNCVO.js} +4 -4
  73. package/dist/_browser-chunks/{react-dom-client-4OHE3QDV.js → react-dom-client-SLBUX3U3.js} +1 -1
  74. package/dist/_node-chunks/{attached-runtime-I2G4WLJI.js → attached-runtime-UC2CB4GH.js} +37 -35
  75. package/dist/_node-chunks/builder-manager-S5UUKVOR.js +1174 -0
  76. package/dist/_node-chunks/{chunk-OUW6R7C3.js → chunk-3335ZZIO.js} +6 -6
  77. package/dist/_node-chunks/{chunk-V2DY426G.js → chunk-3D6N6P2R.js} +283 -306
  78. package/dist/_node-chunks/{chunk-3Y6AAY5H.js → chunk-3ER54PQM.js} +8 -8
  79. package/dist/_node-chunks/{chunk-DC7DKR5K.js → chunk-3H5C52QU.js} +6 -6
  80. package/dist/_node-chunks/chunk-3UI3TQ7R.js +28 -0
  81. package/dist/_node-chunks/{chunk-Q7QNUM5H.js → chunk-4C3ACAHV.js} +6 -6
  82. package/dist/_node-chunks/{chunk-XGIUVY52.js → chunk-4UTCKJEQ.js} +7 -7
  83. package/dist/_node-chunks/chunk-53A5CYDK.js +572 -0
  84. package/dist/_node-chunks/{chunk-4FEANXWU.js → chunk-53PSBDRK.js} +140 -118
  85. package/dist/_node-chunks/{chunk-3W7F2B7P.js → chunk-54MO4QLB.js} +6 -6
  86. package/dist/_node-chunks/{chunk-7GUDZVRQ.js → chunk-5CJMRQZ6.js} +6 -6
  87. package/dist/_node-chunks/chunk-5HOM7B4V.js +20 -0
  88. package/dist/_node-chunks/{chunk-BSKFCWQD.js → chunk-5QG6AXK4.js} +7 -7
  89. package/dist/_node-chunks/chunk-67XVZZUO.js +405 -0
  90. package/dist/_node-chunks/{chunk-EWOX7HPJ.js → chunk-6HQJJDLH.js} +6 -6
  91. package/dist/_node-chunks/chunk-6IPHWCFI.js +29 -0
  92. package/dist/_node-chunks/{chunk-NDWKJ4CL.js → chunk-6XYOFBRD.js} +98 -129
  93. package/dist/_node-chunks/{chunk-TNJIXE37.js → chunk-7IAYDGYH.js} +6 -6
  94. package/dist/_node-chunks/{chunk-ICPBH3E7.js → chunk-7P67PUU2.js} +7 -7
  95. package/dist/_node-chunks/{chunk-XLP2ZKXV.js → chunk-AAK5BBF2.js} +7 -7
  96. package/dist/_node-chunks/{chunk-CCOTJ4FC.js → chunk-BGUVBOOU.js} +10 -10
  97. package/dist/_node-chunks/chunk-BNGBOASQ.js +25 -0
  98. package/dist/_node-chunks/{chunk-VLOXOXXE.js → chunk-BWZWCVVH.js} +9 -9
  99. package/dist/_node-chunks/{chunk-SWO5CDYU.js → chunk-C6HQ6WLU.js} +8 -8
  100. package/dist/_node-chunks/chunk-CJHRH777.js +20 -0
  101. package/dist/_node-chunks/{chunk-IK4FGZLR.js → chunk-COEW4ORP.js} +6 -6
  102. package/dist/_node-chunks/{chunk-JGGFYIG5.js → chunk-CVHDAEDZ.js} +7 -7
  103. package/dist/_node-chunks/{chunk-YCMRA6RX.js → chunk-CXGOQNGI.js} +7 -7
  104. package/dist/_node-chunks/chunk-D4XTQWRM.js +11 -0
  105. package/dist/_node-chunks/{chunk-BS2WMZMR.js → chunk-D5V6CZ6U.js} +7 -7
  106. package/dist/_node-chunks/{chunk-XHL2LVBM.js → chunk-DCTXJ4TT.js} +14 -16
  107. package/dist/_node-chunks/{chunk-WCULS5TP.js → chunk-DP6WFY3D.js} +7 -7
  108. package/dist/_node-chunks/chunk-E23GDXG6.js +271 -0
  109. package/dist/_node-chunks/{chunk-GEFQN7K3.js → chunk-E3ZFMURC.js} +8 -8
  110. package/dist/_node-chunks/{chunk-WZJF2OUH.js → chunk-E6O3NA44.js} +7 -7
  111. package/dist/_node-chunks/{chunk-RWFIFGO5.js → chunk-ECS3WDOU.js} +8 -8
  112. package/dist/_node-chunks/{chunk-XI6B6P47.js → chunk-FB5YJWOH.js} +6 -6
  113. package/dist/_node-chunks/{chunk-3SDUYDXH.js → chunk-FCK5FM6D.js} +7 -7
  114. package/dist/_node-chunks/{chunk-6YKBRP72.js → chunk-FJUGPEJK.js} +6 -6
  115. package/dist/_node-chunks/{chunk-TFEWM4E3.js → chunk-FPYXI76E.js} +75 -75
  116. package/dist/_node-chunks/chunk-GEWVOY3F.js +62 -0
  117. package/dist/_node-chunks/{chunk-ET7PWEO7.js → chunk-GHZ44BFB.js} +14 -13
  118. package/dist/_node-chunks/{chunk-LXBD4UL4.js → chunk-GJMFISS3.js} +8 -8
  119. package/dist/_node-chunks/{chunk-FK7KGTV7.js → chunk-GK2Y2RFX.js} +7 -7
  120. package/dist/_node-chunks/{chunk-FPZB5OI7.js → chunk-GP6YBA2R.js} +6 -6
  121. package/dist/_node-chunks/{chunk-34EO2PUT.js → chunk-GQUFGJ4D.js} +6 -6
  122. package/dist/_node-chunks/{chunk-HMP2G23X.js → chunk-H4CRQDTK.js} +6 -6
  123. package/dist/_node-chunks/{chunk-2BUPBPFB.js → chunk-HCDG54OG.js} +7 -7
  124. package/dist/_node-chunks/{chunk-U5W53R2J.js → chunk-HGJMP4EI.js} +506 -494
  125. package/dist/_node-chunks/chunk-HSX6BDBA.js +18 -0
  126. package/dist/_node-chunks/{chunk-UMUBKI6E.js → chunk-IPFPWMT5.js} +1320 -437
  127. package/dist/_node-chunks/chunk-KRIOC4WF.js +281 -0
  128. package/dist/_node-chunks/{chunk-TINO74G5.js → chunk-KUL2MJ6N.js} +6 -6
  129. package/dist/_node-chunks/{chunk-LO56I6E2.js → chunk-LUR6QTYB.js} +10 -10
  130. package/dist/_node-chunks/{chunk-YZFWBA5L.js → chunk-LYS7TI35.js} +368 -321
  131. package/dist/_node-chunks/chunk-MDTXL6SN.js +2613 -0
  132. package/dist/_node-chunks/{chunk-LCK4ZQKG.js → chunk-MIIPXT4S.js} +9 -9
  133. package/dist/_node-chunks/chunk-MLWGAA2I.js +138 -0
  134. package/dist/_node-chunks/{chunk-42UWAGPW.js → chunk-MWUGCUB5.js} +52 -22
  135. package/dist/_node-chunks/{chunk-JDXXX6LB.js → chunk-MX5MVLEK.js} +6 -6
  136. package/dist/_node-chunks/chunk-N44UIGCO.js +47 -0
  137. package/dist/_node-chunks/{chunk-OISX4AGQ.js → chunk-NP2JHOFY.js} +37 -31
  138. package/dist/_node-chunks/chunk-OMNGOPNG.js +52 -0
  139. package/dist/_node-chunks/{chunk-ZWBCQ4MJ.js → chunk-OO2GTHUF.js} +9 -17
  140. package/dist/_node-chunks/{chunk-F3ZFKBHY.js → chunk-PC57BIYZ.js} +8 -8
  141. package/dist/_node-chunks/chunk-PHWMAF5C.js +49 -0
  142. package/dist/_node-chunks/{chunk-B5J7Q7J4.js → chunk-PLIQQETC.js} +7 -7
  143. package/dist/_node-chunks/{chunk-H32DYT6P.js → chunk-QMYCIS2U.js} +6 -6
  144. package/dist/_node-chunks/{chunk-DUR55DJJ.js → chunk-QZIDK3GX.js} +89 -71
  145. package/dist/_node-chunks/{chunk-UVINFLGY.js → chunk-ROJ6RSIJ.js} +7 -7
  146. package/dist/_node-chunks/{chunk-E6YESGLX.js → chunk-S2NB6QEG.js} +542 -1049
  147. package/dist/_node-chunks/{chunk-TWI4GVH7.js → chunk-S6VCOSQS.js} +6 -6
  148. package/dist/_node-chunks/{chunk-KISMCCP5.js → chunk-SEVOOOB2.js} +474 -479
  149. package/dist/_node-chunks/{chunk-JZOO7GGC.js → chunk-SFT6ZAVN.js} +6 -6
  150. package/dist/_node-chunks/{chunk-RRN2V55B.js → chunk-SXBUK4F6.js} +7 -7
  151. package/dist/_node-chunks/{chunk-WNZ2UMFM.js → chunk-TGF6Q66I.js} +15 -9
  152. package/dist/_node-chunks/{chunk-NIBT7XDZ.js → chunk-TGFHWGGT.js} +9 -6
  153. package/dist/_node-chunks/chunk-TTLSBLPQ.js +620 -0
  154. package/dist/_node-chunks/{chunk-SVTBJ7Q3.js → chunk-UUAEW2AR.js} +6 -6
  155. package/dist/_node-chunks/chunk-VQHM66NL.js +534 -0
  156. package/dist/_node-chunks/{chunk-H4PPVMP5.js → chunk-VSTTY3TM.js} +6 -6
  157. package/dist/_node-chunks/{chunk-2DSIDINN.js → chunk-XDBSAFUB.js} +650 -9
  158. package/dist/_node-chunks/{chunk-OWNFOGTA.js → chunk-XTQQGAUZ.js} +7 -7
  159. package/dist/_node-chunks/{chunk-CXRU72ET.js → chunk-YMJVSFJT.js} +6 -6
  160. package/dist/_node-chunks/{chunk-DHJFTB4K.js → chunk-YXEKWVJQ.js} +7 -7
  161. package/dist/_node-chunks/{chunk-SLWQNBGO.js → chunk-Z6CUUWJO.js} +34 -949
  162. package/dist/_node-chunks/{chunk-TD5PLLQG.js → chunk-ZAIGR7EV.js} +64 -17
  163. package/dist/_node-chunks/{chunk-6KEHV53S.js → chunk-ZCFXEFR6.js} +33 -41
  164. package/dist/_node-chunks/{chunk-FW2HQUBQ.js → chunk-ZHUBOYOD.js} +6 -6
  165. package/dist/_node-chunks/{chunk-MA24JW6C.js → chunk-ZHUBTBP2.js} +25 -8
  166. package/dist/_node-chunks/{chunk-RXNJDRGO.js → chunk-ZSTIFZHY.js} +21 -25
  167. package/dist/_node-chunks/dist-TRTHRODT.js +16 -0
  168. package/dist/_node-chunks/dist-XPLJ5T4W.js +27 -0
  169. package/dist/_node-chunks/{local-runtime-NTKIN2QT.js → local-runtime-AC7MOWYK.js} +21 -22
  170. package/dist/_node-chunks/{mdx-plugin-MWISDWDQ.js → mdx-plugin-ZW26VGEP.js} +2263 -130
  171. package/dist/_node-chunks/{monorepo-LIRFMQXE.js → monorepo-T2KZK62Q.js} +12 -12
  172. package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-2CWUUF6H.js} +12 -12
  173. package/dist/_node-chunks/optimized-tests-4AK3PFSX.js +22 -0
  174. package/dist/_node-chunks/{pattern-copy-play-EKHIUAU2.js → pattern-copy-play-CMRGEXHM.js} +12 -12
  175. package/dist/_node-chunks/postinstallAddon-OUQENFYO.js +20 -0
  176. package/dist/_node-chunks/{rehype-external-links-BUN3HUCO.js → rehype-external-links-LHOAIJ2E.js} +9 -9
  177. package/dist/_node-chunks/{rehype-slug-PLADX223.js → rehype-slug-K54MMYY6.js} +9 -9
  178. package/dist/_node-chunks/{relaxed-limits-GBHW6KIQ.js → relaxed-limits-TTL4PWH7.js} +12 -12
  179. package/dist/_node-chunks/{run-NL66VTNR.js → run-6DXBB5F7.js} +294 -30
  180. package/dist/_node-chunks/{run-KDTIZNSY.js → run-BMTV5ZAO.js} +18 -18
  181. package/dist/_node-chunks/{setup-MGC7BQO6.js → setup-FDPYW25Y.js} +9 -9
  182. package/dist/_node-chunks/{vitest.config.4.template-JH2THZFG.js → vitest.config.4.template-2TCFWAAI.js} +9 -9
  183. package/dist/actions/decorator.js +18 -22
  184. package/dist/actions/index.d.ts +4 -4
  185. package/dist/actions/index.js +3 -2
  186. package/dist/addon-a11y/index.d.ts +3 -3
  187. package/dist/addon-a11y/index.js +3 -2
  188. package/dist/addon-a11y/manager.js +41 -38
  189. package/dist/addon-a11y/preset.js +7 -7
  190. package/dist/addon-a11y/preview.d.ts +8 -2
  191. package/dist/addon-a11y/preview.js +3 -2
  192. package/dist/addon-comments/manager.js +353 -0
  193. package/dist/addon-comments/preset.js +80 -0
  194. package/dist/addon-comments/preview.js +101 -0
  195. package/dist/addon-docs/blocks.d.ts +123 -85
  196. package/dist/addon-docs/blocks.js +159 -85
  197. package/dist/addon-docs/index.d.ts +21 -21
  198. package/dist/addon-docs/index.js +3 -3
  199. package/dist/addon-docs/manager.js +6 -6
  200. package/dist/addon-docs/preset.js +12 -12
  201. package/dist/addon-docs/preview.d.ts +3 -1
  202. package/dist/addon-docs/preview.js +1 -1
  203. package/dist/addon-links/index.d.ts +2 -1
  204. package/dist/addon-links/index.js +5 -2
  205. package/dist/addon-links/preview.d.ts +1 -1
  206. package/dist/addon-links/preview.js +5 -2
  207. package/dist/addon-links/react/index.js +4 -1
  208. package/dist/addon-mcp/preset.js +203 -84
  209. package/dist/addon-mcp/preview.js +1 -1
  210. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +71 -71
  211. package/dist/addon-ondevice-actions/index.js +5 -1
  212. package/dist/addon-ondevice-actions/register.js +5 -1
  213. package/dist/addon-ondevice-controls/index.js +1 -1
  214. package/dist/addon-ondevice-controls/register.js +1 -1
  215. package/dist/addon-pseudo-states/index.d.ts +1 -1
  216. package/dist/addon-pseudo-states/index.js +1 -1
  217. package/dist/addon-pseudo-states/manager.js +2 -2
  218. package/dist/addon-pseudo-states/preview.d.ts +1 -1
  219. package/dist/addon-pseudo-states/preview.js +1 -1
  220. package/dist/addon-themes/index.d.ts +7 -6
  221. package/dist/addon-themes/index.js +2 -2
  222. package/dist/addon-themes/manager.js +4 -4
  223. package/dist/addon-themes/postinstall.js +7 -7
  224. package/dist/addon-themes/preview.js +2 -2
  225. package/dist/addon-vitest/constants.js +8 -8
  226. package/dist/addon-vitest/manager.js +32 -23
  227. package/dist/addon-vitest/node/coverage-reporter.js +11 -11
  228. package/dist/addon-vitest/node/vitest.js +37 -37
  229. package/dist/addon-vitest/postinstall.js +10 -10
  230. package/dist/addon-vitest/preset.js +26 -26
  231. package/dist/addon-vitest/vitest-plugin/global-setup.js +23 -23
  232. package/dist/addon-vitest/vitest-plugin/index.js +83 -73
  233. package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +3 -3
  234. package/dist/addon-vitest/vitest-plugin/setup-file.js +1 -1
  235. package/dist/babel/index.d.ts +241 -995
  236. package/dist/babel/index.js +30583 -38
  237. package/dist/backgrounds/index.d.ts +1 -1
  238. package/dist/bin/core.js +122 -110
  239. package/dist/bin/dispatcher.js +18 -16
  240. package/dist/bin/loader.js +17 -16
  241. package/dist/builder-next/index.d.ts +59 -0
  242. package/dist/builder-next/index.js +201 -0
  243. package/dist/builder-vite/index.d.ts +8 -3
  244. package/dist/builder-vite/index.js +80 -25
  245. package/dist/builder-vite/preset.js +13 -13
  246. package/dist/channels/index.d.ts +3 -2
  247. package/dist/channels/index.js +97 -24
  248. package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
  249. package/dist/{chunk-C2p5r3Vt.d.ts → chunk-B53gRJBs.d.ts} +838 -703
  250. package/dist/{chunk-DoIGKY33.d.ts → chunk-BLZXEm1K.d.ts} +6 -8
  251. package/dist/chunk-BcYKnZln.d.ts +10 -0
  252. package/dist/{chunk-Bpi2tz-6.d.ts → chunk-BspNQvZn.d.ts} +21 -23
  253. package/dist/{chunk-BCoJQE-f.d.ts → chunk-BtKww7r1.d.ts} +6 -4
  254. package/dist/chunk-CFhJCPSB.d.ts +48 -0
  255. package/dist/{chunk-DtHByo32.d.ts → chunk-CFk6djyM.d.ts} +5 -5
  256. package/dist/{chunk-CwQKNaYL.d.ts → chunk-CMx6bGAU.d.ts} +2 -2
  257. package/dist/{chunk-DEVFdzxR.d.ts → chunk-CRmUwbkb.d.ts} +4 -4
  258. package/dist/{chunk-CMeX4WRe.d.ts → chunk-CT2iXaHz.d.ts} +1 -1
  259. package/dist/{chunk-pcFXCimE.d.ts → chunk-CmV7WZzR.d.ts} +124 -2
  260. package/dist/{chunk-BGkgZp-H.d.ts → chunk-D3uSIa6H.d.ts} +9 -1
  261. package/dist/{chunk-DzuY9DXg.d.ts → chunk-DDd8BhTY.d.ts} +2 -2
  262. package/dist/{chunk-Dw1z1Pki.d.ts → chunk-DNCU78oW.d.ts} +160 -323
  263. package/dist/chunk-DVIvUVkS.d.ts +195 -0
  264. package/dist/{chunk-gCX81nOr.d.ts → chunk-DgzPaTw9.d.ts} +3 -3
  265. package/dist/{chunk-Kt1tW-D1.d.ts → chunk-Dm-iHJ-s.d.ts} +3 -3
  266. package/dist/{chunk-C-bavsOH.d.ts → chunk-Dw_4ad2Y.d.ts} +6 -6
  267. package/dist/chunk-Susgfkap.d.ts +20 -0
  268. package/dist/{chunk-B2t1tGRh.d.ts → chunk-bhl-7rRD.d.ts} +40 -15
  269. package/dist/{chunk-BXLImeLy.d.ts → chunk-r-Vjut9o.d.ts} +52 -11
  270. package/dist/cli/index.d.ts +15 -904
  271. package/dist/cli/index.js +49 -5209
  272. package/dist/cli/skills/content/index.d.ts +3 -3
  273. package/dist/cli/skills/content/index.js +3 -3
  274. package/dist/cli/tools/sdk/child-host.d.ts +1 -1
  275. package/dist/cli/tools/sdk/child-host.js +17 -17
  276. package/dist/cli/tools/sdk/index.d.ts +4 -4
  277. package/dist/cli/tools/sdk/index.js +18 -18
  278. package/dist/cli-commands/bin/index.js +7 -7
  279. package/dist/client-logger/index.d.ts +20 -21
  280. package/dist/client-logger/index.js +5 -2
  281. package/dist/common/index.d.ts +32 -44
  282. package/dist/common/index.js +89 -98
  283. package/dist/components/index.d.ts +86 -272
  284. package/dist/components/index.js +2759 -8547
  285. package/dist/core-events/index.d.ts +16 -7
  286. package/dist/core-events/index.js +5 -5
  287. package/dist/core-server/index.d.ts +95 -26
  288. package/dist/core-server/index.js +1675 -408
  289. package/dist/core-server/presets/common-manager.js +837 -1335
  290. package/dist/core-server/presets/common-override-preset.js +12 -10
  291. package/dist/core-server/presets/common-preset.js +100 -282
  292. package/dist/create/bin/index.js +7 -7
  293. package/dist/create/index.js +15 -15
  294. package/dist/csf/csf-utils.d.ts +1 -1
  295. package/dist/csf/index.d.ts +6 -6
  296. package/dist/csf/index.js +90 -159
  297. package/dist/csf-tools/index.d.ts +66 -54
  298. package/dist/csf-tools/index.js +19 -17
  299. package/dist/docs-tools/index.d.ts +332 -16
  300. package/dist/docs-tools/index.js +3 -3
  301. package/dist/highlight/index.d.ts +1 -1
  302. package/dist/instrumenter/index.d.ts +5 -5
  303. package/dist/instrumenter/index.js +31 -19
  304. package/dist/manager/_manager-chunks/{globals-runtime-BvM-NY2g.js → globals-runtime-B4NRbNSS.js} +638 -1731
  305. package/dist/{preview/_chunks/runtime-CqHxptiK.js → manager/_manager-chunks/globals-runtime-BC43T1rL.js} +3413 -173
  306. package/dist/manager/_manager-chunks/{globals-runtime-qKvCZHFY.js → globals-runtime-BJ6EZqH7.js} +1035 -623
  307. package/dist/manager/_manager-chunks/{globals-runtime-Rp_zjGnh.js → globals-runtime-BfXaq_CP.js} +2 -2
  308. package/dist/manager/_manager-chunks/{globals-runtime-C02fvgcd.js → globals-runtime-BkSn_Jpe.js} +411 -379
  309. package/dist/manager/_manager-chunks/{globals-runtime-eLPTIfX-.js → globals-runtime-BnQ7i5wq.js} +232 -370
  310. package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
  311. package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
  312. package/dist/manager/_manager-chunks/globals-runtime-CBviMKtt.js +446 -0
  313. package/dist/manager/_manager-chunks/globals-runtime-CS41oTca.js +1808 -0
  314. package/dist/manager/_manager-chunks/{globals-runtime-BmphMP6z.js → globals-runtime-Cisw9IIE.js} +11 -11
  315. package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
  316. package/dist/manager/_manager-chunks/{globals-runtime-FC201B7s.js → globals-runtime-DCmvKMN5.js} +2 -1
  317. package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
  318. package/dist/manager/_manager-chunks/{globals-runtime-DpNYC-qi.js → globals-runtime-DpvE_zRs.js} +1013 -782
  319. package/dist/manager/_manager-chunks/globals-runtime-Me9Bl-sx.js +156 -0
  320. package/dist/manager/_manager-chunks/globals-runtime-nQMRiA0J.js +19 -0
  321. package/dist/manager/_manager-chunks/globals-runtime-oRjPg2jY.js +8935 -0
  322. package/dist/manager/_manager-chunks/{globals-runtime-sGpNlIJ1.js → globals-runtime-wV08sCKl.js} +715 -620
  323. package/dist/manager/_manager-chunks/{runtime-cp5pazY2.js → runtime-4OQZWibO.js} +1717 -1536
  324. package/dist/manager/_manager-chunks/runtime-BYxbyNm0.js +201 -0
  325. package/dist/manager/_manager-chunks/{runtime-EITvVbkG.js → runtime-BdGkqNEt.js} +1 -2
  326. package/dist/manager/_manager-chunks/runtime-CM4Z8aKR.js +735 -0
  327. package/dist/manager/_manager-chunks/{runtime-eDVAYF7N.js → runtime-Cjo1UL1u.js} +57 -76
  328. package/dist/manager/_manager-chunks/runtime-Cx1-wr6J.js +294 -0
  329. package/dist/manager/_manager-chunks/{runtime-BhkT2CXl.js → runtime-Cxe_uJRb.js} +220 -406
  330. package/dist/manager/_manager-chunks/runtime-D702FFTO.js +551 -0
  331. package/dist/manager/_manager-chunks/{runtime-D94Vq3oR.js → runtime-DnWFp6Zw.js} +8 -534
  332. package/dist/manager/_manager-chunks/{runtime-D0UOWx0U.js → runtime-DoYPE6g6.js} +232 -158
  333. package/dist/manager/_manager-chunks/runtime-P663lpsR.js +528 -0
  334. package/dist/manager/_manager-chunks/{runtime-i-PDAHLR.js → runtime-sppa-0ll.js} +741 -698
  335. package/dist/manager/globals-runtime.js +1 -1
  336. package/dist/manager/globals.d.ts +12 -12
  337. package/dist/manager/globals.js +12 -12
  338. package/dist/manager/runtime.js +1 -1
  339. package/dist/manager-api/index.d.ts +1 -1
  340. package/dist/manager-api/index.js +538 -528
  341. package/dist/manager-errors.d.ts +1 -1
  342. package/dist/manager-errors.js +2 -2
  343. package/dist/mcp/index.d.ts +10 -10
  344. package/dist/mcp/index.js +11 -11
  345. package/dist/mocking-utils/index.d.ts +7 -5
  346. package/dist/mocking-utils/index.js +34 -34
  347. package/dist/mocking-utils/mocker-runtime.js +2 -2
  348. package/dist/next/index.d.ts +231 -0
  349. package/dist/next/index.js +398 -0
  350. package/dist/nextjs-vite/export-mocks/headers/index.js +3 -1
  351. package/dist/nextjs-vite/export-mocks/link/index.d.ts +4 -1
  352. package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +9 -1
  353. package/dist/nextjs-vite/export-mocks/router/index.js +13 -7
  354. package/dist/nextjs-vite/index.d.ts +4 -4
  355. package/dist/nextjs-vite/index.js +10 -5
  356. package/dist/nextjs-vite/node/index.d.ts +2 -2
  357. package/dist/nextjs-vite/node/index.js +7 -7
  358. package/dist/nextjs-vite/node-stand-ins/index.d.ts +68 -0
  359. package/dist/nextjs-vite/node-stand-ins/index.js +145 -0
  360. package/dist/nextjs-vite/preset.js +117 -15
  361. package/dist/nextjs-vite/preview.d.ts +2 -1
  362. package/dist/nextjs-vite/preview.js +1 -1
  363. package/dist/nextjs-vite/vite-plugin/index.d.ts +2 -2
  364. package/dist/nextjs-vite/vite-plugin/index.js +9 -9
  365. package/dist/nextjs-vite-plugin/index.d.ts +2 -3
  366. package/dist/nextjs-vite-plugin/index.js +24 -49
  367. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
  368. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +2 -2
  369. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +2 -2
  370. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +10 -6
  371. package/dist/node-logger/index.d.ts +89 -90
  372. package/dist/node-logger/index.js +11 -12
  373. package/dist/oxc-parser/index.js +15 -14
  374. package/dist/oxc-parser/worker.js +10 -10
  375. package/dist/{manager/_manager-chunks/globals-runtime-8HkdnU2F.js → preview/_chunks/runtime-BYRCSYBN.js} +4440 -179
  376. package/dist/preview/_chunks/{runtime-BZSnICCg.js → runtime-Bvh_rfnQ.js} +29 -64
  377. package/dist/preview/_chunks/{runtime-iXdo8CR8.js → runtime-Cbq5WjbL.js} +772 -418
  378. package/dist/preview/_chunks/{runtime-q3wt0e_N.js → runtime-D2MPrqbU.js} +2 -2
  379. package/dist/preview/_chunks/{runtime-DrTjJkPY.js → runtime-DDEUZops.js} +453 -161
  380. package/dist/preview/_chunks/{runtime-BIzIdDbb.js → runtime-DS0s7U3c.js} +482 -334
  381. package/dist/preview/_chunks/{runtime-CsV4HZPV.js → runtime-DsjyhLpG.js} +397 -176
  382. package/dist/preview/_chunks/{runtime-CxZK_Ln3.js → runtime-Dwi6NFcX.js} +3 -3
  383. package/dist/preview/globals.d.ts +10 -10
  384. package/dist/preview/globals.js +10 -10
  385. package/dist/preview/runtime.js +1 -1
  386. package/dist/preview-api/index.d.ts +3 -3
  387. package/dist/preview-api/index.js +12 -10
  388. package/dist/preview-errors.d.ts +1 -1
  389. package/dist/preview-errors.js +2 -2
  390. package/dist/react/docgen/docgen-worker.js +11 -12
  391. package/dist/react/entry-preview-argtypes.js +1 -1
  392. package/dist/react/entry-preview-docs.js +1 -1
  393. package/dist/react/entry-preview.js +2 -1
  394. package/dist/react/index.d.ts +9 -11
  395. package/dist/react/index.js +8 -6
  396. package/dist/react/preset.js +13 -14
  397. package/dist/react/preview.d.ts +1 -1
  398. package/dist/react/preview.js +5 -4
  399. package/dist/react-native/bin/get-stories.js +12 -12
  400. package/dist/react-native/index.d.ts +48 -47
  401. package/dist/react-native/index.js +64 -249
  402. package/dist/react-native/metro/node.d.ts +3 -3
  403. package/dist/react-native/metro/node.js +10 -9
  404. package/dist/react-native/metro/{withStorybook.d.ts → withForkbook.d.ts} +18 -18
  405. package/dist/react-native/metro/{withStorybook.js → withForkbook.js} +27 -26
  406. package/dist/react-native/preview.js +4 -1
  407. package/dist/react-native/scripts/generate.d.ts +1 -1
  408. package/dist/react-native/scripts/generate.js +8 -8
  409. package/dist/react-native/stub.js +1 -1
  410. package/dist/react-native-theming/index.d.ts +2 -58
  411. package/dist/react-native-theming/index.js +63 -2338
  412. package/dist/react-native-ui/index.d.ts +14 -14
  413. package/dist/react-native-ui/index.js +8 -15
  414. package/dist/react-native-ui-common/index.d.ts +32 -12
  415. package/dist/react-native-ui-common/index.js +26 -31
  416. package/dist/react-vite/index.d.ts +2 -2
  417. package/dist/react-vite/node/index.d.ts +3 -3
  418. package/dist/react-vite/node/index.js +7 -7
  419. package/dist/react-vite/preset.d.ts +3 -1
  420. package/dist/react-vite/preset.js +16 -9
  421. package/dist/router/index.d.ts +80 -3
  422. package/dist/router/index.js +66 -12
  423. package/dist/server-errors.d.ts +1 -1
  424. package/dist/server-errors.js +9 -9
  425. package/dist/shared/open-service/index.d.ts +3 -3
  426. package/dist/shared/open-service/index.js +2 -2
  427. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
  428. package/dist/shared/open-service/toolsets/docs/public.d.ts +28 -28
  429. package/dist/telemetry/index.d.ts +38 -274
  430. package/dist/telemetry/index.js +11 -68
  431. package/dist/test/index.d.ts +2 -2
  432. package/dist/test/index.js +765 -511
  433. package/dist/theming/create.d.ts +1 -1
  434. package/dist/theming/create.js +2 -1
  435. package/dist/theming/index.d.ts +6 -6
  436. package/dist/theming/index.js +41 -16
  437. package/dist/types/index.d.ts +2 -2
  438. package/dist/types/index.js +5 -5
  439. package/dist/viewport/index.d.ts +1 -1
  440. package/package.json +69 -69
  441. package/skills/setup/SKILL.md +14 -0
  442. package/skills/stories/SKILL.md +21 -0
  443. package/skills/write-story/SKILL.md +14 -0
  444. package/template/nextjs-vite/cli/js/Button.jsx +2 -2
  445. package/template/nextjs-vite/cli/js/Button.stories.js +6 -6
  446. package/template/nextjs-vite/cli/js/Configure.mdx +100 -100
  447. package/template/nextjs-vite/cli/js/Header.jsx +1 -1
  448. package/template/nextjs-vite/cli/js/Header.stories.js +2 -2
  449. package/template/nextjs-vite/cli/js/Page.jsx +3 -3
  450. package/template/nextjs-vite/cli/js/Page.stories.js +2 -2
  451. package/template/nextjs-vite/cli/ts/Button.stories.ts +6 -6
  452. package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
  453. package/template/nextjs-vite/cli/ts/Configure.mdx +84 -84
  454. package/template/nextjs-vite/cli/ts/Header.stories.ts +2 -2
  455. package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
  456. package/template/nextjs-vite/cli/ts/Page.stories.ts +2 -2
  457. package/template/nextjs-vite/cli/ts/Page.tsx +3 -3
  458. package/template/react/cli/js/Button.jsx +2 -2
  459. package/template/react/cli/js/Button.stories.js +6 -6
  460. package/template/react/cli/js/Header.jsx +1 -1
  461. package/template/react/cli/js/Header.stories.js +2 -2
  462. package/template/react/cli/js/Page.jsx +3 -3
  463. package/template/react/cli/js/Page.stories.js +2 -2
  464. package/template/react/cli/ts/Button.stories.ts +6 -6
  465. package/template/react/cli/ts/Button.tsx +2 -2
  466. package/template/react/cli/ts/Header.stories.ts +2 -2
  467. package/template/react/cli/ts/Header.tsx +1 -1
  468. package/template/react/cli/ts/Page.stories.ts +2 -2
  469. package/template/react/cli/ts/Page.tsx +3 -3
  470. package/template/react-vite/cli/js/Button.jsx +2 -2
  471. package/template/react-vite/cli/js/Button.stories.js +6 -6
  472. package/template/react-vite/cli/js/Header.jsx +1 -1
  473. package/template/react-vite/cli/js/Header.stories.js +2 -2
  474. package/template/react-vite/cli/js/Page.jsx +3 -3
  475. package/template/react-vite/cli/js/Page.stories.js +2 -2
  476. package/template/react-vite/cli/ts/Button.stories.ts +6 -6
  477. package/template/react-vite/cli/ts/Button.tsx +2 -2
  478. package/template/react-vite/cli/ts/Header.stories.ts +2 -2
  479. package/template/react-vite/cli/ts/Header.tsx +1 -1
  480. package/template/react-vite/cli/ts/Page.stories.ts +2 -2
  481. package/template/react-vite/cli/ts/Page.tsx +3 -3
  482. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  483. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  484. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  485. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  486. package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +0 -1619
  487. package/dist/_browser-chunks/chunk-5P4QA6MY.js +0 -20
  488. package/dist/_browser-chunks/chunk-JMC7AIKT.js +0 -108
  489. package/dist/_node-chunks/builder-manager-VVHYQXCH.js +0 -1661
  490. package/dist/_node-chunks/chunk-2RU7BKEW.js +0 -23
  491. package/dist/_node-chunks/chunk-3BKIBF5S.js +0 -3008
  492. package/dist/_node-chunks/chunk-3T4ZSNPH.js +0 -662
  493. package/dist/_node-chunks/chunk-5DQFEZEA.js +0 -40
  494. package/dist/_node-chunks/chunk-6LMWA44H.js +0 -3837
  495. package/dist/_node-chunks/chunk-BXVYT7SB.js +0 -36
  496. package/dist/_node-chunks/chunk-CQKMLL5J.js +0 -33
  497. package/dist/_node-chunks/chunk-EHUNOMDD.js +0 -52345
  498. package/dist/_node-chunks/chunk-FY6UXW6G.js +0 -11
  499. package/dist/_node-chunks/chunk-GRBLDJCR.js +0 -989
  500. package/dist/_node-chunks/chunk-IDEL2J23.js +0 -23
  501. package/dist/_node-chunks/chunk-JPAZLYJ3.js +0 -29
  502. package/dist/_node-chunks/chunk-MK2KYAI6.js +0 -5414
  503. package/dist/_node-chunks/chunk-NPO45IMH.js +0 -33
  504. package/dist/_node-chunks/chunk-QEQLR22M.js +0 -1877
  505. package/dist/_node-chunks/chunk-RZMQ7S3L.js +0 -92
  506. package/dist/_node-chunks/chunk-SIEXZVCR.js +0 -51
  507. package/dist/_node-chunks/chunk-TEQGGSP7.js +0 -33
  508. package/dist/_node-chunks/chunk-TFCEV2XX.js +0 -155
  509. package/dist/_node-chunks/chunk-UBOGWBEA.js +0 -148
  510. package/dist/_node-chunks/chunk-W4OMYLSP.js +0 -1297
  511. package/dist/_node-chunks/chunk-WAXVSN3O.js +0 -18
  512. package/dist/_node-chunks/chunk-ZMAMXQKP.js +0 -4731
  513. package/dist/_node-chunks/dist-VTSTZKUB.js +0 -16
  514. package/dist/_node-chunks/globby-OEMHPBFY.js +0 -2884
  515. package/dist/_node-chunks/jiti-NFX6UU74.js +0 -3848
  516. package/dist/_node-chunks/lib-MDVARD7W.js +0 -366
  517. package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +0 -22
  518. package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +0 -20
  519. package/dist/_node-chunks/session-id-KIIVOQLR.js +0 -23
  520. package/dist/chunk-BTVrWliM.d.ts +0 -115
  521. package/dist/chunk-BfBzpgct.d.ts +0 -916
  522. package/dist/chunk-BxWufQms.d.ts +0 -142
  523. package/dist/chunk-DaVb55-_.d.ts +0 -124
  524. package/dist/core-server/presets/common-manager.css +0 -170
  525. package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +0 -3389
  526. package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +0 -9766
  527. package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +0 -5357
  528. package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +0 -10463
  529. package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +0 -452
  530. package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +0 -22
  531. package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +0 -998
  532. package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +0 -77
  533. package/dist/preview/_chunks/runtime-BTPtVY1p.js +0 -1102
  534. package/dist/preview/_chunks/runtime-BwSxqk3t.js +0 -63
  535. package/dist/preview/_chunks/runtime-DZToXfvO.js +0 -9767
  536. package/dist/preview/_chunks/runtime-DuHdxMFA.js +0 -387
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ro17f80mg6k from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ro17f80mg6k from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ro17f80mg6k from "node:module";
1
+ import CJS_COMPAT_NODE_URL_wrk1cj8d1xj from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_wrk1cj8d1xj from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_wrk1cj8d1xj from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ro17f80mg6k.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ro17f80mg6k.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ro17f80mg6k.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_wrk1cj8d1xj.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_wrk1cj8d1xj.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_wrk1cj8d1xj.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Forkbook's esbuild configuration
@@ -12,63 +12,61 @@ var require = CJS_COMPAT_NODE_MODULE_ro17f80mg6k.createRequire(import.meta.url);
12
12
  import {
13
13
  UniversalStore,
14
14
  instances
15
- } from "./chunk-OISX4AGQ.js";
15
+ } from "./chunk-NP2JHOFY.js";
16
16
  import {
17
- require_build
18
- } from "./chunk-XGIUVY52.js";
17
+ buildStoryPathMap,
18
+ toUrlPath
19
+ } from "./chunk-GEWVOY3F.js";
19
20
  import {
20
- isI18nPackage,
21
- isRouterPackage,
22
- isStateManagementPackage,
23
- isStylingPackage
24
- } from "./chunk-TFCEV2XX.js";
21
+ require_build
22
+ } from "./chunk-4UTCKJEQ.js";
25
23
  import {
26
24
  leven
27
- } from "./chunk-Q7QNUM5H.js";
25
+ } from "./chunk-4C3ACAHV.js";
28
26
  import {
29
27
  defineToolset
30
- } from "./chunk-BSKFCWQD.js";
28
+ } from "./chunk-5QG6AXK4.js";
31
29
  import {
32
30
  getToolName,
33
31
  toMcpToolName
34
- } from "./chunk-ICPBH3E7.js";
32
+ } from "./chunk-7P67PUU2.js";
35
33
  import {
36
- execa,
34
+ exec,
37
35
  getComponentIdFromEntry,
38
36
  optionalEnvToBoolean,
39
37
  selectComponentEntriesByComponentId
40
- } from "./chunk-MK2KYAI6.js";
38
+ } from "./chunk-53A5CYDK.js";
39
+ import {
40
+ Tag
41
+ } from "./chunk-UUAEW2AR.js";
41
42
  import {
42
43
  getService as getService2,
43
44
  registerService
44
- } from "./chunk-SLWQNBGO.js";
45
+ } from "./chunk-E23GDXG6.js";
45
46
  import {
46
47
  getRegisteredServices,
47
48
  getService
48
- } from "./chunk-4FEANXWU.js";
49
+ } from "./chunk-53PSBDRK.js";
49
50
  import {
50
51
  isEqual,
51
52
  isPlainObject
52
- } from "./chunk-OWNFOGTA.js";
53
- import {
54
- Tag
55
- } from "./chunk-SVTBJ7Q3.js";
53
+ } from "./chunk-XTQQGAUZ.js";
56
54
  import {
57
55
  CHANGE_DETECTION_STATUS_TYPE_ID,
58
56
  UNIVERSAL_STATUS_STORE_OPTIONS,
59
57
  createStatusStore
60
- } from "./chunk-WNZ2UMFM.js";
58
+ } from "./chunk-TGF6Q66I.js";
61
59
  import {
62
60
  invariant
63
- } from "./chunk-34EO2PUT.js";
61
+ } from "./chunk-GQUFGJ4D.js";
64
62
  import {
65
63
  importModule,
66
64
  resolveModulePath,
67
65
  resolvePackageDir
68
- } from "./chunk-F3ZFKBHY.js";
66
+ } from "./chunk-PC57BIYZ.js";
69
67
  import {
70
68
  jsTsSourceExtensions
71
- } from "./chunk-TNJIXE37.js";
69
+ } from "./chunk-7IAYDGYH.js";
72
70
  import {
73
71
  OpenServiceDocgenMissingComponentError,
74
72
  OpenServiceMissingOriginError,
@@ -77,22 +75,19 @@ import {
77
75
  OpenServiceUnknownStoryIdsError,
78
76
  StorybookError,
79
77
  describeUnknownStoryIds
80
- } from "./chunk-U5W53R2J.js";
78
+ } from "./chunk-HGJMP4EI.js";
81
79
  import {
82
80
  require_picocolors
83
- } from "./chunk-2BUPBPFB.js";
81
+ } from "./chunk-HCDG54OG.js";
84
82
  import {
85
83
  errorToErrorLike,
86
84
  reverseIndexToStoriesByFile,
87
85
  toStoryIndexPath
88
- } from "./chunk-XLP2ZKXV.js";
89
- import {
90
- glob
91
- } from "./chunk-ZMAMXQKP.js";
86
+ } from "./chunk-AAK5BBF2.js";
92
87
  import {
93
88
  __commonJS,
94
89
  __toESM
95
- } from "./chunk-CXRU72ET.js";
90
+ } from "./chunk-YMJVSFJT.js";
96
91
 
97
92
  // ../../node_modules/map-or-similar/src/similar.js
98
93
  var require_similar = __commonJS({
@@ -157,10 +152,10 @@ var require_memoizerific = __commonJS({
157
152
  "../../node_modules/memoizerific/src/memoizerific.js"(exports, module) {
158
153
  var MapOrSimilar = require_map_or_similar();
159
154
  module.exports = function(limit) {
160
- var cache5 = new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), lru = [];
155
+ var cache4 = new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), lru = [];
161
156
  return function(fn) {
162
157
  var memoizerific = function() {
163
- var currentCache = cache5, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i;
158
+ var currentCache = cache4, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i;
164
159
  if ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1)
165
160
  throw new Error("Memoizerific functions should always be called with the same number of arguments");
166
161
  for (i = 0; i < argsLengthMinusOne; i++) {
@@ -178,7 +173,7 @@ var require_memoizerific = __commonJS({
178
173
  arg: arguments[argsLengthMinusOne]
179
174
  }, isMemoized ? moveToMostRecentLru(lru, lruPath) : lru.push(lruPath), lru.length > limit && removeCachedResult(lru.shift())), memoizerific.wasMemoized = isMemoized, memoizerific.numArgs = argsLengthMinusOne + 1, fnResult;
180
175
  };
181
- return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache = cache5, memoizerific.lru = lru, memoizerific;
176
+ return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache = cache4, memoizerific.lru = lru, memoizerific;
182
177
  };
183
178
  };
184
179
  function moveToMostRecentLru(lru, lruPath) {
@@ -222,12 +217,12 @@ import { basename, isAbsolute, join, posix, resolve, sep, win32 } from "node:pat
222
217
  import {
223
218
  getDirectoryFromWorkingDir,
224
219
  getProjectRoot,
225
- resolvePathInStorybookCache
220
+ resolvePathInForkbookCache
226
221
  } from "@aussieljk/forkbook/internal/common";
227
222
  import { CLI_COLORS, logger, once } from "@aussieljk/forkbook/internal/node-logger";
228
223
  import { relative } from "pathe";
229
224
  import { dedent } from "ts-dedent";
230
- var cacheDir = resolvePathInStorybookCache("", "ignored-sub").split("ignored-sub")[0], files = /* @__PURE__ */ new Map(), readFileOnce = async (path3) => {
225
+ var cacheDir = resolvePathInForkbookCache("", "ignored-sub").split("ignored-sub")[0], files = /* @__PURE__ */ new Map(), readFileOnce = async (path3) => {
231
226
  if (files.has(path3))
232
227
  return files.get(path3);
233
228
  {
@@ -263,7 +258,7 @@ async function useStatics(app, options) {
263
258
  }), staticDirs.map((dir) => {
264
259
  try {
265
260
  let { staticDir, staticPath, targetEndpoint } = mapStaticDir(dir, options.configDir);
266
- if (!targetEndpoint.startsWith("/sb-") && !staticDir.startsWith(cacheDir)) {
261
+ if (!targetEndpoint.startsWith("/fb-") && !staticDir.startsWith(cacheDir)) {
267
262
  let relativeStaticDir = relative(getProjectRoot(), staticDir);
268
263
  logger.debug(
269
264
  `Serving static files from ${CLI_COLORS.info(relativeStaticDir)} at ${CLI_COLORS.info(targetEndpoint)}`
@@ -282,8 +277,8 @@ async function useStatics(app, options) {
282
277
  });
283
278
  }
284
279
  var sirvWorkaround = (dir, opts = {}) => (req, res, next) => {
285
- let originalParsedUrl = req._parsedUrl, maybeNext = next ? () => {
286
- req._parsedUrl = originalParsedUrl, next();
280
+ let polkaReq = req, originalParsedUrl = polkaReq._parsedUrl, maybeNext = next ? () => {
281
+ polkaReq._parsedUrl = originalParsedUrl, next();
287
282
  } : void 0;
288
283
  (0, import_sirv.default)(dir, { dev: !0, etag: !0, extensions: [], ...opts })(req, res, maybeNext);
289
284
  }, parseStaticDir = (arg) => {
@@ -308,7 +303,7 @@ import { isAbsolute as isAbsolute2, join as join2 } from "node:path";
308
303
  import { pathToFileURL } from "node:url";
309
304
  import { MissingBuilderError } from "@aussieljk/forkbook/internal/server-errors";
310
305
  async function getManagerBuilder() {
311
- return await import("./builder-manager-VVHYQXCH.js");
306
+ return await import("./builder-manager-S5UUKVOR.js");
312
307
  }
313
308
  async function getPreviewBuilder(resolvedPreviewBuilder) {
314
309
  let packageJson = join2(resolvedPreviewBuilder, "package.json");
@@ -462,12 +457,12 @@ function hasMdxRef(entry) {
462
457
  return typeof entry?.mdx?.$ref == "string";
463
458
  }
464
459
  function createDiskLoader(outputDir) {
465
- let cache5 = /* @__PURE__ */ new Map();
460
+ let cache4 = /* @__PURE__ */ new Map();
466
461
  return (relativePath) => {
467
- let pending = cache5.get(relativePath);
462
+ let pending = cache4.get(relativePath);
468
463
  return pending || (pending = readFile3(join4(outputDir, "manifests", relativePath), "utf8").then(
469
464
  (raw) => JSON.parse(raw)
470
- ), cache5.set(relativePath, pending)), pending;
465
+ ), cache4.set(relativePath, pending)), pending;
471
466
  };
472
467
  }
473
468
  function createServiceLoader(mdxPayloads) {
@@ -549,128 +544,384 @@ async function loadMdxPayloadsFromServiceIfNeeded(manifests, docsManifest) {
549
544
  }
550
545
 
551
546
  // src/core-server/utils/manifests/render-components-manifest.ts
552
- import path from "node:path";
553
547
  import { groupBy } from "@aussieljk/forkbook/internal/common";
548
+
549
+ // src/core-server/utils/manifests/components-manifest-cards.ts
550
+ import path from "node:path";
554
551
  function storyEntries(stories) {
555
552
  return Array.isArray(stories) ? stories : Object.values(stories ?? {});
556
553
  }
557
- function renderComponentsManifest(manifest, docsManifest) {
558
- let entries = Object.entries(manifest?.components ?? {}).sort(
559
- (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
560
- ), docsEntries = Object.entries(docsManifest?.docs ?? {}).sort(
561
- (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
562
- ), analyses = entries.map(([, c]) => analyzeComponent(c)), docsAnalyses = docsEntries.map(([, d]) => analyzeDoc(d)), attachedDocs = analyses.reduce((sum, a) => sum + a.totalDocs, 0), attachedDocsWithError = analyses.reduce((sum, a) => sum + a.docsErrors, 0), unattachedDocsWithError = docsAnalyses.filter((a) => a.hasError).length, totals = {
563
- components: entries.length,
564
- componentsWithApiError: analyses.filter((a) => a.hasApiError).length,
565
- infos: analyses.filter((a) => a.hasWarns).length,
566
- stories: analyses.reduce((sum, a) => sum + a.totalStories, 0),
567
- storyErrors: analyses.reduce((sum, a) => sum + a.storyErrors, 0),
568
- storyWarnings: analyses.reduce((sum, a) => sum + a.storyWarnings, 0),
569
- componentsWithoutApi: analyses.filter((a) => a.api.kind === "none").length,
570
- docs: docsEntries.length + attachedDocs,
571
- docsWithError: unattachedDocsWithError + attachedDocsWithError
572
- }, activeEngine = manifest?.meta?.docgen ?? "react-component-meta", durationMs = manifest?.meta?.durationMs ?? 0, allPill = '<a class="filter-pill all" data-k="all" href="#filter-all">All</a>', compErrorsPill = totals.componentsWithApiError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithApiError}/${totals.components} API ${plural(totals.componentsWithApiError, "error")}</a>` : totals.components > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>` : "", compInfosPill = totals.infos > 0 ? `<a class="filter-pill info" data-k="infos" href="#filter-infos">${totals.infos}/${totals.components} ${plural(totals.infos, "info", "infos")}</a>` : "", storiesPill = totals.storyErrors > 0 ? `<a class="filter-pill err" data-k="story-errors" href="#filter-story-errors">${totals.storyErrors}/${totals.stories} story errors</a>` : totals.stories > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.stories} ${plural(totals.stories, "story", "stories")} ok</span>` : "", snippetWarningsPill = totals.storyWarnings > 0 ? `<a class="filter-pill info" data-k="story-warnings" href="#filter-story-warnings">${totals.storyWarnings}/${totals.stories} incomplete snippets</a>` : "", noApiPill = totals.componentsWithoutApi > 0 ? `<a class="filter-pill" data-k="no-api" href="#filter-no-api">${totals.componentsWithoutApi}/${totals.components} without API description</a>` : "", docsPill = totals.docs > 0 ? totals.docsWithError > 0 ? `<a class="filter-pill info" data-k="docs" href="#filter-docs">${totals.docsWithError}/${totals.docs} doc ${plural(totals.docsWithError, "error")}</a>` : `<a class="filter-pill ok" data-k="docs" href="#filter-docs">${totals.docs} ${plural(totals.docs, "doc")} ok</a>` : "", grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`, key)).join(""), docsGrid = docsEntries.map(([key, d], idx) => renderDocCard(key, d, `doc-${idx}`)).join(""), errorGroups = Object.entries(
573
- groupBy(
574
- entries.map(([, it]) => it).filter((it) => it.error),
575
- (manifest2) => manifest2.error?.name ?? "Error"
576
- )
577
- ).sort(([, a], [, b]) => b.length - a.length), errorGroupsHTML = errorGroups.map(([error, grouped]) => {
578
- let id = error.toLowerCase().replace(/[^a-z0-9]+/g, "-"), headerText = `${esc(error)}`, cards = grouped.map((manifest2, id2) => renderComponentCard(manifest2.id, manifest2, `error-${id2}`)).join("");
579
- return `
580
- <section class="group">
581
- <input id="${id}-toggle" class="group-tg" type="checkbox" hidden />
582
- <label for="${id}-toggle" class="group-header">
583
- <span class="caret">\u25B8</span>
584
- <span class="group-title">${headerText}</span>
585
- <span class="group-count">${grouped.length}</span>
586
- </label>
587
- <div class="group-cards">${cards}</div>
588
- </section>
589
- `;
590
- }).join("");
591
- return `<!doctype html>
592
- <html lang="en">
593
- <head>
594
- <meta charset="utf-8" />
595
- <meta name="viewport" content="width=device-width, initial-scale=1" />
596
- <title>Components Manifest</title>
597
- <style>
598
- :root {
599
- --bg: #0b0c10;
600
- --panel: #121318;
601
- --muted: #9aa0a6;
602
- --fg: #e8eaed;
603
- --ok: #22c55e;
604
- --info: #1e88e5;
605
- --err: #c62828;
606
- --ok-bg: #0c1a13;
607
- --info-bg: #0c1624;
608
- --err-bg: #1a0e0e;
609
- --chip: #1f2330;
610
- --border: #2b2f3a;
611
- --link: #8ab4f8;
612
- --active-ring: 1px; /* 1px active ring for pills and toggles */
613
- }
614
-
615
- * {
616
- box-sizing: border-box;
617
- }
618
-
619
- html,
620
- body {
621
- margin: 0;
622
- background: var(--bg);
623
- color: var(--fg);
624
- font: 14px/1.5 system-ui,
625
- -apple-system,
626
- Segoe UI,
627
- Roboto,
628
- Ubuntu,
629
- Cantarell,
630
- 'Helvetica Neue',
631
- Arial,
632
- 'Noto Sans';
633
- }
634
-
635
- .wrap {
636
- max-width: 1100px;
637
- margin: 0 auto;
638
- padding: 16px 20px;
639
- }
554
+ var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c] ?? c), plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
555
+ function analyzeComponent(c) {
556
+ let api = resolveComponentApi(c), hasApiError = api.kind === "error", warns = [];
557
+ c.description?.trim() || warns.push("No description found. Write a jsdoc comment such as /** Component description */."), c.import?.trim() || warns.push(
558
+ `Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
559
+ );
560
+ let allStories = storyEntries(c.stories), totalStories = allStories.length, storyErrors = allStories.filter((e) => !!e?.error).length, storyWarnings = allStories.filter((e) => !!e?.warning).length, storyOk = totalStories - storyErrors, docsEntries = c.docs ? Object.values(c.docs) : [], totalDocs = docsEntries.length, docsErrors = docsEntries.filter((d) => !!d?.error).length, docsOk = totalDocs - docsErrors, hasAnyError = hasApiError || storyErrors > 0 || docsErrors > 0;
561
+ return {
562
+ api,
563
+ hasApiError,
564
+ hasAnyError,
565
+ hasWarns: warns.length > 0,
566
+ warns,
567
+ totalStories,
568
+ storyErrors,
569
+ storyWarnings,
570
+ storyOk,
571
+ totalDocs,
572
+ docsErrors,
573
+ docsOk
574
+ };
575
+ }
576
+ function analyzeDoc(d) {
577
+ return {
578
+ hasError: !!d.error
579
+ };
580
+ }
581
+ function note(title, bodyHTML, kind) {
582
+ return `
583
+ <div class="note ${kind}">
584
+ <div class="note-title">${esc(title)}</div>
585
+ <div class="note-body">${bodyHTML}</div>
586
+ </div>`;
587
+ }
588
+ function renderDocCard(key, d, id) {
589
+ let a = analyzeDoc(d), statusDot = a.hasError ? "dot-err" : "dot-ok", slug = `${id}-${(d.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, errorBadge = a.hasError ? `<label for="${slug}-err" class="badge err as-toggle">error</label>` : "", contentBadge = d.content ? `<label for="${slug}-content" class="badge ok as-toggle">view content</label>` : "";
590
+ return `
591
+ <article
592
+ class="card is-doc ${a.hasError ? "has-doc-error" : "no-doc-error"}"
593
+ role="listitem"
594
+ aria-label="${esc(d.name || key)}">
595
+ <div class="head">
596
+ <div class="title">
597
+ <h2><span class="status-dot ${statusDot}"></span> ${esc(d.title || d.name || key)}</h2>
598
+ <div class="badges">
599
+ ${errorBadge}
600
+ ${contentBadge}
601
+ </div>
602
+ </div>
603
+ <div class="meta" title="${esc(d.path ?? d.id)}">${d.path ? `${esc(d.id)} \xB7 ${esc(d.path)}` : esc(d.id)}</div>
604
+ ${d.summary ? `<div>${esc(d.summary)}</div>` : ""}
605
+ </div>
640
606
 
641
- header {
642
- position: sticky;
643
- top: 0;
644
- backdrop-filter: blur(6px);
645
- background: color-mix(in srgb, var(--bg) 84%, transparent);
646
- border-bottom: 1px solid var(--border);
647
- z-index: 10;
648
- }
607
+ <!-- Hidden toggles must be siblings BEFORE .panels -->
608
+ ${a.hasError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
609
+ ${d.content ? `<input id="${slug}-content" class="tg tg-content" type="checkbox" hidden />` : ""}
649
610
 
650
- h1 {
651
- font-size: 20px;
652
- margin: 0 0 6px;
653
- }
611
+ <div class="panels">
612
+ ${a.hasError ? `
613
+ <div class="panel panel-err">
614
+ <div class="note err">
615
+ <div class="note-title">${esc(d.error?.name || "Error")}</div>
616
+ <div class="note-body"><pre><code>${esc(d.error?.message || "Unknown error")}</code></pre></div>
617
+ </div>
618
+ </div>` : ""}
619
+ ${d.content ? `
620
+ <div class="panel panel-content">
621
+ <div class="mdx-content">
622
+ <pre><code>${esc(d.content)}</code></pre>
623
+ </div>
624
+ </div>` : ""}
625
+ </div>
626
+ </article>`;
627
+ }
628
+ function renderComponentCard(key, c, id, anchorId) {
629
+ let a = analyzeComponent(c), statusDot = a.hasAnyError ? "dot-err" : "dot-ok", allStories = storyEntries(c.stories), errorStories = allStories.filter((ex) => !!ex?.error), okStories = allStories.filter((ex) => !ex?.error), subcomponentEntries = Object.entries(c.subcomponents ?? {}), allDocs = c.docs ? Object.values(c.docs) : [], errorDocs = allDocs.filter((d) => !!d?.error), okDocs = allDocs.filter((d) => !d?.error), slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, { api } = a, primaryBadge = api.kind === "error" ? `<label for="${slug}-err" class="badge err as-toggle">API error</label>` : api.kind === "markdown" ? `<label for="${slug}-props" class="badge ok as-toggle">API description</label>` : api.kind === "props" ? `<label for="${slug}-props" class="badge ok as-toggle">${api.entries.length} ${plural(api.entries.length, "prop type")}</label>` : '<span class="badge">no API description</span>', infosBadge = a.hasWarns ? `<label for="${slug}-info" class="badge info as-toggle">${a.warns.length} ${plural(a.warns.length, "info", "infos")}</label>` : "", storiesBadge = a.totalStories > 0 ? `<label for="${slug}-stories" class="badge ${a.storyErrors > 0 ? "err" : "ok"} as-toggle">${a.storyErrors > 0 ? `${a.storyErrors}/${a.totalStories} story errors` : `${a.totalStories} ${plural(a.totalStories, "story", "stories")}`}${a.storyWarnings > 0 ? ` \xB7 ${a.storyWarnings} incomplete` : ""}</label>` : "", docsBadge = a.totalDocs > 0 ? `<label for="${slug}-docs" class="badge ${a.docsErrors > 0 ? "err" : "ok"} as-toggle">${a.docsErrors > 0 ? `${a.docsErrors}/${a.totalDocs} doc errors` : `${a.totalDocs} ${plural(a.totalDocs, "doc")}`}</label>` : "", subcomponentsBadge = subcomponentEntries.length > 0 ? `<label for="${slug}-subcomponents" class="badge ok as-toggle">${subcomponentEntries.length} ${plural(subcomponentEntries.length, "subcomponent")}</label>` : "", apiPanel = api.kind === "markdown" ? `
630
+ <div class="panel panel-props">
631
+ <div class="note ok">
632
+ <div class="row">
633
+ <span class="ex-name">API description</span>
634
+ ${c.renderer ? `<span class="badge ok">${esc(c.renderer)}</span>` : ""}
635
+ </div>
636
+ <pre><code>${esc(api.markdown)}</code></pre>
637
+ </div>
638
+ </div>` : api.kind === "props" ? `
639
+ <div class="panel panel-props">
640
+ <div class="note ok">
641
+ <div class="row">
642
+ <span class="ex-name">Prop types <small>(${api.engine})</small></span>
643
+ <span class="badge ok">${api.entries.length} ${plural(api.entries.length, "prop type")}</span>
644
+ </div>
645
+ <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}</code></pre>
646
+ <pre><code>Props:</code></pre>
647
+ <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>
648
+ </div>
649
+ </div>` : "", tags = c.jsDocTags && typeof c.jsDocTags == "object" ? Object.entries(c.jsDocTags).flatMap(
650
+ ([k, v10]) => (Array.isArray(v10) ? v10 : [v10]).map(
651
+ (val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
652
+ )
653
+ ).join("") : "";
654
+ return `
655
+ <article
656
+ ${anchorId ? `id="${esc(anchorId)}"` : ""}
657
+ class="card
658
+ ${a.hasApiError ? "has-error" : "no-error"}
659
+ ${a.hasWarns ? "has-info" : "no-info"}
660
+ ${a.storyErrors ? "has-story-error" : "no-story-error"}
661
+ ${a.storyWarnings ? "has-story-warning" : "no-story-warning"}
662
+ ${api.kind === "none" ? "missing-api" : ""}
663
+ ${a.docsErrors ? "has-doc-error" : "no-doc-error"}"
664
+ role="listitem"
665
+ aria-label="${esc(c.name || key)}">
666
+ <div class="head">
667
+ <div class="title">
668
+ <h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
669
+ <div class="badges">
670
+ ${primaryBadge}
671
+ ${infosBadge}
672
+ ${storiesBadge}
673
+ ${docsBadge}
674
+ ${subcomponentsBadge}
675
+ </div>
676
+ </div>
677
+ <div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
678
+ ${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
679
+ ${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
680
+ ${tags ? `<div class="kv">${tags}</div>` : ""}
681
+ </div>
654
682
 
655
- .summary {
656
- display: flex;
657
- gap: 12px;
658
- flex-wrap: wrap;
659
- align-items: center;
660
- }
683
+ <!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
684
+ ${api.kind === "error" ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
685
+ ${a.hasWarns ? `<input id="${slug}-info" class="tg tg-info" type="checkbox" hidden />` : ""}
686
+ ${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
687
+ ${a.totalDocs > 0 ? `<input id="${slug}-docs" class="tg tg-docs" type="checkbox" hidden />` : ""}
688
+ ${subcomponentEntries.length > 0 ? `<input id="${slug}-subcomponents" class="tg tg-subcomponents" type="checkbox" hidden />` : ""}
689
+ ${apiPanel ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
661
690
 
662
- /* Top filter pills */
663
- .filter-pill {
664
- display: inline-flex;
665
- align-items: center;
666
- gap: 6px;
667
- padding: 6px 12px;
668
- border: 1px solid var(--border);
669
- border-radius: 999px;
670
- background: var(--panel);
671
- text-decoration: none;
672
- cursor: pointer;
673
- user-select: none;
691
+ <div class="panels">
692
+ ${api.kind === "error" ? `
693
+ <div class="panel panel-err">
694
+ ${note("API error", `<pre><code>${esc(api.message)}</code></pre>`, "err")}
695
+ </div>` : ""}
696
+ ${a.hasWarns ? `
697
+ <div class="panel panel-info">
698
+ ${a.warns.map((w) => note("Info", esc(w), "info")).join("")}
699
+ </div>` : ""}
700
+ ${apiPanel}
701
+ ${a.totalStories > 0 ? `
702
+ <div class="panel panel-stories">
703
+ ${errorStories.map(
704
+ (ex) => `
705
+ <div class="note err">
706
+ <div class="row">
707
+ <span class="ex-name">${esc(ex.name)}</span>
708
+ <span class="badge err">story error</span>
709
+ ${ex?.warning ? '<span class="badge info">incomplete example</span>' : ""}
710
+ </div>
711
+ ${ex?.summary ? `<div class="hint">Summary: ${esc(ex.summary)}</div>` : ""}
712
+ ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
713
+ ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
714
+ ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
715
+ ${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
716
+ </div>`
717
+ ).join("")}
718
+
719
+
720
+ ${c.import ? `<div class="note ok">
721
+ <div class="row">
722
+ <span class="ex-name">Imports</span>
723
+ </div>
724
+ <pre><code>${c.import}</code></pre>
725
+ </div>` : ""}
726
+
727
+ ${okStories.map(
728
+ (ex) => `
729
+ <div class="note ok">
730
+ <div class="row">
731
+ <span class="ex-name">${esc(ex.name)}</span>
732
+ <span class="badge ${ex?.warning ? "info" : "ok"}">${ex?.warning ? "incomplete example" : "story ok"}</span>
733
+ </div>
734
+ ${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ""}
735
+ ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
736
+ ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
737
+ ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
738
+ </div>`
739
+ ).join("")}
740
+ </div>` : ""}
741
+ ${a.totalDocs > 0 ? `
742
+ <div class="panel panel-docs">
743
+ ${errorDocs.map(
744
+ (doc) => `
745
+ <div class="note err">
746
+ <div class="row">
747
+ <span class="ex-name">${esc(doc.name)}</span>
748
+ <span class="badge err">doc error</span>
749
+ </div>
750
+ ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
751
+ ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
752
+ ${doc?.error?.message ? `<pre><code>${esc(doc.error.message)}</code></pre>` : ""}
753
+ </div>`
754
+ ).join("")}
755
+ ${okDocs.map(
756
+ (doc) => `
757
+ <div class="note ok">
758
+ <div class="row">
759
+ <span class="ex-name">${esc(doc.name)}</span>
760
+ <span class="badge ok">doc ok</span>
761
+ </div>
762
+ ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
763
+ ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
764
+ ${doc?.content ? `<div class="mdx-content"><pre><code>${esc(doc.content)}</code></pre></div>` : ""}
765
+ </div>`
766
+ ).join("")}
767
+ </div>` : ""}
768
+ ${subcomponentEntries.length > 0 ? `
769
+ <div class="panel panel-subcomponents">
770
+ ${subcomponentEntries.map(
771
+ ([subcomponentName, subcomponent]) => renderSubcomponentNote(subcomponentName, subcomponent)
772
+ ).join("")}
773
+ </div>` : ""}
774
+ </div>
775
+ </article>`;
776
+ }
777
+ var docgenRenderData = (component) => component.reactComponentMeta ? {
778
+ parsed: parseReactComponentMeta(component.reactComponentMeta),
779
+ engine: "react-component-meta",
780
+ filePath: component.reactComponentMeta.filePath,
781
+ exportName: component.reactComponentMeta.exportName
782
+ } : {};
783
+ function resolveComponentApi(component) {
784
+ if (component.error)
785
+ return { kind: "error", message: component.error.message || "Unknown error" };
786
+ let markdown = component.apiDescription?.trim();
787
+ if (markdown)
788
+ return { kind: "markdown", markdown };
789
+ let { parsed, ...source } = docgenRenderData(component), entries = Object.entries(parsed?.props ?? {}).sort(([a], [b]) => a.localeCompare(b));
790
+ return entries.length > 0 ? { kind: "props", entries, ...source } : { kind: "none" };
791
+ }
792
+ function renderPropsCode(entries) {
793
+ return entries.map(([propName, info]) => {
794
+ let description8 = (info?.description ?? "").trim(), type = (info?.type ?? "any").trim(), optional7 = info?.required ? "" : "?", defaultValue = (info?.defaultValue ?? "").trim(), fallback = defaultValue ? ` = ${defaultValue}` : "", doc = ["/**", ...description8.split(`
795
+ `).map((line) => ` * ${line}`), " */"].join(`
796
+ `) + `
797
+ `;
798
+ return `${description8 ? doc : ""}${propName}${optional7}: ${type}${fallback}`;
799
+ }).join(`
800
+
801
+ `);
802
+ }
803
+ function renderSubcomponentNote(subcomponentName, subcomponent) {
804
+ let api = resolveComponentApi(subcomponent), tags = subcomponent.jsDocTags && typeof subcomponent.jsDocTags == "object" ? Object.entries(subcomponent.jsDocTags).flatMap(
805
+ ([key, value]) => (Array.isArray(value) ? value : [value]).map(
806
+ (tagValue) => `<span class="chip">${esc(key)}: ${esc(tagValue)}</span>`
807
+ )
808
+ ).join("") : "", badgeLabel = api.kind === "error" ? "API error" : api.kind === "markdown" ? "API description" : api.kind === "props" ? `${api.entries.length} ${plural(api.entries.length, "prop type")}` : "no API description";
809
+ return `
810
+ <div class="note ${api.kind === "error" ? "err" : "ok"}">
811
+ <div class="row">
812
+ <span class="ex-name">${esc(subcomponentName)}</span>
813
+ <span class="badge ${api.kind === "error" ? "err" : api.kind === "none" ? "" : "ok"}">
814
+ ${badgeLabel}
815
+ </span>
816
+ </div>
817
+ <div class="hint">${esc(subcomponent.path)}</div>
818
+ ${subcomponent.summary ? `<div>${esc(subcomponent.summary)}</div>` : ""}
819
+ ${subcomponent.description ? `<div class="hint">${esc(subcomponent.description)}</div>` : ""}
820
+ ${tags ? `<div class="kv">${tags}</div>` : ""}
821
+ ${subcomponent.import ? `<pre><code>${esc(subcomponent.import)}</code></pre>` : ""}
822
+ ${api.kind === "error" ? `<pre><code>${esc(api.message)}</code></pre>` : ""}
823
+ ${api.kind === "markdown" ? `<pre><code>${esc(api.markdown)}</code></pre>` : ""}
824
+ ${api.kind === "props" ? `
825
+ <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}${api.engine ? ` (${esc(api.engine)})` : ""}</code></pre>
826
+ <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>` : ""}
827
+ </div>
828
+ `;
829
+ }
830
+ var parseReactComponentMeta = (reactComponentMeta) => {
831
+ let props = reactComponentMeta.props ?? {};
832
+ return {
833
+ props: Object.fromEntries(
834
+ Object.entries(props).map(([propName, prop]) => [
835
+ propName,
836
+ {
837
+ description: prop.description,
838
+ type: prop.type?.raw ?? prop.type?.name,
839
+ defaultValue: prop.defaultValue?.value,
840
+ required: prop.required
841
+ }
842
+ ])
843
+ )
844
+ };
845
+ };
846
+
847
+ // src/core-server/utils/manifests/components-manifest-styles.ts
848
+ var componentsManifestCss = `
849
+ :root {
850
+ --bg: #0b0c10;
851
+ --panel: #121318;
852
+ --muted: #9aa0a6;
853
+ --fg: #e8eaed;
854
+ --ok: #22c55e;
855
+ --info: #1e88e5;
856
+ --err: #c62828;
857
+ --ok-bg: #0c1a13;
858
+ --info-bg: #0c1624;
859
+ --err-bg: #1a0e0e;
860
+ --chip: #1f2330;
861
+ --border: #2b2f3a;
862
+ --link: #8ab4f8;
863
+ --active-ring: 1px; /* 1px active ring for pills and toggles */
864
+ }
865
+
866
+ * {
867
+ box-sizing: border-box;
868
+ }
869
+
870
+ html,
871
+ body {
872
+ margin: 0;
873
+ background: var(--bg);
874
+ color: var(--fg);
875
+ font: 14px/1.5 system-ui,
876
+ -apple-system,
877
+ Segoe UI,
878
+ Roboto,
879
+ Ubuntu,
880
+ Cantarell,
881
+ 'Helvetica Neue',
882
+ Arial,
883
+ 'Noto Sans';
884
+ }
885
+
886
+ .wrap {
887
+ max-width: 1100px;
888
+ margin: 0 auto;
889
+ padding: 16px 20px;
890
+ }
891
+
892
+ header {
893
+ position: sticky;
894
+ top: 0;
895
+ backdrop-filter: blur(6px);
896
+ background: color-mix(in srgb, var(--bg) 84%, transparent);
897
+ border-bottom: 1px solid var(--border);
898
+ z-index: 10;
899
+ }
900
+
901
+ h1 {
902
+ font-size: 20px;
903
+ margin: 0 0 6px;
904
+ }
905
+
906
+ .summary {
907
+ display: flex;
908
+ gap: 12px;
909
+ flex-wrap: wrap;
910
+ align-items: center;
911
+ }
912
+
913
+ /* Top filter pills */
914
+ .filter-pill {
915
+ display: inline-flex;
916
+ align-items: center;
917
+ gap: 6px;
918
+ padding: 6px 12px;
919
+ border: 1px solid var(--border);
920
+ border-radius: 999px;
921
+ background: var(--panel);
922
+ text-decoration: none;
923
+ cursor: pointer;
924
+ user-select: none;
674
925
  color: var(--fg);
675
926
  }
676
927
 
@@ -1195,336 +1446,89 @@ function renderComponentsManifest(manifest, docsManifest) {
1195
1446
  overflow-y: auto;
1196
1447
  margin-top: 8px;
1197
1448
  }
1198
- </style>
1199
- </head>
1200
- <body>
1201
- <!-- Hidden targets for the top-level filters -->
1202
- <span id="filter-all"></span>
1203
- <span id="filter-errors"></span>
1204
- <span id="filter-infos"></span>
1205
- <span id="filter-story-errors"></span>
1206
- <span id="filter-story-warnings"></span>
1207
- <span id="filter-no-api"></span>
1208
- <span id="filter-doc-errors"></span>
1209
- <span id="filter-docs"></span>
1210
- <header>
1211
- <div class="wrap">
1212
- <h1>Manifest Debugger</h1>
1213
- <div class="summary">${allPill}${compErrorsPill}${compInfosPill}${noApiPill}${storiesPill}${snippetWarningsPill}${docsPill}</div>
1214
- </div>
1215
- </header>
1216
- <main>
1217
- <div class="wrap">
1218
- <div class="note ok" style="margin-bottom: 16px;">
1219
- Using <code>${esc(activeEngine)}</code>. Generation took <strong>${(durationMs / 1e3).toFixed(1)}s</strong>.
1220
- </div>
1221
- ${grid ? `<h2 class="section-title">Components</h2>
1222
- <div class="grid" role="list">
1223
- ${grid}
1224
- </div>` : ""}
1225
- ${errorGroups.length ? `<div class="error-groups" role="region" aria-label="API error groups">${errorGroupsHTML}</div>` : ""}
1226
- ${docsGrid ? `<h2 class="section-title">Unattached Docs</h2>
1227
- <div class="grid" role="list">
1228
- ${docsGrid}
1229
- </div>` : ""}
1230
- ${!grid && !docsGrid ? '<div class="card"><div class="head"><div class="hint">No components or docs.</div></div></div>' : ""}
1231
- </div>
1232
- </main>
1233
- </body>
1234
- </html> `;
1235
- }
1236
- var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c] ?? c), plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
1237
- function analyzeComponent(c) {
1238
- let api = resolveComponentApi(c), hasApiError = api.kind === "error", warns = [];
1239
- c.description?.trim() || warns.push("No description found. Write a jsdoc comment such as /** Component description */."), c.import?.trim() || warns.push(
1240
- `Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
1241
- );
1242
- let allStories = storyEntries(c.stories), totalStories = allStories.length, storyErrors = allStories.filter((e) => !!e?.error).length, storyWarnings = allStories.filter((e) => !!e?.warning).length, storyOk = totalStories - storyErrors, docsEntries = c.docs ? Object.values(c.docs) : [], totalDocs = docsEntries.length, docsErrors = docsEntries.filter((d) => !!d?.error).length, docsOk = totalDocs - docsErrors, hasAnyError = hasApiError || storyErrors > 0 || docsErrors > 0;
1243
- return {
1244
- api,
1245
- hasApiError,
1246
- hasAnyError,
1247
- hasWarns: warns.length > 0,
1248
- warns,
1249
- totalStories,
1250
- storyErrors,
1251
- storyWarnings,
1252
- storyOk,
1253
- totalDocs,
1254
- docsErrors,
1255
- docsOk
1256
- };
1257
- }
1258
- function analyzeDoc(d) {
1259
- return {
1260
- hasError: !!d.error
1261
- };
1262
- }
1263
- function note(title, bodyHTML, kind) {
1264
- return `
1265
- <div class="note ${kind}">
1266
- <div class="note-title">${esc(title)}</div>
1267
- <div class="note-body">${bodyHTML}</div>
1268
- </div>`;
1269
- }
1270
- function renderDocCard(key, d, id) {
1271
- let a = analyzeDoc(d), statusDot = a.hasError ? "dot-err" : "dot-ok", slug = `${id}-${(d.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, errorBadge = a.hasError ? `<label for="${slug}-err" class="badge err as-toggle">error</label>` : "", contentBadge = d.content ? `<label for="${slug}-content" class="badge ok as-toggle">view content</label>` : "";
1272
- return `
1273
- <article
1274
- class="card is-doc ${a.hasError ? "has-doc-error" : "no-doc-error"}"
1275
- role="listitem"
1276
- aria-label="${esc(d.name || key)}">
1277
- <div class="head">
1278
- <div class="title">
1279
- <h2><span class="status-dot ${statusDot}"></span> ${esc(d.title || d.name || key)}</h2>
1280
- <div class="badges">
1281
- ${errorBadge}
1282
- ${contentBadge}
1283
- </div>
1284
- </div>
1285
- <div class="meta" title="${esc(d.path ?? d.id)}">${d.path ? `${esc(d.id)} \xB7 ${esc(d.path)}` : esc(d.id)}</div>
1286
- ${d.summary ? `<div>${esc(d.summary)}</div>` : ""}
1287
- </div>
1288
-
1289
- <!-- Hidden toggles must be siblings BEFORE .panels -->
1290
- ${a.hasError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
1291
- ${d.content ? `<input id="${slug}-content" class="tg tg-content" type="checkbox" hidden />` : ""}
1292
-
1293
- <div class="panels">
1294
- ${a.hasError ? `
1295
- <div class="panel panel-err">
1296
- <div class="note err">
1297
- <div class="note-title">${esc(d.error?.name || "Error")}</div>
1298
- <div class="note-body"><pre><code>${esc(d.error?.message || "Unknown error")}</code></pre></div>
1299
- </div>
1300
- </div>` : ""}
1301
- ${d.content ? `
1302
- <div class="panel panel-content">
1303
- <div class="mdx-content">
1304
- <pre><code>${esc(d.content)}</code></pre>
1305
- </div>
1306
- </div>` : ""}
1307
- </div>
1308
- </article>`;
1309
- }
1310
- function renderComponentCard(key, c, id, anchorId) {
1311
- let a = analyzeComponent(c), statusDot = a.hasAnyError ? "dot-err" : "dot-ok", allStories = storyEntries(c.stories), errorStories = allStories.filter((ex) => !!ex?.error), okStories = allStories.filter((ex) => !ex?.error), subcomponentEntries = Object.entries(c.subcomponents ?? {}), allDocs = c.docs ? Object.values(c.docs) : [], errorDocs = allDocs.filter((d) => !!d?.error), okDocs = allDocs.filter((d) => !d?.error), slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, { api } = a, primaryBadge = api.kind === "error" ? `<label for="${slug}-err" class="badge err as-toggle">API error</label>` : api.kind === "markdown" ? `<label for="${slug}-props" class="badge ok as-toggle">API description</label>` : api.kind === "props" ? `<label for="${slug}-props" class="badge ok as-toggle">${api.entries.length} ${plural(api.entries.length, "prop type")}</label>` : '<span class="badge">no API description</span>', infosBadge = a.hasWarns ? `<label for="${slug}-info" class="badge info as-toggle">${a.warns.length} ${plural(a.warns.length, "info", "infos")}</label>` : "", storiesBadge = a.totalStories > 0 ? `<label for="${slug}-stories" class="badge ${a.storyErrors > 0 ? "err" : "ok"} as-toggle">${a.storyErrors > 0 ? `${a.storyErrors}/${a.totalStories} story errors` : `${a.totalStories} ${plural(a.totalStories, "story", "stories")}`}${a.storyWarnings > 0 ? ` \xB7 ${a.storyWarnings} incomplete` : ""}</label>` : "", docsBadge = a.totalDocs > 0 ? `<label for="${slug}-docs" class="badge ${a.docsErrors > 0 ? "err" : "ok"} as-toggle">${a.docsErrors > 0 ? `${a.docsErrors}/${a.totalDocs} doc errors` : `${a.totalDocs} ${plural(a.totalDocs, "doc")}`}</label>` : "", subcomponentsBadge = subcomponentEntries.length > 0 ? `<label for="${slug}-subcomponents" class="badge ok as-toggle">${subcomponentEntries.length} ${plural(subcomponentEntries.length, "subcomponent")}</label>` : "", apiPanel = api.kind === "markdown" ? `
1312
- <div class="panel panel-props">
1313
- <div class="note ok">
1314
- <div class="row">
1315
- <span class="ex-name">API description</span>
1316
- ${c.renderer ? `<span class="badge ok">${esc(c.renderer)}</span>` : ""}
1317
- </div>
1318
- <pre><code>${esc(api.markdown)}</code></pre>
1319
- </div>
1320
- </div>` : api.kind === "props" ? `
1321
- <div class="panel panel-props">
1322
- <div class="note ok">
1323
- <div class="row">
1324
- <span class="ex-name">Prop types <small>(${api.engine})</small></span>
1325
- <span class="badge ok">${api.entries.length} ${plural(api.entries.length, "prop type")}</span>
1326
- </div>
1327
- <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}</code></pre>
1328
- <pre><code>Props:</code></pre>
1329
- <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>
1330
- </div>
1331
- </div>` : "", tags = c.jsDocTags && typeof c.jsDocTags == "object" ? Object.entries(c.jsDocTags).flatMap(
1332
- ([k, v10]) => (Array.isArray(v10) ? v10 : [v10]).map(
1333
- (val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
1334
- )
1335
- ).join("") : "";
1336
- return `
1337
- <article
1338
- ${anchorId ? `id="${esc(anchorId)}"` : ""}
1339
- class="card
1340
- ${a.hasApiError ? "has-error" : "no-error"}
1341
- ${a.hasWarns ? "has-info" : "no-info"}
1342
- ${a.storyErrors ? "has-story-error" : "no-story-error"}
1343
- ${a.storyWarnings ? "has-story-warning" : "no-story-warning"}
1344
- ${api.kind === "none" ? "missing-api" : ""}
1345
- ${a.docsErrors ? "has-doc-error" : "no-doc-error"}"
1346
- role="listitem"
1347
- aria-label="${esc(c.name || key)}">
1348
- <div class="head">
1349
- <div class="title">
1350
- <h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
1351
- <div class="badges">
1352
- ${primaryBadge}
1353
- ${infosBadge}
1354
- ${storiesBadge}
1355
- ${docsBadge}
1356
- ${subcomponentsBadge}
1357
- </div>
1358
- </div>
1359
- <div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
1360
- ${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
1361
- ${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
1362
- ${tags ? `<div class="kv">${tags}</div>` : ""}
1363
- </div>
1364
-
1365
- <!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
1366
- ${api.kind === "error" ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
1367
- ${a.hasWarns ? `<input id="${slug}-info" class="tg tg-info" type="checkbox" hidden />` : ""}
1368
- ${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
1369
- ${a.totalDocs > 0 ? `<input id="${slug}-docs" class="tg tg-docs" type="checkbox" hidden />` : ""}
1370
- ${subcomponentEntries.length > 0 ? `<input id="${slug}-subcomponents" class="tg tg-subcomponents" type="checkbox" hidden />` : ""}
1371
- ${apiPanel ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
1372
-
1373
- <div class="panels">
1374
- ${api.kind === "error" ? `
1375
- <div class="panel panel-err">
1376
- ${note("API error", `<pre><code>${esc(api.message)}</code></pre>`, "err")}
1377
- </div>` : ""}
1378
- ${a.hasWarns ? `
1379
- <div class="panel panel-info">
1380
- ${a.warns.map((w) => note("Info", esc(w), "info")).join("")}
1381
- </div>` : ""}
1382
- ${apiPanel}
1383
- ${a.totalStories > 0 ? `
1384
- <div class="panel panel-stories">
1385
- ${errorStories.map(
1386
- (ex) => `
1387
- <div class="note err">
1388
- <div class="row">
1389
- <span class="ex-name">${esc(ex.name)}</span>
1390
- <span class="badge err">story error</span>
1391
- ${ex?.warning ? '<span class="badge info">incomplete example</span>' : ""}
1392
- </div>
1393
- ${ex?.summary ? `<div class="hint">Summary: ${esc(ex.summary)}</div>` : ""}
1394
- ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
1395
- ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
1396
- ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
1397
- ${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
1398
- </div>`
1399
- ).join("")}
1400
-
1401
-
1402
- ${c.import ? `<div class="note ok">
1403
- <div class="row">
1404
- <span class="ex-name">Imports</span>
1405
- </div>
1406
- <pre><code>${c.import}</code></pre>
1407
- </div>` : ""}
1408
-
1409
- ${okStories.map(
1410
- (ex) => `
1411
- <div class="note ok">
1412
- <div class="row">
1413
- <span class="ex-name">${esc(ex.name)}</span>
1414
- <span class="badge ${ex?.warning ? "info" : "ok"}">${ex?.warning ? "incomplete example" : "story ok"}</span>
1415
- </div>
1416
- ${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ""}
1417
- ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
1418
- ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
1419
- ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
1420
- </div>`
1421
- ).join("")}
1422
- </div>` : ""}
1423
- ${a.totalDocs > 0 ? `
1424
- <div class="panel panel-docs">
1425
- ${errorDocs.map(
1426
- (doc) => `
1427
- <div class="note err">
1428
- <div class="row">
1429
- <span class="ex-name">${esc(doc.name)}</span>
1430
- <span class="badge err">doc error</span>
1431
- </div>
1432
- ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
1433
- ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
1434
- ${doc?.error?.message ? `<pre><code>${esc(doc.error.message)}</code></pre>` : ""}
1435
- </div>`
1436
- ).join("")}
1437
- ${okDocs.map(
1438
- (doc) => `
1439
- <div class="note ok">
1440
- <div class="row">
1441
- <span class="ex-name">${esc(doc.name)}</span>
1442
- <span class="badge ok">doc ok</span>
1443
- </div>
1444
- ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
1445
- ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
1446
- ${doc?.content ? `<div class="mdx-content"><pre><code>${esc(doc.content)}</code></pre></div>` : ""}
1447
- </div>`
1448
- ).join("")}
1449
- </div>` : ""}
1450
- ${subcomponentEntries.length > 0 ? `
1451
- <div class="panel panel-subcomponents">
1452
- ${subcomponentEntries.map(
1453
- ([subcomponentName, subcomponent]) => renderSubcomponentNote(subcomponentName, subcomponent)
1454
- ).join("")}
1455
- </div>` : ""}
1456
- </div>
1457
- </article>`;
1458
- }
1459
- var docgenRenderData = (component) => component.reactComponentMeta ? {
1460
- parsed: parseReactComponentMeta(component.reactComponentMeta),
1461
- engine: "react-component-meta",
1462
- filePath: component.reactComponentMeta.filePath,
1463
- exportName: component.reactComponentMeta.exportName
1464
- } : {};
1465
- function resolveComponentApi(component) {
1466
- if (component.error)
1467
- return { kind: "error", message: component.error.message || "Unknown error" };
1468
- let markdown = component.apiDescription?.trim();
1469
- if (markdown)
1470
- return { kind: "markdown", markdown };
1471
- let { parsed, ...source } = docgenRenderData(component), entries = Object.entries(parsed?.props ?? {}).sort(([a], [b]) => a.localeCompare(b));
1472
- return entries.length > 0 ? { kind: "props", entries, ...source } : { kind: "none" };
1473
- }
1474
- function renderPropsCode(entries) {
1475
- return entries.map(([propName, info]) => {
1476
- let description8 = (info?.description ?? "").trim(), type = (info?.type ?? "any").trim(), optional7 = info?.required ? "" : "?", defaultValue = (info?.defaultValue ?? "").trim(), fallback = defaultValue ? ` = ${defaultValue}` : "", doc = ["/**", ...description8.split(`
1477
- `).map((line) => ` * ${line}`), " */"].join(`
1478
- `) + `
1479
1449
  `;
1480
- return `${description8 ? doc : ""}${propName}${optional7}: ${type}${fallback}`;
1481
- }).join(`
1482
1450
 
1483
- `);
1484
- }
1485
- function renderSubcomponentNote(subcomponentName, subcomponent) {
1486
- let api = resolveComponentApi(subcomponent), tags = subcomponent.jsDocTags && typeof subcomponent.jsDocTags == "object" ? Object.entries(subcomponent.jsDocTags).flatMap(
1487
- ([key, value]) => (Array.isArray(value) ? value : [value]).map(
1488
- (tagValue) => `<span class="chip">${esc(key)}: ${esc(tagValue)}</span>`
1451
+ // src/core-server/utils/manifests/render-components-manifest.ts
1452
+ function renderComponentsManifest(manifest, docsManifest) {
1453
+ let entries = Object.entries(manifest?.components ?? {}).sort(
1454
+ (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
1455
+ ), docsEntries = Object.entries(docsManifest?.docs ?? {}).sort(
1456
+ (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
1457
+ ), analyses = entries.map(([, c]) => analyzeComponent(c)), docsAnalyses = docsEntries.map(([, d]) => analyzeDoc(d)), attachedDocs = analyses.reduce((sum, a) => sum + a.totalDocs, 0), attachedDocsWithError = analyses.reduce((sum, a) => sum + a.docsErrors, 0), unattachedDocsWithError = docsAnalyses.filter((a) => a.hasError).length, totals = {
1458
+ components: entries.length,
1459
+ componentsWithApiError: analyses.filter((a) => a.hasApiError).length,
1460
+ infos: analyses.filter((a) => a.hasWarns).length,
1461
+ stories: analyses.reduce((sum, a) => sum + a.totalStories, 0),
1462
+ storyErrors: analyses.reduce((sum, a) => sum + a.storyErrors, 0),
1463
+ storyWarnings: analyses.reduce((sum, a) => sum + a.storyWarnings, 0),
1464
+ componentsWithoutApi: analyses.filter((a) => a.api.kind === "none").length,
1465
+ docs: docsEntries.length + attachedDocs,
1466
+ docsWithError: unattachedDocsWithError + attachedDocsWithError
1467
+ }, activeEngine = manifest?.meta?.docgen ?? "react-component-meta", durationMs = manifest?.meta?.durationMs ?? 0, allPill = '<a class="filter-pill all" data-k="all" href="#filter-all">All</a>', compErrorsPill = totals.componentsWithApiError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithApiError}/${totals.components} API ${plural(totals.componentsWithApiError, "error")}</a>` : totals.components > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>` : "", compInfosPill = totals.infos > 0 ? `<a class="filter-pill info" data-k="infos" href="#filter-infos">${totals.infos}/${totals.components} ${plural(totals.infos, "info", "infos")}</a>` : "", storiesPill = totals.storyErrors > 0 ? `<a class="filter-pill err" data-k="story-errors" href="#filter-story-errors">${totals.storyErrors}/${totals.stories} story errors</a>` : totals.stories > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.stories} ${plural(totals.stories, "story", "stories")} ok</span>` : "", snippetWarningsPill = totals.storyWarnings > 0 ? `<a class="filter-pill info" data-k="story-warnings" href="#filter-story-warnings">${totals.storyWarnings}/${totals.stories} incomplete snippets</a>` : "", noApiPill = totals.componentsWithoutApi > 0 ? `<a class="filter-pill" data-k="no-api" href="#filter-no-api">${totals.componentsWithoutApi}/${totals.components} without API description</a>` : "", docsPill = totals.docs > 0 ? totals.docsWithError > 0 ? `<a class="filter-pill info" data-k="docs" href="#filter-docs">${totals.docsWithError}/${totals.docs} doc ${plural(totals.docsWithError, "error")}</a>` : `<a class="filter-pill ok" data-k="docs" href="#filter-docs">${totals.docs} ${plural(totals.docs, "doc")} ok</a>` : "", grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`, key)).join(""), docsGrid = docsEntries.map(([key, d], idx) => renderDocCard(key, d, `doc-${idx}`)).join(""), errorGroups = Object.entries(
1468
+ groupBy(
1469
+ entries.map(([, it]) => it).filter((it) => it.error),
1470
+ (manifest2) => manifest2.error?.name ?? "Error"
1489
1471
  )
1490
- ).join("") : "", badgeLabel = api.kind === "error" ? "API error" : api.kind === "markdown" ? "API description" : api.kind === "props" ? `${api.entries.length} ${plural(api.entries.length, "prop type")}` : "no API description";
1491
- return `
1492
- <div class="note ${api.kind === "error" ? "err" : "ok"}">
1493
- <div class="row">
1494
- <span class="ex-name">${esc(subcomponentName)}</span>
1495
- <span class="badge ${api.kind === "error" ? "err" : api.kind === "none" ? "" : "ok"}">
1496
- ${badgeLabel}
1497
- </span>
1498
- </div>
1499
- <div class="hint">${esc(subcomponent.path)}</div>
1500
- ${subcomponent.summary ? `<div>${esc(subcomponent.summary)}</div>` : ""}
1501
- ${subcomponent.description ? `<div class="hint">${esc(subcomponent.description)}</div>` : ""}
1502
- ${tags ? `<div class="kv">${tags}</div>` : ""}
1503
- ${subcomponent.import ? `<pre><code>${esc(subcomponent.import)}</code></pre>` : ""}
1504
- ${api.kind === "error" ? `<pre><code>${esc(api.message)}</code></pre>` : ""}
1505
- ${api.kind === "markdown" ? `<pre><code>${esc(api.markdown)}</code></pre>` : ""}
1506
- ${api.kind === "props" ? `
1507
- <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}${api.engine ? ` (${esc(api.engine)})` : ""}</code></pre>
1508
- <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>` : ""}
1472
+ ).sort(([, a], [, b]) => b.length - a.length), errorGroupsHTML = errorGroups.map(([error, grouped]) => {
1473
+ let id = error.toLowerCase().replace(/[^a-z0-9]+/g, "-"), headerText = `${esc(error)}`, cards = grouped.map((manifest2, id2) => renderComponentCard(manifest2.id, manifest2, `error-${id2}`)).join("");
1474
+ return `
1475
+ <section class="group">
1476
+ <input id="${id}-toggle" class="group-tg" type="checkbox" hidden />
1477
+ <label for="${id}-toggle" class="group-header">
1478
+ <span class="caret">\u25B8</span>
1479
+ <span class="group-title">${headerText}</span>
1480
+ <span class="group-count">${grouped.length}</span>
1481
+ </label>
1482
+ <div class="group-cards">${cards}</div>
1483
+ </section>
1484
+ `;
1485
+ }).join("");
1486
+ return `<!doctype html>
1487
+ <html lang="en">
1488
+ <head>
1489
+ <meta charset="utf-8" />
1490
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
1491
+ <title>Components Manifest</title>
1492
+ <style>
1493
+ ${componentsManifestCss}
1494
+ </style>
1495
+ </head>
1496
+ <body>
1497
+ <!-- Hidden targets for the top-level filters -->
1498
+ <span id="filter-all"></span>
1499
+ <span id="filter-errors"></span>
1500
+ <span id="filter-infos"></span>
1501
+ <span id="filter-story-errors"></span>
1502
+ <span id="filter-story-warnings"></span>
1503
+ <span id="filter-no-api"></span>
1504
+ <span id="filter-doc-errors"></span>
1505
+ <span id="filter-docs"></span>
1506
+ <header>
1507
+ <div class="wrap">
1508
+ <h1>Manifest Debugger</h1>
1509
+ <div class="summary">${allPill}${compErrorsPill}${compInfosPill}${noApiPill}${storiesPill}${snippetWarningsPill}${docsPill}</div>
1510
+ </div>
1511
+ </header>
1512
+ <main>
1513
+ <div class="wrap">
1514
+ <div class="note ok" style="margin-bottom: 16px;">
1515
+ Using <code>${esc(activeEngine)}</code>. Generation took <strong>${(durationMs / 1e3).toFixed(1)}s</strong>.
1509
1516
  </div>
1510
- `;
1517
+ ${grid ? `<h2 class="section-title">Components</h2>
1518
+ <div class="grid" role="list">
1519
+ ${grid}
1520
+ </div>` : ""}
1521
+ ${errorGroups.length ? `<div class="error-groups" role="region" aria-label="API error groups">${errorGroupsHTML}</div>` : ""}
1522
+ ${docsGrid ? `<h2 class="section-title">Unattached Docs</h2>
1523
+ <div class="grid" role="list">
1524
+ ${docsGrid}
1525
+ </div>` : ""}
1526
+ ${!grid && !docsGrid ? '<div class="card"><div class="head"><div class="hint">No components or docs.</div></div></div>' : ""}
1527
+ </div>
1528
+ </main>
1529
+ </body>
1530
+ </html> `;
1511
1531
  }
1512
- var parseReactComponentMeta = (reactComponentMeta) => {
1513
- let props = reactComponentMeta.props ?? {};
1514
- return {
1515
- props: Object.fromEntries(
1516
- Object.entries(props).map(([propName, prop]) => [
1517
- propName,
1518
- {
1519
- description: prop.description,
1520
- type: prop.type?.raw ?? prop.type?.name,
1521
- defaultValue: prop.defaultValue?.value,
1522
- required: prop.required
1523
- }
1524
- ])
1525
- )
1526
- };
1527
- };
1528
1532
 
1529
1533
  // src/core-server/utils/manifests/manifests.ts
1530
1534
  function buildComponentsManifest(components, meta) {
@@ -2490,7 +2494,7 @@ var ReverseIndexImpl = class {
2490
2494
  async function walkFromStory({
2491
2495
  storyRoot,
2492
2496
  registry,
2493
- cache: cache5,
2497
+ cache: cache4,
2494
2498
  reverseIndex,
2495
2499
  recordEdges
2496
2500
  }) {
@@ -2502,7 +2506,7 @@ async function walkFromStory({
2502
2506
  let { file, depth } = queue[head++];
2503
2507
  if (registry.parserFor(file) === void 0)
2504
2508
  continue;
2505
- let resolvedDeps = await cache5.resolveOnce(file);
2509
+ let resolvedDeps = await cache4.resolveOnce(file);
2506
2510
  recordEdges(file, resolvedDeps);
2507
2511
  let nextDepth = depth + 1;
2508
2512
  for (let normalised of resolvedDeps) {
@@ -2664,7 +2668,7 @@ var DEFAULT_EXTENSIONS = [".tsx", ".ts", ".d.ts", ".jsx", ".js", ".mjs", ".cjs",
2664
2668
  alias,
2665
2669
  conditionNames,
2666
2670
  extensions: DEFAULT_EXTENSIONS
2667
- }), this.projectRootEntry = join7(config.projectRoot, "__sb_resolver_root__.ts");
2671
+ }), this.projectRootEntry = join7(config.projectRoot, "__fb_resolver_root__.ts");
2668
2672
  }
2669
2673
  /**
2670
2674
  * Resolves `specifier` from the file at `from` (must be an absolute path).
@@ -2873,7 +2877,7 @@ var ModuleGraphEngine = class {
2873
2877
  pluginParsers
2874
2878
  }), resolver = new ChangeDetectionResolverFactory(resolveConfig), workspaceRoots = /* @__PURE__ */ new Set([normalize5(getProjectRoot2())]), storyIndex = await this.options.getIndex(), storyIdsByFile = getStoryIdsByAbsolutePath(storyIndex, this.workingDir);
2875
2879
  this.storyFiles = new Set(storyIdsByFile.keys());
2876
- let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG, cache5 = new ParseResolveCache({
2880
+ let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG, cache4 = new ParseResolveCache({
2877
2881
  registry,
2878
2882
  resolver,
2879
2883
  workspaceRoots,
@@ -2886,19 +2890,19 @@ var ModuleGraphEngine = class {
2886
2890
  resolver,
2887
2891
  workspaceRoots,
2888
2892
  projectRoot,
2889
- cache: cache5
2893
+ cache: cache4
2890
2894
  });
2891
2895
  let eventBuffer = [], unsubscribeBuffer = adapter.onFileChange((event) => {
2892
2896
  eventBuffer.push({ event, receivedAt: Date.now() });
2893
2897
  }), { reverseIndex, graph } = await this.dependencyGraphBuilder.build(this.storyFiles);
2894
- this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache5), this.incrementalPatcher = new IncrementalPatcher({
2898
+ this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4), this.incrementalPatcher = new IncrementalPatcher({
2895
2899
  reverseIndex,
2896
2900
  graph,
2897
2901
  registry,
2898
2902
  resolver,
2899
2903
  workspaceRoots,
2900
2904
  projectRoot,
2901
- cache: cache5,
2905
+ cache: cache4,
2902
2906
  isStoryFile: (path3) => this.storyFiles.has(normalize5(path3))
2903
2907
  }), unsubscribeBuffer();
2904
2908
  for (let { event, receivedAt } of eventBuffer)
@@ -2944,7 +2948,7 @@ var ModuleGraphEngine = class {
2944
2948
  });
2945
2949
  }
2946
2950
  }
2947
- async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache5) {
2951
+ async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4) {
2948
2952
  let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG;
2949
2953
  if (!debugEnv)
2950
2954
  return;
@@ -2971,7 +2975,7 @@ var ModuleGraphEngine = class {
2971
2975
  // Each entry records one named-import barrel lookup: which names were requested,
2972
2976
  // which source files they resolved to, and whether the barrel itself was also
2973
2977
  // included (needBarrel: true means at least one name fell back to the barrel).
2974
- barrelResolutions: cache5.getBarrelTrace() ?? []
2978
+ barrelResolutions: cache4.getBarrelTrace() ?? []
2975
2979
  };
2976
2980
  try {
2977
2981
  await writeFile2(outPath, JSON.stringify(snapshot, null, 2), "utf8"), logger5.debug(`Change detection: graph debug snapshot written to ${outPath}`);
@@ -3154,7 +3158,7 @@ var GitDiffProvider = class {
3154
3158
  if (this.repoRoot)
3155
3159
  return this.repoRoot;
3156
3160
  try {
3157
- let { stdout } = await execa("git", ["rev-parse", "--show-toplevel"], {
3161
+ let { stdout } = await exec("git", ["rev-parse", "--show-toplevel"], {
3158
3162
  cwd: this.cwd,
3159
3163
  stdio: "pipe",
3160
3164
  // Prevent git from acquiring .git/index.lock for stat-cache refreshes
@@ -3287,7 +3291,7 @@ var GitDiffProvider = class {
3287
3291
  }
3288
3292
  async runGitCommand(repoRoot, args) {
3289
3293
  try {
3290
- return await execa("git", args, {
3294
+ return await exec("git", args, {
3291
3295
  cwd: repoRoot,
3292
3296
  stdio: "pipe",
3293
3297
  // GIT_OPTIONAL_LOCKS=0 disables the stat-cache refresh that
@@ -3351,9 +3355,9 @@ function resetChangeDetectionReadiness() {
3351
3355
  function isServerStoreLeader() {
3352
3356
  return !optionalEnvToBoolean(process.env.VITEST_CHILD_PROCESS) && !optionalEnvToBoolean(process.env.FORKBOOK_ATTACHED_TOOLS) && UniversalStore.preparedEnvironment !== UniversalStore.Environment.UNKNOWN;
3353
3357
  }
3354
- function getOrRecreateStore(id, cache5, create) {
3358
+ function getOrRecreateStore(id, cache4, create) {
3355
3359
  let leader = isServerStoreLeader();
3356
- return cache5.store !== void 0 && cache5.leader === leader || (cache5.store !== void 0 && instances.delete(id), cache5.leader = leader, cache5.store = create(leader)), cache5.store;
3360
+ return cache4.store !== void 0 && cache4.leader === leader || (cache4.store !== void 0 && instances.delete(id), cache4.leader = leader, cache4.store = create(leader)), cache4.store;
3357
3361
  }
3358
3362
 
3359
3363
  // src/core-server/stores/status.ts
@@ -3414,10 +3418,8 @@ import {
3414
3418
  import { logger as logger7, prompt } from "@aussieljk/forkbook/internal/node-logger";
3415
3419
  import {
3416
3420
  ErrorCollector,
3417
- getPrecedingUpgrade,
3418
3421
  isTelemetryStateResolved,
3419
3422
  oneWayHash,
3420
- onPayloadError,
3421
3423
  setTelemetryEnabled,
3422
3424
  telemetry,
3423
3425
  withSpan
@@ -3468,7 +3470,7 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3468
3470
  } catch {
3469
3471
  }
3470
3472
  if (errorLevel !== "none") {
3471
- let precedingUpgrade = await getPrecedingUpgrade(), error = _error, errorHash;
3473
+ let error = _error, errorHash;
3472
3474
  "message" in error ? errorHash = error.message ? oneWayHash(error.message) : "EMPTY_MESSAGE" : errorHash = "NO_MESSAGE";
3473
3475
  let { code, name, category } = error;
3474
3476
  if (await telemetry(
@@ -3479,7 +3481,6 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3479
3481
  category,
3480
3482
  eventType,
3481
3483
  blocking,
3482
- precedingUpgrade,
3483
3484
  error: errorLevel === "full" ? error : void 0,
3484
3485
  errorHash,
3485
3486
  // if we ever end up sending a non-error instance, we'd like to know
@@ -3487,13 +3488,8 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3487
3488
  // Include parent error information if this is a sub-error
3488
3489
  ...parent ? { parent: parent.fullErrorCode } : {}
3489
3490
  },
3490
- {
3491
- immediate: !0,
3492
- configDir: options.cliOptions.configDir || options.presetOptions?.configDir,
3493
- enableCrashReports: errorLevel === "full",
3494
- force: !0
3495
- }
3496
- ), error && "subErrors" in error && error.subErrors.length > 0)
3491
+ { force: !0 }
3492
+ ), error && error.subErrors && error.subErrors.length > 0)
3497
3493
  for (let subError of error.subErrors)
3498
3494
  await sendTelemetryError(subError, eventType, options, blocking, error);
3499
3495
  }
@@ -3501,16 +3497,20 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3501
3497
  }
3502
3498
  }
3503
3499
  async function resolveTelemetryState(options) {
3504
- if (options.cliOptions.disableTelemetry !== void 0)
3505
- return await setTelemetryEnabled(!options.cliOptions.disableTelemetry);
3500
+ if (options.cliOptions.disableTelemetry !== void 0) {
3501
+ setTelemetryEnabled(!options.cliOptions.disableTelemetry);
3502
+ return;
3503
+ }
3506
3504
  let mainConfig, configDir = options.cliOptions.configDir ?? options.presetOptions?.configDir ?? defaultConfigDir();
3507
3505
  try {
3508
3506
  mainConfig = await loadMainConfig({ configDir });
3509
3507
  } catch {
3510
3508
  }
3511
- if (mainConfig)
3512
- return await setTelemetryEnabled(!mainConfig?.core?.disableTelemetry);
3513
- await setTelemetryEnabled(options.fallbackTelemetryState ?? !1);
3509
+ if (mainConfig) {
3510
+ setTelemetryEnabled(!mainConfig?.core?.disableTelemetry);
3511
+ return;
3512
+ }
3513
+ setTelemetryEnabled(options.fallbackTelemetryState ?? !1);
3514
3514
  }
3515
3515
  function isInterruptionError(error) {
3516
3516
  if (!error || typeof error != "object")
@@ -3523,12 +3523,10 @@ async function withTelemetry(eventType, options, run) {
3523
3523
  isTelemetryStateResolved() || await resolveTelemetryState(options);
3524
3524
  let canceled = !1;
3525
3525
  async function cancelTelemetry() {
3526
- canceled = !0, await telemetry("canceled", { eventType }, { stripMetadata: !0, immediate: !0 }), process.exit(0);
3526
+ canceled = !0, await telemetry("canceled", { eventType }), process.exit(0);
3527
3527
  }
3528
3528
  let trackCancellation = CANCELLATION_TRACKED_EVENTS.includes(eventType);
3529
- trackCancellation && process.on("SIGINT", cancelTelemetry), onPayloadError(async (error, evtType) => {
3530
- await sendTelemetryError(error, evtType, options);
3531
- }), telemetry("boot", { eventType }, { stripMetadata: !0 });
3529
+ trackCancellation && process.on("SIGINT", cancelTelemetry), telemetry("boot", { eventType });
3532
3530
  try {
3533
3531
  return await withSpan(`forkbook ${eventType}`, { "forkbook.command": eventType }, run);
3534
3532
  } catch (error) {
@@ -3547,7 +3545,7 @@ async function withTelemetry(eventType, options, run) {
3547
3545
  let errors = ErrorCollector.getErrors();
3548
3546
  for (let error of errors)
3549
3547
  await sendTelemetryError(error, eventType, options, !1);
3550
- process.off("SIGINT", cancelTelemetry), onPayloadError(void 0);
3548
+ process.off("SIGINT", cancelTelemetry);
3551
3549
  }
3552
3550
  }
3553
3551
 
@@ -3654,7 +3652,7 @@ var storyInputProps = {
3654
3652
  v4.optional(v4.record(v4.string(), v4.any())),
3655
3653
  v4.description(`Optional custom props to pass to the story for rendering. Use this when you don't want to render the default story,
3656
3654
  but you want to customize some args or other props.
3657
- You can look up the component's documentation using the get-storybook-story-instructions tool to see what props are available.`)
3655
+ You can look up the component's documentation using the get-forkbook-story-instructions tool to see what props are available.`)
3658
3656
  ),
3659
3657
  globals: v4.pipe(
3660
3658
  v4.optional(v4.record(v4.string(), v4.any())),
@@ -4843,7 +4841,7 @@ async function getRefsFromConfig(options) {
4843
4841
  refs = await options.presets.apply("refs", {}) ?? {};
4844
4842
  } catch (error) {
4845
4843
  return logger8.warn(
4846
- `Composed Storybooks are left out of the docs toolset: reading "refs" failed. ${error instanceof Error ? error.message : String(error)}`
4844
+ `Composed Forkbooks are left out of the docs toolset: reading "refs" failed. ${error instanceof Error ? error.message : String(error)}`
4847
4845
  ), [];
4848
4846
  }
4849
4847
  return Object.entries(refs).filter(([, ref]) => typeof ref?.url == "string" && ref.url.length > 0 && !ref.disable).map(([key, ref]) => ({
@@ -5928,7 +5926,7 @@ var splitPathRegex = /\/([^/]+)\/(?:(.*)_)?([^/]+)?/, parsePath = (0, import_mem
5928
5926
  return update.length >= value.length ? res : res.concat(new Array(value.length - update.length).fill(void 0));
5929
5927
  }
5930
5928
  return isPlainObject(value) && isPlainObject(update) ? Object.keys({ ...value, ...update }).reduce((acc, key) => {
5931
- let diff = deepDiff(value?.[key], update?.[key]);
5929
+ let diff = deepDiff(value[key], update[key]);
5932
5930
  return diff === DEEPLY_EQUAL ? acc : Object.assign(acc, { [key]: diff });
5933
5931
  }, {}) : update;
5934
5932
  }, VALIDATION_REGEXP = /^[a-zA-Z0-9 _-]*$/, NUMBER_REGEXP = /^-?[0-9]+(\.[0-9]+)?$/, HEX_REGEXP = /^#([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8})$/i, COLOR_REGEXP = /^(rgba?|hsla?)\(([0-9]{1,3}),\s?([0-9]{1,3})%?,\s?([0-9]{1,3})%?,?\s?([0-9](\.[0-9]{1,2})?)?\)$/i, validateArgs = (key = "", value) => key === null || key === "" || !VALIDATION_REGEXP.test(key) ? !1 : value == null || value instanceof Date || typeof value == "number" || typeof value == "boolean" ? !0 : typeof value == "string" ? VALIDATION_REGEXP.test(value) || NUMBER_REGEXP.test(value) || HEX_REGEXP.test(value) || COLOR_REGEXP.test(value) : Array.isArray(value) ? value.every((v10) => validateArgs(key, v10)) : isPlainObject(value) ? Object.entries(value).every(([k, v10]) => validateArgs(k, v10)) : !1, encodeSpecialValues = (value) => value === void 0 ? "!undefined" : value === null ? "!null" : typeof value == "string" ? HEX_REGEXP.test(value) ? `!hex(${value.slice(1)})` : COLOR_REGEXP.test(value) ? `!${value.replace(/[\s%]/g, "")}` : value : typeof value == "boolean" ? `!${value}` : value instanceof Date ? `!date(${value.toISOString()})` : Array.isArray(value) ? value.map(encodeSpecialValues) : isPlainObject(value) ? Object.entries(value).reduce(
@@ -5955,7 +5953,7 @@ var splitPathRegex = /\/([^/]+)\/(?:(.*)_)?([^/]+)?/, parsePath = (0, import_mem
5955
5953
  let object8 = Object.entries(update).reduce((acc, [key, value]) => validateArgs(key, value) ? Object.assign(acc, { [key]: value }) : (once2.warn(dedent3`
5956
5954
  Omitted potentially unsafe URL args.
5957
5955
 
5958
- More info: https://storybook.js.org/docs/writing-stories/args?ref=error#setting-args-through-the-url
5956
+ More info: https://forkbook.ljk.dev/docs/writing-stories/args#setting-args-through-the-url
5959
5957
  `), acc), {});
5960
5958
  return stringify(encodeSpecialValues(object8), {
5961
5959
  delimiter: ";",
@@ -5964,7 +5962,9 @@ var splitPathRegex = /\/([^/]+)\/(?:(.*)_)?([^/]+)?/, parsePath = (0, import_mem
5964
5962
  nestingSyntax: "js"
5965
5963
  // encode objects using dot notation: obj.key=val
5966
5964
  }).replace(knownQueryChar, decodeKnownQueryChar).split(";").map((part) => part.replace("=", ":")).join(";");
5967
- }, queryFromString = (0, import_memoizerific.default)(1e3)((s) => s !== void 0 ? parse2(s) : {});
5965
+ }, queryFromString = (0, import_memoizerific.default)(1e3)(
5966
+ (s) => s !== void 0 ? parse2(s) : {}
5967
+ );
5968
5968
  var getMatch = (0, import_memoizerific.default)(1e3)((current, target, startsWith = !0) => {
5969
5969
  if (startsWith) {
5970
5970
  if (typeof target != "string")
@@ -5981,7 +5981,7 @@ function previewStories({
5981
5981
  index,
5982
5982
  stories
5983
5983
  }) {
5984
- let resolvedStories = findStoryIds(index, stories), result = [];
5984
+ let resolvedStories = findStoryIds(index, stories), result = [], pathMap = buildStoryPathMap(Object.values(index.entries)), base = origin.replace(/\/$/, "");
5985
5985
  for (let story of resolvedStories) {
5986
5986
  if ("errorMessage" in story) {
5987
5987
  result.push({
@@ -5990,13 +5990,16 @@ function previewStories({
5990
5990
  });
5991
5991
  continue;
5992
5992
  }
5993
- let indexEntry = story.entry, previewUrl = `${origin}/?path=/story/${indexEntry.id}`, argsParam = buildArgsParam({}, story.input.props ?? {});
5994
- argsParam && (previewUrl += `&args=${argsParam}`);
5993
+ let indexEntry = story.entry, query = [], argsParam = buildArgsParam({}, story.input.props ?? {});
5994
+ argsParam && query.push(`args=${argsParam}`);
5995
5995
  let globalsParam = buildArgsParam({}, story.input.globals ?? {});
5996
- globalsParam && (previewUrl += `&globals=${globalsParam}`), result.push({
5996
+ globalsParam && query.push(`globals=${globalsParam}`);
5997
+ let search = query.length ? `?${query.join("&")}` : "", previewUrl = `${base}${toUrlPath(`/story/${indexEntry.id}`, pathMap)}${search}`, iframeUrl = `${base}/iframe.html?${["id=" + indexEntry.id, ...query].join("&")}`;
5998
+ result.push({
5997
5999
  title: indexEntry.title,
5998
6000
  name: indexEntry.name,
5999
- previewUrl
6001
+ previewUrl,
6002
+ iframeUrl
6000
6003
  });
6001
6004
  }
6002
6005
  return { stories: result };
@@ -6006,7 +6009,11 @@ function previewStories({
6006
6009
  var previewSuccessSchema = v8.object({
6007
6010
  title: v8.string(),
6008
6011
  name: v8.string(),
6009
- previewUrl: v8.pipe(v8.string(), v8.description("Direct URL to open the story preview."))
6012
+ previewUrl: v8.pipe(v8.string(), v8.description("Direct URL to open the story preview.")),
6013
+ iframeUrl: v8.pipe(
6014
+ v8.string(),
6015
+ v8.description("URL of the story preview frame without the manager.")
6016
+ )
6010
6017
  }), previewFailureSchema = v8.object({
6011
6018
  input: storyInputSchema,
6012
6019
  error: v8.string()
@@ -6437,7 +6444,7 @@ var reviewToolset = defineToolset({
6437
6444
  let collectionCount = review.collections.length, storyCount = review.collections.reduce(
6438
6445
  (total, collection) => total + collection.storyIds.length,
6439
6446
  0
6440
- ), reviewUrl = `${ctx.origin.replace(/\/$/, "")}/?path=${REVIEW_PAGE_PATH}`, data = {
6447
+ ), reviewUrl = `${ctx.origin.replace(/\/$/, "")}${REVIEW_PAGE_PATH}`, data = {
6441
6448
  reviewUrl,
6442
6449
  collectionCount,
6443
6450
  storyCount,
@@ -6456,514 +6463,6 @@ var reviewToolset = defineToolset({
6456
6463
  }
6457
6464
  });
6458
6465
 
6459
- // src/shared/test-provider-store/index.ts
6460
- var UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS = {
6461
- id: "@aussieljk/forkbook/test-provider",
6462
- leader: !0,
6463
- initialState: {}
6464
- };
6465
- function createTestProviderStore({
6466
- universalTestProviderStore: universalTestProviderStore2,
6467
- useUniversalStore
6468
- }) {
6469
- let baseStore = {
6470
- settingsChanged: () => {
6471
- universalTestProviderStore2.untilReady().then(() => {
6472
- universalTestProviderStore2.send({ type: "settings-changed" });
6473
- });
6474
- },
6475
- onRunAll: (listener) => universalTestProviderStore2.subscribe("run-all", listener),
6476
- onClearAll: (listener) => universalTestProviderStore2.subscribe("clear-all", listener)
6477
- }, fullTestProviderStore2 = {
6478
- ...baseStore,
6479
- getFullState: universalTestProviderStore2.getState,
6480
- setFullState: universalTestProviderStore2.setState,
6481
- onSettingsChanged: (listener) => universalTestProviderStore2.subscribe("settings-changed", listener),
6482
- runAll: async () => {
6483
- await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "run-all" });
6484
- },
6485
- clearAll: async () => {
6486
- await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "clear-all" });
6487
- }
6488
- }, getTestProviderStoreById2 = (testProviderId) => {
6489
- let getStateForTestProvider = () => universalTestProviderStore2.getState()[testProviderId] ?? "test-provider-state:pending", setStateForTestProvider = (state) => {
6490
- universalTestProviderStore2.untilReady().then(() => {
6491
- universalTestProviderStore2.setState((currentState) => ({
6492
- ...currentState,
6493
- [testProviderId]: state
6494
- }));
6495
- });
6496
- };
6497
- return {
6498
- ...baseStore,
6499
- testProviderId,
6500
- getState: getStateForTestProvider,
6501
- setState: setStateForTestProvider,
6502
- runWithState: async (callback) => {
6503
- setStateForTestProvider("test-provider-state:running");
6504
- try {
6505
- await callback(), setStateForTestProvider("test-provider-state:succeeded");
6506
- } catch {
6507
- setStateForTestProvider("test-provider-state:crashed");
6508
- }
6509
- }
6510
- };
6511
- };
6512
- return useUniversalStore ? {
6513
- getTestProviderStoreById: getTestProviderStoreById2,
6514
- fullTestProviderStore: fullTestProviderStore2,
6515
- universalTestProviderStore: universalTestProviderStore2,
6516
- useTestProviderStore: (selector) => useUniversalStore(universalTestProviderStore2, selector)[0]
6517
- } : {
6518
- getTestProviderStoreById: getTestProviderStoreById2,
6519
- fullTestProviderStore: fullTestProviderStore2,
6520
- universalTestProviderStore: universalTestProviderStore2
6521
- };
6522
- }
6523
-
6524
- // src/core-server/stores/test-provider.ts
6525
- function createServerTestProviderStore(leader) {
6526
- return createTestProviderStore({
6527
- universalTestProviderStore: UniversalStore.create({
6528
- ...UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS,
6529
- leader
6530
- })
6531
- });
6532
- }
6533
- var cache4 = {};
6534
- function getTestProviderStoreBundle() {
6535
- return getOrRecreateStore(
6536
- UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS.id,
6537
- cache4,
6538
- createServerTestProviderStore
6539
- );
6540
- }
6541
- var getTestProviderStoreById = (id) => getTestProviderStoreBundle().getTestProviderStoreById(id), fullTestProviderStore = new Proxy(
6542
- {},
6543
- {
6544
- get(_target, prop) {
6545
- let store = getTestProviderStoreBundle().fullTestProviderStore, value = Reflect.get(store, prop, store);
6546
- return typeof value == "function" ? value.bind(store) : value;
6547
- }
6548
- }
6549
- ), universalTestProviderStore = new Proxy({}, {
6550
- get(_target, prop) {
6551
- let store = getTestProviderStoreBundle().universalTestProviderStore, value = Reflect.get(store, prop, store);
6552
- return typeof value == "function" ? value.bind(store) : value;
6553
- }
6554
- });
6555
-
6556
- // src/core-server/utils/ghost-stories/get-candidates.ts
6557
- import { readFile as readFile6 } from "node:fs/promises";
6558
- import { babelParse, traverse } from "@aussieljk/forkbook/internal/babel";
6559
-
6560
- // src/core-server/utils/ghost-stories/component-analyzer.ts
6561
- var COMPLEXITY_CONFIG = {
6562
- /** Weight applied to non-empty lines */
6563
- locWeight: 1,
6564
- /** Imports can be cheap, so they get a lower weight */
6565
- importWeight: 0.5,
6566
- /**
6567
- * Defines what raw complexity value should map to the upper bound of a "simple" file For instance
6568
- * 30 LOC + 4 imports = 32. This would result in a score of 0.3
6569
- */
6570
- simpleBaseline: 32,
6571
- simpleScore: 0.3
6572
- }, getComponentComplexity = (fileContent) => {
6573
- let lines = fileContent.split(`
6574
- `), nonEmptyLines = lines.filter((line) => line.trim() !== "").length, importCount = lines.filter((line) => line.trim().startsWith("import")).length, normalizedScore = (nonEmptyLines * COMPLEXITY_CONFIG.locWeight + importCount * COMPLEXITY_CONFIG.importWeight) / (COMPLEXITY_CONFIG.simpleBaseline / COMPLEXITY_CONFIG.simpleScore);
6575
- return Math.min(normalizedScore, 1);
6576
- };
6577
-
6578
- // src/core-server/utils/ghost-stories/get-candidates.ts
6579
- function isValidCandidate(source) {
6580
- let ast = babelParse(source), hasJSX = !1, hasExport = !1;
6581
- return traverse(ast, {
6582
- JSXElement(path3) {
6583
- hasJSX = !0, hasExport && path3.stop();
6584
- },
6585
- JSXFragment(path3) {
6586
- hasJSX = !0, hasExport && path3.stop();
6587
- },
6588
- ExportNamedDeclaration(path3) {
6589
- hasExport = !0, hasJSX && path3.stop();
6590
- },
6591
- ExportDefaultDeclaration(path3) {
6592
- hasExport = !0, hasJSX && path3.stop();
6593
- },
6594
- ExportAllDeclaration(path3) {
6595
- hasExport = !0, hasJSX && path3.stop();
6596
- }
6597
- }), hasJSX && hasExport;
6598
- }
6599
- async function getCandidatesForStorybook(files2, sampleCount) {
6600
- let simpleCandidates = [], analyzedCandidates = [];
6601
- for (let file of files2) {
6602
- let source;
6603
- try {
6604
- if (source = await readFile6(file, "utf-8"), !isValidCandidate(source))
6605
- continue;
6606
- } catch {
6607
- continue;
6608
- }
6609
- let complexity = getComponentComplexity(source);
6610
- if (analyzedCandidates.push({ file, complexity }), complexity < 0.3 && (simpleCandidates.push({ file, complexity }), simpleCandidates.length >= sampleCount))
6611
- break;
6612
- }
6613
- let selectedCandidates = [];
6614
- simpleCandidates.length >= sampleCount ? selectedCandidates = simpleCandidates.sort((a, b) => a.complexity - b.complexity).slice(0, sampleCount) : selectedCandidates = analyzedCandidates.sort((a, b) => a.complexity - b.complexity).slice(0, sampleCount);
6615
- let avgComplexity = selectedCandidates.length > 0 ? Number(
6616
- (selectedCandidates.reduce((acc, curr) => acc + curr.complexity, 0) / selectedCandidates.length).toFixed(2)
6617
- ) : 0;
6618
- return {
6619
- candidates: selectedCandidates.map(({ file }) => file),
6620
- analyzedCount: analyzedCandidates.length,
6621
- avgComplexity
6622
- };
6623
- }
6624
- async function getComponentCandidates({
6625
- sampleSize = 20,
6626
- globPattern = "**/*.{tsx,jsx}",
6627
- cwd = process.cwd()
6628
- } = {}) {
6629
- let globMatchCount = 0;
6630
- try {
6631
- let files2 = [];
6632
- if (files2 = await glob(globPattern, {
6633
- cwd,
6634
- absolute: !0,
6635
- ignore: [
6636
- "**/node_modules/**",
6637
- "**/.git/**",
6638
- "**/dist/**",
6639
- "**/__mocks__/**",
6640
- "**/build/**",
6641
- "**/storybook-static/**",
6642
- "**/*.test.*",
6643
- "**/*.d.*",
6644
- "**/*.config.*",
6645
- "**/*.spec.*",
6646
- "**/*.stories.*",
6647
- // skip example story files that come from the CLI
6648
- "**/stories/{Button,Header,Page}.*",
6649
- "**/stories/{button,header,page}.*"
6650
- ]
6651
- }), globMatchCount = files2.length, globMatchCount === 0)
6652
- return {
6653
- candidates: [],
6654
- globMatchCount
6655
- };
6656
- let { analyzedCount, avgComplexity, candidates } = await getCandidatesForStorybook(
6657
- files2,
6658
- sampleSize
6659
- );
6660
- return {
6661
- analyzedCount,
6662
- avgComplexity,
6663
- candidates,
6664
- globMatchCount
6665
- };
6666
- } catch {
6667
- return {
6668
- candidates: [],
6669
- error: "Failed to find candidates",
6670
- globMatchCount
6671
- };
6672
- }
6673
- }
6674
-
6675
- // src/shared/utils/categorize-render-errors.ts
6676
- var ERROR_CATEGORIES = {
6677
- MISSING_PROVIDER: "MISSING_PROVIDER",
6678
- MISSING_STATE_PROVIDER: "MISSING_STATE_PROVIDER",
6679
- MISSING_ROUTER_PROVIDER: "MISSING_ROUTER_PROVIDER",
6680
- MISSING_THEME_PROVIDER: "MISSING_THEME_PROVIDER",
6681
- MISSING_TRANSLATION_PROVIDER: "MISSING_TRANSLATION_PROVIDER",
6682
- MISSING_PORTAL_ROOT: "MISSING_PORTAL_ROOT",
6683
- HOOK_USAGE_ERROR: "HOOK_USAGE_ERROR",
6684
- MODULE_IMPORT_ERROR: "MODULE_IMPORT_ERROR",
6685
- COMPONENT_RENDER_ERROR: "COMPONENT_RENDER_ERROR",
6686
- SERVER_COMPONENTS_ERROR: "SERVER_COMPONENTS_ERROR",
6687
- UNKNOWN_ERROR: "UNKNOWN_ERROR",
6688
- // Vite related errors
6689
- DYNAMIC_MODULE_IMPORT_ERROR: "DYNAMIC_MODULE_IMPORT_ERROR",
6690
- // Vitest test run related errors
6691
- TEST_FILE_IMPORT_ERROR: "TEST_FILE_IMPORT_ERROR"
6692
- };
6693
- function buildErrorContext(message, stack) {
6694
- let normalizedMessage = message.toLowerCase(), normalizedStack = (stack ?? "").toLowerCase(), stackDeps = /* @__PURE__ */ new Set(), stackLines = normalizedStack.split(`
6695
- `).filter(Boolean);
6696
- for (let line of stackLines) {
6697
- let depMatch = line.match(/\/deps\/([^:]+)\.js/);
6698
- depMatch && stackDeps.add(depMatch[1]);
6699
- }
6700
- return {
6701
- message,
6702
- stack,
6703
- normalizedMessage,
6704
- normalizedStack,
6705
- stackDeps
6706
- };
6707
- }
6708
- var CATEGORIZATION_RULES = [
6709
- {
6710
- category: ERROR_CATEGORIES.MODULE_IMPORT_ERROR,
6711
- priority: 100,
6712
- match: (ctx) => ctx.normalizedMessage.includes("cannot find module") || ctx.normalizedMessage.includes("module not found") || ctx.normalizedMessage.includes("cannot resolve module")
6713
- },
6714
- {
6715
- category: ERROR_CATEGORIES.TEST_FILE_IMPORT_ERROR,
6716
- priority: 95,
6717
- match: (ctx) => ctx.normalizedMessage.includes("failed to import test file")
6718
- },
6719
- {
6720
- category: ERROR_CATEGORIES.DYNAMIC_MODULE_IMPORT_ERROR,
6721
- priority: 95,
6722
- match: (ctx) => ctx.normalizedMessage.includes("failed to fetch dynamically imported module")
6723
- },
6724
- {
6725
- category: ERROR_CATEGORIES.HOOK_USAGE_ERROR,
6726
- priority: 90,
6727
- match: (ctx) => ctx.normalizedMessage.includes("invalid hook call") || ctx.normalizedMessage.includes("rendered more hooks") || ctx.normalizedMessage.includes("hooks can only be called") || ctx.normalizedMessage.includes("too many re-renders") || ctx.normalizedMessage.includes("maximum update depth exceeded") || ctx.normalizedMessage.includes("hook") && ctx.normalizedMessage.includes("function component")
6728
- },
6729
- {
6730
- category: ERROR_CATEGORIES.MISSING_STATE_PROVIDER,
6731
- priority: 85,
6732
- match: (ctx) => Array.from(ctx.stackDeps).some(isStateManagementPackage) && (ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("undefined") || ctx.normalizedMessage.includes("null"))
6733
- },
6734
- {
6735
- category: ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER,
6736
- priority: 85,
6737
- match: (ctx) => Array.from(ctx.stackDeps).some(isRouterPackage) || ctx.normalizedMessage.includes("usenavigate") || ctx.normalizedMessage.includes("router")
6738
- },
6739
- {
6740
- category: ERROR_CATEGORIES.SERVER_COMPONENTS_ERROR,
6741
- priority: 85,
6742
- match: (ctx) => ctx.normalizedMessage.includes("server components") || ctx.normalizedMessage.includes("use client") || ctx.normalizedMessage.includes("async/await") && ctx.normalizedMessage.includes("not supported")
6743
- },
6744
- {
6745
- category: ERROR_CATEGORIES.MISSING_THEME_PROVIDER,
6746
- priority: 80,
6747
- match: (ctx) => Array.from(ctx.stackDeps).some(isStylingPackage) && (ctx.normalizedMessage.includes("theme") || ctx.normalizedMessage.includes("undefined")) || ctx.normalizedMessage.includes("usetheme") || ctx.normalizedMessage.includes("theme") && ctx.normalizedMessage.includes("provider")
6748
- },
6749
- {
6750
- category: ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER,
6751
- priority: 80,
6752
- match: (ctx) => Array.from(ctx.stackDeps).some(isI18nPackage) || ctx.normalizedMessage.includes("i18n") || ctx.normalizedMessage.includes("translation") || ctx.normalizedMessage.includes("locale")
6753
- },
6754
- {
6755
- category: ERROR_CATEGORIES.MISSING_PORTAL_ROOT,
6756
- priority: 70,
6757
- match: (ctx) => ctx.normalizedMessage.includes("target container is not a dom element") || ctx.normalizedMessage.includes("portal") && (ctx.normalizedMessage.includes("container") || ctx.normalizedMessage.includes("root"))
6758
- },
6759
- {
6760
- category: ERROR_CATEGORIES.MISSING_PROVIDER,
6761
- priority: 60,
6762
- match: (ctx) => ctx.normalizedMessage.includes("use") && ctx.normalizedMessage.includes("provider") || ctx.normalizedMessage.includes("<provider>") || ctx.normalizedMessage.includes("no provider") || ctx.normalizedMessage.includes("without a provider") || (ctx.normalizedMessage.includes("could not find") || ctx.normalizedMessage.includes("missing") || ctx.normalizedMessage.includes("not found")) && ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("context") && (ctx.normalizedMessage.includes("null") || ctx.normalizedMessage.includes("undefined"))
6763
- },
6764
- {
6765
- category: ERROR_CATEGORIES.COMPONENT_RENDER_ERROR,
6766
- priority: 10,
6767
- match: (ctx) => ctx.normalizedMessage.includes("cannot read") || ctx.normalizedMessage.includes("is not a function") || ctx.normalizedMessage.includes("is not an object") || ctx.normalizedMessage.includes("is not defined") || ctx.normalizedMessage.includes("element type is invalid") || ctx.normalizedMessage.includes("objects are not valid as a react child") || ctx.normalizedMessage.includes("maximum call stack") || ctx.normalizedMessage.includes("render")
6768
- }
6769
- ], RULES = CATEGORIZATION_RULES.sort((a, b) => b.priority - a.priority);
6770
- function categorizeError(message, stack) {
6771
- let ctx = buildErrorContext(message, stack), rule = RULES.find((r) => r.match(ctx));
6772
- if (!rule)
6773
- return { category: ERROR_CATEGORIES.UNKNOWN_ERROR, matchedDependencies: [] };
6774
- let matchedDependencies = getMatchedDependencies(rule.category, ctx);
6775
- return { category: rule.category, matchedDependencies };
6776
- }
6777
- function getMatchedDependencies(category, ctx) {
6778
- switch (category) {
6779
- case ERROR_CATEGORIES.MISSING_STATE_PROVIDER:
6780
- return Array.from(ctx.stackDeps).filter(isStateManagementPackage);
6781
- case ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER:
6782
- return Array.from(ctx.stackDeps).filter(isRouterPackage);
6783
- case ERROR_CATEGORIES.MISSING_THEME_PROVIDER:
6784
- return Array.from(ctx.stackDeps).filter(isStylingPackage);
6785
- case ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER:
6786
- return Array.from(ctx.stackDeps).filter(isI18nPackage);
6787
- default:
6788
- return [];
6789
- }
6790
- }
6791
-
6792
- // src/shared/utils/analyze-test-results.ts
6793
- function extractCategorizedErrors(testResults) {
6794
- let failed = testResults.filter((r) => r.status === "FAIL" && r.error), map = /* @__PURE__ */ new Map(), uniqueErrorMessages = /* @__PURE__ */ new Set();
6795
- for (let r of failed) {
6796
- let { category, matchedDependencies } = categorizeError(r.error, r.stack);
6797
- map.has(category) || map.set(category, { count: 0, uniqueErrors: /* @__PURE__ */ new Set(), matchedDependencies: /* @__PURE__ */ new Set() });
6798
- let data = map.get(category);
6799
- data.count++, matchedDependencies.forEach((dep) => data.matchedDependencies.add(dep)), uniqueErrorMessages.add(r.error), data.uniqueErrors.add(r.error);
6800
- }
6801
- let categorizedErrors = Array.from(map.entries()).reduce(
6802
- (acc, [category, data]) => (acc[category] = {
6803
- uniqueCount: data.uniqueErrors.size,
6804
- count: data.count,
6805
- matchedDependencies: Array.from(data.matchedDependencies).sort()
6806
- }, acc),
6807
- {}
6808
- );
6809
- return {
6810
- totalErrors: failed.length,
6811
- uniqueErrorCount: uniqueErrorMessages.size,
6812
- categorizedErrors
6813
- };
6814
- }
6815
- var CSS_CHECK_STORY_ID_SUFFIX = "--css-check";
6816
- function summarizeResults(results) {
6817
- let total = results.length, passed = results.filter((r) => r.status === "PASS").length, passedButEmptyRender = results.filter((r) => r.status === "PASS" && r.emptyRender).length, successRate = total > 0 ? parseFloat((passed / total).toFixed(2)) : 0, successRateWithoutEmptyRender = total > 0 ? parseFloat(((passed - passedButEmptyRender) / total).toFixed(2)) : 0, errorClassification = extractCategorizedErrors(results), cssCheckMatch = results.find(
6818
- (r) => r.storyId.toLowerCase().endsWith(CSS_CHECK_STORY_ID_SUFFIX)
6819
- ), cssCheck = cssCheckMatch?.status === "PASS" ? "pass" : cssCheckMatch?.status === "FAIL" ? "fail" : "not-run";
6820
- return {
6821
- total,
6822
- passed,
6823
- passedButEmptyRender,
6824
- successRate,
6825
- successRateWithoutEmptyRender,
6826
- uniqueErrorCount: errorClassification.uniqueErrorCount,
6827
- categorizedErrors: errorClassification.categorizedErrors,
6828
- cssCheck
6829
- };
6830
- }
6831
- function analyzeTestResults(results, cumulativeResults) {
6832
- let run = summarizeResults(results), analysis = {
6833
- total: run.total,
6834
- passed: run.passed,
6835
- passedButEmptyRender: run.passedButEmptyRender,
6836
- successRate: run.successRate,
6837
- successRateWithoutEmptyRender: run.successRateWithoutEmptyRender,
6838
- uniqueErrorCount: run.uniqueErrorCount,
6839
- categorizedErrors: run.categorizedErrors,
6840
- cssCheck: run.cssCheck
6841
- };
6842
- if (cumulativeResults) {
6843
- let cumulative = summarizeResults(cumulativeResults);
6844
- analysis.cumulativeTotal = cumulative.total, analysis.cumulativePassed = cumulative.passed, analysis.cumulativePassedButEmptyRender = cumulative.passedButEmptyRender, analysis.cumulativeSuccessRate = cumulative.successRate, analysis.cumulativeSuccessRateWithoutEmptyRender = cumulative.successRateWithoutEmptyRender, analysis.cumulativeUniqueErrorCount = cumulative.uniqueErrorCount, analysis.cumulativeCategorizedErrors = cumulative.categorizedErrors, analysis.cumulativeCssCheck = cumulative.cssCheck;
6845
- }
6846
- return analysis;
6847
- }
6848
-
6849
- // src/shared/utils/to-story-test-result.ts
6850
- var DEBUG_BANNER_RE = /^\n(?:\x1B\[\d+m)?Click to debug\b[^\n]*\n\n/;
6851
- function extractErrorMessage(message, stack) {
6852
- return (message ?? "").replace(DEBUG_BANNER_RE, "").split(`
6853
- `)[0] || stack?.split(`
6854
- `)[0] || "unknown error";
6855
- }
6856
- function detectEmptyRender(reports) {
6857
- return reports?.some(
6858
- (report) => report.type === "render-analysis" && report.result?.emptyRender === !0
6859
- ) ?? !1;
6860
- }
6861
- function normalizeStatus(statusRaw) {
6862
- return statusRaw === "passed" ? "PASS" : statusRaw === "failed" ? "FAIL" : "PENDING";
6863
- }
6864
- function toStoryTestResult(input) {
6865
- if (!input.storyId)
6866
- return null;
6867
- let status = normalizeStatus(input.statusRaw), emptyRender = status === "PASS" && detectEmptyRender(input.reports), error, stack;
6868
- if (input.errors && input.errors.length > 0) {
6869
- let firstError = input.errors[0];
6870
- error = extractErrorMessage(firstError.message, firstError.stack), stack = firstError.stack ?? firstError.message;
6871
- }
6872
- return {
6873
- storyId: input.storyId,
6874
- status,
6875
- error,
6876
- stack,
6877
- emptyRender: emptyRender || void 0
6878
- };
6879
- }
6880
-
6881
- // src/core-server/utils/ghost-stories/run-story-tests.ts
6882
- import { existsSync as existsSync4 } from "node:fs";
6883
- import { mkdir as mkdir2, readFile as readFile7 } from "node:fs/promises";
6884
- import { executeCommand, resolvePathInStorybookCache as resolvePathInStorybookCache2 } from "@aussieljk/forkbook/internal/common";
6885
- import { join as join11 } from "pathe";
6886
-
6887
- // src/core-server/utils/ghost-stories/parse-vitest-report.ts
6888
- function parseVitestResults(report) {
6889
- let storyTestResults = [];
6890
- for (let testSuite of report.testResults)
6891
- for (let assertion of testSuite.assertionResults) {
6892
- let result = toStoryTestResult({
6893
- storyId: assertion.meta?.storyId ?? assertion.fullName,
6894
- statusRaw: assertion.status,
6895
- reports: assertion.meta?.reports,
6896
- errors: assertion.failureMessages?.map((message) => ({ stack: message }))
6897
- });
6898
- result && storyTestResults.push(result);
6899
- }
6900
- return {
6901
- summary: analyzeTestResults(storyTestResults)
6902
- };
6903
- }
6904
-
6905
- // src/core-server/utils/ghost-stories/run-story-tests.ts
6906
- async function runStoryTests(componentFilePaths, options) {
6907
- let cwd = options?.cwd;
6908
- try {
6909
- let cacheDir2 = resolvePathInStorybookCache2("story-tests");
6910
- await mkdir2(cacheDir2, { recursive: !0 });
6911
- let timestamp = Date.now(), outputFile = join11(cacheDir2, `test-results-${timestamp}.json`), startTime = Date.now(), testFailureMessage;
6912
- try {
6913
- await executeCommand({
6914
- command: "npx",
6915
- args: [
6916
- "vitest",
6917
- "run",
6918
- "--reporter=json",
6919
- "--testTimeout=1000",
6920
- `--outputFile=${outputFile}`,
6921
- ...componentFilePaths
6922
- ],
6923
- cwd,
6924
- stdio: "pipe",
6925
- env: {
6926
- FORKBOOK_INTERNAL_TEST_RUN: "1",
6927
- ...options?.ghostRun ? { FORKBOOK_COMPONENT_PATHS: componentFilePaths.join(";") } : {}
6928
- }
6929
- });
6930
- } catch (error) {
6931
- let errorMessage = (error.stderr || String(error) || "").toLowerCase();
6932
- errorMessage.includes("browsertype.launch") ? testFailureMessage = "Playwright is not installed" : errorMessage.includes("startup error") ? testFailureMessage = "Startup Error" : errorMessage.includes("no tests found") ? testFailureMessage = "No tests found" : errorMessage.includes("test timeout") ? testFailureMessage = "Test timeout" : errorMessage.includes("react-native-web") ? testFailureMessage = "React Native Web error" : errorMessage.includes("unhandled rejection") && (testFailureMessage = "Unhandled Rejection");
6933
- }
6934
- let duration = Date.now() - startTime;
6935
- if (testFailureMessage)
6936
- return {
6937
- duration,
6938
- runError: testFailureMessage
6939
- };
6940
- if (!existsSync4(outputFile))
6941
- return {
6942
- duration,
6943
- runError: "JSON report not found"
6944
- };
6945
- let vitestReport;
6946
- try {
6947
- let resultsJson = await readFile7(outputFile, "utf8");
6948
- vitestReport = JSON.parse(resultsJson);
6949
- } catch {
6950
- return {
6951
- duration,
6952
- runError: "Failed to read or parse JSON report"
6953
- };
6954
- }
6955
- return !vitestReport.testResults || vitestReport.testResults.length === 0 ? {
6956
- duration,
6957
- runError: "No tests found"
6958
- } : { ...parseVitestResults(vitestReport), duration };
6959
- } catch {
6960
- return {
6961
- runError: "Uncaught error running story tests",
6962
- duration: 0
6963
- };
6964
- }
6965
- }
6966
-
6967
6466
  // src/shared/open-service/services/story-docs/snippet.ts
6968
6467
  function prependImportToSnippet(importBlock, snippet) {
6969
6468
  let trimmedImport = importBlock?.trim();
@@ -7001,6 +6500,7 @@ export {
7001
6500
  getChangeDetectionReadiness,
7002
6501
  setChangeDetectionReadiness,
7003
6502
  resetChangeDetectionReadiness,
6503
+ getOrRecreateStore,
7004
6504
  getStatusStoreByTypeId,
7005
6505
  getSyncedStatuses,
7006
6506
  fullStatusStore,
@@ -7021,12 +6521,5 @@ export {
7021
6521
  createLocalDocsAccess,
7022
6522
  getRefsFromConfig,
7023
6523
  createStoriesToolset,
7024
- reviewToolset,
7025
- getTestProviderStoreById,
7026
- fullTestProviderStore,
7027
- universalTestProviderStore,
7028
- getComponentCandidates,
7029
- analyzeTestResults,
7030
- toStoryTestResult,
7031
- runStoryTests
6524
+ reviewToolset
7032
6525
  };