@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.
- package/LICENSE +22 -0
- package/README.md +77 -2
- package/assets/addon-vitest/templates/vitest.config.4.template.ts +36 -0
- package/assets/browser/favicon-wrapper.svg +46 -0
- package/assets/browser/favicon.svg +1 -0
- package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-bold.woff2 +0 -0
- package/assets/browser/nunito-sans-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-regular.woff2 +0 -0
- package/assets/builder-vite/iframe.html +99 -0
- package/assets/create/rendererAssets/.eslintrc.json +16 -0
- package/assets/create/rendererAssets/common/Configure.mdx +388 -0
- package/assets/create/rendererAssets/common/assets/accessibility.png +0 -0
- package/assets/create/rendererAssets/common/assets/accessibility.svg +1 -0
- package/assets/create/rendererAssets/common/assets/addon-library.png +0 -0
- package/assets/create/rendererAssets/common/assets/assets.png +0 -0
- package/assets/create/rendererAssets/common/assets/avif-test-image.avif +0 -0
- package/assets/create/rendererAssets/common/assets/context.png +0 -0
- package/assets/create/rendererAssets/common/assets/discord.svg +1 -0
- package/assets/create/rendererAssets/common/assets/docs.png +0 -0
- package/assets/create/rendererAssets/common/assets/figma-plugin.png +0 -0
- package/assets/create/rendererAssets/common/assets/github.svg +1 -0
- package/assets/create/rendererAssets/common/assets/share.png +0 -0
- package/assets/create/rendererAssets/common/assets/styling.png +0 -0
- package/assets/create/rendererAssets/common/assets/testing.png +0 -0
- package/assets/create/rendererAssets/common/assets/theming.png +0 -0
- package/assets/create/rendererAssets/common/assets/tutorials.svg +1 -0
- package/assets/create/rendererAssets/common/assets/youtube.svg +1 -0
- package/assets/create/rendererAssets/common/button.css +30 -0
- package/assets/create/rendererAssets/common/header.css +32 -0
- package/assets/create/rendererAssets/common/page.css +68 -0
- package/assets/create/templates/react-native/index.expo.js +20 -0
- package/assets/create/templates/react-native/index.js +25 -0
- package/assets/docs/addon-backgrounds.gif +0 -0
- package/assets/docs/addon-controls-args-annotated.png +0 -0
- package/assets/docs/addon-controls-args-background-color.png +0 -0
- package/assets/docs/addon-controls-args-background-string.png +0 -0
- package/assets/docs/addon-controls-args-docs.png +0 -0
- package/assets/docs/addon-controls-args-logging.png +0 -0
- package/assets/docs/addon-controls-args-no-annotation.png +0 -0
- package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
- package/assets/docs/addon-controls-args-reflow.png +0 -0
- package/assets/docs/addon-controls-args-template.png +0 -0
- package/assets/docs/addon-controls-expanded.png +0 -0
- package/assets/docs/addon-controls-hero.gif +0 -0
- package/assets/docs/addon-controls-install.png +0 -0
- package/assets/docs/hero.gif +0 -0
- package/assets/docs/highlight.png +0 -0
- package/assets/docs/message-reference.png +0 -0
- package/assets/docs/viewport.png +0 -0
- package/assets/react-native/metro-env.d.ts +69 -0
- package/assets/server/addon.tsconfig.json +6 -0
- package/assets/server/base-preview-body.html +116 -0
- package/assets/server/base-preview-head.html +494 -0
- package/assets/server/openBrowser.applescript +94 -0
- package/assets/server/template.ejs +87 -0
- package/dist/.build-stamp +0 -0
- package/dist/_browser-chunks/Color-PCLE2J36.js +1025 -0
- package/dist/_browser-chunks/DocsRenderer-JXND3PVQ.js +10 -0
- package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +1619 -0
- package/dist/_browser-chunks/chunk-2JDQ35OA.js +247 -0
- package/dist/_browser-chunks/chunk-2JT76G3E.js +104 -0
- package/dist/_browser-chunks/chunk-2MEPHP35.js +17 -0
- package/dist/_browser-chunks/chunk-2SCZVUKW.js +24 -0
- package/dist/_browser-chunks/chunk-46Z7NGAS.js +41 -0
- package/dist/_browser-chunks/chunk-4ATQOMJB.js +30 -0
- package/dist/_browser-chunks/chunk-52CW7FF7.js +49 -0
- package/dist/_browser-chunks/chunk-5I7E4GMO.js +62 -0
- package/dist/_browser-chunks/chunk-5P4QA6MY.js +20 -0
- package/dist/_browser-chunks/chunk-5WMXI5GW.js +816 -0
- package/dist/_browser-chunks/chunk-66OCZ54D.js +2604 -0
- package/dist/_browser-chunks/chunk-6SXYJQST.js +253 -0
- package/dist/_browser-chunks/chunk-AYRF6EJB.js +36 -0
- package/dist/_browser-chunks/chunk-B4AUNNU4.js +156 -0
- package/dist/_browser-chunks/chunk-BCP2FFXF.js +369 -0
- package/dist/_browser-chunks/chunk-C3D4HEFY.js +3396 -0
- package/dist/_browser-chunks/chunk-CFAOWGL7.js +43 -0
- package/dist/_browser-chunks/chunk-CFWWCCZV.js +223 -0
- package/dist/_browser-chunks/chunk-CNED6RYH.js +18 -0
- package/dist/_browser-chunks/chunk-DRQKCCAG.js +136 -0
- package/dist/_browser-chunks/chunk-ECQ75MKQ.js +0 -0
- package/dist/_browser-chunks/chunk-EIYAKDGP.js +302 -0
- package/dist/_browser-chunks/chunk-ENKK74N4.js +12 -0
- package/dist/_browser-chunks/chunk-FENFYI4X.js +698 -0
- package/dist/_browser-chunks/chunk-FJGWSWL5.js +155 -0
- package/dist/_browser-chunks/chunk-FVSEPWWX.js +2810 -0
- package/dist/_browser-chunks/chunk-GNZY6LOW.js +10116 -0
- package/dist/_browser-chunks/chunk-IE4ULIOQ.js +14 -0
- package/dist/_browser-chunks/chunk-IMSF75WX.js +42 -0
- package/dist/_browser-chunks/chunk-IWQGIXJS.js +14 -0
- package/dist/_browser-chunks/chunk-JMC7AIKT.js +108 -0
- package/dist/_browser-chunks/chunk-JPUOQJUI.js +8 -0
- package/dist/_browser-chunks/chunk-JSBKXXXF.js +218 -0
- package/dist/_browser-chunks/chunk-JWSKPMPC.js +73 -0
- package/dist/_browser-chunks/chunk-JYVGARBG.js +2943 -0
- package/dist/_browser-chunks/chunk-KBK7GKBN.js +35 -0
- package/dist/_browser-chunks/chunk-KQ7CRO2B.js +108 -0
- package/dist/_browser-chunks/chunk-LAWXTSXK.js +18 -0
- package/dist/_browser-chunks/chunk-LE2LTDW3.js +14 -0
- package/dist/_browser-chunks/chunk-LEVSOOLQ.js +48 -0
- package/dist/_browser-chunks/chunk-LV5PIKV4.js +93 -0
- package/dist/_browser-chunks/chunk-MDOL7KML.js +56 -0
- package/dist/_browser-chunks/chunk-MFMDGWP6.js +34 -0
- package/dist/_browser-chunks/chunk-MLBOOZL4.js +67 -0
- package/dist/_browser-chunks/chunk-NQUD4B7H.js +91 -0
- package/dist/_browser-chunks/chunk-NULBREPZ.js +43 -0
- package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
- package/dist/_browser-chunks/chunk-OD6IBQCC.js +117 -0
- package/dist/_browser-chunks/chunk-ODVJ3XZJ.js +157 -0
- package/dist/_browser-chunks/chunk-OQWFVDIN.js +386 -0
- package/dist/_browser-chunks/chunk-OVH3USFB.js +20 -0
- package/dist/_browser-chunks/chunk-OZZPSYQR.js +14 -0
- package/dist/_browser-chunks/chunk-P6PK47TQ.js +1970 -0
- package/dist/_browser-chunks/chunk-PFRNG3UC.js +22 -0
- package/dist/_browser-chunks/chunk-PJSMZ27A.js +13 -0
- package/dist/_browser-chunks/chunk-QC4HFS6K.js +41 -0
- package/dist/_browser-chunks/chunk-QDXFODK4.js +274 -0
- package/dist/_browser-chunks/chunk-RBCHTR7C.js +28 -0
- package/dist/_browser-chunks/chunk-RMYQ3QN3.js +294 -0
- package/dist/_browser-chunks/chunk-RNTIV5CE.js +411 -0
- package/dist/_browser-chunks/chunk-RSPAQWVJ.js +80 -0
- package/dist/_browser-chunks/chunk-S6TK43XQ.js +836 -0
- package/dist/_browser-chunks/chunk-SC67XZST.js +18 -0
- package/dist/_browser-chunks/chunk-SFVA4SBT.js +683 -0
- package/dist/_browser-chunks/chunk-SZYFOQMT.js +25 -0
- package/dist/_browser-chunks/chunk-TBJCJXK4.js +18 -0
- package/dist/_browser-chunks/chunk-UMDO3KB7.js +205 -0
- package/dist/_browser-chunks/chunk-V2G23FV7.js +11 -0
- package/dist/_browser-chunks/chunk-V5M7Q4HT.js +88 -0
- package/dist/_browser-chunks/chunk-W5M6NPS3.js +198 -0
- package/dist/_browser-chunks/chunk-W7NE2JXW.js +84 -0
- package/dist/_browser-chunks/chunk-WGVAAM43.js +1110 -0
- package/dist/_browser-chunks/chunk-WHQRNHXD.js +8 -0
- package/dist/_browser-chunks/chunk-WOSOWBCA.js +12 -0
- package/dist/_browser-chunks/chunk-WZ7KR7SH.js +85 -0
- package/dist/_browser-chunks/chunk-YEKO6BHJ.js +20 -0
- package/dist/_browser-chunks/chunk-YI2IBIQS.js +7 -0
- package/dist/_browser-chunks/chunk-YTIT5NA5.js +1966 -0
- package/dist/_browser-chunks/chunk-ZEHRUHTA.js +6 -0
- package/dist/_browser-chunks/chunk-ZTQ5MEJ5.js +203 -0
- package/dist/_browser-chunks/matchers-YLBYSYAF.js +1263 -0
- package/dist/_browser-chunks/react-dom-client-4OHE3QDV.js +9 -0
- package/dist/_node-chunks/attached-runtime-I2G4WLJI.js +282 -0
- package/dist/_node-chunks/builder-manager-VVHYQXCH.js +1661 -0
- package/dist/_node-chunks/chunk-2BUPBPFB.js +82 -0
- package/dist/_node-chunks/chunk-2DSIDINN.js +884 -0
- package/dist/_node-chunks/chunk-2RU7BKEW.js +23 -0
- package/dist/_node-chunks/chunk-34EO2PUT.js +26 -0
- package/dist/_node-chunks/chunk-3BKIBF5S.js +3008 -0
- package/dist/_node-chunks/chunk-3SDUYDXH.js +98 -0
- package/dist/_node-chunks/chunk-3T4ZSNPH.js +662 -0
- package/dist/_node-chunks/chunk-3W7F2B7P.js +79 -0
- package/dist/_node-chunks/chunk-3Y6AAY5H.js +80 -0
- package/dist/_node-chunks/chunk-42UWAGPW.js +1193 -0
- package/dist/_node-chunks/chunk-4FEANXWU.js +1986 -0
- package/dist/_node-chunks/chunk-5DQFEZEA.js +40 -0
- package/dist/_node-chunks/chunk-6KEHV53S.js +1218 -0
- package/dist/_node-chunks/chunk-6LMWA44H.js +3837 -0
- package/dist/_node-chunks/chunk-6YKBRP72.js +20 -0
- package/dist/_node-chunks/chunk-7GUDZVRQ.js +110 -0
- package/dist/_node-chunks/chunk-B5J7Q7J4.js +21 -0
- package/dist/_node-chunks/chunk-BS2WMZMR.js +90 -0
- package/dist/_node-chunks/chunk-BSKFCWQD.js +47 -0
- package/dist/_node-chunks/chunk-BXVYT7SB.js +36 -0
- package/dist/_node-chunks/chunk-CCOTJ4FC.js +688 -0
- package/dist/_node-chunks/chunk-CQKMLL5J.js +33 -0
- package/dist/_node-chunks/chunk-CXRU72ET.js +63 -0
- package/dist/_node-chunks/chunk-DC7DKR5K.js +20 -0
- package/dist/_node-chunks/chunk-DHJFTB4K.js +25 -0
- package/dist/_node-chunks/chunk-DUR55DJJ.js +1094 -0
- package/dist/_node-chunks/chunk-E6YESGLX.js +7032 -0
- package/dist/_node-chunks/chunk-EHUNOMDD.js +52345 -0
- package/dist/_node-chunks/chunk-ET7PWEO7.js +298 -0
- package/dist/_node-chunks/chunk-EWOX7HPJ.js +20 -0
- package/dist/_node-chunks/chunk-F3ZFKBHY.js +844 -0
- package/dist/_node-chunks/chunk-FK7KGTV7.js +26 -0
- package/dist/_node-chunks/chunk-FPZB5OI7.js +35 -0
- package/dist/_node-chunks/chunk-FW2HQUBQ.js +25 -0
- package/dist/_node-chunks/chunk-FY6UXW6G.js +11 -0
- package/dist/_node-chunks/chunk-GEFQN7K3.js +499 -0
- package/dist/_node-chunks/chunk-GRBLDJCR.js +989 -0
- package/dist/_node-chunks/chunk-H32DYT6P.js +87 -0
- package/dist/_node-chunks/chunk-H4PPVMP5.js +23 -0
- package/dist/_node-chunks/chunk-HMP2G23X.js +25 -0
- package/dist/_node-chunks/chunk-ICPBH3E7.js +59 -0
- package/dist/_node-chunks/chunk-IDEL2J23.js +23 -0
- package/dist/_node-chunks/chunk-IK4FGZLR.js +223 -0
- package/dist/_node-chunks/chunk-JDXXX6LB.js +68 -0
- package/dist/_node-chunks/chunk-JGGFYIG5.js +5468 -0
- package/dist/_node-chunks/chunk-JPAZLYJ3.js +29 -0
- package/dist/_node-chunks/chunk-JZOO7GGC.js +48 -0
- package/dist/_node-chunks/chunk-KISMCCP5.js +4744 -0
- package/dist/_node-chunks/chunk-LCK4ZQKG.js +115 -0
- package/dist/_node-chunks/chunk-LO56I6E2.js +132 -0
- package/dist/_node-chunks/chunk-LXBD4UL4.js +104 -0
- package/dist/_node-chunks/chunk-MA24JW6C.js +7162 -0
- package/dist/_node-chunks/chunk-MK2KYAI6.js +5414 -0
- package/dist/_node-chunks/chunk-NDWKJ4CL.js +2102 -0
- package/dist/_node-chunks/chunk-NIBT7XDZ.js +168 -0
- package/dist/_node-chunks/chunk-NPO45IMH.js +33 -0
- package/dist/_node-chunks/chunk-OISX4AGQ.js +414 -0
- package/dist/_node-chunks/chunk-OUW6R7C3.js +26 -0
- package/dist/_node-chunks/chunk-OWNFOGTA.js +194 -0
- package/dist/_node-chunks/chunk-Q7QNUM5H.js +49 -0
- package/dist/_node-chunks/chunk-QEQLR22M.js +1877 -0
- package/dist/_node-chunks/chunk-RRN2V55B.js +45 -0
- package/dist/_node-chunks/chunk-RWFIFGO5.js +144 -0
- package/dist/_node-chunks/chunk-RXNJDRGO.js +209 -0
- package/dist/_node-chunks/chunk-RZMQ7S3L.js +92 -0
- package/dist/_node-chunks/chunk-SIEXZVCR.js +51 -0
- package/dist/_node-chunks/chunk-SLWQNBGO.js +2034 -0
- package/dist/_node-chunks/chunk-SVTBJ7Q3.js +35 -0
- package/dist/_node-chunks/chunk-SWO5CDYU.js +32 -0
- package/dist/_node-chunks/chunk-TD5PLLQG.js +121 -0
- package/dist/_node-chunks/chunk-TEQGGSP7.js +33 -0
- package/dist/_node-chunks/chunk-TFCEV2XX.js +155 -0
- package/dist/_node-chunks/chunk-TFEWM4E3.js +1073 -0
- package/dist/_node-chunks/chunk-TINO74G5.js +21 -0
- package/dist/_node-chunks/chunk-TNJIXE37.js +40 -0
- package/dist/_node-chunks/chunk-TWI4GVH7.js +19 -0
- package/dist/_node-chunks/chunk-U5W53R2J.js +1011 -0
- package/dist/_node-chunks/chunk-UBOGWBEA.js +148 -0
- package/dist/_node-chunks/chunk-UMUBKI6E.js +3787 -0
- package/dist/_node-chunks/chunk-UVINFLGY.js +56 -0
- package/dist/_node-chunks/chunk-V2DY426G.js +1133 -0
- package/dist/_node-chunks/chunk-VLOXOXXE.js +45 -0
- package/dist/_node-chunks/chunk-W4OMYLSP.js +1297 -0
- package/dist/_node-chunks/chunk-WAXVSN3O.js +18 -0
- package/dist/_node-chunks/chunk-WCULS5TP.js +3767 -0
- package/dist/_node-chunks/chunk-WNZ2UMFM.js +153 -0
- package/dist/_node-chunks/chunk-WZJF2OUH.js +74 -0
- package/dist/_node-chunks/chunk-XGIUVY52.js +611 -0
- package/dist/_node-chunks/chunk-XHL2LVBM.js +415 -0
- package/dist/_node-chunks/chunk-XI6B6P47.js +59 -0
- package/dist/_node-chunks/chunk-XLP2ZKXV.js +60 -0
- package/dist/_node-chunks/chunk-YCMRA6RX.js +95 -0
- package/dist/_node-chunks/chunk-YZFWBA5L.js +2700 -0
- package/dist/_node-chunks/chunk-ZMAMXQKP.js +4731 -0
- package/dist/_node-chunks/chunk-ZWBCQ4MJ.js +110 -0
- package/dist/_node-chunks/dist-VTSTZKUB.js +16 -0
- package/dist/_node-chunks/globby-OEMHPBFY.js +2884 -0
- package/dist/_node-chunks/jiti-NFX6UU74.js +3848 -0
- package/dist/_node-chunks/lib-MDVARD7W.js +366 -0
- package/dist/_node-chunks/local-runtime-NTKIN2QT.js +78 -0
- package/dist/_node-chunks/mdx-plugin-MWISDWDQ.js +5680 -0
- package/dist/_node-chunks/monorepo-LIRFMQXE.js +121 -0
- package/dist/_node-chunks/monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js +121 -0
- package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +22 -0
- package/dist/_node-chunks/pattern-copy-play-EKHIUAU2.js +807 -0
- package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +20 -0
- package/dist/_node-chunks/rehype-external-links-BUN3HUCO.js +121 -0
- package/dist/_node-chunks/rehype-slug-PLADX223.js +52 -0
- package/dist/_node-chunks/relaxed-limits-GBHW6KIQ.js +117 -0
- package/dist/_node-chunks/run-KDTIZNSY.js +103 -0
- package/dist/_node-chunks/run-NL66VTNR.js +4532 -0
- package/dist/_node-chunks/session-id-KIIVOQLR.js +23 -0
- package/dist/_node-chunks/setup-MGC7BQO6.js +278 -0
- package/dist/_node-chunks/vitest.config.4.template-JH2THZFG.js +54 -0
- package/dist/actions/decorator.d.ts +7 -0
- package/dist/actions/decorator.js +43 -0
- package/dist/actions/index.d.ts +67 -0
- package/dist/actions/index.js +28 -0
- package/dist/addon-a11y/index.d.ts +52 -0
- package/dist/addon-a11y/index.js +16 -0
- package/dist/addon-a11y/manager.js +1429 -0
- package/dist/addon-a11y/preset.js +18 -0
- package/dist/addon-a11y/preview.d.ts +17 -0
- package/dist/addon-a11y/preview.js +15 -0
- package/dist/addon-docs/blocks.d.ts +1061 -0
- package/dist/addon-docs/blocks.js +2461 -0
- package/dist/addon-docs/index.d.ts +236 -0
- package/dist/addon-docs/index.js +16 -0
- package/dist/addon-docs/manager.js +90 -0
- package/dist/addon-docs/mdx-react-shim.d.ts +1 -0
- package/dist/addon-docs/mdx-react-shim.js +2 -0
- package/dist/addon-docs/preset.js +378 -0
- package/dist/addon-docs/preview.d.ts +4 -0
- package/dist/addon-docs/preview.js +7 -0
- package/dist/addon-links/index.d.ts +22 -0
- package/dist/addon-links/index.js +20 -0
- package/dist/addon-links/manager.js +14 -0
- package/dist/addon-links/preview.d.ts +6 -0
- package/dist/addon-links/preview.js +9 -0
- package/dist/addon-links/react/index.d.ts +25 -0
- package/dist/addon-links/react/index.js +52 -0
- package/dist/addon-mcp/preset.js +1345 -0
- package/dist/addon-mcp/preview.js +29 -0
- package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +1153 -0
- package/dist/addon-ondevice-actions/index.d.ts +4 -0
- package/dist/addon-ondevice-actions/index.js +7 -0
- package/dist/addon-ondevice-actions/register.js +7 -0
- package/dist/addon-ondevice-controls/index.d.ts +6 -0
- package/dist/addon-ondevice-controls/index.js +14 -0
- package/dist/addon-ondevice-controls/register.js +10 -0
- package/dist/addon-pseudo-states/index.d.ts +35 -0
- package/dist/addon-pseudo-states/index.js +15 -0
- package/dist/addon-pseudo-states/manager.js +53 -0
- package/dist/addon-pseudo-states/preview.d.ts +9 -0
- package/dist/addon-pseudo-states/preview.js +10 -0
- package/dist/addon-themes/index.d.ts +80 -0
- package/dist/addon-themes/index.js +104 -0
- package/dist/addon-themes/manager.js +97 -0
- package/dist/addon-themes/postinstall.js +33 -0
- package/dist/addon-themes/preview.d.ts +6 -0
- package/dist/addon-themes/preview.js +8 -0
- package/dist/addon-vitest/constants.d.ts +132 -0
- package/dist/addon-vitest/constants.js +66 -0
- package/dist/addon-vitest/index.d.ts +4 -0
- package/dist/addon-vitest/index.js +8 -0
- package/dist/addon-vitest/manager.js +665 -0
- package/dist/addon-vitest/node/coverage-reporter.js +1284 -0
- package/dist/addon-vitest/node/vitest.js +674 -0
- package/dist/addon-vitest/postinstall.js +24 -0
- package/dist/addon-vitest/preset.js +943 -0
- package/dist/addon-vitest/vitest-plugin/global-setup.js +162 -0
- package/dist/addon-vitest/vitest-plugin/index.d.ts +56 -0
- package/dist/addon-vitest/vitest-plugin/index.js +463 -0
- package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +9 -0
- package/dist/addon-vitest/vitest-plugin/setup-file.browser.4.js +20 -0
- package/dist/addon-vitest/vitest-plugin/setup-file.js +50 -0
- package/dist/addon-vitest/vitest-plugin/test-utils.js +128 -0
- package/dist/babel/index.d.ts +2301 -0
- package/dist/babel/index.js +61 -0
- package/dist/backgrounds/index.d.ts +6 -0
- package/dist/backgrounds/index.js +15 -0
- package/dist/bin/core.js +1705 -0
- package/dist/bin/dispatcher.js +43 -0
- package/dist/bin/loader.js +115 -0
- package/dist/builder-vite/index.d.ts +50 -0
- package/dist/builder-vite/index.js +245 -0
- package/dist/builder-vite/preset.js +27 -0
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.js +352 -0
- package/dist/chunk-B2t1tGRh.d.ts +284 -0
- package/dist/chunk-BCoJQE-f.d.ts +602 -0
- package/dist/chunk-BGkgZp-H.d.ts +214 -0
- package/dist/chunk-BTVrWliM.d.ts +115 -0
- package/dist/chunk-BXLImeLy.d.ts +197 -0
- package/dist/chunk-BfBzpgct.d.ts +916 -0
- package/dist/chunk-Bpi2tz-6.d.ts +511 -0
- package/dist/chunk-BxWufQms.d.ts +142 -0
- package/dist/chunk-C-bavsOH.d.ts +34 -0
- package/dist/chunk-C2p5r3Vt.d.ts +13001 -0
- package/dist/chunk-C6PAgHLT.d.ts +12 -0
- package/dist/chunk-CMeX4WRe.d.ts +179 -0
- package/dist/chunk-Ct9xd6IM.d.ts +65 -0
- package/dist/chunk-CwQKNaYL.d.ts +15 -0
- package/dist/chunk-D7DwV41f.d.ts +3622 -0
- package/dist/chunk-DEVFdzxR.d.ts +253 -0
- package/dist/chunk-DaVb55-_.d.ts +124 -0
- package/dist/chunk-DgRNfmj_.d.ts +40 -0
- package/dist/chunk-DoIGKY33.d.ts +666 -0
- package/dist/chunk-Dr3R0DXk.d.ts +40 -0
- package/dist/chunk-DtHByo32.d.ts +55 -0
- package/dist/chunk-Dw1z1Pki.d.ts +933 -0
- package/dist/chunk-DzuY9DXg.d.ts +79 -0
- package/dist/chunk-FjDVzZTj.d.ts +62 -0
- package/dist/chunk-Kt1tW-D1.d.ts +59 -0
- package/dist/chunk-XP8oHzpE.d.ts +6 -0
- package/dist/chunk-gCX81nOr.d.ts +61 -0
- package/dist/chunk-pcFXCimE.d.ts +741 -0
- package/dist/cli/index.d.ts +1174 -0
- package/dist/cli/index.js +5613 -0
- package/dist/cli/skills/content/index.d.ts +72 -0
- package/dist/cli/skills/content/index.js +335 -0
- package/dist/cli/tools/sdk/child-host.d.ts +61 -0
- package/dist/cli/tools/sdk/child-host.js +131 -0
- package/dist/cli/tools/sdk/index.d.ts +137 -0
- package/dist/cli/tools/sdk/index.js +44 -0
- package/dist/cli-commands/bin/index.js +25 -0
- package/dist/client-logger/index.d.ts +31 -0
- package/dist/client-logger/index.js +63 -0
- package/dist/common/index.d.ts +1103 -0
- package/dist/common/index.js +364 -0
- package/dist/components/index.d.ts +1924 -0
- package/dist/components/index.js +13759 -0
- package/dist/core-events/index.d.ts +155 -0
- package/dist/core-events/index.js +136 -0
- package/dist/core-server/index.d.ts +2200 -0
- package/dist/core-server/index.js +4165 -0
- package/dist/core-server/presets/common-manager.css +170 -0
- package/dist/core-server/presets/common-manager.js +4168 -0
- package/dist/core-server/presets/common-override-preset.js +81 -0
- package/dist/core-server/presets/common-preset.js +2187 -0
- package/dist/create/bin/index.js +23 -0
- package/dist/create/index.js +25 -0
- package/dist/csf/csf-utils.d.ts +2 -0
- package/dist/csf/csf-utils.js +19 -0
- package/dist/csf/index.d.ts +7 -0
- package/dist/csf/index.js +2142 -0
- package/dist/csf-tools/index.d.ts +1157 -0
- package/dist/csf-tools/index.js +736 -0
- package/dist/docs-tools/index.d.ts +197 -0
- package/dist/docs-tools/index.js +61 -0
- package/dist/highlight/index.d.ts +10 -0
- package/dist/highlight/index.js +15 -0
- package/dist/instrumenter/index.d.ts +113 -0
- package/dist/instrumenter/index.js +2595 -0
- package/dist/manager/_manager-chunks/globals-runtime-8HkdnU2F.js +6144 -0
- package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +3389 -0
- package/dist/manager/_manager-chunks/globals-runtime-BdGkqNEt.js +45 -0
- package/dist/manager/_manager-chunks/globals-runtime-BmphMP6z.js +1190 -0
- package/dist/manager/_manager-chunks/globals-runtime-BvM-NY2g.js +13307 -0
- package/dist/manager/_manager-chunks/globals-runtime-C02fvgcd.js +9243 -0
- package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +9766 -0
- package/dist/manager/_manager-chunks/globals-runtime-DpNYC-qi.js +5564 -0
- package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +5357 -0
- package/dist/manager/_manager-chunks/globals-runtime-DwFqpqya.js +722 -0
- package/dist/manager/_manager-chunks/globals-runtime-FC201B7s.js +6837 -0
- package/dist/manager/_manager-chunks/globals-runtime-Rp_zjGnh.js +121 -0
- package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +10463 -0
- package/dist/manager/_manager-chunks/globals-runtime-eLPTIfX-.js +7759 -0
- package/dist/manager/_manager-chunks/globals-runtime-qKvCZHFY.js +4468 -0
- package/dist/manager/_manager-chunks/globals-runtime-sGpNlIJ1.js +5102 -0
- package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +452 -0
- package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +22 -0
- package/dist/manager/_manager-chunks/runtime-BhkT2CXl.js +1408 -0
- package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +998 -0
- package/dist/manager/_manager-chunks/runtime-D0UOWx0U.js +979 -0
- package/dist/manager/_manager-chunks/runtime-D94Vq3oR.js +4014 -0
- package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +77 -0
- package/dist/manager/_manager-chunks/runtime-EITvVbkG.js +46 -0
- package/dist/manager/_manager-chunks/runtime-cp5pazY2.js +8936 -0
- package/dist/manager/_manager-chunks/runtime-eDVAYF7N.js +6860 -0
- package/dist/manager/_manager-chunks/runtime-i-PDAHLR.js +2493 -0
- package/dist/manager/globals-runtime.js +2 -0
- package/dist/manager/globals.d.ts +23 -0
- package/dist/manager/globals.js +26 -0
- package/dist/manager/manager-stores.d.ts +2 -0
- package/dist/manager/manager-stores.js +19 -0
- package/dist/manager/runtime.js +2 -0
- package/dist/manager-api/index.d.ts +2 -0
- package/dist/manager-api/index.js +3257 -0
- package/dist/manager-errors.d.ts +89 -0
- package/dist/manager-errors.js +20 -0
- package/dist/mcp/index.d.ts +270 -0
- package/dist/mcp/index.js +305 -0
- package/dist/mocking-utils/index.d.ts +689 -0
- package/dist/mocking-utils/index.js +521 -0
- package/dist/mocking-utils/mocker-runtime.js +1254 -0
- package/dist/nextjs-vite/config/preview.js +3 -0
- package/dist/nextjs-vite/export-mocks/cache/index.d.ts +25 -0
- package/dist/nextjs-vite/export-mocks/cache/index.js +29 -0
- package/dist/nextjs-vite/export-mocks/headers/index.d.ts +37 -0
- package/dist/nextjs-vite/export-mocks/headers/index.js +54 -0
- package/dist/nextjs-vite/export-mocks/link/index.d.ts +9 -0
- package/dist/nextjs-vite/export-mocks/link/index.js +59 -0
- package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +28 -0
- package/dist/nextjs-vite/export-mocks/navigation/index.js +58 -0
- package/dist/nextjs-vite/export-mocks/router/index.d.ts +34 -0
- package/dist/nextjs-vite/export-mocks/router/index.js +63 -0
- package/dist/nextjs-vite/index.d.ts +92 -0
- package/dist/nextjs-vite/index.js +58 -0
- package/dist/nextjs-vite/node/index.d.ts +6 -0
- package/dist/nextjs-vite/node/index.js +20 -0
- package/dist/nextjs-vite/preset.js +648 -0
- package/dist/nextjs-vite/preview.d.ts +20 -0
- package/dist/nextjs-vite/preview.js +11 -0
- package/dist/nextjs-vite/vite-plugin/index.d.ts +6 -0
- package/dist/nextjs-vite/vite-plugin/index.js +19 -0
- package/dist/nextjs-vite-plugin/index.d.ts +28 -0
- package/dist/nextjs-vite-plugin/index.js +923 -0
- package/dist/nextjs-vite-plugin/mocks/storybook.global.js +29 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-context.js +8 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-default-loader.js +23 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +28 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +17 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/cache/index.js +29 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/dynamic/index.js +40 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/headers/index.js +55 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/link/index.js +63 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/navigation/index.js +71 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +74 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/rsc/server-only.js +7 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/safe-stable-stringify/index.js +13 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/compatibility/draft-mode.compat.js +7 -0
- package/dist/node-logger/index.d.ts +495 -0
- package/dist/node-logger/index.js +42 -0
- package/dist/oxc-parser/index.d.ts +99 -0
- package/dist/oxc-parser/index.js +275 -0
- package/dist/oxc-parser/worker.js +37 -0
- package/dist/preview/_chunks/runtime-BIzIdDbb.js +10263 -0
- package/dist/preview/_chunks/runtime-BTPtVY1p.js +1102 -0
- package/dist/preview/_chunks/runtime-BZSnICCg.js +8484 -0
- package/dist/preview/_chunks/runtime-BdGkqNEt.js +45 -0
- package/dist/preview/_chunks/runtime-BwSxqk3t.js +63 -0
- package/dist/preview/_chunks/runtime-CqHxptiK.js +6143 -0
- package/dist/preview/_chunks/runtime-CsV4HZPV.js +5064 -0
- package/dist/preview/_chunks/runtime-CxZK_Ln3.js +284 -0
- package/dist/preview/_chunks/runtime-DZToXfvO.js +9767 -0
- package/dist/preview/_chunks/runtime-DrTjJkPY.js +3872 -0
- package/dist/preview/_chunks/runtime-DuHdxMFA.js +387 -0
- package/dist/preview/_chunks/runtime-iXdo8CR8.js +3635 -0
- package/dist/preview/_chunks/runtime-q3wt0e_N.js +6838 -0
- package/dist/preview/globals.d.ts +16 -0
- package/dist/preview/globals.js +20 -0
- package/dist/preview/runtime.js +6 -0
- package/dist/preview-api/index.d.ts +4 -0
- package/dist/preview-api/index.js +147 -0
- package/dist/preview-errors.d.ts +186 -0
- package/dist/preview-errors.js +56 -0
- package/dist/react/docgen/docgen-worker.js +38 -0
- package/dist/react/entry-preview-argtypes.js +9 -0
- package/dist/react/entry-preview-docs.js +12 -0
- package/dist/react/entry-preview-rsc.js +11 -0
- package/dist/react/entry-preview.js +21 -0
- package/dist/react/index.d.ts +119 -0
- package/dist/react/index.js +26 -0
- package/dist/react/preset.js +301 -0
- package/dist/react/preview.d.ts +2 -0
- package/dist/react/preview.js +11 -0
- package/dist/react-native/bin/get-stories.js +34 -0
- package/dist/react-native/index.d.ts +160 -0
- package/dist/react-native/index.js +1547 -0
- package/dist/react-native/metro/node.d.ts +83 -0
- package/dist/react-native/metro/node.js +21 -0
- package/dist/react-native/metro/withStorybook.d.ts +2269 -0
- package/dist/react-native/metro/withStorybook.js +138 -0
- package/dist/react-native/preview.d.ts +6 -0
- package/dist/react-native/preview.js +20 -0
- package/dist/react-native/scripts/generate.d.ts +22 -0
- package/dist/react-native/scripts/generate.js +18 -0
- package/dist/react-native/stub.js +20 -0
- package/dist/react-native-theming/index.d.ts +175 -0
- package/dist/react-native-theming/index.js +2591 -0
- package/dist/react-native-ui/index.d.ts +130 -0
- package/dist/react-native-ui/index.js +1448 -0
- package/dist/react-native-ui-common/index.d.ts +230 -0
- package/dist/react-native-ui-common/index.js +514 -0
- package/dist/react-vite/index.d.ts +4 -0
- package/dist/react-vite/index.js +8 -0
- package/dist/react-vite/node/index.d.ts +6 -0
- package/dist/react-vite/node/index.js +20 -0
- package/dist/react-vite/preset.d.ts +6 -0
- package/dist/react-vite/preset.js +21 -0
- package/dist/router/index.d.ts +141 -0
- package/dist/router/index.js +1217 -0
- package/dist/server-errors.d.ts +2 -0
- package/dist/server-errors.js +149 -0
- package/dist/shared/open-service/index.d.ts +3 -0
- package/dist/shared/open-service/index.js +115 -0
- package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +75 -0
- package/dist/shared/open-service/toolsets/docs/public.d.ts +1296 -0
- package/dist/shared/open-service/toolsets/docs/public.js +991 -0
- package/dist/telemetry/index.d.ts +314 -0
- package/dist/telemetry/index.js +103 -0
- package/dist/test/index.d.ts +158 -0
- package/dist/test/index.js +19421 -0
- package/dist/theming/create.d.ts +15 -0
- package/dist/theming/create.js +11 -0
- package/dist/theming/index.d.ts +54 -0
- package/dist/theming/index.js +511 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +48 -0
- package/dist/viewport/index.d.ts +275 -0
- package/dist/viewport/index.js +21 -0
- package/package.json +1054 -4
- package/template/nextjs-vite/cli/.eslintrc.json +6 -0
- package/template/nextjs-vite/cli/js/Button.jsx +42 -0
- package/template/nextjs-vite/cli/js/Button.stories.js +49 -0
- package/template/nextjs-vite/cli/js/Configure.mdx +470 -0
- package/template/nextjs-vite/cli/js/Header.jsx +58 -0
- package/template/nextjs-vite/cli/js/Header.stories.js +30 -0
- package/template/nextjs-vite/cli/js/Page.jsx +68 -0
- package/template/nextjs-vite/cli/js/Page.stories.js +28 -0
- package/template/nextjs-vite/cli/ts/Button.stories.ts +54 -0
- package/template/nextjs-vite/cli/ts/Button.tsx +39 -0
- package/template/nextjs-vite/cli/ts/Configure.mdx +446 -0
- package/template/nextjs-vite/cli/ts/Header.stories.ts +34 -0
- package/template/nextjs-vite/cli/ts/Header.tsx +54 -0
- package/template/nextjs-vite/cli/ts/Page.stories.ts +33 -0
- package/template/nextjs-vite/cli/ts/Page.tsx +73 -0
- package/template/react/cli/.eslintrc.json +5 -0
- package/template/react/cli/js/Button.jsx +39 -0
- package/template/react/cli/js/Button.stories.js +49 -0
- package/template/react/cli/js/Header.jsx +56 -0
- package/template/react/cli/js/Header.stories.js +29 -0
- package/template/react/cli/js/Page.jsx +69 -0
- package/template/react/cli/js/Page.stories.js +28 -0
- package/template/react/cli/ts/Button.stories.ts +54 -0
- package/template/react/cli/ts/Button.tsx +37 -0
- package/template/react/cli/ts/Header.stories.ts +34 -0
- package/template/react/cli/ts/Header.tsx +56 -0
- package/template/react/cli/ts/Page.stories.ts +33 -0
- package/template/react/cli/ts/Page.tsx +73 -0
- package/template/react-vite/cli/.eslintrc.json +5 -0
- package/template/react-vite/cli/js/Button.jsx +39 -0
- package/template/react-vite/cli/js/Button.stories.js +49 -0
- package/template/react-vite/cli/js/Header.jsx +56 -0
- package/template/react-vite/cli/js/Header.stories.js +29 -0
- package/template/react-vite/cli/js/Page.jsx +69 -0
- package/template/react-vite/cli/js/Page.stories.js +28 -0
- package/template/react-vite/cli/ts/Button.stories.ts +54 -0
- package/template/react-vite/cli/ts/Button.tsx +37 -0
- package/template/react-vite/cli/ts/Header.stories.ts +34 -0
- package/template/react-vite/cli/ts/Header.tsx +56 -0
- package/template/react-vite/cli/ts/Page.stories.ts +33 -0
- package/template/react-vite/cli/ts/Page.tsx +73 -0
|
@@ -0,0 +1,1547 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__toESM
|
|
4
|
+
} from "../_browser-chunks/chunk-IMSF75WX.js";
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/setimmediate/setImmediate.js
|
|
7
|
+
var require_setImmediate = __commonJS({
|
|
8
|
+
"../../node_modules/setimmediate/setImmediate.js"(exports) {
|
|
9
|
+
(function(global2, undefined2) {
|
|
10
|
+
"use strict";
|
|
11
|
+
if (global2.setImmediate)
|
|
12
|
+
return;
|
|
13
|
+
var nextHandle = 1, tasksByHandle = {}, currentlyRunningATask = !1, doc = global2.document, registerImmediate;
|
|
14
|
+
function setImmediate(callback) {
|
|
15
|
+
typeof callback != "function" && (callback = new Function("" + callback));
|
|
16
|
+
for (var args = new Array(arguments.length - 1), i = 0; i < args.length; i++)
|
|
17
|
+
args[i] = arguments[i + 1];
|
|
18
|
+
var task = { callback, args };
|
|
19
|
+
return tasksByHandle[nextHandle] = task, registerImmediate(nextHandle), nextHandle++;
|
|
20
|
+
}
|
|
21
|
+
function clearImmediate(handle) {
|
|
22
|
+
delete tasksByHandle[handle];
|
|
23
|
+
}
|
|
24
|
+
function run(task) {
|
|
25
|
+
var callback = task.callback, args = task.args;
|
|
26
|
+
switch (args.length) {
|
|
27
|
+
case 0:
|
|
28
|
+
callback();
|
|
29
|
+
break;
|
|
30
|
+
case 1:
|
|
31
|
+
callback(args[0]);
|
|
32
|
+
break;
|
|
33
|
+
case 2:
|
|
34
|
+
callback(args[0], args[1]);
|
|
35
|
+
break;
|
|
36
|
+
case 3:
|
|
37
|
+
callback(args[0], args[1], args[2]);
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
callback.apply(undefined2, args);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function runIfPresent(handle) {
|
|
45
|
+
if (currentlyRunningATask)
|
|
46
|
+
setTimeout(runIfPresent, 0, handle);
|
|
47
|
+
else {
|
|
48
|
+
var task = tasksByHandle[handle];
|
|
49
|
+
if (task) {
|
|
50
|
+
currentlyRunningATask = !0;
|
|
51
|
+
try {
|
|
52
|
+
run(task);
|
|
53
|
+
} finally {
|
|
54
|
+
clearImmediate(handle), currentlyRunningATask = !1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function installNextTickImplementation() {
|
|
60
|
+
registerImmediate = function(handle) {
|
|
61
|
+
process.nextTick(function() {
|
|
62
|
+
runIfPresent(handle);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function canUsePostMessage() {
|
|
67
|
+
if (global2.postMessage && !global2.importScripts) {
|
|
68
|
+
var postMessageIsAsynchronous = !0, oldOnMessage = global2.onmessage;
|
|
69
|
+
return global2.onmessage = function() {
|
|
70
|
+
postMessageIsAsynchronous = !1;
|
|
71
|
+
}, global2.postMessage("", "*"), global2.onmessage = oldOnMessage, postMessageIsAsynchronous;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function installPostMessageImplementation() {
|
|
75
|
+
var messagePrefix = "setImmediate$" + Math.random() + "$", onGlobalMessage = function(event) {
|
|
76
|
+
event.source === global2 && typeof event.data == "string" && event.data.indexOf(messagePrefix) === 0 && runIfPresent(+event.data.slice(messagePrefix.length));
|
|
77
|
+
};
|
|
78
|
+
global2.addEventListener ? global2.addEventListener("message", onGlobalMessage, !1) : global2.attachEvent("onmessage", onGlobalMessage), registerImmediate = function(handle) {
|
|
79
|
+
global2.postMessage(messagePrefix + handle, "*");
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function installMessageChannelImplementation() {
|
|
83
|
+
var channel = new MessageChannel();
|
|
84
|
+
channel.port1.onmessage = function(event) {
|
|
85
|
+
var handle = event.data;
|
|
86
|
+
runIfPresent(handle);
|
|
87
|
+
}, registerImmediate = function(handle) {
|
|
88
|
+
channel.port2.postMessage(handle);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function installReadyStateChangeImplementation() {
|
|
92
|
+
var html = doc.documentElement;
|
|
93
|
+
registerImmediate = function(handle) {
|
|
94
|
+
var script = doc.createElement("script");
|
|
95
|
+
script.onreadystatechange = function() {
|
|
96
|
+
runIfPresent(handle), script.onreadystatechange = null, html.removeChild(script), script = null;
|
|
97
|
+
}, html.appendChild(script);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function installSetTimeoutImplementation() {
|
|
101
|
+
registerImmediate = function(handle) {
|
|
102
|
+
setTimeout(runIfPresent, 0, handle);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global2);
|
|
106
|
+
attachTo = attachTo && attachTo.setTimeout ? attachTo : global2, {}.toString.call(global2.process) === "[object process]" ? installNextTickImplementation() : canUsePostMessage() ? installPostMessageImplementation() : global2.MessageChannel ? installMessageChannelImplementation() : doc && "onreadystatechange" in doc.createElement("script") ? installReadyStateChangeImplementation() : installSetTimeoutImplementation(), attachTo.setImmediate = setImmediate, attachTo.clearImmediate = clearImmediate;
|
|
107
|
+
})(typeof self > "u" ? typeof global > "u" ? exports : global : self);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// ../../node_modules/deepmerge/dist/cjs.js
|
|
112
|
+
var require_cjs = __commonJS({
|
|
113
|
+
"../../node_modules/deepmerge/dist/cjs.js"(exports, module) {
|
|
114
|
+
"use strict";
|
|
115
|
+
var isMergeableObject = function(value) {
|
|
116
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
117
|
+
};
|
|
118
|
+
function isNonNullObject(value) {
|
|
119
|
+
return !!value && typeof value == "object";
|
|
120
|
+
}
|
|
121
|
+
function isSpecial(value) {
|
|
122
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
123
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
124
|
+
}
|
|
125
|
+
var canUseSymbol = typeof Symbol == "function" && Symbol.for, REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
|
|
126
|
+
function isReactElement(value) {
|
|
127
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
128
|
+
}
|
|
129
|
+
function emptyTarget(val) {
|
|
130
|
+
return Array.isArray(val) ? [] : {};
|
|
131
|
+
}
|
|
132
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
133
|
+
return options.clone !== !1 && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
|
|
134
|
+
}
|
|
135
|
+
function defaultArrayMerge(target, source, options) {
|
|
136
|
+
return target.concat(source).map(function(element) {
|
|
137
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function getMergeFunction(key, options) {
|
|
141
|
+
if (!options.customMerge)
|
|
142
|
+
return deepmerge2;
|
|
143
|
+
var customMerge = options.customMerge(key);
|
|
144
|
+
return typeof customMerge == "function" ? customMerge : deepmerge2;
|
|
145
|
+
}
|
|
146
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
147
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
148
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
149
|
+
}) : [];
|
|
150
|
+
}
|
|
151
|
+
function getKeys(target) {
|
|
152
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
153
|
+
}
|
|
154
|
+
function propertyIsOnObject(object, property) {
|
|
155
|
+
try {
|
|
156
|
+
return property in object;
|
|
157
|
+
} catch {
|
|
158
|
+
return !1;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function propertyIsUnsafe(target, key) {
|
|
162
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
163
|
+
}
|
|
164
|
+
function mergeObject(target, source, options) {
|
|
165
|
+
var destination = {};
|
|
166
|
+
return options.isMergeableObject(target) && getKeys(target).forEach(function(key) {
|
|
167
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
168
|
+
}), getKeys(source).forEach(function(key) {
|
|
169
|
+
propertyIsUnsafe(target, key) || (propertyIsOnObject(target, key) && options.isMergeableObject(source[key]) ? destination[key] = getMergeFunction(key, options)(target[key], source[key], options) : destination[key] = cloneUnlessOtherwiseSpecified(source[key], options));
|
|
170
|
+
}), destination;
|
|
171
|
+
}
|
|
172
|
+
function deepmerge2(target, source, options) {
|
|
173
|
+
options = options || {}, options.arrayMerge = options.arrayMerge || defaultArrayMerge, options.isMergeableObject = options.isMergeableObject || isMergeableObject, options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
174
|
+
var sourceIsArray = Array.isArray(source), targetIsArray = Array.isArray(target), sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
175
|
+
return sourceAndTargetTypesMatch ? sourceIsArray ? options.arrayMerge(target, source, options) : mergeObject(target, source, options) : cloneUnlessOtherwiseSpecified(source, options);
|
|
176
|
+
}
|
|
177
|
+
deepmerge2.all = function(array, options) {
|
|
178
|
+
if (!Array.isArray(array))
|
|
179
|
+
throw new Error("first argument should be an array");
|
|
180
|
+
return array.reduce(function(prev, next) {
|
|
181
|
+
return deepmerge2(prev, next, options);
|
|
182
|
+
}, {});
|
|
183
|
+
};
|
|
184
|
+
var deepmerge_1 = deepmerge2;
|
|
185
|
+
module.exports = deepmerge_1;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// src/react-native/index.ts
|
|
190
|
+
import { darkTheme as darkTheme2, theme as theme2 } from "@aussieljk/forkbook/internal/react-native-theming";
|
|
191
|
+
|
|
192
|
+
// src/react-native/Start.tsx
|
|
193
|
+
import {
|
|
194
|
+
composeConfigs,
|
|
195
|
+
addons as previewAddons2,
|
|
196
|
+
PreviewWithSelection as PreviewWithSelection2
|
|
197
|
+
} from "@aussieljk/forkbook/internal/preview-api";
|
|
198
|
+
import { addons as managerAddons2 } from "@aussieljk/forkbook/manager-api";
|
|
199
|
+
|
|
200
|
+
// src/react-native/polyfill.ts
|
|
201
|
+
var import_setimmediate = __toESM(require_setImmediate(), 1);
|
|
202
|
+
|
|
203
|
+
// src/react-native/Start.tsx
|
|
204
|
+
import { Channel as Channel2 } from "@aussieljk/forkbook/internal/channels";
|
|
205
|
+
|
|
206
|
+
// src/react-native/View.tsx
|
|
207
|
+
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
208
|
+
import { darkTheme, theme } from "@aussieljk/forkbook/internal/react-native-theming";
|
|
209
|
+
import {
|
|
210
|
+
transformStoryIndexToStoriesHash
|
|
211
|
+
} from "@aussieljk/forkbook/internal/react-native-ui-common";
|
|
212
|
+
import { dedent } from "ts-dedent";
|
|
213
|
+
import { useEffect as useEffect2, useMemo as useMemo2, useReducer as useReducer2, useState } from "react";
|
|
214
|
+
import { SafeAreaProvider, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
215
|
+
import { Channel, WebsocketTransport } from "@aussieljk/forkbook/internal/channels";
|
|
216
|
+
import { CHANNEL_CREATED, SET_CURRENT_STORY } from "@aussieljk/forkbook/internal/core-events";
|
|
217
|
+
import { toId } from "@aussieljk/forkbook/internal/csf";
|
|
218
|
+
import {
|
|
219
|
+
addons as previewAddons
|
|
220
|
+
} from "@aussieljk/forkbook/internal/preview-api";
|
|
221
|
+
import { addons as managerAddons } from "@aussieljk/forkbook/manager-api";
|
|
222
|
+
import { FullUI as DeviceUI } from "@aussieljk/forkbook/react-native-ui";
|
|
223
|
+
|
|
224
|
+
// src/react-native/patchChannelForRN.ts
|
|
225
|
+
function snapshotValue(value, depth = 0) {
|
|
226
|
+
if (depth > 3) return "[...]";
|
|
227
|
+
if (value == null) return value;
|
|
228
|
+
if (typeof value == "function") return;
|
|
229
|
+
if (typeof value != "object") return value;
|
|
230
|
+
if (Array.isArray(value))
|
|
231
|
+
return value.map((item) => snapshotValue(item, depth + 1));
|
|
232
|
+
let result = {};
|
|
233
|
+
for (let key of Object.keys(value))
|
|
234
|
+
try {
|
|
235
|
+
result[key] = snapshotValue(value[key], depth + 1);
|
|
236
|
+
} catch {
|
|
237
|
+
result[key] = "[Error]";
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
function isSyntheticEvent(value) {
|
|
242
|
+
return value !== null && typeof value == "object" && typeof value.persist == "function" && "nativeEvent" in value;
|
|
243
|
+
}
|
|
244
|
+
function sanitizeActionArgs(value) {
|
|
245
|
+
return isSyntheticEvent(value) ? snapshotValue(value) : Array.isArray(value) ? value.map(sanitizeActionArgs) : value;
|
|
246
|
+
}
|
|
247
|
+
function patchChannelForRN(channel) {
|
|
248
|
+
globalThis.CHANNEL_OPTIONS = {
|
|
249
|
+
maxDepth: 5
|
|
250
|
+
};
|
|
251
|
+
let originalEmit = channel.emit.bind(channel);
|
|
252
|
+
channel.emit = (eventName, ...args) => {
|
|
253
|
+
if (eventName === "storybook/actions/action-event") {
|
|
254
|
+
let actionDisplay = args[0];
|
|
255
|
+
actionDisplay?.data?.args != null && (actionDisplay.data.args = sanitizeActionArgs(actionDisplay.data.args));
|
|
256
|
+
}
|
|
257
|
+
return originalEmit(eventName, ...args);
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/react-native/View.tsx
|
|
262
|
+
import {
|
|
263
|
+
ActivityIndicator,
|
|
264
|
+
Linking,
|
|
265
|
+
Platform,
|
|
266
|
+
View as RNView,
|
|
267
|
+
StatusBar,
|
|
268
|
+
useColorScheme
|
|
269
|
+
} from "react-native";
|
|
270
|
+
|
|
271
|
+
// src/react-native/components/StoryView/StoryView.tsx
|
|
272
|
+
import { styled, useTheme } from "@aussieljk/forkbook/internal/react-native-theming";
|
|
273
|
+
import React3, { useCallback as useCallback2, useMemo } from "react";
|
|
274
|
+
import { Keyboard, View as View2 } from "react-native";
|
|
275
|
+
|
|
276
|
+
// ../../node_modules/jotai/esm/vanilla/internals.mjs
|
|
277
|
+
function hasInitialValue(atom2) {
|
|
278
|
+
return "init" in atom2;
|
|
279
|
+
}
|
|
280
|
+
function isActuallyWritableAtom(atom2) {
|
|
281
|
+
return typeof atom2.write == "function";
|
|
282
|
+
}
|
|
283
|
+
function hasOnMount(atom2) {
|
|
284
|
+
return !!atom2.onMount;
|
|
285
|
+
}
|
|
286
|
+
function isAtomStateInitialized(atomState) {
|
|
287
|
+
return "v" in atomState || "e" in atomState;
|
|
288
|
+
}
|
|
289
|
+
function returnAtomValue(atomState) {
|
|
290
|
+
if ("e" in atomState)
|
|
291
|
+
throw atomState.e;
|
|
292
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && !("v" in atomState))
|
|
293
|
+
throw new Error("[Bug] atom state is not initialized");
|
|
294
|
+
return atomState.v;
|
|
295
|
+
}
|
|
296
|
+
function isPromiseLike(p) {
|
|
297
|
+
return typeof p?.then == "function";
|
|
298
|
+
}
|
|
299
|
+
function shouldThrowSynchronously(error) {
|
|
300
|
+
if (!(error instanceof Error))
|
|
301
|
+
return !1;
|
|
302
|
+
let name = error.name, message = error.message.toLowerCase();
|
|
303
|
+
return (name === "RangeError" || name === "InternalError") && (message.includes("call stack") || message.includes("too much recursion") || message.includes("stack overflow"));
|
|
304
|
+
}
|
|
305
|
+
function addPendingPromiseToDependency(atom2, promise, dependencyAtomState) {
|
|
306
|
+
if (!dependencyAtomState.p.has(atom2)) {
|
|
307
|
+
dependencyAtomState.p.add(atom2);
|
|
308
|
+
let cleanup = () => dependencyAtomState.p.delete(atom2);
|
|
309
|
+
promise.then(cleanup, cleanup);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function getMountedOrPendingDependents(atom2, atomState, mountedMap) {
|
|
313
|
+
let mounted = mountedMap.get(atom2), mountedDependents = mounted?.t, pendingDependents = atomState.p;
|
|
314
|
+
if (!mountedDependents?.size)
|
|
315
|
+
return pendingDependents;
|
|
316
|
+
if (!pendingDependents.size)
|
|
317
|
+
return mountedDependents;
|
|
318
|
+
let dependents = new Set(mountedDependents);
|
|
319
|
+
for (let a of pendingDependents)
|
|
320
|
+
dependents.add(a);
|
|
321
|
+
return dependents;
|
|
322
|
+
}
|
|
323
|
+
function hasOnInit(atom2) {
|
|
324
|
+
return !!atom2.INTERNAL_onInit;
|
|
325
|
+
}
|
|
326
|
+
var BUILDING_BLOCK_atomRead = (_buildingBlocks, _store, atom2, ...params) => atom2.read(...params), BUILDING_BLOCK_atomWrite = (_buildingBlocks, _store, atom2, ...params) => atom2.write(...params), BUILDING_BLOCK_atomOnInit = (_buildingBlocks, store2, atom2) => atom2.INTERNAL_onInit(store2), BUILDING_BLOCK_atomOnMount = (_buildingBlocks, _store, atom2, setAtom) => {
|
|
327
|
+
var _a;
|
|
328
|
+
return (_a = atom2.onMount) == null ? void 0 : _a.call(atom2, setAtom);
|
|
329
|
+
}, BUILDING_BLOCK_ensureAtomState = (buildingBlocks, store2, atom2) => {
|
|
330
|
+
var _a;
|
|
331
|
+
let atomStateMap = buildingBlocks[0], atomState = atomStateMap.get(atom2);
|
|
332
|
+
if (!atomState) {
|
|
333
|
+
let storeHooks = buildingBlocks[6], atomOnInit = buildingBlocks[9];
|
|
334
|
+
atomState = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, atomStateMap.set(atom2, atomState), (_a = storeHooks.i) == null || _a.call(storeHooks, atom2), hasOnInit(atom2) && atomOnInit(buildingBlocks, store2, atom2);
|
|
335
|
+
}
|
|
336
|
+
return atomState;
|
|
337
|
+
}, BUILDING_BLOCK_flushCallbacks = (buildingBlocks, store2) => {
|
|
338
|
+
var _a;
|
|
339
|
+
let mountedMap = buildingBlocks[1], changedAtoms = buildingBlocks[3], mountCallbacks = buildingBlocks[4], unmountCallbacks = buildingBlocks[5], storeHooks = buildingBlocks[6], recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
340
|
+
if (!storeHooks.f && !changedAtoms.size && !mountCallbacks.size && !unmountCallbacks.size)
|
|
341
|
+
return;
|
|
342
|
+
let errors = [], call = (fn) => {
|
|
343
|
+
try {
|
|
344
|
+
fn();
|
|
345
|
+
} catch (e) {
|
|
346
|
+
errors.push(e);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
do {
|
|
350
|
+
storeHooks.f && call(storeHooks.f);
|
|
351
|
+
let callbacks = /* @__PURE__ */ new Set();
|
|
352
|
+
for (let atom2 of changedAtoms) {
|
|
353
|
+
let listeners = (_a = mountedMap.get(atom2)) == null ? void 0 : _a.l;
|
|
354
|
+
if (listeners)
|
|
355
|
+
for (let listener of listeners)
|
|
356
|
+
callbacks.add(listener);
|
|
357
|
+
}
|
|
358
|
+
changedAtoms.clear();
|
|
359
|
+
for (let fn of unmountCallbacks)
|
|
360
|
+
callbacks.add(fn);
|
|
361
|
+
unmountCallbacks.clear();
|
|
362
|
+
for (let fn of mountCallbacks)
|
|
363
|
+
callbacks.add(fn);
|
|
364
|
+
mountCallbacks.clear();
|
|
365
|
+
for (let fn of callbacks)
|
|
366
|
+
call(fn);
|
|
367
|
+
changedAtoms.size && recomputeInvalidatedAtoms(buildingBlocks, store2);
|
|
368
|
+
} while (changedAtoms.size || unmountCallbacks.size || mountCallbacks.size);
|
|
369
|
+
if (errors.length)
|
|
370
|
+
throw new AggregateError(errors);
|
|
371
|
+
}, BUILDING_BLOCK_recomputeInvalidatedAtoms = (buildingBlocks, store2) => {
|
|
372
|
+
let mountedMap = buildingBlocks[1], invalidatedAtoms = buildingBlocks[2], changedAtoms = buildingBlocks[3], ensureAtomState = buildingBlocks[11], readAtomState = buildingBlocks[14], mountDependencies = buildingBlocks[17];
|
|
373
|
+
if (!changedAtoms.size)
|
|
374
|
+
return;
|
|
375
|
+
let sortedReversedAtoms = [], sortedReversedStates = [], visiting = /* @__PURE__ */ new WeakSet(), visited = /* @__PURE__ */ new WeakSet(), stackAtoms = [], stackStates = [];
|
|
376
|
+
for (let atom2 of changedAtoms)
|
|
377
|
+
stackAtoms.push(atom2), stackStates.push(ensureAtomState(buildingBlocks, store2, atom2));
|
|
378
|
+
for (; stackAtoms.length; ) {
|
|
379
|
+
let top = stackAtoms.length - 1, a = stackAtoms[top], aState = stackStates[top];
|
|
380
|
+
if (visited.has(a)) {
|
|
381
|
+
stackAtoms.pop(), stackStates.pop();
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (visiting.has(a)) {
|
|
385
|
+
if (invalidatedAtoms.get(a) === aState.n)
|
|
386
|
+
sortedReversedAtoms.push(a), sortedReversedStates.push(aState);
|
|
387
|
+
else if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && invalidatedAtoms.has(a))
|
|
388
|
+
throw new Error("[Bug] invalidated atom exists");
|
|
389
|
+
visited.add(a), stackAtoms.pop(), stackStates.pop();
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
visiting.add(a);
|
|
393
|
+
for (let d of getMountedOrPendingDependents(a, aState, mountedMap))
|
|
394
|
+
visiting.has(d) || (stackAtoms.push(d), stackStates.push(ensureAtomState(buildingBlocks, store2, d)));
|
|
395
|
+
}
|
|
396
|
+
for (let i = sortedReversedAtoms.length - 1; i >= 0; --i) {
|
|
397
|
+
let a = sortedReversedAtoms[i], aState = sortedReversedStates[i], hasChangedDeps = !1;
|
|
398
|
+
for (let dep of aState.d.keys())
|
|
399
|
+
if (dep !== a && changedAtoms.has(dep)) {
|
|
400
|
+
hasChangedDeps = !0;
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
hasChangedDeps && (invalidatedAtoms.set(a, aState.n), readAtomState(buildingBlocks, store2, a), mountDependencies(buildingBlocks, store2, a)), invalidatedAtoms.delete(a);
|
|
404
|
+
}
|
|
405
|
+
}, storeMutationSet = /* @__PURE__ */ new WeakSet(), BUILDING_BLOCK_readAtomState = (buildingBlocks, store2, atom2) => {
|
|
406
|
+
var _a, _b;
|
|
407
|
+
let mountedMap = buildingBlocks[1], invalidatedAtoms = buildingBlocks[2], changedAtoms = buildingBlocks[3], storeHooks = buildingBlocks[6], atomRead = buildingBlocks[7], ensureAtomState = buildingBlocks[11], flushCallbacks = buildingBlocks[12], recomputeInvalidatedAtoms = buildingBlocks[13], readAtomState = buildingBlocks[14], writeAtomState = buildingBlocks[16], mountDependencies = buildingBlocks[17], setAtomStateValueOrPromise = buildingBlocks[20], registerAbortHandler = buildingBlocks[26], storeEpochHolder = buildingBlocks[28], atomState = ensureAtomState(buildingBlocks, store2, atom2), storeEpochNumber = storeEpochHolder[0];
|
|
408
|
+
if (isAtomStateInitialized(atomState)) {
|
|
409
|
+
if (
|
|
410
|
+
// If the atom is mounted, we can use cached atom state,
|
|
411
|
+
// because it should have been updated by dependencies.
|
|
412
|
+
// We can't use the cache if the atom is invalidated.
|
|
413
|
+
mountedMap.has(atom2) && invalidatedAtoms.get(atom2) !== atomState.n || // If atom is not mounted, we can use cached atom state,
|
|
414
|
+
// only if store hasn't been mutated.
|
|
415
|
+
atomState.m === storeEpochNumber
|
|
416
|
+
)
|
|
417
|
+
return atomState.m = storeEpochNumber, atomState;
|
|
418
|
+
let hasChangedDeps = !1;
|
|
419
|
+
for (let [a, n] of atomState.d)
|
|
420
|
+
if (readAtomState(buildingBlocks, store2, a).n !== n) {
|
|
421
|
+
hasChangedDeps = !0;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
if (!hasChangedDeps)
|
|
425
|
+
return atomState.m = storeEpochNumber, atomState;
|
|
426
|
+
}
|
|
427
|
+
let isSync = !0, prevDeps = new Set(atomState.d.keys()), pruneDependencies = () => {
|
|
428
|
+
for (let a of prevDeps)
|
|
429
|
+
atomState.d.delete(a);
|
|
430
|
+
}, mountDependenciesIfAsync = () => {
|
|
431
|
+
if (mountedMap.has(atom2)) {
|
|
432
|
+
let shouldRecompute = !changedAtoms.size;
|
|
433
|
+
mountDependencies(buildingBlocks, store2, atom2), shouldRecompute && (recomputeInvalidatedAtoms(buildingBlocks, store2), flushCallbacks(buildingBlocks, store2));
|
|
434
|
+
}
|
|
435
|
+
}, getter = (a) => {
|
|
436
|
+
var _a2;
|
|
437
|
+
if (a === atom2) {
|
|
438
|
+
let aState2 = ensureAtomState(buildingBlocks, store2, a);
|
|
439
|
+
if (!isAtomStateInitialized(aState2))
|
|
440
|
+
if (hasInitialValue(a))
|
|
441
|
+
setAtomStateValueOrPromise(buildingBlocks, store2, a, a.init);
|
|
442
|
+
else
|
|
443
|
+
throw new Error("no atom init");
|
|
444
|
+
return returnAtomValue(aState2);
|
|
445
|
+
}
|
|
446
|
+
let aState = readAtomState(buildingBlocks, store2, a);
|
|
447
|
+
try {
|
|
448
|
+
return returnAtomValue(aState);
|
|
449
|
+
} finally {
|
|
450
|
+
prevDeps.delete(a), atomState.d.set(a, aState.n), isPromiseLike(atomState.v) && addPendingPromiseToDependency(atom2, atomState.v, aState), mountedMap.has(atom2) && ((_a2 = mountedMap.get(a)) == null || _a2.t.add(atom2)), isSync || mountDependenciesIfAsync();
|
|
451
|
+
}
|
|
452
|
+
}, controller, setSelf, options = {
|
|
453
|
+
get signal() {
|
|
454
|
+
return controller || (controller = new AbortController()), controller.signal;
|
|
455
|
+
},
|
|
456
|
+
get setSelf() {
|
|
457
|
+
return (import.meta.env ? import.meta.env.MODE : void 0) !== "production" && console.warn(
|
|
458
|
+
"[DEPRECATED] setSelf is deprecated and will be removed in v3."
|
|
459
|
+
), (import.meta.env ? import.meta.env.MODE : void 0) !== "production" && !isActuallyWritableAtom(atom2) && console.warn("setSelf function cannot be used with read-only atom"), !setSelf && isActuallyWritableAtom(atom2) && (setSelf = (...args) => {
|
|
460
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && isSync && console.warn("setSelf function cannot be called in sync"), !isSync)
|
|
461
|
+
try {
|
|
462
|
+
return writeAtomState(buildingBlocks, store2, atom2, args);
|
|
463
|
+
} finally {
|
|
464
|
+
recomputeInvalidatedAtoms(buildingBlocks, store2), flushCallbacks(buildingBlocks, store2);
|
|
465
|
+
}
|
|
466
|
+
}), setSelf;
|
|
467
|
+
}
|
|
468
|
+
}, prevEpochNumber = atomState.n, prevInvalidated = invalidatedAtoms.get(atom2) === prevEpochNumber;
|
|
469
|
+
try {
|
|
470
|
+
(import.meta.env ? import.meta.env.MODE : void 0) !== "production" && storeMutationSet.delete(store2);
|
|
471
|
+
let valueOrPromise = atomRead(
|
|
472
|
+
buildingBlocks,
|
|
473
|
+
store2,
|
|
474
|
+
atom2,
|
|
475
|
+
getter,
|
|
476
|
+
options
|
|
477
|
+
);
|
|
478
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && storeMutationSet.has(store2) && console.warn(
|
|
479
|
+
"Detected store mutation during atom read. This is not supported."
|
|
480
|
+
), setAtomStateValueOrPromise(buildingBlocks, store2, atom2, valueOrPromise), isPromiseLike(valueOrPromise)) {
|
|
481
|
+
registerAbortHandler(
|
|
482
|
+
buildingBlocks,
|
|
483
|
+
store2,
|
|
484
|
+
valueOrPromise,
|
|
485
|
+
() => controller?.abort()
|
|
486
|
+
);
|
|
487
|
+
let settle = () => {
|
|
488
|
+
pruneDependencies(), mountDependenciesIfAsync();
|
|
489
|
+
};
|
|
490
|
+
valueOrPromise.then(settle, settle);
|
|
491
|
+
} else
|
|
492
|
+
pruneDependencies();
|
|
493
|
+
return (_a = storeHooks.r) == null || _a.call(storeHooks, atom2), atomState.m = storeEpochNumber, atomState;
|
|
494
|
+
} catch (error) {
|
|
495
|
+
if (shouldThrowSynchronously(error))
|
|
496
|
+
throw error;
|
|
497
|
+
return delete atomState.v, atomState.e = error, ++atomState.n, atomState.m = storeEpochNumber, atomState;
|
|
498
|
+
} finally {
|
|
499
|
+
isSync = !1, atomState.n !== prevEpochNumber && prevInvalidated && (invalidatedAtoms.set(atom2, atomState.n), changedAtoms.add(atom2), (_b = storeHooks.c) == null || _b.call(storeHooks, atom2));
|
|
500
|
+
}
|
|
501
|
+
}, BUILDING_BLOCK_invalidateDependents = (buildingBlocks, store2, atom2) => {
|
|
502
|
+
let mountedMap = buildingBlocks[1], invalidatedAtoms = buildingBlocks[2], ensureAtomState = buildingBlocks[11], stack = [atom2];
|
|
503
|
+
for (; stack.length; ) {
|
|
504
|
+
let a = stack.pop(), aState = ensureAtomState(buildingBlocks, store2, a);
|
|
505
|
+
for (let d of getMountedOrPendingDependents(a, aState, mountedMap)) {
|
|
506
|
+
let dState = ensureAtomState(buildingBlocks, store2, d);
|
|
507
|
+
invalidatedAtoms.get(d) !== dState.n && (invalidatedAtoms.set(d, dState.n), stack.push(d));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}, BUILDING_BLOCK_writeAtomState = (buildingBlocks, store2, atom2, args) => {
|
|
511
|
+
let changedAtoms = buildingBlocks[3], storeHooks = buildingBlocks[6], atomWrite = buildingBlocks[8], ensureAtomState = buildingBlocks[11], flushCallbacks = buildingBlocks[12], recomputeInvalidatedAtoms = buildingBlocks[13], readAtomState = buildingBlocks[14], invalidateDependents = buildingBlocks[15], writeAtomState = buildingBlocks[16], mountDependencies = buildingBlocks[17], setAtomStateValueOrPromise = buildingBlocks[20], storeEpochHolder = buildingBlocks[28], isSync = !0, getter = (a) => returnAtomValue(readAtomState(buildingBlocks, store2, a)), setter = (a, ...args2) => {
|
|
512
|
+
var _a;
|
|
513
|
+
let aState = ensureAtomState(buildingBlocks, store2, a);
|
|
514
|
+
try {
|
|
515
|
+
if (a === atom2) {
|
|
516
|
+
if (!hasInitialValue(a))
|
|
517
|
+
throw new Error("atom not writable");
|
|
518
|
+
(import.meta.env ? import.meta.env.MODE : void 0) !== "production" && storeMutationSet.add(store2);
|
|
519
|
+
let prevEpochNumber = aState.n, v = args2[0];
|
|
520
|
+
setAtomStateValueOrPromise(buildingBlocks, store2, a, v), mountDependencies(buildingBlocks, store2, a), prevEpochNumber !== aState.n && (++storeEpochHolder[0], changedAtoms.add(a), invalidateDependents(buildingBlocks, store2, a), (_a = storeHooks.c) == null || _a.call(storeHooks, a));
|
|
521
|
+
return;
|
|
522
|
+
} else
|
|
523
|
+
return writeAtomState(buildingBlocks, store2, a, args2);
|
|
524
|
+
} finally {
|
|
525
|
+
isSync || (recomputeInvalidatedAtoms(buildingBlocks, store2), flushCallbacks(buildingBlocks, store2));
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
try {
|
|
529
|
+
return atomWrite(buildingBlocks, store2, atom2, getter, setter, ...args);
|
|
530
|
+
} finally {
|
|
531
|
+
isSync = !1;
|
|
532
|
+
}
|
|
533
|
+
}, BUILDING_BLOCK_mountDependencies = (buildingBlocks, store2, atom2) => {
|
|
534
|
+
var _a;
|
|
535
|
+
let mountedMap = buildingBlocks[1], changedAtoms = buildingBlocks[3], storeHooks = buildingBlocks[6], ensureAtomState = buildingBlocks[11], invalidateDependents = buildingBlocks[15], mountAtom = buildingBlocks[18], unmountAtom = buildingBlocks[19], atomState = ensureAtomState(buildingBlocks, store2, atom2), mounted = mountedMap.get(atom2);
|
|
536
|
+
if (mounted && atomState.d.size > 0) {
|
|
537
|
+
for (let [a, n] of atomState.d)
|
|
538
|
+
if (!mounted.d.has(a)) {
|
|
539
|
+
let aState = ensureAtomState(buildingBlocks, store2, a);
|
|
540
|
+
mountAtom(buildingBlocks, store2, a).t.add(atom2), mounted.d.add(a), n !== aState.n && (changedAtoms.add(a), invalidateDependents(buildingBlocks, store2, a), (_a = storeHooks.c) == null || _a.call(storeHooks, a));
|
|
541
|
+
}
|
|
542
|
+
for (let a of mounted.d)
|
|
543
|
+
if (!atomState.d.has(a)) {
|
|
544
|
+
mounted.d.delete(a);
|
|
545
|
+
let aMounted = unmountAtom(buildingBlocks, store2, a);
|
|
546
|
+
aMounted?.t.delete(atom2);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}, BUILDING_BLOCK_mountAtom = (buildingBlocks, store2, atom2) => {
|
|
550
|
+
var _a;
|
|
551
|
+
let mountedMap = buildingBlocks[1], mountCallbacks = buildingBlocks[4], storeHooks = buildingBlocks[6], atomOnMount = buildingBlocks[10], ensureAtomState = buildingBlocks[11], flushCallbacks = buildingBlocks[12], recomputeInvalidatedAtoms = buildingBlocks[13], readAtomState = buildingBlocks[14], writeAtomState = buildingBlocks[16], mountAtom = buildingBlocks[18], atomState = ensureAtomState(buildingBlocks, store2, atom2), mounted = mountedMap.get(atom2);
|
|
552
|
+
if (!mounted) {
|
|
553
|
+
readAtomState(buildingBlocks, store2, atom2);
|
|
554
|
+
for (let a of atomState.d.keys())
|
|
555
|
+
mountAtom(buildingBlocks, store2, a).t.add(atom2);
|
|
556
|
+
if (mounted = {
|
|
557
|
+
l: /* @__PURE__ */ new Set(),
|
|
558
|
+
d: new Set(atomState.d.keys()),
|
|
559
|
+
t: /* @__PURE__ */ new Set()
|
|
560
|
+
}, mountedMap.set(atom2, mounted), isActuallyWritableAtom(atom2) && hasOnMount(atom2)) {
|
|
561
|
+
let processOnMount = () => {
|
|
562
|
+
let isSync = !0, setAtom = (...args) => {
|
|
563
|
+
try {
|
|
564
|
+
return writeAtomState(buildingBlocks, store2, atom2, args);
|
|
565
|
+
} finally {
|
|
566
|
+
isSync || (recomputeInvalidatedAtoms(buildingBlocks, store2), flushCallbacks(buildingBlocks, store2));
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
try {
|
|
570
|
+
let onUnmount = atomOnMount(buildingBlocks, store2, atom2, setAtom);
|
|
571
|
+
onUnmount && (mounted.u = () => {
|
|
572
|
+
isSync = !0;
|
|
573
|
+
try {
|
|
574
|
+
onUnmount();
|
|
575
|
+
} finally {
|
|
576
|
+
isSync = !1;
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
} finally {
|
|
580
|
+
isSync = !1;
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
mountCallbacks.add(processOnMount);
|
|
584
|
+
}
|
|
585
|
+
(_a = storeHooks.m) == null || _a.call(storeHooks, atom2);
|
|
586
|
+
}
|
|
587
|
+
return mounted;
|
|
588
|
+
}, BUILDING_BLOCK_unmountAtom = (buildingBlocks, store2, atom2) => {
|
|
589
|
+
var _a, _b;
|
|
590
|
+
let mountedMap = buildingBlocks[1], unmountCallbacks = buildingBlocks[5], storeHooks = buildingBlocks[6], ensureAtomState = buildingBlocks[11], unmountAtom = buildingBlocks[19], atomState = ensureAtomState(buildingBlocks, store2, atom2), mounted = mountedMap.get(atom2);
|
|
591
|
+
if (!mounted || mounted.l.size)
|
|
592
|
+
return mounted;
|
|
593
|
+
let isDependent = !1;
|
|
594
|
+
for (let a of mounted.t)
|
|
595
|
+
if ((_a = mountedMap.get(a)) != null && _a.d.has(atom2)) {
|
|
596
|
+
isDependent = !0;
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
if (!isDependent) {
|
|
600
|
+
mounted.u && unmountCallbacks.add(mounted.u), mounted = void 0, mountedMap.delete(atom2);
|
|
601
|
+
for (let a of atomState.d.keys()) {
|
|
602
|
+
let aMounted = unmountAtom(buildingBlocks, store2, a);
|
|
603
|
+
aMounted?.t.delete(atom2);
|
|
604
|
+
}
|
|
605
|
+
(_b = storeHooks.u) == null || _b.call(storeHooks, atom2);
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
return mounted;
|
|
609
|
+
}, BUILDING_BLOCK_setAtomStateValueOrPromise = (buildingBlocks, store2, atom2, valueOrPromise) => {
|
|
610
|
+
let ensureAtomState = buildingBlocks[11], abortPromise = buildingBlocks[27], atomState = ensureAtomState(buildingBlocks, store2, atom2), hasPrevValue = "v" in atomState, prevValue = atomState.v;
|
|
611
|
+
if (isPromiseLike(valueOrPromise))
|
|
612
|
+
for (let a of atomState.d.keys())
|
|
613
|
+
addPendingPromiseToDependency(
|
|
614
|
+
atom2,
|
|
615
|
+
valueOrPromise,
|
|
616
|
+
ensureAtomState(buildingBlocks, store2, a)
|
|
617
|
+
);
|
|
618
|
+
atomState.v = valueOrPromise, delete atomState.e, (!hasPrevValue || !Object.is(prevValue, atomState.v)) && (++atomState.n, isPromiseLike(prevValue) && abortPromise(buildingBlocks, store2, prevValue));
|
|
619
|
+
}, BUILDING_BLOCK_storeGet = (buildingBlocks, store2, atom2) => {
|
|
620
|
+
let readAtomState = buildingBlocks[14];
|
|
621
|
+
return returnAtomValue(readAtomState(buildingBlocks, store2, atom2));
|
|
622
|
+
}, BUILDING_BLOCK_storeSet = (buildingBlocks, store2, atom2, ...args) => {
|
|
623
|
+
let changedAtoms = buildingBlocks[3], flushCallbacks = buildingBlocks[12], recomputeInvalidatedAtoms = buildingBlocks[13], writeAtomState = buildingBlocks[16], prevChangedAtomsSize = changedAtoms.size;
|
|
624
|
+
try {
|
|
625
|
+
return writeAtomState(buildingBlocks, store2, atom2, args);
|
|
626
|
+
} finally {
|
|
627
|
+
changedAtoms.size !== prevChangedAtomsSize && (recomputeInvalidatedAtoms(buildingBlocks, store2), flushCallbacks(buildingBlocks, store2));
|
|
628
|
+
}
|
|
629
|
+
}, BUILDING_BLOCK_storeSub = (buildingBlocks, store2, atom2, listener) => {
|
|
630
|
+
let flushCallbacks = buildingBlocks[12], recomputeInvalidatedAtoms = buildingBlocks[13], mountAtom = buildingBlocks[18], unmountAtom = buildingBlocks[19], listeners = mountAtom(buildingBlocks, store2, atom2).l;
|
|
631
|
+
return listeners.add(listener), recomputeInvalidatedAtoms(buildingBlocks, store2), flushCallbacks(buildingBlocks, store2), () => {
|
|
632
|
+
listeners.delete(listener), unmountAtom(buildingBlocks, store2, atom2), recomputeInvalidatedAtoms(buildingBlocks, store2), flushCallbacks(buildingBlocks, store2);
|
|
633
|
+
};
|
|
634
|
+
}, BUILDING_BLOCK_registerAbortHandler = (buildingBlocks, _store, promise, abortHandler) => {
|
|
635
|
+
let abortHandlersMap = buildingBlocks[25], abortHandlers = abortHandlersMap.get(promise);
|
|
636
|
+
if (!abortHandlers) {
|
|
637
|
+
abortHandlers = /* @__PURE__ */ new Set(), abortHandlersMap.set(promise, abortHandlers);
|
|
638
|
+
let cleanup = () => abortHandlersMap.delete(promise);
|
|
639
|
+
promise.then(cleanup, cleanup);
|
|
640
|
+
}
|
|
641
|
+
abortHandlers.add(abortHandler);
|
|
642
|
+
}, BUILDING_BLOCK_abortPromise = (buildingBlocks, _store, promise) => {
|
|
643
|
+
let abortHandlers = buildingBlocks[25].get(promise);
|
|
644
|
+
abortHandlers?.forEach((fn) => fn());
|
|
645
|
+
}, buildingBlockMap = /* @__PURE__ */ new WeakMap();
|
|
646
|
+
function getBuildingBlocks(store2) {
|
|
647
|
+
let buildingBlocks = buildingBlockMap.get(store2);
|
|
648
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && !buildingBlocks)
|
|
649
|
+
throw new Error(
|
|
650
|
+
"Store must be created by buildStore to read its building blocks"
|
|
651
|
+
);
|
|
652
|
+
let enhanceBuildingBlocks = buildingBlocks[24];
|
|
653
|
+
return enhanceBuildingBlocks ? enhanceBuildingBlocks(buildingBlocks, store2) : buildingBlocks;
|
|
654
|
+
}
|
|
655
|
+
function buildStore(...partialBuildingBlocks) {
|
|
656
|
+
let store2 = {
|
|
657
|
+
get(atom2) {
|
|
658
|
+
return storeGet(buildingBlocks, store2, atom2);
|
|
659
|
+
},
|
|
660
|
+
set(atom2, ...args) {
|
|
661
|
+
return storeSet(buildingBlocks, store2, atom2, ...args);
|
|
662
|
+
},
|
|
663
|
+
sub(atom2, listener) {
|
|
664
|
+
return storeSub(buildingBlocks, store2, atom2, listener);
|
|
665
|
+
}
|
|
666
|
+
}, buildingBlocks = [
|
|
667
|
+
// store state
|
|
668
|
+
/* @__PURE__ */ new WeakMap(),
|
|
669
|
+
// atomStateMap
|
|
670
|
+
/* @__PURE__ */ new WeakMap(),
|
|
671
|
+
// mountedMap
|
|
672
|
+
/* @__PURE__ */ new WeakMap(),
|
|
673
|
+
// invalidatedAtoms
|
|
674
|
+
/* @__PURE__ */ new Set(),
|
|
675
|
+
// changedAtoms
|
|
676
|
+
/* @__PURE__ */ new Set(),
|
|
677
|
+
// mountCallbacks
|
|
678
|
+
/* @__PURE__ */ new Set(),
|
|
679
|
+
// unmountCallbacks
|
|
680
|
+
{},
|
|
681
|
+
// storeHooks
|
|
682
|
+
// atom interceptors
|
|
683
|
+
BUILDING_BLOCK_atomRead,
|
|
684
|
+
BUILDING_BLOCK_atomWrite,
|
|
685
|
+
BUILDING_BLOCK_atomOnInit,
|
|
686
|
+
BUILDING_BLOCK_atomOnMount,
|
|
687
|
+
// building-block functions
|
|
688
|
+
BUILDING_BLOCK_ensureAtomState,
|
|
689
|
+
BUILDING_BLOCK_flushCallbacks,
|
|
690
|
+
BUILDING_BLOCK_recomputeInvalidatedAtoms,
|
|
691
|
+
BUILDING_BLOCK_readAtomState,
|
|
692
|
+
BUILDING_BLOCK_invalidateDependents,
|
|
693
|
+
BUILDING_BLOCK_writeAtomState,
|
|
694
|
+
BUILDING_BLOCK_mountDependencies,
|
|
695
|
+
BUILDING_BLOCK_mountAtom,
|
|
696
|
+
BUILDING_BLOCK_unmountAtom,
|
|
697
|
+
BUILDING_BLOCK_setAtomStateValueOrPromise,
|
|
698
|
+
BUILDING_BLOCK_storeGet,
|
|
699
|
+
BUILDING_BLOCK_storeSet,
|
|
700
|
+
BUILDING_BLOCK_storeSub,
|
|
701
|
+
void 0,
|
|
702
|
+
// enhanceBuildingBlocks
|
|
703
|
+
// abortable promise support
|
|
704
|
+
/* @__PURE__ */ new WeakMap(),
|
|
705
|
+
// abortHandlersMap
|
|
706
|
+
BUILDING_BLOCK_registerAbortHandler,
|
|
707
|
+
BUILDING_BLOCK_abortPromise,
|
|
708
|
+
// store epoch
|
|
709
|
+
[0]
|
|
710
|
+
].map((fn, i) => partialBuildingBlocks[i] || fn);
|
|
711
|
+
buildingBlockMap.set(store2, Object.freeze(buildingBlocks));
|
|
712
|
+
let storeGet = buildingBlocks[21], storeSet = buildingBlocks[22], storeSub = buildingBlocks[23];
|
|
713
|
+
return store2;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// ../../node_modules/jotai/esm/vanilla.mjs
|
|
717
|
+
var keyCount = 0;
|
|
718
|
+
function atom(read, write) {
|
|
719
|
+
let key = `atom${++keyCount}`, config = {
|
|
720
|
+
toString() {
|
|
721
|
+
return (import.meta.env ? import.meta.env.MODE : void 0) !== "production" && this.debugLabel ? key + ":" + this.debugLabel : key;
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
return typeof read == "function" ? config.read = read : (config.init = read, config.read = defaultRead, config.write = defaultWrite), write && (config.write = write), config;
|
|
725
|
+
}
|
|
726
|
+
function defaultRead(get) {
|
|
727
|
+
return get(this);
|
|
728
|
+
}
|
|
729
|
+
function defaultWrite(get, set, arg) {
|
|
730
|
+
return set(
|
|
731
|
+
this,
|
|
732
|
+
typeof arg == "function" ? arg(get(this)) : arg
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
var overriddenCreateStore;
|
|
736
|
+
function createStore() {
|
|
737
|
+
return overriddenCreateStore ? overriddenCreateStore() : buildStore();
|
|
738
|
+
}
|
|
739
|
+
var defaultStore;
|
|
740
|
+
function getDefaultStore() {
|
|
741
|
+
return defaultStore || (defaultStore = createStore(), (import.meta.env ? import.meta.env.MODE : void 0) !== "production" && (globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = defaultStore), globalThis.__JOTAI_DEFAULT_STORE__ !== defaultStore && console.warn(
|
|
742
|
+
"Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
|
|
743
|
+
))), defaultStore;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// ../../node_modules/jotai/esm/react.mjs
|
|
747
|
+
import React, { createContext, useContext, useRef, createElement, useReducer, useEffect, useDebugValue, useCallback } from "react";
|
|
748
|
+
var StoreContext = createContext(
|
|
749
|
+
void 0
|
|
750
|
+
);
|
|
751
|
+
function useStore(options) {
|
|
752
|
+
let store2 = useContext(StoreContext);
|
|
753
|
+
return options?.store || store2 || getDefaultStore();
|
|
754
|
+
}
|
|
755
|
+
var isPromiseLike2 = (x) => typeof x?.then == "function", attachPromiseStatus = (promise) => {
|
|
756
|
+
promise.status || (promise.status = "pending", promise.then(
|
|
757
|
+
(v) => {
|
|
758
|
+
promise.status = "fulfilled", promise.value = v;
|
|
759
|
+
},
|
|
760
|
+
(e) => {
|
|
761
|
+
promise.status = "rejected", promise.reason = e;
|
|
762
|
+
}
|
|
763
|
+
));
|
|
764
|
+
}, use = React.use || // A shim for older React versions
|
|
765
|
+
((promise) => {
|
|
766
|
+
if (promise.status === "pending")
|
|
767
|
+
throw promise;
|
|
768
|
+
if (promise.status === "fulfilled")
|
|
769
|
+
return promise.value;
|
|
770
|
+
throw promise.status === "rejected" ? promise.reason : (attachPromiseStatus(promise), promise);
|
|
771
|
+
}), continuablePromiseMap = /* @__PURE__ */ new WeakMap(), createContinuablePromise = (store2, promise, getValue) => {
|
|
772
|
+
let buildingBlocks = getBuildingBlocks(store2), registerAbortHandler = buildingBlocks[26], continuablePromise = continuablePromiseMap.get(promise);
|
|
773
|
+
return continuablePromise || (continuablePromise = new Promise((resolve, reject) => {
|
|
774
|
+
let curr = promise, onFulfilled = (me) => (v) => {
|
|
775
|
+
curr === me && resolve(v);
|
|
776
|
+
}, onRejected = (me) => (e) => {
|
|
777
|
+
curr === me && reject(e);
|
|
778
|
+
}, onAbort = () => {
|
|
779
|
+
try {
|
|
780
|
+
let nextValue = getValue();
|
|
781
|
+
isPromiseLike2(nextValue) ? (continuablePromiseMap.set(nextValue, continuablePromise), curr = nextValue, nextValue.then(onFulfilled(nextValue), onRejected(nextValue)), registerAbortHandler(buildingBlocks, store2, nextValue, onAbort)) : resolve(nextValue);
|
|
782
|
+
} catch (e) {
|
|
783
|
+
reject(e);
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
promise.then(onFulfilled(promise), onRejected(promise)), registerAbortHandler(buildingBlocks, store2, promise, onAbort);
|
|
787
|
+
}), continuablePromiseMap.set(promise, continuablePromise)), continuablePromise;
|
|
788
|
+
};
|
|
789
|
+
function useAtomValue(atom2, options) {
|
|
790
|
+
let { delay, unstable_promiseStatus: promiseStatus = !React.use } = options || {}, store2 = useStore(options), [[valueFromReducer, storeFromReducer, atomFromReducer], rerender] = useReducer(
|
|
791
|
+
(prev) => {
|
|
792
|
+
let nextValue = store2.get(atom2);
|
|
793
|
+
return Object.is(prev[0], nextValue) && prev[1] === store2 && prev[2] === atom2 ? prev : [nextValue, store2, atom2];
|
|
794
|
+
},
|
|
795
|
+
void 0,
|
|
796
|
+
() => [store2.get(atom2), store2, atom2]
|
|
797
|
+
), value = valueFromReducer;
|
|
798
|
+
if ((storeFromReducer !== store2 || atomFromReducer !== atom2) && (rerender(), value = store2.get(atom2)), useEffect(() => {
|
|
799
|
+
let unsub = store2.sub(atom2, () => {
|
|
800
|
+
if (promiseStatus)
|
|
801
|
+
try {
|
|
802
|
+
let value2 = store2.get(atom2);
|
|
803
|
+
isPromiseLike2(value2) && attachPromiseStatus(
|
|
804
|
+
createContinuablePromise(store2, value2, () => store2.get(atom2))
|
|
805
|
+
);
|
|
806
|
+
} catch {
|
|
807
|
+
}
|
|
808
|
+
if (typeof delay == "number") {
|
|
809
|
+
console.warn(`[DEPRECATED] delay option is deprecated and will be removed in v3.
|
|
810
|
+
|
|
811
|
+
Migration guide:
|
|
812
|
+
|
|
813
|
+
Create a custom hook like the following.
|
|
814
|
+
|
|
815
|
+
function useAtomValueWithDelay<Value>(
|
|
816
|
+
atom: Atom<Value>,
|
|
817
|
+
options: { delay: number },
|
|
818
|
+
): Value {
|
|
819
|
+
const { delay } = options
|
|
820
|
+
const store = useStore(options)
|
|
821
|
+
const [value, setValue] = useState(() => store.get(atom))
|
|
822
|
+
useEffect(() => {
|
|
823
|
+
const unsub = store.sub(atom, () => {
|
|
824
|
+
setTimeout(() => setValue(store.get(atom)), delay)
|
|
825
|
+
})
|
|
826
|
+
return unsub
|
|
827
|
+
}, [store, atom, delay])
|
|
828
|
+
return value
|
|
829
|
+
}
|
|
830
|
+
`), setTimeout(rerender, delay);
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
rerender();
|
|
834
|
+
});
|
|
835
|
+
return rerender(), unsub;
|
|
836
|
+
}, [store2, atom2, delay, promiseStatus]), useDebugValue(value), isPromiseLike2(value)) {
|
|
837
|
+
let promise = createContinuablePromise(
|
|
838
|
+
store2,
|
|
839
|
+
value,
|
|
840
|
+
() => store2.get(atom2)
|
|
841
|
+
);
|
|
842
|
+
return promiseStatus && attachPromiseStatus(promise), use(promise);
|
|
843
|
+
}
|
|
844
|
+
return value;
|
|
845
|
+
}
|
|
846
|
+
function useSetAtom(atom2, options) {
|
|
847
|
+
let store2 = useStore(options);
|
|
848
|
+
return useCallback(
|
|
849
|
+
(...args) => {
|
|
850
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && !("write" in atom2))
|
|
851
|
+
throw new Error("not writable atom");
|
|
852
|
+
return store2.set(atom2, ...args);
|
|
853
|
+
},
|
|
854
|
+
[store2, atom2]
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// src/react-native/hooks.tsx
|
|
859
|
+
var store = createStore(), storyContextAtom = atom(null);
|
|
860
|
+
function useSetStoryContext() {
|
|
861
|
+
return useSetAtom(storyContextAtom, { store });
|
|
862
|
+
}
|
|
863
|
+
function useStoryContext() {
|
|
864
|
+
return useAtomValue(storyContextAtom, { store });
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// src/react-native/components/StoryView/ErrorBoundary.tsx
|
|
868
|
+
import React2 from "react";
|
|
869
|
+
import { View, Text } from "react-native";
|
|
870
|
+
import { jsx } from "react/jsx-runtime";
|
|
871
|
+
var ErrorBoundary = class extends React2.Component {
|
|
872
|
+
constructor(props) {
|
|
873
|
+
super(props), this.state = { hasError: !1 };
|
|
874
|
+
}
|
|
875
|
+
static getDerivedStateFromError(_error) {
|
|
876
|
+
return { hasError: !0 };
|
|
877
|
+
}
|
|
878
|
+
componentDidCatch(error, info) {
|
|
879
|
+
this.props.onError(error, info.componentStack);
|
|
880
|
+
}
|
|
881
|
+
render() {
|
|
882
|
+
return this.state.hasError ? jsx(
|
|
883
|
+
View,
|
|
884
|
+
{
|
|
885
|
+
style: {
|
|
886
|
+
margin: 16,
|
|
887
|
+
padding: 16,
|
|
888
|
+
borderColor: "red",
|
|
889
|
+
borderWidth: 2,
|
|
890
|
+
alignItems: "center",
|
|
891
|
+
justifyContent: "center",
|
|
892
|
+
borderRadius: 4
|
|
893
|
+
},
|
|
894
|
+
children: jsx(Text, { style: { fontWeight: "bold" }, children: "Something went wrong rendering your story" })
|
|
895
|
+
}
|
|
896
|
+
) : this.props.children;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
// src/react-native/components/StoryView/StoryView.tsx
|
|
901
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
902
|
+
function dismissOnStartResponder() {
|
|
903
|
+
return Keyboard.dismiss(), !1;
|
|
904
|
+
}
|
|
905
|
+
var Text2 = styled.Text(({ theme: theme3 }) => ({
|
|
906
|
+
color: theme3?.color?.defaultText
|
|
907
|
+
})), errorContainerStyle = {
|
|
908
|
+
flex: 1,
|
|
909
|
+
padding: 16,
|
|
910
|
+
alignItems: "center",
|
|
911
|
+
justifyContent: "center"
|
|
912
|
+
}, layoutStyles = {
|
|
913
|
+
padded: { padding: 8 },
|
|
914
|
+
centered: { alignItems: "center", justifyContent: "center" },
|
|
915
|
+
fullscreen: {}
|
|
916
|
+
}, StoryView = ({
|
|
917
|
+
useWrapper = !0,
|
|
918
|
+
storyBackgroundColor
|
|
919
|
+
}) => {
|
|
920
|
+
let context = useStoryContext(), id = context?.id, theme3 = useTheme(), containerStyle = useMemo(() => {
|
|
921
|
+
let layout = context?.parameters?.layout, layoutStyle = typeof layout == "string" && layout in layoutStyles ? layoutStyles[layout] : {};
|
|
922
|
+
return {
|
|
923
|
+
flex: 1,
|
|
924
|
+
backgroundColor: storyBackgroundColor || theme3.background?.content,
|
|
925
|
+
overflow: "hidden",
|
|
926
|
+
...layoutStyle
|
|
927
|
+
};
|
|
928
|
+
}, [theme3.background?.content, context?.parameters?.layout, storyBackgroundColor]), onError = useCallback2(() => {
|
|
929
|
+
console.log(`Error rendering story for ${context?.title} ${context?.name}`);
|
|
930
|
+
}, [context?.title, context?.name]);
|
|
931
|
+
if (context && context.unboundStoryFn) {
|
|
932
|
+
let { unboundStoryFn: StoryComponent } = context;
|
|
933
|
+
return useWrapper ? jsx2(
|
|
934
|
+
View2,
|
|
935
|
+
{
|
|
936
|
+
style: containerStyle,
|
|
937
|
+
testID: id,
|
|
938
|
+
accessibilityLabel: id,
|
|
939
|
+
importantForAccessibility: "no",
|
|
940
|
+
onStartShouldSetResponder: dismissOnStartResponder,
|
|
941
|
+
children: jsx2(ErrorBoundary, { onError, children: StoryComponent && jsx2(StoryComponent, { ...context }) })
|
|
942
|
+
},
|
|
943
|
+
id
|
|
944
|
+
) : jsx2(ErrorBoundary, { onError, children: StoryComponent && jsx2(StoryComponent, { ...context }) });
|
|
945
|
+
}
|
|
946
|
+
return jsx2(View2, { style: errorContainerStyle, children: jsx2(Text2, { children: "Please select a story to preview." }) });
|
|
947
|
+
}, StoryView_default = React3.memo(StoryView);
|
|
948
|
+
|
|
949
|
+
// src/react-native/constants.ts
|
|
950
|
+
var RN_STORYBOOK_STORAGE_KEY = "lastOpenedStory", RN_STORYBOOK_EVENTS = {
|
|
951
|
+
RN_GET_INDEX: "RN_GET_INDEX",
|
|
952
|
+
RN_GET_INDEX_RESPONSE: "RN_GET_INDEX_RESPONSE"
|
|
953
|
+
}, STORYBOOK_STORY_ID_PARAM = "STORYBOOK_STORY_ID";
|
|
954
|
+
|
|
955
|
+
// src/react-native/View.tsx
|
|
956
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
957
|
+
function resolveStoryBackgroundColor(story) {
|
|
958
|
+
let backgroundGlobal = story?.globals?.backgrounds?.value, bgParams = story?.parameters?.backgrounds, backgroundName = backgroundGlobal;
|
|
959
|
+
if (backgroundName) {
|
|
960
|
+
if (bgParams?.options?.[backgroundName]?.value)
|
|
961
|
+
return bgParams.options[backgroundName].value;
|
|
962
|
+
if (backgroundName.startsWith("#")) return backgroundName;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
var View3 = class {
|
|
966
|
+
constructor(preview, channel, options) {
|
|
967
|
+
this._setStory = () => {
|
|
968
|
+
};
|
|
969
|
+
this._forceRerender = () => {
|
|
970
|
+
};
|
|
971
|
+
this._ready = !1;
|
|
972
|
+
this._asyncStorageStoryId = null;
|
|
973
|
+
this._idToPrepared = {};
|
|
974
|
+
this._storyIdExists = (storyId) => Object.keys(this._storyIndex.entries).includes(storyId);
|
|
975
|
+
this._selectInitialStory = async ({
|
|
976
|
+
selectionSpecifier,
|
|
977
|
+
storyIdFromUrl
|
|
978
|
+
}) => {
|
|
979
|
+
this._preview.selectionStore.selectionSpecifier = storyIdFromUrl ? { storySpecifier: storyIdFromUrl, viewMode: "story" } : selectionSpecifier, this._preview.selectionStore.selection = void 0, await this._preview.selectSpecifiedStory();
|
|
980
|
+
};
|
|
981
|
+
this._getInitialStory = async ({
|
|
982
|
+
initialSelection,
|
|
983
|
+
shouldPersistSelection = !0
|
|
984
|
+
} = {}) => {
|
|
985
|
+
if (initialSelection)
|
|
986
|
+
return typeof initialSelection == "string" ? { storySpecifier: initialSelection, viewMode: "story" } : {
|
|
987
|
+
storySpecifier: toId(initialSelection.kind, initialSelection.name),
|
|
988
|
+
viewMode: "story"
|
|
989
|
+
};
|
|
990
|
+
if (shouldPersistSelection)
|
|
991
|
+
try {
|
|
992
|
+
let value = this._asyncStorageStoryId;
|
|
993
|
+
return !value && this._storage != null && (value = await this._storage.getItem(RN_STORYBOOK_STORAGE_KEY), value || (await new Promise((resolve) => setTimeout(resolve, 100)), value = await this._storage.getItem(RN_STORYBOOK_STORAGE_KEY)), this._asyncStorageStoryId = value), { storySpecifier: (value && this._storyIdExists(value) ? value : void 0) ?? "*", viewMode: "story" };
|
|
994
|
+
} catch (e) {
|
|
995
|
+
console.warn("storybook-log: error reading from async storage", e);
|
|
996
|
+
}
|
|
997
|
+
return { storySpecifier: "*", viewMode: "story" };
|
|
998
|
+
};
|
|
999
|
+
this._getHost = (params = {}) => params.host ? params.host : globalThis.STORYBOOK_WEBSOCKET?.host ? globalThis.STORYBOOK_WEBSOCKET.host : Platform.OS === "android" ? "10.0.2.2" : "localhost";
|
|
1000
|
+
this.__getPort = (params = {}) => params.port ? params.port : globalThis.STORYBOOK_WEBSOCKET?.port ? globalThis.STORYBOOK_WEBSOCKET.port : 7007;
|
|
1001
|
+
this._isSecureConnection = (params = {}) => typeof params.secured == "boolean" ? params.secured : globalThis.STORYBOOK_WEBSOCKET?.secured ?? !1;
|
|
1002
|
+
this._getServerChannel = (params = {}) => {
|
|
1003
|
+
let host = this._getHost(params), port = `:${this.__getPort(params)}`, query = params.query || "", url = `${this._isSecureConnection(params) ? "wss" : "ws"}://${host}${port}/${query}`, channel = new Channel({
|
|
1004
|
+
async: !0,
|
|
1005
|
+
transport: new WebsocketTransport({
|
|
1006
|
+
url,
|
|
1007
|
+
onError: (e) => {
|
|
1008
|
+
console.log(`WebsocketTransport error ${JSON.stringify(e)}`);
|
|
1009
|
+
}
|
|
1010
|
+
})
|
|
1011
|
+
});
|
|
1012
|
+
return patchChannelForRN(channel), channel;
|
|
1013
|
+
};
|
|
1014
|
+
this.createPreparedStoryMapping = async () => {
|
|
1015
|
+
await this._preview.ready().then(
|
|
1016
|
+
() => Promise.all(
|
|
1017
|
+
Object.keys(this._storyIndex.entries).map(async (storyId) => {
|
|
1018
|
+
this._idToPrepared[storyId] = await this._preview.loadStory({ storyId });
|
|
1019
|
+
})
|
|
1020
|
+
)
|
|
1021
|
+
);
|
|
1022
|
+
};
|
|
1023
|
+
this.getStorybookUI = (params = {}) => {
|
|
1024
|
+
let {
|
|
1025
|
+
enableWebsockets = !!globalThis.STORYBOOK_WEBSOCKET,
|
|
1026
|
+
CustomUIComponent,
|
|
1027
|
+
hasStoryWrapper: storyViewWrapper = !0
|
|
1028
|
+
} = params, storage = params.storage ?? {
|
|
1029
|
+
getItem: async (key) => null,
|
|
1030
|
+
setItem: async (key, value) => {
|
|
1031
|
+
}
|
|
1032
|
+
}, onDeviceUI = this._options?.disableUI ? !1 : params.onDeviceUI ?? !0, shouldPersistSelection = this._options.disableUI ? !1 : params.shouldPersistSelection ?? !0, FullUI = ((enabled) => enabled && DeviceUI ? DeviceUI : ({ children }) => children)(onDeviceUI && !CustomUIComponent);
|
|
1033
|
+
if (this._storage = storage ?? {
|
|
1034
|
+
getItem: async (key) => null,
|
|
1035
|
+
setItem: async (key, value) => {
|
|
1036
|
+
}
|
|
1037
|
+
}, enableWebsockets) {
|
|
1038
|
+
let channel = this._getServerChannel(params);
|
|
1039
|
+
managerAddons.setChannel(channel), previewAddons.setChannel(channel), this._channel = channel, this._preview.channel = channel, this._preview.setupListeners(), channel.emit(CHANNEL_CREATED), this._preview.ready().then(() => this._preview.onStoryIndexChanged());
|
|
1040
|
+
}
|
|
1041
|
+
this._channel.on(RN_STORYBOOK_EVENTS.RN_GET_INDEX, () => {
|
|
1042
|
+
this._channel.emit(RN_STORYBOOK_EVENTS.RN_GET_INDEX_RESPONSE, { index: this._storyIndex });
|
|
1043
|
+
}), managerAddons.loadAddons({
|
|
1044
|
+
store: () => ({
|
|
1045
|
+
fromId: (id) => {
|
|
1046
|
+
if (!this._ready)
|
|
1047
|
+
throw new Error("Storybook is not ready yet");
|
|
1048
|
+
return this._preview.getStoryContext(this._idToPrepared[id]);
|
|
1049
|
+
},
|
|
1050
|
+
getSelection: () => this._preview.currentSelection,
|
|
1051
|
+
_channel: this._channel
|
|
1052
|
+
})
|
|
1053
|
+
});
|
|
1054
|
+
let self2 = this;
|
|
1055
|
+
return () => {
|
|
1056
|
+
let setContext = useSetStoryContext(), story = useStoryContext(), colorScheme = useColorScheme(), [update, forceUpdate] = useReducer2((x) => x + 1, 0), [ready, setReady] = useState(!1), appliedTheme = useMemo2(
|
|
1057
|
+
() => (0, import_deepmerge.default)(colorScheme === "dark" ? darkTheme : theme, params.theme ?? {}),
|
|
1058
|
+
[colorScheme]
|
|
1059
|
+
);
|
|
1060
|
+
useEffect2(() => {
|
|
1061
|
+
let listener = Linking.addEventListener("url", ({ url }) => {
|
|
1062
|
+
if (typeof url == "string") {
|
|
1063
|
+
let storyId = new URL(url).searchParams.get(STORYBOOK_STORY_ID_PARAM), hasStoryId = storyId && typeof storyId == "string", storyExists = hasStoryId && self2._storyIdExists(storyId);
|
|
1064
|
+
storyExists && self2._ready && (console.log(`STORYBOOK: Linking event received, navigating to story: ${storyId}`), self2._channel.emit(SET_CURRENT_STORY, { storyId })), hasStoryId && !storyExists && console.log(
|
|
1065
|
+
`STORYBOOK: Linking event received, but story does not exist: ${storyId}`
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
return () => {
|
|
1070
|
+
listener.remove();
|
|
1071
|
+
};
|
|
1072
|
+
}, []), useEffect2(() => {
|
|
1073
|
+
self2.createPreparedStoryMapping().then(
|
|
1074
|
+
() => Linking.getInitialURL().then((url) => {
|
|
1075
|
+
if (url && typeof url == "string") {
|
|
1076
|
+
let storyId = new URL(url).searchParams.get(STORYBOOK_STORY_ID_PARAM), hasStoryId = typeof storyId == "string", storyExists = hasStoryId && self2._storyIdExists(storyId);
|
|
1077
|
+
if (hasStoryId && !storyExists && console.log(
|
|
1078
|
+
`STORYBOOK: Initial Linking event received, but story does not exist: ${storyId}`
|
|
1079
|
+
), storyExists)
|
|
1080
|
+
return storyId;
|
|
1081
|
+
}
|
|
1082
|
+
return null;
|
|
1083
|
+
})
|
|
1084
|
+
).then(
|
|
1085
|
+
(initialStoryIdFromUrl) => self2._getInitialStory(params).then((st) => (initialStoryIdFromUrl && console.log(
|
|
1086
|
+
`STORYBOOK: Setting initial story from Linking event, storyId: ${initialStoryIdFromUrl}`
|
|
1087
|
+
), self2._selectInitialStory({
|
|
1088
|
+
selectionSpecifier: st,
|
|
1089
|
+
storyIdFromUrl: initialStoryIdFromUrl
|
|
1090
|
+
})))
|
|
1091
|
+
).then(() => {
|
|
1092
|
+
let currentStoryId = self2._preview.currentSelection?.storyId, preparedStory = currentStoryId ? self2._idToPrepared[currentStoryId] : void 0;
|
|
1093
|
+
preparedStory && setContext(
|
|
1094
|
+
self2._preview.getStoryContext(
|
|
1095
|
+
preparedStory
|
|
1096
|
+
)
|
|
1097
|
+
), self2._ready = !0, setReady(!0);
|
|
1098
|
+
}).catch((e) => console.error(e)), self2._setStory = (newStory) => {
|
|
1099
|
+
if (setContext(newStory), shouldPersistSelection && !params.storage && console.warn(dedent`Please set storage in getStorybookUI like this:
|
|
1100
|
+
const StorybookUIRoot = view.getStorybookUI({
|
|
1101
|
+
storage: {
|
|
1102
|
+
getItem: AsyncStorage.getItem,
|
|
1103
|
+
setItem: AsyncStorage.setItem,
|
|
1104
|
+
},
|
|
1105
|
+
});
|
|
1106
|
+
`), shouldPersistSelection && self2._storage && self2._ready)
|
|
1107
|
+
try {
|
|
1108
|
+
self2._asyncStorageStoryId = newStory.id;
|
|
1109
|
+
let ret = self2._storage.setItem(RN_STORYBOOK_STORAGE_KEY, newStory.id);
|
|
1110
|
+
ret && typeof ret.then == "function" && ret.catch((e) => {
|
|
1111
|
+
console.warn("storybook-log: error writing to async storage", e);
|
|
1112
|
+
});
|
|
1113
|
+
} catch (e) {
|
|
1114
|
+
console.warn("storybook-log: error writing to async storage", e);
|
|
1115
|
+
}
|
|
1116
|
+
}, self2._forceRerender = () => forceUpdate();
|
|
1117
|
+
}, []);
|
|
1118
|
+
let storyHash = useMemo2(() => ready ? transformStoryIndexToStoriesHash(self2._storyIndex, {
|
|
1119
|
+
docsOptions: { docsMode: !1, defaultName: "" },
|
|
1120
|
+
filters: {},
|
|
1121
|
+
allStatuses: {},
|
|
1122
|
+
provider: {
|
|
1123
|
+
handleAPI: () => ({}),
|
|
1124
|
+
getConfig: () => ({})
|
|
1125
|
+
}
|
|
1126
|
+
}) : {}, [ready, update]);
|
|
1127
|
+
if (!ready)
|
|
1128
|
+
return jsx3(
|
|
1129
|
+
RNView,
|
|
1130
|
+
{
|
|
1131
|
+
style: {
|
|
1132
|
+
position: "absolute",
|
|
1133
|
+
top: 0,
|
|
1134
|
+
left: 0,
|
|
1135
|
+
right: 0,
|
|
1136
|
+
bottom: 0,
|
|
1137
|
+
alignItems: "center",
|
|
1138
|
+
justifyContent: "center"
|
|
1139
|
+
},
|
|
1140
|
+
children: jsx3(ActivityIndicator, { animating: !0, size: "large" })
|
|
1141
|
+
}
|
|
1142
|
+
);
|
|
1143
|
+
let storyBackgroundColor = globalThis.FEATURES?.ondeviceBackgrounds ? resolveStoryBackgroundColor(story) : void 0;
|
|
1144
|
+
return onDeviceUI ? CustomUIComponent ? jsx3(
|
|
1145
|
+
CustomUIComponent,
|
|
1146
|
+
{
|
|
1147
|
+
story,
|
|
1148
|
+
storyHash,
|
|
1149
|
+
setStory: (newStoryId) => self2._channel.emit(SET_CURRENT_STORY, { storyId: newStoryId }),
|
|
1150
|
+
storage,
|
|
1151
|
+
theme: appliedTheme,
|
|
1152
|
+
storyBackgroundColor,
|
|
1153
|
+
children: jsx3(
|
|
1154
|
+
StoryView_default,
|
|
1155
|
+
{
|
|
1156
|
+
useWrapper: storyViewWrapper,
|
|
1157
|
+
storyBackgroundColor
|
|
1158
|
+
}
|
|
1159
|
+
)
|
|
1160
|
+
}
|
|
1161
|
+
) : jsx3(
|
|
1162
|
+
FullUI,
|
|
1163
|
+
{
|
|
1164
|
+
storage,
|
|
1165
|
+
theme: appliedTheme,
|
|
1166
|
+
storyHash,
|
|
1167
|
+
story,
|
|
1168
|
+
setStory: (newStoryId) => self2._channel.emit(SET_CURRENT_STORY, { storyId: newStoryId }),
|
|
1169
|
+
storyBackgroundColor,
|
|
1170
|
+
children: jsx3(StoryView_default, { useWrapper: storyViewWrapper, storyBackgroundColor })
|
|
1171
|
+
}
|
|
1172
|
+
) : jsxs(SafeAreaProvider, { children: [
|
|
1173
|
+
jsx3(StatusBar, { hidden: !0 }),
|
|
1174
|
+
jsx3(
|
|
1175
|
+
WithSafeArea,
|
|
1176
|
+
{
|
|
1177
|
+
id: story?.id ?? "",
|
|
1178
|
+
safeAreaEnabled: !(story?.parameters?.noSafeArea ?? !1),
|
|
1179
|
+
children: jsx3(
|
|
1180
|
+
StoryView_default,
|
|
1181
|
+
{
|
|
1182
|
+
useWrapper: storyViewWrapper,
|
|
1183
|
+
storyBackgroundColor
|
|
1184
|
+
}
|
|
1185
|
+
)
|
|
1186
|
+
}
|
|
1187
|
+
)
|
|
1188
|
+
] });
|
|
1189
|
+
};
|
|
1190
|
+
};
|
|
1191
|
+
this._preview = preview, this._channel = channel, this._options = options ?? {};
|
|
1192
|
+
}
|
|
1193
|
+
}, WithSafeArea = ({
|
|
1194
|
+
children,
|
|
1195
|
+
id,
|
|
1196
|
+
safeAreaEnabled
|
|
1197
|
+
}) => {
|
|
1198
|
+
let insets = useSafeAreaInsets();
|
|
1199
|
+
return jsx3(
|
|
1200
|
+
RNView,
|
|
1201
|
+
{
|
|
1202
|
+
style: {
|
|
1203
|
+
flex: 1,
|
|
1204
|
+
paddingTop: safeAreaEnabled ? insets.top : 0,
|
|
1205
|
+
paddingBottom: safeAreaEnabled ? insets.bottom : 0
|
|
1206
|
+
},
|
|
1207
|
+
accessibilityLabel: id,
|
|
1208
|
+
testID: id,
|
|
1209
|
+
accessible: !0,
|
|
1210
|
+
children
|
|
1211
|
+
}
|
|
1212
|
+
);
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1215
|
+
// src/react-native/prepareStories.ts
|
|
1216
|
+
import {
|
|
1217
|
+
sortStoriesV7,
|
|
1218
|
+
userOrAutoTitleFromSpecifier
|
|
1219
|
+
} from "@aussieljk/forkbook/internal/preview-api";
|
|
1220
|
+
import { isExportStory, storyNameFromExport, toId as toId2 } from "@aussieljk/forkbook/internal/csf";
|
|
1221
|
+
function prepareStories({
|
|
1222
|
+
storyEntries,
|
|
1223
|
+
options,
|
|
1224
|
+
storySort
|
|
1225
|
+
}) {
|
|
1226
|
+
let index = {
|
|
1227
|
+
v: 5,
|
|
1228
|
+
entries: {}
|
|
1229
|
+
}, importMap = {}, makeTitle = (fileName, specifier, userTitle) => {
|
|
1230
|
+
let title = userOrAutoTitleFromSpecifier(fileName, specifier, userTitle);
|
|
1231
|
+
if (title)
|
|
1232
|
+
return title.replace("./", "");
|
|
1233
|
+
throw console.log({
|
|
1234
|
+
fileName,
|
|
1235
|
+
userTitle,
|
|
1236
|
+
storyEntries: storyEntries.map((entry) => ({ ...entry, importPathMatcher: entry.importPathMatcher.source })),
|
|
1237
|
+
title: title ?? ""
|
|
1238
|
+
}), new Error("Could not generate title");
|
|
1239
|
+
};
|
|
1240
|
+
storyEntries.forEach((specifier) => {
|
|
1241
|
+
let { req, directory: root } = specifier;
|
|
1242
|
+
req.keys().forEach((filename) => {
|
|
1243
|
+
try {
|
|
1244
|
+
let fileExports = req(filename);
|
|
1245
|
+
if (!fileExports.default) return;
|
|
1246
|
+
let meta = fileExports.default;
|
|
1247
|
+
Object.keys(fileExports).forEach((key) => {
|
|
1248
|
+
if (key === "default" || !isExportStory(key, fileExports.default)) return;
|
|
1249
|
+
let exportValue = fileExports[key];
|
|
1250
|
+
if (!exportValue) return;
|
|
1251
|
+
let title = makeTitle(filename, specifier, meta.title);
|
|
1252
|
+
if (title) {
|
|
1253
|
+
let nameFromExport = storyNameFromExport(key), id = toId2(title, nameFromExport), name = nameFromExport;
|
|
1254
|
+
typeof exportValue == "function" ? name = exportValue?.storyName || nameFromExport : name = exportValue?.name || exportValue?.storyName || nameFromExport, index.entries[id] = {
|
|
1255
|
+
type: "story",
|
|
1256
|
+
id,
|
|
1257
|
+
name,
|
|
1258
|
+
title,
|
|
1259
|
+
importPath: `${root}/${filename.substring(2)}`,
|
|
1260
|
+
// FIXME: use normalize function here
|
|
1261
|
+
tags: ["story"],
|
|
1262
|
+
subtype: "story"
|
|
1263
|
+
};
|
|
1264
|
+
let importedStories = req(filename), stories = Object.entries(importedStories).reduce((carry, [storyKey, story]) => (isExportStory(storyKey, fileExports.default) && (story.play && !options?.playFn ? carry[storyKey] = { ...story, play: void 0 } : carry[storyKey] = story), carry), {});
|
|
1265
|
+
importMap[`${root}/${filename.substring(2)}`] = stories;
|
|
1266
|
+
} else
|
|
1267
|
+
console.log(`Unexpected error while loading ${filename}: could not find title`);
|
|
1268
|
+
});
|
|
1269
|
+
} catch (error) {
|
|
1270
|
+
let typedError = error, errorString = typedError.message && typedError.stack ? `${typedError.message}
|
|
1271
|
+
${typedError.stack}` : typedError.toString();
|
|
1272
|
+
console.error(`Unexpected error while loading ${filename}: ${errorString}`);
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
});
|
|
1276
|
+
let sortableStories = Object.values(index.entries);
|
|
1277
|
+
return sortStoriesV7(
|
|
1278
|
+
sortableStories,
|
|
1279
|
+
storySort,
|
|
1280
|
+
Object.values(index.entries).map((entry) => entry.importPath)
|
|
1281
|
+
), { index: { v: 5, entries: sortableStories.reduce(
|
|
1282
|
+
(acc, item) => (acc[item.id] = item, acc),
|
|
1283
|
+
{}
|
|
1284
|
+
) }, importMap };
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
// src/react-native/backgrounds/register.tsx
|
|
1288
|
+
import { addons, types } from "@aussieljk/forkbook/manager-api";
|
|
1289
|
+
|
|
1290
|
+
// src/react-native/backgrounds/BackgroundPanel.tsx
|
|
1291
|
+
import { View as View4 } from "react-native";
|
|
1292
|
+
import { useCallback as useCallback3 } from "react";
|
|
1293
|
+
import { UPDATE_GLOBALS } from "@aussieljk/forkbook/internal/core-events";
|
|
1294
|
+
import { styled as styled3 } from "@aussieljk/forkbook/internal/react-native-theming";
|
|
1295
|
+
|
|
1296
|
+
// src/react-native/backgrounds/Swatch.tsx
|
|
1297
|
+
import { styled as styled2 } from "@aussieljk/forkbook/internal/react-native-theming";
|
|
1298
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1299
|
+
var PressableSwatch = styled2.TouchableOpacity(({ theme: theme3 }) => ({
|
|
1300
|
+
marginBottom: 10,
|
|
1301
|
+
borderWidth: 1,
|
|
1302
|
+
borderColor: theme3.appBorderColor,
|
|
1303
|
+
borderRadius: 6,
|
|
1304
|
+
backgroundColor: theme3.background.content,
|
|
1305
|
+
paddingVertical: 4,
|
|
1306
|
+
paddingHorizontal: 4
|
|
1307
|
+
})), ColorSwatch = styled2.View(({ color, theme: theme3 }) => ({
|
|
1308
|
+
height: 40,
|
|
1309
|
+
width: "100%",
|
|
1310
|
+
borderRadius: 4,
|
|
1311
|
+
backgroundColor: color,
|
|
1312
|
+
borderColor: theme3.appBorderColor,
|
|
1313
|
+
borderWidth: 1
|
|
1314
|
+
})), ValueContainer = styled2.View(() => ({
|
|
1315
|
+
flex: 1,
|
|
1316
|
+
flexDirection: "row",
|
|
1317
|
+
justifyContent: "space-between",
|
|
1318
|
+
padding: 4,
|
|
1319
|
+
paddingBottom: 0
|
|
1320
|
+
})), NameText = styled2.Text(({ theme: theme3 }) => ({
|
|
1321
|
+
fontSize: theme3.typography.size.s2,
|
|
1322
|
+
color: theme3.color.defaultText,
|
|
1323
|
+
fontWeight: theme3.typography.weight.bold
|
|
1324
|
+
})), ValueText = styled2.Text(({ theme: theme3 }) => ({
|
|
1325
|
+
fontSize: theme3.typography.size.s2,
|
|
1326
|
+
color: theme3.color.defaultText
|
|
1327
|
+
})), Swatch = ({ name, value, setBackground, disabled }) => jsxs2(
|
|
1328
|
+
PressableSwatch,
|
|
1329
|
+
{
|
|
1330
|
+
onPress: () => setBackground(value),
|
|
1331
|
+
disabled,
|
|
1332
|
+
style: { opacity: disabled ? 0.5 : 1 },
|
|
1333
|
+
children: [
|
|
1334
|
+
jsx4(ColorSwatch, { color: value }),
|
|
1335
|
+
jsxs2(ValueContainer, { children: [
|
|
1336
|
+
jsx4(NameText, { children: name }),
|
|
1337
|
+
jsx4(ValueText, { children: value })
|
|
1338
|
+
] })
|
|
1339
|
+
]
|
|
1340
|
+
}
|
|
1341
|
+
), Swatch_default = Swatch;
|
|
1342
|
+
|
|
1343
|
+
// src/react-native/backgrounds/constants.ts
|
|
1344
|
+
var PARAM_KEY = "backgrounds", ADDON_ID = "storybook-addon-background", PANEL_ID = `${ADDON_ID}/background-panel`;
|
|
1345
|
+
|
|
1346
|
+
// src/react-native/backgrounds/BackgroundPanel.tsx
|
|
1347
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1348
|
+
var codeSample = `
|
|
1349
|
+
// In your preview config (.storybook/preview.tsx):
|
|
1350
|
+
import type { Preview } from '@aussieljk/forkbook/react-native';
|
|
1351
|
+
|
|
1352
|
+
const preview: Preview = {
|
|
1353
|
+
parameters: {
|
|
1354
|
+
backgrounds: {
|
|
1355
|
+
options: {
|
|
1356
|
+
dark: { name: 'Dark', value: '#333333' },
|
|
1357
|
+
light: { name: 'Light', value: '#F7F9F2' },
|
|
1358
|
+
maroon: { name: 'Maroon', value: '#400000' },
|
|
1359
|
+
},
|
|
1360
|
+
},
|
|
1361
|
+
},
|
|
1362
|
+
initialGlobals: {
|
|
1363
|
+
backgrounds: { value: 'light' },
|
|
1364
|
+
},
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
export default preview;
|
|
1368
|
+
`.trim(), ThemedText = styled3.Text(({ theme: theme3 }) => ({
|
|
1369
|
+
color: theme3.color.defaultText
|
|
1370
|
+
})), TitleText = styled3.Text(({ theme: theme3 }) => ({
|
|
1371
|
+
color: theme3.color.defaultText,
|
|
1372
|
+
fontSize: 16,
|
|
1373
|
+
marginBottom: 8
|
|
1374
|
+
})), ParagraphText = styled3.Text(({ theme: theme3 }) => ({
|
|
1375
|
+
color: theme3.color.defaultText,
|
|
1376
|
+
marginBottom: 8
|
|
1377
|
+
})), LockedText = styled3.Text(({ theme: theme3 }) => ({
|
|
1378
|
+
color: theme3.color.defaultText,
|
|
1379
|
+
marginBottom: 10,
|
|
1380
|
+
fontStyle: "italic",
|
|
1381
|
+
opacity: 0.7
|
|
1382
|
+
})), Instructions = () => jsxs3(View4, { children: [
|
|
1383
|
+
jsx5(TitleText, { children: "Setup Instructions" }),
|
|
1384
|
+
jsx5(ParagraphText, { children: "Add background options to your preview parameters. Each option should include a name and the corresponding color value." }),
|
|
1385
|
+
jsx5(ParagraphText, { children: "Below is an example of how to configure backgrounds in your preview config. Long press the example to copy it." }),
|
|
1386
|
+
jsx5(ThemedText, { selectable: !0, children: codeSample })
|
|
1387
|
+
] }), BackgroundPanel = ({ active, api, channel }) => {
|
|
1388
|
+
let store2 = api.store(), storyId = store2.getSelection()?.storyId, story = storyId ? store2.fromId(storyId) : null, isLocked = !!story?.storyGlobals?.[PARAM_KEY], setBackground = useCallback3(
|
|
1389
|
+
(name) => {
|
|
1390
|
+
channel.emit(UPDATE_GLOBALS, { globals: { [PARAM_KEY]: { value: name } } });
|
|
1391
|
+
},
|
|
1392
|
+
[channel]
|
|
1393
|
+
), options = story?.parameters?.[PARAM_KEY]?.options;
|
|
1394
|
+
return options && Object.keys(options).length > 0 ? jsxs3(View4, { style: { padding: 10 }, children: [
|
|
1395
|
+
isLocked && jsx5(LockedText, { children: "Background is set at the story level" }),
|
|
1396
|
+
Object.entries(options).map(([key, { name, value }]) => jsx5(View4, { children: jsx5(
|
|
1397
|
+
Swatch_default,
|
|
1398
|
+
{
|
|
1399
|
+
value,
|
|
1400
|
+
name: name || key,
|
|
1401
|
+
setBackground: () => setBackground(key),
|
|
1402
|
+
disabled: isLocked
|
|
1403
|
+
}
|
|
1404
|
+
) }, `${key} ${value}`))
|
|
1405
|
+
] }) : jsx5(View4, { style: { padding: 10 }, children: jsx5(Instructions, {}) });
|
|
1406
|
+
}, BackgroundPanel_default = BackgroundPanel;
|
|
1407
|
+
|
|
1408
|
+
// src/react-native/backgrounds/register.tsx
|
|
1409
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1410
|
+
function registerBackgroundsAddon() {
|
|
1411
|
+
addons.register(ADDON_ID, (api) => {
|
|
1412
|
+
let channel = addons.getChannel();
|
|
1413
|
+
addons.add(PANEL_ID, {
|
|
1414
|
+
type: types.PANEL,
|
|
1415
|
+
title: "Backgrounds",
|
|
1416
|
+
render: ({ active }) => jsx6(BackgroundPanel_default, { channel, api, active }),
|
|
1417
|
+
paramKey: PARAM_KEY
|
|
1418
|
+
});
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
// src/react-native/Start.tsx
|
|
1423
|
+
import { Fragment, jsx as jsx7 } from "react/jsx-runtime";
|
|
1424
|
+
var createPreviewRoot = () => ({
|
|
1425
|
+
component: () => jsx7(Fragment, {}),
|
|
1426
|
+
canvasElement: null,
|
|
1427
|
+
mount: () => Promise.resolve({}),
|
|
1428
|
+
storyResult: null,
|
|
1429
|
+
T: null
|
|
1430
|
+
}), getReactNativeProjectAnnotations = (getView) => ({
|
|
1431
|
+
renderToCanvas: (context) => {
|
|
1432
|
+
getView()?._setStory(context.storyContext);
|
|
1433
|
+
},
|
|
1434
|
+
render: (args, context) => {
|
|
1435
|
+
let { id, component: Component } = context;
|
|
1436
|
+
if (!Component)
|
|
1437
|
+
throw new Error(
|
|
1438
|
+
`Unable to render story ${id} as the component annotation is missing from the default export`
|
|
1439
|
+
);
|
|
1440
|
+
return jsx7(Component, { ...args });
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
globalThis.FEATURES = Object.assign(globalThis.FEATURES ?? {}, {
|
|
1444
|
+
measure: !1,
|
|
1445
|
+
outline: !1,
|
|
1446
|
+
interactions: !1,
|
|
1447
|
+
viewport: !1,
|
|
1448
|
+
highlight: !1,
|
|
1449
|
+
backgrounds: !1
|
|
1450
|
+
});
|
|
1451
|
+
var ReactNativePreview = class extends PreviewWithSelection2 {
|
|
1452
|
+
constructor() {
|
|
1453
|
+
super(...arguments);
|
|
1454
|
+
this.renderSelectionQueue = Promise.resolve();
|
|
1455
|
+
}
|
|
1456
|
+
renderSelection(options) {
|
|
1457
|
+
let run = this.renderSelectionQueue.then(() => super.renderSelection(options));
|
|
1458
|
+
return this.renderSelectionQueue = run.catch(() => {
|
|
1459
|
+
}), run;
|
|
1460
|
+
}
|
|
1461
|
+
// Storybook tears down a story that is still rendering (e.g. its loaders are running) by waiting briefly and then
|
|
1462
|
+
// reloading the page, which restarts the app in Expo and never resolves elsewhere in React Native. Abort the render
|
|
1463
|
+
// instead: once its loaders finish it sees the abort and doesn't draw.
|
|
1464
|
+
async teardownRender(...[render, options]) {
|
|
1465
|
+
if (render && "isPending" in render && render.isPending()) {
|
|
1466
|
+
this.storyRenders = this.storyRenders.filter((r) => r !== render), render.torndown = !0, render.cancelRender(), render.story && await this.storyStoreValue?.cleanupStory(render.story);
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
await super.teardownRender(render, options);
|
|
1470
|
+
}
|
|
1471
|
+
}, getProjectAnnotations = (view, annotations) => async () => composeConfigs([getReactNativeProjectAnnotations(() => view), ...annotations]);
|
|
1472
|
+
function start({
|
|
1473
|
+
annotations,
|
|
1474
|
+
storyEntries,
|
|
1475
|
+
options
|
|
1476
|
+
}) {
|
|
1477
|
+
let composedAnnotations = composeConfigs(annotations), { index, importMap } = prepareStories({
|
|
1478
|
+
storyEntries,
|
|
1479
|
+
options,
|
|
1480
|
+
storySort: composedAnnotations.parameters?.options?.storySort
|
|
1481
|
+
}), channel = new Channel2({});
|
|
1482
|
+
managerAddons2.setChannel(channel), previewAddons2.setChannel(channel), globalThis.FEATURES?.ondeviceBackgrounds && registerBackgroundsAddon();
|
|
1483
|
+
let previewView = {
|
|
1484
|
+
prepareForStory: () => createPreviewRoot(),
|
|
1485
|
+
prepareForDocs: () => createPreviewRoot(),
|
|
1486
|
+
showErrorDisplay: (e) => {
|
|
1487
|
+
console.log(e);
|
|
1488
|
+
},
|
|
1489
|
+
showDocs: () => {
|
|
1490
|
+
},
|
|
1491
|
+
showMain: () => {
|
|
1492
|
+
},
|
|
1493
|
+
showNoPreview: () => {
|
|
1494
|
+
},
|
|
1495
|
+
showPreparingDocs: () => {
|
|
1496
|
+
},
|
|
1497
|
+
showPreparingStory: () => {
|
|
1498
|
+
},
|
|
1499
|
+
showStory: () => {
|
|
1500
|
+
},
|
|
1501
|
+
showStoryDuringRender: () => {
|
|
1502
|
+
}
|
|
1503
|
+
}, selectionStore = {
|
|
1504
|
+
selection: null,
|
|
1505
|
+
selectionSpecifier: null,
|
|
1506
|
+
setQueryParams: () => {
|
|
1507
|
+
},
|
|
1508
|
+
setSelection: (selection) => {
|
|
1509
|
+
preview.selectionStore.selection = selection;
|
|
1510
|
+
}
|
|
1511
|
+
}, view, getProjectAnnotationsInitial = async () => composeConfigs([getReactNativeProjectAnnotations(() => view), ...annotations]), preview = new ReactNativePreview(
|
|
1512
|
+
async (importPath) => importMap[importPath],
|
|
1513
|
+
getProjectAnnotationsInitial,
|
|
1514
|
+
selectionStore,
|
|
1515
|
+
previewView
|
|
1516
|
+
);
|
|
1517
|
+
if (view = new View3(preview, channel, options), global) {
|
|
1518
|
+
let storybookGlobal = global;
|
|
1519
|
+
storybookGlobal.__STORYBOOK_ADDONS_CHANNEL__ = channel, storybookGlobal.__STORYBOOK_PREVIEW__ = preview;
|
|
1520
|
+
}
|
|
1521
|
+
return view._storyIndex = index, preview.getStoryIndexFromServer = async () => view._storyIndex, view;
|
|
1522
|
+
}
|
|
1523
|
+
function updateView(viewInstance, annotations, normalizedStories, options) {
|
|
1524
|
+
let storySort = composeConfigs(annotations).parameters?.options?.storySort, { importMap, index } = prepareStories({
|
|
1525
|
+
storyEntries: normalizedStories,
|
|
1526
|
+
options,
|
|
1527
|
+
storySort
|
|
1528
|
+
});
|
|
1529
|
+
viewInstance._preview.onStoryHotUpdated(), viewInstance._preview.onStoriesChanged({
|
|
1530
|
+
importFn: async (importPath) => importMap[importPath]
|
|
1531
|
+
}), viewInstance._preview.onGetProjectAnnotationsChanged({
|
|
1532
|
+
getProjectAnnotations: getProjectAnnotations(viewInstance, annotations)
|
|
1533
|
+
}), viewInstance._storyIndex = index, viewInstance._preview.onStoryIndexChanged().then(() => {
|
|
1534
|
+
viewInstance.createPreparedStoryMapping().then(() => viewInstance._forceRerender());
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
export {
|
|
1538
|
+
RN_STORYBOOK_EVENTS,
|
|
1539
|
+
RN_STORYBOOK_STORAGE_KEY,
|
|
1540
|
+
STORYBOOK_STORY_ID_PARAM,
|
|
1541
|
+
darkTheme2 as darkTheme,
|
|
1542
|
+
getProjectAnnotations,
|
|
1543
|
+
prepareStories,
|
|
1544
|
+
start,
|
|
1545
|
+
theme2 as theme,
|
|
1546
|
+
updateView
|
|
1547
|
+
};
|