@aussieljk/forkbook 0.0.1-10 → 0.0.1-12

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 (346) hide show
  1. package/README.md +1 -1
  2. package/assets/create/rendererAssets/common/button.css +6 -6
  3. package/assets/create/rendererAssets/common/header.css +5 -5
  4. package/assets/create/rendererAssets/common/page.css +10 -10
  5. package/assets/server/template.ejs +6 -3
  6. package/dist/_browser-chunks/{Color-X63I7FHI.js → Color-TA43572R.js} +2 -2
  7. package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
  8. package/dist/_browser-chunks/{WithTooltip-5S6F2P7L.js → WithTooltip-66AWY4VQ.js} +5 -4
  9. package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
  10. package/dist/_browser-chunks/{chunk-DYNTDJ3O.js → chunk-2UKY4NXZ.js} +1 -1
  11. package/dist/_browser-chunks/{chunk-I4ATZPNZ.js → chunk-2WMECYEY.js} +3 -3
  12. package/dist/_browser-chunks/{chunk-6ELMKWKX.js → chunk-2WZWS7GJ.js} +1 -1
  13. package/dist/_browser-chunks/{chunk-N3NRW5XX.js → chunk-2YWS25WY.js} +1 -1
  14. package/dist/_browser-chunks/{chunk-NGMQJMCY.js → chunk-3O4QUF3D.js} +1 -1
  15. package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-5MRMYSUN.js} +4 -4
  16. package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-5XGERZHU.js} +15 -12
  17. package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-AQVUHXWY.js} +6 -4
  18. package/dist/_browser-chunks/{chunk-ZHKZKFY4.js → chunk-ARZTIHZK.js} +6 -10
  19. package/dist/_browser-chunks/{chunk-DS2WQZGO.js → chunk-D2Z5KXPS.js} +12 -41
  20. package/dist/_browser-chunks/{chunk-EQKMUQF3.js → chunk-DT7BB545.js} +3 -2
  21. package/dist/_browser-chunks/{chunk-76222HQR.js → chunk-E6QKKKLO.js} +20 -5
  22. package/dist/_browser-chunks/{chunk-5Z65SURM.js → chunk-F22A5EGD.js} +4 -4
  23. package/dist/_browser-chunks/{chunk-3M5T7BW4.js → chunk-GGALYEQS.js} +1 -1
  24. package/dist/_browser-chunks/{chunk-TTBPZQ24.js → chunk-HGIW4I4J.js} +11 -18
  25. package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
  26. package/dist/_browser-chunks/{chunk-KYSD26D6.js → chunk-IGD46SQI.js} +90 -83
  27. package/dist/_browser-chunks/{chunk-LTCXWKZO.js → chunk-QSYOMLRG.js} +667 -624
  28. package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
  29. package/dist/_browser-chunks/{chunk-O24AZJZ7.js → chunk-UDR26TXA.js} +2 -2
  30. package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
  31. package/dist/_browser-chunks/{chunk-7DQREF4S.js → chunk-XV3AEPJW.js} +1 -1
  32. package/dist/_browser-chunks/{matchers-YLBYSYAF.js → matchers-2HVLNCVO.js} +4 -4
  33. package/dist/_browser-chunks/{react-dom-client-4OHE3QDV.js → react-dom-client-SLBUX3U3.js} +1 -1
  34. package/dist/_node-chunks/{attached-runtime-PDBJ2EGV.js → attached-runtime-AU2RZM4Y.js} +28 -29
  35. package/dist/_node-chunks/{builder-manager-VLL26RPG.js → builder-manager-UPXA2KKT.js} +39 -28
  36. package/dist/_node-chunks/{chunk-FR2ZDWKJ.js → chunk-22A63J7O.js} +7 -7
  37. package/dist/_node-chunks/{chunk-ZBWAA2EY.js → chunk-22TWJGGQ.js} +28 -43
  38. package/dist/_node-chunks/{chunk-M4QNXI37.js → chunk-2GJBHF56.js} +6 -6
  39. package/dist/_node-chunks/{chunk-TNFH4Y4G.js → chunk-2MGPZNKV.js} +280 -306
  40. package/dist/_node-chunks/{chunk-KRWR44KT.js → chunk-2Q3YWQSK.js} +6 -6
  41. package/dist/_node-chunks/{chunk-6DRVJCYP.js → chunk-2W525A4I.js} +7 -7
  42. package/dist/_node-chunks/{chunk-ZFLK7MY5.js → chunk-2X3WAH7V.js} +7 -7
  43. package/dist/_node-chunks/{chunk-FERXOKZY.js → chunk-34DNGOCZ.js} +8 -8
  44. package/dist/_node-chunks/{chunk-ID3WA6WR.js → chunk-3MJZ5GI2.js} +6 -6
  45. package/dist/_node-chunks/{chunk-AAL6X7YG.js → chunk-3X67K6EI.js} +136 -114
  46. package/dist/_node-chunks/{chunk-QGC3UWR5.js → chunk-5KMW5XXM.js} +6 -6
  47. package/dist/_node-chunks/{chunk-FXBZWUW3.js → chunk-5MYXWAKD.js} +512 -1033
  48. package/dist/_node-chunks/chunk-5N7YRHXJ.js +20 -0
  49. package/dist/_node-chunks/{chunk-QGVU7IFS.js → chunk-6772LYNF.js} +7 -7
  50. package/dist/_node-chunks/{chunk-IGOX6TUG.js → chunk-76M6JG5T.js} +7 -7
  51. package/dist/_node-chunks/{chunk-MKUA4ZCG.js → chunk-7F6TIY4T.js} +8 -8
  52. package/dist/_node-chunks/{chunk-KWNBN3DV.js → chunk-7SBWGNA7.js} +10 -10
  53. package/dist/_node-chunks/chunk-ABCEMTIP.js +20 -0
  54. package/dist/_node-chunks/{chunk-JVWXCB3L.js → chunk-AHNN3TQH.js} +8 -8
  55. package/dist/_node-chunks/{chunk-CEDR5CNM.js → chunk-BDATIKVV.js} +7 -7
  56. package/dist/_node-chunks/{chunk-K4O2ZAMU.js → chunk-BMM74ZQW.js} +6 -6
  57. package/dist/_node-chunks/{chunk-DR7NW2MI.js → chunk-BOWRRVJM.js} +6 -6
  58. package/dist/_node-chunks/{chunk-FRBE7ES4.js → chunk-BTDLJXAT.js} +6 -6
  59. package/dist/_node-chunks/{chunk-GKHLTHYM.js → chunk-C2HVGXLD.js} +224 -181
  60. package/dist/_node-chunks/chunk-CWIJ2D5F.js +18 -0
  61. package/dist/_node-chunks/{chunk-QOFBJXPH.js → chunk-DNX4BLMS.js} +7 -7
  62. package/dist/_node-chunks/{chunk-G2ZUFOHU.js → chunk-DXR3YGRT.js} +6 -6
  63. package/dist/_node-chunks/{chunk-GBVWRZHP.js → chunk-EFZAYIPN.js} +6 -6
  64. package/dist/_node-chunks/{chunk-MY7UVHPL.js → chunk-FAR3NIPG.js} +8 -8
  65. package/dist/_node-chunks/{chunk-MBPHOLXB.js → chunk-FFUIQJRI.js} +32 -40
  66. package/dist/_node-chunks/{chunk-TZIT6SZP.js → chunk-FKI7K3GE.js} +6 -6
  67. package/dist/_node-chunks/{chunk-VSHYJR23.js → chunk-FR67COFW.js} +7 -7
  68. package/dist/_node-chunks/chunk-FUDG3QKB.js +25 -0
  69. package/dist/_node-chunks/chunk-G6GOV7H7.js +19 -0
  70. package/dist/_node-chunks/{chunk-DRCP3DQF.js → chunk-H7UVQBCQ.js} +8 -8
  71. package/dist/_node-chunks/{chunk-CSFNS7HA.js → chunk-HMQUTLMS.js} +6 -6
  72. package/dist/_node-chunks/{chunk-VG2KFIOW.js → chunk-HPXM4SGT.js} +9 -9
  73. package/dist/_node-chunks/{chunk-MQC7ZY6L.js → chunk-HW4T3OXA.js} +7 -7
  74. package/dist/_node-chunks/{chunk-QVLHVO4X.js → chunk-HW7RCOV4.js} +8 -8
  75. package/dist/_node-chunks/{chunk-NGFFEW2B.js → chunk-IFHNMS7I.js} +19 -19
  76. package/dist/_node-chunks/{chunk-IL7YA7QJ.js → chunk-IKUSSZJ3.js} +10 -10
  77. package/dist/_node-chunks/{chunk-OPG46TLN.js → chunk-IOXDHKFF.js} +7 -7
  78. package/dist/_node-chunks/chunk-J3CNNXKQ.js +11 -0
  79. package/dist/_node-chunks/{chunk-ACSO4HQP.js → chunk-JB4457FJ.js} +6 -6
  80. package/dist/_node-chunks/{chunk-T5VZYRL2.js → chunk-JHX35YKT.js} +6 -6
  81. package/dist/_node-chunks/{chunk-CKE4R4NL.js → chunk-JKPKEYSH.js} +6 -6
  82. package/dist/_node-chunks/{chunk-RC4HPD5Q.js → chunk-JMFTALJW.js} +6 -6
  83. package/dist/_node-chunks/{chunk-BDU3ZUMK.js → chunk-JXS4P2RM.js} +7 -7
  84. package/dist/_node-chunks/{chunk-7CV4VEA2.js → chunk-K2K6KTBC.js} +8 -8
  85. package/dist/_node-chunks/{chunk-THDTJJMO.js → chunk-KMC5WWQS.js} +7 -7
  86. package/dist/_node-chunks/{chunk-FJFB7TWU.js → chunk-KQTFSKC6.js} +8 -8
  87. package/dist/_node-chunks/{chunk-GQYATLH6.js → chunk-KZPWZM2E.js} +37 -34
  88. package/dist/_node-chunks/{chunk-FZ453CHY.js → chunk-LTJ4AYDM.js} +6 -6
  89. package/dist/_node-chunks/{chunk-LH5QBX2U.js → chunk-MNNESU33.js} +497 -475
  90. package/dist/_node-chunks/{chunk-FQGQ5KHN.js → chunk-MNQVVJZN.js} +6 -6
  91. package/dist/_node-chunks/{chunk-CZ3V3HHK.js → chunk-NO7MF6VR.js} +6 -6
  92. package/dist/_node-chunks/{chunk-MIWBXEUH.js → chunk-NPSIAK46.js} +6 -6
  93. package/dist/_node-chunks/{chunk-GGE7TBVX.js → chunk-NUSHY22I.js} +62 -7
  94. package/dist/_node-chunks/{chunk-YU5TVYPS.js → chunk-NXRZL2PR.js} +6 -6
  95. package/dist/_node-chunks/{chunk-7O2UIVID.js → chunk-O2CCUB5T.js} +7 -7
  96. package/dist/_node-chunks/{chunk-BNEC3EBC.js → chunk-ORSH2FXG.js} +6 -6
  97. package/dist/_node-chunks/{chunk-LX2XSPPL.js → chunk-OSNOV4EH.js} +7 -7
  98. package/dist/_node-chunks/{chunk-BPL3ERBH.js → chunk-PHB6QBHM.js} +10 -10
  99. package/dist/_node-chunks/{chunk-63LPGIV4.js → chunk-POA32M7F.js} +21 -21
  100. package/dist/_node-chunks/{chunk-QFXAGOIO.js → chunk-Q64ESHBN.js} +8 -8
  101. package/dist/_node-chunks/{chunk-SYUOBOB5.js → chunk-QBWGJYHY.js} +6 -6
  102. package/dist/_node-chunks/{chunk-7OY4VMAT.js → chunk-QSKVNZCF.js} +7 -7
  103. package/dist/_node-chunks/{chunk-MRCPS4S3.js → chunk-QX6RXAEU.js} +6 -6
  104. package/dist/_node-chunks/{chunk-RJXAXHDJ.js → chunk-R73PEGQU.js} +9 -9
  105. package/dist/_node-chunks/{chunk-3CSGIJKG.js → chunk-RHH7VDIY.js} +8 -8
  106. package/dist/_node-chunks/{chunk-BXDMSX3D.js → chunk-RMJNWFPV.js} +9 -9
  107. package/dist/_node-chunks/{chunk-GJSYGBI5.js → chunk-RT2LVWTC.js} +7 -7
  108. package/dist/_node-chunks/{chunk-5NRWU7S2.js → chunk-SPCPGRYF.js} +7 -7
  109. package/dist/_node-chunks/{chunk-FWAF5NBL.js → chunk-SUHBBHKR.js} +6 -6
  110. package/dist/_node-chunks/{chunk-SGEPJMTU.js → chunk-TXZTC6LA.js} +22 -22
  111. package/dist/_node-chunks/{chunk-5SMIGUYF.js → chunk-U5HVQTHI.js} +6 -6
  112. package/dist/_node-chunks/{chunk-LG3NMXCM.js → chunk-UFZUSE3Y.js} +6 -6
  113. package/dist/_node-chunks/{chunk-DQ44ZAEM.js → chunk-UGQFYYBC.js} +6 -6
  114. package/dist/_node-chunks/{chunk-R2ZCFA7I.js → chunk-UKLCYEZU.js} +7 -7
  115. package/dist/_node-chunks/{chunk-IUPE4SU2.js → chunk-VJEN2JM3.js} +8 -8
  116. package/dist/_node-chunks/{chunk-WVRM6DQU.js → chunk-W5ZAUN5R.js} +7 -7
  117. package/dist/_node-chunks/{chunk-7KD5DKGZ.js → chunk-WNEWL2PL.js} +6 -6
  118. package/dist/_node-chunks/{chunk-6DHTL5G2.js → chunk-WUVQ465T.js} +6 -6
  119. package/dist/_node-chunks/{chunk-3W4KR5GX.js → chunk-XCNYQV2M.js} +19 -15
  120. package/dist/_node-chunks/{chunk-VUMGWJ6Y.js → chunk-XOAWAXUH.js} +7 -7
  121. package/dist/_node-chunks/chunk-Y472MP5U.js +281 -0
  122. package/dist/_node-chunks/{chunk-HCP5DG52.js → chunk-ZCKTYMZT.js} +320 -316
  123. package/dist/_node-chunks/{chunk-ECOW63CV.js → chunk-ZUK5ZLPP.js} +8 -8
  124. package/dist/_node-chunks/dist-2DPC664Y.js +27 -0
  125. package/dist/_node-chunks/dist-XBFUDMFQ.js +16 -0
  126. package/dist/_node-chunks/{local-runtime-V5YTRN24.js → local-runtime-Z667YPXR.js} +19 -20
  127. package/dist/_node-chunks/{mdx-plugin-CBOD52VP.js → mdx-plugin-BPRPTZNP.js} +13 -13
  128. package/dist/_node-chunks/{monorepo-GF6H53U4.js → monorepo-GO54BY34.js} +11 -11
  129. package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-K4TTV2DQ.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-PEHFNJQ5.js} +11 -11
  130. package/dist/_node-chunks/optimized-tests-W7U4ZRWX.js +22 -0
  131. package/dist/_node-chunks/{pattern-copy-play-M2QNC4IZ.js → pattern-copy-play-64HQIVWK.js} +9 -9
  132. package/dist/_node-chunks/postinstallAddon-XM2BHKDN.js +20 -0
  133. package/dist/_node-chunks/{rehype-external-links-3IDE4CYH.js → rehype-external-links-2BSEZ7AC.js} +9 -9
  134. package/dist/_node-chunks/{rehype-slug-GKB3WS3U.js → rehype-slug-6253EA36.js} +9 -9
  135. package/dist/_node-chunks/{relaxed-limits-C6QU365N.js → relaxed-limits-4PAAPG3J.js} +11 -11
  136. package/dist/_node-chunks/{run-XWBUPXLN.js → run-3SQW3FRF.js} +18 -18
  137. package/dist/_node-chunks/{run-TMVS3KKA.js → run-XJT3YVMZ.js} +16 -16
  138. package/dist/_node-chunks/{setup-KEEJK4WI.js → setup-JIYCTADZ.js} +8 -8
  139. package/dist/_node-chunks/{vitest.config.4.template-74HEE4WJ.js → vitest.config.4.template-W74SGWHT.js} +7 -7
  140. package/dist/actions/decorator.js +12 -20
  141. package/dist/addon-a11y/index.js +2 -2
  142. package/dist/addon-a11y/manager.js +12 -12
  143. package/dist/addon-a11y/preset.js +7 -7
  144. package/dist/addon-a11y/preview.js +2 -2
  145. package/dist/addon-docs/blocks.d.ts +10 -6
  146. package/dist/addon-docs/blocks.js +28 -30
  147. package/dist/addon-docs/index.js +3 -3
  148. package/dist/addon-docs/manager.js +3 -3
  149. package/dist/addon-docs/preset.js +10 -10
  150. package/dist/addon-docs/preview.js +1 -1
  151. package/dist/addon-links/preview.d.ts +1 -1
  152. package/dist/addon-mcp/preset.js +9 -9
  153. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +15 -15
  154. package/dist/addon-ondevice-controls/index.js +1 -1
  155. package/dist/addon-ondevice-controls/register.js +1 -1
  156. package/dist/addon-pseudo-states/index.js +1 -1
  157. package/dist/addon-pseudo-states/preview.js +1 -1
  158. package/dist/addon-themes/postinstall.js +7 -7
  159. package/dist/addon-vitest/constants.js +8 -8
  160. package/dist/addon-vitest/manager.js +18 -9
  161. package/dist/addon-vitest/node/coverage-reporter.js +11 -11
  162. package/dist/addon-vitest/node/vitest.js +28 -28
  163. package/dist/addon-vitest/postinstall.js +10 -10
  164. package/dist/addon-vitest/preset.js +15 -15
  165. package/dist/addon-vitest/vitest-plugin/global-setup.js +21 -21
  166. package/dist/addon-vitest/vitest-plugin/index.js +68 -58
  167. package/dist/babel/index.js +11 -11
  168. package/dist/bin/core.js +106 -88
  169. package/dist/bin/dispatcher.js +10 -10
  170. package/dist/bin/loader.js +8 -8
  171. package/dist/builder-vite/index.js +18 -18
  172. package/dist/builder-vite/preset.js +13 -13
  173. package/dist/channels/index.d.ts +1 -1
  174. package/dist/channels/index.js +1 -1
  175. package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
  176. package/dist/{chunk-Fg1Fm__9.d.ts → chunk-BmCH-L7_.d.ts} +393 -383
  177. package/dist/{chunk-CNqjcOmK.d.ts → chunk-Bn1RoGAP.d.ts} +1 -1
  178. package/dist/{chunk-BXLImeLy.d.ts → chunk-CfEntHiI.d.ts} +18 -3
  179. package/dist/{chunk-D0NUmzXp.d.ts → chunk-IMedIHPn.d.ts} +3 -3
  180. package/dist/{chunk-CYuvV2sR.d.ts → chunk-evfhuBNU.d.ts} +1 -1
  181. package/dist/cli/index.d.ts +2 -2
  182. package/dist/cli/index.js +25 -30
  183. package/dist/cli/tools/sdk/child-host.d.ts +1 -1
  184. package/dist/cli/tools/sdk/child-host.js +17 -17
  185. package/dist/cli/tools/sdk/index.d.ts +2 -2
  186. package/dist/cli/tools/sdk/index.js +18 -18
  187. package/dist/cli-commands/bin/index.js +7 -7
  188. package/dist/client-logger/index.js +2 -1
  189. package/dist/common/index.d.ts +5 -5
  190. package/dist/common/index.js +34 -35
  191. package/dist/components/index.d.ts +6 -6
  192. package/dist/components/index.js +152 -162
  193. package/dist/core-server/index.d.ts +6 -5
  194. package/dist/core-server/index.js +688 -152
  195. package/dist/core-server/presets/common-manager.js +227 -316
  196. package/dist/core-server/presets/common-override-preset.js +10 -10
  197. package/dist/core-server/presets/common-preset.js +73 -268
  198. package/dist/create/bin/index.js +7 -7
  199. package/dist/create/index.js +15 -15
  200. package/dist/csf/csf-utils.d.ts +1 -1
  201. package/dist/csf/index.d.ts +1 -1
  202. package/dist/csf/index.js +10 -10
  203. package/dist/csf-tools/index.d.ts +41 -37
  204. package/dist/csf-tools/index.js +13 -13
  205. package/dist/instrumenter/index.d.ts +1 -1
  206. package/dist/instrumenter/index.js +1 -1
  207. package/dist/manager/_manager-chunks/{globals-runtime-CJL1dQtn.js → globals-runtime--RDllwDw.js} +629 -436
  208. package/dist/manager/_manager-chunks/{globals-runtime-DvV_TF3-.js → globals-runtime-B4NRbNSS.js} +2 -2
  209. package/dist/manager/_manager-chunks/{globals-runtime-wjkxyMn0.js → globals-runtime-BC43T1rL.js} +4150 -50
  210. package/dist/manager/_manager-chunks/{globals-runtime-CfurFwS_.js → globals-runtime-BFVFUcji.js} +2 -2
  211. package/dist/manager/_manager-chunks/{globals-runtime-BKQscPdC.js → globals-runtime-BWciJpaD.js} +103 -101
  212. package/dist/manager/_manager-chunks/{globals-runtime-CA8AuIRT.js → globals-runtime-BnQ7i5wq.js} +232 -228
  213. package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
  214. package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
  215. package/dist/manager/_manager-chunks/{globals-runtime-BY3epqww.js → globals-runtime-CS41oTca.js} +2 -1
  216. package/dist/manager/_manager-chunks/{globals-runtime-DBba3I9c.js → globals-runtime-CdLHkSK1.js} +260 -401
  217. package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
  218. package/dist/manager/_manager-chunks/{globals-runtime-BweHuXkK.js → globals-runtime-DCmvKMN5.js} +2 -2
  219. package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
  220. package/dist/manager/_manager-chunks/{globals-runtime-CvIgTRVu.js → globals-runtime-DhygDQ09.js} +5 -5
  221. package/dist/manager/_manager-chunks/{globals-runtime-NwJK8t0T.js → globals-runtime-DweLlyBa.js} +5 -4
  222. package/dist/manager/_manager-chunks/globals-runtime-Me9Bl-sx.js +156 -0
  223. package/dist/manager/_manager-chunks/globals-runtime-nQMRiA0J.js +19 -0
  224. package/dist/manager/_manager-chunks/{globals-runtime-Bj5KDUJi.js → globals-runtime-oRjPg2jY.js} +1 -1
  225. package/dist/manager/_manager-chunks/{runtime-Bs3bEhuy.js → runtime-1BcYUf7-.js} +24 -42
  226. package/dist/manager/_manager-chunks/{runtime-CBQsKmch.js → runtime-B2VQIT0n.js} +739 -554
  227. package/dist/manager/_manager-chunks/runtime-BBaBlpAS.js +552 -0
  228. package/dist/manager/_manager-chunks/{runtime-B_nqedQW.js → runtime-BFgSyEE6.js} +13 -13
  229. package/dist/manager/_manager-chunks/{runtime-jj8qYc2n.js → runtime-CE_oqcpl.js} +6 -6
  230. package/dist/manager/_manager-chunks/{runtime-DtCVCy4G.js → runtime-CRqm7NXD.js} +49 -49
  231. package/dist/manager/_manager-chunks/{runtime-5B2mWjEm.js → runtime-CZtDJIYj.js} +3 -3
  232. package/dist/manager/_manager-chunks/{runtime-eBAgOym6.js → runtime-D3Gk2bTl.js} +846 -835
  233. package/dist/manager/_manager-chunks/{runtime-DG61zYUm.js → runtime-Db8fJ2MP.js} +67 -500
  234. package/dist/manager/_manager-chunks/{runtime-j9yqh0tr.js → runtime-Dj8tizGo.js} +101 -101
  235. package/dist/manager/globals-runtime.js +1 -1
  236. package/dist/manager/runtime.js +1 -1
  237. package/dist/manager-api/index.d.ts +1 -1
  238. package/dist/manager-api/index.js +444 -428
  239. package/dist/manager-errors.d.ts +1 -1
  240. package/dist/mcp/index.js +9 -9
  241. package/dist/mocking-utils/index.js +15 -19
  242. package/dist/nextjs-vite/export-mocks/router/index.js +1 -1
  243. package/dist/nextjs-vite/index.d.ts +1 -1
  244. package/dist/nextjs-vite/index.js +4 -4
  245. package/dist/nextjs-vite/node/index.js +7 -7
  246. package/dist/nextjs-vite/preset.js +12 -12
  247. package/dist/nextjs-vite/preview.js +1 -1
  248. package/dist/nextjs-vite/vite-plugin/index.d.ts +2 -2
  249. package/dist/nextjs-vite/vite-plugin/index.js +9 -9
  250. package/dist/nextjs-vite-plugin/index.js +15 -15
  251. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
  252. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +1 -1
  253. package/dist/node-logger/index.d.ts +16 -16
  254. package/dist/node-logger/index.js +9 -9
  255. package/dist/oxc-parser/index.js +14 -11
  256. package/dist/oxc-parser/worker.js +10 -10
  257. package/dist/preview/_chunks/{runtime-BJwGQok8.js → runtime-4BNaFIif.js} +180 -21
  258. package/dist/preview/_chunks/{runtime-BUnOhg9h.js → runtime-BSJ0Ov_b.js} +2 -2
  259. package/dist/preview/_chunks/{runtime-BhSZ1Mwt.js → runtime-Bjm1gBLN.js} +6 -19
  260. package/dist/preview/_chunks/{runtime-Bcv1hJky.js → runtime-CBKlMZg2.js} +4148 -48
  261. package/dist/preview/_chunks/{runtime-BPwAnlRx.js → runtime-CElbz0uN.js} +1 -1
  262. package/dist/preview/_chunks/{runtime-BZ4pNS3g.js → runtime-C_nyb8QT.js} +3 -3
  263. package/dist/preview/_chunks/{runtime-BgPhfM5P.js → runtime-CzTPeFXg.js} +676 -376
  264. package/dist/preview/_chunks/{runtime-WapFVPAh.js → runtime-DZ7fvh0y.js} +1 -1
  265. package/dist/preview/runtime.js +1 -1
  266. package/dist/preview-api/index.d.ts +2 -2
  267. package/dist/preview-api/index.js +5 -5
  268. package/dist/preview-errors.d.ts +1 -1
  269. package/dist/react/docgen/docgen-worker.js +11 -11
  270. package/dist/react/entry-preview-argtypes.js +1 -1
  271. package/dist/react/entry-preview-docs.js +1 -1
  272. package/dist/react/entry-preview.js +1 -1
  273. package/dist/react/index.d.ts +1 -1
  274. package/dist/react/index.js +5 -5
  275. package/dist/react/preset.js +13 -13
  276. package/dist/react/preview.js +4 -4
  277. package/dist/react-native/bin/get-stories.js +8 -8
  278. package/dist/react-native/index.d.ts +37 -36
  279. package/dist/react-native/index.js +30 -34
  280. package/dist/react-native/metro/node.d.ts +1 -1
  281. package/dist/react-native/metro/node.js +10 -10
  282. package/dist/react-native/metro/withForkbook.d.ts +7 -7
  283. package/dist/react-native/metro/withForkbook.js +14 -14
  284. package/dist/react-native/preview.js +4 -1
  285. package/dist/react-native/scripts/generate.js +8 -8
  286. package/dist/react-native/stub.js +1 -1
  287. package/dist/react-native-ui/index.d.ts +4 -3
  288. package/dist/react-native-ui/index.js +1 -8
  289. package/dist/react-native-ui-common/index.d.ts +7 -6
  290. package/dist/react-native-ui-common/index.js +6 -6
  291. package/dist/react-vite/node/index.js +7 -7
  292. package/dist/react-vite/preset.js +7 -7
  293. package/dist/server-errors.d.ts +1 -1
  294. package/dist/server-errors.js +9 -9
  295. package/dist/shared/open-service/index.d.ts +1 -1
  296. package/dist/shared/open-service/index.js +1 -1
  297. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
  298. package/dist/shared/open-service/toolsets/docs/public.d.ts +2 -2
  299. package/dist/telemetry/index.d.ts +38 -274
  300. package/dist/telemetry/index.js +11 -66
  301. package/dist/test/index.js +125 -112
  302. package/dist/types/index.d.ts +1 -1
  303. package/dist/types/index.js +2 -2
  304. package/package.json +15 -15
  305. package/template/nextjs-vite/cli/js/Button.jsx +2 -2
  306. package/template/nextjs-vite/cli/js/Header.jsx +1 -1
  307. package/template/nextjs-vite/cli/js/Page.jsx +1 -1
  308. package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
  309. package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
  310. package/template/nextjs-vite/cli/ts/Page.tsx +1 -1
  311. package/template/react/cli/js/Button.jsx +2 -2
  312. package/template/react/cli/js/Header.jsx +1 -1
  313. package/template/react/cli/js/Page.jsx +1 -1
  314. package/template/react/cli/ts/Button.tsx +2 -2
  315. package/template/react/cli/ts/Header.tsx +1 -1
  316. package/template/react/cli/ts/Page.tsx +1 -1
  317. package/template/react-vite/cli/js/Button.jsx +2 -2
  318. package/template/react-vite/cli/js/Header.jsx +1 -1
  319. package/template/react-vite/cli/js/Page.jsx +1 -1
  320. package/template/react-vite/cli/ts/Button.tsx +2 -2
  321. package/template/react-vite/cli/ts/Header.tsx +1 -1
  322. package/template/react-vite/cli/ts/Page.tsx +1 -1
  323. package/dist/_node-chunks/chunk-BMJPOQ2S.js +0 -11
  324. package/dist/_node-chunks/chunk-C3PLG47Q.js +0 -25
  325. package/dist/_node-chunks/chunk-DNV3LPV3.js +0 -33
  326. package/dist/_node-chunks/chunk-DPILYJH4.js +0 -33
  327. package/dist/_node-chunks/chunk-EBWZKN2I.js +0 -1297
  328. package/dist/_node-chunks/chunk-ENBDAHOV.js +0 -18
  329. package/dist/_node-chunks/chunk-FAEOR2AW.js +0 -40
  330. package/dist/_node-chunks/chunk-HVOSLI2K.js +0 -20
  331. package/dist/_node-chunks/chunk-ND323XCC.js +0 -33
  332. package/dist/_node-chunks/chunk-PEL4YXU6.js +0 -19
  333. package/dist/_node-chunks/chunk-T6IU66AM.js +0 -69
  334. package/dist/_node-chunks/chunk-TY2ZY7AO.js +0 -155
  335. package/dist/_node-chunks/chunk-ZD5TUA6I.js +0 -20
  336. package/dist/_node-chunks/dist-7OJKTBKL.js +0 -27
  337. package/dist/_node-chunks/dist-MWP6WLW4.js +0 -16
  338. package/dist/_node-chunks/optimized-tests-KOTSVWTN.js +0 -22
  339. package/dist/_node-chunks/postinstallAddon-WXKJL6DP.js +0 -20
  340. package/dist/_node-chunks/session-id-VMH57SKN.js +0 -23
  341. package/dist/manager/_manager-chunks/globals-runtime-Bs75QQ_I.js +0 -9987
  342. package/dist/manager/_manager-chunks/globals-runtime-WZKaeKm9.js +0 -4091
  343. package/dist/manager/_manager-chunks/runtime-5o_11Jae.js +0 -78
  344. package/dist/preview/_chunks/runtime-BsMjBzuq.js +0 -53
  345. package/dist/preview/_chunks/runtime-C1jgT6tJ.js +0 -4091
  346. package/dist/preview/_chunks/runtime-CkOhMcXf.js +0 -387
@@ -14,13 +14,13 @@ import {
14
14
  createStatusStore,
15
15
  statusValueShortName,
16
16
  toStatusValue
17
- } from "../_browser-chunks/chunk-DYNTDJ3O.js";
17
+ } from "../_browser-chunks/chunk-2UKY4NXZ.js";
18
18
  import {
19
19
  getService,
20
20
  registerService,
21
21
  useServiceCommand,
22
22
  useServiceQuery
23
- } from "../_browser-chunks/chunk-NGMQJMCY.js";
23
+ } from "../_browser-chunks/chunk-3O4QUF3D.js";
24
24
  import {
25
25
  countBy,
26
26
  partition
@@ -34,14 +34,14 @@ import {
34
34
  Tag,
35
35
  USER_TAG_FILTER,
36
36
  mockChannel
37
- } from "../_browser-chunks/chunk-3M5T7BW4.js";
38
- import "../_browser-chunks/chunk-KYSD26D6.js";
37
+ } from "../_browser-chunks/chunk-GGALYEQS.js";
38
+ import "../_browser-chunks/chunk-IGD46SQI.js";
39
39
  import {
40
40
  getChannel,
41
41
  setChannel
42
- } from "../_browser-chunks/chunk-N3NRW5XX.js";
42
+ } from "../_browser-chunks/chunk-2YWS25WY.js";
43
43
  import "../_browser-chunks/chunk-QC4HFS6K.js";
44
- import "../_browser-chunks/chunk-76222HQR.js";
44
+ import "../_browser-chunks/chunk-E6QKKKLO.js";
45
45
  import {
46
46
  stringify
47
47
  } from "../_browser-chunks/chunk-SFVA4SBT.js";
@@ -806,7 +806,7 @@ var TITLE_PATH_SEPARATOR = /\s*\/\s*/, denormalizeStoryParameters = ({
806
806
  var { location, fetch } = global, getSourceType = (source, refId) => {
807
807
  let { origin: localOrigin, pathname: localPathname } = location, { origin: sourceOrigin, pathname: sourcePathname } = new URL(source), localFull = `${localOrigin + localPathname}`.replace(/\/[^\/]*$/, ""), sourceFull = `${sourceOrigin + sourcePathname}`.replace(/\/[^\/]*$/, "");
808
808
  return localFull === sourceFull ? ["local", sourceFull] : refId || source ? ["external", sourceFull] : [null, null];
809
- }, defaultStoryMapper = (b, a) => ({ ...a, kind: a.kind.replace("|", "/") }), addRefIds = (input, ref) => Object.entries(input).reduce((acc, [id, item]) => ({ ...acc, [id]: { ...item, refId: ref.id } }), {}), applyRefStoryUpdates = (index, storyUpdates) => (storyUpdates && Object.entries(storyUpdates).forEach(([id, update2]) => {
809
+ }, defaultStoryMapper = (_ref, a) => ({ ...a, kind: a.kind.replace("|", "/") }), addRefIds = (input, ref) => Object.entries(input).reduce((acc, [id, item]) => ({ ...acc, [id]: { ...item, refId: ref.id } }), {}), applyRefStoryUpdates = (index, storyUpdates) => (storyUpdates && Object.entries(storyUpdates).forEach(([id, update2]) => {
810
810
  let entry = index[id];
811
811
  entry && (entry.type === "story" || entry.type === "docs") && (index[id] = { ...entry, ...update2 });
812
812
  }), index);
@@ -946,7 +946,9 @@ var parseUrl = (url) => {
946
946
  updateRef: async (id, data) => {
947
947
  let { [id]: ref, ...updated } = api.getRefs();
948
948
  updated[id] = { ...ref, ...data };
949
- let ordered = Object.keys(initialState).reduce((obj, key) => (obj[key] = updated[key], obj), {});
949
+ let ordered = Object.fromEntries(
950
+ Object.keys(initialState).map((key) => [key, updated[key]])
951
+ );
950
952
  await store2.setState({
951
953
  refs: ordered
952
954
  });
@@ -1780,32 +1782,16 @@ var stories_exports = {};
1780
1782
  __export(stories_exports, {
1781
1783
  init: () => init11
1782
1784
  });
1783
- import { logger as logger7 } from "@aussieljk/forkbook/internal/client-logger";
1785
+ import { logger as logger8 } from "@aussieljk/forkbook/internal/client-logger";
1784
1786
  import {
1785
- CONFIG_ERROR,
1786
- CURRENT_STORY_WAS_SET,
1787
- DOCS_PREPARED,
1788
- PRELOAD_ENTRIES,
1789
1787
  RESET_STORY_ARGS,
1790
- SELECT_STORY,
1791
- SET_CONFIG as SET_CONFIG3,
1792
- SET_CURRENT_STORY,
1793
- SET_FILTER,
1794
- SET_INDEX,
1795
- SET_STORIES,
1796
- SIDEBAR_FILTER_CHANGED,
1797
- STORY_ARGS_UPDATED,
1798
- STORY_CHANGED,
1799
1788
  STORY_INDEX_INVALIDATED,
1800
- STORY_MISSING,
1801
- STORY_PREPARED,
1802
- STORY_SPECIFIED,
1803
1789
  UPDATE_STORY_ARGS
1804
1790
  } from "@aussieljk/forkbook/internal/core-events";
1805
1791
  import { sanitize as sanitize2, toId } from "@aussieljk/forkbook/internal/csf";
1806
1792
  import {
1807
1793
  fromUrlPath,
1808
- queryFromLocation,
1794
+ queryFromLocation as queryFromLocation2,
1809
1795
  setStoryPathEntries,
1810
1796
  toUrlPath
1811
1797
  } from "@aussieljk/forkbook/internal/router";
@@ -1848,6 +1834,152 @@ var statusStore = createStatusStore({
1848
1834
  environment: "manager"
1849
1835
  }), { fullStatusStore, getStatusStoreByTypeId, useStatusStore, universalStatusStore } = statusStore;
1850
1836
 
1837
+ // src/manager-api/modules/stories-events.ts
1838
+ import {
1839
+ CONFIG_ERROR,
1840
+ CURRENT_STORY_WAS_SET,
1841
+ DOCS_PREPARED,
1842
+ PRELOAD_ENTRIES,
1843
+ SELECT_STORY,
1844
+ SET_CURRENT_STORY,
1845
+ SET_INDEX,
1846
+ SET_STORIES,
1847
+ STORY_ARGS_UPDATED,
1848
+ STORY_CHANGED,
1849
+ STORY_MISSING,
1850
+ STORY_PREPARED,
1851
+ STORY_SPECIFIED
1852
+ } from "@aussieljk/forkbook/internal/core-events";
1853
+ var removedOptions = ["enableShortcuts", "theme", "showRoots"];
1854
+ function removeRemovedOptions(options) {
1855
+ if (!options || typeof options == "string")
1856
+ return options;
1857
+ let result = { ...options };
1858
+ return removedOptions.forEach((option) => {
1859
+ option in result && delete result[option];
1860
+ }), result;
1861
+ }
1862
+ var listenToStoryEvents = ({
1863
+ store: store2,
1864
+ provider,
1865
+ fullAPI,
1866
+ api,
1867
+ navigateWithQueryParams
1868
+ }) => {
1869
+ provider.channel?.on(
1870
+ STORY_SPECIFIED,
1871
+ function({ storyId, viewMode }) {
1872
+ let { sourceType } = getEventMetadata(this, fullAPI);
1873
+ if (sourceType === "local") {
1874
+ let state = store2.getState(), isCanvasRoute = !isReviewManagerRoute(state.path, state.customQueryParams) && (state.path === "/" || state.viewMode === "story" || state.viewMode === "docs"), stateHasSelection = state.viewMode && state.storyId, stateSelectionDifferent = state.viewMode !== viewMode || state.storyId !== storyId, { type } = state.index?.[state.storyId] || {}, isStory = !(type === "root" || type === "component" || type === "group");
1875
+ if (isCanvasRoute) {
1876
+ let { filteredIndex } = state;
1877
+ if (filteredIndex && !stateHasSelection && !(filteredIndex[storyId]?.type === "story")) {
1878
+ let firstFiltered = Object.keys(filteredIndex).find((id) => {
1879
+ let entry = filteredIndex[id];
1880
+ return entry.type === "story" || entry.type === "docs";
1881
+ });
1882
+ firstFiltered && navigateWithQueryParams(`/${viewMode}/${firstFiltered}`);
1883
+ return;
1884
+ }
1885
+ stateHasSelection && stateSelectionDifferent && isStory ? provider.channel?.emit(SET_CURRENT_STORY, {
1886
+ storyId: state.storyId,
1887
+ viewMode: state.viewMode
1888
+ }) : stateSelectionDifferent && navigateWithQueryParams(`/${viewMode}/${storyId}`);
1889
+ }
1890
+ }
1891
+ }
1892
+ ), provider.channel?.on(CURRENT_STORY_WAS_SET, function() {
1893
+ let { ref } = getEventMetadata(this, fullAPI);
1894
+ api.setPreviewInitialized(ref);
1895
+ }), provider.channel?.on(STORY_CHANGED, function() {
1896
+ let { sourceType } = getEventMetadata(this, fullAPI);
1897
+ if (sourceType === "local") {
1898
+ let options = api.getCurrentParameter("options");
1899
+ options && fullAPI.setOptions(removeRemovedOptions(options));
1900
+ }
1901
+ }), provider.channel?.on(
1902
+ STORY_PREPARED,
1903
+ function({ id, ...update2 }) {
1904
+ let { ref, sourceType } = getEventMetadata(this, fullAPI);
1905
+ if (api.updateStory(id, { ...update2, prepared: !0 }, ref), !ref && !store2.getState().hasCalledSetOptions) {
1906
+ let { options } = update2.parameters;
1907
+ fullAPI.setOptions(removeRemovedOptions(options)), store2.setState({ hasCalledSetOptions: !0 });
1908
+ }
1909
+ if (sourceType === "local") {
1910
+ let { storyId, index, refId } = store2.getState();
1911
+ if (!index)
1912
+ return;
1913
+ let toBePreloaded = Array.from(
1914
+ /* @__PURE__ */ new Set([
1915
+ api.findSiblingStoryId(storyId, index, 1, !0),
1916
+ api.findSiblingStoryId(storyId, index, -1, !0)
1917
+ ])
1918
+ ).filter(Boolean);
1919
+ provider.channel?.emit(PRELOAD_ENTRIES, {
1920
+ ids: toBePreloaded,
1921
+ options: { target: refId }
1922
+ });
1923
+ }
1924
+ }
1925
+ ), provider.channel?.on(
1926
+ DOCS_PREPARED,
1927
+ function({ id, ...update2 }) {
1928
+ let { ref } = getEventMetadata(this, fullAPI);
1929
+ api.updateStory(id, { ...update2, prepared: !0 }, ref);
1930
+ }
1931
+ ), provider.channel?.on(SET_INDEX, function(index) {
1932
+ let { ref } = getEventMetadata(this, fullAPI);
1933
+ if (ref)
1934
+ fullAPI.setRef(ref.id, { ...ref, storyIndex: index }, !0);
1935
+ else {
1936
+ api.setIndex(index);
1937
+ let options = api.getCurrentParameter("options");
1938
+ fullAPI.setOptions(removeRemovedOptions(options));
1939
+ }
1940
+ }), provider.channel?.on(SET_STORIES, function(data) {
1941
+ let { ref } = getEventMetadata(this, fullAPI), setStoriesData = data.v ? denormalizeStoryParameters(data) : data.stories;
1942
+ if (ref)
1943
+ fullAPI.setRef(ref.id, { ...ref, setStoriesData }, !0);
1944
+ else
1945
+ throw new Error("Cannot call SET_STORIES for local frame");
1946
+ }), provider.channel?.on(
1947
+ SELECT_STORY,
1948
+ function({
1949
+ kind,
1950
+ title = kind,
1951
+ story,
1952
+ name = story,
1953
+ storyId,
1954
+ ...rest
1955
+ }) {
1956
+ let { ref } = getEventMetadata(this, fullAPI);
1957
+ ref ? fullAPI.selectStory(storyId || title, name, { ...rest, ref: ref.id }) : fullAPI.selectStory(storyId || title, name, rest);
1958
+ }
1959
+ ), provider.channel?.on(
1960
+ STORY_ARGS_UPDATED,
1961
+ function({ storyId, args }) {
1962
+ let { ref } = getEventMetadata(this, fullAPI);
1963
+ api.updateStory(storyId, { args }, ref);
1964
+ }
1965
+ ), provider.channel?.on(CONFIG_ERROR, function() {
1966
+ let { ref } = getEventMetadata(this, fullAPI);
1967
+ api.setPreviewInitialized(ref);
1968
+ }), provider.channel?.on(STORY_MISSING, function() {
1969
+ let { ref } = getEventMetadata(this, fullAPI);
1970
+ api.setPreviewInitialized(ref);
1971
+ });
1972
+ };
1973
+
1974
+ // src/manager-api/modules/stories-filters.ts
1975
+ import { logger as logger7 } from "@aussieljk/forkbook/internal/client-logger";
1976
+ import {
1977
+ SET_CONFIG as SET_CONFIG3,
1978
+ SET_FILTER,
1979
+ SIDEBAR_FILTER_CHANGED
1980
+ } from "@aussieljk/forkbook/internal/core-events";
1981
+ import { queryFromLocation } from "@aussieljk/forkbook/internal/router";
1982
+
1851
1983
  // src/manager-api/lib/filter-param.ts
1852
1984
  var parseFilterParam = (param, transform) => {
1853
1985
  if (!param)
@@ -1915,45 +2047,18 @@ var BUILT_IN_URL_TAG_MAP = {
1915
2047
  };
1916
2048
  };
1917
2049
 
1918
- // src/manager-api/modules/stories.ts
1919
- var { fetch: fetch2 } = global, STORY_INDEX_PATH = "./index.json", TAGS_FILTER = "tags-filter", STATIC_FILTER = "static-filter", STATUS_FILTER = "status-filter", STATUS_CHANGE_REBUILD_THROTTLE = 500, BUILT_IN_TAG_IDS = new Set(Object.keys(BUILT_IN_FILTERS)), removedOptions = ["enableShortcuts", "theme", "showRoots"];
1920
- function removeRemovedOptions(options) {
1921
- if (!options || typeof options == "string")
1922
- return options;
1923
- let result = { ...options };
1924
- return removedOptions.forEach((option) => {
1925
- option in result && delete result[option];
1926
- }), result;
1927
- }
1928
- var FILTER_KEYS = {
2050
+ // src/manager-api/modules/stories-filters.ts
2051
+ var TAGS_FILTER = "tags-filter", STATIC_FILTER = "static-filter", STATUS_FILTER = "status-filter", STATUS_CHANGE_REBUILD_THROTTLE = 500, BUILT_IN_TAG_IDS = new Set(Object.keys(BUILT_IN_FILTERS)), FILTER_KEYS = {
1929
2052
  tag: { included: "includedTagFilters", excluded: "excludedTagFilters" },
1930
2053
  status: { included: "includedStatusFilters", excluded: "excludedStatusFilters" }
1931
- }, init11 = ({
1932
- fullAPI,
2054
+ }, initFilters = ({
1933
2055
  store: store2,
1934
- navigate,
1935
2056
  provider,
1936
- state: { location: location2 } = {},
1937
- storyId: initialStoryId,
1938
- viewMode: initialViewMode,
1939
- docsOptions = {}
2057
+ fullAPI,
2058
+ location: location2,
2059
+ setIndex
1940
2060
  }) => {
1941
- let navigateWithQueryParams = (path, options) => {
1942
- let { customQueryParams } = store2.getState();
1943
- navigate(buildNavigationUrl(path, customQueryParams ?? {}), options);
1944
- }, canonicaliseUrl = () => {
1945
- let { location: currentLocation, path, customQueryParams } = store2.getState(), pathname = currentLocation?.pathname;
1946
- if (!pathname || queryFromLocation(currentLocation).path)
1947
- return;
1948
- let resolved = fromUrlPath(pathname);
1949
- if (resolved === "/" || resolved === path && toUrlPath(resolved) === pathname)
1950
- return;
1951
- let target = buildNavigationUrl(
1952
- `${resolved}${currentLocation.hash ?? ""}`,
1953
- customQueryParams ?? {}
1954
- );
1955
- navigate(target, { replace: !0 });
1956
- }, persistFilters = (inputPatch) => store2.setState(inputPatch, {
2061
+ let persistFilters = (inputPatch) => store2.setState(inputPatch, {
1957
2062
  persistence: "url",
1958
2063
  serialize: (s) => {
1959
2064
  let tagsValue = serializeTagsParam(s.includedTagFilters, s.excludedTagFilters), statusesValue = serializeStatusesParam(
@@ -1962,8 +2067,8 @@ var FILTER_KEYS = {
1962
2067
  );
1963
2068
  return { tags: tagsValue ?? null, statuses: statusesValue ?? null };
1964
2069
  }
1965
- }), urlFilterTelemetryEmitted = !1, addFilters = async (type, items, excluded) => {
1966
- let { included, excluded: excludedKey } = FILTER_KEYS[type], state = store2.getState(), newIncluded = new Set(state[included]), newExcluded = new Set(state[excludedKey]);
2070
+ }), addFilters = async (type, items, excluded) => {
2071
+ let { included, excluded: excludedKey } = FILTER_KEYS[type], state2 = store2.getState(), newIncluded = new Set(state2[included]), newExcluded = new Set(state2[excludedKey]);
1967
2072
  for (let item of items) {
1968
2073
  let [target, other] = excluded ? [newExcluded, newIncluded] : [newIncluded, newExcluded];
1969
2074
  other.delete(item), target.add(item);
@@ -1973,13 +2078,13 @@ var FILTER_KEYS = {
1973
2078
  [excludedKey]: Array.from(newExcluded)
1974
2079
  });
1975
2080
  }, removeFilters = async (type, items) => {
1976
- let { included, excluded } = FILTER_KEYS[type], state = store2.getState(), itemSet = new Set(items);
2081
+ let { included, excluded } = FILTER_KEYS[type], state2 = store2.getState(), itemSet = new Set(items);
1977
2082
  await persistFilters({
1978
- [included]: state[included].filter((v) => !itemSet.has(v)),
1979
- [excluded]: state[excluded].filter((v) => !itemSet.has(v))
2083
+ [included]: state2[included].filter((v) => !itemSet.has(v)),
2084
+ [excluded]: state2[excluded].filter((v) => !itemSet.has(v))
1980
2085
  });
1981
2086
  }, emitFilterTelemetry = (trigger, changed) => {
1982
- let state = store2.getState(), includedTags = (state.includedTagFilters ?? []).filter((id) => BUILT_IN_TAG_IDS.has(id)), excludedTags = (state.excludedTagFilters ?? []).filter((id) => BUILT_IN_TAG_IDS.has(id)), includedStatuses = state.includedStatusFilters ?? [], excludedStatuses = state.excludedStatusFilters ?? [], storyCounts = {}, entries = state.internal_index ? Object.values(state.internal_index.entries) : [];
2087
+ let state2 = store2.getState(), includedTags = (state2.includedTagFilters ?? []).filter((id) => BUILT_IN_TAG_IDS.has(id)), excludedTags = (state2.excludedTagFilters ?? []).filter((id) => BUILT_IN_TAG_IDS.has(id)), includedStatuses = state2.includedStatusFilters ?? [], excludedStatuses = state2.excludedStatusFilters ?? [], storyCounts = {}, entries = state2.internal_index ? Object.values(state2.internal_index.entries) : [];
1983
2088
  for (let tagId of /* @__PURE__ */ new Set([...includedTags, ...excludedTags])) {
1984
2089
  let filterDef = BUILT_IN_FILTERS[tagId];
1985
2090
  storyCounts[tagId] = entries.filter((entry) => filterDef(entry)).length;
@@ -1997,63 +2102,251 @@ var FILTER_KEYS = {
1997
2102
  storyCounts
1998
2103
  });
1999
2104
  }, api = {
2000
- storyId: toId,
2001
- getData: (storyId, refId) => {
2002
- let result = api.resolveStory(storyId, refId);
2003
- if (result?.type === "story" || result?.type === "docs")
2004
- return result;
2005
- },
2006
- isPrepared: (storyId, refId) => {
2007
- let data = api.getData(storyId, refId);
2008
- return data ? data.type === "story" ? data.prepared : !0 : !1;
2009
- },
2010
- resolveStory: (storyId, refId) => {
2011
- let { refs, index } = store2.getState();
2012
- if (!(refId && !refs[refId]))
2013
- return refId ? refs?.[refId]?.index?.[storyId] ?? void 0 : index ? index[storyId] : void 0;
2105
+ setFilter: async (id, filterFunction) => {
2106
+ await api.setFilters({ [id]: filterFunction });
2014
2107
  },
2015
- getCurrentStoryData: () => {
2016
- let { storyId, refId } = store2.getState();
2017
- return api.getData(storyId, refId);
2108
+ setFilters: async (filters) => {
2109
+ if (await store2.setState((state2) => ({ filters: { ...state2.filters, ...filters } })), !!await applyCurrentFilters())
2110
+ for (let id of Object.keys(filters))
2111
+ provider.channel?.emit(SET_FILTER, { id });
2018
2112
  },
2019
- getIndex: () => {
2020
- let { internal_index } = store2.getState();
2021
- return internal_index;
2113
+ resetTagFilters: async () => {
2114
+ await persistFilters((s) => ({
2115
+ includedTagFilters: s.defaultIncludedTagFilters,
2116
+ excludedTagFilters: s.defaultExcludedTagFilters
2117
+ })), await recomputeTagsFilter();
2022
2118
  },
2023
- getParameters: (storyIdOrCombo, parameterName) => {
2024
- let { storyId, refId } = typeof storyIdOrCombo == "string" ? { storyId: storyIdOrCombo, refId: void 0 } : storyIdOrCombo, data = api.getData(storyId, refId);
2025
- if (["story", "docs"].includes(data?.type)) {
2026
- let { parameters } = data;
2027
- if (parameters)
2028
- return parameterName ? parameters[parameterName] : parameters;
2029
- }
2030
- return null;
2119
+ setAllTagFilters: async (included, excluded) => {
2120
+ await persistFilters({ includedTagFilters: included, excludedTagFilters: excluded }), await recomputeTagsFilter();
2031
2121
  },
2032
- getCurrentParameter: (parameterName) => {
2033
- let { storyId, refId } = store2.getState();
2034
- return api.getParameters({ storyId, refId }, parameterName) || void 0;
2122
+ addTagFilters: async (tags2, excluded) => {
2123
+ await addFilters("tag", tags2, excluded), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
2124
+ filterType: "tag",
2125
+ filterId: tags2[0],
2126
+ action: excluded ? "exclude" : "include"
2127
+ });
2035
2128
  },
2036
- jumpToComponent: (direction) => {
2037
- let { filteredIndex, storyId, refs, refId } = store2.getState();
2038
- if (!api.getData(storyId, refId))
2039
- return;
2040
- let hash = refId ? refs[refId].filteredIndex || {} : filteredIndex;
2041
- if (!hash)
2042
- return;
2043
- let result = api.findSiblingStoryId(storyId, hash, direction, !0);
2044
- result && api.selectStory(result, void 0, { ref: refId });
2129
+ removeTagFilters: async (tags2) => {
2130
+ await removeFilters("tag", tags2), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
2131
+ filterType: "tag",
2132
+ filterId: tags2[0],
2133
+ action: "remove"
2134
+ });
2045
2135
  },
2046
- jumpToStory: (direction) => {
2047
- let { filteredIndex, storyId, refs, refId } = store2.getState(), story = api.getData(storyId, refId);
2048
- if (!story)
2049
- return;
2050
- let hash = story.refId ? refs[story.refId].filteredIndex : filteredIndex;
2051
- if (!hash)
2052
- return;
2053
- let result = api.findSiblingStoryId(storyId, hash, direction, !1);
2054
- result && api.selectStory(result, void 0, { ref: refId });
2136
+ resetStatusFilters: async () => {
2137
+ await persistFilters({ includedStatusFilters: [], excludedStatusFilters: [] }), await recomputeStatusFilter();
2055
2138
  },
2056
- selectFirstStory: () => {
2139
+ setAllStatusFilters: async (included, excluded) => {
2140
+ let prevState = store2.getState(), prevIncluded = new Set(prevState.includedStatusFilters ?? []), prevExcluded = new Set(prevState.excludedStatusFilters ?? []), nextIncluded = new Set(included), nextExcluded = new Set(excluded);
2141
+ await persistFilters({ includedStatusFilters: included, excludedStatusFilters: excluded }), await recomputeStatusFilter();
2142
+ let changedIds = /* @__PURE__ */ new Set([
2143
+ ...prevIncluded,
2144
+ ...prevExcluded,
2145
+ ...nextIncluded,
2146
+ ...nextExcluded
2147
+ ]);
2148
+ for (let id of changedIds) {
2149
+ let wasIncluded = prevIncluded.has(id), wasExcluded = prevExcluded.has(id), isIncluded = nextIncluded.has(id), isExcluded = nextExcluded.has(id);
2150
+ if (wasIncluded === isIncluded && wasExcluded === isExcluded)
2151
+ continue;
2152
+ let action;
2153
+ isIncluded ? action = "include" : isExcluded ? action = "exclude" : action = "remove", emitFilterTelemetry("interaction", {
2154
+ filterType: "status",
2155
+ filterId: id,
2156
+ action
2157
+ });
2158
+ }
2159
+ },
2160
+ addStatusFilters: async (statuses2, excluded) => {
2161
+ await addFilters("status", statuses2, excluded), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
2162
+ filterType: "status",
2163
+ filterId: statuses2[0],
2164
+ action: excluded ? "exclude" : "include"
2165
+ });
2166
+ },
2167
+ removeStatusFilters: async (statuses2) => {
2168
+ await removeFilters("status", statuses2), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
2169
+ filterType: "status",
2170
+ filterId: statuses2[0],
2171
+ action: "remove"
2172
+ });
2173
+ }
2174
+ }, applyCurrentFilters = async () => {
2175
+ let { internal_index: index } = store2.getState();
2176
+ if (!index)
2177
+ return !1;
2178
+ await setIndex(index);
2179
+ let refs = await fullAPI.getRefs();
2180
+ for (let [refId, { internal_index, ...ref }] of Object.entries(refs))
2181
+ await fullAPI.setRef(refId, { ...ref, storyIndex: internal_index }, !0);
2182
+ return !0;
2183
+ }, statusFilterRebuildQueued = !1, statusFilterRebuildInFlight = !1, flushStatusFilterRebuild = async () => {
2184
+ if (!statusFilterRebuildInFlight) {
2185
+ statusFilterRebuildInFlight = !0;
2186
+ try {
2187
+ for (; statusFilterRebuildQueued; ) {
2188
+ statusFilterRebuildQueued = !1;
2189
+ try {
2190
+ await applyCurrentFilters();
2191
+ } catch (error) {
2192
+ logger7.warn("Failed to rebuild story index after status change:", error);
2193
+ }
2194
+ }
2195
+ } finally {
2196
+ statusFilterRebuildInFlight = !1, statusFilterRebuildQueued && flushStatusFilterRebuild();
2197
+ }
2198
+ }
2199
+ }, requestStatusFilterRebuild = () => {
2200
+ statusFilterRebuildQueued = !0, flushStatusFilterRebuild();
2201
+ }, recomputeTagsFilter = () => {
2202
+ let { includedTagFilters, excludedTagFilters } = store2.getState();
2203
+ return api.setFilters({
2204
+ [TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters)
2205
+ });
2206
+ }, recomputeStatusFilter = () => {
2207
+ let { includedStatusFilters, excludedStatusFilters } = store2.getState();
2208
+ return api.setFilters({
2209
+ [STATUS_FILTER]: computeStatusFilterFn(
2210
+ includedStatusFilters ?? [],
2211
+ excludedStatusFilters ?? []
2212
+ )
2213
+ });
2214
+ };
2215
+ provider.channel?.on(SET_CONFIG3, async () => {
2216
+ let {
2217
+ includedTagFilters,
2218
+ excludedTagFilters,
2219
+ includedStatusFilters,
2220
+ excludedStatusFilters,
2221
+ tagPresets: tagPresets2
2222
+ } = store2.getState();
2223
+ await api.setFilters({
2224
+ [STATIC_FILTER]: computeStaticFilterFn(tagPresets2),
2225
+ [TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters),
2226
+ [STATUS_FILTER]: computeStatusFilterFn(includedStatusFilters, excludedStatusFilters)
2227
+ });
2228
+ }), fullStatusStore.onAllStatusChange(
2229
+ throttle(requestStatusFilterRebuild, STATUS_CHANGE_REBUILD_THROTTLE, {
2230
+ edges: ["leading", "trailing"]
2231
+ })
2232
+ );
2233
+ let tagPresets = global.TAGS_OPTIONS || {}, defaultTags = getDefaultTagsFromPreset(tagPresets), { tags, statuses } = queryFromLocation(location2 ?? { search: "" }), parsedTags = parseTagsParam(tags), hasTagsParam = tags !== void 0, initialIncluded = hasTagsParam ? parsedTags.included : defaultTags.included, initialExcluded = hasTagsParam ? parsedTags.excluded : defaultTags.excluded, parsedStatuses = parseStatusesParam(statuses), initialIncludedStatuses = parsedStatuses.included, initialExcludedStatuses = parsedStatuses.excluded, state = {
2234
+ filters: {
2235
+ [STATIC_FILTER]: computeStaticFilterFn(tagPresets),
2236
+ [TAGS_FILTER]: computeTagsFilterFn(initialIncluded, initialExcluded),
2237
+ [STATUS_FILTER]: computeStatusFilterFn(initialIncludedStatuses, initialExcludedStatuses)
2238
+ },
2239
+ tagPresets,
2240
+ defaultIncludedTagFilters: defaultTags.included,
2241
+ defaultExcludedTagFilters: defaultTags.excluded,
2242
+ includedTagFilters: initialIncluded,
2243
+ excludedTagFilters: initialExcluded,
2244
+ includedStatusFilters: initialIncludedStatuses,
2245
+ excludedStatusFilters: initialExcludedStatuses
2246
+ }, urlFilterTelemetryEmitted = !1;
2247
+ return { api, state, emitUrlFilterTelemetry: () => {
2248
+ if (urlFilterTelemetryEmitted)
2249
+ return;
2250
+ urlFilterTelemetryEmitted = !0;
2251
+ let hasBuiltInTagFilters = initialIncluded.some((id) => BUILT_IN_TAG_IDS.has(id)) || initialExcluded.some((id) => BUILT_IN_TAG_IDS.has(id)), hasStatusFilters = initialIncludedStatuses.length > 0 || initialExcludedStatuses.length > 0;
2252
+ (hasBuiltInTagFilters || hasStatusFilters) && emitFilterTelemetry("url");
2253
+ } };
2254
+ };
2255
+
2256
+ // src/manager-api/modules/stories.ts
2257
+ var { fetch: fetch2 } = global, STORY_INDEX_PATH = "./index.json", applyUpdate = (indexes, id, update2) => {
2258
+ for (let index of indexes)
2259
+ index?.[id] && (index[id] = { ...index[id], ...update2 });
2260
+ }, init11 = ({
2261
+ fullAPI,
2262
+ store: store2,
2263
+ navigate,
2264
+ provider,
2265
+ state: { location: location2 } = {},
2266
+ storyId: initialStoryId,
2267
+ viewMode: initialViewMode,
2268
+ docsOptions = {}
2269
+ }) => {
2270
+ let navigateWithQueryParams = (path, options) => {
2271
+ let { customQueryParams } = store2.getState();
2272
+ navigate(buildNavigationUrl(path, customQueryParams ?? {}), options);
2273
+ }, canonicaliseUrl = () => {
2274
+ let { location: currentLocation, path, customQueryParams } = store2.getState(), pathname = currentLocation?.pathname;
2275
+ if (!pathname || queryFromLocation2(currentLocation).path)
2276
+ return;
2277
+ let resolved = fromUrlPath(pathname);
2278
+ if (resolved === "/" || resolved === path && toUrlPath(resolved) === pathname)
2279
+ return;
2280
+ let target = buildNavigationUrl(
2281
+ `${resolved}${currentLocation.hash ?? ""}`,
2282
+ customQueryParams ?? {}
2283
+ );
2284
+ navigate(target, { replace: !0 });
2285
+ }, filters = initFilters({
2286
+ store: store2,
2287
+ provider,
2288
+ fullAPI,
2289
+ location: location2,
2290
+ setIndex: (index) => api.setIndex(index)
2291
+ }), api = {
2292
+ ...filters.api,
2293
+ storyId: toId,
2294
+ getData: (storyId, refId) => {
2295
+ let result = api.resolveStory(storyId, refId);
2296
+ if (result?.type === "story" || result?.type === "docs")
2297
+ return result;
2298
+ },
2299
+ isPrepared: (storyId, refId) => {
2300
+ let data = api.getData(storyId, refId);
2301
+ return data ? data.type === "story" ? data.prepared : !0 : !1;
2302
+ },
2303
+ resolveStory: (storyId, refId) => {
2304
+ let { refs, index } = store2.getState();
2305
+ if (!(refId && !refs[refId]))
2306
+ return refId ? refs?.[refId]?.index?.[storyId] ?? void 0 : index ? index[storyId] : void 0;
2307
+ },
2308
+ getCurrentStoryData: () => {
2309
+ let { storyId, refId } = store2.getState();
2310
+ return api.getData(storyId, refId);
2311
+ },
2312
+ getIndex: () => {
2313
+ let { internal_index } = store2.getState();
2314
+ return internal_index;
2315
+ },
2316
+ getParameters: (storyIdOrCombo, parameterName) => {
2317
+ let { storyId, refId } = typeof storyIdOrCombo == "string" ? { storyId: storyIdOrCombo, refId: void 0 } : storyIdOrCombo, data = api.getData(storyId, refId);
2318
+ if (["story", "docs"].includes(data?.type)) {
2319
+ let { parameters } = data;
2320
+ if (parameters)
2321
+ return parameterName ? parameters[parameterName] : parameters;
2322
+ }
2323
+ return null;
2324
+ },
2325
+ getCurrentParameter: (parameterName) => {
2326
+ let { storyId, refId } = store2.getState();
2327
+ return api.getParameters({ storyId, refId }, parameterName) || void 0;
2328
+ },
2329
+ jumpToComponent: (direction) => {
2330
+ let { filteredIndex, storyId, refs, refId } = store2.getState();
2331
+ if (!api.getData(storyId, refId))
2332
+ return;
2333
+ let hash = refId ? refs[refId].filteredIndex || {} : filteredIndex;
2334
+ if (!hash)
2335
+ return;
2336
+ let result = api.findSiblingStoryId(storyId, hash, direction, !0);
2337
+ result && api.selectStory(result, void 0, { ref: refId });
2338
+ },
2339
+ jumpToStory: (direction) => {
2340
+ let { filteredIndex, storyId, refs, refId } = store2.getState(), story = api.getData(storyId, refId);
2341
+ if (!story)
2342
+ return;
2343
+ let hash = story.refId ? refs[story.refId].filteredIndex : filteredIndex;
2344
+ if (!hash)
2345
+ return;
2346
+ let result = api.findSiblingStoryId(storyId, hash, direction, !1);
2347
+ result && api.selectStory(result, void 0, { ref: refId });
2348
+ },
2349
+ selectFirstStory: () => {
2057
2350
  let state = store2.getState(), { filteredIndex } = state;
2058
2351
  if (filteredIndex) {
2059
2352
  let firstStory2 = Object.keys(filteredIndex).find(
@@ -2153,7 +2446,7 @@ var FILTER_KEYS = {
2153
2446
  throw new Error(await result.text());
2154
2447
  let storyIndex = await result.json();
2155
2448
  if (storyIndex.v < 3) {
2156
- logger7.warn(`Skipping story index with version v${storyIndex.v}, awaiting SET_STORIES.`);
2449
+ logger8.warn(`Skipping story index with version v${storyIndex.v}, awaiting SET_STORIES.`);
2157
2450
  return;
2158
2451
  }
2159
2452
  await api.setIndex(storyIndex);
@@ -2165,10 +2458,10 @@ var FILTER_KEYS = {
2165
2458
  // The story index we receive on fetchStoryIndex is not, but all the prepared fields are optional
2166
2459
  // so we can cast one to the other easily enough
2167
2460
  setIndex: async (input) => {
2168
- let { filteredIndex: oldFilteredHash, index: oldHash, filters } = store2.getState(), allStatuses = fullStatusStore.getAll(), newFilteredHash = transformStoryIndexToStoriesHash(input, {
2461
+ let { filteredIndex: oldFilteredHash, index: oldHash, filters: filters2 } = store2.getState(), allStatuses = fullStatusStore.getAll(), newFilteredHash = transformStoryIndexToStoriesHash(input, {
2169
2462
  provider,
2170
2463
  docsOptions,
2171
- filters,
2464
+ filters: filters2,
2172
2465
  allStatuses,
2173
2466
  statusFilterKey: STATUS_FILTER
2174
2467
  }), newHash = transformStoryIndexToStoriesHash(input, {
@@ -2186,316 +2479,37 @@ var FILTER_KEYS = {
2186
2479
  },
2187
2480
  // FIXME: is there a bug where filtered stories get added back in on updateStory???
2188
2481
  updateStory: async (storyId, update2, ref) => {
2189
- if (ref) {
2190
- let { id: refId, index, filteredIndex } = ref, storyUpdates = {
2191
- ...ref.storyUpdates,
2192
- [storyId]: { ...ref.storyUpdates?.[storyId], ...update2 }
2193
- };
2194
- index && index[storyId] && (index[storyId] = {
2195
- ...index[storyId],
2196
- ...update2
2197
- }), filteredIndex && filteredIndex[storyId] && (filteredIndex[storyId] = {
2198
- ...filteredIndex[storyId],
2199
- ...update2
2200
- }), await fullAPI.updateRef(refId, { index, filteredIndex, storyUpdates });
2201
- } else {
2202
- let { index, filteredIndex } = store2.getState();
2203
- index && index[storyId] && (index[storyId] = {
2204
- ...index[storyId],
2205
- ...update2
2206
- }), filteredIndex && filteredIndex[storyId] && (filteredIndex[storyId] = {
2207
- ...filteredIndex[storyId],
2208
- ...update2
2209
- }), (index || filteredIndex) && await store2.setState({ index, filteredIndex });
2210
- }
2482
+ await applyEntryUpdate(storyId, update2, ref);
2211
2483
  },
2212
2484
  updateDocs: async (docsId, update2, ref) => {
2213
- if (ref) {
2214
- let { id: refId, index, filteredIndex } = ref, storyUpdates = {
2215
- ...ref.storyUpdates,
2216
- [docsId]: { ...ref.storyUpdates?.[docsId], ...update2 }
2217
- };
2218
- index && index[docsId] && (index[docsId] = {
2219
- ...index[docsId],
2220
- ...update2
2221
- }), filteredIndex && filteredIndex[docsId] && (filteredIndex[docsId] = {
2222
- ...filteredIndex[docsId],
2223
- ...update2
2224
- }), await fullAPI.updateRef(refId, { index, filteredIndex, storyUpdates });
2225
- } else {
2226
- let { index, filteredIndex } = store2.getState();
2227
- index && (index[docsId] = {
2228
- ...index[docsId],
2229
- ...update2
2230
- }), filteredIndex && (filteredIndex[docsId] = {
2231
- ...filteredIndex[docsId],
2232
- ...update2
2233
- }), (index || filteredIndex) && await store2.setState({ index, filteredIndex });
2234
- }
2485
+ await applyEntryUpdate(docsId, update2, ref);
2235
2486
  },
2236
2487
  setPreviewInitialized: async (ref) => {
2237
2488
  ref ? fullAPI.updateRef(ref.id, { previewInitialized: !0 }) : store2.setState({ previewInitialized: !0 });
2238
- },
2239
- setFilter: async (id, filterFunction) => {
2240
- await api.setFilters({ [id]: filterFunction });
2241
- },
2242
- setFilters: async (filters) => {
2243
- if (await store2.setState((state) => ({ filters: { ...state.filters, ...filters } })), !!await applyCurrentFilters())
2244
- for (let id of Object.keys(filters))
2245
- provider.channel?.emit(SET_FILTER, { id });
2246
- },
2247
- resetTagFilters: async () => {
2248
- await persistFilters((s) => ({
2249
- includedTagFilters: s.defaultIncludedTagFilters,
2250
- excludedTagFilters: s.defaultExcludedTagFilters
2251
- })), await recomputeTagsFilter();
2252
- },
2253
- setAllTagFilters: async (included, excluded) => {
2254
- await persistFilters({ includedTagFilters: included, excludedTagFilters: excluded }), await recomputeTagsFilter();
2255
- },
2256
- addTagFilters: async (tags2, excluded) => {
2257
- await addFilters("tag", tags2, excluded), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
2258
- filterType: "tag",
2259
- filterId: tags2[0],
2260
- action: excluded ? "exclude" : "include"
2261
- });
2262
- },
2263
- removeTagFilters: async (tags2) => {
2264
- await removeFilters("tag", tags2), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
2265
- filterType: "tag",
2266
- filterId: tags2[0],
2267
- action: "remove"
2268
- });
2269
- },
2270
- resetStatusFilters: async () => {
2271
- await persistFilters({ includedStatusFilters: [], excludedStatusFilters: [] }), await recomputeStatusFilter();
2272
- },
2273
- setAllStatusFilters: async (included, excluded) => {
2274
- let prevState = store2.getState(), prevIncluded = new Set(prevState.includedStatusFilters ?? []), prevExcluded = new Set(prevState.excludedStatusFilters ?? []), nextIncluded = new Set(included), nextExcluded = new Set(excluded);
2275
- await persistFilters({ includedStatusFilters: included, excludedStatusFilters: excluded }), await recomputeStatusFilter();
2276
- let changedIds = /* @__PURE__ */ new Set([
2277
- ...prevIncluded,
2278
- ...prevExcluded,
2279
- ...nextIncluded,
2280
- ...nextExcluded
2281
- ]);
2282
- for (let id of changedIds) {
2283
- let wasIncluded = prevIncluded.has(id), wasExcluded = prevExcluded.has(id), isIncluded = nextIncluded.has(id), isExcluded = nextExcluded.has(id);
2284
- if (wasIncluded === isIncluded && wasExcluded === isExcluded)
2285
- continue;
2286
- let action;
2287
- isIncluded ? action = "include" : isExcluded ? action = "exclude" : action = "remove", emitFilterTelemetry("interaction", {
2288
- filterType: "status",
2289
- filterId: id,
2290
- action
2291
- });
2292
- }
2293
- },
2294
- addStatusFilters: async (statuses2, excluded) => {
2295
- await addFilters("status", statuses2, excluded), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
2296
- filterType: "status",
2297
- filterId: statuses2[0],
2298
- action: excluded ? "exclude" : "include"
2299
- });
2300
- },
2301
- removeStatusFilters: async (statuses2) => {
2302
- await removeFilters("status", statuses2), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
2303
- filterType: "status",
2304
- filterId: statuses2[0],
2305
- action: "remove"
2306
- });
2307
- }
2308
- }, applyCurrentFilters = async () => {
2309
- let { internal_index: index } = store2.getState();
2310
- if (!index)
2311
- return !1;
2312
- await api.setIndex(index);
2313
- let refs = await fullAPI.getRefs();
2314
- for (let [refId, { internal_index, ...ref }] of Object.entries(refs))
2315
- await fullAPI.setRef(refId, { ...ref, storyIndex: internal_index }, !0);
2316
- return !0;
2317
- }, statusFilterRebuildQueued = !1, statusFilterRebuildInFlight = !1, flushStatusFilterRebuild = async () => {
2318
- if (!statusFilterRebuildInFlight) {
2319
- statusFilterRebuildInFlight = !0;
2320
- try {
2321
- for (; statusFilterRebuildQueued; ) {
2322
- statusFilterRebuildQueued = !1;
2323
- try {
2324
- await applyCurrentFilters();
2325
- } catch (error) {
2326
- logger7.warn("Failed to rebuild story index after status change:", error);
2327
- }
2328
- }
2329
- } finally {
2330
- statusFilterRebuildInFlight = !1, statusFilterRebuildQueued && flushStatusFilterRebuild();
2331
- }
2332
2489
  }
2333
- }, requestStatusFilterRebuild = () => {
2334
- statusFilterRebuildQueued = !0, flushStatusFilterRebuild();
2335
- }, recomputeTagsFilter = () => {
2336
- let { includedTagFilters, excludedTagFilters } = store2.getState();
2337
- return api.setFilters({
2338
- [TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters)
2339
- });
2340
- }, recomputeStatusFilter = () => {
2341
- let { includedStatusFilters, excludedStatusFilters } = store2.getState();
2342
- return api.setFilters({
2343
- [STATUS_FILTER]: computeStatusFilterFn(
2344
- includedStatusFilters ?? [],
2345
- excludedStatusFilters ?? []
2346
- )
2347
- });
2348
- };
2349
- provider.channel?.on(
2350
- STORY_SPECIFIED,
2351
- function({
2352
- storyId,
2353
- viewMode
2354
- }) {
2355
- let { sourceType } = getEventMetadata(this, fullAPI);
2356
- if (sourceType === "local") {
2357
- let state = store2.getState(), isCanvasRoute = !isReviewManagerRoute(state.path, state.customQueryParams) && (state.path === "/" || state.viewMode === "story" || state.viewMode === "docs"), stateHasSelection = state.viewMode && state.storyId, stateSelectionDifferent = state.viewMode !== viewMode || state.storyId !== storyId, { type } = state.index?.[state.storyId] || {}, isStory = !(type === "root" || type === "component" || type === "group");
2358
- if (isCanvasRoute) {
2359
- let { filteredIndex } = state;
2360
- if (filteredIndex && !stateHasSelection && !(filteredIndex[storyId]?.type === "story")) {
2361
- let firstFiltered = filteredIndex ? Object.keys(filteredIndex).find((id) => {
2362
- let entry = filteredIndex[id];
2363
- return entry.type === "story" || entry.type === "docs";
2364
- }) : void 0;
2365
- firstFiltered && navigateWithQueryParams(`/${viewMode}/${firstFiltered}`);
2366
- return;
2367
- }
2368
- stateHasSelection && stateSelectionDifferent && isStory ? provider.channel?.emit(SET_CURRENT_STORY, {
2369
- storyId: state.storyId,
2370
- viewMode: state.viewMode
2371
- }) : stateSelectionDifferent && navigateWithQueryParams(`/${viewMode}/${storyId}`);
2372
- }
2373
- }
2374
- }
2375
- ), provider.channel?.on(CURRENT_STORY_WAS_SET, function() {
2376
- let { ref } = getEventMetadata(this, fullAPI);
2377
- api.setPreviewInitialized(ref);
2378
- }), provider.channel?.on(STORY_CHANGED, function() {
2379
- let { sourceType } = getEventMetadata(this, fullAPI);
2380
- if (sourceType === "local") {
2381
- let options = api.getCurrentParameter("options");
2382
- options && fullAPI.setOptions(removeRemovedOptions(options));
2383
- }
2384
- }), provider.channel?.on(
2385
- STORY_PREPARED,
2386
- function({ id, ...update2 }) {
2387
- let { ref, sourceType } = getEventMetadata(this, fullAPI);
2388
- if (api.updateStory(id, { ...update2, prepared: !0 }, ref), !ref && !store2.getState().hasCalledSetOptions) {
2389
- let { options } = update2.parameters;
2390
- fullAPI.setOptions(removeRemovedOptions(options)), store2.setState({ hasCalledSetOptions: !0 });
2391
- }
2392
- if (sourceType === "local") {
2393
- let { storyId, index, refId } = store2.getState();
2394
- if (!index)
2395
- return;
2396
- let toBePreloaded = Array.from(
2397
- /* @__PURE__ */ new Set([
2398
- api.findSiblingStoryId(storyId, index, 1, !0),
2399
- api.findSiblingStoryId(storyId, index, -1, !0)
2400
- ])
2401
- ).filter(Boolean);
2402
- provider.channel?.emit(PRELOAD_ENTRIES, {
2403
- ids: toBePreloaded,
2404
- options: { target: refId }
2405
- });
2406
- }
2407
- }
2408
- ), provider.channel?.on(
2409
- DOCS_PREPARED,
2410
- function({ id, ...update2 }) {
2411
- let { ref } = getEventMetadata(this, fullAPI);
2412
- api.updateStory(id, { ...update2, prepared: !0 }, ref);
2413
- }
2414
- ), provider.channel?.on(SET_INDEX, function(index) {
2415
- let { ref } = getEventMetadata(this, fullAPI);
2416
- if (ref)
2417
- fullAPI.setRef(ref.id, { ...ref, storyIndex: index }, !0);
2418
- else {
2419
- api.setIndex(index);
2420
- let options = api.getCurrentParameter("options");
2421
- fullAPI.setOptions(removeRemovedOptions(options));
2422
- }
2423
- }), provider.channel?.on(SET_STORIES, function(data) {
2424
- let { ref } = getEventMetadata(this, fullAPI), setStoriesData = data.v ? denormalizeStoryParameters(data) : data.stories;
2425
- if (ref)
2426
- fullAPI.setRef(ref.id, { ...ref, setStoriesData }, !0);
2427
- else
2428
- throw new Error("Cannot call SET_STORIES for local frame");
2429
- }), provider.channel?.on(
2430
- SELECT_STORY,
2431
- function({
2432
- kind,
2433
- title = kind,
2434
- story,
2435
- name = story,
2436
- storyId,
2437
- ...rest
2438
- }) {
2439
- let { ref } = getEventMetadata(this, fullAPI);
2440
- ref ? fullAPI.selectStory(storyId || title, name, { ...rest, ref: ref.id }) : fullAPI.selectStory(storyId || title, name, rest);
2441
- }
2442
- ), provider.channel?.on(
2443
- STORY_ARGS_UPDATED,
2444
- function({ storyId, args }) {
2445
- let { ref } = getEventMetadata(this, fullAPI);
2446
- api.updateStory(storyId, { args }, ref);
2490
+ }, applyEntryUpdate = async (id, update2, ref) => {
2491
+ if (!ref) {
2492
+ let { index: index2, filteredIndex: filteredIndex2 } = store2.getState();
2493
+ applyUpdate([index2, filteredIndex2], id, update2), (index2 || filteredIndex2) && await store2.setState({ index: index2, filteredIndex: filteredIndex2 });
2494
+ return;
2447
2495
  }
2448
- ), provider.channel?.on(CONFIG_ERROR, function(err) {
2449
- let { ref } = getEventMetadata(this, fullAPI);
2450
- api.setPreviewInitialized(ref);
2451
- }), provider.channel?.on(STORY_MISSING, function(err) {
2452
- let { ref } = getEventMetadata(this, fullAPI);
2453
- api.setPreviewInitialized(ref);
2454
- }), provider.channel?.on(SET_CONFIG3, async () => {
2455
- let {
2456
- includedTagFilters,
2457
- excludedTagFilters,
2458
- includedStatusFilters,
2459
- excludedStatusFilters,
2460
- tagPresets: tagPresets2
2461
- } = store2.getState();
2462
- await api.setFilters({
2463
- [STATIC_FILTER]: computeStaticFilterFn(tagPresets2),
2464
- [TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters),
2465
- [STATUS_FILTER]: computeStatusFilterFn(includedStatusFilters, excludedStatusFilters)
2466
- });
2467
- }), fullStatusStore.onAllStatusChange(
2468
- throttle(requestStatusFilterRebuild, STATUS_CHANGE_REBUILD_THROTTLE, {
2469
- edges: ["leading", "trailing"]
2470
- })
2471
- );
2472
- let tagPresets = global.TAGS_OPTIONS || {}, defaultTags = getDefaultTagsFromPreset(tagPresets), { tags, statuses } = queryFromLocation(location2 ?? { search: "" }), parsedTags = parseTagsParam(tags), hasTagsParam = tags !== void 0, initialIncluded = hasTagsParam ? parsedTags.included : defaultTags.included, initialExcluded = hasTagsParam ? parsedTags.excluded : defaultTags.excluded, parsedStatuses = parseStatusesParam(statuses), initialIncludedStatuses = parsedStatuses.included, initialExcludedStatuses = parsedStatuses.excluded, initialFilters = {
2473
- [STATIC_FILTER]: computeStaticFilterFn(tagPresets),
2474
- [TAGS_FILTER]: computeTagsFilterFn(initialIncluded, initialExcluded),
2475
- [STATUS_FILTER]: computeStatusFilterFn(initialIncludedStatuses, initialExcludedStatuses)
2496
+ let { id: refId, index, filteredIndex } = ref, storyUpdates = {
2497
+ ...ref.storyUpdates,
2498
+ [id]: { ...ref.storyUpdates?.[id], ...update2 }
2499
+ };
2500
+ applyUpdate([index, filteredIndex], id, update2), await fullAPI.updateRef(refId, { index, filteredIndex, storyUpdates });
2476
2501
  };
2477
- return {
2502
+ return listenToStoryEvents({ store: store2, provider, fullAPI, api, navigateWithQueryParams }), {
2478
2503
  api,
2479
2504
  state: {
2480
2505
  storyId: initialStoryId,
2481
2506
  viewMode: initialViewMode,
2482
2507
  hasCalledSetOptions: !1,
2483
2508
  previewInitialized: !1,
2484
- filters: initialFilters,
2485
- tagPresets,
2486
- defaultIncludedTagFilters: defaultTags.included,
2487
- defaultExcludedTagFilters: defaultTags.excluded,
2488
- includedTagFilters: initialIncluded,
2489
- excludedTagFilters: initialExcluded,
2490
- includedStatusFilters: initialIncludedStatuses,
2491
- excludedStatusFilters: initialExcludedStatuses
2509
+ ...filters.state
2492
2510
  },
2493
2511
  init: async () => {
2494
- if (provider.channel?.on(STORY_INDEX_INVALIDATED, () => api.fetchIndex()), await api.fetchIndex(), urlFilterTelemetryEmitted)
2495
- return;
2496
- urlFilterTelemetryEmitted = !0;
2497
- let hasBuiltInTagFilters = initialIncluded.some((id) => BUILT_IN_TAG_IDS.has(id)) || initialExcluded.some((id) => BUILT_IN_TAG_IDS.has(id)), hasStatusFilters = initialIncludedStatuses.length > 0 || initialExcludedStatuses.length > 0;
2498
- (hasBuiltInTagFilters || hasStatusFilters) && emitFilterTelemetry("url");
2512
+ provider.channel?.on(STORY_INDEX_INVALIDATED, () => api.fetchIndex()), await api.fetchIndex(), filters.emitUrlFilterTelemetry();
2499
2513
  }
2500
2514
  };
2501
2515
  };
@@ -2516,7 +2530,7 @@ import {
2516
2530
  import {
2517
2531
  buildArgsParam,
2518
2532
  buildManagerHref,
2519
- queryFromLocation as queryFromLocation2
2533
+ queryFromLocation as queryFromLocation3
2520
2534
  } from "@aussieljk/forkbook/internal/router";
2521
2535
  var parseBoolean = (value) => {
2522
2536
  if (value === "true" || value === "1")
@@ -2531,11 +2545,11 @@ var parseBoolean = (value) => {
2531
2545
  }, resolveIframeUrl = (baseUrl, { absolute }) => {
2532
2546
  let resolved = new URL("iframe.html", baseUrl);
2533
2547
  return absolute ? resolved.href : `${resolved.pathname}${resolved.search}${resolved.hash}`;
2534
- }, LAYOUT_QUERY_PARAM_KEYS = ["full", "panel", "nav", "shortcuts", "addonPanel", "tabs", "path"], getCustomQueryParams = (location2) => omit(queryFromLocation2(location2), LAYOUT_QUERY_PARAM_KEYS), prevParams, initialUrlSupport = ({
2548
+ }, LAYOUT_QUERY_PARAM_KEYS = ["full", "panel", "nav", "shortcuts", "addonPanel", "tabs", "path"], getCustomQueryParams = (location2) => omit(queryFromLocation3(location2), LAYOUT_QUERY_PARAM_KEYS), prevParams, initialUrlSupport = ({
2535
2549
  state: { location: location2, path, viewMode, storyId: storyIdFromUrl },
2536
2550
  singleStory
2537
2551
  }) => {
2538
- let { full, panel, nav, shortcuts, addonPanel } = queryFromLocation2(location2), navSize, bottomPanelHeight, rightPanelWidth;
2552
+ let { full, panel, nav, shortcuts, addonPanel } = queryFromLocation3(location2), navSize, bottomPanelHeight, rightPanelWidth;
2539
2553
  parseBoolean(full) === !0 ? (navSize = 0, bottomPanelHeight = 0, rightPanelWidth = 0) : parseBoolean(full) === !1 && (navSize = DEFAULT_NAV_SIZE, bottomPanelHeight = DEFAULT_BOTTOM_PANEL_HEIGHT, rightPanelWidth = DEFAULT_RIGHT_PANEL_WIDTH), singleStory || (parseBoolean(nav) === !0 && (navSize = DEFAULT_NAV_SIZE), parseBoolean(nav) === !1 && (navSize = 0)), parseBoolean(panel) === !1 && (bottomPanelHeight = 0, rightPanelWidth = 0);
2540
2554
  let layout = {
2541
2555
  navSize,
@@ -2621,14 +2635,17 @@ var parseBoolean = (value) => {
2621
2635
  let handleOrId;
2622
2636
  return provider.channel?.on(STORY_ARGS_UPDATED2, () => {
2623
2637
  "requestIdleCallback" in global.window ? (handleOrId && global.window.cancelIdleCallback(handleOrId), handleOrId = global.window.requestIdleCallback(updateArgsParam, { timeout: 1e3 })) : (handleOrId && clearTimeout(handleOrId), setTimeout(updateArgsParam, 100));
2624
- }), provider.channel?.on(GLOBALS_UPDATED2, ({ userGlobals, initialGlobals }) => {
2625
- let { path, hash = "", queryParams } = api.getUrlState(), globalsString = buildArgsParam(initialGlobals, merge_default(initialGlobals, userGlobals));
2626
- navigateTo(
2627
- `${path}${hash}`,
2628
- { ...queryParams, globals: globalsString || null },
2629
- { replace: !0 }
2630
- ), api.setQueryParams({ globals: globalsString || null });
2631
- }), provider.channel?.on(NAVIGATE_URL, (url, options) => {
2638
+ }), provider.channel?.on(
2639
+ GLOBALS_UPDATED2,
2640
+ ({ userGlobals, initialGlobals }) => {
2641
+ let { path, hash = "", queryParams } = api.getUrlState(), globalsString = buildArgsParam(initialGlobals, merge_default(initialGlobals, userGlobals));
2642
+ navigateTo(
2643
+ `${path}${hash}`,
2644
+ { ...queryParams, globals: globalsString || null },
2645
+ { replace: !0 }
2646
+ ), api.setQueryParams({ globals: globalsString || null });
2647
+ }
2648
+ ), provider.channel?.on(NAVIGATE_URL, (url, options) => {
2632
2649
  api.navigateUrl(url, options);
2633
2650
  }), {
2634
2651
  api,
@@ -2887,7 +2904,7 @@ var ManagerContext = createContext({ api: void 0, state: initial_state_default({
2887
2904
  this.mounted = !1;
2888
2905
  this.initModules = () => {
2889
2906
  this.modules.forEach((module) => {
2890
- "init" in module && module.init();
2907
+ module.init?.();
2891
2908
  });
2892
2909
  };
2893
2910
  let {
@@ -2966,14 +2983,13 @@ var ManagerContext = createContext({ api: void 0, state: initial_state_default({
2966
2983
  ManagerProvider.displayName = "Manager";
2967
2984
  var EffectOnMount = ({ children, effect }) => (React2.useEffect(effect, []), children), defaultFilter = (c) => c;
2968
2985
  function ManagerConsumer({
2969
- // @ts-expect-error (Converted from ts-ignore)
2970
2986
  filter = defaultFilter,
2971
2987
  children
2972
2988
  }) {
2973
2989
  let managerContext = useContext(ManagerContext), renderer = useRef2(children), filterer = useRef2(filter);
2974
2990
  if (typeof renderer.current != "function")
2975
2991
  return jsx3(Fragment, { children: renderer.current });
2976
- let comboData = filterer.current(managerContext), comboDataArray = useMemo(() => [...Object.entries(comboData).reduce((acc, keyval) => acc.concat(keyval), [])], [managerContext.state]);
2992
+ let comboData = filterer.current(managerContext), comboDataArray = useMemo(() => Object.entries(comboData).flat(), [managerContext.state]);
2977
2993
  return useMemo(() => {
2978
2994
  let Child = renderer.current;
2979
2995
  return jsx3(Child, { ...comboData });
@@ -3020,7 +3036,7 @@ function useSharedState(stateId, defaultState) {
3020
3036
  FORKBOOK_ADDON_STATE[stateId] ? FORKBOOK_ADDON_STATE[stateId] : defaultState
3021
3037
  ), quicksync = !1;
3022
3038
  state === defaultState && defaultState !== void 0 && (FORKBOOK_ADDON_STATE[stateId] = defaultState, quicksync = !0), useEffect(() => {
3023
- quicksync && api.setAddonState(stateId, defaultState);
3039
+ quicksync && defaultState !== void 0 && api.setAddonState(stateId, defaultState);
3024
3040
  }, [quicksync]);
3025
3041
  let setState = useCallback2(
3026
3042
  async (s, options) => {