@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,2461 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SnippetWarning,
|
|
3
|
+
Source
|
|
4
|
+
} from "../_browser-chunks/chunk-KQ7CRO2B.js";
|
|
5
|
+
import {
|
|
6
|
+
ArgsTable,
|
|
7
|
+
BooleanControl,
|
|
8
|
+
ColorControl,
|
|
9
|
+
DateControl,
|
|
10
|
+
FilesControl,
|
|
11
|
+
NumberControl,
|
|
12
|
+
ObjectControl,
|
|
13
|
+
OptionsControl,
|
|
14
|
+
RangeControl,
|
|
15
|
+
TextControl,
|
|
16
|
+
format,
|
|
17
|
+
formatDate,
|
|
18
|
+
formatTime,
|
|
19
|
+
index_modern_default,
|
|
20
|
+
normalizeOptions,
|
|
21
|
+
parse,
|
|
22
|
+
parseDate,
|
|
23
|
+
parseTime
|
|
24
|
+
} from "../_browser-chunks/chunk-JYVGARBG.js";
|
|
25
|
+
import "../_browser-chunks/chunk-PJSMZ27A.js";
|
|
26
|
+
import "../_browser-chunks/chunk-PFRNG3UC.js";
|
|
27
|
+
import {
|
|
28
|
+
clsx
|
|
29
|
+
} from "../_browser-chunks/chunk-CNED6RYH.js";
|
|
30
|
+
import {
|
|
31
|
+
stringify
|
|
32
|
+
} from "../_browser-chunks/chunk-WGVAAM43.js";
|
|
33
|
+
import "../_browser-chunks/chunk-4ATQOMJB.js";
|
|
34
|
+
import "../_browser-chunks/chunk-2JDQ35OA.js";
|
|
35
|
+
import "../_browser-chunks/chunk-IE4ULIOQ.js";
|
|
36
|
+
import "../_browser-chunks/chunk-JWSKPMPC.js";
|
|
37
|
+
import "../_browser-chunks/chunk-JPUOQJUI.js";
|
|
38
|
+
import "../_browser-chunks/chunk-IMSF75WX.js";
|
|
39
|
+
|
|
40
|
+
// src/addon-docs/blocks/components/DocsPage.tsx
|
|
41
|
+
import { withReset as withReset2 } from "@aussieljk/forkbook/internal/components";
|
|
42
|
+
|
|
43
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/DocsPage.module.css
|
|
44
|
+
var id = "core/src/addon-docs/blocks/components/DocsPage.module.css";
|
|
45
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id}"]`)) {
|
|
46
|
+
let style = document.createElement("style");
|
|
47
|
+
style.setAttribute("data-sb-css", id), style.textContent = ".sb-JTDUUW-subtitle{font-weight:var(--sb-weight-regular);font-size:var(--sb-size-s3);color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .25));border-bottom:none;margin-bottom:15px;line-height:20px;@media (width>=600px){font-size:var(--sb-size-m1);margin-bottom:24px;line-height:28px}}.sb-JTDUUW-docsWrapper{background:var(--sb-background-content);box-sizing:border-box;flex-direction:row-reverse;justify-content:center;gap:3rem;min-height:100vh;padding:4rem 40px;display:flex}.sb-JTDUUW-docsContent{--docs-code-border:var(--sb-color-mediumlight);--docs-code-color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .1));--docs-code-background:var(--sb-color-lighter);--docs-even-row-background:var(--sb-color-lighter);flex:1;width:100%;min-width:0;max-width:1000px;& :where(a:not(.sb-anchor,.sb-unstyled,.sb-unstyled a)),& :where(blockquote:not(.sb-anchor,.sb-unstyled,.sb-unstyled blockquote)),& :where(div:not(.sb-anchor,.sb-unstyled,.sb-unstyled div)),& :where(dl:not(.sb-anchor,.sb-unstyled,.sb-unstyled dl)),& :where(h1:not(.sb-anchor,.sb-unstyled,.sb-unstyled h1)),& :where(h2:not(.sb-anchor,.sb-unstyled,.sb-unstyled h2)),& :where(h3:not(.sb-anchor,.sb-unstyled,.sb-unstyled h3)),& :where(h4:not(.sb-anchor,.sb-unstyled,.sb-unstyled h4)),& :where(h5:not(.sb-anchor,.sb-unstyled,.sb-unstyled h5)),& :where(h6:not(.sb-anchor,.sb-unstyled,.sb-unstyled h6)),& :where(li:not(.sb-anchor,.sb-unstyled,.sb-unstyled li)),& :where(ol:not(.sb-anchor,.sb-unstyled,.sb-unstyled ol)),& :where(p:not(.sb-anchor,.sb-unstyled,.sb-unstyled p)),& :where(pre:not(.sb-anchor,.sb-unstyled,.sb-unstyled pre)),& :where(span:not(.sb-anchor,.sb-unstyled,.sb-unstyled span)),& :where(table:not(.sb-anchor,.sb-unstyled,.sb-unstyled table)),& :where(ul:not(.sb-anchor,.sb-unstyled,.sb-unstyled ul)){font-family:var(--sb-font-base);font-size:var(--sb-size-s3);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:#0000;-webkit-overflow-scrolling:touch;margin:0}& :where(h1:not(.sb-anchor,.sb-unstyled,.sb-unstyled h1)),& :where(h2:not(.sb-anchor,.sb-unstyled,.sb-unstyled h2)),& :where(h3:not(.sb-anchor,.sb-unstyled,.sb-unstyled h3)),& :where(h4:not(.sb-anchor,.sb-unstyled,.sb-unstyled h4)),& :where(h5:not(.sb-anchor,.sb-unstyled,.sb-unstyled h5)),& :where(h6:not(.sb-anchor,.sb-unstyled,.sb-unstyled h6)){cursor:text;color:var(--sb-color-default-text);margin:20px 0 8px;padding:0;position:relative;&:first-of-type{margin-top:0;padding-top:0}&:hover a.anchor{text-decoration:none}& code{font-size:inherit}}& :where(li:not(.sb-anchor,.sb-unstyled,.sb-unstyled li)) code,& :where(p:not(.sb-anchor,.sb-unstyled,.sb-unstyled p)) code{white-space:nowrap;line-height:1;font-size:calc(var(--sb-size-s2) - 1px);border:1px solid var(--docs-code-border);color:var(--docs-code-color);background-color:var(--docs-code-background);border-radius:3px;margin:0 2px;padding:3px 5px}& :where(a:not(.sb-anchor,.sb-unstyled,.sb-unstyled a)){font-size:inherit;color:var(--sb-color-secondary);text-underline-offset:.11em;line-height:24px;text-decoration:underline .03125rem;&.absent{color:#c00}&.anchor{cursor:pointer;margin-left:-30px;padding-left:30px;text-decoration:none;display:block;position:absolute;top:0;bottom:0;left:0}&.anchor:hover,&.anchor:focus{text-decoration:underline}}& :where(blockquote:not(.sb-anchor,.sb-unstyled,.sb-unstyled blockquote)){border-left:4px solid var(--sb-color-medium);color:var(--sb-color-dark);margin:16px 0;padding:0 15px;&>:first-of-type{margin-top:0}&>:last-child{margin-bottom:0}}& :where(dl:not(.sb-anchor,.sb-unstyled,.sb-unstyled dl)){margin:16px 0;padding:0;& dt{margin:16px 0 4px;padding:0;font-size:14px;font-style:italic;font-weight:700}& dt:first-of-type{padding:0}& dt>:first-of-type{margin-top:0}& dt>:last-child{margin-bottom:0}& dd{margin:0 0 16px;padding:0 15px}& dd>:first-of-type{margin-top:0}& dd>:last-child{margin-bottom:0}}& :where(h1:not(.sb-anchor,.sb-unstyled,.sb-unstyled h1)){font-size:var(--sb-size-l1);font-weight:var(--sb-weight-bold)}& :where(h2:not(.sb-anchor,.sb-unstyled,.sb-unstyled h2)){font-size:var(--sb-size-m2);border-bottom:1px solid var(--sb-app-border-color);padding-bottom:4px}& :where(h3:not(.sb-anchor,.sb-unstyled,.sb-unstyled h3)){font-size:var(--sb-size-m1);font-weight:var(--sb-weight-bold)}& :where(h4:not(.sb-anchor,.sb-unstyled,.sb-unstyled h4)){font-size:var(--sb-size-s3)}& :where(h5:not(.sb-anchor,.sb-unstyled,.sb-unstyled h5)){font-size:var(--sb-size-s2)}& :where(h6:not(.sb-anchor,.sb-unstyled,.sb-unstyled h6)){font-size:var(--sb-size-s2);color:var(--sb-color-dark)}& :where(hr:not(.sb-anchor,.sb-unstyled,.sb-unstyled hr)){border:0;border-top:1px solid var(--sb-app-border-color);height:4px;padding:0}& :where(img:not(.sb-anchor,.sb-unstyled,.sb-unstyled img)){max-width:100%}& :where(li:not(.sb-anchor,.sb-unstyled,.sb-unstyled li)){font-size:var(--sb-size-s2);color:var(--sb-color-default-text);line-height:24px;&+li{margin-top:.25em}& ul,& ol{margin-top:.25em;margin-bottom:0}}& :where(ol:not(.sb-anchor,.sb-unstyled,.sb-unstyled ol)),& :where(ul:not(.sb-anchor,.sb-unstyled,.sb-unstyled ul)){margin:16px 0;padding-left:30px;& :first-of-type{margin-top:0}& :last-child{margin-bottom:0}}& :where(ul:not(.sb-anchor,.sb-unstyled,.sb-unstyled ul)){list-style:outside}& :where(p:not(.sb-anchor,.sb-unstyled,.sb-unstyled p)){font-size:var(--sb-size-s2);color:var(--sb-color-default-text);margin:16px 0;line-height:24px}& :where(pre:not(.sb-anchor,.sb-unstyled,.sb-unstyled pre)){font-family:var(--sb-font-mono);white-space:pre-wrap;color:inherit;border-radius:3px;margin:1rem 0;padding:11px 1rem;line-height:18px;&:not(.prismjs){background:0 0;border:none;border-radius:0;margin:0;padding:0}& pre,&.prismjs{white-space:pre-wrap;color:inherit;margin:0;padding:15px;font-size:13px;line-height:19px;& code{color:inherit;font-size:inherit}}& code{white-space:pre}& code,& tt{border:none}}& :where(span:not(.sb-anchor,.sb-unstyled,.sb-unstyled span)){&.frame{display:block;overflow:hidden;&>span{border:1px solid var(--sb-color-medium);float:left;width:auto;margin:13px 0 0;padding:7px;display:block;overflow:hidden}& span img{float:left;display:block}& span span{clear:both;color:var(--sb-color-darkest);padding:5px 0 0;display:block}}&.align-center{clear:both;display:block;overflow:hidden;&>span{text-align:center;margin:13px auto 0;display:block;overflow:hidden}& span img{text-align:center;margin:0 auto}}&.align-right{clear:both;display:block;overflow:hidden;&>span{text-align:right;margin:13px 0 0;display:block;overflow:hidden}& span img{text-align:right;margin:0}}&.float-left{float:left;margin-right:13px;display:block;overflow:hidden;& span{margin:13px 0 0}}&.float-right{float:right;margin-left:13px;display:block;overflow:hidden;&>span{text-align:right;margin:13px auto 0;display:block;overflow:hidden}}}& :where(table:not(.sb-anchor,.sb-unstyled,.sb-unstyled table)){font-size:var(--sb-size-s2);border-collapse:collapse;margin:16px 0;padding:0;line-height:24px;& tr{border-top:1px solid var(--sb-app-border-color);margin:0;padding:0}& tr:nth-of-type(2n){background-color:var(--docs-even-row-background)}& tr th{color:var(--sb-color-default-text);border:1px solid var(--sb-app-border-color);margin:0;padding:6px 13px;font-weight:700}& tr td{border:1px solid var(--sb-app-border-color);color:var(--sb-color-default-text);margin:0;padding:6px 13px}& tr th :first-of-type,& tr td :first-of-type{margin-top:0}& tr th :last-child,& tr td :last-child{margin-bottom:0}}}:where([data-sb-theme=dark]) .sb-JTDUUW-docsContent{--docs-code-border:var(--sb-color-darker);--docs-code-color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .3));--docs-code-background:var(--sb-color-border);--docs-even-row-background:var(--sb-color-darker)}", document.head.appendChild(style);
|
|
48
|
+
}
|
|
49
|
+
var DocsPage_default = { docsWrapper: "sb-JTDUUW-docsWrapper", docsContent: "sb-JTDUUW-docsContent", subtitle: "sb-JTDUUW-subtitle" };
|
|
50
|
+
|
|
51
|
+
// src/addon-docs/blocks/components/Title.tsx
|
|
52
|
+
import { withReset } from "@aussieljk/forkbook/internal/components";
|
|
53
|
+
|
|
54
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/Title.module.css
|
|
55
|
+
var id2 = "core/src/addon-docs/blocks/components/Title.module.css";
|
|
56
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id2}"]`)) {
|
|
57
|
+
let style = document.createElement("style");
|
|
58
|
+
style.setAttribute("data-sb-css", id2), style.textContent = ".sb-sjHF1G-title{color:var(--sb-color-default-text);font-size:var(--sb-size-m3);font-weight:var(--sb-weight-bold);line-height:32px;@media (width>=600px){font-size:var(--sb-size-l1);margin-bottom:16px;line-height:36px}}", document.head.appendChild(style);
|
|
59
|
+
}
|
|
60
|
+
var Title_default = { title: "sb-sjHF1G-title" };
|
|
61
|
+
|
|
62
|
+
// src/addon-docs/blocks/components/Title.tsx
|
|
63
|
+
import { jsx } from "react/jsx-runtime";
|
|
64
|
+
var Title = ({ className, ...props }) => jsx("h1", { className: clsx(withReset, Title_default.title, className), ...props });
|
|
65
|
+
|
|
66
|
+
// src/addon-docs/blocks/components/DocsPage.tsx
|
|
67
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
68
|
+
var Subtitle = ({ className, ...props }) => jsx2("h2", { className: clsx(withReset2, DocsPage_default.subtitle, className), ...props }), DocsContent = ({ className, ...props }) => jsx2("div", { className: clsx(DocsPage_default.docsContent, className), ...props }), DocsWrapper = ({ className, ...props }) => jsx2("div", { className: clsx(DocsPage_default.docsWrapper, className), ...props }), DocsPageWrapper = ({ children, toc, lang = "en" }) => jsxs(DocsWrapper, { className: "sbdocs sbdocs-wrapper", children: [
|
|
69
|
+
toc,
|
|
70
|
+
jsx2(DocsContent, { className: "sbdocs sbdocs-content", lang, children })
|
|
71
|
+
] });
|
|
72
|
+
|
|
73
|
+
// src/addon-docs/blocks/components/Preview.tsx
|
|
74
|
+
import { Children, useCallback, useContext as useContext2, useId, useMemo, useState as useState3 } from "react";
|
|
75
|
+
import { logger } from "@aussieljk/forkbook/internal/client-logger";
|
|
76
|
+
import { Bar, Button as Button2, ToggleButton, Zoom } from "@aussieljk/forkbook/internal/components";
|
|
77
|
+
import { CopyIcon, MarkupIcon } from "@storybook/icons";
|
|
78
|
+
|
|
79
|
+
// src/addon-docs/blocks/blocks/DocsContext.ts
|
|
80
|
+
import { createContext } from "react";
|
|
81
|
+
globalThis && globalThis.__DOCS_CONTEXT__ === void 0 && (globalThis.__DOCS_CONTEXT__ = createContext(null), globalThis.__DOCS_CONTEXT__.displayName = "DocsContext");
|
|
82
|
+
var DocsContext = globalThis ? globalThis.__DOCS_CONTEXT__ : createContext(null);
|
|
83
|
+
|
|
84
|
+
// src/addon-docs/blocks/blocks/Story.tsx
|
|
85
|
+
import { useContext } from "react";
|
|
86
|
+
import { InvalidBlockOfPropError } from "@aussieljk/forkbook/internal/preview-errors";
|
|
87
|
+
|
|
88
|
+
// src/addon-docs/blocks/blocks/useStory.ts
|
|
89
|
+
import { useEffect, useState } from "react";
|
|
90
|
+
function useStory(storyId, context) {
|
|
91
|
+
let stories = useStories([storyId], context);
|
|
92
|
+
return stories && stories[0];
|
|
93
|
+
}
|
|
94
|
+
function useStories(storyIds, context) {
|
|
95
|
+
let [storiesById, setStories] = useState({});
|
|
96
|
+
return useEffect(() => {
|
|
97
|
+
Promise.all(
|
|
98
|
+
storyIds.map(async (storyId) => {
|
|
99
|
+
let story = await context.loadStory(storyId);
|
|
100
|
+
setStories(
|
|
101
|
+
(current) => current[storyId] === story ? current : { ...current, [storyId]: story }
|
|
102
|
+
);
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}), storyIds.map((storyId) => {
|
|
106
|
+
if (storiesById[storyId])
|
|
107
|
+
return storiesById[storyId];
|
|
108
|
+
try {
|
|
109
|
+
return context.storyById(storyId);
|
|
110
|
+
} catch {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/addon-docs/blocks/blocks/with-mdx-component-override.tsx
|
|
117
|
+
import React from "react";
|
|
118
|
+
import { useMDXComponents } from "@mdx-js/react";
|
|
119
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
120
|
+
var MDX_WRAPPED_BLOCK = /* @__PURE__ */ Symbol("mdxWrappedBlock"), MdxWrappedBlockContext = React.createContext(null), withMdxComponentOverride = (blockName, Block) => {
|
|
121
|
+
let WrappedBlock = (props) => {
|
|
122
|
+
let wrappedBlocks = React.useContext(MdxWrappedBlockContext), Override = useMDXComponents()[blockName];
|
|
123
|
+
if (wrappedBlocks?.has(blockName) || Override === WrappedBlock)
|
|
124
|
+
return jsx3(Block, { ...props });
|
|
125
|
+
if (Override) {
|
|
126
|
+
let nextWrappedBlocks = new Set(wrappedBlocks ?? []);
|
|
127
|
+
return nextWrappedBlocks.add(blockName), jsx3(MdxWrappedBlockContext.Provider, { value: nextWrappedBlocks, children: jsx3(Override, { ...props }) });
|
|
128
|
+
}
|
|
129
|
+
return jsx3(Block, { ...props });
|
|
130
|
+
};
|
|
131
|
+
return WrappedBlock.displayName = blockName, WrappedBlock[MDX_WRAPPED_BLOCK] = !0, WrappedBlock;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/addon-docs/blocks/blocks/Story.tsx
|
|
135
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
136
|
+
var getStoryId = (props, context) => {
|
|
137
|
+
let { of, meta } = props;
|
|
138
|
+
if ("of" in props && of === void 0)
|
|
139
|
+
throw new InvalidBlockOfPropError();
|
|
140
|
+
return meta && context.referenceMeta(meta, !1), context.resolveOf(of || "story", ["story"]).story.id;
|
|
141
|
+
}, getStoryProps = (props, story, context) => {
|
|
142
|
+
let { parameters = {} } = story || {}, { docs = {} } = parameters, storyParameters = docs.story || {};
|
|
143
|
+
if (docs.disable)
|
|
144
|
+
return null;
|
|
145
|
+
if (props.inline ?? storyParameters.inline ?? !1) {
|
|
146
|
+
let height2 = props.height ?? storyParameters.height, autoplay = props.autoplay ?? storyParameters.autoplay ?? !1;
|
|
147
|
+
return {
|
|
148
|
+
story,
|
|
149
|
+
inline: !0,
|
|
150
|
+
height: height2,
|
|
151
|
+
autoplay,
|
|
152
|
+
forceInitialArgs: !!props.__forceInitialArgs,
|
|
153
|
+
primary: !!props.__primary,
|
|
154
|
+
renderStoryToElement: context.renderStoryToElement
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
let height = props.height ?? storyParameters.height ?? storyParameters.iframeHeight ?? "100px";
|
|
158
|
+
return {
|
|
159
|
+
story,
|
|
160
|
+
inline: !1,
|
|
161
|
+
height,
|
|
162
|
+
primary: !!props.__primary
|
|
163
|
+
};
|
|
164
|
+
}, StoryImpl = (props = { __forceInitialArgs: !1, __primary: !1 }) => {
|
|
165
|
+
let context = useContext(DocsContext), storyId = getStoryId(props, context), story = useStory(storyId, context);
|
|
166
|
+
if (!story)
|
|
167
|
+
return jsx4(StorySkeleton, {});
|
|
168
|
+
let storyProps = getStoryProps(props, story, context);
|
|
169
|
+
return storyProps ? jsx4(Story, { ...storyProps }) : null;
|
|
170
|
+
}, Story2 = withMdxComponentOverride("Story", StoryImpl);
|
|
171
|
+
|
|
172
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/BlockBackground.module.css
|
|
173
|
+
var id3 = "core/src/addon-docs/blocks/components/BlockBackground.module.css";
|
|
174
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id3}"]`)) {
|
|
175
|
+
let style = document.createElement("style");
|
|
176
|
+
style.setAttribute("data-sb-css", id3), style.textContent = ".sb-x3oNsa-blockBackground{border-radius:var(--sb-app-border-radius);background:var(--sb-background-content);border:1px solid var(--sb-app-border-color);box-shadow:0 1px 3px #0000001a}:where([data-sb-theme=dark]) .sb-x3oNsa-blockBackground{box-shadow:0 2px 5px #0003}", document.head.appendChild(style);
|
|
177
|
+
}
|
|
178
|
+
var BlockBackground_default = { blockBackground: "sb-x3oNsa-blockBackground" };
|
|
179
|
+
|
|
180
|
+
// src/addon-docs/blocks/components/BlockBackgroundStyles.tsx
|
|
181
|
+
var blockBackground = BlockBackground_default.blockBackground;
|
|
182
|
+
|
|
183
|
+
// src/addon-docs/blocks/components/Story.tsx
|
|
184
|
+
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
185
|
+
import { ErrorFormatter, Loader } from "@aussieljk/forkbook/internal/components";
|
|
186
|
+
|
|
187
|
+
// src/addon-docs/blocks/getStoryHref.ts
|
|
188
|
+
var getStoryHref = (storyId, additionalParams = {}) => {
|
|
189
|
+
let params = new URLSearchParams();
|
|
190
|
+
return Object.entries(additionalParams).forEach(([key, value]) => {
|
|
191
|
+
params.set(key, value);
|
|
192
|
+
}), params.set("id", storyId), `iframe.html?${params.toString()}`;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/addon-docs/blocks/components/IFrame.tsx
|
|
196
|
+
import { Component } from "react";
|
|
197
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
198
|
+
var { window: globalWindow } = globalThis, IFrame = class extends Component {
|
|
199
|
+
constructor() {
|
|
200
|
+
super(...arguments);
|
|
201
|
+
this.iframe = null;
|
|
202
|
+
}
|
|
203
|
+
componentDidMount() {
|
|
204
|
+
let { id: id11 } = this.props;
|
|
205
|
+
this.iframe = globalWindow.document.getElementById(id11);
|
|
206
|
+
}
|
|
207
|
+
shouldComponentUpdate(nextProps) {
|
|
208
|
+
let { scale } = nextProps;
|
|
209
|
+
return scale !== this.props.scale && this.setIframeBodyStyle({
|
|
210
|
+
width: `${scale * 100}%`,
|
|
211
|
+
height: `${scale * 100}%`,
|
|
212
|
+
transform: `scale(${1 / scale})`,
|
|
213
|
+
transformOrigin: "top left"
|
|
214
|
+
}), !1;
|
|
215
|
+
}
|
|
216
|
+
setIframeBodyStyle(style) {
|
|
217
|
+
return Object.assign(this.iframe.contentDocument.body.style, style);
|
|
218
|
+
}
|
|
219
|
+
render() {
|
|
220
|
+
let { id: id11, title, src, allowFullScreen, scale, ...rest } = this.props;
|
|
221
|
+
return jsx5(
|
|
222
|
+
"iframe",
|
|
223
|
+
{
|
|
224
|
+
id: id11,
|
|
225
|
+
title,
|
|
226
|
+
src,
|
|
227
|
+
...allowFullScreen ? { allow: "fullscreen" } : {},
|
|
228
|
+
loading: "lazy",
|
|
229
|
+
...rest
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/addon-docs/blocks/components/ZoomContext.tsx
|
|
236
|
+
import { createContext as createContext2 } from "react";
|
|
237
|
+
var ZoomContext = createContext2({
|
|
238
|
+
scale: 1
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// src/addon-docs/blocks/components/Story.tsx
|
|
242
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
243
|
+
var storyBlockIdFromId = ({ story, primary }) => `story--${story.id}${primary ? "--primary" : ""}`, InlineStory = (props) => {
|
|
244
|
+
let storyRef = useRef(), [showLoader, setShowLoader] = useState2(!0), [error, setError] = useState2(), { story, height, autoplay, forceInitialArgs, renderStoryToElement } = props;
|
|
245
|
+
return useEffect2(() => {
|
|
246
|
+
if (!(story && storyRef.current))
|
|
247
|
+
return () => {
|
|
248
|
+
};
|
|
249
|
+
let element = storyRef.current, cleanup = renderStoryToElement(
|
|
250
|
+
story,
|
|
251
|
+
element,
|
|
252
|
+
{
|
|
253
|
+
showMain: () => {
|
|
254
|
+
},
|
|
255
|
+
showError: ({ title, description }) => setError(new Error(`${title} - ${description}`)),
|
|
256
|
+
showException: (err) => setError(err)
|
|
257
|
+
},
|
|
258
|
+
{ autoplay, forceInitialArgs }
|
|
259
|
+
);
|
|
260
|
+
return setShowLoader(!1), () => {
|
|
261
|
+
Promise.resolve().then(() => cleanup());
|
|
262
|
+
};
|
|
263
|
+
}, [autoplay, renderStoryToElement, story]), error ? jsx6("pre", { children: jsx6(ErrorFormatter, { error }) }) : jsxs2(Fragment, { children: [
|
|
264
|
+
height ? jsx6("style", { children: `#${storyBlockIdFromId(
|
|
265
|
+
props
|
|
266
|
+
)} { min-height: ${height}; transform: translateZ(0); overflow: auto }` }) : null,
|
|
267
|
+
showLoader && jsx6(StorySkeleton, {}),
|
|
268
|
+
jsx6(
|
|
269
|
+
"div",
|
|
270
|
+
{
|
|
271
|
+
ref: storyRef,
|
|
272
|
+
id: `${storyBlockIdFromId(props)}-inner`,
|
|
273
|
+
"data-name": story.name,
|
|
274
|
+
lang: story.parameters?.htmlLang || "en"
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
] });
|
|
278
|
+
}, IFrameStory = ({ story, height = "500px" }) => jsx6("div", { style: { width: "100%", height }, children: jsx6(ZoomContext.Consumer, { children: ({ scale }) => jsx6(
|
|
279
|
+
IFrame,
|
|
280
|
+
{
|
|
281
|
+
id: `iframe--${story.id}`,
|
|
282
|
+
title: story.name,
|
|
283
|
+
src: getStoryHref(story.id, { viewMode: "story" }),
|
|
284
|
+
allowFullScreen: !0,
|
|
285
|
+
scale,
|
|
286
|
+
style: {
|
|
287
|
+
width: "100%",
|
|
288
|
+
height: "100%",
|
|
289
|
+
border: "0 none"
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
"iframe"
|
|
293
|
+
) }) }), Story = (props) => {
|
|
294
|
+
let { inline, story } = props;
|
|
295
|
+
return inline && !props.autoplay && story.usesMount ? jsxs2("strong", { style: { color: "var(--sb-color-orange)" }, children: [
|
|
296
|
+
"This story mounts inside of play. Set",
|
|
297
|
+
" ",
|
|
298
|
+
jsx6("a", { href: "https://storybook.js.org/docs/api/doc-blocks/doc-block-story?ref=ui#autoplay", children: "autoplay" }),
|
|
299
|
+
" ",
|
|
300
|
+
"to true to view this story."
|
|
301
|
+
] }) : jsx6("div", { id: storyBlockIdFromId(props), className: "sb-story sb-unstyled", "data-story-block": "true", children: inline ? jsx6(InlineStory, { ...props }) : jsx6(IFrameStory, { ...props }) });
|
|
302
|
+
}, StorySkeleton = () => jsx6(Loader, {});
|
|
303
|
+
|
|
304
|
+
// src/addon-docs/blocks/components/Toolbar.tsx
|
|
305
|
+
import { Button, Toolbar as SharedToolbar } from "@aussieljk/forkbook/internal/components";
|
|
306
|
+
import { ShareAltIcon, SyncIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon } from "@storybook/icons";
|
|
307
|
+
|
|
308
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/Toolbar.module.css
|
|
309
|
+
var id4 = "core/src/addon-docs/blocks/components/Toolbar.module.css";
|
|
310
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id4}"]`)) {
|
|
311
|
+
let style = document.createElement("style");
|
|
312
|
+
style.setAttribute("data-sb-css", id4), style.textContent = ".sb-zhwxuG-absoluteBar{align-items:center;transition:transform .2s linear;display:flex;position:absolute;top:0;left:0;right:0}.sb-zhwxuG-wrapper{align-items:center;gap:4px;display:flex}.sb-zhwxuG-iconPlaceholder{background-color:var(--sb-app-border-color);border-radius:2px;width:14px;height:14px;margin:0 7px;animation:1.5s ease-in-out infinite sb-zhwxuG-glow}@keyframes sb-zhwxuG-glow{0%,to{opacity:1}50%{opacity:.4}}", document.head.appendChild(style);
|
|
313
|
+
}
|
|
314
|
+
var Toolbar_default = { wrapper: "sb-zhwxuG-wrapper", glow: "sb-zhwxuG-glow", absoluteBar: "sb-zhwxuG-absoluteBar", iconPlaceholder: "sb-zhwxuG-iconPlaceholder" };
|
|
315
|
+
|
|
316
|
+
// src/addon-docs/blocks/components/Toolbar.tsx
|
|
317
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
318
|
+
var TRAILING_INSET = 10, Toolbar = ({
|
|
319
|
+
isLoading,
|
|
320
|
+
storyId,
|
|
321
|
+
zoom,
|
|
322
|
+
resetZoom,
|
|
323
|
+
onReloadStory,
|
|
324
|
+
className,
|
|
325
|
+
...rest
|
|
326
|
+
}) => jsxs3(
|
|
327
|
+
SharedToolbar,
|
|
328
|
+
{
|
|
329
|
+
className: clsx(Toolbar_default.absoluteBar, className),
|
|
330
|
+
innerStyle: {
|
|
331
|
+
gap: 4,
|
|
332
|
+
paddingInline: 7,
|
|
333
|
+
paddingInlineEnd: TRAILING_INSET - 1,
|
|
334
|
+
justifyContent: "space-between"
|
|
335
|
+
},
|
|
336
|
+
lang: "en",
|
|
337
|
+
...rest,
|
|
338
|
+
children: [
|
|
339
|
+
jsx7("div", { className: Toolbar_default.wrapper, children: isLoading ? [1, 2, 3].map((key) => jsx7("div", { className: Toolbar_default.iconPlaceholder }, key)) : jsxs3(Fragment2, { children: [
|
|
340
|
+
onReloadStory && jsx7(
|
|
341
|
+
Button,
|
|
342
|
+
{
|
|
343
|
+
padding: "small",
|
|
344
|
+
variant: "ghost",
|
|
345
|
+
onClick: onReloadStory,
|
|
346
|
+
ariaLabel: "Reload story",
|
|
347
|
+
children: jsx7(SyncIcon, {})
|
|
348
|
+
},
|
|
349
|
+
"reload"
|
|
350
|
+
),
|
|
351
|
+
jsx7(
|
|
352
|
+
Button,
|
|
353
|
+
{
|
|
354
|
+
padding: "small",
|
|
355
|
+
variant: "ghost",
|
|
356
|
+
onClick: (e) => {
|
|
357
|
+
e.preventDefault(), zoom(0.8);
|
|
358
|
+
},
|
|
359
|
+
ariaLabel: "Zoom in",
|
|
360
|
+
children: jsx7(ZoomIcon, {})
|
|
361
|
+
},
|
|
362
|
+
"zoomin"
|
|
363
|
+
),
|
|
364
|
+
jsx7(
|
|
365
|
+
Button,
|
|
366
|
+
{
|
|
367
|
+
padding: "small",
|
|
368
|
+
variant: "ghost",
|
|
369
|
+
onClick: (e) => {
|
|
370
|
+
e.preventDefault(), zoom(1.25);
|
|
371
|
+
},
|
|
372
|
+
ariaLabel: "Zoom out",
|
|
373
|
+
children: jsx7(ZoomOutIcon, {})
|
|
374
|
+
},
|
|
375
|
+
"zoomout"
|
|
376
|
+
),
|
|
377
|
+
jsx7(
|
|
378
|
+
Button,
|
|
379
|
+
{
|
|
380
|
+
padding: "small",
|
|
381
|
+
variant: "ghost",
|
|
382
|
+
onClick: (e) => {
|
|
383
|
+
e.preventDefault(), resetZoom();
|
|
384
|
+
},
|
|
385
|
+
ariaLabel: "Reset zoom",
|
|
386
|
+
children: jsx7(ZoomResetIcon, {})
|
|
387
|
+
},
|
|
388
|
+
"zoomreset"
|
|
389
|
+
)
|
|
390
|
+
] }) }, "left"),
|
|
391
|
+
isLoading ? jsx7("div", { className: Toolbar_default.wrapper, children: jsx7("div", { className: Toolbar_default.iconPlaceholder }) }, "right") : storyId && jsx7("div", { className: Toolbar_default.wrapper, children: jsx7(
|
|
392
|
+
Button,
|
|
393
|
+
{
|
|
394
|
+
asChild: !0,
|
|
395
|
+
padding: "small",
|
|
396
|
+
variant: "ghost",
|
|
397
|
+
ariaLabel: "Open canvas in new tab",
|
|
398
|
+
children: jsx7("a", { href: getStoryHref(storyId), target: "_blank", rel: "noopener noreferrer", children: jsx7(ShareAltIcon, {}) })
|
|
399
|
+
},
|
|
400
|
+
"opener"
|
|
401
|
+
) }, "right")
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/Preview.module.css
|
|
407
|
+
var id5 = "core/src/addon-docs/blocks/components/Preview.module.css";
|
|
408
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id5}"]`)) {
|
|
409
|
+
let style = document.createElement("style");
|
|
410
|
+
style.setAttribute("data-sb-css", id5), style.textContent = ".sb-3lk6NG-childrenContainer{flex-flow:wrap;display:block;position:relative;overflow:auto;& .innerZoomElementWrapper>*{max-width:calc(100% - 20px);display:inline-block}}.sb-3lk6NG-childrenContainer:where([data-flex]){display:flex}.sb-3lk6NG-childrenContainer:where([data-column]){flex-direction:column;& .innerZoomElementWrapper>*{width:calc(100% - 20px);max-width:none;display:block}}.sb-3lk6NG-childrenContainer:where([data-layout=fullscreen]) .innerZoomElementWrapper>*{max-width:100%}.sb-3lk6NG-childrenContainer:where([data-layout=fullscreen][data-column]) .innerZoomElementWrapper>*{width:100%;max-width:none}.sb-3lk6NG-childrenContainer:where([data-layout=padded],[data-layout=centered]){padding:0;& .innerZoomElementWrapper>*{width:auto;border:8px solid #0000!important}}.sb-3lk6NG-childrenContainer:where([data-layout=padded][data-inline],[data-layout=centered][data-inline]){padding:32px 22px}.sb-3lk6NG-childrenContainer:where([data-layout=centered][data-inline]){place-content:center;place-items:center;display:flex}.sb-3lk6NG-childrenContainer:where([data-columns]) .innerZoomElementWrapper>*{min-width:calc(100% / var(--preview-columns) - 20px)}.sb-3lk6NG-actionBar{margin-top:-40px;margin-bottom:40px}.sb-3lk6NG-trailingSnippetWarning{margin-inline:auto 10px}.sb-3lk6NG-previewContainer{--preview-source-background:#000000d9;margin:25px 0 40px;position:relative;overflow:hidden;h3+&{margin-top:16px}}:where([data-sb-theme=dark]) .sb-3lk6NG-previewContainer{--preview-source-background:hsl(from var(--sb-background-content) h s calc(l - 5))}.sb-3lk6NG-previewContainer:where([data-with-toolbar]){padding-top:40px}.sb-3lk6NG-source{border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:var(--sb-app-border-radius);border-bottom-right-radius:var(--sb-app-border-radius);background:var(--preview-source-background);color:var(--sb-color-lightest);border:none;margin:0;& button{background:var(--preview-source-background)}}.sb-3lk6NG-positionedToolbar{height:40px;position:absolute;top:0;left:0;right:0}.sb-3lk6NG-skeleton .docs-story{padding-top:32px;padding-bottom:40px}", document.head.appendChild(style);
|
|
411
|
+
}
|
|
412
|
+
var Preview_default = { previewContainer: "sb-3lk6NG-previewContainer", childrenContainer: "sb-3lk6NG-childrenContainer", trailingSnippetWarning: "sb-3lk6NG-trailingSnippetWarning", source: "sb-3lk6NG-source", positionedToolbar: "sb-3lk6NG-positionedToolbar", actionBar: "sb-3lk6NG-actionBar", skeleton: "sb-3lk6NG-skeleton" };
|
|
413
|
+
|
|
414
|
+
// src/addon-docs/blocks/components/Preview.tsx
|
|
415
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
416
|
+
function getChildProps(children) {
|
|
417
|
+
if (Children.count(children) === 1) {
|
|
418
|
+
let elt = children;
|
|
419
|
+
if (elt.props)
|
|
420
|
+
return elt.props;
|
|
421
|
+
}
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
var COPIED_LABEL_ANIMATION_DURATION = 2e3, Preview = ({
|
|
425
|
+
isLoading,
|
|
426
|
+
isColumn,
|
|
427
|
+
columns,
|
|
428
|
+
children,
|
|
429
|
+
withSource,
|
|
430
|
+
withToolbar = !1,
|
|
431
|
+
isExpanded = !1,
|
|
432
|
+
additionalActions,
|
|
433
|
+
className,
|
|
434
|
+
layout = "padded",
|
|
435
|
+
inline = !1,
|
|
436
|
+
onReloadStory,
|
|
437
|
+
...props
|
|
438
|
+
}) => {
|
|
439
|
+
let [expanded, setExpanded] = useState3(isExpanded), [copied, setCopied] = useState3(null), [scale, setScale] = useState3(1), additionalActionItems = useMemo(
|
|
440
|
+
() => additionalActions ? [...additionalActions] : [],
|
|
441
|
+
[additionalActions]
|
|
442
|
+
), sourceId = useId(), context = useContext2(DocsContext), copyToClipboard = useCallback(async (text) => {
|
|
443
|
+
let { createCopyToClipboardFunction } = await import("@aussieljk/forkbook/internal/components");
|
|
444
|
+
await createCopyToClipboardFunction()(text);
|
|
445
|
+
}, []), handleCopyCode = useCallback(async () => {
|
|
446
|
+
try {
|
|
447
|
+
await copyToClipboard(withSource?.code ?? ""), setCopied("Copied!");
|
|
448
|
+
} catch (err) {
|
|
449
|
+
logger.error(err), setCopied("Copy error!");
|
|
450
|
+
}
|
|
451
|
+
globalThis.window.setTimeout(() => setCopied(null), COPIED_LABEL_ANIMATION_DURATION);
|
|
452
|
+
}, [copyToClipboard, withSource?.code]), childProps = getChildProps(children), { warning: sourceWarning, ...sourceProps } = withSource ?? {}, hasSourceError = !!(withSource && withSource.error), hasValidSource = !!(withSource && !withSource.error), showsColumn = isColumn || !Array.isArray(children);
|
|
453
|
+
return jsxs4(Fragment3, { children: [
|
|
454
|
+
jsxs4(
|
|
455
|
+
"div",
|
|
456
|
+
{
|
|
457
|
+
...props,
|
|
458
|
+
"data-with-toolbar": withToolbar || void 0,
|
|
459
|
+
className: clsx(
|
|
460
|
+
blockBackground,
|
|
461
|
+
Preview_default.previewContainer,
|
|
462
|
+
className,
|
|
463
|
+
"sbdocs sbdocs-preview sb-unstyled"
|
|
464
|
+
),
|
|
465
|
+
children: [
|
|
466
|
+
withToolbar && jsx8(
|
|
467
|
+
Toolbar,
|
|
468
|
+
{
|
|
469
|
+
className: Preview_default.positionedToolbar,
|
|
470
|
+
isLoading,
|
|
471
|
+
border: !0,
|
|
472
|
+
zoom: (z) => setScale(scale * z),
|
|
473
|
+
resetZoom: () => setScale(1),
|
|
474
|
+
storyId: !isLoading && childProps ? getStoryId(childProps, context) : void 0,
|
|
475
|
+
onReloadStory
|
|
476
|
+
}
|
|
477
|
+
),
|
|
478
|
+
jsx8(ZoomContext.Provider, { value: { scale }, children: jsx8(
|
|
479
|
+
"div",
|
|
480
|
+
{
|
|
481
|
+
className: clsx(Preview_default.childrenContainer, "docs-story"),
|
|
482
|
+
"data-column": showsColumn || void 0,
|
|
483
|
+
"data-flex": !showsColumn && !!columns || void 0,
|
|
484
|
+
"data-layout": layout,
|
|
485
|
+
"data-inline": inline || void 0,
|
|
486
|
+
"data-columns": columns && columns > 1 || void 0,
|
|
487
|
+
style: columns && columns > 1 ? { "--preview-columns": columns } : void 0,
|
|
488
|
+
children: jsx8(Zoom.Element, { centered: layout === "centered", scale: inline ? scale : 1, children: Array.isArray(children) ? children.map((child, i) => jsx8("div", { children: child }, i)) : jsx8("div", { children }) })
|
|
489
|
+
}
|
|
490
|
+
) }),
|
|
491
|
+
hasValidSource && expanded && jsx8("div", { id: sourceId, children: jsx8(Source, { ...sourceProps, className: Preview_default.source, dark: !0, copyable: !1 }) })
|
|
492
|
+
]
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
(withSource || additionalActionItems.length > 0) && jsxs4(
|
|
496
|
+
Bar,
|
|
497
|
+
{
|
|
498
|
+
className: clsx(Preview_default.actionBar, "sbdocs sbdocs-preview-actions"),
|
|
499
|
+
innerStyle: { paddingInline: 0 },
|
|
500
|
+
children: [
|
|
501
|
+
hasSourceError && jsxs4(
|
|
502
|
+
Button2,
|
|
503
|
+
{
|
|
504
|
+
lang: "en",
|
|
505
|
+
ariaLabel: !1,
|
|
506
|
+
disabled: !0,
|
|
507
|
+
variant: "ghost",
|
|
508
|
+
className: "docblock-code-toggle docblock-code-toggle--disabled",
|
|
509
|
+
children: [
|
|
510
|
+
jsx8(MarkupIcon, {}),
|
|
511
|
+
" No code available"
|
|
512
|
+
]
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
hasValidSource && jsxs4(Fragment3, { children: [
|
|
516
|
+
jsxs4(
|
|
517
|
+
ToggleButton,
|
|
518
|
+
{
|
|
519
|
+
lang: "en",
|
|
520
|
+
ariaLabel: !1,
|
|
521
|
+
pressed: expanded,
|
|
522
|
+
"aria-expanded": expanded,
|
|
523
|
+
"aria-controls": sourceId,
|
|
524
|
+
onClick: () => setExpanded(!expanded),
|
|
525
|
+
variant: "ghost",
|
|
526
|
+
className: `docblock-code-toggle${expanded ? " docblock-code-toggle--expanded" : ""}`,
|
|
527
|
+
children: [
|
|
528
|
+
jsx8(MarkupIcon, {}),
|
|
529
|
+
" ",
|
|
530
|
+
expanded ? "Hide code" : "Show code"
|
|
531
|
+
]
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
jsxs4(Button2, { lang: "en", ariaLabel: !1, variant: "ghost", onClick: handleCopyCode, children: [
|
|
535
|
+
jsx8(CopyIcon, {}),
|
|
536
|
+
" ",
|
|
537
|
+
copied ?? "Copy code"
|
|
538
|
+
] })
|
|
539
|
+
] }),
|
|
540
|
+
additionalActionItems.map(
|
|
541
|
+
({ title, ariaLabel, className: className2, onClick, disabled }, index) => jsx8(
|
|
542
|
+
Button2,
|
|
543
|
+
{
|
|
544
|
+
ariaLabel: ariaLabel ?? !1,
|
|
545
|
+
className: className2,
|
|
546
|
+
onClick,
|
|
547
|
+
disabled: !!disabled,
|
|
548
|
+
variant: "ghost",
|
|
549
|
+
children: title
|
|
550
|
+
},
|
|
551
|
+
index
|
|
552
|
+
)
|
|
553
|
+
),
|
|
554
|
+
hasValidSource && jsx8(SnippetWarning, { className: Preview_default.trailingSnippetWarning, warning: sourceWarning })
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
] });
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
// src/addon-docs/blocks/components/ArgsTable/TabbedArgsTable.tsx
|
|
562
|
+
import { TabsView } from "@aussieljk/forkbook/internal/components";
|
|
563
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
564
|
+
var TabbedArgsTable = ({ tabs, ...props }) => {
|
|
565
|
+
let entries = Object.entries(tabs);
|
|
566
|
+
if (entries.length === 1)
|
|
567
|
+
return jsx9(ArgsTable, { ...entries[0][1], ...props });
|
|
568
|
+
let tabsFromEntries = entries.map(([label, table], index) => {
|
|
569
|
+
let argsTableProps = index === 0 ? props : { sort: props.sort, docsLang: props.docsLang };
|
|
570
|
+
return {
|
|
571
|
+
id: `prop_table_div_${label}`,
|
|
572
|
+
title: label,
|
|
573
|
+
children: jsx9(ArgsTable, { inTabPanel: !0, ...table, ...argsTableProps })
|
|
574
|
+
};
|
|
575
|
+
});
|
|
576
|
+
return jsx9(TabsView, { tabs: tabsFromEntries, style: { height: "fit-content" } });
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
// src/addon-docs/blocks/components/Typeset.tsx
|
|
580
|
+
import { withReset as withReset3 } from "@aussieljk/forkbook/internal/components";
|
|
581
|
+
|
|
582
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/Typeset.module.css
|
|
583
|
+
var id6 = "core/src/addon-docs/blocks/components/Typeset.module.css";
|
|
584
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id6}"]`)) {
|
|
585
|
+
let style = document.createElement("style");
|
|
586
|
+
style.setAttribute("data-sb-css", id6), style.textContent = ".sb-JrHkka-label{font-size:var(--sb-size-s1);color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .4));margin-right:30px}:where([data-sb-theme=dark]) .sb-JrHkka-label{color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .6))}.sb-JrHkka-sample{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.sb-JrHkka-typeSpecimen{flex-direction:row;align-items:baseline;display:flex;&:not(:last-child){margin-bottom:1rem}}.sb-JrHkka-wrapper{margin:25px 0 40px;padding:30px 20px}", document.head.appendChild(style);
|
|
587
|
+
}
|
|
588
|
+
var Typeset_default = { label: "sb-JrHkka-label", wrapper: "sb-JrHkka-wrapper", sample: "sb-JrHkka-sample", typeSpecimen: "sb-JrHkka-typeSpecimen" };
|
|
589
|
+
|
|
590
|
+
// src/addon-docs/blocks/components/Typeset.tsx
|
|
591
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
592
|
+
var Typeset = ({
|
|
593
|
+
fontFamily,
|
|
594
|
+
fontSizes,
|
|
595
|
+
fontWeight,
|
|
596
|
+
sampleText,
|
|
597
|
+
...props
|
|
598
|
+
}) => jsx10(
|
|
599
|
+
"div",
|
|
600
|
+
{
|
|
601
|
+
...props,
|
|
602
|
+
className: clsx(withReset3, blockBackground, Typeset_default.wrapper, "docblock-typeset sb-unstyled"),
|
|
603
|
+
children: fontSizes.map((size) => jsxs5("div", { className: Typeset_default.typeSpecimen, children: [
|
|
604
|
+
jsx10("div", { className: Typeset_default.label, children: size }),
|
|
605
|
+
jsx10(
|
|
606
|
+
"div",
|
|
607
|
+
{
|
|
608
|
+
className: Typeset_default.sample,
|
|
609
|
+
style: {
|
|
610
|
+
fontFamily,
|
|
611
|
+
fontSize: size,
|
|
612
|
+
fontWeight,
|
|
613
|
+
lineHeight: 1.2
|
|
614
|
+
},
|
|
615
|
+
children: sampleText || "Was he a beast if music could move him so?"
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
] }, size))
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
|
|
622
|
+
// src/addon-docs/blocks/components/ColorPalette.tsx
|
|
623
|
+
import { ResetWrapper } from "@aussieljk/forkbook/internal/components";
|
|
624
|
+
|
|
625
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/ColorPalette.module.css
|
|
626
|
+
var id7 = "core/src/addon-docs/blocks/components/ColorPalette.module.css";
|
|
627
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id7}"]`)) {
|
|
628
|
+
let style = document.createElement("style");
|
|
629
|
+
style.setAttribute("data-sb-css", id7), style.textContent = '.sb-yLo5nG-itemTitle{font-weight:var(--sb-weight-bold);color:var(--sb-color-default-text)}.sb-yLo5nG-itemSubtitle{color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .3))}.sb-yLo5nG-itemDescription{flex:0 0 30%;margin-top:5px;line-height:20px}.sb-yLo5nG-swatchLabel{text-align:center;font-family:var(--sb-font-mono);font-size:var(--sb-size-s1);color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .3));flex:1;line-height:1;overflow:hidden;&>div{text-overflow:ellipsis;max-width:100%;display:inline-block;overflow:hidden}& span{margin-top:2px;display:block}}.sb-yLo5nG-swatchLabels{flex-direction:row;display:flex}.sb-yLo5nG-swatch{flex:1;position:relative;&:before{background:var(--swatch-background);content:"";width:100%;height:100%;position:absolute;top:0;left:0}}.sb-yLo5nG-swatchColors{background-color:#fff;background-image:repeating-linear-gradient(-45deg,#ccc,#ccc 1px,#fff 1px 16px);background-clip:padding-box;flex-direction:row;height:50px;margin-bottom:5px;display:flex;overflow:hidden}.sb-yLo5nG-swatchSpecimen{flex-direction:column;flex:1;margin-bottom:30px;display:flex;position:relative}.sb-yLo5nG-swatches{flex-direction:row;flex:1;display:flex}.sb-yLo5nG-item{align-items:flex-start;display:flex}.sb-yLo5nG-listName{flex:0 0 30%}.sb-yLo5nG-listSwatches{flex:1}.sb-yLo5nG-listHeading{font-weight:var(--sb-weight-bold);color:rgb(from var(--sb-color-default-text) r g b / calc(alpha - .3));flex-direction:row;align-items:center;padding-bottom:20px;display:flex}.sb-yLo5nG-list{font-size:var(--sb-size-s2);flex-direction:column;line-height:20px;display:flex}', document.head.appendChild(style);
|
|
630
|
+
}
|
|
631
|
+
var ColorPalette_default = { swatchColors: "sb-yLo5nG-swatchColors", swatches: "sb-yLo5nG-swatches", item: "sb-yLo5nG-item", listHeading: "sb-yLo5nG-listHeading", swatchLabels: "sb-yLo5nG-swatchLabels", swatch: "sb-yLo5nG-swatch", itemSubtitle: "sb-yLo5nG-itemSubtitle", swatchLabel: "sb-yLo5nG-swatchLabel", listName: "sb-yLo5nG-listName", itemTitle: "sb-yLo5nG-itemTitle", listSwatches: "sb-yLo5nG-listSwatches", itemDescription: "sb-yLo5nG-itemDescription", swatchSpecimen: "sb-yLo5nG-swatchSpecimen", list: "sb-yLo5nG-list" };
|
|
632
|
+
|
|
633
|
+
// src/addon-docs/blocks/components/ColorPalette.tsx
|
|
634
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
635
|
+
function renderSwatch(color, index) {
|
|
636
|
+
return jsx11(
|
|
637
|
+
"div",
|
|
638
|
+
{
|
|
639
|
+
className: ColorPalette_default.swatch,
|
|
640
|
+
title: color,
|
|
641
|
+
style: { "--swatch-background": color }
|
|
642
|
+
},
|
|
643
|
+
`${color}-${index}`
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
function renderSwatchLabel(color, index, colorDescription) {
|
|
647
|
+
return jsx11("div", { className: ColorPalette_default.swatchLabel, title: color, children: jsxs6("div", { children: [
|
|
648
|
+
color,
|
|
649
|
+
colorDescription && jsx11("span", { children: colorDescription })
|
|
650
|
+
] }) }, `${color}-${index}`);
|
|
651
|
+
}
|
|
652
|
+
function renderSwatchSpecimen(colors) {
|
|
653
|
+
if (Array.isArray(colors))
|
|
654
|
+
return jsxs6("div", { className: ColorPalette_default.swatchSpecimen, children: [
|
|
655
|
+
jsx11("div", { className: clsx(blockBackground, ColorPalette_default.swatchColors), children: colors.map((color, index) => renderSwatch(color, index)) }),
|
|
656
|
+
jsx11("div", { className: ColorPalette_default.swatchLabels, children: colors.map((color, index) => renderSwatchLabel(color, index)) })
|
|
657
|
+
] });
|
|
658
|
+
let swatchElements = [], labelElements = [];
|
|
659
|
+
for (let colorKey in colors) {
|
|
660
|
+
let colorValue = colors[colorKey];
|
|
661
|
+
swatchElements.push(renderSwatch(colorValue, swatchElements.length)), labelElements.push(renderSwatchLabel(colorKey, labelElements.length, colorValue));
|
|
662
|
+
}
|
|
663
|
+
return jsxs6("div", { className: ColorPalette_default.swatchSpecimen, children: [
|
|
664
|
+
jsx11("div", { className: clsx(blockBackground, ColorPalette_default.swatchColors), children: swatchElements }),
|
|
665
|
+
jsx11("div", { className: ColorPalette_default.swatchLabels, children: labelElements })
|
|
666
|
+
] });
|
|
667
|
+
}
|
|
668
|
+
var ColorItem = ({ title, subtitle, colors }) => jsxs6("div", { className: ColorPalette_default.item, children: [
|
|
669
|
+
jsxs6("div", { className: ColorPalette_default.itemDescription, children: [
|
|
670
|
+
jsx11("div", { className: ColorPalette_default.itemTitle, children: title }),
|
|
671
|
+
jsx11("div", { className: ColorPalette_default.itemSubtitle, children: subtitle })
|
|
672
|
+
] }),
|
|
673
|
+
jsx11("div", { className: ColorPalette_default.swatches, children: renderSwatchSpecimen(colors) })
|
|
674
|
+
] }), ColorPalette = ({ children, ...props }) => jsx11(ResetWrapper, { children: jsxs6("div", { ...props, className: clsx(ColorPalette_default.list, "docblock-colorpalette sb-unstyled"), children: [
|
|
675
|
+
jsxs6("div", { className: ColorPalette_default.listHeading, children: [
|
|
676
|
+
jsx11("div", { className: ColorPalette_default.listName, children: "Name" }),
|
|
677
|
+
jsx11("div", { className: ColorPalette_default.listSwatches, children: "Swatches" })
|
|
678
|
+
] }),
|
|
679
|
+
children
|
|
680
|
+
] }) });
|
|
681
|
+
|
|
682
|
+
// src/addon-docs/blocks/components/IconGallery.tsx
|
|
683
|
+
import { ResetWrapper as ResetWrapper2 } from "@aussieljk/forkbook/internal/components";
|
|
684
|
+
|
|
685
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/IconGallery.module.css
|
|
686
|
+
var id8 = "core/src/addon-docs/blocks/components/IconGallery.module.css";
|
|
687
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id8}"]`)) {
|
|
688
|
+
let style = document.createElement("style");
|
|
689
|
+
style.setAttribute("data-sb-css", id8), style.textContent = ".sb-P_cJ1a-itemLabel{font-family:var(--sb-font-base);font-size:var(--sb-size-s1);color:var(--sb-color-default-text);word-break:break-word;text-overflow:ellipsis;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-left:10px;line-height:1.2;display:-webkit-box;overflow:hidden}.sb-P_cJ1a-itemSpecimen{flex:none;justify-content:center;align-items:center;width:40px;height:40px;display:flex;overflow:hidden;&>img,&>svg{width:20px;height:20px}}.sb-P_cJ1a-item{flex-direction:row;align-items:center;width:100%;display:inline-flex}.sb-P_cJ1a-list{grid-gap:8px 16px;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));grid-auto-rows:50px;grid-auto-flow:dense;display:grid}", document.head.appendChild(style);
|
|
690
|
+
}
|
|
691
|
+
var IconGallery_default = { itemLabel: "sb-P_cJ1a-itemLabel", item: "sb-P_cJ1a-item", itemSpecimen: "sb-P_cJ1a-itemSpecimen", list: "sb-P_cJ1a-list" };
|
|
692
|
+
|
|
693
|
+
// src/addon-docs/blocks/components/IconGallery.tsx
|
|
694
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
695
|
+
var IconItem = ({ name, children }) => jsxs7("div", { className: IconGallery_default.item, children: [
|
|
696
|
+
jsx12("div", { className: clsx(blockBackground, IconGallery_default.itemSpecimen), children }),
|
|
697
|
+
jsx12("div", { className: IconGallery_default.itemLabel, children: name })
|
|
698
|
+
] }), IconGallery = ({ children, ...props }) => jsx12(ResetWrapper2, { children: jsx12("div", { ...props, className: clsx(IconGallery_default.list, "docblock-icongallery sb-unstyled"), children }) });
|
|
699
|
+
|
|
700
|
+
// src/addon-docs/blocks/components/TableOfContents.tsx
|
|
701
|
+
import { useEffect as useEffect3 } from "react";
|
|
702
|
+
import { NAVIGATE_URL } from "@aussieljk/forkbook/internal/core-events";
|
|
703
|
+
|
|
704
|
+
// ../../node_modules/tocbot/src/js/build-html.js
|
|
705
|
+
function build_html_default(options) {
|
|
706
|
+
let forEach = [].forEach, some = [].some, body = typeof window < "u" && document.body, SPACE_CHAR = " ", tocElement, currentlyHighlighting = !0, eventCount = 0;
|
|
707
|
+
function createEl(d, container) {
|
|
708
|
+
let link = container.appendChild(createLink(d));
|
|
709
|
+
if (d.children.length) {
|
|
710
|
+
let list = createList(d.isCollapsed);
|
|
711
|
+
d.children.forEach((child) => {
|
|
712
|
+
createEl(child, list);
|
|
713
|
+
}), link.appendChild(list);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
function render(parent, data) {
|
|
717
|
+
let container = createList(!1);
|
|
718
|
+
if (data.forEach((d) => {
|
|
719
|
+
createEl(d, container);
|
|
720
|
+
}), tocElement = parent || tocElement, tocElement !== null)
|
|
721
|
+
return tocElement.firstChild && tocElement.removeChild(tocElement.firstChild), data.length === 0 ? tocElement : tocElement.appendChild(container);
|
|
722
|
+
}
|
|
723
|
+
function createLink(data) {
|
|
724
|
+
let item = document.createElement("li"), a = document.createElement("a");
|
|
725
|
+
return options.listItemClass && item.setAttribute("class", options.listItemClass), options.onClick && (a.onclick = options.onClick), options.includeTitleTags && a.setAttribute("title", data.textContent), options.includeHtml && data.childNodes.length ? forEach.call(data.childNodes, (node) => {
|
|
726
|
+
a.appendChild(node.cloneNode(!0));
|
|
727
|
+
}) : a.textContent = data.textContent, a.setAttribute("href", `${options.basePath}#${data.id}`), a.setAttribute(
|
|
728
|
+
"class",
|
|
729
|
+
`${options.linkClass + SPACE_CHAR}node-name--${data.nodeName}${SPACE_CHAR}${options.extraLinkClasses}`
|
|
730
|
+
), item.appendChild(a), item;
|
|
731
|
+
}
|
|
732
|
+
function createList(isCollapsed) {
|
|
733
|
+
let listElement = options.orderedList ? "ol" : "ul", list = document.createElement(listElement), classes = options.listClass + SPACE_CHAR + options.extraListClasses;
|
|
734
|
+
return isCollapsed && (classes = classes + SPACE_CHAR + options.collapsibleClass, classes = classes + SPACE_CHAR + options.isCollapsedClass), list.setAttribute("class", classes), list;
|
|
735
|
+
}
|
|
736
|
+
function updateFixedSidebarClass() {
|
|
737
|
+
let scrollTop = getScrollTop(), posFixedEl = document.querySelector(options.positionFixedSelector);
|
|
738
|
+
options.fixedSidebarOffset === "auto" && (options.fixedSidebarOffset = tocElement.offsetTop), scrollTop > options.fixedSidebarOffset ? posFixedEl.className.indexOf(options.positionFixedClass) === -1 && (posFixedEl.className += SPACE_CHAR + options.positionFixedClass) : posFixedEl.className = posFixedEl.className.replace(
|
|
739
|
+
SPACE_CHAR + options.positionFixedClass,
|
|
740
|
+
""
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
function getHeadingTopPos(obj) {
|
|
744
|
+
let position = 0;
|
|
745
|
+
return obj !== null && (position = obj.offsetTop, options.hasInnerContainers && (position += getHeadingTopPos(obj.offsetParent))), position;
|
|
746
|
+
}
|
|
747
|
+
function updateClassname(obj, className) {
|
|
748
|
+
return obj && obj.className !== className && (obj.className = className), obj;
|
|
749
|
+
}
|
|
750
|
+
function updateToc(headingsArray, event) {
|
|
751
|
+
options.positionFixedSelector && updateFixedSidebarClass();
|
|
752
|
+
let headings = headingsArray, clickedHref = event?.target?.getAttribute ? event?.target?.getAttribute("href") : null, isBottomMode = clickedHref && clickedHref.charAt(0) === "#" ? getIsHeaderBottomMode(clickedHref.replace("#", "")) : !1, shouldUpdate = currentlyHighlighting || isBottomMode;
|
|
753
|
+
if (event && eventCount < 5 && eventCount++, shouldUpdate && tocElement && headings.length > 0) {
|
|
754
|
+
let topHeader = getTopHeader(headings), oldActiveTocLink = tocElement.querySelector(
|
|
755
|
+
`.${options.activeLinkClass}`
|
|
756
|
+
), topHeaderId = topHeader.id.replace(
|
|
757
|
+
/([ #;&,.+*~':"!^$[\]()=>|/\\@])/g,
|
|
758
|
+
"\\$1"
|
|
759
|
+
), hashId = window.location.hash.replace("#", ""), activeId = topHeaderId, isPageBottomMode = getIsPageBottomMode();
|
|
760
|
+
clickedHref && isBottomMode ? activeId = clickedHref.replace("#", "") : hashId && hashId !== topHeaderId && isPageBottomMode && (getIsHeaderBottomMode(topHeaderId) || eventCount <= 2) && (activeId = hashId);
|
|
761
|
+
let activeTocLink = tocElement.querySelector(
|
|
762
|
+
`.${options.linkClass}[href="${options.basePath}#${activeId}"]`
|
|
763
|
+
);
|
|
764
|
+
if (oldActiveTocLink === activeTocLink)
|
|
765
|
+
return;
|
|
766
|
+
let tocLinks = tocElement.querySelectorAll(`.${options.linkClass}`);
|
|
767
|
+
forEach.call(tocLinks, (tocLink) => {
|
|
768
|
+
updateClassname(
|
|
769
|
+
tocLink,
|
|
770
|
+
tocLink.className.replace(SPACE_CHAR + options.activeLinkClass, "")
|
|
771
|
+
);
|
|
772
|
+
});
|
|
773
|
+
let tocLis = tocElement.querySelectorAll(`.${options.listItemClass}`);
|
|
774
|
+
forEach.call(tocLis, (tocLi) => {
|
|
775
|
+
updateClassname(
|
|
776
|
+
tocLi,
|
|
777
|
+
tocLi.className.replace(SPACE_CHAR + options.activeListItemClass, "")
|
|
778
|
+
);
|
|
779
|
+
}), activeTocLink && activeTocLink.className.indexOf(options.activeLinkClass) === -1 && (activeTocLink.className += SPACE_CHAR + options.activeLinkClass);
|
|
780
|
+
let li = activeTocLink?.parentNode;
|
|
781
|
+
li && li.className.indexOf(options.activeListItemClass) === -1 && (li.className += SPACE_CHAR + options.activeListItemClass);
|
|
782
|
+
let tocLists = tocElement.querySelectorAll(
|
|
783
|
+
`.${options.listClass}.${options.collapsibleClass}`
|
|
784
|
+
);
|
|
785
|
+
forEach.call(tocLists, (list) => {
|
|
786
|
+
list.className.indexOf(options.isCollapsedClass) === -1 && (list.className += SPACE_CHAR + options.isCollapsedClass);
|
|
787
|
+
}), activeTocLink?.nextSibling && activeTocLink.nextSibling.className.indexOf(
|
|
788
|
+
options.isCollapsedClass
|
|
789
|
+
) !== -1 && updateClassname(
|
|
790
|
+
activeTocLink.nextSibling,
|
|
791
|
+
activeTocLink.nextSibling.className.replace(
|
|
792
|
+
SPACE_CHAR + options.isCollapsedClass,
|
|
793
|
+
""
|
|
794
|
+
)
|
|
795
|
+
), removeCollapsedFromParents(activeTocLink?.parentNode.parentNode);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
function removeCollapsedFromParents(element) {
|
|
799
|
+
return element && element.className.indexOf(options.collapsibleClass) !== -1 && element.className.indexOf(options.isCollapsedClass) !== -1 ? (updateClassname(
|
|
800
|
+
element,
|
|
801
|
+
element.className.replace(SPACE_CHAR + options.isCollapsedClass, "")
|
|
802
|
+
), removeCollapsedFromParents(element.parentNode.parentNode)) : element;
|
|
803
|
+
}
|
|
804
|
+
function disableTocAnimation(event) {
|
|
805
|
+
let target = event.target || event.srcElement;
|
|
806
|
+
typeof target.className != "string" || target.className.indexOf(options.linkClass) === -1 || (currentlyHighlighting = !1);
|
|
807
|
+
}
|
|
808
|
+
function enableTocAnimation() {
|
|
809
|
+
currentlyHighlighting = !0;
|
|
810
|
+
}
|
|
811
|
+
function getCurrentlyHighlighting() {
|
|
812
|
+
return currentlyHighlighting;
|
|
813
|
+
}
|
|
814
|
+
function getIsHeaderBottomMode(headerId) {
|
|
815
|
+
let scrollEl = getScrollEl(), activeHeading = document?.getElementById(headerId);
|
|
816
|
+
return activeHeading && activeHeading.offsetTop > scrollEl.offsetHeight - scrollEl.clientHeight * 1.4 - options.bottomModeThreshold;
|
|
817
|
+
}
|
|
818
|
+
function getIsPageBottomMode() {
|
|
819
|
+
let scrollEl = getScrollEl(), isScrollable = scrollEl.scrollHeight > scrollEl.clientHeight, isBottomMode = getScrollTop() + scrollEl.clientHeight > scrollEl.offsetHeight - options.bottomModeThreshold;
|
|
820
|
+
return isScrollable && isBottomMode;
|
|
821
|
+
}
|
|
822
|
+
function getScrollEl() {
|
|
823
|
+
let el;
|
|
824
|
+
return options.scrollContainer && document.querySelector(options.scrollContainer) ? el = document.querySelector(options.scrollContainer) : el = document.documentElement || body, el;
|
|
825
|
+
}
|
|
826
|
+
function getScrollTop() {
|
|
827
|
+
return getScrollEl()?.scrollTop || 0;
|
|
828
|
+
}
|
|
829
|
+
function getTopHeader(headings, scrollTop = getScrollTop()) {
|
|
830
|
+
let topHeader;
|
|
831
|
+
return some.call(headings, (heading, i) => {
|
|
832
|
+
if (getHeadingTopPos(heading) > scrollTop + options.headingsOffset + 10) {
|
|
833
|
+
let index = i === 0 ? i : i - 1;
|
|
834
|
+
return topHeader = headings[index], !0;
|
|
835
|
+
}
|
|
836
|
+
if (i === headings.length - 1)
|
|
837
|
+
return topHeader = headings[headings.length - 1], !0;
|
|
838
|
+
}), topHeader;
|
|
839
|
+
}
|
|
840
|
+
function updateUrlHashForHeader(headingsArray) {
|
|
841
|
+
let scrollTop = getScrollTop(), topHeader = getTopHeader(headingsArray, scrollTop), isPageBottomMode = getIsPageBottomMode();
|
|
842
|
+
if ((!topHeader || scrollTop < 5) && !isPageBottomMode)
|
|
843
|
+
window.location.hash === "#" || window.location.hash === "" || window.history.pushState(null, null, "#");
|
|
844
|
+
else if (topHeader && !isPageBottomMode) {
|
|
845
|
+
let newHash = `#${topHeader.id}`;
|
|
846
|
+
window.location.hash !== newHash && window.history.pushState(null, null, newHash);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return {
|
|
850
|
+
enableTocAnimation,
|
|
851
|
+
disableTocAnimation,
|
|
852
|
+
render,
|
|
853
|
+
updateToc,
|
|
854
|
+
getCurrentlyHighlighting,
|
|
855
|
+
getTopHeader,
|
|
856
|
+
getScrollTop,
|
|
857
|
+
updateUrlHashForHeader
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// ../../node_modules/tocbot/src/js/default-options.js
|
|
862
|
+
var default_options_default = {
|
|
863
|
+
// Where to render the table of contents.
|
|
864
|
+
tocSelector: ".js-toc",
|
|
865
|
+
// Or, you can pass in a DOM node instead
|
|
866
|
+
tocElement: null,
|
|
867
|
+
// Where to grab the headings to build the table of contents.
|
|
868
|
+
contentSelector: ".js-toc-content",
|
|
869
|
+
// Or, you can pass in a DOM node instead
|
|
870
|
+
contentElement: null,
|
|
871
|
+
// Which headings to grab inside of the contentSelector element.
|
|
872
|
+
headingSelector: "h1, h2, h3",
|
|
873
|
+
// Headings that match the ignoreSelector will be skipped.
|
|
874
|
+
ignoreSelector: ".js-toc-ignore",
|
|
875
|
+
// For headings inside relative or absolute positioned
|
|
876
|
+
// containers within content.
|
|
877
|
+
hasInnerContainers: !1,
|
|
878
|
+
// Main class to add to links.
|
|
879
|
+
linkClass: "toc-link",
|
|
880
|
+
// Extra classes to add to links.
|
|
881
|
+
extraLinkClasses: "",
|
|
882
|
+
// Class to add to active links,
|
|
883
|
+
// the link corresponding to the top most heading on the page.
|
|
884
|
+
activeLinkClass: "is-active-link",
|
|
885
|
+
// Main class to add to lists.
|
|
886
|
+
listClass: "toc-list",
|
|
887
|
+
// Extra classes to add to lists.
|
|
888
|
+
extraListClasses: "",
|
|
889
|
+
// Class that gets added when a list should be collapsed.
|
|
890
|
+
isCollapsedClass: "is-collapsed",
|
|
891
|
+
// Class that gets added when a list should be able
|
|
892
|
+
// to be collapsed but isn't necessarily collapsed.
|
|
893
|
+
collapsibleClass: "is-collapsible",
|
|
894
|
+
// Class to add to list items.
|
|
895
|
+
listItemClass: "toc-list-item",
|
|
896
|
+
// Class to add to active list items.
|
|
897
|
+
activeListItemClass: "is-active-li",
|
|
898
|
+
// How many heading levels should not be collapsed.
|
|
899
|
+
// For example, number 6 will show everything since
|
|
900
|
+
// there are only 6 heading levels and number 0 will collapse them all.
|
|
901
|
+
// The sections that are hidden will open
|
|
902
|
+
// and close as you scroll to headings within them.
|
|
903
|
+
collapseDepth: 0,
|
|
904
|
+
// Smooth scrolling enabled.
|
|
905
|
+
scrollSmooth: !0,
|
|
906
|
+
// Smooth scroll duration.
|
|
907
|
+
scrollSmoothDuration: 420,
|
|
908
|
+
// Smooth scroll offset.
|
|
909
|
+
scrollSmoothOffset: 0,
|
|
910
|
+
// Callback for scroll end.
|
|
911
|
+
scrollEndCallback: function(e) {
|
|
912
|
+
},
|
|
913
|
+
// Headings offset between the headings and the top of
|
|
914
|
+
// the document (this is meant for minor adjustments).
|
|
915
|
+
headingsOffset: 1,
|
|
916
|
+
// Enable the URL hash to update with the proper heading ID as
|
|
917
|
+
// a user scrolls the page.
|
|
918
|
+
enableUrlHashUpdateOnScroll: !1,
|
|
919
|
+
// type of scroll handler to use. to make scroll event not too rapid.
|
|
920
|
+
// Options are: "debounce" or "throttle"
|
|
921
|
+
// when set auto , use debounce less than 333ms , other use throttle.
|
|
922
|
+
// for ios browser can't use history.pushState() more than 100 times per 30 seconds reason
|
|
923
|
+
scrollHandlerType: "auto",
|
|
924
|
+
// scrollHandler delay in ms.
|
|
925
|
+
scrollHandlerTimeout: 50,
|
|
926
|
+
// Timeout between events firing to make sure it's
|
|
927
|
+
// not too rapid (for performance reasons).
|
|
928
|
+
throttleTimeout: 50,
|
|
929
|
+
// Element to add the positionFixedClass to.
|
|
930
|
+
positionFixedSelector: null,
|
|
931
|
+
// Fixed position class to add to make sidebar fixed after scrolling
|
|
932
|
+
// down past the fixedSidebarOffset.
|
|
933
|
+
positionFixedClass: "is-position-fixed",
|
|
934
|
+
// fixedSidebarOffset can be any number but by default is set
|
|
935
|
+
// to auto which sets the fixedSidebarOffset to the sidebar
|
|
936
|
+
// element's offsetTop from the top of the document on init.
|
|
937
|
+
fixedSidebarOffset: "auto",
|
|
938
|
+
// includeHtml can be set to true to include the HTML markup from the
|
|
939
|
+
// heading node instead of just including the innerText.
|
|
940
|
+
includeHtml: !1,
|
|
941
|
+
// includeTitleTags automatically sets the html title tag of the link
|
|
942
|
+
// to match the title. This can be useful for SEO purposes or
|
|
943
|
+
// when truncating titles.
|
|
944
|
+
includeTitleTags: !1,
|
|
945
|
+
// onclick function to apply to all links in toc. will be called with
|
|
946
|
+
// the event as the first parameter, and this can be used to stop,
|
|
947
|
+
// propagation, prevent default or perform action
|
|
948
|
+
onClick: function(e) {
|
|
949
|
+
},
|
|
950
|
+
// orderedList can be set to false to generate unordered lists (ul)
|
|
951
|
+
// instead of ordered lists (ol)
|
|
952
|
+
orderedList: !0,
|
|
953
|
+
// If there is a fixed article scroll container, set to calculate offset.
|
|
954
|
+
scrollContainer: null,
|
|
955
|
+
// prevent ToC DOM rendering if it's already rendered by an external system.
|
|
956
|
+
skipRendering: !1,
|
|
957
|
+
// Optional callback to change heading labels.
|
|
958
|
+
// For example it can be used to cut down and put ellipses on multiline headings you deem too long.
|
|
959
|
+
// Called each time a heading is parsed. Expects a string and returns the modified label to display.
|
|
960
|
+
// Additionally, the attribute `data-heading-label` may be used on a heading to specify
|
|
961
|
+
// a shorter string to be used in the TOC.
|
|
962
|
+
// function (string) => string
|
|
963
|
+
headingLabelCallback: !1,
|
|
964
|
+
// ignore headings that are hidden in DOM
|
|
965
|
+
ignoreHiddenElements: !1,
|
|
966
|
+
// Optional callback to modify properties of parsed headings.
|
|
967
|
+
// The heading element is passed in node parameter and information
|
|
968
|
+
// parsed by default parser is provided in obj parameter.
|
|
969
|
+
// Function has to return the same or modified obj.
|
|
970
|
+
// The heading will be excluded from TOC if nothing is returned.
|
|
971
|
+
// function (object, HTMLElement) => object | void
|
|
972
|
+
headingObjectCallback: null,
|
|
973
|
+
// Set the base path, useful if you use a `base` tag in `head`.
|
|
974
|
+
basePath: "",
|
|
975
|
+
// Only takes affect when `tocSelector` is scrolling,
|
|
976
|
+
// keep the toc scroll position in sync with the content.
|
|
977
|
+
disableTocScrollSync: !1,
|
|
978
|
+
// If this is null then just use `tocElement` or `tocSelector` instead
|
|
979
|
+
// assuming `disableTocScrollSync` is set to false. This allows for
|
|
980
|
+
// scrolling an outer element (like a nav panel w/ search) containing the toc.
|
|
981
|
+
// Please pass an element, not a selector here.
|
|
982
|
+
tocScrollingWrapper: null,
|
|
983
|
+
// Offset for the toc scroll (top) position when scrolling the page.
|
|
984
|
+
// Only effective if `disableTocScrollSync` is false.
|
|
985
|
+
tocScrollOffset: 30,
|
|
986
|
+
// Threshold for when bottom mode should be enabled to handle
|
|
987
|
+
// highlighting links that cannot be scrolled to.
|
|
988
|
+
bottomModeThreshold: 30
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
// ../../node_modules/tocbot/src/js/parse-content.js
|
|
992
|
+
function parseContent(options) {
|
|
993
|
+
let reduce = [].reduce;
|
|
994
|
+
function getLastItem(array) {
|
|
995
|
+
return array[array.length - 1];
|
|
996
|
+
}
|
|
997
|
+
function getHeadingLevel(heading) {
|
|
998
|
+
return +heading.nodeName.toUpperCase().replace("H", "");
|
|
999
|
+
}
|
|
1000
|
+
function isHTMLElement(maybeElement) {
|
|
1001
|
+
try {
|
|
1002
|
+
return maybeElement instanceof window.HTMLElement || maybeElement instanceof window.parent.HTMLElement;
|
|
1003
|
+
} catch {
|
|
1004
|
+
return maybeElement instanceof window.HTMLElement;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
function getHeadingObject(heading) {
|
|
1008
|
+
if (!isHTMLElement(heading)) return heading;
|
|
1009
|
+
if (options.ignoreHiddenElements && (!heading.offsetHeight || !heading.offsetParent))
|
|
1010
|
+
return null;
|
|
1011
|
+
let headingLabel = heading.getAttribute("data-heading-label") || (options.headingLabelCallback ? String(options.headingLabelCallback(heading.innerText)) : (heading.innerText || heading.textContent).trim()), obj = {
|
|
1012
|
+
id: heading.id,
|
|
1013
|
+
children: [],
|
|
1014
|
+
nodeName: heading.nodeName,
|
|
1015
|
+
headingLevel: getHeadingLevel(heading),
|
|
1016
|
+
textContent: headingLabel
|
|
1017
|
+
};
|
|
1018
|
+
return options.includeHtml && (obj.childNodes = heading.childNodes), options.headingObjectCallback ? options.headingObjectCallback(obj, heading) : obj;
|
|
1019
|
+
}
|
|
1020
|
+
function addNode(node, nest) {
|
|
1021
|
+
let obj = getHeadingObject(node), level = obj.headingLevel, array = nest, lastItem = getLastItem(array), lastItemLevel = lastItem ? lastItem.headingLevel : 0, counter = level - lastItemLevel;
|
|
1022
|
+
for (; counter > 0 && (lastItem = getLastItem(array), !(lastItem && level === lastItem.headingLevel)); )
|
|
1023
|
+
lastItem && lastItem.children !== void 0 && (array = lastItem.children), counter--;
|
|
1024
|
+
return level >= options.collapseDepth && (obj.isCollapsed = !0), array.push(obj), array;
|
|
1025
|
+
}
|
|
1026
|
+
function selectHeadings(contentElement, headingSelector) {
|
|
1027
|
+
let selectors = headingSelector;
|
|
1028
|
+
options.ignoreSelector && (selectors = headingSelector.split(",").map(function(selector) {
|
|
1029
|
+
return `${selector.trim()}:not(${options.ignoreSelector})`;
|
|
1030
|
+
}));
|
|
1031
|
+
try {
|
|
1032
|
+
return contentElement.querySelectorAll(selectors);
|
|
1033
|
+
} catch {
|
|
1034
|
+
return console.warn(`Headers not found with selector: ${selectors}`), null;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
function nestHeadingsArray(headingsArray) {
|
|
1038
|
+
return reduce.call(
|
|
1039
|
+
headingsArray,
|
|
1040
|
+
function(prev, curr) {
|
|
1041
|
+
let currentHeading = getHeadingObject(curr);
|
|
1042
|
+
return currentHeading && addNode(currentHeading, prev.nest), prev;
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
nest: []
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
return {
|
|
1050
|
+
nestHeadingsArray,
|
|
1051
|
+
selectHeadings
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// ../../node_modules/tocbot/src/js/scroll-smooth/index.js
|
|
1056
|
+
function initSmoothScrolling(options) {
|
|
1057
|
+
var duration = options.duration, offset = options.offset;
|
|
1058
|
+
if (typeof window > "u" || typeof location > "u") return;
|
|
1059
|
+
var pageUrl = location.hash ? stripHash(location.href) : location.href;
|
|
1060
|
+
delegatedLinkHijacking();
|
|
1061
|
+
function delegatedLinkHijacking() {
|
|
1062
|
+
document.body.addEventListener("click", onClick, !1);
|
|
1063
|
+
function onClick(e) {
|
|
1064
|
+
!isInPageLink(e.target) || e.target.className.indexOf("no-smooth-scroll") > -1 || e.target.href.charAt(e.target.href.length - 2) === "#" && e.target.href.charAt(e.target.href.length - 1) === "!" || e.target.className.indexOf(options.linkClass) === -1 || jump(e.target.hash, {
|
|
1065
|
+
duration,
|
|
1066
|
+
offset,
|
|
1067
|
+
callback: function() {
|
|
1068
|
+
setFocus(e.target.hash);
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
function isInPageLink(n) {
|
|
1074
|
+
return n.tagName.toLowerCase() === "a" && (n.hash.length > 0 || n.href.charAt(n.href.length - 1) === "#") && (stripHash(n.href) === pageUrl || stripHash(n.href) + "#" === pageUrl);
|
|
1075
|
+
}
|
|
1076
|
+
function stripHash(url) {
|
|
1077
|
+
return url.slice(0, url.lastIndexOf("#"));
|
|
1078
|
+
}
|
|
1079
|
+
function setFocus(hash) {
|
|
1080
|
+
var element = document.getElementById(hash.substring(1));
|
|
1081
|
+
element && (/^(?:a|select|input|button|textarea)$/i.test(element.tagName) || (element.tabIndex = -1), element.focus());
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
function jump(target, options) {
|
|
1085
|
+
var start = window.pageYOffset, opt = {
|
|
1086
|
+
duration: options.duration,
|
|
1087
|
+
offset: options.offset || 0,
|
|
1088
|
+
callback: options.callback,
|
|
1089
|
+
easing: options.easing || easeInOutQuad
|
|
1090
|
+
}, tgt = document.querySelector(
|
|
1091
|
+
'[id="' + decodeURI(target).split("#").join("") + '"]'
|
|
1092
|
+
) || document.querySelector('[id="' + target.split("#").join("") + '"]'), distance = typeof target == "string" ? opt.offset + (target ? tgt && tgt.getBoundingClientRect().top || 0 : -(document.documentElement.scrollTop || document.body.scrollTop)) : target, duration = typeof opt.duration == "function" ? opt.duration(distance) : opt.duration, timeStart, timeElapsed;
|
|
1093
|
+
requestAnimationFrame(function(time) {
|
|
1094
|
+
timeStart = time, loop(time);
|
|
1095
|
+
});
|
|
1096
|
+
function loop(time) {
|
|
1097
|
+
timeElapsed = time - timeStart, window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration)), timeElapsed < duration ? requestAnimationFrame(loop) : end();
|
|
1098
|
+
}
|
|
1099
|
+
function end() {
|
|
1100
|
+
window.scrollTo(0, start + distance), typeof opt.callback == "function" && opt.callback();
|
|
1101
|
+
}
|
|
1102
|
+
function easeInOutQuad(t, b, c, d) {
|
|
1103
|
+
return t /= d / 2, t < 1 ? c / 2 * t * t + b : (t--, -c / 2 * (t * (t - 2) - 1) + b);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// ../../node_modules/tocbot/src/js/update-toc-scroll.js
|
|
1108
|
+
function updateTocScroll(options) {
|
|
1109
|
+
let toc = options.tocScrollingWrapper || options.tocElement || document.querySelector(options.tocSelector);
|
|
1110
|
+
if (toc && toc.scrollHeight > toc.clientHeight) {
|
|
1111
|
+
let activeItem = toc.querySelector(`.${options.activeListItemClass}`);
|
|
1112
|
+
if (activeItem) {
|
|
1113
|
+
let scrollAmount = activeItem.offsetTop - options.tocScrollOffset;
|
|
1114
|
+
toc.scrollTop = scrollAmount > 0 ? scrollAmount : 0;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// ../../node_modules/tocbot/src/js/index-esm.js
|
|
1120
|
+
var _options = {}, _buildHtml, _parseContent, _headingsArray, _scrollListener, clickListener;
|
|
1121
|
+
function init(customOptions) {
|
|
1122
|
+
let hasInitialized = !1;
|
|
1123
|
+
_options = extend(default_options_default, customOptions || {}), _options.scrollSmooth && (_options.duration = _options.scrollSmoothDuration, _options.offset = _options.scrollSmoothOffset, initSmoothScrolling(_options)), _buildHtml = build_html_default(_options), _parseContent = parseContent(_options), destroy();
|
|
1124
|
+
let contentElement = getContentElement(_options);
|
|
1125
|
+
if (contentElement === null)
|
|
1126
|
+
return;
|
|
1127
|
+
let tocElement = getTocElement(_options);
|
|
1128
|
+
if (tocElement === null || (_headingsArray = _parseContent.selectHeadings(
|
|
1129
|
+
contentElement,
|
|
1130
|
+
_options.headingSelector
|
|
1131
|
+
), _headingsArray === null))
|
|
1132
|
+
return;
|
|
1133
|
+
let nestedHeadings = _parseContent.nestHeadingsArray(_headingsArray).nest;
|
|
1134
|
+
if (!_options.skipRendering)
|
|
1135
|
+
_buildHtml.render(tocElement, nestedHeadings);
|
|
1136
|
+
else
|
|
1137
|
+
return this;
|
|
1138
|
+
let isClick = !1, scrollHandlerTimeout = _options.scrollHandlerTimeout || _options.throttleTimeout;
|
|
1139
|
+
_scrollListener = ((fn, delay) => getScrollHandler(fn, delay, _options.scrollHandlerType))((e) => {
|
|
1140
|
+
_buildHtml.updateToc(_headingsArray, e), !_options.disableTocScrollSync && !isClick && updateTocScroll(_options), _options.enableUrlHashUpdateOnScroll && hasInitialized && _buildHtml.getCurrentlyHighlighting() && _buildHtml.updateUrlHashForHeader(_headingsArray);
|
|
1141
|
+
let isTop = e?.target?.scrollingElement?.scrollTop === 0;
|
|
1142
|
+
(e && (e.eventPhase === 0 || e.currentTarget === null) || isTop) && (_buildHtml.updateToc(_headingsArray), _options.scrollEndCallback?.(e));
|
|
1143
|
+
}, scrollHandlerTimeout), hasInitialized || (_scrollListener(), hasInitialized = !0), window.onhashchange = window.onscrollend = (e) => {
|
|
1144
|
+
_scrollListener(e);
|
|
1145
|
+
}, _options.scrollContainer && document.querySelector(_options.scrollContainer) ? (document.querySelector(_options.scrollContainer).addEventListener("scroll", _scrollListener, !1), document.querySelector(_options.scrollContainer).addEventListener("resize", _scrollListener, !1)) : (document.addEventListener("scroll", _scrollListener, !1), document.addEventListener("resize", _scrollListener, !1));
|
|
1146
|
+
let timeout = null;
|
|
1147
|
+
clickListener = throttle((event) => {
|
|
1148
|
+
isClick = !0, _options.scrollSmooth && _buildHtml.disableTocAnimation(event), _buildHtml.updateToc(_headingsArray, event), timeout && clearTimeout(timeout), timeout = setTimeout(() => {
|
|
1149
|
+
_buildHtml.enableTocAnimation();
|
|
1150
|
+
}, _options.scrollSmoothDuration), setTimeout(() => {
|
|
1151
|
+
isClick = !1;
|
|
1152
|
+
}, _options.scrollSmoothDuration + 100);
|
|
1153
|
+
}, _options.throttleTimeout), _options.scrollContainer && document.querySelector(_options.scrollContainer) ? document.querySelector(_options.scrollContainer).addEventListener("click", clickListener, !1) : document.addEventListener("click", clickListener, !1);
|
|
1154
|
+
}
|
|
1155
|
+
function destroy() {
|
|
1156
|
+
let tocElement = getTocElement(_options);
|
|
1157
|
+
tocElement !== null && (_options.skipRendering || tocElement && (tocElement.innerHTML = ""), _options.scrollContainer && document.querySelector(_options.scrollContainer) ? (document.querySelector(_options.scrollContainer).removeEventListener("scroll", _scrollListener, !1), document.querySelector(_options.scrollContainer).removeEventListener("resize", _scrollListener, !1), _buildHtml && document.querySelector(_options.scrollContainer).removeEventListener("click", clickListener, !1)) : (document.removeEventListener("scroll", _scrollListener, !1), document.removeEventListener("resize", _scrollListener, !1), _buildHtml && document.removeEventListener("click", clickListener, !1)));
|
|
1158
|
+
}
|
|
1159
|
+
function refresh(customOptions) {
|
|
1160
|
+
destroy(), init(customOptions || _options);
|
|
1161
|
+
}
|
|
1162
|
+
var hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1163
|
+
function extend(...args) {
|
|
1164
|
+
let target = {};
|
|
1165
|
+
for (let i = 0; i < args.length; i++) {
|
|
1166
|
+
let source = args[i];
|
|
1167
|
+
for (let key in source)
|
|
1168
|
+
hasOwnProp.call(source, key) && (target[key] = source[key]);
|
|
1169
|
+
}
|
|
1170
|
+
return target;
|
|
1171
|
+
}
|
|
1172
|
+
function throttle(fn, threshold, scope) {
|
|
1173
|
+
threshold || (threshold = 250);
|
|
1174
|
+
let last, deferTimer;
|
|
1175
|
+
return function(...args) {
|
|
1176
|
+
let context = scope || this, now = +/* @__PURE__ */ new Date();
|
|
1177
|
+
last && now < last + threshold ? (clearTimeout(deferTimer), deferTimer = setTimeout(() => {
|
|
1178
|
+
last = now, fn.apply(context, args);
|
|
1179
|
+
}, threshold)) : (last = now, fn.apply(context, args));
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
function debounce(func, wait) {
|
|
1183
|
+
let timeout;
|
|
1184
|
+
return (...args) => {
|
|
1185
|
+
clearTimeout(timeout), timeout = setTimeout(() => func.apply(this, args), wait);
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
function getScrollHandler(func, timeout, type = "auto") {
|
|
1189
|
+
switch (type) {
|
|
1190
|
+
case "debounce":
|
|
1191
|
+
return debounce(func, timeout);
|
|
1192
|
+
case "throttle":
|
|
1193
|
+
return throttle(func, timeout);
|
|
1194
|
+
default:
|
|
1195
|
+
return timeout < 334 ? debounce(func, timeout) : throttle(func, timeout);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
function getContentElement(options) {
|
|
1199
|
+
try {
|
|
1200
|
+
return options.contentElement || document.querySelector(options.contentSelector);
|
|
1201
|
+
} catch {
|
|
1202
|
+
return console.warn(`Contents element not found: ${options.contentSelector}`), null;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
function getTocElement(options) {
|
|
1206
|
+
try {
|
|
1207
|
+
return options.tocElement || document.querySelector(options.tocSelector);
|
|
1208
|
+
} catch {
|
|
1209
|
+
return console.warn(`TOC element not found: ${options.tocSelector}`), null;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
// ../../node_modules/tocbot/index.js
|
|
1214
|
+
var tocbot = { destroy, init, refresh };
|
|
1215
|
+
var tocbot_default = tocbot;
|
|
1216
|
+
|
|
1217
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/components/TableOfContents.module.css
|
|
1218
|
+
var id9 = "core/src/addon-docs/blocks/components/TableOfContents.module.css";
|
|
1219
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id9}"]`)) {
|
|
1220
|
+
let style = document.createElement("style");
|
|
1221
|
+
style.setAttribute("data-sb-css", id9), style.textContent = '.sb-7qSlVa-aside{width:10rem;@media (width<=768px){display:none}}.sb-7qSlVa-nav{width:10rem;font-family:var(--sb-font-base);font-size:var(--sb-size-s2);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:#0000;-webkit-overflow-scrolling:touch;padding-top:4rem;padding-bottom:2rem;position:fixed;top:0;bottom:0;overflow-y:auto;& *{box-sizing:border-box}&>.toc-wrapper>.toc-list,&>.toc-wrapper>.toc-list .toc-list{border-left:solid 2px var(--sb-color-mediumlight);padding-left:0}& .toc-list-item{margin-left:20px;padding-top:3px;padding-bottom:3px;list-style-type:none;position:relative}& .toc-list-item:before{content:"";border-left:solid 2px var(--sb-color-mediumdark);opacity:0;height:100%;transition:opacity .2s;position:absolute;top:0;left:0;transform:translate(-22px)}& .toc-list-item.is-active-li:before{opacity:1}& .toc-list-item>a{color:var(--sb-color-default-text);text-decoration:none}& .toc-list-item.is-active-li>a{color:var(--sb-color-secondary);font-weight:600;text-decoration:none}}.sb-7qSlVa-heading{color:var(--sb-color-default-text);text-transform:uppercase;margin-bottom:10px;font-size:.875em;font-weight:600}', document.head.appendChild(style);
|
|
1222
|
+
}
|
|
1223
|
+
var TableOfContents_default = { nav: "sb-7qSlVa-nav", aside: "sb-7qSlVa-aside", heading: "sb-7qSlVa-heading" };
|
|
1224
|
+
|
|
1225
|
+
// src/addon-docs/blocks/components/TableOfContents.tsx
|
|
1226
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1227
|
+
var Title2 = ({ headingId, title }) => typeof title == "string" || !title ? jsx13(
|
|
1228
|
+
"h2",
|
|
1229
|
+
{
|
|
1230
|
+
id: headingId,
|
|
1231
|
+
className: clsx(TableOfContents_default.heading, !title && "sb-sr-only"),
|
|
1232
|
+
lang: title ? void 0 : "en",
|
|
1233
|
+
children: title || "Table of contents"
|
|
1234
|
+
}
|
|
1235
|
+
) : jsx13("div", { id: headingId, children: title }), TableOfContents = ({
|
|
1236
|
+
title,
|
|
1237
|
+
disable,
|
|
1238
|
+
headingSelector,
|
|
1239
|
+
contentsSelector,
|
|
1240
|
+
ignoreSelector,
|
|
1241
|
+
unsafeTocbotOptions,
|
|
1242
|
+
channel,
|
|
1243
|
+
className
|
|
1244
|
+
}) => {
|
|
1245
|
+
useEffect3(() => {
|
|
1246
|
+
if (disable)
|
|
1247
|
+
return () => {
|
|
1248
|
+
};
|
|
1249
|
+
let configuration = {
|
|
1250
|
+
tocSelector: ".toc-wrapper",
|
|
1251
|
+
contentSelector: contentsSelector ?? ".sbdocs-content",
|
|
1252
|
+
headingSelector: headingSelector ?? "h3",
|
|
1253
|
+
/** Ignore headings that did not come from the main markdown code. */
|
|
1254
|
+
ignoreSelector: ignoreSelector ?? ".docs-story *, .skip-toc",
|
|
1255
|
+
headingsOffset: 40,
|
|
1256
|
+
scrollSmoothOffset: -40,
|
|
1257
|
+
orderedList: !1,
|
|
1258
|
+
/** Prevent default linking behavior, leaving only the smooth scrolling. */
|
|
1259
|
+
onClick: (e) => {
|
|
1260
|
+
if (e.preventDefault(), e.currentTarget instanceof HTMLAnchorElement) {
|
|
1261
|
+
let [, headerId] = e.currentTarget.href.split("#");
|
|
1262
|
+
headerId && channel.emit(NAVIGATE_URL, `#${headerId}`);
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
...unsafeTocbotOptions
|
|
1266
|
+
}, timeout = setTimeout(() => tocbot_default.init(configuration), 100);
|
|
1267
|
+
return () => {
|
|
1268
|
+
clearTimeout(timeout), tocbot_default.destroy();
|
|
1269
|
+
};
|
|
1270
|
+
}, [channel, disable, ignoreSelector, contentsSelector, headingSelector, unsafeTocbotOptions]);
|
|
1271
|
+
let headingId = "table-of-contents";
|
|
1272
|
+
return jsx13("aside", { className: clsx(TableOfContents_default.aside, className), children: disable ? null : jsxs8("nav", { className: TableOfContents_default.nav, "aria-labelledby": headingId, children: [
|
|
1273
|
+
jsx13(Title2, { headingId, title }),
|
|
1274
|
+
jsx13("div", { className: "toc-wrapper" })
|
|
1275
|
+
] }) });
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
// src/addon-docs/blocks/blocks/Anchor.tsx
|
|
1279
|
+
import { anchorBlockIdFromId } from "@aussieljk/forkbook/internal/docs-tools";
|
|
1280
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1281
|
+
var Anchor = ({ storyId, children }) => jsx14("div", { id: anchorBlockIdFromId(storyId), className: "sb-anchor", children });
|
|
1282
|
+
|
|
1283
|
+
// src/addon-docs/blocks/blocks/ArgTypes.tsx
|
|
1284
|
+
import { useContext as useContext4 } from "react";
|
|
1285
|
+
import { InvalidBlockOfPropError as InvalidBlockOfPropError2 } from "@aussieljk/forkbook/internal/preview-errors";
|
|
1286
|
+
import { filterArgTypes } from "@aussieljk/forkbook/preview-api";
|
|
1287
|
+
|
|
1288
|
+
// src/addon-docs/blocks/blocks/argTypesShared.ts
|
|
1289
|
+
import {
|
|
1290
|
+
getServiceSubcomponentArgTypes,
|
|
1291
|
+
mergeServiceArgTypes
|
|
1292
|
+
} from "@aussieljk/forkbook/internal/docs-tools";
|
|
1293
|
+
|
|
1294
|
+
// src/addon-docs/blocks/blocks/use-service-docgen.ts
|
|
1295
|
+
import { getService } from "@aussieljk/forkbook/preview-api";
|
|
1296
|
+
|
|
1297
|
+
// src/addon-docs/blocks/blocks/use-query-subscription.ts
|
|
1298
|
+
import { useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
1299
|
+
import { seedQueryState } from "@aussieljk/forkbook/open-service";
|
|
1300
|
+
|
|
1301
|
+
// src/addon-docs/blocks/blocks/useSyncExternalStoreShim.ts
|
|
1302
|
+
import { useEffect as useEffect4, useLayoutEffect, useState as useState4 } from "react";
|
|
1303
|
+
function useSyncExternalStoreShim(subscribe, getSnapshot) {
|
|
1304
|
+
let value = getSnapshot(), [{ inst }, forceUpdate] = useState4({ inst: { value, getSnapshot } });
|
|
1305
|
+
return useLayoutEffect(() => {
|
|
1306
|
+
inst.value = value, inst.getSnapshot = getSnapshot, didSnapshotChange(inst) && forceUpdate({ inst });
|
|
1307
|
+
}, [subscribe, value, getSnapshot]), useEffect4(() => (didSnapshotChange(inst) && forceUpdate({ inst }), subscribe(() => {
|
|
1308
|
+
didSnapshotChange(inst) && forceUpdate({ inst });
|
|
1309
|
+
})), [subscribe]), value;
|
|
1310
|
+
}
|
|
1311
|
+
function didSnapshotChange(inst) {
|
|
1312
|
+
let latestGetSnapshot = inst.getSnapshot, prevValue = inst.value;
|
|
1313
|
+
try {
|
|
1314
|
+
let nextValue = latestGetSnapshot();
|
|
1315
|
+
return !Object.is(prevValue, nextValue);
|
|
1316
|
+
} catch {
|
|
1317
|
+
return !0;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
// src/addon-docs/blocks/blocks/use-query-subscription.ts
|
|
1322
|
+
function useQuerySubscription(cacheKey, query, input, selector) {
|
|
1323
|
+
let cache = useRef2(void 0);
|
|
1324
|
+
(cache.current?.key !== cacheKey || cache.current.selector !== selector) && (cache.current = {
|
|
1325
|
+
key: cacheKey,
|
|
1326
|
+
selector,
|
|
1327
|
+
state: selector ? seedQueryState(query, input, selector) : seedQueryState(query, input)
|
|
1328
|
+
});
|
|
1329
|
+
let inputRef = useRef2(input);
|
|
1330
|
+
inputRef.current = input;
|
|
1331
|
+
let subscribe = useCallback2(
|
|
1332
|
+
(listener) => {
|
|
1333
|
+
let onQueryState = (state) => {
|
|
1334
|
+
cache.current = { key: cacheKey, selector, state }, listener();
|
|
1335
|
+
};
|
|
1336
|
+
return selector ? query.subscribe(inputRef.current, selector, onQueryState) : query.subscribe(inputRef.current, onQueryState);
|
|
1337
|
+
},
|
|
1338
|
+
[query, cacheKey, selector]
|
|
1339
|
+
), getSnapshot = useCallback2(() => cache.current.state, []);
|
|
1340
|
+
return useSyncExternalStoreShim(subscribe, getSnapshot);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
// src/addon-docs/blocks/blocks/use-service-docgen.ts
|
|
1344
|
+
function useServiceDocgen(id11) {
|
|
1345
|
+
let service = getService("core/docgen", { internal: !0 });
|
|
1346
|
+
return useQuerySubscription(id11, service.queries.docgen, { id: id11 });
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
// src/addon-docs/blocks/blocks/argTypesShared.ts
|
|
1350
|
+
function extractComponentArgTypes(component, parameters) {
|
|
1351
|
+
let { extractArgTypes } = parameters.docs || {};
|
|
1352
|
+
if (!extractArgTypes)
|
|
1353
|
+
throw new Error("Args unsupported. See Args documentation for your framework." /* ARGS_UNSUPPORTED */);
|
|
1354
|
+
return extractArgTypes(component);
|
|
1355
|
+
}
|
|
1356
|
+
function extractSubcomponentArgTypes(subcomponents, parameters) {
|
|
1357
|
+
return Object.fromEntries(
|
|
1358
|
+
Object.entries(subcomponents || {}).map(([key, comp]) => [
|
|
1359
|
+
key,
|
|
1360
|
+
extractComponentArgTypes(comp, parameters)
|
|
1361
|
+
])
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
function useDocgenServiceRows({
|
|
1365
|
+
componentId,
|
|
1366
|
+
storyId,
|
|
1367
|
+
parameters,
|
|
1368
|
+
initialArgs,
|
|
1369
|
+
customArgTypes
|
|
1370
|
+
}) {
|
|
1371
|
+
let { data: servicePayload, isInitialLoading } = useServiceDocgen(componentId);
|
|
1372
|
+
return isInitialLoading ? { rows: null, isInitialLoading } : {
|
|
1373
|
+
rows: {
|
|
1374
|
+
serviceComponentName: servicePayload?.name ?? "",
|
|
1375
|
+
mainRows: mergeServiceArgTypes({
|
|
1376
|
+
payload: servicePayload,
|
|
1377
|
+
storyId: storyId ?? componentId,
|
|
1378
|
+
parameters,
|
|
1379
|
+
initialArgs,
|
|
1380
|
+
customArgTypes
|
|
1381
|
+
}),
|
|
1382
|
+
subcomponentRows: servicePayload ? getServiceSubcomponentArgTypes(servicePayload) : {}
|
|
1383
|
+
},
|
|
1384
|
+
isInitialLoading
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
// src/addon-docs/blocks/blocks/useOf.ts
|
|
1389
|
+
import { useContext as useContext3 } from "react";
|
|
1390
|
+
var useOf = (moduleExportOrType, validTypes) => useContext3(DocsContext).resolveOf(moduleExportOrType, validTypes);
|
|
1391
|
+
|
|
1392
|
+
// src/addon-docs/blocks/blocks/utils.ts
|
|
1393
|
+
var titleCase = (str) => str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(""), getComponentName = (component) => {
|
|
1394
|
+
if (component)
|
|
1395
|
+
return typeof component == "string" ? component.includes("-") ? titleCase(component) : component : component.__docgenInfo && component.__docgenInfo.displayName ? component.__docgenInfo.displayName : component.name;
|
|
1396
|
+
};
|
|
1397
|
+
function scrollToElement(element, block = "start") {
|
|
1398
|
+
element.scrollIntoView({
|
|
1399
|
+
behavior: "smooth",
|
|
1400
|
+
block,
|
|
1401
|
+
inline: "nearest"
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
// src/addon-docs/blocks/blocks/ArgTypes.tsx
|
|
1406
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1407
|
+
function useResolveArgTypes(props) {
|
|
1408
|
+
let { of } = props;
|
|
1409
|
+
if ("of" in props && of === void 0)
|
|
1410
|
+
throw new InvalidBlockOfPropError2();
|
|
1411
|
+
let context = useContext4(DocsContext), resolved = useOf(of || "meta"), resolvedArgTypes;
|
|
1412
|
+
if (resolved.type === "component") {
|
|
1413
|
+
let {
|
|
1414
|
+
component,
|
|
1415
|
+
projectAnnotations: { parameters }
|
|
1416
|
+
} = resolved;
|
|
1417
|
+
resolvedArgTypes = {
|
|
1418
|
+
parameters,
|
|
1419
|
+
// Bare `of={Component}` has no story/meta annotations; the docgen service is addressed by
|
|
1420
|
+
// component id, recovered by searching only the CSF files this docs page imports.
|
|
1421
|
+
componentId: context.getComponentId(component),
|
|
1422
|
+
argTypes: extractComponentArgTypes(component, parameters),
|
|
1423
|
+
component
|
|
1424
|
+
};
|
|
1425
|
+
} else if (resolved.type === "meta") {
|
|
1426
|
+
let { id: id11, argTypes, parameters, initialArgs, component, subcomponents } = resolved.preparedMeta;
|
|
1427
|
+
resolvedArgTypes = {
|
|
1428
|
+
parameters,
|
|
1429
|
+
componentId: id11.split("--")[0],
|
|
1430
|
+
initialArgs,
|
|
1431
|
+
argTypes,
|
|
1432
|
+
component,
|
|
1433
|
+
subcomponents
|
|
1434
|
+
};
|
|
1435
|
+
} else {
|
|
1436
|
+
let { id: id11, argTypes, parameters, initialArgs, component, subcomponents } = resolved.story;
|
|
1437
|
+
resolvedArgTypes = {
|
|
1438
|
+
parameters,
|
|
1439
|
+
componentId: id11.split("--")[0],
|
|
1440
|
+
storyId: id11,
|
|
1441
|
+
initialArgs,
|
|
1442
|
+
argTypes,
|
|
1443
|
+
component,
|
|
1444
|
+
subcomponents
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
let argTypesParameters = resolvedArgTypes.parameters?.docs?.argTypes || {};
|
|
1448
|
+
return {
|
|
1449
|
+
...resolvedArgTypes,
|
|
1450
|
+
filterProps: {
|
|
1451
|
+
include: props.include ?? argTypesParameters.include,
|
|
1452
|
+
exclude: props.exclude ?? argTypesParameters.exclude,
|
|
1453
|
+
sort: props.sort ?? argTypesParameters.sort
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
function renderArgTypesTables({
|
|
1458
|
+
mainName = "Main",
|
|
1459
|
+
mainRows,
|
|
1460
|
+
subcomponentRows,
|
|
1461
|
+
include,
|
|
1462
|
+
exclude,
|
|
1463
|
+
sort,
|
|
1464
|
+
docsLang
|
|
1465
|
+
}) {
|
|
1466
|
+
let filteredMainRows = filterArgTypes(mainRows, include, exclude);
|
|
1467
|
+
if (Object.keys(subcomponentRows).length === 0)
|
|
1468
|
+
return jsx15(ArgsTable, { rows: filteredMainRows, sort, docsLang });
|
|
1469
|
+
let tabs = {
|
|
1470
|
+
[mainName]: { rows: filteredMainRows, sort },
|
|
1471
|
+
...Object.fromEntries(
|
|
1472
|
+
Object.entries(subcomponentRows).map(([key, rows]) => [
|
|
1473
|
+
key,
|
|
1474
|
+
{
|
|
1475
|
+
rows: filterArgTypes(rows, include, exclude),
|
|
1476
|
+
sort
|
|
1477
|
+
}
|
|
1478
|
+
])
|
|
1479
|
+
)
|
|
1480
|
+
};
|
|
1481
|
+
return jsx15(TabbedArgsTable, { tabs, sort, docsLang });
|
|
1482
|
+
}
|
|
1483
|
+
var LegacyArgTypes = (props) => {
|
|
1484
|
+
let { argTypes, parameters, component, subcomponents, filterProps } = useResolveArgTypes(props);
|
|
1485
|
+
return argTypes ? renderArgTypesTables({
|
|
1486
|
+
mainName: getComponentName(component),
|
|
1487
|
+
mainRows: argTypes,
|
|
1488
|
+
subcomponentRows: extractSubcomponentArgTypes(subcomponents, parameters),
|
|
1489
|
+
docsLang: parameters?.docs?.lang,
|
|
1490
|
+
...filterProps
|
|
1491
|
+
}) : null;
|
|
1492
|
+
}, DocgenServiceArgTypes = (props) => {
|
|
1493
|
+
let resolved = useResolveArgTypes(props);
|
|
1494
|
+
return resolved.componentId === void 0 ? jsx15(ArgsTable, { error: "No docs found for this component on this page. Import the story file whose meta.component is this component, or pass `of={ComponentStories}`." /* NOT_A_STORY_COMPONENT */ }) : jsx15(DocgenServiceArgTypesRows, { ...resolved, componentId: resolved.componentId });
|
|
1495
|
+
}, DocgenServiceArgTypesRows = ({
|
|
1496
|
+
argTypes,
|
|
1497
|
+
parameters,
|
|
1498
|
+
componentId,
|
|
1499
|
+
storyId,
|
|
1500
|
+
initialArgs,
|
|
1501
|
+
filterProps
|
|
1502
|
+
}) => {
|
|
1503
|
+
let { rows: serviceRows, isInitialLoading } = useDocgenServiceRows({
|
|
1504
|
+
componentId,
|
|
1505
|
+
storyId,
|
|
1506
|
+
parameters,
|
|
1507
|
+
initialArgs,
|
|
1508
|
+
customArgTypes: argTypes
|
|
1509
|
+
});
|
|
1510
|
+
return isInitialLoading ? jsx15(ArgsTable, { isLoading: !0 }) : serviceRows ? renderArgTypesTables({
|
|
1511
|
+
mainName: serviceRows.serviceComponentName,
|
|
1512
|
+
mainRows: serviceRows.mainRows,
|
|
1513
|
+
subcomponentRows: serviceRows.subcomponentRows,
|
|
1514
|
+
docsLang: parameters?.docs?.lang,
|
|
1515
|
+
...filterProps
|
|
1516
|
+
}) : null;
|
|
1517
|
+
}, ArgTypesImpl = (props) => globalThis.FEATURES?.docgenServer ? jsx15(DocgenServiceArgTypes, { ...props }) : jsx15(LegacyArgTypes, { ...props }), ArgTypes = withMdxComponentOverride("ArgTypes", ArgTypesImpl);
|
|
1518
|
+
|
|
1519
|
+
// src/addon-docs/blocks/blocks/Canvas.tsx
|
|
1520
|
+
import { useCallback as useCallback4, useContext as useContext6 } from "react";
|
|
1521
|
+
import { FORCE_REMOUNT } from "@aussieljk/forkbook/internal/core-events";
|
|
1522
|
+
import { InvalidBlockOfPropError as InvalidBlockOfPropError4 } from "@aussieljk/forkbook/internal/preview-errors";
|
|
1523
|
+
|
|
1524
|
+
// src/addon-docs/blocks/blocks/Source.tsx
|
|
1525
|
+
import { useContext as useContext5, useMemo as useMemo2 } from "react";
|
|
1526
|
+
import { SourceType } from "@aussieljk/forkbook/internal/docs-tools";
|
|
1527
|
+
import { InvalidBlockOfPropError as InvalidBlockOfPropError3 } from "@aussieljk/forkbook/internal/preview-errors";
|
|
1528
|
+
|
|
1529
|
+
// src/addon-docs/blocks/blocks/SourceContainer.tsx
|
|
1530
|
+
import { createContext as createContext3, useEffect as useEffect5, useState as useState5 } from "react";
|
|
1531
|
+
import { SNIPPET_RENDERED } from "@aussieljk/forkbook/internal/docs-tools";
|
|
1532
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1533
|
+
function argsHash(args) {
|
|
1534
|
+
return stringify(args, { maxDepth: 50 });
|
|
1535
|
+
}
|
|
1536
|
+
var SourceContext = createContext3({ sources: {} }), UNKNOWN_ARGS_HASH = "--unknown--", SourceContainer = ({
|
|
1537
|
+
children,
|
|
1538
|
+
channel
|
|
1539
|
+
}) => {
|
|
1540
|
+
let [sources, setSources] = useState5({});
|
|
1541
|
+
return useEffect5(() => {
|
|
1542
|
+
let handleSnippetRendered = (idOrEvent, inputSource = null, inputFormat = !1) => {
|
|
1543
|
+
let {
|
|
1544
|
+
id: id11,
|
|
1545
|
+
args = void 0,
|
|
1546
|
+
source,
|
|
1547
|
+
format: format2,
|
|
1548
|
+
warning = void 0
|
|
1549
|
+
} = typeof idOrEvent == "string" ? {
|
|
1550
|
+
id: idOrEvent,
|
|
1551
|
+
source: inputSource,
|
|
1552
|
+
format: inputFormat
|
|
1553
|
+
} : idOrEvent, hash = args ? argsHash(args) : UNKNOWN_ARGS_HASH;
|
|
1554
|
+
setSources((current) => ({
|
|
1555
|
+
...current,
|
|
1556
|
+
[id11]: {
|
|
1557
|
+
...current[id11],
|
|
1558
|
+
[hash]: { code: source || "", format: format2, warning }
|
|
1559
|
+
}
|
|
1560
|
+
}));
|
|
1561
|
+
};
|
|
1562
|
+
return channel.on(SNIPPET_RENDERED, handleSnippetRendered), () => channel.off(SNIPPET_RENDERED, handleSnippetRendered);
|
|
1563
|
+
}, []), jsx16(SourceContext.Provider, { value: { sources }, children });
|
|
1564
|
+
};
|
|
1565
|
+
|
|
1566
|
+
// src/addon-docs/blocks/blocks/use-service-story-docs.ts
|
|
1567
|
+
import { useCallback as useCallback3 } from "react";
|
|
1568
|
+
import {
|
|
1569
|
+
selectSnippetForStory,
|
|
1570
|
+
selectStoryDoc,
|
|
1571
|
+
selectWarningForStory
|
|
1572
|
+
} from "@aussieljk/forkbook/open-service";
|
|
1573
|
+
import { getService as getService2 } from "@aussieljk/forkbook/preview-api";
|
|
1574
|
+
function useServiceStory(storyId, selector) {
|
|
1575
|
+
let componentId = storyId.split("--")[0], service = getService2("core/story-docs", { internal: !0 }), boundSelector = useCallback3(
|
|
1576
|
+
(payload) => selector(payload, storyId),
|
|
1577
|
+
[selector, storyId]
|
|
1578
|
+
);
|
|
1579
|
+
return useQuerySubscription(
|
|
1580
|
+
storyId,
|
|
1581
|
+
service.queries.storyDocs,
|
|
1582
|
+
{ id: componentId },
|
|
1583
|
+
boundSelector
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
function useServiceStoryDoc(storyId) {
|
|
1587
|
+
return useServiceStory(storyId, selectStoryDoc);
|
|
1588
|
+
}
|
|
1589
|
+
function useServiceStorySnippet(storyId) {
|
|
1590
|
+
return useServiceStory(storyId, selectSnippetForStory);
|
|
1591
|
+
}
|
|
1592
|
+
function useServiceStoryWarning(storyId) {
|
|
1593
|
+
return useServiceStory(storyId, selectWarningForStory);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
// src/addon-docs/blocks/blocks/useTransformCode.tsx
|
|
1597
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1598
|
+
function useTransformCode(source, transform, storyContext) {
|
|
1599
|
+
let [transformedCode, setTransformedCode] = useState6("Transforming..."), transformed = transform ? transform?.(source, storyContext) : source;
|
|
1600
|
+
return useEffect6(() => {
|
|
1601
|
+
async function getTransformedCode() {
|
|
1602
|
+
let transformResult = await transformed;
|
|
1603
|
+
transformResult !== transformedCode && setTransformedCode(transformResult);
|
|
1604
|
+
}
|
|
1605
|
+
getTransformedCode();
|
|
1606
|
+
}), typeof transformed == "object" && typeof transformed.then == "function" ? transformedCode : transformed;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
// src/addon-docs/blocks/blocks/Source.tsx
|
|
1610
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1611
|
+
var EMPTY_SOURCE_CONTEXT = { sources: {} }, getStorySource = (storyId, args, sourceContext) => {
|
|
1612
|
+
let { sources } = sourceContext, sourceMap = sources?.[storyId];
|
|
1613
|
+
return sourceMap?.[argsHash(args)] || sourceMap?.[UNKNOWN_ARGS_HASH] || { code: "" };
|
|
1614
|
+
}, useCode = ({
|
|
1615
|
+
snippet,
|
|
1616
|
+
serviceSnippet,
|
|
1617
|
+
storyContext,
|
|
1618
|
+
typeFromProps,
|
|
1619
|
+
transformFromProps
|
|
1620
|
+
}) => {
|
|
1621
|
+
let parameters = storyContext.parameters ?? {}, { __isArgsStory: isArgsStory } = parameters, sourceParameters = parameters.docs?.source || {}, type = typeFromProps || sourceParameters.type || SourceType.AUTO, staticSnippet = serviceSnippet || snippet, code = /* if user has explicitly set this as dynamic, use snippet */ type === SourceType.DYNAMIC || // if this is an args story and there's a snippet
|
|
1622
|
+
type === SourceType.AUTO && staticSnippet && isArgsStory ? staticSnippet : sourceParameters.originalSource || "", transformer = transformFromProps ?? sourceParameters.transform, transformedCode = transformer ? useTransformCode(code, transformer, storyContext) : code;
|
|
1623
|
+
return sourceParameters.code !== void 0 ? sourceParameters.code : transformedCode;
|
|
1624
|
+
}, useSourceProps = (props, docsContext, sourceContext, serviceSnippet = "", serviceWarning) => {
|
|
1625
|
+
let { of } = props, story = useMemo2(() => {
|
|
1626
|
+
if (of)
|
|
1627
|
+
return docsContext.resolveOf(of, ["story"]).story;
|
|
1628
|
+
try {
|
|
1629
|
+
return docsContext.storyById();
|
|
1630
|
+
} catch {
|
|
1631
|
+
}
|
|
1632
|
+
}, [docsContext, of]), storyContext = story ? docsContext.getStoryContext(story) : {}, argsForSource = props.__forceInitialArgs ? storyContext.initialArgs : storyContext.unmappedArgs, source = story ? getStorySource(story.id, argsForSource, sourceContext) : null, transformedCode = useCode({
|
|
1633
|
+
snippet: source ? source.code : "",
|
|
1634
|
+
serviceSnippet,
|
|
1635
|
+
storyContext: { ...storyContext, args: argsForSource },
|
|
1636
|
+
typeFromProps: props.type,
|
|
1637
|
+
transformFromProps: props.transform
|
|
1638
|
+
});
|
|
1639
|
+
if ("of" in props && of === void 0)
|
|
1640
|
+
throw new InvalidBlockOfPropError3();
|
|
1641
|
+
let sourceParameters = story?.parameters?.docs?.source || {}, format2 = props.format, language = props.language ?? sourceParameters.language ?? "jsx", dark = props.dark ?? sourceParameters.dark ?? !1;
|
|
1642
|
+
if (props.code === void 0 && !story)
|
|
1643
|
+
return { error: "Oh no! The source is not available." /* SOURCE_UNAVAILABLE */ };
|
|
1644
|
+
if (props.code !== void 0)
|
|
1645
|
+
return {
|
|
1646
|
+
code: props.code,
|
|
1647
|
+
format: format2,
|
|
1648
|
+
language,
|
|
1649
|
+
dark
|
|
1650
|
+
};
|
|
1651
|
+
format2 = source?.format ?? !0;
|
|
1652
|
+
let warning;
|
|
1653
|
+
return transformedCode === serviceSnippet ? warning = serviceWarning : transformedCode === source?.code && (warning = source.warning), {
|
|
1654
|
+
code: transformedCode,
|
|
1655
|
+
format: format2,
|
|
1656
|
+
language,
|
|
1657
|
+
dark,
|
|
1658
|
+
warning
|
|
1659
|
+
};
|
|
1660
|
+
}, SourceWithStoryDocsSnippet = ({ storyId, docsContext, sourceContext, ...props }) => {
|
|
1661
|
+
let serviceSnippet = useServiceStorySnippet(storyId).data ?? "", serviceWarning = useServiceStoryWarning(storyId).data, sourceProps = useSourceProps(
|
|
1662
|
+
props,
|
|
1663
|
+
docsContext,
|
|
1664
|
+
sourceContext,
|
|
1665
|
+
serviceSnippet,
|
|
1666
|
+
serviceWarning
|
|
1667
|
+
);
|
|
1668
|
+
return jsx17(Source, { ...sourceProps });
|
|
1669
|
+
}, SourceWithStorySnippet = (props) => {
|
|
1670
|
+
let { of } = props, sourceContext = useContext5(SourceContext), docsContext = useContext5(DocsContext), story = useMemo2(() => {
|
|
1671
|
+
if (of)
|
|
1672
|
+
return docsContext.resolveOf(of, ["story"]).story;
|
|
1673
|
+
try {
|
|
1674
|
+
return docsContext.storyById();
|
|
1675
|
+
} catch {
|
|
1676
|
+
}
|
|
1677
|
+
}, [docsContext, of]);
|
|
1678
|
+
if (globalThis.FEATURES?.docgenServer && story?.id)
|
|
1679
|
+
return jsx17(
|
|
1680
|
+
SourceWithStoryDocsSnippet,
|
|
1681
|
+
{
|
|
1682
|
+
...props,
|
|
1683
|
+
docsContext,
|
|
1684
|
+
sourceContext,
|
|
1685
|
+
storyId: story.id
|
|
1686
|
+
}
|
|
1687
|
+
);
|
|
1688
|
+
let sourceProps = useSourceProps(props, docsContext, sourceContext);
|
|
1689
|
+
return jsx17(Source, { ...sourceProps });
|
|
1690
|
+
}, SourceWithCode = (props) => {
|
|
1691
|
+
let docsContext = useContext5(DocsContext), sourceProps = useSourceProps(props, docsContext, EMPTY_SOURCE_CONTEXT);
|
|
1692
|
+
return jsx17(Source, { ...sourceProps });
|
|
1693
|
+
}, SourceImpl = (props) => props.code !== void 0 ? jsx17(SourceWithCode, { ...props }) : jsx17(SourceWithStorySnippet, { ...props }), Source2 = withMdxComponentOverride("Source", SourceImpl);
|
|
1694
|
+
|
|
1695
|
+
// src/addon-docs/blocks/blocks/Canvas.tsx
|
|
1696
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1697
|
+
var CanvasImpl = (props) => {
|
|
1698
|
+
let docsContext = useContext6(DocsContext), sourceContext = useContext6(SourceContext), { of, source } = props;
|
|
1699
|
+
if ("of" in props && of === void 0)
|
|
1700
|
+
throw new InvalidBlockOfPropError4();
|
|
1701
|
+
let { story } = useOf(of || "story", ["story"]), sourceProps = useSourceProps({ ...source, ...of && { of } }, docsContext, sourceContext), layout = props.layout ?? story.parameters.layout ?? story.parameters.docs?.canvas?.layout ?? "padded", withToolbar = props.withToolbar ?? story.parameters.docs?.canvas?.withToolbar ?? !1, additionalActions = props.additionalActions ?? story.parameters.docs?.canvas?.additionalActions, sourceState = props.sourceState ?? story.parameters.docs?.canvas?.sourceState ?? "hidden", className = props.className ?? story.parameters.docs?.canvas?.className, inline = props.story?.inline ?? story.parameters?.docs?.story?.inline ?? !1, handleReloadStory = useCallback4(() => {
|
|
1702
|
+
docsContext.channel.emit(FORCE_REMOUNT, { storyId: story.id });
|
|
1703
|
+
}, [docsContext.channel, story.id]);
|
|
1704
|
+
return jsx18(
|
|
1705
|
+
Preview,
|
|
1706
|
+
{
|
|
1707
|
+
withSource: sourceState === "none" ? void 0 : sourceProps,
|
|
1708
|
+
isExpanded: sourceState === "shown",
|
|
1709
|
+
withToolbar,
|
|
1710
|
+
additionalActions,
|
|
1711
|
+
className,
|
|
1712
|
+
layout,
|
|
1713
|
+
inline,
|
|
1714
|
+
onReloadStory: inline ? handleReloadStory : void 0,
|
|
1715
|
+
children: jsx18(Story2, { of: of || story.moduleExport, meta: props.meta, ...props.story })
|
|
1716
|
+
}
|
|
1717
|
+
);
|
|
1718
|
+
}, Canvas = withMdxComponentOverride("Canvas", CanvasImpl);
|
|
1719
|
+
|
|
1720
|
+
// src/addon-docs/blocks/blocks/Controls.tsx
|
|
1721
|
+
import { useContext as useContext8, useId as useId2 } from "react";
|
|
1722
|
+
import { filterArgTypes as filterArgTypes2 } from "@aussieljk/forkbook/preview-api";
|
|
1723
|
+
|
|
1724
|
+
// src/addon-docs/blocks/blocks/useArgs.ts
|
|
1725
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useState as useState7 } from "react";
|
|
1726
|
+
import {
|
|
1727
|
+
RESET_STORY_ARGS,
|
|
1728
|
+
STORY_ARGS_UPDATED,
|
|
1729
|
+
UPDATE_STORY_ARGS
|
|
1730
|
+
} from "@aussieljk/forkbook/internal/core-events";
|
|
1731
|
+
var useArgs = (story, context) => {
|
|
1732
|
+
let result = useArgsIfDefined(story, context);
|
|
1733
|
+
if (!result)
|
|
1734
|
+
throw new Error("No result when story was defined");
|
|
1735
|
+
return result;
|
|
1736
|
+
}, useArgsIfDefined = (story, context) => {
|
|
1737
|
+
let storyContext = story ? context.getStoryContext(story) : { args: {} }, { id: storyId } = story || { id: "none" }, [args, setArgs] = useState7(storyContext.args);
|
|
1738
|
+
useEffect7(() => {
|
|
1739
|
+
let onArgsUpdated = (changed) => {
|
|
1740
|
+
changed.storyId === storyId && setArgs(changed.args);
|
|
1741
|
+
};
|
|
1742
|
+
return context.channel.on(STORY_ARGS_UPDATED, onArgsUpdated), () => context.channel.off(STORY_ARGS_UPDATED, onArgsUpdated);
|
|
1743
|
+
}, [storyId, context.channel]);
|
|
1744
|
+
let updateArgs = useCallback5(
|
|
1745
|
+
(updatedArgs) => context.channel.emit(UPDATE_STORY_ARGS, { storyId, updatedArgs }),
|
|
1746
|
+
[storyId, context.channel]
|
|
1747
|
+
), resetArgs = useCallback5(
|
|
1748
|
+
(argNames) => context.channel.emit(RESET_STORY_ARGS, { storyId, argNames }),
|
|
1749
|
+
[storyId, context.channel]
|
|
1750
|
+
);
|
|
1751
|
+
return story && [args, updateArgs, resetArgs];
|
|
1752
|
+
};
|
|
1753
|
+
|
|
1754
|
+
// src/addon-docs/blocks/blocks/useGlobals.ts
|
|
1755
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
1756
|
+
import { GLOBALS_UPDATED } from "@aussieljk/forkbook/internal/core-events";
|
|
1757
|
+
var useGlobals = (story, context) => {
|
|
1758
|
+
let storyContext = context.getStoryContext(story), [globals, setGlobals] = useState8(storyContext.globals);
|
|
1759
|
+
return useEffect8(() => {
|
|
1760
|
+
let onGlobalsUpdated = (changed) => {
|
|
1761
|
+
setGlobals(changed.globals);
|
|
1762
|
+
};
|
|
1763
|
+
return context.channel.on(GLOBALS_UPDATED, onGlobalsUpdated), () => context.channel.off(GLOBALS_UPDATED, onGlobalsUpdated);
|
|
1764
|
+
}, [context.channel]), [globals];
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
// src/addon-docs/blocks/blocks/usePrimaryStory.ts
|
|
1768
|
+
import { useContext as useContext7 } from "react";
|
|
1769
|
+
import { Tag } from "@aussieljk/forkbook/internal/preview-api";
|
|
1770
|
+
var usePrimaryStory = () => {
|
|
1771
|
+
let context = useContext7(DocsContext), stories = context.componentStories();
|
|
1772
|
+
return context.filterByAutodocs === !1 ? stories[0] : stories.find((story) => story.tags.includes(Tag.AUTODOCS));
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1775
|
+
// src/addon-docs/blocks/blocks/Controls.tsx
|
|
1776
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1777
|
+
function getControlsFilterProps(story, props) {
|
|
1778
|
+
let controlsParameters = story.parameters.docs?.controls || {};
|
|
1779
|
+
return {
|
|
1780
|
+
include: props.include ?? controlsParameters.include,
|
|
1781
|
+
exclude: props.exclude ?? controlsParameters.exclude,
|
|
1782
|
+
sort: props.sort ?? controlsParameters.sort
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
function useControlsInteractiveState(story, context) {
|
|
1786
|
+
let controlsId = useId2(), [args, updateArgs, resetArgs] = useArgs(story, context), [globals] = useGlobals(story, context);
|
|
1787
|
+
return { controlsId, args, globals, updateArgs, resetArgs };
|
|
1788
|
+
}
|
|
1789
|
+
var ControlsTables = ({
|
|
1790
|
+
mainName = "Story",
|
|
1791
|
+
mainRows,
|
|
1792
|
+
subcomponentRows,
|
|
1793
|
+
include,
|
|
1794
|
+
exclude,
|
|
1795
|
+
sort,
|
|
1796
|
+
storyId,
|
|
1797
|
+
controlsId,
|
|
1798
|
+
args,
|
|
1799
|
+
globals,
|
|
1800
|
+
updateArgs,
|
|
1801
|
+
resetArgs,
|
|
1802
|
+
docsLang
|
|
1803
|
+
}) => {
|
|
1804
|
+
let filteredMainRows = filterArgTypes2(mainRows, include, exclude);
|
|
1805
|
+
if (Object.keys(subcomponentRows).length === 0)
|
|
1806
|
+
return Object.keys(filteredMainRows).length > 0 || Object.keys(args).length > 0 ? jsx19(
|
|
1807
|
+
ArgsTable,
|
|
1808
|
+
{
|
|
1809
|
+
storyId,
|
|
1810
|
+
controlsId,
|
|
1811
|
+
rows: filteredMainRows,
|
|
1812
|
+
sort,
|
|
1813
|
+
args,
|
|
1814
|
+
globals,
|
|
1815
|
+
updateArgs,
|
|
1816
|
+
resetArgs,
|
|
1817
|
+
docsLang
|
|
1818
|
+
}
|
|
1819
|
+
) : null;
|
|
1820
|
+
let tabs = {
|
|
1821
|
+
[mainName]: { rows: filteredMainRows, sort },
|
|
1822
|
+
...Object.fromEntries(
|
|
1823
|
+
Object.entries(subcomponentRows).map(([key, rows]) => [
|
|
1824
|
+
key,
|
|
1825
|
+
{
|
|
1826
|
+
rows: filterArgTypes2(rows, include, exclude),
|
|
1827
|
+
sort
|
|
1828
|
+
}
|
|
1829
|
+
])
|
|
1830
|
+
)
|
|
1831
|
+
};
|
|
1832
|
+
return jsx19(
|
|
1833
|
+
TabbedArgsTable,
|
|
1834
|
+
{
|
|
1835
|
+
tabs,
|
|
1836
|
+
sort,
|
|
1837
|
+
args,
|
|
1838
|
+
globals,
|
|
1839
|
+
updateArgs,
|
|
1840
|
+
resetArgs,
|
|
1841
|
+
storyId,
|
|
1842
|
+
controlsId,
|
|
1843
|
+
docsLang
|
|
1844
|
+
}
|
|
1845
|
+
);
|
|
1846
|
+
}, LegacyControls = ({ story, context, ...props }) => {
|
|
1847
|
+
let { parameters, argTypes, component, subcomponents } = story, filterProps = getControlsFilterProps(story, props), interactiveState = useControlsInteractiveState(story, context);
|
|
1848
|
+
return argTypes ? jsx19(
|
|
1849
|
+
ControlsTables,
|
|
1850
|
+
{
|
|
1851
|
+
mainName: getComponentName(component) || "Story",
|
|
1852
|
+
mainRows: argTypes,
|
|
1853
|
+
subcomponentRows: extractSubcomponentArgTypes(subcomponents, parameters),
|
|
1854
|
+
...filterProps,
|
|
1855
|
+
storyId: story.id,
|
|
1856
|
+
...interactiveState,
|
|
1857
|
+
docsLang: parameters?.docs?.lang
|
|
1858
|
+
}
|
|
1859
|
+
) : null;
|
|
1860
|
+
}, DocgenServiceControls = ({ story, context, ...props }) => {
|
|
1861
|
+
let { parameters, argTypes } = story, filterProps = getControlsFilterProps(story, props), interactiveState = useControlsInteractiveState(story, context), { rows: serviceRows, isInitialLoading } = useDocgenServiceRows({
|
|
1862
|
+
componentId: story.id.split("--")[0],
|
|
1863
|
+
storyId: story.id,
|
|
1864
|
+
parameters,
|
|
1865
|
+
initialArgs: story.initialArgs,
|
|
1866
|
+
customArgTypes: argTypes
|
|
1867
|
+
});
|
|
1868
|
+
return isInitialLoading ? jsx19(ArgsTable, { isLoading: !0 }) : serviceRows ? jsx19(
|
|
1869
|
+
ControlsTables,
|
|
1870
|
+
{
|
|
1871
|
+
mainName: serviceRows.serviceComponentName,
|
|
1872
|
+
mainRows: serviceRows.mainRows,
|
|
1873
|
+
subcomponentRows: serviceRows.subcomponentRows,
|
|
1874
|
+
...filterProps,
|
|
1875
|
+
storyId: story.id,
|
|
1876
|
+
...interactiveState,
|
|
1877
|
+
docsLang: parameters?.docs?.lang
|
|
1878
|
+
}
|
|
1879
|
+
) : null;
|
|
1880
|
+
}, ControlsImpl = (props) => {
|
|
1881
|
+
let { of } = props, context = useContext8(DocsContext), primaryStory = usePrimaryStory(), story = of ? context.resolveOf(of, ["story"]).story : primaryStory;
|
|
1882
|
+
if (!story)
|
|
1883
|
+
return null;
|
|
1884
|
+
let storyProps = { ...props, story, context };
|
|
1885
|
+
return globalThis.FEATURES?.docgenServer ? jsx19(DocgenServiceControls, { ...storyProps }) : jsx19(LegacyControls, { ...storyProps });
|
|
1886
|
+
}, Controls = withMdxComponentOverride("Controls", ControlsImpl);
|
|
1887
|
+
|
|
1888
|
+
// src/addon-docs/blocks/blocks/Description.tsx
|
|
1889
|
+
import { useContext as useContext10 } from "react";
|
|
1890
|
+
import { InvalidBlockOfPropError as InvalidBlockOfPropError5 } from "@aussieljk/forkbook/internal/preview-errors";
|
|
1891
|
+
|
|
1892
|
+
// src/addon-docs/blocks/blocks/Markdown.tsx
|
|
1893
|
+
import { dedent } from "ts-dedent";
|
|
1894
|
+
|
|
1895
|
+
// src/addon-docs/blocks/blocks/mdx.tsx
|
|
1896
|
+
import React12, { useContext as useContext9 } from "react";
|
|
1897
|
+
import {
|
|
1898
|
+
Button as Button3,
|
|
1899
|
+
Code,
|
|
1900
|
+
components,
|
|
1901
|
+
nameSpaceClassNames
|
|
1902
|
+
} from "@aussieljk/forkbook/internal/components";
|
|
1903
|
+
import { NAVIGATE_URL as NAVIGATE_URL2 } from "@aussieljk/forkbook/internal/core-events";
|
|
1904
|
+
import { LinkIcon } from "@storybook/icons";
|
|
1905
|
+
|
|
1906
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/addon-docs/blocks/blocks/mdx.module.css
|
|
1907
|
+
var id10 = "core/src/addon-docs/blocks/blocks/mdx.module.css";
|
|
1908
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id10}"]`)) {
|
|
1909
|
+
let style = document.createElement("style");
|
|
1910
|
+
style.setAttribute("data-sb-css", id10), style.textContent = ".sb-HnuX0q-alignmentWrapper{display:block;position:relative;& svg{visibility:hidden}&:hover svg,&:focus-within svg{visibility:visible}}.sb-HnuX0q-anchorWrapper{line-height:inherit;color:inherit;padding-right:8px;position:absolute;top:50%;right:100%;& a{color:inherit;text-decoration:none}}.sb-HnuX0q-anchorWrapper.sb-HnuX0q-anchorWrapper{margin-top:-14px}", document.head.appendChild(style);
|
|
1911
|
+
}
|
|
1912
|
+
var mdx_default = { alignmentWrapper: "sb-HnuX0q-alignmentWrapper", anchorWrapper: "sb-HnuX0q-anchorWrapper" };
|
|
1913
|
+
|
|
1914
|
+
// src/addon-docs/blocks/blocks/mdx.tsx
|
|
1915
|
+
import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1916
|
+
var { document: document2 } = globalThis, assertIsFn = (val) => {
|
|
1917
|
+
if (typeof val != "function")
|
|
1918
|
+
throw new Error(`Expected story function, got: ${val}`);
|
|
1919
|
+
return val;
|
|
1920
|
+
}, AddContext = (props) => {
|
|
1921
|
+
let { children, ...rest } = props, parentContext = React12.useContext(DocsContext);
|
|
1922
|
+
return jsx20(DocsContext.Provider, { value: { ...parentContext, ...rest }, children });
|
|
1923
|
+
}, CodeOrSourceMdx = ({
|
|
1924
|
+
className,
|
|
1925
|
+
children,
|
|
1926
|
+
...rest
|
|
1927
|
+
}) => {
|
|
1928
|
+
if (typeof className != "string" && (typeof children != "string" || !children.match(/[\n\r]/g)))
|
|
1929
|
+
return jsx20(Code, { children });
|
|
1930
|
+
let language = className && className.split("-");
|
|
1931
|
+
return jsx20(
|
|
1932
|
+
Source,
|
|
1933
|
+
{
|
|
1934
|
+
language: language && language[1] || "text",
|
|
1935
|
+
format: !1,
|
|
1936
|
+
code: children,
|
|
1937
|
+
...rest
|
|
1938
|
+
}
|
|
1939
|
+
);
|
|
1940
|
+
};
|
|
1941
|
+
function navigate(context, url) {
|
|
1942
|
+
context.channel.emit(NAVIGATE_URL2, url);
|
|
1943
|
+
}
|
|
1944
|
+
var A = components.a, AnchorInPage = ({ hash, children }) => {
|
|
1945
|
+
let context = useContext9(DocsContext);
|
|
1946
|
+
return jsx20(
|
|
1947
|
+
A,
|
|
1948
|
+
{
|
|
1949
|
+
href: hash,
|
|
1950
|
+
target: "_self",
|
|
1951
|
+
onClick: (event) => {
|
|
1952
|
+
let id11 = hash.substring(1);
|
|
1953
|
+
document2.getElementById(id11) && navigate(context, hash);
|
|
1954
|
+
},
|
|
1955
|
+
children
|
|
1956
|
+
}
|
|
1957
|
+
);
|
|
1958
|
+
}, AnchorMdx = (props) => {
|
|
1959
|
+
let { href, target, children, ...rest } = props, context = useContext9(DocsContext);
|
|
1960
|
+
return !href || target === "_blank" || /^https?:\/\//.test(href) ? jsx20(A, { ...props }) : href.startsWith("#") ? jsx20(AnchorInPage, { hash: href, children }) : jsx20(
|
|
1961
|
+
A,
|
|
1962
|
+
{
|
|
1963
|
+
href,
|
|
1964
|
+
onClick: (event) => {
|
|
1965
|
+
event.button === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey && (event.preventDefault(), navigate(context, event.currentTarget.getAttribute("href") || ""));
|
|
1966
|
+
},
|
|
1967
|
+
target,
|
|
1968
|
+
...rest,
|
|
1969
|
+
children
|
|
1970
|
+
}
|
|
1971
|
+
);
|
|
1972
|
+
}, SUPPORTED_MDX_HEADERS = ["h1", "h2", "h3", "h4", "h5", "h6"], HeaderWithOcticonAnchor = ({
|
|
1973
|
+
as,
|
|
1974
|
+
id: id11,
|
|
1975
|
+
children,
|
|
1976
|
+
...rest
|
|
1977
|
+
}) => {
|
|
1978
|
+
let context = useContext9(DocsContext), OcticonHeader = as, hash = `#${id11}`;
|
|
1979
|
+
return jsx20(OcticonHeader, { id: id11, ...rest, children: jsxs9("span", { className: `${mdx_default.alignmentWrapper} sb-unstyled`, children: [
|
|
1980
|
+
jsx20("span", { className: mdx_default.anchorWrapper, children: jsx20(
|
|
1981
|
+
Button3,
|
|
1982
|
+
{
|
|
1983
|
+
asChild: !0,
|
|
1984
|
+
variant: "ghost",
|
|
1985
|
+
size: "small",
|
|
1986
|
+
padding: "small",
|
|
1987
|
+
ariaLabel: "Copy heading URL to address bar",
|
|
1988
|
+
children: jsx20(
|
|
1989
|
+
"a",
|
|
1990
|
+
{
|
|
1991
|
+
href: hash,
|
|
1992
|
+
target: "_self",
|
|
1993
|
+
onClick: (event) => {
|
|
1994
|
+
event.preventDefault(), document2.getElementById(id11) && navigate(context, hash);
|
|
1995
|
+
},
|
|
1996
|
+
children: jsx20(LinkIcon, {})
|
|
1997
|
+
}
|
|
1998
|
+
)
|
|
1999
|
+
}
|
|
2000
|
+
) }),
|
|
2001
|
+
children
|
|
2002
|
+
] }) });
|
|
2003
|
+
}, HeaderMdx = (props) => {
|
|
2004
|
+
let { as, id: id11, children, ...rest } = props;
|
|
2005
|
+
if (id11)
|
|
2006
|
+
return jsx20(HeaderWithOcticonAnchor, { as, id: id11, ...rest, children });
|
|
2007
|
+
let Component2 = as, { as: omittedAs, ...withoutAs } = props;
|
|
2008
|
+
return jsx20(Component2, { ...nameSpaceClassNames(withoutAs, as) });
|
|
2009
|
+
}, HeadersMdx = SUPPORTED_MDX_HEADERS.reduce(
|
|
2010
|
+
(acc, headerType) => ({
|
|
2011
|
+
...acc,
|
|
2012
|
+
// @ts-expect-error (Converted from ts-ignore)
|
|
2013
|
+
[headerType]: (props) => jsx20(HeaderMdx, { as: headerType, ...props })
|
|
2014
|
+
}),
|
|
2015
|
+
{}
|
|
2016
|
+
);
|
|
2017
|
+
|
|
2018
|
+
// src/addon-docs/blocks/blocks/Markdown.tsx
|
|
2019
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2020
|
+
var MarkdownImpl = (props) => {
|
|
2021
|
+
if (!props.children)
|
|
2022
|
+
return null;
|
|
2023
|
+
if (typeof props.children != "string")
|
|
2024
|
+
throw new Error(
|
|
2025
|
+
dedent`The Markdown block only accepts children as a single string, but children were of type: '${typeof props.children}'
|
|
2026
|
+
This is often caused by not wrapping the child in a template string.
|
|
2027
|
+
|
|
2028
|
+
This is invalid:
|
|
2029
|
+
<Markdown>
|
|
2030
|
+
# Some heading
|
|
2031
|
+
A paragraph
|
|
2032
|
+
</Markdown>
|
|
2033
|
+
|
|
2034
|
+
Instead do:
|
|
2035
|
+
<Markdown>
|
|
2036
|
+
{\`
|
|
2037
|
+
# Some heading
|
|
2038
|
+
A paragraph
|
|
2039
|
+
\`}
|
|
2040
|
+
</Markdown>
|
|
2041
|
+
`
|
|
2042
|
+
);
|
|
2043
|
+
return jsx21(
|
|
2044
|
+
index_modern_default,
|
|
2045
|
+
{
|
|
2046
|
+
...props,
|
|
2047
|
+
options: {
|
|
2048
|
+
forceBlock: !0,
|
|
2049
|
+
overrides: {
|
|
2050
|
+
code: CodeOrSourceMdx,
|
|
2051
|
+
a: AnchorMdx,
|
|
2052
|
+
...HeadersMdx,
|
|
2053
|
+
...props?.options?.overrides
|
|
2054
|
+
},
|
|
2055
|
+
...props?.options
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
);
|
|
2059
|
+
}, Markdown = withMdxComponentOverride("Markdown", MarkdownImpl);
|
|
2060
|
+
|
|
2061
|
+
// src/addon-docs/blocks/blocks/Description.tsx
|
|
2062
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2063
|
+
var DescriptionType = /* @__PURE__ */ ((DescriptionType2) => (DescriptionType2.INFO = "info", DescriptionType2.NOTES = "notes", DescriptionType2.DOCGEN = "docgen", DescriptionType2.AUTO = "auto", DescriptionType2))(DescriptionType || {}), getDescriptionFromResolvedOf = (resolvedOf, serviceComponentDescription, storyDocsDescription) => {
|
|
2064
|
+
switch (resolvedOf.type) {
|
|
2065
|
+
case "story": {
|
|
2066
|
+
let storyDescription = resolvedOf.story.parameters.docs?.description?.story;
|
|
2067
|
+
return storyDescription !== void 0 ? storyDescription : storyDocsDescription ?? null;
|
|
2068
|
+
}
|
|
2069
|
+
case "meta": {
|
|
2070
|
+
let { parameters, component } = resolvedOf.preparedMeta, metaDescription = parameters.docs?.description?.component;
|
|
2071
|
+
return metaDescription || parameters.docs?.extractComponentDescription?.(component, {
|
|
2072
|
+
component,
|
|
2073
|
+
parameters
|
|
2074
|
+
}) || serviceComponentDescription || null;
|
|
2075
|
+
}
|
|
2076
|
+
case "component": {
|
|
2077
|
+
let {
|
|
2078
|
+
component,
|
|
2079
|
+
projectAnnotations: { parameters }
|
|
2080
|
+
} = resolvedOf;
|
|
2081
|
+
return parameters?.docs?.extractComponentDescription?.(component, {
|
|
2082
|
+
component,
|
|
2083
|
+
parameters
|
|
2084
|
+
}) || serviceComponentDescription || null;
|
|
2085
|
+
}
|
|
2086
|
+
default:
|
|
2087
|
+
throw new Error(
|
|
2088
|
+
`Unrecognized module type resolved from 'useOf', got: ${resolvedOf.type}`
|
|
2089
|
+
);
|
|
2090
|
+
}
|
|
2091
|
+
}, DescriptionBody = ({ resolvedOf, serviceComponentDescription, lang, storyDocsDescription }) => {
|
|
2092
|
+
let markdown = getDescriptionFromResolvedOf(
|
|
2093
|
+
resolvedOf,
|
|
2094
|
+
serviceComponentDescription,
|
|
2095
|
+
storyDocsDescription
|
|
2096
|
+
);
|
|
2097
|
+
return markdown ? jsx22(Markdown, { lang, children: markdown }) : null;
|
|
2098
|
+
}, DescriptionStoryWithServices = ({ resolvedOf }) => {
|
|
2099
|
+
let storyDocsDescription = useServiceStoryDoc(resolvedOf.story.id).data?.description, lang = resolvedOf.story.parameters.docs?.lang || "en";
|
|
2100
|
+
return jsx22(
|
|
2101
|
+
DescriptionBody,
|
|
2102
|
+
{
|
|
2103
|
+
resolvedOf,
|
|
2104
|
+
storyDocsDescription,
|
|
2105
|
+
lang
|
|
2106
|
+
}
|
|
2107
|
+
);
|
|
2108
|
+
}, DescriptionComponentWithServices = ({ resolvedOf, componentId }) => {
|
|
2109
|
+
let serviceComponentDescription = useServiceDocgen(componentId).data?.description || void 0, lang = resolvedOf.type === "meta" ? resolvedOf.preparedMeta.parameters.docs?.lang || "en" : resolvedOf.projectAnnotations.parameters?.docs?.lang || "en";
|
|
2110
|
+
return jsx22(
|
|
2111
|
+
DescriptionBody,
|
|
2112
|
+
{
|
|
2113
|
+
resolvedOf,
|
|
2114
|
+
serviceComponentDescription,
|
|
2115
|
+
lang
|
|
2116
|
+
}
|
|
2117
|
+
);
|
|
2118
|
+
}, DescriptionImpl = (props) => {
|
|
2119
|
+
let { of } = props, context = useContext10(DocsContext);
|
|
2120
|
+
if ("of" in props && of === void 0)
|
|
2121
|
+
throw new InvalidBlockOfPropError5();
|
|
2122
|
+
let resolvedOf = useOf(of || "meta");
|
|
2123
|
+
if (globalThis.FEATURES?.docgenServer) {
|
|
2124
|
+
if (resolvedOf.type === "story")
|
|
2125
|
+
return jsx22(DescriptionStoryWithServices, { resolvedOf });
|
|
2126
|
+
let componentId = resolvedOf.type === "meta" ? resolvedOf.preparedMeta.componentId : context.getComponentId(resolvedOf.component);
|
|
2127
|
+
if (componentId)
|
|
2128
|
+
return jsx22(DescriptionComponentWithServices, { resolvedOf, componentId });
|
|
2129
|
+
}
|
|
2130
|
+
let lang = (resolvedOf.type === "story" ? resolvedOf.story.parameters : resolvedOf.type === "meta" ? resolvedOf.preparedMeta.parameters : resolvedOf.projectAnnotations.parameters)?.docs?.lang || "en";
|
|
2131
|
+
return jsx22(DescriptionBody, { resolvedOf, lang });
|
|
2132
|
+
}, Description = withMdxComponentOverride("Description", DescriptionImpl);
|
|
2133
|
+
|
|
2134
|
+
// src/addon-docs/blocks/blocks/DocsContainer.tsx
|
|
2135
|
+
import { useEffect as useEffect9, useMemo as useMemo3 } from "react";
|
|
2136
|
+
import { ensure as ensureTheme, ThemeProvider } from "@aussieljk/forkbook/theming";
|
|
2137
|
+
|
|
2138
|
+
// src/addon-docs/blocks/blocks/DocsSluggerContext.ts
|
|
2139
|
+
import { createContext as createContext4 } from "react";
|
|
2140
|
+
|
|
2141
|
+
// ../../node_modules/github-slugger/regex.js
|
|
2142
|
+
var regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g;
|
|
2143
|
+
|
|
2144
|
+
// ../../node_modules/github-slugger/index.js
|
|
2145
|
+
var own = Object.hasOwnProperty, BananaSlug = class {
|
|
2146
|
+
/**
|
|
2147
|
+
* Create a new slug class.
|
|
2148
|
+
*/
|
|
2149
|
+
constructor() {
|
|
2150
|
+
this.occurrences, this.reset();
|
|
2151
|
+
}
|
|
2152
|
+
/**
|
|
2153
|
+
* Generate a unique slug.
|
|
2154
|
+
*
|
|
2155
|
+
* Tracks previously generated slugs: repeated calls with the same value
|
|
2156
|
+
* will result in different slugs.
|
|
2157
|
+
* Use the `slug` function to get same slugs.
|
|
2158
|
+
*
|
|
2159
|
+
* @param {string} value
|
|
2160
|
+
* String of text to slugify
|
|
2161
|
+
* @param {boolean} [maintainCase=false]
|
|
2162
|
+
* Keep the current case, otherwise make all lowercase
|
|
2163
|
+
* @return {string}
|
|
2164
|
+
* A unique slug string
|
|
2165
|
+
*/
|
|
2166
|
+
slug(value, maintainCase) {
|
|
2167
|
+
let self = this, result = slug(value, maintainCase === !0), originalSlug = result;
|
|
2168
|
+
for (; own.call(self.occurrences, result); )
|
|
2169
|
+
self.occurrences[originalSlug]++, result = originalSlug + "-" + self.occurrences[originalSlug];
|
|
2170
|
+
return self.occurrences[result] = 0, result;
|
|
2171
|
+
}
|
|
2172
|
+
/**
|
|
2173
|
+
* Reset - Forget all previous slugs
|
|
2174
|
+
*
|
|
2175
|
+
* @return void
|
|
2176
|
+
*/
|
|
2177
|
+
reset() {
|
|
2178
|
+
this.occurrences = /* @__PURE__ */ Object.create(null);
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
function slug(value, maintainCase) {
|
|
2182
|
+
return typeof value != "string" ? "" : (maintainCase || (value = value.toLowerCase()), value.replace(regex, "").replace(/ /g, "-"));
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
// src/addon-docs/blocks/blocks/DocsSluggerContext.ts
|
|
2186
|
+
var createDocsSlugger = () => new BananaSlug(), DocsSluggerContext = createContext4(
|
|
2187
|
+
null
|
|
2188
|
+
);
|
|
2189
|
+
|
|
2190
|
+
// src/addon-docs/blocks/blocks/DocsContainer.tsx
|
|
2191
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2192
|
+
var { document: document3, window: globalWindow2 } = globalThis, DocsContainer = ({
|
|
2193
|
+
context,
|
|
2194
|
+
theme,
|
|
2195
|
+
children
|
|
2196
|
+
}) => {
|
|
2197
|
+
let slugger = useMemo3(() => createDocsSlugger(), []), toc, lang;
|
|
2198
|
+
try {
|
|
2199
|
+
let metaParameters = context.resolveOf("meta", ["meta"]).preparedMeta.parameters;
|
|
2200
|
+
toc = metaParameters?.docs?.toc, lang = metaParameters?.docs?.lang || "en";
|
|
2201
|
+
} catch {
|
|
2202
|
+
toc = context?.projectAnnotations?.parameters?.docs?.toc, lang = context?.projectAnnotations?.parameters?.docs?.lang || "en";
|
|
2203
|
+
}
|
|
2204
|
+
return useEffect9(() => {
|
|
2205
|
+
let url;
|
|
2206
|
+
try {
|
|
2207
|
+
if (url = new URL(globalWindow2.parent.location.toString()), url.hash) {
|
|
2208
|
+
let element = document3.getElementById(decodeURIComponent(url.hash.substring(1)));
|
|
2209
|
+
element && setTimeout(() => {
|
|
2210
|
+
scrollToElement(element);
|
|
2211
|
+
}, 200);
|
|
2212
|
+
}
|
|
2213
|
+
} catch {
|
|
2214
|
+
}
|
|
2215
|
+
}), jsx23(DocsSluggerContext.Provider, { value: slugger, children: jsx23(DocsContext.Provider, { value: context, children: jsx23(SourceContainer, { channel: context.channel, children: jsx23(ThemeProvider, { theme: ensureTheme(theme), children: jsx23(
|
|
2216
|
+
DocsPageWrapper,
|
|
2217
|
+
{
|
|
2218
|
+
lang,
|
|
2219
|
+
toc: toc ? jsx23(
|
|
2220
|
+
TableOfContents,
|
|
2221
|
+
{
|
|
2222
|
+
className: "sbdocs sbdocs-toc--custom",
|
|
2223
|
+
channel: context.channel,
|
|
2224
|
+
...toc
|
|
2225
|
+
}
|
|
2226
|
+
) : null,
|
|
2227
|
+
children
|
|
2228
|
+
}
|
|
2229
|
+
) }) }) }) });
|
|
2230
|
+
};
|
|
2231
|
+
|
|
2232
|
+
// src/addon-docs/blocks/blocks/Subheading.tsx
|
|
2233
|
+
import React16 from "react";
|
|
2234
|
+
import { H3 } from "@aussieljk/forkbook/internal/components";
|
|
2235
|
+
|
|
2236
|
+
// src/addon-docs/blocks/blocks/Heading.tsx
|
|
2237
|
+
import React15 from "react";
|
|
2238
|
+
import { H2 } from "@aussieljk/forkbook/internal/components";
|
|
2239
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2240
|
+
var slugs = new BananaSlug(), HeadingImpl = ({
|
|
2241
|
+
children,
|
|
2242
|
+
disableAnchor,
|
|
2243
|
+
...props
|
|
2244
|
+
}) => {
|
|
2245
|
+
if (disableAnchor || typeof children != "string")
|
|
2246
|
+
return jsx24(H2, { children });
|
|
2247
|
+
let tagID = (React15.useContext(DocsSluggerContext) ?? slugs).slug(children.toLowerCase());
|
|
2248
|
+
return jsx24(HeaderMdx, { as: "h2", id: tagID, ...props, children });
|
|
2249
|
+
}, Heading = withMdxComponentOverride("Heading", HeadingImpl);
|
|
2250
|
+
|
|
2251
|
+
// src/addon-docs/blocks/blocks/Subheading.tsx
|
|
2252
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2253
|
+
var SubheadingImpl = ({ children, disableAnchor }) => {
|
|
2254
|
+
if (disableAnchor || typeof children != "string")
|
|
2255
|
+
return jsx25(H3, { children });
|
|
2256
|
+
let tagID = (React16.useContext(DocsSluggerContext) ?? slugs).slug(children.toLowerCase());
|
|
2257
|
+
return jsx25(HeaderMdx, { as: "h3", id: tagID, children });
|
|
2258
|
+
}, Subheading = withMdxComponentOverride("Subheading", SubheadingImpl);
|
|
2259
|
+
|
|
2260
|
+
// src/addon-docs/blocks/blocks/DocsStory.tsx
|
|
2261
|
+
import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2262
|
+
var DocsStoryImpl = ({
|
|
2263
|
+
of,
|
|
2264
|
+
expanded = !0,
|
|
2265
|
+
withToolbar: withToolbarProp = !1,
|
|
2266
|
+
__forceInitialArgs = !1,
|
|
2267
|
+
__primary = !1
|
|
2268
|
+
}) => {
|
|
2269
|
+
let { story } = useOf(of || "story", ["story"]), withToolbar = story.parameters.docs?.canvas?.withToolbar ?? withToolbarProp;
|
|
2270
|
+
return jsxs10(Anchor, { storyId: __primary ? `primary--${story.id}` : story.id, children: [
|
|
2271
|
+
expanded && jsxs10(Fragment4, { children: [
|
|
2272
|
+
jsx26(Subheading, { children: story.name }),
|
|
2273
|
+
jsx26(Description, { of })
|
|
2274
|
+
] }),
|
|
2275
|
+
jsx26(
|
|
2276
|
+
Canvas,
|
|
2277
|
+
{
|
|
2278
|
+
of,
|
|
2279
|
+
withToolbar,
|
|
2280
|
+
story: { __forceInitialArgs, __primary },
|
|
2281
|
+
source: { __forceInitialArgs }
|
|
2282
|
+
}
|
|
2283
|
+
)
|
|
2284
|
+
] });
|
|
2285
|
+
}, DocsStory = withMdxComponentOverride("DocsStory", DocsStoryImpl);
|
|
2286
|
+
|
|
2287
|
+
// src/addon-docs/blocks/blocks/Primary.tsx
|
|
2288
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
2289
|
+
var PrimaryImpl = () => {
|
|
2290
|
+
let primaryStory = usePrimaryStory();
|
|
2291
|
+
return primaryStory ? jsx27(DocsStory, { of: primaryStory.moduleExport, expanded: !1, __primary: !0, withToolbar: !0 }) : null;
|
|
2292
|
+
}, Primary = withMdxComponentOverride("Primary", PrimaryImpl);
|
|
2293
|
+
|
|
2294
|
+
// src/addon-docs/blocks/blocks/Stories.tsx
|
|
2295
|
+
import { useContext as useContext11 } from "react";
|
|
2296
|
+
import { Tag as Tag2 } from "@aussieljk/forkbook/internal/preview-api";
|
|
2297
|
+
import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2298
|
+
var StoriesImpl = ({ title = "Stories", includePrimary = !0 }) => {
|
|
2299
|
+
let { componentStories, projectAnnotations, getStoryContext } = useContext11(DocsContext), stories = componentStories(), filter = projectAnnotations.parameters?.docs?.stories?.filter;
|
|
2300
|
+
return filter && (stories = stories.filter((story) => filter(story, getStoryContext(story)))), stories.some((story) => story.tags?.includes(Tag2.AUTODOCS)) && (stories = stories.filter((story) => story.tags?.includes(Tag2.AUTODOCS) && !story.usesMount)), includePrimary || (stories = stories.slice(1)), !stories || stories.length === 0 ? null : jsxs11(Fragment5, { children: [
|
|
2301
|
+
typeof title == "string" ? jsx28(Heading, { children: title }) : title,
|
|
2302
|
+
stories.map(
|
|
2303
|
+
(story) => story && jsx28(DocsStory, { of: story.moduleExport, expanded: !0, __forceInitialArgs: !0 }, story.id)
|
|
2304
|
+
)
|
|
2305
|
+
] });
|
|
2306
|
+
}, Stories = withMdxComponentOverride("Stories", StoriesImpl);
|
|
2307
|
+
|
|
2308
|
+
// src/addon-docs/blocks/blocks/Subtitle.tsx
|
|
2309
|
+
import { InvalidBlockOfPropError as InvalidBlockOfPropError6 } from "@aussieljk/forkbook/internal/preview-errors";
|
|
2310
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2311
|
+
var SubtitleImpl = (props) => {
|
|
2312
|
+
let { of, children } = props;
|
|
2313
|
+
if ("of" in props && of === void 0)
|
|
2314
|
+
throw new InvalidBlockOfPropError6();
|
|
2315
|
+
let preparedMeta;
|
|
2316
|
+
try {
|
|
2317
|
+
preparedMeta = useOf(of || "meta", ["meta"]).preparedMeta;
|
|
2318
|
+
} catch (error) {
|
|
2319
|
+
if (children && !error.message.includes("did you forget to use <Meta of={} />?"))
|
|
2320
|
+
throw error;
|
|
2321
|
+
}
|
|
2322
|
+
let content = children || preparedMeta?.parameters?.docs?.subtitle;
|
|
2323
|
+
return content ? jsx29(Subtitle, { className: "sbdocs-subtitle sb-unstyled", children: content }) : null;
|
|
2324
|
+
}, Subtitle2 = withMdxComponentOverride("Subtitle", SubtitleImpl);
|
|
2325
|
+
|
|
2326
|
+
// src/addon-docs/blocks/blocks/Title.tsx
|
|
2327
|
+
import { InvalidBlockOfPropError as InvalidBlockOfPropError7 } from "@aussieljk/forkbook/internal/preview-errors";
|
|
2328
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2329
|
+
var STORY_KIND_PATH_SEPARATOR = /\s*\/\s*/, extractTitle = (title) => {
|
|
2330
|
+
let groups = title.trim().split(STORY_KIND_PATH_SEPARATOR);
|
|
2331
|
+
return groups?.[groups?.length - 1] || title;
|
|
2332
|
+
}, TitleImpl = (props) => {
|
|
2333
|
+
let { children, of } = props;
|
|
2334
|
+
if ("of" in props && of === void 0)
|
|
2335
|
+
throw new InvalidBlockOfPropError7();
|
|
2336
|
+
let preparedMeta;
|
|
2337
|
+
try {
|
|
2338
|
+
preparedMeta = useOf(of || "meta", ["meta"]).preparedMeta;
|
|
2339
|
+
} catch (error) {
|
|
2340
|
+
if (children && error instanceof Error && !error.message.includes("did you forget to use <Meta of={} />?"))
|
|
2341
|
+
throw error;
|
|
2342
|
+
}
|
|
2343
|
+
let content = children || extractTitle(preparedMeta?.title || "");
|
|
2344
|
+
return content ? jsx30(Title, { className: "sbdocs-title sb-unstyled", children: content }) : null;
|
|
2345
|
+
}, Title3 = withMdxComponentOverride("Title", TitleImpl);
|
|
2346
|
+
|
|
2347
|
+
// src/addon-docs/blocks/blocks/DocsPage.tsx
|
|
2348
|
+
import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2349
|
+
var DocsPage = () => {
|
|
2350
|
+
let resolvedOf = useOf("meta", ["meta"]), { stories } = resolvedOf.csfFile, isSingleStory = Object.keys(stories).length === 1;
|
|
2351
|
+
return jsxs12(Fragment6, { children: [
|
|
2352
|
+
jsx31(Title3, {}),
|
|
2353
|
+
jsx31(Subtitle2, {}),
|
|
2354
|
+
jsx31(Description, { of: "meta" }),
|
|
2355
|
+
isSingleStory ? jsx31(Description, { of: "story" }) : null,
|
|
2356
|
+
jsx31(Primary, {}),
|
|
2357
|
+
jsx31(Controls, {}),
|
|
2358
|
+
isSingleStory ? null : jsx31(Stories, {})
|
|
2359
|
+
] });
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2362
|
+
// src/addon-docs/blocks/blocks/Docs.tsx
|
|
2363
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2364
|
+
function Docs({
|
|
2365
|
+
context,
|
|
2366
|
+
docsParameter
|
|
2367
|
+
}) {
|
|
2368
|
+
let Container = docsParameter.container || DocsContainer, Page = docsParameter.page || DocsPage;
|
|
2369
|
+
return jsx32(Container, { context, theme: docsParameter.theme, children: jsx32(Page, {}) });
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
// src/addon-docs/blocks/blocks/Meta.tsx
|
|
2373
|
+
import { useContext as useContext12 } from "react";
|
|
2374
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2375
|
+
var Meta = ({ of }) => {
|
|
2376
|
+
let context = useContext12(DocsContext);
|
|
2377
|
+
of && context.referenceMeta(of, !0);
|
|
2378
|
+
try {
|
|
2379
|
+
let primary = context.storyById();
|
|
2380
|
+
return jsx33(Anchor, { storyId: primary.id });
|
|
2381
|
+
} catch {
|
|
2382
|
+
return null;
|
|
2383
|
+
}
|
|
2384
|
+
};
|
|
2385
|
+
|
|
2386
|
+
// src/addon-docs/blocks/blocks/Unstyled.tsx
|
|
2387
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2388
|
+
var UnstyledImpl = (props) => jsx34("div", { ...props, className: "sb-unstyled" }), Unstyled = withMdxComponentOverride("Unstyled", UnstyledImpl);
|
|
2389
|
+
|
|
2390
|
+
// src/addon-docs/blocks/blocks/Wrapper.tsx
|
|
2391
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
2392
|
+
var WrapperImpl = ({ children }) => jsx35("div", { style: { fontFamily: "sans-serif" }, children }), Wrapper = withMdxComponentOverride("Wrapper", WrapperImpl);
|
|
2393
|
+
|
|
2394
|
+
// src/addon-docs/blocks/blocks/types.ts
|
|
2395
|
+
var PRIMARY_STORY = "^";
|
|
2396
|
+
export {
|
|
2397
|
+
AddContext,
|
|
2398
|
+
Anchor,
|
|
2399
|
+
AnchorMdx,
|
|
2400
|
+
ArgTypes,
|
|
2401
|
+
BooleanControl,
|
|
2402
|
+
Canvas,
|
|
2403
|
+
CodeOrSourceMdx,
|
|
2404
|
+
ColorControl,
|
|
2405
|
+
ColorItem,
|
|
2406
|
+
ColorPalette,
|
|
2407
|
+
Controls,
|
|
2408
|
+
DateControl,
|
|
2409
|
+
Description,
|
|
2410
|
+
DescriptionType,
|
|
2411
|
+
Docs,
|
|
2412
|
+
DocsContainer,
|
|
2413
|
+
DocsContext,
|
|
2414
|
+
DocsPage,
|
|
2415
|
+
DocsStory,
|
|
2416
|
+
FilesControl,
|
|
2417
|
+
HeaderMdx,
|
|
2418
|
+
HeadersMdx,
|
|
2419
|
+
Heading,
|
|
2420
|
+
IconGallery,
|
|
2421
|
+
IconItem,
|
|
2422
|
+
Markdown,
|
|
2423
|
+
Meta,
|
|
2424
|
+
NumberControl,
|
|
2425
|
+
ObjectControl,
|
|
2426
|
+
OptionsControl,
|
|
2427
|
+
PRIMARY_STORY,
|
|
2428
|
+
Primary,
|
|
2429
|
+
ArgsTable as PureArgsTable,
|
|
2430
|
+
RangeControl,
|
|
2431
|
+
Source2 as Source,
|
|
2432
|
+
SourceContainer,
|
|
2433
|
+
SourceContext,
|
|
2434
|
+
Stories,
|
|
2435
|
+
Story2 as Story,
|
|
2436
|
+
Subheading,
|
|
2437
|
+
Subtitle2 as Subtitle,
|
|
2438
|
+
TableOfContents,
|
|
2439
|
+
TextControl,
|
|
2440
|
+
Title3 as Title,
|
|
2441
|
+
Typeset,
|
|
2442
|
+
UNKNOWN_ARGS_HASH,
|
|
2443
|
+
Unstyled,
|
|
2444
|
+
Wrapper,
|
|
2445
|
+
anchorBlockIdFromId,
|
|
2446
|
+
argsHash,
|
|
2447
|
+
assertIsFn,
|
|
2448
|
+
extractTitle,
|
|
2449
|
+
format,
|
|
2450
|
+
formatDate,
|
|
2451
|
+
formatTime,
|
|
2452
|
+
getStoryId,
|
|
2453
|
+
getStoryProps,
|
|
2454
|
+
normalizeOptions,
|
|
2455
|
+
parse,
|
|
2456
|
+
parseDate,
|
|
2457
|
+
parseTime,
|
|
2458
|
+
slugs,
|
|
2459
|
+
useOf,
|
|
2460
|
+
useSourceProps
|
|
2461
|
+
};
|