zidane-gui 9.0.3 → 9.1.1
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/out/main/chunks/{dev-extension-D5os9z0A.js → dev-extension-CjcEOYly.js} +10 -9
- package/out/main/chunks/extension-watch-Bk_X4gTf.js +93 -0
- package/out/main/chunks/{history-pager-DUFgTrih.js → history-pager-B5iwhWqn.js} +44 -7
- package/out/main/chunks/idle-collect-ZgTY7fw2.js +33 -0
- package/out/main/chunks/{remote-hosts-DlvE2ELX.js → remote-hosts-DmiOiwKi.js} +41 -1
- package/out/main/chunks/{session-search-sql-BrNTuwjH.js → session-search-sql-BaBnjEgm.js} +4 -4
- package/out/main/chunks/{tool-results-sql-C0MqWcQc.js → tool-results-sql-CVleIS51.js} +1 -1
- package/out/main/chunks/transcript-sql-DfsO-a4Q.js +27 -0
- package/out/main/extension-worker.js +52 -0
- package/out/main/git-watch-worker.js +21 -0
- package/out/main/history-worker.js +6 -3
- package/out/main/index.js +7614 -4263
- package/out/main/session-search-worker.js +18 -13
- package/out/main/tool-results-worker.js +18 -13
- package/out/main/update-worker.js +6 -0
- package/out/main/usage-worker.js +4 -1
- package/out/preload/index.mjs +49 -6
- package/out/renderer/assets/2CHDFZHC-B7OS2WPy.js +76 -0
- package/out/renderer/assets/43YPWK3Q-C1KxyhBe.js +297 -0
- package/out/renderer/assets/45MVAN6X-uedsCyvs.js +227 -0
- package/out/renderer/assets/46GJKBLZ-DqRDtmyU.js +362 -0
- package/out/renderer/assets/5THPTBWS-2mBFupjU.js +21 -0
- package/out/renderer/assets/63WH7YNF-E23uJkxY.js +1519 -0
- package/out/renderer/assets/6DDU7VKX-BnYMT-fZ.js +139 -0
- package/out/renderer/assets/7WLXJQOR-C8MM6Bra.js +23 -0
- package/out/renderer/assets/CLQLV5VT-BsAy1F0L.js +1159 -0
- package/out/renderer/assets/CUSPXG5M-BndthcFo.js +233 -0
- package/out/renderer/assets/{CodeEditor-in2F3Rz-.js → CodeEditor-Bc2yVqNr.js} +404 -744
- package/out/renderer/assets/{ComposerEditor-DzKoxH6Z.js → ComposerEditor-B4wmjkXE.js} +6 -7
- package/out/renderer/assets/D3L7O4X2-LfFKkl0g.js +194 -0
- package/out/renderer/assets/D5TW5CPZ-BUXfpU2q.js +21 -0
- package/out/renderer/assets/DKTLEL5E-Dj3316cp.js +42 -0
- package/out/renderer/assets/{DiffsTab-Ceh4E5wW.js → DiffsTab-BHaJc7Ve.js} +43 -26
- package/out/renderer/assets/EGADTWYV-giCCF2cw.js +292 -0
- package/out/renderer/assets/EOJSJZXM-B9xc3U2A.js +1137 -0
- package/out/renderer/assets/{EditorWorkers-Bhv2OJRb.js → EditorWorkers-DABG5YG9.js} +9 -11
- package/out/renderer/assets/FTXIJQGB-BX14b7pN.js +13 -0
- package/out/renderer/assets/{FileIcon-CYgGSQ59.js → FileIcon-acads6Ac.js} +1 -1
- package/out/renderer/assets/{FilesTab-DESQMqGK.js → FilesTab-CyWw9vW2.js} +70 -28
- package/out/renderer/assets/G2OEIG6X-hZmo0wrY.js +519 -0
- package/out/renderer/assets/G3MDBVQH-qZ3yfAIw.js +25 -0
- package/out/renderer/assets/GXJ2T77W-Dx1MA_On.js +445 -0
- package/out/renderer/assets/HX3UMAK7-DcJt6NaE.js +177 -0
- package/out/renderer/assets/IU7WZTP6-BZMu2vL3.js +137 -0
- package/out/renderer/assets/J5J2NR2G-CbQLnnZq.js +673 -0
- package/out/renderer/assets/JRCWTJEL-xEOyWDIN.js +419 -0
- package/out/renderer/assets/KHUP5TOH-032p46g-.js +359 -0
- package/out/renderer/assets/L74FQTH5-CQ_54hNm.js +994 -0
- package/out/renderer/assets/LAV4ZXOS-DvhVMhLR.js +968 -0
- package/out/renderer/assets/LBIZYCRR-CMaDdulz.js +715 -0
- package/out/renderer/assets/LFFXNLRS-BjbqzBYN.js +377 -0
- package/out/renderer/assets/LLLWOAQD-B2zZRpRf.js +409 -0
- package/out/renderer/assets/LTYQZ5U5-DzI-7yJW.js +1223 -0
- package/out/renderer/assets/NDSCUZ25-C9oT6c6G.js +83 -0
- package/out/renderer/assets/NMN3IKWL-9IsXehWp.js +1042 -0
- package/out/renderer/assets/NMUA3R2D-B2ZuyfXA.js +1080 -0
- package/out/renderer/assets/NY5A6PPW-BzmvsXmE.js +523 -0
- package/out/renderer/assets/OHJ2EJXK-BEkFEoxu.js +85 -0
- package/out/renderer/assets/OU2GIT2H-DZQl_5qv.js +32 -0
- package/out/renderer/assets/PDMLSE6I-C3FMl6Ej.js +15 -0
- package/out/renderer/assets/PJ7X32S5-BQ3aTkUy.js +188 -0
- package/out/renderer/assets/RLLQ44NJ-Dq15CCQ6.js +248 -0
- package/out/renderer/assets/RVARI57O-DMrXgtoB.js +10 -0
- package/out/renderer/assets/S6DWMCK5-KeQNStMI.js +817 -0
- package/out/renderer/assets/STIOTUT7-ZnewWXB7.js +509 -0
- package/out/renderer/assets/SXSLPWUD-VIPmiOfk.js +120 -0
- package/out/renderer/assets/TR4WJQGX-CQ3dPMLJ.js +25 -0
- package/out/renderer/assets/UWRPUF3N-CtgKKvKe.js +1276 -0
- package/out/renderer/assets/VSWIZJ7B-BN-hZ_G_.js +205 -0
- package/out/renderer/assets/WM7NR6YK-CghasXna.js +193 -0
- package/out/renderer/assets/WXKV2YEK-C8qjO_OQ.js +499 -0
- package/out/renderer/assets/XLHPVVFU-CoRVO17g.js +56 -0
- package/out/renderer/assets/YNX532HU-DhZCm9iK.js +119 -0
- package/out/renderer/assets/YUPSMAUO-Brx2G_oh.js +39 -0
- package/out/renderer/assets/ZFRCZTLK-Cs8fJIgy.js +150 -0
- package/out/renderer/assets/ZZDR4CN3-DcTVOpcO.js +122 -0
- package/out/renderer/assets/andromeeda-Bx1G2cLE.js +293 -0
- package/out/renderer/assets/andromeeda-vBqMIOkk.js +293 -0
- package/out/renderer/assets/aurora-x-Cm7-xw-C.js +243 -0
- package/out/renderer/assets/aurora-x-DPl7s7lw.js +243 -0
- package/out/renderer/assets/ayu-dark-CwZzE4zG.js +207 -0
- package/out/renderer/assets/ayu-dark-DkHc-GR-.js +207 -0
- package/out/renderer/assets/ayu-light-D8NJUeg2.js +207 -0
- package/out/renderer/assets/ayu-light-DNVhSCsl.js +207 -0
- package/out/renderer/assets/ayu-mirage-C-lSBwzI.js +207 -0
- package/out/renderer/assets/ayu-mirage-JE49iZ2H.js +207 -0
- package/out/renderer/assets/catppuccin-frappe-DU1nAiyx.js +414 -0
- package/out/renderer/assets/catppuccin-frappe-DX6Q-ciL.js +414 -0
- package/out/renderer/assets/catppuccin-latte-CO9onEOF.js +414 -0
- package/out/renderer/assets/catppuccin-latte-CkSyOFfG.js +414 -0
- package/out/renderer/assets/catppuccin-macchiato-OyZDjojj.js +414 -0
- package/out/renderer/assets/catppuccin-macchiato-WINjU_Dw.js +414 -0
- package/out/renderer/assets/catppuccin-mocha-0z8-eFg0.js +414 -0
- package/out/renderer/assets/catppuccin-mocha-DRTSTdRR.js +414 -0
- package/out/renderer/assets/core-COuvbqNs.js +5186 -0
- package/out/renderer/assets/{highlight.worker-gURcNJD7.js → core-Drnj1qQL.js} +404 -4454
- package/out/renderer/assets/{core-xOIU6ifr.js → core-Z_paRVMb.js} +3208 -1946
- package/out/renderer/assets/dark-plus-BaggkchT.js +241 -0
- package/out/renderer/assets/dark-plus-Conw9IRY.js +241 -0
- package/out/renderer/assets/default-CzLFidVE.js +1890 -0
- package/out/renderer/assets/dracula-BKSZoV-6.js +227 -0
- package/out/renderer/assets/dracula-BpiXsqbq.js +227 -0
- package/out/renderer/assets/dracula-soft-BF0b4PXf.js +169 -0
- package/out/renderer/assets/dracula-soft-DIWOT7Wr.js +169 -0
- package/out/renderer/assets/engine-javascript-CtTomO8o.js +3238 -0
- package/out/renderer/assets/engine-javascript-DUvVq6Hk.js +3223 -0
- package/out/renderer/assets/engine-oniguruma-DKBWYAaE.js +482 -0
- package/out/renderer/assets/engine-oniguruma-mZf4aRKS.js +482 -0
- package/out/renderer/assets/everforest-dark-B3n4qCUZ.js +181 -0
- package/out/renderer/assets/everforest-dark-BXgth4bF.js +181 -0
- package/out/renderer/assets/everforest-light-BhaIwhYu.js +181 -0
- package/out/renderer/assets/everforest-light-cbpcbx0E.js +181 -0
- package/out/renderer/assets/{file-tabs-Cozt9Sho.js → file-tabs-BCf1cAWp.js} +10 -12
- package/out/renderer/assets/{ghostty-web-BTHoKwMc.js → ghostty-web-CdNv377h.js} +3 -1
- package/out/renderer/assets/github-dark-BESFF5XO.js +234 -0
- package/out/renderer/assets/github-dark-DNCSzN6m.js +234 -0
- package/out/renderer/assets/github-dark-default-DgFmzzcd.js +168 -0
- package/out/renderer/assets/github-dark-default-ffmDUf0z.js +168 -0
- package/out/renderer/assets/github-dark-dimmed-CLKTYZCg.js +225 -0
- package/out/renderer/assets/github-dark-dimmed-s1SLsKJt.js +225 -0
- package/out/renderer/assets/github-dark-high-contrast-CXehgwDU.js +225 -0
- package/out/renderer/assets/github-dark-high-contrast-KLlCEr3k.js +225 -0
- package/out/renderer/assets/github-light-U3PkvbB_.js +234 -0
- package/out/renderer/assets/github-light-default-BPzGUBgG.js +225 -0
- package/out/renderer/assets/github-light-default-xMLgS_bN.js +225 -0
- package/out/renderer/assets/github-light-high-contrast-C8D72_o0.js +225 -0
- package/out/renderer/assets/github-light-high-contrast-DQhuIFi9.js +225 -0
- package/out/renderer/assets/github-light-jtm9FPHO.js +234 -0
- package/out/renderer/assets/gruvbox-dark-hard-BAboCHnq.js +214 -0
- package/out/renderer/assets/gruvbox-dark-hard-woZR1aVf.js +214 -0
- package/out/renderer/assets/gruvbox-dark-medium-BsoEOmFF.js +214 -0
- package/out/renderer/assets/gruvbox-dark-medium-CNo7daJC.js +214 -0
- package/out/renderer/assets/gruvbox-dark-soft-CaJ_lf0b.js +214 -0
- package/out/renderer/assets/gruvbox-dark-soft-Cg271WAX.js +214 -0
- package/out/renderer/assets/gruvbox-light-hard-CEjA0x_J.js +214 -0
- package/out/renderer/assets/gruvbox-light-hard-D8Ufxp8E.js +214 -0
- package/out/renderer/assets/gruvbox-light-medium-BCS-MX7u.js +214 -0
- package/out/renderer/assets/gruvbox-light-medium-DZkNZdeM.js +214 -0
- package/out/renderer/assets/gruvbox-light-soft-CRdK2Ssn.js +214 -0
- package/out/renderer/assets/gruvbox-light-soft-DEEl98i-.js +214 -0
- package/out/renderer/assets/hastToHtml-AUrFnNH_.js +123 -0
- package/out/renderer/assets/highlight.worker-BYB12Fvh.js +1624 -0
- package/out/renderer/assets/highlights-Cjdp9LIq.js +292 -0
- package/out/renderer/assets/highlights-CpZm9DAR-DaBE50nC.js +2188 -0
- package/out/renderer/assets/highlights-DaYW35iB.js +313 -0
- package/out/renderer/assets/horizon-B492K9Ky.js +165 -0
- package/out/renderer/assets/horizon-DAZuC-xh.js +165 -0
- package/out/renderer/assets/horizon-bright-D2Sfzu7E.js +165 -0
- package/out/renderer/assets/horizon-bright-tGFWGsRc.js +165 -0
- package/out/renderer/assets/houston-BuwDhoUX.js +373 -0
- package/out/renderer/assets/houston-Cp9zzZds.js +373 -0
- package/out/renderer/assets/index-DhpOdP7M.js +882 -0
- package/out/renderer/assets/{index-DkE-xvCG.js → index-_dhRO6Oc.js} +1823 -384
- package/out/renderer/assets/{index-DrLLItLS.css → index-fNK5AY6Q.css} +202 -42
- package/out/renderer/assets/kanagawa-dragon-6NLBJhOz.js +229 -0
- package/out/renderer/assets/kanagawa-dragon-BF7rCHRT.js +229 -0
- package/out/renderer/assets/kanagawa-lotus-Cj8RDQcT.js +229 -0
- package/out/renderer/assets/kanagawa-lotus-uV7FMPcj.js +229 -0
- package/out/renderer/assets/kanagawa-wave-0rvDP1ei.js +229 -0
- package/out/renderer/assets/kanagawa-wave-B6IVm0GO.js +229 -0
- package/out/renderer/assets/{kit-BUt8oFlT.js → kit-E8-H6M0V.js} +45590 -39890
- package/out/renderer/assets/langs-BDUDFyts.js +1333 -0
- package/out/renderer/assets/langs-BtXnoosO.js +1331 -0
- package/out/renderer/assets/laserwave-DXWE1WnK.js +166 -0
- package/out/renderer/assets/laserwave-JLRBtymH.js +166 -0
- package/out/renderer/assets/lazy-DQmrNfMK.js +1188 -0
- package/out/renderer/assets/light-plus-DU2oMqtU.js +244 -0
- package/out/renderer/assets/light-plus-D_GZIzn-.js +244 -0
- package/out/renderer/assets/loader-byWkNl6P.js +83 -0
- package/out/renderer/assets/loader-q6EC19QI.js +80 -0
- package/out/renderer/assets/material-theme-C0rHRk_7.js +171 -0
- package/out/renderer/assets/material-theme-CKzpgSIj.js +171 -0
- package/out/renderer/assets/material-theme-darker-LxtgP-nI.js +171 -0
- package/out/renderer/assets/material-theme-darker-q1PJSGwC.js +171 -0
- package/out/renderer/assets/material-theme-lighter-Bo7q33GI.js +171 -0
- package/out/renderer/assets/material-theme-lighter-DIrXq_cm.js +171 -0
- package/out/renderer/assets/material-theme-ocean-DBoGA257.js +171 -0
- package/out/renderer/assets/material-theme-ocean-DKw0PiZ1.js +171 -0
- package/out/renderer/assets/material-theme-palenight-C6KqY_uf.js +171 -0
- package/out/renderer/assets/material-theme-palenight-DoLm5E7H.js +171 -0
- package/out/renderer/assets/min-dark-C29HEm34.js +166 -0
- package/out/renderer/assets/min-dark-C5zOB6s9.js +166 -0
- package/out/renderer/assets/min-light-BDAdB2zx.js +166 -0
- package/out/renderer/assets/min-light-CCfylF7u.js +166 -0
- package/out/renderer/assets/monokai-CgbJVDnk.js +246 -0
- package/out/renderer/assets/monokai-hi1UnAdE.js +246 -0
- package/out/renderer/assets/night-owl-Cy8ZrWil.js +238 -0
- package/out/renderer/assets/night-owl-Pfm14M0L.js +238 -0
- package/out/renderer/assets/night-owl-light-Cr6ug2dl.js +237 -0
- package/out/renderer/assets/night-owl-light-UewpB7JV.js +237 -0
- package/out/renderer/assets/nord-C68LX7oy.js +200 -0
- package/out/renderer/assets/nord-D68iK8nx.js +200 -0
- package/out/renderer/assets/one-dark-pro-DSih0ZZj.js +196 -0
- package/out/renderer/assets/one-dark-pro-DyTT0T_G.js +196 -0
- package/out/renderer/assets/one-light--fEa3idW.js +232 -0
- package/out/renderer/assets/one-light-BzGf0rQc.js +232 -0
- package/out/renderer/assets/{patch-parse.worker-BAW1QWyk.js → patch-parse.worker-siqPY9wG.js} +24 -4
- package/out/renderer/assets/pierre-dark-1Xh1-lMo.js +4 -0
- package/out/renderer/assets/pierre-dark-7z_hCG7W.js +364 -0
- package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-DjiH32kw.js +364 -0
- package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-GW6g2K_K.js +364 -0
- package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-LDfpPKjm.js +4 -0
- package/out/renderer/assets/pierre-dark-soft-1iBHdNO0.js +364 -0
- package/out/renderer/assets/pierre-dark-soft-C_k_gt55.js +4 -0
- package/out/renderer/assets/pierre-dark-soft-D5-n1AeJ.js +364 -0
- package/out/renderer/assets/pierre-dark-tritanopia-CeWJyYfV.js +4 -0
- package/out/renderer/assets/pierre-dark-tritanopia-ClMvjOGO.js +364 -0
- package/out/renderer/assets/pierre-dark-tritanopia-D9kXXcwP.js +364 -0
- package/out/renderer/assets/pierre-dark-vibrant-6Oqz1PbM.js +4 -0
- package/out/renderer/assets/pierre-dark-vibrant-C8yH51pK.js +364 -0
- package/out/renderer/assets/pierre-dark-vibrant-D_7rJXbX.js +364 -0
- package/out/renderer/assets/pierre-dark-yHUcpElV.js +364 -0
- package/out/renderer/assets/pierre-light-BIebL0yQ.js +4 -0
- package/out/renderer/assets/pierre-light-C34x-mcs.js +364 -0
- package/out/renderer/assets/pierre-light-C9v4GAHb.js +364 -0
- package/out/renderer/assets/pierre-light-protanopia-deuteranopia-BufD2-1n.js +4 -0
- package/out/renderer/assets/pierre-light-protanopia-deuteranopia-DUrvpW2C.js +364 -0
- package/out/renderer/assets/pierre-light-protanopia-deuteranopia-VwXWNPo2.js +364 -0
- package/out/renderer/assets/pierre-light-soft-BmDnpPlM.js +364 -0
- package/out/renderer/assets/pierre-light-soft-Cd6v49hf.js +4 -0
- package/out/renderer/assets/pierre-light-soft-DqFh0kZA.js +364 -0
- package/out/renderer/assets/pierre-light-tritanopia-BVCfgdSF.js +364 -0
- package/out/renderer/assets/pierre-light-tritanopia-RkA2q6k9.js +364 -0
- package/out/renderer/assets/pierre-light-tritanopia-VrCUn-Lh.js +4 -0
- package/out/renderer/assets/pierre-light-vibrant-C5BaqWq3.js +364 -0
- package/out/renderer/assets/pierre-light-vibrant-CCrCMYrB.js +364 -0
- package/out/renderer/assets/pierre-light-vibrant-ClZHsQXl.js +4 -0
- package/out/renderer/assets/{pierre-theme-Bj5EAt1L.js → pierre-theme-CsyO3esE.js} +1022 -913
- package/out/renderer/assets/plastic-7t7HzasC.js +207 -0
- package/out/renderer/assets/plastic-EgWoj0TX.js +207 -0
- package/out/renderer/assets/poimandres-Clm3QHf_.js +186 -0
- package/out/renderer/assets/poimandres-_9ZL-zjP.js +186 -0
- package/out/renderer/assets/red-BGLMOAQA.js +240 -0
- package/out/renderer/assets/red-C7WxuK4s.js +240 -0
- package/out/renderer/assets/rose-pine-CSYOOLQH.js +200 -0
- package/out/renderer/assets/rose-pine-DQTixAK4.js +200 -0
- package/out/renderer/assets/rose-pine-dawn-BsExWFpO.js +200 -0
- package/out/renderer/assets/rose-pine-dawn-DtnCKB3V.js +200 -0
- package/out/renderer/assets/rose-pine-moon-CIVzFPCR.js +200 -0
- package/out/renderer/assets/rose-pine-moon-DUVYttUm.js +200 -0
- package/out/renderer/assets/shiki-Ci4cdHsM-C6d-uTVf.js +681 -0
- package/out/renderer/assets/shiki-DxXti3Bm.js +651 -0
- package/out/renderer/assets/slack-dark-DqfBLzDN.js +156 -0
- package/out/renderer/assets/slack-dark-PDVLPqBV.js +156 -0
- package/out/renderer/assets/slack-ochin-BXb20b9s.js +167 -0
- package/out/renderer/assets/slack-ochin-Bkl8Akj-.js +167 -0
- package/out/renderer/assets/snazzy-light-B-XgRQqH.js +169 -0
- package/out/renderer/assets/snazzy-light-B_Pnr_t3.js +169 -0
- package/out/renderer/assets/solarized-dark-BExlwCgF.js +256 -0
- package/out/renderer/assets/solarized-dark-BWOkBqBk.js +256 -0
- package/out/renderer/assets/solarized-light-B0LC-9ef.js +256 -0
- package/out/renderer/assets/solarized-light-B7xKmc3j.js +256 -0
- package/out/renderer/assets/stream-tokenizer-DK9xp5M5-BkzgPytU.js +2641 -0
- package/out/renderer/assets/stream-tokenizer-sqhinrU5.js +131 -0
- package/out/renderer/assets/synthwave-84-Bz5LYLQI.js +766 -0
- package/out/renderer/assets/synthwave-84-DnB997dV.js +766 -0
- package/out/renderer/assets/themes-DGY5d--g.js +323 -0
- package/out/renderer/assets/themes-KOxcu5sY.js +322 -0
- package/out/renderer/assets/tokyo-night-BFQDXQF9.js +343 -0
- package/out/renderer/assets/tokyo-night-BKV2xFQO.js +343 -0
- package/out/renderer/assets/{useDetachCleanup-Bb7k1ePf.js → useDetachCleanup-DYbCqwX-.js} +95 -51
- package/out/renderer/assets/{useFolderChanges-B4X4n6NV.js → useFolderChanges-Y0OqX_nG.js} +406 -242
- package/out/renderer/assets/utils-BcG7Lqcy.js +90 -0
- package/out/renderer/assets/{vendor-BvslLX9q.js → vendor-BpwX-s_O.js} +16835 -16799
- package/out/renderer/assets/{vendor-editor-Bx3dRdBD.js → vendor-editor-Cx3SvGyZ.js} +2 -2
- package/out/renderer/assets/{vendor-motion-BLeNAEjH.js → vendor-motion-CD5Og8pC.js} +3 -3
- package/out/renderer/assets/{vendor-react-DltKc0Ts.js → vendor-react-bPTwWURR.js} +28 -12
- package/out/renderer/assets/vesper-BVtJs6jF.js +173 -0
- package/out/renderer/assets/vesper-BXSaHQeX.js +173 -0
- package/out/renderer/assets/vitesse-black-Bk4nGSr_.js +388 -0
- package/out/renderer/assets/vitesse-black-DjBh7jMr.js +388 -0
- package/out/renderer/assets/vitesse-dark-BSeRY0TR.js +388 -0
- package/out/renderer/assets/vitesse-dark-Czy_Ejt3.js +388 -0
- package/out/renderer/assets/vitesse-light-BpMpGmeY.js +388 -0
- package/out/renderer/assets/vitesse-light-Cv09MZGR.js +388 -0
- package/out/renderer/assets/worker-CswOd5_T.js +2367 -0
- package/out/renderer/index.html +8 -9
- package/package.json +13 -6
- package/out/main/chunks/transcript-sql-DbZ-a5wb.js +0 -43
- package/out/renderer/assets/index-DogoEzwx.js +0 -10868
- package/out/renderer/assets/vendor-shiki-ba8IDo5s.js +0 -459
- package/out/renderer/assets/worker-DNIQ0wG8.js +0 -12761
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports, r as reactExports } from "./vendor-react-
|
|
2
|
-
import { g as useEditorEnvironment, E as useLabels, G as buttonClass } from "./kit-
|
|
3
|
-
import { g as getLineAnnotationName, a as areFileTargetsEqual, b as applyLineTextWithNewline, c as areRenderRangesEqual, i as isDefaultRenderRange, e as shouldRenderFileAnnotations, f as getFileAnnotations, h as createAnnotationElement, j as createFileHeaderElement, k as createContentColumn, l as getHighlighterOptions, m as createPreElement, n as shouldUseTokenTransformer, R as ResizeManager, I as InteractionManager, p as pluckInteractionOptions,
|
|
4
|
-
import { i as isFullyTransparent, s as surfacesMatch,
|
|
5
|
-
import {
|
|
1
|
+
import { j as jsxRuntimeExports, r as reactExports } from "./vendor-react-bPTwWURR.js";
|
|
2
|
+
import { g as useEditorEnvironment, E as useLabels, G as buttonClass } from "./kit-E8-H6M0V.js";
|
|
3
|
+
import { g as getLineAnnotationName, a as areFileTargetsEqual, b as applyLineTextWithNewline, c as areRenderRangesEqual, i as isDefaultRenderRange, e as shouldRenderFileAnnotations, f as getFileAnnotations, h as createAnnotationElement, j as createFileHeaderElement, k as createContentColumn, l as getHighlighterOptions, r as resolvePreferredHighlighter, m as createPreElement, n as shouldUseTokenTransformer, R as ResizeManager, I as InteractionManager, p as pluckInteractionOptions, o as resolveEditSessionSlotName, q as adoptEditSessionAnnotations, w as writeEditSessionAnnotations, t as prerenderHTMLIfNecessary, v as createAnnotationWrapperNode, x as createGutterUtilityContentNode, y as createUnsafeCSSStyleNode, z as wrapUnsafeCSS, A as getMeasuredScrollbarGutter, B as upsertHostThemeStyle, C as wrapThemeCSS, D as patchScrollbarGutterSize, E as isSafari, G as getOrCreateCodeNode, H as guardWebKitScrollDuringRebuild, J as isStyleNode, S as SVGSpriteSheet$1, K as arePrePropertiesEqual, L as setPreNodeProperties, M as areObjectsEqual, N as areOptionsEqual, O as includesFileAnnotations, P as FILE_ANNOTATION_DOM_KEY, Q as GutterUtilitySlotStyles, T as useVirtualizer, U as useCreateEditor, V as useStableCallback, W as useForceUpdate, X as useNextRenderData, Y as noopRender, Z as templateRender, _ as isMacLike, $ as recordLineAnnotationSource, a0 as getLineAnnotationSource, a1 as cloneHunks, a2 as dequeueRender, a3 as queueRender, a4 as isGutterUtilityPath, a5 as useDetachCleanup, a6 as revealOnHighlight, a7 as scrollReachOnRender, a8 as EditProvider, a9 as Virtualizer, u as useFind, aa as fileLines, F as FindBar } from "./useDetachCleanup-DYbCqwX-.js";
|
|
4
|
+
import { i as isFullyTransparent, s as surfacesMatch, j as relativeLuminance, p as pickReadableForeground, k as isDarkSurface, l as hoverWouldEraseText, m as deriveMutedFg, n as contrastRatio, o as compositeOverBg, D as DEFAULT_THEMES, q as areFileRenderOptionsEqual, t as isFilePlainText, v as getHighlighterIfLoaded, w as getFiletypeFromFileName, H as HighlighterDisposedError, x as linesFromFileContents, y as DEFAULT_RENDER_RANGE, z as areThemesAttached, B as areLanguagesAttached, C as renderFileWithHighlighter, E as createGutterGap, F as createGutterItem, G as createHastElement, I as getSharedHighlighter, J as createGutterWrapper, K as EMPTY_LINE_ANNOTATIONS, L as areThemesEqual, M as getThemes, N as EMPTY_RENDER_RANGE, O as isHandledWorkerPoolError, Q as CUSTOM_HEADER_SLOT_ID, S as HEADER_PREFIX_SLOT_ID, T as HEADER_FILENAME_SUFFIX_SLOT_ID, U as HEADER_METADATA_SLOT_ID, V as DEFAULT_VIRTUAL_FILE_METRICS, X as computeVirtualFileMetrics, Y as getVirtualFileHeaderHeight, Z as getVirtualFileHeaderRegion, _ as getVirtualFilePaddingBottom, $ as WorkerPoolContext, a0 as DIFFS_TAG_NAME, a1 as computeLineOffsets, a2 as countLineBreaks, a3 as LRUMapPkg, P as PREFERRED_HIGHLIGHTER, a4 as DIFFS_UNSAFE_CSS, a5 as DIFFS_HOST_STYLE, a6 as VIRTUALIZER_CONFIG, a7 as DEFAULT_TOKENIZE_MAX_LENGTH } from "./pierre-theme-CsyO3esE.js";
|
|
5
|
+
import { h as hastToHtml } from "./hastToHtml-AUrFnNH_.js";
|
|
6
|
+
import { a as addEventListener, g as getLineNumberAttr, h, e as endsWithLineBreak, b as getGraphemeSegmenter, c as createSegmenter, r as round, f as extend, l as lookupScrollContainer, i as clampDomOffset } from "./utils-BcG7Lqcy.js";
|
|
6
7
|
const colorUtils = {
|
|
7
8
|
compositeOverBg,
|
|
8
9
|
contrastRatio,
|
|
@@ -24,7 +25,6 @@ var FileRenderer = class {
|
|
|
24
25
|
onRenderUpdate;
|
|
25
26
|
workerManager;
|
|
26
27
|
__id = `file-renderer:${++instanceId$2}`;
|
|
27
|
-
highlighter;
|
|
28
28
|
file;
|
|
29
29
|
renderCache;
|
|
30
30
|
pendingHighlightResult;
|
|
@@ -33,6 +33,7 @@ var FileRenderer = class {
|
|
|
33
33
|
lineCache;
|
|
34
34
|
pendingStructuralRows;
|
|
35
35
|
textDocumentCache = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
ownedRows = /* @__PURE__ */ new WeakSet();
|
|
36
37
|
editSessionActive = false;
|
|
37
38
|
get fileCache() {
|
|
38
39
|
return this.renderCache?.file;
|
|
@@ -42,7 +43,6 @@ var FileRenderer = class {
|
|
|
42
43
|
this.annotationSlotName = annotationSlotName;
|
|
43
44
|
this.onRenderUpdate = onRenderUpdate;
|
|
44
45
|
this.workerManager = workerManager;
|
|
45
|
-
if (workerManager?.isWorkingPool() !== true) this.highlighter = areThemesAttached(options.theme ?? DEFAULT_THEMES) ? getHighlighterIfLoaded() : void 0;
|
|
46
46
|
}
|
|
47
47
|
setOptions(options) {
|
|
48
48
|
this.options = options;
|
|
@@ -149,7 +149,6 @@ var FileRenderer = class {
|
|
|
149
149
|
this.lineCache = void 0;
|
|
150
150
|
this.textDocumentCache = /* @__PURE__ */ new WeakMap();
|
|
151
151
|
}
|
|
152
|
-
this.highlighter = void 0;
|
|
153
152
|
this.workerManager?.cleanUpTasks(this);
|
|
154
153
|
this.file = void 0;
|
|
155
154
|
}
|
|
@@ -172,13 +171,24 @@ var FileRenderer = class {
|
|
|
172
171
|
result: massiveFile ? void 0 : cache?.result,
|
|
173
172
|
renderRange: void 0
|
|
174
173
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
const workerManager = this.getHighlightWorkerManager(file);
|
|
175
|
+
if (workerManager != null) {
|
|
176
|
+
if (this.renderCache.result == null && !massiveFile) workerManager.highlightFileAST(this, file);
|
|
177
|
+
} else if (getHighlighterIfLoaded({ theme: this.getLocalHighlightTheme() }) == null) {
|
|
178
178
|
this.computedLang = file.lang ?? getFiletypeFromFileName(file.name);
|
|
179
|
-
this.initializeHighlighter()
|
|
179
|
+
this.initializeHighlighter().catch((error) => {
|
|
180
|
+
if (!(error instanceof HighlighterDisposedError)) this.onHighlightError(error);
|
|
181
|
+
});
|
|
180
182
|
}
|
|
181
183
|
}
|
|
184
|
+
getHighlightWorkerManager(file) {
|
|
185
|
+
const { editSessionActive, workerManager } = this;
|
|
186
|
+
return !editSessionActive && workerManager?.isWorkingPool() === true && !workerManager.shouldHighlightOnMainThread(file) ? workerManager : void 0;
|
|
187
|
+
}
|
|
188
|
+
cacheHighlightResult(file, renderResult) {
|
|
189
|
+
const { editSessionActive, workerManager } = this;
|
|
190
|
+
if (!editSessionActive && workerManager?.isWorkingPool() === true) workerManager.setFileResultCache(file.cacheKey, renderResult);
|
|
191
|
+
}
|
|
182
192
|
getLocalHighlightTheme() {
|
|
183
193
|
return this.workerManager?.getFileRenderOptions().theme ?? this.options.theme ?? DEFAULT_THEMES;
|
|
184
194
|
}
|
|
@@ -238,10 +248,10 @@ var FileRenderer = class {
|
|
|
238
248
|
canRenderFile(file, options, forcePlainText) {
|
|
239
249
|
const { renderCache } = this;
|
|
240
250
|
if (renderCache == null || areFileTargetsEqual(renderCache.file, file)) return true;
|
|
241
|
-
if (forcePlainText) return renderCache.result == null && renderCache.hydrated !== true || this.workerManager?.isWorkingPool() === true
|
|
251
|
+
if (forcePlainText) return renderCache.result == null && renderCache.hydrated !== true || this.workerManager?.isWorkingPool() === true && !this.workerManager.shouldHighlightOnMainThread(file) || getHighlighterIfLoaded({ theme: options.theme }) != null;
|
|
242
252
|
if (renderCache.result == null && renderCache.hydrated !== true) return true;
|
|
243
|
-
if (
|
|
244
|
-
return
|
|
253
|
+
if (this.getHighlightWorkerManager(file) != null) return !renderCache.highlighted;
|
|
254
|
+
return getHighlighterIfLoaded({ theme: options.theme }) != null;
|
|
245
255
|
}
|
|
246
256
|
getOrCreateLineCache(file) {
|
|
247
257
|
let { lineCache } = this;
|
|
@@ -307,6 +317,7 @@ var FileRenderer = class {
|
|
|
307
317
|
};
|
|
308
318
|
})
|
|
309
319
|
};
|
|
320
|
+
this.ownedRows.add(row);
|
|
310
321
|
if (pendingStructuralRows != null) pendingStructuralRows.set(line, row);
|
|
311
322
|
else result.code[line] = row;
|
|
312
323
|
}
|
|
@@ -338,7 +349,7 @@ var FileRenderer = class {
|
|
|
338
349
|
if (pendingStructuralRows !== void 0) {
|
|
339
350
|
for (const [line, row] of pendingStructuralRows) if (line < nextLines.length) result.code[line] = row;
|
|
340
351
|
}
|
|
341
|
-
for (let i = prefix; i < nextLines.length - suffix; i++) result.code[i] ??= {
|
|
352
|
+
for (let i = prefix; i < nextLines.length - suffix; i++) result.code[i] ??= this.ownRow({
|
|
342
353
|
type: "element",
|
|
343
354
|
tagName: "div",
|
|
344
355
|
properties: {
|
|
@@ -355,12 +366,17 @@ var FileRenderer = class {
|
|
|
355
366
|
value: textDocument.getLineText(i)
|
|
356
367
|
}]
|
|
357
368
|
}]
|
|
358
|
-
};
|
|
369
|
+
});
|
|
359
370
|
for (let i = 0; i < result.code.length; i++) {
|
|
360
371
|
const line = result.code[i];
|
|
361
|
-
if (line?.type === "element") {
|
|
362
|
-
|
|
363
|
-
|
|
372
|
+
if (line?.type === "element" && (line.properties["data-line"] !== i + 1 || line.properties["data-line-index"] !== i)) {
|
|
373
|
+
const row = this.ownedRows.has(line) ? line : this.ownRow({
|
|
374
|
+
...line,
|
|
375
|
+
properties: { ...line.properties }
|
|
376
|
+
});
|
|
377
|
+
row.properties["data-line"] = i + 1;
|
|
378
|
+
row.properties["data-line-index"] = i;
|
|
379
|
+
result.code[i] = row;
|
|
364
380
|
}
|
|
365
381
|
}
|
|
366
382
|
if (renderCache != null) renderCache.isDirty = true;
|
|
@@ -375,6 +391,10 @@ var FileRenderer = class {
|
|
|
375
391
|
this.textDocumentCache.set(file, textDocument);
|
|
376
392
|
file.contents = contents;
|
|
377
393
|
}
|
|
394
|
+
ownRow(row) {
|
|
395
|
+
this.ownedRows.add(row);
|
|
396
|
+
return row;
|
|
397
|
+
}
|
|
378
398
|
renderFile(file = this.file, renderRange = DEFAULT_RENDER_RANGE) {
|
|
379
399
|
this.file = file;
|
|
380
400
|
if (file == null) {
|
|
@@ -405,24 +425,26 @@ var FileRenderer = class {
|
|
|
405
425
|
const canRenderFile = this.canRenderFile(file, options, forcePlainText);
|
|
406
426
|
const newContent = !areFileTargetsEqual(file, this.renderCache.file);
|
|
407
427
|
const newRenderRange = !areRenderRangesEqual(this.renderCache.renderRange, renderRange);
|
|
408
|
-
|
|
428
|
+
const workerManager = this.getHighlightWorkerManager(file);
|
|
429
|
+
if (workerManager != null) {
|
|
409
430
|
const preserveHydratedContent = this.renderCache.result == null && this.renderCache.highlighted && !forcePlainText && !newContent && isDefaultRenderRange(renderRange);
|
|
410
431
|
if (canRenderFile && !preserveHydratedContent && (forcePlainText || this.renderCache.result == null || !this.renderCache.highlighted && (newContent || newRenderRange))) {
|
|
411
432
|
this.renderCache.file = file;
|
|
412
433
|
this.renderCache.options = options;
|
|
413
434
|
this.renderCache.highlighted = false;
|
|
414
|
-
if (this.renderCache.result == null || newContent || newRenderRange || forceHighlight) this.renderCache.result =
|
|
435
|
+
if (this.renderCache.result == null || newContent || newRenderRange || forceHighlight) this.renderCache.result = workerManager.getPlainFileAST(file, renderRange.startingLine, renderRange.totalLines, lines);
|
|
415
436
|
this.renderCache.renderRange = renderRange;
|
|
416
437
|
}
|
|
417
|
-
if (!forcePlainText && hasContent && (!this.renderCache.highlighted || forceHighlight))
|
|
438
|
+
if (!forcePlainText && hasContent && (!this.renderCache.highlighted || forceHighlight)) workerManager.highlightFileAST(this, file);
|
|
418
439
|
} else {
|
|
419
440
|
this.computedLang = file.lang ?? getFiletypeFromFileName(file.name);
|
|
420
|
-
|
|
421
|
-
const hasThemes =
|
|
422
|
-
const hasLangs =
|
|
441
|
+
const highlighter = getHighlighterIfLoaded();
|
|
442
|
+
const hasThemes = highlighter != null && areThemesAttached(options.theme, highlighter);
|
|
443
|
+
const hasLangs = highlighter != null && areLanguagesAttached(this.computedLang, highlighter);
|
|
423
444
|
const canHighlight = !forcePlainText && hasLangs;
|
|
424
|
-
|
|
425
|
-
|
|
445
|
+
const lazyLineAST = Number.isFinite(renderRange.totalLines);
|
|
446
|
+
if (canRenderFile && highlighter != null && hasThemes && (forceHighlight || forcePlainText || !this.renderCache.highlighted && canHighlight || this.renderCache.result == null)) {
|
|
447
|
+
const { result, options: options2 } = this.renderFileWithHighlighter(file, highlighter, forcePlainText || !hasLangs, lazyLineAST);
|
|
426
448
|
this.renderCache = {
|
|
427
449
|
file,
|
|
428
450
|
options: options2,
|
|
@@ -430,30 +452,44 @@ var FileRenderer = class {
|
|
|
430
452
|
result,
|
|
431
453
|
renderRange: void 0
|
|
432
454
|
};
|
|
455
|
+
if (canHighlight) this.cacheHighlightResult(file, {
|
|
456
|
+
result,
|
|
457
|
+
options: options2
|
|
458
|
+
});
|
|
433
459
|
}
|
|
434
|
-
if (!hasThemes || !forcePlainText && !hasLangs) this.asyncHighlight(file).then(({ result, options: options2 }) => {
|
|
460
|
+
if (!hasThemes || !forcePlainText && !hasLangs) this.asyncHighlight(file, lazyLineAST).then(({ result, options: options2 }) => {
|
|
461
|
+
if (!forcePlainText) this.cacheHighlightResult(file, {
|
|
462
|
+
result,
|
|
463
|
+
options: options2
|
|
464
|
+
});
|
|
435
465
|
this.applyHighlightResult(file, result, options2, !forcePlainText);
|
|
466
|
+
}).catch((error) => {
|
|
467
|
+
if (!(error instanceof HighlighterDisposedError)) this.onHighlightError(error);
|
|
436
468
|
});
|
|
437
469
|
}
|
|
438
470
|
return this.renderCache.result != null ? this.processFileResult(this.renderCache.file, renderRange, this.renderCache.result) : void 0;
|
|
439
471
|
}
|
|
440
472
|
async asyncRender(file, renderRange = DEFAULT_RENDER_RANGE) {
|
|
441
473
|
this.file = file;
|
|
442
|
-
const { result } = await this.asyncHighlight(file);
|
|
474
|
+
const { result } = await this.asyncHighlight(file, Number.isFinite(renderRange.totalLines));
|
|
443
475
|
return this.processFileResult(file, renderRange, result);
|
|
444
476
|
}
|
|
445
|
-
async asyncHighlight(file) {
|
|
477
|
+
async asyncHighlight(file, lazyLineAST = false) {
|
|
446
478
|
const forcePlainText = isFileMassive(this.getOrCreateLineCache(file).length, this.getTokenizeMaxLength());
|
|
447
479
|
this.computedLang = forcePlainText ? "text" : file.lang ?? getFiletypeFromFileName(file.name);
|
|
448
|
-
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
480
|
+
let highlighter = getHighlighterIfLoaded();
|
|
481
|
+
const hasThemes = highlighter != null && areThemesAttached(this.getLocalHighlightTheme(), highlighter);
|
|
482
|
+
const hasLangs = forcePlainText || highlighter != null && areLanguagesAttached(this.computedLang, highlighter);
|
|
483
|
+
if (highlighter == null || !hasThemes || !hasLangs) highlighter = await this.initializeHighlighter();
|
|
484
|
+
return this.renderFileWithHighlighter(file, highlighter, forcePlainText, lazyLineAST);
|
|
452
485
|
}
|
|
453
|
-
renderFileWithHighlighter(file, highlighter, forcePlainText = false) {
|
|
486
|
+
renderFileWithHighlighter(file, highlighter, forcePlainText = false, lazyLineAST = false) {
|
|
454
487
|
const { options } = this.getRenderOptions(file);
|
|
455
488
|
return {
|
|
456
|
-
result: renderFileWithHighlighter(file, highlighter, options, {
|
|
489
|
+
result: renderFileWithHighlighter(file, highlighter, options, {
|
|
490
|
+
forcePlainText,
|
|
491
|
+
lazyLineAST
|
|
492
|
+
}),
|
|
457
493
|
options
|
|
458
494
|
};
|
|
459
495
|
}
|
|
@@ -525,7 +561,7 @@ var FileRenderer = class {
|
|
|
525
561
|
});
|
|
526
562
|
}
|
|
527
563
|
renderFullHTML(result) {
|
|
528
|
-
return
|
|
564
|
+
return hastToHtml(this.renderFullAST(result));
|
|
529
565
|
}
|
|
530
566
|
renderFullAST(result, children = []) {
|
|
531
567
|
children.push(createHastElement({
|
|
@@ -545,19 +581,18 @@ var FileRenderer = class {
|
|
|
545
581
|
return [gutter, createContentColumn(result.contentAST, result.rowCount)];
|
|
546
582
|
}
|
|
547
583
|
renderPartialHTML(children, includeCodeNode = false) {
|
|
548
|
-
if (!includeCodeNode) return
|
|
549
|
-
return
|
|
584
|
+
if (!includeCodeNode) return hastToHtml(children);
|
|
585
|
+
return hastToHtml(createHastElement({
|
|
550
586
|
tagName: "code",
|
|
551
587
|
children,
|
|
552
588
|
properties: { "data-code": "" }
|
|
553
589
|
}));
|
|
554
590
|
}
|
|
555
|
-
|
|
556
|
-
|
|
591
|
+
initializeHighlighter() {
|
|
592
|
+
return getSharedHighlighter(getHighlighterOptions(this.computedLang, {
|
|
557
593
|
theme: this.getLocalHighlightTheme(),
|
|
558
|
-
preferredHighlighter: this.workerManager
|
|
594
|
+
preferredHighlighter: resolvePreferredHighlighter(this.workerManager, this.options)
|
|
559
595
|
}));
|
|
560
|
-
return this.highlighter;
|
|
561
596
|
}
|
|
562
597
|
onHighlightSuccess(file, result, options, highlighted = true) {
|
|
563
598
|
if (this.editSessionActive) return;
|
|
@@ -650,7 +685,7 @@ let instanceId$1 = -1;
|
|
|
650
685
|
var File$1 = class File {
|
|
651
686
|
options;
|
|
652
687
|
workerManager;
|
|
653
|
-
|
|
688
|
+
requestOwnerRender;
|
|
654
689
|
static LoadedCustomComponent = true;
|
|
655
690
|
__id = `file:${++instanceId$1}`;
|
|
656
691
|
type = "file";
|
|
@@ -682,18 +717,22 @@ var File$1 = class File {
|
|
|
682
717
|
resizeManager;
|
|
683
718
|
interactionManager;
|
|
684
719
|
annotationCache = /* @__PURE__ */ new Map();
|
|
685
|
-
lineAnnotations
|
|
720
|
+
get lineAnnotations() {
|
|
721
|
+
return this.renderedData?.lineAnnotations ?? EMPTY_LINE_ANNOTATIONS;
|
|
722
|
+
}
|
|
686
723
|
managersDirty = false;
|
|
687
724
|
file;
|
|
688
725
|
editSession;
|
|
689
|
-
|
|
726
|
+
renderedData;
|
|
727
|
+
pendingData;
|
|
728
|
+
forceRenderOverride;
|
|
690
729
|
renderRange;
|
|
691
730
|
enabled = true;
|
|
692
731
|
editor;
|
|
693
|
-
constructor(options = { theme: DEFAULT_THEMES }, workerManager,
|
|
732
|
+
constructor(options = { theme: DEFAULT_THEMES }, workerManager, requestOwnerRender) {
|
|
694
733
|
this.options = options;
|
|
695
734
|
this.workerManager = workerManager;
|
|
696
|
-
this.
|
|
735
|
+
this.requestOwnerRender = requestOwnerRender;
|
|
697
736
|
this.fileRenderer = new FileRenderer(options, this.getAnnotationSlotName, this.handleHighlightRender, this.workerManager);
|
|
698
737
|
this.resizeManager = new ResizeManager();
|
|
699
738
|
this.interactionManager = new InteractionManager("file", pluckInteractionOptions(options));
|
|
@@ -706,51 +745,104 @@ var File$1 = class File {
|
|
|
706
745
|
this.rerender();
|
|
707
746
|
};
|
|
708
747
|
rerender() {
|
|
709
|
-
|
|
748
|
+
const file = this.getInputFile();
|
|
749
|
+
if (!this.enabled || file == null) return;
|
|
750
|
+
if (this.requestRender()) return;
|
|
710
751
|
this.render({
|
|
711
|
-
file
|
|
752
|
+
file,
|
|
712
753
|
forceRender: true,
|
|
713
754
|
renderRange: this.renderRange
|
|
714
755
|
});
|
|
715
756
|
}
|
|
757
|
+
requestRender() {
|
|
758
|
+
const { requestOwnerRender } = this;
|
|
759
|
+
if (this.editSession != null || requestOwnerRender == null) return false;
|
|
760
|
+
this.forceRenderOverride = true;
|
|
761
|
+
requestOwnerRender();
|
|
762
|
+
return true;
|
|
763
|
+
}
|
|
764
|
+
get isComponentManaged() {
|
|
765
|
+
return this.requestOwnerRender != null;
|
|
766
|
+
}
|
|
716
767
|
getTheme() {
|
|
717
768
|
return this.workerManager?.getFileRenderOptions().theme ?? this.options.theme ?? DEFAULT_THEMES;
|
|
718
769
|
}
|
|
719
|
-
|
|
720
|
-
return this.
|
|
770
|
+
getInputFile() {
|
|
771
|
+
return this.file;
|
|
772
|
+
}
|
|
773
|
+
getWorkingFile(fallbackFile = this.file) {
|
|
774
|
+
return this.editSession?.file ?? fallbackFile;
|
|
721
775
|
}
|
|
722
776
|
getRenderedFile() {
|
|
723
|
-
return this.
|
|
777
|
+
return this.renderedData?.file;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* @internal Data the next render() with this input will display. While a
|
|
781
|
+
* replacement file is being highlighted, this is still the displayed data.
|
|
782
|
+
*/
|
|
783
|
+
__getNextRenderData({ file, lineAnnotations }) {
|
|
784
|
+
const sessionAnnotations = this.editSession?.annotations;
|
|
785
|
+
if (sessionAnnotations != null) return {
|
|
786
|
+
file,
|
|
787
|
+
lineAnnotations: lineAnnotations != null && this.isNewAnnotations(lineAnnotations) ? lineAnnotations : sessionAnnotations.provided
|
|
788
|
+
};
|
|
789
|
+
const workingFile = this.getWorkingFile(file) ?? file;
|
|
790
|
+
const nextFile = this.fileRenderer.getFileForNextRender(workingFile);
|
|
791
|
+
return {
|
|
792
|
+
file: nextFile,
|
|
793
|
+
lineAnnotations: lineAnnotations != null && areFileTargetsEqual(nextFile, workingFile) ? lineAnnotations : this.getAnnotationsForFile(nextFile)
|
|
794
|
+
};
|
|
724
795
|
}
|
|
725
796
|
getLatestAnnotations() {
|
|
726
|
-
return this.editSession?.annotations?.current ?? this.lineAnnotations;
|
|
797
|
+
return this.pendingData?.lineAnnotations ?? this.editSession?.annotations?.current ?? this.lineAnnotations;
|
|
798
|
+
}
|
|
799
|
+
getAnnotationsForFile(file) {
|
|
800
|
+
const { pendingData } = this;
|
|
801
|
+
return pendingData != null && areFileTargetsEqual(file, pendingData.file) ? pendingData.lineAnnotations : this.lineAnnotations;
|
|
802
|
+
}
|
|
803
|
+
adoptRenderData(file) {
|
|
804
|
+
const { pendingData } = this;
|
|
805
|
+
const matchesPending = pendingData != null && areFileTargetsEqual(file, pendingData.file);
|
|
806
|
+
this.renderedData = {
|
|
807
|
+
file,
|
|
808
|
+
lineAnnotations: matchesPending ? pendingData.lineAnnotations : this.lineAnnotations
|
|
809
|
+
};
|
|
810
|
+
if (matchesPending) this.pendingData = void 0;
|
|
727
811
|
}
|
|
728
812
|
isNewAnnotations(lineAnnotations) {
|
|
729
813
|
const session = this.editSession?.annotations;
|
|
730
|
-
if (lineAnnotations === this.
|
|
814
|
+
if (lineAnnotations === this.getLatestAnnotations()) return false;
|
|
731
815
|
return session == null || lineAnnotations !== session.provided && lineAnnotations !== session.current;
|
|
732
816
|
}
|
|
733
|
-
|
|
734
|
-
if (areFileTargetsEqual(this.
|
|
817
|
+
updateInputFile(incomingFile, lineAnnotations) {
|
|
818
|
+
if (areFileTargetsEqual(this.getInputFile(), incomingFile)) return false;
|
|
735
819
|
const hadSession = this.editSession != null;
|
|
820
|
+
const previousAnnotations = this.getLatestAnnotations();
|
|
736
821
|
this.file = incomingFile;
|
|
737
822
|
if (hadSession || this.editor != null) this.installEditSession(incomingFile, hadSession ? void 0 : this.editor?.__getDocumentContents(incomingFile), true);
|
|
738
823
|
else this.editSession = void 0;
|
|
739
|
-
if (this.editSession?.annotations != null && lineAnnotations != null)
|
|
740
|
-
|
|
741
|
-
this.editSession
|
|
742
|
-
|
|
824
|
+
if (this.editSession?.annotations != null && lineAnnotations != null) this.editSession.annotations = adoptEditSessionAnnotations(lineAnnotations, getLineAnnotationName, this.editSession.annotations);
|
|
825
|
+
this.pendingData = {
|
|
826
|
+
file: this.editSession?.file ?? incomingFile,
|
|
827
|
+
lineAnnotations: this.editSession?.annotations?.current ?? lineAnnotations ?? previousAnnotations
|
|
828
|
+
};
|
|
743
829
|
return true;
|
|
744
830
|
}
|
|
745
|
-
installEditSession(
|
|
746
|
-
const
|
|
747
|
-
const file = createEditSessionFile(retainedDocument ??
|
|
831
|
+
installEditSession(inputFile, retainedDocument, hostReplacement = false) {
|
|
832
|
+
const usesInputDocument = retainedDocument == null || retainedDocument.name === inputFile.name && retainedDocument.lang === inputFile.lang && retainedDocument.contents === inputFile.contents;
|
|
833
|
+
const file = createEditSessionFile(retainedDocument ?? inputFile);
|
|
834
|
+
const annotations = this.editSession?.annotations ?? adoptEditSessionAnnotations(this.getLatestAnnotations(), getLineAnnotationName);
|
|
748
835
|
this.editSession = {
|
|
749
836
|
file,
|
|
750
|
-
|
|
751
|
-
|
|
837
|
+
inputFile,
|
|
838
|
+
externalReplacement: hostReplacement && usesInputDocument,
|
|
839
|
+
annotations
|
|
840
|
+
};
|
|
841
|
+
this.pendingData = {
|
|
842
|
+
file,
|
|
843
|
+
lineAnnotations: annotations.current
|
|
752
844
|
};
|
|
753
|
-
this.fileRenderer.beginEditSession(file,
|
|
845
|
+
this.fileRenderer.beginEditSession(file, usesInputDocument ? inputFile : void 0);
|
|
754
846
|
}
|
|
755
847
|
onThemeChange() {
|
|
756
848
|
this.fileRenderer.clearRenderCache();
|
|
@@ -791,18 +883,22 @@ var File$1 = class File {
|
|
|
791
883
|
};
|
|
792
884
|
setLineAnnotations(lineAnnotations) {
|
|
793
885
|
const sessionAnnotations = this.editSession?.annotations;
|
|
794
|
-
if (sessionAnnotations
|
|
795
|
-
this.lineAnnotations
|
|
796
|
-
|
|
886
|
+
if (sessionAnnotations != null) {
|
|
887
|
+
if (!this.isNewAnnotations(lineAnnotations)) return;
|
|
888
|
+
writeEditSessionAnnotations(sessionAnnotations, lineAnnotations, getLineAnnotationName);
|
|
797
889
|
}
|
|
798
|
-
|
|
799
|
-
this.
|
|
800
|
-
|
|
890
|
+
const file = this.getWorkingFile();
|
|
891
|
+
if (file != null) this.pendingData = {
|
|
892
|
+
file,
|
|
893
|
+
lineAnnotations
|
|
894
|
+
};
|
|
801
895
|
}
|
|
802
896
|
syncEditSessionAnnotationsFromEditor(lineAnnotations) {
|
|
803
897
|
const session = this.editSession?.annotations;
|
|
804
898
|
if (session == null || lineAnnotations === session.current) return false;
|
|
805
899
|
session.current = lineAnnotations;
|
|
900
|
+
if (this.renderedData != null) this.renderedData.lineAnnotations = lineAnnotations;
|
|
901
|
+
this.pendingData = void 0;
|
|
806
902
|
this.fileRenderer.setLineAnnotations(lineAnnotations);
|
|
807
903
|
this.renderAnnotations();
|
|
808
904
|
return true;
|
|
@@ -842,7 +938,7 @@ var File$1 = class File {
|
|
|
842
938
|
this.managersDirty = false;
|
|
843
939
|
}
|
|
844
940
|
shouldApplyColumnVariables(overflow) {
|
|
845
|
-
return overflow === "scroll" && this.
|
|
941
|
+
return overflow === "scroll" && this.lineAnnotations.length > 0;
|
|
846
942
|
}
|
|
847
943
|
cleanUp(recycle = false) {
|
|
848
944
|
const editor = this.editor;
|
|
@@ -854,11 +950,15 @@ var File$1 = class File {
|
|
|
854
950
|
this.managersDirty = false;
|
|
855
951
|
this.workerManager?.unsubscribeToThemeChanges(this);
|
|
856
952
|
this.renderRange = void 0;
|
|
857
|
-
if (!this.
|
|
953
|
+
if (!this.isComponentManaged) this.fileContainer?.remove();
|
|
858
954
|
this.fileContainer = void 0;
|
|
859
955
|
this.mounted = false;
|
|
860
|
-
if (!recycle)
|
|
956
|
+
if (!recycle) {
|
|
957
|
+
this.renderedData = void 0;
|
|
958
|
+
this.pendingData = void 0;
|
|
959
|
+
}
|
|
861
960
|
this.clearAuxiliaryNodes();
|
|
961
|
+
this.pre?.remove();
|
|
862
962
|
this.pre = void 0;
|
|
863
963
|
this.code = void 0;
|
|
864
964
|
this.bufferBefore?.remove();
|
|
@@ -867,11 +967,9 @@ var File$1 = class File {
|
|
|
867
967
|
this.bufferAfter = void 0;
|
|
868
968
|
this.appliedPreAttributes = void 0;
|
|
869
969
|
this.lastRowCount = void 0;
|
|
970
|
+
this.headerElement?.remove();
|
|
870
971
|
this.headerElement = void 0;
|
|
871
|
-
this.
|
|
872
|
-
this.headerFilenameSuffix = void 0;
|
|
873
|
-
this.headerMetadata = void 0;
|
|
874
|
-
this.headerCustom = void 0;
|
|
972
|
+
this.clearHeaderSlots();
|
|
875
973
|
this.lastRenderedHeaderHTML = void 0;
|
|
876
974
|
if (!recycle) this.cachedHeaderHTML = void 0;
|
|
877
975
|
this.errorWrapper?.remove();
|
|
@@ -890,7 +988,6 @@ var File$1 = class File {
|
|
|
890
988
|
this.workerManager = void 0;
|
|
891
989
|
this.file = void 0;
|
|
892
990
|
this.editSession = void 0;
|
|
893
|
-
this.renderedFile = void 0;
|
|
894
991
|
}
|
|
895
992
|
this.enabled = false;
|
|
896
993
|
}
|
|
@@ -952,20 +1049,23 @@ var File$1 = class File {
|
|
|
952
1049
|
this.hydrateMeasuredScrollbar();
|
|
953
1050
|
}
|
|
954
1051
|
hydrationSetup({ file, lineAnnotations }) {
|
|
955
|
-
this.
|
|
1052
|
+
this.renderedData = {
|
|
1053
|
+
file,
|
|
1054
|
+
lineAnnotations: lineAnnotations ?? this.getLatestAnnotations()
|
|
1055
|
+
};
|
|
1056
|
+
this.pendingData = void 0;
|
|
956
1057
|
this.file = file;
|
|
957
1058
|
this.fileRenderer.setOptions(getFileRendererOptions(this.options));
|
|
958
1059
|
this.syncInteractionOptions();
|
|
959
1060
|
if (this.pre == null) return;
|
|
960
1061
|
this.fileRenderer.hydrate(file);
|
|
961
|
-
this.renderedFile = file;
|
|
962
1062
|
this.renderAnnotations();
|
|
963
1063
|
this.renderGutterUtility();
|
|
964
1064
|
this.injectUnsafeCSS();
|
|
965
1065
|
this.managersDirty = true;
|
|
966
1066
|
this.flushManagers();
|
|
967
1067
|
}
|
|
968
|
-
getOrCreateLineCache(file = this.
|
|
1068
|
+
getOrCreateLineCache(file = this.getWorkingFile()) {
|
|
969
1069
|
return file != null ? this.fileRenderer.getOrCreateLineCache(file) : EMPTY_STRINGS;
|
|
970
1070
|
}
|
|
971
1071
|
updateBuffers(renderRange) {
|
|
@@ -974,10 +1074,10 @@ var File$1 = class File {
|
|
|
974
1074
|
syncRenderViewToEditor() {
|
|
975
1075
|
const { editor, fileContainer, renderRange } = this;
|
|
976
1076
|
const lineAnnotations = this.getLatestAnnotations();
|
|
977
|
-
const file = this.
|
|
1077
|
+
const file = this.getWorkingFile();
|
|
978
1078
|
if (editor == null || fileContainer == null || file == null) return;
|
|
979
1079
|
const syncEditor = (highlighter2) => {
|
|
980
|
-
if (!this.enabled || this.editor !== editor || this.fileContainer !== fileContainer || this.
|
|
1080
|
+
if (!this.enabled || this.editor !== editor || this.fileContainer !== fileContainer || this.getWorkingFile() !== file) return;
|
|
981
1081
|
editor.__syncRenderView({
|
|
982
1082
|
highlighter: highlighter2,
|
|
983
1083
|
fileContainer,
|
|
@@ -997,8 +1097,10 @@ var File$1 = class File {
|
|
|
997
1097
|
else getSharedHighlighter({
|
|
998
1098
|
themes: getThemes(theme),
|
|
999
1099
|
langs: Array.from(/* @__PURE__ */ new Set(["text", lang])),
|
|
1000
|
-
preferredHighlighter: this.workerManager
|
|
1001
|
-
}).then(syncEditor)
|
|
1100
|
+
preferredHighlighter: resolvePreferredHighlighter(this.workerManager, this.options)
|
|
1101
|
+
}).then(syncEditor).catch((error) => {
|
|
1102
|
+
if (!(error instanceof HighlighterDisposedError)) console.error(error);
|
|
1103
|
+
});
|
|
1002
1104
|
}
|
|
1003
1105
|
/** @internal The editor applied or edited past the pending external replacement. */
|
|
1004
1106
|
__acknowledgeDocumentUpdate() {
|
|
@@ -1039,10 +1141,13 @@ var File$1 = class File {
|
|
|
1039
1141
|
}
|
|
1040
1142
|
resumeEditorRendering(editor) {
|
|
1041
1143
|
if (this.editSession != null) this.fileRenderer.beginEditSession(this.editSession.file);
|
|
1042
|
-
else
|
|
1144
|
+
else {
|
|
1145
|
+
const inputFile = this.getInputFile();
|
|
1146
|
+
if (inputFile != null) this.installEditSession(inputFile, editor.__getDocumentContents(inputFile));
|
|
1147
|
+
}
|
|
1043
1148
|
const editSessionFile = this.editSession?.file;
|
|
1044
1149
|
if (this.fileRenderer.editorRenderReady()) {
|
|
1045
|
-
if (this.fileRenderer.fileCache === editSessionFile) this.
|
|
1150
|
+
if (editSessionFile != null && this.fileRenderer.fileCache === editSessionFile) this.adoptRenderData(editSessionFile);
|
|
1046
1151
|
this.syncRenderViewToEditor();
|
|
1047
1152
|
} else this.rerender();
|
|
1048
1153
|
}
|
|
@@ -1053,7 +1158,7 @@ var File$1 = class File {
|
|
|
1053
1158
|
* Requires the editor to be detached first. Does nothing when no session
|
|
1054
1159
|
* exists, so callers can invoke it again safely after it has settled.
|
|
1055
1160
|
*
|
|
1056
|
-
* `onEditComplete` receives the completed file, current
|
|
1161
|
+
* `onEditComplete` receives the completed file, current input file, and
|
|
1057
1162
|
* both annotation collections even when the final text is unchanged. In
|
|
1058
1163
|
* `install` mode, accepting installs the completed file and its annotations;
|
|
1059
1164
|
* rejecting or having no handler restores the external values. `discard`
|
|
@@ -1064,9 +1169,10 @@ var File$1 = class File {
|
|
|
1064
1169
|
this.settleEditSession(mode === "install", editor);
|
|
1065
1170
|
}
|
|
1066
1171
|
settleEditSession(installResult, editor) {
|
|
1067
|
-
const { editSession
|
|
1068
|
-
if (editSession == null
|
|
1069
|
-
const { file: editSessionFile, annotations: editSessionAnnotations } = editSession;
|
|
1172
|
+
const { editSession } = this;
|
|
1173
|
+
if (editSession == null) return;
|
|
1174
|
+
const { file: editSessionFile, inputFile, annotations: editSessionAnnotations } = editSession;
|
|
1175
|
+
const inputAnnotations = editSessionAnnotations?.provided ?? this.lineAnnotations;
|
|
1070
1176
|
if (this.editor != null) throw new Error("File.__completeEditSession: detach the editor before completing the session");
|
|
1071
1177
|
const sessionAnnotationsCurrent = editSessionAnnotations?.current;
|
|
1072
1178
|
let acceptedFile;
|
|
@@ -1077,29 +1183,31 @@ var File$1 = class File {
|
|
|
1077
1183
|
const event = {
|
|
1078
1184
|
file: completedFile,
|
|
1079
1185
|
editor,
|
|
1080
|
-
originalFile:
|
|
1186
|
+
originalFile: inputFile,
|
|
1081
1187
|
lineAnnotations: sessionAnnotationsCurrent,
|
|
1082
|
-
originalLineAnnotations:
|
|
1188
|
+
originalLineAnnotations: inputAnnotations
|
|
1083
1189
|
};
|
|
1084
1190
|
Object.freeze(event);
|
|
1085
1191
|
try {
|
|
1086
1192
|
editor.__emitEditComplete(event);
|
|
1087
1193
|
if (this.options.onEditComplete?.(event) === "accept") {
|
|
1088
|
-
if (completedFile.cacheKey != null && completedFile.cacheKey ===
|
|
1194
|
+
if (completedFile.cacheKey != null && completedFile.cacheKey === inputFile.cacheKey) throw new Error("File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey");
|
|
1089
1195
|
acceptedFile = completedFile;
|
|
1090
1196
|
}
|
|
1091
1197
|
} catch (error) {
|
|
1092
1198
|
failed = true;
|
|
1093
1199
|
failure = error;
|
|
1094
1200
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
if (sessionAnnotationsCurrent != null) this.lineAnnotations = sessionAnnotationsCurrent;
|
|
1098
|
-
}
|
|
1201
|
+
const settledFile = installResult && acceptedFile != null ? acceptedFile : inputFile;
|
|
1202
|
+
const settledAnnotations = installResult && acceptedFile != null ? sessionAnnotationsCurrent ?? inputAnnotations : inputAnnotations;
|
|
1099
1203
|
this.editSession = void 0;
|
|
1100
|
-
|
|
1204
|
+
this.file = settledFile;
|
|
1205
|
+
this.pendingData = {
|
|
1206
|
+
file: settledFile,
|
|
1207
|
+
lineAnnotations: settledAnnotations
|
|
1208
|
+
};
|
|
1101
1209
|
this.fileRenderer.endEditSession(settledFile);
|
|
1102
|
-
if (
|
|
1210
|
+
if (areFileTargetsEqual(this.getRenderedFile(), settledFile)) this.adoptRenderData(settledFile);
|
|
1103
1211
|
if (installResult && this.fileContainer != null) this.rerender();
|
|
1104
1212
|
if (failed) throw failure;
|
|
1105
1213
|
}
|
|
@@ -1124,15 +1232,17 @@ var File$1 = class File {
|
|
|
1124
1232
|
}
|
|
1125
1233
|
render({ file, fileContainer, forceRender = false, preventEmit = false, containerWrapper, deferManagers = false, lineAnnotations, renderRange }) {
|
|
1126
1234
|
if (!this.enabled) throw new Error("File.render: attempting to call render after cleaned up");
|
|
1235
|
+
forceRender = this.forceRenderOverride ?? forceRender;
|
|
1236
|
+
this.forceRenderOverride = void 0;
|
|
1127
1237
|
this.editor?.__postponeBgTokenizeToNextFrame();
|
|
1128
1238
|
const { collapsed = false, themeType = "system" } = this.options;
|
|
1129
1239
|
const nextRenderRange = collapsed ? void 0 : renderRange;
|
|
1130
1240
|
const previousRenderRange = this.renderRange;
|
|
1131
1241
|
const themeChanged = this.hasThemeChanged();
|
|
1132
1242
|
const annotationsChanged = lineAnnotations != null && (lineAnnotations.length > 0 || this.getLatestAnnotations().length > 0) ? this.isNewAnnotations(lineAnnotations) : false;
|
|
1133
|
-
const didFileChange = !areFileTargetsEqual(this.
|
|
1134
|
-
if (didFileChange) this.
|
|
1135
|
-
const
|
|
1243
|
+
const didFileChange = !areFileTargetsEqual(this.getInputFile(), file);
|
|
1244
|
+
if (didFileChange) this.updateInputFile(file, lineAnnotations);
|
|
1245
|
+
const workingFile = this.getWorkingFile(file) ?? file;
|
|
1136
1246
|
if (!collapsed && !forceRender && areRenderRangesEqual(nextRenderRange, this.renderRange) && !didFileChange && !annotationsChanged && !themeChanged) {
|
|
1137
1247
|
const rendered = this.applyCachedThemeState(themeType);
|
|
1138
1248
|
if (rendered) this.finalizeRender();
|
|
@@ -1143,7 +1253,8 @@ var File$1 = class File {
|
|
|
1143
1253
|
this.fileRenderer.setOptions(getFileRendererOptions(this.options));
|
|
1144
1254
|
this.syncInteractionOptions();
|
|
1145
1255
|
if (lineAnnotations != null) this.setLineAnnotations(lineAnnotations);
|
|
1146
|
-
this.fileRenderer.
|
|
1256
|
+
const nextRenderFile = this.fileRenderer.getFileForNextRender(workingFile);
|
|
1257
|
+
this.fileRenderer.setLineAnnotations(this.getAnnotationsForFile(nextRenderFile));
|
|
1147
1258
|
const { disableErrorHandling = false, disableFileHeader = false } = this.options;
|
|
1148
1259
|
if (disableFileHeader) {
|
|
1149
1260
|
if (this.headerElement != null) {
|
|
@@ -1159,10 +1270,10 @@ var File$1 = class File {
|
|
|
1159
1270
|
this.removeRenderedCode();
|
|
1160
1271
|
this.clearAuxiliaryNodes();
|
|
1161
1272
|
try {
|
|
1162
|
-
const fileResult = this.fileRenderer.renderFile(
|
|
1273
|
+
const fileResult = this.fileRenderer.renderFile(workingFile, EMPTY_RENDER_RANGE);
|
|
1163
1274
|
if (fileResult != null) this.applyThemeState(fileContainer, fileResult.themeStyles, themeType, fileResult.baseThemeType);
|
|
1164
1275
|
if (fileResult?.headerAST != null) this.applyHeaderToDOM(fileResult.headerAST, fileContainer, fileResult.file);
|
|
1165
|
-
this.
|
|
1276
|
+
this.adoptRenderData(fileResult?.file ?? workingFile);
|
|
1166
1277
|
this.injectUnsafeCSS();
|
|
1167
1278
|
} catch (error) {
|
|
1168
1279
|
if (disableErrorHandling) throw error;
|
|
@@ -1175,8 +1286,9 @@ var File$1 = class File {
|
|
|
1175
1286
|
}
|
|
1176
1287
|
try {
|
|
1177
1288
|
const pre = this.getOrCreatePreNode(fileContainer);
|
|
1178
|
-
|
|
1179
|
-
|
|
1289
|
+
let renderedFile = this.getRenderedFile();
|
|
1290
|
+
if (!this.canPartiallyRender(forceRender, annotationsChanged, didFileChange || themeChanged || !areFileTargetsEqual(this.getRenderedFile(), workingFile)) || !this.applyPartialRender(workingFile, previousRenderRange, nextRenderRange)) {
|
|
1291
|
+
const fileResult = this.fileRenderer.renderFile(workingFile, nextRenderRange);
|
|
1180
1292
|
if (fileResult == null) {
|
|
1181
1293
|
if (this.workerManager?.isInitialized() === false && this.workerManager.isWorkingPool()) this.workerManager.initialize().catch(() => {
|
|
1182
1294
|
}).then(() => this.rerender());
|
|
@@ -1185,10 +1297,11 @@ var File$1 = class File {
|
|
|
1185
1297
|
this.applyThemeState(fileContainer, fileResult.themeStyles, themeType, fileResult.baseThemeType);
|
|
1186
1298
|
if (fileResult.headerAST != null) this.applyHeaderToDOM(fileResult.headerAST, fileContainer, fileResult.file);
|
|
1187
1299
|
this.applyFullRender(fileResult, pre);
|
|
1188
|
-
|
|
1300
|
+
renderedFile = fileResult.file;
|
|
1189
1301
|
}
|
|
1190
1302
|
this.applyBuffers(pre, nextRenderRange);
|
|
1191
1303
|
this.injectUnsafeCSS();
|
|
1304
|
+
if (renderedFile != null) this.adoptRenderData(renderedFile);
|
|
1192
1305
|
this.renderAnnotations();
|
|
1193
1306
|
this.renderGutterUtility();
|
|
1194
1307
|
this.managersDirty = true;
|
|
@@ -1260,7 +1373,7 @@ var File$1 = class File {
|
|
|
1260
1373
|
this.placeHolder.style.setProperty("height", `${height}px`);
|
|
1261
1374
|
return true;
|
|
1262
1375
|
}
|
|
1263
|
-
async primeHighlightCache(file = this.
|
|
1376
|
+
async primeHighlightCache(file = this.getInputFile()) {
|
|
1264
1377
|
const { workerManager } = this;
|
|
1265
1378
|
if (file == null || workerManager == null || !workerManager.isWorkingPool() || file.cacheKey == null || isFilePlainText(file)) return;
|
|
1266
1379
|
const tokenizeMaxLength = this.options.tokenizeMaxLength ?? 1e5;
|
|
@@ -1308,31 +1421,35 @@ var File$1 = class File {
|
|
|
1308
1421
|
this.mounted = false;
|
|
1309
1422
|
}
|
|
1310
1423
|
renderAnnotations() {
|
|
1311
|
-
if (this.
|
|
1424
|
+
if (this.isComponentManaged || this.fileContainer == null) {
|
|
1312
1425
|
for (const { element } of this.annotationCache.values()) element.remove();
|
|
1313
1426
|
this.annotationCache.clear();
|
|
1314
1427
|
return;
|
|
1315
1428
|
}
|
|
1316
1429
|
const staleAnnotations = new Map(this.annotationCache);
|
|
1317
1430
|
const { renderAnnotation } = this.options;
|
|
1318
|
-
const
|
|
1319
|
-
if (renderAnnotation != null &&
|
|
1320
|
-
const
|
|
1321
|
-
const
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
cache
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1431
|
+
const { renderedData } = this;
|
|
1432
|
+
if (renderAnnotation != null && renderedData != null) {
|
|
1433
|
+
const { file, lineAnnotations } = renderedData;
|
|
1434
|
+
for (const [index, annotation] of lineAnnotations.entries()) {
|
|
1435
|
+
const name = this.getAnnotationSlotName(annotation);
|
|
1436
|
+
const id = `${index}-${name}`;
|
|
1437
|
+
let cache = this.annotationCache.get(id);
|
|
1438
|
+
if (cache == null || cache.file !== file || !areLineAnnotationsEqual(annotation, cache.annotation)) {
|
|
1439
|
+
cache?.element.remove();
|
|
1440
|
+
const content = renderAnnotation(annotation, file);
|
|
1441
|
+
if (content == null) continue;
|
|
1442
|
+
cache = {
|
|
1443
|
+
element: createAnnotationWrapperNode(name),
|
|
1444
|
+
annotation,
|
|
1445
|
+
file
|
|
1446
|
+
};
|
|
1447
|
+
cache.element.appendChild(content);
|
|
1448
|
+
this.fileContainer.appendChild(cache.element);
|
|
1449
|
+
this.annotationCache.set(id, cache);
|
|
1450
|
+
}
|
|
1451
|
+
staleAnnotations.delete(id);
|
|
1334
1452
|
}
|
|
1335
|
-
staleAnnotations.delete(id);
|
|
1336
1453
|
}
|
|
1337
1454
|
for (const [id, { element }] of staleAnnotations.entries()) {
|
|
1338
1455
|
this.annotationCache.delete(id);
|
|
@@ -1360,6 +1477,7 @@ var File$1 = class File {
|
|
|
1360
1477
|
}
|
|
1361
1478
|
injectUnsafeCSS() {
|
|
1362
1479
|
const { unsafeCSS } = this.options;
|
|
1480
|
+
this.pre?.toggleAttribute("data-custom-styles", Boolean(unsafeCSS));
|
|
1363
1481
|
const shadowRoot = this.fileContainer?.shadowRoot;
|
|
1364
1482
|
if (shadowRoot == null) return;
|
|
1365
1483
|
if (unsafeCSS == null || unsafeCSS === "") {
|
|
@@ -1428,10 +1546,10 @@ var File$1 = class File {
|
|
|
1428
1546
|
if (code.childElementCount >= 2) for (let i = 0; i < 2; i++) {
|
|
1429
1547
|
const domEl = code.children[i];
|
|
1430
1548
|
const astEl = codeAst[i];
|
|
1431
|
-
domEl.innerHTML =
|
|
1549
|
+
domEl.innerHTML = hastToHtml(astEl.children);
|
|
1432
1550
|
domEl.style.cssText = astEl.properties.style;
|
|
1433
1551
|
}
|
|
1434
|
-
else code.innerHTML =
|
|
1552
|
+
else code.innerHTML = hastToHtml(codeAst);
|
|
1435
1553
|
if (!pre.contains(code)) pre.replaceChildren(code);
|
|
1436
1554
|
};
|
|
1437
1555
|
if (this.shouldGuardRebuildScroll()) guardWebKitScrollDuringRebuild(pre, applyColumns);
|
|
@@ -1579,7 +1697,7 @@ var File$1 = class File {
|
|
|
1579
1697
|
this.cleanupErrorWrapper();
|
|
1580
1698
|
this.placeHolder?.remove();
|
|
1581
1699
|
this.placeHolder = void 0;
|
|
1582
|
-
const headerHTML = this.cachedHeaderHTML ??
|
|
1700
|
+
const headerHTML = this.cachedHeaderHTML ?? hastToHtml(headerAST);
|
|
1583
1701
|
this.cachedHeaderHTML = headerHTML;
|
|
1584
1702
|
if (headerHTML !== this.lastRenderedHeaderHTML) {
|
|
1585
1703
|
const tempDiv = document.createElement("div");
|
|
@@ -1591,7 +1709,7 @@ var File$1 = class File {
|
|
|
1591
1709
|
this.headerElement = newHeader;
|
|
1592
1710
|
this.lastRenderedHeaderHTML = headerHTML;
|
|
1593
1711
|
}
|
|
1594
|
-
if (this.
|
|
1712
|
+
if (this.isComponentManaged) return;
|
|
1595
1713
|
const { renderHeaderPrefix, renderHeaderFilenameSuffix, renderCustomHeader, renderHeaderMetadata } = this.options;
|
|
1596
1714
|
if (renderCustomHeader != null) {
|
|
1597
1715
|
const content = renderCustomHeader(file) ?? void 0;
|
|
@@ -1775,10 +1893,9 @@ var VirtualizedFile = class extends File$1 {
|
|
|
1775
1893
|
isVisible = false;
|
|
1776
1894
|
isSetup = false;
|
|
1777
1895
|
layoutDirty = true;
|
|
1778
|
-
forceRenderOverride;
|
|
1779
1896
|
currentCollapsed;
|
|
1780
|
-
constructor(options, virtualizer, metrics = DEFAULT_VIRTUAL_FILE_METRICS, workerManager,
|
|
1781
|
-
super(options, workerManager,
|
|
1897
|
+
constructor(options, virtualizer, metrics = DEFAULT_VIRTUAL_FILE_METRICS, workerManager, requestOwnerRender) {
|
|
1898
|
+
super(options, workerManager, requestOwnerRender);
|
|
1782
1899
|
this.virtualizer = virtualizer;
|
|
1783
1900
|
this.metrics = metrics;
|
|
1784
1901
|
}
|
|
@@ -1805,7 +1922,7 @@ var VirtualizedFile = class extends File$1 {
|
|
|
1805
1922
|
return false;
|
|
1806
1923
|
}
|
|
1807
1924
|
hasLineAnnotations() {
|
|
1808
|
-
return this.
|
|
1925
|
+
return this.getLayoutAnnotations().some((annotation) => annotation.lineNumber > 0);
|
|
1809
1926
|
}
|
|
1810
1927
|
hasUniformLineHeights() {
|
|
1811
1928
|
const { overflow = "scroll" } = this.options;
|
|
@@ -1869,7 +1986,7 @@ var VirtualizedFile = class extends File$1 {
|
|
|
1869
1986
|
this.top = this.getVirtualizedTop();
|
|
1870
1987
|
const ghostTextRows = this.editor?.__getGhostTextRows() ?? NO_GHOST_TEXT_ROWS;
|
|
1871
1988
|
hasHeightChange = this.applyGhostTextRows(ghostTextRows);
|
|
1872
|
-
const measureAllRows = overflow !== "scroll" || this.
|
|
1989
|
+
const measureAllRows = overflow !== "scroll" || this.lineAnnotations.length > 0 || this.isResizeDebuggingEnabled();
|
|
1873
1990
|
if (this.placeHolder != null || !measureAllRows && this.cache.heights.size === 0 && this.cache.fileAnnotationHeight === 0) {
|
|
1874
1991
|
if (hasHeightChange) {
|
|
1875
1992
|
this.computeApproximateSize(true);
|
|
@@ -1912,13 +2029,14 @@ var VirtualizedFile = class extends File$1 {
|
|
|
1912
2029
|
return hasHeightChange;
|
|
1913
2030
|
}
|
|
1914
2031
|
onRender = (dirty) => {
|
|
1915
|
-
|
|
2032
|
+
const file = this.getInputFile();
|
|
2033
|
+
if (this.fileContainer == null || file == null) return false;
|
|
1916
2034
|
if (dirty) this.top = this.getVirtualizedTop();
|
|
1917
|
-
return this.render({ file
|
|
2035
|
+
return this.render({ file });
|
|
1918
2036
|
};
|
|
1919
2037
|
updateCodeViewLayout(file, top, reset, lineAnnotations) {
|
|
1920
|
-
const targetChanged = !areFileTargetsEqual(this.
|
|
1921
|
-
if (targetChanged) this.
|
|
2038
|
+
const targetChanged = !areFileTargetsEqual(this.getInputFile(), file);
|
|
2039
|
+
if (targetChanged) this.updateInputFile(file, lineAnnotations);
|
|
1922
2040
|
const { pendingRenderFile, layoutFileChanged, renderedFileChanged, annotationsChanged } = this.updatePendingRender(file, lineAnnotations);
|
|
1923
2041
|
let shouldResetLayoutCache = reset?.resetFileLayoutCache === true || layoutFileChanged;
|
|
1924
2042
|
if (reset?.metrics != null) {
|
|
@@ -1940,6 +2058,10 @@ var VirtualizedFile = class extends File$1 {
|
|
|
1940
2058
|
getLayoutFile() {
|
|
1941
2059
|
return this.pendingRender?.file ?? this.getRenderedFile();
|
|
1942
2060
|
}
|
|
2061
|
+
getLayoutAnnotations() {
|
|
2062
|
+
const { pendingRender } = this;
|
|
2063
|
+
return pendingRender != null ? this.getAnnotationsForFile(pendingRender.file) : this.lineAnnotations;
|
|
2064
|
+
}
|
|
1943
2065
|
getLinePosition(lineNumber) {
|
|
1944
2066
|
const file = this.getLayoutFile();
|
|
1945
2067
|
if (file == null || lineNumber < 1) return;
|
|
@@ -2029,7 +2151,7 @@ var VirtualizedFile = class extends File$1 {
|
|
|
2029
2151
|
cleanUp(recycle = false) {
|
|
2030
2152
|
const hadGhostTextRows = this.cache.ghostTextRows.size > 0;
|
|
2031
2153
|
if (hadGhostTextRows) this.layoutDirty = true;
|
|
2032
|
-
const shouldRecomputeLayout = recycle && this.isAdvancedMode() && this.fileContainer != null && (hadGhostTextRows || !areFileTargetsEqual(this.getRenderedFile(), this.
|
|
2154
|
+
const shouldRecomputeLayout = recycle && this.isAdvancedMode() && this.fileContainer != null && (hadGhostTextRows || !areFileTargetsEqual(this.getRenderedFile(), this.getWorkingFile()));
|
|
2033
2155
|
if (this.fileContainer != null && this.isSimpleMode()) this.getSimpleVirtualizer()?.disconnect(this.fileContainer);
|
|
2034
2156
|
if (!recycle) this.resetLayoutCache();
|
|
2035
2157
|
this.pendingRender = void 0;
|
|
@@ -2089,13 +2211,17 @@ var VirtualizedFile = class extends File$1 {
|
|
|
2089
2211
|
}
|
|
2090
2212
|
}
|
|
2091
2213
|
rerender() {
|
|
2092
|
-
if (!this.enabled || this.
|
|
2093
|
-
const
|
|
2094
|
-
const nextRenderFile =
|
|
2214
|
+
if (!this.enabled || this.getInputFile() == null) return;
|
|
2215
|
+
const workingFile = this.getWorkingFile();
|
|
2216
|
+
const nextRenderFile = workingFile == null ? void 0 : this.fileRenderer.getFileForNextRender(workingFile);
|
|
2095
2217
|
if (this.isSimpleMode()) this.pendingRender = void 0;
|
|
2096
2218
|
this.forceRenderOverride = true;
|
|
2219
|
+
if (this.isSimpleMode() && this.requestRender()) return;
|
|
2097
2220
|
this.virtualizer.instanceChanged(this, !areFileTargetsEqual(this.getRenderedFile(), nextRenderFile));
|
|
2098
2221
|
}
|
|
2222
|
+
get isComponentManaged() {
|
|
2223
|
+
return this.getAdvancedVirtualizer()?.isComponentManaged ?? super.isComponentManaged;
|
|
2224
|
+
}
|
|
2099
2225
|
syncGhostTextRows() {
|
|
2100
2226
|
const codeView = this.getAdvancedVirtualizer();
|
|
2101
2227
|
if (codeView != null) {
|
|
@@ -2121,13 +2247,13 @@ var VirtualizedFile = class extends File$1 {
|
|
|
2121
2247
|
this.virtualizer.instanceChanged(this, true);
|
|
2122
2248
|
}
|
|
2123
2249
|
render({ fileContainer, file, forceRender = false, lineAnnotations, ...props }) {
|
|
2124
|
-
const didFileChange = !areFileTargetsEqual(this.
|
|
2250
|
+
const didFileChange = !areFileTargetsEqual(this.getInputFile(), file);
|
|
2125
2251
|
if (didFileChange) {
|
|
2126
|
-
this.
|
|
2252
|
+
this.updateInputFile(file, lineAnnotations);
|
|
2127
2253
|
this.cachedHeaderHTML = void 0;
|
|
2128
2254
|
}
|
|
2129
2255
|
const { pendingRenderFile, layoutFileChanged, renderedFileChanged, annotationsChanged } = (() => {
|
|
2130
|
-
if (this.pendingRender != null && this.pendingRender.
|
|
2256
|
+
if (this.pendingRender != null && this.pendingRender.workingFile === (this.getWorkingFile(file) ?? file)) return {
|
|
2131
2257
|
pendingRenderFile: this.pendingRender.file,
|
|
2132
2258
|
layoutFileChanged: false,
|
|
2133
2259
|
renderedFileChanged: false,
|
|
@@ -2176,12 +2302,12 @@ var VirtualizedFile = class extends File$1 {
|
|
|
2176
2302
|
if (this.isSimpleMode()) this.getSimpleVirtualizer()?.requestHeightReconcile(this);
|
|
2177
2303
|
}
|
|
2178
2304
|
updatePendingRender(nextFile, lineAnnotations) {
|
|
2179
|
-
const
|
|
2305
|
+
const workingFile = this.getWorkingFile(nextFile) ?? nextFile;
|
|
2180
2306
|
const previousRenderedFile = this.getRenderedFile();
|
|
2181
2307
|
const previousLayoutFile = this.pendingRender?.file ?? previousRenderedFile;
|
|
2182
|
-
const pendingRenderFile = this.fileRenderer.getFileForNextRender(
|
|
2308
|
+
const pendingRenderFile = this.fileRenderer.getFileForNextRender(workingFile);
|
|
2183
2309
|
this.pendingRender = {
|
|
2184
|
-
|
|
2310
|
+
workingFile,
|
|
2185
2311
|
file: pendingRenderFile
|
|
2186
2312
|
};
|
|
2187
2313
|
return {
|
|
@@ -2272,7 +2398,7 @@ var VirtualizedFile = class extends File$1 {
|
|
|
2272
2398
|
const { fileAnnotationHeight } = this.cache;
|
|
2273
2399
|
const codeRegionTop = headerRegion + fileAnnotationHeight;
|
|
2274
2400
|
const codeRowsHeight = Math.max(0, fileHeight - headerRegion - fileAnnotationHeight - paddingBottom);
|
|
2275
|
-
const hasFileAnnotations = includesFileAnnotations(this.
|
|
2401
|
+
const hasFileAnnotations = includesFileAnnotations(this.getLayoutAnnotations());
|
|
2276
2402
|
const fileAnnotationTop = fileTop + headerRegion;
|
|
2277
2403
|
const measuredFileAnnotationVisible = fileAnnotationHeight > 0 && hasFileAnnotations && fileAnnotationTop < bottom && fileAnnotationTop + fileAnnotationHeight > top;
|
|
2278
2404
|
if (fileTop < top - fileHeight || fileTop > bottom) return {
|
|
@@ -2403,7 +2529,7 @@ function renderFileChildren({ file, renderCustomHeader, renderHeaderPrefix, rend
|
|
|
2403
2529
|
] }),
|
|
2404
2530
|
renderAnnotation != null && lineAnnotations?.map((annotation, index) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
2405
2531
|
slot: getAnnotationSlotName(annotation),
|
|
2406
|
-
children: renderAnnotation(annotation)
|
|
2532
|
+
children: renderAnnotation(annotation, file)
|
|
2407
2533
|
}, index)),
|
|
2408
2534
|
renderGutterUtility != null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
2409
2535
|
slot: "gutter-utility-slot",
|
|
@@ -2437,6 +2563,12 @@ function useFileInstance({ file, options, editorOptions, editStateKey, lineAnnot
|
|
|
2437
2563
|
});
|
|
2438
2564
|
const onEditComplete = _onEditComplete != null ? handleOnEditComplete : void 0;
|
|
2439
2565
|
const instanceRef = reactExports.useRef(null);
|
|
2566
|
+
const forceUpdate = useForceUpdate();
|
|
2567
|
+
const accepted = useAcceptedValues(acceptedCache, file, lineAnnotations);
|
|
2568
|
+
const renderData = useNextRenderData(instanceRef, accepted) ?? {
|
|
2569
|
+
file,
|
|
2570
|
+
lineAnnotations: lineAnnotations ?? EMPTY_LINE_ANNOTATIONS
|
|
2571
|
+
};
|
|
2440
2572
|
const disposeEditorRef = reactExports.useRef(null);
|
|
2441
2573
|
const getEditor = useStableCallback(() => {
|
|
2442
2574
|
if (createEditor2 == null) throw new Error("File: EditContext is not attached");
|
|
@@ -2452,7 +2584,7 @@ function useFileInstance({ file, options, editorOptions, editStateKey, lineAnnot
|
|
|
2452
2584
|
onEditChange,
|
|
2453
2585
|
onEditComplete,
|
|
2454
2586
|
options
|
|
2455
|
-
}), simpleVirtualizer, metrics, !disableWorkerPool ? poolManager : void 0,
|
|
2587
|
+
}), simpleVirtualizer, metrics, !disableWorkerPool ? poolManager : void 0, forceUpdate);
|
|
2456
2588
|
else instanceRef.current = new File$1(mergeFileOptions({
|
|
2457
2589
|
controlledSelection,
|
|
2458
2590
|
hasCustomHeader,
|
|
@@ -2460,7 +2592,7 @@ function useFileInstance({ file, options, editorOptions, editStateKey, lineAnnot
|
|
|
2460
2592
|
onEditChange,
|
|
2461
2593
|
onEditComplete,
|
|
2462
2594
|
options
|
|
2463
|
-
}), !disableWorkerPool ? poolManager : void 0,
|
|
2595
|
+
}), !disableWorkerPool ? poolManager : void 0, forceUpdate);
|
|
2464
2596
|
if (edit && disposeEditorRef.current == null) disposeEditorRef.current = applyEdit(instanceRef.current, getEditor);
|
|
2465
2597
|
instanceRef.current.hydrate({
|
|
2466
2598
|
file,
|
|
@@ -2486,7 +2618,7 @@ function useFileInstance({ file, options, editorOptions, editStateKey, lineAnnot
|
|
|
2486
2618
|
onEditComplete,
|
|
2487
2619
|
options
|
|
2488
2620
|
});
|
|
2489
|
-
const forceRender =
|
|
2621
|
+
const forceRender = !areOptionsEqual(instance.options, newOptions);
|
|
2490
2622
|
instance.setOptions(newOptions);
|
|
2491
2623
|
if (!edit && disposeEditorRef.current != null) {
|
|
2492
2624
|
const { current: disposeEditor } = disposeEditorRef;
|
|
@@ -2500,41 +2632,42 @@ function useFileInstance({ file, options, editorOptions, editStateKey, lineAnnot
|
|
|
2500
2632
|
forceRender
|
|
2501
2633
|
});
|
|
2502
2634
|
if (selectedLines !== void 0) instance.setSelectedLines(selectedLines);
|
|
2503
|
-
if (edit && disposeEditorRef.current == null)
|
|
2635
|
+
if (edit && disposeEditorRef.current == null) {
|
|
2636
|
+
disposeEditorRef.current = applyEdit(instance, getEditor);
|
|
2637
|
+
forceUpdate();
|
|
2638
|
+
}
|
|
2504
2639
|
});
|
|
2640
|
+
const getHoveredLine = reactExports.useCallback(() => {
|
|
2641
|
+
return instanceRef.current?.getHoveredLine();
|
|
2642
|
+
}, []);
|
|
2643
|
+
const getAnnotationSlotName = reactExports.useCallback((annotation) => instanceRef.current?.getAnnotationSlotName(annotation) ?? getLineAnnotationName(annotation), []);
|
|
2505
2644
|
return {
|
|
2645
|
+
...renderData,
|
|
2506
2646
|
ref,
|
|
2507
|
-
getHoveredLine
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2647
|
+
getHoveredLine,
|
|
2648
|
+
getAnnotationSlotName
|
|
2649
|
+
};
|
|
2650
|
+
}
|
|
2651
|
+
function useAcceptedValues(acceptedCache, file, lineAnnotations) {
|
|
2652
|
+
"use no memo";
|
|
2653
|
+
return getAcceptedValues(file, lineAnnotations, acceptedCache.current);
|
|
2654
|
+
}
|
|
2655
|
+
function getAcceptedValues(file, lineAnnotations, accepted) {
|
|
2656
|
+
return {
|
|
2657
|
+
file: accepted?.file != null && areFileTargetsEqual(file, accepted.file.stale) ? accepted.file.installed : file,
|
|
2658
|
+
lineAnnotations: accepted?.annotations != null && lineAnnotations === accepted.annotations.stale ? accepted.annotations.installed : lineAnnotations
|
|
2511
2659
|
};
|
|
2512
2660
|
}
|
|
2513
2661
|
function resolveAcceptedValues(file, lineAnnotations, acceptedCache) {
|
|
2514
2662
|
const { current: accepted } = acceptedCache;
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
const { file: acceptedFiles, annotations: acceptedAnnotations } = accepted;
|
|
2520
|
-
let resolvedFile = file;
|
|
2521
|
-
if (acceptedFiles != null) {
|
|
2522
|
-
if (areFileTargetsEqual(file, acceptedFiles.stale)) resolvedFile = acceptedFiles.installed;
|
|
2523
|
-
else accepted.file = null;
|
|
2524
|
-
}
|
|
2525
|
-
let resolvedAnnotations = lineAnnotations;
|
|
2526
|
-
if (acceptedAnnotations != null) {
|
|
2527
|
-
if (lineAnnotations === acceptedAnnotations.stale) resolvedAnnotations = acceptedAnnotations.installed;
|
|
2528
|
-
else accepted.annotations = null;
|
|
2529
|
-
}
|
|
2663
|
+
const resolved = getAcceptedValues(file, lineAnnotations, accepted);
|
|
2664
|
+
if (accepted == null) return resolved;
|
|
2665
|
+
if (accepted.file != null && !areFileTargetsEqual(file, accepted.file.stale)) accepted.file = null;
|
|
2666
|
+
if (lineAnnotations !== accepted.annotations?.stale) accepted.annotations = null;
|
|
2530
2667
|
if (accepted.file == null && accepted.annotations == null) acceptedCache.current = null;
|
|
2531
|
-
return
|
|
2532
|
-
file: resolvedFile,
|
|
2533
|
-
lineAnnotations: resolvedAnnotations
|
|
2534
|
-
};
|
|
2668
|
+
return resolved;
|
|
2535
2669
|
}
|
|
2536
2670
|
function mergeFileOptions({ options, controlledSelection, hasCustomHeader, hasGutterRenderUtility, onEditChange, onEditComplete }) {
|
|
2537
|
-
if (!(controlledSelection || hasGutterRenderUtility || hasCustomHeader || onEditChange != null || onEditComplete != null)) return options;
|
|
2538
2671
|
return {
|
|
2539
2672
|
...options,
|
|
2540
2673
|
controlledSelection,
|
|
@@ -2554,7 +2687,7 @@ function applyEdit(instance, getEditor) {
|
|
|
2554
2687
|
}
|
|
2555
2688
|
}
|
|
2556
2689
|
function File2({ file, lineAnnotations, selectedLines, options, editorOptions, editStateKey, metrics, className, style, renderAnnotation, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, prerenderedHTML, renderGutterUtility, disableWorkerPool = false, edit = false, onEditChange, onEditComplete }) {
|
|
2557
|
-
const { ref, getHoveredLine, getAnnotationSlotName } = useFileInstance({
|
|
2690
|
+
const { ref, getHoveredLine, getAnnotationSlotName, file: renderedFile, lineAnnotations: renderedAnnotations } = useFileInstance({
|
|
2558
2691
|
file,
|
|
2559
2692
|
options,
|
|
2560
2693
|
editorOptions,
|
|
@@ -2571,14 +2704,14 @@ function File2({ file, lineAnnotations, selectedLines, options, editorOptions, e
|
|
|
2571
2704
|
onEditComplete
|
|
2572
2705
|
});
|
|
2573
2706
|
const children = renderFileChildren({
|
|
2574
|
-
file,
|
|
2707
|
+
file: renderedFile,
|
|
2575
2708
|
renderAnnotation,
|
|
2576
2709
|
renderCustomHeader,
|
|
2577
2710
|
renderHeaderPrefix,
|
|
2578
2711
|
renderHeaderFilenameSuffix,
|
|
2579
2712
|
renderHeaderMetadata,
|
|
2580
2713
|
renderGutterUtility,
|
|
2581
|
-
lineAnnotations,
|
|
2714
|
+
lineAnnotations: renderedAnnotations,
|
|
2582
2715
|
getHoveredLine,
|
|
2583
2716
|
getAnnotationSlotName
|
|
2584
2717
|
});
|
|
@@ -4011,7 +4144,8 @@ function isPrimaryModifier({ metaKey, ctrlKey }, isMac = isMacLike()) {
|
|
|
4011
4144
|
return isMac ? metaKey && !ctrlKey : ctrlKey && !metaKey;
|
|
4012
4145
|
}
|
|
4013
4146
|
function isMoveCursorShortcut(e) {
|
|
4014
|
-
|
|
4147
|
+
const isMac = isMacLike();
|
|
4148
|
+
if (isMac && e.ctrlKey && !e.altKey && !e.metaKey) switch (e.key) {
|
|
4015
4149
|
case "a":
|
|
4016
4150
|
return "start";
|
|
4017
4151
|
case "e":
|
|
@@ -4033,9 +4167,9 @@ function isMoveCursorShortcut(e) {
|
|
|
4033
4167
|
else if (e.key === "Home") return "start";
|
|
4034
4168
|
else if (e.key === "End") return "end";
|
|
4035
4169
|
}
|
|
4036
|
-
if (isPrimaryModifier(e)) {
|
|
4037
|
-
if (e.key === "ArrowLeft") return "textStart";
|
|
4038
|
-
else if (e.key === "ArrowRight") return "end";
|
|
4170
|
+
if (!e.altKey && isPrimaryModifier(e, isMac)) {
|
|
4171
|
+
if (e.key === "ArrowLeft") return isMac ? "textStart" : "wordLeft";
|
|
4172
|
+
else if (e.key === "ArrowRight") return isMac ? "end" : "wordRight";
|
|
4039
4173
|
}
|
|
4040
4174
|
}
|
|
4041
4175
|
const compiledEditorKeymaps = /* @__PURE__ */ new WeakMap();
|
|
@@ -4159,83 +4293,6 @@ function resolveFindAgainShortcut(event, isMac = isMacLike()) {
|
|
|
4159
4293
|
if (!isPrimaryModifier(event, isMac)) return;
|
|
4160
4294
|
if ((event.key.length === 1 ? event.key.toLowerCase() : event.key) === "g" || event.code === "KeyG") return event.shiftKey ? "previous" : "next";
|
|
4161
4295
|
}
|
|
4162
|
-
function h(tagName, props, parent) {
|
|
4163
|
-
const { style, dataset, children, ...attrs } = props ?? {};
|
|
4164
|
-
const el = document.createElement(tagName);
|
|
4165
|
-
Object.assign(el, attrs);
|
|
4166
|
-
if (style !== void 0) {
|
|
4167
|
-
if (typeof style === "string") el.style.cssText = style;
|
|
4168
|
-
else Object.assign(el.style, style);
|
|
4169
|
-
}
|
|
4170
|
-
if (dataset !== void 0) {
|
|
4171
|
-
if (typeof dataset === "string") el.dataset[dataset] = "";
|
|
4172
|
-
else if (Array.isArray(dataset)) dataset.forEach((key) => {
|
|
4173
|
-
el.dataset[key] = "";
|
|
4174
|
-
});
|
|
4175
|
-
else Object.assign(el.dataset, dataset);
|
|
4176
|
-
}
|
|
4177
|
-
if (children !== void 0) el.replaceChildren(...children);
|
|
4178
|
-
if (parent !== void 0) parent.appendChild(el);
|
|
4179
|
-
return el;
|
|
4180
|
-
}
|
|
4181
|
-
function addEventListener(el, event, listener, options) {
|
|
4182
|
-
el.addEventListener(event, listener, options);
|
|
4183
|
-
return () => el.removeEventListener(event, listener, options);
|
|
4184
|
-
}
|
|
4185
|
-
function getLineNumberAttr(el, key = "line") {
|
|
4186
|
-
const value = el.dataset[key];
|
|
4187
|
-
if (value === void 0) return;
|
|
4188
|
-
const lineNumber = parseInt(value, 10);
|
|
4189
|
-
if (Number.isNaN(lineNumber)) return;
|
|
4190
|
-
return lineNumber;
|
|
4191
|
-
}
|
|
4192
|
-
function clampDomOffset(node, offset) {
|
|
4193
|
-
if (node.nodeType === 3) {
|
|
4194
|
-
const length = node.textContent?.length ?? 0;
|
|
4195
|
-
return Math.max(0, Math.min(offset, length));
|
|
4196
|
-
}
|
|
4197
|
-
if (node.nodeType === 1) return Math.max(0, Math.min(offset, node.childNodes.length));
|
|
4198
|
-
return 0;
|
|
4199
|
-
}
|
|
4200
|
-
function extend(obj, attrs) {
|
|
4201
|
-
return Object.assign(obj, attrs);
|
|
4202
|
-
}
|
|
4203
|
-
function debounce(func, wait) {
|
|
4204
|
-
let timeout;
|
|
4205
|
-
return function(...args) {
|
|
4206
|
-
clearTimeout(timeout);
|
|
4207
|
-
timeout = setTimeout(() => func.apply(this, args), wait);
|
|
4208
|
-
};
|
|
4209
|
-
}
|
|
4210
|
-
function round(value, precision = 1e3) {
|
|
4211
|
-
return Math.round(value * precision) / precision;
|
|
4212
|
-
}
|
|
4213
|
-
function endsWithLineBreak(text) {
|
|
4214
|
-
return text.endsWith("\n") || text.endsWith("\r");
|
|
4215
|
-
}
|
|
4216
|
-
function createSegmenter(options) {
|
|
4217
|
-
if (typeof Intl === "undefined" || typeof Intl.Segmenter !== "function") return;
|
|
4218
|
-
return new Intl.Segmenter(void 0, options);
|
|
4219
|
-
}
|
|
4220
|
-
let graphemeSegmenter;
|
|
4221
|
-
let graphemeSegmenterInit = false;
|
|
4222
|
-
function getGraphemeSegmenter() {
|
|
4223
|
-
if (!graphemeSegmenterInit) {
|
|
4224
|
-
graphemeSegmenter = createSegmenter({ granularity: "grapheme" });
|
|
4225
|
-
graphemeSegmenterInit = true;
|
|
4226
|
-
}
|
|
4227
|
-
return graphemeSegmenter;
|
|
4228
|
-
}
|
|
4229
|
-
function lookupScrollContainer(element) {
|
|
4230
|
-
const ownerDocument = element.ownerDocument;
|
|
4231
|
-
let parentElement = element.parentElement;
|
|
4232
|
-
while (parentElement != null && parentElement !== ownerDocument.body && parentElement !== ownerDocument.documentElement) {
|
|
4233
|
-
const overflowY = parentElement.ownerDocument.defaultView?.getComputedStyle(parentElement).overflowY;
|
|
4234
|
-
if (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay") return parentElement;
|
|
4235
|
-
parentElement = parentElement.parentElement;
|
|
4236
|
-
}
|
|
4237
|
-
return ownerDocument;
|
|
4238
|
-
}
|
|
4239
4296
|
var PopoverManager = class {
|
|
4240
4297
|
#fileContainer;
|
|
4241
4298
|
#codeElement;
|
|
@@ -4716,7 +4773,7 @@ function resolveIndentEdits(textDocument, selection, tabSize, outdent) {
|
|
|
4716
4773
|
function mapCursorMove(textDocument, selections, shortcut, options = {}) {
|
|
4717
4774
|
const lineCount = textDocument.lineCount;
|
|
4718
4775
|
return selections.map((selection) => {
|
|
4719
|
-
let { line, character } = shortcut === "up" || shortcut === "left" ? selection.start : selection.end;
|
|
4776
|
+
let { line, character } = shortcut === "up" || shortcut === "left" || shortcut === "wordLeft" ? selection.start : selection.end;
|
|
4720
4777
|
if (shortcut === "textStart" || shortcut === "start" || shortcut === "end") {
|
|
4721
4778
|
const caret = getCaretPosition(selection);
|
|
4722
4779
|
line = caret.line;
|
|
@@ -4745,8 +4802,8 @@ function mapCursorMove(textDocument, selections, shortcut, options = {}) {
|
|
|
4745
4802
|
} else if (isCollapsedSelection(selection)) {
|
|
4746
4803
|
const lineLength = textDocument.getLineLength(line);
|
|
4747
4804
|
character = Math.min(character, lineLength);
|
|
4748
|
-
if (shortcut === "left") {
|
|
4749
|
-
if (character > 0) character = stepCharacterByGrapheme(textDocument, line, character, false);
|
|
4805
|
+
if (shortcut === "left" || shortcut === "wordLeft") {
|
|
4806
|
+
if (character > 0) character = shortcut === "left" ? stepCharacterByGrapheme(textDocument, line, character, false) : findWordBoundary(textDocument.getLineText(line), character, false);
|
|
4750
4807
|
else if (line > 0) {
|
|
4751
4808
|
const targetLine = options.resolveRenderableLine == null ? line - 1 : options.resolveRenderableLine(line - 1, "up");
|
|
4752
4809
|
if (targetLine !== void 0) {
|
|
@@ -4754,7 +4811,7 @@ function mapCursorMove(textDocument, selections, shortcut, options = {}) {
|
|
|
4754
4811
|
character = textDocument.getLineLength(line);
|
|
4755
4812
|
}
|
|
4756
4813
|
}
|
|
4757
|
-
} else if (character < lineLength) character = stepCharacterByGrapheme(textDocument, line, character, true);
|
|
4814
|
+
} else if (character < lineLength) character = shortcut === "right" ? stepCharacterByGrapheme(textDocument, line, character, true) : findWordBoundary(textDocument.getLineText(line), character, true);
|
|
4758
4815
|
else if (line < lineCount - 1) {
|
|
4759
4816
|
const targetLine = options.resolveRenderableLine == null ? line + 1 : options.resolveRenderableLine(line + 1, "down");
|
|
4760
4817
|
if (targetLine !== void 0) {
|
|
@@ -5744,8 +5801,7 @@ function resolveDeleteWordBackwardRange(textDocument, selection) {
|
|
|
5744
5801
|
let match;
|
|
5745
5802
|
while (pos > 0) {
|
|
5746
5803
|
const prev = findClusterBreak(lineText, pos, false, graphemeStarts);
|
|
5747
|
-
const
|
|
5748
|
-
const nextMatch = !/\S/.test(nextChar) ? 0 : new RegExp("\\p{Alphabetic}|\\p{Number}|_", "u").test(nextChar) ? 1 : 2;
|
|
5804
|
+
const nextMatch = getWordCharKind(lineText.slice(prev, pos));
|
|
5749
5805
|
if (match !== void 0 && nextMatch !== match) break;
|
|
5750
5806
|
if (nextMatch !== 0 || pos !== head) match = nextMatch;
|
|
5751
5807
|
pos = prev;
|
|
@@ -5758,6 +5814,32 @@ function resolveDeleteWordBackwardRange(textDocument, selection) {
|
|
|
5758
5814
|
character: head
|
|
5759
5815
|
}];
|
|
5760
5816
|
}
|
|
5817
|
+
function getWordCharKind(text) {
|
|
5818
|
+
return !/\S/.test(text) ? 0 : new RegExp("\\p{Alphabetic}|\\p{Number}|_", "u").test(text) ? 1 : 2;
|
|
5819
|
+
}
|
|
5820
|
+
function findWordBoundary(lineText, character, forward) {
|
|
5821
|
+
const segments = getGraphemeSegmenter()?.segment(lineText);
|
|
5822
|
+
let pos = character;
|
|
5823
|
+
let kind = 0;
|
|
5824
|
+
while (forward ? pos < lineText.length : pos > 0) {
|
|
5825
|
+
let text;
|
|
5826
|
+
let next;
|
|
5827
|
+
const segment = segments?.containing(forward ? pos : pos - 1);
|
|
5828
|
+
if (segment !== void 0) {
|
|
5829
|
+
text = segment.segment;
|
|
5830
|
+
next = forward ? segment.index + text.length : segment.index;
|
|
5831
|
+
} else {
|
|
5832
|
+
const start = forward ? pos : (lineText.codePointAt(pos - 2) ?? 0) > 65535 ? pos - 2 : pos - 1;
|
|
5833
|
+
text = String.fromCodePoint(lineText.codePointAt(start) ?? 0);
|
|
5834
|
+
next = forward ? pos + text.length : start;
|
|
5835
|
+
}
|
|
5836
|
+
const nextKind = getWordCharKind(text);
|
|
5837
|
+
if (kind !== 0 && nextKind !== kind) break;
|
|
5838
|
+
kind = nextKind;
|
|
5839
|
+
pos = next;
|
|
5840
|
+
}
|
|
5841
|
+
return pos;
|
|
5842
|
+
}
|
|
5761
5843
|
function findClusterBreak(text, pos, forward, graphemeStarts) {
|
|
5762
5844
|
if (forward) {
|
|
5763
5845
|
for (const start of graphemeStarts) if (start > pos) return start;
|
|
@@ -6357,7 +6439,7 @@ function cloneRetainedDiffSessionSnapshot(snapshot) {
|
|
|
6357
6439
|
hunks: cloneHunks(snapshot.hunks)
|
|
6358
6440
|
};
|
|
6359
6441
|
}
|
|
6360
|
-
var editor_default = '@layer base,theme,rendered,unsafe;::selection{background-color:#0000}[data-deleted-text-selection] [data-deletions] ::selection,[data-deleted-text-selection] [data-line-type=change-deletion] ::selection{background-color:var(--diffs-editor-selection-bg)}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content],[data-diff-type=split][data-overflow=wrap]{position:relative}[data-code]{container-type:inline-size}[data-content]{cursor:text;caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-line]{cursor:text;background-color:#0000}[data-line]:after{content:"";z-index:-20;background-color:var(--diffs-line-bg);pointer-events:none;position:absolute;inset:0}[data-line][data-editor-active-line]:after{box-shadow:inset 0 0 0 1px var(--diffs-editor-line-highlight-border)}[data-editor-overlay]{display:contents}[data-caret],[data-edit-prediction],[data-selection-range],[data-match-range],[data-bracket-match-range],[data-edit-prediction-deletion-range],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range],[data-marker-range],[data-remote-caret],[data-caret-highlight-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-edit-prediction]{z-index:1;user-select:none;width:max-content;height:auto;color:var(--diffs-editor-edit-prediction-fg,color-mix(in lab, var(--diffs-fg) 45%, transparent));overflow:visible}[data-edit-prediction-line]{box-sizing:border-box;white-space:pre;width:max-content;min-height:1lh;display:block}[data-edit-prediction][data-replacement] [data-edit-prediction-line],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range]{background-color:var(--diffs-edit-prediction-bg,var(--diffs-bg))}[data-edit-prediction-suffix]{color:var(--diffs-fg)}[data-edit-prediction][data-wrap] [data-edit-prediction-line]{overflow-wrap:anywhere;white-space:pre-wrap;max-width:100%}[data-edit-prediction-line][data-empty]:after{content:"↵"}[data-edit-prediction-spacer]{margin-block-end:var(--diffs-edit-prediction-spacer-height)}[data-code][data-deletions] [data-edit-prediction-spacer]{box-sizing:content-box;margin-block-end:0;padding-block-end:var(--diffs-edit-prediction-spacer-height)}[data-edit-prediction-deletion-range]{--diffs-edit-prediction-deletion-color:var(--diffs-editor-edit-prediction-deletion-fg,color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));z-index:1;background:linear-gradient(to bottom, transparent calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% + .5px), transparent calc(50% + .5px))}[data-edit-prediction-insertion-range]{z-index:0}[data-edit-prediction-replacement-range]{z-index:1}[data-caret]{z-index:2;background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px}@media (prefers-reduced-motion:no-preference){[data-caret]{animation:1.2s .8s infinite blinking}}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-caret-highlight-range]{z-index:-10;background-color:var(--diffs-caret-highlight-bg,var(--diffs-editor-selection-bg))}[data-selection-corner]{background-color:var(--diffs-selection-corner-bg,var(--diffs-bg));width:100%;height:100%}[data-match-range]{z-index:-10;background-color:var(--diffs-editor-match-bg,var(--diffs-editor-selection-bg))}[data-match-range]:not([data-focus]){background-color:var(--diffs-editor-match-highlight-bg,light-dark(#ff963288,#ff963266))}[data-bracket-match-range]{z-index:-9;box-sizing:border-box;border-bottom:1px solid var(--diffs-editor-bracket-match-border,color-mix(in lab, var(--diffs-fg) 60%, transparent));background-color:var(--diffs-editor-bracket-match-bg,color-mix(in lab, var(--diffs-fg) 5%, transparent))}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}[data-marker-range]{z-index:1;background-color:var(--diffs-marker-bg);mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-error-fg,var(--diffs-deletion-base))}[data-marker-warning]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-warning-fg,light-dark(var(--diffs-warning-light),var(--diffs-warning-dark)))}[data-marker-info]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-info-fg,var(--diffs-modified-base))}[data-marker-hint]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-hint-fg,var(--diffs-fg-number))}@media (width>=480px){[data-content]{caret-color:#0000}[data-content]:focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-fg:var(--diffs-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;width:fit-content;max-width:calc(100% - 24px);font:14px/20px var(--diffs-header-font-fallback);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popover],[data-selection-action-popover]{--popover-gap:var(--diffs-popover-gap,var(--diffs-gap-fallback,8px));--popover-viewport-left:0px;--popover-viewport-right:100cqw;--popover-viewport-top:-99999px;--popover-viewport-bottom:99999px;--popover-min-left:calc(var(--popover-viewport-left) + var(--gutter-width,0px) + var(--popover-gap));--popover-available-width:max(0px, calc(var(--popover-viewport-right) - var(--popover-min-left) - var(--popover-gap)));max-width:min(640px, var(--popover-available-width));translate:clamp(var(--popover-min-left), var(--popover-x,var(--popover-min-left)), calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)) clamp(var(--popover-viewport-top), calc(var(--popover-y,0px) + var(--popover-y-shift,0px)), calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%))}[data-marker-popover]{--diffs-widget-bg:var(--diffs-marker-bg);--diffs-widget-shadow:0 4px 8px #00000026, 0 6px 18px #00000026;min-width:min(180px, var(--popover-available-width));overflow-wrap:anywhere;color:var(--diffs-marker-contrast);white-space:normal;pointer-events:auto;border:0;padding:8px 12px;@supports (color:contrast-color(red)){color:contrast-color(var(--diffs-marker-bg,var(--diffs-bg)))}& [data-marker-message]{white-space:normal;overflow-wrap:anywhere;& code{white-space:normal;color:inherit;background-color:#0000;display:inline}}}[data-selection-action-popover]{pointer-events:auto;flex-wrap:wrap;align-items:center;gap:4px;width:max-content;padding:4px;display:flex}[data-search-panel]{z-index:100;flex-direction:column;justify-content:right;width:100%;height:0;display:flex;position:sticky;top:16px;right:16px;container:search-panel/inline-size;& [data-editor-widget]{z-index:100;flex-shrink:0;align-items:stretch;gap:8px;min-width:260px;max-width:100%;margin-inline:auto 16px;padding:4px;display:flex;position:relative}& svg{fill:currentColor;width:12px;height:12px;display:block}}[data-search-grid]{grid-template-columns:auto auto auto;grid-template-areas:"find matches nav""replace actions.";align-items:center;gap:4px 6px;width:100%;display:grid}[data-input-box][data-find]{grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find]{grid-template-areas:"find matches nav"}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-search-panel] [data-editor-widget]{padding:10px}[data-search-grid][data-mode=replace]{grid-template-columns:auto 1fr auto;grid-template-areas:"find find find""replace replace replace""nav matches actions"}[data-search-grid][data-mode=find]{grid-template-columns:auto 1fr auto;grid-template-areas:"find find find""nav matches matches"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative;& input{width:100%;min-width:0;color:var(--diffs-fg);background-color:var(--diffs-bg);border:1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));border-radius:6px;outline:none;flex-grow:1;padding-inline:6px;font-size:13px;line-height:24px;&::selection{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg))}&:focus-visible{outline:1px solid var(--diffs-modified-base)}}&[data-find] input{padding-inline-end:72px}& [data-search-icon]{--diffs-search-icon-size:20px}}[data-search-toggles]{align-items:center;gap:1px;display:flex;position:absolute;top:50%;right:4px;transform:translateY(-50%)}[data-matches]{white-space:nowrap;min-width:50px;color:color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));flex-shrink:0;grid-area:matches;font-size:12px;font-weight:500;line-height:20px;&[data-no-matches]{color:color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg))}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex;&:disabled{opacity:.25;cursor:default}&:not(:disabled):hover{color:var(--diffs-fg)}&:focus-visible{outline:1px solid var(--diffs-modified-base)}&[aria-pressed=true]{color:var(--diffs-modified-base)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);&:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}\n';
|
|
6442
|
+
var editor_default = '@layer base,theme,rendered,unsafe;::selection{background-color:#0000}[data-deleted-text-selection] [data-deletions] ::selection,[data-deleted-text-selection] [data-line-type=change-deletion] ::selection{background-color:var(--diffs-editor-selection-bg)}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content],[data-diff-type=split][data-overflow=wrap]{position:relative}[data-code]{container-type:inline-size}[data-content]{cursor:text;caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-line]{cursor:text;background-color:#0000}[data-line]:after{content:"";z-index:-20;background-color:var(--diffs-line-bg);pointer-events:none;position:absolute;inset:0}[data-line][data-editor-active-line]:after{box-shadow:inset 0 0 0 1px var(--diffs-editor-line-highlight-border)}[data-editor-overlay]{display:contents}[data-caret],[data-edit-prediction],[data-selection-range],[data-match-range],[data-bracket-match-range],[data-edit-prediction-deletion-range],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range],[data-marker-range],[data-remote-caret],[data-caret-highlight-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-edit-prediction]{z-index:1;user-select:none;width:max-content;height:auto;color:var(--diffs-editor-edit-prediction-fg,color-mix(in lab, var(--diffs-fg) 45%, transparent));overflow:visible}[data-edit-prediction-line]{box-sizing:border-box;white-space:pre;width:max-content;min-height:1lh;display:block}[data-edit-prediction][data-replacement] [data-edit-prediction-line],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range]{background-color:var(--diffs-edit-prediction-bg,var(--diffs-bg))}[data-edit-prediction-suffix]{color:var(--diffs-fg)}[data-edit-prediction][data-wrap] [data-edit-prediction-line]{overflow-wrap:anywhere;white-space:pre-wrap;max-width:100%}[data-edit-prediction-line][data-empty]:after{content:"↵"}[data-edit-prediction-spacer]{margin-block-end:var(--diffs-edit-prediction-spacer-height)}[data-code][data-deletions] [data-edit-prediction-spacer]{box-sizing:content-box;margin-block-end:0;padding-block-end:var(--diffs-edit-prediction-spacer-height)}[data-edit-prediction-deletion-range]{--diffs-edit-prediction-deletion-color:var(--diffs-editor-edit-prediction-deletion-fg,color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));z-index:1;background:linear-gradient(to bottom, transparent calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% + .5px), transparent calc(50% + .5px))}[data-edit-prediction-insertion-range]{z-index:0}[data-edit-prediction-replacement-range]{z-index:1}[data-caret]{z-index:2;background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px}@media (prefers-reduced-motion:no-preference){[data-caret]{animation:1.2s .8s infinite blinking}}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-caret-highlight-range]{z-index:-10;background-color:var(--diffs-caret-highlight-bg,var(--diffs-editor-selection-bg))}[data-selection-corner]{background-color:var(--diffs-selection-corner-bg,var(--diffs-bg));width:100%;height:100%}[data-match-range]{z-index:-10;background-color:var(--diffs-editor-match-bg,var(--diffs-editor-selection-bg))}[data-match-range]:not([data-focus]){background-color:var(--diffs-editor-match-highlight-bg,light-dark(#ff963288,#ff963266))}[data-bracket-match-range]{z-index:-9;box-sizing:border-box;border-bottom:1px solid var(--diffs-editor-bracket-match-border,color-mix(in lab, var(--diffs-fg) 60%, transparent));background-color:var(--diffs-editor-bracket-match-bg,color-mix(in lab, var(--diffs-fg) 5%, transparent))}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}[data-marker-range]{z-index:1;background-color:var(--diffs-marker-bg);mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-error-fg,var(--diffs-deletion-base))}[data-marker-warning]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-warning-fg,light-dark(var(--diffs-warning-light),var(--diffs-warning-dark)))}[data-marker-info]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-info-fg,var(--diffs-modified-base))}[data-marker-hint]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-hint-fg,var(--diffs-fg-number))}@media (width>=480px){[data-content]{caret-color:#0000}[data-content]:focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-fg:var(--diffs-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;width:fit-content;max-width:calc(100% - 24px);font:14px/20px var(--diffs-header-font-fallback);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popover],[data-selection-action-popover]{--popover-gap:var(--diffs-popover-gap,var(--diffs-gap-fallback,8px));--popover-viewport-left:0px;--popover-viewport-right:100cqw;--popover-viewport-top:-99999px;--popover-viewport-bottom:99999px;--popover-min-left:calc(var(--popover-viewport-left) + var(--gutter-width,0px) + var(--popover-gap));--popover-available-width:max(0px, calc(var(--popover-viewport-right) - var(--popover-min-left) - var(--popover-gap)));max-width:min(640px, var(--popover-available-width));translate:clamp(var(--popover-min-left), var(--popover-x,var(--popover-min-left)), calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)) clamp(var(--popover-viewport-top), calc(var(--popover-y,0px) + var(--popover-y-shift,0px)), calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%))}[data-marker-popover]{--diffs-widget-bg:var(--diffs-marker-bg);--diffs-widget-shadow:0 4px 8px #00000026, 0 6px 18px #00000026;min-width:min(180px, var(--popover-available-width));overflow-wrap:anywhere;color:var(--diffs-marker-contrast);white-space:normal;pointer-events:auto;border:0;padding:8px 12px;@supports (color:contrast-color(red)){color:contrast-color(var(--diffs-marker-bg,var(--diffs-bg)))}& [data-marker-message]{white-space:normal;overflow-wrap:anywhere;& code{white-space:normal;color:inherit;background-color:#0000;display:inline}}}[data-selection-action-popover]{pointer-events:auto;flex-wrap:wrap;align-items:center;gap:4px;width:max-content;padding:4px;display:flex}[data-search-panel]{z-index:100;flex-direction:column;justify-content:right;width:100%;height:0;display:flex;position:sticky;top:16px;right:16px;container:search-panel/inline-size;& [data-editor-widget]{z-index:100;flex-shrink:0;align-items:stretch;gap:8px;min-width:260px;max-width:100%;margin-inline:auto 16px;padding:4px;display:flex;position:relative}& svg{fill:currentColor;width:12px;height:12px;display:block}}[data-search-grid]{grid-template-columns:auto auto auto auto;grid-template-areas:"toggle find matches nav"".replace actions.";align-items:center;gap:4px 6px;width:100%;display:grid}[data-input-box][data-find]{grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find]{grid-template-areas:"toggle find matches nav"}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-search-panel] [data-editor-widget]{padding:10px}[data-search-grid][data-mode=replace]{grid-template-columns:auto auto 1fr auto;grid-template-areas:"toggle find find find"".replace replace replace"".nav matches actions"}[data-search-grid][data-mode=find]{grid-template-columns:auto auto 1fr auto;grid-template-areas:"toggle find find find"".nav matches matches"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative;& input{width:100%;min-width:0;color:var(--diffs-fg);background-color:var(--diffs-bg);border:1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));border-radius:6px;outline:none;flex-grow:1;padding-inline:6px;font-size:13px;line-height:24px;&::selection{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg))}&:focus-visible{outline:1px solid var(--diffs-modified-base)}}&[data-find] input{padding-inline-end:72px}& [data-search-icon]{--diffs-search-icon-size:20px}}[data-search-toggles]{align-items:center;gap:1px;display:flex;position:absolute;top:50%;right:4px;transform:translateY(-50%)}[data-matches]{white-space:nowrap;min-width:50px;color:color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));flex-shrink:0;grid-area:matches;font-size:12px;font-weight:500;line-height:20px;&[data-no-matches]{color:color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg))}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex;&:disabled{opacity:.25;cursor:default}&:not(:disabled):hover{color:var(--diffs-fg)}&:focus-visible{outline:1px solid var(--diffs-modified-base)}&[aria-pressed=true]{color:var(--diffs-modified-base)}}[data-replace-toggle]{--diffs-search-icon-size:16px;grid-area:toggle;align-self:stretch;height:auto;&[aria-expanded=false] svg{transform:rotate(-90deg)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);&:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}\n';
|
|
6361
6443
|
const EDITABLE_TOKENS = 350;
|
|
6362
6444
|
const CONTEXT_TOKENS = 150;
|
|
6363
6445
|
const MAX_EDITABLE_TOKENS = 512;
|
|
@@ -7249,6 +7331,9 @@ const SVGSpriteSheet = `<svg data-icon-sprite aria-hidden="true" width="0" heigh
|
|
|
7249
7331
|
<path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
|
|
7250
7332
|
<path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
|
|
7251
7333
|
</symbol>
|
|
7334
|
+
<symbol id="diffs-editor-icon-chevron" viewBox="0 0 16 16">
|
|
7335
|
+
<path fill="currentColor" d="M1.46967 4.46967C1.76256 4.17678 2.23744 4.17678 2.53033 4.46967L8 9.93934L13.4697 4.46967C13.7626 4.17678 14.2374 4.17678 14.5303 4.46967C14.8232 4.76256 14.8232 5.23744 14.5303 5.53033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L1.46967 5.53033C1.17678 5.23744 1.17678 4.76256 1.46967 4.46967Z"></path>
|
|
7336
|
+
</symbol>
|
|
7252
7337
|
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
7253
7338
|
<path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
|
|
7254
7339
|
<path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
|
|
@@ -7534,12 +7619,26 @@ var SearchPanelWidget = class {
|
|
|
7534
7619
|
onClick: close,
|
|
7535
7620
|
dataset: { searchClose: "" }
|
|
7536
7621
|
});
|
|
7622
|
+
const replaceToggleElement = iconButton({
|
|
7623
|
+
icon: "chevron",
|
|
7624
|
+
label: "Toggle Replace",
|
|
7625
|
+
dataset: { replaceToggle: "" },
|
|
7626
|
+
onClick: () => {
|
|
7627
|
+
if (gridElement.dataset.mode === "replace") applyMode("find");
|
|
7628
|
+
else {
|
|
7629
|
+
applyMode("replace");
|
|
7630
|
+
replaceInputElement.focus();
|
|
7631
|
+
}
|
|
7632
|
+
}
|
|
7633
|
+
});
|
|
7634
|
+
replaceToggleElement.ariaExpanded = String(mode === "replace");
|
|
7537
7635
|
const gridElement = h("div", {
|
|
7538
7636
|
dataset: {
|
|
7539
7637
|
searchGrid: "",
|
|
7540
7638
|
mode
|
|
7541
7639
|
},
|
|
7542
7640
|
children: [
|
|
7641
|
+
replaceToggleElement,
|
|
7543
7642
|
findInputBox,
|
|
7544
7643
|
replaceInputBox,
|
|
7545
7644
|
replaceActionsElement,
|
|
@@ -7550,6 +7649,7 @@ var SearchPanelWidget = class {
|
|
|
7550
7649
|
});
|
|
7551
7650
|
const applyMode = (next) => {
|
|
7552
7651
|
gridElement.dataset.mode = next;
|
|
7652
|
+
replaceToggleElement.ariaExpanded = String(next === "replace");
|
|
7553
7653
|
this.#inputElement.focus();
|
|
7554
7654
|
this.#inputElement.select();
|
|
7555
7655
|
};
|
|
@@ -7873,73 +7973,20 @@ function getExpandedAsciiTextColumns(text, tabSize) {
|
|
|
7873
7973
|
}
|
|
7874
7974
|
return columns;
|
|
7875
7975
|
}
|
|
7876
|
-
const TOKENIZE_TIME_LIMIT = 500;
|
|
7877
|
-
let nextTokenizerId = 0;
|
|
7878
7976
|
var EditorTokenizer = class {
|
|
7879
7977
|
#highlighter;
|
|
7880
|
-
#
|
|
7978
|
+
#tokenizer;
|
|
7881
7979
|
#mediaQueryList;
|
|
7882
7980
|
#themeType = "dark";
|
|
7883
7981
|
#themeName = "";
|
|
7884
|
-
#colorMap;
|
|
7885
|
-
#textDocument;
|
|
7886
|
-
#tokenizeMaxLineLength;
|
|
7887
7982
|
#setStyle;
|
|
7888
|
-
#onDeferTokenize;
|
|
7889
7983
|
#onThemeChange;
|
|
7890
|
-
#matchBrackets;
|
|
7891
|
-
#debug;
|
|
7892
7984
|
#disposes;
|
|
7893
|
-
#isCleanedUp = false;
|
|
7894
|
-
#stateStack = [INITIAL];
|
|
7895
|
-
#comparisonStateStack = [];
|
|
7896
|
-
#comparisonStateStackStart = 0;
|
|
7897
|
-
#comparisonLineChanges = [];
|
|
7898
|
-
#lastLine = -1;
|
|
7899
|
-
#isStopped = true;
|
|
7900
|
-
#isPaused = false;
|
|
7901
|
-
#backgroundJobId = 0;
|
|
7902
|
-
#tokenizerId = ++nextTokenizerId;
|
|
7903
|
-
#backgroundPrebuildEndLine = -1;
|
|
7904
|
-
#pendingPrebuildEndLine = -1;
|
|
7905
|
-
#backgroundChangedLineRanges;
|
|
7906
|
-
#backgroundChangedRangeIndex = 0;
|
|
7907
|
-
#bracketIgnoredRanges = [];
|
|
7908
|
-
#isMessageListenerAttached = false;
|
|
7909
|
-
#prebuildStateStack = debounce(async (renderRange) => {
|
|
7910
|
-
if (this.#isCleanedUp) return;
|
|
7911
|
-
const { startingLine = 0, totalLines = Infinity } = renderRange ?? {};
|
|
7912
|
-
const endLine = Math.min(totalLines === Infinity ? Infinity : startingLine + totalLines, this.#textDocument.lineCount);
|
|
7913
|
-
if (this.#grammar === void 0 && !isGrammarlessLanguage(this.#textDocument.languageId)) {
|
|
7914
|
-
await this.#highlighter.loadLanguage(this.#textDocument.languageId);
|
|
7915
|
-
if (this.#isCleanedUp) return;
|
|
7916
|
-
this.#grammar = this.#highlighter.getLanguage(this.#textDocument.languageId);
|
|
7917
|
-
}
|
|
7918
|
-
this.#ensureActiveTheme();
|
|
7919
|
-
this.#scheduleStatePrebuild(endLine);
|
|
7920
|
-
}, 500);
|
|
7921
|
-
#onMessage = ({ data }) => {
|
|
7922
|
-
if (typeof data !== "object" || data === null) return;
|
|
7923
|
-
const { type, tokenizerId, jobId } = data;
|
|
7924
|
-
if (type === "tokenize" && tokenizerId === this.#tokenizerId && typeof jobId === "number" && jobId === this.#backgroundJobId) {
|
|
7925
|
-
if (this.#backgroundPrebuildEndLine >= 0) this.#backgroundPrebuild(jobId);
|
|
7926
|
-
else this.#backgroundTokenize(jobId);
|
|
7927
|
-
}
|
|
7928
|
-
};
|
|
7929
7985
|
get themeType() {
|
|
7930
7986
|
return this.#themeType;
|
|
7931
7987
|
}
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
this.#ensureGrammar();
|
|
7935
|
-
if (this.#grammar === void 0) return null;
|
|
7936
|
-
if (this.#bracketIgnoredRanges[lineIndex] === void 0) {
|
|
7937
|
-
this.#buildStateStack(lineIndex);
|
|
7938
|
-
const state = this.#stateStack[lineIndex] ?? INITIAL;
|
|
7939
|
-
const result = this.#tokenizeLineAt(lineIndex, state);
|
|
7940
|
-
this.#stateStack[lineIndex + 1] = result.state;
|
|
7941
|
-
}
|
|
7942
|
-
return this.#bracketIgnoredRanges[lineIndex] ?? null;
|
|
7988
|
+
get highlighter() {
|
|
7989
|
+
return this.#highlighter;
|
|
7943
7990
|
}
|
|
7944
7991
|
constructor({ codeOptions, highlighter, textDocument, matchBrackets, setStyle, onDeferTokenize, onThemeChange, __debug }) {
|
|
7945
7992
|
const { themeType: themeTypeOption = "system", theme = DEFAULT_THEMES, tokenizeMaxLineLength = 1e3 } = codeOptions;
|
|
@@ -7963,26 +8010,22 @@ var EditorTokenizer = class {
|
|
|
7963
8010
|
}), () => observer.disconnect()];
|
|
7964
8011
|
}
|
|
7965
8012
|
this.#highlighter = highlighter;
|
|
7966
|
-
this.#textDocument = textDocument;
|
|
7967
|
-
this.#tokenizeMaxLineLength = tokenizeMaxLineLength;
|
|
7968
8013
|
this.#setStyle = setStyle;
|
|
7969
|
-
this.#onDeferTokenize = onDeferTokenize;
|
|
7970
8014
|
this.#onThemeChange = onThemeChange;
|
|
7971
|
-
this.#matchBrackets = matchBrackets !== false;
|
|
7972
|
-
this.#debug = __debug ?? false;
|
|
7973
|
-
this.#ensureGrammar();
|
|
7974
|
-
this.#colorMap = [];
|
|
7975
8015
|
this.#setTheme(typeof theme === "string" ? theme : theme[themeType], typeof theme === "string" ? void 0 : themeType);
|
|
8016
|
+
this.#tokenizer = highlighter.createEditorTokenizer({
|
|
8017
|
+
textDocument,
|
|
8018
|
+
theme: this.#themeName,
|
|
8019
|
+
tokenizeMaxLineLength,
|
|
8020
|
+
matchBrackets,
|
|
8021
|
+
__debug,
|
|
8022
|
+
onDeferTokenize: (lines) => onDeferTokenize(lines, this.#themeType)
|
|
8023
|
+
});
|
|
7976
8024
|
}
|
|
7977
8025
|
#emitThemeChange(themeName, themeType) {
|
|
7978
8026
|
if (themeName === this.#themeName && themeType === this.#themeType) return;
|
|
7979
8027
|
this.#setTheme(themeName, themeType);
|
|
7980
|
-
this.
|
|
7981
|
-
this.#stateStack = [INITIAL];
|
|
7982
|
-
this.#comparisonStateStack = [];
|
|
7983
|
-
this.#comparisonStateStackStart = 0;
|
|
7984
|
-
this.#comparisonLineChanges = [];
|
|
7985
|
-
if (this.#grammar !== void 0 && this.#textDocument.lineCount > 0) this.#scheduleBackgroundTokenize(0);
|
|
8028
|
+
this.#tokenizer.setTheme(themeName);
|
|
7986
8029
|
this.#onThemeChange?.();
|
|
7987
8030
|
}
|
|
7988
8031
|
#resolveSystemThemeType() {
|
|
@@ -8010,8 +8053,8 @@ var EditorTokenizer = class {
|
|
|
8010
8053
|
this.#emitThemeChange(nextThemeName, nextThemeType);
|
|
8011
8054
|
}
|
|
8012
8055
|
#setTheme(themeName, themeType) {
|
|
8013
|
-
const
|
|
8014
|
-
const { colors = {} } =
|
|
8056
|
+
const theme = this.#highlighter.getTheme(themeName);
|
|
8057
|
+
const { colors = {} } = theme;
|
|
8015
8058
|
const selectionBackground = colors["editor.selectionBackground"];
|
|
8016
8059
|
const themeLineHighlightBackground = colors["editor.lineHighlightBackground"];
|
|
8017
8060
|
const lineHighlightBackground = themeLineHighlightBackground != null && themeLineHighlightBackground.trim() !== "" && !colorUtils.isFullyTransparent(themeLineHighlightBackground) ? themeLineHighlightBackground : void 0;
|
|
@@ -8042,415 +8085,31 @@ var EditorTokenizer = class {
|
|
|
8042
8085
|
}`);
|
|
8043
8086
|
this.#themeName = themeName;
|
|
8044
8087
|
this.#themeType = themeType ?? theme.type;
|
|
8045
|
-
this.#colorMap = colorMap;
|
|
8046
|
-
}
|
|
8047
|
-
#ensureActiveTheme() {
|
|
8048
|
-
if (this.#themeName === "") return;
|
|
8049
|
-
const { colorMap } = this.#highlighter.setTheme(this.#themeName);
|
|
8050
|
-
this.#colorMap = colorMap;
|
|
8051
8088
|
}
|
|
8052
8089
|
cleanUp() {
|
|
8053
|
-
this.#
|
|
8054
|
-
this.stopBackgroundTokenize();
|
|
8055
|
-
this.#detachMessageListener();
|
|
8090
|
+
this.#tokenizer.dispose();
|
|
8056
8091
|
this.#disposes?.forEach((dispose) => dispose());
|
|
8057
8092
|
this.#disposes = void 0;
|
|
8058
8093
|
}
|
|
8059
8094
|
tokenize(change, renderRange, hostRealignsRows = false) {
|
|
8060
|
-
this.#
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
const { startingLine = 0, totalLines = Infinity } = renderRange ?? {};
|
|
8065
|
-
const renderRangeEndLine = totalLines === Infinity ? lineCount : Math.min(startingLine + totalLines, lineCount);
|
|
8066
|
-
const dirtyStart = change.startLine;
|
|
8067
|
-
const viewStart = Math.max(startingLine, dirtyStart);
|
|
8068
|
-
const crossesRenderRangeEnd = renderRange !== void 0 && totalLines !== Infinity && change.lineDelta > 0 && dirtyStart < renderRangeEndLine && change.endLine >= renderRangeEndLine;
|
|
8069
|
-
const canReuseCachedStates = change.lineDelta === 0 && (change.changedLineChanges?.every(([, , lineDelta]) => lineDelta === 0) ?? true);
|
|
8070
|
-
if (this.#matchBrackets && !canReuseCachedStates) this.#bracketIgnoredRanges.length = Math.min(this.#bracketIgnoredRanges.length, change.startLine);
|
|
8071
|
-
const canReuseShiftedStates = hostRealignsRows && change.lineDelta !== 0 && dirtyStart >= startingLine;
|
|
8072
|
-
const canCacheTokenizedStates = canReuseCachedStates || renderRange === void 0 || dirtyStart >= viewStart;
|
|
8073
|
-
const changedLineRanges = change.changedLineRanges ?? [[dirtyStart, change.endLine]];
|
|
8074
|
-
this.#comparisonStateStack = [];
|
|
8075
|
-
this.#comparisonStateStackStart = 0;
|
|
8076
|
-
this.#comparisonLineChanges = [];
|
|
8077
|
-
let offscreenSyncEnd = -1;
|
|
8078
|
-
if (dirtyStart < viewStart) {
|
|
8079
|
-
for (const [rangeStart, rangeEnd] of changedLineRanges) if (rangeStart < viewStart) offscreenSyncEnd = Math.max(offscreenSyncEnd, Math.min(rangeEnd, viewStart - 1));
|
|
8080
|
-
}
|
|
8081
|
-
const shouldFlushOffscreenLines = offscreenSyncEnd >= dirtyStart && (canReuseCachedStates || change.lineDelta < 0);
|
|
8082
|
-
if (canReuseCachedStates) this.#buildStateStack(dirtyStart);
|
|
8083
|
-
else {
|
|
8084
|
-
this.#shiftComparisonStateStack(change);
|
|
8085
|
-
if (renderRange === void 0 || dirtyStart >= viewStart) this.#buildStateStack(viewStart);
|
|
8086
|
-
}
|
|
8087
|
-
let changedRangeIndex = 0;
|
|
8088
|
-
let currentChangedRangeEnd = changedLineRanges[changedRangeIndex][1];
|
|
8089
|
-
let backgroundStartLine;
|
|
8090
|
-
let backgroundChangedRangeIndex = 0;
|
|
8091
|
-
let line = canReuseCachedStates ? changedLineRanges[changedRangeIndex][0] : viewStart;
|
|
8092
|
-
let settled = false;
|
|
8093
|
-
const dirtyLines = /* @__PURE__ */ new Map();
|
|
8094
|
-
const offscreenDirtyLines = shouldFlushOffscreenLines ? /* @__PURE__ */ new Map() : void 0;
|
|
8095
|
-
if (offscreenDirtyLines !== void 0 && !canReuseCachedStates) {
|
|
8096
|
-
const offscreenEnd = Math.min(offscreenSyncEnd + 1, viewStart, renderRangeEndLine);
|
|
8097
|
-
if (offscreenEnd > dirtyStart) {
|
|
8098
|
-
this.#buildStateStack(offscreenEnd);
|
|
8099
|
-
let offscreenLine = dirtyStart;
|
|
8100
|
-
let offscreenState = this.#stateStack[offscreenLine] ?? INITIAL;
|
|
8101
|
-
for (; offscreenLine < offscreenEnd; offscreenLine++) {
|
|
8102
|
-
const resolved = this.#tokenizeLineAt(offscreenLine, offscreenState);
|
|
8103
|
-
offscreenState = resolved.state;
|
|
8104
|
-
offscreenDirtyLines.set(offscreenLine, resolved.resolvedTokens);
|
|
8105
|
-
}
|
|
8106
|
-
this.#stateStack[offscreenEnd] = offscreenState;
|
|
8107
|
-
}
|
|
8108
|
-
}
|
|
8109
|
-
let state = this.#stateStack[line] ?? INITIAL;
|
|
8110
|
-
for (; line < renderRangeEndLine; ) {
|
|
8111
|
-
const previousNextState = canReuseCachedStates ? this.#stateStack[line + 1] : canReuseShiftedStates ? this.#getPreviousEndState(line + 1) : void 0;
|
|
8112
|
-
if (canCacheTokenizedStates) this.#stateStack[line] = state;
|
|
8113
|
-
const { resolvedTokens, state: nextState } = this.#tokenizeLineAt(line, state);
|
|
8114
|
-
state = nextState;
|
|
8115
|
-
if (line >= viewStart) dirtyLines.set(line, resolvedTokens);
|
|
8116
|
-
else offscreenDirtyLines?.set(line, resolvedTokens);
|
|
8117
|
-
if (canCacheTokenizedStates) this.#stateStack[line + 1] = state;
|
|
8118
|
-
settled = line >= currentChangedRangeEnd && (canReuseCachedStates || canReuseShiftedStates) && previousNextState !== void 0 && state.equals(previousNextState);
|
|
8119
|
-
if (settled) {
|
|
8120
|
-
changedRangeIndex++;
|
|
8121
|
-
const nextRange = changedLineRanges[changedRangeIndex];
|
|
8122
|
-
if (nextRange === void 0) break;
|
|
8123
|
-
if (nextRange[0] >= renderRangeEndLine) {
|
|
8124
|
-
backgroundStartLine = nextRange[0];
|
|
8125
|
-
backgroundChangedRangeIndex = changedRangeIndex;
|
|
8126
|
-
break;
|
|
8127
|
-
}
|
|
8128
|
-
let nextState2 = this.#stateStack[nextRange[0]];
|
|
8129
|
-
if (canReuseShiftedStates) for (let stateLine = line + 2; stateLine <= nextRange[0]; stateLine++) {
|
|
8130
|
-
nextState2 = this.#getPreviousEndState(stateLine);
|
|
8131
|
-
if (nextState2 === void 0) break;
|
|
8132
|
-
this.#stateStack[stateLine] = nextState2;
|
|
8133
|
-
}
|
|
8134
|
-
if (nextState2 === void 0) {
|
|
8135
|
-
currentChangedRangeEnd = nextRange[1];
|
|
8136
|
-
line++;
|
|
8137
|
-
} else {
|
|
8138
|
-
line = nextRange[0];
|
|
8139
|
-
state = nextState2;
|
|
8140
|
-
currentChangedRangeEnd = nextRange[1];
|
|
8141
|
-
}
|
|
8142
|
-
settled = false;
|
|
8143
|
-
continue;
|
|
8144
|
-
}
|
|
8145
|
-
line++;
|
|
8146
|
-
}
|
|
8147
|
-
if (canCacheTokenizedStates) {
|
|
8148
|
-
if (line < renderRangeEndLine) this.#stateStack[line + 1] = state;
|
|
8149
|
-
else this.#stateStack[line] = state;
|
|
8150
|
-
}
|
|
8151
|
-
if (settled && canReuseShiftedStates && backgroundStartLine === void 0) {
|
|
8152
|
-
for (let stateLine = line + 2; stateLine <= lineCount; stateLine++) {
|
|
8153
|
-
const previousState = this.#getPreviousEndState(stateLine);
|
|
8154
|
-
if (previousState === void 0) break;
|
|
8155
|
-
this.#stateStack[stateLine] = previousState;
|
|
8156
|
-
}
|
|
8157
|
-
this.#comparisonStateStack = [];
|
|
8158
|
-
this.#comparisonStateStackStart = 0;
|
|
8159
|
-
this.#comparisonLineChanges = [];
|
|
8160
|
-
}
|
|
8161
|
-
if (offscreenDirtyLines !== void 0 && offscreenDirtyLines.size > 0) this.#onDeferTokenize(offscreenDirtyLines, this.#themeType);
|
|
8162
|
-
if (backgroundStartLine !== void 0) {
|
|
8163
|
-
if (this.#matchBrackets && canReuseCachedStates) this.#bracketIgnoredRanges.length = Math.min(this.#bracketIgnoredRanges.length, backgroundStartLine);
|
|
8164
|
-
this.#scheduleBackgroundTokenize(backgroundStartLine, changedLineRanges, backgroundChangedRangeIndex);
|
|
8165
|
-
} else if (!settled && line < lineCount) {
|
|
8166
|
-
const backgroundLine = crossesRenderRangeEnd && dirtyStart >= viewStart ? renderRangeEndLine : dirtyStart < viewStart && !canReuseCachedStates ? dirtyStart : line;
|
|
8167
|
-
if (this.#matchBrackets && canReuseCachedStates) this.#bracketIgnoredRanges.length = Math.min(this.#bracketIgnoredRanges.length, backgroundLine);
|
|
8168
|
-
this.#scheduleBackgroundTokenize(backgroundLine, changedLineRanges, changedRangeIndex);
|
|
8169
|
-
}
|
|
8170
|
-
return dirtyLines;
|
|
8095
|
+
return this.#tokenizer.tokenize(change, renderRange, hostRealignsRows);
|
|
8096
|
+
}
|
|
8097
|
+
getStringCommentRegexpRangesInLine(lineIndex) {
|
|
8098
|
+
return this.#tokenizer.getStringCommentRegexpRangesInLine(lineIndex);
|
|
8171
8099
|
}
|
|
8172
8100
|
prebuildStateStack(renderRange) {
|
|
8173
|
-
this.#
|
|
8174
|
-
this.#prebuildStateStack(renderRange);
|
|
8101
|
+
this.#tokenizer.prebuildStateStack(renderRange);
|
|
8175
8102
|
}
|
|
8176
8103
|
stopBackgroundTokenize() {
|
|
8177
|
-
this.#
|
|
8178
|
-
if (this.#isStopped) return;
|
|
8179
|
-
this.#isStopped = true;
|
|
8180
|
-
this.#isPaused = false;
|
|
8181
|
-
this.#lastLine = -1;
|
|
8182
|
-
this.#backgroundPrebuildEndLine = -1;
|
|
8183
|
-
this.#backgroundChangedLineRanges = void 0;
|
|
8184
|
-
this.#backgroundChangedRangeIndex = 0;
|
|
8185
|
-
this.#comparisonStateStack = [];
|
|
8186
|
-
this.#comparisonStateStackStart = 0;
|
|
8187
|
-
this.#comparisonLineChanges = [];
|
|
8188
|
-
this.#detachMessageListener();
|
|
8104
|
+
this.#tokenizer.stopBackgroundTokenize();
|
|
8189
8105
|
}
|
|
8190
8106
|
pauseBackgroundTokenize() {
|
|
8191
|
-
|
|
8192
|
-
if (this.#debug) console.log("[diffs/editor] background tokenization paused", { jobId: this.#backgroundJobId });
|
|
8193
|
-
this.#isPaused = true;
|
|
8107
|
+
this.#tokenizer.pauseBackgroundTokenize();
|
|
8194
8108
|
}
|
|
8195
8109
|
resumeBackgroundTokenize() {
|
|
8196
|
-
|
|
8197
|
-
if (this.#debug) console.log("[diffs/editor] background tokenization resumed", { jobId: this.#backgroundJobId });
|
|
8198
|
-
this.#isPaused = false;
|
|
8199
|
-
this.#postTokenizeMessage(this.#backgroundJobId);
|
|
8200
|
-
}
|
|
8201
|
-
#ensureGrammar() {
|
|
8202
|
-
if (this.#grammar === void 0 && !isGrammarlessLanguage(this.#textDocument.languageId) && this.#highlighter.getLoadedLanguages().includes(this.#textDocument.languageId)) this.#grammar = this.#highlighter.getLanguage(this.#textDocument.languageId);
|
|
8203
|
-
}
|
|
8204
|
-
#attachMessageListener() {
|
|
8205
|
-
if (this.#isMessageListenerAttached) return;
|
|
8206
|
-
globalThis.addEventListener("message", this.#onMessage);
|
|
8207
|
-
this.#isMessageListenerAttached = true;
|
|
8208
|
-
}
|
|
8209
|
-
#detachMessageListener() {
|
|
8210
|
-
if (!this.#isMessageListenerAttached) return;
|
|
8211
|
-
globalThis.removeEventListener("message", this.#onMessage);
|
|
8212
|
-
this.#isMessageListenerAttached = false;
|
|
8213
|
-
}
|
|
8214
|
-
#postTokenizeMessage(jobId) {
|
|
8215
|
-
globalThis.postMessage({
|
|
8216
|
-
type: "tokenize",
|
|
8217
|
-
tokenizerId: this.#tokenizerId,
|
|
8218
|
-
jobId
|
|
8219
|
-
});
|
|
8220
|
-
}
|
|
8221
|
-
#scheduleBackgroundTokenize(startLine, changedLineRanges, changedRangeIndex = 0) {
|
|
8222
|
-
if (isGrammarlessLanguage(this.#textDocument.languageId)) return;
|
|
8223
|
-
const jobId = ++this.#backgroundJobId;
|
|
8224
|
-
if (this.#debug) console.log("[diffs/editor] background tokenization scheduled", {
|
|
8225
|
-
jobId,
|
|
8226
|
-
startLine,
|
|
8227
|
-
changedLineRanges,
|
|
8228
|
-
changedRangeIndex
|
|
8229
|
-
});
|
|
8230
|
-
this.#isStopped = false;
|
|
8231
|
-
this.#isPaused = false;
|
|
8232
|
-
this.#lastLine = startLine;
|
|
8233
|
-
if (this.#backgroundPrebuildEndLine >= 0) this.#pendingPrebuildEndLine = Math.max(this.#pendingPrebuildEndLine, this.#backgroundPrebuildEndLine);
|
|
8234
|
-
this.#backgroundPrebuildEndLine = -1;
|
|
8235
|
-
this.#backgroundChangedLineRanges = changedLineRanges;
|
|
8236
|
-
this.#backgroundChangedRangeIndex = changedRangeIndex;
|
|
8237
|
-
this.#attachMessageListener();
|
|
8238
|
-
this.#postTokenizeMessage(jobId);
|
|
8239
|
-
}
|
|
8240
|
-
#scheduleStatePrebuild(endLine) {
|
|
8241
|
-
if (this.#grammar === void 0 || this.#stateStack.length > endLine) return;
|
|
8242
|
-
if (!this.#isStopped) {
|
|
8243
|
-
if (this.#backgroundPrebuildEndLine >= 0) this.#backgroundPrebuildEndLine = Math.max(this.#backgroundPrebuildEndLine, endLine);
|
|
8244
|
-
else this.#pendingPrebuildEndLine = Math.max(this.#pendingPrebuildEndLine, endLine);
|
|
8245
|
-
return;
|
|
8246
|
-
}
|
|
8247
|
-
const jobId = ++this.#backgroundJobId;
|
|
8248
|
-
this.#isStopped = false;
|
|
8249
|
-
this.#isPaused = false;
|
|
8250
|
-
this.#lastLine = this.#stateStack.length - 1;
|
|
8251
|
-
this.#backgroundPrebuildEndLine = endLine;
|
|
8252
|
-
this.#pendingPrebuildEndLine = -1;
|
|
8253
|
-
this.#backgroundChangedLineRanges = void 0;
|
|
8254
|
-
this.#backgroundChangedRangeIndex = 0;
|
|
8255
|
-
this.#attachMessageListener();
|
|
8256
|
-
this.#postTokenizeMessage(jobId);
|
|
8257
|
-
}
|
|
8258
|
-
#tokenizeLineAt(line, state) {
|
|
8259
|
-
const lineText = this.#textDocument.getLineText(line);
|
|
8260
|
-
if (lineText.length > this.#tokenizeMaxLineLength) {
|
|
8261
|
-
console.warn(`[diffs] Line(${line}) too long to tokenize: ${lineText.length}`);
|
|
8262
|
-
this.#cacheBracketIgnoredRanges(line, null);
|
|
8263
|
-
return {
|
|
8264
|
-
resolvedTokens: [[
|
|
8265
|
-
0,
|
|
8266
|
-
"",
|
|
8267
|
-
lineText
|
|
8268
|
-
]],
|
|
8269
|
-
state
|
|
8270
|
-
};
|
|
8271
|
-
}
|
|
8272
|
-
if (this.#grammar === void 0 || lineText === "" || lineText.trim() === "") {
|
|
8273
|
-
this.#cacheBracketIgnoredRanges(line, null);
|
|
8274
|
-
return {
|
|
8275
|
-
resolvedTokens: [[
|
|
8276
|
-
0,
|
|
8277
|
-
"",
|
|
8278
|
-
lineText
|
|
8279
|
-
]],
|
|
8280
|
-
state
|
|
8281
|
-
};
|
|
8282
|
-
}
|
|
8283
|
-
const result = tokenizeLine(this.#grammar, this.#colorMap, lineText, state, TOKENIZE_TIME_LIMIT, this.#matchBrackets);
|
|
8284
|
-
this.#cacheBracketIgnoredRanges(line, result.bracketIgnoredRanges);
|
|
8285
|
-
return {
|
|
8286
|
-
resolvedTokens: result.resolvedTokens,
|
|
8287
|
-
state: result.ruleStack
|
|
8288
|
-
};
|
|
8289
|
-
}
|
|
8290
|
-
#cacheBracketIgnoredRanges(line, ranges) {
|
|
8291
|
-
if (this.#matchBrackets) this.#bracketIgnoredRanges[line] = ranges;
|
|
8292
|
-
}
|
|
8293
|
-
#shiftComparisonStateStack(change) {
|
|
8294
|
-
const lineChanges = change.changedLineChanges ?? [[
|
|
8295
|
-
change.startLine,
|
|
8296
|
-
change.endLine,
|
|
8297
|
-
change.lineDelta
|
|
8298
|
-
]];
|
|
8299
|
-
const comparisonStart = change.startLine + 1;
|
|
8300
|
-
if (comparisonStart <= this.#stateStack.length - comparisonStart) {
|
|
8301
|
-
this.#comparisonStateStack = this.#stateStack;
|
|
8302
|
-
this.#comparisonStateStackStart = 0;
|
|
8303
|
-
this.#stateStack = this.#stateStack.slice(0, comparisonStart);
|
|
8304
|
-
} else {
|
|
8305
|
-
this.#comparisonStateStackStart = comparisonStart;
|
|
8306
|
-
this.#comparisonStateStack = this.#stateStack.slice(comparisonStart);
|
|
8307
|
-
this.#stateStack.length = Math.min(this.#stateStack.length, comparisonStart);
|
|
8308
|
-
}
|
|
8309
|
-
this.#comparisonLineChanges = lineChanges;
|
|
8310
|
-
}
|
|
8311
|
-
#getPreviousEndState(line) {
|
|
8312
|
-
let previousLine = line;
|
|
8313
|
-
for (let index = this.#comparisonLineChanges.length - 1; index >= 0; index--) {
|
|
8314
|
-
const [startLine, endLine, lineDelta] = this.#comparisonLineChanges[index];
|
|
8315
|
-
if (lineDelta === 0) continue;
|
|
8316
|
-
if (previousLine > endLine) previousLine -= lineDelta;
|
|
8317
|
-
else if (previousLine > startLine) return this.#stateStack[line];
|
|
8318
|
-
}
|
|
8319
|
-
return this.#comparisonStateStack[previousLine - this.#comparisonStateStackStart] ?? this.#stateStack[line];
|
|
8320
|
-
}
|
|
8321
|
-
#buildStateStack(endAt, timeBudget) {
|
|
8322
|
-
const boundedEndAt = Math.min(Math.max(0, endAt), this.#textDocument.lineCount);
|
|
8323
|
-
if (this.#stateStack.length > boundedEndAt || this.#grammar === void 0) return true;
|
|
8324
|
-
const startedAt = timeBudget === void 0 ? 0 : performance.now();
|
|
8325
|
-
let line = this.#stateStack.length - 1;
|
|
8326
|
-
let state = this.#stateStack[line] ?? INITIAL;
|
|
8327
|
-
while (line < boundedEndAt) {
|
|
8328
|
-
this.#stateStack[line] = state;
|
|
8329
|
-
const lineText = this.#textDocument.getLineText(line);
|
|
8330
|
-
if (lineText.length <= this.#tokenizeMaxLineLength && lineText !== "" && lineText.trim() !== "") {
|
|
8331
|
-
const result = tokenizeLine(this.#grammar, this.#colorMap, lineText, state, TOKENIZE_TIME_LIMIT, this.#matchBrackets, false);
|
|
8332
|
-
this.#cacheBracketIgnoredRanges(line, result.bracketIgnoredRanges);
|
|
8333
|
-
state = result.ruleStack;
|
|
8334
|
-
} else this.#cacheBracketIgnoredRanges(line, null);
|
|
8335
|
-
line++;
|
|
8336
|
-
this.#stateStack[line] = state;
|
|
8337
|
-
if (timeBudget !== void 0 && performance.now() - startedAt > timeBudget) break;
|
|
8338
|
-
}
|
|
8339
|
-
return line >= boundedEndAt;
|
|
8340
|
-
}
|
|
8341
|
-
#backgroundPrebuild(jobId) {
|
|
8342
|
-
if (this.#isStopped || this.#isPaused || this.#grammar === void 0 || jobId !== this.#backgroundJobId) return;
|
|
8343
|
-
this.#ensureActiveTheme();
|
|
8344
|
-
const complete = this.#buildStateStack(this.#backgroundPrebuildEndLine, 1);
|
|
8345
|
-
if (this.#isStopped || this.#isPaused || jobId !== this.#backgroundJobId) return;
|
|
8346
|
-
if (complete) {
|
|
8347
|
-
this.stopBackgroundTokenize();
|
|
8348
|
-
return;
|
|
8349
|
-
}
|
|
8350
|
-
this.#lastLine = this.#stateStack.length - 1;
|
|
8351
|
-
this.#postTokenizeMessage(jobId);
|
|
8352
|
-
}
|
|
8353
|
-
#backgroundTokenize(jobId) {
|
|
8354
|
-
if (this.#isStopped || this.#isPaused || this.#grammar === void 0 || jobId !== this.#backgroundJobId) return;
|
|
8355
|
-
this.#ensureActiveTheme();
|
|
8356
|
-
const t = performance.now();
|
|
8357
|
-
const lines = /* @__PURE__ */ new Map();
|
|
8358
|
-
const totalLines = this.#textDocument.lineCount;
|
|
8359
|
-
const changedLineRanges = this.#backgroundChangedLineRanges;
|
|
8360
|
-
let line = this.#lastLine;
|
|
8361
|
-
let state = this.#stateStack[line] ?? INITIAL;
|
|
8362
|
-
let settled = false;
|
|
8363
|
-
let changedRangeIndex = this.#backgroundChangedRangeIndex;
|
|
8364
|
-
let currentChangedRangeEnd = changedLineRanges?.[changedRangeIndex]?.[1];
|
|
8365
|
-
for (; line < totalLines; ) {
|
|
8366
|
-
this.#stateStack[line] = state;
|
|
8367
|
-
const previousNextState = currentChangedRangeEnd !== void 0 ? this.#getPreviousEndState(line + 1) : void 0;
|
|
8368
|
-
const lineText = this.#textDocument.getLineText(line);
|
|
8369
|
-
if (lineText.length > this.#tokenizeMaxLineLength) {
|
|
8370
|
-
console.warn(`[diffs] Line(${line}) too long to tokenize: ${lineText.length}`);
|
|
8371
|
-
lines.set(line, [[
|
|
8372
|
-
0,
|
|
8373
|
-
"",
|
|
8374
|
-
lineText
|
|
8375
|
-
]]);
|
|
8376
|
-
this.#cacheBracketIgnoredRanges(line, null);
|
|
8377
|
-
} else if (lineText === "" || lineText.trim() === "") {
|
|
8378
|
-
lines.set(line, [[
|
|
8379
|
-
0,
|
|
8380
|
-
"",
|
|
8381
|
-
lineText
|
|
8382
|
-
]]);
|
|
8383
|
-
this.#cacheBracketIgnoredRanges(line, null);
|
|
8384
|
-
} else {
|
|
8385
|
-
const ret = tokenizeLine(this.#grammar, this.#colorMap, lineText, state, TOKENIZE_TIME_LIMIT, this.#matchBrackets);
|
|
8386
|
-
lines.set(line, ret.resolvedTokens);
|
|
8387
|
-
this.#cacheBracketIgnoredRanges(line, ret.bracketIgnoredRanges);
|
|
8388
|
-
state = ret.ruleStack;
|
|
8389
|
-
}
|
|
8390
|
-
this.#stateStack[line + 1] = state;
|
|
8391
|
-
settled = currentChangedRangeEnd !== void 0 && line >= currentChangedRangeEnd && previousNextState !== void 0 && state.equals(previousNextState);
|
|
8392
|
-
line++;
|
|
8393
|
-
if (settled) {
|
|
8394
|
-
changedRangeIndex++;
|
|
8395
|
-
const nextRange = changedLineRanges?.[changedRangeIndex];
|
|
8396
|
-
if (nextRange === void 0) break;
|
|
8397
|
-
currentChangedRangeEnd = nextRange[1];
|
|
8398
|
-
if (this.#stateStack[nextRange[0]] === void 0) settled = false;
|
|
8399
|
-
else {
|
|
8400
|
-
line = nextRange[0];
|
|
8401
|
-
state = this.#stateStack[line] ?? state;
|
|
8402
|
-
settled = false;
|
|
8403
|
-
continue;
|
|
8404
|
-
}
|
|
8405
|
-
}
|
|
8406
|
-
if (performance.now() - t > 1) break;
|
|
8407
|
-
}
|
|
8408
|
-
this.#onDeferTokenize(lines, this.#themeType);
|
|
8409
|
-
if (this.#isStopped || this.#isPaused || jobId !== this.#backgroundJobId) return;
|
|
8410
|
-
if (settled || line >= totalLines) {
|
|
8411
|
-
const pendingPrebuildEndLine = this.#pendingPrebuildEndLine;
|
|
8412
|
-
this.stopBackgroundTokenize();
|
|
8413
|
-
if (pendingPrebuildEndLine >= 0) this.#scheduleStatePrebuild(pendingPrebuildEndLine);
|
|
8414
|
-
return;
|
|
8415
|
-
}
|
|
8416
|
-
this.#lastLine = line;
|
|
8417
|
-
this.#backgroundChangedRangeIndex = changedRangeIndex;
|
|
8418
|
-
this.#postTokenizeMessage(jobId);
|
|
8110
|
+
this.#tokenizer.resumeBackgroundTokenize();
|
|
8419
8111
|
}
|
|
8420
8112
|
};
|
|
8421
|
-
function tokenizeLine(grammar, colorMap, lineText, stateStack, timeLimit, collectBracketIgnoredRanges = true, resolveTokens = true) {
|
|
8422
|
-
const result = grammar.tokenizeLine2(lineText, stateStack, timeLimit);
|
|
8423
|
-
if (result.stoppedEarly) console.warn(`[diffs] Time limit reached when tokenizing line: ${lineText.substring(0, 100)}`);
|
|
8424
|
-
const rawTokens = result.tokens;
|
|
8425
|
-
const tokensLength = rawTokens.length / 2;
|
|
8426
|
-
const resolvedTokens = [];
|
|
8427
|
-
const bracketIgnoredRanges = [];
|
|
8428
|
-
if (!resolveTokens && !collectBracketIgnoredRanges) return {
|
|
8429
|
-
ruleStack: result.ruleStack,
|
|
8430
|
-
resolvedTokens,
|
|
8431
|
-
bracketIgnoredRanges
|
|
8432
|
-
};
|
|
8433
|
-
for (let j = 0; j < tokensLength; j++) {
|
|
8434
|
-
const offset = rawTokens[2 * j];
|
|
8435
|
-
const nextOffset = j + 1 < tokensLength ? rawTokens[2 * j + 2] : lineText.length;
|
|
8436
|
-
if (offset === nextOffset) continue;
|
|
8437
|
-
const metadata = rawTokens[2 * j + 1];
|
|
8438
|
-
if (resolveTokens) {
|
|
8439
|
-
const fg = EncodedTokenMetadata.getForeground(metadata);
|
|
8440
|
-
resolvedTokens.push([
|
|
8441
|
-
offset,
|
|
8442
|
-
colorMap[fg],
|
|
8443
|
-
lineText.slice(offset, nextOffset)
|
|
8444
|
-
]);
|
|
8445
|
-
}
|
|
8446
|
-
if (collectBracketIgnoredRanges && EncodedTokenMetadata.getTokenType(metadata) > 0) bracketIgnoredRanges.push([offset, nextOffset]);
|
|
8447
|
-
}
|
|
8448
|
-
return {
|
|
8449
|
-
ruleStack: result.ruleStack,
|
|
8450
|
-
resolvedTokens,
|
|
8451
|
-
bracketIgnoredRanges
|
|
8452
|
-
};
|
|
8453
|
-
}
|
|
8454
8113
|
function renderLineTokens(tokens) {
|
|
8455
8114
|
return tokens.map(([char, fg, textContent]) => {
|
|
8456
8115
|
if (char === 0 && fg === "") {
|
|
@@ -8464,9 +8123,6 @@ function renderLineTokens(tokens) {
|
|
|
8464
8123
|
});
|
|
8465
8124
|
});
|
|
8466
8125
|
}
|
|
8467
|
-
function isGrammarlessLanguage(languageId) {
|
|
8468
|
-
return languageId === "text" || languageId === "ansi";
|
|
8469
|
-
}
|
|
8470
8126
|
function getShadowRootRange(shadowRoot) {
|
|
8471
8127
|
const selection = shadowRoot.getSelection?.();
|
|
8472
8128
|
if (selection == null || selection.rangeCount === 0) return;
|
|
@@ -9034,7 +8690,7 @@ var Editor = class {
|
|
|
9034
8690
|
if (tokenizer !== void 0) {
|
|
9035
8691
|
tokenizer.pauseBackgroundTokenize();
|
|
9036
8692
|
requestAnimationFrame(() => {
|
|
9037
|
-
tokenizer.resumeBackgroundTokenize();
|
|
8693
|
+
if (this.#tokenizer === tokenizer) tokenizer.resumeBackgroundTokenize();
|
|
9038
8694
|
});
|
|
9039
8695
|
}
|
|
9040
8696
|
}
|
|
@@ -9160,6 +8816,10 @@ var Editor = class {
|
|
|
9160
8816
|
};
|
|
9161
8817
|
}
|
|
9162
8818
|
const textDocument = editSession.document;
|
|
8819
|
+
if (this.#tokenizer != null && this.#tokenizer.highlighter !== highlighter) {
|
|
8820
|
+
this.#tokenizer.cleanUp();
|
|
8821
|
+
this.#tokenizer = void 0;
|
|
8822
|
+
}
|
|
9163
8823
|
if (this.#tokenizer == null && textDocument != null) this.#tokenizer = new EditorTokenizer({
|
|
9164
8824
|
highlighter,
|
|
9165
8825
|
textDocument,
|