@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,1217 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isReviewSummaryPath
|
|
3
|
+
} from "../_browser-chunks/chunk-YI2IBIQS.js";
|
|
4
|
+
import {
|
|
5
|
+
parse,
|
|
6
|
+
stringify
|
|
7
|
+
} from "../_browser-chunks/chunk-SFVA4SBT.js";
|
|
8
|
+
import {
|
|
9
|
+
require_memoizerific
|
|
10
|
+
} from "../_browser-chunks/chunk-DRQKCCAG.js";
|
|
11
|
+
import {
|
|
12
|
+
isEqual
|
|
13
|
+
} from "../_browser-chunks/chunk-B4AUNNU4.js";
|
|
14
|
+
import "../_browser-chunks/chunk-NZMVUW5T.js";
|
|
15
|
+
import {
|
|
16
|
+
isPlainObject
|
|
17
|
+
} from "../_browser-chunks/chunk-JWSKPMPC.js";
|
|
18
|
+
import "../_browser-chunks/chunk-JPUOQJUI.js";
|
|
19
|
+
import {
|
|
20
|
+
__toESM
|
|
21
|
+
} from "../_browser-chunks/chunk-IMSF75WX.js";
|
|
22
|
+
|
|
23
|
+
// src/router/utils.ts
|
|
24
|
+
import { once } from "@aussieljk/forkbook/internal/client-logger";
|
|
25
|
+
var import_memoizerific = __toESM(require_memoizerific(), 1);
|
|
26
|
+
import { dedent } from "ts-dedent";
|
|
27
|
+
var splitPathRegex = /\/([^/]+)\/(?:(.*)_)?([^/]+)?/, parsePath = (0, import_memoizerific.default)(1e3)((path) => {
|
|
28
|
+
let result = {
|
|
29
|
+
viewMode: void 0,
|
|
30
|
+
storyId: void 0,
|
|
31
|
+
refId: void 0
|
|
32
|
+
};
|
|
33
|
+
if (path) {
|
|
34
|
+
let [, viewMode, refId, storyId] = path.toLowerCase().match(splitPathRegex) || [];
|
|
35
|
+
viewMode ? Object.assign(result, {
|
|
36
|
+
viewMode,
|
|
37
|
+
storyId,
|
|
38
|
+
refId
|
|
39
|
+
}) : isReviewSummaryPath(path) && (result.viewMode = "review");
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}), DEEPLY_EQUAL = /* @__PURE__ */ Symbol("Deeply equal"), deepDiff = (value, update) => {
|
|
43
|
+
if (typeof value != typeof update)
|
|
44
|
+
return update;
|
|
45
|
+
if (isEqual(value, update))
|
|
46
|
+
return DEEPLY_EQUAL;
|
|
47
|
+
if (Array.isArray(value) && Array.isArray(update)) {
|
|
48
|
+
let res = update.reduce((acc, upd, index) => {
|
|
49
|
+
let diff = deepDiff(value[index], upd);
|
|
50
|
+
return diff !== DEEPLY_EQUAL && (acc[index] = diff), acc;
|
|
51
|
+
}, new Array(update.length));
|
|
52
|
+
return update.length >= value.length ? res : res.concat(new Array(value.length - update.length).fill(void 0));
|
|
53
|
+
}
|
|
54
|
+
return isPlainObject(value) && isPlainObject(update) ? Object.keys({ ...value, ...update }).reduce((acc, key) => {
|
|
55
|
+
let diff = deepDiff(value?.[key], update?.[key]);
|
|
56
|
+
return diff === DEEPLY_EQUAL ? acc : Object.assign(acc, { [key]: diff });
|
|
57
|
+
}, {}) : update;
|
|
58
|
+
}, VALIDATION_REGEXP = /^[a-zA-Z0-9 _-]*$/, NUMBER_REGEXP = /^-?[0-9]+(\.[0-9]+)?$/, HEX_REGEXP = /^#([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8})$/i, COLOR_REGEXP = /^(rgba?|hsla?)\(([0-9]{1,3}),\s?([0-9]{1,3})%?,\s?([0-9]{1,3})%?,?\s?([0-9](\.[0-9]{1,2})?)?\)$/i, validateArgs = (key = "", value) => key === null || key === "" || !VALIDATION_REGEXP.test(key) ? !1 : value == null || value instanceof Date || typeof value == "number" || typeof value == "boolean" ? !0 : typeof value == "string" ? VALIDATION_REGEXP.test(value) || NUMBER_REGEXP.test(value) || HEX_REGEXP.test(value) || COLOR_REGEXP.test(value) : Array.isArray(value) ? value.every((v) => validateArgs(key, v)) : isPlainObject(value) ? Object.entries(value).every(([k, v]) => validateArgs(k, v)) : !1, encodeSpecialValues = (value) => value === void 0 ? "!undefined" : value === null ? "!null" : typeof value == "string" ? HEX_REGEXP.test(value) ? `!hex(${value.slice(1)})` : COLOR_REGEXP.test(value) ? `!${value.replace(/[\s%]/g, "")}` : value : typeof value == "boolean" ? `!${value}` : value instanceof Date ? `!date(${value.toISOString()})` : Array.isArray(value) ? value.map(encodeSpecialValues) : isPlainObject(value) ? Object.entries(value).reduce(
|
|
59
|
+
(acc, [key, val]) => Object.assign(acc, { [key]: encodeSpecialValues(val) }),
|
|
60
|
+
{}
|
|
61
|
+
) : value, decodeKnownQueryChar = (chr) => {
|
|
62
|
+
switch (chr) {
|
|
63
|
+
case "%20":
|
|
64
|
+
return "+";
|
|
65
|
+
case "%5B":
|
|
66
|
+
return "[";
|
|
67
|
+
case "%5D":
|
|
68
|
+
return "]";
|
|
69
|
+
case "%2C":
|
|
70
|
+
return ",";
|
|
71
|
+
case "%3A":
|
|
72
|
+
return ":";
|
|
73
|
+
}
|
|
74
|
+
return chr;
|
|
75
|
+
}, knownQueryChar = /%[0-9A-F]{2}/g, buildArgsParam = (initialArgs, args) => {
|
|
76
|
+
let update = deepDiff(initialArgs, args);
|
|
77
|
+
if (!update || update === DEEPLY_EQUAL)
|
|
78
|
+
return "";
|
|
79
|
+
let object = Object.entries(update).reduce((acc, [key, value]) => validateArgs(key, value) ? Object.assign(acc, { [key]: value }) : (once.warn(dedent`
|
|
80
|
+
Omitted potentially unsafe URL args.
|
|
81
|
+
|
|
82
|
+
More info: https://storybook.js.org/docs/writing-stories/args?ref=error#setting-args-through-the-url
|
|
83
|
+
`), acc), {});
|
|
84
|
+
return stringify(encodeSpecialValues(object), {
|
|
85
|
+
delimiter: ";",
|
|
86
|
+
// we don't actually create multiple query params
|
|
87
|
+
nesting: !0,
|
|
88
|
+
nestingSyntax: "js"
|
|
89
|
+
// encode objects using dot notation: obj.key=val
|
|
90
|
+
}).replace(knownQueryChar, decodeKnownQueryChar).split(";").map((part) => part.replace("=", ":")).join(";");
|
|
91
|
+
}, queryFromString = (0, import_memoizerific.default)(1e3)((s) => s !== void 0 ? parse(s) : {}), queryFromLocation = (location) => queryFromString(location?.search ? location.search.slice(1) : ""), stringifyQuery = (query) => {
|
|
92
|
+
let queryStr = stringify(query);
|
|
93
|
+
return queryStr ? "?" + queryStr : "";
|
|
94
|
+
}, getMatch = (0, import_memoizerific.default)(1e3)((current, target, startsWith = !0) => {
|
|
95
|
+
if (startsWith) {
|
|
96
|
+
if (typeof target != "string")
|
|
97
|
+
throw new Error("startsWith only works with string targets");
|
|
98
|
+
return current && current.startsWith(target) ? { path: current } : null;
|
|
99
|
+
}
|
|
100
|
+
let currentIsTarget = typeof target == "string" && current === target, matchTarget = current && target && current.match(target);
|
|
101
|
+
return currentIsTarget || matchTarget ? { path: current } : null;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// src/router/router.tsx
|
|
105
|
+
import { useCallback as useCallback3 } from "react";
|
|
106
|
+
import { global } from "@storybook/global";
|
|
107
|
+
|
|
108
|
+
// ../../node_modules/react-router-dom/dist/index.js
|
|
109
|
+
import * as React2 from "react";
|
|
110
|
+
|
|
111
|
+
// ../../node_modules/react-router/dist/index.js
|
|
112
|
+
import * as React from "react";
|
|
113
|
+
|
|
114
|
+
// ../../node_modules/@remix-run/router/dist/router.js
|
|
115
|
+
function _extends() {
|
|
116
|
+
return _extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
117
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
118
|
+
var source = arguments[i];
|
|
119
|
+
for (var key in source)
|
|
120
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
121
|
+
}
|
|
122
|
+
return target;
|
|
123
|
+
}, _extends.apply(this, arguments);
|
|
124
|
+
}
|
|
125
|
+
var Action;
|
|
126
|
+
(function(Action2) {
|
|
127
|
+
Action2.Pop = "POP", Action2.Push = "PUSH", Action2.Replace = "REPLACE";
|
|
128
|
+
})(Action || (Action = {}));
|
|
129
|
+
var PopStateEventType = "popstate";
|
|
130
|
+
function createMemoryHistory(options) {
|
|
131
|
+
options === void 0 && (options = {});
|
|
132
|
+
let {
|
|
133
|
+
initialEntries = ["/"],
|
|
134
|
+
initialIndex,
|
|
135
|
+
v5Compat = !1
|
|
136
|
+
} = options, entries;
|
|
137
|
+
entries = initialEntries.map((entry, index2) => createMemoryLocation(entry, typeof entry == "string" ? null : entry.state, index2 === 0 ? "default" : void 0));
|
|
138
|
+
let index = clampIndex(initialIndex ?? entries.length - 1), action = Action.Pop, listener = null;
|
|
139
|
+
function clampIndex(n) {
|
|
140
|
+
return Math.min(Math.max(n, 0), entries.length - 1);
|
|
141
|
+
}
|
|
142
|
+
function getCurrentLocation() {
|
|
143
|
+
return entries[index];
|
|
144
|
+
}
|
|
145
|
+
function createMemoryLocation(to, state, key) {
|
|
146
|
+
state === void 0 && (state = null);
|
|
147
|
+
let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key);
|
|
148
|
+
return warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to)), location;
|
|
149
|
+
}
|
|
150
|
+
function createHref(to) {
|
|
151
|
+
return typeof to == "string" ? to : createPath(to);
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
get index() {
|
|
155
|
+
return index;
|
|
156
|
+
},
|
|
157
|
+
get action() {
|
|
158
|
+
return action;
|
|
159
|
+
},
|
|
160
|
+
get location() {
|
|
161
|
+
return getCurrentLocation();
|
|
162
|
+
},
|
|
163
|
+
createHref,
|
|
164
|
+
createURL(to) {
|
|
165
|
+
return new URL(createHref(to), "http://localhost");
|
|
166
|
+
},
|
|
167
|
+
encodeLocation(to) {
|
|
168
|
+
let path = typeof to == "string" ? parsePath2(to) : to;
|
|
169
|
+
return {
|
|
170
|
+
pathname: path.pathname || "",
|
|
171
|
+
search: path.search || "",
|
|
172
|
+
hash: path.hash || ""
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
push(to, state) {
|
|
176
|
+
action = Action.Push;
|
|
177
|
+
let nextLocation = createMemoryLocation(to, state);
|
|
178
|
+
index += 1, entries.splice(index, entries.length, nextLocation), v5Compat && listener && listener({
|
|
179
|
+
action,
|
|
180
|
+
location: nextLocation,
|
|
181
|
+
delta: 1
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
replace(to, state) {
|
|
185
|
+
action = Action.Replace;
|
|
186
|
+
let nextLocation = createMemoryLocation(to, state);
|
|
187
|
+
entries[index] = nextLocation, v5Compat && listener && listener({
|
|
188
|
+
action,
|
|
189
|
+
location: nextLocation,
|
|
190
|
+
delta: 0
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
go(delta) {
|
|
194
|
+
action = Action.Pop;
|
|
195
|
+
let nextIndex = clampIndex(index + delta), nextLocation = entries[nextIndex];
|
|
196
|
+
index = nextIndex, listener && listener({
|
|
197
|
+
action,
|
|
198
|
+
location: nextLocation,
|
|
199
|
+
delta
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
listen(fn) {
|
|
203
|
+
return listener = fn, () => {
|
|
204
|
+
listener = null;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function createBrowserHistory(options) {
|
|
210
|
+
options === void 0 && (options = {});
|
|
211
|
+
function createBrowserLocation(window2, globalHistory) {
|
|
212
|
+
let {
|
|
213
|
+
pathname,
|
|
214
|
+
search,
|
|
215
|
+
hash
|
|
216
|
+
} = window2.location;
|
|
217
|
+
return createLocation(
|
|
218
|
+
"",
|
|
219
|
+
{
|
|
220
|
+
pathname,
|
|
221
|
+
search,
|
|
222
|
+
hash
|
|
223
|
+
},
|
|
224
|
+
// state defaults to `null` because `window.history.state` does
|
|
225
|
+
globalHistory.state && globalHistory.state.usr || null,
|
|
226
|
+
globalHistory.state && globalHistory.state.key || "default"
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
function createBrowserHref(window2, to) {
|
|
230
|
+
return typeof to == "string" ? to : createPath(to);
|
|
231
|
+
}
|
|
232
|
+
return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);
|
|
233
|
+
}
|
|
234
|
+
function invariant(value, message) {
|
|
235
|
+
if (value === !1 || value === null || typeof value > "u")
|
|
236
|
+
throw new Error(message);
|
|
237
|
+
}
|
|
238
|
+
function warning(cond, message) {
|
|
239
|
+
if (!cond) {
|
|
240
|
+
typeof console < "u" && console.warn(message);
|
|
241
|
+
try {
|
|
242
|
+
throw new Error(message);
|
|
243
|
+
} catch {
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function createKey() {
|
|
248
|
+
return Math.random().toString(36).substr(2, 8);
|
|
249
|
+
}
|
|
250
|
+
function getHistoryState(location, index) {
|
|
251
|
+
return {
|
|
252
|
+
usr: location.state,
|
|
253
|
+
key: location.key,
|
|
254
|
+
idx: index
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function createLocation(current, to, state, key) {
|
|
258
|
+
return state === void 0 && (state = null), _extends({
|
|
259
|
+
pathname: typeof current == "string" ? current : current.pathname,
|
|
260
|
+
search: "",
|
|
261
|
+
hash: ""
|
|
262
|
+
}, typeof to == "string" ? parsePath2(to) : to, {
|
|
263
|
+
state,
|
|
264
|
+
// TODO: This could be cleaned up. push/replace should probably just take
|
|
265
|
+
// full Locations now and avoid the need to run through this flow at all
|
|
266
|
+
// But that's a pretty big refactor to the current test suite so going to
|
|
267
|
+
// keep as is for the time being and just let any incoming keys take precedence
|
|
268
|
+
key: to && to.key || key || createKey()
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function createPath(_ref) {
|
|
272
|
+
let {
|
|
273
|
+
pathname = "/",
|
|
274
|
+
search = "",
|
|
275
|
+
hash = ""
|
|
276
|
+
} = _ref;
|
|
277
|
+
return search && search !== "?" && (pathname += search.charAt(0) === "?" ? search : "?" + search), hash && hash !== "#" && (pathname += hash.charAt(0) === "#" ? hash : "#" + hash), pathname;
|
|
278
|
+
}
|
|
279
|
+
function parsePath2(path) {
|
|
280
|
+
let parsedPath = {};
|
|
281
|
+
if (path) {
|
|
282
|
+
let hashIndex = path.indexOf("#");
|
|
283
|
+
hashIndex >= 0 && (parsedPath.hash = path.substr(hashIndex), path = path.substr(0, hashIndex));
|
|
284
|
+
let searchIndex = path.indexOf("?");
|
|
285
|
+
searchIndex >= 0 && (parsedPath.search = path.substr(searchIndex), path = path.substr(0, searchIndex)), path && (parsedPath.pathname = path);
|
|
286
|
+
}
|
|
287
|
+
return parsedPath;
|
|
288
|
+
}
|
|
289
|
+
function getUrlBasedHistory(getLocation, createHref, validateLocation, options) {
|
|
290
|
+
options === void 0 && (options = {});
|
|
291
|
+
let {
|
|
292
|
+
window: window2 = document.defaultView,
|
|
293
|
+
v5Compat = !1
|
|
294
|
+
} = options, globalHistory = window2.history, action = Action.Pop, listener = null, index = getIndex();
|
|
295
|
+
index == null && (index = 0, globalHistory.replaceState(_extends({}, globalHistory.state, {
|
|
296
|
+
idx: index
|
|
297
|
+
}), ""));
|
|
298
|
+
function getIndex() {
|
|
299
|
+
return (globalHistory.state || {
|
|
300
|
+
idx: null
|
|
301
|
+
}).idx;
|
|
302
|
+
}
|
|
303
|
+
function handlePop() {
|
|
304
|
+
action = Action.Pop;
|
|
305
|
+
let nextIndex = getIndex(), delta = nextIndex == null ? null : nextIndex - index;
|
|
306
|
+
index = nextIndex, listener && listener({
|
|
307
|
+
action,
|
|
308
|
+
location: history.location,
|
|
309
|
+
delta
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function push(to, state) {
|
|
313
|
+
action = Action.Push;
|
|
314
|
+
let location = createLocation(history.location, to, state);
|
|
315
|
+
validateLocation && validateLocation(location, to), index = getIndex() + 1;
|
|
316
|
+
let historyState = getHistoryState(location, index), url = history.createHref(location);
|
|
317
|
+
try {
|
|
318
|
+
globalHistory.pushState(historyState, "", url);
|
|
319
|
+
} catch (error) {
|
|
320
|
+
if (error instanceof DOMException && error.name === "DataCloneError")
|
|
321
|
+
throw error;
|
|
322
|
+
window2.location.assign(url);
|
|
323
|
+
}
|
|
324
|
+
v5Compat && listener && listener({
|
|
325
|
+
action,
|
|
326
|
+
location: history.location,
|
|
327
|
+
delta: 1
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
function replace(to, state) {
|
|
331
|
+
action = Action.Replace;
|
|
332
|
+
let location = createLocation(history.location, to, state);
|
|
333
|
+
validateLocation && validateLocation(location, to), index = getIndex();
|
|
334
|
+
let historyState = getHistoryState(location, index), url = history.createHref(location);
|
|
335
|
+
globalHistory.replaceState(historyState, "", url), v5Compat && listener && listener({
|
|
336
|
+
action,
|
|
337
|
+
location: history.location,
|
|
338
|
+
delta: 0
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function createURL(to) {
|
|
342
|
+
let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href, href = typeof to == "string" ? to : createPath(to);
|
|
343
|
+
return invariant(base, "No window.location.(origin|href) available to create URL for href: " + href), new URL(href, base);
|
|
344
|
+
}
|
|
345
|
+
let history = {
|
|
346
|
+
get action() {
|
|
347
|
+
return action;
|
|
348
|
+
},
|
|
349
|
+
get location() {
|
|
350
|
+
return getLocation(window2, globalHistory);
|
|
351
|
+
},
|
|
352
|
+
listen(fn) {
|
|
353
|
+
if (listener)
|
|
354
|
+
throw new Error("A history only accepts one active listener");
|
|
355
|
+
return window2.addEventListener(PopStateEventType, handlePop), listener = fn, () => {
|
|
356
|
+
window2.removeEventListener(PopStateEventType, handlePop), listener = null;
|
|
357
|
+
};
|
|
358
|
+
},
|
|
359
|
+
createHref(to) {
|
|
360
|
+
return createHref(window2, to);
|
|
361
|
+
},
|
|
362
|
+
createURL,
|
|
363
|
+
encodeLocation(to) {
|
|
364
|
+
let url = createURL(to);
|
|
365
|
+
return {
|
|
366
|
+
pathname: url.pathname,
|
|
367
|
+
search: url.search,
|
|
368
|
+
hash: url.hash
|
|
369
|
+
};
|
|
370
|
+
},
|
|
371
|
+
push,
|
|
372
|
+
replace,
|
|
373
|
+
go(n) {
|
|
374
|
+
return globalHistory.go(n);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
return history;
|
|
378
|
+
}
|
|
379
|
+
var ResultType;
|
|
380
|
+
(function(ResultType2) {
|
|
381
|
+
ResultType2.data = "data", ResultType2.deferred = "deferred", ResultType2.redirect = "redirect", ResultType2.error = "error";
|
|
382
|
+
})(ResultType || (ResultType = {}));
|
|
383
|
+
function stripBasename(pathname, basename) {
|
|
384
|
+
if (basename === "/") return pathname;
|
|
385
|
+
if (!pathname.toLowerCase().startsWith(basename.toLowerCase()))
|
|
386
|
+
return null;
|
|
387
|
+
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length, nextChar = pathname.charAt(startIndex);
|
|
388
|
+
return nextChar && nextChar !== "/" ? null : pathname.slice(startIndex) || "/";
|
|
389
|
+
}
|
|
390
|
+
function resolvePath(to, fromPathname) {
|
|
391
|
+
fromPathname === void 0 && (fromPathname = "/");
|
|
392
|
+
let {
|
|
393
|
+
pathname: toPathname,
|
|
394
|
+
search = "",
|
|
395
|
+
hash = ""
|
|
396
|
+
} = typeof to == "string" ? parsePath2(to) : to;
|
|
397
|
+
return {
|
|
398
|
+
pathname: toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname,
|
|
399
|
+
search: normalizeSearch(search),
|
|
400
|
+
hash: normalizeHash(hash)
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function resolvePathname(relativePath, fromPathname) {
|
|
404
|
+
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
405
|
+
return relativePath.split("/").forEach((segment) => {
|
|
406
|
+
segment === ".." ? segments.length > 1 && segments.pop() : segment !== "." && segments.push(segment);
|
|
407
|
+
}), segments.length > 1 ? segments.join("/") : "/";
|
|
408
|
+
}
|
|
409
|
+
function getInvalidPathError(char, field, dest, path) {
|
|
410
|
+
return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
|
|
411
|
+
}
|
|
412
|
+
function getPathContributingMatches(matches) {
|
|
413
|
+
return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
|
|
414
|
+
}
|
|
415
|
+
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
|
|
416
|
+
isPathRelative === void 0 && (isPathRelative = !1);
|
|
417
|
+
let to;
|
|
418
|
+
typeof toArg == "string" ? to = parsePath2(toArg) : (to = _extends({}, toArg), invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to)), invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to)), invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to)));
|
|
419
|
+
let isEmptyPath = toArg === "" || to.pathname === "", toPathname = isEmptyPath ? "/" : to.pathname, from;
|
|
420
|
+
if (isPathRelative || toPathname == null)
|
|
421
|
+
from = locationPathname;
|
|
422
|
+
else {
|
|
423
|
+
let routePathnameIndex = routePathnames.length - 1;
|
|
424
|
+
if (toPathname.startsWith("..")) {
|
|
425
|
+
let toSegments = toPathname.split("/");
|
|
426
|
+
for (; toSegments[0] === ".."; )
|
|
427
|
+
toSegments.shift(), routePathnameIndex -= 1;
|
|
428
|
+
to.pathname = toSegments.join("/");
|
|
429
|
+
}
|
|
430
|
+
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
431
|
+
}
|
|
432
|
+
let path = resolvePath(to, from), hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/"), hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
|
|
433
|
+
return !path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash) && (path.pathname += "/"), path;
|
|
434
|
+
}
|
|
435
|
+
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
|
436
|
+
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search, normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
437
|
+
function isRouteErrorResponse(error) {
|
|
438
|
+
return error != null && typeof error.status == "number" && typeof error.statusText == "string" && typeof error.internal == "boolean" && "data" in error;
|
|
439
|
+
}
|
|
440
|
+
var validMutationMethodsArr = ["post", "put", "patch", "delete"], validMutationMethods = new Set(validMutationMethodsArr), validRequestMethodsArr = ["get", ...validMutationMethodsArr], validRequestMethods = new Set(validRequestMethodsArr);
|
|
441
|
+
|
|
442
|
+
// ../../node_modules/react-router/dist/index.js
|
|
443
|
+
function _extends2() {
|
|
444
|
+
return _extends2 = Object.assign ? Object.assign.bind() : function(target) {
|
|
445
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
446
|
+
var source = arguments[i];
|
|
447
|
+
for (var key in source)
|
|
448
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
449
|
+
}
|
|
450
|
+
return target;
|
|
451
|
+
}, _extends2.apply(this, arguments);
|
|
452
|
+
}
|
|
453
|
+
var DataRouterContext = React.createContext(null);
|
|
454
|
+
process.env.NODE_ENV !== "production" && (DataRouterContext.displayName = "DataRouter");
|
|
455
|
+
var DataRouterStateContext = React.createContext(null);
|
|
456
|
+
process.env.NODE_ENV !== "production" && (DataRouterStateContext.displayName = "DataRouterState");
|
|
457
|
+
var AwaitContext = React.createContext(null);
|
|
458
|
+
process.env.NODE_ENV !== "production" && (AwaitContext.displayName = "Await");
|
|
459
|
+
var NavigationContext = React.createContext(null);
|
|
460
|
+
process.env.NODE_ENV !== "production" && (NavigationContext.displayName = "Navigation");
|
|
461
|
+
var LocationContext = React.createContext(null);
|
|
462
|
+
process.env.NODE_ENV !== "production" && (LocationContext.displayName = "Location");
|
|
463
|
+
var RouteContext = React.createContext({
|
|
464
|
+
outlet: null,
|
|
465
|
+
matches: [],
|
|
466
|
+
isDataRoute: !1
|
|
467
|
+
});
|
|
468
|
+
process.env.NODE_ENV !== "production" && (RouteContext.displayName = "Route");
|
|
469
|
+
var RouteErrorContext = React.createContext(null);
|
|
470
|
+
process.env.NODE_ENV !== "production" && (RouteErrorContext.displayName = "RouteError");
|
|
471
|
+
function useHref(to, _temp) {
|
|
472
|
+
let {
|
|
473
|
+
relative
|
|
474
|
+
} = _temp === void 0 ? {} : _temp;
|
|
475
|
+
useInRouterContext() || (process.env.NODE_ENV !== "production" ? invariant(
|
|
476
|
+
!1,
|
|
477
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
478
|
+
// router loaded. We can help them understand how to avoid that.
|
|
479
|
+
"useHref() may be used only in the context of a <Router> component."
|
|
480
|
+
) : invariant(!1));
|
|
481
|
+
let {
|
|
482
|
+
basename,
|
|
483
|
+
navigator
|
|
484
|
+
} = React.useContext(NavigationContext), {
|
|
485
|
+
hash,
|
|
486
|
+
pathname,
|
|
487
|
+
search
|
|
488
|
+
} = useResolvedPath(to, {
|
|
489
|
+
relative
|
|
490
|
+
}), joinedPathname = pathname;
|
|
491
|
+
return basename !== "/" && (joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname])), navigator.createHref({
|
|
492
|
+
pathname: joinedPathname,
|
|
493
|
+
search,
|
|
494
|
+
hash
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
function useInRouterContext() {
|
|
498
|
+
return React.useContext(LocationContext) != null;
|
|
499
|
+
}
|
|
500
|
+
function useLocation() {
|
|
501
|
+
return useInRouterContext() || (process.env.NODE_ENV !== "production" ? invariant(
|
|
502
|
+
!1,
|
|
503
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
504
|
+
// router loaded. We can help them understand how to avoid that.
|
|
505
|
+
"useLocation() may be used only in the context of a <Router> component."
|
|
506
|
+
) : invariant(!1)), React.useContext(LocationContext).location;
|
|
507
|
+
}
|
|
508
|
+
var navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
509
|
+
function useIsomorphicLayoutEffect(cb) {
|
|
510
|
+
React.useContext(NavigationContext).static || React.useLayoutEffect(cb);
|
|
511
|
+
}
|
|
512
|
+
function useNavigate() {
|
|
513
|
+
let {
|
|
514
|
+
isDataRoute
|
|
515
|
+
} = React.useContext(RouteContext);
|
|
516
|
+
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
517
|
+
}
|
|
518
|
+
function useNavigateUnstable() {
|
|
519
|
+
useInRouterContext() || (process.env.NODE_ENV !== "production" ? invariant(
|
|
520
|
+
!1,
|
|
521
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
522
|
+
// router loaded. We can help them understand how to avoid that.
|
|
523
|
+
"useNavigate() may be used only in the context of a <Router> component."
|
|
524
|
+
) : invariant(!1));
|
|
525
|
+
let dataRouterContext = React.useContext(DataRouterContext), {
|
|
526
|
+
basename,
|
|
527
|
+
navigator
|
|
528
|
+
} = React.useContext(NavigationContext), {
|
|
529
|
+
matches
|
|
530
|
+
} = React.useContext(RouteContext), {
|
|
531
|
+
pathname: locationPathname
|
|
532
|
+
} = useLocation(), routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase)), activeRef = React.useRef(!1);
|
|
533
|
+
return useIsomorphicLayoutEffect(() => {
|
|
534
|
+
activeRef.current = !0;
|
|
535
|
+
}), React.useCallback(function(to, options) {
|
|
536
|
+
if (options === void 0 && (options = {}), process.env.NODE_ENV !== "production" && warning(activeRef.current, navigateEffectWarning), !activeRef.current) return;
|
|
537
|
+
if (typeof to == "number") {
|
|
538
|
+
navigator.go(to);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
|
|
542
|
+
dataRouterContext == null && basename !== "/" && (path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname])), (options.replace ? navigator.replace : navigator.push)(path, options.state, options);
|
|
543
|
+
}, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);
|
|
544
|
+
}
|
|
545
|
+
var OutletContext = React.createContext(null);
|
|
546
|
+
function useResolvedPath(to, _temp2) {
|
|
547
|
+
let {
|
|
548
|
+
relative
|
|
549
|
+
} = _temp2 === void 0 ? {} : _temp2, {
|
|
550
|
+
matches
|
|
551
|
+
} = React.useContext(RouteContext), {
|
|
552
|
+
pathname: locationPathname
|
|
553
|
+
} = useLocation(), routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase));
|
|
554
|
+
return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
|
|
555
|
+
}
|
|
556
|
+
function DefaultErrorComponent() {
|
|
557
|
+
let error = useRouteError(), message = isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error), stack = error instanceof Error ? error.stack : null, lightgrey = "rgba(200,200,200, 0.5)", preStyles = {
|
|
558
|
+
padding: "0.5rem",
|
|
559
|
+
backgroundColor: lightgrey
|
|
560
|
+
}, codeStyles = {
|
|
561
|
+
padding: "2px 4px",
|
|
562
|
+
backgroundColor: lightgrey
|
|
563
|
+
}, devInfo = null;
|
|
564
|
+
return process.env.NODE_ENV !== "production" && (console.error("Error handled by React Router default ErrorBoundary:", error), devInfo = React.createElement(React.Fragment, null, React.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", React.createElement("code", {
|
|
565
|
+
style: codeStyles
|
|
566
|
+
}, "ErrorBoundary"), " or", " ", React.createElement("code", {
|
|
567
|
+
style: codeStyles
|
|
568
|
+
}, "errorElement"), " prop on your route."))), React.createElement(React.Fragment, null, React.createElement("h2", null, "Unexpected Application Error!"), React.createElement("h3", {
|
|
569
|
+
style: {
|
|
570
|
+
fontStyle: "italic"
|
|
571
|
+
}
|
|
572
|
+
}, message), stack ? React.createElement("pre", {
|
|
573
|
+
style: preStyles
|
|
574
|
+
}, stack) : null, devInfo);
|
|
575
|
+
}
|
|
576
|
+
var defaultErrorElement = React.createElement(DefaultErrorComponent, null);
|
|
577
|
+
var DataRouterHook = (function(DataRouterHook3) {
|
|
578
|
+
return DataRouterHook3.UseBlocker = "useBlocker", DataRouterHook3.UseRevalidator = "useRevalidator", DataRouterHook3.UseNavigateStable = "useNavigate", DataRouterHook3;
|
|
579
|
+
})(DataRouterHook || {}), DataRouterStateHook = (function(DataRouterStateHook3) {
|
|
580
|
+
return DataRouterStateHook3.UseBlocker = "useBlocker", DataRouterStateHook3.UseLoaderData = "useLoaderData", DataRouterStateHook3.UseActionData = "useActionData", DataRouterStateHook3.UseRouteError = "useRouteError", DataRouterStateHook3.UseNavigation = "useNavigation", DataRouterStateHook3.UseRouteLoaderData = "useRouteLoaderData", DataRouterStateHook3.UseMatches = "useMatches", DataRouterStateHook3.UseRevalidator = "useRevalidator", DataRouterStateHook3.UseNavigateStable = "useNavigate", DataRouterStateHook3.UseRouteId = "useRouteId", DataRouterStateHook3;
|
|
581
|
+
})(DataRouterStateHook || {});
|
|
582
|
+
function getDataRouterConsoleError(hookName) {
|
|
583
|
+
return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
|
|
584
|
+
}
|
|
585
|
+
function useDataRouterContext(hookName) {
|
|
586
|
+
let ctx = React.useContext(DataRouterContext);
|
|
587
|
+
return ctx || (process.env.NODE_ENV !== "production" ? invariant(!1, getDataRouterConsoleError(hookName)) : invariant(!1)), ctx;
|
|
588
|
+
}
|
|
589
|
+
function useDataRouterState(hookName) {
|
|
590
|
+
let state = React.useContext(DataRouterStateContext);
|
|
591
|
+
return state || (process.env.NODE_ENV !== "production" ? invariant(!1, getDataRouterConsoleError(hookName)) : invariant(!1)), state;
|
|
592
|
+
}
|
|
593
|
+
function useRouteContext(hookName) {
|
|
594
|
+
let route = React.useContext(RouteContext);
|
|
595
|
+
return route || (process.env.NODE_ENV !== "production" ? invariant(!1, getDataRouterConsoleError(hookName)) : invariant(!1)), route;
|
|
596
|
+
}
|
|
597
|
+
function useCurrentRouteId(hookName) {
|
|
598
|
+
let route = useRouteContext(hookName), thisRoute = route.matches[route.matches.length - 1];
|
|
599
|
+
return thisRoute.route.id || (process.env.NODE_ENV !== "production" ? invariant(!1, hookName + ' can only be used on routes that contain a unique "id"') : invariant(!1)), thisRoute.route.id;
|
|
600
|
+
}
|
|
601
|
+
function useRouteId() {
|
|
602
|
+
return useCurrentRouteId(DataRouterStateHook.UseRouteId);
|
|
603
|
+
}
|
|
604
|
+
function useNavigation() {
|
|
605
|
+
return useDataRouterState(DataRouterStateHook.UseNavigation).navigation;
|
|
606
|
+
}
|
|
607
|
+
function useMatches() {
|
|
608
|
+
let {
|
|
609
|
+
matches,
|
|
610
|
+
loaderData
|
|
611
|
+
} = useDataRouterState(DataRouterStateHook.UseMatches);
|
|
612
|
+
return React.useMemo(() => matches.map((match) => {
|
|
613
|
+
let {
|
|
614
|
+
pathname,
|
|
615
|
+
params
|
|
616
|
+
} = match;
|
|
617
|
+
return {
|
|
618
|
+
id: match.route.id,
|
|
619
|
+
pathname,
|
|
620
|
+
params,
|
|
621
|
+
data: loaderData[match.route.id],
|
|
622
|
+
handle: match.route.handle
|
|
623
|
+
};
|
|
624
|
+
}), [matches, loaderData]);
|
|
625
|
+
}
|
|
626
|
+
function useRouteError() {
|
|
627
|
+
var _state$errors;
|
|
628
|
+
let error = React.useContext(RouteErrorContext), state = useDataRouterState(DataRouterStateHook.UseRouteError), routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);
|
|
629
|
+
return error || ((_state$errors = state.errors) == null ? void 0 : _state$errors[routeId]);
|
|
630
|
+
}
|
|
631
|
+
function useNavigateStable() {
|
|
632
|
+
let {
|
|
633
|
+
router
|
|
634
|
+
} = useDataRouterContext(DataRouterHook.UseNavigateStable), id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable), activeRef = React.useRef(!1);
|
|
635
|
+
return useIsomorphicLayoutEffect(() => {
|
|
636
|
+
activeRef.current = !0;
|
|
637
|
+
}), React.useCallback(function(to, options) {
|
|
638
|
+
options === void 0 && (options = {}), process.env.NODE_ENV !== "production" && warning(activeRef.current, navigateEffectWarning), activeRef.current && (typeof to == "number" ? router.navigate(to) : router.navigate(to, _extends2({
|
|
639
|
+
fromRouteId: id
|
|
640
|
+
}, options)));
|
|
641
|
+
}, [router, id]);
|
|
642
|
+
}
|
|
643
|
+
var START_TRANSITION = "startTransition", startTransitionImpl = React[START_TRANSITION];
|
|
644
|
+
function MemoryRouter(_ref3) {
|
|
645
|
+
let {
|
|
646
|
+
basename,
|
|
647
|
+
children,
|
|
648
|
+
initialEntries,
|
|
649
|
+
initialIndex,
|
|
650
|
+
future
|
|
651
|
+
} = _ref3, historyRef = React.useRef();
|
|
652
|
+
historyRef.current == null && (historyRef.current = createMemoryHistory({
|
|
653
|
+
initialEntries,
|
|
654
|
+
initialIndex,
|
|
655
|
+
v5Compat: !0
|
|
656
|
+
}));
|
|
657
|
+
let history = historyRef.current, [state, setStateImpl] = React.useState({
|
|
658
|
+
action: history.action,
|
|
659
|
+
location: history.location
|
|
660
|
+
}), {
|
|
661
|
+
v7_startTransition
|
|
662
|
+
} = future || {}, setState = React.useCallback((newState) => {
|
|
663
|
+
v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
|
|
664
|
+
}, [setStateImpl, v7_startTransition]);
|
|
665
|
+
return React.useLayoutEffect(() => history.listen(setState), [history, setState]), React.createElement(Router, {
|
|
666
|
+
basename,
|
|
667
|
+
children,
|
|
668
|
+
location: state.location,
|
|
669
|
+
navigationType: state.action,
|
|
670
|
+
navigator: history
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
function Router(_ref5) {
|
|
674
|
+
let {
|
|
675
|
+
basename: basenameProp = "/",
|
|
676
|
+
children = null,
|
|
677
|
+
location: locationProp,
|
|
678
|
+
navigationType = Action.Pop,
|
|
679
|
+
navigator,
|
|
680
|
+
static: staticProp = !1
|
|
681
|
+
} = _ref5;
|
|
682
|
+
useInRouterContext() && (process.env.NODE_ENV !== "production" ? invariant(!1, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : invariant(!1));
|
|
683
|
+
let basename = basenameProp.replace(/^\/*/, "/"), navigationContext = React.useMemo(() => ({
|
|
684
|
+
basename,
|
|
685
|
+
navigator,
|
|
686
|
+
static: staticProp
|
|
687
|
+
}), [basename, navigator, staticProp]);
|
|
688
|
+
typeof locationProp == "string" && (locationProp = parsePath2(locationProp));
|
|
689
|
+
let {
|
|
690
|
+
pathname = "/",
|
|
691
|
+
search = "",
|
|
692
|
+
hash = "",
|
|
693
|
+
state = null,
|
|
694
|
+
key = "default"
|
|
695
|
+
} = locationProp, locationContext = React.useMemo(() => {
|
|
696
|
+
let trailingPathname = stripBasename(pathname, basename);
|
|
697
|
+
return trailingPathname == null ? null : {
|
|
698
|
+
location: {
|
|
699
|
+
pathname: trailingPathname,
|
|
700
|
+
search,
|
|
701
|
+
hash,
|
|
702
|
+
state,
|
|
703
|
+
key
|
|
704
|
+
},
|
|
705
|
+
navigationType
|
|
706
|
+
};
|
|
707
|
+
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
708
|
+
return process.env.NODE_ENV !== "production" && warning(locationContext != null, '<Router basename="' + basename + '"> is not able to match the URL ' + ('"' + pathname + search + hash + '" because it does not start with the ') + "basename, so the <Router> won't render anything."), locationContext == null ? null : React.createElement(NavigationContext.Provider, {
|
|
709
|
+
value: navigationContext
|
|
710
|
+
}, React.createElement(LocationContext.Provider, {
|
|
711
|
+
children,
|
|
712
|
+
value: locationContext
|
|
713
|
+
}));
|
|
714
|
+
}
|
|
715
|
+
var AwaitRenderStatus = (function(AwaitRenderStatus2) {
|
|
716
|
+
return AwaitRenderStatus2[AwaitRenderStatus2.pending = 0] = "pending", AwaitRenderStatus2[AwaitRenderStatus2.success = 1] = "success", AwaitRenderStatus2[AwaitRenderStatus2.error = 2] = "error", AwaitRenderStatus2;
|
|
717
|
+
})(AwaitRenderStatus || {}), neverSettledPromise = new Promise(() => {
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
// ../../node_modules/react-router-dom/dist/index.js
|
|
721
|
+
function _extends3() {
|
|
722
|
+
return _extends3 = Object.assign ? Object.assign.bind() : function(target) {
|
|
723
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
724
|
+
var source = arguments[i];
|
|
725
|
+
for (var key in source)
|
|
726
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
727
|
+
}
|
|
728
|
+
return target;
|
|
729
|
+
}, _extends3.apply(this, arguments);
|
|
730
|
+
}
|
|
731
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
732
|
+
if (source == null) return {};
|
|
733
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
734
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
735
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
736
|
+
return target;
|
|
737
|
+
}
|
|
738
|
+
var defaultMethod = "get", defaultEncType = "application/x-www-form-urlencoded";
|
|
739
|
+
function isHtmlElement(object) {
|
|
740
|
+
return object != null && typeof object.tagName == "string";
|
|
741
|
+
}
|
|
742
|
+
function isButtonElement(object) {
|
|
743
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
|
|
744
|
+
}
|
|
745
|
+
function isFormElement(object) {
|
|
746
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
|
|
747
|
+
}
|
|
748
|
+
function isInputElement(object) {
|
|
749
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
|
|
750
|
+
}
|
|
751
|
+
function isModifiedEvent(event) {
|
|
752
|
+
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
753
|
+
}
|
|
754
|
+
function shouldProcessLinkClick(event, target) {
|
|
755
|
+
return event.button === 0 && // Ignore everything but left clicks
|
|
756
|
+
(!target || target === "_self") && // Let browser handle "target=_blank" etc.
|
|
757
|
+
!isModifiedEvent(event);
|
|
758
|
+
}
|
|
759
|
+
var _formDataSupportsSubmitter = null;
|
|
760
|
+
function isFormDataSubmitterSupported() {
|
|
761
|
+
if (_formDataSupportsSubmitter === null)
|
|
762
|
+
try {
|
|
763
|
+
new FormData(
|
|
764
|
+
document.createElement("form"),
|
|
765
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
766
|
+
0
|
|
767
|
+
), _formDataSupportsSubmitter = !1;
|
|
768
|
+
} catch {
|
|
769
|
+
_formDataSupportsSubmitter = !0;
|
|
770
|
+
}
|
|
771
|
+
return _formDataSupportsSubmitter;
|
|
772
|
+
}
|
|
773
|
+
var supportedFormEncTypes = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
|
|
774
|
+
function getFormEncType(encType) {
|
|
775
|
+
return encType != null && !supportedFormEncTypes.has(encType) ? (process.env.NODE_ENV !== "production" && warning(!1, '"' + encType + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + defaultEncType + '"')), null) : encType;
|
|
776
|
+
}
|
|
777
|
+
function getFormSubmissionInfo(target, basename) {
|
|
778
|
+
let method, action, encType, formData, body;
|
|
779
|
+
if (isFormElement(target)) {
|
|
780
|
+
let attr = target.getAttribute("action");
|
|
781
|
+
action = attr ? stripBasename(attr, basename) : null, method = target.getAttribute("method") || defaultMethod, encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType, formData = new FormData(target);
|
|
782
|
+
} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
|
|
783
|
+
let form = target.form;
|
|
784
|
+
if (form == null)
|
|
785
|
+
throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');
|
|
786
|
+
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
787
|
+
if (action = attr ? stripBasename(attr, basename) : null, method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod, encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType, formData = new FormData(form, target), !isFormDataSubmitterSupported()) {
|
|
788
|
+
let {
|
|
789
|
+
name,
|
|
790
|
+
type,
|
|
791
|
+
value
|
|
792
|
+
} = target;
|
|
793
|
+
if (type === "image") {
|
|
794
|
+
let prefix = name ? name + "." : "";
|
|
795
|
+
formData.append(prefix + "x", "0"), formData.append(prefix + "y", "0");
|
|
796
|
+
} else name && formData.append(name, value);
|
|
797
|
+
}
|
|
798
|
+
} else {
|
|
799
|
+
if (isHtmlElement(target))
|
|
800
|
+
throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');
|
|
801
|
+
method = defaultMethod, action = null, encType = defaultEncType, body = target;
|
|
802
|
+
}
|
|
803
|
+
return formData && encType === "text/plain" && (body = formData, formData = void 0), {
|
|
804
|
+
action,
|
|
805
|
+
method: method.toLowerCase(),
|
|
806
|
+
encType,
|
|
807
|
+
formData,
|
|
808
|
+
body
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
var _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"], _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"], _excluded3 = ["reloadDocument", "replace", "state", "method", "action", "onSubmit", "submit", "relative", "preventScrollReset"];
|
|
812
|
+
var START_TRANSITION2 = "startTransition", startTransitionImpl2 = React2[START_TRANSITION2];
|
|
813
|
+
function BrowserRouter(_ref) {
|
|
814
|
+
let {
|
|
815
|
+
basename,
|
|
816
|
+
children,
|
|
817
|
+
future,
|
|
818
|
+
window: window2
|
|
819
|
+
} = _ref, historyRef = React2.useRef();
|
|
820
|
+
historyRef.current == null && (historyRef.current = createBrowserHistory({
|
|
821
|
+
window: window2,
|
|
822
|
+
v5Compat: !0
|
|
823
|
+
}));
|
|
824
|
+
let history = historyRef.current, [state, setStateImpl] = React2.useState({
|
|
825
|
+
action: history.action,
|
|
826
|
+
location: history.location
|
|
827
|
+
}), {
|
|
828
|
+
v7_startTransition
|
|
829
|
+
} = future || {}, setState = React2.useCallback((newState) => {
|
|
830
|
+
v7_startTransition && startTransitionImpl2 ? startTransitionImpl2(() => setStateImpl(newState)) : setStateImpl(newState);
|
|
831
|
+
}, [setStateImpl, v7_startTransition]);
|
|
832
|
+
return React2.useLayoutEffect(() => history.listen(setState), [history, setState]), React2.createElement(Router, {
|
|
833
|
+
basename,
|
|
834
|
+
children,
|
|
835
|
+
location: state.location,
|
|
836
|
+
navigationType: state.action,
|
|
837
|
+
navigator: history
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
function HistoryRouter(_ref3) {
|
|
841
|
+
let {
|
|
842
|
+
basename,
|
|
843
|
+
children,
|
|
844
|
+
future,
|
|
845
|
+
history
|
|
846
|
+
} = _ref3, [state, setStateImpl] = React2.useState({
|
|
847
|
+
action: history.action,
|
|
848
|
+
location: history.location
|
|
849
|
+
}), {
|
|
850
|
+
v7_startTransition
|
|
851
|
+
} = future || {}, setState = React2.useCallback((newState) => {
|
|
852
|
+
v7_startTransition && startTransitionImpl2 ? startTransitionImpl2(() => setStateImpl(newState)) : setStateImpl(newState);
|
|
853
|
+
}, [setStateImpl, v7_startTransition]);
|
|
854
|
+
return React2.useLayoutEffect(() => history.listen(setState), [history, setState]), React2.createElement(Router, {
|
|
855
|
+
basename,
|
|
856
|
+
children,
|
|
857
|
+
location: state.location,
|
|
858
|
+
navigationType: state.action,
|
|
859
|
+
navigator: history
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
process.env.NODE_ENV !== "production" && (HistoryRouter.displayName = "unstable_HistoryRouter");
|
|
863
|
+
var isBrowser = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, Link = React2.forwardRef(function(_ref4, ref) {
|
|
864
|
+
let {
|
|
865
|
+
onClick,
|
|
866
|
+
relative,
|
|
867
|
+
reloadDocument,
|
|
868
|
+
replace,
|
|
869
|
+
state,
|
|
870
|
+
target,
|
|
871
|
+
to,
|
|
872
|
+
preventScrollReset
|
|
873
|
+
} = _ref4, rest = _objectWithoutPropertiesLoose(_ref4, _excluded), {
|
|
874
|
+
basename
|
|
875
|
+
} = React2.useContext(NavigationContext), absoluteHref, isExternal = !1;
|
|
876
|
+
if (typeof to == "string" && ABSOLUTE_URL_REGEX.test(to) && (absoluteHref = to, isBrowser))
|
|
877
|
+
try {
|
|
878
|
+
let currentUrl = new URL(window.location.href), targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to), path = stripBasename(targetUrl.pathname, basename);
|
|
879
|
+
targetUrl.origin === currentUrl.origin && path != null ? to = path + targetUrl.search + targetUrl.hash : isExternal = !0;
|
|
880
|
+
} catch {
|
|
881
|
+
process.env.NODE_ENV !== "production" && warning(!1, '<Link to="' + to + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.');
|
|
882
|
+
}
|
|
883
|
+
let href = useHref(to, {
|
|
884
|
+
relative
|
|
885
|
+
}), internalOnClick = useLinkClickHandler(to, {
|
|
886
|
+
replace,
|
|
887
|
+
state,
|
|
888
|
+
target,
|
|
889
|
+
preventScrollReset,
|
|
890
|
+
relative
|
|
891
|
+
});
|
|
892
|
+
function handleClick(event) {
|
|
893
|
+
onClick && onClick(event), event.defaultPrevented || internalOnClick(event);
|
|
894
|
+
}
|
|
895
|
+
return (
|
|
896
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
897
|
+
React2.createElement("a", _extends3({}, rest, {
|
|
898
|
+
href: absoluteHref || href,
|
|
899
|
+
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
900
|
+
ref,
|
|
901
|
+
target
|
|
902
|
+
}))
|
|
903
|
+
);
|
|
904
|
+
});
|
|
905
|
+
process.env.NODE_ENV !== "production" && (Link.displayName = "Link");
|
|
906
|
+
var NavLink = React2.forwardRef(function(_ref5, ref) {
|
|
907
|
+
let {
|
|
908
|
+
"aria-current": ariaCurrentProp = "page",
|
|
909
|
+
caseSensitive = !1,
|
|
910
|
+
className: classNameProp = "",
|
|
911
|
+
end = !1,
|
|
912
|
+
style: styleProp,
|
|
913
|
+
to,
|
|
914
|
+
children
|
|
915
|
+
} = _ref5, rest = _objectWithoutPropertiesLoose(_ref5, _excluded2), path = useResolvedPath(to, {
|
|
916
|
+
relative: rest.relative
|
|
917
|
+
}), location = useLocation(), routerState = React2.useContext(DataRouterStateContext), {
|
|
918
|
+
navigator
|
|
919
|
+
} = React2.useContext(NavigationContext), toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname, locationPathname = location.pathname, nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
920
|
+
caseSensitive || (locationPathname = locationPathname.toLowerCase(), nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null, toPathname = toPathname.toLowerCase());
|
|
921
|
+
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/", isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"), ariaCurrent = isActive ? ariaCurrentProp : void 0, className;
|
|
922
|
+
typeof classNameProp == "function" ? className = classNameProp({
|
|
923
|
+
isActive,
|
|
924
|
+
isPending
|
|
925
|
+
}) : className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null].filter(Boolean).join(" ");
|
|
926
|
+
let style = typeof styleProp == "function" ? styleProp({
|
|
927
|
+
isActive,
|
|
928
|
+
isPending
|
|
929
|
+
}) : styleProp;
|
|
930
|
+
return React2.createElement(Link, _extends3({}, rest, {
|
|
931
|
+
"aria-current": ariaCurrent,
|
|
932
|
+
className,
|
|
933
|
+
ref,
|
|
934
|
+
style,
|
|
935
|
+
to
|
|
936
|
+
}), typeof children == "function" ? children({
|
|
937
|
+
isActive,
|
|
938
|
+
isPending
|
|
939
|
+
}) : children);
|
|
940
|
+
});
|
|
941
|
+
process.env.NODE_ENV !== "production" && (NavLink.displayName = "NavLink");
|
|
942
|
+
var Form = React2.forwardRef((props, ref) => {
|
|
943
|
+
let submit = useSubmit();
|
|
944
|
+
return React2.createElement(FormImpl, _extends3({}, props, {
|
|
945
|
+
submit,
|
|
946
|
+
ref
|
|
947
|
+
}));
|
|
948
|
+
});
|
|
949
|
+
process.env.NODE_ENV !== "production" && (Form.displayName = "Form");
|
|
950
|
+
var FormImpl = React2.forwardRef((_ref6, forwardedRef) => {
|
|
951
|
+
let {
|
|
952
|
+
reloadDocument,
|
|
953
|
+
replace,
|
|
954
|
+
state,
|
|
955
|
+
method = defaultMethod,
|
|
956
|
+
action,
|
|
957
|
+
onSubmit,
|
|
958
|
+
submit,
|
|
959
|
+
relative,
|
|
960
|
+
preventScrollReset
|
|
961
|
+
} = _ref6, props = _objectWithoutPropertiesLoose(_ref6, _excluded3), formMethod = method.toLowerCase() === "get" ? "get" : "post", formAction = useFormAction(action, {
|
|
962
|
+
relative
|
|
963
|
+
});
|
|
964
|
+
return React2.createElement("form", _extends3({
|
|
965
|
+
ref: forwardedRef,
|
|
966
|
+
method: formMethod,
|
|
967
|
+
action: formAction,
|
|
968
|
+
onSubmit: reloadDocument ? onSubmit : (event) => {
|
|
969
|
+
if (onSubmit && onSubmit(event), event.defaultPrevented) return;
|
|
970
|
+
event.preventDefault();
|
|
971
|
+
let submitter = event.nativeEvent.submitter, submitMethod = submitter?.getAttribute("formmethod") || method;
|
|
972
|
+
submit(submitter || event.currentTarget, {
|
|
973
|
+
method: submitMethod,
|
|
974
|
+
replace,
|
|
975
|
+
state,
|
|
976
|
+
relative,
|
|
977
|
+
preventScrollReset
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
}, props));
|
|
981
|
+
});
|
|
982
|
+
process.env.NODE_ENV !== "production" && (FormImpl.displayName = "FormImpl");
|
|
983
|
+
function ScrollRestoration(_ref7) {
|
|
984
|
+
let {
|
|
985
|
+
getKey,
|
|
986
|
+
storageKey
|
|
987
|
+
} = _ref7;
|
|
988
|
+
return useScrollRestoration({
|
|
989
|
+
getKey,
|
|
990
|
+
storageKey
|
|
991
|
+
}), null;
|
|
992
|
+
}
|
|
993
|
+
process.env.NODE_ENV !== "production" && (ScrollRestoration.displayName = "ScrollRestoration");
|
|
994
|
+
var DataRouterHook2;
|
|
995
|
+
(function(DataRouterHook3) {
|
|
996
|
+
DataRouterHook3.UseScrollRestoration = "useScrollRestoration", DataRouterHook3.UseSubmit = "useSubmit", DataRouterHook3.UseSubmitFetcher = "useSubmitFetcher", DataRouterHook3.UseFetcher = "useFetcher";
|
|
997
|
+
})(DataRouterHook2 || (DataRouterHook2 = {}));
|
|
998
|
+
var DataRouterStateHook2;
|
|
999
|
+
(function(DataRouterStateHook3) {
|
|
1000
|
+
DataRouterStateHook3.UseFetchers = "useFetchers", DataRouterStateHook3.UseScrollRestoration = "useScrollRestoration";
|
|
1001
|
+
})(DataRouterStateHook2 || (DataRouterStateHook2 = {}));
|
|
1002
|
+
function getDataRouterConsoleError2(hookName) {
|
|
1003
|
+
return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
|
|
1004
|
+
}
|
|
1005
|
+
function useDataRouterContext2(hookName) {
|
|
1006
|
+
let ctx = React2.useContext(DataRouterContext);
|
|
1007
|
+
return ctx || (process.env.NODE_ENV !== "production" ? invariant(!1, getDataRouterConsoleError2(hookName)) : invariant(!1)), ctx;
|
|
1008
|
+
}
|
|
1009
|
+
function useDataRouterState2(hookName) {
|
|
1010
|
+
let state = React2.useContext(DataRouterStateContext);
|
|
1011
|
+
return state || (process.env.NODE_ENV !== "production" ? invariant(!1, getDataRouterConsoleError2(hookName)) : invariant(!1)), state;
|
|
1012
|
+
}
|
|
1013
|
+
function useLinkClickHandler(to, _temp) {
|
|
1014
|
+
let {
|
|
1015
|
+
target,
|
|
1016
|
+
replace: replaceProp,
|
|
1017
|
+
state,
|
|
1018
|
+
preventScrollReset,
|
|
1019
|
+
relative
|
|
1020
|
+
} = _temp === void 0 ? {} : _temp, navigate = useNavigate(), location = useLocation(), path = useResolvedPath(to, {
|
|
1021
|
+
relative
|
|
1022
|
+
});
|
|
1023
|
+
return React2.useCallback((event) => {
|
|
1024
|
+
if (shouldProcessLinkClick(event, target)) {
|
|
1025
|
+
event.preventDefault();
|
|
1026
|
+
let replace = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
|
|
1027
|
+
navigate(to, {
|
|
1028
|
+
replace,
|
|
1029
|
+
state,
|
|
1030
|
+
preventScrollReset,
|
|
1031
|
+
relative
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
}, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative]);
|
|
1035
|
+
}
|
|
1036
|
+
function validateClientSideSubmission() {
|
|
1037
|
+
if (typeof document > "u")
|
|
1038
|
+
throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");
|
|
1039
|
+
}
|
|
1040
|
+
function useSubmit() {
|
|
1041
|
+
let {
|
|
1042
|
+
router
|
|
1043
|
+
} = useDataRouterContext2(DataRouterHook2.UseSubmit), {
|
|
1044
|
+
basename
|
|
1045
|
+
} = React2.useContext(NavigationContext), currentRouteId = useRouteId();
|
|
1046
|
+
return React2.useCallback(function(target, options) {
|
|
1047
|
+
options === void 0 && (options = {}), validateClientSideSubmission();
|
|
1048
|
+
let {
|
|
1049
|
+
action,
|
|
1050
|
+
method,
|
|
1051
|
+
encType,
|
|
1052
|
+
formData,
|
|
1053
|
+
body
|
|
1054
|
+
} = getFormSubmissionInfo(target, basename);
|
|
1055
|
+
router.navigate(options.action || action, {
|
|
1056
|
+
preventScrollReset: options.preventScrollReset,
|
|
1057
|
+
formData,
|
|
1058
|
+
body,
|
|
1059
|
+
formMethod: options.method || method,
|
|
1060
|
+
formEncType: options.encType || encType,
|
|
1061
|
+
replace: options.replace,
|
|
1062
|
+
state: options.state,
|
|
1063
|
+
fromRouteId: currentRouteId
|
|
1064
|
+
});
|
|
1065
|
+
}, [router, basename, currentRouteId]);
|
|
1066
|
+
}
|
|
1067
|
+
function useFormAction(action, _temp2) {
|
|
1068
|
+
let {
|
|
1069
|
+
relative
|
|
1070
|
+
} = _temp2 === void 0 ? {} : _temp2, {
|
|
1071
|
+
basename
|
|
1072
|
+
} = React2.useContext(NavigationContext), routeContext = React2.useContext(RouteContext);
|
|
1073
|
+
routeContext || (process.env.NODE_ENV !== "production" ? invariant(!1, "useFormAction must be used inside a RouteContext") : invariant(!1));
|
|
1074
|
+
let [match] = routeContext.matches.slice(-1), path = _extends3({}, useResolvedPath(action || ".", {
|
|
1075
|
+
relative
|
|
1076
|
+
})), location = useLocation();
|
|
1077
|
+
if (action == null && (path.search = location.search, match.route.index)) {
|
|
1078
|
+
let params = new URLSearchParams(path.search);
|
|
1079
|
+
params.delete("index"), path.search = params.toString() ? "?" + params.toString() : "";
|
|
1080
|
+
}
|
|
1081
|
+
return (!action || action === ".") && match.route.index && (path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"), basename !== "/" && (path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname])), createPath(path);
|
|
1082
|
+
}
|
|
1083
|
+
var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions", savedScrollPositions = {};
|
|
1084
|
+
function useScrollRestoration(_temp3) {
|
|
1085
|
+
let {
|
|
1086
|
+
getKey,
|
|
1087
|
+
storageKey
|
|
1088
|
+
} = _temp3 === void 0 ? {} : _temp3, {
|
|
1089
|
+
router
|
|
1090
|
+
} = useDataRouterContext2(DataRouterHook2.UseScrollRestoration), {
|
|
1091
|
+
restoreScrollPosition,
|
|
1092
|
+
preventScrollReset
|
|
1093
|
+
} = useDataRouterState2(DataRouterStateHook2.UseScrollRestoration), {
|
|
1094
|
+
basename
|
|
1095
|
+
} = React2.useContext(NavigationContext), location = useLocation(), matches = useMatches(), navigation = useNavigation();
|
|
1096
|
+
React2.useEffect(() => (window.history.scrollRestoration = "manual", () => {
|
|
1097
|
+
window.history.scrollRestoration = "auto";
|
|
1098
|
+
}), []), usePageHide(React2.useCallback(() => {
|
|
1099
|
+
if (navigation.state === "idle") {
|
|
1100
|
+
let key = (getKey ? getKey(location, matches) : null) || location.key;
|
|
1101
|
+
savedScrollPositions[key] = window.scrollY;
|
|
1102
|
+
}
|
|
1103
|
+
sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions)), window.history.scrollRestoration = "auto";
|
|
1104
|
+
}, [storageKey, getKey, navigation.state, location, matches])), typeof document < "u" && (React2.useLayoutEffect(() => {
|
|
1105
|
+
try {
|
|
1106
|
+
let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
|
|
1107
|
+
sessionPositions && (savedScrollPositions = JSON.parse(sessionPositions));
|
|
1108
|
+
} catch {
|
|
1109
|
+
}
|
|
1110
|
+
}, [storageKey]), React2.useLayoutEffect(() => {
|
|
1111
|
+
let getKeyWithoutBasename = getKey && basename !== "/" ? (location2, matches2) => getKey(
|
|
1112
|
+
// Strip the basename to match useLocation()
|
|
1113
|
+
_extends3({}, location2, {
|
|
1114
|
+
pathname: stripBasename(location2.pathname, basename) || location2.pathname
|
|
1115
|
+
}),
|
|
1116
|
+
matches2
|
|
1117
|
+
) : getKey, disableScrollRestoration = router?.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);
|
|
1118
|
+
return () => disableScrollRestoration && disableScrollRestoration();
|
|
1119
|
+
}, [router, basename, getKey]), React2.useLayoutEffect(() => {
|
|
1120
|
+
if (restoreScrollPosition !== !1) {
|
|
1121
|
+
if (typeof restoreScrollPosition == "number") {
|
|
1122
|
+
window.scrollTo(0, restoreScrollPosition);
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
if (location.hash) {
|
|
1126
|
+
let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
|
|
1127
|
+
if (el) {
|
|
1128
|
+
el.scrollIntoView();
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
preventScrollReset !== !0 && window.scrollTo(0, 0);
|
|
1133
|
+
}
|
|
1134
|
+
}, [location, restoreScrollPosition, preventScrollReset]));
|
|
1135
|
+
}
|
|
1136
|
+
function usePageHide(callback, options) {
|
|
1137
|
+
let {
|
|
1138
|
+
capture
|
|
1139
|
+
} = options || {};
|
|
1140
|
+
React2.useEffect(() => {
|
|
1141
|
+
let opts = capture != null ? {
|
|
1142
|
+
capture
|
|
1143
|
+
} : void 0;
|
|
1144
|
+
return window.addEventListener("pagehide", callback, opts), () => {
|
|
1145
|
+
window.removeEventListener("pagehide", callback, opts);
|
|
1146
|
+
};
|
|
1147
|
+
}, [callback, capture]);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
// src/router/router.tsx
|
|
1151
|
+
import { NAVIGATE_URL } from "@aussieljk/forkbook/internal/core-events";
|
|
1152
|
+
import { addons } from "@aussieljk/forkbook/manager-api";
|
|
1153
|
+
import { Fragment as Fragment2, jsx } from "react/jsx-runtime";
|
|
1154
|
+
var { document: document2 } = global, getBase = () => `${document2.location.pathname}?`, useNavigate2 = () => {
|
|
1155
|
+
let navigate = useNavigate();
|
|
1156
|
+
return useCallback3((to, { plain, ...options } = {}) => {
|
|
1157
|
+
if (typeof to == "string" && to.startsWith("#"))
|
|
1158
|
+
return navigate(`${document2.location.search}${to === "#" ? "" : to}`, options);
|
|
1159
|
+
if (typeof to == "string") {
|
|
1160
|
+
let target = plain ? to : `?path=${to}`, [search, hash] = target.split("#");
|
|
1161
|
+
if (search === document2.location.search && hash) {
|
|
1162
|
+
addons.getChannel().emit(NAVIGATE_URL, `#${hash}`);
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
return navigate(target, options);
|
|
1166
|
+
}
|
|
1167
|
+
if (typeof to == "number")
|
|
1168
|
+
return navigate(to);
|
|
1169
|
+
}, []);
|
|
1170
|
+
}, Link2 = ({ to, children, ...rest }) => jsx(Link, { to: `${getBase()}path=${to}`, ...rest, children });
|
|
1171
|
+
Link2.displayName = "QueryLink";
|
|
1172
|
+
var Location = ({ children }) => {
|
|
1173
|
+
let location = useLocation(), { path = "", singleStory } = queryFromLocation(location), { viewMode, storyId, refId } = parsePath(path);
|
|
1174
|
+
return jsx(Fragment2, { children: children({
|
|
1175
|
+
path: path || "/",
|
|
1176
|
+
location,
|
|
1177
|
+
viewMode,
|
|
1178
|
+
storyId,
|
|
1179
|
+
refId,
|
|
1180
|
+
singleStory: singleStory === "true"
|
|
1181
|
+
}) });
|
|
1182
|
+
};
|
|
1183
|
+
Location.displayName = "QueryLocation";
|
|
1184
|
+
function Match({
|
|
1185
|
+
children,
|
|
1186
|
+
path: targetPath,
|
|
1187
|
+
startsWith = !1
|
|
1188
|
+
}) {
|
|
1189
|
+
return jsx(Location, { children: ({ path: urlPath, ...rest }) => children({
|
|
1190
|
+
match: getMatch(urlPath, targetPath, startsWith),
|
|
1191
|
+
...rest
|
|
1192
|
+
}) });
|
|
1193
|
+
}
|
|
1194
|
+
Match.displayName = "QueryMatch";
|
|
1195
|
+
function Route2(input) {
|
|
1196
|
+
let { children, ...rest } = input;
|
|
1197
|
+
return rest.startsWith === void 0 && (rest.startsWith = !1), jsx(Match, { ...rest, children: ({ match }) => match ? children : null });
|
|
1198
|
+
}
|
|
1199
|
+
Route2.displayName = "Route";
|
|
1200
|
+
var LocationProvider = (...args) => BrowserRouter(...args), BaseLocationProvider = (...args) => Router(...args), MemoryRouter2 = (...args) => MemoryRouter(...args);
|
|
1201
|
+
export {
|
|
1202
|
+
BaseLocationProvider,
|
|
1203
|
+
DEEPLY_EQUAL,
|
|
1204
|
+
Link2 as Link,
|
|
1205
|
+
Location,
|
|
1206
|
+
LocationProvider,
|
|
1207
|
+
Match,
|
|
1208
|
+
MemoryRouter2 as MemoryRouter,
|
|
1209
|
+
Route2 as Route,
|
|
1210
|
+
buildArgsParam,
|
|
1211
|
+
deepDiff,
|
|
1212
|
+
getMatch,
|
|
1213
|
+
parsePath,
|
|
1214
|
+
queryFromLocation,
|
|
1215
|
+
stringifyQuery,
|
|
1216
|
+
useNavigate2 as useNavigate
|
|
1217
|
+
};
|