@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,4168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ADDON_ID as ADDON_ID6,
|
|
3
|
+
DOCUMENTATION_DISCREPANCY_LINK,
|
|
4
|
+
DOCUMENTATION_PLAY_FUNCTION_LINK,
|
|
5
|
+
FORKBOOK_ADDON_TEST_CHANNEL,
|
|
6
|
+
INTERNAL_RENDER_CALL_ID,
|
|
7
|
+
PANEL_ID as PANEL_ID2,
|
|
8
|
+
PARAM_KEY as PARAM_KEY5,
|
|
9
|
+
STATUS_TYPE_ID_COMPONENT_TEST
|
|
10
|
+
} from "../../_browser-chunks/chunk-MLBOOZL4.js";
|
|
11
|
+
import "../../_browser-chunks/chunk-OZZPSYQR.js";
|
|
12
|
+
import {
|
|
13
|
+
ArgsTable
|
|
14
|
+
} from "../../_browser-chunks/chunk-JYVGARBG.js";
|
|
15
|
+
import "../../_browser-chunks/chunk-PJSMZ27A.js";
|
|
16
|
+
import "../../_browser-chunks/chunk-PFRNG3UC.js";
|
|
17
|
+
import {
|
|
18
|
+
defineService
|
|
19
|
+
} from "../../_browser-chunks/chunk-ZEHRUHTA.js";
|
|
20
|
+
import {
|
|
21
|
+
announce
|
|
22
|
+
} from "../../_browser-chunks/chunk-KBK7GKBN.js";
|
|
23
|
+
import "../../_browser-chunks/chunk-CNED6RYH.js";
|
|
24
|
+
import {
|
|
25
|
+
dequal,
|
|
26
|
+
registerService
|
|
27
|
+
} from "../../_browser-chunks/chunk-JMC7AIKT.js";
|
|
28
|
+
import "../../_browser-chunks/chunk-4ATQOMJB.js";
|
|
29
|
+
import {
|
|
30
|
+
ADDON_ID as ADDON_ID4,
|
|
31
|
+
ADDON_ID2 as ADDON_ID5,
|
|
32
|
+
PARAM_KEY2 as PARAM_KEY4,
|
|
33
|
+
TOOL_ID as TOOL_ID2,
|
|
34
|
+
docgenServiceDef
|
|
35
|
+
} from "../../_browser-chunks/chunk-NQUD4B7H.js";
|
|
36
|
+
import {
|
|
37
|
+
EVENTS
|
|
38
|
+
} from "../../_browser-chunks/chunk-TBJCJXK4.js";
|
|
39
|
+
import {
|
|
40
|
+
require_ansi_to_html,
|
|
41
|
+
resolveViewport
|
|
42
|
+
} from "../../_browser-chunks/chunk-FENFYI4X.js";
|
|
43
|
+
import "../../_browser-chunks/chunk-YTIT5NA5.js";
|
|
44
|
+
import "../../_browser-chunks/chunk-OD6IBQCC.js";
|
|
45
|
+
import "../../_browser-chunks/chunk-QC4HFS6K.js";
|
|
46
|
+
import "../../_browser-chunks/chunk-6SXYJQST.js";
|
|
47
|
+
import {
|
|
48
|
+
mergeServiceArgTypes
|
|
49
|
+
} from "../../_browser-chunks/chunk-ODVJ3XZJ.js";
|
|
50
|
+
import "../../_browser-chunks/chunk-2JDQ35OA.js";
|
|
51
|
+
import "../../_browser-chunks/chunk-IE4ULIOQ.js";
|
|
52
|
+
import "../../_browser-chunks/chunk-B4AUNNU4.js";
|
|
53
|
+
import "../../_browser-chunks/chunk-NZMVUW5T.js";
|
|
54
|
+
import "../../_browser-chunks/chunk-JWSKPMPC.js";
|
|
55
|
+
import "../../_browser-chunks/chunk-JPUOQJUI.js";
|
|
56
|
+
import {
|
|
57
|
+
ADDON_ID,
|
|
58
|
+
MINIMAL_VIEWPORTS,
|
|
59
|
+
PARAM_KEY,
|
|
60
|
+
TOOL_ID
|
|
61
|
+
} from "../../_browser-chunks/chunk-QDXFODK4.js";
|
|
62
|
+
import "../../_browser-chunks/chunk-RSPAQWVJ.js";
|
|
63
|
+
import "../../_browser-chunks/chunk-V5M7Q4HT.js";
|
|
64
|
+
import "../../_browser-chunks/chunk-SC67XZST.js";
|
|
65
|
+
import {
|
|
66
|
+
ADDON_ID as ADDON_ID2,
|
|
67
|
+
CLEAR_ID,
|
|
68
|
+
EVENT_ID,
|
|
69
|
+
PANEL_ID,
|
|
70
|
+
PARAM_KEY as PARAM_KEY2
|
|
71
|
+
} from "../../_browser-chunks/chunk-V2G23FV7.js";
|
|
72
|
+
import {
|
|
73
|
+
ADDON_ID as ADDON_ID3,
|
|
74
|
+
DEFAULT_BACKGROUNDS,
|
|
75
|
+
PARAM_KEY as PARAM_KEY3
|
|
76
|
+
} from "../../_browser-chunks/chunk-LAWXTSXK.js";
|
|
77
|
+
import {
|
|
78
|
+
__commonJS,
|
|
79
|
+
__toESM
|
|
80
|
+
} from "../../_browser-chunks/chunk-IMSF75WX.js";
|
|
81
|
+
|
|
82
|
+
// ../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/extends.js
|
|
83
|
+
var require_extends = __commonJS({
|
|
84
|
+
"../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/extends.js"(exports, module) {
|
|
85
|
+
function _extends6() {
|
|
86
|
+
return module.exports = _extends6 = Object.assign || function(target) {
|
|
87
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
88
|
+
var source = arguments[i];
|
|
89
|
+
for (var key in source)
|
|
90
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
91
|
+
}
|
|
92
|
+
return target;
|
|
93
|
+
}, _extends6.apply(this, arguments);
|
|
94
|
+
}
|
|
95
|
+
module.exports = _extends6;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// ../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js
|
|
100
|
+
var require_objectWithoutPropertiesLoose = __commonJS({
|
|
101
|
+
"../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
|
|
102
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
103
|
+
if (source == null) return {};
|
|
104
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
105
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
106
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
107
|
+
return target;
|
|
108
|
+
}
|
|
109
|
+
module.exports = _objectWithoutPropertiesLoose;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// ../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
114
|
+
var require_objectWithoutProperties = __commonJS({
|
|
115
|
+
"../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/objectWithoutProperties.js"(exports, module) {
|
|
116
|
+
var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
|
|
117
|
+
function _objectWithoutProperties7(source, excluded) {
|
|
118
|
+
if (source == null) return {};
|
|
119
|
+
var target = objectWithoutPropertiesLoose(source, excluded), key, i;
|
|
120
|
+
if (Object.getOwnPropertySymbols) {
|
|
121
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
122
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
123
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
124
|
+
}
|
|
125
|
+
return target;
|
|
126
|
+
}
|
|
127
|
+
module.exports = _objectWithoutProperties7;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// ../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/defineProperty.js
|
|
132
|
+
var require_defineProperty = __commonJS({
|
|
133
|
+
"../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/defineProperty.js"(exports, module) {
|
|
134
|
+
function _defineProperty(obj, key, value) {
|
|
135
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
136
|
+
value,
|
|
137
|
+
enumerable: !0,
|
|
138
|
+
configurable: !0,
|
|
139
|
+
writable: !0
|
|
140
|
+
}) : obj[key] = value, obj;
|
|
141
|
+
}
|
|
142
|
+
module.exports = _defineProperty;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// ../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
147
|
+
var require_objectSpread2 = __commonJS({
|
|
148
|
+
"../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/objectSpread2.js"(exports, module) {
|
|
149
|
+
var defineProperty = require_defineProperty();
|
|
150
|
+
function ownKeys(object2, enumerableOnly) {
|
|
151
|
+
var keys = Object.keys(object2);
|
|
152
|
+
if (Object.getOwnPropertySymbols) {
|
|
153
|
+
var symbols = Object.getOwnPropertySymbols(object2);
|
|
154
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
155
|
+
return Object.getOwnPropertyDescriptor(object2, sym).enumerable;
|
|
156
|
+
})), keys.push.apply(keys, symbols);
|
|
157
|
+
}
|
|
158
|
+
return keys;
|
|
159
|
+
}
|
|
160
|
+
function _objectSpread22(target) {
|
|
161
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
162
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
163
|
+
i % 2 ? ownKeys(source, !0).forEach(function(key) {
|
|
164
|
+
defineProperty(target, key, source[key]);
|
|
165
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(source).forEach(function(key) {
|
|
166
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return target;
|
|
170
|
+
}
|
|
171
|
+
module.exports = _objectSpread22;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// ../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js
|
|
176
|
+
var require_objectWithoutPropertiesLoose2 = __commonJS({
|
|
177
|
+
"../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
|
|
178
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
179
|
+
if (source == null) return {};
|
|
180
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
181
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
182
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
183
|
+
return target;
|
|
184
|
+
}
|
|
185
|
+
module.exports = _objectWithoutPropertiesLoose;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// ../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
190
|
+
var require_objectWithoutProperties2 = __commonJS({
|
|
191
|
+
"../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/objectWithoutProperties.js"(exports, module) {
|
|
192
|
+
var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose2();
|
|
193
|
+
function _objectWithoutProperties7(source, excluded) {
|
|
194
|
+
if (source == null) return {};
|
|
195
|
+
var target = objectWithoutPropertiesLoose(source, excluded), key, i;
|
|
196
|
+
if (Object.getOwnPropertySymbols) {
|
|
197
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
198
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
199
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
200
|
+
}
|
|
201
|
+
return target;
|
|
202
|
+
}
|
|
203
|
+
module.exports = _objectWithoutProperties7;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// ../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/extends.js
|
|
208
|
+
var require_extends2 = __commonJS({
|
|
209
|
+
"../../node_modules/@devtools-ds/themes/node_modules/@babel/runtime/helpers/extends.js"(exports, module) {
|
|
210
|
+
function _extends6() {
|
|
211
|
+
return module.exports = _extends6 = Object.assign || function(target) {
|
|
212
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
213
|
+
var source = arguments[i];
|
|
214
|
+
for (var key in source)
|
|
215
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
216
|
+
}
|
|
217
|
+
return target;
|
|
218
|
+
}, _extends6.apply(this, arguments);
|
|
219
|
+
}
|
|
220
|
+
module.exports = _extends6;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// ../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/defineProperty.js
|
|
225
|
+
var require_defineProperty2 = __commonJS({
|
|
226
|
+
"../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/defineProperty.js"(exports, module) {
|
|
227
|
+
function _defineProperty(obj, key, value) {
|
|
228
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
229
|
+
value,
|
|
230
|
+
enumerable: !0,
|
|
231
|
+
configurable: !0,
|
|
232
|
+
writable: !0
|
|
233
|
+
}) : obj[key] = value, obj;
|
|
234
|
+
}
|
|
235
|
+
module.exports = _defineProperty;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// ../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
240
|
+
var require_objectSpread22 = __commonJS({
|
|
241
|
+
"../../node_modules/@devtools-ds/object-inspector/node_modules/@babel/runtime/helpers/objectSpread2.js"(exports, module) {
|
|
242
|
+
var defineProperty = require_defineProperty2();
|
|
243
|
+
function ownKeys(object2, enumerableOnly) {
|
|
244
|
+
var keys = Object.keys(object2);
|
|
245
|
+
if (Object.getOwnPropertySymbols) {
|
|
246
|
+
var symbols = Object.getOwnPropertySymbols(object2);
|
|
247
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
248
|
+
return Object.getOwnPropertyDescriptor(object2, sym).enumerable;
|
|
249
|
+
})), keys.push.apply(keys, symbols);
|
|
250
|
+
}
|
|
251
|
+
return keys;
|
|
252
|
+
}
|
|
253
|
+
function _objectSpread22(target) {
|
|
254
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
255
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
256
|
+
i % 2 ? ownKeys(source, !0).forEach(function(key) {
|
|
257
|
+
defineProperty(target, key, source[key]);
|
|
258
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(source).forEach(function(key) {
|
|
259
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
return target;
|
|
263
|
+
}
|
|
264
|
+
module.exports = _objectSpread22;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// ../../node_modules/@devtools-ds/tree/node_modules/@babel/runtime/helpers/extends.js
|
|
269
|
+
var require_extends3 = __commonJS({
|
|
270
|
+
"../../node_modules/@devtools-ds/tree/node_modules/@babel/runtime/helpers/extends.js"(exports, module) {
|
|
271
|
+
function _extends6() {
|
|
272
|
+
return module.exports = _extends6 = Object.assign || function(target) {
|
|
273
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
274
|
+
var source = arguments[i];
|
|
275
|
+
for (var key in source)
|
|
276
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
277
|
+
}
|
|
278
|
+
return target;
|
|
279
|
+
}, _extends6.apply(this, arguments);
|
|
280
|
+
}
|
|
281
|
+
module.exports = _extends6;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
// ../../node_modules/@devtools-ds/tree/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js
|
|
286
|
+
var require_objectWithoutPropertiesLoose3 = __commonJS({
|
|
287
|
+
"../../node_modules/@devtools-ds/tree/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
|
|
288
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
289
|
+
if (source == null) return {};
|
|
290
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
291
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
292
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
293
|
+
return target;
|
|
294
|
+
}
|
|
295
|
+
module.exports = _objectWithoutPropertiesLoose;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// ../../node_modules/@devtools-ds/tree/node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
300
|
+
var require_objectWithoutProperties3 = __commonJS({
|
|
301
|
+
"../../node_modules/@devtools-ds/tree/node_modules/@babel/runtime/helpers/objectWithoutProperties.js"(exports, module) {
|
|
302
|
+
var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose3();
|
|
303
|
+
function _objectWithoutProperties7(source, excluded) {
|
|
304
|
+
if (source == null) return {};
|
|
305
|
+
var target = objectWithoutPropertiesLoose(source, excluded), key, i;
|
|
306
|
+
if (Object.getOwnPropertySymbols) {
|
|
307
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
308
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
309
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
310
|
+
}
|
|
311
|
+
return target;
|
|
312
|
+
}
|
|
313
|
+
module.exports = _objectWithoutProperties7;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// src/shared/open-service/services/docgen/manager.tsx
|
|
318
|
+
import { addons } from "@aussieljk/forkbook/manager-api";
|
|
319
|
+
var ADDON_ID7 = "core/docgen", manager_default = addons.register(ADDON_ID7, () => {
|
|
320
|
+
globalThis.FEATURES?.docgenServer && registerService(docgenServiceDef);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// src/shared/open-service/services/review/manager.tsx
|
|
324
|
+
import { addons as addons2 } from "@aussieljk/forkbook/manager-api";
|
|
325
|
+
|
|
326
|
+
// src/shared/open-service/services/review/definition.ts
|
|
327
|
+
import * as v from "valibot";
|
|
328
|
+
var reviewCollectionSchema = v.object({
|
|
329
|
+
title: v.pipe(v.string(), v.description("Collection title shown on the review page.")),
|
|
330
|
+
rationale: v.pipe(
|
|
331
|
+
v.string(),
|
|
332
|
+
v.description("Why this collection is relevant. Plain text, one or two sentences.")
|
|
333
|
+
),
|
|
334
|
+
storyIds: v.pipe(v.array(v.string()), v.description("Story ids included in this collection."))
|
|
335
|
+
}), reviewStateSchema = v.object({
|
|
336
|
+
title: v.pipe(v.string(), v.description("Terse review title. Plain text.")),
|
|
337
|
+
description: v.pipe(
|
|
338
|
+
v.string(),
|
|
339
|
+
v.description(
|
|
340
|
+
"Review scope and what to look for. Limited markdown: bold, italic, and inline code."
|
|
341
|
+
)
|
|
342
|
+
),
|
|
343
|
+
collections: v.array(reviewCollectionSchema),
|
|
344
|
+
changedFiles: v.optional(
|
|
345
|
+
v.pipe(
|
|
346
|
+
v.array(v.string()),
|
|
347
|
+
v.description(
|
|
348
|
+
"Changed file paths, most central first. Pass an empty array when nothing changed."
|
|
349
|
+
)
|
|
350
|
+
)
|
|
351
|
+
),
|
|
352
|
+
createdAt: v.optional(v.number()),
|
|
353
|
+
stale: v.optional(v.boolean())
|
|
354
|
+
}), reviewNavEntrySchema = v.object({
|
|
355
|
+
storyId: v.pipe(v.string(), v.description("Story id of this navigation slot.")),
|
|
356
|
+
collectionIndex: v.pipe(
|
|
357
|
+
v.number(),
|
|
358
|
+
v.description("Index of the collection this slot belongs to.")
|
|
359
|
+
)
|
|
360
|
+
}), reviewServiceDef = defineService({
|
|
361
|
+
id: "core/review",
|
|
362
|
+
internal: !0,
|
|
363
|
+
description: "Owns the current curated Forkbook review, its deferred update, and its staleness.",
|
|
364
|
+
initialState: { current: null, pending: null },
|
|
365
|
+
queries: {
|
|
366
|
+
current: {
|
|
367
|
+
description: "Returns the current review, or null when no review is active.",
|
|
368
|
+
input: v.undefined(),
|
|
369
|
+
output: v.nullable(reviewStateSchema),
|
|
370
|
+
handler: (_input, ctx) => ctx.self.state.current
|
|
371
|
+
},
|
|
372
|
+
pending: {
|
|
373
|
+
description: "Returns the deferred review update, or null when none is held.",
|
|
374
|
+
input: v.undefined(),
|
|
375
|
+
output: v.nullable(reviewStateSchema),
|
|
376
|
+
handler: (_input, ctx) => ctx.self.state.pending
|
|
377
|
+
},
|
|
378
|
+
flattenedEntries: {
|
|
379
|
+
description: "Returns the current review flattened into navigable story slots, walking collections in order (a story repeats when curated into several collections). Empty when no review is active.",
|
|
380
|
+
input: v.undefined(),
|
|
381
|
+
output: v.array(reviewNavEntrySchema),
|
|
382
|
+
handler: (_input, ctx) => (ctx.self.state.current?.collections ?? []).flatMap(
|
|
383
|
+
(collection, collectionIndex) => collection.storyIds.map((storyId) => ({ storyId, collectionIndex }))
|
|
384
|
+
)
|
|
385
|
+
},
|
|
386
|
+
bannerKind: {
|
|
387
|
+
description: "Returns which attention banner review surfaces should show: pending-update outranks stale, and once accepted the banner reflects the staleness of the accepted review; null when neither applies.",
|
|
388
|
+
input: v.undefined(),
|
|
389
|
+
output: v.nullable(v.picklist(["pending-update", "stale"])),
|
|
390
|
+
handler: (_input, ctx) => ctx.self.state.pending !== null ? "pending-update" : ctx.self.state.current?.stale ? "stale" : null
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
commands: {
|
|
394
|
+
setReview: {
|
|
395
|
+
description: "Publishes a review and assigns its server creation time. Defers to pending while any review is current. Implemented by the server.",
|
|
396
|
+
input: reviewStateSchema,
|
|
397
|
+
output: v.void()
|
|
398
|
+
},
|
|
399
|
+
acceptPending: {
|
|
400
|
+
description: "Promotes the deferred review update to current. Implemented by the server.",
|
|
401
|
+
input: v.undefined(),
|
|
402
|
+
output: v.void()
|
|
403
|
+
},
|
|
404
|
+
markStale: {
|
|
405
|
+
description: "Marks the current and pending reviews stale when the module graph changed after they were published. Implemented by the server.",
|
|
406
|
+
input: v.object({
|
|
407
|
+
changedAt: v.pipe(
|
|
408
|
+
v.number(),
|
|
409
|
+
v.description("When (unix ms) the newest module-graph change was made.")
|
|
410
|
+
)
|
|
411
|
+
}),
|
|
412
|
+
output: v.void()
|
|
413
|
+
},
|
|
414
|
+
dismissReview: {
|
|
415
|
+
description: "Clears the current review and any deferred update. Implemented by the server.",
|
|
416
|
+
input: v.undefined(),
|
|
417
|
+
output: v.void()
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// src/shared/open-service/services/review/manager.tsx
|
|
423
|
+
var ADDON_ID8 = "core/review", manager_default2 = addons2.register(ADDON_ID8, () => {
|
|
424
|
+
registerService(reviewServiceDef);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// src/controls/manager.tsx
|
|
428
|
+
import { AddonPanel } from "@aussieljk/forkbook/internal/components";
|
|
429
|
+
import { SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE } from "@aussieljk/forkbook/internal/core-events";
|
|
430
|
+
import { FailedIcon, PassedIcon } from "@storybook/icons";
|
|
431
|
+
import {
|
|
432
|
+
addons as addons3,
|
|
433
|
+
experimental_requestResponse,
|
|
434
|
+
getService,
|
|
435
|
+
types
|
|
436
|
+
} from "@aussieljk/forkbook/manager-api";
|
|
437
|
+
import { color } from "@aussieljk/forkbook/theming";
|
|
438
|
+
|
|
439
|
+
// src/controls/components/ControlsPanel.tsx
|
|
440
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
441
|
+
import { STORY_FINISHED, STORY_PREPARED } from "@aussieljk/forkbook/internal/core-events";
|
|
442
|
+
import { global } from "@storybook/global";
|
|
443
|
+
import {
|
|
444
|
+
useArgTypes,
|
|
445
|
+
useArgs,
|
|
446
|
+
useChannel,
|
|
447
|
+
useGlobals,
|
|
448
|
+
useParameter,
|
|
449
|
+
useServiceQuery,
|
|
450
|
+
useStorybookApi,
|
|
451
|
+
useStorybookState
|
|
452
|
+
} from "@aussieljk/forkbook/manager-api";
|
|
453
|
+
|
|
454
|
+
// src/controls/constants.ts
|
|
455
|
+
var ADDON_ID9 = "addon-controls", PARAM_KEY6 = "controls";
|
|
456
|
+
|
|
457
|
+
// src/controls/components/SaveStory.tsx
|
|
458
|
+
import React from "react";
|
|
459
|
+
import { Bar, Button, Form, Modal } from "@aussieljk/forkbook/internal/components";
|
|
460
|
+
import { AddIcon, CheckIcon, UndoIcon } from "@storybook/icons";
|
|
461
|
+
|
|
462
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/controls/components/SaveStory.module.css
|
|
463
|
+
var id = "core/src/controls/components/SaveStory.module.css";
|
|
464
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id}"]`)) {
|
|
465
|
+
let style = document.createElement("style");
|
|
466
|
+
style.setAttribute("data-sb-css", id), style.textContent = ".sb-zEgyLq-container{z-index:1;width:100%;height:41px;position:absolute;bottom:0;overflow:hidden;container-type:size}.sb-zEgyLq-bar{--highlight-bg-color:#e0f0ff;background:var(--sb-background-bar);border-top:1px solid var(--sb-app-border-color);font-size:var(--sb-size-s2);padding-inline:4px;animation:.3s sb-zEgyLq-slideIn,2s sb-zEgyLq-highlight;@container (width<=799px){flex-direction:row;justify-content:flex-end}}:where([data-sb-theme=dark]) .sb-zEgyLq-bar{--highlight-bg-color:#153b5b}.sb-zEgyLq-info{flex:99 0 auto;align-items:center;gap:6px;margin-inline:7px 10px;display:flex}.sb-zEgyLq-actions{color:var(--sb-text-muted-color);font-size:var(--sb-size-s2);flex:1 0 0;align-items:center;gap:2px;display:flex}.sb-zEgyLq-label{@container (width<=799px){text-indent:-9999px;line-height:0;&:after{content:attr(data-short-label);line-height:initial;text-indent:0;display:block}}}.sb-zEgyLq-modalInput{&::placeholder{color:var(--sb-color-mediumdark)}&:invalid:not(:placeholder-shown){box-shadow:var(--sb-color-negative) 0 0 0 1px inset}}@keyframes sb-zEgyLq-slideIn{0%{transform:translateY(40px)}to{transform:translateY(0)}}@keyframes sb-zEgyLq-highlight{0%{background:var(--highlight-bg-color)}}", document.head.appendChild(style);
|
|
467
|
+
}
|
|
468
|
+
var SaveStory_default = { info: "sb-zEgyLq-info", container: "sb-zEgyLq-container", modalInput: "sb-zEgyLq-modalInput", slideIn: "sb-zEgyLq-slideIn", label: "sb-zEgyLq-label", actions: "sb-zEgyLq-actions", bar: "sb-zEgyLq-bar", highlight: "sb-zEgyLq-highlight" };
|
|
469
|
+
|
|
470
|
+
// src/controls/components/SaveStory.tsx
|
|
471
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
472
|
+
var SaveStory = ({ saveStory, createStory, resetArgs }) => {
|
|
473
|
+
let inputRef = React.useRef(null), [saving, setSaving] = React.useState(!1), [creating, setCreating] = React.useState(!1), [storyName, setStoryName] = React.useState(""), [errorMessage, setErrorMessage] = React.useState(null), onSaveStory = async () => {
|
|
474
|
+
saving || (setSaving(!0), await saveStory().catch(() => {
|
|
475
|
+
}), setSaving(!1));
|
|
476
|
+
}, onShowForm = () => {
|
|
477
|
+
setCreating(!0), setStoryName(""), setTimeout(() => inputRef.current?.focus(), 0);
|
|
478
|
+
}, onChange = (e) => {
|
|
479
|
+
let value = e.target.value.replace(/^[^a-z]/i, "").replace(/[^a-z0-9-_ ]/gi, "").replaceAll(/([-_ ]+[a-z0-9])/gi, (match) => match.toUpperCase().replace(/[-_ ]/g, ""));
|
|
480
|
+
setStoryName(value.charAt(0).toUpperCase() + value.slice(1));
|
|
481
|
+
}, onSubmitForm = async (event) => {
|
|
482
|
+
if (event.preventDefault(), !saving)
|
|
483
|
+
try {
|
|
484
|
+
setErrorMessage(null), setSaving(!0), await createStory(storyName.replace(/^[^a-z]/i, "").replaceAll(/[^a-z0-9]/gi, "")), setCreating(!1), setSaving(!1);
|
|
485
|
+
} catch (e) {
|
|
486
|
+
setErrorMessage(e.message), setSaving(!1);
|
|
487
|
+
}
|
|
488
|
+
}, saveLabel = saving ? "Saving changes to story" : "Save changes to story", createLabel = "Create new story with these settings";
|
|
489
|
+
return jsx("div", { className: SaveStory_default.container, id: "save-from-controls", children: jsxs(
|
|
490
|
+
Bar,
|
|
491
|
+
{
|
|
492
|
+
className: SaveStory_default.bar,
|
|
493
|
+
innerStyle: {
|
|
494
|
+
flexDirection: "row-reverse",
|
|
495
|
+
justifyContent: "space-between",
|
|
496
|
+
flexWrap: "wrap"
|
|
497
|
+
},
|
|
498
|
+
children: [
|
|
499
|
+
jsxs("div", { className: SaveStory_default.actions, children: [
|
|
500
|
+
jsxs(Button, { ariaLabel: saveLabel, tooltip: saveLabel, disabled: saving, onClick: onSaveStory, children: [
|
|
501
|
+
jsx(CheckIcon, {}),
|
|
502
|
+
jsx("div", { className: SaveStory_default.label, "data-short-label": "Save", children: "Update story" })
|
|
503
|
+
] }),
|
|
504
|
+
jsxs(Button, { ariaLabel: createLabel, tooltip: createLabel, onClick: onShowForm, children: [
|
|
505
|
+
jsx(AddIcon, {}),
|
|
506
|
+
jsx("div", { className: SaveStory_default.label, "data-short-label": "New", children: "Create new story" })
|
|
507
|
+
] }),
|
|
508
|
+
jsxs(Button, { ariaLabel: "Reset changes", onClick: () => resetArgs(), children: [
|
|
509
|
+
jsx(UndoIcon, {}),
|
|
510
|
+
jsx("span", { children: "Reset" })
|
|
511
|
+
] })
|
|
512
|
+
] }),
|
|
513
|
+
jsxs(Modal, { ariaLabel: "Create new story", width: 350, open: creating, onOpenChange: setCreating, children: [
|
|
514
|
+
jsx(Form, { onSubmit: onSubmitForm, id: "create-new-story-form", children: jsxs(Modal.Content, { children: [
|
|
515
|
+
jsxs(Modal.Header, { children: [
|
|
516
|
+
jsx(Modal.Title, { children: "Create new story" }),
|
|
517
|
+
jsx(Modal.Description, { children: "This will add a new story to your existing stories file." })
|
|
518
|
+
] }),
|
|
519
|
+
jsx(
|
|
520
|
+
Form.Input,
|
|
521
|
+
{
|
|
522
|
+
className: SaveStory_default.modalInput,
|
|
523
|
+
onChange,
|
|
524
|
+
placeholder: "Story export name",
|
|
525
|
+
readOnly: saving,
|
|
526
|
+
ref: inputRef,
|
|
527
|
+
value: storyName
|
|
528
|
+
}
|
|
529
|
+
),
|
|
530
|
+
jsxs(Modal.Actions, { children: [
|
|
531
|
+
jsx(
|
|
532
|
+
Button,
|
|
533
|
+
{
|
|
534
|
+
ariaLabel: !1,
|
|
535
|
+
disabled: saving || !storyName,
|
|
536
|
+
size: "medium",
|
|
537
|
+
type: "submit",
|
|
538
|
+
variant: "solid",
|
|
539
|
+
children: "Create"
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
jsx(Modal.Close, { asChild: !0, children: jsx(Button, { ariaLabel: !1, disabled: saving, size: "medium", type: "reset", children: "Cancel" }) })
|
|
543
|
+
] })
|
|
544
|
+
] }) }),
|
|
545
|
+
errorMessage && jsx(Modal.Error, { children: errorMessage })
|
|
546
|
+
] }),
|
|
547
|
+
jsx("div", { className: SaveStory_default.info, children: jsx("div", { className: SaveStory_default.label, "data-short-label": "Unsaved changes", children: "You modified this story. Do you want to save your changes?" }) })
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
) });
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/controls/components/ControlsPanel.module.css
|
|
554
|
+
var id2 = "core/src/controls/components/ControlsPanel.module.css";
|
|
555
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id2}"]`)) {
|
|
556
|
+
let style = document.createElement("style");
|
|
557
|
+
style.setAttribute("data-sb-css", id2), style.textContent = ".sb-yARkZG-wrapper{background-color:var(--sb-background-content);min-height:100%;padding-bottom:0;&[data-save-from-ui]{padding-bottom:41px}& table{background-color:var(--sb-background-app)}}", document.head.appendChild(style);
|
|
558
|
+
}
|
|
559
|
+
var ControlsPanel_default = { wrapper: "sb-yARkZG-wrapper" };
|
|
560
|
+
|
|
561
|
+
// src/controls/components/ControlsPanel.tsx
|
|
562
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
563
|
+
var clean = (obj) => Object.entries(obj).reduce(
|
|
564
|
+
(acc, [key, value]) => value !== void 0 ? Object.assign(acc, { [key]: value }) : acc,
|
|
565
|
+
{}
|
|
566
|
+
), hasAnyControl = (rows) => Object.values(rows).some((arg) => arg?.control);
|
|
567
|
+
function applyPresetColors(rows, presetColors) {
|
|
568
|
+
return Object.entries(rows).reduce((acc, [key, arg]) => {
|
|
569
|
+
let control = arg?.control;
|
|
570
|
+
return typeof control != "object" || control?.type !== "color" || control?.presetColors ? acc[key] = arg : acc[key] = { ...arg, control: { ...control, presetColors } }, acc;
|
|
571
|
+
}, {});
|
|
572
|
+
}
|
|
573
|
+
function ControlsPanelTable({
|
|
574
|
+
rows,
|
|
575
|
+
isLoading,
|
|
576
|
+
saveStory,
|
|
577
|
+
createStory
|
|
578
|
+
}) {
|
|
579
|
+
let [args, updateArgs, resetArgs, initialArgs] = useArgs(), [globals] = useGlobals(), {
|
|
580
|
+
expanded,
|
|
581
|
+
sort,
|
|
582
|
+
presetColors,
|
|
583
|
+
disableSaveFromUI = !1
|
|
584
|
+
} = useParameter(PARAM_KEY6, {}), { path } = useStorybookState(), storyData = useStorybookApi().getCurrentStoryData(), hasControls = hasAnyControl(rows), withPresetColors = applyPresetColors(rows, presetColors), hasUpdatedArgs = useMemo(
|
|
585
|
+
() => !!args && !!initialArgs && !dequal(clean(args), clean(initialArgs)),
|
|
586
|
+
[args, initialArgs]
|
|
587
|
+
), showSaveFromUI = hasControls && storyData.type === "story" && storyData.subtype !== "test" && hasUpdatedArgs && global.CONFIG_TYPE === "DEVELOPMENT" && disableSaveFromUI !== !0;
|
|
588
|
+
return jsxs2("div", { className: ControlsPanel_default.wrapper, "data-save-from-ui": showSaveFromUI || void 0, children: [
|
|
589
|
+
jsx2(
|
|
590
|
+
ArgsTable,
|
|
591
|
+
{
|
|
592
|
+
compact: !expanded && hasControls,
|
|
593
|
+
rows: withPresetColors,
|
|
594
|
+
args,
|
|
595
|
+
globals,
|
|
596
|
+
updateArgs,
|
|
597
|
+
resetArgs,
|
|
598
|
+
inAddonPanel: !0,
|
|
599
|
+
sort,
|
|
600
|
+
isLoading
|
|
601
|
+
},
|
|
602
|
+
path
|
|
603
|
+
),
|
|
604
|
+
showSaveFromUI && jsx2(SaveStory, { resetArgs, saveStory, createStory })
|
|
605
|
+
] });
|
|
606
|
+
}
|
|
607
|
+
function LegacyControlsPanel(props) {
|
|
608
|
+
let [isLoading, setIsLoading] = useState(!0), rows = useArgTypes(), { refs, previewInitialized } = useStorybookState(), storyData = useStorybookApi().getCurrentStoryData(), isPreviewInitialized = storyData?.refId ? !!refs[storyData.refId]?.previewInitialized : previewInitialized;
|
|
609
|
+
return useEffect(() => {
|
|
610
|
+
isPreviewInitialized && setIsLoading(!1);
|
|
611
|
+
}, [isPreviewInitialized]), jsx2(ControlsPanelTable, { ...props, rows, isLoading });
|
|
612
|
+
}
|
|
613
|
+
function DocgenQuery({
|
|
614
|
+
docgenService,
|
|
615
|
+
id: id13,
|
|
616
|
+
onChange
|
|
617
|
+
}) {
|
|
618
|
+
let { data, isInitialLoading } = useServiceQuery(docgenService.queries.docgen, { id: id13 });
|
|
619
|
+
return useEffect(() => {
|
|
620
|
+
onChange({ payload: data, isInitialLoading });
|
|
621
|
+
}, [data, isInitialLoading, onChange]), null;
|
|
622
|
+
}
|
|
623
|
+
function useStoryDocgenGateReady(storyId) {
|
|
624
|
+
let isDevelopment = global.CONFIG_TYPE === "DEVELOPMENT", requestAtStoryPrepared = global.DOCGEN_STORY_PREPARED === !0, [readyStoryId, setReadyStoryId] = useState(null), ready = !isDevelopment || readyStoryId === storyId, gateEvent = requestAtStoryPrepared ? STORY_PREPARED : STORY_FINISHED;
|
|
625
|
+
return useChannel(
|
|
626
|
+
{
|
|
627
|
+
[gateEvent]: (payload) => {
|
|
628
|
+
(requestAtStoryPrepared ? payload?.id : payload?.storyId) === storyId && setReadyStoryId(storyId);
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
[storyId, requestAtStoryPrepared, gateEvent]
|
|
632
|
+
), ready;
|
|
633
|
+
}
|
|
634
|
+
function ServiceControlsPanel({
|
|
635
|
+
docgenService,
|
|
636
|
+
...props
|
|
637
|
+
}) {
|
|
638
|
+
let storyData = useStorybookApi().getCurrentStoryData(), [, , , initialArgs] = useArgs(), customArgTypes = useArgTypes(), id13 = storyData.id.split("--")[0], isStory = storyData.type === "story", isStoryPrepared = !(global.CONFIG_TYPE === "DEVELOPMENT") || (isStory ? storyData.prepared : !0), gateReady = useStoryDocgenGateReady(storyData.id), queryReady = !isStory || gateReady, [docgen, setDocgen] = useState(), onDocgenChange = useCallback(
|
|
639
|
+
(state) => setDocgen({ id: id13, ...state }),
|
|
640
|
+
[id13]
|
|
641
|
+
), current = queryReady && docgen?.id === id13 ? docgen : void 0, docgenPayload = current?.payload, docgenResolved = !!current && !current.isInitialLoading, rows = useMemo(
|
|
642
|
+
() => docgenResolved ? mergeServiceArgTypes({
|
|
643
|
+
payload: docgenPayload,
|
|
644
|
+
storyId: storyData.id,
|
|
645
|
+
parameters: storyData.parameters,
|
|
646
|
+
initialArgs,
|
|
647
|
+
customArgTypes
|
|
648
|
+
}) : customArgTypes,
|
|
649
|
+
[docgenResolved, docgenPayload, initialArgs, storyData.id, storyData.parameters, customArgTypes]
|
|
650
|
+
), isDocgenLoading = !docgenResolved;
|
|
651
|
+
return jsxs2(Fragment, { children: [
|
|
652
|
+
queryReady && jsx2(DocgenQuery, { docgenService, id: id13, onChange: onDocgenChange }),
|
|
653
|
+
jsx2(
|
|
654
|
+
ControlsPanelTable,
|
|
655
|
+
{
|
|
656
|
+
...props,
|
|
657
|
+
rows,
|
|
658
|
+
isLoading: !isStoryPrepared || isDocgenLoading && !hasAnyControl(rows)
|
|
659
|
+
}
|
|
660
|
+
)
|
|
661
|
+
] });
|
|
662
|
+
}
|
|
663
|
+
var ControlsPanel = ({ docgenService, ...props }) => docgenService ? jsx2(ServiceControlsPanel, { ...props, docgenService }) : jsx2(LegacyControlsPanel, { ...props });
|
|
664
|
+
|
|
665
|
+
// src/controls/components/Title.tsx
|
|
666
|
+
import { Badge } from "@aussieljk/forkbook/internal/components";
|
|
667
|
+
import { useArgTypes as useArgTypes2, useStorybookApi as useStorybookApi2 } from "@aussieljk/forkbook/manager-api";
|
|
668
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
669
|
+
function Title() {
|
|
670
|
+
let selectedPanel = useStorybookApi2().getSelectedPanel(), rows = useArgTypes2(), controlsCount = Object.values(rows).filter(
|
|
671
|
+
(argType) => argType?.control && !argType?.table?.disable
|
|
672
|
+
).length, suffix = controlsCount === 0 ? null : jsx3(Badge, { compact: !0, status: selectedPanel === ADDON_ID9 ? "active" : "neutral", children: controlsCount });
|
|
673
|
+
return jsxs3("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
674
|
+
jsx3("span", { children: "Controls" }),
|
|
675
|
+
suffix
|
|
676
|
+
] });
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// src/manager/utils/trySelectStory.ts
|
|
680
|
+
async function trySelectStory(selectStory, storyId, attempt = 1) {
|
|
681
|
+
if (attempt > 10)
|
|
682
|
+
throw new Error("We could not select the new story. Please try again.");
|
|
683
|
+
try {
|
|
684
|
+
selectStory(storyId);
|
|
685
|
+
} catch {
|
|
686
|
+
return await new Promise((resolve) => setTimeout(resolve, 500)), trySelectStory(selectStory, storyId, attempt + 1);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// src/controls/stringifyArgs.tsx
|
|
691
|
+
var stringifyArgs = (args) => JSON.stringify(args, (_, value) => typeof value == "function" ? "__sb_empty_function_arg__" : value);
|
|
692
|
+
|
|
693
|
+
// src/controls/manager.tsx
|
|
694
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
695
|
+
var manager_default3 = addons3.register(ADDON_ID9, (api) => {
|
|
696
|
+
if (globalThis?.FEATURES?.controls) {
|
|
697
|
+
let channel = addons3.getChannel(), docgenService = globalThis.FEATURES?.docgenServer ? getService("core/docgen", { internal: !0 }) : void 0, saveStory = async () => {
|
|
698
|
+
let data = api.getCurrentStoryData();
|
|
699
|
+
if (data.type !== "story")
|
|
700
|
+
throw new Error("Not a story");
|
|
701
|
+
try {
|
|
702
|
+
let response = await experimental_requestResponse(channel, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, {
|
|
703
|
+
// Only send updated args
|
|
704
|
+
args: stringifyArgs(
|
|
705
|
+
Object.entries(data.args || {}).reduce((acc, [key, value]) => (dequal(value, data.initialArgs?.[key]) || (acc[key] = value), acc), {})
|
|
706
|
+
),
|
|
707
|
+
csfId: data.id,
|
|
708
|
+
importPath: data.importPath
|
|
709
|
+
});
|
|
710
|
+
api.addNotification({
|
|
711
|
+
id: "save-story-success",
|
|
712
|
+
icon: jsx4(PassedIcon, { color: color.positive }),
|
|
713
|
+
content: {
|
|
714
|
+
headline: "Story saved",
|
|
715
|
+
subHeadline: jsxs4(Fragment2, { children: [
|
|
716
|
+
"Updated story ",
|
|
717
|
+
jsx4("b", { children: response.sourceStoryName }),
|
|
718
|
+
"."
|
|
719
|
+
] })
|
|
720
|
+
},
|
|
721
|
+
duration: 8e3
|
|
722
|
+
});
|
|
723
|
+
} catch (error) {
|
|
724
|
+
throw api.addNotification({
|
|
725
|
+
id: "save-story-error",
|
|
726
|
+
icon: jsx4(FailedIcon, { color: color.negative }),
|
|
727
|
+
content: {
|
|
728
|
+
headline: "Failed to save story",
|
|
729
|
+
subHeadline: error?.message || "Check the Forkbook process on the command line for more details."
|
|
730
|
+
},
|
|
731
|
+
duration: 8e3
|
|
732
|
+
}), error;
|
|
733
|
+
}
|
|
734
|
+
}, createStory = async (name) => {
|
|
735
|
+
let data = api.getCurrentStoryData();
|
|
736
|
+
if (data.type !== "story")
|
|
737
|
+
throw new Error("Not a story");
|
|
738
|
+
let response = await experimental_requestResponse(channel, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, {
|
|
739
|
+
args: data.args && stringifyArgs(data.args),
|
|
740
|
+
csfId: data.id,
|
|
741
|
+
importPath: data.importPath,
|
|
742
|
+
name
|
|
743
|
+
});
|
|
744
|
+
api.addNotification({
|
|
745
|
+
id: "save-story-success",
|
|
746
|
+
icon: jsx4(PassedIcon, { color: color.positive }),
|
|
747
|
+
content: {
|
|
748
|
+
headline: "Story created",
|
|
749
|
+
subHeadline: jsxs4(Fragment2, { children: [
|
|
750
|
+
"Added story ",
|
|
751
|
+
jsx4("b", { children: response.newStoryName }),
|
|
752
|
+
" based on ",
|
|
753
|
+
jsx4("b", { children: response.sourceStoryName }),
|
|
754
|
+
"."
|
|
755
|
+
] })
|
|
756
|
+
},
|
|
757
|
+
duration: 8e3,
|
|
758
|
+
onClick: ({ onDismiss }) => {
|
|
759
|
+
onDismiss(), trySelectStory(api.selectStory, response.newStoryId);
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
};
|
|
763
|
+
addons3.add(ADDON_ID9, {
|
|
764
|
+
title: Title,
|
|
765
|
+
type: types.PANEL,
|
|
766
|
+
paramKey: PARAM_KEY6,
|
|
767
|
+
render: ({ active }) => !active || !api.getCurrentStoryData() ? null : jsx4(AddonPanel, { active, hasHorizontalScrollbar: !0, hasScrollbar: !0, children: jsx4(
|
|
768
|
+
ControlsPanel,
|
|
769
|
+
{
|
|
770
|
+
saveStory,
|
|
771
|
+
createStory,
|
|
772
|
+
docgenService
|
|
773
|
+
}
|
|
774
|
+
) })
|
|
775
|
+
}), channel.on(SAVE_STORY_RESPONSE, (data) => {
|
|
776
|
+
if (!data.success)
|
|
777
|
+
return;
|
|
778
|
+
let story = api.getCurrentStoryData();
|
|
779
|
+
story.type === "story" && (api.resetStoryArgs(story), data.payload.newStoryId && trySelectStory(api.selectStory, data.payload.newStoryId));
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
// src/actions/manager.tsx
|
|
785
|
+
import { addons as addons4, types as types2 } from "@aussieljk/forkbook/manager-api";
|
|
786
|
+
|
|
787
|
+
// src/actions/components/Title.tsx
|
|
788
|
+
import { Badge as Badge2 } from "@aussieljk/forkbook/internal/components";
|
|
789
|
+
import { STORY_CHANGED } from "@aussieljk/forkbook/internal/core-events";
|
|
790
|
+
import { useAddonState, useChannel as useChannel2, useStorybookApi as useStorybookApi3 } from "@aussieljk/forkbook/manager-api";
|
|
791
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
792
|
+
function Title2() {
|
|
793
|
+
let selectedPanel = useStorybookApi3().getSelectedPanel(), [{ count }, setCount] = useAddonState(ADDON_ID2, { count: 0 });
|
|
794
|
+
useChannel2({
|
|
795
|
+
[EVENT_ID]: () => {
|
|
796
|
+
setCount((c) => ({ ...c, count: c.count + 1 }));
|
|
797
|
+
},
|
|
798
|
+
[STORY_CHANGED]: () => {
|
|
799
|
+
setCount((c) => ({ ...c, count: 0 }));
|
|
800
|
+
},
|
|
801
|
+
[CLEAR_ID]: () => {
|
|
802
|
+
setCount((c) => ({ ...c, count: 0 }));
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
let suffix = count === 0 ? null : jsx5(Badge2, { compact: !0, status: selectedPanel === PANEL_ID ? "active" : "neutral", children: count });
|
|
806
|
+
return jsxs5("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
807
|
+
jsx5("span", { children: "Actions" }),
|
|
808
|
+
suffix
|
|
809
|
+
] });
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
// src/actions/containers/ActionLogger/index.tsx
|
|
813
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo3, useState as useState4 } from "react";
|
|
814
|
+
import { STORY_CHANGED as STORY_CHANGED2 } from "@aussieljk/forkbook/internal/core-events";
|
|
815
|
+
import { useParameter as useParameter2 } from "@aussieljk/forkbook/manager-api";
|
|
816
|
+
|
|
817
|
+
// src/actions/components/ActionLogger/index.tsx
|
|
818
|
+
import { Fragment as Fragment3, useEffect as useEffect2, useRef } from "react";
|
|
819
|
+
import { ActionBar, ScrollArea } from "@aussieljk/forkbook/internal/components";
|
|
820
|
+
|
|
821
|
+
// ../../node_modules/react-inspector/dist/index.mjs
|
|
822
|
+
import React9 from "react";
|
|
823
|
+
import React3, { useContext as useContext2, useCallback as useCallback2, useLayoutEffect, useState as useState2, memo as memo2 } from "react";
|
|
824
|
+
import { createContext } from "react";
|
|
825
|
+
import React22, { Children, memo } from "react";
|
|
826
|
+
import React4, { createContext as createContext2, useContext, useMemo as useMemo2 } from "react";
|
|
827
|
+
import React7 from "react";
|
|
828
|
+
import React42 from "react";
|
|
829
|
+
import React6 from "react";
|
|
830
|
+
import React5 from "react";
|
|
831
|
+
import React8 from "react";
|
|
832
|
+
import React13, { useCallback as useCallback3, useState as useState3 } from "react";
|
|
833
|
+
import React10 from "react";
|
|
834
|
+
import React12 from "react";
|
|
835
|
+
import React11, { useCallback as useCallback22, useState as useState22 } from "react";
|
|
836
|
+
import React15 from "react";
|
|
837
|
+
import React14 from "react";
|
|
838
|
+
import React16 from "react";
|
|
839
|
+
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __commonJS2 = (cb, mod) => function() {
|
|
840
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
841
|
+
}, __export = (target, all2) => {
|
|
842
|
+
for (var name in all2)
|
|
843
|
+
__defProp(target, name, { get: all2[name], enumerable: !0 });
|
|
844
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
845
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
846
|
+
for (let key of __getOwnPropNames(from))
|
|
847
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
848
|
+
return to;
|
|
849
|
+
}, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target, mod)), require_is_object = __commonJS2({
|
|
850
|
+
"node_modules/is-object/index.js"(exports, module) {
|
|
851
|
+
"use strict";
|
|
852
|
+
module.exports = function(x) {
|
|
853
|
+
return typeof x == "object" && x !== null;
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
}), require_is_window = __commonJS2({
|
|
857
|
+
"node_modules/is-window/index.js"(exports, module) {
|
|
858
|
+
"use strict";
|
|
859
|
+
module.exports = function(obj) {
|
|
860
|
+
if (obj == null)
|
|
861
|
+
return !1;
|
|
862
|
+
var o = Object(obj);
|
|
863
|
+
return o === o.window;
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
}), require_is_dom = __commonJS2({
|
|
867
|
+
"node_modules/is-dom/index.js"(exports, module) {
|
|
868
|
+
var isObject2 = require_is_object(), isWindow = require_is_window();
|
|
869
|
+
function isNode(val) {
|
|
870
|
+
return !isObject2(val) || !isWindow(window) || typeof window.Node != "function" ? !1 : typeof val.nodeType == "number" && typeof val.nodeName == "string";
|
|
871
|
+
}
|
|
872
|
+
module.exports = isNode;
|
|
873
|
+
}
|
|
874
|
+
}), themes_exports = {};
|
|
875
|
+
__export(themes_exports, {
|
|
876
|
+
chromeDark: () => theme,
|
|
877
|
+
chromeLight: () => theme2
|
|
878
|
+
});
|
|
879
|
+
var theme = {
|
|
880
|
+
BASE_FONT_FAMILY: "Menlo, monospace",
|
|
881
|
+
BASE_FONT_SIZE: "11px",
|
|
882
|
+
BASE_LINE_HEIGHT: 1.2,
|
|
883
|
+
BASE_BACKGROUND_COLOR: "rgb(36, 36, 36)",
|
|
884
|
+
BASE_COLOR: "rgb(213, 213, 213)",
|
|
885
|
+
OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
|
|
886
|
+
OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
|
|
887
|
+
OBJECT_NAME_COLOR: "rgb(227, 110, 236)",
|
|
888
|
+
OBJECT_VALUE_NULL_COLOR: "rgb(127, 127, 127)",
|
|
889
|
+
OBJECT_VALUE_UNDEFINED_COLOR: "rgb(127, 127, 127)",
|
|
890
|
+
OBJECT_VALUE_REGEXP_COLOR: "rgb(233, 63, 59)",
|
|
891
|
+
OBJECT_VALUE_STRING_COLOR: "rgb(233, 63, 59)",
|
|
892
|
+
OBJECT_VALUE_SYMBOL_COLOR: "rgb(233, 63, 59)",
|
|
893
|
+
OBJECT_VALUE_NUMBER_COLOR: "hsl(252, 100%, 75%)",
|
|
894
|
+
OBJECT_VALUE_BOOLEAN_COLOR: "hsl(252, 100%, 75%)",
|
|
895
|
+
OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "rgb(85, 106, 242)",
|
|
896
|
+
HTML_TAG_COLOR: "rgb(93, 176, 215)",
|
|
897
|
+
HTML_TAGNAME_COLOR: "rgb(93, 176, 215)",
|
|
898
|
+
HTML_TAGNAME_TEXT_TRANSFORM: "lowercase",
|
|
899
|
+
HTML_ATTRIBUTE_NAME_COLOR: "rgb(155, 187, 220)",
|
|
900
|
+
HTML_ATTRIBUTE_VALUE_COLOR: "rgb(242, 151, 102)",
|
|
901
|
+
HTML_COMMENT_COLOR: "rgb(137, 137, 137)",
|
|
902
|
+
HTML_DOCTYPE_COLOR: "rgb(192, 192, 192)",
|
|
903
|
+
ARROW_COLOR: "rgb(145, 145, 145)",
|
|
904
|
+
ARROW_MARGIN_RIGHT: 3,
|
|
905
|
+
ARROW_FONT_SIZE: 12,
|
|
906
|
+
ARROW_ANIMATION_DURATION: "0",
|
|
907
|
+
TREENODE_FONT_FAMILY: "Menlo, monospace",
|
|
908
|
+
TREENODE_FONT_SIZE: "11px",
|
|
909
|
+
TREENODE_LINE_HEIGHT: 1.2,
|
|
910
|
+
TREENODE_PADDING_LEFT: 12,
|
|
911
|
+
TABLE_BORDER_COLOR: "rgb(85, 85, 85)",
|
|
912
|
+
TABLE_TH_BACKGROUND_COLOR: "rgb(44, 44, 44)",
|
|
913
|
+
TABLE_TH_HOVER_COLOR: "rgb(48, 48, 48)",
|
|
914
|
+
TABLE_SORT_ICON_COLOR: "black",
|
|
915
|
+
TABLE_DATA_BACKGROUND_IMAGE: "linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(51, 139, 255, 0.0980392) 50%, rgba(51, 139, 255, 0.0980392))",
|
|
916
|
+
TABLE_DATA_BACKGROUND_SIZE: "128px 32px"
|
|
917
|
+
}, theme2 = {
|
|
918
|
+
BASE_FONT_FAMILY: "Menlo, monospace",
|
|
919
|
+
BASE_FONT_SIZE: "11px",
|
|
920
|
+
BASE_LINE_HEIGHT: 1.2,
|
|
921
|
+
BASE_BACKGROUND_COLOR: "white",
|
|
922
|
+
BASE_COLOR: "black",
|
|
923
|
+
OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
|
|
924
|
+
OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
|
|
925
|
+
OBJECT_NAME_COLOR: "rgb(136, 19, 145)",
|
|
926
|
+
OBJECT_VALUE_NULL_COLOR: "rgb(128, 128, 128)",
|
|
927
|
+
OBJECT_VALUE_UNDEFINED_COLOR: "rgb(128, 128, 128)",
|
|
928
|
+
OBJECT_VALUE_REGEXP_COLOR: "rgb(196, 26, 22)",
|
|
929
|
+
OBJECT_VALUE_STRING_COLOR: "rgb(196, 26, 22)",
|
|
930
|
+
OBJECT_VALUE_SYMBOL_COLOR: "rgb(196, 26, 22)",
|
|
931
|
+
OBJECT_VALUE_NUMBER_COLOR: "rgb(28, 0, 207)",
|
|
932
|
+
OBJECT_VALUE_BOOLEAN_COLOR: "rgb(28, 0, 207)",
|
|
933
|
+
OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "rgb(13, 34, 170)",
|
|
934
|
+
HTML_TAG_COLOR: "rgb(168, 148, 166)",
|
|
935
|
+
HTML_TAGNAME_COLOR: "rgb(136, 18, 128)",
|
|
936
|
+
HTML_TAGNAME_TEXT_TRANSFORM: "lowercase",
|
|
937
|
+
HTML_ATTRIBUTE_NAME_COLOR: "rgb(153, 69, 0)",
|
|
938
|
+
HTML_ATTRIBUTE_VALUE_COLOR: "rgb(26, 26, 166)",
|
|
939
|
+
HTML_COMMENT_COLOR: "rgb(35, 110, 37)",
|
|
940
|
+
HTML_DOCTYPE_COLOR: "rgb(192, 192, 192)",
|
|
941
|
+
ARROW_COLOR: "#6e6e6e",
|
|
942
|
+
ARROW_MARGIN_RIGHT: 3,
|
|
943
|
+
ARROW_FONT_SIZE: 12,
|
|
944
|
+
ARROW_ANIMATION_DURATION: "0",
|
|
945
|
+
TREENODE_FONT_FAMILY: "Menlo, monospace",
|
|
946
|
+
TREENODE_FONT_SIZE: "11px",
|
|
947
|
+
TREENODE_LINE_HEIGHT: 1.2,
|
|
948
|
+
TREENODE_PADDING_LEFT: 12,
|
|
949
|
+
TABLE_BORDER_COLOR: "#aaa",
|
|
950
|
+
TABLE_TH_BACKGROUND_COLOR: "#eee",
|
|
951
|
+
TABLE_TH_HOVER_COLOR: "hsla(0, 0%, 90%, 1)",
|
|
952
|
+
TABLE_SORT_ICON_COLOR: "#6e6e6e",
|
|
953
|
+
TABLE_DATA_BACKGROUND_IMAGE: "linear-gradient(to bottom, white, white 50%, rgb(234, 243, 255) 50%, rgb(234, 243, 255))",
|
|
954
|
+
TABLE_DATA_BACKGROUND_SIZE: "128px 32px"
|
|
955
|
+
}, ExpandedPathsContext = createContext([{}, () => {
|
|
956
|
+
}]), unselectable = {
|
|
957
|
+
WebkitTouchCallout: "none",
|
|
958
|
+
WebkitUserSelect: "none",
|
|
959
|
+
KhtmlUserSelect: "none",
|
|
960
|
+
MozUserSelect: "none",
|
|
961
|
+
msUserSelect: "none",
|
|
962
|
+
OUserSelect: "none",
|
|
963
|
+
userSelect: "none"
|
|
964
|
+
}, createTheme = (theme3) => ({
|
|
965
|
+
DOMNodePreview: {
|
|
966
|
+
htmlOpenTag: {
|
|
967
|
+
base: {
|
|
968
|
+
color: theme3.HTML_TAG_COLOR
|
|
969
|
+
},
|
|
970
|
+
tagName: {
|
|
971
|
+
color: theme3.HTML_TAGNAME_COLOR,
|
|
972
|
+
textTransform: theme3.HTML_TAGNAME_TEXT_TRANSFORM
|
|
973
|
+
},
|
|
974
|
+
htmlAttributeName: {
|
|
975
|
+
color: theme3.HTML_ATTRIBUTE_NAME_COLOR
|
|
976
|
+
},
|
|
977
|
+
htmlAttributeValue: {
|
|
978
|
+
color: theme3.HTML_ATTRIBUTE_VALUE_COLOR
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
htmlCloseTag: {
|
|
982
|
+
base: {
|
|
983
|
+
color: theme3.HTML_TAG_COLOR
|
|
984
|
+
},
|
|
985
|
+
offsetLeft: {
|
|
986
|
+
marginLeft: -theme3.TREENODE_PADDING_LEFT
|
|
987
|
+
},
|
|
988
|
+
tagName: {
|
|
989
|
+
color: theme3.HTML_TAGNAME_COLOR,
|
|
990
|
+
textTransform: theme3.HTML_TAGNAME_TEXT_TRANSFORM
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
htmlComment: {
|
|
994
|
+
color: theme3.HTML_COMMENT_COLOR
|
|
995
|
+
},
|
|
996
|
+
htmlDoctype: {
|
|
997
|
+
color: theme3.HTML_DOCTYPE_COLOR
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
ObjectPreview: {
|
|
1001
|
+
objectDescription: {
|
|
1002
|
+
fontStyle: "italic"
|
|
1003
|
+
},
|
|
1004
|
+
preview: {
|
|
1005
|
+
fontStyle: "italic"
|
|
1006
|
+
},
|
|
1007
|
+
arrayMaxProperties: theme3.OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES,
|
|
1008
|
+
objectMaxProperties: theme3.OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES
|
|
1009
|
+
},
|
|
1010
|
+
ObjectName: {
|
|
1011
|
+
base: {
|
|
1012
|
+
color: theme3.OBJECT_NAME_COLOR
|
|
1013
|
+
},
|
|
1014
|
+
dimmed: {
|
|
1015
|
+
opacity: 0.6
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
ObjectValue: {
|
|
1019
|
+
objectValueNull: {
|
|
1020
|
+
color: theme3.OBJECT_VALUE_NULL_COLOR
|
|
1021
|
+
},
|
|
1022
|
+
objectValueUndefined: {
|
|
1023
|
+
color: theme3.OBJECT_VALUE_UNDEFINED_COLOR
|
|
1024
|
+
},
|
|
1025
|
+
objectValueRegExp: {
|
|
1026
|
+
color: theme3.OBJECT_VALUE_REGEXP_COLOR
|
|
1027
|
+
},
|
|
1028
|
+
objectValueString: {
|
|
1029
|
+
color: theme3.OBJECT_VALUE_STRING_COLOR
|
|
1030
|
+
},
|
|
1031
|
+
objectValueSymbol: {
|
|
1032
|
+
color: theme3.OBJECT_VALUE_SYMBOL_COLOR
|
|
1033
|
+
},
|
|
1034
|
+
objectValueNumber: {
|
|
1035
|
+
color: theme3.OBJECT_VALUE_NUMBER_COLOR
|
|
1036
|
+
},
|
|
1037
|
+
objectValueBoolean: {
|
|
1038
|
+
color: theme3.OBJECT_VALUE_BOOLEAN_COLOR
|
|
1039
|
+
},
|
|
1040
|
+
objectValueFunctionPrefix: {
|
|
1041
|
+
color: theme3.OBJECT_VALUE_FUNCTION_PREFIX_COLOR,
|
|
1042
|
+
fontStyle: "italic"
|
|
1043
|
+
},
|
|
1044
|
+
objectValueFunctionName: {
|
|
1045
|
+
fontStyle: "italic"
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
TreeView: {
|
|
1049
|
+
treeViewOutline: {
|
|
1050
|
+
padding: 0,
|
|
1051
|
+
margin: 0,
|
|
1052
|
+
listStyleType: "none"
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
TreeNode: {
|
|
1056
|
+
treeNodeBase: {
|
|
1057
|
+
color: theme3.BASE_COLOR,
|
|
1058
|
+
backgroundColor: theme3.BASE_BACKGROUND_COLOR,
|
|
1059
|
+
lineHeight: theme3.TREENODE_LINE_HEIGHT,
|
|
1060
|
+
cursor: "default",
|
|
1061
|
+
boxSizing: "border-box",
|
|
1062
|
+
listStyle: "none",
|
|
1063
|
+
fontFamily: theme3.TREENODE_FONT_FAMILY,
|
|
1064
|
+
fontSize: theme3.TREENODE_FONT_SIZE
|
|
1065
|
+
},
|
|
1066
|
+
treeNodePreviewContainer: {},
|
|
1067
|
+
treeNodePlaceholder: {
|
|
1068
|
+
whiteSpace: "pre",
|
|
1069
|
+
fontSize: theme3.ARROW_FONT_SIZE,
|
|
1070
|
+
marginRight: theme3.ARROW_MARGIN_RIGHT,
|
|
1071
|
+
...unselectable
|
|
1072
|
+
},
|
|
1073
|
+
treeNodeArrow: {
|
|
1074
|
+
base: {
|
|
1075
|
+
color: theme3.ARROW_COLOR,
|
|
1076
|
+
display: "inline-block",
|
|
1077
|
+
fontSize: theme3.ARROW_FONT_SIZE,
|
|
1078
|
+
marginRight: theme3.ARROW_MARGIN_RIGHT,
|
|
1079
|
+
...parseFloat(theme3.ARROW_ANIMATION_DURATION) > 0 ? {
|
|
1080
|
+
transition: `transform ${theme3.ARROW_ANIMATION_DURATION} ease 0s`
|
|
1081
|
+
} : {},
|
|
1082
|
+
...unselectable
|
|
1083
|
+
},
|
|
1084
|
+
expanded: {
|
|
1085
|
+
WebkitTransform: "rotateZ(90deg)",
|
|
1086
|
+
MozTransform: "rotateZ(90deg)",
|
|
1087
|
+
transform: "rotateZ(90deg)"
|
|
1088
|
+
},
|
|
1089
|
+
collapsed: {
|
|
1090
|
+
WebkitTransform: "rotateZ(0deg)",
|
|
1091
|
+
MozTransform: "rotateZ(0deg)",
|
|
1092
|
+
transform: "rotateZ(0deg)"
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
treeNodeChildNodesContainer: {
|
|
1096
|
+
margin: 0,
|
|
1097
|
+
paddingLeft: theme3.TREENODE_PADDING_LEFT
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
TableInspector: {
|
|
1101
|
+
base: {
|
|
1102
|
+
color: theme3.BASE_COLOR,
|
|
1103
|
+
position: "relative",
|
|
1104
|
+
border: `1px solid ${theme3.TABLE_BORDER_COLOR}`,
|
|
1105
|
+
fontFamily: theme3.BASE_FONT_FAMILY,
|
|
1106
|
+
fontSize: theme3.BASE_FONT_SIZE,
|
|
1107
|
+
lineHeight: "120%",
|
|
1108
|
+
boxSizing: "border-box",
|
|
1109
|
+
cursor: "default"
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
TableInspectorHeaderContainer: {
|
|
1113
|
+
base: {
|
|
1114
|
+
top: 0,
|
|
1115
|
+
height: "17px",
|
|
1116
|
+
left: 0,
|
|
1117
|
+
right: 0,
|
|
1118
|
+
overflowX: "hidden"
|
|
1119
|
+
},
|
|
1120
|
+
table: {
|
|
1121
|
+
tableLayout: "fixed",
|
|
1122
|
+
borderSpacing: 0,
|
|
1123
|
+
borderCollapse: "separate",
|
|
1124
|
+
height: "100%",
|
|
1125
|
+
width: "100%",
|
|
1126
|
+
margin: 0
|
|
1127
|
+
}
|
|
1128
|
+
},
|
|
1129
|
+
TableInspectorDataContainer: {
|
|
1130
|
+
tr: {
|
|
1131
|
+
display: "table-row"
|
|
1132
|
+
},
|
|
1133
|
+
td: {
|
|
1134
|
+
boxSizing: "border-box",
|
|
1135
|
+
border: "none",
|
|
1136
|
+
height: "16px",
|
|
1137
|
+
verticalAlign: "top",
|
|
1138
|
+
padding: "1px 4px",
|
|
1139
|
+
WebkitUserSelect: "text",
|
|
1140
|
+
whiteSpace: "nowrap",
|
|
1141
|
+
textOverflow: "ellipsis",
|
|
1142
|
+
overflow: "hidden",
|
|
1143
|
+
lineHeight: "14px"
|
|
1144
|
+
},
|
|
1145
|
+
div: {
|
|
1146
|
+
position: "static",
|
|
1147
|
+
top: "17px",
|
|
1148
|
+
bottom: 0,
|
|
1149
|
+
overflowY: "overlay",
|
|
1150
|
+
transform: "translateZ(0)",
|
|
1151
|
+
left: 0,
|
|
1152
|
+
right: 0,
|
|
1153
|
+
overflowX: "hidden"
|
|
1154
|
+
},
|
|
1155
|
+
table: {
|
|
1156
|
+
positon: "static",
|
|
1157
|
+
left: 0,
|
|
1158
|
+
top: 0,
|
|
1159
|
+
right: 0,
|
|
1160
|
+
bottom: 0,
|
|
1161
|
+
borderTop: "0 none transparent",
|
|
1162
|
+
margin: 0,
|
|
1163
|
+
backgroundImage: theme3.TABLE_DATA_BACKGROUND_IMAGE,
|
|
1164
|
+
backgroundSize: theme3.TABLE_DATA_BACKGROUND_SIZE,
|
|
1165
|
+
tableLayout: "fixed",
|
|
1166
|
+
borderSpacing: 0,
|
|
1167
|
+
borderCollapse: "separate",
|
|
1168
|
+
width: "100%",
|
|
1169
|
+
fontSize: theme3.BASE_FONT_SIZE,
|
|
1170
|
+
lineHeight: "120%"
|
|
1171
|
+
}
|
|
1172
|
+
},
|
|
1173
|
+
TableInspectorTH: {
|
|
1174
|
+
base: {
|
|
1175
|
+
position: "relative",
|
|
1176
|
+
height: "auto",
|
|
1177
|
+
textAlign: "left",
|
|
1178
|
+
backgroundColor: theme3.TABLE_TH_BACKGROUND_COLOR,
|
|
1179
|
+
borderBottom: `1px solid ${theme3.TABLE_BORDER_COLOR}`,
|
|
1180
|
+
fontWeight: "normal",
|
|
1181
|
+
verticalAlign: "middle",
|
|
1182
|
+
padding: "0 4px",
|
|
1183
|
+
whiteSpace: "nowrap",
|
|
1184
|
+
textOverflow: "ellipsis",
|
|
1185
|
+
overflow: "hidden",
|
|
1186
|
+
lineHeight: "14px",
|
|
1187
|
+
":hover": {
|
|
1188
|
+
backgroundColor: theme3.TABLE_TH_HOVER_COLOR
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
div: {
|
|
1192
|
+
whiteSpace: "nowrap",
|
|
1193
|
+
textOverflow: "ellipsis",
|
|
1194
|
+
overflow: "hidden",
|
|
1195
|
+
fontSize: theme3.BASE_FONT_SIZE,
|
|
1196
|
+
lineHeight: "120%"
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1199
|
+
TableInspectorLeftBorder: {
|
|
1200
|
+
none: {
|
|
1201
|
+
borderLeft: "none"
|
|
1202
|
+
},
|
|
1203
|
+
solid: {
|
|
1204
|
+
borderLeft: `1px solid ${theme3.TABLE_BORDER_COLOR}`
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
1207
|
+
TableInspectorSortIcon: {
|
|
1208
|
+
display: "block",
|
|
1209
|
+
marginRight: 3,
|
|
1210
|
+
width: 8,
|
|
1211
|
+
height: 7,
|
|
1212
|
+
marginTop: -7,
|
|
1213
|
+
color: theme3.TABLE_SORT_ICON_COLOR,
|
|
1214
|
+
fontSize: 12,
|
|
1215
|
+
...unselectable
|
|
1216
|
+
}
|
|
1217
|
+
}), DEFAULT_THEME_NAME = "chromeLight", ThemeContext = createContext2(createTheme(themes_exports[DEFAULT_THEME_NAME])), useStyles = (baseStylesKey) => useContext(ThemeContext)[baseStylesKey], themeAcceptor = (WrappedComponent) => ({ theme: theme3 = DEFAULT_THEME_NAME, ...restProps }) => {
|
|
1218
|
+
let themeStyles = useMemo2(() => {
|
|
1219
|
+
switch (Object.prototype.toString.call(theme3)) {
|
|
1220
|
+
case "[object String]":
|
|
1221
|
+
return createTheme(themes_exports[theme3]);
|
|
1222
|
+
case "[object Object]":
|
|
1223
|
+
return createTheme(theme3);
|
|
1224
|
+
default:
|
|
1225
|
+
return createTheme(themes_exports[DEFAULT_THEME_NAME]);
|
|
1226
|
+
}
|
|
1227
|
+
}, [theme3]);
|
|
1228
|
+
return React4.createElement(ThemeContext.Provider, {
|
|
1229
|
+
value: themeStyles
|
|
1230
|
+
}, React4.createElement(WrappedComponent, {
|
|
1231
|
+
...restProps
|
|
1232
|
+
}));
|
|
1233
|
+
}, Arrow = ({ expanded, styles }) => React22.createElement("span", {
|
|
1234
|
+
style: {
|
|
1235
|
+
...styles.base,
|
|
1236
|
+
...expanded ? styles.expanded : styles.collapsed
|
|
1237
|
+
}
|
|
1238
|
+
}, "\u25B6"), TreeNode = memo((props) => {
|
|
1239
|
+
props = {
|
|
1240
|
+
expanded: !0,
|
|
1241
|
+
nodeRenderer: ({ name }) => React22.createElement("span", null, name),
|
|
1242
|
+
onClick: () => {
|
|
1243
|
+
},
|
|
1244
|
+
shouldShowArrow: !1,
|
|
1245
|
+
shouldShowPlaceholder: !0,
|
|
1246
|
+
...props
|
|
1247
|
+
};
|
|
1248
|
+
let { expanded, onClick, children, nodeRenderer, title, shouldShowArrow, shouldShowPlaceholder } = props, styles = useStyles("TreeNode"), NodeRenderer = nodeRenderer;
|
|
1249
|
+
return React22.createElement("li", {
|
|
1250
|
+
"aria-expanded": expanded,
|
|
1251
|
+
role: "treeitem",
|
|
1252
|
+
style: styles.treeNodeBase,
|
|
1253
|
+
title
|
|
1254
|
+
}, React22.createElement("div", {
|
|
1255
|
+
style: styles.treeNodePreviewContainer,
|
|
1256
|
+
onClick
|
|
1257
|
+
}, shouldShowArrow || Children.count(children) > 0 ? React22.createElement(Arrow, {
|
|
1258
|
+
expanded,
|
|
1259
|
+
styles: styles.treeNodeArrow
|
|
1260
|
+
}) : shouldShowPlaceholder && React22.createElement("span", {
|
|
1261
|
+
style: styles.treeNodePlaceholder
|
|
1262
|
+
}, "\xA0"), React22.createElement(NodeRenderer, {
|
|
1263
|
+
...props
|
|
1264
|
+
})), React22.createElement("ol", {
|
|
1265
|
+
role: "group",
|
|
1266
|
+
style: styles.treeNodeChildNodesContainer
|
|
1267
|
+
}, expanded ? children : void 0));
|
|
1268
|
+
}), DEFAULT_ROOT_PATH = "$", WILDCARD = "*";
|
|
1269
|
+
function hasChildNodes(data, dataIterator) {
|
|
1270
|
+
return !dataIterator(data).next().done;
|
|
1271
|
+
}
|
|
1272
|
+
var wildcardPathsFromLevel = (level) => Array.from({ length: level }, (_, i) => [DEFAULT_ROOT_PATH].concat(Array.from({ length: i }, () => "*")).join(".")), getExpandedPaths = (data, dataIterator, expandPaths, expandLevel, prevExpandedPaths) => {
|
|
1273
|
+
let wildcardPaths = [].concat(wildcardPathsFromLevel(expandLevel)).concat(expandPaths).filter((path) => typeof path == "string"), expandedPaths = [];
|
|
1274
|
+
return wildcardPaths.forEach((wildcardPath) => {
|
|
1275
|
+
let keyPaths = wildcardPath.split("."), populatePaths = (curData, curPath, depth) => {
|
|
1276
|
+
if (depth === keyPaths.length) {
|
|
1277
|
+
expandedPaths.push(curPath);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
let key = keyPaths[depth];
|
|
1281
|
+
if (depth === 0)
|
|
1282
|
+
hasChildNodes(curData, dataIterator) && (key === DEFAULT_ROOT_PATH || key === WILDCARD) && populatePaths(curData, DEFAULT_ROOT_PATH, depth + 1);
|
|
1283
|
+
else if (key === WILDCARD)
|
|
1284
|
+
for (let { name, data: data2 } of dataIterator(curData))
|
|
1285
|
+
hasChildNodes(data2, dataIterator) && populatePaths(data2, `${curPath}.${name}`, depth + 1);
|
|
1286
|
+
else {
|
|
1287
|
+
let value = curData[key];
|
|
1288
|
+
hasChildNodes(value, dataIterator) && populatePaths(value, `${curPath}.${key}`, depth + 1);
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
populatePaths(data, "", 0);
|
|
1292
|
+
}), expandedPaths.reduce((obj, path) => (obj[path] = !0, obj), { ...prevExpandedPaths });
|
|
1293
|
+
}, ConnectedTreeNode = memo2((props) => {
|
|
1294
|
+
let { data, dataIterator, path, depth, nodeRenderer } = props, [expandedPaths, setExpandedPaths] = useContext2(ExpandedPathsContext), nodeHasChildNodes = hasChildNodes(data, dataIterator), expanded = !!expandedPaths[path], handleClick = useCallback2(() => nodeHasChildNodes && setExpandedPaths((prevExpandedPaths) => ({
|
|
1295
|
+
...prevExpandedPaths,
|
|
1296
|
+
[path]: !expanded
|
|
1297
|
+
})), [nodeHasChildNodes, setExpandedPaths, path, expanded]);
|
|
1298
|
+
return React3.createElement(TreeNode, {
|
|
1299
|
+
expanded,
|
|
1300
|
+
onClick: handleClick,
|
|
1301
|
+
shouldShowArrow: nodeHasChildNodes,
|
|
1302
|
+
shouldShowPlaceholder: depth > 0,
|
|
1303
|
+
nodeRenderer,
|
|
1304
|
+
...props
|
|
1305
|
+
}, expanded ? [...dataIterator(data)].map(({ name, data: data2, ...renderNodeProps }) => React3.createElement(ConnectedTreeNode, {
|
|
1306
|
+
name,
|
|
1307
|
+
data: data2,
|
|
1308
|
+
depth: depth + 1,
|
|
1309
|
+
path: `${path}.${name}`,
|
|
1310
|
+
key: name,
|
|
1311
|
+
dataIterator,
|
|
1312
|
+
nodeRenderer,
|
|
1313
|
+
...renderNodeProps
|
|
1314
|
+
})) : null);
|
|
1315
|
+
}), TreeView = memo2(({ name, data, dataIterator, nodeRenderer, expandPaths, expandLevel }) => {
|
|
1316
|
+
let styles = useStyles("TreeView"), stateAndSetter = useState2({}), [, setExpandedPaths] = stateAndSetter;
|
|
1317
|
+
return useLayoutEffect(() => setExpandedPaths((prevExpandedPaths) => getExpandedPaths(data, dataIterator, expandPaths, expandLevel, prevExpandedPaths)), [data, dataIterator, expandPaths, expandLevel]), React3.createElement(ExpandedPathsContext.Provider, {
|
|
1318
|
+
value: stateAndSetter
|
|
1319
|
+
}, React3.createElement("ol", {
|
|
1320
|
+
role: "tree",
|
|
1321
|
+
style: styles.treeViewOutline
|
|
1322
|
+
}, React3.createElement(ConnectedTreeNode, {
|
|
1323
|
+
name,
|
|
1324
|
+
data,
|
|
1325
|
+
dataIterator,
|
|
1326
|
+
depth: 0,
|
|
1327
|
+
path: DEFAULT_ROOT_PATH,
|
|
1328
|
+
nodeRenderer
|
|
1329
|
+
})));
|
|
1330
|
+
}), ObjectName = ({ name, dimmed = !1, styles = {} }) => {
|
|
1331
|
+
let themeStyles = useStyles("ObjectName"), appliedStyles = {
|
|
1332
|
+
...themeStyles.base,
|
|
1333
|
+
...dimmed ? themeStyles.dimmed : {},
|
|
1334
|
+
...styles
|
|
1335
|
+
};
|
|
1336
|
+
return React42.createElement("span", {
|
|
1337
|
+
style: appliedStyles
|
|
1338
|
+
}, name);
|
|
1339
|
+
}, ObjectValue = ({ object: object2, styles }) => {
|
|
1340
|
+
let themeStyles = useStyles("ObjectValue"), mkStyle = (key) => ({ ...themeStyles[key], ...styles });
|
|
1341
|
+
switch (typeof object2) {
|
|
1342
|
+
case "bigint":
|
|
1343
|
+
return React5.createElement("span", {
|
|
1344
|
+
style: mkStyle("objectValueNumber")
|
|
1345
|
+
}, String(object2), "n");
|
|
1346
|
+
case "number":
|
|
1347
|
+
return React5.createElement("span", {
|
|
1348
|
+
style: mkStyle("objectValueNumber")
|
|
1349
|
+
}, String(object2));
|
|
1350
|
+
case "string":
|
|
1351
|
+
return React5.createElement("span", {
|
|
1352
|
+
style: mkStyle("objectValueString")
|
|
1353
|
+
}, '"', object2, '"');
|
|
1354
|
+
case "boolean":
|
|
1355
|
+
return React5.createElement("span", {
|
|
1356
|
+
style: mkStyle("objectValueBoolean")
|
|
1357
|
+
}, String(object2));
|
|
1358
|
+
case "undefined":
|
|
1359
|
+
return React5.createElement("span", {
|
|
1360
|
+
style: mkStyle("objectValueUndefined")
|
|
1361
|
+
}, "undefined");
|
|
1362
|
+
case "object":
|
|
1363
|
+
return object2 === null ? React5.createElement("span", {
|
|
1364
|
+
style: mkStyle("objectValueNull")
|
|
1365
|
+
}, "null") : object2 instanceof Date ? React5.createElement("span", null, object2.toString()) : object2 instanceof RegExp ? React5.createElement("span", {
|
|
1366
|
+
style: mkStyle("objectValueRegExp")
|
|
1367
|
+
}, object2.toString()) : Array.isArray(object2) ? React5.createElement("span", null, `Array(${object2.length})`) : object2.constructor ? typeof object2.constructor.isBuffer == "function" && object2.constructor.isBuffer(object2) ? React5.createElement("span", null, `Buffer[${object2.length}]`) : React5.createElement("span", null, object2.constructor.name) : React5.createElement("span", null, "Object");
|
|
1368
|
+
case "function":
|
|
1369
|
+
return React5.createElement("span", null, React5.createElement("span", {
|
|
1370
|
+
style: mkStyle("objectValueFunctionPrefix")
|
|
1371
|
+
}, "\u0192\xA0"), React5.createElement("span", {
|
|
1372
|
+
style: mkStyle("objectValueFunctionName")
|
|
1373
|
+
}, object2.name, "()"));
|
|
1374
|
+
case "symbol":
|
|
1375
|
+
return React5.createElement("span", {
|
|
1376
|
+
style: mkStyle("objectValueSymbol")
|
|
1377
|
+
}, object2.toString());
|
|
1378
|
+
default:
|
|
1379
|
+
return React5.createElement("span", null);
|
|
1380
|
+
}
|
|
1381
|
+
}, hasOwnProperty = Object.prototype.hasOwnProperty, propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
1382
|
+
function getPropertyValue(object2, propertyName) {
|
|
1383
|
+
let propertyDescriptor = Object.getOwnPropertyDescriptor(object2, propertyName);
|
|
1384
|
+
if (propertyDescriptor.get)
|
|
1385
|
+
try {
|
|
1386
|
+
return propertyDescriptor.get();
|
|
1387
|
+
} catch {
|
|
1388
|
+
return propertyDescriptor.get;
|
|
1389
|
+
}
|
|
1390
|
+
return object2[propertyName];
|
|
1391
|
+
}
|
|
1392
|
+
function intersperse(arr, sep) {
|
|
1393
|
+
return arr.length === 0 ? [] : arr.slice(1).reduce((xs, x) => xs.concat([sep, x]), [arr[0]]);
|
|
1394
|
+
}
|
|
1395
|
+
var ObjectPreview = ({ data }) => {
|
|
1396
|
+
let styles = useStyles("ObjectPreview"), object2 = data;
|
|
1397
|
+
if (typeof object2 != "object" || object2 === null || object2 instanceof Date || object2 instanceof RegExp)
|
|
1398
|
+
return React6.createElement(ObjectValue, {
|
|
1399
|
+
object: object2
|
|
1400
|
+
});
|
|
1401
|
+
if (Array.isArray(object2)) {
|
|
1402
|
+
let maxProperties = styles.arrayMaxProperties, previewArray = object2.slice(0, maxProperties).map((element, index) => React6.createElement(ObjectValue, {
|
|
1403
|
+
key: index,
|
|
1404
|
+
object: element
|
|
1405
|
+
}));
|
|
1406
|
+
object2.length > maxProperties && previewArray.push(React6.createElement("span", {
|
|
1407
|
+
key: "ellipsis"
|
|
1408
|
+
}, "\u2026"));
|
|
1409
|
+
let arrayLength = object2.length;
|
|
1410
|
+
return React6.createElement(React6.Fragment, null, React6.createElement("span", {
|
|
1411
|
+
style: styles.objectDescription
|
|
1412
|
+
}, arrayLength === 0 ? "" : `(${arrayLength})\xA0`), React6.createElement("span", {
|
|
1413
|
+
style: styles.preview
|
|
1414
|
+
}, "[", intersperse(previewArray, ", "), "]"));
|
|
1415
|
+
} else {
|
|
1416
|
+
let maxProperties = styles.objectMaxProperties, propertyNodes = [];
|
|
1417
|
+
for (let propertyName in object2)
|
|
1418
|
+
if (hasOwnProperty.call(object2, propertyName)) {
|
|
1419
|
+
let ellipsis;
|
|
1420
|
+
propertyNodes.length === maxProperties - 1 && Object.keys(object2).length > maxProperties && (ellipsis = React6.createElement("span", {
|
|
1421
|
+
key: "ellipsis"
|
|
1422
|
+
}, "\u2026"));
|
|
1423
|
+
let propertyValue = getPropertyValue(object2, propertyName);
|
|
1424
|
+
if (propertyNodes.push(React6.createElement("span", {
|
|
1425
|
+
key: propertyName
|
|
1426
|
+
}, React6.createElement(ObjectName, {
|
|
1427
|
+
name: propertyName || '""'
|
|
1428
|
+
}), ":\xA0", React6.createElement(ObjectValue, {
|
|
1429
|
+
object: propertyValue
|
|
1430
|
+
}), ellipsis)), ellipsis)
|
|
1431
|
+
break;
|
|
1432
|
+
}
|
|
1433
|
+
let objectConstructorName = object2.constructor ? object2.constructor.name : "Object";
|
|
1434
|
+
return React6.createElement(React6.Fragment, null, React6.createElement("span", {
|
|
1435
|
+
style: styles.objectDescription
|
|
1436
|
+
}, objectConstructorName === "Object" ? "" : `${objectConstructorName} `), React6.createElement("span", {
|
|
1437
|
+
style: styles.preview
|
|
1438
|
+
}, "{", intersperse(propertyNodes, ", "), "}"));
|
|
1439
|
+
}
|
|
1440
|
+
}, ObjectRootLabel = ({ name, data }) => typeof name == "string" ? React7.createElement("span", null, React7.createElement(ObjectName, {
|
|
1441
|
+
name
|
|
1442
|
+
}), React7.createElement("span", null, ": "), React7.createElement(ObjectPreview, {
|
|
1443
|
+
data
|
|
1444
|
+
})) : React7.createElement(ObjectPreview, {
|
|
1445
|
+
data
|
|
1446
|
+
}), ObjectLabel = ({ name, data, isNonenumerable = !1 }) => {
|
|
1447
|
+
let object2 = data;
|
|
1448
|
+
return React8.createElement("span", null, typeof name == "string" ? React8.createElement(ObjectName, {
|
|
1449
|
+
name,
|
|
1450
|
+
dimmed: isNonenumerable
|
|
1451
|
+
}) : React8.createElement(ObjectPreview, {
|
|
1452
|
+
data: name
|
|
1453
|
+
}), React8.createElement("span", null, ": "), React8.createElement(ObjectValue, {
|
|
1454
|
+
object: object2
|
|
1455
|
+
}));
|
|
1456
|
+
}, createIterator = (showNonenumerable, sortObjectKeys) => function* (data) {
|
|
1457
|
+
if (!(typeof data == "object" && data !== null || typeof data == "function"))
|
|
1458
|
+
return;
|
|
1459
|
+
let dataIsArray = Array.isArray(data);
|
|
1460
|
+
if (!dataIsArray && data[Symbol.iterator]) {
|
|
1461
|
+
let i = 0;
|
|
1462
|
+
for (let entry of data) {
|
|
1463
|
+
if (Array.isArray(entry) && entry.length === 2) {
|
|
1464
|
+
let [k, v2] = entry;
|
|
1465
|
+
yield {
|
|
1466
|
+
name: k,
|
|
1467
|
+
data: v2
|
|
1468
|
+
};
|
|
1469
|
+
} else
|
|
1470
|
+
yield {
|
|
1471
|
+
name: i.toString(),
|
|
1472
|
+
data: entry
|
|
1473
|
+
};
|
|
1474
|
+
i++;
|
|
1475
|
+
}
|
|
1476
|
+
} else {
|
|
1477
|
+
let keys = Object.getOwnPropertyNames(data);
|
|
1478
|
+
sortObjectKeys === !0 && !dataIsArray ? keys.sort() : typeof sortObjectKeys == "function" && keys.sort(sortObjectKeys);
|
|
1479
|
+
for (let propertyName of keys)
|
|
1480
|
+
if (propertyIsEnumerable.call(data, propertyName)) {
|
|
1481
|
+
let propertyValue = getPropertyValue(data, propertyName);
|
|
1482
|
+
yield {
|
|
1483
|
+
name: propertyName || '""',
|
|
1484
|
+
data: propertyValue
|
|
1485
|
+
};
|
|
1486
|
+
} else if (showNonenumerable) {
|
|
1487
|
+
let propertyValue;
|
|
1488
|
+
try {
|
|
1489
|
+
propertyValue = getPropertyValue(data, propertyName);
|
|
1490
|
+
} catch {
|
|
1491
|
+
}
|
|
1492
|
+
propertyValue !== void 0 && (yield {
|
|
1493
|
+
name: propertyName,
|
|
1494
|
+
data: propertyValue,
|
|
1495
|
+
isNonenumerable: !0
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
showNonenumerable && data !== Object.prototype && (yield {
|
|
1499
|
+
name: "__proto__",
|
|
1500
|
+
data: Object.getPrototypeOf(data),
|
|
1501
|
+
isNonenumerable: !0
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
}, defaultNodeRenderer = ({ depth, name, data, isNonenumerable }) => depth === 0 ? React9.createElement(ObjectRootLabel, {
|
|
1505
|
+
name,
|
|
1506
|
+
data
|
|
1507
|
+
}) : React9.createElement(ObjectLabel, {
|
|
1508
|
+
name,
|
|
1509
|
+
data,
|
|
1510
|
+
isNonenumerable
|
|
1511
|
+
}), ObjectInspector = ({ showNonenumerable = !1, sortObjectKeys, nodeRenderer, ...treeViewProps }) => {
|
|
1512
|
+
let dataIterator = createIterator(showNonenumerable, sortObjectKeys), renderer = nodeRenderer || defaultNodeRenderer;
|
|
1513
|
+
return React9.createElement(TreeView, {
|
|
1514
|
+
nodeRenderer: renderer,
|
|
1515
|
+
dataIterator,
|
|
1516
|
+
...treeViewProps
|
|
1517
|
+
});
|
|
1518
|
+
}, themedObjectInspector = themeAcceptor(ObjectInspector);
|
|
1519
|
+
function getHeaders(data) {
|
|
1520
|
+
if (typeof data == "object") {
|
|
1521
|
+
let rowHeaders = [];
|
|
1522
|
+
if (Array.isArray(data)) {
|
|
1523
|
+
let nRows = data.length;
|
|
1524
|
+
rowHeaders = [...Array(nRows).keys()];
|
|
1525
|
+
} else data !== null && (rowHeaders = Object.keys(data));
|
|
1526
|
+
let colHeaders = rowHeaders.reduce((colHeaders2, rowHeader) => {
|
|
1527
|
+
let row = data[rowHeader];
|
|
1528
|
+
return typeof row == "object" && row !== null && Object.keys(row).reduce((xs, x) => (xs.includes(x) || xs.push(x), xs), colHeaders2), colHeaders2;
|
|
1529
|
+
}, []);
|
|
1530
|
+
return {
|
|
1531
|
+
rowHeaders,
|
|
1532
|
+
colHeaders
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
var DataContainer = ({ rows, columns, rowsData }) => {
|
|
1537
|
+
let styles = useStyles("TableInspectorDataContainer"), borderStyles = useStyles("TableInspectorLeftBorder");
|
|
1538
|
+
return React10.createElement("div", {
|
|
1539
|
+
style: styles.div
|
|
1540
|
+
}, React10.createElement("table", {
|
|
1541
|
+
style: styles.table
|
|
1542
|
+
}, React10.createElement("colgroup", null), React10.createElement("tbody", null, rows.map((row, i) => React10.createElement("tr", {
|
|
1543
|
+
key: row,
|
|
1544
|
+
style: styles.tr
|
|
1545
|
+
}, React10.createElement("td", {
|
|
1546
|
+
style: { ...styles.td, ...borderStyles.none }
|
|
1547
|
+
}, row), columns.map((column) => {
|
|
1548
|
+
let rowData = rowsData[i];
|
|
1549
|
+
return typeof rowData == "object" && rowData !== null && hasOwnProperty.call(rowData, column) ? React10.createElement("td", {
|
|
1550
|
+
key: column,
|
|
1551
|
+
style: { ...styles.td, ...borderStyles.solid }
|
|
1552
|
+
}, React10.createElement(ObjectValue, {
|
|
1553
|
+
object: rowData[column]
|
|
1554
|
+
})) : React10.createElement("td", {
|
|
1555
|
+
key: column,
|
|
1556
|
+
style: { ...styles.td, ...borderStyles.solid }
|
|
1557
|
+
});
|
|
1558
|
+
}))))));
|
|
1559
|
+
}, SortIconContainer = (props) => React11.createElement("div", {
|
|
1560
|
+
style: {
|
|
1561
|
+
position: "absolute",
|
|
1562
|
+
top: 1,
|
|
1563
|
+
right: 0,
|
|
1564
|
+
bottom: 1,
|
|
1565
|
+
display: "flex",
|
|
1566
|
+
alignItems: "center"
|
|
1567
|
+
}
|
|
1568
|
+
}, props.children), SortIcon = ({ sortAscending }) => {
|
|
1569
|
+
let styles = useStyles("TableInspectorSortIcon"), glyph = sortAscending ? "\u25B2" : "\u25BC";
|
|
1570
|
+
return React11.createElement("div", {
|
|
1571
|
+
style: styles
|
|
1572
|
+
}, glyph);
|
|
1573
|
+
}, TH = ({
|
|
1574
|
+
sortAscending = !1,
|
|
1575
|
+
sorted = !1,
|
|
1576
|
+
onClick = void 0,
|
|
1577
|
+
borderStyle = {},
|
|
1578
|
+
children,
|
|
1579
|
+
...thProps
|
|
1580
|
+
}) => {
|
|
1581
|
+
let styles = useStyles("TableInspectorTH"), [hovered, setHovered] = useState22(!1), handleMouseEnter = useCallback22(() => setHovered(!0), []), handleMouseLeave = useCallback22(() => setHovered(!1), []);
|
|
1582
|
+
return React11.createElement("th", {
|
|
1583
|
+
...thProps,
|
|
1584
|
+
style: {
|
|
1585
|
+
...styles.base,
|
|
1586
|
+
...borderStyle,
|
|
1587
|
+
...hovered ? styles.base[":hover"] : {}
|
|
1588
|
+
},
|
|
1589
|
+
onMouseEnter: handleMouseEnter,
|
|
1590
|
+
onMouseLeave: handleMouseLeave,
|
|
1591
|
+
onClick
|
|
1592
|
+
}, React11.createElement("div", {
|
|
1593
|
+
style: styles.div
|
|
1594
|
+
}, children), sorted && React11.createElement(SortIconContainer, null, React11.createElement(SortIcon, {
|
|
1595
|
+
sortAscending
|
|
1596
|
+
})));
|
|
1597
|
+
}, HeaderContainer = ({
|
|
1598
|
+
indexColumnText = "(index)",
|
|
1599
|
+
columns = [],
|
|
1600
|
+
sorted,
|
|
1601
|
+
sortIndexColumn,
|
|
1602
|
+
sortColumn,
|
|
1603
|
+
sortAscending,
|
|
1604
|
+
onTHClick,
|
|
1605
|
+
onIndexTHClick
|
|
1606
|
+
}) => {
|
|
1607
|
+
let styles = useStyles("TableInspectorHeaderContainer"), borderStyles = useStyles("TableInspectorLeftBorder");
|
|
1608
|
+
return React12.createElement("div", {
|
|
1609
|
+
style: styles.base
|
|
1610
|
+
}, React12.createElement("table", {
|
|
1611
|
+
style: styles.table
|
|
1612
|
+
}, React12.createElement("tbody", null, React12.createElement("tr", null, React12.createElement(TH, {
|
|
1613
|
+
borderStyle: borderStyles.none,
|
|
1614
|
+
sorted: sorted && sortIndexColumn,
|
|
1615
|
+
sortAscending,
|
|
1616
|
+
onClick: onIndexTHClick
|
|
1617
|
+
}, indexColumnText), columns.map((column) => React12.createElement(TH, {
|
|
1618
|
+
borderStyle: borderStyles.solid,
|
|
1619
|
+
key: column,
|
|
1620
|
+
sorted: sorted && sortColumn === column,
|
|
1621
|
+
sortAscending,
|
|
1622
|
+
onClick: onTHClick.bind(null, column)
|
|
1623
|
+
}, column))))));
|
|
1624
|
+
}, TableInspector = ({
|
|
1625
|
+
data,
|
|
1626
|
+
columns
|
|
1627
|
+
}) => {
|
|
1628
|
+
let styles = useStyles("TableInspector"), [{ sorted, sortIndexColumn, sortColumn, sortAscending }, setState] = useState3({
|
|
1629
|
+
sorted: !1,
|
|
1630
|
+
sortIndexColumn: !1,
|
|
1631
|
+
sortColumn: void 0,
|
|
1632
|
+
sortAscending: !1
|
|
1633
|
+
}), handleIndexTHClick = useCallback3(() => {
|
|
1634
|
+
setState(({ sortIndexColumn: sortIndexColumn2, sortAscending: sortAscending2 }) => ({
|
|
1635
|
+
sorted: !0,
|
|
1636
|
+
sortIndexColumn: !0,
|
|
1637
|
+
sortColumn: void 0,
|
|
1638
|
+
sortAscending: sortIndexColumn2 ? !sortAscending2 : !0
|
|
1639
|
+
}));
|
|
1640
|
+
}, []), handleTHClick = useCallback3((col) => {
|
|
1641
|
+
setState(({ sortColumn: sortColumn2, sortAscending: sortAscending2 }) => ({
|
|
1642
|
+
sorted: !0,
|
|
1643
|
+
sortIndexColumn: !1,
|
|
1644
|
+
sortColumn: col,
|
|
1645
|
+
sortAscending: col === sortColumn2 ? !sortAscending2 : !0
|
|
1646
|
+
}));
|
|
1647
|
+
}, []);
|
|
1648
|
+
if (typeof data != "object" || data === null)
|
|
1649
|
+
return React13.createElement("div", null);
|
|
1650
|
+
let { rowHeaders, colHeaders } = getHeaders(data);
|
|
1651
|
+
columns !== void 0 && (colHeaders = columns);
|
|
1652
|
+
let rowsData = rowHeaders.map((rowHeader) => data[rowHeader]), columnDataWithRowIndexes;
|
|
1653
|
+
if (sortColumn !== void 0 ? columnDataWithRowIndexes = rowsData.map((rowData, index) => typeof rowData == "object" && rowData !== null ? [rowData[sortColumn], index] : [void 0, index]) : sortIndexColumn && (columnDataWithRowIndexes = rowHeaders.map((rowData, index) => [rowHeaders[index], index])), columnDataWithRowIndexes !== void 0) {
|
|
1654
|
+
let comparator = (mapper, ascending) => (a, b) => {
|
|
1655
|
+
let v1 = mapper(a), v2 = mapper(b), type1 = typeof v1, type2 = typeof v2, lt = (v12, v22) => v12 < v22 ? -1 : v12 > v22 ? 1 : 0, result;
|
|
1656
|
+
if (type1 === type2)
|
|
1657
|
+
result = lt(v1, v2);
|
|
1658
|
+
else {
|
|
1659
|
+
let order = {
|
|
1660
|
+
string: 0,
|
|
1661
|
+
number: 1,
|
|
1662
|
+
object: 2,
|
|
1663
|
+
symbol: 3,
|
|
1664
|
+
boolean: 4,
|
|
1665
|
+
undefined: 5,
|
|
1666
|
+
function: 6
|
|
1667
|
+
};
|
|
1668
|
+
result = lt(order[type1], order[type2]);
|
|
1669
|
+
}
|
|
1670
|
+
return ascending || (result = -result), result;
|
|
1671
|
+
}, sortedRowIndexes = columnDataWithRowIndexes.sort(comparator((item) => item[0], sortAscending)).map((item) => item[1]);
|
|
1672
|
+
rowHeaders = sortedRowIndexes.map((i) => rowHeaders[i]), rowsData = sortedRowIndexes.map((i) => rowsData[i]);
|
|
1673
|
+
}
|
|
1674
|
+
return React13.createElement("div", {
|
|
1675
|
+
style: styles.base
|
|
1676
|
+
}, React13.createElement(HeaderContainer, {
|
|
1677
|
+
columns: colHeaders,
|
|
1678
|
+
sorted,
|
|
1679
|
+
sortIndexColumn,
|
|
1680
|
+
sortColumn,
|
|
1681
|
+
sortAscending,
|
|
1682
|
+
onTHClick: handleTHClick,
|
|
1683
|
+
onIndexTHClick: handleIndexTHClick
|
|
1684
|
+
}), React13.createElement(DataContainer, {
|
|
1685
|
+
rows: rowHeaders,
|
|
1686
|
+
columns: colHeaders,
|
|
1687
|
+
rowsData
|
|
1688
|
+
}));
|
|
1689
|
+
}, themedTableInspector = themeAcceptor(TableInspector), TEXT_NODE_MAX_INLINE_CHARS = 80, shouldInline = (data) => data.childNodes.length === 0 || data.childNodes.length === 1 && data.childNodes[0].nodeType === Node.TEXT_NODE && data.textContent.length < TEXT_NODE_MAX_INLINE_CHARS, OpenTag = ({ tagName, attributes, styles }) => React14.createElement("span", {
|
|
1690
|
+
style: styles.base
|
|
1691
|
+
}, "<", React14.createElement("span", {
|
|
1692
|
+
style: styles.tagName
|
|
1693
|
+
}, tagName), (() => {
|
|
1694
|
+
if (attributes) {
|
|
1695
|
+
let attributeNodes = [];
|
|
1696
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
1697
|
+
let attribute = attributes[i];
|
|
1698
|
+
attributeNodes.push(React14.createElement("span", {
|
|
1699
|
+
key: i
|
|
1700
|
+
}, " ", React14.createElement("span", {
|
|
1701
|
+
style: styles.htmlAttributeName
|
|
1702
|
+
}, attribute.name), '="', React14.createElement("span", {
|
|
1703
|
+
style: styles.htmlAttributeValue
|
|
1704
|
+
}, attribute.value), '"'));
|
|
1705
|
+
}
|
|
1706
|
+
return attributeNodes;
|
|
1707
|
+
}
|
|
1708
|
+
})(), ">"), CloseTag = ({ tagName, isChildNode = !1, styles }) => React14.createElement("span", {
|
|
1709
|
+
style: Object.assign({}, styles.base, isChildNode && styles.offsetLeft)
|
|
1710
|
+
}, "</", React14.createElement("span", {
|
|
1711
|
+
style: styles.tagName
|
|
1712
|
+
}, tagName), ">"), nameByNodeType = {
|
|
1713
|
+
1: "ELEMENT_NODE",
|
|
1714
|
+
3: "TEXT_NODE",
|
|
1715
|
+
7: "PROCESSING_INSTRUCTION_NODE",
|
|
1716
|
+
8: "COMMENT_NODE",
|
|
1717
|
+
9: "DOCUMENT_NODE",
|
|
1718
|
+
10: "DOCUMENT_TYPE_NODE",
|
|
1719
|
+
11: "DOCUMENT_FRAGMENT_NODE"
|
|
1720
|
+
}, DOMNodePreview = ({ isCloseTag, data, expanded }) => {
|
|
1721
|
+
let styles = useStyles("DOMNodePreview");
|
|
1722
|
+
if (isCloseTag)
|
|
1723
|
+
return React14.createElement(CloseTag, {
|
|
1724
|
+
styles: styles.htmlCloseTag,
|
|
1725
|
+
isChildNode: !0,
|
|
1726
|
+
tagName: data.tagName
|
|
1727
|
+
});
|
|
1728
|
+
switch (data.nodeType) {
|
|
1729
|
+
case Node.ELEMENT_NODE:
|
|
1730
|
+
return React14.createElement("span", null, React14.createElement(OpenTag, {
|
|
1731
|
+
tagName: data.tagName,
|
|
1732
|
+
attributes: data.attributes,
|
|
1733
|
+
styles: styles.htmlOpenTag
|
|
1734
|
+
}), shouldInline(data) ? data.textContent : !expanded && "\u2026", !expanded && React14.createElement(CloseTag, {
|
|
1735
|
+
tagName: data.tagName,
|
|
1736
|
+
styles: styles.htmlCloseTag
|
|
1737
|
+
}));
|
|
1738
|
+
case Node.TEXT_NODE:
|
|
1739
|
+
return React14.createElement("span", null, data.textContent);
|
|
1740
|
+
case Node.CDATA_SECTION_NODE:
|
|
1741
|
+
return React14.createElement("span", null, "<![CDATA[" + data.textContent + "]]>");
|
|
1742
|
+
case Node.COMMENT_NODE:
|
|
1743
|
+
return React14.createElement("span", {
|
|
1744
|
+
style: styles.htmlComment
|
|
1745
|
+
}, "<!--", data.textContent, "-->");
|
|
1746
|
+
case Node.PROCESSING_INSTRUCTION_NODE:
|
|
1747
|
+
return React14.createElement("span", null, data.nodeName);
|
|
1748
|
+
case Node.DOCUMENT_TYPE_NODE:
|
|
1749
|
+
return React14.createElement("span", {
|
|
1750
|
+
style: styles.htmlDoctype
|
|
1751
|
+
}, "<!DOCTYPE ", data.name, data.publicId ? ` PUBLIC "${data.publicId}"` : "", !data.publicId && data.systemId ? " SYSTEM" : "", data.systemId ? ` "${data.systemId}"` : "", ">");
|
|
1752
|
+
case Node.DOCUMENT_NODE:
|
|
1753
|
+
return React14.createElement("span", null, data.nodeName);
|
|
1754
|
+
case Node.DOCUMENT_FRAGMENT_NODE:
|
|
1755
|
+
return React14.createElement("span", null, data.nodeName);
|
|
1756
|
+
default:
|
|
1757
|
+
return React14.createElement("span", null, nameByNodeType[data.nodeType]);
|
|
1758
|
+
}
|
|
1759
|
+
}, domIterator = function* (data) {
|
|
1760
|
+
if (data && data.childNodes) {
|
|
1761
|
+
if (shouldInline(data))
|
|
1762
|
+
return;
|
|
1763
|
+
for (let i = 0; i < data.childNodes.length; i++) {
|
|
1764
|
+
let node = data.childNodes[i];
|
|
1765
|
+
node.nodeType === Node.TEXT_NODE && node.textContent.trim().length === 0 || (yield {
|
|
1766
|
+
name: `${node.tagName}[${i}]`,
|
|
1767
|
+
data: node
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
data.tagName && (yield {
|
|
1771
|
+
name: "CLOSE_TAG",
|
|
1772
|
+
data: {
|
|
1773
|
+
tagName: data.tagName
|
|
1774
|
+
},
|
|
1775
|
+
isCloseTag: !0
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
}, DOMInspector = (props) => React15.createElement(TreeView, {
|
|
1779
|
+
nodeRenderer: DOMNodePreview,
|
|
1780
|
+
dataIterator: domIterator,
|
|
1781
|
+
...props
|
|
1782
|
+
}), themedDOMInspector = themeAcceptor(DOMInspector), import_is_dom = __toESM2(require_is_dom()), Inspector = ({ table = !1, data, ...rest }) => table ? React16.createElement(themedTableInspector, {
|
|
1783
|
+
data,
|
|
1784
|
+
...rest
|
|
1785
|
+
}) : (0, import_is_dom.default)(data) ? React16.createElement(themedDOMInspector, {
|
|
1786
|
+
data,
|
|
1787
|
+
...rest
|
|
1788
|
+
}) : React16.createElement(themedObjectInspector, {
|
|
1789
|
+
data,
|
|
1790
|
+
...rest
|
|
1791
|
+
});
|
|
1792
|
+
|
|
1793
|
+
// src/actions/components/ActionLogger/index.tsx
|
|
1794
|
+
import { useTheme } from "@aussieljk/forkbook/theming";
|
|
1795
|
+
|
|
1796
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/actions/components/ActionLogger/index.module.css
|
|
1797
|
+
var id3 = "core/src/actions/components/ActionLogger/index.module.css";
|
|
1798
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id3}"]`)) {
|
|
1799
|
+
let style = document.createElement("style");
|
|
1800
|
+
style.setAttribute("data-sb-css", id3), style.textContent = ".sb-IaeYrG-wrapper{margin:0;padding:10px 5px 20px}.sb-IaeYrG-action{white-space:pre;border-bottom:1px solid #0000;border-left:5px solid #0000;align-items:flex-start;padding:0;transition:all .1s;display:flex}.sb-IaeYrG-counter{background-color:rgb(from var(--sb-app-border-color) r g b / calc(alpha + .5));color:var(--sb-color-inverse-text);font-size:var(--sb-size-s1);font-weight:var(--sb-weight-bold);border-radius:20px;margin:2px 0;padding:1px 5px;line-height:1}.sb-IaeYrG-inspectorContainer{flex:1;padding:0 0 0 5px}", document.head.appendChild(style);
|
|
1801
|
+
}
|
|
1802
|
+
var ActionLogger_default = { inspectorContainer: "sb-IaeYrG-inspectorContainer", counter: "sb-IaeYrG-counter", wrapper: "sb-IaeYrG-wrapper", action: "sb-IaeYrG-action" };
|
|
1803
|
+
|
|
1804
|
+
// src/actions/components/ActionLogger/index.tsx
|
|
1805
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1806
|
+
var ThemedInspector = (props) => {
|
|
1807
|
+
let theme3 = useTheme();
|
|
1808
|
+
return jsx6(Inspector, { theme: theme3.addonActionsTheme || "chromeLight", table: !1, ...props });
|
|
1809
|
+
}, ActionLogger = ({ actions, expandLevel, onClear }) => {
|
|
1810
|
+
let wrapperRef = useRef(null), wrapper = wrapperRef.current, wasAtBottom = wrapper && wrapper.scrollHeight - wrapper.scrollTop === wrapper.clientHeight;
|
|
1811
|
+
return useEffect2(() => {
|
|
1812
|
+
wasAtBottom && (wrapperRef.current.scrollTop = wrapperRef.current.scrollHeight);
|
|
1813
|
+
}, [wasAtBottom, actions.length]), jsxs6(Fragment3, { children: [
|
|
1814
|
+
jsx6(ScrollArea, { ref: wrapperRef, horizontal: !0, vertical: !0, className: ActionLogger_default.wrapper, children: actions.map((action) => jsxs6("div", { className: ActionLogger_default.action, children: [
|
|
1815
|
+
action.count > 1 && jsx6("div", { className: ActionLogger_default.counter, children: action.count }),
|
|
1816
|
+
jsx6("div", { className: ActionLogger_default.inspectorContainer, children: jsx6(
|
|
1817
|
+
ThemedInspector,
|
|
1818
|
+
{
|
|
1819
|
+
sortObjectKeys: !0,
|
|
1820
|
+
showNonenumerable: !1,
|
|
1821
|
+
name: action.data.name,
|
|
1822
|
+
data: action.data.args ?? action.data,
|
|
1823
|
+
expandLevel
|
|
1824
|
+
}
|
|
1825
|
+
) })
|
|
1826
|
+
] }, action.id)) }),
|
|
1827
|
+
jsx6(ActionBar, { actionItems: [{ title: "Clear", onClick: onClear }] })
|
|
1828
|
+
] });
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
// src/actions/containers/ActionLogger/index.tsx
|
|
1832
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1833
|
+
var safeDeepEqual = (a, b) => {
|
|
1834
|
+
try {
|
|
1835
|
+
return dequal(a, b);
|
|
1836
|
+
} catch {
|
|
1837
|
+
return !1;
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
function ActionLogger2({ active, api }) {
|
|
1841
|
+
let [actions, setActions] = useState4([]), expandLevel = useParameter2(PARAM_KEY2)?.expandLevel ?? 1, clearActions = useCallback4(() => {
|
|
1842
|
+
api.emit(CLEAR_ID), setActions([]);
|
|
1843
|
+
}, [api]), addAction = useCallback4((action) => {
|
|
1844
|
+
setActions((prevActions) => {
|
|
1845
|
+
let limit = action.options.limit ?? 50, previous = prevActions.length ? prevActions[prevActions.length - 1] : null;
|
|
1846
|
+
if (previous && safeDeepEqual(previous.data, action.data)) {
|
|
1847
|
+
let updated = [...prevActions];
|
|
1848
|
+
return updated[updated.length - 1] = {
|
|
1849
|
+
...previous,
|
|
1850
|
+
count: previous.count + 1
|
|
1851
|
+
}, updated.slice(-limit);
|
|
1852
|
+
} else {
|
|
1853
|
+
let newAction = { ...action, count: 1 };
|
|
1854
|
+
return [...prevActions, newAction].slice(-limit);
|
|
1855
|
+
}
|
|
1856
|
+
});
|
|
1857
|
+
}, []), handleStoryChange = useCallback4(() => {
|
|
1858
|
+
actions.length > 0 && actions[0].options.clearOnStoryChange && clearActions();
|
|
1859
|
+
}, [actions, clearActions]);
|
|
1860
|
+
useEffect3(() => (api.on(EVENT_ID, addAction), api.on(STORY_CHANGED2, handleStoryChange), () => {
|
|
1861
|
+
api.off(EVENT_ID, addAction), api.off(STORY_CHANGED2, handleStoryChange);
|
|
1862
|
+
}), [api, addAction, handleStoryChange]);
|
|
1863
|
+
let props = useMemo3(
|
|
1864
|
+
() => ({
|
|
1865
|
+
actions,
|
|
1866
|
+
expandLevel,
|
|
1867
|
+
onClear: clearActions
|
|
1868
|
+
}),
|
|
1869
|
+
[actions, expandLevel, clearActions]
|
|
1870
|
+
);
|
|
1871
|
+
return active ? jsx7(ActionLogger, { ...props }) : null;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// src/actions/manager.tsx
|
|
1875
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1876
|
+
var manager_default4 = addons4.register(ADDON_ID2, (api) => {
|
|
1877
|
+
globalThis?.FEATURES?.actions && addons4.add(PANEL_ID, {
|
|
1878
|
+
title: Title2,
|
|
1879
|
+
type: types2.PANEL,
|
|
1880
|
+
render: ({ active }) => jsx8(ActionLogger2, { api, active: !!active }),
|
|
1881
|
+
paramKey: PARAM_KEY2
|
|
1882
|
+
});
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
// src/component-testing/manager.tsx
|
|
1886
|
+
import { AddonPanel as AddonPanel2 } from "@aussieljk/forkbook/internal/components";
|
|
1887
|
+
import { Consumer, addons as addons5, types as types3 } from "@aussieljk/forkbook/manager-api";
|
|
1888
|
+
|
|
1889
|
+
// src/component-testing/components/Panel.tsx
|
|
1890
|
+
import { Fragment as Fragment8, memo as memo4, useEffect as useEffect10, useMemo as useMemo4, useRef as useRef2, useState as useState11 } from "react";
|
|
1891
|
+
import {
|
|
1892
|
+
FORCE_REMOUNT,
|
|
1893
|
+
PLAY_FUNCTION_THREW_EXCEPTION,
|
|
1894
|
+
STORY_RENDER_PHASE_CHANGED,
|
|
1895
|
+
STORY_THREW_EXCEPTION,
|
|
1896
|
+
UNHANDLED_ERRORS_WHILE_PLAYING
|
|
1897
|
+
} from "@aussieljk/forkbook/internal/core-events";
|
|
1898
|
+
import { global as global2 } from "@storybook/global";
|
|
1899
|
+
import {
|
|
1900
|
+
experimental_useStatusStore,
|
|
1901
|
+
useAddonState as useAddonState2,
|
|
1902
|
+
useChannel as useChannel3,
|
|
1903
|
+
useParameter as useParameter3,
|
|
1904
|
+
useStorybookApi as useStorybookApi6,
|
|
1905
|
+
useStorybookState as useStorybookState2
|
|
1906
|
+
} from "@aussieljk/forkbook/manager-api";
|
|
1907
|
+
|
|
1908
|
+
// src/component-testing/components/InteractionsPanel.tsx
|
|
1909
|
+
import * as React31 from "react";
|
|
1910
|
+
|
|
1911
|
+
// src/component-testing/utils.ts
|
|
1912
|
+
var import_ansi_to_html = __toESM(require_ansi_to_html(), 1);
|
|
1913
|
+
import { useTheme as useTheme2 } from "@aussieljk/forkbook/theming";
|
|
1914
|
+
|
|
1915
|
+
// ../../node_modules/strip-ansi/node_modules/ansi-regex/index.js
|
|
1916
|
+
function ansiRegex({ onlyFirst = !1 } = {}) {
|
|
1917
|
+
let pattern = "(?:(?:\\u001B\\]|\\u009D)[^\\u0007\\u001B\\u009C\\u009D]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
1918
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
// ../../node_modules/strip-ansi/index.js
|
|
1922
|
+
var regex = ansiRegex();
|
|
1923
|
+
function stripAnsi(string2) {
|
|
1924
|
+
if (typeof string2 != "string")
|
|
1925
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string2}\``);
|
|
1926
|
+
return !string2.includes("\x1B") && !string2.includes("\x9B") ? string2 : string2.replace(regex, "");
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
// src/component-testing/utils.ts
|
|
1930
|
+
function isInteractionsDisabled(parameters) {
|
|
1931
|
+
return !!parameters?.[PARAM_KEY5]?.disable;
|
|
1932
|
+
}
|
|
1933
|
+
function isTestAssertionError(error) {
|
|
1934
|
+
return isChaiError(error) || isJestError(error);
|
|
1935
|
+
}
|
|
1936
|
+
function isChaiError(error) {
|
|
1937
|
+
return error && typeof error == "object" && "name" in error && typeof error.name == "string" && error.name === "AssertionError";
|
|
1938
|
+
}
|
|
1939
|
+
function isJestError(error) {
|
|
1940
|
+
return error && typeof error == "object" && "message" in error && typeof error.message == "string" && stripAnsi(error.message).startsWith("expect(");
|
|
1941
|
+
}
|
|
1942
|
+
function createAnsiToHtmlFilter(theme3) {
|
|
1943
|
+
return new import_ansi_to_html.default({
|
|
1944
|
+
escapeXML: !0,
|
|
1945
|
+
fg: theme3.color.defaultText,
|
|
1946
|
+
bg: theme3.background.content
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
function useAnsiToHtmlFilter() {
|
|
1950
|
+
let theme3 = useTheme2();
|
|
1951
|
+
return createAnsiToHtmlFilter(theme3);
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// src/component-testing/components/DetachedDebuggerMessage.tsx
|
|
1955
|
+
import { Link } from "@aussieljk/forkbook/internal/components";
|
|
1956
|
+
|
|
1957
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/DetachedDebuggerMessage.module.css
|
|
1958
|
+
var id4 = "core/src/component-testing/components/DetachedDebuggerMessage.module.css";
|
|
1959
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id4}"]`)) {
|
|
1960
|
+
let style = document.createElement("style");
|
|
1961
|
+
style.setAttribute("data-sb-css", id4), style.textContent = ".sb-McV2ua-message{text-align:start;font-size:calc(var(--sb-size-s2) - 1px);font-weight:var(--sb-weight-regular);background:var(--sb-background-app);border-bottom:1px solid var(--sb-color-border);color:var(--sb-color-default-text);background-clip:padding-box;padding:11px 15px;line-height:1rem;position:relative}", document.head.appendChild(style);
|
|
1962
|
+
}
|
|
1963
|
+
var DetachedDebuggerMessage_default = { message: "sb-McV2ua-message" };
|
|
1964
|
+
|
|
1965
|
+
// src/component-testing/components/DetachedDebuggerMessage.tsx
|
|
1966
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1967
|
+
var DetachedDebuggerMessage = ({ storyUrl }) => jsxs7("div", { className: DetachedDebuggerMessage_default.message, children: [
|
|
1968
|
+
"Debugger controls are not available on composed Storybooks.",
|
|
1969
|
+
" ",
|
|
1970
|
+
jsx9(
|
|
1971
|
+
Link,
|
|
1972
|
+
{
|
|
1973
|
+
href: `${storyUrl}&addonPanel=${PANEL_ID2}`,
|
|
1974
|
+
target: "_blank",
|
|
1975
|
+
rel: "noopener noreferrer",
|
|
1976
|
+
withArrow: !0,
|
|
1977
|
+
children: "Open in external Forkbook"
|
|
1978
|
+
}
|
|
1979
|
+
)
|
|
1980
|
+
] });
|
|
1981
|
+
|
|
1982
|
+
// src/component-testing/components/EmptyState.tsx
|
|
1983
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
1984
|
+
import { EmptyTabContent, Link as Link2 } from "@aussieljk/forkbook/internal/components";
|
|
1985
|
+
import { DocumentIcon } from "@storybook/icons";
|
|
1986
|
+
import { useStorybookApi as useStorybookApi4 } from "@aussieljk/forkbook/manager-api";
|
|
1987
|
+
|
|
1988
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/EmptyState.module.css
|
|
1989
|
+
var id5 = "core/src/component-testing/components/EmptyState.module.css";
|
|
1990
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id5}"]`)) {
|
|
1991
|
+
let style = document.createElement("style");
|
|
1992
|
+
style.setAttribute("data-sb-css", id5), style.textContent = ".sb-m4u5Jq-links{font-size:calc(var(--sb-size-s2) - 1px);gap:25px;display:flex}", document.head.appendChild(style);
|
|
1993
|
+
}
|
|
1994
|
+
var EmptyState_default = { links: "sb-m4u5Jq-links" };
|
|
1995
|
+
|
|
1996
|
+
// src/component-testing/components/EmptyState.tsx
|
|
1997
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1998
|
+
var Empty = () => {
|
|
1999
|
+
let [isLoading, setIsLoading] = useState5(!0), docsUrl = useStorybookApi4().getDocsUrl({
|
|
2000
|
+
subpath: DOCUMENTATION_PLAY_FUNCTION_LINK,
|
|
2001
|
+
versioned: !0,
|
|
2002
|
+
renderer: !0
|
|
2003
|
+
});
|
|
2004
|
+
return useEffect4(() => {
|
|
2005
|
+
let load = setTimeout(() => {
|
|
2006
|
+
setIsLoading(!1);
|
|
2007
|
+
}, 100);
|
|
2008
|
+
return () => clearTimeout(load);
|
|
2009
|
+
}, []), isLoading ? null : jsx10("div", { children: jsx10(
|
|
2010
|
+
EmptyTabContent,
|
|
2011
|
+
{
|
|
2012
|
+
title: "Interactions",
|
|
2013
|
+
description: jsx10(Fragment4, { children: "Interactions allow you to verify the functional aspects of UIs. Write a play function for your story and you'll see it run here." }),
|
|
2014
|
+
footer: jsx10("div", { className: EmptyState_default.links, children: jsxs8(Link2, { href: docsUrl, target: "_blank", withArrow: !0, children: [
|
|
2015
|
+
jsx10(DocumentIcon, {}),
|
|
2016
|
+
" Read docs"
|
|
2017
|
+
] }) })
|
|
2018
|
+
}
|
|
2019
|
+
) });
|
|
2020
|
+
};
|
|
2021
|
+
|
|
2022
|
+
// src/component-testing/components/Interaction.tsx
|
|
2023
|
+
import * as React30 from "react";
|
|
2024
|
+
import { Button as Button2 } from "@aussieljk/forkbook/internal/components";
|
|
2025
|
+
import { ChevronDownIcon, ChevronUpIcon } from "@storybook/icons";
|
|
2026
|
+
|
|
2027
|
+
// src/component-testing/components/MethodCall.tsx
|
|
2028
|
+
import React29, { Fragment as Fragment5 } from "react";
|
|
2029
|
+
import { logger } from "@aussieljk/forkbook/internal/client-logger";
|
|
2030
|
+
|
|
2031
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspector.js
|
|
2032
|
+
var import_extends5 = __toESM(require_extends()), import_objectWithoutProperties6 = __toESM(require_objectWithoutProperties());
|
|
2033
|
+
import React28, { useEffect as useEffect8, useState as useState9 } from "react";
|
|
2034
|
+
|
|
2035
|
+
// ../../node_modules/@devtools-ds/object-inspector/node_modules/clsx/dist/clsx.m.js
|
|
2036
|
+
function toVal(mix) {
|
|
2037
|
+
var k, y, str = "";
|
|
2038
|
+
if (mix)
|
|
2039
|
+
if (typeof mix == "object")
|
|
2040
|
+
if (Array.isArray(mix))
|
|
2041
|
+
for (k = 0; k < mix.length; k++)
|
|
2042
|
+
mix[k] && (y = toVal(mix[k])) && (str && (str += " "), str += y);
|
|
2043
|
+
else
|
|
2044
|
+
for (k in mix)
|
|
2045
|
+
mix[k] && (y = toVal(k)) && (str && (str += " "), str += y);
|
|
2046
|
+
else typeof mix != "boolean" && !mix.call && (str && (str += " "), str += mix);
|
|
2047
|
+
return str;
|
|
2048
|
+
}
|
|
2049
|
+
function clsx_m_default() {
|
|
2050
|
+
for (var i = 0, x, str = ""; i < arguments.length; )
|
|
2051
|
+
(x = toVal(arguments[i++])) && (str && (str += " "), str += x);
|
|
2052
|
+
return str;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
// ../../node_modules/@devtools-ds/object-parser/dist/esm/index.js
|
|
2056
|
+
var isArray = (val) => Array.isArray(val) || // Detect https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
|
|
2057
|
+
ArrayBuffer.isView(val) && !(val instanceof DataView), isObject = (val) => val !== null && typeof val == "object" && !isArray(val) && !(val instanceof Date) && !(val instanceof RegExp) && !(val instanceof Error) && !(val instanceof WeakMap) && !(val instanceof WeakSet), isKnownObject = (val) => isObject(val) || isArray(val) || typeof val == "function" || val instanceof Promise, getPromiseState = (promise) => {
|
|
2058
|
+
let unique = /unique/;
|
|
2059
|
+
return Promise.race([promise, unique]).then((result) => result === unique ? ["pending"] : ["fulfilled", result], (e) => ["rejected", e]);
|
|
2060
|
+
}, buildAST = async (key, value, depth, sortKeys, isPrototype, showPrototype) => {
|
|
2061
|
+
let astNode = {
|
|
2062
|
+
key,
|
|
2063
|
+
depth,
|
|
2064
|
+
value,
|
|
2065
|
+
type: "value",
|
|
2066
|
+
parent: void 0
|
|
2067
|
+
};
|
|
2068
|
+
if (value && isKnownObject(value) && depth < 100) {
|
|
2069
|
+
let children = [], t = "object";
|
|
2070
|
+
if (isArray(value)) {
|
|
2071
|
+
for (let i = 0; i < value.length; i++)
|
|
2072
|
+
children.push(async () => {
|
|
2073
|
+
let child = await buildAST(i.toString(), value[i], depth + 1, sortKeys);
|
|
2074
|
+
return child.parent = astNode, child;
|
|
2075
|
+
});
|
|
2076
|
+
t = "array";
|
|
2077
|
+
} else {
|
|
2078
|
+
let keys = Object.getOwnPropertyNames(value);
|
|
2079
|
+
sortKeys && keys.sort();
|
|
2080
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2081
|
+
let safeValue;
|
|
2082
|
+
try {
|
|
2083
|
+
safeValue = value[keys[i]];
|
|
2084
|
+
} catch {
|
|
2085
|
+
}
|
|
2086
|
+
children.push(async () => {
|
|
2087
|
+
let child = await buildAST(keys[i], safeValue, depth + 1, sortKeys);
|
|
2088
|
+
return child.parent = astNode, child;
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
if (typeof value == "function" && (t = "function"), value instanceof Promise) {
|
|
2092
|
+
let [status, result] = await getPromiseState(value);
|
|
2093
|
+
children.push(async () => {
|
|
2094
|
+
let child = await buildAST("<state>", status, depth + 1, sortKeys);
|
|
2095
|
+
return child.parent = astNode, child;
|
|
2096
|
+
}), status !== "pending" && children.push(async () => {
|
|
2097
|
+
let child = await buildAST("<value>", result, depth + 1, sortKeys);
|
|
2098
|
+
return child.parent = astNode, child;
|
|
2099
|
+
}), t = "promise";
|
|
2100
|
+
}
|
|
2101
|
+
if (value instanceof Map) {
|
|
2102
|
+
let parsedEntries = Array.from(value.entries()).map((entry) => {
|
|
2103
|
+
let [entryKey, entryValue] = entry;
|
|
2104
|
+
return {
|
|
2105
|
+
"<key>": entryKey,
|
|
2106
|
+
"<value>": entryValue
|
|
2107
|
+
};
|
|
2108
|
+
});
|
|
2109
|
+
children.push(async () => {
|
|
2110
|
+
let child = await buildAST("<entries>", parsedEntries, depth + 1, sortKeys);
|
|
2111
|
+
return child.parent = astNode, child;
|
|
2112
|
+
}), children.push(async () => {
|
|
2113
|
+
let child = await buildAST("size", value.size, depth + 1, sortKeys);
|
|
2114
|
+
return child.parent = astNode, child;
|
|
2115
|
+
}), t = "map";
|
|
2116
|
+
}
|
|
2117
|
+
if (value instanceof Set) {
|
|
2118
|
+
let parsedEntries = Array.from(value.entries()).map((entry) => entry[1]);
|
|
2119
|
+
children.push(async () => {
|
|
2120
|
+
let child = await buildAST("<entries>", parsedEntries, depth + 1, sortKeys);
|
|
2121
|
+
return child.parent = astNode, child;
|
|
2122
|
+
}), children.push(async () => {
|
|
2123
|
+
let child = await buildAST("size", value.size, depth + 1, sortKeys);
|
|
2124
|
+
return child.parent = astNode, child;
|
|
2125
|
+
}), t = "set";
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
value !== Object.prototype && showPrototype && children.push(async () => {
|
|
2129
|
+
let child = await buildAST("<prototype>", Object.getPrototypeOf(value), depth + 1, sortKeys, !0);
|
|
2130
|
+
return child.parent = astNode, child;
|
|
2131
|
+
}), astNode.type = t, astNode.children = children, astNode.isPrototype = isPrototype;
|
|
2132
|
+
}
|
|
2133
|
+
return astNode;
|
|
2134
|
+
}, parse = (data, sortKeys, includePrototypes) => buildAST("root", data, 0, sortKeys === !1 ? sortKeys : !0, void 0, includePrototypes === !1 ? includePrototypes : !0);
|
|
2135
|
+
|
|
2136
|
+
// ../../node_modules/@devtools-ds/themes/dist/esm/utils.js
|
|
2137
|
+
var import_objectSpread2 = __toESM(require_objectSpread2()), import_objectWithoutProperties = __toESM(require_objectWithoutProperties2());
|
|
2138
|
+
import React20 from "react";
|
|
2139
|
+
|
|
2140
|
+
// ../../node_modules/@devtools-ds/themes/node_modules/clsx/dist/clsx.m.js
|
|
2141
|
+
function toVal2(mix) {
|
|
2142
|
+
var k, y, str = "";
|
|
2143
|
+
if (mix)
|
|
2144
|
+
if (typeof mix == "object")
|
|
2145
|
+
if (Array.isArray(mix))
|
|
2146
|
+
for (k = 0; k < mix.length; k++)
|
|
2147
|
+
mix[k] && (y = toVal2(mix[k])) && (str && (str += " "), str += y);
|
|
2148
|
+
else
|
|
2149
|
+
for (k in mix)
|
|
2150
|
+
mix[k] && (y = toVal2(k)) && (str && (str += " "), str += y);
|
|
2151
|
+
else typeof mix != "boolean" && !mix.call && (str && (str += " "), str += mix);
|
|
2152
|
+
return str;
|
|
2153
|
+
}
|
|
2154
|
+
function clsx_m_default2() {
|
|
2155
|
+
for (var i = 0, x, str = ""; i < arguments.length; )
|
|
2156
|
+
(x = toVal2(arguments[i++])) && (str && (str += " "), str += x);
|
|
2157
|
+
return str;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
// ../../node_modules/@devtools-ds/themes/dist/esm/utils.js
|
|
2161
|
+
var _excluded = ["children"];
|
|
2162
|
+
var ThemeContext2 = React20.createContext({
|
|
2163
|
+
theme: "chrome",
|
|
2164
|
+
colorScheme: "light"
|
|
2165
|
+
});
|
|
2166
|
+
var ThemeProvider = (_ref) => {
|
|
2167
|
+
let {
|
|
2168
|
+
children
|
|
2169
|
+
} = _ref, value = (0, import_objectWithoutProperties.default)(_ref, _excluded), wrappedTheme = React20.useContext(ThemeContext2);
|
|
2170
|
+
return React20.createElement(ThemeContext2.Provider, {
|
|
2171
|
+
value: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, wrappedTheme), value)
|
|
2172
|
+
}, children);
|
|
2173
|
+
}, useTheme3 = (props, styles = {}) => {
|
|
2174
|
+
let themeContext = React20.useContext(ThemeContext2), currentTheme = props.theme || themeContext.theme || "chrome", currentColorScheme = props.colorScheme || themeContext.colorScheme || "light", themeClass = clsx_m_default2(styles[currentTheme], styles[currentColorScheme]);
|
|
2175
|
+
return {
|
|
2176
|
+
currentColorScheme,
|
|
2177
|
+
currentTheme,
|
|
2178
|
+
themeClass
|
|
2179
|
+
};
|
|
2180
|
+
};
|
|
2181
|
+
|
|
2182
|
+
// ../../node_modules/@devtools-ds/themes/dist/esm/AutoThemeProvider.js
|
|
2183
|
+
var import_extends = __toESM(require_extends2()), import_objectWithoutProperties2 = __toESM(require_objectWithoutProperties2());
|
|
2184
|
+
import React21 from "react";
|
|
2185
|
+
|
|
2186
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspectorItem.js
|
|
2187
|
+
var import_objectSpread22 = __toESM(require_objectSpread22());
|
|
2188
|
+
import React27, { useEffect as useEffect7, useState as useState8 } from "react";
|
|
2189
|
+
|
|
2190
|
+
// ../../node_modules/@devtools-ds/tree/dist/esm/index.js
|
|
2191
|
+
var import_extends2 = __toESM(require_extends3()), import_objectWithoutProperties3 = __toESM(require_objectWithoutProperties3());
|
|
2192
|
+
import React24, { useState as useState6, useEffect as useEffect5 } from "react";
|
|
2193
|
+
|
|
2194
|
+
// ../../node_modules/@devtools-ds/tree/node_modules/clsx/dist/clsx.m.js
|
|
2195
|
+
function toVal3(mix) {
|
|
2196
|
+
var k, y, str = "";
|
|
2197
|
+
if (mix)
|
|
2198
|
+
if (typeof mix == "object")
|
|
2199
|
+
if (Array.isArray(mix))
|
|
2200
|
+
for (k = 0; k < mix.length; k++)
|
|
2201
|
+
mix[k] && (y = toVal3(mix[k])) && (str && (str += " "), str += y);
|
|
2202
|
+
else
|
|
2203
|
+
for (k in mix)
|
|
2204
|
+
mix[k] && (y = toVal3(k)) && (str && (str += " "), str += y);
|
|
2205
|
+
else typeof mix != "boolean" && !mix.call && (str && (str += " "), str += mix);
|
|
2206
|
+
return str;
|
|
2207
|
+
}
|
|
2208
|
+
function clsx_m_default3() {
|
|
2209
|
+
for (var i = 0, x, str = ""; i < arguments.length; )
|
|
2210
|
+
(x = toVal3(arguments[i++])) && (str && (str += " "), str += x);
|
|
2211
|
+
return str;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
// ../../node_modules/@devtools-ds/tree/dist/esm/TreeContext.js
|
|
2215
|
+
import React23 from "react";
|
|
2216
|
+
var TreeContext = React23.createContext({
|
|
2217
|
+
isChild: !1,
|
|
2218
|
+
depth: 0,
|
|
2219
|
+
hasHover: !0
|
|
2220
|
+
}), TreeContext_default = TreeContext;
|
|
2221
|
+
|
|
2222
|
+
// ../../node_modules/@devtools-ds/tree/dist/esm/Tree.css.js
|
|
2223
|
+
var Tree_css_default = { tree: "Tree-tree-fbbbe38", item: "Tree-item-353d6f3", group: "Tree-group-d3c3d8a", label: "Tree-label-d819155", focusWhite: "Tree-focusWhite-f1e00c2", arrow: "Tree-arrow-03ab2e7", hover: "Tree-hover-3cc4e5d", open: "Tree-open-3f1a336", dark: "Tree-dark-1b4aa00", chrome: "Tree-chrome-bcbcac6", light: "Tree-light-09174ee" };
|
|
2224
|
+
|
|
2225
|
+
// ../../node_modules/@devtools-ds/tree/dist/esm/index.js
|
|
2226
|
+
var _excluded2 = ["theme", "hover", "colorScheme", "children", "label", "className", "onUpdate", "onSelect", "open"], Tree = (props) => {
|
|
2227
|
+
let {
|
|
2228
|
+
theme: theme3,
|
|
2229
|
+
hover,
|
|
2230
|
+
colorScheme,
|
|
2231
|
+
children,
|
|
2232
|
+
label,
|
|
2233
|
+
className,
|
|
2234
|
+
onUpdate,
|
|
2235
|
+
onSelect,
|
|
2236
|
+
open
|
|
2237
|
+
} = props, html = (0, import_objectWithoutProperties3.default)(props, _excluded2), {
|
|
2238
|
+
themeClass,
|
|
2239
|
+
currentTheme
|
|
2240
|
+
} = useTheme3({
|
|
2241
|
+
theme: theme3,
|
|
2242
|
+
colorScheme
|
|
2243
|
+
}, Tree_css_default), [isOpen, setOpen] = useState6(open);
|
|
2244
|
+
useEffect5(() => {
|
|
2245
|
+
setOpen(open);
|
|
2246
|
+
}, [open]);
|
|
2247
|
+
let updateState = (value) => {
|
|
2248
|
+
setOpen(value), onUpdate && onUpdate(value);
|
|
2249
|
+
}, hasChildren = React24.Children.count(children) > 0, updateFocus = (newNode, previousNode) => {
|
|
2250
|
+
if (newNode.isSameNode(previousNode || null)) return;
|
|
2251
|
+
let focusableNode = newNode.querySelector('[tabindex="-1"]');
|
|
2252
|
+
focusableNode?.focus(), newNode.setAttribute("aria-selected", "true"), previousNode?.removeAttribute("aria-selected");
|
|
2253
|
+
}, getParent = (node, role) => {
|
|
2254
|
+
let parent = node;
|
|
2255
|
+
for (; parent && parent.parentElement; ) {
|
|
2256
|
+
if (parent.getAttribute("role") === role)
|
|
2257
|
+
return parent;
|
|
2258
|
+
parent = parent.parentElement;
|
|
2259
|
+
}
|
|
2260
|
+
return null;
|
|
2261
|
+
}, getListElements = (node) => {
|
|
2262
|
+
let tree = getParent(node, "tree");
|
|
2263
|
+
return tree ? Array.from(tree.querySelectorAll("li")) : [];
|
|
2264
|
+
}, moveBack = (node) => {
|
|
2265
|
+
let group = getParent(node, "group"), toggle = group?.previousElementSibling;
|
|
2266
|
+
if (toggle && toggle.getAttribute("tabindex") === "-1") {
|
|
2267
|
+
let toggleParent = toggle.parentElement, nodeParent = node.parentElement;
|
|
2268
|
+
updateFocus(toggleParent, nodeParent);
|
|
2269
|
+
}
|
|
2270
|
+
}, moveHome = (node, direction) => {
|
|
2271
|
+
let elements = getListElements(node);
|
|
2272
|
+
elements.forEach((element) => {
|
|
2273
|
+
element.removeAttribute("aria-selected");
|
|
2274
|
+
}), direction === "start" && elements[0] && updateFocus(elements[0]), direction === "end" && elements[elements.length - 1] && updateFocus(elements[elements.length - 1]);
|
|
2275
|
+
}, moveFocusAdjacent = (node, direction) => {
|
|
2276
|
+
let elements = getListElements(node) || [];
|
|
2277
|
+
for (let i = 0; i < elements.length; i++) {
|
|
2278
|
+
let currentNode = elements[i];
|
|
2279
|
+
if (currentNode.getAttribute("aria-selected") === "true") {
|
|
2280
|
+
direction === "up" && elements[i - 1] ? updateFocus(elements[i - 1], currentNode) : direction === "down" && elements[i + 1] && updateFocus(elements[i + 1], currentNode);
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
updateFocus(elements[0]);
|
|
2285
|
+
}, handleKeypress = (event, isChild2) => {
|
|
2286
|
+
let node = event.target;
|
|
2287
|
+
(event.key === "Enter" || event.key === " ") && updateState(!isOpen), event.key === "ArrowRight" && isOpen && !isChild2 ? moveFocusAdjacent(node, "down") : event.key === "ArrowRight" && updateState(!0), event.key === "ArrowLeft" && (!isOpen || isChild2) ? moveBack(node) : event.key === "ArrowLeft" && updateState(!1), event.key === "ArrowDown" && moveFocusAdjacent(node, "down"), event.key === "ArrowUp" && moveFocusAdjacent(node, "up"), event.key === "Home" && moveHome(node, "start"), event.key === "End" && moveHome(node, "end");
|
|
2288
|
+
}, handleClick = (event, isChild2) => {
|
|
2289
|
+
let node = event.target, parent = getParent(node, "treeitem"), elements = getListElements(node) || [], found = !1;
|
|
2290
|
+
for (let i = 0; i < elements.length; i++) {
|
|
2291
|
+
let currentNode = elements[i];
|
|
2292
|
+
if (currentNode.getAttribute("aria-selected") === "true") {
|
|
2293
|
+
parent && (found = !0, updateFocus(parent, currentNode));
|
|
2294
|
+
break;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
!found && parent && updateFocus(parent), isChild2 || updateState(!isOpen);
|
|
2298
|
+
}, handleBlur = (event) => {
|
|
2299
|
+
let node = event.currentTarget;
|
|
2300
|
+
!node.contains(document.activeElement) && node.getAttribute("role") === "tree" && node.setAttribute("tabindex", "0");
|
|
2301
|
+
}, handleFocus = (event) => {
|
|
2302
|
+
let node = event.target;
|
|
2303
|
+
if (node.getAttribute("role") === "tree") {
|
|
2304
|
+
let selected = node.querySelector('[aria-selected="true"]');
|
|
2305
|
+
selected ? updateFocus(selected) : moveFocusAdjacent(node, "down"), node.setAttribute("tabindex", "-1");
|
|
2306
|
+
}
|
|
2307
|
+
}, handleButtonFocus = () => {
|
|
2308
|
+
onSelect?.();
|
|
2309
|
+
}, getPaddingStyles = (depth2) => {
|
|
2310
|
+
let space = depth2 * 0.9 + 0.3;
|
|
2311
|
+
return {
|
|
2312
|
+
paddingLeft: `${space}em`,
|
|
2313
|
+
width: `calc(100% - ${space}em)`
|
|
2314
|
+
};
|
|
2315
|
+
}, {
|
|
2316
|
+
isChild,
|
|
2317
|
+
depth,
|
|
2318
|
+
hasHover
|
|
2319
|
+
} = React24.useContext(TreeContext_default), showHover = hasHover ? hover : !1;
|
|
2320
|
+
if (!isChild)
|
|
2321
|
+
return React24.createElement("ul", (0, import_extends2.default)({
|
|
2322
|
+
role: "tree",
|
|
2323
|
+
tabIndex: 0,
|
|
2324
|
+
className: clsx_m_default3(Tree_css_default.tree, Tree_css_default.group, themeClass, className),
|
|
2325
|
+
onFocus: handleFocus,
|
|
2326
|
+
onBlur: handleBlur
|
|
2327
|
+
}, html), React24.createElement(TreeContext_default.Provider, {
|
|
2328
|
+
value: {
|
|
2329
|
+
isChild: !0,
|
|
2330
|
+
depth: 0,
|
|
2331
|
+
hasHover: showHover
|
|
2332
|
+
}
|
|
2333
|
+
}, React24.createElement(Tree, props)));
|
|
2334
|
+
if (!hasChildren)
|
|
2335
|
+
return React24.createElement("li", (0, import_extends2.default)({
|
|
2336
|
+
role: "treeitem",
|
|
2337
|
+
className: Tree_css_default.item
|
|
2338
|
+
}, html), React24.createElement("div", {
|
|
2339
|
+
role: "button",
|
|
2340
|
+
className: clsx_m_default3(Tree_css_default.label, {
|
|
2341
|
+
[Tree_css_default.hover]: showHover,
|
|
2342
|
+
[Tree_css_default.focusWhite]: currentTheme === "firefox"
|
|
2343
|
+
}),
|
|
2344
|
+
tabIndex: -1,
|
|
2345
|
+
style: getPaddingStyles(depth),
|
|
2346
|
+
onKeyDown: (e) => {
|
|
2347
|
+
handleKeypress(e, isChild);
|
|
2348
|
+
},
|
|
2349
|
+
onClick: (e) => handleClick(e, !0),
|
|
2350
|
+
onFocus: handleButtonFocus
|
|
2351
|
+
}, React24.createElement("span", null, label)));
|
|
2352
|
+
let arrowClass = clsx_m_default3(Tree_css_default.arrow, {
|
|
2353
|
+
[Tree_css_default.open]: isOpen
|
|
2354
|
+
});
|
|
2355
|
+
return React24.createElement("li", {
|
|
2356
|
+
role: "treeitem",
|
|
2357
|
+
"aria-expanded": isOpen,
|
|
2358
|
+
className: Tree_css_default.item
|
|
2359
|
+
}, React24.createElement("div", {
|
|
2360
|
+
role: "button",
|
|
2361
|
+
tabIndex: -1,
|
|
2362
|
+
className: clsx_m_default3(Tree_css_default.label, {
|
|
2363
|
+
[Tree_css_default.hover]: showHover,
|
|
2364
|
+
[Tree_css_default.focusWhite]: currentTheme === "firefox"
|
|
2365
|
+
}),
|
|
2366
|
+
style: getPaddingStyles(depth),
|
|
2367
|
+
onClick: (e) => handleClick(e),
|
|
2368
|
+
onKeyDown: (e) => handleKeypress(e),
|
|
2369
|
+
onFocus: handleButtonFocus
|
|
2370
|
+
}, React24.createElement("span", null, React24.createElement("span", {
|
|
2371
|
+
"aria-hidden": !0,
|
|
2372
|
+
className: arrowClass
|
|
2373
|
+
}), React24.createElement("span", null, label))), React24.createElement("ul", (0, import_extends2.default)({
|
|
2374
|
+
role: "group",
|
|
2375
|
+
className: clsx_m_default3(className, Tree_css_default.group)
|
|
2376
|
+
}, html), isOpen && React24.Children.map(children, (child) => React24.createElement(TreeContext_default.Provider, {
|
|
2377
|
+
value: {
|
|
2378
|
+
isChild: !0,
|
|
2379
|
+
depth: depth + 1,
|
|
2380
|
+
hasHover: showHover
|
|
2381
|
+
}
|
|
2382
|
+
}, child))));
|
|
2383
|
+
};
|
|
2384
|
+
Tree.defaultProps = {
|
|
2385
|
+
open: !1,
|
|
2386
|
+
hover: !0
|
|
2387
|
+
};
|
|
2388
|
+
|
|
2389
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectValue.js
|
|
2390
|
+
var import_extends3 = __toESM(require_extends()), import_objectWithoutProperties4 = __toESM(require_objectWithoutProperties());
|
|
2391
|
+
import React25, { useState as useState7, useEffect as useEffect6 } from "react";
|
|
2392
|
+
|
|
2393
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspector.css.js
|
|
2394
|
+
var ObjectInspector_css_default = { "object-inspector": "ObjectInspector-object-inspector-0c33e82", objectInspector: "ObjectInspector-object-inspector-0c33e82", "object-label": "ObjectInspector-object-label-b81482b", objectLabel: "ObjectInspector-object-label-b81482b", text: "ObjectInspector-text-25f57f3", key: "ObjectInspector-key-4f712bb", value: "ObjectInspector-value-f7ec2e5", string: "ObjectInspector-string-c496000", regex: "ObjectInspector-regex-59d45a3", error: "ObjectInspector-error-b818698", boolean: "ObjectInspector-boolean-2dd1642", number: "ObjectInspector-number-a6daabb", undefined: "ObjectInspector-undefined-3a68263", null: "ObjectInspector-null-74acb50", function: "ObjectInspector-function-07bbdcd", "function-decorator": "ObjectInspector-function-decorator-3d22c24", functionDecorator: "ObjectInspector-function-decorator-3d22c24", prototype: "ObjectInspector-prototype-f2449ee", dark: "ObjectInspector-dark-0c96c97", chrome: "ObjectInspector-chrome-2f3ca98", light: "ObjectInspector-light-78bef54" };
|
|
2395
|
+
|
|
2396
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectValue.js
|
|
2397
|
+
var _excluded3 = ["ast", "theme", "showKey", "colorScheme", "className"], buildValue = (key, value, valueClass, showKey, depth) => {
|
|
2398
|
+
let computedKey = key.includes("-") ? `"${key}"` : key, isRoot = depth <= 0;
|
|
2399
|
+
return React25.createElement("span", {
|
|
2400
|
+
className: ObjectInspector_css_default.text
|
|
2401
|
+
}, !isRoot && showKey && React25.createElement(React25.Fragment, null, React25.createElement("span", {
|
|
2402
|
+
className: ObjectInspector_css_default.key
|
|
2403
|
+
}, computedKey), React25.createElement("span", null, ":\xA0")), React25.createElement("span", {
|
|
2404
|
+
className: valueClass
|
|
2405
|
+
}, value));
|
|
2406
|
+
}, ObjectValue2 = (props) => {
|
|
2407
|
+
let {
|
|
2408
|
+
ast,
|
|
2409
|
+
theme: theme3,
|
|
2410
|
+
showKey,
|
|
2411
|
+
colorScheme,
|
|
2412
|
+
className
|
|
2413
|
+
} = props, html = (0, import_objectWithoutProperties4.default)(props, _excluded3), {
|
|
2414
|
+
themeClass
|
|
2415
|
+
} = useTheme3({
|
|
2416
|
+
theme: theme3,
|
|
2417
|
+
colorScheme
|
|
2418
|
+
}, ObjectInspector_css_default), [asyncValue, setAsyncValue] = useState7(React25.createElement("span", null)), value = React25.createElement("span", null);
|
|
2419
|
+
return useEffect6(() => {
|
|
2420
|
+
ast.value instanceof Promise && (async (promise) => {
|
|
2421
|
+
setAsyncValue(buildValue(ast.key, `Promise { "${await getPromiseState(promise)}" }`, ObjectInspector_css_default.key, showKey, ast.depth));
|
|
2422
|
+
})(ast.value);
|
|
2423
|
+
}, [ast, showKey]), typeof ast.value == "number" || typeof ast.value == "bigint" ? value = buildValue(ast.key, String(ast.value), ObjectInspector_css_default.number, showKey, ast.depth) : typeof ast.value == "boolean" ? value = buildValue(ast.key, String(ast.value), ObjectInspector_css_default.boolean, showKey, ast.depth) : typeof ast.value == "string" ? value = buildValue(ast.key, `"${ast.value}"`, ObjectInspector_css_default.string, showKey, ast.depth) : typeof ast.value > "u" ? value = buildValue(ast.key, "undefined", ObjectInspector_css_default.undefined, showKey, ast.depth) : typeof ast.value == "symbol" ? value = buildValue(ast.key, ast.value.toString(), ObjectInspector_css_default.string, showKey, ast.depth) : typeof ast.value == "function" ? value = buildValue(ast.key, `${ast.value.name}()`, ObjectInspector_css_default.key, showKey, ast.depth) : typeof ast.value == "object" && (ast.value === null ? value = buildValue(ast.key, "null", ObjectInspector_css_default.null, showKey, ast.depth) : Array.isArray(ast.value) ? value = buildValue(ast.key, `Array(${ast.value.length})`, ObjectInspector_css_default.key, showKey, ast.depth) : ast.value instanceof Date ? value = buildValue(ast.key, `Date ${ast.value.toString()}`, ObjectInspector_css_default.value, showKey, ast.depth) : ast.value instanceof RegExp ? value = buildValue(ast.key, ast.value.toString(), ObjectInspector_css_default.regex, showKey, ast.depth) : ast.value instanceof Error ? value = buildValue(ast.key, ast.value.toString(), ObjectInspector_css_default.error, showKey, ast.depth) : isObject(ast.value) ? value = buildValue(ast.key, "{\u2026}", ObjectInspector_css_default.key, showKey, ast.depth) : value = buildValue(ast.key, ast.value.constructor.name, ObjectInspector_css_default.key, showKey, ast.depth)), React25.createElement("span", (0, import_extends3.default)({
|
|
2424
|
+
className: clsx_m_default(themeClass, className)
|
|
2425
|
+
}, html), asyncValue, value);
|
|
2426
|
+
};
|
|
2427
|
+
ObjectValue2.defaultProps = {
|
|
2428
|
+
showKey: !0
|
|
2429
|
+
};
|
|
2430
|
+
var ObjectValue_default = ObjectValue2;
|
|
2431
|
+
|
|
2432
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectLabel.js
|
|
2433
|
+
var import_extends4 = __toESM(require_extends()), import_objectWithoutProperties5 = __toESM(require_objectWithoutProperties());
|
|
2434
|
+
import React26 from "react";
|
|
2435
|
+
var _excluded4 = ["ast", "theme", "previewMax", "open", "colorScheme", "className"], buildPreview = (children, previewMax, showKey) => {
|
|
2436
|
+
let previews = [];
|
|
2437
|
+
for (let i = 0; i < children.length; i++) {
|
|
2438
|
+
let child = children[i];
|
|
2439
|
+
if (child.isPrototype || (previews.push(React26.createElement(ObjectValue_default, {
|
|
2440
|
+
key: child.key,
|
|
2441
|
+
ast: child,
|
|
2442
|
+
showKey
|
|
2443
|
+
})), i < children.length - 1 ? previews.push(", ") : previews.push(" ")), child.isPrototype && i === children.length - 1 && (previews.pop(), previews.push(" ")), i === previewMax - 1 && children.length > previewMax) {
|
|
2444
|
+
previews.push("\u2026 ");
|
|
2445
|
+
break;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
return previews;
|
|
2449
|
+
}, getArrayLabel = (ast, open, previewMax, theme3) => {
|
|
2450
|
+
let l = ast.value.length;
|
|
2451
|
+
return open ? React26.createElement("span", null, "Array(", l, ")") : React26.createElement(React26.Fragment, null, React26.createElement("span", null, `${theme3 === "firefox" ? "Array" : ""}(${l}) [ `), buildPreview(ast.children, previewMax, !1), React26.createElement("span", null, "]"));
|
|
2452
|
+
}, getObjectLabel = (ast, open, previewMax, theme3) => ast.isPrototype ? React26.createElement("span", null, `Object ${theme3 === "firefox" ? "{ \u2026 }" : ""}`) : open ? React26.createElement("span", null, "{\u2026}") : React26.createElement(React26.Fragment, null, React26.createElement("span", null, `${theme3 === "firefox" ? "Object " : ""}{ `), buildPreview(ast.children, previewMax, !0), React26.createElement("span", null, "}")), getPromiseLabel = (ast, open, previewMax) => open ? React26.createElement("span", null, `Promise { "${String(ast.children[0].value)}" }`) : React26.createElement(React26.Fragment, null, React26.createElement("span", null, "Promise { "), buildPreview(ast.children, previewMax, !0), React26.createElement("span", null, "}")), getMapLabel = (ast, open, previewMax, theme3) => {
|
|
2453
|
+
let {
|
|
2454
|
+
size
|
|
2455
|
+
} = ast.value;
|
|
2456
|
+
return open ? React26.createElement("span", null, `Map(${size})`) : React26.createElement(React26.Fragment, null, React26.createElement("span", null, `Map${theme3 === "chrome" ? `(${size})` : ""} { `), buildPreview(ast.children, previewMax, !0), React26.createElement("span", null, "}"));
|
|
2457
|
+
}, getSetLabel = (ast, open, previewMax) => {
|
|
2458
|
+
let {
|
|
2459
|
+
size
|
|
2460
|
+
} = ast.value;
|
|
2461
|
+
return open ? React26.createElement("span", null, "Set(", size, ")") : React26.createElement(React26.Fragment, null, React26.createElement("span", null, `Set(${ast.value.size}) {`), buildPreview(ast.children, previewMax, !0), React26.createElement("span", null, "}"));
|
|
2462
|
+
}, ObjectLabel2 = (props) => {
|
|
2463
|
+
let {
|
|
2464
|
+
ast,
|
|
2465
|
+
theme: theme3,
|
|
2466
|
+
previewMax,
|
|
2467
|
+
open,
|
|
2468
|
+
colorScheme,
|
|
2469
|
+
className
|
|
2470
|
+
} = props, html = (0, import_objectWithoutProperties5.default)(props, _excluded4), {
|
|
2471
|
+
themeClass,
|
|
2472
|
+
currentTheme
|
|
2473
|
+
} = useTheme3({
|
|
2474
|
+
theme: theme3,
|
|
2475
|
+
colorScheme
|
|
2476
|
+
}, ObjectInspector_css_default), isPrototype = ast.isPrototype || !1, classes = clsx_m_default(ObjectInspector_css_default.objectLabel, themeClass, className, {
|
|
2477
|
+
[ObjectInspector_css_default.prototype]: isPrototype
|
|
2478
|
+
}), isRoot = ast.depth <= 0, Key = () => React26.createElement("span", {
|
|
2479
|
+
className: isPrototype ? ObjectInspector_css_default.prototype : ObjectInspector_css_default.key
|
|
2480
|
+
}, isRoot ? "" : `${ast.key}: `);
|
|
2481
|
+
return ast.type === "array" ? React26.createElement("span", (0, import_extends4.default)({
|
|
2482
|
+
className: classes
|
|
2483
|
+
}, html), React26.createElement(Key, null), getArrayLabel(ast, open, previewMax, currentTheme)) : ast.type === "function" ? React26.createElement("span", (0, import_extends4.default)({
|
|
2484
|
+
className: classes
|
|
2485
|
+
}, html), React26.createElement(Key, null), currentTheme === "chrome" && React26.createElement("span", {
|
|
2486
|
+
className: ObjectInspector_css_default.functionDecorator
|
|
2487
|
+
}, "\u0192 "), React26.createElement("span", {
|
|
2488
|
+
className: clsx_m_default({
|
|
2489
|
+
[ObjectInspector_css_default.function]: !isPrototype
|
|
2490
|
+
})
|
|
2491
|
+
}, `${ast.value.name}()`)) : ast.type === "promise" ? React26.createElement("span", (0, import_extends4.default)({
|
|
2492
|
+
className: classes
|
|
2493
|
+
}, html), React26.createElement(Key, null), getPromiseLabel(ast, open, previewMax)) : ast.type === "map" ? React26.createElement("span", (0, import_extends4.default)({
|
|
2494
|
+
className: classes
|
|
2495
|
+
}, html), React26.createElement(Key, null), getMapLabel(ast, open, previewMax, currentTheme)) : ast.type === "set" ? React26.createElement("span", (0, import_extends4.default)({
|
|
2496
|
+
className: classes
|
|
2497
|
+
}, html), React26.createElement(Key, null), getSetLabel(ast, open, previewMax)) : React26.createElement("span", (0, import_extends4.default)({
|
|
2498
|
+
className: classes
|
|
2499
|
+
}, html), React26.createElement(Key, null), getObjectLabel(ast, open, previewMax, currentTheme));
|
|
2500
|
+
};
|
|
2501
|
+
ObjectLabel2.defaultProps = {
|
|
2502
|
+
previewMax: 8,
|
|
2503
|
+
open: !1
|
|
2504
|
+
};
|
|
2505
|
+
var ObjectLabel_default = ObjectLabel2;
|
|
2506
|
+
|
|
2507
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspectorItem.js
|
|
2508
|
+
var ObjectInspectorItem = (props) => {
|
|
2509
|
+
let {
|
|
2510
|
+
ast,
|
|
2511
|
+
expandLevel,
|
|
2512
|
+
depth
|
|
2513
|
+
} = props, [resolved, setResolved] = useState8(), [open, setOpen] = useState8(depth < expandLevel);
|
|
2514
|
+
return useEffect7(() => {
|
|
2515
|
+
(async () => {
|
|
2516
|
+
if (ast.type !== "value") {
|
|
2517
|
+
let promises = ast.children.map((f) => f()), children = await Promise.all(promises), r = (0, import_objectSpread22.default)((0, import_objectSpread22.default)({}, ast), {}, {
|
|
2518
|
+
children
|
|
2519
|
+
});
|
|
2520
|
+
setResolved(r);
|
|
2521
|
+
}
|
|
2522
|
+
})();
|
|
2523
|
+
}, [ast]), resolved ? React27.createElement(Tree, {
|
|
2524
|
+
hover: !1,
|
|
2525
|
+
open,
|
|
2526
|
+
label: React27.createElement(ObjectLabel_default, {
|
|
2527
|
+
open,
|
|
2528
|
+
ast: resolved
|
|
2529
|
+
}),
|
|
2530
|
+
onSelect: () => {
|
|
2531
|
+
var _props$onSelect;
|
|
2532
|
+
(_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 || _props$onSelect.call(props, ast);
|
|
2533
|
+
},
|
|
2534
|
+
onUpdate: (value) => {
|
|
2535
|
+
setOpen(value);
|
|
2536
|
+
}
|
|
2537
|
+
}, resolved.children.map((child) => React27.createElement(ObjectInspectorItem, {
|
|
2538
|
+
key: child.key,
|
|
2539
|
+
ast: child,
|
|
2540
|
+
depth: depth + 1,
|
|
2541
|
+
expandLevel,
|
|
2542
|
+
onSelect: props.onSelect
|
|
2543
|
+
}))) : React27.createElement(Tree, {
|
|
2544
|
+
hover: !1,
|
|
2545
|
+
label: React27.createElement(ObjectValue_default, {
|
|
2546
|
+
ast
|
|
2547
|
+
}),
|
|
2548
|
+
onSelect: () => {
|
|
2549
|
+
var _props$onSelect2;
|
|
2550
|
+
(_props$onSelect2 = props.onSelect) === null || _props$onSelect2 === void 0 || _props$onSelect2.call(props, ast);
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2553
|
+
};
|
|
2554
|
+
ObjectInspectorItem.defaultProps = {
|
|
2555
|
+
expandLevel: 0,
|
|
2556
|
+
depth: 0
|
|
2557
|
+
};
|
|
2558
|
+
var ObjectInspectorItem_default = ObjectInspectorItem;
|
|
2559
|
+
|
|
2560
|
+
// ../../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspector.js
|
|
2561
|
+
var _excluded5 = ["data", "expandLevel", "sortKeys", "includePrototypes", "className", "theme", "colorScheme", "onSelect"], ObjectInspector2 = (props) => {
|
|
2562
|
+
let {
|
|
2563
|
+
data,
|
|
2564
|
+
expandLevel,
|
|
2565
|
+
sortKeys,
|
|
2566
|
+
includePrototypes,
|
|
2567
|
+
className,
|
|
2568
|
+
theme: theme3,
|
|
2569
|
+
colorScheme,
|
|
2570
|
+
onSelect
|
|
2571
|
+
} = props, html = (0, import_objectWithoutProperties6.default)(props, _excluded5), [ast, setAST] = useState9(void 0), {
|
|
2572
|
+
themeClass,
|
|
2573
|
+
currentTheme,
|
|
2574
|
+
currentColorScheme
|
|
2575
|
+
} = useTheme3({
|
|
2576
|
+
theme: theme3,
|
|
2577
|
+
colorScheme
|
|
2578
|
+
}, ObjectInspector_css_default);
|
|
2579
|
+
return useEffect8(() => {
|
|
2580
|
+
(async () => setAST(await parse(data, sortKeys, includePrototypes)))();
|
|
2581
|
+
}, [data, sortKeys, includePrototypes]), React28.createElement("div", (0, import_extends5.default)({
|
|
2582
|
+
className: clsx_m_default(ObjectInspector_css_default.objectInspector, className, themeClass)
|
|
2583
|
+
}, html), ast && React28.createElement(ThemeProvider, {
|
|
2584
|
+
theme: currentTheme,
|
|
2585
|
+
colorScheme: currentColorScheme
|
|
2586
|
+
}, React28.createElement(ObjectInspectorItem_default, {
|
|
2587
|
+
ast,
|
|
2588
|
+
expandLevel,
|
|
2589
|
+
onSelect
|
|
2590
|
+
})));
|
|
2591
|
+
};
|
|
2592
|
+
ObjectInspector2.defaultProps = {
|
|
2593
|
+
expandLevel: 0,
|
|
2594
|
+
sortKeys: !0,
|
|
2595
|
+
includePrototypes: !0
|
|
2596
|
+
};
|
|
2597
|
+
|
|
2598
|
+
// src/component-testing/components/MethodCall.tsx
|
|
2599
|
+
import { useTheme as useTheme4 } from "@aussieljk/forkbook/theming";
|
|
2600
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2601
|
+
var colorsLight = {
|
|
2602
|
+
base: "#444",
|
|
2603
|
+
nullish: "#7D99AA",
|
|
2604
|
+
string: "#16B242",
|
|
2605
|
+
number: "#5D40D0",
|
|
2606
|
+
boolean: "#f41840",
|
|
2607
|
+
objectkey: "#698394",
|
|
2608
|
+
instance: "#A15C20",
|
|
2609
|
+
function: "#EA7509",
|
|
2610
|
+
muted: "#7D99AA",
|
|
2611
|
+
tag: {
|
|
2612
|
+
name: "#6F2CAC",
|
|
2613
|
+
suffix: "#1F99E5"
|
|
2614
|
+
},
|
|
2615
|
+
date: "#459D9C",
|
|
2616
|
+
error: {
|
|
2617
|
+
name: "#D43900",
|
|
2618
|
+
message: "#444"
|
|
2619
|
+
},
|
|
2620
|
+
regex: {
|
|
2621
|
+
source: "#A15C20",
|
|
2622
|
+
flags: "#EA7509"
|
|
2623
|
+
},
|
|
2624
|
+
meta: "#EA7509",
|
|
2625
|
+
method: "#0271B6"
|
|
2626
|
+
}, colorsDark = {
|
|
2627
|
+
base: "#eee",
|
|
2628
|
+
nullish: "#aaa",
|
|
2629
|
+
string: "#5FE584",
|
|
2630
|
+
number: "#6ba5ff",
|
|
2631
|
+
boolean: "#ff4191",
|
|
2632
|
+
objectkey: "#accfe6",
|
|
2633
|
+
instance: "#E3B551",
|
|
2634
|
+
function: "#E3B551",
|
|
2635
|
+
muted: "#aaa",
|
|
2636
|
+
tag: {
|
|
2637
|
+
name: "#f57bff",
|
|
2638
|
+
suffix: "#8EB5FF"
|
|
2639
|
+
},
|
|
2640
|
+
date: "#70D4D3",
|
|
2641
|
+
error: {
|
|
2642
|
+
name: "#f40",
|
|
2643
|
+
message: "#eee"
|
|
2644
|
+
},
|
|
2645
|
+
regex: {
|
|
2646
|
+
source: "#FAD483",
|
|
2647
|
+
flags: "#E3B551"
|
|
2648
|
+
},
|
|
2649
|
+
meta: "#FAD483",
|
|
2650
|
+
method: "#5EC1FF"
|
|
2651
|
+
}, useThemeColors = () => {
|
|
2652
|
+
let { base } = useTheme4();
|
|
2653
|
+
return base === "dark" ? colorsDark : colorsLight;
|
|
2654
|
+
}, special = /[^A-Z0-9]/i, trimEnd = /[\s.,…]+$/gm, ellipsize = (string2, maxlength) => {
|
|
2655
|
+
if (string2.length <= maxlength)
|
|
2656
|
+
return string2;
|
|
2657
|
+
for (let i = maxlength - 1; i >= 0; i -= 1)
|
|
2658
|
+
if (special.test(string2[i]) && i > 10)
|
|
2659
|
+
return `${string2.slice(0, i).replace(trimEnd, "")}\u2026`;
|
|
2660
|
+
return `${string2.slice(0, maxlength).replace(trimEnd, "")}\u2026`;
|
|
2661
|
+
}, stringify = (value) => {
|
|
2662
|
+
try {
|
|
2663
|
+
return JSON.stringify(value, null, 1);
|
|
2664
|
+
} catch {
|
|
2665
|
+
return String(value);
|
|
2666
|
+
}
|
|
2667
|
+
}, interleave = (nodes, separator) => nodes.flatMap(
|
|
2668
|
+
(node, index) => index === nodes.length - 1 ? [node] : [node, React29.cloneElement(separator, { key: `sep${index}` })]
|
|
2669
|
+
), Node2 = ({
|
|
2670
|
+
value,
|
|
2671
|
+
nested,
|
|
2672
|
+
showObjectInspector,
|
|
2673
|
+
callsById,
|
|
2674
|
+
...props
|
|
2675
|
+
}) => {
|
|
2676
|
+
switch (!0) {
|
|
2677
|
+
case value === null:
|
|
2678
|
+
return jsx11(NullNode, { ...props });
|
|
2679
|
+
case value === void 0:
|
|
2680
|
+
return jsx11(UndefinedNode, { ...props });
|
|
2681
|
+
case Array.isArray(value):
|
|
2682
|
+
return jsx11(ArrayNode, { ...props, value, callsById });
|
|
2683
|
+
case typeof value == "string":
|
|
2684
|
+
return jsx11(StringNode, { ...props, value });
|
|
2685
|
+
case typeof value == "number":
|
|
2686
|
+
return jsx11(NumberNode, { ...props, value });
|
|
2687
|
+
case typeof value == "boolean":
|
|
2688
|
+
return jsx11(BooleanNode, { ...props, value });
|
|
2689
|
+
case Object.prototype.hasOwnProperty.call(value, "__date__"):
|
|
2690
|
+
return jsx11(DateNode, { ...props, ...value.__date__ });
|
|
2691
|
+
case Object.prototype.hasOwnProperty.call(value, "__error__"):
|
|
2692
|
+
return jsx11(ErrorNode, { ...props, ...value.__error__ });
|
|
2693
|
+
case Object.prototype.hasOwnProperty.call(value, "__regexp__"):
|
|
2694
|
+
return jsx11(RegExpNode, { ...props, ...value.__regexp__ });
|
|
2695
|
+
case Object.prototype.hasOwnProperty.call(value, "__function__"):
|
|
2696
|
+
return jsx11(FunctionNode, { ...props, ...value.__function__ });
|
|
2697
|
+
case Object.prototype.hasOwnProperty.call(value, "__symbol__"):
|
|
2698
|
+
return jsx11(SymbolNode, { ...props, ...value.__symbol__ });
|
|
2699
|
+
case Object.prototype.hasOwnProperty.call(value, "__element__"):
|
|
2700
|
+
return jsx11(ElementNode, { ...props, ...value.__element__ });
|
|
2701
|
+
case Object.prototype.hasOwnProperty.call(value, "__class__"):
|
|
2702
|
+
return jsx11(ClassNode, { ...props, ...value.__class__ });
|
|
2703
|
+
case Object.prototype.hasOwnProperty.call(value, "__callId__"):
|
|
2704
|
+
return jsx11(MethodCall, { call: callsById?.get(value.__callId__), callsById });
|
|
2705
|
+
case Object.prototype.toString.call(value) === "[object Object]":
|
|
2706
|
+
return jsx11(
|
|
2707
|
+
ObjectNode,
|
|
2708
|
+
{
|
|
2709
|
+
value,
|
|
2710
|
+
showInspector: showObjectInspector,
|
|
2711
|
+
callsById,
|
|
2712
|
+
...props
|
|
2713
|
+
}
|
|
2714
|
+
);
|
|
2715
|
+
default:
|
|
2716
|
+
return jsx11(OtherNode, { value, ...props });
|
|
2717
|
+
}
|
|
2718
|
+
}, NullNode = (props) => {
|
|
2719
|
+
let colors = useThemeColors();
|
|
2720
|
+
return jsx11("span", { style: { color: colors.nullish }, ...props, children: "null" });
|
|
2721
|
+
}, UndefinedNode = (props) => {
|
|
2722
|
+
let colors = useThemeColors();
|
|
2723
|
+
return jsx11("span", { style: { color: colors.nullish }, ...props, children: "undefined" });
|
|
2724
|
+
}, StringNode = ({ value, ...props }) => {
|
|
2725
|
+
let colors = useThemeColors();
|
|
2726
|
+
return jsx11("span", { style: { color: colors.string }, ...props, children: JSON.stringify(ellipsize(value, 50)) });
|
|
2727
|
+
}, NumberNode = ({ value, ...props }) => {
|
|
2728
|
+
let colors = useThemeColors();
|
|
2729
|
+
return jsx11("span", { style: { color: colors.number }, ...props, children: value });
|
|
2730
|
+
}, BooleanNode = ({ value, ...props }) => {
|
|
2731
|
+
let colors = useThemeColors();
|
|
2732
|
+
return jsx11("span", { style: { color: colors.boolean }, ...props, children: String(value) });
|
|
2733
|
+
}, ArrayNode = ({
|
|
2734
|
+
value,
|
|
2735
|
+
nested = !1,
|
|
2736
|
+
callsById
|
|
2737
|
+
}) => {
|
|
2738
|
+
let colors = useThemeColors();
|
|
2739
|
+
if (nested)
|
|
2740
|
+
return jsx11("span", { style: { color: colors.base }, children: "[\u2026]" });
|
|
2741
|
+
let nodes = value.slice(0, 3).map((v2, index) => jsx11(Node2, { value: v2, nested: !0, callsById }, `${index}--${JSON.stringify(v2)}`)), nodelist = interleave(nodes, jsx11("span", { children: ", " }));
|
|
2742
|
+
return value.length <= 3 ? jsxs9("span", { style: { color: colors.base }, children: [
|
|
2743
|
+
"[",
|
|
2744
|
+
nodelist,
|
|
2745
|
+
"]"
|
|
2746
|
+
] }) : jsxs9("span", { style: { color: colors.base }, children: [
|
|
2747
|
+
"(",
|
|
2748
|
+
value.length,
|
|
2749
|
+
") [",
|
|
2750
|
+
nodelist,
|
|
2751
|
+
", \u2026]"
|
|
2752
|
+
] });
|
|
2753
|
+
}, ObjectNode = ({
|
|
2754
|
+
showInspector,
|
|
2755
|
+
value,
|
|
2756
|
+
callsById,
|
|
2757
|
+
nested = !1
|
|
2758
|
+
}) => {
|
|
2759
|
+
let isDarkMode = useTheme4().base === "dark", colors = useThemeColors();
|
|
2760
|
+
if (showInspector)
|
|
2761
|
+
return jsx11(Fragment6, { children: jsx11(
|
|
2762
|
+
ObjectInspector2,
|
|
2763
|
+
{
|
|
2764
|
+
id: "interactions-object-inspector",
|
|
2765
|
+
data: value,
|
|
2766
|
+
includePrototypes: !1,
|
|
2767
|
+
colorScheme: isDarkMode ? "dark" : "light"
|
|
2768
|
+
}
|
|
2769
|
+
) });
|
|
2770
|
+
if (nested)
|
|
2771
|
+
return jsx11("span", { style: { color: colors.base }, children: "{\u2026}" });
|
|
2772
|
+
let nodelist = interleave(
|
|
2773
|
+
Object.entries(value).slice(0, 2).map(([k, v2]) => jsxs9(Fragment5, { children: [
|
|
2774
|
+
jsxs9("span", { style: { color: colors.objectkey }, children: [
|
|
2775
|
+
k,
|
|
2776
|
+
": "
|
|
2777
|
+
] }),
|
|
2778
|
+
jsx11(Node2, { value: v2, callsById, nested: !0 })
|
|
2779
|
+
] }, k)),
|
|
2780
|
+
jsx11("span", { children: ", " })
|
|
2781
|
+
);
|
|
2782
|
+
return Object.keys(value).length <= 2 ? jsxs9("span", { style: { color: colors.base }, children: [
|
|
2783
|
+
"{ ",
|
|
2784
|
+
nodelist,
|
|
2785
|
+
" }"
|
|
2786
|
+
] }) : jsxs9("span", { style: { color: colors.base }, children: [
|
|
2787
|
+
"(",
|
|
2788
|
+
Object.keys(value).length,
|
|
2789
|
+
") ",
|
|
2790
|
+
"{ ",
|
|
2791
|
+
nodelist,
|
|
2792
|
+
", \u2026 }"
|
|
2793
|
+
] });
|
|
2794
|
+
}, ClassNode = ({ name }) => {
|
|
2795
|
+
let colors = useThemeColors();
|
|
2796
|
+
return jsx11("span", { style: { color: colors.instance }, children: name });
|
|
2797
|
+
}, FunctionNode = ({ name }) => {
|
|
2798
|
+
let colors = useThemeColors();
|
|
2799
|
+
return name ? jsx11("span", { style: { color: colors.function }, children: name }) : jsx11("span", { style: { color: colors.nullish, fontStyle: "italic" }, children: "anonymous" });
|
|
2800
|
+
}, ElementNode = ({
|
|
2801
|
+
prefix,
|
|
2802
|
+
localName,
|
|
2803
|
+
id: id13,
|
|
2804
|
+
classNames = [],
|
|
2805
|
+
innerText
|
|
2806
|
+
}) => {
|
|
2807
|
+
let name = prefix ? `${prefix}:${localName}` : localName, colors = useThemeColors();
|
|
2808
|
+
return jsxs9("span", { style: { wordBreak: "keep-all" }, children: [
|
|
2809
|
+
jsx11("span", { style: { color: colors.muted }, children: "<" }, `${name}_lt`),
|
|
2810
|
+
jsx11("span", { style: { color: colors.tag.name }, children: name }, `${name}_tag`),
|
|
2811
|
+
jsx11("span", { style: { color: colors.tag.suffix }, children: id13 ? `#${id13}` : classNames.reduce((acc, className) => `${acc}.${className}`, "") }, `${name}_suffix`),
|
|
2812
|
+
jsx11("span", { style: { color: colors.muted }, children: ">" }, `${name}_gt`),
|
|
2813
|
+
!id13 && classNames.length === 0 && innerText && jsxs9(Fragment6, { children: [
|
|
2814
|
+
jsx11("span", { children: innerText }, `${name}_text`),
|
|
2815
|
+
jsx11("span", { style: { color: colors.muted }, children: "<" }, `${name}_close_lt`),
|
|
2816
|
+
jsxs9("span", { style: { color: colors.tag.name }, children: [
|
|
2817
|
+
"/",
|
|
2818
|
+
name
|
|
2819
|
+
] }, `${name}_close_tag`),
|
|
2820
|
+
jsx11("span", { style: { color: colors.muted }, children: ">" }, `${name}_close_gt`)
|
|
2821
|
+
] })
|
|
2822
|
+
] });
|
|
2823
|
+
}, DateNode = ({ value }) => {
|
|
2824
|
+
let parsed = new Date(value);
|
|
2825
|
+
isNaN(Number(parsed)) && (logger.warn("Invalid date value:", value), parsed = null);
|
|
2826
|
+
let colors = useThemeColors();
|
|
2827
|
+
if (!parsed)
|
|
2828
|
+
return jsx11("span", { style: { whiteSpace: "nowrap", color: colors.date }, children: "Invalid date" });
|
|
2829
|
+
let [date, time, ms] = parsed.toISOString().split(/[T.Z]/);
|
|
2830
|
+
return jsxs9("span", { style: { whiteSpace: "nowrap", color: colors.date }, children: [
|
|
2831
|
+
date,
|
|
2832
|
+
jsx11("span", { style: { opacity: 0.7 }, children: "T" }),
|
|
2833
|
+
time === "00:00:00" ? jsx11("span", { style: { opacity: 0.7 }, children: time }) : time,
|
|
2834
|
+
ms === "000" ? jsxs9("span", { style: { opacity: 0.7 }, children: [
|
|
2835
|
+
".",
|
|
2836
|
+
ms
|
|
2837
|
+
] }) : `.${ms}`,
|
|
2838
|
+
jsx11("span", { style: { opacity: 0.7 }, children: "Z" })
|
|
2839
|
+
] });
|
|
2840
|
+
}, ErrorNode = ({ name, message }) => {
|
|
2841
|
+
let colors = useThemeColors();
|
|
2842
|
+
return jsxs9("span", { style: { color: colors.error.name }, children: [
|
|
2843
|
+
name,
|
|
2844
|
+
message && ": ",
|
|
2845
|
+
message && jsx11("span", { style: { color: colors.error.message }, title: message.length > 50 ? message : "", children: ellipsize(message, 50) })
|
|
2846
|
+
] });
|
|
2847
|
+
}, RegExpNode = ({ flags, source }) => {
|
|
2848
|
+
let colors = useThemeColors();
|
|
2849
|
+
return jsxs9("span", { style: { whiteSpace: "nowrap", color: colors.regex.flags }, children: [
|
|
2850
|
+
"/",
|
|
2851
|
+
jsx11("span", { style: { color: colors.regex.source }, children: source }),
|
|
2852
|
+
"/",
|
|
2853
|
+
flags
|
|
2854
|
+
] });
|
|
2855
|
+
}, SymbolNode = ({ description: description2 }) => {
|
|
2856
|
+
let colors = useThemeColors();
|
|
2857
|
+
return jsxs9("span", { style: { whiteSpace: "nowrap", color: colors.instance }, children: [
|
|
2858
|
+
"Symbol(",
|
|
2859
|
+
description2 && jsxs9("span", { style: { color: colors.meta }, children: [
|
|
2860
|
+
'"',
|
|
2861
|
+
description2,
|
|
2862
|
+
'"'
|
|
2863
|
+
] }),
|
|
2864
|
+
")"
|
|
2865
|
+
] });
|
|
2866
|
+
}, OtherNode = ({ value }) => {
|
|
2867
|
+
let colors = useThemeColors();
|
|
2868
|
+
return jsx11("span", { style: { color: colors.meta }, children: stringify(value) });
|
|
2869
|
+
}, StepNode = ({ label }) => {
|
|
2870
|
+
let colors = useThemeColors(), { typography } = useTheme4();
|
|
2871
|
+
return jsx11(
|
|
2872
|
+
"span",
|
|
2873
|
+
{
|
|
2874
|
+
style: {
|
|
2875
|
+
color: colors.base,
|
|
2876
|
+
fontFamily: typography.fonts.base,
|
|
2877
|
+
fontSize: typography.size.s2 - 1
|
|
2878
|
+
},
|
|
2879
|
+
children: label
|
|
2880
|
+
}
|
|
2881
|
+
);
|
|
2882
|
+
}, MethodCall = ({
|
|
2883
|
+
call,
|
|
2884
|
+
callsById
|
|
2885
|
+
}) => {
|
|
2886
|
+
if (!call)
|
|
2887
|
+
return null;
|
|
2888
|
+
if (call.method === "step" && call.path?.length === 0)
|
|
2889
|
+
return jsx11(StepNode, { label: call.args[0] });
|
|
2890
|
+
let path = call.path?.flatMap((elem, index) => {
|
|
2891
|
+
let callId = elem.__callId__;
|
|
2892
|
+
return [
|
|
2893
|
+
callId ? jsx11(MethodCall, { call: callsById?.get(callId), callsById }, `elem${index}`) : jsx11("span", { children: elem }, `elem${index}`),
|
|
2894
|
+
jsx11("wbr", {}, `wbr${index}`),
|
|
2895
|
+
jsx11("span", { children: "." }, `dot${index}`)
|
|
2896
|
+
];
|
|
2897
|
+
}), args = call.args?.flatMap((arg, index, array2) => {
|
|
2898
|
+
let node = jsx11(Node2, { value: arg, callsById }, `node${index}`);
|
|
2899
|
+
return index < array2.length - 1 ? [node, jsx11("span", { children: ",\xA0" }, `comma${index}`), jsx11("wbr", {}, `wbr${index}`)] : [node];
|
|
2900
|
+
}), colors = useThemeColors();
|
|
2901
|
+
return jsxs9(Fragment6, { children: [
|
|
2902
|
+
jsx11("span", { style: { color: colors.base }, children: path }),
|
|
2903
|
+
jsx11("span", { style: { color: colors.method }, children: call.method }),
|
|
2904
|
+
jsxs9("span", { style: { color: colors.base }, children: [
|
|
2905
|
+
"(",
|
|
2906
|
+
jsx11("wbr", {}),
|
|
2907
|
+
args,
|
|
2908
|
+
jsx11("wbr", {}),
|
|
2909
|
+
")"
|
|
2910
|
+
] })
|
|
2911
|
+
] });
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2914
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/MatcherResult.module.css
|
|
2915
|
+
var id6 = "core/src/component-testing/components/MatcherResult.module.css";
|
|
2916
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id6}"]`)) {
|
|
2917
|
+
let style = document.createElement("style");
|
|
2918
|
+
style.setAttribute("data-sb-css", id6), style.textContent = ".sb-cs81pG-expected{color:var(--sb-color-positive-text)}.sb-cs81pG-received{color:var(--sb-color-negative-text)}:where([data-sb-theme=dark]){& .sb-cs81pG-expected{color:var(--sb-color-positive)}& .sb-cs81pG-received{color:var(--sb-color-negative)}}", document.head.appendChild(style);
|
|
2919
|
+
}
|
|
2920
|
+
var MatcherResult_default = { received: "sb-cs81pG-received", expected: "sb-cs81pG-expected" };
|
|
2921
|
+
|
|
2922
|
+
// src/component-testing/components/MatcherResult.tsx
|
|
2923
|
+
import { Fragment as Fragment7, jsx as jsx12 } from "react/jsx-runtime";
|
|
2924
|
+
var getParams = (line, fromIndex = 0) => {
|
|
2925
|
+
for (let i = fromIndex, depth = 1; i < line.length; i += 1)
|
|
2926
|
+
if (line[i] === "(" ? depth += 1 : line[i] === ")" && (depth -= 1), depth === 0)
|
|
2927
|
+
return line.slice(fromIndex, i);
|
|
2928
|
+
return "";
|
|
2929
|
+
}, parseValue = (value) => {
|
|
2930
|
+
try {
|
|
2931
|
+
return value === "undefined" ? void 0 : JSON.parse(value);
|
|
2932
|
+
} catch {
|
|
2933
|
+
return value;
|
|
2934
|
+
}
|
|
2935
|
+
}, Received = ({ value, parsed }) => parsed ? jsx12(Node2, { showObjectInspector: !0, value, style: { color: "#D43900" } }) : jsx12("span", { className: MatcherResult_default.received, children: value }), Expected = ({ value, parsed }) => parsed ? typeof value == "string" && value.startsWith("called with") ? jsx12(Fragment7, { children: value }) : jsx12(Node2, { showObjectInspector: !0, value, style: { color: "#16B242" } }) : jsx12("span", { className: MatcherResult_default.expected, children: value }), MatcherResult = ({
|
|
2936
|
+
message,
|
|
2937
|
+
style = {}
|
|
2938
|
+
}) => {
|
|
2939
|
+
let filter = useAnsiToHtmlFilter(), lines = message.split(`
|
|
2940
|
+
`);
|
|
2941
|
+
return jsx12(
|
|
2942
|
+
"pre",
|
|
2943
|
+
{
|
|
2944
|
+
style: {
|
|
2945
|
+
margin: 0,
|
|
2946
|
+
padding: "8px 10px 8px 36px",
|
|
2947
|
+
fontSize: "var(--sb-size-s1)",
|
|
2948
|
+
...style
|
|
2949
|
+
},
|
|
2950
|
+
children: lines.flatMap((line, index) => {
|
|
2951
|
+
if (line.startsWith("expect(")) {
|
|
2952
|
+
let received = getParams(line, 7), remainderIndex = received ? 7 + received.length : 0, matcher = received && line.slice(remainderIndex).match(/\.(to|last|nth)[A-Z]\w+\(/);
|
|
2953
|
+
if (matcher) {
|
|
2954
|
+
let expectedIndex = remainderIndex + (matcher.index ?? 0) + matcher[0].length, expected = getParams(line, expectedIndex);
|
|
2955
|
+
if (expected)
|
|
2956
|
+
return [
|
|
2957
|
+
"expect(",
|
|
2958
|
+
jsx12(Received, { value: received }, `received_${received}`),
|
|
2959
|
+
line.slice(remainderIndex, expectedIndex),
|
|
2960
|
+
jsx12(Expected, { value: expected }, `expected_${expected}`),
|
|
2961
|
+
line.slice(expectedIndex + expected.length),
|
|
2962
|
+
jsx12("br", {}, `br${index}`)
|
|
2963
|
+
];
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
if (line.match(/^\s*- /))
|
|
2967
|
+
return [jsx12(Expected, { value: line }, line + index), jsx12("br", {}, `br${index}`)];
|
|
2968
|
+
if (line.match(/^\s*\+ /) || line.match(/^Received: $/))
|
|
2969
|
+
return [jsx12(Received, { value: line }, line + index), jsx12("br", {}, `br${index}`)];
|
|
2970
|
+
let [, assertionLabel, assertionValue] = line.match(/^(Expected|Received): (.*)$/) || [];
|
|
2971
|
+
if (assertionLabel && assertionValue)
|
|
2972
|
+
return assertionLabel === "Expected" ? [
|
|
2973
|
+
"Expected: ",
|
|
2974
|
+
jsx12(Expected, { value: parseValue(assertionValue), parsed: !0 }, line + index),
|
|
2975
|
+
jsx12("br", {}, `br${index}`)
|
|
2976
|
+
] : [
|
|
2977
|
+
"Received: ",
|
|
2978
|
+
jsx12(Received, { value: parseValue(assertionValue), parsed: !0 }, line + index),
|
|
2979
|
+
jsx12("br", {}, `br${index}`)
|
|
2980
|
+
];
|
|
2981
|
+
let [, prefix, numberOfCalls] = line.match(/(Expected number|Received number|Number) of calls: (\d+)$/i) || [];
|
|
2982
|
+
if (prefix && numberOfCalls)
|
|
2983
|
+
return [
|
|
2984
|
+
`${prefix} of calls: `,
|
|
2985
|
+
jsx12(Node2, { value: Number(numberOfCalls) }, line + index),
|
|
2986
|
+
jsx12("br", {}, `br${index}`)
|
|
2987
|
+
];
|
|
2988
|
+
let [, receivedValue] = line.match(/^Received has value: (.+)$/) || [];
|
|
2989
|
+
return receivedValue ? [
|
|
2990
|
+
"Received has value: ",
|
|
2991
|
+
jsx12(Node2, { value: parseValue(receivedValue) }, line + index),
|
|
2992
|
+
jsx12("br", {}, `br${index}`)
|
|
2993
|
+
] : [
|
|
2994
|
+
jsx12(
|
|
2995
|
+
"span",
|
|
2996
|
+
{
|
|
2997
|
+
dangerouslySetInnerHTML: { __html: filter.toHtml(line) }
|
|
2998
|
+
},
|
|
2999
|
+
line + index
|
|
3000
|
+
),
|
|
3001
|
+
jsx12("br", {}, `br${index}`)
|
|
3002
|
+
];
|
|
3003
|
+
})
|
|
3004
|
+
}
|
|
3005
|
+
);
|
|
3006
|
+
};
|
|
3007
|
+
|
|
3008
|
+
// src/component-testing/components/StatusIcon.tsx
|
|
3009
|
+
import { CheckIcon as CheckIcon2, CircleIcon, PlayIcon, StopAltIcon } from "@storybook/icons";
|
|
3010
|
+
import { useTheme as useTheme5 } from "@aussieljk/forkbook/theming";
|
|
3011
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
3012
|
+
var StatusIcon = ({ status }) => {
|
|
3013
|
+
let theme3 = useTheme5();
|
|
3014
|
+
switch (status) {
|
|
3015
|
+
case "done" /* DONE */:
|
|
3016
|
+
return jsx13(CheckIcon2, { color: theme3.color.positive, "data-testid": "icon-done" });
|
|
3017
|
+
case "error" /* ERROR */:
|
|
3018
|
+
return jsx13(StopAltIcon, { color: theme3.color.negative, "data-testid": "icon-error" });
|
|
3019
|
+
case "active" /* ACTIVE */:
|
|
3020
|
+
return jsx13(PlayIcon, { color: theme3.color.secondary, "data-testid": "icon-active" });
|
|
3021
|
+
case "waiting" /* WAITING */:
|
|
3022
|
+
return jsx13(
|
|
3023
|
+
"div",
|
|
3024
|
+
{
|
|
3025
|
+
style: {
|
|
3026
|
+
width: 14,
|
|
3027
|
+
height: 14,
|
|
3028
|
+
display: "flex",
|
|
3029
|
+
alignItems: "center",
|
|
3030
|
+
justifyContent: "center"
|
|
3031
|
+
},
|
|
3032
|
+
"data-testid": "icon-waiting",
|
|
3033
|
+
children: jsx13(CircleIcon, { color: "rgba(204, 204, 204, 0.5)", size: 6 })
|
|
3034
|
+
}
|
|
3035
|
+
);
|
|
3036
|
+
default:
|
|
3037
|
+
return null;
|
|
3038
|
+
}
|
|
3039
|
+
};
|
|
3040
|
+
|
|
3041
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/Interaction.module.css
|
|
3042
|
+
var id7 = "core/src/component-testing/components/Interaction.module.css";
|
|
3043
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id7}"]`)) {
|
|
3044
|
+
let style = document.createElement("style");
|
|
3045
|
+
style.setAttribute("data-sb-css", id7), style.textContent = '.sb-PYwdvq-methodCall{font-family:var(--sb-font-mono);font-size:var(--sb-size-s1);overflow-wrap:break-word;inline-size:calc(100% - 40px)}.sb-PYwdvq-row{border-bottom:1px solid var(--sb-app-border-color);font-family:var(--sb-font-base);flex-direction:column;font-size:13px;list-style:none;display:flex;position:relative;&[data-status=error]{background-color:var(--sb-background-warning)}&[data-paused]:before{content:"";z-index:1;border-top:4.5px solid #0000;border-left:7px solid var(--sb-color-warning);border-bottom:4.5px solid #0000;position:absolute;top:-5px}&[data-paused]:after{content:"";z-index:1;border-top:1.5px solid var(--sb-color-warning);width:100%;position:absolute;top:-1px}}:where([data-sb-theme=dark]) .sb-PYwdvq-row[data-status=error]{background-color:rgb(from var(--sb-color-negative) r g b / calc(alpha - .93))}.sb-PYwdvq-rowHeader{display:flex;&:not([data-navigation-disabled]):hover{background:var(--sb-background-hoverable)}}.sb-PYwdvq-rowLabel{text-align:start;cursor:pointer;background:0 0;border:0;flex:1;grid-template-columns:15px 1fr;align-items:center;min-height:40px;margin:0;padding:8px 15px;display:grid;&:disabled,&[data-status=error]{cursor:default}&:focus-visible{box-shadow:inset 3px 0 0 0 var(--sb-color-secondary);background:var(--sb-background-hoverable);outline:0}&[data-status=error]:focus-visible{box-shadow:inset 3px 0 0 0 var(--sb-color-warning);background:0 0}&[data-status=waiting]>div{opacity:.5}}.sb-PYwdvq-rowActions{align-items:center;padding:6px;display:flex}.sb-PYwdvq-button{color:var(--sb-text-muted-color);margin:0 3px}.sb-PYwdvq-rowMessage{font-size:var(--sb-size-s1);color:var(--sb-color-default-text);padding:8px 10px 8px 36px;& pre{margin:0;padding:0}}.sb-PYwdvq-errorName{color:#0271b6}.sb-PYwdvq-errorMessage{color:#444}.sb-PYwdvq-errorExplainer{color:var(--sb-color-negative-text);font-size:var(--sb-size-s2);text-wrap:balance;max-width:500px}:where([data-sb-theme=dark]){& .sb-PYwdvq-errorName{color:#5ec1ff}& .sb-PYwdvq-errorMessage{color:#eee}& .sb-PYwdvq-errorExplainer{color:var(--sb-color-negative)}}', document.head.appendChild(style);
|
|
3046
|
+
}
|
|
3047
|
+
var Interaction_default = { methodCall: "sb-PYwdvq-methodCall", rowMessage: "sb-PYwdvq-rowMessage", row: "sb-PYwdvq-row", errorMessage: "sb-PYwdvq-errorMessage", rowLabel: "sb-PYwdvq-rowLabel", errorExplainer: "sb-PYwdvq-errorExplainer", rowHeader: "sb-PYwdvq-rowHeader", button: "sb-PYwdvq-button", errorName: "sb-PYwdvq-errorName", rowActions: "sb-PYwdvq-rowActions" };
|
|
3048
|
+
|
|
3049
|
+
// src/component-testing/components/Interaction.tsx
|
|
3050
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3051
|
+
var extractStepName = (call) => {
|
|
3052
|
+
if (call.method === "step" && call.path?.length === 0 && typeof call.args?.[0] == "string") {
|
|
3053
|
+
let label = call.args[0].trim();
|
|
3054
|
+
if (label.length > 0)
|
|
3055
|
+
return label;
|
|
3056
|
+
}
|
|
3057
|
+
return call.method;
|
|
3058
|
+
}, getRowAriaLabel = ({
|
|
3059
|
+
isNavigationDisabled,
|
|
3060
|
+
stepName,
|
|
3061
|
+
statusText
|
|
3062
|
+
}) => `${isNavigationDisabled ? "Interaction row" : "Go to interaction row"}: ${stepName}. Status: ${statusText}.`, getExpandButtonAriaLabel = ({
|
|
3063
|
+
isCollapsed,
|
|
3064
|
+
stepName
|
|
3065
|
+
}) => `${isCollapsed ? "Expand" : "Collapse"} nested interaction steps for ${stepName}`, stepStatusTextMap = {
|
|
3066
|
+
done: "passed",
|
|
3067
|
+
error: "failed",
|
|
3068
|
+
active: "running",
|
|
3069
|
+
waiting: "pending"
|
|
3070
|
+
}, getInteractionStatusText = (call) => call.status ? stepStatusTextMap[call.status] : "not run", Exception = ({ exception }) => {
|
|
3071
|
+
let filter = useAnsiToHtmlFilter();
|
|
3072
|
+
if (!exception)
|
|
3073
|
+
return null;
|
|
3074
|
+
if (exception.callId === INTERNAL_RENDER_CALL_ID)
|
|
3075
|
+
return jsxs10("div", { className: Interaction_default.rowMessage, children: [
|
|
3076
|
+
jsxs10("pre", { children: [
|
|
3077
|
+
jsxs10("span", { className: Interaction_default.errorName, children: [
|
|
3078
|
+
exception.name,
|
|
3079
|
+
":"
|
|
3080
|
+
] }),
|
|
3081
|
+
" ",
|
|
3082
|
+
jsx14("span", { className: Interaction_default.errorMessage, children: exception.message })
|
|
3083
|
+
] }),
|
|
3084
|
+
jsx14("p", { className: Interaction_default.errorExplainer, children: "The component failed to render properly. Automated component tests will not run until this is resolved. Check the full error message in Forkbook\u2019s canvas to debug." })
|
|
3085
|
+
] });
|
|
3086
|
+
if (isJestError(exception))
|
|
3087
|
+
return jsx14(MatcherResult, { ...exception });
|
|
3088
|
+
if (isChaiError(exception))
|
|
3089
|
+
return jsxs10("div", { className: Interaction_default.rowMessage, children: [
|
|
3090
|
+
jsx14(
|
|
3091
|
+
MatcherResult,
|
|
3092
|
+
{
|
|
3093
|
+
message: `${exception.message}${exception.diff ? `
|
|
3094
|
+
|
|
3095
|
+
${exception.diff}` : ""}`,
|
|
3096
|
+
style: { padding: 0 }
|
|
3097
|
+
}
|
|
3098
|
+
),
|
|
3099
|
+
jsx14("p", { children: "See the full stack trace in the browser console." })
|
|
3100
|
+
] });
|
|
3101
|
+
let paragraphs = exception.message.split(`
|
|
3102
|
+
|
|
3103
|
+
`), more = paragraphs.length > 1;
|
|
3104
|
+
return jsxs10("div", { className: Interaction_default.rowMessage, children: [
|
|
3105
|
+
jsx14("pre", { dangerouslySetInnerHTML: { __html: filter.toHtml(paragraphs[0]) } }),
|
|
3106
|
+
more && jsx14("p", { children: "See the full stack trace in the browser console." })
|
|
3107
|
+
] });
|
|
3108
|
+
}, Interaction = ({
|
|
3109
|
+
call,
|
|
3110
|
+
callsById,
|
|
3111
|
+
controls,
|
|
3112
|
+
controlStates,
|
|
3113
|
+
childCallIds,
|
|
3114
|
+
isHidden,
|
|
3115
|
+
isCollapsed,
|
|
3116
|
+
toggleCollapsed,
|
|
3117
|
+
pausedAt
|
|
3118
|
+
}) => {
|
|
3119
|
+
let [isHovered, setIsHovered] = React30.useState(!1), isNavigationDisabled = !controlStates.goto || !call.interceptable || !!call.ancestors?.length, stepName = extractStepName(call), interactionStatus = getInteractionStatusText(call);
|
|
3120
|
+
return isHidden || call.id === INTERNAL_RENDER_CALL_ID ? null : jsxs10(
|
|
3121
|
+
"li",
|
|
3122
|
+
{
|
|
3123
|
+
className: Interaction_default.row,
|
|
3124
|
+
"data-status": call.status,
|
|
3125
|
+
"data-paused": pausedAt === call.id || void 0,
|
|
3126
|
+
style: { paddingLeft: (call.ancestors?.length ?? 0) * 20 },
|
|
3127
|
+
children: [
|
|
3128
|
+
jsxs10(
|
|
3129
|
+
"div",
|
|
3130
|
+
{
|
|
3131
|
+
className: Interaction_default.rowHeader,
|
|
3132
|
+
"data-navigation-disabled": isNavigationDisabled || void 0,
|
|
3133
|
+
children: [
|
|
3134
|
+
jsxs10(
|
|
3135
|
+
"button",
|
|
3136
|
+
{
|
|
3137
|
+
className: Interaction_default.rowLabel,
|
|
3138
|
+
"data-status": call.status,
|
|
3139
|
+
"aria-label": getRowAriaLabel({
|
|
3140
|
+
isNavigationDisabled,
|
|
3141
|
+
stepName,
|
|
3142
|
+
statusText: interactionStatus
|
|
3143
|
+
}),
|
|
3144
|
+
onClick: () => controls.goto(call.id),
|
|
3145
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
3146
|
+
disabled: isNavigationDisabled,
|
|
3147
|
+
onMouseEnter: () => controlStates.goto && setIsHovered(!0),
|
|
3148
|
+
onMouseLeave: () => controlStates.goto && setIsHovered(!1),
|
|
3149
|
+
children: [
|
|
3150
|
+
jsx14(StatusIcon, { status: isHovered ? "active" /* ACTIVE */ : call.status }),
|
|
3151
|
+
jsx14("div", { className: Interaction_default.methodCall, style: { marginLeft: 6, marginBottom: 1 }, children: jsx14(MethodCall, { call, callsById }) })
|
|
3152
|
+
]
|
|
3153
|
+
}
|
|
3154
|
+
),
|
|
3155
|
+
jsx14("div", { className: Interaction_default.rowActions, children: (childCallIds?.length ?? 0) > 0 && jsx14(
|
|
3156
|
+
Button2,
|
|
3157
|
+
{
|
|
3158
|
+
className: Interaction_default.button,
|
|
3159
|
+
padding: "small",
|
|
3160
|
+
variant: "ghost",
|
|
3161
|
+
onClick: toggleCollapsed,
|
|
3162
|
+
ariaLabel: getExpandButtonAriaLabel({ isCollapsed, stepName }),
|
|
3163
|
+
"aria-expanded": !isCollapsed,
|
|
3164
|
+
children: isCollapsed ? jsx14(ChevronUpIcon, {}) : jsx14(ChevronDownIcon, {})
|
|
3165
|
+
}
|
|
3166
|
+
) })
|
|
3167
|
+
]
|
|
3168
|
+
}
|
|
3169
|
+
),
|
|
3170
|
+
call.status === "error" /* ERROR */ && call.exception?.callId === call.id && jsx14(Exception, { exception: call.exception })
|
|
3171
|
+
]
|
|
3172
|
+
}
|
|
3173
|
+
);
|
|
3174
|
+
};
|
|
3175
|
+
|
|
3176
|
+
// src/component-testing/components/TestDiscrepancyMessage.tsx
|
|
3177
|
+
import { Link as Link3 } from "@aussieljk/forkbook/internal/components";
|
|
3178
|
+
import { useStorybookApi as useStorybookApi5 } from "@aussieljk/forkbook/manager-api";
|
|
3179
|
+
|
|
3180
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/TestDiscrepancyMessage.module.css
|
|
3181
|
+
var id8 = "core/src/component-testing/components/TestDiscrepancyMessage.module.css";
|
|
3182
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id8}"]`)) {
|
|
3183
|
+
let style = document.createElement("style");
|
|
3184
|
+
style.setAttribute("data-sb-css", id8), style.textContent = ".sb-wob9GG-message{text-align:start;font-size:calc(var(--sb-size-s2) - 1px);font-weight:var(--sb-weight-regular);background:var(--sb-background-app);border-bottom:1px solid var(--sb-color-border);color:var(--sb-color-default-text);background-clip:padding-box;padding:11px 15px;line-height:1rem;position:relative}.sb-wob9GG-message code{font-size:calc(var(--sb-size-s1) - 1px);color:inherit;background:#fffc;border-radius:2px;margin:0 .2em;padding:0 .2em;box-shadow:0 0 0 1px #0000001a}", document.head.appendChild(style);
|
|
3185
|
+
}
|
|
3186
|
+
var TestDiscrepancyMessage_default = { message: "sb-wob9GG-message" };
|
|
3187
|
+
|
|
3188
|
+
// src/component-testing/components/TestDiscrepancyMessage.tsx
|
|
3189
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3190
|
+
var TestDiscrepancyMessage = ({ browserTestStatus }) => {
|
|
3191
|
+
let docsUrl = useStorybookApi5().getDocsUrl({
|
|
3192
|
+
subpath: DOCUMENTATION_DISCREPANCY_LINK,
|
|
3193
|
+
versioned: !0,
|
|
3194
|
+
renderer: !0
|
|
3195
|
+
}), [passed, failed] = browserTestStatus === "error" /* ERROR */ ? ["the CLI", "this browser"] : ["this browser", "the CLI"];
|
|
3196
|
+
return jsxs11("div", { className: TestDiscrepancyMessage_default.message, children: [
|
|
3197
|
+
"This interaction test passed in ",
|
|
3198
|
+
passed,
|
|
3199
|
+
", but the tests failed in ",
|
|
3200
|
+
failed,
|
|
3201
|
+
".",
|
|
3202
|
+
" ",
|
|
3203
|
+
jsx15(Link3, { href: docsUrl, target: "_blank", withArrow: !0, children: "Learn what could cause this" })
|
|
3204
|
+
] });
|
|
3205
|
+
};
|
|
3206
|
+
|
|
3207
|
+
// src/component-testing/components/Toolbar.tsx
|
|
3208
|
+
import {
|
|
3209
|
+
Button as Button3,
|
|
3210
|
+
P,
|
|
3211
|
+
Separator,
|
|
3212
|
+
Toolbar as SharedToolbar
|
|
3213
|
+
} from "@aussieljk/forkbook/internal/components";
|
|
3214
|
+
import {
|
|
3215
|
+
FastForwardIcon,
|
|
3216
|
+
PlayBackIcon,
|
|
3217
|
+
PlayNextIcon,
|
|
3218
|
+
RewindIcon,
|
|
3219
|
+
SyncIcon
|
|
3220
|
+
} from "@storybook/icons";
|
|
3221
|
+
import { useTheme as useTheme6 } from "@aussieljk/forkbook/theming";
|
|
3222
|
+
|
|
3223
|
+
// src/component-testing/components/StatusBadge.tsx
|
|
3224
|
+
import { TooltipNote, WithTooltip } from "@aussieljk/forkbook/internal/components";
|
|
3225
|
+
|
|
3226
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/StatusBadge.module.css
|
|
3227
|
+
var id9 = "core/src/component-testing/components/StatusBadge.module.css";
|
|
3228
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id9}"]`)) {
|
|
3229
|
+
let style = document.createElement("style");
|
|
3230
|
+
style.setAttribute("data-sb-css", id9), style.textContent = ".sb-R5-BBa-badge{color:#fff;font-family:var(--sb-font-base);text-transform:uppercase;font-size:var(--sb-size-s1);letter-spacing:3px;font-weight:var(--sb-weight-bold);text-align:center;border-radius:4px;min-width:65px;padding:4px 6px 4px 8px;display:inline-block}", document.head.appendChild(style);
|
|
3231
|
+
}
|
|
3232
|
+
var StatusBadge_default = { badge: "sb-R5-BBa-badge" };
|
|
3233
|
+
|
|
3234
|
+
// src/component-testing/components/StatusBadge.tsx
|
|
3235
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3236
|
+
var StatusColorMapping = {
|
|
3237
|
+
rendering: "mediumdark",
|
|
3238
|
+
playing: "warning",
|
|
3239
|
+
completed: "positive",
|
|
3240
|
+
errored: "negative",
|
|
3241
|
+
aborted: "purple"
|
|
3242
|
+
}, StatusTextMapping = {
|
|
3243
|
+
rendering: "Wait",
|
|
3244
|
+
playing: "Runs",
|
|
3245
|
+
completed: "Pass",
|
|
3246
|
+
errored: "Fail",
|
|
3247
|
+
aborted: "Bail"
|
|
3248
|
+
}, StatusNoteMapping = {
|
|
3249
|
+
rendering: "Story is rendering",
|
|
3250
|
+
playing: "Interactions are running",
|
|
3251
|
+
completed: "Story ran successfully",
|
|
3252
|
+
errored: "Story failed to complete",
|
|
3253
|
+
aborted: "Interactions aborted due to file changes"
|
|
3254
|
+
}, StatusBadge = ({ status }) => {
|
|
3255
|
+
let badgeText = StatusTextMapping[status], badgeNote = StatusNoteMapping[status];
|
|
3256
|
+
return jsx16(
|
|
3257
|
+
WithTooltip,
|
|
3258
|
+
{
|
|
3259
|
+
hasChrome: !1,
|
|
3260
|
+
placement: "top",
|
|
3261
|
+
trigger: "hover",
|
|
3262
|
+
tooltip: jsx16(TooltipNote, { note: badgeNote }),
|
|
3263
|
+
children: jsx16(
|
|
3264
|
+
"div",
|
|
3265
|
+
{
|
|
3266
|
+
className: StatusBadge_default.badge,
|
|
3267
|
+
style: { backgroundColor: `var(--sb-color-${StatusColorMapping[status]})` },
|
|
3268
|
+
"aria-label": `Story status: ${badgeText}`,
|
|
3269
|
+
children: badgeText
|
|
3270
|
+
}
|
|
3271
|
+
)
|
|
3272
|
+
}
|
|
3273
|
+
);
|
|
3274
|
+
};
|
|
3275
|
+
|
|
3276
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/Toolbar.module.css
|
|
3277
|
+
var id10 = "core/src/component-testing/components/Toolbar.module.css";
|
|
3278
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id10}"]`)) {
|
|
3279
|
+
let style = document.createElement("style");
|
|
3280
|
+
style.setAttribute("data-sb-css", id10), style.textContent = ".sb-W9rv1G-wrapper{box-shadow:var(--sb-app-border-color) 0 -1px 0 0 inset;background:var(--sb-background-app);z-index:1;position:sticky;top:0}.sb-W9rv1G-controlsGroup{flex:1;align-items:center;gap:6px;display:flex}.sb-W9rv1G-iconButton{color:var(--sb-text-muted-color)}.sb-W9rv1G-rewindButton{margin-inline-start:3px;}.sb-W9rv1G-jumpToEndButton{color:var(--sb-text-muted-color);border-radius:4px;margin-inline:3px;padding:6px;line-height:12px;&:not(:disabled):hover,&:not(:disabled):focus-visible{color:var(--sb-color-secondary)}}.sb-W9rv1G-openInEditorButton{color:var(--sb-color-secondary);font-weight:var(--sb-weight-bold);text-align:right;white-space:nowrap;justify-content:flex-end;font-size:13px;line-height:24px}.sb-W9rv1G-location{color:var(--sb-text-muted-color);cursor:default;font-weight:var(--sb-weight-regular);text-align:right;white-space:nowrap;justify-content:flex-end;margin:0;font-size:13px}", document.head.appendChild(style);
|
|
3281
|
+
}
|
|
3282
|
+
var Toolbar_default = { rewindButton: "sb-W9rv1G-rewindButton sb-W9rv1G-iconButton", openInEditorButton: "sb-W9rv1G-openInEditorButton", location: "sb-W9rv1G-location", jumpToEndButton: "sb-W9rv1G-jumpToEndButton", wrapper: "sb-W9rv1G-wrapper", controlsGroup: "sb-W9rv1G-controlsGroup", iconButton: "sb-W9rv1G-iconButton" };
|
|
3283
|
+
|
|
3284
|
+
// src/component-testing/components/Toolbar.tsx
|
|
3285
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3286
|
+
var Toolbar = ({
|
|
3287
|
+
controls,
|
|
3288
|
+
controlStates,
|
|
3289
|
+
status,
|
|
3290
|
+
storyFileName,
|
|
3291
|
+
onScrollToEnd,
|
|
3292
|
+
importPath,
|
|
3293
|
+
canOpenInEditor,
|
|
3294
|
+
api
|
|
3295
|
+
}) => {
|
|
3296
|
+
let buttonText = status === "errored" ? "Scroll to error" : "Scroll to end", theme3 = useTheme6(), preventFocusLoss = (e) => e.preventDefault();
|
|
3297
|
+
return jsx17("div", { className: Toolbar_default.wrapper, children: jsxs12(
|
|
3298
|
+
SharedToolbar,
|
|
3299
|
+
{
|
|
3300
|
+
backgroundColor: theme3.background.app,
|
|
3301
|
+
innerStyle: { gap: 6, paddingInline: 15 },
|
|
3302
|
+
"aria-label": "Component test playback controls",
|
|
3303
|
+
children: [
|
|
3304
|
+
jsxs12("div", { className: Toolbar_default.controlsGroup, children: [
|
|
3305
|
+
jsx17(StatusBadge, { status }),
|
|
3306
|
+
jsx17(
|
|
3307
|
+
Button3,
|
|
3308
|
+
{
|
|
3309
|
+
className: Toolbar_default.jumpToEndButton,
|
|
3310
|
+
ariaLabel: !1,
|
|
3311
|
+
onClick: onScrollToEnd,
|
|
3312
|
+
onPointerDown: preventFocusLoss,
|
|
3313
|
+
disabled: !onScrollToEnd,
|
|
3314
|
+
children: buttonText
|
|
3315
|
+
}
|
|
3316
|
+
),
|
|
3317
|
+
jsx17(Separator, {}),
|
|
3318
|
+
jsx17(
|
|
3319
|
+
Button3,
|
|
3320
|
+
{
|
|
3321
|
+
className: Toolbar_default.rewindButton,
|
|
3322
|
+
padding: "small",
|
|
3323
|
+
variant: "ghost",
|
|
3324
|
+
ariaLabel: "Go to start",
|
|
3325
|
+
onClick: controls.start,
|
|
3326
|
+
onPointerDown: preventFocusLoss,
|
|
3327
|
+
disabled: !controlStates.start,
|
|
3328
|
+
children: jsx17(RewindIcon, {})
|
|
3329
|
+
}
|
|
3330
|
+
),
|
|
3331
|
+
jsx17(
|
|
3332
|
+
Button3,
|
|
3333
|
+
{
|
|
3334
|
+
className: Toolbar_default.iconButton,
|
|
3335
|
+
padding: "small",
|
|
3336
|
+
variant: "ghost",
|
|
3337
|
+
ariaLabel: "Go back",
|
|
3338
|
+
onClick: controls.back,
|
|
3339
|
+
onPointerDown: preventFocusLoss,
|
|
3340
|
+
disabled: !controlStates.back,
|
|
3341
|
+
children: jsx17(PlayBackIcon, {})
|
|
3342
|
+
}
|
|
3343
|
+
),
|
|
3344
|
+
jsx17(
|
|
3345
|
+
Button3,
|
|
3346
|
+
{
|
|
3347
|
+
className: Toolbar_default.iconButton,
|
|
3348
|
+
padding: "small",
|
|
3349
|
+
variant: "ghost",
|
|
3350
|
+
ariaLabel: "Go forward",
|
|
3351
|
+
onClick: controls.next,
|
|
3352
|
+
onPointerDown: preventFocusLoss,
|
|
3353
|
+
disabled: !controlStates.next,
|
|
3354
|
+
children: jsx17(PlayNextIcon, {})
|
|
3355
|
+
}
|
|
3356
|
+
),
|
|
3357
|
+
jsx17(
|
|
3358
|
+
Button3,
|
|
3359
|
+
{
|
|
3360
|
+
className: Toolbar_default.iconButton,
|
|
3361
|
+
padding: "small",
|
|
3362
|
+
variant: "ghost",
|
|
3363
|
+
ariaLabel: "Go to end",
|
|
3364
|
+
onClick: controls.end,
|
|
3365
|
+
onPointerDown: preventFocusLoss,
|
|
3366
|
+
disabled: !controlStates.end,
|
|
3367
|
+
children: jsx17(FastForwardIcon, {})
|
|
3368
|
+
}
|
|
3369
|
+
),
|
|
3370
|
+
jsx17(
|
|
3371
|
+
Button3,
|
|
3372
|
+
{
|
|
3373
|
+
className: Toolbar_default.iconButton,
|
|
3374
|
+
padding: "small",
|
|
3375
|
+
variant: "ghost",
|
|
3376
|
+
ariaLabel: "Rerun",
|
|
3377
|
+
onClick: controls.rerun,
|
|
3378
|
+
onPointerDown: preventFocusLoss,
|
|
3379
|
+
children: jsx17(SyncIcon, {})
|
|
3380
|
+
}
|
|
3381
|
+
)
|
|
3382
|
+
] }),
|
|
3383
|
+
(importPath || storyFileName) && (canOpenInEditor ? jsx17(
|
|
3384
|
+
Button3,
|
|
3385
|
+
{
|
|
3386
|
+
className: Toolbar_default.openInEditorButton,
|
|
3387
|
+
padding: "small",
|
|
3388
|
+
size: "small",
|
|
3389
|
+
variant: "ghost",
|
|
3390
|
+
ariaLabel: "Open in editor",
|
|
3391
|
+
onClick: () => {
|
|
3392
|
+
api.openInEditor({
|
|
3393
|
+
file: importPath
|
|
3394
|
+
});
|
|
3395
|
+
},
|
|
3396
|
+
children: storyFileName
|
|
3397
|
+
}
|
|
3398
|
+
) : jsx17(P, { className: Toolbar_default.location, children: storyFileName }))
|
|
3399
|
+
]
|
|
3400
|
+
}
|
|
3401
|
+
) });
|
|
3402
|
+
};
|
|
3403
|
+
|
|
3404
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/component-testing/components/InteractionsPanel.module.css
|
|
3405
|
+
var id11 = "core/src/component-testing/components/InteractionsPanel.module.css";
|
|
3406
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id11}"]`)) {
|
|
3407
|
+
let style = document.createElement("style");
|
|
3408
|
+
style.setAttribute("data-sb-css", id11), style.textContent = ".sb-RpIDLa-container{background:var(--sb-background-content);height:100%}.sb-RpIDLa-section{position:relative}.sb-RpIDLa-heading{white-space:nowrap;clip:rect(0, 0, 0, 0);clip-path:inset(50%);border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.sb-RpIDLa-list{margin:0;padding:0}.sb-RpIDLa-caughtException{border-bottom:1px solid var(--sb-app-border-color);background-color:var(--sb-background-warning);font-size:calc(var(--sb-size-s2) - 1px);padding:15px;line-height:19px}:where([data-sb-theme=dark]) .sb-RpIDLa-caughtException{background-color:rgb(from var(--sb-color-negative) r g b / calc(alpha - .93))}.sb-RpIDLa-caughtExceptionCode{font-size:calc(var(--sb-size-s1) - 1px);vertical-align:top;border:1px solid var(--sb-app-border-color);background:#0000000d;border-radius:3px;margin:0 1px;padding:3px;line-height:1}.sb-RpIDLa-caughtExceptionTitle{padding-bottom:4px;font-weight:700}.sb-RpIDLa-caughtExceptionDescription{margin:0;padding:0 0 20px}.sb-RpIDLa-caughtExceptionStack{font-size:calc(var(--sb-size-s1) - 1px);margin:0;padding:0;&:not(:last-child){padding-bottom:16px}}", document.head.appendChild(style);
|
|
3409
|
+
}
|
|
3410
|
+
var InteractionsPanel_default = { caughtExceptionCode: "sb-RpIDLa-caughtExceptionCode", caughtExceptionTitle: "sb-RpIDLa-caughtExceptionTitle", caughtException: "sb-RpIDLa-caughtException", heading: "sb-RpIDLa-heading", caughtExceptionStack: "sb-RpIDLa-caughtExceptionStack", section: "sb-RpIDLa-section", caughtExceptionDescription: "sb-RpIDLa-caughtExceptionDescription", list: "sb-RpIDLa-list", container: "sb-RpIDLa-container" };
|
|
3411
|
+
|
|
3412
|
+
// src/component-testing/components/InteractionsPanel.tsx
|
|
3413
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3414
|
+
var StatusAnnouncementMapping = {
|
|
3415
|
+
rendering: "Component test is rendering.",
|
|
3416
|
+
playing: "Component test is running.",
|
|
3417
|
+
completed: "Component test completed successfully.",
|
|
3418
|
+
errored: "Component test failed.",
|
|
3419
|
+
aborted: "Component test was aborted."
|
|
3420
|
+
}, getStatusAnnouncement = (status, hasException) => status === "completed" && hasException ? StatusAnnouncementMapping.errored : StatusAnnouncementMapping[status], InteractionsPanel = React31.memo(
|
|
3421
|
+
function({
|
|
3422
|
+
storyUrl,
|
|
3423
|
+
status,
|
|
3424
|
+
calls,
|
|
3425
|
+
controls,
|
|
3426
|
+
controlStates,
|
|
3427
|
+
interactions,
|
|
3428
|
+
fileName,
|
|
3429
|
+
hasException,
|
|
3430
|
+
caughtException,
|
|
3431
|
+
unhandledErrors,
|
|
3432
|
+
pausedAt,
|
|
3433
|
+
onScrollToEnd,
|
|
3434
|
+
endRef,
|
|
3435
|
+
hasResultMismatch,
|
|
3436
|
+
browserTestStatus,
|
|
3437
|
+
importPath,
|
|
3438
|
+
canOpenInEditor,
|
|
3439
|
+
api
|
|
3440
|
+
}) {
|
|
3441
|
+
let filter = useAnsiToHtmlFilter(), hasRealInteractions = interactions.some((i) => i.id !== INTERNAL_RENDER_CALL_ID), isListBusy = status === "rendering" || status === "playing", statusAnnouncement = getStatusAnnouncement(status, hasException), isStatusAlert = status === "errored" || status === "completed" && hasException;
|
|
3442
|
+
return React31.useEffect(() => {
|
|
3443
|
+
announce(statusAnnouncement, isStatusAlert ? "assertive" : "polite");
|
|
3444
|
+
}, [statusAnnouncement, isStatusAlert]), jsxs13("div", { className: InteractionsPanel_default.container, children: [
|
|
3445
|
+
hasResultMismatch && jsx18(TestDiscrepancyMessage, { browserTestStatus }),
|
|
3446
|
+
controlStates.detached && (hasRealInteractions || hasException) && jsx18(DetachedDebuggerMessage, { storyUrl }),
|
|
3447
|
+
jsx18(
|
|
3448
|
+
Toolbar,
|
|
3449
|
+
{
|
|
3450
|
+
controls,
|
|
3451
|
+
controlStates,
|
|
3452
|
+
status,
|
|
3453
|
+
storyFileName: fileName,
|
|
3454
|
+
onScrollToEnd,
|
|
3455
|
+
importPath,
|
|
3456
|
+
canOpenInEditor,
|
|
3457
|
+
api
|
|
3458
|
+
}
|
|
3459
|
+
),
|
|
3460
|
+
jsxs13("section", { className: InteractionsPanel_default.section, children: [
|
|
3461
|
+
jsx18("h3", { className: InteractionsPanel_default.heading, children: "Interaction steps" }),
|
|
3462
|
+
jsx18("ol", { className: InteractionsPanel_default.list, "aria-busy": isListBusy, children: interactions.map((call) => jsx18(
|
|
3463
|
+
Interaction,
|
|
3464
|
+
{
|
|
3465
|
+
call,
|
|
3466
|
+
callsById: calls,
|
|
3467
|
+
controls,
|
|
3468
|
+
controlStates,
|
|
3469
|
+
childCallIds: call.childCallIds,
|
|
3470
|
+
isHidden: call.isHidden,
|
|
3471
|
+
isCollapsed: call.isCollapsed,
|
|
3472
|
+
toggleCollapsed: call.toggleCollapsed,
|
|
3473
|
+
pausedAt
|
|
3474
|
+
},
|
|
3475
|
+
call.id
|
|
3476
|
+
)) })
|
|
3477
|
+
] }),
|
|
3478
|
+
caughtException && !isTestAssertionError(caughtException) && jsxs13("div", { className: InteractionsPanel_default.caughtException, children: [
|
|
3479
|
+
jsxs13("div", { className: InteractionsPanel_default.caughtExceptionTitle, children: [
|
|
3480
|
+
"Caught exception in ",
|
|
3481
|
+
jsx18("code", { className: InteractionsPanel_default.caughtExceptionCode, children: "play" }),
|
|
3482
|
+
" function"
|
|
3483
|
+
] }),
|
|
3484
|
+
jsx18(
|
|
3485
|
+
"pre",
|
|
3486
|
+
{
|
|
3487
|
+
className: InteractionsPanel_default.caughtExceptionStack,
|
|
3488
|
+
"data-chromatic": "ignore",
|
|
3489
|
+
dangerouslySetInnerHTML: {
|
|
3490
|
+
__html: filter.toHtml(printSerializedError(caughtException))
|
|
3491
|
+
}
|
|
3492
|
+
}
|
|
3493
|
+
)
|
|
3494
|
+
] }),
|
|
3495
|
+
unhandledErrors && jsxs13("div", { className: InteractionsPanel_default.caughtException, children: [
|
|
3496
|
+
jsx18("div", { className: InteractionsPanel_default.caughtExceptionTitle, children: "Unhandled Errors" }),
|
|
3497
|
+
jsxs13("p", { className: InteractionsPanel_default.caughtExceptionDescription, children: [
|
|
3498
|
+
"Found ",
|
|
3499
|
+
unhandledErrors.length,
|
|
3500
|
+
" unhandled error",
|
|
3501
|
+
unhandledErrors.length > 1 ? "s" : "",
|
|
3502
|
+
" ",
|
|
3503
|
+
"while running the play function. This might cause false positive assertions. Resolve unhandled errors or ignore unhandled errors with setting the",
|
|
3504
|
+
jsx18("code", { className: InteractionsPanel_default.caughtExceptionCode, children: "test.dangerouslyIgnoreUnhandledErrors" }),
|
|
3505
|
+
" ",
|
|
3506
|
+
"parameter to ",
|
|
3507
|
+
jsx18("code", { className: InteractionsPanel_default.caughtExceptionCode, children: "true" }),
|
|
3508
|
+
"."
|
|
3509
|
+
] }),
|
|
3510
|
+
unhandledErrors.map((error, i) => jsx18("pre", { className: InteractionsPanel_default.caughtExceptionStack, "data-chromatic": "ignore", children: printSerializedError(error) }, i))
|
|
3511
|
+
] }),
|
|
3512
|
+
jsx18("div", { ref: endRef }),
|
|
3513
|
+
status === "completed" && !caughtException && !hasRealInteractions && jsx18(Empty, {})
|
|
3514
|
+
] });
|
|
3515
|
+
}
|
|
3516
|
+
);
|
|
3517
|
+
function printSerializedError(error) {
|
|
3518
|
+
return error.stack || `${error.name}: ${error.message}`;
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
// src/component-testing/components/Panel.tsx
|
|
3522
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3523
|
+
var INITIAL_CONTROL_STATES = {
|
|
3524
|
+
detached: !1,
|
|
3525
|
+
start: !1,
|
|
3526
|
+
back: !1,
|
|
3527
|
+
goto: !1,
|
|
3528
|
+
next: !1,
|
|
3529
|
+
end: !1
|
|
3530
|
+
}, playStatusMap = {
|
|
3531
|
+
rendering: "rendering",
|
|
3532
|
+
playing: "playing",
|
|
3533
|
+
completed: "completed",
|
|
3534
|
+
errored: "errored",
|
|
3535
|
+
aborted: "aborted"
|
|
3536
|
+
}, terminalStatuses = ["completed", "errored", "aborted"], storyStatusMap = {
|
|
3537
|
+
done: "status-value:success",
|
|
3538
|
+
error: "status-value:error",
|
|
3539
|
+
active: "status-value:pending",
|
|
3540
|
+
waiting: "status-value:pending"
|
|
3541
|
+
}, getInteractions = ({
|
|
3542
|
+
log,
|
|
3543
|
+
calls,
|
|
3544
|
+
collapsed,
|
|
3545
|
+
setCollapsed
|
|
3546
|
+
}) => {
|
|
3547
|
+
let callsById = /* @__PURE__ */ new Map(), childCallMap = /* @__PURE__ */ new Map();
|
|
3548
|
+
return log.map(({ callId, ancestors, status }) => {
|
|
3549
|
+
let isHidden = !1;
|
|
3550
|
+
return ancestors.forEach((ancestor) => {
|
|
3551
|
+
collapsed.has(ancestor) && (isHidden = !0), childCallMap.set(ancestor, (childCallMap.get(ancestor) || []).concat(callId));
|
|
3552
|
+
}), { ...calls.get(callId), status, isHidden };
|
|
3553
|
+
}).map((call) => {
|
|
3554
|
+
let status = call.status === "error" /* ERROR */ && call.ancestors && callsById.get(call.ancestors.slice(-1)[0])?.status === "active" /* ACTIVE */ ? "active" /* ACTIVE */ : call.status;
|
|
3555
|
+
return callsById.set(call.id, { ...call, status }), {
|
|
3556
|
+
...call,
|
|
3557
|
+
status,
|
|
3558
|
+
childCallIds: childCallMap.get(call.id),
|
|
3559
|
+
isCollapsed: collapsed.has(call.id),
|
|
3560
|
+
toggleCollapsed: () => setCollapsed((ids) => (ids.has(call.id) ? ids.delete(call.id) : ids.add(call.id), new Set(ids)))
|
|
3561
|
+
};
|
|
3562
|
+
});
|
|
3563
|
+
}, getPanelState = (state, {
|
|
3564
|
+
log,
|
|
3565
|
+
calls,
|
|
3566
|
+
collapsed,
|
|
3567
|
+
setCollapsed
|
|
3568
|
+
}) => getInteractions({ log, calls, collapsed, setCollapsed }).reduce(
|
|
3569
|
+
(acc, interaction) => (interaction.id === INTERNAL_RENDER_CALL_ID ? acc.interactions.push(interaction) : state.status !== "rendering" && (acc.controlStates = state.controlStates, acc.interactions.push(interaction), interaction.method !== "step" && acc.interactionsCount++), acc),
|
|
3570
|
+
{
|
|
3571
|
+
...state,
|
|
3572
|
+
controlStates: INITIAL_CONTROL_STATES,
|
|
3573
|
+
interactions: [],
|
|
3574
|
+
interactionsCount: 0
|
|
3575
|
+
}
|
|
3576
|
+
), trackRenderPhase = (tracker, event, currentStoryId) => {
|
|
3577
|
+
if (event.storyId !== currentStoryId)
|
|
3578
|
+
return { tracker, isCurrentRender: !1 };
|
|
3579
|
+
if (tracker.storyId === event.storyId && ["preparing", "loading"].includes(event.newPhase))
|
|
3580
|
+
return { tracker, isCurrentRender: !1 };
|
|
3581
|
+
let renderId = tracker.storyId === event.storyId ? Math.max(tracker.renderId, event.renderId || 0) : event.renderId || 0;
|
|
3582
|
+
return {
|
|
3583
|
+
tracker: { storyId: event.storyId, renderId },
|
|
3584
|
+
isCurrentRender: renderId === event.renderId
|
|
3585
|
+
};
|
|
3586
|
+
}, getInternalRenderCall = (storyId, exception) => ({
|
|
3587
|
+
id: INTERNAL_RENDER_CALL_ID,
|
|
3588
|
+
method: "render",
|
|
3589
|
+
args: [],
|
|
3590
|
+
cursor: 0,
|
|
3591
|
+
storyId,
|
|
3592
|
+
ancestors: [],
|
|
3593
|
+
path: [],
|
|
3594
|
+
interceptable: !0,
|
|
3595
|
+
retain: !1,
|
|
3596
|
+
exception
|
|
3597
|
+
}), getInternalRenderLogItem = (status) => ({
|
|
3598
|
+
callId: INTERNAL_RENDER_CALL_ID,
|
|
3599
|
+
status,
|
|
3600
|
+
ancestors: []
|
|
3601
|
+
}), Panel = memo4(
|
|
3602
|
+
function({ refId, storyId, storyUrl }) {
|
|
3603
|
+
let { statusValue, testRunId } = experimental_useStatusStore((state2) => {
|
|
3604
|
+
let storyStatus = refId ? void 0 : state2[storyId]?.[STATUS_TYPE_ID_COMPONENT_TEST];
|
|
3605
|
+
return {
|
|
3606
|
+
statusValue: storyStatus?.value,
|
|
3607
|
+
testRunId: storyStatus?.data?.testRunId
|
|
3608
|
+
};
|
|
3609
|
+
}), state = useStorybookState2(), api = useStorybookApi6(), importPath = api.getData(state.storyId, state.refId)?.importPath, canOpenInEditor = global2.CONFIG_TYPE === "DEVELOPMENT" && !state.refId, [panelState, set] = useAddonState2(ADDON_ID6, {
|
|
3610
|
+
status: "rendering",
|
|
3611
|
+
controlStates: INITIAL_CONTROL_STATES,
|
|
3612
|
+
interactions: [],
|
|
3613
|
+
interactionsCount: 0,
|
|
3614
|
+
hasException: !1,
|
|
3615
|
+
pausedAt: void 0,
|
|
3616
|
+
caughtException: void 0,
|
|
3617
|
+
unhandledErrors: void 0
|
|
3618
|
+
}), [scrollTarget, setScrollTarget] = useState11(void 0), [collapsed, setCollapsed] = useState11(/* @__PURE__ */ new Set()), [hasResultMismatch, setResultMismatch] = useState11(!1), {
|
|
3619
|
+
status = "rendering",
|
|
3620
|
+
controlStates = INITIAL_CONTROL_STATES,
|
|
3621
|
+
interactions = [],
|
|
3622
|
+
pausedAt = void 0,
|
|
3623
|
+
caughtException = void 0,
|
|
3624
|
+
unhandledErrors = void 0
|
|
3625
|
+
} = panelState, log = useRef2([getInternalRenderLogItem("active" /* ACTIVE */)]), calls = useRef2(
|
|
3626
|
+
/* @__PURE__ */ new Map([[INTERNAL_RENDER_CALL_ID, getInternalRenderCall(storyId)]])
|
|
3627
|
+
), setCall = ({ status: status2, ...call }) => calls.current.set(call.id, call), endRef = useRef2();
|
|
3628
|
+
useEffect10(() => {
|
|
3629
|
+
let observer;
|
|
3630
|
+
return global2.IntersectionObserver && (observer = new global2.IntersectionObserver(
|
|
3631
|
+
([end]) => setScrollTarget(end.isIntersecting ? void 0 : end.target),
|
|
3632
|
+
{ root: global2.document.querySelector('#storybook-panel-root [role="tabpanel"]') }
|
|
3633
|
+
), endRef.current && observer.observe(endRef.current)), () => observer?.disconnect();
|
|
3634
|
+
}, []);
|
|
3635
|
+
let renderTracker = useRef2({ renderId: 0 }), emit = useChannel3(
|
|
3636
|
+
{
|
|
3637
|
+
[EVENTS.CALL]: setCall,
|
|
3638
|
+
[EVENTS.SYNC]: (payload) => {
|
|
3639
|
+
payload.storyId && payload.storyId !== api.getUrlState().storyId || (log.current = [getInternalRenderLogItem("done" /* DONE */), ...payload.logItems], set(
|
|
3640
|
+
(state2) => getPanelState(
|
|
3641
|
+
{ ...state2, controlStates: payload.controlStates, pausedAt: payload.pausedAt },
|
|
3642
|
+
{ log: log.current, calls: calls.current, collapsed, setCollapsed }
|
|
3643
|
+
)
|
|
3644
|
+
));
|
|
3645
|
+
},
|
|
3646
|
+
[STORY_RENDER_PHASE_CHANGED]: (event) => {
|
|
3647
|
+
let { tracker, isCurrentRender } = trackRenderPhase(
|
|
3648
|
+
renderTracker.current,
|
|
3649
|
+
event,
|
|
3650
|
+
api.getUrlState().storyId
|
|
3651
|
+
);
|
|
3652
|
+
renderTracker.current = tracker, isCurrentRender && (event.newPhase === "rendering" ? (log.current = [getInternalRenderLogItem("active" /* ACTIVE */)], calls.current.set(INTERNAL_RENDER_CALL_ID, getInternalRenderCall(storyId)), set({
|
|
3653
|
+
status: "rendering",
|
|
3654
|
+
controlStates: INITIAL_CONTROL_STATES,
|
|
3655
|
+
pausedAt: void 0,
|
|
3656
|
+
interactions: [],
|
|
3657
|
+
interactionsCount: 0,
|
|
3658
|
+
hasException: !1,
|
|
3659
|
+
caughtException: void 0,
|
|
3660
|
+
unhandledErrors: void 0
|
|
3661
|
+
})) : set((state2) => {
|
|
3662
|
+
let status2 = event.newPhase in playStatusMap && !terminalStatuses.includes(state2.status) ? playStatusMap[event.newPhase] : state2.status;
|
|
3663
|
+
return getPanelState(
|
|
3664
|
+
{ ...state2, status: status2, pausedAt: void 0 },
|
|
3665
|
+
{ log: log.current, calls: calls.current, collapsed, setCollapsed }
|
|
3666
|
+
);
|
|
3667
|
+
}));
|
|
3668
|
+
},
|
|
3669
|
+
[STORY_THREW_EXCEPTION]: (e) => {
|
|
3670
|
+
log.current = [getInternalRenderLogItem("error" /* ERROR */)], calls.current.set(
|
|
3671
|
+
INTERNAL_RENDER_CALL_ID,
|
|
3672
|
+
getInternalRenderCall(storyId, { ...e, callId: INTERNAL_RENDER_CALL_ID })
|
|
3673
|
+
), set(
|
|
3674
|
+
(state2) => getPanelState(
|
|
3675
|
+
{
|
|
3676
|
+
...state2,
|
|
3677
|
+
hasException: !0,
|
|
3678
|
+
caughtException: void 0,
|
|
3679
|
+
controlStates: INITIAL_CONTROL_STATES,
|
|
3680
|
+
pausedAt: void 0
|
|
3681
|
+
},
|
|
3682
|
+
{ log: log.current, calls: calls.current, collapsed, setCollapsed }
|
|
3683
|
+
)
|
|
3684
|
+
);
|
|
3685
|
+
},
|
|
3686
|
+
[PLAY_FUNCTION_THREW_EXCEPTION]: (caughtException2) => {
|
|
3687
|
+
set((state2) => ({ ...state2, caughtException: caughtException2, hasException: !0 }));
|
|
3688
|
+
},
|
|
3689
|
+
[UNHANDLED_ERRORS_WHILE_PLAYING]: (unhandledErrors2) => {
|
|
3690
|
+
set((state2) => ({ ...state2, unhandledErrors: unhandledErrors2, hasException: !0 }));
|
|
3691
|
+
}
|
|
3692
|
+
},
|
|
3693
|
+
[collapsed, storyId]
|
|
3694
|
+
);
|
|
3695
|
+
useEffect10(() => {
|
|
3696
|
+
set(
|
|
3697
|
+
(state2) => getPanelState(state2, { log: log.current, calls: calls.current, collapsed, setCollapsed })
|
|
3698
|
+
);
|
|
3699
|
+
}, [set, collapsed]);
|
|
3700
|
+
let controls = useMemo4(
|
|
3701
|
+
() => ({
|
|
3702
|
+
start: () => emit(EVENTS.START, { storyId }),
|
|
3703
|
+
back: () => emit(EVENTS.BACK, { storyId }),
|
|
3704
|
+
goto: (callId) => emit(EVENTS.GOTO, { storyId, callId }),
|
|
3705
|
+
next: () => emit(EVENTS.NEXT, { storyId }),
|
|
3706
|
+
end: () => emit(EVENTS.END, { storyId }),
|
|
3707
|
+
rerun: () => {
|
|
3708
|
+
emit(FORCE_REMOUNT, { storyId });
|
|
3709
|
+
}
|
|
3710
|
+
}),
|
|
3711
|
+
[emit, storyId]
|
|
3712
|
+
), storyFilePath = useParameter3("fileName", ""), [fileName] = storyFilePath.toString().split("/").slice(-1), scrollToTarget = () => scrollTarget?.scrollIntoView({ behavior: "smooth", block: "end" }), hasException = !!caughtException || !!unhandledErrors || interactions.some((v2) => v2.status === "error" /* ERROR */), browserTestStatus = useMemo4(() => status !== "playing" && (interactions.length > 0 || hasException) ? hasException ? "error" /* ERROR */ : "done" /* DONE */ : status === "playing" ? "active" /* ACTIVE */ : void 0, [status, interactions, hasException]);
|
|
3713
|
+
return useEffect10(() => {
|
|
3714
|
+
if (browserTestStatus && statusValue && statusValue !== "status-value:pending" && statusValue !== storyStatusMap[browserTestStatus]) {
|
|
3715
|
+
let timeout = setTimeout(
|
|
3716
|
+
() => setResultMismatch((currentValue) => (currentValue || emit(FORKBOOK_ADDON_TEST_CHANNEL, {
|
|
3717
|
+
type: "test-discrepancy",
|
|
3718
|
+
payload: {
|
|
3719
|
+
browserStatus: browserTestStatus === "done" /* DONE */ ? "PASS" : "FAIL",
|
|
3720
|
+
cliStatus: browserTestStatus === "done" /* DONE */ ? "FAIL" : "PASS",
|
|
3721
|
+
storyId,
|
|
3722
|
+
testRunId
|
|
3723
|
+
}
|
|
3724
|
+
}), !0)),
|
|
3725
|
+
2e3
|
|
3726
|
+
);
|
|
3727
|
+
return () => clearTimeout(timeout);
|
|
3728
|
+
} else
|
|
3729
|
+
setResultMismatch(!1);
|
|
3730
|
+
}, [emit, browserTestStatus, statusValue, storyId, testRunId]), jsx19(Fragment8, { children: jsx19(
|
|
3731
|
+
InteractionsPanel,
|
|
3732
|
+
{
|
|
3733
|
+
storyUrl,
|
|
3734
|
+
status,
|
|
3735
|
+
hasResultMismatch,
|
|
3736
|
+
browserTestStatus,
|
|
3737
|
+
calls: calls.current,
|
|
3738
|
+
controls,
|
|
3739
|
+
controlStates: { ...controlStates, detached: !!refId || controlStates.detached },
|
|
3740
|
+
interactions,
|
|
3741
|
+
fileName,
|
|
3742
|
+
hasException,
|
|
3743
|
+
caughtException,
|
|
3744
|
+
unhandledErrors,
|
|
3745
|
+
pausedAt,
|
|
3746
|
+
endRef,
|
|
3747
|
+
onScrollToEnd: scrollTarget && scrollToTarget,
|
|
3748
|
+
importPath,
|
|
3749
|
+
canOpenInEditor,
|
|
3750
|
+
api
|
|
3751
|
+
}
|
|
3752
|
+
) }, "component-tests");
|
|
3753
|
+
}
|
|
3754
|
+
);
|
|
3755
|
+
|
|
3756
|
+
// src/component-testing/components/PanelTitle.tsx
|
|
3757
|
+
import { Badge as Badge3 } from "@aussieljk/forkbook/internal/components";
|
|
3758
|
+
import { useAddonState as useAddonState3, useStorybookApi as useStorybookApi7 } from "@aussieljk/forkbook/manager-api";
|
|
3759
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3760
|
+
function PanelTitle() {
|
|
3761
|
+
let selectedPanel = useStorybookApi7().getSelectedPanel(), [addonState = {}] = useAddonState3(ADDON_ID6), { status, hasException, interactionsCount } = addonState;
|
|
3762
|
+
return jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3763
|
+
jsx20("span", { children: "Interactions" }),
|
|
3764
|
+
interactionsCount && status !== "errored" && !hasException ? jsx20(Badge3, { compact: !0, status: selectedPanel === PANEL_ID2 ? "active" : "neutral", children: interactionsCount }) : null,
|
|
3765
|
+
status === "errored" || hasException ? jsx20(StatusIcon, { status: "error" /* ERROR */ }) : null
|
|
3766
|
+
] });
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
// src/component-testing/manager.tsx
|
|
3770
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3771
|
+
var manager_default5 = addons5.register(ADDON_ID6, () => {
|
|
3772
|
+
if (globalThis?.FEATURES?.interactions) {
|
|
3773
|
+
let filter = ({ state }) => {
|
|
3774
|
+
let origin = state.refId && state.refs[state.refId]?.url || document.location.origin, { pathname, search = "" } = state.location, path = pathname + (state.refId ? search.replace(`/${state.refId}_`, "/") : search);
|
|
3775
|
+
return {
|
|
3776
|
+
refId: state.refId,
|
|
3777
|
+
storyId: state.storyId,
|
|
3778
|
+
storyUrl: origin + path
|
|
3779
|
+
};
|
|
3780
|
+
};
|
|
3781
|
+
addons5.add(PANEL_ID2, {
|
|
3782
|
+
type: types3.PANEL,
|
|
3783
|
+
title: () => jsx21(PanelTitle, {}),
|
|
3784
|
+
match: ({ viewMode }) => viewMode === "story",
|
|
3785
|
+
disabled: isInteractionsDisabled,
|
|
3786
|
+
render: ({ active }) => jsx21(AddonPanel2, { active: !!active, children: jsx21(Consumer, { filter, children: (props) => jsx21(Panel, { ...props }) }) })
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
});
|
|
3790
|
+
|
|
3791
|
+
// src/backgrounds/manager.tsx
|
|
3792
|
+
import { addons as addons6, types as types4 } from "@aussieljk/forkbook/manager-api";
|
|
3793
|
+
|
|
3794
|
+
// src/backgrounds/components/Tool.tsx
|
|
3795
|
+
import { Fragment as Fragment9, memo as memo5, useCallback as useCallback5 } from "react";
|
|
3796
|
+
import { Select, ToggleButton } from "@aussieljk/forkbook/internal/components";
|
|
3797
|
+
import { CircleIcon as CircleIcon2, GridIcon, PhotoIcon } from "@storybook/icons";
|
|
3798
|
+
import { useGlobals as useGlobals2, useParameter as useParameter4 } from "@aussieljk/forkbook/manager-api";
|
|
3799
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3800
|
+
var BackgroundTool = memo5(function() {
|
|
3801
|
+
let config = useParameter4(PARAM_KEY3), [globals, updateGlobals, storyGlobals] = useGlobals2(), { options = DEFAULT_BACKGROUNDS, disable = !0 } = config || {};
|
|
3802
|
+
if (disable)
|
|
3803
|
+
return null;
|
|
3804
|
+
let data = globals[PARAM_KEY3] || {}, backgroundName = data.value, isGridActive = data.grid || !1, item = options[backgroundName], isLocked = !!storyGlobals?.[PARAM_KEY3], length = Object.keys(options).length;
|
|
3805
|
+
return jsx22(
|
|
3806
|
+
Pure,
|
|
3807
|
+
{
|
|
3808
|
+
length,
|
|
3809
|
+
backgroundMap: options,
|
|
3810
|
+
item,
|
|
3811
|
+
updateGlobals,
|
|
3812
|
+
backgroundName,
|
|
3813
|
+
isLocked,
|
|
3814
|
+
isGridActive
|
|
3815
|
+
}
|
|
3816
|
+
);
|
|
3817
|
+
}), Pure = memo5(function(props) {
|
|
3818
|
+
let {
|
|
3819
|
+
length,
|
|
3820
|
+
updateGlobals,
|
|
3821
|
+
backgroundMap,
|
|
3822
|
+
backgroundName,
|
|
3823
|
+
isLocked,
|
|
3824
|
+
isGridActive: isGrid
|
|
3825
|
+
} = props, update = useCallback5(
|
|
3826
|
+
(input) => {
|
|
3827
|
+
updateGlobals({
|
|
3828
|
+
[PARAM_KEY3]: input
|
|
3829
|
+
});
|
|
3830
|
+
},
|
|
3831
|
+
[updateGlobals]
|
|
3832
|
+
), options = Object.entries(backgroundMap).map(([k, value]) => ({
|
|
3833
|
+
value: k,
|
|
3834
|
+
title: value.name,
|
|
3835
|
+
icon: jsx22(CircleIcon2, { color: value?.value || "grey" })
|
|
3836
|
+
}));
|
|
3837
|
+
return jsxs15(Fragment9, { children: [
|
|
3838
|
+
jsx22(
|
|
3839
|
+
ToggleButton,
|
|
3840
|
+
{
|
|
3841
|
+
padding: "small",
|
|
3842
|
+
variant: "ghost",
|
|
3843
|
+
pressed: isGrid,
|
|
3844
|
+
disabled: isLocked,
|
|
3845
|
+
ariaLabel: isLocked ? "Grid set by story parameters" : "Grid visibility",
|
|
3846
|
+
tooltip: isLocked ? "Grid set by story parameters" : "Toggle grid visibility",
|
|
3847
|
+
onClick: () => update({ value: backgroundName, grid: !isGrid }),
|
|
3848
|
+
children: jsx22(GridIcon, {})
|
|
3849
|
+
},
|
|
3850
|
+
"grid"
|
|
3851
|
+
),
|
|
3852
|
+
length > 0 ? jsx22(
|
|
3853
|
+
Select,
|
|
3854
|
+
{
|
|
3855
|
+
resetLabel: "Reset background",
|
|
3856
|
+
onReset: () => update(void 0),
|
|
3857
|
+
disabled: isLocked,
|
|
3858
|
+
icon: jsx22(PhotoIcon, {}),
|
|
3859
|
+
ariaLabel: isLocked ? "Background set by story parameters" : "Preview background",
|
|
3860
|
+
tooltip: isLocked ? "Background set by story parameters" : "Change background",
|
|
3861
|
+
defaultOptions: backgroundName,
|
|
3862
|
+
options,
|
|
3863
|
+
onSelect: (selected) => update({ value: selected, grid: isGrid })
|
|
3864
|
+
},
|
|
3865
|
+
"background"
|
|
3866
|
+
) : null
|
|
3867
|
+
] });
|
|
3868
|
+
});
|
|
3869
|
+
|
|
3870
|
+
// src/backgrounds/manager.tsx
|
|
3871
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3872
|
+
var manager_default6 = addons6.register(ADDON_ID3, () => {
|
|
3873
|
+
globalThis?.FEATURES?.backgrounds && addons6.add(ADDON_ID3, {
|
|
3874
|
+
title: "Backgrounds",
|
|
3875
|
+
type: types4.TOOL,
|
|
3876
|
+
match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
|
|
3877
|
+
render: () => jsx23(BackgroundTool, {})
|
|
3878
|
+
});
|
|
3879
|
+
});
|
|
3880
|
+
|
|
3881
|
+
// src/measure/manager.tsx
|
|
3882
|
+
import { addons as addons7, types as types5 } from "@aussieljk/forkbook/manager-api";
|
|
3883
|
+
|
|
3884
|
+
// src/measure/Tool.tsx
|
|
3885
|
+
import { useCallback as useCallback6, useEffect as useEffect11 } from "react";
|
|
3886
|
+
import { ToggleButton as ToggleButton2 } from "@aussieljk/forkbook/internal/components";
|
|
3887
|
+
import { RulerIcon } from "@storybook/icons";
|
|
3888
|
+
import { useGlobals as useGlobals3, useParameter as useParameter5, useStorybookApi as useStorybookApi8 } from "@aussieljk/forkbook/manager-api";
|
|
3889
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3890
|
+
var Tool = () => {
|
|
3891
|
+
let isDisabled = useParameter5("measure")?.disable, [globals, updateGlobals] = useGlobals3(), { measureEnabled } = globals || {}, api = useStorybookApi8(), toggleMeasure = useCallback6(
|
|
3892
|
+
() => updateGlobals({
|
|
3893
|
+
measureEnabled: !measureEnabled
|
|
3894
|
+
}),
|
|
3895
|
+
[updateGlobals, measureEnabled]
|
|
3896
|
+
);
|
|
3897
|
+
return useEffect11(() => {
|
|
3898
|
+
isDisabled || api.setAddonShortcut(ADDON_ID4, {
|
|
3899
|
+
label: "Toggle Measure",
|
|
3900
|
+
defaultShortcut: ["M"],
|
|
3901
|
+
actionName: "measure",
|
|
3902
|
+
showInMenu: !1,
|
|
3903
|
+
action: toggleMeasure
|
|
3904
|
+
});
|
|
3905
|
+
}, [toggleMeasure, api, isDisabled]), isDisabled ? null : jsx24(
|
|
3906
|
+
ToggleButton2,
|
|
3907
|
+
{
|
|
3908
|
+
pressed: measureEnabled,
|
|
3909
|
+
padding: "small",
|
|
3910
|
+
variant: "ghost",
|
|
3911
|
+
ariaLabel: "Measure tool",
|
|
3912
|
+
tooltip: "Toggle measure",
|
|
3913
|
+
ariaDescription: "When enabled, this tool shows dimensions and whitespace (margin, padding, border) for the currently hovered element in the preview area. Does not work with keyboard focus.",
|
|
3914
|
+
onClick: toggleMeasure,
|
|
3915
|
+
children: jsx24(RulerIcon, {})
|
|
3916
|
+
},
|
|
3917
|
+
TOOL_ID2
|
|
3918
|
+
);
|
|
3919
|
+
};
|
|
3920
|
+
|
|
3921
|
+
// src/measure/manager.tsx
|
|
3922
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
3923
|
+
var manager_default7 = addons7.register(ADDON_ID4, () => {
|
|
3924
|
+
globalThis?.FEATURES?.measure && addons7.add(TOOL_ID2, {
|
|
3925
|
+
type: types5.TOOL,
|
|
3926
|
+
title: "Measure",
|
|
3927
|
+
match: ({ viewMode }) => viewMode === "story",
|
|
3928
|
+
render: () => jsx25(Tool, {})
|
|
3929
|
+
});
|
|
3930
|
+
});
|
|
3931
|
+
|
|
3932
|
+
// src/outline/manager.tsx
|
|
3933
|
+
import { addons as addons8, types as types6 } from "@aussieljk/forkbook/manager-api";
|
|
3934
|
+
|
|
3935
|
+
// src/outline/OutlineSelector.tsx
|
|
3936
|
+
import { memo as memo6, useCallback as useCallback7, useEffect as useEffect12 } from "react";
|
|
3937
|
+
import { ToggleButton as ToggleButton3 } from "@aussieljk/forkbook/internal/components";
|
|
3938
|
+
import { OutlineIcon } from "@storybook/icons";
|
|
3939
|
+
import { useGlobals as useGlobals4, useParameter as useParameter6, useStorybookApi as useStorybookApi9 } from "@aussieljk/forkbook/manager-api";
|
|
3940
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3941
|
+
var OutlineSelector = memo6(function() {
|
|
3942
|
+
let isDisabled = useParameter6(PARAM_KEY4)?.disable, [globals, updateGlobals] = useGlobals4(), api = useStorybookApi9(), isActive = [!0, "true"].includes(globals[PARAM_KEY4]), toggleOutline = useCallback7(
|
|
3943
|
+
() => updateGlobals({
|
|
3944
|
+
[PARAM_KEY4]: !isActive
|
|
3945
|
+
}),
|
|
3946
|
+
[isActive, updateGlobals]
|
|
3947
|
+
);
|
|
3948
|
+
return useEffect12(() => {
|
|
3949
|
+
isDisabled || api.setAddonShortcut(ADDON_ID5, {
|
|
3950
|
+
label: "Toggle Outline",
|
|
3951
|
+
defaultShortcut: ["alt", "O"],
|
|
3952
|
+
actionName: "outline",
|
|
3953
|
+
showInMenu: !1,
|
|
3954
|
+
action: toggleOutline
|
|
3955
|
+
});
|
|
3956
|
+
}, [toggleOutline, api, isDisabled]), isDisabled ? null : jsx26(
|
|
3957
|
+
ToggleButton3,
|
|
3958
|
+
{
|
|
3959
|
+
padding: "small",
|
|
3960
|
+
variant: "ghost",
|
|
3961
|
+
pressed: isActive,
|
|
3962
|
+
ariaLabel: "Outline tool",
|
|
3963
|
+
ariaDescription: "When enabled, this tool displays the outline of every element in the preview area, which helps understand their layout.",
|
|
3964
|
+
tooltip: "Toggle outline",
|
|
3965
|
+
onClick: toggleOutline,
|
|
3966
|
+
children: jsx26(OutlineIcon, {})
|
|
3967
|
+
},
|
|
3968
|
+
"outline"
|
|
3969
|
+
);
|
|
3970
|
+
});
|
|
3971
|
+
|
|
3972
|
+
// src/outline/manager.tsx
|
|
3973
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3974
|
+
var manager_default8 = addons8.register(ADDON_ID5, () => {
|
|
3975
|
+
globalThis?.FEATURES?.outline && addons8.add(ADDON_ID5, {
|
|
3976
|
+
title: "Outline",
|
|
3977
|
+
type: types6.TOOL,
|
|
3978
|
+
match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
|
|
3979
|
+
render: () => jsx27(OutlineSelector, {})
|
|
3980
|
+
});
|
|
3981
|
+
});
|
|
3982
|
+
|
|
3983
|
+
// src/viewport/manager.tsx
|
|
3984
|
+
import { addons as addons9, types as types7 } from "@aussieljk/forkbook/manager-api";
|
|
3985
|
+
|
|
3986
|
+
// src/viewport/components/Tool.tsx
|
|
3987
|
+
import { useMemo as useMemo6 } from "react";
|
|
3988
|
+
import { Select as Select2 } from "@aussieljk/forkbook/internal/components";
|
|
3989
|
+
import { GrowIcon } from "@storybook/icons";
|
|
3990
|
+
|
|
3991
|
+
// src/viewport/useViewport.ts
|
|
3992
|
+
import { useCallback as useCallback8, useEffect as useEffect13, useMemo as useMemo5, useRef as useRef3 } from "react";
|
|
3993
|
+
import { useGlobals as useGlobals5, useParameter as useParameter7, useStorybookApi as useStorybookApi10 } from "@aussieljk/forkbook/manager-api";
|
|
3994
|
+
var cycle = (viewports, current, direction = 1) => {
|
|
3995
|
+
let keys = Object.keys(viewports), nextIndex = (current ? keys.indexOf(current) : -1) + direction;
|
|
3996
|
+
return nextIndex < 0 ? keys[keys.length - 1] : nextIndex >= keys.length ? keys[0] : keys[nextIndex];
|
|
3997
|
+
}, normalizeGlobal = (value, defaultIsRotated) => typeof value == "string" ? { value, isRotated: defaultIsRotated } : { value: value?.value, isRotated: value?.isRotated ?? defaultIsRotated }, useViewport = () => {
|
|
3998
|
+
let api = useStorybookApi10(), { viewMode } = api.getUrlState(), lastSelectedOption = useRef3(), parameter = useParameter7(PARAM_KEY), [globals, updateGlobals, storyGlobals, userGlobals] = useGlobals5(), { options = MINIMAL_VIEWPORTS, disable = !1 } = parameter || {}, { name, type, width, height, value, option, isCustom, isDefault, isLocked, isRotated } = resolveViewport({
|
|
3999
|
+
globals,
|
|
4000
|
+
storyGlobals,
|
|
4001
|
+
userGlobals,
|
|
4002
|
+
options,
|
|
4003
|
+
lastSelectedOption: lastSelectedOption.current,
|
|
4004
|
+
disable,
|
|
4005
|
+
viewMode
|
|
4006
|
+
}), update = useCallback8(
|
|
4007
|
+
(input) => updateGlobals({ [PARAM_KEY]: normalizeGlobal(input, !1) }),
|
|
4008
|
+
[updateGlobals]
|
|
4009
|
+
), resize = useCallback8(
|
|
4010
|
+
(width2, height2) => {
|
|
4011
|
+
let w = width2.replace(/px$/, "").replace(/%$/, "pct"), h = height2.replace(/px$/, "").replace(/%$/, "pct"), value2 = isRotated ? `${h}-${w}` : `${w}-${h}`;
|
|
4012
|
+
update({ value: value2, isRotated });
|
|
4013
|
+
},
|
|
4014
|
+
[update, isRotated]
|
|
4015
|
+
);
|
|
4016
|
+
return useEffect13(() => {
|
|
4017
|
+
parameter && option && (Object.hasOwn(options, option) ? lastSelectedOption.current = option : (lastSelectedOption.current = void 0, PARAM_KEY in storyGlobals || update({ value: void 0, isRotated: !1 })));
|
|
4018
|
+
}, [parameter, storyGlobals, options, option, update]), useEffect13(() => {
|
|
4019
|
+
api.setAddonShortcut(ADDON_ID, {
|
|
4020
|
+
label: "Next viewport",
|
|
4021
|
+
defaultShortcut: ["alt", "V"],
|
|
4022
|
+
actionName: "next",
|
|
4023
|
+
action: () => update({ value: cycle(options, lastSelectedOption.current), isRotated })
|
|
4024
|
+
}), api.setAddonShortcut(ADDON_ID, {
|
|
4025
|
+
label: "Previous viewport",
|
|
4026
|
+
defaultShortcut: ["alt", "shift", "V"],
|
|
4027
|
+
actionName: "previous",
|
|
4028
|
+
action: () => update({ value: cycle(options, lastSelectedOption.current, -1), isRotated })
|
|
4029
|
+
}), api.setAddonShortcut(ADDON_ID, {
|
|
4030
|
+
label: "Reset viewport",
|
|
4031
|
+
defaultShortcut: ["alt", "control", "V"],
|
|
4032
|
+
actionName: "reset",
|
|
4033
|
+
action: () => update({ value: void 0, isRotated: !1 })
|
|
4034
|
+
});
|
|
4035
|
+
}, [api, update, options, isRotated]), useMemo5(
|
|
4036
|
+
() => ({
|
|
4037
|
+
name,
|
|
4038
|
+
type,
|
|
4039
|
+
width,
|
|
4040
|
+
height,
|
|
4041
|
+
value,
|
|
4042
|
+
option,
|
|
4043
|
+
isCustom,
|
|
4044
|
+
isDefault,
|
|
4045
|
+
isLocked,
|
|
4046
|
+
isRotated,
|
|
4047
|
+
options,
|
|
4048
|
+
lastSelectedOption: lastSelectedOption.current,
|
|
4049
|
+
resize,
|
|
4050
|
+
reset: () => update({ value: void 0, isRotated: !1 }),
|
|
4051
|
+
rotate: () => update({ value, isRotated: !isRotated }),
|
|
4052
|
+
select: (value2) => update({ value: value2, isRotated })
|
|
4053
|
+
}),
|
|
4054
|
+
[
|
|
4055
|
+
name,
|
|
4056
|
+
type,
|
|
4057
|
+
width,
|
|
4058
|
+
height,
|
|
4059
|
+
value,
|
|
4060
|
+
option,
|
|
4061
|
+
isCustom,
|
|
4062
|
+
isDefault,
|
|
4063
|
+
isRotated,
|
|
4064
|
+
isLocked,
|
|
4065
|
+
options,
|
|
4066
|
+
resize,
|
|
4067
|
+
update
|
|
4068
|
+
]
|
|
4069
|
+
);
|
|
4070
|
+
};
|
|
4071
|
+
|
|
4072
|
+
// src/viewport/viewportIcons.tsx
|
|
4073
|
+
import { BrowserIcon, DiamondIcon, MobileIcon, TabletIcon, WatchIcon } from "@storybook/icons";
|
|
4074
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4075
|
+
var iconsMap = {
|
|
4076
|
+
desktop: jsx28(BrowserIcon, {}),
|
|
4077
|
+
mobile: jsx28(MobileIcon, {}),
|
|
4078
|
+
tablet: jsx28(TabletIcon, {}),
|
|
4079
|
+
watch: jsx28(WatchIcon, {}),
|
|
4080
|
+
other: jsx28(DiamondIcon, {})
|
|
4081
|
+
};
|
|
4082
|
+
|
|
4083
|
+
// storybook-css:/Users/ljk/p/repos/storybook/code/core/src/viewport/components/Tool.module.css
|
|
4084
|
+
var id12 = "core/src/viewport/components/Tool.module.css";
|
|
4085
|
+
if (typeof document < "u" && !document.querySelector(`style[data-sb-css="${id12}"]`)) {
|
|
4086
|
+
let style = document.createElement("style");
|
|
4087
|
+
style.setAttribute("data-sb-css", id12), style.textContent = ".sb-vBOFLW-dimensions{font-family:var(--sb-font-mono);font-size:calc(var(--sb-size-s1) - 1px);font-weight:var(--sb-weight-regular);color:var(--sb-text-muted-color);gap:2px;margin-left:20px;display:flex}", document.head.appendChild(style);
|
|
4088
|
+
}
|
|
4089
|
+
var Tool_default = { dimensions: "sb-vBOFLW-dimensions" };
|
|
4090
|
+
|
|
4091
|
+
// src/viewport/components/Tool.tsx
|
|
4092
|
+
import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4093
|
+
var ViewportTool = () => {
|
|
4094
|
+
let {
|
|
4095
|
+
name,
|
|
4096
|
+
value,
|
|
4097
|
+
isDefault,
|
|
4098
|
+
isCustom,
|
|
4099
|
+
isLocked,
|
|
4100
|
+
options: viewportMap,
|
|
4101
|
+
reset,
|
|
4102
|
+
select
|
|
4103
|
+
} = useViewport(), options = useMemo6(() => {
|
|
4104
|
+
let presetOptions = Object.entries(viewportMap).map(([k, value2]) => ({
|
|
4105
|
+
value: k,
|
|
4106
|
+
title: value2.name,
|
|
4107
|
+
icon: iconsMap[value2.type],
|
|
4108
|
+
right: jsxs16("div", { className: Tool_default.dimensions, children: [
|
|
4109
|
+
jsx29("span", { children: value2.styles.width.replace("px", "") }),
|
|
4110
|
+
jsx29("span", { children: "\xD7" }),
|
|
4111
|
+
jsx29("span", { children: value2.styles.height.replace("px", "") })
|
|
4112
|
+
] })
|
|
4113
|
+
}));
|
|
4114
|
+
return isCustom && value ? [
|
|
4115
|
+
...presetOptions,
|
|
4116
|
+
{
|
|
4117
|
+
value,
|
|
4118
|
+
title: name,
|
|
4119
|
+
icon: iconsMap.other,
|
|
4120
|
+
right: null
|
|
4121
|
+
}
|
|
4122
|
+
] : presetOptions;
|
|
4123
|
+
}, [viewportMap, isCustom, value, name]);
|
|
4124
|
+
return jsx29(
|
|
4125
|
+
Select2,
|
|
4126
|
+
{
|
|
4127
|
+
resetLabel: "Reset viewport",
|
|
4128
|
+
onReset: reset,
|
|
4129
|
+
disabled: isLocked,
|
|
4130
|
+
ariaLabel: isLocked ? "Viewport size set by story parameters" : "Viewport size",
|
|
4131
|
+
ariaDescription: "Select a viewport among predefined options for the preview area, or reset to the default viewport.",
|
|
4132
|
+
tooltip: isLocked ? "Viewport set by story parameters" : "Change viewport",
|
|
4133
|
+
defaultOptions: value,
|
|
4134
|
+
options,
|
|
4135
|
+
onSelect: (selected) => select(selected),
|
|
4136
|
+
icon: jsx29(GrowIcon, {}),
|
|
4137
|
+
children: isDefault ? null : name
|
|
4138
|
+
},
|
|
4139
|
+
"viewport"
|
|
4140
|
+
);
|
|
4141
|
+
};
|
|
4142
|
+
|
|
4143
|
+
// src/viewport/manager.tsx
|
|
4144
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4145
|
+
var manager_default9 = addons9.register(ADDON_ID, () => {
|
|
4146
|
+
globalThis?.FEATURES?.viewport && addons9.add(TOOL_ID, {
|
|
4147
|
+
title: "viewport / media-queries",
|
|
4148
|
+
type: types7.TOOL,
|
|
4149
|
+
match: ({ viewMode }) => viewMode === "story",
|
|
4150
|
+
render: () => jsx30(ViewportTool, {})
|
|
4151
|
+
});
|
|
4152
|
+
});
|
|
4153
|
+
|
|
4154
|
+
// src/core-server/presets/common-manager.ts
|
|
4155
|
+
var common_manager_default = [
|
|
4156
|
+
manager_default,
|
|
4157
|
+
manager_default2,
|
|
4158
|
+
manager_default7,
|
|
4159
|
+
manager_default4,
|
|
4160
|
+
manager_default6,
|
|
4161
|
+
manager_default5,
|
|
4162
|
+
manager_default3,
|
|
4163
|
+
manager_default9,
|
|
4164
|
+
manager_default8
|
|
4165
|
+
];
|
|
4166
|
+
export {
|
|
4167
|
+
common_manager_default as default
|
|
4168
|
+
};
|