@aussieljk/forkbook 0.0.1-11 → 0.0.1-13
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/README.md +1 -1
- package/assets/create/rendererAssets/common/button.css +6 -6
- package/assets/create/rendererAssets/common/header.css +5 -5
- package/assets/create/rendererAssets/common/page.css +10 -10
- package/dist/_browser-chunks/{Color-QLZNXLSV.js → Color-2EUQ6NXV.js} +2 -2
- package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
- package/dist/_browser-chunks/{WithTooltip-GNLRTZDF.js → WithTooltip-QCFTNB6P.js} +5 -4
- package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
- package/dist/_browser-chunks/{chunk-6ELMKWKX.js → chunk-2WZWS7GJ.js} +1 -1
- package/dist/_browser-chunks/{chunk-FRAOQJDI.js → chunk-3QPZOXB7.js} +1 -5
- package/dist/_browser-chunks/{chunk-GRO2ZYEJ.js → chunk-4BOJAE7P.js} +12 -8
- package/dist/_browser-chunks/{chunk-ZHKZKFY4.js → chunk-6SL45YM3.js} +9 -13
- package/dist/_browser-chunks/{chunk-DS2WQZGO.js → chunk-BLCZ3C5M.js} +41 -62
- package/dist/_browser-chunks/{chunk-7DQREF4S.js → chunk-DHTLVXAL.js} +37 -44
- package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-DISGPOF4.js} +54 -51
- package/dist/_browser-chunks/{chunk-76222HQR.js → chunk-E6QKKKLO.js} +20 -5
- package/dist/_browser-chunks/{chunk-DYNTDJ3O.js → chunk-EBSOKHFG.js} +8 -2
- package/dist/_browser-chunks/{chunk-3M5T7BW4.js → chunk-ECMVTOVD.js} +1 -1
- package/dist/_browser-chunks/{chunk-EQKMUQF3.js → chunk-ENHFQXYS.js} +5 -4
- package/dist/_browser-chunks/{chunk-KYSD26D6.js → chunk-EW2M3URL.js} +90 -83
- package/dist/_browser-chunks/{chunk-I4ATZPNZ.js → chunk-FCULT3AE.js} +3 -3
- package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
- package/dist/_browser-chunks/{chunk-NGMQJMCY.js → chunk-HZFHNYRC.js} +1 -1
- package/dist/_browser-chunks/{chunk-5H4KFI44.js → chunk-KQJ4T6JL.js} +30 -24
- package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-NK5SGJNG.js} +22 -17
- package/dist/_browser-chunks/{chunk-N3NRW5XX.js → chunk-PQRPDA4U.js} +3 -3
- package/dist/_browser-chunks/{chunk-2JDQ35OA.js → chunk-PU7D2WDP.js} +0 -11
- package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-QFO2B4X2.js} +31 -28
- package/dist/_browser-chunks/{chunk-TTBPZQ24.js → chunk-S7N7Z5TY.js} +47 -43
- package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
- package/dist/_browser-chunks/{chunk-WBLVFDJT.js → chunk-UH3XTEOQ.js} +716 -658
- package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
- package/dist/_browser-chunks/{chunk-O24AZJZ7.js → chunk-YJO5BK52.js} +7 -3
- package/dist/_browser-chunks/{chunk-3HM3VWJS.js → chunk-ZF37BMDS.js} +6 -2
- package/dist/_browser-chunks/{chunk-QU4RB2WU.js → chunk-ZF5SPY56.js} +4 -4
- package/dist/_browser-chunks/{matchers-YLBYSYAF.js → matchers-2HVLNCVO.js} +4 -4
- package/dist/_browser-chunks/{react-dom-client-4OHE3QDV.js → react-dom-client-SLBUX3U3.js} +1 -1
- package/dist/_node-chunks/{attached-runtime-J2AKT5WI.js → attached-runtime-7IRDQUTZ.js} +28 -29
- package/dist/_node-chunks/{builder-manager-Z4RWF4ZH.js → builder-manager-YTALSWKQ.js} +39 -28
- package/dist/_node-chunks/{chunk-2WVLC5M2.js → chunk-26ERGIQH.js} +6 -6
- package/dist/_node-chunks/{chunk-VZG3OKFO.js → chunk-33T4HNF2.js} +6 -6
- package/dist/_node-chunks/{chunk-ZEYODVQT.js → chunk-3F3673RQ.js} +7 -7
- package/dist/_node-chunks/{chunk-Y4W4B3E7.js → chunk-3FLRYZLJ.js} +6 -6
- package/dist/_node-chunks/{chunk-AVL7GUOZ.js → chunk-3L2QRDKH.js} +522 -1045
- package/dist/_node-chunks/{chunk-XO54HM4P.js → chunk-3NH7IHUS.js} +6 -6
- package/dist/_node-chunks/{chunk-GMKLTDKN.js → chunk-3ZAENV5A.js} +6 -6
- package/dist/_node-chunks/{chunk-3IIQSDCO.js → chunk-4B52HLKK.js} +53 -55
- package/dist/_node-chunks/chunk-4CZJ4SFH.js +281 -0
- package/dist/_node-chunks/{chunk-BBU2FUPC.js → chunk-4IIWFG7O.js} +13 -11
- package/dist/_node-chunks/{chunk-2U5J7YTA.js → chunk-4YWZLOAF.js} +6 -6
- package/dist/_node-chunks/{chunk-XVOIYGTJ.js → chunk-5A5XOSRM.js} +6 -6
- package/dist/_node-chunks/chunk-5T6Q7HT3.js +11 -0
- package/dist/_node-chunks/{chunk-MI7WBXWX.js → chunk-6DRDJF2Q.js} +6 -6
- package/dist/_node-chunks/{chunk-WBCKO5LP.js → chunk-6JSZY5TJ.js} +6 -6
- package/dist/_node-chunks/{chunk-3EBGFRAH.js → chunk-7SPDKMDQ.js} +32 -40
- package/dist/_node-chunks/{chunk-IRPQQARO.js → chunk-7YLKDHLZ.js} +7 -7
- package/dist/_node-chunks/{chunk-BSQB5B57.js → chunk-7YQIVUEK.js} +6 -6
- package/dist/_node-chunks/{chunk-PYVGF5F2.js → chunk-ADCQYK3Z.js} +6 -6
- package/dist/_node-chunks/{chunk-7YQTID2W.js → chunk-ALHQVE5R.js} +6 -6
- package/dist/_node-chunks/{chunk-MW4OAPPD.js → chunk-B4XAZ2OC.js} +8 -8
- package/dist/_node-chunks/{chunk-GGCOG7OV.js → chunk-BFQJF3ID.js} +283 -306
- package/dist/_node-chunks/{chunk-5GOXN5M4.js → chunk-BSXI35KM.js} +7 -7
- package/dist/_node-chunks/{chunk-TAMTPVYZ.js → chunk-BZQF5KUE.js} +7 -7
- package/dist/_node-chunks/{chunk-5JLVSH44.js → chunk-CEIESR4U.js} +8 -8
- package/dist/_node-chunks/{chunk-OJWUUSA4.js → chunk-CESXIP3N.js} +6 -6
- package/dist/_node-chunks/{chunk-CEYSYQLV.js → chunk-DAEUTT3I.js} +6 -6
- package/dist/_node-chunks/{chunk-FB2BOL6I.js → chunk-DIC4T2UO.js} +6 -6
- package/dist/_node-chunks/{chunk-LKITAODU.js → chunk-DPOWAA4P.js} +37 -31
- package/dist/_node-chunks/{chunk-W3KFVTWV.js → chunk-DTNEHO4J.js} +10 -10
- package/dist/_node-chunks/{chunk-C5OFHB3N.js → chunk-DY7F7B6V.js} +7 -7
- package/dist/_node-chunks/{chunk-FUG5LYKS.js → chunk-E56UKDJR.js} +8 -8
- package/dist/_node-chunks/{chunk-A7GEBS3Q.js → chunk-EFX2VA4Q.js} +6 -6
- package/dist/_node-chunks/{chunk-PQTEFQIJ.js → chunk-EM6AYELK.js} +10 -12
- package/dist/_node-chunks/{chunk-32FLWHUC.js → chunk-F2AFT3P7.js} +497 -475
- package/dist/_node-chunks/{chunk-OXT6T4AS.js → chunk-GC7NA2Y7.js} +7 -7
- package/dist/_node-chunks/{chunk-55S3GGGC.js → chunk-GIKCT5KG.js} +7 -7
- package/dist/_node-chunks/{chunk-PXOD36TR.js → chunk-GLNHSUKT.js} +20 -20
- package/dist/_node-chunks/{chunk-BKND5XP2.js → chunk-GQZZQB4K.js} +7 -7
- package/dist/_node-chunks/{chunk-GTXZNA2L.js → chunk-GRN6WQC3.js} +10 -10
- package/dist/_node-chunks/{chunk-6UASHVMR.js → chunk-HCMHVV7N.js} +8 -8
- package/dist/_node-chunks/{chunk-IVAOJWPF.js → chunk-HJVZQS65.js} +7 -7
- package/dist/_node-chunks/{chunk-ER3X3AQ7.js → chunk-I26RGEVQ.js} +7 -7
- package/dist/_node-chunks/{chunk-LAIED5XU.js → chunk-I36FPWMO.js} +6 -6
- package/dist/_node-chunks/{chunk-W7HY3ELZ.js → chunk-IDPQ3CVN.js} +474 -479
- package/dist/_node-chunks/{chunk-36LPBTLF.js → chunk-JUVUVVHI.js} +6 -6
- package/dist/_node-chunks/{chunk-DGWKJQ6G.js → chunk-K6TEIAKH.js} +62 -7
- package/dist/_node-chunks/{chunk-7IOSIYW2.js → chunk-KEXQ3BON.js} +7 -7
- package/dist/_node-chunks/{chunk-NLNAIU4I.js → chunk-KUZSE7ZD.js} +9 -9
- package/dist/_node-chunks/chunk-LJ5JRR5Q.js +18 -0
- package/dist/_node-chunks/{chunk-YBG7HVP7.js → chunk-LMGI47HP.js} +8 -8
- package/dist/_node-chunks/{chunk-6E34W4UX.js → chunk-LPIPPSMS.js} +6 -6
- package/dist/_node-chunks/{chunk-XICRXTTE.js → chunk-LR4W5G37.js} +6 -6
- package/dist/_node-chunks/{chunk-VKRGTLQJ.js → chunk-M4MRBEJI.js} +27 -23
- package/dist/_node-chunks/{chunk-REIDJUVJ.js → chunk-M7BVABR2.js} +20 -16
- package/dist/_node-chunks/{chunk-XCJ2ZIQ4.js → chunk-MK2RPLWT.js} +7 -7
- package/dist/_node-chunks/{chunk-LHNHFYK3.js → chunk-MKSEM5C2.js} +6 -6
- package/dist/_node-chunks/{chunk-RNRGXAFV.js → chunk-MWQIBOUB.js} +6 -6
- package/dist/_node-chunks/{chunk-NFDQT7UW.js → chunk-NAXIA2JI.js} +320 -316
- package/dist/_node-chunks/{chunk-GYFR2JLS.js → chunk-NDVIMCIX.js} +7 -7
- package/dist/_node-chunks/{chunk-D5ADPGA4.js → chunk-NIOVXWQZ.js} +6 -6
- package/dist/_node-chunks/{chunk-54EHKXV7.js → chunk-NRP4FGRT.js} +15 -9
- package/dist/_node-chunks/{chunk-NIQSBBT2.js → chunk-NSNBFXVB.js} +7 -7
- package/dist/_node-chunks/{chunk-Z2ZTDQDY.js → chunk-NTUTJAD4.js} +8 -8
- package/dist/_node-chunks/{chunk-XH5CXH53.js → chunk-O46DZ2KC.js} +8 -8
- package/dist/_node-chunks/{chunk-S3NDLFYL.js → chunk-OH5M2YER.js} +7 -7
- package/dist/_node-chunks/{chunk-FTYDKQCO.js → chunk-OSIENBU6.js} +6 -6
- package/dist/_node-chunks/{chunk-76KKKLEE.js → chunk-OVJZBW54.js} +7 -7
- package/dist/_node-chunks/{chunk-WO4UEQI6.js → chunk-PGIDRLZ5.js} +22 -22
- package/dist/_node-chunks/{chunk-J3SM62J3.js → chunk-PJCSZR4T.js} +8 -8
- package/dist/_node-chunks/{chunk-OPT5A55S.js → chunk-PQXP5FZ2.js} +8 -8
- package/dist/_node-chunks/{chunk-5P4N734V.js → chunk-PU33WSBW.js} +34 -52
- package/dist/_node-chunks/{chunk-APPFF22V.js → chunk-PUBZLLNL.js} +7 -7
- package/dist/_node-chunks/{chunk-ALGQMFMN.js → chunk-QWZZX2HN.js} +6 -6
- package/dist/_node-chunks/{chunk-NLLM4MDK.js → chunk-RMUBUNBY.js} +6 -6
- package/dist/_node-chunks/{chunk-SJXLINHV.js → chunk-S33FEPQ3.js} +6 -6
- package/dist/_node-chunks/{chunk-FEC5PGJO.js → chunk-SHP6447T.js} +7 -7
- package/dist/_node-chunks/{chunk-MBIVTOJK.js → chunk-ST3KB36E.js} +6 -6
- package/dist/_node-chunks/{chunk-AKMPPLT5.js → chunk-SXX75O2D.js} +7 -7
- package/dist/_node-chunks/{chunk-6UAJLEIO.js → chunk-TQ5YAQ4Y.js} +6 -6
- package/dist/_node-chunks/{chunk-R7VDUSKY.js → chunk-TSJ3JCNN.js} +16 -10
- package/dist/_node-chunks/{chunk-TKMXEHM4.js → chunk-UYEX6LW6.js} +7 -7
- package/dist/_node-chunks/{chunk-46Y5H6X5.js → chunk-VJLLEKWR.js} +138 -116
- package/dist/_node-chunks/{chunk-IFAV3CER.js → chunk-WWJKLYU5.js} +10 -10
- package/dist/_node-chunks/{chunk-MXLHIEXC.js → chunk-XC7K4QEX.js} +6 -6
- package/dist/_node-chunks/{chunk-GO3YSBPE.js → chunk-Y64FM6U7.js} +8 -8
- package/dist/_node-chunks/{chunk-T6P2EJD2.js → chunk-YDM7NH4T.js} +6 -6
- package/dist/_node-chunks/{chunk-XSVOMORJ.js → chunk-ZHVOUP6D.js} +6 -6
- package/dist/_node-chunks/dist-CFCU4PZG.js +27 -0
- package/dist/_node-chunks/dist-PFMT5YJK.js +16 -0
- package/dist/_node-chunks/{local-runtime-YDAW5RJV.js → local-runtime-BKID5MBG.js} +19 -20
- package/dist/_node-chunks/{mdx-plugin-XLDET5LV.js → mdx-plugin-7BOUDCZB.js} +13 -13
- package/dist/_node-chunks/{monorepo-NWMAHGOM.js → monorepo-FRHSAJB7.js} +11 -11
- package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-4B6IZ7JD.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-7BHSAJP4.js} +11 -11
- package/dist/_node-chunks/optimized-tests-F5LCOTXH.js +22 -0
- package/dist/_node-chunks/{pattern-copy-play-PJC4PO6A.js → pattern-copy-play-6TGV6WS4.js} +9 -9
- package/dist/_node-chunks/postinstallAddon-4RININ5C.js +20 -0
- package/dist/_node-chunks/{rehype-external-links-4CWXZ35U.js → rehype-external-links-EE2HT4QP.js} +9 -9
- package/dist/_node-chunks/{rehype-slug-QZ2PWSJH.js → rehype-slug-ZKRW2V6Z.js} +9 -9
- package/dist/_node-chunks/{relaxed-limits-ZQR4ER7L.js → relaxed-limits-6Q7VRQC5.js} +11 -11
- package/dist/_node-chunks/{run-U63AXEKZ.js → run-6Y3ZTASZ.js} +23 -21
- package/dist/_node-chunks/{run-BMXB2BW2.js → run-EBHIAT35.js} +18 -18
- package/dist/_node-chunks/{setup-NCUTUBNN.js → setup-6XIF77JT.js} +8 -8
- package/dist/_node-chunks/{vitest.config.4.template-4XHF7XPS.js → vitest.config.4.template-GMQNQ4UW.js} +7 -7
- package/dist/actions/decorator.js +16 -21
- package/dist/actions/index.d.ts +3 -3
- package/dist/actions/index.js +1 -1
- package/dist/addon-a11y/index.js +2 -2
- package/dist/addon-a11y/manager.js +11 -11
- package/dist/addon-a11y/preset.js +7 -7
- package/dist/addon-a11y/preview.d.ts +8 -2
- package/dist/addon-a11y/preview.js +2 -2
- package/dist/addon-docs/blocks.d.ts +104 -85
- package/dist/addon-docs/blocks.js +30 -32
- package/dist/addon-docs/index.d.ts +2 -2
- package/dist/addon-docs/index.js +3 -3
- package/dist/addon-docs/manager.js +4 -4
- package/dist/addon-docs/preset.js +12 -12
- package/dist/addon-docs/preview.d.ts +3 -1
- package/dist/addon-docs/preview.js +1 -1
- package/dist/addon-links/index.d.ts +2 -1
- package/dist/addon-links/preview.d.ts +1 -1
- package/dist/addon-mcp/preset.js +11 -11
- package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +16 -16
- package/dist/addon-ondevice-controls/index.js +1 -1
- package/dist/addon-ondevice-controls/register.js +1 -1
- package/dist/addon-pseudo-states/index.js +1 -1
- package/dist/addon-pseudo-states/preview.d.ts +1 -1
- package/dist/addon-pseudo-states/preview.js +1 -1
- package/dist/addon-themes/index.d.ts +6 -5
- package/dist/addon-themes/postinstall.js +7 -7
- package/dist/addon-vitest/constants.js +8 -8
- package/dist/addon-vitest/manager.js +18 -9
- package/dist/addon-vitest/node/coverage-reporter.js +11 -11
- package/dist/addon-vitest/node/vitest.js +34 -34
- package/dist/addon-vitest/postinstall.js +10 -10
- package/dist/addon-vitest/preset.js +21 -20
- package/dist/addon-vitest/vitest-plugin/global-setup.js +22 -22
- package/dist/addon-vitest/vitest-plugin/index.js +69 -59
- package/dist/babel/index.d.ts +209 -212
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +110 -89
- package/dist/bin/dispatcher.js +10 -10
- package/dist/bin/loader.js +8 -8
- package/dist/builder-vite/index.d.ts +1 -1
- package/dist/builder-vite/index.js +18 -18
- package/dist/builder-vite/preset.js +13 -13
- package/dist/channels/index.d.ts +1 -1
- package/dist/channels/index.js +2 -2
- package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
- package/dist/{chunk-Fg1Fm__9.d.ts → chunk-BCG2ui5q.d.ts} +671 -674
- package/dist/{chunk-DoIGKY33.d.ts → chunk-BLZXEm1K.d.ts} +6 -8
- package/dist/{chunk-CYuvV2sR.d.ts → chunk-BNRZY6Jq.d.ts} +3 -3
- package/dist/{chunk-CNqjcOmK.d.ts → chunk-BV_hETtB.d.ts} +2 -2
- package/dist/chunk-BcYKnZln.d.ts +10 -0
- package/dist/{chunk-BCoJQE-f.d.ts → chunk-BtKww7r1.d.ts} +6 -4
- package/dist/{chunk-Bpi2tz-6.d.ts → chunk-Bubi-WAs.d.ts} +20 -17
- package/dist/{chunk-pcFXCimE.d.ts → chunk-CmV7WZzR.d.ts} +124 -2
- package/dist/{chunk-BGkgZp-H.d.ts → chunk-D3uSIa6H.d.ts} +9 -1
- package/dist/{chunk-DROZ9oel.d.ts → chunk-DNCU78oW.d.ts} +110 -9
- package/dist/{chunk-D0NUmzXp.d.ts → chunk-LWwxlbee.d.ts} +4 -4
- package/dist/{chunk-BXLImeLy.d.ts → chunk-u_gGuTrz.d.ts} +23 -8
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +25 -30
- package/dist/cli/skills/content/index.d.ts +1 -1
- package/dist/cli/tools/sdk/child-host.d.ts +1 -1
- package/dist/cli/tools/sdk/child-host.js +17 -17
- package/dist/cli/tools/sdk/index.d.ts +3 -3
- package/dist/cli/tools/sdk/index.js +18 -18
- package/dist/cli-commands/bin/index.js +7 -7
- package/dist/client-logger/index.d.ts +20 -21
- package/dist/client-logger/index.js +2 -1
- package/dist/common/index.d.ts +13 -13
- package/dist/common/index.js +34 -35
- package/dist/components/index.d.ts +46 -35
- package/dist/components/index.js +194 -205
- package/dist/core-events/index.d.ts +2 -2
- package/dist/core-server/index.d.ts +15 -10
- package/dist/core-server/index.js +706 -165
- package/dist/core-server/presets/common-manager.js +254 -336
- package/dist/core-server/presets/common-override-preset.js +10 -10
- package/dist/core-server/presets/common-preset.js +83 -275
- package/dist/create/bin/index.js +7 -7
- package/dist/create/index.js +15 -15
- package/dist/csf/csf-utils.d.ts +1 -1
- package/dist/csf/index.d.ts +3 -3
- package/dist/csf/index.js +40 -43
- package/dist/csf-tools/index.d.ts +52 -44
- package/dist/csf-tools/index.js +13 -13
- package/dist/docs-tools/index.d.ts +332 -16
- package/dist/docs-tools/index.js +3 -3
- package/dist/instrumenter/index.d.ts +5 -5
- package/dist/instrumenter/index.js +25 -15
- package/dist/manager/_manager-chunks/{globals-runtime-DvV_TF3-.js → globals-runtime-B4NRbNSS.js} +2 -2
- package/dist/manager/_manager-chunks/{globals-runtime-wjkxyMn0.js → globals-runtime-BC43T1rL.js} +4150 -50
- package/dist/manager/_manager-chunks/{globals-runtime-BSj0mCjE.js → globals-runtime-BgWmCsA7.js} +114 -110
- package/dist/manager/_manager-chunks/{globals-runtime-CA8AuIRT.js → globals-runtime-BnQ7i5wq.js} +232 -228
- package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
- package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
- package/dist/manager/_manager-chunks/{globals-runtime-C5gK7HhH.js → globals-runtime-C59T0h-j.js} +2 -2
- package/dist/manager/_manager-chunks/{globals-runtime-CCTA-XPa.js → globals-runtime-CCZrdft6.js} +5 -4
- package/dist/manager/_manager-chunks/{globals-runtime-BY3epqww.js → globals-runtime-CS41oTca.js} +2 -1
- package/dist/manager/_manager-chunks/{globals-runtime-Bu9eGDTe.js → globals-runtime-Cccwtspx.js} +288 -420
- package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
- package/dist/manager/_manager-chunks/{globals-runtime-BweHuXkK.js → globals-runtime-DCmvKMN5.js} +2 -2
- package/dist/manager/_manager-chunks/{globals-runtime-C92M_Vnq.js → globals-runtime-Ddp2jFET.js} +5 -5
- package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
- package/dist/manager/_manager-chunks/globals-runtime-Me9Bl-sx.js +156 -0
- package/dist/manager/_manager-chunks/{globals-runtime-CHjExYMv.js → globals-runtime-UFDJQlo-.js} +741 -540
- package/dist/manager/_manager-chunks/globals-runtime-nQMRiA0J.js +19 -0
- package/dist/manager/_manager-chunks/{globals-runtime-Bj5KDUJi.js → globals-runtime-oRjPg2jY.js} +1 -1
- package/dist/manager/_manager-chunks/runtime-4wMiTjjZ.js +552 -0
- package/dist/manager/_manager-chunks/{runtime--hR2NZFd.js → runtime-AvqHE9rM.js} +112 -109
- package/dist/manager/_manager-chunks/{runtime-EPerAEAs.js → runtime-CZtDJIYj.js} +3 -3
- package/dist/manager/_manager-chunks/{runtime-B6NL14pz.js → runtime-D8QxTQiI.js} +6 -6
- package/dist/manager/_manager-chunks/{runtime-BAsOe1C_.js → runtime-DC3oEVlM.js} +49 -49
- package/dist/manager/_manager-chunks/{runtime-CJQZFUUj.js → runtime-DCOIOn4T.js} +46 -56
- package/dist/manager/_manager-chunks/{runtime-DvB1axgp.js → runtime-D_FDSHFG.js} +13 -13
- package/dist/manager/_manager-chunks/{runtime-Dtbhxq5m.js → runtime-Db8fJ2MP.js} +67 -500
- package/dist/manager/_manager-chunks/{runtime-CgRqs_SK.js → runtime-lPbyY_f5.js} +882 -869
- package/dist/manager/_manager-chunks/{runtime-Dem2xJbS.js → runtime-td6oYfU6.js} +739 -554
- package/dist/manager/globals-runtime.js +1 -1
- package/dist/manager/runtime.js +1 -1
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +479 -464
- package/dist/manager-errors.d.ts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +9 -9
- package/dist/mocking-utils/index.d.ts +5 -3
- package/dist/mocking-utils/index.js +21 -26
- package/dist/nextjs-vite/export-mocks/headers/index.js +3 -1
- package/dist/nextjs-vite/export-mocks/link/index.d.ts +4 -1
- package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +9 -1
- package/dist/nextjs-vite/export-mocks/router/index.js +13 -7
- package/dist/nextjs-vite/index.d.ts +2 -2
- package/dist/nextjs-vite/index.js +9 -5
- package/dist/nextjs-vite/node/index.js +7 -7
- package/dist/nextjs-vite/preset.js +12 -12
- package/dist/nextjs-vite/preview.d.ts +2 -1
- package/dist/nextjs-vite/preview.js +1 -1
- package/dist/nextjs-vite/vite-plugin/index.d.ts +2 -2
- package/dist/nextjs-vite/vite-plugin/index.js +9 -9
- package/dist/nextjs-vite-plugin/index.js +17 -27
- package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +10 -6
- package/dist/node-logger/index.d.ts +18 -18
- package/dist/node-logger/index.js +9 -9
- package/dist/oxc-parser/index.js +14 -11
- package/dist/oxc-parser/worker.js +10 -10
- package/dist/preview/_chunks/{runtime-Bcv1hJky.js → runtime-BYRCSYBN.js} +4148 -48
- package/dist/preview/_chunks/{runtime-WapFVPAh.js → runtime-Bvh_rfnQ.js} +2 -37
- package/dist/preview/_chunks/{runtime-BZ4pNS3g.js → runtime-CdZ1yk7m.js} +3 -3
- package/dist/preview/_chunks/{runtime-BhSZ1Mwt.js → runtime-CsO4apr9.js} +38 -42
- package/dist/preview/_chunks/{runtime-BUnOhg9h.js → runtime-D2MPrqbU.js} +2 -2
- package/dist/preview/_chunks/{runtime-BPwAnlRx.js → runtime-DS0s7U3c.js} +1 -1
- package/dist/preview/_chunks/{runtime-BgPhfM5P.js → runtime-U1Ycy25F.js} +736 -428
- package/dist/preview/_chunks/{runtime-BJwGQok8.js → runtime-tyJLgv6h.js} +221 -60
- package/dist/preview/runtime.js +1 -1
- package/dist/preview-api/index.d.ts +3 -3
- package/dist/preview-api/index.js +8 -8
- package/dist/preview-errors.d.ts +1 -1
- package/dist/react/docgen/docgen-worker.js +11 -11
- package/dist/react/entry-preview-argtypes.js +1 -1
- package/dist/react/entry-preview-docs.js +1 -1
- package/dist/react/entry-preview.js +1 -1
- package/dist/react/index.d.ts +5 -7
- package/dist/react/index.js +5 -5
- package/dist/react/preset.js +13 -13
- package/dist/react/preview.js +4 -4
- package/dist/react-native/bin/get-stories.js +8 -8
- package/dist/react-native/index.d.ts +37 -36
- package/dist/react-native/index.js +38 -38
- package/dist/react-native/metro/node.d.ts +1 -1
- package/dist/react-native/metro/node.js +10 -10
- package/dist/react-native/metro/withForkbook.d.ts +7 -7
- package/dist/react-native/metro/withForkbook.js +16 -16
- package/dist/react-native/preview.js +4 -1
- package/dist/react-native/scripts/generate.js +8 -8
- package/dist/react-native/stub.js +1 -1
- package/dist/react-native-ui/index.d.ts +8 -7
- package/dist/react-native-ui/index.js +1 -8
- package/dist/react-native-ui-common/index.d.ts +30 -9
- package/dist/react-native-ui-common/index.js +26 -31
- package/dist/react-vite/node/index.js +7 -7
- package/dist/react-vite/preset.js +7 -7
- package/dist/router/index.d.ts +2 -2
- package/dist/router/index.js +4 -2
- package/dist/server-errors.d.ts +1 -1
- package/dist/server-errors.js +9 -9
- package/dist/shared/open-service/index.d.ts +3 -3
- package/dist/shared/open-service/index.js +1 -1
- package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
- package/dist/shared/open-service/toolsets/docs/public.d.ts +7 -7
- package/dist/telemetry/index.d.ts +38 -274
- package/dist/telemetry/index.js +11 -66
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.js +139 -120
- package/dist/theming/create.d.ts +1 -1
- package/dist/theming/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/package.json +16 -16
- package/template/nextjs-vite/cli/js/Button.jsx +2 -2
- package/template/nextjs-vite/cli/js/Header.jsx +1 -1
- package/template/nextjs-vite/cli/js/Page.jsx +1 -1
- package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
- package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
- package/template/nextjs-vite/cli/ts/Page.tsx +1 -1
- package/template/react/cli/js/Button.jsx +2 -2
- package/template/react/cli/js/Header.jsx +1 -1
- package/template/react/cli/js/Page.jsx +1 -1
- package/template/react/cli/ts/Button.tsx +2 -2
- package/template/react/cli/ts/Header.tsx +1 -1
- package/template/react/cli/ts/Page.tsx +1 -1
- package/template/react-vite/cli/js/Button.jsx +2 -2
- package/template/react-vite/cli/js/Header.jsx +1 -1
- package/template/react-vite/cli/js/Page.jsx +1 -1
- package/template/react-vite/cli/ts/Button.tsx +2 -2
- package/template/react-vite/cli/ts/Header.tsx +1 -1
- package/template/react-vite/cli/ts/Page.tsx +1 -1
- package/dist/_node-chunks/chunk-2YNXKY72.js +0 -40
- package/dist/_node-chunks/chunk-3NST2GUZ.js +0 -33
- package/dist/_node-chunks/chunk-4D325SMT.js +0 -1359
- package/dist/_node-chunks/chunk-APXRPW7A.js +0 -11
- package/dist/_node-chunks/chunk-QHBQRPDP.js +0 -155
- package/dist/_node-chunks/chunk-SMBAR4G6.js +0 -18
- package/dist/_node-chunks/chunk-SRDKK3SG.js +0 -33
- package/dist/_node-chunks/chunk-V5IMPC3J.js +0 -33
- package/dist/_node-chunks/chunk-YIAUHGY2.js +0 -69
- package/dist/_node-chunks/dist-C5QIQD3G.js +0 -27
- package/dist/_node-chunks/dist-NBRPZCHX.js +0 -16
- package/dist/_node-chunks/optimized-tests-EIPJR7HA.js +0 -22
- package/dist/_node-chunks/postinstallAddon-EOAAURMG.js +0 -20
- package/dist/_node-chunks/session-id-HEW5JUNB.js +0 -23
- package/dist/chunk-BGhyFTJO.d.ts +0 -115
- package/dist/chunk-DaVb55-_.d.ts +0 -124
- package/dist/manager/_manager-chunks/globals-runtime-Bs75QQ_I.js +0 -9987
- package/dist/manager/_manager-chunks/globals-runtime-WZKaeKm9.js +0 -4091
- package/dist/manager/_manager-chunks/runtime-5o_11Jae.js +0 -78
- package/dist/preview/_chunks/runtime-BsMjBzuq.js +0 -53
- package/dist/preview/_chunks/runtime-C1jgT6tJ.js +0 -4091
- package/dist/preview/_chunks/runtime-CkOhMcXf.js +0 -387
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../_browser-chunks/chunk-W7NE2JXW.js";
|
|
4
4
|
import {
|
|
5
5
|
UniversalStore
|
|
6
|
-
} from "../_browser-chunks/chunk-
|
|
6
|
+
} from "../_browser-chunks/chunk-KQJ4T6JL.js";
|
|
7
7
|
import {
|
|
8
8
|
parse,
|
|
9
9
|
stringify as stringify2
|
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
createStatusStore,
|
|
15
15
|
statusValueShortName,
|
|
16
16
|
toStatusValue
|
|
17
|
-
} from "../_browser-chunks/chunk-
|
|
17
|
+
} from "../_browser-chunks/chunk-EBSOKHFG.js";
|
|
18
18
|
import {
|
|
19
19
|
getService,
|
|
20
20
|
registerService,
|
|
21
21
|
useServiceCommand,
|
|
22
22
|
useServiceQuery
|
|
23
|
-
} from "../_browser-chunks/chunk-
|
|
23
|
+
} from "../_browser-chunks/chunk-HZFHNYRC.js";
|
|
24
24
|
import {
|
|
25
25
|
countBy,
|
|
26
26
|
partition
|
|
@@ -34,14 +34,14 @@ import {
|
|
|
34
34
|
Tag,
|
|
35
35
|
USER_TAG_FILTER,
|
|
36
36
|
mockChannel
|
|
37
|
-
} from "../_browser-chunks/chunk-
|
|
38
|
-
import "../_browser-chunks/chunk-
|
|
37
|
+
} from "../_browser-chunks/chunk-ECMVTOVD.js";
|
|
38
|
+
import "../_browser-chunks/chunk-EW2M3URL.js";
|
|
39
39
|
import {
|
|
40
40
|
getChannel,
|
|
41
41
|
setChannel
|
|
42
|
-
} from "../_browser-chunks/chunk-
|
|
42
|
+
} from "../_browser-chunks/chunk-PQRPDA4U.js";
|
|
43
43
|
import "../_browser-chunks/chunk-QC4HFS6K.js";
|
|
44
|
-
import "../_browser-chunks/chunk-
|
|
44
|
+
import "../_browser-chunks/chunk-E6QKKKLO.js";
|
|
45
45
|
import {
|
|
46
46
|
stringify
|
|
47
47
|
} from "../_browser-chunks/chunk-SFVA4SBT.js";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
omit,
|
|
55
55
|
pick,
|
|
56
56
|
toMerged
|
|
57
|
-
} from "../_browser-chunks/chunk-
|
|
57
|
+
} from "../_browser-chunks/chunk-PU7D2WDP.js";
|
|
58
58
|
import "../_browser-chunks/chunk-IE4ULIOQ.js";
|
|
59
59
|
import {
|
|
60
60
|
isEqual
|
|
@@ -398,18 +398,14 @@ var createContext = ({ api, state }) => ReactCreateContext({ api, state });
|
|
|
398
398
|
import { logger } from "@aussieljk/forkbook/internal/client-logger";
|
|
399
399
|
var merge_default = (a, ...b) => {
|
|
400
400
|
let target = {};
|
|
401
|
-
target = mergeWith(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (Array.isArray(objValue))
|
|
410
|
-
return logger.log(["the types mismatch, picking", objValue]), objValue;
|
|
411
|
-
}
|
|
412
|
-
);
|
|
401
|
+
target = mergeWith({}, a, (objValue, srcValue) => {
|
|
402
|
+
if (Array.isArray(srcValue) && Array.isArray(objValue))
|
|
403
|
+
return srcValue.forEach((s) => {
|
|
404
|
+
objValue.find((o) => o === s || isEqual(o, s)) || objValue.push(s);
|
|
405
|
+
}), objValue;
|
|
406
|
+
if (Array.isArray(objValue))
|
|
407
|
+
return logger.log(["the types mismatch, picking", objValue]), objValue;
|
|
408
|
+
});
|
|
413
409
|
for (let obj of b)
|
|
414
410
|
target = mergeWith(target, obj, (objValue, srcValue) => {
|
|
415
411
|
if (Array.isArray(srcValue) && Array.isArray(objValue))
|
|
@@ -422,14 +418,10 @@ var merge_default = (a, ...b) => {
|
|
|
422
418
|
return target;
|
|
423
419
|
}, noArrayMerge = (a, ...b) => {
|
|
424
420
|
let target = {};
|
|
425
|
-
target = mergeWith(
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if (Array.isArray(srcValue))
|
|
430
|
-
return srcValue;
|
|
431
|
-
}
|
|
432
|
-
);
|
|
421
|
+
target = mergeWith({}, a, (objValue, srcValue) => {
|
|
422
|
+
if (Array.isArray(srcValue))
|
|
423
|
+
return srcValue;
|
|
424
|
+
});
|
|
433
425
|
for (let obj of b)
|
|
434
426
|
target = mergeWith(target, obj, (objValue, srcValue) => {
|
|
435
427
|
if (Array.isArray(srcValue))
|
|
@@ -549,7 +541,9 @@ var init = ({ provider, store: store2, fullAPI }) => {
|
|
|
549
541
|
options
|
|
550
542
|
).then(() => api.getAddonState(addonId));
|
|
551
543
|
},
|
|
552
|
-
getAddonState
|
|
544
|
+
getAddonState(addonId) {
|
|
545
|
+
return store2.getState().addons[addonId] || globalThis?.FORKBOOK_ADDON_STATE[addonId];
|
|
546
|
+
}
|
|
553
547
|
};
|
|
554
548
|
return {
|
|
555
549
|
api,
|
|
@@ -568,13 +562,13 @@ var channel_exports = {};
|
|
|
568
562
|
__export(channel_exports, {
|
|
569
563
|
init: () => init2
|
|
570
564
|
});
|
|
571
|
-
var init2 = ({ provider }) => ({ api: {
|
|
565
|
+
var hasTarget = (data) => typeof data == "object" && data !== null && "options" in data && typeof data.options == "object" && data.options !== null && "target" in data.options && typeof data.options.target == "string", init2 = ({ provider }) => ({ api: {
|
|
572
566
|
getChannel: () => provider.channel,
|
|
573
567
|
on: (type, handler) => (provider.channel?.on(type, handler), () => provider.channel?.off(type, handler)),
|
|
574
568
|
off: (type, handler) => provider.channel?.off(type, handler),
|
|
575
569
|
once: (type, handler) => provider.channel?.once(type, handler),
|
|
576
570
|
emit: (type, data, ...args) => {
|
|
577
|
-
data
|
|
571
|
+
hasTarget(data) && data.options.target && data.options.target !== "storybook-preview-iframe" && !data.options.target.startsWith("storybook-ref-") && (data.options.target = data.options.target !== "storybook_internal" ? `storybook-ref-${data.options.target}` : "storybook-preview-iframe"), provider.channel?.emit(type, data, ...args);
|
|
578
572
|
}
|
|
579
573
|
}, state: {} });
|
|
580
574
|
|
|
@@ -672,11 +666,13 @@ var TITLE_PATH_SEPARATOR = /\s*\/\s*/, denormalizeStoryParameters = ({
|
|
|
672
666
|
entries: Object.values(index.stories).reduce(
|
|
673
667
|
(acc, entry) => {
|
|
674
668
|
let type = "story";
|
|
675
|
-
|
|
669
|
+
(entry.parameters?.docsOnly || entry.name === "Page" && countByTitle[entry.title] === 1) && (type = "docs");
|
|
670
|
+
let { story: _story, kind: _kind, ...entryWithoutV3Fields } = entry;
|
|
671
|
+
return acc[entry.id] = {
|
|
676
672
|
type,
|
|
677
673
|
...type === "docs" && { tags: ["stories-mdx"], storiesImports: [] },
|
|
678
|
-
...
|
|
679
|
-
},
|
|
674
|
+
...entryWithoutV3Fields
|
|
675
|
+
}, acc;
|
|
680
676
|
},
|
|
681
677
|
{}
|
|
682
678
|
)
|
|
@@ -806,7 +802,7 @@ var TITLE_PATH_SEPARATOR = /\s*\/\s*/, denormalizeStoryParameters = ({
|
|
|
806
802
|
var { location, fetch } = global, getSourceType = (source, refId) => {
|
|
807
803
|
let { origin: localOrigin, pathname: localPathname } = location, { origin: sourceOrigin, pathname: sourcePathname } = new URL(source), localFull = `${localOrigin + localPathname}`.replace(/\/[^\/]*$/, ""), sourceFull = `${sourceOrigin + sourcePathname}`.replace(/\/[^\/]*$/, "");
|
|
808
804
|
return localFull === sourceFull ? ["local", sourceFull] : refId || source ? ["external", sourceFull] : [null, null];
|
|
809
|
-
}, defaultStoryMapper = (
|
|
805
|
+
}, defaultStoryMapper = (_ref, a) => ({ ...a, kind: a.kind.replace("|", "/") }), addRefIds = (input, ref) => Object.entries(input).reduce((acc, [id, item]) => ({ ...acc, [id]: { ...item, refId: ref.id } }), {}), applyRefStoryUpdates = (index, storyUpdates) => (storyUpdates && Object.entries(storyUpdates).forEach(([id, update2]) => {
|
|
810
806
|
let entry = index[id];
|
|
811
807
|
entry && (entry.type === "story" || entry.type === "docs") && (index[id] = { ...entry, ...update2 });
|
|
812
808
|
}), index);
|
|
@@ -928,15 +924,15 @@ var parseUrl = (url) => {
|
|
|
928
924
|
setRef: async (id, { storyIndex, setStoriesData, ...rest }, ready = !1) => {
|
|
929
925
|
if (singleStory)
|
|
930
926
|
return;
|
|
931
|
-
let
|
|
932
|
-
(storyIndex || setStoriesData) && (internal_index = setStoriesData ? transformSetStoriesStoryDataToPreparedStoryIndex(
|
|
927
|
+
let index, filteredIndex, { filters } = store2.getState(), { storyMapper = defaultStoryMapper } = provider.getConfig(), ref = api.getRefs()[id], internal_index = setStoriesData ? transformSetStoriesStoryDataToPreparedStoryIndex(
|
|
933
928
|
map(setStoriesData, ref, { storyMapper })
|
|
934
|
-
) : storyIndex
|
|
929
|
+
) : storyIndex;
|
|
930
|
+
internal_index && (filteredIndex = transformStoryIndexToStoriesHash(internal_index, {
|
|
935
931
|
provider,
|
|
936
932
|
docsOptions,
|
|
937
933
|
filters,
|
|
938
934
|
allStatuses: {}
|
|
939
|
-
}), index = transformStoryIndexToStoriesHash(
|
|
935
|
+
}), index = transformStoryIndexToStoriesHash(internal_index, {
|
|
940
936
|
provider,
|
|
941
937
|
docsOptions,
|
|
942
938
|
filters: {},
|
|
@@ -946,7 +942,9 @@ var parseUrl = (url) => {
|
|
|
946
942
|
updateRef: async (id, data) => {
|
|
947
943
|
let { [id]: ref, ...updated } = api.getRefs();
|
|
948
944
|
updated[id] = { ...ref, ...data };
|
|
949
|
-
let ordered = Object.
|
|
945
|
+
let ordered = Object.fromEntries(
|
|
946
|
+
Object.keys(initialState).map((key) => [key, updated[key]])
|
|
947
|
+
);
|
|
950
948
|
await store2.setState({
|
|
951
949
|
refs: ordered
|
|
952
950
|
});
|
|
@@ -1269,7 +1267,7 @@ var { document: document2 } = global, isFunction = (val) => typeof val == "funct
|
|
|
1269
1267
|
return !1;
|
|
1270
1268
|
let attemptFocus = () => {
|
|
1271
1269
|
let element = document2.getElementById(elementId);
|
|
1272
|
-
return !element || (element.focus(), element !== document2.activeElement && forceFocus && element.getAttribute("tabindex") === null && (element.setAttribute("tabindex", "-1"), element.focus()), element !== document2.activeElement && element.id !== document2.activeElement?.id) ? !1 : (select && element.select
|
|
1270
|
+
return !element || (element.focus(), element !== document2.activeElement && forceFocus && element.getAttribute("tabindex") === null && (element.setAttribute("tabindex", "-1"), element.focus()), element !== document2.activeElement && element.id !== document2.activeElement?.id) ? !1 : (select && "select" in element && typeof element.select == "function" && element.select(), !0);
|
|
1273
1271
|
};
|
|
1274
1272
|
return attemptFocus() ? !0 : poll ? new Promise((resolve) => {
|
|
1275
1273
|
let startTime = Date.now(), maxDuration = 500, intervalId = setInterval(() => {
|
|
@@ -1780,32 +1778,16 @@ var stories_exports = {};
|
|
|
1780
1778
|
__export(stories_exports, {
|
|
1781
1779
|
init: () => init11
|
|
1782
1780
|
});
|
|
1783
|
-
import { logger as
|
|
1781
|
+
import { logger as logger8 } from "@aussieljk/forkbook/internal/client-logger";
|
|
1784
1782
|
import {
|
|
1785
|
-
CONFIG_ERROR,
|
|
1786
|
-
CURRENT_STORY_WAS_SET,
|
|
1787
|
-
DOCS_PREPARED,
|
|
1788
|
-
PRELOAD_ENTRIES,
|
|
1789
1783
|
RESET_STORY_ARGS,
|
|
1790
|
-
SELECT_STORY,
|
|
1791
|
-
SET_CONFIG as SET_CONFIG3,
|
|
1792
|
-
SET_CURRENT_STORY,
|
|
1793
|
-
SET_FILTER,
|
|
1794
|
-
SET_INDEX,
|
|
1795
|
-
SET_STORIES,
|
|
1796
|
-
SIDEBAR_FILTER_CHANGED,
|
|
1797
|
-
STORY_ARGS_UPDATED,
|
|
1798
|
-
STORY_CHANGED,
|
|
1799
1784
|
STORY_INDEX_INVALIDATED,
|
|
1800
|
-
STORY_MISSING,
|
|
1801
|
-
STORY_PREPARED,
|
|
1802
|
-
STORY_SPECIFIED,
|
|
1803
1785
|
UPDATE_STORY_ARGS
|
|
1804
1786
|
} from "@aussieljk/forkbook/internal/core-events";
|
|
1805
1787
|
import { sanitize as sanitize2, toId } from "@aussieljk/forkbook/internal/csf";
|
|
1806
1788
|
import {
|
|
1807
1789
|
fromUrlPath,
|
|
1808
|
-
queryFromLocation,
|
|
1790
|
+
queryFromLocation as queryFromLocation2,
|
|
1809
1791
|
setStoryPathEntries,
|
|
1810
1792
|
toUrlPath
|
|
1811
1793
|
} from "@aussieljk/forkbook/internal/router";
|
|
@@ -1848,6 +1830,152 @@ var statusStore = createStatusStore({
|
|
|
1848
1830
|
environment: "manager"
|
|
1849
1831
|
}), { fullStatusStore, getStatusStoreByTypeId, useStatusStore, universalStatusStore } = statusStore;
|
|
1850
1832
|
|
|
1833
|
+
// src/manager-api/modules/stories-events.ts
|
|
1834
|
+
import {
|
|
1835
|
+
CONFIG_ERROR,
|
|
1836
|
+
CURRENT_STORY_WAS_SET,
|
|
1837
|
+
DOCS_PREPARED,
|
|
1838
|
+
PRELOAD_ENTRIES,
|
|
1839
|
+
SELECT_STORY,
|
|
1840
|
+
SET_CURRENT_STORY,
|
|
1841
|
+
SET_INDEX,
|
|
1842
|
+
SET_STORIES,
|
|
1843
|
+
STORY_ARGS_UPDATED,
|
|
1844
|
+
STORY_CHANGED,
|
|
1845
|
+
STORY_MISSING,
|
|
1846
|
+
STORY_PREPARED,
|
|
1847
|
+
STORY_SPECIFIED
|
|
1848
|
+
} from "@aussieljk/forkbook/internal/core-events";
|
|
1849
|
+
var removedOptions = ["enableShortcuts", "theme", "showRoots"];
|
|
1850
|
+
function removeRemovedOptions(options) {
|
|
1851
|
+
if (!options || typeof options == "string")
|
|
1852
|
+
return options;
|
|
1853
|
+
let result = { ...options };
|
|
1854
|
+
return removedOptions.forEach((option) => {
|
|
1855
|
+
option in result && delete result[option];
|
|
1856
|
+
}), result;
|
|
1857
|
+
}
|
|
1858
|
+
var listenToStoryEvents = ({
|
|
1859
|
+
store: store2,
|
|
1860
|
+
provider,
|
|
1861
|
+
fullAPI,
|
|
1862
|
+
api,
|
|
1863
|
+
navigateWithQueryParams
|
|
1864
|
+
}) => {
|
|
1865
|
+
provider.channel?.on(
|
|
1866
|
+
STORY_SPECIFIED,
|
|
1867
|
+
function({ storyId, viewMode }) {
|
|
1868
|
+
let { sourceType } = getEventMetadata(this, fullAPI);
|
|
1869
|
+
if (sourceType === "local") {
|
|
1870
|
+
let state = store2.getState(), isCanvasRoute = !isReviewManagerRoute(state.path, state.customQueryParams) && (state.path === "/" || state.viewMode === "story" || state.viewMode === "docs"), stateHasSelection = state.viewMode && state.storyId, stateSelectionDifferent = state.viewMode !== viewMode || state.storyId !== storyId, { type } = state.index?.[state.storyId] || {}, isStory = !(type === "root" || type === "component" || type === "group");
|
|
1871
|
+
if (isCanvasRoute) {
|
|
1872
|
+
let { filteredIndex } = state;
|
|
1873
|
+
if (filteredIndex && !stateHasSelection && !(filteredIndex[storyId]?.type === "story")) {
|
|
1874
|
+
let firstFiltered = Object.keys(filteredIndex).find((id) => {
|
|
1875
|
+
let entry = filteredIndex[id];
|
|
1876
|
+
return entry.type === "story" || entry.type === "docs";
|
|
1877
|
+
});
|
|
1878
|
+
firstFiltered && navigateWithQueryParams(`/${viewMode}/${firstFiltered}`);
|
|
1879
|
+
return;
|
|
1880
|
+
}
|
|
1881
|
+
stateHasSelection && stateSelectionDifferent && isStory ? provider.channel?.emit(SET_CURRENT_STORY, {
|
|
1882
|
+
storyId: state.storyId,
|
|
1883
|
+
viewMode: state.viewMode
|
|
1884
|
+
}) : stateSelectionDifferent && navigateWithQueryParams(`/${viewMode}/${storyId}`);
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
), provider.channel?.on(CURRENT_STORY_WAS_SET, function() {
|
|
1889
|
+
let { ref } = getEventMetadata(this, fullAPI);
|
|
1890
|
+
api.setPreviewInitialized(ref);
|
|
1891
|
+
}), provider.channel?.on(STORY_CHANGED, function() {
|
|
1892
|
+
let { sourceType } = getEventMetadata(this, fullAPI);
|
|
1893
|
+
if (sourceType === "local") {
|
|
1894
|
+
let options = api.getCurrentParameter("options");
|
|
1895
|
+
options && fullAPI.setOptions(removeRemovedOptions(options));
|
|
1896
|
+
}
|
|
1897
|
+
}), provider.channel?.on(
|
|
1898
|
+
STORY_PREPARED,
|
|
1899
|
+
function({ id, ...update2 }) {
|
|
1900
|
+
let { ref, sourceType } = getEventMetadata(this, fullAPI);
|
|
1901
|
+
if (api.updateStory(id, { ...update2, prepared: !0 }, ref), !ref && !store2.getState().hasCalledSetOptions) {
|
|
1902
|
+
let { options } = update2.parameters;
|
|
1903
|
+
fullAPI.setOptions(removeRemovedOptions(options)), store2.setState({ hasCalledSetOptions: !0 });
|
|
1904
|
+
}
|
|
1905
|
+
if (sourceType === "local") {
|
|
1906
|
+
let { storyId, index, refId } = store2.getState();
|
|
1907
|
+
if (!index)
|
|
1908
|
+
return;
|
|
1909
|
+
let toBePreloaded = Array.from(
|
|
1910
|
+
/* @__PURE__ */ new Set([
|
|
1911
|
+
api.findSiblingStoryId(storyId, index, 1, !0),
|
|
1912
|
+
api.findSiblingStoryId(storyId, index, -1, !0)
|
|
1913
|
+
])
|
|
1914
|
+
).filter(Boolean);
|
|
1915
|
+
provider.channel?.emit(PRELOAD_ENTRIES, {
|
|
1916
|
+
ids: toBePreloaded,
|
|
1917
|
+
options: { target: refId }
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
), provider.channel?.on(
|
|
1922
|
+
DOCS_PREPARED,
|
|
1923
|
+
function({ id, ...update2 }) {
|
|
1924
|
+
let { ref } = getEventMetadata(this, fullAPI);
|
|
1925
|
+
api.updateStory(id, { ...update2, prepared: !0 }, ref);
|
|
1926
|
+
}
|
|
1927
|
+
), provider.channel?.on(SET_INDEX, function(index) {
|
|
1928
|
+
let { ref } = getEventMetadata(this, fullAPI);
|
|
1929
|
+
if (ref)
|
|
1930
|
+
fullAPI.setRef(ref.id, { ...ref, storyIndex: index }, !0);
|
|
1931
|
+
else {
|
|
1932
|
+
api.setIndex(index);
|
|
1933
|
+
let options = api.getCurrentParameter("options");
|
|
1934
|
+
fullAPI.setOptions(removeRemovedOptions(options));
|
|
1935
|
+
}
|
|
1936
|
+
}), provider.channel?.on(SET_STORIES, function(data) {
|
|
1937
|
+
let { ref } = getEventMetadata(this, fullAPI), setStoriesData = data.v ? denormalizeStoryParameters(data) : data.stories;
|
|
1938
|
+
if (ref)
|
|
1939
|
+
fullAPI.setRef(ref.id, { ...ref, setStoriesData }, !0);
|
|
1940
|
+
else
|
|
1941
|
+
throw new Error("Cannot call SET_STORIES for local frame");
|
|
1942
|
+
}), provider.channel?.on(
|
|
1943
|
+
SELECT_STORY,
|
|
1944
|
+
function({
|
|
1945
|
+
kind,
|
|
1946
|
+
title = kind,
|
|
1947
|
+
story,
|
|
1948
|
+
name = story,
|
|
1949
|
+
storyId,
|
|
1950
|
+
...rest
|
|
1951
|
+
}) {
|
|
1952
|
+
let { ref } = getEventMetadata(this, fullAPI);
|
|
1953
|
+
ref ? fullAPI.selectStory(storyId || title, name, { ...rest, ref: ref.id }) : fullAPI.selectStory(storyId || title, name, rest);
|
|
1954
|
+
}
|
|
1955
|
+
), provider.channel?.on(
|
|
1956
|
+
STORY_ARGS_UPDATED,
|
|
1957
|
+
function({ storyId, args }) {
|
|
1958
|
+
let { ref } = getEventMetadata(this, fullAPI);
|
|
1959
|
+
api.updateStory(storyId, { args }, ref);
|
|
1960
|
+
}
|
|
1961
|
+
), provider.channel?.on(CONFIG_ERROR, function() {
|
|
1962
|
+
let { ref } = getEventMetadata(this, fullAPI);
|
|
1963
|
+
api.setPreviewInitialized(ref);
|
|
1964
|
+
}), provider.channel?.on(STORY_MISSING, function() {
|
|
1965
|
+
let { ref } = getEventMetadata(this, fullAPI);
|
|
1966
|
+
api.setPreviewInitialized(ref);
|
|
1967
|
+
});
|
|
1968
|
+
};
|
|
1969
|
+
|
|
1970
|
+
// src/manager-api/modules/stories-filters.ts
|
|
1971
|
+
import { logger as logger7 } from "@aussieljk/forkbook/internal/client-logger";
|
|
1972
|
+
import {
|
|
1973
|
+
SET_CONFIG as SET_CONFIG3,
|
|
1974
|
+
SET_FILTER,
|
|
1975
|
+
SIDEBAR_FILTER_CHANGED
|
|
1976
|
+
} from "@aussieljk/forkbook/internal/core-events";
|
|
1977
|
+
import { queryFromLocation } from "@aussieljk/forkbook/internal/router";
|
|
1978
|
+
|
|
1851
1979
|
// src/manager-api/lib/filter-param.ts
|
|
1852
1980
|
var parseFilterParam = (param, transform) => {
|
|
1853
1981
|
if (!param)
|
|
@@ -1915,45 +2043,18 @@ var BUILT_IN_URL_TAG_MAP = {
|
|
|
1915
2043
|
};
|
|
1916
2044
|
};
|
|
1917
2045
|
|
|
1918
|
-
// src/manager-api/modules/stories.ts
|
|
1919
|
-
var
|
|
1920
|
-
function removeRemovedOptions(options) {
|
|
1921
|
-
if (!options || typeof options == "string")
|
|
1922
|
-
return options;
|
|
1923
|
-
let result = { ...options };
|
|
1924
|
-
return removedOptions.forEach((option) => {
|
|
1925
|
-
option in result && delete result[option];
|
|
1926
|
-
}), result;
|
|
1927
|
-
}
|
|
1928
|
-
var FILTER_KEYS = {
|
|
2046
|
+
// src/manager-api/modules/stories-filters.ts
|
|
2047
|
+
var TAGS_FILTER = "tags-filter", STATIC_FILTER = "static-filter", STATUS_FILTER = "status-filter", STATUS_CHANGE_REBUILD_THROTTLE = 500, BUILT_IN_TAG_IDS = new Set(Object.keys(BUILT_IN_FILTERS)), FILTER_KEYS = {
|
|
1929
2048
|
tag: { included: "includedTagFilters", excluded: "excludedTagFilters" },
|
|
1930
2049
|
status: { included: "includedStatusFilters", excluded: "excludedStatusFilters" }
|
|
1931
|
-
},
|
|
1932
|
-
fullAPI,
|
|
2050
|
+
}, initFilters = ({
|
|
1933
2051
|
store: store2,
|
|
1934
|
-
navigate,
|
|
1935
2052
|
provider,
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
docsOptions = {}
|
|
2053
|
+
fullAPI,
|
|
2054
|
+
location: location2,
|
|
2055
|
+
setIndex
|
|
1940
2056
|
}) => {
|
|
1941
|
-
let
|
|
1942
|
-
let { customQueryParams } = store2.getState();
|
|
1943
|
-
navigate(buildNavigationUrl(path, customQueryParams ?? {}), options);
|
|
1944
|
-
}, canonicaliseUrl = () => {
|
|
1945
|
-
let { location: currentLocation, path, customQueryParams } = store2.getState(), pathname = currentLocation?.pathname;
|
|
1946
|
-
if (!pathname || queryFromLocation(currentLocation).path)
|
|
1947
|
-
return;
|
|
1948
|
-
let resolved = fromUrlPath(pathname);
|
|
1949
|
-
if (resolved === "/" || resolved === path && toUrlPath(resolved) === pathname)
|
|
1950
|
-
return;
|
|
1951
|
-
let target = buildNavigationUrl(
|
|
1952
|
-
`${resolved}${currentLocation.hash ?? ""}`,
|
|
1953
|
-
customQueryParams ?? {}
|
|
1954
|
-
);
|
|
1955
|
-
navigate(target, { replace: !0 });
|
|
1956
|
-
}, persistFilters = (inputPatch) => store2.setState(inputPatch, {
|
|
2057
|
+
let persistFilters = (inputPatch) => store2.setState(inputPatch, {
|
|
1957
2058
|
persistence: "url",
|
|
1958
2059
|
serialize: (s) => {
|
|
1959
2060
|
let tagsValue = serializeTagsParam(s.includedTagFilters, s.excludedTagFilters), statusesValue = serializeStatusesParam(
|
|
@@ -1962,8 +2063,8 @@ var FILTER_KEYS = {
|
|
|
1962
2063
|
);
|
|
1963
2064
|
return { tags: tagsValue ?? null, statuses: statusesValue ?? null };
|
|
1964
2065
|
}
|
|
1965
|
-
}),
|
|
1966
|
-
let { included, excluded: excludedKey } = FILTER_KEYS[type],
|
|
2066
|
+
}), addFilters = async (type, items, excluded) => {
|
|
2067
|
+
let { included, excluded: excludedKey } = FILTER_KEYS[type], state2 = store2.getState(), newIncluded = new Set(state2[included]), newExcluded = new Set(state2[excludedKey]);
|
|
1967
2068
|
for (let item of items) {
|
|
1968
2069
|
let [target, other] = excluded ? [newExcluded, newIncluded] : [newIncluded, newExcluded];
|
|
1969
2070
|
other.delete(item), target.add(item);
|
|
@@ -1973,13 +2074,13 @@ var FILTER_KEYS = {
|
|
|
1973
2074
|
[excludedKey]: Array.from(newExcluded)
|
|
1974
2075
|
});
|
|
1975
2076
|
}, removeFilters = async (type, items) => {
|
|
1976
|
-
let { included, excluded } = FILTER_KEYS[type],
|
|
2077
|
+
let { included, excluded } = FILTER_KEYS[type], state2 = store2.getState(), itemSet = new Set(items);
|
|
1977
2078
|
await persistFilters({
|
|
1978
|
-
[included]:
|
|
1979
|
-
[excluded]:
|
|
2079
|
+
[included]: state2[included].filter((v) => !itemSet.has(v)),
|
|
2080
|
+
[excluded]: state2[excluded].filter((v) => !itemSet.has(v))
|
|
1980
2081
|
});
|
|
1981
2082
|
}, emitFilterTelemetry = (trigger, changed) => {
|
|
1982
|
-
let
|
|
2083
|
+
let state2 = store2.getState(), includedTags = (state2.includedTagFilters ?? []).filter((id) => BUILT_IN_TAG_IDS.has(id)), excludedTags = (state2.excludedTagFilters ?? []).filter((id) => BUILT_IN_TAG_IDS.has(id)), includedStatuses = state2.includedStatusFilters ?? [], excludedStatuses = state2.excludedStatusFilters ?? [], storyCounts = {}, entries = state2.internal_index ? Object.values(state2.internal_index.entries) : [];
|
|
1983
2084
|
for (let tagId of /* @__PURE__ */ new Set([...includedTags, ...excludedTags])) {
|
|
1984
2085
|
let filterDef = BUILT_IN_FILTERS[tagId];
|
|
1985
2086
|
storyCounts[tagId] = entries.filter((entry) => filterDef(entry)).length;
|
|
@@ -1997,48 +2098,236 @@ var FILTER_KEYS = {
|
|
|
1997
2098
|
storyCounts
|
|
1998
2099
|
});
|
|
1999
2100
|
}, api = {
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
let result = api.resolveStory(storyId, refId);
|
|
2003
|
-
if (result?.type === "story" || result?.type === "docs")
|
|
2004
|
-
return result;
|
|
2101
|
+
setFilter: async (id, filterFunction) => {
|
|
2102
|
+
await api.setFilters({ [id]: filterFunction });
|
|
2005
2103
|
},
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2104
|
+
setFilters: async (filters) => {
|
|
2105
|
+
if (await store2.setState((state2) => ({ filters: { ...state2.filters, ...filters } })), !!await applyCurrentFilters())
|
|
2106
|
+
for (let id of Object.keys(filters))
|
|
2107
|
+
provider.channel?.emit(SET_FILTER, { id });
|
|
2009
2108
|
},
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2109
|
+
resetTagFilters: async () => {
|
|
2110
|
+
await persistFilters((s) => ({
|
|
2111
|
+
includedTagFilters: s.defaultIncludedTagFilters,
|
|
2112
|
+
excludedTagFilters: s.defaultExcludedTagFilters
|
|
2113
|
+
})), await recomputeTagsFilter();
|
|
2014
2114
|
},
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
return api.getData(storyId, refId);
|
|
2115
|
+
setAllTagFilters: async (included, excluded) => {
|
|
2116
|
+
await persistFilters({ includedTagFilters: included, excludedTagFilters: excluded }), await recomputeTagsFilter();
|
|
2018
2117
|
},
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2118
|
+
addTagFilters: async (tags2, excluded) => {
|
|
2119
|
+
await addFilters("tag", tags2, excluded), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
|
|
2120
|
+
filterType: "tag",
|
|
2121
|
+
filterId: tags2[0],
|
|
2122
|
+
action: excluded ? "exclude" : "include"
|
|
2123
|
+
});
|
|
2022
2124
|
},
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
}
|
|
2030
|
-
return null;
|
|
2125
|
+
removeTagFilters: async (tags2) => {
|
|
2126
|
+
await removeFilters("tag", tags2), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
|
|
2127
|
+
filterType: "tag",
|
|
2128
|
+
filterId: tags2[0],
|
|
2129
|
+
action: "remove"
|
|
2130
|
+
});
|
|
2031
2131
|
},
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
return api.getParameters({ storyId, refId }, parameterName) || void 0;
|
|
2132
|
+
resetStatusFilters: async () => {
|
|
2133
|
+
await persistFilters({ includedStatusFilters: [], excludedStatusFilters: [] }), await recomputeStatusFilter();
|
|
2035
2134
|
},
|
|
2036
|
-
|
|
2037
|
-
let
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2135
|
+
setAllStatusFilters: async (included, excluded) => {
|
|
2136
|
+
let prevState = store2.getState(), prevIncluded = new Set(prevState.includedStatusFilters ?? []), prevExcluded = new Set(prevState.excludedStatusFilters ?? []), nextIncluded = new Set(included), nextExcluded = new Set(excluded);
|
|
2137
|
+
await persistFilters({ includedStatusFilters: included, excludedStatusFilters: excluded }), await recomputeStatusFilter();
|
|
2138
|
+
let changedIds = /* @__PURE__ */ new Set([
|
|
2139
|
+
...prevIncluded,
|
|
2140
|
+
...prevExcluded,
|
|
2141
|
+
...nextIncluded,
|
|
2142
|
+
...nextExcluded
|
|
2143
|
+
]);
|
|
2144
|
+
for (let id of changedIds) {
|
|
2145
|
+
let wasIncluded = prevIncluded.has(id), wasExcluded = prevExcluded.has(id), isIncluded = nextIncluded.has(id), isExcluded = nextExcluded.has(id);
|
|
2146
|
+
if (wasIncluded === isIncluded && wasExcluded === isExcluded)
|
|
2147
|
+
continue;
|
|
2148
|
+
let action;
|
|
2149
|
+
isIncluded ? action = "include" : isExcluded ? action = "exclude" : action = "remove", emitFilterTelemetry("interaction", {
|
|
2150
|
+
filterType: "status",
|
|
2151
|
+
filterId: id,
|
|
2152
|
+
action
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
},
|
|
2156
|
+
addStatusFilters: async (statuses2, excluded) => {
|
|
2157
|
+
await addFilters("status", statuses2, excluded), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
|
|
2158
|
+
filterType: "status",
|
|
2159
|
+
filterId: statuses2[0],
|
|
2160
|
+
action: excluded ? "exclude" : "include"
|
|
2161
|
+
});
|
|
2162
|
+
},
|
|
2163
|
+
removeStatusFilters: async (statuses2) => {
|
|
2164
|
+
await removeFilters("status", statuses2), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
|
|
2165
|
+
filterType: "status",
|
|
2166
|
+
filterId: statuses2[0],
|
|
2167
|
+
action: "remove"
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
}, applyCurrentFilters = async () => {
|
|
2171
|
+
let { internal_index: index } = store2.getState();
|
|
2172
|
+
if (!index)
|
|
2173
|
+
return !1;
|
|
2174
|
+
await setIndex(index);
|
|
2175
|
+
let refs = await fullAPI.getRefs();
|
|
2176
|
+
for (let [refId, { internal_index, ...ref }] of Object.entries(refs))
|
|
2177
|
+
await fullAPI.setRef(refId, { ...ref, storyIndex: internal_index }, !0);
|
|
2178
|
+
return !0;
|
|
2179
|
+
}, statusFilterRebuildQueued = !1, statusFilterRebuildInFlight = !1, flushStatusFilterRebuild = async () => {
|
|
2180
|
+
if (!statusFilterRebuildInFlight) {
|
|
2181
|
+
statusFilterRebuildInFlight = !0;
|
|
2182
|
+
try {
|
|
2183
|
+
for (; statusFilterRebuildQueued; ) {
|
|
2184
|
+
statusFilterRebuildQueued = !1;
|
|
2185
|
+
try {
|
|
2186
|
+
await applyCurrentFilters();
|
|
2187
|
+
} catch (error) {
|
|
2188
|
+
logger7.warn("Failed to rebuild story index after status change:", error);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
} finally {
|
|
2192
|
+
statusFilterRebuildInFlight = !1, statusFilterRebuildQueued && flushStatusFilterRebuild();
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
}, requestStatusFilterRebuild = () => {
|
|
2196
|
+
statusFilterRebuildQueued = !0, flushStatusFilterRebuild();
|
|
2197
|
+
}, recomputeTagsFilter = () => {
|
|
2198
|
+
let { includedTagFilters, excludedTagFilters } = store2.getState();
|
|
2199
|
+
return api.setFilters({
|
|
2200
|
+
[TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters)
|
|
2201
|
+
});
|
|
2202
|
+
}, recomputeStatusFilter = () => {
|
|
2203
|
+
let { includedStatusFilters, excludedStatusFilters } = store2.getState();
|
|
2204
|
+
return api.setFilters({
|
|
2205
|
+
[STATUS_FILTER]: computeStatusFilterFn(
|
|
2206
|
+
includedStatusFilters ?? [],
|
|
2207
|
+
excludedStatusFilters ?? []
|
|
2208
|
+
)
|
|
2209
|
+
});
|
|
2210
|
+
};
|
|
2211
|
+
provider.channel?.on(SET_CONFIG3, async () => {
|
|
2212
|
+
let {
|
|
2213
|
+
includedTagFilters,
|
|
2214
|
+
excludedTagFilters,
|
|
2215
|
+
includedStatusFilters,
|
|
2216
|
+
excludedStatusFilters,
|
|
2217
|
+
tagPresets: tagPresets2
|
|
2218
|
+
} = store2.getState();
|
|
2219
|
+
await api.setFilters({
|
|
2220
|
+
[STATIC_FILTER]: computeStaticFilterFn(tagPresets2),
|
|
2221
|
+
[TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters),
|
|
2222
|
+
[STATUS_FILTER]: computeStatusFilterFn(includedStatusFilters, excludedStatusFilters)
|
|
2223
|
+
});
|
|
2224
|
+
}), fullStatusStore.onAllStatusChange(
|
|
2225
|
+
throttle(requestStatusFilterRebuild, STATUS_CHANGE_REBUILD_THROTTLE, {
|
|
2226
|
+
edges: ["leading", "trailing"]
|
|
2227
|
+
})
|
|
2228
|
+
);
|
|
2229
|
+
let tagPresets = global.TAGS_OPTIONS || {}, defaultTags = getDefaultTagsFromPreset(tagPresets), { tags, statuses } = queryFromLocation(location2 ?? { search: "" }), parsedTags = parseTagsParam(tags), hasTagsParam = tags !== void 0, initialIncluded = hasTagsParam ? parsedTags.included : defaultTags.included, initialExcluded = hasTagsParam ? parsedTags.excluded : defaultTags.excluded, parsedStatuses = parseStatusesParam(statuses), initialIncludedStatuses = parsedStatuses.included, initialExcludedStatuses = parsedStatuses.excluded, state = {
|
|
2230
|
+
filters: {
|
|
2231
|
+
[STATIC_FILTER]: computeStaticFilterFn(tagPresets),
|
|
2232
|
+
[TAGS_FILTER]: computeTagsFilterFn(initialIncluded, initialExcluded),
|
|
2233
|
+
[STATUS_FILTER]: computeStatusFilterFn(initialIncludedStatuses, initialExcludedStatuses)
|
|
2234
|
+
},
|
|
2235
|
+
tagPresets,
|
|
2236
|
+
defaultIncludedTagFilters: defaultTags.included,
|
|
2237
|
+
defaultExcludedTagFilters: defaultTags.excluded,
|
|
2238
|
+
includedTagFilters: initialIncluded,
|
|
2239
|
+
excludedTagFilters: initialExcluded,
|
|
2240
|
+
includedStatusFilters: initialIncludedStatuses,
|
|
2241
|
+
excludedStatusFilters: initialExcludedStatuses
|
|
2242
|
+
}, urlFilterTelemetryEmitted = !1;
|
|
2243
|
+
return { api, state, emitUrlFilterTelemetry: () => {
|
|
2244
|
+
if (urlFilterTelemetryEmitted)
|
|
2245
|
+
return;
|
|
2246
|
+
urlFilterTelemetryEmitted = !0;
|
|
2247
|
+
let hasBuiltInTagFilters = initialIncluded.some((id) => BUILT_IN_TAG_IDS.has(id)) || initialExcluded.some((id) => BUILT_IN_TAG_IDS.has(id)), hasStatusFilters = initialIncludedStatuses.length > 0 || initialExcludedStatuses.length > 0;
|
|
2248
|
+
(hasBuiltInTagFilters || hasStatusFilters) && emitFilterTelemetry("url");
|
|
2249
|
+
} };
|
|
2250
|
+
};
|
|
2251
|
+
|
|
2252
|
+
// src/manager-api/modules/stories.ts
|
|
2253
|
+
var { fetch: fetch2 } = global, STORY_INDEX_PATH = "./index.json", applyUpdate = (indexes, id, update2) => {
|
|
2254
|
+
for (let index of indexes)
|
|
2255
|
+
index?.[id] && (index[id] = { ...index[id], ...update2 });
|
|
2256
|
+
}, init11 = ({
|
|
2257
|
+
fullAPI,
|
|
2258
|
+
store: store2,
|
|
2259
|
+
navigate,
|
|
2260
|
+
provider,
|
|
2261
|
+
state: { location: location2 } = {},
|
|
2262
|
+
storyId: initialStoryId,
|
|
2263
|
+
viewMode: initialViewMode,
|
|
2264
|
+
docsOptions = {}
|
|
2265
|
+
}) => {
|
|
2266
|
+
let navigateWithQueryParams = (path, options) => {
|
|
2267
|
+
let { customQueryParams } = store2.getState();
|
|
2268
|
+
navigate(buildNavigationUrl(path, customQueryParams ?? {}), options);
|
|
2269
|
+
}, canonicaliseUrl = () => {
|
|
2270
|
+
let { location: currentLocation, path, customQueryParams } = store2.getState(), pathname = currentLocation?.pathname;
|
|
2271
|
+
if (!pathname || queryFromLocation2(currentLocation).path)
|
|
2272
|
+
return;
|
|
2273
|
+
let resolved = fromUrlPath(pathname);
|
|
2274
|
+
if (resolved === "/" || resolved === path && toUrlPath(resolved) === pathname)
|
|
2275
|
+
return;
|
|
2276
|
+
let target = buildNavigationUrl(
|
|
2277
|
+
`${resolved}${currentLocation.hash ?? ""}`,
|
|
2278
|
+
customQueryParams ?? {}
|
|
2279
|
+
);
|
|
2280
|
+
navigate(target, { replace: !0 });
|
|
2281
|
+
}, filters = initFilters({
|
|
2282
|
+
store: store2,
|
|
2283
|
+
provider,
|
|
2284
|
+
fullAPI,
|
|
2285
|
+
location: location2,
|
|
2286
|
+
setIndex: (index) => api.setIndex(index)
|
|
2287
|
+
}), api = {
|
|
2288
|
+
...filters.api,
|
|
2289
|
+
storyId: toId,
|
|
2290
|
+
getData: (storyId, refId) => {
|
|
2291
|
+
let result = api.resolveStory(storyId, refId);
|
|
2292
|
+
if (result?.type === "story" || result?.type === "docs")
|
|
2293
|
+
return result;
|
|
2294
|
+
},
|
|
2295
|
+
isPrepared: (storyId, refId) => {
|
|
2296
|
+
let data = api.getData(storyId, refId);
|
|
2297
|
+
return data ? data.type === "story" ? data.prepared : !0 : !1;
|
|
2298
|
+
},
|
|
2299
|
+
resolveStory: (storyId, refId) => {
|
|
2300
|
+
let { refs, index } = store2.getState();
|
|
2301
|
+
if (!(refId && !refs[refId]))
|
|
2302
|
+
return refId ? refs?.[refId]?.index?.[storyId] ?? void 0 : index ? index[storyId] : void 0;
|
|
2303
|
+
},
|
|
2304
|
+
getCurrentStoryData: () => {
|
|
2305
|
+
let { storyId, refId } = store2.getState();
|
|
2306
|
+
return api.getData(storyId, refId);
|
|
2307
|
+
},
|
|
2308
|
+
getIndex: () => {
|
|
2309
|
+
let { internal_index } = store2.getState();
|
|
2310
|
+
return internal_index;
|
|
2311
|
+
},
|
|
2312
|
+
getParameters: (storyIdOrCombo, parameterName) => {
|
|
2313
|
+
let { storyId, refId } = typeof storyIdOrCombo == "string" ? { storyId: storyIdOrCombo, refId: void 0 } : storyIdOrCombo, data = api.getData(storyId, refId);
|
|
2314
|
+
if (["story", "docs"].includes(data?.type)) {
|
|
2315
|
+
let { parameters } = data;
|
|
2316
|
+
if (parameters)
|
|
2317
|
+
return parameterName ? parameters[parameterName] : parameters;
|
|
2318
|
+
}
|
|
2319
|
+
return null;
|
|
2320
|
+
},
|
|
2321
|
+
getCurrentParameter: (parameterName) => {
|
|
2322
|
+
let { storyId, refId } = store2.getState();
|
|
2323
|
+
return api.getParameters({ storyId, refId }, parameterName) || void 0;
|
|
2324
|
+
},
|
|
2325
|
+
jumpToComponent: (direction) => {
|
|
2326
|
+
let { filteredIndex, storyId, refs, refId } = store2.getState();
|
|
2327
|
+
if (!api.getData(storyId, refId))
|
|
2328
|
+
return;
|
|
2329
|
+
let hash = refId ? refs[refId].filteredIndex || {} : filteredIndex;
|
|
2330
|
+
if (!hash)
|
|
2042
2331
|
return;
|
|
2043
2332
|
let result = api.findSiblingStoryId(storyId, hash, direction, !0);
|
|
2044
2333
|
result && api.selectStory(result, void 0, { ref: refId });
|
|
@@ -2153,7 +2442,7 @@ var FILTER_KEYS = {
|
|
|
2153
2442
|
throw new Error(await result.text());
|
|
2154
2443
|
let storyIndex = await result.json();
|
|
2155
2444
|
if (storyIndex.v < 3) {
|
|
2156
|
-
|
|
2445
|
+
logger8.warn(`Skipping story index with version v${storyIndex.v}, awaiting SET_STORIES.`);
|
|
2157
2446
|
return;
|
|
2158
2447
|
}
|
|
2159
2448
|
await api.setIndex(storyIndex);
|
|
@@ -2165,10 +2454,10 @@ var FILTER_KEYS = {
|
|
|
2165
2454
|
// The story index we receive on fetchStoryIndex is not, but all the prepared fields are optional
|
|
2166
2455
|
// so we can cast one to the other easily enough
|
|
2167
2456
|
setIndex: async (input) => {
|
|
2168
|
-
let { filteredIndex: oldFilteredHash, index: oldHash, filters } = store2.getState(), allStatuses = fullStatusStore.getAll(), newFilteredHash = transformStoryIndexToStoriesHash(input, {
|
|
2457
|
+
let { filteredIndex: oldFilteredHash, index: oldHash, filters: filters2 } = store2.getState(), allStatuses = fullStatusStore.getAll(), newFilteredHash = transformStoryIndexToStoriesHash(input, {
|
|
2169
2458
|
provider,
|
|
2170
2459
|
docsOptions,
|
|
2171
|
-
filters,
|
|
2460
|
+
filters: filters2,
|
|
2172
2461
|
allStatuses,
|
|
2173
2462
|
statusFilterKey: STATUS_FILTER
|
|
2174
2463
|
}), newHash = transformStoryIndexToStoriesHash(input, {
|
|
@@ -2186,316 +2475,37 @@ var FILTER_KEYS = {
|
|
|
2186
2475
|
},
|
|
2187
2476
|
// FIXME: is there a bug where filtered stories get added back in on updateStory???
|
|
2188
2477
|
updateStory: async (storyId, update2, ref) => {
|
|
2189
|
-
|
|
2190
|
-
let { id: refId, index, filteredIndex } = ref, storyUpdates = {
|
|
2191
|
-
...ref.storyUpdates,
|
|
2192
|
-
[storyId]: { ...ref.storyUpdates?.[storyId], ...update2 }
|
|
2193
|
-
};
|
|
2194
|
-
index && index[storyId] && (index[storyId] = {
|
|
2195
|
-
...index[storyId],
|
|
2196
|
-
...update2
|
|
2197
|
-
}), filteredIndex && filteredIndex[storyId] && (filteredIndex[storyId] = {
|
|
2198
|
-
...filteredIndex[storyId],
|
|
2199
|
-
...update2
|
|
2200
|
-
}), await fullAPI.updateRef(refId, { index, filteredIndex, storyUpdates });
|
|
2201
|
-
} else {
|
|
2202
|
-
let { index, filteredIndex } = store2.getState();
|
|
2203
|
-
index && index[storyId] && (index[storyId] = {
|
|
2204
|
-
...index[storyId],
|
|
2205
|
-
...update2
|
|
2206
|
-
}), filteredIndex && filteredIndex[storyId] && (filteredIndex[storyId] = {
|
|
2207
|
-
...filteredIndex[storyId],
|
|
2208
|
-
...update2
|
|
2209
|
-
}), (index || filteredIndex) && await store2.setState({ index, filteredIndex });
|
|
2210
|
-
}
|
|
2478
|
+
await applyEntryUpdate(storyId, update2, ref);
|
|
2211
2479
|
},
|
|
2212
2480
|
updateDocs: async (docsId, update2, ref) => {
|
|
2213
|
-
|
|
2214
|
-
let { id: refId, index, filteredIndex } = ref, storyUpdates = {
|
|
2215
|
-
...ref.storyUpdates,
|
|
2216
|
-
[docsId]: { ...ref.storyUpdates?.[docsId], ...update2 }
|
|
2217
|
-
};
|
|
2218
|
-
index && index[docsId] && (index[docsId] = {
|
|
2219
|
-
...index[docsId],
|
|
2220
|
-
...update2
|
|
2221
|
-
}), filteredIndex && filteredIndex[docsId] && (filteredIndex[docsId] = {
|
|
2222
|
-
...filteredIndex[docsId],
|
|
2223
|
-
...update2
|
|
2224
|
-
}), await fullAPI.updateRef(refId, { index, filteredIndex, storyUpdates });
|
|
2225
|
-
} else {
|
|
2226
|
-
let { index, filteredIndex } = store2.getState();
|
|
2227
|
-
index && (index[docsId] = {
|
|
2228
|
-
...index[docsId],
|
|
2229
|
-
...update2
|
|
2230
|
-
}), filteredIndex && (filteredIndex[docsId] = {
|
|
2231
|
-
...filteredIndex[docsId],
|
|
2232
|
-
...update2
|
|
2233
|
-
}), (index || filteredIndex) && await store2.setState({ index, filteredIndex });
|
|
2234
|
-
}
|
|
2481
|
+
await applyEntryUpdate(docsId, update2, ref);
|
|
2235
2482
|
},
|
|
2236
2483
|
setPreviewInitialized: async (ref) => {
|
|
2237
2484
|
ref ? fullAPI.updateRef(ref.id, { previewInitialized: !0 }) : store2.setState({ previewInitialized: !0 });
|
|
2238
|
-
},
|
|
2239
|
-
setFilter: async (id, filterFunction) => {
|
|
2240
|
-
await api.setFilters({ [id]: filterFunction });
|
|
2241
|
-
},
|
|
2242
|
-
setFilters: async (filters) => {
|
|
2243
|
-
if (await store2.setState((state) => ({ filters: { ...state.filters, ...filters } })), !!await applyCurrentFilters())
|
|
2244
|
-
for (let id of Object.keys(filters))
|
|
2245
|
-
provider.channel?.emit(SET_FILTER, { id });
|
|
2246
|
-
},
|
|
2247
|
-
resetTagFilters: async () => {
|
|
2248
|
-
await persistFilters((s) => ({
|
|
2249
|
-
includedTagFilters: s.defaultIncludedTagFilters,
|
|
2250
|
-
excludedTagFilters: s.defaultExcludedTagFilters
|
|
2251
|
-
})), await recomputeTagsFilter();
|
|
2252
|
-
},
|
|
2253
|
-
setAllTagFilters: async (included, excluded) => {
|
|
2254
|
-
await persistFilters({ includedTagFilters: included, excludedTagFilters: excluded }), await recomputeTagsFilter();
|
|
2255
|
-
},
|
|
2256
|
-
addTagFilters: async (tags2, excluded) => {
|
|
2257
|
-
await addFilters("tag", tags2, excluded), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
|
|
2258
|
-
filterType: "tag",
|
|
2259
|
-
filterId: tags2[0],
|
|
2260
|
-
action: excluded ? "exclude" : "include"
|
|
2261
|
-
});
|
|
2262
|
-
},
|
|
2263
|
-
removeTagFilters: async (tags2) => {
|
|
2264
|
-
await removeFilters("tag", tags2), await recomputeTagsFilter(), tags2.length === 1 && BUILT_IN_TAG_IDS.has(tags2[0]) && emitFilterTelemetry("interaction", {
|
|
2265
|
-
filterType: "tag",
|
|
2266
|
-
filterId: tags2[0],
|
|
2267
|
-
action: "remove"
|
|
2268
|
-
});
|
|
2269
|
-
},
|
|
2270
|
-
resetStatusFilters: async () => {
|
|
2271
|
-
await persistFilters({ includedStatusFilters: [], excludedStatusFilters: [] }), await recomputeStatusFilter();
|
|
2272
|
-
},
|
|
2273
|
-
setAllStatusFilters: async (included, excluded) => {
|
|
2274
|
-
let prevState = store2.getState(), prevIncluded = new Set(prevState.includedStatusFilters ?? []), prevExcluded = new Set(prevState.excludedStatusFilters ?? []), nextIncluded = new Set(included), nextExcluded = new Set(excluded);
|
|
2275
|
-
await persistFilters({ includedStatusFilters: included, excludedStatusFilters: excluded }), await recomputeStatusFilter();
|
|
2276
|
-
let changedIds = /* @__PURE__ */ new Set([
|
|
2277
|
-
...prevIncluded,
|
|
2278
|
-
...prevExcluded,
|
|
2279
|
-
...nextIncluded,
|
|
2280
|
-
...nextExcluded
|
|
2281
|
-
]);
|
|
2282
|
-
for (let id of changedIds) {
|
|
2283
|
-
let wasIncluded = prevIncluded.has(id), wasExcluded = prevExcluded.has(id), isIncluded = nextIncluded.has(id), isExcluded = nextExcluded.has(id);
|
|
2284
|
-
if (wasIncluded === isIncluded && wasExcluded === isExcluded)
|
|
2285
|
-
continue;
|
|
2286
|
-
let action;
|
|
2287
|
-
isIncluded ? action = "include" : isExcluded ? action = "exclude" : action = "remove", emitFilterTelemetry("interaction", {
|
|
2288
|
-
filterType: "status",
|
|
2289
|
-
filterId: id,
|
|
2290
|
-
action
|
|
2291
|
-
});
|
|
2292
|
-
}
|
|
2293
|
-
},
|
|
2294
|
-
addStatusFilters: async (statuses2, excluded) => {
|
|
2295
|
-
await addFilters("status", statuses2, excluded), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
|
|
2296
|
-
filterType: "status",
|
|
2297
|
-
filterId: statuses2[0],
|
|
2298
|
-
action: excluded ? "exclude" : "include"
|
|
2299
|
-
});
|
|
2300
|
-
},
|
|
2301
|
-
removeStatusFilters: async (statuses2) => {
|
|
2302
|
-
await removeFilters("status", statuses2), await recomputeStatusFilter(), statuses2.length === 1 && emitFilterTelemetry("interaction", {
|
|
2303
|
-
filterType: "status",
|
|
2304
|
-
filterId: statuses2[0],
|
|
2305
|
-
action: "remove"
|
|
2306
|
-
});
|
|
2307
|
-
}
|
|
2308
|
-
}, applyCurrentFilters = async () => {
|
|
2309
|
-
let { internal_index: index } = store2.getState();
|
|
2310
|
-
if (!index)
|
|
2311
|
-
return !1;
|
|
2312
|
-
await api.setIndex(index);
|
|
2313
|
-
let refs = await fullAPI.getRefs();
|
|
2314
|
-
for (let [refId, { internal_index, ...ref }] of Object.entries(refs))
|
|
2315
|
-
await fullAPI.setRef(refId, { ...ref, storyIndex: internal_index }, !0);
|
|
2316
|
-
return !0;
|
|
2317
|
-
}, statusFilterRebuildQueued = !1, statusFilterRebuildInFlight = !1, flushStatusFilterRebuild = async () => {
|
|
2318
|
-
if (!statusFilterRebuildInFlight) {
|
|
2319
|
-
statusFilterRebuildInFlight = !0;
|
|
2320
|
-
try {
|
|
2321
|
-
for (; statusFilterRebuildQueued; ) {
|
|
2322
|
-
statusFilterRebuildQueued = !1;
|
|
2323
|
-
try {
|
|
2324
|
-
await applyCurrentFilters();
|
|
2325
|
-
} catch (error) {
|
|
2326
|
-
logger7.warn("Failed to rebuild story index after status change:", error);
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
} finally {
|
|
2330
|
-
statusFilterRebuildInFlight = !1, statusFilterRebuildQueued && flushStatusFilterRebuild();
|
|
2331
|
-
}
|
|
2332
|
-
}
|
|
2333
|
-
}, requestStatusFilterRebuild = () => {
|
|
2334
|
-
statusFilterRebuildQueued = !0, flushStatusFilterRebuild();
|
|
2335
|
-
}, recomputeTagsFilter = () => {
|
|
2336
|
-
let { includedTagFilters, excludedTagFilters } = store2.getState();
|
|
2337
|
-
return api.setFilters({
|
|
2338
|
-
[TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters)
|
|
2339
|
-
});
|
|
2340
|
-
}, recomputeStatusFilter = () => {
|
|
2341
|
-
let { includedStatusFilters, excludedStatusFilters } = store2.getState();
|
|
2342
|
-
return api.setFilters({
|
|
2343
|
-
[STATUS_FILTER]: computeStatusFilterFn(
|
|
2344
|
-
includedStatusFilters ?? [],
|
|
2345
|
-
excludedStatusFilters ?? []
|
|
2346
|
-
)
|
|
2347
|
-
});
|
|
2348
|
-
};
|
|
2349
|
-
provider.channel?.on(
|
|
2350
|
-
STORY_SPECIFIED,
|
|
2351
|
-
function({
|
|
2352
|
-
storyId,
|
|
2353
|
-
viewMode
|
|
2354
|
-
}) {
|
|
2355
|
-
let { sourceType } = getEventMetadata(this, fullAPI);
|
|
2356
|
-
if (sourceType === "local") {
|
|
2357
|
-
let state = store2.getState(), isCanvasRoute = !isReviewManagerRoute(state.path, state.customQueryParams) && (state.path === "/" || state.viewMode === "story" || state.viewMode === "docs"), stateHasSelection = state.viewMode && state.storyId, stateSelectionDifferent = state.viewMode !== viewMode || state.storyId !== storyId, { type } = state.index?.[state.storyId] || {}, isStory = !(type === "root" || type === "component" || type === "group");
|
|
2358
|
-
if (isCanvasRoute) {
|
|
2359
|
-
let { filteredIndex } = state;
|
|
2360
|
-
if (filteredIndex && !stateHasSelection && !(filteredIndex[storyId]?.type === "story")) {
|
|
2361
|
-
let firstFiltered = filteredIndex ? Object.keys(filteredIndex).find((id) => {
|
|
2362
|
-
let entry = filteredIndex[id];
|
|
2363
|
-
return entry.type === "story" || entry.type === "docs";
|
|
2364
|
-
}) : void 0;
|
|
2365
|
-
firstFiltered && navigateWithQueryParams(`/${viewMode}/${firstFiltered}`);
|
|
2366
|
-
return;
|
|
2367
|
-
}
|
|
2368
|
-
stateHasSelection && stateSelectionDifferent && isStory ? provider.channel?.emit(SET_CURRENT_STORY, {
|
|
2369
|
-
storyId: state.storyId,
|
|
2370
|
-
viewMode: state.viewMode
|
|
2371
|
-
}) : stateSelectionDifferent && navigateWithQueryParams(`/${viewMode}/${storyId}`);
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
), provider.channel?.on(CURRENT_STORY_WAS_SET, function() {
|
|
2376
|
-
let { ref } = getEventMetadata(this, fullAPI);
|
|
2377
|
-
api.setPreviewInitialized(ref);
|
|
2378
|
-
}), provider.channel?.on(STORY_CHANGED, function() {
|
|
2379
|
-
let { sourceType } = getEventMetadata(this, fullAPI);
|
|
2380
|
-
if (sourceType === "local") {
|
|
2381
|
-
let options = api.getCurrentParameter("options");
|
|
2382
|
-
options && fullAPI.setOptions(removeRemovedOptions(options));
|
|
2383
2485
|
}
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
let { options } = update2.parameters;
|
|
2390
|
-
fullAPI.setOptions(removeRemovedOptions(options)), store2.setState({ hasCalledSetOptions: !0 });
|
|
2391
|
-
}
|
|
2392
|
-
if (sourceType === "local") {
|
|
2393
|
-
let { storyId, index, refId } = store2.getState();
|
|
2394
|
-
if (!index)
|
|
2395
|
-
return;
|
|
2396
|
-
let toBePreloaded = Array.from(
|
|
2397
|
-
/* @__PURE__ */ new Set([
|
|
2398
|
-
api.findSiblingStoryId(storyId, index, 1, !0),
|
|
2399
|
-
api.findSiblingStoryId(storyId, index, -1, !0)
|
|
2400
|
-
])
|
|
2401
|
-
).filter(Boolean);
|
|
2402
|
-
provider.channel?.emit(PRELOAD_ENTRIES, {
|
|
2403
|
-
ids: toBePreloaded,
|
|
2404
|
-
options: { target: refId }
|
|
2405
|
-
});
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
), provider.channel?.on(
|
|
2409
|
-
DOCS_PREPARED,
|
|
2410
|
-
function({ id, ...update2 }) {
|
|
2411
|
-
let { ref } = getEventMetadata(this, fullAPI);
|
|
2412
|
-
api.updateStory(id, { ...update2, prepared: !0 }, ref);
|
|
2413
|
-
}
|
|
2414
|
-
), provider.channel?.on(SET_INDEX, function(index) {
|
|
2415
|
-
let { ref } = getEventMetadata(this, fullAPI);
|
|
2416
|
-
if (ref)
|
|
2417
|
-
fullAPI.setRef(ref.id, { ...ref, storyIndex: index }, !0);
|
|
2418
|
-
else {
|
|
2419
|
-
api.setIndex(index);
|
|
2420
|
-
let options = api.getCurrentParameter("options");
|
|
2421
|
-
fullAPI.setOptions(removeRemovedOptions(options));
|
|
2422
|
-
}
|
|
2423
|
-
}), provider.channel?.on(SET_STORIES, function(data) {
|
|
2424
|
-
let { ref } = getEventMetadata(this, fullAPI), setStoriesData = data.v ? denormalizeStoryParameters(data) : data.stories;
|
|
2425
|
-
if (ref)
|
|
2426
|
-
fullAPI.setRef(ref.id, { ...ref, setStoriesData }, !0);
|
|
2427
|
-
else
|
|
2428
|
-
throw new Error("Cannot call SET_STORIES for local frame");
|
|
2429
|
-
}), provider.channel?.on(
|
|
2430
|
-
SELECT_STORY,
|
|
2431
|
-
function({
|
|
2432
|
-
kind,
|
|
2433
|
-
title = kind,
|
|
2434
|
-
story,
|
|
2435
|
-
name = story,
|
|
2436
|
-
storyId,
|
|
2437
|
-
...rest
|
|
2438
|
-
}) {
|
|
2439
|
-
let { ref } = getEventMetadata(this, fullAPI);
|
|
2440
|
-
ref ? fullAPI.selectStory(storyId || title, name, { ...rest, ref: ref.id }) : fullAPI.selectStory(storyId || title, name, rest);
|
|
2441
|
-
}
|
|
2442
|
-
), provider.channel?.on(
|
|
2443
|
-
STORY_ARGS_UPDATED,
|
|
2444
|
-
function({ storyId, args }) {
|
|
2445
|
-
let { ref } = getEventMetadata(this, fullAPI);
|
|
2446
|
-
api.updateStory(storyId, { args }, ref);
|
|
2486
|
+
}, applyEntryUpdate = async (id, update2, ref) => {
|
|
2487
|
+
if (!ref) {
|
|
2488
|
+
let { index: index2, filteredIndex: filteredIndex2 } = store2.getState();
|
|
2489
|
+
applyUpdate([index2, filteredIndex2], id, update2), (index2 || filteredIndex2) && await store2.setState({ index: index2, filteredIndex: filteredIndex2 });
|
|
2490
|
+
return;
|
|
2447
2491
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
api.setPreviewInitialized(ref);
|
|
2454
|
-
}), provider.channel?.on(SET_CONFIG3, async () => {
|
|
2455
|
-
let {
|
|
2456
|
-
includedTagFilters,
|
|
2457
|
-
excludedTagFilters,
|
|
2458
|
-
includedStatusFilters,
|
|
2459
|
-
excludedStatusFilters,
|
|
2460
|
-
tagPresets: tagPresets2
|
|
2461
|
-
} = store2.getState();
|
|
2462
|
-
await api.setFilters({
|
|
2463
|
-
[STATIC_FILTER]: computeStaticFilterFn(tagPresets2),
|
|
2464
|
-
[TAGS_FILTER]: computeTagsFilterFn(includedTagFilters, excludedTagFilters),
|
|
2465
|
-
[STATUS_FILTER]: computeStatusFilterFn(includedStatusFilters, excludedStatusFilters)
|
|
2466
|
-
});
|
|
2467
|
-
}), fullStatusStore.onAllStatusChange(
|
|
2468
|
-
throttle(requestStatusFilterRebuild, STATUS_CHANGE_REBUILD_THROTTLE, {
|
|
2469
|
-
edges: ["leading", "trailing"]
|
|
2470
|
-
})
|
|
2471
|
-
);
|
|
2472
|
-
let tagPresets = global.TAGS_OPTIONS || {}, defaultTags = getDefaultTagsFromPreset(tagPresets), { tags, statuses } = queryFromLocation(location2 ?? { search: "" }), parsedTags = parseTagsParam(tags), hasTagsParam = tags !== void 0, initialIncluded = hasTagsParam ? parsedTags.included : defaultTags.included, initialExcluded = hasTagsParam ? parsedTags.excluded : defaultTags.excluded, parsedStatuses = parseStatusesParam(statuses), initialIncludedStatuses = parsedStatuses.included, initialExcludedStatuses = parsedStatuses.excluded, initialFilters = {
|
|
2473
|
-
[STATIC_FILTER]: computeStaticFilterFn(tagPresets),
|
|
2474
|
-
[TAGS_FILTER]: computeTagsFilterFn(initialIncluded, initialExcluded),
|
|
2475
|
-
[STATUS_FILTER]: computeStatusFilterFn(initialIncludedStatuses, initialExcludedStatuses)
|
|
2492
|
+
let { id: refId, index, filteredIndex } = ref, storyUpdates = {
|
|
2493
|
+
...ref.storyUpdates,
|
|
2494
|
+
[id]: { ...ref.storyUpdates?.[id], ...update2 }
|
|
2495
|
+
};
|
|
2496
|
+
applyUpdate([index, filteredIndex], id, update2), await fullAPI.updateRef(refId, { index, filteredIndex, storyUpdates });
|
|
2476
2497
|
};
|
|
2477
|
-
return {
|
|
2498
|
+
return listenToStoryEvents({ store: store2, provider, fullAPI, api, navigateWithQueryParams }), {
|
|
2478
2499
|
api,
|
|
2479
2500
|
state: {
|
|
2480
2501
|
storyId: initialStoryId,
|
|
2481
2502
|
viewMode: initialViewMode,
|
|
2482
2503
|
hasCalledSetOptions: !1,
|
|
2483
2504
|
previewInitialized: !1,
|
|
2484
|
-
filters
|
|
2485
|
-
tagPresets,
|
|
2486
|
-
defaultIncludedTagFilters: defaultTags.included,
|
|
2487
|
-
defaultExcludedTagFilters: defaultTags.excluded,
|
|
2488
|
-
includedTagFilters: initialIncluded,
|
|
2489
|
-
excludedTagFilters: initialExcluded,
|
|
2490
|
-
includedStatusFilters: initialIncludedStatuses,
|
|
2491
|
-
excludedStatusFilters: initialExcludedStatuses
|
|
2505
|
+
...filters.state
|
|
2492
2506
|
},
|
|
2493
2507
|
init: async () => {
|
|
2494
|
-
|
|
2495
|
-
return;
|
|
2496
|
-
urlFilterTelemetryEmitted = !0;
|
|
2497
|
-
let hasBuiltInTagFilters = initialIncluded.some((id) => BUILT_IN_TAG_IDS.has(id)) || initialExcluded.some((id) => BUILT_IN_TAG_IDS.has(id)), hasStatusFilters = initialIncludedStatuses.length > 0 || initialExcludedStatuses.length > 0;
|
|
2498
|
-
(hasBuiltInTagFilters || hasStatusFilters) && emitFilterTelemetry("url");
|
|
2508
|
+
provider.channel?.on(STORY_INDEX_INVALIDATED, () => api.fetchIndex()), await api.fetchIndex(), filters.emitUrlFilterTelemetry();
|
|
2499
2509
|
}
|
|
2500
2510
|
};
|
|
2501
2511
|
};
|
|
@@ -2516,7 +2526,7 @@ import {
|
|
|
2516
2526
|
import {
|
|
2517
2527
|
buildArgsParam,
|
|
2518
2528
|
buildManagerHref,
|
|
2519
|
-
queryFromLocation as
|
|
2529
|
+
queryFromLocation as queryFromLocation3
|
|
2520
2530
|
} from "@aussieljk/forkbook/internal/router";
|
|
2521
2531
|
var parseBoolean = (value) => {
|
|
2522
2532
|
if (value === "true" || value === "1")
|
|
@@ -2531,17 +2541,17 @@ var parseBoolean = (value) => {
|
|
|
2531
2541
|
}, resolveIframeUrl = (baseUrl, { absolute }) => {
|
|
2532
2542
|
let resolved = new URL("iframe.html", baseUrl);
|
|
2533
2543
|
return absolute ? resolved.href : `${resolved.pathname}${resolved.search}${resolved.hash}`;
|
|
2534
|
-
}, LAYOUT_QUERY_PARAM_KEYS = ["full", "panel", "nav", "shortcuts", "addonPanel", "tabs", "path"], getCustomQueryParams = (location2) => omit(
|
|
2544
|
+
}, LAYOUT_QUERY_PARAM_KEYS = ["full", "panel", "nav", "shortcuts", "addonPanel", "tabs", "path"], getCustomQueryParams = (location2) => omit(queryFromLocation3(location2), LAYOUT_QUERY_PARAM_KEYS), prevParams, initialUrlSupport = ({
|
|
2535
2545
|
state: { location: location2, path, viewMode, storyId: storyIdFromUrl },
|
|
2536
2546
|
singleStory
|
|
2537
2547
|
}) => {
|
|
2538
|
-
let { full, panel, nav, shortcuts, addonPanel } =
|
|
2548
|
+
let { full, panel, nav, shortcuts, addonPanel } = queryFromLocation3(location2), navSize, bottomPanelHeight, rightPanelWidth;
|
|
2539
2549
|
parseBoolean(full) === !0 ? (navSize = 0, bottomPanelHeight = 0, rightPanelWidth = 0) : parseBoolean(full) === !1 && (navSize = DEFAULT_NAV_SIZE, bottomPanelHeight = DEFAULT_BOTTOM_PANEL_HEIGHT, rightPanelWidth = DEFAULT_RIGHT_PANEL_WIDTH), singleStory || (parseBoolean(nav) === !0 && (navSize = DEFAULT_NAV_SIZE), parseBoolean(nav) === !1 && (navSize = 0)), parseBoolean(panel) === !1 && (bottomPanelHeight = 0, rightPanelWidth = 0);
|
|
2540
2550
|
let layout = {
|
|
2541
2551
|
navSize,
|
|
2542
2552
|
bottomPanelHeight,
|
|
2543
2553
|
rightPanelWidth,
|
|
2544
|
-
panelPosition:
|
|
2554
|
+
panelPosition: panel === "right" || panel === "bottom" ? panel : void 0
|
|
2545
2555
|
}, ui = {
|
|
2546
2556
|
enableShortcuts: parseBoolean(shortcuts)
|
|
2547
2557
|
}, selectedPanel = addonPanel || void 0, storyId = storyIdFromUrl, otherParams = getCustomQueryParams(location2), customQueryParams = isEqual(prevParams, otherParams) ? prevParams : otherParams;
|
|
@@ -2584,13 +2594,12 @@ var parseBoolean = (value) => {
|
|
|
2584
2594
|
return customQueryParams ? customQueryParams[key] : void 0;
|
|
2585
2595
|
},
|
|
2586
2596
|
getUrlState() {
|
|
2587
|
-
let { location: location2, path, customQueryParams, storyId,
|
|
2597
|
+
let { location: location2, path, customQueryParams, storyId, viewMode } = store2.getState();
|
|
2588
2598
|
return {
|
|
2589
2599
|
path,
|
|
2590
2600
|
hash: location2?.hash ?? "",
|
|
2591
2601
|
queryParams: customQueryParams,
|
|
2592
2602
|
storyId,
|
|
2593
|
-
url,
|
|
2594
2603
|
viewMode
|
|
2595
2604
|
};
|
|
2596
2605
|
},
|
|
@@ -2621,14 +2630,17 @@ var parseBoolean = (value) => {
|
|
|
2621
2630
|
let handleOrId;
|
|
2622
2631
|
return provider.channel?.on(STORY_ARGS_UPDATED2, () => {
|
|
2623
2632
|
"requestIdleCallback" in global.window ? (handleOrId && global.window.cancelIdleCallback(handleOrId), handleOrId = global.window.requestIdleCallback(updateArgsParam, { timeout: 1e3 })) : (handleOrId && clearTimeout(handleOrId), setTimeout(updateArgsParam, 100));
|
|
2624
|
-
}), provider.channel?.on(
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2633
|
+
}), provider.channel?.on(
|
|
2634
|
+
GLOBALS_UPDATED2,
|
|
2635
|
+
({ userGlobals, initialGlobals }) => {
|
|
2636
|
+
let { path, hash = "", queryParams } = api.getUrlState(), globalsString = buildArgsParam(initialGlobals, merge_default(initialGlobals, userGlobals));
|
|
2637
|
+
navigateTo(
|
|
2638
|
+
`${path}${hash}`,
|
|
2639
|
+
{ ...queryParams, globals: globalsString || null },
|
|
2640
|
+
{ replace: !0 }
|
|
2641
|
+
), api.setQueryParams({ globals: globalsString || null });
|
|
2642
|
+
}
|
|
2643
|
+
), provider.channel?.on(NAVIGATE_URL, (url, options) => {
|
|
2632
2644
|
api.navigateUrl(url, options);
|
|
2633
2645
|
}), {
|
|
2634
2646
|
api,
|
|
@@ -2783,13 +2795,7 @@ var import_store2 = __toESM(require_store2(), 1);
|
|
|
2783
2795
|
// src/manager-api/lib/store-setup.ts
|
|
2784
2796
|
var store_setup_default = (_) => {
|
|
2785
2797
|
_.fn("set", function(key, data) {
|
|
2786
|
-
return _.set(
|
|
2787
|
-
// @ts-expect-error('this' implicitly has type 'any')
|
|
2788
|
-
this._area,
|
|
2789
|
-
// @ts-expect-error('this' implicitly has type 'any')
|
|
2790
|
-
this._in(key),
|
|
2791
|
-
stringify2(data, { maxDepth: 50 })
|
|
2792
|
-
);
|
|
2798
|
+
return _.set(this._area, this._in(key), stringify2(data, { maxDepth: 50 }));
|
|
2793
2799
|
}), _.fn("get", function(key, alt) {
|
|
2794
2800
|
let value = _.get(this._area, this._in(key));
|
|
2795
2801
|
return value !== null ? parse(value) : alt || value;
|
|
@@ -2887,7 +2893,7 @@ var ManagerContext = createContext({ api: void 0, state: initial_state_default({
|
|
|
2887
2893
|
this.mounted = !1;
|
|
2888
2894
|
this.initModules = () => {
|
|
2889
2895
|
this.modules.forEach((module) => {
|
|
2890
|
-
|
|
2896
|
+
module.init?.();
|
|
2891
2897
|
});
|
|
2892
2898
|
};
|
|
2893
2899
|
let {
|
|
@@ -2906,7 +2912,13 @@ var ManagerContext = createContext({ api: void 0, state: initial_state_default({
|
|
|
2906
2912
|
let patch = typeof stateChange == "function" ? stateChange(this.state) : stateChange;
|
|
2907
2913
|
return this.state = { ...this.state, ...patch }, callback?.(this.state), this.state;
|
|
2908
2914
|
}
|
|
2909
|
-
return this.setState(
|
|
2915
|
+
return this.setState(
|
|
2916
|
+
(state2) => ({
|
|
2917
|
+
...state2,
|
|
2918
|
+
...typeof stateChange == "function" ? stateChange(state2) : stateChange
|
|
2919
|
+
}),
|
|
2920
|
+
() => callback(this.state)
|
|
2921
|
+
), this.state;
|
|
2910
2922
|
}
|
|
2911
2923
|
}), routeData = { location: location2, path, viewMode, singleStory, storyId, refId }, optionsData = { docsOptions };
|
|
2912
2924
|
this.state = store2.getInitialState(initial_state_default({ ...routeData, ...optionsData }));
|
|
@@ -2966,14 +2978,13 @@ var ManagerContext = createContext({ api: void 0, state: initial_state_default({
|
|
|
2966
2978
|
ManagerProvider.displayName = "Manager";
|
|
2967
2979
|
var EffectOnMount = ({ children, effect }) => (React2.useEffect(effect, []), children), defaultFilter = (c) => c;
|
|
2968
2980
|
function ManagerConsumer({
|
|
2969
|
-
// @ts-expect-error (Converted from ts-ignore)
|
|
2970
2981
|
filter = defaultFilter,
|
|
2971
2982
|
children
|
|
2972
2983
|
}) {
|
|
2973
2984
|
let managerContext = useContext(ManagerContext), renderer = useRef2(children), filterer = useRef2(filter);
|
|
2974
2985
|
if (typeof renderer.current != "function")
|
|
2975
2986
|
return jsx3(Fragment, { children: renderer.current });
|
|
2976
|
-
let comboData = filterer.current(managerContext), comboDataArray = useMemo(() =>
|
|
2987
|
+
let comboData = filterer.current(managerContext), comboDataArray = useMemo(() => Object.entries(comboData).flat(), [managerContext.state]);
|
|
2977
2988
|
return useMemo(() => {
|
|
2978
2989
|
let Child = renderer.current;
|
|
2979
2990
|
return jsx3(Child, { ...comboData });
|
|
@@ -3015,12 +3026,9 @@ function useParameter(parameterKey, defaultValue) {
|
|
|
3015
3026
|
globalThis.FORKBOOK_ADDON_STATE = {};
|
|
3016
3027
|
var { FORKBOOK_ADDON_STATE } = globalThis;
|
|
3017
3028
|
function useSharedState(stateId, defaultState) {
|
|
3018
|
-
let api = useStorybookApi(), existingState = api.getAddonState(stateId) ||
|
|
3019
|
-
existingState,
|
|
3020
|
-
FORKBOOK_ADDON_STATE[stateId] ? FORKBOOK_ADDON_STATE[stateId] : defaultState
|
|
3021
|
-
), quicksync = !1;
|
|
3029
|
+
let api = useStorybookApi(), getCachedState = () => FORKBOOK_ADDON_STATE[stateId], existingState = api.getAddonState(stateId) || getCachedState(), state = orDefault(existingState, getCachedState() || defaultState), quicksync = !1;
|
|
3022
3030
|
state === defaultState && defaultState !== void 0 && (FORKBOOK_ADDON_STATE[stateId] = defaultState, quicksync = !0), useEffect(() => {
|
|
3023
|
-
quicksync && api.setAddonState(stateId, defaultState);
|
|
3031
|
+
quicksync && defaultState !== void 0 && api.setAddonState(stateId, defaultState);
|
|
3024
3032
|
}, [quicksync]);
|
|
3025
3033
|
let setState = useCallback2(
|
|
3026
3034
|
async (s, options) => {
|
|
@@ -3035,8 +3043,8 @@ function useSharedState(stateId, defaultState) {
|
|
|
3035
3043
|
[`${SHARED_STATE_SET}-client-${stateId}`]: setState
|
|
3036
3044
|
}, stateInitializationHandlers = {
|
|
3037
3045
|
[SET_STORIES2]: async () => {
|
|
3038
|
-
let currentState = api.getAddonState(stateId);
|
|
3039
|
-
currentState ? (FORKBOOK_ADDON_STATE[stateId] = currentState, api.emit(`${SHARED_STATE_SET}-manager-${stateId}`, currentState)) :
|
|
3046
|
+
let currentState = api.getAddonState(stateId), cachedState = getCachedState();
|
|
3047
|
+
currentState ? (FORKBOOK_ADDON_STATE[stateId] = currentState, api.emit(`${SHARED_STATE_SET}-manager-${stateId}`, currentState)) : cachedState ? (await setState(cachedState), api.emit(`${SHARED_STATE_SET}-manager-${stateId}`, getCachedState())) : defaultState !== void 0 && (await setState(defaultState), FORKBOOK_ADDON_STATE[stateId] = defaultState, api.emit(`${SHARED_STATE_SET}-manager-${stateId}`, defaultState));
|
|
3040
3048
|
},
|
|
3041
3049
|
[STORY_CHANGED2]: () => {
|
|
3042
3050
|
let currentState = api.getAddonState(stateId);
|
|
@@ -3098,6 +3106,7 @@ var MockUniversalStore = class _MockUniversalStore extends UniversalStore {
|
|
|
3098
3106
|
), UniversalStore.isInternalConstructing = !1, typeof testUtils?.fn == "function" && (this.testUtils = testUtils, this.getState = testUtils.fn(this.getState), this.setState = testUtils.fn(this.setState), this.subscribe = testUtils.fn(this.subscribe), this.onStateChange = testUtils.fn(this.onStateChange), this.send = testUtils.fn(this.send));
|
|
3099
3107
|
}
|
|
3100
3108
|
/** Create a mock universal store. This is just an alias for the constructor */
|
|
3109
|
+
// `State = any`: as in `UniversalStore.create`, a store made without a state type takes any state.
|
|
3101
3110
|
static create(options, testUtils) {
|
|
3102
3111
|
return new _MockUniversalStore(options, testUtils);
|
|
3103
3112
|
}
|
|
@@ -3174,7 +3183,13 @@ function createTestProviderStore({
|
|
|
3174
3183
|
getTestProviderStoreById: getTestProviderStoreById2,
|
|
3175
3184
|
fullTestProviderStore: fullTestProviderStore2,
|
|
3176
3185
|
universalTestProviderStore: universalTestProviderStore2,
|
|
3177
|
-
useTestProviderStore: (selector) =>
|
|
3186
|
+
useTestProviderStore: (selector) => (
|
|
3187
|
+
// The hook also runs without a selector and then returns the whole state.
|
|
3188
|
+
useUniversalStore2(
|
|
3189
|
+
universalTestProviderStore2,
|
|
3190
|
+
selector
|
|
3191
|
+
)[0]
|
|
3192
|
+
)
|
|
3178
3193
|
} : {
|
|
3179
3194
|
getTestProviderStoreById: getTestProviderStoreById2,
|
|
3180
3195
|
fullTestProviderStore: fullTestProviderStore2,
|