@aussieljk/forkbook 0.0.0-stage → 0.0.1-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (598) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +77 -2
  3. package/assets/addon-vitest/templates/vitest.config.4.template.ts +36 -0
  4. package/assets/browser/favicon-wrapper.svg +46 -0
  5. package/assets/browser/favicon.svg +1 -0
  6. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  7. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  8. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  9. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  10. package/assets/builder-vite/iframe.html +99 -0
  11. package/assets/create/rendererAssets/.eslintrc.json +16 -0
  12. package/assets/create/rendererAssets/common/Configure.mdx +388 -0
  13. package/assets/create/rendererAssets/common/assets/accessibility.png +0 -0
  14. package/assets/create/rendererAssets/common/assets/accessibility.svg +1 -0
  15. package/assets/create/rendererAssets/common/assets/addon-library.png +0 -0
  16. package/assets/create/rendererAssets/common/assets/assets.png +0 -0
  17. package/assets/create/rendererAssets/common/assets/avif-test-image.avif +0 -0
  18. package/assets/create/rendererAssets/common/assets/context.png +0 -0
  19. package/assets/create/rendererAssets/common/assets/discord.svg +1 -0
  20. package/assets/create/rendererAssets/common/assets/docs.png +0 -0
  21. package/assets/create/rendererAssets/common/assets/figma-plugin.png +0 -0
  22. package/assets/create/rendererAssets/common/assets/github.svg +1 -0
  23. package/assets/create/rendererAssets/common/assets/share.png +0 -0
  24. package/assets/create/rendererAssets/common/assets/styling.png +0 -0
  25. package/assets/create/rendererAssets/common/assets/testing.png +0 -0
  26. package/assets/create/rendererAssets/common/assets/theming.png +0 -0
  27. package/assets/create/rendererAssets/common/assets/tutorials.svg +1 -0
  28. package/assets/create/rendererAssets/common/assets/youtube.svg +1 -0
  29. package/assets/create/rendererAssets/common/button.css +30 -0
  30. package/assets/create/rendererAssets/common/header.css +32 -0
  31. package/assets/create/rendererAssets/common/page.css +68 -0
  32. package/assets/create/templates/react-native/index.expo.js +20 -0
  33. package/assets/create/templates/react-native/index.js +25 -0
  34. package/assets/docs/addon-backgrounds.gif +0 -0
  35. package/assets/docs/addon-controls-args-annotated.png +0 -0
  36. package/assets/docs/addon-controls-args-background-color.png +0 -0
  37. package/assets/docs/addon-controls-args-background-string.png +0 -0
  38. package/assets/docs/addon-controls-args-docs.png +0 -0
  39. package/assets/docs/addon-controls-args-logging.png +0 -0
  40. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  41. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  42. package/assets/docs/addon-controls-args-reflow.png +0 -0
  43. package/assets/docs/addon-controls-args-template.png +0 -0
  44. package/assets/docs/addon-controls-expanded.png +0 -0
  45. package/assets/docs/addon-controls-hero.gif +0 -0
  46. package/assets/docs/addon-controls-install.png +0 -0
  47. package/assets/docs/hero.gif +0 -0
  48. package/assets/docs/highlight.png +0 -0
  49. package/assets/docs/message-reference.png +0 -0
  50. package/assets/docs/viewport.png +0 -0
  51. package/assets/react-native/metro-env.d.ts +69 -0
  52. package/assets/server/addon.tsconfig.json +6 -0
  53. package/assets/server/base-preview-body.html +116 -0
  54. package/assets/server/base-preview-head.html +494 -0
  55. package/assets/server/openBrowser.applescript +94 -0
  56. package/assets/server/template.ejs +87 -0
  57. package/dist/.build-stamp +0 -0
  58. package/dist/_browser-chunks/Color-PCLE2J36.js +1025 -0
  59. package/dist/_browser-chunks/DocsRenderer-JXND3PVQ.js +10 -0
  60. package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +1619 -0
  61. package/dist/_browser-chunks/chunk-2JDQ35OA.js +247 -0
  62. package/dist/_browser-chunks/chunk-2JT76G3E.js +104 -0
  63. package/dist/_browser-chunks/chunk-2MEPHP35.js +17 -0
  64. package/dist/_browser-chunks/chunk-2SCZVUKW.js +24 -0
  65. package/dist/_browser-chunks/chunk-46Z7NGAS.js +41 -0
  66. package/dist/_browser-chunks/chunk-4ATQOMJB.js +30 -0
  67. package/dist/_browser-chunks/chunk-52CW7FF7.js +49 -0
  68. package/dist/_browser-chunks/chunk-5I7E4GMO.js +62 -0
  69. package/dist/_browser-chunks/chunk-5P4QA6MY.js +20 -0
  70. package/dist/_browser-chunks/chunk-5WMXI5GW.js +816 -0
  71. package/dist/_browser-chunks/chunk-66OCZ54D.js +2604 -0
  72. package/dist/_browser-chunks/chunk-6SXYJQST.js +253 -0
  73. package/dist/_browser-chunks/chunk-AYRF6EJB.js +36 -0
  74. package/dist/_browser-chunks/chunk-B4AUNNU4.js +156 -0
  75. package/dist/_browser-chunks/chunk-BCP2FFXF.js +369 -0
  76. package/dist/_browser-chunks/chunk-C3D4HEFY.js +3396 -0
  77. package/dist/_browser-chunks/chunk-CFAOWGL7.js +43 -0
  78. package/dist/_browser-chunks/chunk-CFWWCCZV.js +223 -0
  79. package/dist/_browser-chunks/chunk-CNED6RYH.js +18 -0
  80. package/dist/_browser-chunks/chunk-DRQKCCAG.js +136 -0
  81. package/dist/_browser-chunks/chunk-ECQ75MKQ.js +0 -0
  82. package/dist/_browser-chunks/chunk-EIYAKDGP.js +302 -0
  83. package/dist/_browser-chunks/chunk-ENKK74N4.js +12 -0
  84. package/dist/_browser-chunks/chunk-FENFYI4X.js +698 -0
  85. package/dist/_browser-chunks/chunk-FJGWSWL5.js +155 -0
  86. package/dist/_browser-chunks/chunk-FVSEPWWX.js +2810 -0
  87. package/dist/_browser-chunks/chunk-GNZY6LOW.js +10116 -0
  88. package/dist/_browser-chunks/chunk-IE4ULIOQ.js +14 -0
  89. package/dist/_browser-chunks/chunk-IMSF75WX.js +42 -0
  90. package/dist/_browser-chunks/chunk-IWQGIXJS.js +14 -0
  91. package/dist/_browser-chunks/chunk-JMC7AIKT.js +108 -0
  92. package/dist/_browser-chunks/chunk-JPUOQJUI.js +8 -0
  93. package/dist/_browser-chunks/chunk-JSBKXXXF.js +218 -0
  94. package/dist/_browser-chunks/chunk-JWSKPMPC.js +73 -0
  95. package/dist/_browser-chunks/chunk-JYVGARBG.js +2943 -0
  96. package/dist/_browser-chunks/chunk-KBK7GKBN.js +35 -0
  97. package/dist/_browser-chunks/chunk-KQ7CRO2B.js +108 -0
  98. package/dist/_browser-chunks/chunk-LAWXTSXK.js +18 -0
  99. package/dist/_browser-chunks/chunk-LE2LTDW3.js +14 -0
  100. package/dist/_browser-chunks/chunk-LEVSOOLQ.js +48 -0
  101. package/dist/_browser-chunks/chunk-LV5PIKV4.js +93 -0
  102. package/dist/_browser-chunks/chunk-MDOL7KML.js +56 -0
  103. package/dist/_browser-chunks/chunk-MFMDGWP6.js +34 -0
  104. package/dist/_browser-chunks/chunk-MLBOOZL4.js +67 -0
  105. package/dist/_browser-chunks/chunk-NQUD4B7H.js +91 -0
  106. package/dist/_browser-chunks/chunk-NULBREPZ.js +43 -0
  107. package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
  108. package/dist/_browser-chunks/chunk-OD6IBQCC.js +117 -0
  109. package/dist/_browser-chunks/chunk-ODVJ3XZJ.js +157 -0
  110. package/dist/_browser-chunks/chunk-OQWFVDIN.js +386 -0
  111. package/dist/_browser-chunks/chunk-OVH3USFB.js +20 -0
  112. package/dist/_browser-chunks/chunk-OZZPSYQR.js +14 -0
  113. package/dist/_browser-chunks/chunk-P6PK47TQ.js +1970 -0
  114. package/dist/_browser-chunks/chunk-PFRNG3UC.js +22 -0
  115. package/dist/_browser-chunks/chunk-PJSMZ27A.js +13 -0
  116. package/dist/_browser-chunks/chunk-QC4HFS6K.js +41 -0
  117. package/dist/_browser-chunks/chunk-QDXFODK4.js +274 -0
  118. package/dist/_browser-chunks/chunk-RBCHTR7C.js +28 -0
  119. package/dist/_browser-chunks/chunk-RMYQ3QN3.js +294 -0
  120. package/dist/_browser-chunks/chunk-RNTIV5CE.js +411 -0
  121. package/dist/_browser-chunks/chunk-RSPAQWVJ.js +80 -0
  122. package/dist/_browser-chunks/chunk-S6TK43XQ.js +836 -0
  123. package/dist/_browser-chunks/chunk-SC67XZST.js +18 -0
  124. package/dist/_browser-chunks/chunk-SFVA4SBT.js +683 -0
  125. package/dist/_browser-chunks/chunk-SZYFOQMT.js +25 -0
  126. package/dist/_browser-chunks/chunk-TBJCJXK4.js +18 -0
  127. package/dist/_browser-chunks/chunk-UMDO3KB7.js +205 -0
  128. package/dist/_browser-chunks/chunk-V2G23FV7.js +11 -0
  129. package/dist/_browser-chunks/chunk-V5M7Q4HT.js +88 -0
  130. package/dist/_browser-chunks/chunk-W5M6NPS3.js +198 -0
  131. package/dist/_browser-chunks/chunk-W7NE2JXW.js +84 -0
  132. package/dist/_browser-chunks/chunk-WGVAAM43.js +1110 -0
  133. package/dist/_browser-chunks/chunk-WHQRNHXD.js +8 -0
  134. package/dist/_browser-chunks/chunk-WOSOWBCA.js +12 -0
  135. package/dist/_browser-chunks/chunk-WZ7KR7SH.js +85 -0
  136. package/dist/_browser-chunks/chunk-YEKO6BHJ.js +20 -0
  137. package/dist/_browser-chunks/chunk-YI2IBIQS.js +7 -0
  138. package/dist/_browser-chunks/chunk-YTIT5NA5.js +1966 -0
  139. package/dist/_browser-chunks/chunk-ZEHRUHTA.js +6 -0
  140. package/dist/_browser-chunks/chunk-ZTQ5MEJ5.js +203 -0
  141. package/dist/_browser-chunks/matchers-YLBYSYAF.js +1263 -0
  142. package/dist/_browser-chunks/react-dom-client-4OHE3QDV.js +9 -0
  143. package/dist/_node-chunks/attached-runtime-I2G4WLJI.js +282 -0
  144. package/dist/_node-chunks/builder-manager-VVHYQXCH.js +1661 -0
  145. package/dist/_node-chunks/chunk-2BUPBPFB.js +82 -0
  146. package/dist/_node-chunks/chunk-2DSIDINN.js +884 -0
  147. package/dist/_node-chunks/chunk-2RU7BKEW.js +23 -0
  148. package/dist/_node-chunks/chunk-34EO2PUT.js +26 -0
  149. package/dist/_node-chunks/chunk-3BKIBF5S.js +3008 -0
  150. package/dist/_node-chunks/chunk-3SDUYDXH.js +98 -0
  151. package/dist/_node-chunks/chunk-3T4ZSNPH.js +662 -0
  152. package/dist/_node-chunks/chunk-3W7F2B7P.js +79 -0
  153. package/dist/_node-chunks/chunk-3Y6AAY5H.js +80 -0
  154. package/dist/_node-chunks/chunk-42UWAGPW.js +1193 -0
  155. package/dist/_node-chunks/chunk-4FEANXWU.js +1986 -0
  156. package/dist/_node-chunks/chunk-5DQFEZEA.js +40 -0
  157. package/dist/_node-chunks/chunk-6KEHV53S.js +1218 -0
  158. package/dist/_node-chunks/chunk-6LMWA44H.js +3837 -0
  159. package/dist/_node-chunks/chunk-6YKBRP72.js +20 -0
  160. package/dist/_node-chunks/chunk-7GUDZVRQ.js +110 -0
  161. package/dist/_node-chunks/chunk-B5J7Q7J4.js +21 -0
  162. package/dist/_node-chunks/chunk-BS2WMZMR.js +90 -0
  163. package/dist/_node-chunks/chunk-BSKFCWQD.js +47 -0
  164. package/dist/_node-chunks/chunk-BXVYT7SB.js +36 -0
  165. package/dist/_node-chunks/chunk-CCOTJ4FC.js +688 -0
  166. package/dist/_node-chunks/chunk-CQKMLL5J.js +33 -0
  167. package/dist/_node-chunks/chunk-CXRU72ET.js +63 -0
  168. package/dist/_node-chunks/chunk-DC7DKR5K.js +20 -0
  169. package/dist/_node-chunks/chunk-DHJFTB4K.js +25 -0
  170. package/dist/_node-chunks/chunk-DUR55DJJ.js +1094 -0
  171. package/dist/_node-chunks/chunk-E6YESGLX.js +7032 -0
  172. package/dist/_node-chunks/chunk-EHUNOMDD.js +52345 -0
  173. package/dist/_node-chunks/chunk-ET7PWEO7.js +298 -0
  174. package/dist/_node-chunks/chunk-EWOX7HPJ.js +20 -0
  175. package/dist/_node-chunks/chunk-F3ZFKBHY.js +844 -0
  176. package/dist/_node-chunks/chunk-FK7KGTV7.js +26 -0
  177. package/dist/_node-chunks/chunk-FPZB5OI7.js +35 -0
  178. package/dist/_node-chunks/chunk-FW2HQUBQ.js +25 -0
  179. package/dist/_node-chunks/chunk-FY6UXW6G.js +11 -0
  180. package/dist/_node-chunks/chunk-GEFQN7K3.js +499 -0
  181. package/dist/_node-chunks/chunk-GRBLDJCR.js +989 -0
  182. package/dist/_node-chunks/chunk-H32DYT6P.js +87 -0
  183. package/dist/_node-chunks/chunk-H4PPVMP5.js +23 -0
  184. package/dist/_node-chunks/chunk-HMP2G23X.js +25 -0
  185. package/dist/_node-chunks/chunk-ICPBH3E7.js +59 -0
  186. package/dist/_node-chunks/chunk-IDEL2J23.js +23 -0
  187. package/dist/_node-chunks/chunk-IK4FGZLR.js +223 -0
  188. package/dist/_node-chunks/chunk-JDXXX6LB.js +68 -0
  189. package/dist/_node-chunks/chunk-JGGFYIG5.js +5468 -0
  190. package/dist/_node-chunks/chunk-JPAZLYJ3.js +29 -0
  191. package/dist/_node-chunks/chunk-JZOO7GGC.js +48 -0
  192. package/dist/_node-chunks/chunk-KISMCCP5.js +4744 -0
  193. package/dist/_node-chunks/chunk-LCK4ZQKG.js +115 -0
  194. package/dist/_node-chunks/chunk-LO56I6E2.js +132 -0
  195. package/dist/_node-chunks/chunk-LXBD4UL4.js +104 -0
  196. package/dist/_node-chunks/chunk-MA24JW6C.js +7162 -0
  197. package/dist/_node-chunks/chunk-MK2KYAI6.js +5414 -0
  198. package/dist/_node-chunks/chunk-NDWKJ4CL.js +2102 -0
  199. package/dist/_node-chunks/chunk-NIBT7XDZ.js +168 -0
  200. package/dist/_node-chunks/chunk-NPO45IMH.js +33 -0
  201. package/dist/_node-chunks/chunk-OISX4AGQ.js +414 -0
  202. package/dist/_node-chunks/chunk-OUW6R7C3.js +26 -0
  203. package/dist/_node-chunks/chunk-OWNFOGTA.js +194 -0
  204. package/dist/_node-chunks/chunk-Q7QNUM5H.js +49 -0
  205. package/dist/_node-chunks/chunk-QEQLR22M.js +1877 -0
  206. package/dist/_node-chunks/chunk-RRN2V55B.js +45 -0
  207. package/dist/_node-chunks/chunk-RWFIFGO5.js +144 -0
  208. package/dist/_node-chunks/chunk-RXNJDRGO.js +209 -0
  209. package/dist/_node-chunks/chunk-RZMQ7S3L.js +92 -0
  210. package/dist/_node-chunks/chunk-SIEXZVCR.js +51 -0
  211. package/dist/_node-chunks/chunk-SLWQNBGO.js +2034 -0
  212. package/dist/_node-chunks/chunk-SVTBJ7Q3.js +35 -0
  213. package/dist/_node-chunks/chunk-SWO5CDYU.js +32 -0
  214. package/dist/_node-chunks/chunk-TD5PLLQG.js +121 -0
  215. package/dist/_node-chunks/chunk-TEQGGSP7.js +33 -0
  216. package/dist/_node-chunks/chunk-TFCEV2XX.js +155 -0
  217. package/dist/_node-chunks/chunk-TFEWM4E3.js +1073 -0
  218. package/dist/_node-chunks/chunk-TINO74G5.js +21 -0
  219. package/dist/_node-chunks/chunk-TNJIXE37.js +40 -0
  220. package/dist/_node-chunks/chunk-TWI4GVH7.js +19 -0
  221. package/dist/_node-chunks/chunk-U5W53R2J.js +1011 -0
  222. package/dist/_node-chunks/chunk-UBOGWBEA.js +148 -0
  223. package/dist/_node-chunks/chunk-UMUBKI6E.js +3787 -0
  224. package/dist/_node-chunks/chunk-UVINFLGY.js +56 -0
  225. package/dist/_node-chunks/chunk-V2DY426G.js +1133 -0
  226. package/dist/_node-chunks/chunk-VLOXOXXE.js +45 -0
  227. package/dist/_node-chunks/chunk-W4OMYLSP.js +1297 -0
  228. package/dist/_node-chunks/chunk-WAXVSN3O.js +18 -0
  229. package/dist/_node-chunks/chunk-WCULS5TP.js +3767 -0
  230. package/dist/_node-chunks/chunk-WNZ2UMFM.js +153 -0
  231. package/dist/_node-chunks/chunk-WZJF2OUH.js +74 -0
  232. package/dist/_node-chunks/chunk-XGIUVY52.js +611 -0
  233. package/dist/_node-chunks/chunk-XHL2LVBM.js +415 -0
  234. package/dist/_node-chunks/chunk-XI6B6P47.js +59 -0
  235. package/dist/_node-chunks/chunk-XLP2ZKXV.js +60 -0
  236. package/dist/_node-chunks/chunk-YCMRA6RX.js +95 -0
  237. package/dist/_node-chunks/chunk-YZFWBA5L.js +2700 -0
  238. package/dist/_node-chunks/chunk-ZMAMXQKP.js +4731 -0
  239. package/dist/_node-chunks/chunk-ZWBCQ4MJ.js +110 -0
  240. package/dist/_node-chunks/dist-VTSTZKUB.js +16 -0
  241. package/dist/_node-chunks/globby-OEMHPBFY.js +2884 -0
  242. package/dist/_node-chunks/jiti-NFX6UU74.js +3848 -0
  243. package/dist/_node-chunks/lib-MDVARD7W.js +366 -0
  244. package/dist/_node-chunks/local-runtime-NTKIN2QT.js +78 -0
  245. package/dist/_node-chunks/mdx-plugin-MWISDWDQ.js +5680 -0
  246. package/dist/_node-chunks/monorepo-LIRFMQXE.js +121 -0
  247. package/dist/_node-chunks/monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js +121 -0
  248. package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +22 -0
  249. package/dist/_node-chunks/pattern-copy-play-EKHIUAU2.js +807 -0
  250. package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +20 -0
  251. package/dist/_node-chunks/rehype-external-links-BUN3HUCO.js +121 -0
  252. package/dist/_node-chunks/rehype-slug-PLADX223.js +52 -0
  253. package/dist/_node-chunks/relaxed-limits-GBHW6KIQ.js +117 -0
  254. package/dist/_node-chunks/run-KDTIZNSY.js +103 -0
  255. package/dist/_node-chunks/run-NL66VTNR.js +4532 -0
  256. package/dist/_node-chunks/session-id-KIIVOQLR.js +23 -0
  257. package/dist/_node-chunks/setup-MGC7BQO6.js +278 -0
  258. package/dist/_node-chunks/vitest.config.4.template-JH2THZFG.js +54 -0
  259. package/dist/actions/decorator.d.ts +7 -0
  260. package/dist/actions/decorator.js +43 -0
  261. package/dist/actions/index.d.ts +67 -0
  262. package/dist/actions/index.js +28 -0
  263. package/dist/addon-a11y/index.d.ts +52 -0
  264. package/dist/addon-a11y/index.js +16 -0
  265. package/dist/addon-a11y/manager.js +1429 -0
  266. package/dist/addon-a11y/preset.js +18 -0
  267. package/dist/addon-a11y/preview.d.ts +17 -0
  268. package/dist/addon-a11y/preview.js +15 -0
  269. package/dist/addon-docs/blocks.d.ts +1061 -0
  270. package/dist/addon-docs/blocks.js +2461 -0
  271. package/dist/addon-docs/index.d.ts +236 -0
  272. package/dist/addon-docs/index.js +16 -0
  273. package/dist/addon-docs/manager.js +90 -0
  274. package/dist/addon-docs/mdx-react-shim.d.ts +1 -0
  275. package/dist/addon-docs/mdx-react-shim.js +2 -0
  276. package/dist/addon-docs/preset.js +378 -0
  277. package/dist/addon-docs/preview.d.ts +4 -0
  278. package/dist/addon-docs/preview.js +7 -0
  279. package/dist/addon-links/index.d.ts +22 -0
  280. package/dist/addon-links/index.js +20 -0
  281. package/dist/addon-links/manager.js +14 -0
  282. package/dist/addon-links/preview.d.ts +6 -0
  283. package/dist/addon-links/preview.js +9 -0
  284. package/dist/addon-links/react/index.d.ts +25 -0
  285. package/dist/addon-links/react/index.js +52 -0
  286. package/dist/addon-mcp/preset.js +1345 -0
  287. package/dist/addon-mcp/preview.js +29 -0
  288. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +1153 -0
  289. package/dist/addon-ondevice-actions/index.d.ts +4 -0
  290. package/dist/addon-ondevice-actions/index.js +7 -0
  291. package/dist/addon-ondevice-actions/register.js +7 -0
  292. package/dist/addon-ondevice-controls/index.d.ts +6 -0
  293. package/dist/addon-ondevice-controls/index.js +14 -0
  294. package/dist/addon-ondevice-controls/register.js +10 -0
  295. package/dist/addon-pseudo-states/index.d.ts +35 -0
  296. package/dist/addon-pseudo-states/index.js +15 -0
  297. package/dist/addon-pseudo-states/manager.js +53 -0
  298. package/dist/addon-pseudo-states/preview.d.ts +9 -0
  299. package/dist/addon-pseudo-states/preview.js +10 -0
  300. package/dist/addon-themes/index.d.ts +80 -0
  301. package/dist/addon-themes/index.js +104 -0
  302. package/dist/addon-themes/manager.js +97 -0
  303. package/dist/addon-themes/postinstall.js +33 -0
  304. package/dist/addon-themes/preview.d.ts +6 -0
  305. package/dist/addon-themes/preview.js +8 -0
  306. package/dist/addon-vitest/constants.d.ts +132 -0
  307. package/dist/addon-vitest/constants.js +66 -0
  308. package/dist/addon-vitest/index.d.ts +4 -0
  309. package/dist/addon-vitest/index.js +8 -0
  310. package/dist/addon-vitest/manager.js +665 -0
  311. package/dist/addon-vitest/node/coverage-reporter.js +1284 -0
  312. package/dist/addon-vitest/node/vitest.js +674 -0
  313. package/dist/addon-vitest/postinstall.js +24 -0
  314. package/dist/addon-vitest/preset.js +943 -0
  315. package/dist/addon-vitest/vitest-plugin/global-setup.js +162 -0
  316. package/dist/addon-vitest/vitest-plugin/index.d.ts +56 -0
  317. package/dist/addon-vitest/vitest-plugin/index.js +463 -0
  318. package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +9 -0
  319. package/dist/addon-vitest/vitest-plugin/setup-file.browser.4.js +20 -0
  320. package/dist/addon-vitest/vitest-plugin/setup-file.js +50 -0
  321. package/dist/addon-vitest/vitest-plugin/test-utils.js +128 -0
  322. package/dist/babel/index.d.ts +2301 -0
  323. package/dist/babel/index.js +61 -0
  324. package/dist/backgrounds/index.d.ts +6 -0
  325. package/dist/backgrounds/index.js +15 -0
  326. package/dist/bin/core.js +1705 -0
  327. package/dist/bin/dispatcher.js +43 -0
  328. package/dist/bin/loader.js +115 -0
  329. package/dist/builder-vite/index.d.ts +50 -0
  330. package/dist/builder-vite/index.js +245 -0
  331. package/dist/builder-vite/preset.js +27 -0
  332. package/dist/channels/index.d.ts +2 -0
  333. package/dist/channels/index.js +352 -0
  334. package/dist/chunk-B2t1tGRh.d.ts +284 -0
  335. package/dist/chunk-BCoJQE-f.d.ts +602 -0
  336. package/dist/chunk-BGkgZp-H.d.ts +214 -0
  337. package/dist/chunk-BTVrWliM.d.ts +115 -0
  338. package/dist/chunk-BXLImeLy.d.ts +197 -0
  339. package/dist/chunk-BfBzpgct.d.ts +916 -0
  340. package/dist/chunk-Bpi2tz-6.d.ts +511 -0
  341. package/dist/chunk-BxWufQms.d.ts +142 -0
  342. package/dist/chunk-C-bavsOH.d.ts +34 -0
  343. package/dist/chunk-C2p5r3Vt.d.ts +13001 -0
  344. package/dist/chunk-C6PAgHLT.d.ts +12 -0
  345. package/dist/chunk-CMeX4WRe.d.ts +179 -0
  346. package/dist/chunk-Ct9xd6IM.d.ts +65 -0
  347. package/dist/chunk-CwQKNaYL.d.ts +15 -0
  348. package/dist/chunk-D7DwV41f.d.ts +3622 -0
  349. package/dist/chunk-DEVFdzxR.d.ts +253 -0
  350. package/dist/chunk-DaVb55-_.d.ts +124 -0
  351. package/dist/chunk-DgRNfmj_.d.ts +40 -0
  352. package/dist/chunk-DoIGKY33.d.ts +666 -0
  353. package/dist/chunk-Dr3R0DXk.d.ts +40 -0
  354. package/dist/chunk-DtHByo32.d.ts +55 -0
  355. package/dist/chunk-Dw1z1Pki.d.ts +933 -0
  356. package/dist/chunk-DzuY9DXg.d.ts +79 -0
  357. package/dist/chunk-FjDVzZTj.d.ts +62 -0
  358. package/dist/chunk-Kt1tW-D1.d.ts +59 -0
  359. package/dist/chunk-XP8oHzpE.d.ts +6 -0
  360. package/dist/chunk-gCX81nOr.d.ts +61 -0
  361. package/dist/chunk-pcFXCimE.d.ts +741 -0
  362. package/dist/cli/index.d.ts +1174 -0
  363. package/dist/cli/index.js +5613 -0
  364. package/dist/cli/skills/content/index.d.ts +72 -0
  365. package/dist/cli/skills/content/index.js +335 -0
  366. package/dist/cli/tools/sdk/child-host.d.ts +61 -0
  367. package/dist/cli/tools/sdk/child-host.js +131 -0
  368. package/dist/cli/tools/sdk/index.d.ts +137 -0
  369. package/dist/cli/tools/sdk/index.js +44 -0
  370. package/dist/cli-commands/bin/index.js +25 -0
  371. package/dist/client-logger/index.d.ts +31 -0
  372. package/dist/client-logger/index.js +63 -0
  373. package/dist/common/index.d.ts +1103 -0
  374. package/dist/common/index.js +364 -0
  375. package/dist/components/index.d.ts +1924 -0
  376. package/dist/components/index.js +13759 -0
  377. package/dist/core-events/index.d.ts +155 -0
  378. package/dist/core-events/index.js +136 -0
  379. package/dist/core-server/index.d.ts +2200 -0
  380. package/dist/core-server/index.js +4165 -0
  381. package/dist/core-server/presets/common-manager.css +170 -0
  382. package/dist/core-server/presets/common-manager.js +4168 -0
  383. package/dist/core-server/presets/common-override-preset.js +81 -0
  384. package/dist/core-server/presets/common-preset.js +2187 -0
  385. package/dist/create/bin/index.js +23 -0
  386. package/dist/create/index.js +25 -0
  387. package/dist/csf/csf-utils.d.ts +2 -0
  388. package/dist/csf/csf-utils.js +19 -0
  389. package/dist/csf/index.d.ts +7 -0
  390. package/dist/csf/index.js +2142 -0
  391. package/dist/csf-tools/index.d.ts +1157 -0
  392. package/dist/csf-tools/index.js +736 -0
  393. package/dist/docs-tools/index.d.ts +197 -0
  394. package/dist/docs-tools/index.js +61 -0
  395. package/dist/highlight/index.d.ts +10 -0
  396. package/dist/highlight/index.js +15 -0
  397. package/dist/instrumenter/index.d.ts +113 -0
  398. package/dist/instrumenter/index.js +2595 -0
  399. package/dist/manager/_manager-chunks/globals-runtime-8HkdnU2F.js +6144 -0
  400. package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +3389 -0
  401. package/dist/manager/_manager-chunks/globals-runtime-BdGkqNEt.js +45 -0
  402. package/dist/manager/_manager-chunks/globals-runtime-BmphMP6z.js +1190 -0
  403. package/dist/manager/_manager-chunks/globals-runtime-BvM-NY2g.js +13307 -0
  404. package/dist/manager/_manager-chunks/globals-runtime-C02fvgcd.js +9243 -0
  405. package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +9766 -0
  406. package/dist/manager/_manager-chunks/globals-runtime-DpNYC-qi.js +5564 -0
  407. package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +5357 -0
  408. package/dist/manager/_manager-chunks/globals-runtime-DwFqpqya.js +722 -0
  409. package/dist/manager/_manager-chunks/globals-runtime-FC201B7s.js +6837 -0
  410. package/dist/manager/_manager-chunks/globals-runtime-Rp_zjGnh.js +121 -0
  411. package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +10463 -0
  412. package/dist/manager/_manager-chunks/globals-runtime-eLPTIfX-.js +7759 -0
  413. package/dist/manager/_manager-chunks/globals-runtime-qKvCZHFY.js +4468 -0
  414. package/dist/manager/_manager-chunks/globals-runtime-sGpNlIJ1.js +5102 -0
  415. package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +452 -0
  416. package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +22 -0
  417. package/dist/manager/_manager-chunks/runtime-BhkT2CXl.js +1408 -0
  418. package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +998 -0
  419. package/dist/manager/_manager-chunks/runtime-D0UOWx0U.js +979 -0
  420. package/dist/manager/_manager-chunks/runtime-D94Vq3oR.js +4014 -0
  421. package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +77 -0
  422. package/dist/manager/_manager-chunks/runtime-EITvVbkG.js +46 -0
  423. package/dist/manager/_manager-chunks/runtime-cp5pazY2.js +8936 -0
  424. package/dist/manager/_manager-chunks/runtime-eDVAYF7N.js +6860 -0
  425. package/dist/manager/_manager-chunks/runtime-i-PDAHLR.js +2493 -0
  426. package/dist/manager/globals-runtime.js +2 -0
  427. package/dist/manager/globals.d.ts +23 -0
  428. package/dist/manager/globals.js +26 -0
  429. package/dist/manager/manager-stores.d.ts +2 -0
  430. package/dist/manager/manager-stores.js +19 -0
  431. package/dist/manager/runtime.js +2 -0
  432. package/dist/manager-api/index.d.ts +2 -0
  433. package/dist/manager-api/index.js +3257 -0
  434. package/dist/manager-errors.d.ts +89 -0
  435. package/dist/manager-errors.js +20 -0
  436. package/dist/mcp/index.d.ts +270 -0
  437. package/dist/mcp/index.js +305 -0
  438. package/dist/mocking-utils/index.d.ts +689 -0
  439. package/dist/mocking-utils/index.js +521 -0
  440. package/dist/mocking-utils/mocker-runtime.js +1254 -0
  441. package/dist/nextjs-vite/config/preview.js +3 -0
  442. package/dist/nextjs-vite/export-mocks/cache/index.d.ts +25 -0
  443. package/dist/nextjs-vite/export-mocks/cache/index.js +29 -0
  444. package/dist/nextjs-vite/export-mocks/headers/index.d.ts +37 -0
  445. package/dist/nextjs-vite/export-mocks/headers/index.js +54 -0
  446. package/dist/nextjs-vite/export-mocks/link/index.d.ts +9 -0
  447. package/dist/nextjs-vite/export-mocks/link/index.js +59 -0
  448. package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +28 -0
  449. package/dist/nextjs-vite/export-mocks/navigation/index.js +58 -0
  450. package/dist/nextjs-vite/export-mocks/router/index.d.ts +34 -0
  451. package/dist/nextjs-vite/export-mocks/router/index.js +63 -0
  452. package/dist/nextjs-vite/index.d.ts +92 -0
  453. package/dist/nextjs-vite/index.js +58 -0
  454. package/dist/nextjs-vite/node/index.d.ts +6 -0
  455. package/dist/nextjs-vite/node/index.js +20 -0
  456. package/dist/nextjs-vite/preset.js +648 -0
  457. package/dist/nextjs-vite/preview.d.ts +20 -0
  458. package/dist/nextjs-vite/preview.js +11 -0
  459. package/dist/nextjs-vite/vite-plugin/index.d.ts +6 -0
  460. package/dist/nextjs-vite/vite-plugin/index.js +19 -0
  461. package/dist/nextjs-vite-plugin/index.d.ts +28 -0
  462. package/dist/nextjs-vite-plugin/index.js +923 -0
  463. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +29 -0
  464. package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-context.js +8 -0
  465. package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-default-loader.js +23 -0
  466. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +28 -0
  467. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +17 -0
  468. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/cache/index.js +29 -0
  469. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/dynamic/index.js +40 -0
  470. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/headers/index.js +55 -0
  471. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/link/index.js +63 -0
  472. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/navigation/index.js +71 -0
  473. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +74 -0
  474. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/rsc/server-only.js +7 -0
  475. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/safe-stable-stringify/index.js +13 -0
  476. package/dist/nextjs-vite-plugin/plugins/next-mocks/compatibility/draft-mode.compat.js +7 -0
  477. package/dist/node-logger/index.d.ts +495 -0
  478. package/dist/node-logger/index.js +42 -0
  479. package/dist/oxc-parser/index.d.ts +99 -0
  480. package/dist/oxc-parser/index.js +275 -0
  481. package/dist/oxc-parser/worker.js +37 -0
  482. package/dist/preview/_chunks/runtime-BIzIdDbb.js +10263 -0
  483. package/dist/preview/_chunks/runtime-BTPtVY1p.js +1102 -0
  484. package/dist/preview/_chunks/runtime-BZSnICCg.js +8484 -0
  485. package/dist/preview/_chunks/runtime-BdGkqNEt.js +45 -0
  486. package/dist/preview/_chunks/runtime-BwSxqk3t.js +63 -0
  487. package/dist/preview/_chunks/runtime-CqHxptiK.js +6143 -0
  488. package/dist/preview/_chunks/runtime-CsV4HZPV.js +5064 -0
  489. package/dist/preview/_chunks/runtime-CxZK_Ln3.js +284 -0
  490. package/dist/preview/_chunks/runtime-DZToXfvO.js +9767 -0
  491. package/dist/preview/_chunks/runtime-DrTjJkPY.js +3872 -0
  492. package/dist/preview/_chunks/runtime-DuHdxMFA.js +387 -0
  493. package/dist/preview/_chunks/runtime-iXdo8CR8.js +3635 -0
  494. package/dist/preview/_chunks/runtime-q3wt0e_N.js +6838 -0
  495. package/dist/preview/globals.d.ts +16 -0
  496. package/dist/preview/globals.js +20 -0
  497. package/dist/preview/runtime.js +6 -0
  498. package/dist/preview-api/index.d.ts +4 -0
  499. package/dist/preview-api/index.js +147 -0
  500. package/dist/preview-errors.d.ts +186 -0
  501. package/dist/preview-errors.js +56 -0
  502. package/dist/react/docgen/docgen-worker.js +38 -0
  503. package/dist/react/entry-preview-argtypes.js +9 -0
  504. package/dist/react/entry-preview-docs.js +12 -0
  505. package/dist/react/entry-preview-rsc.js +11 -0
  506. package/dist/react/entry-preview.js +21 -0
  507. package/dist/react/index.d.ts +119 -0
  508. package/dist/react/index.js +26 -0
  509. package/dist/react/preset.js +301 -0
  510. package/dist/react/preview.d.ts +2 -0
  511. package/dist/react/preview.js +11 -0
  512. package/dist/react-native/bin/get-stories.js +34 -0
  513. package/dist/react-native/index.d.ts +160 -0
  514. package/dist/react-native/index.js +1547 -0
  515. package/dist/react-native/metro/node.d.ts +83 -0
  516. package/dist/react-native/metro/node.js +21 -0
  517. package/dist/react-native/metro/withStorybook.d.ts +2269 -0
  518. package/dist/react-native/metro/withStorybook.js +138 -0
  519. package/dist/react-native/preview.d.ts +6 -0
  520. package/dist/react-native/preview.js +20 -0
  521. package/dist/react-native/scripts/generate.d.ts +22 -0
  522. package/dist/react-native/scripts/generate.js +18 -0
  523. package/dist/react-native/stub.js +20 -0
  524. package/dist/react-native-theming/index.d.ts +175 -0
  525. package/dist/react-native-theming/index.js +2591 -0
  526. package/dist/react-native-ui/index.d.ts +130 -0
  527. package/dist/react-native-ui/index.js +1448 -0
  528. package/dist/react-native-ui-common/index.d.ts +230 -0
  529. package/dist/react-native-ui-common/index.js +514 -0
  530. package/dist/react-vite/index.d.ts +4 -0
  531. package/dist/react-vite/index.js +8 -0
  532. package/dist/react-vite/node/index.d.ts +6 -0
  533. package/dist/react-vite/node/index.js +20 -0
  534. package/dist/react-vite/preset.d.ts +6 -0
  535. package/dist/react-vite/preset.js +21 -0
  536. package/dist/router/index.d.ts +141 -0
  537. package/dist/router/index.js +1217 -0
  538. package/dist/server-errors.d.ts +2 -0
  539. package/dist/server-errors.js +149 -0
  540. package/dist/shared/open-service/index.d.ts +3 -0
  541. package/dist/shared/open-service/index.js +115 -0
  542. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +75 -0
  543. package/dist/shared/open-service/toolsets/docs/public.d.ts +1296 -0
  544. package/dist/shared/open-service/toolsets/docs/public.js +991 -0
  545. package/dist/telemetry/index.d.ts +314 -0
  546. package/dist/telemetry/index.js +103 -0
  547. package/dist/test/index.d.ts +158 -0
  548. package/dist/test/index.js +19421 -0
  549. package/dist/theming/create.d.ts +15 -0
  550. package/dist/theming/create.js +11 -0
  551. package/dist/theming/index.d.ts +54 -0
  552. package/dist/theming/index.js +511 -0
  553. package/dist/types/index.d.ts +2 -0
  554. package/dist/types/index.js +48 -0
  555. package/dist/viewport/index.d.ts +275 -0
  556. package/dist/viewport/index.js +21 -0
  557. package/package.json +1054 -4
  558. package/template/nextjs-vite/cli/.eslintrc.json +6 -0
  559. package/template/nextjs-vite/cli/js/Button.jsx +42 -0
  560. package/template/nextjs-vite/cli/js/Button.stories.js +49 -0
  561. package/template/nextjs-vite/cli/js/Configure.mdx +470 -0
  562. package/template/nextjs-vite/cli/js/Header.jsx +58 -0
  563. package/template/nextjs-vite/cli/js/Header.stories.js +30 -0
  564. package/template/nextjs-vite/cli/js/Page.jsx +68 -0
  565. package/template/nextjs-vite/cli/js/Page.stories.js +28 -0
  566. package/template/nextjs-vite/cli/ts/Button.stories.ts +54 -0
  567. package/template/nextjs-vite/cli/ts/Button.tsx +39 -0
  568. package/template/nextjs-vite/cli/ts/Configure.mdx +446 -0
  569. package/template/nextjs-vite/cli/ts/Header.stories.ts +34 -0
  570. package/template/nextjs-vite/cli/ts/Header.tsx +54 -0
  571. package/template/nextjs-vite/cli/ts/Page.stories.ts +33 -0
  572. package/template/nextjs-vite/cli/ts/Page.tsx +73 -0
  573. package/template/react/cli/.eslintrc.json +5 -0
  574. package/template/react/cli/js/Button.jsx +39 -0
  575. package/template/react/cli/js/Button.stories.js +49 -0
  576. package/template/react/cli/js/Header.jsx +56 -0
  577. package/template/react/cli/js/Header.stories.js +29 -0
  578. package/template/react/cli/js/Page.jsx +69 -0
  579. package/template/react/cli/js/Page.stories.js +28 -0
  580. package/template/react/cli/ts/Button.stories.ts +54 -0
  581. package/template/react/cli/ts/Button.tsx +37 -0
  582. package/template/react/cli/ts/Header.stories.ts +34 -0
  583. package/template/react/cli/ts/Header.tsx +56 -0
  584. package/template/react/cli/ts/Page.stories.ts +33 -0
  585. package/template/react/cli/ts/Page.tsx +73 -0
  586. package/template/react-vite/cli/.eslintrc.json +5 -0
  587. package/template/react-vite/cli/js/Button.jsx +39 -0
  588. package/template/react-vite/cli/js/Button.stories.js +49 -0
  589. package/template/react-vite/cli/js/Header.jsx +56 -0
  590. package/template/react-vite/cli/js/Header.stories.js +29 -0
  591. package/template/react-vite/cli/js/Page.jsx +69 -0
  592. package/template/react-vite/cli/js/Page.stories.js +28 -0
  593. package/template/react-vite/cli/ts/Button.stories.ts +54 -0
  594. package/template/react-vite/cli/ts/Button.tsx +37 -0
  595. package/template/react-vite/cli/ts/Header.stories.ts +34 -0
  596. package/template/react-vite/cli/ts/Header.tsx +56 -0
  597. package/template/react-vite/cli/ts/Page.stories.ts +33 -0
  598. package/template/react-vite/cli/ts/Page.tsx +73 -0
@@ -0,0 +1,1408 @@
1
+ import { n as __esmMin } from "./runtime-EITvVbkG.js";
2
+ import { Cr as useSyncExternalStore, Ft as useParameter, G as Separator, Lt as useStorybookApi, Nt as useGlobalTypes, Pt as useGlobals, Sr as useState, Tt as init_manager_api, W as Select, fr as useCallback, hr as useEffect, lr as init__storybook_global_react, nr as _storybook_global_react_default, ot as init_components, xr as useRef, yr as useMemo } from "./runtime-Bly6WJLN.js";
3
+ import { c as Icons, l as init_icon } from "./runtime-B1L9TH89.js";
4
+ import { i as init_esm, r as dedent } from "./runtime-i-PDAHLR.js";
5
+ import { d as isEqual, u as init_isEqual } from "./runtime-D94Vq3oR.js";
6
+ import { a as StatusTypeIdMismatchError$1, o as UniversalStoreFollowerTimeoutError, s as init_manager_errors } from "./runtime-cp5pazY2.js";
7
+ import { n as init_preview_errors, t as StatusTypeIdMismatchError$2 } from "./runtime-BK0zF7FN.js";
8
+ //#region src/toolbar/utils/normalize-toolbar-arg-type.ts
9
+ var normalizeArgType;
10
+ function init_normalize_toolbar_arg_type() {
11
+ return (init_normalize_toolbar_arg_type = __esmMin((() => {
12
+ normalizeArgType = (key, argType) => {
13
+ const toolbar = argType.toolbar;
14
+ if (!toolbar) return null;
15
+ return {
16
+ ...argType,
17
+ toolbar: {
18
+ ...argType.toolbar,
19
+ items: toolbar.items.map((_item) => {
20
+ const item = typeof _item === "string" ? {
21
+ value: _item,
22
+ title: _item
23
+ } : _item;
24
+ if (item.type === "reset" && toolbar.icon) {
25
+ item.icon = toolbar.icon;
26
+ item.hideIcon = true;
27
+ item.value = void 0;
28
+ }
29
+ return item;
30
+ })
31
+ }
32
+ };
33
+ };
34
+ })))();
35
+ }
36
+ //#endregion
37
+ //#region src/toolbar/utils/get-selected.ts
38
+ var getSelectedItem;
39
+ function init_get_selected() {
40
+ return (init_get_selected = __esmMin((() => {
41
+ getSelectedItem = ({ currentValue, items }) => {
42
+ return items.find((item) => item.value === currentValue && item.type !== "reset");
43
+ };
44
+ })))();
45
+ }
46
+ //#endregion
47
+ //#region src/toolbar/constants.ts
48
+ var TOOLBAR_ID;
49
+ function init_constants() {
50
+ return (init_constants = __esmMin((() => {
51
+ TOOLBAR_ID = "toolbar";
52
+ })))();
53
+ }
54
+ //#endregion
55
+ //#region src/toolbar/utils/register-shortcuts.ts
56
+ var registerShortcuts;
57
+ function init_register_shortcuts() {
58
+ return (init_register_shortcuts = __esmMin((() => {
59
+ init_constants();
60
+ registerShortcuts = async (api, id, shortcuts) => {
61
+ if (shortcuts.next) await api.setAddonShortcut(TOOLBAR_ID, {
62
+ label: shortcuts.next.label,
63
+ defaultShortcut: shortcuts.next.keys,
64
+ actionName: `${id}:next`,
65
+ action: shortcuts.next.action
66
+ });
67
+ if (shortcuts.previous) await api.setAddonShortcut(TOOLBAR_ID, {
68
+ label: shortcuts.previous.label,
69
+ defaultShortcut: shortcuts.previous.keys,
70
+ actionName: `${id}:previous`,
71
+ action: shortcuts.previous.action
72
+ });
73
+ if (shortcuts.reset) await api.setAddonShortcut(TOOLBAR_ID, {
74
+ label: shortcuts.reset.label,
75
+ defaultShortcut: shortcuts.reset.keys,
76
+ actionName: `${id}:reset`,
77
+ action: shortcuts.reset.action
78
+ });
79
+ };
80
+ })))();
81
+ }
82
+ //#endregion
83
+ //#region src/toolbar/components/ToolbarMenuSelect.module.css
84
+ var id, ToolbarMenuSelect_module_default;
85
+ function init_ToolbarMenuSelect_module() {
86
+ return (init_ToolbarMenuSelect_module = __esmMin((() => {
87
+ id = "core/src/toolbar/components/ToolbarMenuSelect.module.css";
88
+ if (typeof document !== "undefined" && !document.querySelector(`style[data-sb-css="${id}"]`)) {
89
+ const style = document.createElement("style");
90
+ style.setAttribute("data-sb-css", id);
91
+ style.textContent = ".sb-FCSgfW-item{align-items:center;gap:8px;width:100%;display:flex}.sb-FCSgfW-itemMiddle{flex:1}";
92
+ document.head.appendChild(style);
93
+ }
94
+ ToolbarMenuSelect_module_default = {
95
+ "item": "sb-FCSgfW-item",
96
+ "itemMiddle": "sb-FCSgfW-itemMiddle"
97
+ };
98
+ })))();
99
+ }
100
+ //#endregion
101
+ //#region src/toolbar/components/ToolbarMenuSelect.tsx
102
+ var ToolbarMenuSelect;
103
+ function init_ToolbarMenuSelect() {
104
+ return (init_ToolbarMenuSelect = __esmMin((() => {
105
+ init__storybook_global_react();
106
+ init_components();
107
+ init_manager_api();
108
+ init_icon();
109
+ init_get_selected();
110
+ init_register_shortcuts();
111
+ init_ToolbarMenuSelect_module();
112
+ ToolbarMenuSelect = ({ id, name, description, toolbar: { icon: _icon, items, title: _title, preventDynamicIcon, dynamicTitle = true, shortcuts } }) => {
113
+ const api = useStorybookApi();
114
+ const [globals, updateGlobals, storyGlobals] = useGlobals();
115
+ const currentValue = globals[id];
116
+ const isOverridden = id in storyGlobals;
117
+ let icon = _icon;
118
+ let title = _title;
119
+ if (!preventDynamicIcon) icon = getSelectedItem({
120
+ currentValue,
121
+ items
122
+ })?.icon || icon;
123
+ if (dynamicTitle) title = getSelectedItem({
124
+ currentValue,
125
+ items
126
+ })?.title || title;
127
+ if (!title && !icon) console.warn(`Toolbar '${id}' has no title or icon`);
128
+ const resetItem = items.find((item) => item.type === "reset");
129
+ const resetLabel = resetItem?.title;
130
+ const options = _storybook_global_react_default.useMemo(() => items.filter((item) => item.type !== "reset").map((item) => {
131
+ const itemTitle = item.title ?? item.value ?? "Untitled";
132
+ const iconComponent = !item.hideIcon && item.icon ? /* @__PURE__ */ _storybook_global_react_default.createElement(Icons, {
133
+ icon: item.icon,
134
+ __suppressDeprecationWarning: true
135
+ }) : void 0;
136
+ if (item.right) return {
137
+ title: itemTitle,
138
+ value: item.value,
139
+ children: /* @__PURE__ */ _storybook_global_react_default.createElement("div", { className: ToolbarMenuSelect_module_default.item }, iconComponent, /* @__PURE__ */ _storybook_global_react_default.createElement("div", { className: ToolbarMenuSelect_module_default.itemMiddle }, item.title ?? item.value), item.right)
140
+ };
141
+ else return {
142
+ title: itemTitle,
143
+ value: item.value,
144
+ icon: iconComponent
145
+ };
146
+ }), [items]);
147
+ _storybook_global_react_default.useEffect(() => {
148
+ if (shortcuts) {
149
+ const length = options.length;
150
+ registerShortcuts(api, id, {
151
+ next: {
152
+ ...shortcuts.next,
153
+ action: () => {
154
+ const idx = options.findIndex((i) => i.value === globals[id]);
155
+ const nextIdx = idx < 0 ? 0 : (idx + 1) % length;
156
+ updateGlobals({ [id]: options[nextIdx].value });
157
+ }
158
+ },
159
+ previous: {
160
+ ...shortcuts.previous,
161
+ action: () => {
162
+ const idx = options.findIndex((i) => i.value === globals[id]);
163
+ const previousIdx = idx < 0 ? length - 1 : (idx + length - 1) % length;
164
+ updateGlobals({ [id]: options[previousIdx].value });
165
+ }
166
+ },
167
+ reset: {
168
+ ...shortcuts.reset,
169
+ action: () => {
170
+ updateGlobals({ [id]: void 0 });
171
+ }
172
+ }
173
+ });
174
+ }
175
+ }, [
176
+ api,
177
+ id,
178
+ shortcuts,
179
+ globals,
180
+ options,
181
+ updateGlobals
182
+ ]);
183
+ const ariaLabel = description || title || name || id;
184
+ return /* @__PURE__ */ _storybook_global_react_default.createElement(Select, {
185
+ defaultOptions: [currentValue],
186
+ options,
187
+ disabled: isOverridden,
188
+ ariaLabel,
189
+ tooltip: ariaLabel,
190
+ resetLabel,
191
+ onReset: resetItem ? () => updateGlobals({ [id]: resetItem?.value }) : void 0,
192
+ onSelect: (selected) => updateGlobals({ [id]: selected }),
193
+ icon: icon && /* @__PURE__ */ _storybook_global_react_default.createElement(Icons, {
194
+ icon,
195
+ __suppressDeprecationWarning: true
196
+ }),
197
+ showSelectedOptionTitle: dynamicTitle
198
+ }, title);
199
+ };
200
+ })))();
201
+ }
202
+ //#endregion
203
+ //#region src/toolbar/components/ToolbarManager.tsx
204
+ var ToolbarManager;
205
+ function init_ToolbarManager() {
206
+ return (init_ToolbarManager = __esmMin((() => {
207
+ init__storybook_global_react();
208
+ init_components();
209
+ init_manager_api();
210
+ init_normalize_toolbar_arg_type();
211
+ init_ToolbarMenuSelect();
212
+ ToolbarManager = () => {
213
+ const globalTypes = useGlobalTypes();
214
+ if (!Object.keys(globalTypes).some((id) => !!globalTypes[id].toolbar)) return null;
215
+ return /* @__PURE__ */ _storybook_global_react_default.createElement(_storybook_global_react_default.Fragment, null, /* @__PURE__ */ _storybook_global_react_default.createElement(Separator, null), Object.keys(globalTypes).map((id) => {
216
+ const normalizedArgType = normalizeArgType(id, globalTypes[id]);
217
+ return normalizedArgType && /* @__PURE__ */ _storybook_global_react_default.createElement(ToolbarMenuSelect, {
218
+ key: id,
219
+ id,
220
+ ...normalizedArgType
221
+ });
222
+ }));
223
+ };
224
+ })))();
225
+ }
226
+ //#endregion
227
+ //#region src/shared/review/routes.ts
228
+ var REVIEW_COLLECTION_QUERY_PARAM, isReviewSummaryPath, isReviewCollectionStoryRoute;
229
+ function init_routes() {
230
+ return (init_routes = __esmMin((() => {
231
+ REVIEW_COLLECTION_QUERY_PARAM = "collection";
232
+ isReviewSummaryPath = (path) => path === "/review/" || path === "/review";
233
+ isReviewCollectionStoryRoute = (path, customQueryParams) => !!path && path.startsWith("/story/") && customQueryParams?.["collection"] !== void 0;
234
+ })))();
235
+ }
236
+ //#endregion
237
+ //#region src/shared/announce.ts
238
+ function getRegion(politeness) {
239
+ let region = regions.get(politeness);
240
+ if (!region?.isConnected) {
241
+ region = document.createElement("div");
242
+ region.setAttribute("aria-live", politeness);
243
+ region.setAttribute("role", "log");
244
+ region.setAttribute("aria-relevant", "additions");
245
+ region.dataset.liveAnnouncer = "true";
246
+ Object.assign(region.style, {
247
+ position: "absolute",
248
+ width: "1px",
249
+ height: "1px",
250
+ margin: "-1px",
251
+ padding: "0",
252
+ border: "0",
253
+ overflow: "hidden",
254
+ clip: "rect(0 0 0 0)",
255
+ clipPath: "inset(50%)",
256
+ whiteSpace: "nowrap"
257
+ });
258
+ document.body.append(region);
259
+ regions.set(politeness, region);
260
+ }
261
+ return region;
262
+ }
263
+ /** Announces a message to screen readers. */
264
+ function announce(message, politeness = "polite") {
265
+ if (typeof document === "undefined") return;
266
+ const node = document.createElement("div");
267
+ node.textContent = message;
268
+ getRegion(politeness).append(node);
269
+ setTimeout(() => node.remove(), MESSAGE_TIMEOUT);
270
+ }
271
+ /** Removes all messages of one politeness level. */
272
+ function clearAnnouncer(politeness) {
273
+ regions.get(politeness)?.replaceChildren();
274
+ }
275
+ var MESSAGE_TIMEOUT, regions;
276
+ function init_announce() {
277
+ return (init_announce = __esmMin((() => {
278
+ MESSAGE_TIMEOUT = 7e3;
279
+ regions = /* @__PURE__ */ new Map();
280
+ })))();
281
+ }
282
+ //#endregion
283
+ //#region src/shared/useCopyButton.ts
284
+ function useCopyButton({ children = "Copy", childrenOnCopy = "Copied!", content, onCopy, ariaLabel = false, ariaLabelOnCopy = false, duration = 3e3 }) {
285
+ const [copied, setCopied] = useState(false);
286
+ const timerRef = useRef(null);
287
+ useEffect(() => () => {
288
+ if (timerRef.current) clearTimeout(timerRef.current);
289
+ }, []);
290
+ const handleClick = useCallback((e) => {
291
+ if (timerRef.current) clearTimeout(timerRef.current);
292
+ const announcement = typeof ariaLabelOnCopy === "string" ? ariaLabelOnCopy : "Copied to clipboard";
293
+ navigator.clipboard?.writeText(content).then(() => {
294
+ onCopy?.(e);
295
+ setCopied(true);
296
+ announce(announcement, "polite");
297
+ timerRef.current = setTimeout(() => {
298
+ setCopied(false);
299
+ clearAnnouncer("polite");
300
+ timerRef.current = null;
301
+ }, duration);
302
+ });
303
+ }, [
304
+ content,
305
+ onCopy,
306
+ ariaLabelOnCopy,
307
+ duration
308
+ ]);
309
+ return {
310
+ children: copied ? childrenOnCopy : children,
311
+ buttonProps: useMemo(() => ({
312
+ onClick: handleClick,
313
+ ariaLabel: copied ? ariaLabelOnCopy : ariaLabel
314
+ }), [
315
+ handleClick,
316
+ copied,
317
+ ariaLabelOnCopy,
318
+ ariaLabel
319
+ ])
320
+ };
321
+ }
322
+ function init_useCopyButton() {
323
+ return (init_useCopyButton = __esmMin((() => {
324
+ init__storybook_global_react();
325
+ init_announce();
326
+ })))();
327
+ }
328
+ //#endregion
329
+ //#region src/shared/review/events.ts
330
+ var REVIEW_NAMESPACE, REVIEW_EVENTS;
331
+ function init_events() {
332
+ return (init_events = __esmMin((() => {
333
+ REVIEW_NAMESPACE = "@aussieljk/forkbook/review";
334
+ REVIEW_EVENTS = { PAGEVIEW: `${REVIEW_NAMESPACE}/pageview` };
335
+ })))();
336
+ }
337
+ //#endregion
338
+ //#region src/viewport/constants.ts
339
+ var ADDON_ID, PARAM_KEY, RESPONSIVE_VIEWPORT_VALUE;
340
+ function init_constants$1() {
341
+ return (init_constants$1 = __esmMin((() => {
342
+ ADDON_ID = "@aussieljk/forkbook/viewport";
343
+ PARAM_KEY = "viewport";
344
+ RESPONSIVE_VIEWPORT_VALUE = "100pct-100pct";
345
+ })))();
346
+ }
347
+ //#endregion
348
+ //#region src/shared/constants/iframe-resize.ts
349
+ var IFRAME_RESIZE_REQUEST_CONTEXT, isPositiveFinite, parseViewport, parseIframeResizeMessage, hasFixedViewportDimensions, iframeResizeViewportsEqual, iframeResizeDimensionsEqual;
350
+ function init_iframe_resize() {
351
+ return (init_iframe_resize = __esmMin((() => {
352
+ init_constants$1();
353
+ IFRAME_RESIZE_REQUEST_CONTEXT = "iframe.resize.request";
354
+ isPositiveFinite = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
355
+ parseViewport = (value) => {
356
+ if (!value || typeof value !== "object") return;
357
+ const viewport = value;
358
+ if (typeof viewport.name !== "string" || typeof viewport.value !== "string") return;
359
+ const parsed = {
360
+ name: viewport.name,
361
+ value: viewport.value
362
+ };
363
+ if (viewport.width !== void 0) {
364
+ if (!isPositiveFinite(viewport.width)) return;
365
+ parsed.width = viewport.width;
366
+ }
367
+ if (viewport.height !== void 0) {
368
+ if (!isPositiveFinite(viewport.height)) return;
369
+ parsed.height = viewport.height;
370
+ }
371
+ return parsed;
372
+ };
373
+ parseIframeResizeMessage = (data) => {
374
+ try {
375
+ const parsed = typeof data === "string" ? JSON.parse(data) : data;
376
+ if (parsed?.context !== "iframe.resize") return null;
377
+ if (!isPositiveFinite(parsed.width) || !isPositiveFinite(parsed.height)) return null;
378
+ const viewport = parseViewport(parsed.viewport);
379
+ if (parsed.viewport !== void 0 && viewport === void 0) return null;
380
+ return {
381
+ width: parsed.width,
382
+ height: parsed.height,
383
+ ...viewport ? { viewport } : {}
384
+ };
385
+ } catch {
386
+ return null;
387
+ }
388
+ };
389
+ hasFixedViewportDimensions = (viewport) => !!viewport && viewport.value !== "100pct-100pct" && typeof viewport.width === "number" && viewport.width > 0 && typeof viewport.height === "number" && viewport.height > 0;
390
+ iframeResizeViewportsEqual = (left, right) => {
391
+ if (left === right) return true;
392
+ if (!left || !right) return !left && !right;
393
+ return left.name === right.name && left.value === right.value && left.width === right.width && left.height === right.height;
394
+ };
395
+ iframeResizeDimensionsEqual = (left, right) => {
396
+ if (!left) return false;
397
+ if (left.width !== right.width || left.height !== right.height) return false;
398
+ return iframeResizeViewportsEqual(left.viewport, right.viewport);
399
+ };
400
+ })))();
401
+ }
402
+ //#endregion
403
+ //#region src/viewport/defaults.ts
404
+ var MINIMAL_VIEWPORTS;
405
+ function init_defaults() {
406
+ return (init_defaults = __esmMin((() => {
407
+ MINIMAL_VIEWPORTS = {
408
+ mobile1: {
409
+ name: "Small mobile",
410
+ styles: {
411
+ height: "568px",
412
+ width: "320px"
413
+ },
414
+ type: "mobile"
415
+ },
416
+ mobile2: {
417
+ name: "Large mobile",
418
+ styles: {
419
+ height: "896px",
420
+ width: "414px"
421
+ },
422
+ type: "mobile"
423
+ },
424
+ tablet: {
425
+ name: "Tablet",
426
+ styles: {
427
+ height: "1112px",
428
+ width: "834px"
429
+ },
430
+ type: "tablet"
431
+ },
432
+ desktop: {
433
+ name: "Desktop",
434
+ styles: {
435
+ height: "1024px",
436
+ width: "1280px"
437
+ },
438
+ type: "desktop"
439
+ }
440
+ };
441
+ })))();
442
+ }
443
+ //#endregion
444
+ //#region src/viewport/resolveViewport.ts
445
+ var URL_VALUE_PATTERN, normalizeGlobal$1, resolveViewport;
446
+ function init_resolveViewport() {
447
+ return (init_resolveViewport = __esmMin((() => {
448
+ init_constants$1();
449
+ URL_VALUE_PATTERN = /^([0-9]{1,4})([a-z]{0,4})-([0-9]{1,4})([a-z]{0,4})$/;
450
+ normalizeGlobal$1 = (value, defaultIsRotated) => typeof value === "string" ? {
451
+ value,
452
+ isRotated: defaultIsRotated
453
+ } : {
454
+ value: value?.value,
455
+ isRotated: value?.isRotated ?? defaultIsRotated
456
+ };
457
+ resolveViewport = ({ globals, storyGlobals, userGlobals, options, lastSelectedOption, disable = false, viewMode }) => {
458
+ if (viewMode !== "story") return {
459
+ name: "Responsive",
460
+ type: "desktop",
461
+ width: "100%",
462
+ height: "100%",
463
+ value: RESPONSIVE_VIEWPORT_VALUE,
464
+ option: void 0,
465
+ isCustom: false,
466
+ isDefault: true,
467
+ isLocked: true,
468
+ isRotated: false
469
+ };
470
+ const global = normalizeGlobal$1(globals?.[PARAM_KEY]);
471
+ const userGlobal = normalizeGlobal$1(userGlobals?.[PARAM_KEY]);
472
+ const storyGlobal = normalizeGlobal$1(storyGlobals?.[PARAM_KEY]);
473
+ const storyHasViewport = PARAM_KEY in storyGlobals;
474
+ const primaryGlobal = storyHasViewport ? storyGlobal : userGlobal;
475
+ const secondaryGlobal = storyHasViewport ? userGlobal : storyGlobal;
476
+ const value = primaryGlobal?.value ?? secondaryGlobal?.value ?? global?.value;
477
+ const isRotated = primaryGlobal?.isRotated ?? secondaryGlobal?.isRotated ?? global?.isRotated ?? false;
478
+ const keys = Object.keys(options);
479
+ const isLocked = disable || "viewport" in storyGlobals || !keys.length;
480
+ const [match, vx, ux, vy, uy] = value?.match(URL_VALUE_PATTERN) || [];
481
+ if (match) {
482
+ const x = ux && ux !== "px" ? vx : Math.max(Number(vx), 40);
483
+ const y = uy && uy !== "px" ? vy : Math.max(Number(vy), 40);
484
+ const width = `${x}${ux === "pct" ? "%" : ux || "px"}`;
485
+ const height = `${y}${uy === "pct" ? "%" : uy || "px"}`;
486
+ const selection = lastSelectedOption ? options[lastSelectedOption] : void 0;
487
+ return {
488
+ name: selection?.name ?? "Custom",
489
+ type: selection?.type ?? "other",
490
+ width: isRotated ? height : width,
491
+ height: isRotated ? width : height,
492
+ value: match,
493
+ option: void 0,
494
+ isCustom: true,
495
+ isDefault: false,
496
+ isLocked,
497
+ isRotated
498
+ };
499
+ }
500
+ if (value && keys.length) {
501
+ const { name, styles, type = "other" } = options[value] ?? options[keys[0]];
502
+ return {
503
+ name,
504
+ type,
505
+ width: isRotated ? styles.height : styles.width,
506
+ height: isRotated ? styles.width : styles.height,
507
+ value,
508
+ option: value,
509
+ isCustom: false,
510
+ isDefault: false,
511
+ isLocked,
512
+ isRotated
513
+ };
514
+ }
515
+ return {
516
+ name: "Responsive",
517
+ type: "desktop",
518
+ width: "100%",
519
+ height: "100%",
520
+ value: RESPONSIVE_VIEWPORT_VALUE,
521
+ option: void 0,
522
+ isCustom: false,
523
+ isDefault: true,
524
+ isLocked,
525
+ isRotated: false
526
+ };
527
+ };
528
+ })))();
529
+ }
530
+ //#endregion
531
+ //#region src/viewport/useViewport.ts
532
+ var cycle, normalizeGlobal, useViewport;
533
+ function init_useViewport() {
534
+ return (init_useViewport = __esmMin((() => {
535
+ init__storybook_global_react();
536
+ init_manager_api();
537
+ init_constants$1();
538
+ init_defaults();
539
+ init_resolveViewport();
540
+ cycle = (viewports, current, direction = 1) => {
541
+ const keys = Object.keys(viewports);
542
+ const nextIndex = (current ? keys.indexOf(current) : -1) + direction;
543
+ return nextIndex < 0 ? keys[keys.length - 1] : nextIndex >= keys.length ? keys[0] : keys[nextIndex];
544
+ };
545
+ normalizeGlobal = (value, defaultIsRotated) => typeof value === "string" ? {
546
+ value,
547
+ isRotated: defaultIsRotated
548
+ } : {
549
+ value: value?.value,
550
+ isRotated: value?.isRotated ?? defaultIsRotated
551
+ };
552
+ useViewport = () => {
553
+ const api = useStorybookApi();
554
+ const { viewMode } = api.getUrlState();
555
+ const lastSelectedOption = useRef();
556
+ const parameter = useParameter(PARAM_KEY);
557
+ const [globals, updateGlobals, storyGlobals, userGlobals] = useGlobals();
558
+ const { options = MINIMAL_VIEWPORTS, disable = false } = parameter || {};
559
+ const { name, type, width, height, value, option, isCustom, isDefault, isLocked, isRotated } = resolveViewport({
560
+ globals,
561
+ storyGlobals,
562
+ userGlobals,
563
+ options,
564
+ lastSelectedOption: lastSelectedOption.current,
565
+ disable,
566
+ viewMode
567
+ });
568
+ const update = useCallback((input) => updateGlobals({ [PARAM_KEY]: normalizeGlobal(input, false) }), [updateGlobals]);
569
+ const resize = useCallback((width, height) => {
570
+ const w = width.replace(/px$/, "").replace(/%$/, "pct");
571
+ const h = height.replace(/px$/, "").replace(/%$/, "pct");
572
+ const value = isRotated ? `${h}-${w}` : `${w}-${h}`;
573
+ update({
574
+ value,
575
+ isRotated
576
+ });
577
+ }, [update, isRotated]);
578
+ useEffect(() => {
579
+ if (!parameter) return;
580
+ if (option) {
581
+ if (Object.hasOwn(options, option)) lastSelectedOption.current = option;
582
+ else {
583
+ lastSelectedOption.current = void 0;
584
+ if (!("viewport" in storyGlobals)) update({
585
+ value: void 0,
586
+ isRotated: false
587
+ });
588
+ }
589
+ }
590
+ }, [
591
+ parameter,
592
+ storyGlobals,
593
+ options,
594
+ option,
595
+ update
596
+ ]);
597
+ useEffect(() => {
598
+ api.setAddonShortcut(ADDON_ID, {
599
+ label: "Next viewport",
600
+ defaultShortcut: ["alt", "V"],
601
+ actionName: "next",
602
+ action: () => update({
603
+ value: cycle(options, lastSelectedOption.current),
604
+ isRotated
605
+ })
606
+ });
607
+ api.setAddonShortcut(ADDON_ID, {
608
+ label: "Previous viewport",
609
+ defaultShortcut: [
610
+ "alt",
611
+ "shift",
612
+ "V"
613
+ ],
614
+ actionName: "previous",
615
+ action: () => update({
616
+ value: cycle(options, lastSelectedOption.current, -1),
617
+ isRotated
618
+ })
619
+ });
620
+ api.setAddonShortcut(ADDON_ID, {
621
+ label: "Reset viewport",
622
+ defaultShortcut: [
623
+ "alt",
624
+ "control",
625
+ "V"
626
+ ],
627
+ actionName: "reset",
628
+ action: () => update({
629
+ value: void 0,
630
+ isRotated: false
631
+ })
632
+ });
633
+ }, [
634
+ api,
635
+ update,
636
+ options,
637
+ isRotated
638
+ ]);
639
+ return useMemo(() => ({
640
+ name,
641
+ type,
642
+ width,
643
+ height,
644
+ value,
645
+ option,
646
+ isCustom,
647
+ isDefault,
648
+ isLocked,
649
+ isRotated,
650
+ options,
651
+ lastSelectedOption: lastSelectedOption.current,
652
+ resize,
653
+ reset: () => update({
654
+ value: void 0,
655
+ isRotated: false
656
+ }),
657
+ rotate: () => update({
658
+ value,
659
+ isRotated: !isRotated
660
+ }),
661
+ select: (value) => update({
662
+ value,
663
+ isRotated
664
+ })
665
+ }), [
666
+ name,
667
+ type,
668
+ width,
669
+ height,
670
+ value,
671
+ option,
672
+ isCustom,
673
+ isDefault,
674
+ isRotated,
675
+ isLocked,
676
+ options,
677
+ resize,
678
+ update
679
+ ]);
680
+ };
681
+ })))();
682
+ }
683
+ //#endregion
684
+ //#region src/shared/constants/tags.ts
685
+ var Tag, BUILT_IN_FILTERS, USER_TAG_FILTER;
686
+ function init_tags() {
687
+ return (init_tags = __esmMin((() => {
688
+ Tag = {
689
+ /** Indicates that autodocs should be generated for this component */
690
+ AUTODOCS: "autodocs",
691
+ /** MDX documentation attached to a component's stories file */
692
+ ATTACHED_MDX: "attached-mdx",
693
+ /** Standalone MDX documentation not attached to stories */
694
+ UNATTACHED_MDX: "unattached-mdx",
695
+ /** Story has a play function */
696
+ PLAY_FN: "play-fn",
697
+ /** Story has a test function */
698
+ TEST_FN: "test-fn",
699
+ /** Development environment tag */
700
+ DEV: "dev",
701
+ /** Test environment tag */
702
+ TEST: "test",
703
+ /** Manifest generation tag */
704
+ MANIFEST: "manifest"
705
+ };
706
+ BUILT_IN_FILTERS = {
707
+ _docs: (entry, excluded) => excluded ? entry.type !== "docs" : entry.type === "docs",
708
+ _play: (entry, excluded) => excluded ? entry.type !== "story" || !entry.tags?.includes(Tag.PLAY_FN) : entry.type === "story" && !!entry.tags?.includes(Tag.PLAY_FN),
709
+ _test: (entry, excluded) => excluded ? entry.type !== "story" || entry.subtype !== "test" : entry.type === "story" && entry.subtype === "test"
710
+ };
711
+ USER_TAG_FILTER = (tag) => (entry, excluded) => excluded ? !entry.tags?.includes(tag) : !!entry.tags?.includes(tag);
712
+ })))();
713
+ }
714
+ //#endregion
715
+ //#region src/shared/utils/story-index-filters.ts
716
+ var getActiveFilterCount;
717
+ function init_story_index_filters() {
718
+ return (init_story_index_filters = __esmMin((() => {
719
+ getActiveFilterCount = ({ includedTagFilters, excludedTagFilters, includedStatusFilters, excludedStatusFilters }) => (includedTagFilters?.length ?? 0) + (excludedTagFilters?.length ?? 0) + (includedStatusFilters?.length ?? 0) + (excludedStatusFilters?.length ?? 0);
720
+ })))();
721
+ }
722
+ //#endregion
723
+ //#region src/storybook-error.ts
724
+ function parseErrorCode({ code, category }) {
725
+ return `SB_${category}_${String(code).padStart(4, "0")}`;
726
+ }
727
+ function appendErrorRef(url) {
728
+ if (/^(?!.*storybook\.js\.org)|[?&]ref=error\b/.test(url)) return url;
729
+ try {
730
+ const urlObj = new URL(url);
731
+ urlObj.searchParams.set("ref", "error");
732
+ return urlObj.toString();
733
+ } catch {
734
+ return url;
735
+ }
736
+ }
737
+ var StorybookError;
738
+ function init_storybook_error() {
739
+ return (init_storybook_error = __esmMin((() => {
740
+ StorybookError = class StorybookError extends Error {
741
+ get fullErrorCode() {
742
+ return parseErrorCode({
743
+ code: this.code,
744
+ category: this.category
745
+ });
746
+ }
747
+ /** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
748
+ get name() {
749
+ const errorName = this._name || this.constructor.name;
750
+ return `${this.fullErrorCode} (${errorName})`;
751
+ }
752
+ set name(name) {
753
+ this._name = name;
754
+ }
755
+ constructor(props) {
756
+ super(StorybookError.getFullMessage(props), props.cause === void 0 ? void 0 : { cause: props.cause });
757
+ this.data = {};
758
+ this.fromStorybook = true;
759
+ this.isHandledError = false;
760
+ this.subErrors = [];
761
+ this.category = props.category;
762
+ this.documentation = props.documentation ?? false;
763
+ this.code = props.code;
764
+ this.isHandledError = props.isHandledError ?? false;
765
+ this.agentFacing = props.agentFacing ?? false;
766
+ this.name = props.name;
767
+ this.subErrors = props.subErrors ?? [];
768
+ }
769
+ /** Generates the error message along with additional documentation link (if applicable). */
770
+ static getFullMessage({ documentation, code, category, message }) {
771
+ let page;
772
+ if (documentation === true) page = `https://storybook.js.org/error/${parseErrorCode({
773
+ code,
774
+ category
775
+ })}?ref=error`;
776
+ else if (typeof documentation === "string") page = appendErrorRef(documentation);
777
+ else if (Array.isArray(documentation)) page = `\n${documentation.map((doc) => `\t- ${appendErrorRef(doc)}`).join("\n")}`;
778
+ return `${message}${page != null ? `\n\nMore info: ${page}\n` : ""}`;
779
+ }
780
+ };
781
+ })))();
782
+ }
783
+ //#endregion
784
+ //#region src/server-errors.ts
785
+ var StatusTypeIdMismatchError;
786
+ function init_server_errors() {
787
+ return (init_server_errors = __esmMin((() => {
788
+ init_storybook_error();
789
+ StatusTypeIdMismatchError = class extends StorybookError {
790
+ constructor(data) {
791
+ super({
792
+ name: "StatusTypeIdMismatchError",
793
+ category: "CORE-SERVER",
794
+ code: 16,
795
+ message: `Status has typeId "${data.status.typeId}" but was added to store with typeId "${data.typeId}". Full status: ${JSON.stringify(data.status, null, 2)}`
796
+ });
797
+ this.data = data;
798
+ }
799
+ };
800
+ })))();
801
+ }
802
+ //#endregion
803
+ //#region src/shared/status-store/index.ts
804
+ function countStatusesByValue(allStatuses) {
805
+ const counts = {};
806
+ for (const statusByTypeId of Object.values(allStatuses)) for (const status of Object.values(statusByTypeId)) counts[status.value] = (counts[status.value] ?? 0) + 1;
807
+ return counts;
808
+ }
809
+ function createStatusStore({ universalStatusStore, useUniversalStore, environment }) {
810
+ const fullStatusStore = {
811
+ getAll() {
812
+ return universalStatusStore.getState();
813
+ },
814
+ set(statuses) {
815
+ universalStatusStore.setState((state) => {
816
+ const newState = { ...state };
817
+ for (const status of statuses) {
818
+ const { storyId, typeId } = status;
819
+ newState[storyId] = {
820
+ ...newState[storyId] ?? {},
821
+ [typeId]: status
822
+ };
823
+ }
824
+ return newState;
825
+ });
826
+ },
827
+ onAllStatusChange(listener) {
828
+ return universalStatusStore.onStateChange((state, prevState) => {
829
+ listener(state, prevState);
830
+ });
831
+ },
832
+ onSelect(listener) {
833
+ return universalStatusStore.subscribe(StatusStoreEventType.SELECT, (event) => {
834
+ listener(event.payload);
835
+ });
836
+ },
837
+ selectStatuses: (statuses) => {
838
+ universalStatusStore.send({
839
+ type: StatusStoreEventType.SELECT,
840
+ payload: statuses
841
+ });
842
+ },
843
+ unset(storyIds) {
844
+ if (!storyIds) {
845
+ universalStatusStore.setState({});
846
+ return;
847
+ }
848
+ universalStatusStore.setState((state) => {
849
+ const newState = { ...state };
850
+ for (const storyId of storyIds) delete newState[storyId];
851
+ return newState;
852
+ });
853
+ },
854
+ typeId: void 0
855
+ };
856
+ const getStatusStoreByTypeId = (typeId) => ({
857
+ getAll: fullStatusStore.getAll,
858
+ set(statuses) {
859
+ universalStatusStore.setState((state) => {
860
+ const newState = { ...state };
861
+ for (const status of statuses) {
862
+ const { storyId } = status;
863
+ if (status.typeId !== typeId) switch (environment) {
864
+ case "server": throw new StatusTypeIdMismatchError({
865
+ status,
866
+ typeId
867
+ });
868
+ case "manager": throw new StatusTypeIdMismatchError$1({
869
+ status,
870
+ typeId
871
+ });
872
+ default: throw new StatusTypeIdMismatchError$2({
873
+ status,
874
+ typeId
875
+ });
876
+ }
877
+ newState[storyId] = {
878
+ ...newState[storyId] ?? {},
879
+ [typeId]: status
880
+ };
881
+ }
882
+ return newState;
883
+ });
884
+ },
885
+ onAllStatusChange: fullStatusStore.onAllStatusChange,
886
+ onSelect(listener) {
887
+ return universalStatusStore.subscribe(StatusStoreEventType.SELECT, (event) => {
888
+ if (event.payload.some((status) => status.typeId === typeId)) listener(event.payload);
889
+ });
890
+ },
891
+ unset(storyIds) {
892
+ universalStatusStore.setState((state) => {
893
+ const newState = { ...state };
894
+ for (const storyId in newState) if (newState[storyId]?.[typeId] && (!storyIds || storyIds?.includes(storyId))) {
895
+ const { [typeId]: omittedStatus, ...storyStatusesWithoutTypeId } = newState[storyId];
896
+ newState[storyId] = storyStatusesWithoutTypeId;
897
+ }
898
+ return newState;
899
+ });
900
+ },
901
+ typeId
902
+ });
903
+ if (!useUniversalStore) return {
904
+ getStatusStoreByTypeId,
905
+ fullStatusStore,
906
+ universalStatusStore
907
+ };
908
+ return {
909
+ getStatusStoreByTypeId,
910
+ fullStatusStore,
911
+ universalStatusStore,
912
+ useStatusStore: (selector) => useUniversalStore(universalStatusStore, selector)[0]
913
+ };
914
+ }
915
+ var statusValueShortName, statusValueDescription, UNIVERSAL_STATUS_STORE_OPTIONS, StatusStoreEventType;
916
+ function init_status_store() {
917
+ return (init_status_store = __esmMin((() => {
918
+ init_manager_errors();
919
+ init_preview_errors();
920
+ init_server_errors();
921
+ statusValueShortName = (value) => {
922
+ if (value === "status-value:affected") return "related";
923
+ return value.slice(13);
924
+ };
925
+ statusValueDescription = (value) => ({
926
+ "status-value:pending": "Stories with pending status",
927
+ "status-value:success": "Stories with passing tests",
928
+ "status-value:new": "Newly added stories",
929
+ "status-value:modified": "Stories closely linked to code changes",
930
+ "status-value:affected": "Stories likely to be affected by code changes",
931
+ "status-value:reviewing": "Stories included in the active review",
932
+ "status-value:warning": "Stories with warnings",
933
+ "status-value:error": "Stories with failing tests",
934
+ "status-value:unknown": "Stories with unknown status"
935
+ })[value];
936
+ UNIVERSAL_STATUS_STORE_OPTIONS = {
937
+ id: "@aussieljk/forkbook/status",
938
+ leader: true,
939
+ initialState: {}
940
+ };
941
+ StatusStoreEventType = { SELECT: "select" };
942
+ })))();
943
+ }
944
+ //#endregion
945
+ //#region src/shared/universal-store/first-party-store-ids.ts
946
+ var FIRST_PARTY_STORE_IDS, isFirstPartyStoreId;
947
+ function init_first_party_store_ids() {
948
+ return (init_first_party_store_ids = __esmMin((() => {
949
+ FIRST_PARTY_STORE_IDS = /* @__PURE__ */ new Set([
950
+ "@aussieljk/forkbook/status",
951
+ "@aussieljk/forkbook/test-provider",
952
+ "@aussieljk/forkbook/test"
953
+ ]);
954
+ isFirstPartyStoreId = (id) => FIRST_PARTY_STORE_IDS.has(id);
955
+ })))();
956
+ }
957
+ //#endregion
958
+ //#region src/shared/universal-store/instances.ts
959
+ var instances;
960
+ function init_instances() {
961
+ return (init_instances = __esmMin((() => {
962
+ instances = /* @__PURE__ */ new Map();
963
+ })))();
964
+ }
965
+ //#endregion
966
+ //#region src/shared/universal-store/index.ts
967
+ var CHANNEL_EVENT_PREFIX, ProgressState, UniversalStore;
968
+ function init_universal_store() {
969
+ return (init_universal_store = __esmMin((() => {
970
+ init_esm();
971
+ init_manager_errors();
972
+ init_first_party_store_ids();
973
+ init_instances();
974
+ CHANNEL_EVENT_PREFIX = "UNIVERSAL_STORE:";
975
+ ProgressState = {
976
+ PENDING: "PENDING",
977
+ RESOLVED: "RESOLVED",
978
+ REJECTED: "REJECTED"
979
+ };
980
+ UniversalStore = class UniversalStore {
981
+ static {
982
+ this.ActorType = {
983
+ LEADER: "LEADER",
984
+ FOLLOWER: "FOLLOWER"
985
+ };
986
+ }
987
+ static {
988
+ this.Environment = {
989
+ SERVER: "SERVER",
990
+ MANAGER: "MANAGER",
991
+ PREVIEW: "PREVIEW",
992
+ UNKNOWN: "UNKNOWN",
993
+ MOCK: "MOCK"
994
+ };
995
+ }
996
+ /** The environment this realm was prepared as, or `undefined` before `__prepare`. */
997
+ static get preparedEnvironment() {
998
+ return UniversalStore.preparation.environment;
999
+ }
1000
+ static {
1001
+ this.InternalEventType = {
1002
+ EXISTING_STATE_REQUEST: "__EXISTING_STATE_REQUEST",
1003
+ EXISTING_STATE_RESPONSE: "__EXISTING_STATE_RESPONSE",
1004
+ SET_STATE: "__SET_STATE",
1005
+ LEADER_CREATED: "__LEADER_CREATED",
1006
+ FOLLOWER_CREATED: "__FOLLOWER_CREATED"
1007
+ };
1008
+ }
1009
+ static {
1010
+ this.Status = {
1011
+ UNPREPARED: "UNPREPARED",
1012
+ SYNCING: "SYNCING",
1013
+ READY: "READY",
1014
+ ERROR: "ERROR"
1015
+ };
1016
+ }
1017
+ static {
1018
+ this.isInternalConstructing = false;
1019
+ }
1020
+ static {
1021
+ UniversalStore.setupPreparationPromise();
1022
+ }
1023
+ static setupPreparationPromise() {
1024
+ let resolveRef;
1025
+ let rejectRef;
1026
+ const promise = new Promise((resolve, reject) => {
1027
+ resolveRef = (args) => {
1028
+ resolve(args);
1029
+ };
1030
+ rejectRef = (...args) => {
1031
+ reject(args);
1032
+ };
1033
+ });
1034
+ UniversalStore.preparation = {
1035
+ resolve: resolveRef,
1036
+ reject: rejectRef,
1037
+ promise
1038
+ };
1039
+ }
1040
+ /** The actor object representing the store instance with a unique ID and a type */
1041
+ get actor() {
1042
+ return Object.freeze({
1043
+ id: this.actorId,
1044
+ type: this.actorType,
1045
+ environment: this.environment ?? UniversalStore.Environment.UNKNOWN
1046
+ });
1047
+ }
1048
+ /**
1049
+ * The current state of the store, that signals both if the store is prepared by Forkbook and
1050
+ * also - in the case of a follower - if the state has been synced with the leader's state.
1051
+ */
1052
+ get status() {
1053
+ if (!this.channel || !this.environment) return UniversalStore.Status.UNPREPARED;
1054
+ switch (this.syncing?.state) {
1055
+ case ProgressState.PENDING:
1056
+ case void 0: return UniversalStore.Status.SYNCING;
1057
+ case ProgressState.REJECTED: return UniversalStore.Status.ERROR;
1058
+ case ProgressState.RESOLVED:
1059
+ default: return UniversalStore.Status.READY;
1060
+ }
1061
+ }
1062
+ /**
1063
+ * A promise that resolves when the store is fully ready. A leader will be ready when the store
1064
+ * has been prepared by Forkbook, which is almost instantly.
1065
+ *
1066
+ * A follower will be ready when the state has been synced with the leader's state, within a few
1067
+ * hundred milliseconds.
1068
+ */
1069
+ untilReady() {
1070
+ const preparation = this.channel && this.environment ? Promise.resolve() : UniversalStore.preparation.promise;
1071
+ return Promise.all([preparation, this.syncing?.promise]);
1072
+ }
1073
+ constructor(options, environmentOverrides) {
1074
+ this.debugging = false;
1075
+ this.listeners = /* @__PURE__ */ new Map([["*", /* @__PURE__ */ new Set()]]);
1076
+ this.getState = () => {
1077
+ this.debug("getState", { state: this.state });
1078
+ return this.state;
1079
+ };
1080
+ this.subscribe = (eventTypeOrListener, maybeListener) => {
1081
+ const subscribesToAllEvents = typeof eventTypeOrListener === "function";
1082
+ const eventType = subscribesToAllEvents ? "*" : eventTypeOrListener;
1083
+ const listener = subscribesToAllEvents ? eventTypeOrListener : maybeListener;
1084
+ this.debug("subscribe", {
1085
+ eventType,
1086
+ listener
1087
+ });
1088
+ if (!listener) throw new TypeError(`Missing first subscribe argument, or second if first is the event type, when subscribing to a UniversalStore with id '${this.id}'`);
1089
+ if (!this.listeners.has(eventType)) this.listeners.set(eventType, /* @__PURE__ */ new Set());
1090
+ this.listeners.get(eventType).add(listener);
1091
+ return () => {
1092
+ this.debug("unsubscribe", {
1093
+ eventType,
1094
+ listener
1095
+ });
1096
+ if (!this.listeners.has(eventType)) return;
1097
+ this.listeners.get(eventType).delete(listener);
1098
+ if (this.listeners.get(eventType)?.size === 0) this.listeners.delete(eventType);
1099
+ };
1100
+ };
1101
+ this.send = (event) => {
1102
+ this.debug("send", { event });
1103
+ if (this.status !== UniversalStore.Status.READY) throw new TypeError(dedent`Cannot send event before store is ready. You can get the current status with store.status,
1104
+ or await store.readyPromise to wait for the store to be ready before sending events.
1105
+ ${JSON.stringify({
1106
+ event,
1107
+ id: this.id,
1108
+ actor: this.actor,
1109
+ environment: this.environment
1110
+ }, null, 2)}`);
1111
+ this.emitToListeners(event, { actor: this.actor });
1112
+ this.emitToChannel(event, { actor: this.actor });
1113
+ };
1114
+ this.debugging = options.debug ?? false;
1115
+ if (!UniversalStore.isInternalConstructing) throw new TypeError("UniversalStore is not constructable - use UniversalStore.create() instead");
1116
+ UniversalStore.isInternalConstructing = false;
1117
+ this.id = options.id;
1118
+ this.actorId = Date.now().toString(36) + Math.random().toString(36).substring(2);
1119
+ this.actorType = options.leader ? UniversalStore.ActorType.LEADER : UniversalStore.ActorType.FOLLOWER;
1120
+ this.state = options.initialState;
1121
+ this.channelEventName = `${CHANNEL_EVENT_PREFIX}${this.id}`;
1122
+ this.debug("constructor", {
1123
+ options,
1124
+ environmentOverrides,
1125
+ channelEventName: this.channelEventName
1126
+ });
1127
+ if (this.actor.type === UniversalStore.ActorType.LEADER) this.syncing = {
1128
+ state: ProgressState.RESOLVED,
1129
+ promise: Promise.resolve()
1130
+ };
1131
+ else {
1132
+ let syncingResolve;
1133
+ let syncingReject;
1134
+ const syncingPromise = new Promise((resolve, reject) => {
1135
+ syncingResolve = () => {
1136
+ if (this.syncing.state !== ProgressState.PENDING) return;
1137
+ this.syncing.state = ProgressState.RESOLVED;
1138
+ resolve();
1139
+ };
1140
+ syncingReject = (reason) => {
1141
+ if (this.syncing.state !== ProgressState.PENDING) return;
1142
+ this.syncing.state = ProgressState.REJECTED;
1143
+ reject(reason);
1144
+ };
1145
+ });
1146
+ this.syncing = {
1147
+ state: ProgressState.PENDING,
1148
+ promise: syncingPromise,
1149
+ resolve: syncingResolve,
1150
+ reject: syncingReject
1151
+ };
1152
+ }
1153
+ this.getState = this.getState.bind(this);
1154
+ this.setState = this.setState.bind(this);
1155
+ this.subscribe = this.subscribe.bind(this);
1156
+ this.onStateChange = this.onStateChange.bind(this);
1157
+ this.send = this.send.bind(this);
1158
+ this.emitToChannel = this.emitToChannel.bind(this);
1159
+ this.prepareThis = this.prepareThis.bind(this);
1160
+ this.emitToListeners = this.emitToListeners.bind(this);
1161
+ this.handleChannelEvents = this.handleChannelEvents.bind(this);
1162
+ this.debug = this.debug.bind(this);
1163
+ this.channel = environmentOverrides?.channel ?? UniversalStore.preparation.channel;
1164
+ this.environment = environmentOverrides?.environment ?? UniversalStore.preparation.environment;
1165
+ if (this.channel && this.environment) {
1166
+ if (!environmentOverrides) UniversalStore.preparation.resolve({
1167
+ channel: this.channel,
1168
+ environment: this.environment
1169
+ });
1170
+ this.prepareThis({
1171
+ channel: this.channel,
1172
+ environment: this.environment
1173
+ });
1174
+ } else UniversalStore.preparation.promise.then(this.prepareThis);
1175
+ }
1176
+ /** Creates a new instance of UniversalStore */
1177
+ static create(options) {
1178
+ if (!options || typeof options?.id !== "string") throw new TypeError("id is required and must be a string, when creating a UniversalStore");
1179
+ if (!isFirstPartyStoreId(options.id)) throw new TypeError(`UniversalStore is internal to Forkbook and cannot create a store with id "${options.id}"`);
1180
+ if (options.debug) console.debug(dedent`[UniversalStore]
1181
+ create`, { options });
1182
+ const existing = instances.get(options.id);
1183
+ if (existing) {
1184
+ console.warn(dedent`UniversalStore with id "${options.id}" already exists in this environment, re-using existing.
1185
+ You should reuse the existing instance instead of trying to create a new one.`);
1186
+ return existing;
1187
+ }
1188
+ UniversalStore.isInternalConstructing = true;
1189
+ const store = new UniversalStore(options);
1190
+ instances.set(options.id, store);
1191
+ return store;
1192
+ }
1193
+ /**
1194
+ * Used by Forkbook to set the channel for all instances of UniversalStore in the given
1195
+ * environment.
1196
+ *
1197
+ * @internal
1198
+ */
1199
+ static __prepare(channel, environment) {
1200
+ UniversalStore.preparation.channel = channel;
1201
+ UniversalStore.preparation.environment = environment;
1202
+ UniversalStore.preparation.resolve({
1203
+ channel,
1204
+ environment
1205
+ });
1206
+ }
1207
+ /**
1208
+ * Updates the store's state
1209
+ *
1210
+ * Either a new state or a state updater function can be passed to the method.
1211
+ */
1212
+ setState(updater) {
1213
+ const previousState = this.state;
1214
+ const newState = typeof updater === "function" ? updater(previousState) : updater;
1215
+ this.debug("setState", {
1216
+ newState,
1217
+ previousState,
1218
+ updater
1219
+ });
1220
+ if (this.status !== UniversalStore.Status.READY) throw new TypeError(dedent`Cannot set state before store is ready. You can get the current status with store.status,
1221
+ or await store.readyPromise to wait for the store to be ready before sending events.
1222
+ ${JSON.stringify({
1223
+ newState,
1224
+ id: this.id,
1225
+ actor: this.actor,
1226
+ environment: this.environment
1227
+ }, null, 2)}`);
1228
+ this.state = newState;
1229
+ const event = {
1230
+ type: UniversalStore.InternalEventType.SET_STATE,
1231
+ payload: {
1232
+ state: newState,
1233
+ previousState
1234
+ }
1235
+ };
1236
+ this.emitToChannel(event, { actor: this.actor });
1237
+ this.emitToListeners(event, { actor: this.actor });
1238
+ }
1239
+ /**
1240
+ * Subscribes to state changes
1241
+ *
1242
+ * @returns Unsubscribe function
1243
+ */
1244
+ onStateChange(listener) {
1245
+ this.debug("onStateChange", { listener });
1246
+ return this.subscribe(UniversalStore.InternalEventType.SET_STATE, ({ payload }, eventInfo) => {
1247
+ listener(payload.state, payload.previousState, eventInfo);
1248
+ });
1249
+ }
1250
+ emitToChannel(event, eventInfo) {
1251
+ this.debug("emitToChannel", {
1252
+ event,
1253
+ eventInfo,
1254
+ channel: !!this.channel
1255
+ });
1256
+ this.channel?.emit(this.channelEventName, {
1257
+ event,
1258
+ eventInfo
1259
+ });
1260
+ }
1261
+ prepareThis({ channel, environment }) {
1262
+ this.channel = channel;
1263
+ this.environment = environment;
1264
+ this.debug("prepared", {
1265
+ channel: !!channel,
1266
+ environment
1267
+ });
1268
+ this.channel.on(this.channelEventName, this.handleChannelEvents);
1269
+ if (this.actor.type === UniversalStore.ActorType.LEADER) this.emitToChannel({ type: UniversalStore.InternalEventType.LEADER_CREATED }, { actor: this.actor });
1270
+ else {
1271
+ this.emitToChannel({ type: UniversalStore.InternalEventType.FOLLOWER_CREATED }, { actor: this.actor });
1272
+ this.emitToChannel({ type: UniversalStore.InternalEventType.EXISTING_STATE_REQUEST }, { actor: this.actor });
1273
+ setTimeout(() => {
1274
+ this.syncing.reject(new UniversalStoreFollowerTimeoutError(this.id));
1275
+ }, 1e3);
1276
+ }
1277
+ }
1278
+ emitToListeners(event, eventInfo) {
1279
+ const eventTypeListeners = this.listeners.get(event.type);
1280
+ const everythingListeners = this.listeners.get("*");
1281
+ this.debug("emitToListeners", {
1282
+ event,
1283
+ eventInfo,
1284
+ eventTypeListeners,
1285
+ everythingListeners
1286
+ });
1287
+ [...eventTypeListeners ?? [], ...everythingListeners ?? []].forEach((listener) => listener(event, eventInfo));
1288
+ }
1289
+ handleChannelEvents(channelEvent) {
1290
+ const { event, eventInfo } = channelEvent;
1291
+ if ([eventInfo.actor.id, eventInfo.forwardingActor?.id].includes(this.actor.id)) {
1292
+ this.debug("handleChannelEvents: Ignoring event from self", { channelEvent });
1293
+ return;
1294
+ } else if (this.syncing?.state === ProgressState.PENDING && event.type !== UniversalStore.InternalEventType.EXISTING_STATE_RESPONSE) {
1295
+ this.debug("handleChannelEvents: Ignoring event while syncing", { channelEvent });
1296
+ return;
1297
+ }
1298
+ this.debug("handleChannelEvents", { channelEvent });
1299
+ if (this.actor.type === UniversalStore.ActorType.LEADER) {
1300
+ let shouldForwardEvent = true;
1301
+ switch (event.type) {
1302
+ case UniversalStore.InternalEventType.EXISTING_STATE_REQUEST:
1303
+ shouldForwardEvent = false;
1304
+ const responseEvent = {
1305
+ type: UniversalStore.InternalEventType.EXISTING_STATE_RESPONSE,
1306
+ payload: this.state
1307
+ };
1308
+ this.debug("handleChannelEvents: responding to existing state request", { responseEvent });
1309
+ this.emitToChannel(responseEvent, { actor: this.actor });
1310
+ this.emitToListeners(responseEvent, { actor: this.actor });
1311
+ break;
1312
+ case UniversalStore.InternalEventType.LEADER_CREATED:
1313
+ shouldForwardEvent = false;
1314
+ this.syncing.state = ProgressState.REJECTED;
1315
+ this.debug("handleChannelEvents: erroring due to second leader being created", { event });
1316
+ console.error(dedent`Detected multiple UniversalStore leaders created with the same id "${this.id}".
1317
+ Only one leader can exists at a time, your stores are now in an invalid state.
1318
+ Leaders detected:
1319
+ this: ${JSON.stringify(this.actor, null, 2)}
1320
+ other: ${JSON.stringify(eventInfo.actor, null, 2)}`);
1321
+ }
1322
+ if (shouldForwardEvent) {
1323
+ this.debug("handleChannelEvents: forwarding event", { channelEvent });
1324
+ this.emitToChannel(event, {
1325
+ actor: eventInfo.actor,
1326
+ forwardingActor: this.actor
1327
+ });
1328
+ }
1329
+ }
1330
+ if (this.actor.type === UniversalStore.ActorType.FOLLOWER) switch (event.type) {
1331
+ case UniversalStore.InternalEventType.EXISTING_STATE_RESPONSE:
1332
+ this.debug("handleChannelEvents: Setting state from leader's existing state response", { event });
1333
+ if (this.syncing?.state !== ProgressState.PENDING) break;
1334
+ this.syncing.resolve?.();
1335
+ const setStateEvent = {
1336
+ type: UniversalStore.InternalEventType.SET_STATE,
1337
+ payload: {
1338
+ state: event.payload,
1339
+ previousState: this.state
1340
+ }
1341
+ };
1342
+ this.state = event.payload;
1343
+ this.emitToListeners(setStateEvent, eventInfo);
1344
+ }
1345
+ switch (event.type) {
1346
+ case UniversalStore.InternalEventType.SET_STATE:
1347
+ this.debug("handleChannelEvents: Setting state", { event });
1348
+ this.state = event.payload.state;
1349
+ }
1350
+ this.emitToListeners(event, { actor: eventInfo.actor });
1351
+ }
1352
+ debug(message, data) {
1353
+ if (this.debugging) console.debug(dedent`[UniversalStore::${this.id}::${this.environment ?? UniversalStore.Environment.UNKNOWN}]
1354
+ ${message}`, JSON.stringify({
1355
+ data,
1356
+ actor: this.actor,
1357
+ state: this.state,
1358
+ status: this.status
1359
+ }, null, 2));
1360
+ }
1361
+ /**
1362
+ * Used to reset the static fields of the UniversalStore class when cleaning up tests
1363
+ *
1364
+ * @internal
1365
+ */
1366
+ static __reset() {
1367
+ UniversalStore.preparation.reject(/* @__PURE__ */ new Error("reset"));
1368
+ UniversalStore.setupPreparationPromise();
1369
+ UniversalStore.isInternalConstructing = false;
1370
+ }
1371
+ };
1372
+ })))();
1373
+ }
1374
+ //#endregion
1375
+ //#region src/shared/universal-store/use-universal-store-manager.ts
1376
+ var useUniversalStore;
1377
+ function init_use_universal_store_manager() {
1378
+ return (init_use_universal_store_manager = __esmMin((() => {
1379
+ init__storybook_global_react();
1380
+ init_isEqual();
1381
+ useUniversalStore = (universalStore, selector) => {
1382
+ const snapshotRef = useRef(selector ? selector(universalStore.getState()) : universalStore.getState());
1383
+ const subscribe = useCallback((listener) => universalStore.onStateChange((state, previousState) => {
1384
+ if (!selector) {
1385
+ snapshotRef.current = state;
1386
+ listener();
1387
+ return;
1388
+ }
1389
+ const selectedState = selector(state);
1390
+ const selectedPreviousState = selector(previousState);
1391
+ if (!isEqual(selectedState, selectedPreviousState)) {
1392
+ snapshotRef.current = selectedState;
1393
+ listener();
1394
+ }
1395
+ }), [universalStore, selector]);
1396
+ const getSnapshot = useCallback(() => {
1397
+ const currentState = universalStore.getState();
1398
+ const selectedState = selector ? selector(currentState) : currentState;
1399
+ if (isEqual(selectedState, snapshotRef.current)) return snapshotRef.current;
1400
+ snapshotRef.current = selectedState;
1401
+ return snapshotRef.current;
1402
+ }, [universalStore, selector]);
1403
+ return [useSyncExternalStore(subscribe, getSnapshot), universalStore.setState];
1404
+ };
1405
+ })))();
1406
+ }
1407
+ //#endregion
1408
+ export { useCopyButton as A, iframeResizeDimensionsEqual as C, REVIEW_NAMESPACE as D, REVIEW_EVENTS as E, ToolbarManager as F, init_ToolbarManager as I, TOOLBAR_ID as L, init_routes as M, isReviewCollectionStoryRoute as N, init_events as O, isReviewSummaryPath as P, init_constants as R, hasFixedViewportDimensions as S, parseIframeResizeMessage as T, init_tags as _, UNIVERSAL_STATUS_STORE_OPTIONS as a, init_resolveViewport as b, init_status_store as c, StorybookError as d, init_storybook_error as f, USER_TAG_FILTER as g, BUILT_IN_FILTERS as h, init_universal_store as i, REVIEW_COLLECTION_QUERY_PARAM as j, init_useCopyButton as k, statusValueDescription as l, init_story_index_filters as m, useUniversalStore as n, countStatusesByValue as o, getActiveFilterCount as p, UniversalStore as r, createStatusStore as s, init_use_universal_store_manager as t, statusValueShortName as u, init_useViewport as v, init_iframe_resize as w, IFRAME_RESIZE_REQUEST_CONTEXT as x, useViewport as y };