@aussieljk/forkbook 0.0.1-11 → 0.0.1-13

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 (381) 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/dist/_browser-chunks/{Color-QLZNXLSV.js → Color-2EUQ6NXV.js} +2 -2
  6. package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
  7. package/dist/_browser-chunks/{WithTooltip-GNLRTZDF.js → WithTooltip-QCFTNB6P.js} +5 -4
  8. package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
  9. package/dist/_browser-chunks/{chunk-6ELMKWKX.js → chunk-2WZWS7GJ.js} +1 -1
  10. package/dist/_browser-chunks/{chunk-FRAOQJDI.js → chunk-3QPZOXB7.js} +1 -5
  11. package/dist/_browser-chunks/{chunk-GRO2ZYEJ.js → chunk-4BOJAE7P.js} +12 -8
  12. package/dist/_browser-chunks/{chunk-ZHKZKFY4.js → chunk-6SL45YM3.js} +9 -13
  13. package/dist/_browser-chunks/{chunk-DS2WQZGO.js → chunk-BLCZ3C5M.js} +41 -62
  14. package/dist/_browser-chunks/{chunk-7DQREF4S.js → chunk-DHTLVXAL.js} +37 -44
  15. package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-DISGPOF4.js} +54 -51
  16. package/dist/_browser-chunks/{chunk-76222HQR.js → chunk-E6QKKKLO.js} +20 -5
  17. package/dist/_browser-chunks/{chunk-DYNTDJ3O.js → chunk-EBSOKHFG.js} +8 -2
  18. package/dist/_browser-chunks/{chunk-3M5T7BW4.js → chunk-ECMVTOVD.js} +1 -1
  19. package/dist/_browser-chunks/{chunk-EQKMUQF3.js → chunk-ENHFQXYS.js} +5 -4
  20. package/dist/_browser-chunks/{chunk-KYSD26D6.js → chunk-EW2M3URL.js} +90 -83
  21. package/dist/_browser-chunks/{chunk-I4ATZPNZ.js → chunk-FCULT3AE.js} +3 -3
  22. package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
  23. package/dist/_browser-chunks/{chunk-NGMQJMCY.js → chunk-HZFHNYRC.js} +1 -1
  24. package/dist/_browser-chunks/{chunk-5H4KFI44.js → chunk-KQJ4T6JL.js} +30 -24
  25. package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-NK5SGJNG.js} +22 -17
  26. package/dist/_browser-chunks/{chunk-N3NRW5XX.js → chunk-PQRPDA4U.js} +3 -3
  27. package/dist/_browser-chunks/{chunk-2JDQ35OA.js → chunk-PU7D2WDP.js} +0 -11
  28. package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-QFO2B4X2.js} +31 -28
  29. package/dist/_browser-chunks/{chunk-TTBPZQ24.js → chunk-S7N7Z5TY.js} +47 -43
  30. package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
  31. package/dist/_browser-chunks/{chunk-WBLVFDJT.js → chunk-UH3XTEOQ.js} +716 -658
  32. package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
  33. package/dist/_browser-chunks/{chunk-O24AZJZ7.js → chunk-YJO5BK52.js} +7 -3
  34. package/dist/_browser-chunks/{chunk-3HM3VWJS.js → chunk-ZF37BMDS.js} +6 -2
  35. package/dist/_browser-chunks/{chunk-QU4RB2WU.js → chunk-ZF5SPY56.js} +4 -4
  36. package/dist/_browser-chunks/{matchers-YLBYSYAF.js → matchers-2HVLNCVO.js} +4 -4
  37. package/dist/_browser-chunks/{react-dom-client-4OHE3QDV.js → react-dom-client-SLBUX3U3.js} +1 -1
  38. package/dist/_node-chunks/{attached-runtime-J2AKT5WI.js → attached-runtime-7IRDQUTZ.js} +28 -29
  39. package/dist/_node-chunks/{builder-manager-Z4RWF4ZH.js → builder-manager-YTALSWKQ.js} +39 -28
  40. package/dist/_node-chunks/{chunk-2WVLC5M2.js → chunk-26ERGIQH.js} +6 -6
  41. package/dist/_node-chunks/{chunk-VZG3OKFO.js → chunk-33T4HNF2.js} +6 -6
  42. package/dist/_node-chunks/{chunk-ZEYODVQT.js → chunk-3F3673RQ.js} +7 -7
  43. package/dist/_node-chunks/{chunk-Y4W4B3E7.js → chunk-3FLRYZLJ.js} +6 -6
  44. package/dist/_node-chunks/{chunk-AVL7GUOZ.js → chunk-3L2QRDKH.js} +522 -1045
  45. package/dist/_node-chunks/{chunk-XO54HM4P.js → chunk-3NH7IHUS.js} +6 -6
  46. package/dist/_node-chunks/{chunk-GMKLTDKN.js → chunk-3ZAENV5A.js} +6 -6
  47. package/dist/_node-chunks/{chunk-3IIQSDCO.js → chunk-4B52HLKK.js} +53 -55
  48. package/dist/_node-chunks/chunk-4CZJ4SFH.js +281 -0
  49. package/dist/_node-chunks/{chunk-BBU2FUPC.js → chunk-4IIWFG7O.js} +13 -11
  50. package/dist/_node-chunks/{chunk-2U5J7YTA.js → chunk-4YWZLOAF.js} +6 -6
  51. package/dist/_node-chunks/{chunk-XVOIYGTJ.js → chunk-5A5XOSRM.js} +6 -6
  52. package/dist/_node-chunks/chunk-5T6Q7HT3.js +11 -0
  53. package/dist/_node-chunks/{chunk-MI7WBXWX.js → chunk-6DRDJF2Q.js} +6 -6
  54. package/dist/_node-chunks/{chunk-WBCKO5LP.js → chunk-6JSZY5TJ.js} +6 -6
  55. package/dist/_node-chunks/{chunk-3EBGFRAH.js → chunk-7SPDKMDQ.js} +32 -40
  56. package/dist/_node-chunks/{chunk-IRPQQARO.js → chunk-7YLKDHLZ.js} +7 -7
  57. package/dist/_node-chunks/{chunk-BSQB5B57.js → chunk-7YQIVUEK.js} +6 -6
  58. package/dist/_node-chunks/{chunk-PYVGF5F2.js → chunk-ADCQYK3Z.js} +6 -6
  59. package/dist/_node-chunks/{chunk-7YQTID2W.js → chunk-ALHQVE5R.js} +6 -6
  60. package/dist/_node-chunks/{chunk-MW4OAPPD.js → chunk-B4XAZ2OC.js} +8 -8
  61. package/dist/_node-chunks/{chunk-GGCOG7OV.js → chunk-BFQJF3ID.js} +283 -306
  62. package/dist/_node-chunks/{chunk-5GOXN5M4.js → chunk-BSXI35KM.js} +7 -7
  63. package/dist/_node-chunks/{chunk-TAMTPVYZ.js → chunk-BZQF5KUE.js} +7 -7
  64. package/dist/_node-chunks/{chunk-5JLVSH44.js → chunk-CEIESR4U.js} +8 -8
  65. package/dist/_node-chunks/{chunk-OJWUUSA4.js → chunk-CESXIP3N.js} +6 -6
  66. package/dist/_node-chunks/{chunk-CEYSYQLV.js → chunk-DAEUTT3I.js} +6 -6
  67. package/dist/_node-chunks/{chunk-FB2BOL6I.js → chunk-DIC4T2UO.js} +6 -6
  68. package/dist/_node-chunks/{chunk-LKITAODU.js → chunk-DPOWAA4P.js} +37 -31
  69. package/dist/_node-chunks/{chunk-W3KFVTWV.js → chunk-DTNEHO4J.js} +10 -10
  70. package/dist/_node-chunks/{chunk-C5OFHB3N.js → chunk-DY7F7B6V.js} +7 -7
  71. package/dist/_node-chunks/{chunk-FUG5LYKS.js → chunk-E56UKDJR.js} +8 -8
  72. package/dist/_node-chunks/{chunk-A7GEBS3Q.js → chunk-EFX2VA4Q.js} +6 -6
  73. package/dist/_node-chunks/{chunk-PQTEFQIJ.js → chunk-EM6AYELK.js} +10 -12
  74. package/dist/_node-chunks/{chunk-32FLWHUC.js → chunk-F2AFT3P7.js} +497 -475
  75. package/dist/_node-chunks/{chunk-OXT6T4AS.js → chunk-GC7NA2Y7.js} +7 -7
  76. package/dist/_node-chunks/{chunk-55S3GGGC.js → chunk-GIKCT5KG.js} +7 -7
  77. package/dist/_node-chunks/{chunk-PXOD36TR.js → chunk-GLNHSUKT.js} +20 -20
  78. package/dist/_node-chunks/{chunk-BKND5XP2.js → chunk-GQZZQB4K.js} +7 -7
  79. package/dist/_node-chunks/{chunk-GTXZNA2L.js → chunk-GRN6WQC3.js} +10 -10
  80. package/dist/_node-chunks/{chunk-6UASHVMR.js → chunk-HCMHVV7N.js} +8 -8
  81. package/dist/_node-chunks/{chunk-IVAOJWPF.js → chunk-HJVZQS65.js} +7 -7
  82. package/dist/_node-chunks/{chunk-ER3X3AQ7.js → chunk-I26RGEVQ.js} +7 -7
  83. package/dist/_node-chunks/{chunk-LAIED5XU.js → chunk-I36FPWMO.js} +6 -6
  84. package/dist/_node-chunks/{chunk-W7HY3ELZ.js → chunk-IDPQ3CVN.js} +474 -479
  85. package/dist/_node-chunks/{chunk-36LPBTLF.js → chunk-JUVUVVHI.js} +6 -6
  86. package/dist/_node-chunks/{chunk-DGWKJQ6G.js → chunk-K6TEIAKH.js} +62 -7
  87. package/dist/_node-chunks/{chunk-7IOSIYW2.js → chunk-KEXQ3BON.js} +7 -7
  88. package/dist/_node-chunks/{chunk-NLNAIU4I.js → chunk-KUZSE7ZD.js} +9 -9
  89. package/dist/_node-chunks/chunk-LJ5JRR5Q.js +18 -0
  90. package/dist/_node-chunks/{chunk-YBG7HVP7.js → chunk-LMGI47HP.js} +8 -8
  91. package/dist/_node-chunks/{chunk-6E34W4UX.js → chunk-LPIPPSMS.js} +6 -6
  92. package/dist/_node-chunks/{chunk-XICRXTTE.js → chunk-LR4W5G37.js} +6 -6
  93. package/dist/_node-chunks/{chunk-VKRGTLQJ.js → chunk-M4MRBEJI.js} +27 -23
  94. package/dist/_node-chunks/{chunk-REIDJUVJ.js → chunk-M7BVABR2.js} +20 -16
  95. package/dist/_node-chunks/{chunk-XCJ2ZIQ4.js → chunk-MK2RPLWT.js} +7 -7
  96. package/dist/_node-chunks/{chunk-LHNHFYK3.js → chunk-MKSEM5C2.js} +6 -6
  97. package/dist/_node-chunks/{chunk-RNRGXAFV.js → chunk-MWQIBOUB.js} +6 -6
  98. package/dist/_node-chunks/{chunk-NFDQT7UW.js → chunk-NAXIA2JI.js} +320 -316
  99. package/dist/_node-chunks/{chunk-GYFR2JLS.js → chunk-NDVIMCIX.js} +7 -7
  100. package/dist/_node-chunks/{chunk-D5ADPGA4.js → chunk-NIOVXWQZ.js} +6 -6
  101. package/dist/_node-chunks/{chunk-54EHKXV7.js → chunk-NRP4FGRT.js} +15 -9
  102. package/dist/_node-chunks/{chunk-NIQSBBT2.js → chunk-NSNBFXVB.js} +7 -7
  103. package/dist/_node-chunks/{chunk-Z2ZTDQDY.js → chunk-NTUTJAD4.js} +8 -8
  104. package/dist/_node-chunks/{chunk-XH5CXH53.js → chunk-O46DZ2KC.js} +8 -8
  105. package/dist/_node-chunks/{chunk-S3NDLFYL.js → chunk-OH5M2YER.js} +7 -7
  106. package/dist/_node-chunks/{chunk-FTYDKQCO.js → chunk-OSIENBU6.js} +6 -6
  107. package/dist/_node-chunks/{chunk-76KKKLEE.js → chunk-OVJZBW54.js} +7 -7
  108. package/dist/_node-chunks/{chunk-WO4UEQI6.js → chunk-PGIDRLZ5.js} +22 -22
  109. package/dist/_node-chunks/{chunk-J3SM62J3.js → chunk-PJCSZR4T.js} +8 -8
  110. package/dist/_node-chunks/{chunk-OPT5A55S.js → chunk-PQXP5FZ2.js} +8 -8
  111. package/dist/_node-chunks/{chunk-5P4N734V.js → chunk-PU33WSBW.js} +34 -52
  112. package/dist/_node-chunks/{chunk-APPFF22V.js → chunk-PUBZLLNL.js} +7 -7
  113. package/dist/_node-chunks/{chunk-ALGQMFMN.js → chunk-QWZZX2HN.js} +6 -6
  114. package/dist/_node-chunks/{chunk-NLLM4MDK.js → chunk-RMUBUNBY.js} +6 -6
  115. package/dist/_node-chunks/{chunk-SJXLINHV.js → chunk-S33FEPQ3.js} +6 -6
  116. package/dist/_node-chunks/{chunk-FEC5PGJO.js → chunk-SHP6447T.js} +7 -7
  117. package/dist/_node-chunks/{chunk-MBIVTOJK.js → chunk-ST3KB36E.js} +6 -6
  118. package/dist/_node-chunks/{chunk-AKMPPLT5.js → chunk-SXX75O2D.js} +7 -7
  119. package/dist/_node-chunks/{chunk-6UAJLEIO.js → chunk-TQ5YAQ4Y.js} +6 -6
  120. package/dist/_node-chunks/{chunk-R7VDUSKY.js → chunk-TSJ3JCNN.js} +16 -10
  121. package/dist/_node-chunks/{chunk-TKMXEHM4.js → chunk-UYEX6LW6.js} +7 -7
  122. package/dist/_node-chunks/{chunk-46Y5H6X5.js → chunk-VJLLEKWR.js} +138 -116
  123. package/dist/_node-chunks/{chunk-IFAV3CER.js → chunk-WWJKLYU5.js} +10 -10
  124. package/dist/_node-chunks/{chunk-MXLHIEXC.js → chunk-XC7K4QEX.js} +6 -6
  125. package/dist/_node-chunks/{chunk-GO3YSBPE.js → chunk-Y64FM6U7.js} +8 -8
  126. package/dist/_node-chunks/{chunk-T6P2EJD2.js → chunk-YDM7NH4T.js} +6 -6
  127. package/dist/_node-chunks/{chunk-XSVOMORJ.js → chunk-ZHVOUP6D.js} +6 -6
  128. package/dist/_node-chunks/dist-CFCU4PZG.js +27 -0
  129. package/dist/_node-chunks/dist-PFMT5YJK.js +16 -0
  130. package/dist/_node-chunks/{local-runtime-YDAW5RJV.js → local-runtime-BKID5MBG.js} +19 -20
  131. package/dist/_node-chunks/{mdx-plugin-XLDET5LV.js → mdx-plugin-7BOUDCZB.js} +13 -13
  132. package/dist/_node-chunks/{monorepo-NWMAHGOM.js → monorepo-FRHSAJB7.js} +11 -11
  133. package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-4B6IZ7JD.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-7BHSAJP4.js} +11 -11
  134. package/dist/_node-chunks/optimized-tests-F5LCOTXH.js +22 -0
  135. package/dist/_node-chunks/{pattern-copy-play-PJC4PO6A.js → pattern-copy-play-6TGV6WS4.js} +9 -9
  136. package/dist/_node-chunks/postinstallAddon-4RININ5C.js +20 -0
  137. package/dist/_node-chunks/{rehype-external-links-4CWXZ35U.js → rehype-external-links-EE2HT4QP.js} +9 -9
  138. package/dist/_node-chunks/{rehype-slug-QZ2PWSJH.js → rehype-slug-ZKRW2V6Z.js} +9 -9
  139. package/dist/_node-chunks/{relaxed-limits-ZQR4ER7L.js → relaxed-limits-6Q7VRQC5.js} +11 -11
  140. package/dist/_node-chunks/{run-U63AXEKZ.js → run-6Y3ZTASZ.js} +23 -21
  141. package/dist/_node-chunks/{run-BMXB2BW2.js → run-EBHIAT35.js} +18 -18
  142. package/dist/_node-chunks/{setup-NCUTUBNN.js → setup-6XIF77JT.js} +8 -8
  143. package/dist/_node-chunks/{vitest.config.4.template-4XHF7XPS.js → vitest.config.4.template-GMQNQ4UW.js} +7 -7
  144. package/dist/actions/decorator.js +16 -21
  145. package/dist/actions/index.d.ts +3 -3
  146. package/dist/actions/index.js +1 -1
  147. package/dist/addon-a11y/index.js +2 -2
  148. package/dist/addon-a11y/manager.js +11 -11
  149. package/dist/addon-a11y/preset.js +7 -7
  150. package/dist/addon-a11y/preview.d.ts +8 -2
  151. package/dist/addon-a11y/preview.js +2 -2
  152. package/dist/addon-docs/blocks.d.ts +104 -85
  153. package/dist/addon-docs/blocks.js +30 -32
  154. package/dist/addon-docs/index.d.ts +2 -2
  155. package/dist/addon-docs/index.js +3 -3
  156. package/dist/addon-docs/manager.js +4 -4
  157. package/dist/addon-docs/preset.js +12 -12
  158. package/dist/addon-docs/preview.d.ts +3 -1
  159. package/dist/addon-docs/preview.js +1 -1
  160. package/dist/addon-links/index.d.ts +2 -1
  161. package/dist/addon-links/preview.d.ts +1 -1
  162. package/dist/addon-mcp/preset.js +11 -11
  163. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +16 -16
  164. package/dist/addon-ondevice-controls/index.js +1 -1
  165. package/dist/addon-ondevice-controls/register.js +1 -1
  166. package/dist/addon-pseudo-states/index.js +1 -1
  167. package/dist/addon-pseudo-states/preview.d.ts +1 -1
  168. package/dist/addon-pseudo-states/preview.js +1 -1
  169. package/dist/addon-themes/index.d.ts +6 -5
  170. package/dist/addon-themes/postinstall.js +7 -7
  171. package/dist/addon-vitest/constants.js +8 -8
  172. package/dist/addon-vitest/manager.js +18 -9
  173. package/dist/addon-vitest/node/coverage-reporter.js +11 -11
  174. package/dist/addon-vitest/node/vitest.js +34 -34
  175. package/dist/addon-vitest/postinstall.js +10 -10
  176. package/dist/addon-vitest/preset.js +21 -20
  177. package/dist/addon-vitest/vitest-plugin/global-setup.js +22 -22
  178. package/dist/addon-vitest/vitest-plugin/index.js +69 -59
  179. package/dist/babel/index.d.ts +209 -212
  180. package/dist/babel/index.js +11 -11
  181. package/dist/bin/core.js +110 -89
  182. package/dist/bin/dispatcher.js +10 -10
  183. package/dist/bin/loader.js +8 -8
  184. package/dist/builder-vite/index.d.ts +1 -1
  185. package/dist/builder-vite/index.js +18 -18
  186. package/dist/builder-vite/preset.js +13 -13
  187. package/dist/channels/index.d.ts +1 -1
  188. package/dist/channels/index.js +2 -2
  189. package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
  190. package/dist/{chunk-Fg1Fm__9.d.ts → chunk-BCG2ui5q.d.ts} +671 -674
  191. package/dist/{chunk-DoIGKY33.d.ts → chunk-BLZXEm1K.d.ts} +6 -8
  192. package/dist/{chunk-CYuvV2sR.d.ts → chunk-BNRZY6Jq.d.ts} +3 -3
  193. package/dist/{chunk-CNqjcOmK.d.ts → chunk-BV_hETtB.d.ts} +2 -2
  194. package/dist/chunk-BcYKnZln.d.ts +10 -0
  195. package/dist/{chunk-BCoJQE-f.d.ts → chunk-BtKww7r1.d.ts} +6 -4
  196. package/dist/{chunk-Bpi2tz-6.d.ts → chunk-Bubi-WAs.d.ts} +20 -17
  197. package/dist/{chunk-pcFXCimE.d.ts → chunk-CmV7WZzR.d.ts} +124 -2
  198. package/dist/{chunk-BGkgZp-H.d.ts → chunk-D3uSIa6H.d.ts} +9 -1
  199. package/dist/{chunk-DROZ9oel.d.ts → chunk-DNCU78oW.d.ts} +110 -9
  200. package/dist/{chunk-D0NUmzXp.d.ts → chunk-LWwxlbee.d.ts} +4 -4
  201. package/dist/{chunk-BXLImeLy.d.ts → chunk-u_gGuTrz.d.ts} +23 -8
  202. package/dist/cli/index.d.ts +3 -3
  203. package/dist/cli/index.js +25 -30
  204. package/dist/cli/skills/content/index.d.ts +1 -1
  205. package/dist/cli/tools/sdk/child-host.d.ts +1 -1
  206. package/dist/cli/tools/sdk/child-host.js +17 -17
  207. package/dist/cli/tools/sdk/index.d.ts +3 -3
  208. package/dist/cli/tools/sdk/index.js +18 -18
  209. package/dist/cli-commands/bin/index.js +7 -7
  210. package/dist/client-logger/index.d.ts +20 -21
  211. package/dist/client-logger/index.js +2 -1
  212. package/dist/common/index.d.ts +13 -13
  213. package/dist/common/index.js +34 -35
  214. package/dist/components/index.d.ts +46 -35
  215. package/dist/components/index.js +194 -205
  216. package/dist/core-events/index.d.ts +2 -2
  217. package/dist/core-server/index.d.ts +15 -10
  218. package/dist/core-server/index.js +706 -165
  219. package/dist/core-server/presets/common-manager.js +254 -336
  220. package/dist/core-server/presets/common-override-preset.js +10 -10
  221. package/dist/core-server/presets/common-preset.js +83 -275
  222. package/dist/create/bin/index.js +7 -7
  223. package/dist/create/index.js +15 -15
  224. package/dist/csf/csf-utils.d.ts +1 -1
  225. package/dist/csf/index.d.ts +3 -3
  226. package/dist/csf/index.js +40 -43
  227. package/dist/csf-tools/index.d.ts +52 -44
  228. package/dist/csf-tools/index.js +13 -13
  229. package/dist/docs-tools/index.d.ts +332 -16
  230. package/dist/docs-tools/index.js +3 -3
  231. package/dist/instrumenter/index.d.ts +5 -5
  232. package/dist/instrumenter/index.js +25 -15
  233. package/dist/manager/_manager-chunks/{globals-runtime-DvV_TF3-.js → globals-runtime-B4NRbNSS.js} +2 -2
  234. package/dist/manager/_manager-chunks/{globals-runtime-wjkxyMn0.js → globals-runtime-BC43T1rL.js} +4150 -50
  235. package/dist/manager/_manager-chunks/{globals-runtime-BSj0mCjE.js → globals-runtime-BgWmCsA7.js} +114 -110
  236. package/dist/manager/_manager-chunks/{globals-runtime-CA8AuIRT.js → globals-runtime-BnQ7i5wq.js} +232 -228
  237. package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
  238. package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
  239. package/dist/manager/_manager-chunks/{globals-runtime-C5gK7HhH.js → globals-runtime-C59T0h-j.js} +2 -2
  240. package/dist/manager/_manager-chunks/{globals-runtime-CCTA-XPa.js → globals-runtime-CCZrdft6.js} +5 -4
  241. package/dist/manager/_manager-chunks/{globals-runtime-BY3epqww.js → globals-runtime-CS41oTca.js} +2 -1
  242. package/dist/manager/_manager-chunks/{globals-runtime-Bu9eGDTe.js → globals-runtime-Cccwtspx.js} +288 -420
  243. package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
  244. package/dist/manager/_manager-chunks/{globals-runtime-BweHuXkK.js → globals-runtime-DCmvKMN5.js} +2 -2
  245. package/dist/manager/_manager-chunks/{globals-runtime-C92M_Vnq.js → globals-runtime-Ddp2jFET.js} +5 -5
  246. package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
  247. package/dist/manager/_manager-chunks/globals-runtime-Me9Bl-sx.js +156 -0
  248. package/dist/manager/_manager-chunks/{globals-runtime-CHjExYMv.js → globals-runtime-UFDJQlo-.js} +741 -540
  249. package/dist/manager/_manager-chunks/globals-runtime-nQMRiA0J.js +19 -0
  250. package/dist/manager/_manager-chunks/{globals-runtime-Bj5KDUJi.js → globals-runtime-oRjPg2jY.js} +1 -1
  251. package/dist/manager/_manager-chunks/runtime-4wMiTjjZ.js +552 -0
  252. package/dist/manager/_manager-chunks/{runtime--hR2NZFd.js → runtime-AvqHE9rM.js} +112 -109
  253. package/dist/manager/_manager-chunks/{runtime-EPerAEAs.js → runtime-CZtDJIYj.js} +3 -3
  254. package/dist/manager/_manager-chunks/{runtime-B6NL14pz.js → runtime-D8QxTQiI.js} +6 -6
  255. package/dist/manager/_manager-chunks/{runtime-BAsOe1C_.js → runtime-DC3oEVlM.js} +49 -49
  256. package/dist/manager/_manager-chunks/{runtime-CJQZFUUj.js → runtime-DCOIOn4T.js} +46 -56
  257. package/dist/manager/_manager-chunks/{runtime-DvB1axgp.js → runtime-D_FDSHFG.js} +13 -13
  258. package/dist/manager/_manager-chunks/{runtime-Dtbhxq5m.js → runtime-Db8fJ2MP.js} +67 -500
  259. package/dist/manager/_manager-chunks/{runtime-CgRqs_SK.js → runtime-lPbyY_f5.js} +882 -869
  260. package/dist/manager/_manager-chunks/{runtime-Dem2xJbS.js → runtime-td6oYfU6.js} +739 -554
  261. package/dist/manager/globals-runtime.js +1 -1
  262. package/dist/manager/runtime.js +1 -1
  263. package/dist/manager-api/index.d.ts +1 -1
  264. package/dist/manager-api/index.js +479 -464
  265. package/dist/manager-errors.d.ts +1 -1
  266. package/dist/mcp/index.d.ts +1 -1
  267. package/dist/mcp/index.js +9 -9
  268. package/dist/mocking-utils/index.d.ts +5 -3
  269. package/dist/mocking-utils/index.js +21 -26
  270. package/dist/nextjs-vite/export-mocks/headers/index.js +3 -1
  271. package/dist/nextjs-vite/export-mocks/link/index.d.ts +4 -1
  272. package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +9 -1
  273. package/dist/nextjs-vite/export-mocks/router/index.js +13 -7
  274. package/dist/nextjs-vite/index.d.ts +2 -2
  275. package/dist/nextjs-vite/index.js +9 -5
  276. package/dist/nextjs-vite/node/index.js +7 -7
  277. package/dist/nextjs-vite/preset.js +12 -12
  278. package/dist/nextjs-vite/preview.d.ts +2 -1
  279. package/dist/nextjs-vite/preview.js +1 -1
  280. package/dist/nextjs-vite/vite-plugin/index.d.ts +2 -2
  281. package/dist/nextjs-vite/vite-plugin/index.js +9 -9
  282. package/dist/nextjs-vite-plugin/index.js +17 -27
  283. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
  284. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +10 -6
  285. package/dist/node-logger/index.d.ts +18 -18
  286. package/dist/node-logger/index.js +9 -9
  287. package/dist/oxc-parser/index.js +14 -11
  288. package/dist/oxc-parser/worker.js +10 -10
  289. package/dist/preview/_chunks/{runtime-Bcv1hJky.js → runtime-BYRCSYBN.js} +4148 -48
  290. package/dist/preview/_chunks/{runtime-WapFVPAh.js → runtime-Bvh_rfnQ.js} +2 -37
  291. package/dist/preview/_chunks/{runtime-BZ4pNS3g.js → runtime-CdZ1yk7m.js} +3 -3
  292. package/dist/preview/_chunks/{runtime-BhSZ1Mwt.js → runtime-CsO4apr9.js} +38 -42
  293. package/dist/preview/_chunks/{runtime-BUnOhg9h.js → runtime-D2MPrqbU.js} +2 -2
  294. package/dist/preview/_chunks/{runtime-BPwAnlRx.js → runtime-DS0s7U3c.js} +1 -1
  295. package/dist/preview/_chunks/{runtime-BgPhfM5P.js → runtime-U1Ycy25F.js} +736 -428
  296. package/dist/preview/_chunks/{runtime-BJwGQok8.js → runtime-tyJLgv6h.js} +221 -60
  297. package/dist/preview/runtime.js +1 -1
  298. package/dist/preview-api/index.d.ts +3 -3
  299. package/dist/preview-api/index.js +8 -8
  300. package/dist/preview-errors.d.ts +1 -1
  301. package/dist/react/docgen/docgen-worker.js +11 -11
  302. package/dist/react/entry-preview-argtypes.js +1 -1
  303. package/dist/react/entry-preview-docs.js +1 -1
  304. package/dist/react/entry-preview.js +1 -1
  305. package/dist/react/index.d.ts +5 -7
  306. package/dist/react/index.js +5 -5
  307. package/dist/react/preset.js +13 -13
  308. package/dist/react/preview.js +4 -4
  309. package/dist/react-native/bin/get-stories.js +8 -8
  310. package/dist/react-native/index.d.ts +37 -36
  311. package/dist/react-native/index.js +38 -38
  312. package/dist/react-native/metro/node.d.ts +1 -1
  313. package/dist/react-native/metro/node.js +10 -10
  314. package/dist/react-native/metro/withForkbook.d.ts +7 -7
  315. package/dist/react-native/metro/withForkbook.js +16 -16
  316. package/dist/react-native/preview.js +4 -1
  317. package/dist/react-native/scripts/generate.js +8 -8
  318. package/dist/react-native/stub.js +1 -1
  319. package/dist/react-native-ui/index.d.ts +8 -7
  320. package/dist/react-native-ui/index.js +1 -8
  321. package/dist/react-native-ui-common/index.d.ts +30 -9
  322. package/dist/react-native-ui-common/index.js +26 -31
  323. package/dist/react-vite/node/index.js +7 -7
  324. package/dist/react-vite/preset.js +7 -7
  325. package/dist/router/index.d.ts +2 -2
  326. package/dist/router/index.js +4 -2
  327. package/dist/server-errors.d.ts +1 -1
  328. package/dist/server-errors.js +9 -9
  329. package/dist/shared/open-service/index.d.ts +3 -3
  330. package/dist/shared/open-service/index.js +1 -1
  331. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
  332. package/dist/shared/open-service/toolsets/docs/public.d.ts +7 -7
  333. package/dist/telemetry/index.d.ts +38 -274
  334. package/dist/telemetry/index.js +11 -66
  335. package/dist/test/index.d.ts +2 -2
  336. package/dist/test/index.js +139 -120
  337. package/dist/theming/create.d.ts +1 -1
  338. package/dist/theming/index.d.ts +1 -1
  339. package/dist/types/index.d.ts +2 -2
  340. package/dist/types/index.js +2 -2
  341. package/package.json +16 -16
  342. package/template/nextjs-vite/cli/js/Button.jsx +2 -2
  343. package/template/nextjs-vite/cli/js/Header.jsx +1 -1
  344. package/template/nextjs-vite/cli/js/Page.jsx +1 -1
  345. package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
  346. package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
  347. package/template/nextjs-vite/cli/ts/Page.tsx +1 -1
  348. package/template/react/cli/js/Button.jsx +2 -2
  349. package/template/react/cli/js/Header.jsx +1 -1
  350. package/template/react/cli/js/Page.jsx +1 -1
  351. package/template/react/cli/ts/Button.tsx +2 -2
  352. package/template/react/cli/ts/Header.tsx +1 -1
  353. package/template/react/cli/ts/Page.tsx +1 -1
  354. package/template/react-vite/cli/js/Button.jsx +2 -2
  355. package/template/react-vite/cli/js/Header.jsx +1 -1
  356. package/template/react-vite/cli/js/Page.jsx +1 -1
  357. package/template/react-vite/cli/ts/Button.tsx +2 -2
  358. package/template/react-vite/cli/ts/Header.tsx +1 -1
  359. package/template/react-vite/cli/ts/Page.tsx +1 -1
  360. package/dist/_node-chunks/chunk-2YNXKY72.js +0 -40
  361. package/dist/_node-chunks/chunk-3NST2GUZ.js +0 -33
  362. package/dist/_node-chunks/chunk-4D325SMT.js +0 -1359
  363. package/dist/_node-chunks/chunk-APXRPW7A.js +0 -11
  364. package/dist/_node-chunks/chunk-QHBQRPDP.js +0 -155
  365. package/dist/_node-chunks/chunk-SMBAR4G6.js +0 -18
  366. package/dist/_node-chunks/chunk-SRDKK3SG.js +0 -33
  367. package/dist/_node-chunks/chunk-V5IMPC3J.js +0 -33
  368. package/dist/_node-chunks/chunk-YIAUHGY2.js +0 -69
  369. package/dist/_node-chunks/dist-C5QIQD3G.js +0 -27
  370. package/dist/_node-chunks/dist-NBRPZCHX.js +0 -16
  371. package/dist/_node-chunks/optimized-tests-EIPJR7HA.js +0 -22
  372. package/dist/_node-chunks/postinstallAddon-EOAAURMG.js +0 -20
  373. package/dist/_node-chunks/session-id-HEW5JUNB.js +0 -23
  374. package/dist/chunk-BGhyFTJO.d.ts +0 -115
  375. package/dist/chunk-DaVb55-_.d.ts +0 -124
  376. package/dist/manager/_manager-chunks/globals-runtime-Bs75QQ_I.js +0 -9987
  377. package/dist/manager/_manager-chunks/globals-runtime-WZKaeKm9.js +0 -4091
  378. package/dist/manager/_manager-chunks/runtime-5o_11Jae.js +0 -78
  379. package/dist/preview/_chunks/runtime-BsMjBzuq.js +0 -53
  380. package/dist/preview/_chunks/runtime-C1jgT6tJ.js +0 -4091
  381. package/dist/preview/_chunks/runtime-CkOhMcXf.js +0 -387
@@ -1,9 +1,61 @@
1
1
  import { n as __esmMin, r as __exportAll } from "./runtime-BdGkqNEt.js";
2
- import { A as variant, C as pipe, D as string, E as safeParse, J as isEqual, M as init_index_browser, N as nanoid, O as undefined_, S as optional, T as safeInteger, _ as looseObject, b as number, c as slash, d as l, f as array, g as literal, h as init_dist, j as void_, k as unknown, l as g, lt as dedent, m as custom, p as check, q as init_isEqual, u as init_deepsignal_core_module, ut as init_esm, v as minLength, w as record, x as object, y as minValue } from "./runtime-WapFVPAh.js";
3
- import { n as init_storybook_error, t as StorybookError } from "./runtime-BsMjBzuq.js";
4
- import { At as UniversalStoreFollowerTimeoutError, Et as logger, F as init_channel_slot, Ot as OpenServiceStaticSnapshotInvalidError, P as getChannel, Tt as init_client_logger, f as init_storyDocsCodePanel, jt as init_manager_errors, kt as OpenServiceStaticSnapshotLoadError, p as shouldSkipStoryDocsEmit, r as definePreviewAddon } from "./runtime-BJwGQok8.js";
5
- import { i as emitTransformCode, r as init_preview_api } from "./runtime-BhSZ1Mwt.js";
6
- import { i as j, n as g$1, o as n, r as init_signals_core_module, s as y, t as f } from "./runtime-Bcv1hJky.js";
2
+ import { A as variant, B as T, C as pipe, D as string, E as safeParse, J as isEqual, M as init_index_browser, N as nanoid, O as undefined_, S as optional, T as safeInteger, V as init_dist, _ as looseObject, b as number, c as slash, ct as init_esm, d as l, f as array, g as literal, h as init_dist$1, j as void_, k as unknown, l as g, m as custom, p as check, q as init_isEqual, st as dedent, u as init_deepsignal_core_module, v as minLength, w as record, x as object, y as minValue } from "./runtime-Bvh_rfnQ.js";
3
+ import { A as OpenServiceAsyncRecipeError, B as OpenServiceRemoteCommandDisconnectedError, Bt as init_client_logger, F as OpenServiceLoadedDrainExceededError, Gt as UniversalStoreFollowerTimeoutError, H as OpenServiceUnimplementedOperationError, Ht as once, I as OpenServiceMissingChannelError, Kt as init_manager_errors, L as OpenServiceMissingServiceError, M as OpenServiceCyclicStateError, N as OpenServiceInternalServiceError, P as OpenServiceInvalidStaticPathError, R as OpenServiceOperationNameCollisionError, U as OpenServiceValidationError, Ut as OpenServiceStaticSnapshotInvalidError, V as OpenServiceRemoteCommandUnhandledError, Vt as logger, W as init_open_service, Wt as OpenServiceStaticSnapshotLoadError, X as init_channel_slot, Y as getChannel, _ as instrument, f as init_storyDocsCodePanel, g as init_instrumenter, j as OpenServiceAsyncSchemaError, p as shouldSkipStoryDocsEmit, r as definePreviewAddon, z as OpenServiceRemoteCommandConfigDriftError } from "./runtime-tyJLgv6h.js";
4
+ import { i as emitTransformCode, r as init_preview_api } from "./runtime-CsO4apr9.js";
5
+ import { a as customMatchers, c as setState, d as isMockFunction, f as mocks, i as JestExtend, l as fn$1, n as JestAsymmetricMatchers, o as getState, p as spyOn$1, r as JestChaiExpect, s as init_dist$2, t as GLOBAL_EXPECT, u as init_dist$3 } from "./runtime-D2MPrqbU.js";
6
+ import { a as Assertion, c as init_chai, l as use, o as assert, s as expect$2, u as utils_exports } from "./runtime-DS0s7U3c.js";
7
+ import { c as init_esm$1, d as dom_esm_exports, f as init_dom_esm, i as j, m as matchers_exports, n as g$1, o as n, p as init_matchers, r as init_signals_core_module, s as y, t as f, u as userEvent$1 } from "./runtime-BYRCSYBN.js";
8
+ //#region src/storybook-error.ts
9
+ function parseErrorCode({ code, category }) {
10
+ return `FB_${category}_${String(code).padStart(4, "0")}`;
11
+ }
12
+ var StorybookError;
13
+ function init_storybook_error() {
14
+ return (init_storybook_error = __esmMin((() => {
15
+ StorybookError = class StorybookError extends Error {
16
+ get fullErrorCode() {
17
+ return parseErrorCode({
18
+ code: this.code,
19
+ category: this.category
20
+ });
21
+ }
22
+ /** Overrides the default `Error.name` property in the format: FB_<CATEGORY>_<CODE>. */
23
+ get name() {
24
+ const errorName = this._name || this.constructor.name;
25
+ return `${this.fullErrorCode} (${errorName})`;
26
+ }
27
+ set name(name) {
28
+ this._name = name;
29
+ }
30
+ constructor(props) {
31
+ super(StorybookError.getFullMessage(props), props.cause === void 0 ? void 0 : { cause: props.cause });
32
+ this.data = {};
33
+ this.fromStorybook = true;
34
+ this.isHandledError = false;
35
+ this.subErrors = [];
36
+ this.category = props.category;
37
+ this.documentation = props.documentation ?? false;
38
+ this.code = props.code;
39
+ this.isHandledError = props.isHandledError ?? false;
40
+ this.agentFacing = props.agentFacing ?? false;
41
+ this.name = props.name;
42
+ this.subErrors = props.subErrors ?? [];
43
+ }
44
+ /** Generates the error message along with additional documentation link (if applicable). */
45
+ static getFullMessage({ documentation, code, category, message }) {
46
+ let page;
47
+ if (documentation === true) page = `https://forkbook.ljk.dev/error/${parseErrorCode({
48
+ code,
49
+ category
50
+ })}`;
51
+ else if (typeof documentation === "string") page = documentation;
52
+ else if (Array.isArray(documentation)) page = `\n${documentation.map((doc) => `\t- ${doc}`).join("\n")}`;
53
+ return `${message}${page != null ? `\n\nMore info: ${page}\n` : ""}`;
54
+ }
55
+ };
56
+ })))();
57
+ }
58
+ //#endregion
7
59
  //#region src/shared/universal-store/first-party-store-ids.ts
8
60
  var FIRST_PARTY_STORE_IDS, isFirstPartyStoreId;
9
61
  function init_first_party_store_ids() {
@@ -26,6 +78,13 @@ function init_instances() {
26
78
  }
27
79
  //#endregion
28
80
  //#region src/shared/universal-store/index.ts
81
+ /**
82
+ * Whether `event` has the type `type`. A custom event's `type` is any string, so a `switch` on
83
+ * `event.type` cannot narrow an event union to one payload, but this check can.
84
+ */
85
+ function hasType(event, type) {
86
+ return event.type === type;
87
+ }
29
88
  var CHANNEL_EVENT_PREFIX, ProgressState, UniversalStore;
30
89
  function init_universal_store() {
31
90
  return (init_universal_store = __esmMin((() => {
@@ -305,8 +364,8 @@ function init_universal_store() {
305
364
  */
306
365
  onStateChange(listener) {
307
366
  this.debug("onStateChange", { listener });
308
- return this.subscribe(UniversalStore.InternalEventType.SET_STATE, ({ payload }, eventInfo) => {
309
- listener(payload.state, payload.previousState, eventInfo);
367
+ return this.subscribe(UniversalStore.InternalEventType.SET_STATE, (event, eventInfo) => {
368
+ if (hasType(event, UniversalStore.InternalEventType.SET_STATE)) listener(event.payload.state, event.payload.previousState, eventInfo);
310
369
  });
311
370
  }
312
371
  emitToChannel(event, eventInfo) {
@@ -389,10 +448,9 @@ function init_universal_store() {
389
448
  });
390
449
  }
391
450
  }
392
- if (this.actor.type === UniversalStore.ActorType.FOLLOWER) switch (event.type) {
393
- case UniversalStore.InternalEventType.EXISTING_STATE_RESPONSE:
394
- this.debug("handleChannelEvents: Setting state from leader's existing state response", { event });
395
- if (this.syncing?.state !== ProgressState.PENDING) break;
451
+ if (this.actor.type === UniversalStore.ActorType.FOLLOWER && hasType(event, UniversalStore.InternalEventType.EXISTING_STATE_RESPONSE)) {
452
+ this.debug("handleChannelEvents: Setting state from leader's existing state response", { event });
453
+ if (this.syncing?.state === ProgressState.PENDING) {
396
454
  this.syncing.resolve?.();
397
455
  const setStateEvent = {
398
456
  type: UniversalStore.InternalEventType.SET_STATE,
@@ -403,11 +461,11 @@ function init_universal_store() {
403
461
  };
404
462
  this.state = event.payload;
405
463
  this.emitToListeners(setStateEvent, eventInfo);
464
+ }
406
465
  }
407
- switch (event.type) {
408
- case UniversalStore.InternalEventType.SET_STATE:
409
- this.debug("handleChannelEvents: Setting state", { event });
410
- this.state = event.payload.state;
466
+ if (hasType(event, UniversalStore.InternalEventType.SET_STATE)) {
467
+ this.debug("handleChannelEvents: Setting state", { event });
468
+ this.state = event.payload.state;
411
469
  }
412
470
  this.emitToListeners(event, { actor: eventInfo.actor });
413
471
  }
@@ -480,165 +538,8 @@ function formatIssues(issues) {
480
538
  return path === "" ? issue.message : `${path}: ${issue.message}`;
481
539
  }).join("\n");
482
540
  }
483
- //#endregion
484
- //#region src/server-errors.ts
485
- var OpenServiceValidationError, OpenServiceMissingServiceError, OpenServiceInternalServiceError, OpenServiceUnimplementedOperationError, OpenServiceInvalidStaticPathError, OpenServiceAsyncSchemaError, OpenServiceLoadedDrainExceededError, OpenServiceMissingChannelError, OpenServiceRemoteCommandDisconnectedError, OpenServiceRemoteCommandUnhandledError, OpenServiceRemoteCommandConfigDriftError, OpenServiceAsyncRecipeError, OpenServiceCyclicStateError, OpenServiceOperationNameCollisionError;
486
- function init_server_errors() {
487
- return (init_server_errors = __esmMin((() => {
488
- init_storybook_error();
489
- OpenServiceValidationError = class extends StorybookError {
490
- constructor(data) {
491
- super({
492
- name: "OpenServiceValidationError",
493
- category: "CORE-COMMON",
494
- code: 5,
495
- message: `Invalid ${data.phase} for ${data.kind} "${data.serviceId}.${data.name}":\n${formatIssues(data.issues)}`
496
- });
497
- this.data = data;
498
- }
499
- };
500
- OpenServiceMissingServiceError = class extends StorybookError {
501
- constructor(data) {
502
- super({
503
- name: "OpenServiceMissingServiceError",
504
- category: "CORE-COMMON",
505
- code: 7,
506
- message: `No registered service with id "${data.serviceId}" exists in this environment.`
507
- });
508
- this.data = data;
509
- }
510
- };
511
- OpenServiceInternalServiceError = class extends StorybookError {
512
- constructor(data) {
513
- super({
514
- name: "OpenServiceInternalServiceError",
515
- category: "CORE-COMMON",
516
- code: 19,
517
- message: `Service "${data.serviceId}" is internal. Pass { internal: true } to getService() only if you intentionally depend on an unstable OSA surface. Internal services may change without notice.`
518
- });
519
- this.data = data;
520
- }
521
- };
522
- OpenServiceUnimplementedOperationError = class extends StorybookError {
523
- constructor(data) {
524
- super({
525
- name: "OpenServiceUnimplementedOperationError",
526
- category: "CORE-COMMON",
527
- code: 8,
528
- message: `${data.kind[0].toUpperCase()}${data.kind.slice(1)} "${data.serviceId}.${data.name}" is not implemented for this environment.`
529
- });
530
- this.data = data;
531
- }
532
- };
533
- OpenServiceInvalidStaticPathError = class extends StorybookError {
534
- constructor(data) {
535
- super({
536
- name: "OpenServiceInvalidStaticPathError",
537
- category: "CORE-COMMON",
538
- code: 10,
539
- message: `Invalid static path "${data.path}" for query "${data.serviceId}.${data.name}": use a relative path with forward slashes and no ".." segments.`
540
- });
541
- this.data = data;
542
- }
543
- };
544
- OpenServiceAsyncSchemaError = class extends StorybookError {
545
- constructor(data) {
546
- super({
547
- name: "OpenServiceAsyncSchemaError",
548
- category: "CORE-COMMON",
549
- code: 9,
550
- message: `Async schema for ${data.kind} "${data.serviceId}.${data.name}" (${data.phase}): query input and output schemas must validate synchronously.`
551
- });
552
- this.data = data;
553
- }
554
- };
555
- OpenServiceLoadedDrainExceededError = class extends StorybookError {
556
- constructor(data) {
557
- super({
558
- name: "OpenServiceLoadedDrainExceededError",
559
- category: "CORE-COMMON",
560
- code: 11,
561
- message: `Query "${data.serviceId}.${data.name}".loaded(...) did not settle after ${data.iterations} drain iterations. Check for handlers that keep discovering new dependencies after every state change.`
562
- });
563
- this.data = data;
564
- }
565
- };
566
- OpenServiceMissingChannelError = class extends StorybookError {
567
- constructor(data = {}) {
568
- super({
569
- name: "OpenServiceMissingChannelError",
570
- category: "CORE-COMMON",
571
- code: 13,
572
- message: data.serviceId ? `Cannot register service "${data.serviceId}": the Forkbook addons channel is not installed in this runtime.` : "The Forkbook addons channel is not installed in this runtime."
573
- });
574
- this.data = data;
575
- }
576
- };
577
- OpenServiceRemoteCommandDisconnectedError = class extends StorybookError {
578
- constructor(data) {
579
- super({
580
- name: "OpenServiceRemoteCommandDisconnectedError",
581
- category: "CORE-COMMON",
582
- code: 14,
583
- message: `Service "${data.serviceId}" was unregistered before a remote command resolved.`
584
- });
585
- this.data = data;
586
- }
587
- };
588
- OpenServiceRemoteCommandUnhandledError = class extends StorybookError {
589
- constructor(data) {
590
- super({
591
- name: "OpenServiceRemoteCommandUnhandledError",
592
- category: "CORE-COMMON",
593
- code: 15,
594
- message: data.delegated ? `The Forkbook this runtime is attached to did not acknowledge remote command "${data.serviceId}.${data.commandName}" in time — it may be busy or unreachable. Retry; note the command may still have executed on that instance.` : `No runtime acknowledged remote command "${data.serviceId}.${data.commandName}"; its handler is not implemented in any connected runtime.`
595
- });
596
- this.data = data;
597
- }
598
- };
599
- OpenServiceRemoteCommandConfigDriftError = class extends StorybookError {
600
- constructor(data) {
601
- super({
602
- name: "OpenServiceRemoteCommandConfigDriftError",
603
- category: "CORE-COMMON",
604
- code: 30,
605
- message: `The Forkbook this runtime is attached to reported it has no handler for remote command "${data.serviceId}.${data.commandName}". The two processes are running different configurations (for example a feature flag enabled in one but not the other). Restart the attached Forkbook with a configuration matching this process.`
606
- });
607
- this.data = data;
608
- }
609
- };
610
- OpenServiceAsyncRecipeError = class extends StorybookError {
611
- constructor() {
612
- super({
613
- name: "OpenServiceAsyncRecipeError",
614
- category: "CORE-COMMON",
615
- code: 31,
616
- message: "setState recipes must be synchronous. A write after an await would change state without authoring a sync entry. Split the command into one setState per synchronous step."
617
- });
618
- }
619
- };
620
- OpenServiceCyclicStateError = class extends StorybookError {
621
- constructor() {
622
- super({
623
- name: "OpenServiceCyclicStateError",
624
- category: "CORE-COMMON",
625
- code: 32,
626
- message: "Service state must be JSON-serializable, but the value is cyclic or nested more than 256 levels deep. Store an id and look the value up in a query instead of a reference."
627
- });
628
- }
629
- };
630
- OpenServiceOperationNameCollisionError = class extends StorybookError {
631
- constructor(data) {
632
- super({
633
- name: "OpenServiceOperationNameCollisionError",
634
- category: "CORE-COMMON",
635
- code: 16,
636
- message: `Service "${data.serviceId}" cannot register "${data.operationName}" as both a query and a command.`
637
- });
638
- this.data = data;
639
- }
640
- };
641
- })))();
541
+ function init_errors() {
542
+ return (init_errors = __esmMin((() => {})))();
642
543
  }
643
544
  //#endregion
644
545
  //#region src/shared/status-store/index.ts
@@ -685,6 +586,296 @@ function init_tags() {
685
586
  })))();
686
587
  }
687
588
  //#endregion
589
+ //#region src/test/expect.ts
590
+ function createExpect() {
591
+ use(JestExtend);
592
+ use(JestChaiExpect);
593
+ use(JestAsymmetricMatchers);
594
+ const expect = ((value, message) => {
595
+ const { assertionCalls } = getState(expect);
596
+ setState({
597
+ assertionCalls: assertionCalls + 1,
598
+ soft: false
599
+ }, expect);
600
+ return expect$2(value, message);
601
+ });
602
+ Object.assign(expect, expect$2);
603
+ expect.getState = () => getState(expect);
604
+ expect.setState = (state) => setState(state, expect);
605
+ const chaiExpect = expect$2;
606
+ expect.extend = (expects) => chaiExpect.extend(expect, expects);
607
+ Object.assign(expect, { soft: (value, message) => {
608
+ const assert = expect(value, message);
609
+ expect.setState({ soft: true });
610
+ return assert;
611
+ } });
612
+ expect.extend(customMatchers);
613
+ Object.assign(expect, { unreachable: (message) => {
614
+ assert.fail(`expected${message ? ` "${message}" ` : " "}not to be reached`);
615
+ } });
616
+ function assertions(expected) {
617
+ const errorGen = () => /* @__PURE__ */ new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
618
+ if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") Error.captureStackTrace(errorGen(), assertions);
619
+ expect.setState({
620
+ expectedAssertionsNumber: expected,
621
+ expectedAssertionsNumberErrorGen: errorGen
622
+ });
623
+ }
624
+ function hasAssertions() {
625
+ const error = /* @__PURE__ */ new Error("expected any number of assertion, but got none");
626
+ if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") Error.captureStackTrace(error, hasAssertions);
627
+ expect.setState({
628
+ isExpectingAssertions: true,
629
+ isExpectingAssertionsError: error
630
+ });
631
+ }
632
+ setState({
633
+ assertionCalls: 0,
634
+ isExpectingAssertions: false,
635
+ isExpectingAssertionsError: null,
636
+ expectedAssertionsNumber: null,
637
+ expectedAssertionsNumberErrorGen: null
638
+ }, expect);
639
+ utils_exports.addMethod(expect, "assertions", assertions);
640
+ utils_exports.addMethod(expect, "hasAssertions", hasAssertions);
641
+ expect.extend(matchers_exports);
642
+ return expect;
643
+ }
644
+ var expect$1;
645
+ function init_expect() {
646
+ return (init_expect = __esmMin((() => {
647
+ init_matchers();
648
+ init_dist$2();
649
+ init_chai();
650
+ expect$1 = createExpect();
651
+ // @vitest/expect expects this to be set
652
+ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
653
+ value: expect$1,
654
+ writable: true,
655
+ configurable: true
656
+ });
657
+ })))();
658
+ }
659
+ //#endregion
660
+ //#region src/test/spy.ts
661
+ function onMockCall(callback) {
662
+ listeners.add(callback);
663
+ return () => void listeners.delete(callback);
664
+ }
665
+ function fn(implementation) {
666
+ return reactiveMock(implementation ? fn$1(implementation) : fn$1());
667
+ }
668
+ function reactiveMock(mock) {
669
+ const reactive = listenWhenCalled(mock);
670
+ const originalMockImplementation = reactive.mockImplementation.bind(null);
671
+ reactive.mockImplementation = (fn) => listenWhenCalled(originalMockImplementation(fn));
672
+ return reactive;
673
+ }
674
+ function listenWhenCalled(mock) {
675
+ const state = T(mock);
676
+ const impl = state.impl;
677
+ state.willCall(function(...args) {
678
+ listeners.forEach((listener) => listener(mock, args));
679
+ return impl?.apply(this, args);
680
+ });
681
+ return mock;
682
+ }
683
+ /**
684
+ * Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will
685
+ * only empty `.mock` state, it will not reset implementation.
686
+ *
687
+ * It is useful if you need to clean up mock between different assertions.
688
+ */
689
+ function clearAllMocks() {
690
+ mocks.forEach((spy) => spy.mockClear());
691
+ moduleMockSpies.forEach((spy) => spy.mockClear());
692
+ }
693
+ /**
694
+ * Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will
695
+ * empty `.mock` state, reset "once" implementations and force the base implementation to return
696
+ * `undefined` when invoked.
697
+ *
698
+ * This is useful when you want to completely reset a mock to the default state.
699
+ */
700
+ function resetAllMocks() {
701
+ mocks.forEach((spy) => spy.mockReset());
702
+ moduleMockSpies.forEach((spy) => spy.mockReset());
703
+ }
704
+ /**
705
+ * Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This
706
+ * will restore all original implementations.
707
+ */
708
+ function restoreAllMocks() {
709
+ mocks.forEach((spy) => spy.mockRestore());
710
+ moduleMockSpies.forEach((spy) => spy.mockClear());
711
+ }
712
+ function mocked(item, _options = {}) {
713
+ return item;
714
+ }
715
+ var moduleMockSpies, listeners, spyOn;
716
+ function init_spy() {
717
+ return (init_spy = __esmMin((() => {
718
+ init_dist$3();
719
+ init_dist();
720
+ moduleMockSpies = globalThis.__FORKBOOK_MODULE_MOCK_SPIES__ ??= /* @__PURE__ */ new Set();
721
+ listeners = /* @__PURE__ */ new Set();
722
+ spyOn = ((...args) => {
723
+ return reactiveMock(spyOn$1(...args));
724
+ });
725
+ })))();
726
+ }
727
+ //#endregion
728
+ //#region src/test/testing-library.ts
729
+ var testingLibrary, buildQueries$1, configure, createEvent, fireEvent, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, prettyDOM, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, waitFor, waitForElementToBeRemoved, within, prettyFormat, uninstrumentedUserEvent, userEvent;
730
+ function init_testing_library() {
731
+ return (init_testing_library = __esmMin((() => {
732
+ init_dom_esm();
733
+ init_esm$1();
734
+ init_client_logger();
735
+ init_instrumenter();
736
+ init_esm();
737
+ testingLibrary = instrument({ ...dom_esm_exports }, {
738
+ getKeys: (obj) => Object.keys(obj).filter((key) => key !== "eventWrapper"),
739
+ intercept: (method, path) => path[0] === "fireEvent" || method.startsWith("find") || method.startsWith("waitFor")
740
+ });
741
+ testingLibrary.screen = new Proxy(testingLibrary.screen, { get(target, prop, receiver) {
742
+ if (typeof window !== "undefined" && globalThis.location?.href?.includes("viewMode=docs")) once.warn(dedent`
743
+ You are using Testing Library's \`screen\` object while the story is rendered in docs mode. This will likely lead to issues, as multiple stories are rendered in the same page and therefore screen will potentially find multiple elements. Use the \`canvas\` utility from the story context instead, which will scope the queries to each story's canvas.
744
+
745
+ More info: https://forkbook.ljk.dev/docs/writing-tests/interaction-testing#querying-the-canvas
746
+ `);
747
+ return Reflect.get(target, prop, receiver);
748
+ } });
749
+ ({buildQueries: buildQueries$1, configure, createEvent, fireEvent, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, prettyDOM, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, waitFor, waitForElementToBeRemoved, within, prettyFormat} = testingLibrary);
750
+ uninstrumentedUserEvent = userEvent$1;
751
+ ({userEvent} = instrument({ userEvent: userEvent$1 }, {
752
+ intercept: true,
753
+ getKeys: (obj) => Object.keys(obj).filter((key) => key !== "eventWrapper")
754
+ }));
755
+ })))();
756
+ }
757
+ //#endregion
758
+ //#region src/test/index.ts
759
+ var test_exports = /* @__PURE__ */ __exportAll({
760
+ buildQueries: () => buildQueries$1,
761
+ clearAllMocks: () => clearAllMocks,
762
+ configure: () => configure,
763
+ createEvent: () => createEvent,
764
+ expect: () => expect,
765
+ findAllByAltText: () => findAllByAltText,
766
+ findAllByDisplayValue: () => findAllByDisplayValue,
767
+ findAllByLabelText: () => findAllByLabelText,
768
+ findAllByPlaceholderText: () => findAllByPlaceholderText,
769
+ findAllByRole: () => findAllByRole,
770
+ findAllByTestId: () => findAllByTestId,
771
+ findAllByText: () => findAllByText,
772
+ findAllByTitle: () => findAllByTitle,
773
+ findByAltText: () => findByAltText,
774
+ findByDisplayValue: () => findByDisplayValue,
775
+ findByLabelText: () => findByLabelText,
776
+ findByPlaceholderText: () => findByPlaceholderText,
777
+ findByRole: () => findByRole,
778
+ findByTestId: () => findByTestId,
779
+ findByText: () => findByText,
780
+ findByTitle: () => findByTitle,
781
+ fireEvent: () => fireEvent,
782
+ fn: () => fn,
783
+ getAllByAltText: () => getAllByAltText,
784
+ getAllByDisplayValue: () => getAllByDisplayValue,
785
+ getAllByLabelText: () => getAllByLabelText,
786
+ getAllByPlaceholderText: () => getAllByPlaceholderText,
787
+ getAllByRole: () => getAllByRole,
788
+ getAllByTestId: () => getAllByTestId,
789
+ getAllByText: () => getAllByText,
790
+ getAllByTitle: () => getAllByTitle,
791
+ getByAltText: () => getByAltText,
792
+ getByDisplayValue: () => getByDisplayValue,
793
+ getByLabelText: () => getByLabelText,
794
+ getByPlaceholderText: () => getByPlaceholderText,
795
+ getByRole: () => getByRole,
796
+ getByTestId: () => getByTestId,
797
+ getByText: () => getByText,
798
+ getByTitle: () => getByTitle,
799
+ getConfig: () => getConfig,
800
+ getDefaultNormalizer: () => getDefaultNormalizer,
801
+ getElementError: () => getElementError,
802
+ getNodeText: () => getNodeText,
803
+ getQueriesForElement: () => getQueriesForElement,
804
+ getRoles: () => getRoles,
805
+ getSuggestedQuery: () => getSuggestedQuery,
806
+ isInaccessible: () => isInaccessible,
807
+ isMockFunction: () => isMockFunction,
808
+ logDOM: () => logDOM,
809
+ logRoles: () => logRoles,
810
+ mocked: () => mocked,
811
+ mocks: () => mocks,
812
+ onMockCall: () => onMockCall,
813
+ prettyDOM: () => prettyDOM,
814
+ prettyFormat: () => prettyFormat,
815
+ queries: () => queries,
816
+ queryAllByAltText: () => queryAllByAltText,
817
+ queryAllByAttribute: () => queryAllByAttribute,
818
+ queryAllByDisplayValue: () => queryAllByDisplayValue,
819
+ queryAllByLabelText: () => queryAllByLabelText,
820
+ queryAllByPlaceholderText: () => queryAllByPlaceholderText,
821
+ queryAllByRole: () => queryAllByRole,
822
+ queryAllByTestId: () => queryAllByTestId,
823
+ queryAllByText: () => queryAllByText,
824
+ queryAllByTitle: () => queryAllByTitle,
825
+ queryByAltText: () => queryByAltText,
826
+ queryByAttribute: () => queryByAttribute,
827
+ queryByDisplayValue: () => queryByDisplayValue,
828
+ queryByLabelText: () => queryByLabelText,
829
+ queryByPlaceholderText: () => queryByPlaceholderText,
830
+ queryByRole: () => queryByRole,
831
+ queryByTestId: () => queryByTestId,
832
+ queryByText: () => queryByText,
833
+ queryByTitle: () => queryByTitle,
834
+ queryHelpers: () => queryHelpers,
835
+ resetAllMocks: () => resetAllMocks,
836
+ restoreAllMocks: () => restoreAllMocks,
837
+ sb: () => sb,
838
+ screen: () => screen,
839
+ spyOn: () => spyOn,
840
+ uninstrumentedUserEvent: () => uninstrumentedUserEvent,
841
+ userEvent: () => userEvent,
842
+ waitFor: () => waitFor,
843
+ waitForElementToBeRemoved: () => waitForElementToBeRemoved,
844
+ within: () => within
845
+ });
846
+ function getChaiAssertionKeys(obj, depth) {
847
+ return [...Object.keys(Object.getPrototypeOf(obj)).filter((key) => !chaiAssertionPrivateApi.includes(key)), ...["not"].slice(depth / 3)];
848
+ }
849
+ function getObjectKeys(obj) {
850
+ return Object.keys(obj).filter((key) => key !== "any");
851
+ }
852
+ function getKeys(obj, depth) {
853
+ if ("constructor" in obj && obj.constructor === Assertion) return getChaiAssertionKeys(obj, depth);
854
+ return getObjectKeys(obj);
855
+ }
856
+ var chaiAssertionPrivateApi, expect, sb;
857
+ function init_test() {
858
+ return (init_test = __esmMin((() => {
859
+ init_instrumenter();
860
+ init_chai();
861
+ init_expect();
862
+ init_spy();
863
+ init_testing_library();
864
+ chaiAssertionPrivateApi = [
865
+ "assert",
866
+ "__methods",
867
+ "__flags",
868
+ "_obj"
869
+ ];
870
+ ({expect} = instrument({ expect: expect$1 }, {
871
+ getKeys,
872
+ mutate: true,
873
+ intercept: (method) => method !== "expect"
874
+ }));
875
+ sb = { mock: () => {} };
876
+ })))();
877
+ }
878
+ //#endregion
688
879
  //#region src/shared/open-service/plain-object.ts
689
880
  function isReservedKey(key) {
690
881
  return FORBIDDEN_KEYS.has(key) || key.startsWith("$");
@@ -728,7 +919,7 @@ function clonePlain(value, depth = 0) {
728
919
  var FORBIDDEN_KEYS, MAX_DEPTH;
729
920
  function init_plain_object() {
730
921
  return (init_plain_object = __esmMin((() => {
731
- init_server_errors();
922
+ init_open_service();
732
923
  FORBIDDEN_KEYS = /* @__PURE__ */ new Set([
733
924
  "__proto__",
734
925
  "constructor",
@@ -778,7 +969,7 @@ var SERVICE_SYNC_REQUEST, SERVICE_SYNC_REPLY, SERVICE_ENTRY, SERVICE_COMMAND_INV
778
969
  function init_service_channel() {
779
970
  return (init_service_channel = __esmMin((() => {
780
971
  init_index_browser();
781
- init_dist();
972
+ init_dist$1();
782
973
  init_plain_object();
783
974
  SERVICE_SYNC_REQUEST = "services:sync-request";
784
975
  SERVICE_SYNC_REPLY = "services:sync-reply";
@@ -1109,49 +1300,13 @@ function init_patch_recorder() {
1109
1300
  return (init_patch_recorder = __esmMin((() => {
1110
1301
  init_signals_core_module();
1111
1302
  init_deepsignal_core_module();
1112
- init_server_errors();
1303
+ init_open_service();
1113
1304
  init_plain_object();
1114
1305
  init_service_channel();
1115
1306
  activeDrafts = /* @__PURE__ */ new WeakMap();
1116
1307
  })))();
1117
1308
  }
1118
1309
  //#endregion
1119
- //#region src/shared/open-service/query-state.ts
1120
- /**
1121
- * Expands a `(data, lifecycle)` pair into the full {@link QueryState} surfaced to subscribers.
1122
- *
1123
- * The single source of truth for the derived booleans, shared by the runtime's subscription
1124
- * emissions and `useServiceQuery`'s first-render seed so they can never drift apart. The booleans
1125
- * intentionally follow our `load` vocabulary: `isLoading` is "any load in flight" (TanStack's
1126
- * `isFetching`) and `isInitialLoading` is "the first load with nothing to show yet".
1127
- *
1128
- * Unlike TanStack Query, a subscription here can attach to a query whose `data` is already cached in
1129
- * service state (e.g. revisiting an already-extracted component): its per-subscription lifecycle
1130
- * still starts `pending`/`loading`, but `data` is present from the first emission. `isInitialLoading`
1131
- * therefore also requires `data === undefined`, so consumers gate a "nothing yet" skeleton on it
1132
- * without flashing it over already-available data while a background (re)load runs.
1133
- */
1134
- function buildQueryState(data, lifecycle) {
1135
- const isPending = lifecycle.status === "pending";
1136
- const isLoading = lifecycle.loadStatus === "loading";
1137
- return {
1138
- data,
1139
- error: lifecycle.error,
1140
- status: lifecycle.status,
1141
- loadStatus: lifecycle.loadStatus,
1142
- isPending,
1143
- isSuccess: lifecycle.status === "success",
1144
- isError: lifecycle.status === "error",
1145
- isLoading,
1146
- isInitialLoading: isPending && isLoading && data === void 0,
1147
- isRefreshing: isLoading && !isPending
1148
- };
1149
- }
1150
- /** Coerces an unknown thrown value into an `Error` for the `error` field of a {@link QueryState}. */
1151
- function toError(value) {
1152
- return value instanceof Error ? value : new Error(String(value));
1153
- }
1154
- //#endregion
1155
1310
  //#region src/shared/open-service/service-validation.ts
1156
1311
  /**
1157
1312
  * Re-throws asynchronous subscription failures on the microtask queue so they are not silently
@@ -1199,11 +1354,11 @@ function validateSchemaSync(schema, value, meta) {
1199
1354
  }
1200
1355
  function init_service_validation() {
1201
1356
  return (init_service_validation = __esmMin((() => {
1202
- init_server_errors();
1357
+ init_open_service();
1203
1358
  })))();
1204
1359
  }
1205
1360
  //#endregion
1206
- //#region src/shared/open-service/query-runtime.ts
1361
+ //#region src/shared/open-service/query-load-registry.ts
1207
1362
  /**
1208
1363
  * Returns a deterministic JSON encoding so the same logical input always produces the same key.
1209
1364
  *
@@ -1267,10 +1422,10 @@ function surfaceRejections(settlements) {
1267
1422
  async function drainCollector(collector, settledKeys, serviceId, queryName) {
1268
1423
  let iterations = 0;
1269
1424
  while (collector.size > 0) {
1270
- if (iterations++ > MAX_DRAIN_ITERATIONS) throw new OpenServiceLoadedDrainExceededError({
1425
+ if (iterations++ > 32) throw new OpenServiceLoadedDrainExceededError({
1271
1426
  serviceId,
1272
1427
  name: queryName,
1273
- iterations: MAX_DRAIN_ITERATIONS
1428
+ iterations: 32
1274
1429
  });
1275
1430
  const pending = [...collector];
1276
1431
  collector.clear();
@@ -1295,6 +1450,18 @@ function detachSnapshot(value) {
1295
1450
  if (value === null || typeof value !== "object") return value;
1296
1451
  return JSON.parse(JSON.stringify(value));
1297
1452
  }
1453
+ var inFlightLoads, nextLoadScopeSequence, nextLoadScopeId, EMPTY_SET;
1454
+ function init_query_load_registry() {
1455
+ return (init_query_load_registry = __esmMin((() => {
1456
+ init_open_service();
1457
+ inFlightLoads = /* @__PURE__ */ new Map();
1458
+ nextLoadScopeSequence = 0;
1459
+ nextLoadScopeId = () => String(nextLoadScopeSequence += 1);
1460
+ EMPTY_SET = /* @__PURE__ */ new Set();
1461
+ })))();
1462
+ }
1463
+ //#endregion
1464
+ //#region src/shared/open-service/query-handler.ts
1298
1465
  /**
1299
1466
  * Validates query input synchronously, falling through to the dedicated async-schema error if a
1300
1467
  * schema returns a Promise.
@@ -1314,52 +1481,253 @@ function validateQueryOutput(refs, queryName, queryDef, output) {
1314
1481
  name: queryName,
1315
1482
  phase: "output"
1316
1483
  });
1317
- }
1318
- /**
1319
- * Runs the query handler synchronously and returns its raw result (no output validation).
1320
- *
1321
- * The `selfQueries` parameter lets the caller swap in load-aware wrappers when running inside a
1322
- * load body or a `.loaded()` discovery pass; ordinary handler calls pass the default queries.
1323
- */
1324
- function runHandlerSync(refs, queryName, queryDef, validatedInput, selfQueries, getService) {
1325
- if (!queryDef.handler) throw new OpenServiceUnimplementedOperationError({
1326
- kind: "query",
1327
- serviceId: refs.serviceId,
1328
- name: queryName
1484
+ }
1485
+ /**
1486
+ * Runs the query handler synchronously and returns its raw result (no output validation).
1487
+ *
1488
+ * The `selfQueries` parameter lets the caller swap in load-aware wrappers when running inside a
1489
+ * load body or a `.loaded()` discovery pass; ordinary handler calls pass the default queries.
1490
+ */
1491
+ function runHandlerSync(refs, queryName, queryDef, validatedInput, selfQueries, getService) {
1492
+ if (!queryDef.handler) throw new OpenServiceUnimplementedOperationError({
1493
+ kind: "query",
1494
+ serviceId: refs.serviceId,
1495
+ name: queryName
1496
+ });
1497
+ const handlerCtx = {
1498
+ self: {
1499
+ get state() {
1500
+ return refs.state;
1501
+ },
1502
+ queries: selfQueries
1503
+ },
1504
+ getService
1505
+ };
1506
+ return queryDef.handler(validatedInput, handlerCtx);
1507
+ }
1508
+ /**
1509
+ * Builds the shared synchronous `get(input)` for a query: validate input → fire the load per the
1510
+ * caller's policy → run the handler against `selfQueries` → validate output.
1511
+ *
1512
+ * The three query surfaces — the default consumer query ({@link createDefaultQuery}), the reactive
1513
+ * subscription-load wrappers ({@link buildReactiveLoadQueries}), and the awaited load-body wrappers
1514
+ * ({@link buildLoadWrappedQueries}) — differ only in (a) which `self.queries` map the handler sees
1515
+ * and (b) how a load-backed read fires its `load`. Everything else (the validate → run → validate
1516
+ * skeleton, the zero-arg input resolution) is identical, so each surface passes its own `selfQueries`
1517
+ * map and `fireLoad` policy and shares this body.
1518
+ *
1519
+ * `fireLoad` is invoked only for queries that declare a `load`; queries without one skip it. Pass
1520
+ * `selfQueries` by reference even when it is the same map being populated by the caller — `get`
1521
+ * closes over the reference, which is fully built by the time any handler runs.
1522
+ */
1523
+ function createQueryGet(refs, queryName, queryDef, selfQueries, fireLoad) {
1524
+ return function get(input) {
1525
+ const validatedInput = validateQueryInput(refs, queryName, queryDef, arguments.length === 0 ? void 0 : input);
1526
+ if (queryDef.load) fireLoad?.(validatedInput);
1527
+ return validateQueryOutput(refs, queryName, queryDef, runHandlerSync(refs, queryName, queryDef, validatedInput, selfQueries, refs.registryApi.getService));
1528
+ };
1529
+ }
1530
+ function init_query_handler() {
1531
+ return (init_query_handler = __esmMin((() => {
1532
+ init_open_service();
1533
+ init_service_validation();
1534
+ })))();
1535
+ }
1536
+ //#endregion
1537
+ //#region src/shared/open-service/query-state.ts
1538
+ /**
1539
+ * Expands a `(data, lifecycle)` pair into the full {@link QueryState} surfaced to subscribers.
1540
+ *
1541
+ * The single source of truth for the derived booleans, shared by the runtime's subscription
1542
+ * emissions and `useServiceQuery`'s first-render seed so they can never drift apart. The booleans
1543
+ * intentionally follow our `load` vocabulary: `isLoading` is "any load in flight" (TanStack's
1544
+ * `isFetching`) and `isInitialLoading` is "the first load with nothing to show yet".
1545
+ *
1546
+ * Unlike TanStack Query, a subscription here can attach to a query whose `data` is already cached in
1547
+ * service state (e.g. revisiting an already-extracted component): its per-subscription lifecycle
1548
+ * still starts `pending`/`loading`, but `data` is present from the first emission. `isInitialLoading`
1549
+ * therefore also requires `data === undefined`, so consumers gate a "nothing yet" skeleton on it
1550
+ * without flashing it over already-available data while a background (re)load runs.
1551
+ */
1552
+ function buildQueryState(data, lifecycle) {
1553
+ const isPending = lifecycle.status === "pending";
1554
+ const isLoading = lifecycle.loadStatus === "loading";
1555
+ return {
1556
+ data,
1557
+ error: lifecycle.error,
1558
+ status: lifecycle.status,
1559
+ loadStatus: lifecycle.loadStatus,
1560
+ isPending,
1561
+ isSuccess: lifecycle.status === "success",
1562
+ isError: lifecycle.status === "error",
1563
+ isLoading,
1564
+ isInitialLoading: isPending && isLoading && data === void 0,
1565
+ isRefreshing: isLoading && !isPending
1566
+ };
1567
+ }
1568
+ /** Coerces an unknown thrown value into an `Error` for the `error` field of a {@link QueryState}. */
1569
+ function toError(value) {
1570
+ return value instanceof Error ? value : new Error(String(value));
1571
+ }
1572
+ //#endregion
1573
+ //#region src/shared/open-service/query-subscribe.ts
1574
+ /**
1575
+ * Runs a query's `load` as the body of a subscription's reactive effect.
1576
+ *
1577
+ * Unlike {@link runLoadBody}, this is invoked synchronously inside an `effect()`, so the external
1578
+ * signals the load reads in its synchronous prefix are tracked — when they later change, the effect
1579
+ * re-runs and the load re-fires, turning it into a reactive async resource. Loads are therefore an
1580
+ * idempotent warming step (the documented guideline, now a hard contract); one-shot side effects
1581
+ * belong in a command.
1582
+ *
1583
+ * Writes go through gated commands: if `isCurrent()` flips to false because a newer run started
1584
+ * (deps changed again), this run's later writes are dropped, so a slow stale load cannot clobber the
1585
+ * newer result. Sibling reads use the default queries — their loads fire-and-forget — so transitive
1586
+ * dependencies stay warm without the `.loaded()` drain, which is only meaningful for awaited pulls.
1587
+ */
1588
+ async function runReactiveLoad(refs, queryName, queryDef, validatedInput, isCurrent) {
1589
+ if (!queryDef.load) return;
1590
+ const loadCtx = {
1591
+ self: {
1592
+ get state() {
1593
+ return refs.state;
1594
+ },
1595
+ queries: refs.reactiveLoadQueries,
1596
+ commands: refs.buildGatedCommands(isCurrent)
1597
+ },
1598
+ getService: refs.registryApi.getService
1599
+ };
1600
+ await Promise.resolve(queryDef.load(validatedInput, loadCtx));
1601
+ }
1602
+ /**
1603
+ * Subscribes to a query by running its handler inside a deep-signal-aware `computed()` and
1604
+ * notifying through an `effect()`. The callback receives a {@link QueryState} combining the current
1605
+ * `data` (the synchronous handler result, or the selected slice) with the per-subscription `load`
1606
+ * lifecycle (`status` / `loadStatus` / `error`).
1607
+ *
1608
+ * The first emission is **synchronous**: `subscribe()` invokes the callback once with the current
1609
+ * {@link QueryState} before it returns the unsubscribe handle. The runtime kicks `load` off in the
1610
+ * background but does not wait for it — subscribers see the current state immediately (a load-backed
1611
+ * query already reads `loading`, since the reactive-load effect runs synchronously here) and
1612
+ * follow-up emissions as the load settles (or re-fires) and tracked state changes.
1613
+ *
1614
+ * Three layers keep emissions precise:
1615
+ *
1616
+ * 1. **Fine-grained reads** — the handler (and the optional `selector`) read through the deep-signal
1617
+ * proxy, so the computed only re-runs when the exact fields it touched change. A write to an
1618
+ * unrelated key or field never re-runs the handler.
1619
+ * 2. **Lifecycle signal** — a separate per-subscription signal carries `status`/`loadStatus`/`error`,
1620
+ * updated by the reactive-load effect. The emit effect reads both it and the data computed, so a
1621
+ * status change (e.g. a background re-load) fires the callback even when the selected slice is
1622
+ * unchanged.
1623
+ * 3. **Object dedup** — the whole emitted `QueryState` is compared with the previously emitted one via
1624
+ * `isEqual`; a re-run that produces a deeply-equal state (e.g. a load rewriting an equal payload
1625
+ * with no status change) does not fire the callback.
1626
+ *
1627
+ * Error sources all surface as `status: 'error'` (keeping the last successful `data`): input
1628
+ * validation failure, a synchronous handler / output-validation throw, and a `load` rejection.
1629
+ */
1630
+ function subscribeToQuery(refs, queryName, queryDef, rawInput, selector, callback) {
1631
+ let active = true;
1632
+ let validatedInput;
1633
+ try {
1634
+ validatedInput = validateQueryInput(refs, queryName, queryDef, rawInput);
1635
+ } catch (error) {
1636
+ callback(buildQueryState(void 0, {
1637
+ status: "error",
1638
+ error: toError(error),
1639
+ loadStatus: "idle"
1640
+ }));
1641
+ return () => {
1642
+ active = false;
1643
+ };
1644
+ }
1645
+ const lifecycle = y({
1646
+ status: queryDef.load ? "pending" : "success",
1647
+ error: void 0,
1648
+ loadStatus: "idle"
1649
+ });
1650
+ let loadTeardown;
1651
+ if (queryDef.load) {
1652
+ let epoch = 0;
1653
+ loadTeardown = j(() => {
1654
+ const myEpoch = ++epoch;
1655
+ const isCurrent = () => myEpoch === epoch;
1656
+ const previous = f(() => lifecycle.value);
1657
+ lifecycle.value = {
1658
+ status: previous.status,
1659
+ error: previous.error,
1660
+ loadStatus: "loading"
1661
+ };
1662
+ runReactiveLoad(refs, queryName, queryDef, validatedInput, isCurrent).then(() => {
1663
+ if (!isCurrent()) return;
1664
+ lifecycle.value = {
1665
+ status: "success",
1666
+ error: void 0,
1667
+ loadStatus: "idle"
1668
+ };
1669
+ }, (error) => {
1670
+ if (!isCurrent()) return;
1671
+ lifecycle.value = {
1672
+ status: "error",
1673
+ error: toError(error),
1674
+ loadStatus: "idle"
1675
+ };
1676
+ });
1677
+ });
1678
+ }
1679
+ const comp = g$1(() => {
1680
+ const output = runHandlerSync(refs, queryName, queryDef, validatedInput, refs.defaultQueries, refs.registryApi.getService);
1681
+ if (selector) {
1682
+ const validated = f(() => validateQueryOutput(refs, queryName, queryDef, output));
1683
+ selector(output);
1684
+ return detachSnapshot(selector(validated));
1685
+ }
1686
+ return detachSnapshot(validateQueryOutput(refs, queryName, queryDef, output));
1687
+ });
1688
+ let hasEmitted = false;
1689
+ let lastEmitted;
1690
+ let lastData;
1691
+ const teardown = j(() => {
1692
+ const life = lifecycle.value;
1693
+ let data;
1694
+ let status = life.status;
1695
+ let error = life.error;
1696
+ try {
1697
+ data = comp.value;
1698
+ lastData = data;
1699
+ } catch (handlerError) {
1700
+ data = lastData;
1701
+ status = "error";
1702
+ error = toError(handlerError);
1703
+ }
1704
+ if (!active) return;
1705
+ const state = buildQueryState(data, {
1706
+ status,
1707
+ error,
1708
+ loadStatus: life.loadStatus
1709
+ });
1710
+ if (hasEmitted && isEqual(state, lastEmitted)) return;
1711
+ hasEmitted = true;
1712
+ lastEmitted = state;
1713
+ callback(state);
1329
1714
  });
1330
- const handlerCtx = {
1331
- self: {
1332
- get state() {
1333
- return refs.state;
1334
- },
1335
- queries: selfQueries
1336
- },
1337
- getService
1715
+ return () => {
1716
+ active = false;
1717
+ teardown();
1718
+ loadTeardown?.();
1338
1719
  };
1339
- return queryDef.handler(validatedInput, handlerCtx);
1340
1720
  }
1341
- /**
1342
- * Builds the shared synchronous `get(input)` for a query: validate input → fire the load per the
1343
- * caller's policy → run the handler against `selfQueries` → validate output.
1344
- *
1345
- * The three query surfaces — the default consumer query ({@link createDefaultQuery}), the reactive
1346
- * subscription-load wrappers ({@link buildReactiveLoadQueries}), and the awaited load-body wrappers
1347
- * ({@link buildLoadWrappedQueries}) — differ only in (a) which `self.queries` map the handler sees
1348
- * and (b) how a load-backed read fires its `load`. Everything else (the validate → run → validate
1349
- * skeleton, the zero-arg input resolution) is identical, so each surface passes its own `selfQueries`
1350
- * map and `fireLoad` policy and shares this body.
1351
- *
1352
- * `fireLoad` is invoked only for queries that declare a `load`; queries without one skip it. Pass
1353
- * `selfQueries` by reference even when it is the same map being populated by the caller — `get`
1354
- * closes over the reference, which is fully built by the time any handler runs.
1355
- */
1356
- function createQueryGet(refs, queryName, queryDef, selfQueries, fireLoad) {
1357
- return function get(input) {
1358
- const validatedInput = validateQueryInput(refs, queryName, queryDef, arguments.length === 0 ? void 0 : input);
1359
- if (queryDef.load) fireLoad?.(validatedInput);
1360
- return validateQueryOutput(refs, queryName, queryDef, runHandlerSync(refs, queryName, queryDef, validatedInput, selfQueries, refs.registryApi.getService));
1361
- };
1721
+ function init_query_subscribe() {
1722
+ return (init_query_subscribe = __esmMin((() => {
1723
+ init_signals_core_module();
1724
+ init_isEqual();
1725
+ init_query_load_registry();
1726
+ init_query_handler();
1727
+ })))();
1362
1728
  }
1729
+ //#endregion
1730
+ //#region src/shared/open-service/query-runtime.ts
1363
1731
  /**
1364
1732
  * Triggers a `load` if one is not already in flight for the same key, or returns the existing
1365
1733
  * promise so concurrent callers share the work.
@@ -1438,34 +1806,6 @@ async function runLoadBody(refs, queryName, queryDef, validatedInput, ancestorCh
1438
1806
  await drainCollector(collector, void 0, refs.serviceId, queryName);
1439
1807
  }
1440
1808
  /**
1441
- * Runs a query's `load` as the body of a subscription's reactive effect.
1442
- *
1443
- * Unlike {@link runLoadBody}, this is invoked synchronously inside an `effect()`, so the external
1444
- * signals the load reads in its synchronous prefix are tracked — when they later change, the effect
1445
- * re-runs and the load re-fires, turning it into a reactive async resource. Loads are therefore an
1446
- * idempotent warming step (the documented guideline, now a hard contract); one-shot side effects
1447
- * belong in a command.
1448
- *
1449
- * Writes go through gated commands: if `isCurrent()` flips to false because a newer run started
1450
- * (deps changed again), this run's later writes are dropped, so a slow stale load cannot clobber the
1451
- * newer result. Sibling reads use the default queries — their loads fire-and-forget — so transitive
1452
- * dependencies stay warm without the `.loaded()` drain, which is only meaningful for awaited pulls.
1453
- */
1454
- async function runReactiveLoad(refs, queryName, queryDef, validatedInput, isCurrent) {
1455
- if (!queryDef.load) return;
1456
- const loadCtx = {
1457
- self: {
1458
- get state() {
1459
- return refs.state;
1460
- },
1461
- queries: refs.reactiveLoadQueries,
1462
- commands: refs.buildGatedCommands(isCurrent)
1463
- },
1464
- getService: refs.registryApi.getService
1465
- };
1466
- await Promise.resolve(queryDef.load(validatedInput, loadCtx));
1467
- }
1468
- /**
1469
1809
  * Builds the `ctx.self.queries` map used inside a *reactive subscription load* body.
1470
1810
  *
1471
1811
  * `.get()` here fires the dependency's `load` fire-and-forget (deduped via {@link inFlightLoads}),
@@ -1617,10 +1957,10 @@ async function runLoaded(refs, queryName, queryDef, rawInput, parentAncestorChai
1617
1957
  let iterations = 0;
1618
1958
  let hasMoreWork = true;
1619
1959
  while (hasMoreWork) {
1620
- if (iterations++ > MAX_DRAIN_ITERATIONS) throw new OpenServiceLoadedDrainExceededError({
1960
+ if (iterations++ > 32) throw new OpenServiceLoadedDrainExceededError({
1621
1961
  serviceId: refs.serviceId,
1622
1962
  name: queryName,
1623
- iterations: MAX_DRAIN_ITERATIONS
1963
+ iterations: 32
1624
1964
  });
1625
1965
  while (session.collector.size > 0) {
1626
1966
  const pending = [...session.collector];
@@ -1690,143 +2030,20 @@ function createDefaultQuery(refs, queryName, queryDef) {
1690
2030
  subscribe
1691
2031
  };
1692
2032
  }
1693
- /**
1694
- * Subscribes to a query by running its handler inside a deep-signal-aware `computed()` and
1695
- * notifying through an `effect()`. The callback receives a {@link QueryState} combining the current
1696
- * `data` (the synchronous handler result, or the selected slice) with the per-subscription `load`
1697
- * lifecycle (`status` / `loadStatus` / `error`).
1698
- *
1699
- * The first emission is **synchronous**: `subscribe()` invokes the callback once with the current
1700
- * {@link QueryState} before it returns the unsubscribe handle. The runtime kicks `load` off in the
1701
- * background but does not wait for it — subscribers see the current state immediately (a load-backed
1702
- * query already reads `loading`, since the reactive-load effect runs synchronously here) and
1703
- * follow-up emissions as the load settles (or re-fires) and tracked state changes.
1704
- *
1705
- * Three layers keep emissions precise:
1706
- *
1707
- * 1. **Fine-grained reads** — the handler (and the optional `selector`) read through the deep-signal
1708
- * proxy, so the computed only re-runs when the exact fields it touched change. A write to an
1709
- * unrelated key or field never re-runs the handler.
1710
- * 2. **Lifecycle signal** — a separate per-subscription signal carries `status`/`loadStatus`/`error`,
1711
- * updated by the reactive-load effect. The emit effect reads both it and the data computed, so a
1712
- * status change (e.g. a background re-load) fires the callback even when the selected slice is
1713
- * unchanged.
1714
- * 3. **Object dedup** — the whole emitted `QueryState` is compared with the previously emitted one via
1715
- * `isEqual`; a re-run that produces a deeply-equal state (e.g. a load rewriting an equal payload
1716
- * with no status change) does not fire the callback.
1717
- *
1718
- * Error sources all surface as `status: 'error'` (keeping the last successful `data`): input
1719
- * validation failure, a synchronous handler / output-validation throw, and a `load` rejection.
1720
- */
1721
- function subscribeToQuery(refs, queryName, queryDef, rawInput, selector, callback) {
1722
- let active = true;
1723
- let validatedInput;
1724
- try {
1725
- validatedInput = validateQueryInput(refs, queryName, queryDef, rawInput);
1726
- } catch (error) {
1727
- callback(buildQueryState(void 0, {
1728
- status: "error",
1729
- error: toError(error),
1730
- loadStatus: "idle"
1731
- }));
1732
- return () => {
1733
- active = false;
1734
- };
1735
- }
1736
- const lifecycle = y({
1737
- status: queryDef.load ? "pending" : "success",
1738
- error: void 0,
1739
- loadStatus: "idle"
1740
- });
1741
- let loadTeardown;
1742
- if (queryDef.load) {
1743
- let epoch = 0;
1744
- loadTeardown = j(() => {
1745
- const myEpoch = ++epoch;
1746
- const isCurrent = () => myEpoch === epoch;
1747
- const previous = f(() => lifecycle.value);
1748
- lifecycle.value = {
1749
- status: previous.status,
1750
- error: previous.error,
1751
- loadStatus: "loading"
1752
- };
1753
- runReactiveLoad(refs, queryName, queryDef, validatedInput, isCurrent).then(() => {
1754
- if (!isCurrent()) return;
1755
- lifecycle.value = {
1756
- status: "success",
1757
- error: void 0,
1758
- loadStatus: "idle"
1759
- };
1760
- }, (error) => {
1761
- if (!isCurrent()) return;
1762
- lifecycle.value = {
1763
- status: "error",
1764
- error: toError(error),
1765
- loadStatus: "idle"
1766
- };
1767
- });
1768
- });
1769
- }
1770
- const comp = g$1(() => {
1771
- const output = runHandlerSync(refs, queryName, queryDef, validatedInput, refs.defaultQueries, refs.registryApi.getService);
1772
- if (selector) {
1773
- const validated = f(() => validateQueryOutput(refs, queryName, queryDef, output));
1774
- selector(output);
1775
- return detachSnapshot(selector(validated));
1776
- }
1777
- return detachSnapshot(validateQueryOutput(refs, queryName, queryDef, output));
1778
- });
1779
- let hasEmitted = false;
1780
- let lastEmitted;
1781
- let lastData;
1782
- const teardown = j(() => {
1783
- const life = lifecycle.value;
1784
- let data;
1785
- let status = life.status;
1786
- let error = life.error;
1787
- try {
1788
- data = comp.value;
1789
- lastData = data;
1790
- } catch (handlerError) {
1791
- data = lastData;
1792
- status = "error";
1793
- error = toError(handlerError);
1794
- }
1795
- if (!active) return;
1796
- const state = buildQueryState(data, {
1797
- status,
1798
- error,
1799
- loadStatus: life.loadStatus
1800
- });
1801
- if (hasEmitted && isEqual(state, lastEmitted)) return;
1802
- hasEmitted = true;
1803
- lastEmitted = state;
1804
- callback(state);
1805
- });
1806
- return () => {
1807
- active = false;
1808
- teardown();
1809
- loadTeardown?.();
1810
- };
1811
- }
1812
2033
  /** Builds the runtime query map for one service runtime. */
1813
2034
  function buildQueries(refs) {
1814
2035
  const result = {};
1815
2036
  for (const [name, queryDef] of refs.queryDefinitions) result[name] = createDefaultQuery(refs, name, queryDef);
1816
2037
  return result;
1817
2038
  }
1818
- var MAX_DRAIN_ITERATIONS, inFlightLoads, nextLoadScopeSequence, nextLoadScopeId, activeHandlerLoadSession, EMPTY_SET;
2039
+ var activeHandlerLoadSession;
1819
2040
  function init_query_runtime() {
1820
2041
  return (init_query_runtime = __esmMin((() => {
1821
- init_signals_core_module();
1822
- init_isEqual();
1823
- init_server_errors();
2042
+ init_open_service();
1824
2043
  init_service_validation();
1825
- MAX_DRAIN_ITERATIONS = 32;
1826
- inFlightLoads = /* @__PURE__ */ new Map();
1827
- nextLoadScopeSequence = 0;
1828
- nextLoadScopeId = () => String(nextLoadScopeSequence += 1);
1829
- EMPTY_SET = /* @__PURE__ */ new Set();
2044
+ init_query_load_registry();
2045
+ init_query_handler();
2046
+ init_query_subscribe();
1830
2047
  })))();
1831
2048
  }
1832
2049
  //#endregion
@@ -2429,7 +2646,7 @@ function init_service_runtime() {
2429
2646
  return (init_service_runtime = __esmMin((() => {
2430
2647
  init_signals_core_module();
2431
2648
  init_deepsignal_core_module();
2432
- init_server_errors();
2649
+ init_open_service();
2433
2650
  init_patch_recorder();
2434
2651
  init_plain_object();
2435
2652
  init_query_runtime();
@@ -2908,9 +3125,9 @@ function connectServiceToChannel(context) {
2908
3125
  var SYNC_REQUEST_SILENCE_MS;
2909
3126
  function init_service_transport() {
2910
3127
  return (init_service_transport = __esmMin((() => {
2911
- init_dist();
3128
+ init_dist$1();
2912
3129
  init_client_logger();
2913
- init_server_errors();
3130
+ init_open_service();
2914
3131
  init_service_channel();
2915
3132
  init_service_error_serialization();
2916
3133
  init_service_sync();
@@ -3114,7 +3331,7 @@ var REGISTRY_SYMBOL, serviceRegistryApi;
3114
3331
  function init_service_registry() {
3115
3332
  return (init_service_registry = __esmMin((() => {
3116
3333
  init_channel_slot();
3117
- init_server_errors();
3334
+ init_open_service();
3118
3335
  init_service_channel();
3119
3336
  init_service_runtime();
3120
3337
  init_service_sync();
@@ -3257,7 +3474,7 @@ function init_paths() {
3257
3474
  var docgenInputSchema, argTypesSchema, docgenErrorSchema, docgenJsDocTagsSchema, docgenComponentFields, docgenSubcomponentFields, docgenSubcomponentSchema, docgenPayloadSchema, docgenOutputSchema, docgenServiceDef;
3258
3475
  function init_definition() {
3259
3476
  return (init_definition = __esmMin((() => {
3260
- init_dist();
3477
+ init_dist$1();
3261
3478
  init_service_definition();
3262
3479
  init_paths();
3263
3480
  docgenInputSchema = object({ id: string() });
@@ -3330,12 +3547,12 @@ function init_definition() {
3330
3547
  }
3331
3548
  //#endregion
3332
3549
  //#region src/shared/open-service/services/docgen/preview.ts
3333
- var preview_default$1;
3550
+ var preview_default$2;
3334
3551
  function init_preview$1() {
3335
3552
  return (init_preview$1 = __esmMin((() => {
3336
3553
  init_preview();
3337
3554
  init_definition();
3338
- preview_default$1 = () => definePreviewAddon({ beforeAll: () => {
3555
+ preview_default$2 = () => definePreviewAddon({ beforeAll: () => {
3339
3556
  if (globalThis.FEATURES?.docgenServer) registerService(docgenServiceDef);
3340
3557
  } });
3341
3558
  })))();
@@ -3357,7 +3574,7 @@ function init_paths$1() {
3357
3574
  var storyDocsInputSchema, storyDocsErrorSchema, storyDocSchema, storyDocsPayloadSchema, storyDocsOutputSchema, storyDocsServiceDef;
3358
3575
  function init_definition$1() {
3359
3576
  return (init_definition$1 = __esmMin((() => {
3360
- init_dist();
3577
+ init_dist$1();
3361
3578
  init_service_definition();
3362
3579
  init_paths$1();
3363
3580
  storyDocsInputSchema = object({ id: string() });
@@ -3468,13 +3685,13 @@ function init_story_docs_source_before_each() {
3468
3685
  }
3469
3686
  //#endregion
3470
3687
  //#region src/shared/open-service/services/story-docs/preview.ts
3471
- var preview_default;
3688
+ var preview_default$1;
3472
3689
  function init_preview$2() {
3473
3690
  return (init_preview$2 = __esmMin((() => {
3474
3691
  init_preview();
3475
3692
  init_definition$1();
3476
3693
  init_story_docs_source_before_each();
3477
- preview_default = () => {
3694
+ preview_default$1 = () => {
3478
3695
  if (!("FEATURES" in globalThis && globalThis.FEATURES?.docgenServer)) return definePreviewAddon({});
3479
3696
  return definePreviewAddon({
3480
3697
  beforeAll: () => {
@@ -3486,6 +3703,97 @@ function init_preview$2() {
3486
3703
  })))();
3487
3704
  }
3488
3705
  //#endregion
3706
+ //#region src/test/preview.ts
3707
+ var resetAllMocksLoader, isExplicitAction, traverseArgs, nameSpiesAndWrapActionsInSpies, patchedFocus, enhanceContext, preview_default;
3708
+ function init_preview$3() {
3709
+ return (init_preview$3 = __esmMin((() => {
3710
+ init_instrumenter();
3711
+ init_test();
3712
+ resetAllMocksLoader = ({ parameters }) => {
3713
+ if (parameters?.test?.mockReset === true) resetAllMocks();
3714
+ else if (parameters?.test?.clearMocks === true) clearAllMocks();
3715
+ else if (parameters?.test?.restoreMocks !== false) restoreAllMocks();
3716
+ };
3717
+ isExplicitAction = (value) => typeof value === "function" && "isAction" in value && !!value.isAction && !("implicit" in value && value.implicit);
3718
+ traverseArgs = (value, depth = 0, key) => {
3719
+ if (depth > 5) return value;
3720
+ if (value == null) return value;
3721
+ if (isMockFunction(value)) {
3722
+ if (key) value.mockName(key);
3723
+ return value;
3724
+ }
3725
+ if (isExplicitAction(value)) {
3726
+ const mock = fn(value);
3727
+ if (key) mock.mockName(key);
3728
+ return mock;
3729
+ }
3730
+ if (Array.isArray(value)) {
3731
+ depth++;
3732
+ for (let i = 0; i < value.length; i++) if (Object.getOwnPropertyDescriptor(value, i)?.writable) value[i] = traverseArgs(value[i], depth);
3733
+ return value;
3734
+ }
3735
+ if (typeof value === "object" && value.constructor === Object) {
3736
+ depth++;
3737
+ for (const [k, v] of Object.entries(value)) if (Object.getOwnPropertyDescriptor(value, k)?.writable) value[k] = traverseArgs(v, depth, k);
3738
+ return value;
3739
+ }
3740
+ return value;
3741
+ };
3742
+ nameSpiesAndWrapActionsInSpies = ({ initialArgs }) => {
3743
+ traverseArgs(initialArgs);
3744
+ };
3745
+ patchedFocus = false;
3746
+ enhanceContext = async (context) => {
3747
+ if (globalThis.HTMLElement && context.canvasElement instanceof globalThis.HTMLElement) context.canvas = within(context.canvasElement);
3748
+ try {
3749
+ const clipboard = globalThis.window?.navigator?.clipboard;
3750
+ if (clipboard) {
3751
+ context.userEvent = instrument({ userEvent: uninstrumentedUserEvent.setup() }, {
3752
+ intercept: true,
3753
+ getKeys: (obj) => Object.keys(obj).filter((key) => key !== "eventWrapper")
3754
+ }).userEvent;
3755
+ Object.defineProperty(globalThis.window.navigator, "clipboard", {
3756
+ get: () => clipboard,
3757
+ configurable: true
3758
+ });
3759
+ if (!patchedFocus) {
3760
+ const originalFocus = HTMLElement.prototype.focus;
3761
+ let currentFocus = HTMLElement.prototype.focus;
3762
+ const noopFocus = () => {};
3763
+ const focusingElements = /* @__PURE__ */ new Set();
3764
+ Object.defineProperties(HTMLElement.prototype, { focus: {
3765
+ configurable: true,
3766
+ set: (newFocus) => {
3767
+ currentFocus = newFocus;
3768
+ },
3769
+ get() {
3770
+ if (this === HTMLElement.prototype) return currentFocus;
3771
+ let browsingContext;
3772
+ try {
3773
+ browsingContext = this.ownerDocument?.defaultView;
3774
+ } catch {
3775
+ return currentFocus;
3776
+ }
3777
+ if (!browsingContext) return noopFocus;
3778
+ if (focusingElements.has(this)) return originalFocus;
3779
+ focusingElements.add(this);
3780
+ setTimeout(() => focusingElements.delete(this), 0);
3781
+ return currentFocus;
3782
+ }
3783
+ } });
3784
+ patchedFocus = true;
3785
+ }
3786
+ }
3787
+ } catch {}
3788
+ };
3789
+ preview_default = () => definePreviewAddon({ loaders: [
3790
+ resetAllMocksLoader,
3791
+ nameSpiesAndWrapActionsInSpies,
3792
+ enhanceContext
3793
+ ] });
3794
+ })))();
3795
+ }
3796
+ //#endregion
3489
3797
  //#region src/shared/story-index/autoTitle.ts
3490
3798
  /**
3491
3799
  * Combines path parts together, without duplicating separators (slashes). Used instead of
@@ -3678,4 +3986,4 @@ function init_iframe_resize() {
3678
3986
  })))();
3679
3987
  }
3680
3988
  //#endregion
3681
- export { LOOPBACK_HOSTNAMES as A, REVIEW_EVENTS as C, NON_AGGREGATED_STATUS_TYPE_IDS as D, CHANGE_DETECTION_STATUS_TYPE_ID as E, init_global as F, UniversalStore as I, init_universal_store as L, matchesHostname as M, global as N, REVIEW_STATUS_TYPE_ID as O, global_exports as P, init_tags as S, init_events as T, preview_default$1 as _, groupEntriesByComponent as a, registerService as b, isMdxEntry as c, init_autoTitle as d, userOrAutoTitle as f, init_preview$1 as g, preview_default as h, init_iframe_resize as i, init_local_hosts as j, init_status_store as k, init_sortStories as l, init_preview$2 as m, IFRAME_RESIZE_REQUEST_CONTEXT as n, init_story_grid as o, userOrAutoTitleFromSpecifier as p, iframeResizeViewportsEqual as r, init_story_index_filters as s, IFRAME_RESIZE_CONTEXT as t, sortStoriesV7 as u, getService as v, REVIEW_NAMESPACE as w, Tag as x, init_preview as y };
3989
+ export { REVIEW_NAMESPACE as A, matchesHostname as B, init_test as C, Tag as D, onMockCall as E, init_status_store as F, init_universal_store as G, global_exports as H, formatIssues as I, StorybookError as K, init_errors as L, CHANGE_DETECTION_STATUS_TYPE_ID as M, NON_AGGREGATED_STATUS_TYPE_IDS as N, init_tags as O, REVIEW_STATUS_TYPE_ID as P, LOOPBACK_HOSTNAMES as R, registerService as S, init_spy as T, init_global as U, global as V, UniversalStore as W, preview_default$1 as _, groupEntriesByComponent as a, getService as b, isMdxEntry as c, init_autoTitle as d, userOrAutoTitle as f, init_preview$2 as g, preview_default as h, init_iframe_resize as i, init_events as j, REVIEW_EVENTS as k, init_sortStories as l, init_preview$3 as m, IFRAME_RESIZE_REQUEST_CONTEXT as n, init_story_grid as o, userOrAutoTitleFromSpecifier as p, init_storybook_error as q, iframeResizeViewportsEqual as r, init_story_index_filters as s, IFRAME_RESIZE_CONTEXT as t, sortStoriesV7 as u, init_preview$1 as v, test_exports as w, init_preview as x, preview_default$2 as y, init_local_hosts as z };