ryugi-artifacts 1.7.4 → 1.9.0
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/bin/ryugi-artifacts.cjs +1 -52
- package/dist/cli.cjs +594 -0
- package/dist/server.cjs +862 -548
- package/dist/viewer/{CloudDocument-Ba6KrnqA.js → CloudDocument-Dguokp_6.js} +1 -1
- package/dist/viewer/{DocumentEditor-BS16Wb_Z.js → DocumentEditor-rRoUyzj5.js} +81 -81
- package/dist/viewer/DocumentPage-C0_SVGNv.js +1 -0
- package/dist/viewer/{abnfDiagram-VCTEODGH-DuJfhZTl.js → abnfDiagram-VCTEODGH-Cd62lXYi.js} +1 -1
- package/dist/viewer/{ar-SA-G6X2FPQ2-CVlRFGvR.js → ar-SA-G6X2FPQ2-k4wcXC0w.js} +1 -1
- package/dist/viewer/{architectureDiagram-5GKGNRK7-Ca-sK1k9.js → architectureDiagram-5GKGNRK7-BqGRfF7K.js} +1 -1
- package/dist/viewer/{az-AZ-76LH7QW2-CzO5U4tE.js → az-AZ-76LH7QW2-DjkRWALq.js} +1 -1
- package/dist/viewer/{bg-BG-XCXSNQG7-DLheLFGn.js → bg-BG-XCXSNQG7-CUOyMSFg.js} +1 -1
- package/dist/viewer/{blockDiagram-I7D4REHJ-CVWXNFVb.js → blockDiagram-I7D4REHJ-DLj9e678.js} +1 -1
- package/dist/viewer/{bn-BD-2XOGV67Q-DvnFf2ym.js → bn-BD-2XOGV67Q-CPw_5I7i.js} +1 -1
- package/dist/viewer/{c4Diagram-7LVT6UL2-CddHgiim.js → c4Diagram-7LVT6UL2-D9FPioA_.js} +1 -1
- package/dist/viewer/{ca-ES-6MX7JW3Y-1SQM_Wxy.js → ca-ES-6MX7JW3Y-Bl_ggxy-.js} +1 -1
- package/dist/viewer/{chunk-4HAMMTFA-B7k7y3et.js → chunk-4HAMMTFA-B8CHZ2iu.js} +1 -1
- package/dist/viewer/{chunk-75Z2AOVW-Dmt3SQH3.js → chunk-75Z2AOVW-BLvzzoaA.js} +1 -1
- package/dist/viewer/{chunk-EIO257PC-CNxgWaGL.js → chunk-EIO257PC-BkhwQy9u.js} +1 -1
- package/dist/viewer/{chunk-GMAD6QVW-Do0Tih79.js → chunk-GMAD6QVW-BIxPNzf_.js} +1 -1
- package/dist/viewer/{chunk-GVQU2GXP-C9mWLYpa.js → chunk-GVQU2GXP-BcbkZdgL.js} +1 -1
- package/dist/viewer/{chunk-IMKFNOWR-BqsuylOZ.js → chunk-IMKFNOWR-BlVm2eW6.js} +1 -1
- package/dist/viewer/{chunk-L3NEJ4N5-D_AVAMEp.js → chunk-L3NEJ4N5-DPP-Uqzz.js} +1 -1
- package/dist/viewer/{chunk-OSK3NFVY-BKczRUt9.js → chunk-OSK3NFVY-DvWBYW0M.js} +1 -1
- package/dist/viewer/{chunk-PWAF6VOD-CcIRMiiP.js → chunk-PWAF6VOD-Df9WdVJL.js} +1 -1
- package/dist/viewer/{chunk-SHT3W25Y-D8R29R_u.js → chunk-SHT3W25Y-BSCi7YG7.js} +1 -1
- package/dist/viewer/{chunk-SVP7TREG-DvPbOdMe.js → chunk-SVP7TREG-Bxv2fp8X.js} +1 -1
- package/dist/viewer/{chunk-TICWLB2K-v1pSr6BB.js → chunk-TICWLB2K-MSpOEdcV.js} +1 -1
- package/dist/viewer/classDiagram-ZZMXUADV-YWXPsH1o.js +1 -0
- package/dist/viewer/classDiagram-v2-VYDZK3BY-YWXPsH1o.js +1 -0
- package/dist/viewer/{cs-CZ-2BRQDIVT-CuIWOyM9.js → cs-CZ-2BRQDIVT-VpdA_B_0.js} +1 -1
- package/dist/viewer/{cynefinDiagram-5FMLGOSQ-CarHaJWA.js → cynefinDiagram-5FMLGOSQ-CCIqA18s.js} +1 -1
- package/dist/viewer/{da-DK-5WZEPLOC-BNpk9O4Z.js → da-DK-5WZEPLOC-Bikfnz1b.js} +1 -1
- package/dist/viewer/{dagre-GXQ25YYZ-jKxlutMc.js → dagre-GXQ25YYZ-DeVnyw6S.js} +1 -1
- package/dist/viewer/{de-DE-XR44H4JA-DeRYYEYN.js → de-DE-XR44H4JA-5nJunltn.js} +1 -1
- package/dist/viewer/{diagram-S7CK7UJ4-BzGz76pK.js → diagram-S7CK7UJ4-rcnT6Csv.js} +1 -1
- package/dist/viewer/{diagram-UQ7AKVKN-DDsoAc73.js → diagram-UQ7AKVKN-D6yGL_te.js} +1 -1
- package/dist/viewer/{diagram-VSXAHHWV-HxtxJg2X.js → diagram-VSXAHHWV-C8eVmzD7.js} +1 -1
- package/dist/viewer/{diagram-VX7I27RA-BIeolo3r.js → diagram-VX7I27RA-BVBGylbn.js} +1 -1
- package/dist/viewer/{diagram-Z3DM3KII-CU7mw2ow.js → diagram-Z3DM3KII-DnsHEfda.js} +1 -1
- package/dist/viewer/{dist-DqbHnPRI.js → dist-BGR5ezDy.js} +1 -1
- package/dist/viewer/{dist-DC1HltnF.js → dist-BPa5yz1M.js} +1 -1
- package/dist/viewer/{dist-BgSBKOA3.js → dist-BSqmGdSf.js} +1 -1
- package/dist/viewer/{dist-Bu_voPaa.js → dist-Bn3GpIIQ.js} +1 -1
- package/dist/viewer/{dist-BSeJYKLj.js → dist-C2UdEldV.js} +1 -1
- package/dist/viewer/{dist-DX3SNcdm.js → dist-C46f_skK.js} +1 -1
- package/dist/viewer/{dist-AH0bdIVa.js → dist-CNSswqVs.js} +1 -1
- package/dist/viewer/{dist-CgYgXYmt.js → dist-CPg9Exib.js} +1 -1
- package/dist/viewer/{dist-CddCPamz.js → dist-CWy1mEqq.js} +1 -1
- package/dist/viewer/{dist-CHLFapPp.js → dist-C_2nvGGH.js} +1 -1
- package/dist/viewer/{dist-CZsxPTNE.js → dist-CjSSDaiM.js} +1 -1
- package/dist/viewer/{dist-C-ieEyE1.js → dist-CyR9uUsj.js} +1 -1
- package/dist/viewer/{dist-CvB831yK.js → dist-DOLGlCIF.js} +1 -1
- package/dist/viewer/{dist-Cu6PLla0.js → dist-DOpcb4fi.js} +1 -1
- package/dist/viewer/{dist-CbHHxvP1.js → dist-DRJfWmsE.js} +1 -1
- package/dist/viewer/{dist-BeULvDu_.js → dist-DU3q2qgP.js} +1 -1
- package/dist/viewer/{dist-BlXyXxst.js → dist-DeqL7hkG.js} +1 -1
- package/dist/viewer/{dist-BppD0RS2.js → dist-DlPVPwB6.js} +1 -1
- package/dist/viewer/{dist-BbW5iWCe.js → dist-JNndX187.js} +1 -1
- package/dist/viewer/{dist-C21gJBBO.js → dist-bznEISxg.js} +1 -1
- package/dist/viewer/{dist-DA8TW41P.js → dist-gtpBaWjz.js} +1 -1
- package/dist/viewer/{dist-Cackv1h9.js → dist-oPn-5997.js} +1 -1
- package/dist/viewer/{dist-CitzQ6z1.js → dist-rkIdnkmY.js} +4 -4
- package/dist/viewer/{dist-D_Vtqh_s.js → dist-s3i70bod.js} +1 -1
- package/dist/viewer/{ebnfDiagram-PWID7BFC-BUmzlASS.js → ebnfDiagram-PWID7BFC-c_bXfo9C.js} +1 -1
- package/dist/viewer/{el-GR-BZB4AONW-CU9I6jx_.js → el-GR-BZB4AONW-DuM6nGWb.js} +1 -1
- package/dist/viewer/{en-B4ZKOASM-DGboqHSv.js → en-B4ZKOASM-Cr7s3JvY.js} +1 -1
- package/dist/viewer/{erDiagram-RLTQ6QDP-DRUmIoEG.js → erDiagram-RLTQ6QDP-B-DgtUd4.js} +1 -1
- package/dist/viewer/{es-ES-U4NZUMDT-j5HevUjd.js → es-ES-U4NZUMDT-DNvSsfqo.js} +1 -1
- package/dist/viewer/{eu-ES-A7QVB2H4-FpISoaoc.js → eu-ES-A7QVB2H4-NECtmtc_.js} +1 -1
- package/dist/viewer/{fa-IR-HGAKTJCU-COJsQztN.js → fa-IR-HGAKTJCU-fp_dFFfn.js} +1 -1
- package/dist/viewer/{fi-FI-Z5N7JZ37-BNHsLnGq.js → fi-FI-Z5N7JZ37-uZ8T0uZ2.js} +1 -1
- package/dist/viewer/flowDiagram-HODETNUW-QbMFIBc7.js +1 -0
- package/dist/viewer/{fr-FR-RHASNOE6-CM9a28Dh.js → fr-FR-RHASNOE6-DYF69T_L.js} +1 -1
- package/dist/viewer/{ganttDiagram-EL5Y4UJY-BVcwKFHE.js → ganttDiagram-EL5Y4UJY-C7nYK4VV.js} +1 -1
- package/dist/viewer/{gitGraphDiagram-WWUBYQGX-CZxp-Wm4.js → gitGraphDiagram-WWUBYQGX-BYs6a9XC.js} +1 -1
- package/dist/viewer/{gl-ES-HMX3MZ6V-C5aDlPBE.js → gl-ES-HMX3MZ6V-Cjlf8qDo.js} +1 -1
- package/dist/viewer/{he-IL-6SHJWFNN-eFs-GSWn.js → he-IL-6SHJWFNN-B44gxQ_q.js} +1 -1
- package/dist/viewer/{hi-IN-IWLTKZ5I-O1MAguUp.js → hi-IN-IWLTKZ5I-DHRyKjrX.js} +1 -1
- package/dist/viewer/{hu-HU-A5ZG7DT2-B3meydQb.js → hu-HU-A5ZG7DT2-B0x2fwF-.js} +1 -1
- package/dist/viewer/{id-ID-SAP4L64H-PHNH2hzW.js → id-ID-SAP4L64H-Xxsnu-eK.js} +1 -1
- package/dist/viewer/{image-GAAHSSAO-BJifdIGE.js → image-GAAHSSAO-DmsBDNOK.js} +1 -1
- package/dist/viewer/index.js +3 -3
- package/dist/viewer/index2.css +21 -1
- package/dist/viewer/{infoDiagram-27XIBGKW-D5Ag03ug.js → infoDiagram-27XIBGKW-OPdlHu-j.js} +1 -1
- package/dist/viewer/{ishikawaDiagram-5VMMS53U-B9SCwzFe.js → ishikawaDiagram-5VMMS53U-3fyfjNAh.js} +1 -1
- package/dist/viewer/{it-IT-JPQ66NNP-DHOLiY7r.js → it-IT-JPQ66NNP-B0X8yQyS.js} +1 -1
- package/dist/viewer/{ja-JP-DBVTYXUO-DTOuZQy0.js → ja-JP-DBVTYXUO-CnhqD0fK.js} +1 -1
- package/dist/viewer/{journeyDiagram-3NMN7TZE-CQvvWgCk.js → journeyDiagram-3NMN7TZE-BD_Ll3Bo.js} +1 -1
- package/dist/viewer/{kaa-6HZHGXH3-1d0tKthK.js → kaa-6HZHGXH3-BzhTyhLc.js} +1 -1
- package/dist/viewer/{kab-KAB-ZGHBKWFO-BaPyqYzR.js → kab-KAB-ZGHBKWFO-DGiUv22x.js} +1 -1
- package/dist/viewer/{kanban-definition-UXKFOSKX-Bg-Q4j28.js → kanban-definition-UXKFOSKX-BspaC3q1.js} +1 -1
- package/dist/viewer/{kk-KZ-P5N5QNE5-BqF9n_h-.js → kk-KZ-P5N5QNE5-DH8jyrO_.js} +1 -1
- package/dist/viewer/{km-KH-HSX4SM5Z-DPTb_KDC.js → km-KH-HSX4SM5Z-CTtH-yq7.js} +1 -1
- package/dist/viewer/{ko-KR-MTYHY66A-DxGidADD.js → ko-KR-MTYHY66A-kp3bbs3q.js} +1 -1
- package/dist/viewer/{ku-TR-6OUDTVRD-BECmOCof.js → ku-TR-6OUDTVRD-CniHyrQH.js} +1 -1
- package/dist/viewer/{lt-LT-XHIRWOB4-DKQm4SS0.js → lt-LT-XHIRWOB4-C5_ErQjQ.js} +1 -1
- package/dist/viewer/{lv-LV-5QDEKY6T-C4kUM3XE.js → lv-LV-5QDEKY6T-DH2pmwSL.js} +1 -1
- package/dist/viewer/{mindmap-definition-YA3MSWOX-DRQfDlAQ.js → mindmap-definition-YA3MSWOX-gbG6Nf0i.js} +1 -1
- package/dist/viewer/{mr-IN-CRQNXWMA-CutHorlk.js → mr-IN-CRQNXWMA-4I7m5ob-.js} +1 -1
- package/dist/viewer/{my-MM-5M5IBNSE-BqscH03z.js → my-MM-5M5IBNSE-0nHUTGbL.js} +1 -1
- package/dist/viewer/{nb-NO-T6EIAALU-Dqflwtt9.js → nb-NO-T6EIAALU-DfqC7CQ7.js} +1 -1
- package/dist/viewer/{nl-NL-IS3SIHDZ-BFq09PQX.js → nl-NL-IS3SIHDZ-Bjzz0r--.js} +1 -1
- package/dist/viewer/{nn-NO-6E72VCQL-BNIuUKOs.js → nn-NO-6E72VCQL-m2jjAc9n.js} +1 -1
- package/dist/viewer/{oc-FR-POXYY2M6-Bz0jVYcW.js → oc-FR-POXYY2M6-CAVYt9Ft.js} +1 -1
- package/dist/viewer/{pa-IN-N4M65BXN-Diu6ZQtk.js → pa-IN-N4M65BXN-CrcUCfFF.js} +1 -1
- package/dist/viewer/{pegDiagram-XKGWAZYB-COMSnXOr.js → pegDiagram-XKGWAZYB-MIcAh6C6.js} +1 -1
- package/dist/viewer/percentages-BXMCSKIN-I1K7WJgu.js +1 -0
- package/dist/viewer/{pieDiagram-E7YTZNPT-gHe-bm7N.js → pieDiagram-E7YTZNPT-mI3-_ikZ.js} +1 -1
- package/dist/viewer/{pl-PL-T2D74RX3-CCwgP0Tt.js → pl-PL-T2D74RX3-CGPvBMhq.js} +1 -1
- package/dist/viewer/{prod-iZwju1YX.js → prod-DdQVR1xL.js} +8 -8
- package/dist/viewer/{pt-BR-5N22H2LF-CNn18ypM.js → pt-BR-5N22H2LF-jUQJyEPF.js} +1 -1
- package/dist/viewer/{pt-PT-UZXXM6DQ-BMoRZ8jH.js → pt-PT-UZXXM6DQ-4quEbcoT.js} +1 -1
- package/dist/viewer/{quadrantDiagram-AXDQQJYC-YkFWTX48.js → quadrantDiagram-AXDQQJYC-qOr_Ag5n.js} +1 -1
- package/dist/viewer/{railroadDiagram-O6MQD6OU-BP58ggYs.js → railroadDiagram-O6MQD6OU-C8uzuX6Z.js} +1 -1
- package/dist/viewer/{requirementDiagram-BXWQKSXE-B4RcZ6Uz.js → requirementDiagram-BXWQKSXE-Dz0j-_Ul.js} +1 -1
- package/dist/viewer/{ro-RO-JPDTUUEW-SoalcNvO.js → ro-RO-JPDTUUEW-Fux6vqWg.js} +1 -1
- package/dist/viewer/{ru-RU-B4JR7IUQ-DkWHaRhg.js → ru-RU-B4JR7IUQ-Dfr69XLN.js} +1 -1
- package/dist/viewer/{sequenceDiagram-WJ2MYXX4-C5uL0tpK.js → sequenceDiagram-WJ2MYXX4-DJU5fD19.js} +1 -1
- package/dist/viewer/{si-LK-N5RQ5JYF-eD68JhLY.js → si-LK-N5RQ5JYF-Cb-bjtRn.js} +1 -1
- package/dist/viewer/{sk-SK-C5VTKIMK-EXqkY3Ta.js → sk-SK-C5VTKIMK-CohdnzY8.js} +1 -1
- package/dist/viewer/{sl-SI-NN7IZMDC-D2V_J_sw.js → sl-SI-NN7IZMDC-DHVdRHE2.js} +1 -1
- package/dist/viewer/{stateDiagram-D77RDMKH-DkyLdU7q.js → stateDiagram-D77RDMKH-Rooio_TB.js} +1 -1
- package/dist/viewer/stateDiagram-v2-MP3YSRHH-DU1T3Lmf.js +1 -0
- package/dist/viewer/subset-shared.chunk-CrkhCoQF.js +1 -0
- package/dist/viewer/{subset-worker.chunk-B92dIZyQ.js → subset-worker.chunk-Zq5HEGfq.js} +1 -1
- package/dist/viewer/{sv-SE-XGPEYMSR-Bzbzaslo.js → sv-SE-XGPEYMSR-BU075tJ9.js} +1 -1
- package/dist/viewer/{swimlanes-42K2YHIH-BWEGkPBm.js → swimlanes-42K2YHIH-BBJBvoSV.js} +1 -1
- package/dist/viewer/swimlanesDiagram-VR7AAH4N-NfEcSN_S.js +8 -0
- package/dist/viewer/{ta-IN-2NMHFXQM-BkRw8Ab-.js → ta-IN-2NMHFXQM-D5U6fuX5.js} +1 -1
- package/dist/viewer/{th-TH-HPSO5L25-DpxjfRSg.js → th-TH-HPSO5L25-5svbXPdz.js} +1 -1
- package/dist/viewer/{timeline-definition-24CTP7MA-BEYELt88.js → timeline-definition-24CTP7MA-B0TrCHZJ.js} +1 -1
- package/dist/viewer/{tr-TR-DEFEU3FU-CDIHZRzE.js → tr-TR-DEFEU3FU-CtJIUVOL.js} +1 -1
- package/dist/viewer/{uk-UA-QMV73CPH-BX8bS5mk.js → uk-UA-QMV73CPH-BUwW5t5R.js} +1 -1
- package/dist/viewer/{vennDiagram-4TSXK5OY-CWnDIkB0.js → vennDiagram-4TSXK5OY-I1KbtT6m.js} +1 -1
- package/dist/viewer/{vi-VN-M7AON7JQ-uPTH0PFh.js → vi-VN-M7AON7JQ-CEi077aa.js} +1 -1
- package/dist/viewer/{wardleyDiagram-VM6X3IG4-DazKGA6Y.js → wardleyDiagram-VM6X3IG4-BBsUCECp.js} +1 -1
- package/dist/viewer/{xychartDiagram-S5SC5T6Z-sQuCm3yV.js → xychartDiagram-S5SC5T6Z-CVMwOWKp.js} +1 -1
- package/dist/viewer/{zh-CN-LNUGB5OW-CSw936pf.js → zh-CN-LNUGB5OW-BSFQBwv1.js} +1 -1
- package/dist/viewer/{zh-HK-E62DVLB3-D5pp2ILq.js → zh-HK-E62DVLB3-C_UX1aQ7.js} +1 -1
- package/dist/viewer/{zh-TW-RAJ6MFWO-DUVdEREg.js → zh-TW-RAJ6MFWO-BvBIQhnc.js} +1 -1
- package/package.json +7 -5
- package/dist/start-server.sh +0 -359
- package/dist/viewer/DocumentPage-DQmrD0th.js +0 -1
- package/dist/viewer/classDiagram-ZZMXUADV-BJqflR68.js +0 -1
- package/dist/viewer/classDiagram-v2-VYDZK3BY-BJqflR68.js +0 -1
- package/dist/viewer/flowDiagram-HODETNUW-BIce5Xbz.js +0 -1
- package/dist/viewer/percentages-BXMCSKIN-C4UC-sd0.js +0 -1
- package/dist/viewer/stateDiagram-v2-MP3YSRHH-BMCqlN4T.js +0 -1
- package/dist/viewer/subset-shared.chunk-pCVh-jxe.js +0 -1
- package/dist/viewer/swimlanesDiagram-VR7AAH4N-a8X5vJTG.js +0 -8
package/dist/server.cjs
CHANGED
|
@@ -95,13 +95,13 @@ var require_CSSStyleRule = __commonJS({
|
|
|
95
95
|
CSSOM.CSSStyleRule.prototype.type = 1;
|
|
96
96
|
Object.defineProperty(CSSOM.CSSStyleRule.prototype, "cssText", {
|
|
97
97
|
get: function() {
|
|
98
|
-
var
|
|
98
|
+
var text2;
|
|
99
99
|
if (this.selectorText) {
|
|
100
|
-
|
|
100
|
+
text2 = this.selectorText + " {" + this.style.cssText + "}";
|
|
101
101
|
} else {
|
|
102
|
-
|
|
102
|
+
text2 = "";
|
|
103
103
|
}
|
|
104
|
-
return
|
|
104
|
+
return text2;
|
|
105
105
|
},
|
|
106
106
|
set: function(cssText) {
|
|
107
107
|
var rule = CSSOM.CSSStyleRule.parse(cssText);
|
|
@@ -659,9 +659,9 @@ var require_CSSValue = __commonJS({
|
|
|
659
659
|
CSSOM.CSSValue.prototype = {
|
|
660
660
|
constructor: CSSOM.CSSValue,
|
|
661
661
|
// @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
|
|
662
|
-
set cssText(
|
|
662
|
+
set cssText(text2) {
|
|
663
663
|
var name = this._getConstructorName();
|
|
664
|
-
throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' +
|
|
664
|
+
throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' + text2 + '"!');
|
|
665
665
|
},
|
|
666
666
|
get cssText() {
|
|
667
667
|
var name = this._getConstructorName();
|
|
@@ -755,7 +755,7 @@ var require_CSSValueExpression = __commonJS({
|
|
|
755
755
|
return ret;
|
|
756
756
|
};
|
|
757
757
|
CSSOM.CSSValueExpression.prototype._parseJSComment = function(token, idx) {
|
|
758
|
-
var nextChar = token.charAt(idx + 1),
|
|
758
|
+
var nextChar = token.charAt(idx + 1), text2;
|
|
759
759
|
if (nextChar === "/" || nextChar === "*") {
|
|
760
760
|
var startIdx = idx, endIdx, commentEndChar;
|
|
761
761
|
if (nextChar === "/") {
|
|
@@ -766,10 +766,10 @@ var require_CSSValueExpression = __commonJS({
|
|
|
766
766
|
endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1);
|
|
767
767
|
if (endIdx !== -1) {
|
|
768
768
|
endIdx = endIdx + commentEndChar.length - 1;
|
|
769
|
-
|
|
769
|
+
text2 = token.substring(idx, endIdx + 1);
|
|
770
770
|
return {
|
|
771
771
|
idx: endIdx,
|
|
772
|
-
text
|
|
772
|
+
text: text2
|
|
773
773
|
};
|
|
774
774
|
} else {
|
|
775
775
|
var error = "css expression error: unfinished comment in expression!";
|
|
@@ -782,14 +782,14 @@ var require_CSSValueExpression = __commonJS({
|
|
|
782
782
|
}
|
|
783
783
|
};
|
|
784
784
|
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) {
|
|
785
|
-
var endIdx = this._findMatchedIdx(token, idx, sep),
|
|
785
|
+
var endIdx = this._findMatchedIdx(token, idx, sep), text2;
|
|
786
786
|
if (endIdx === -1) {
|
|
787
787
|
return false;
|
|
788
788
|
} else {
|
|
789
|
-
|
|
789
|
+
text2 = token.substring(idx, endIdx + sep.length);
|
|
790
790
|
return {
|
|
791
791
|
idx: endIdx,
|
|
792
|
-
text
|
|
792
|
+
text: text2
|
|
793
793
|
};
|
|
794
794
|
}
|
|
795
795
|
};
|
|
@@ -839,7 +839,7 @@ var require_CSSValueExpression = __commonJS({
|
|
|
839
839
|
endIdx = NOT_FOUND;
|
|
840
840
|
break;
|
|
841
841
|
} else {
|
|
842
|
-
var
|
|
842
|
+
var text2 = token.substring(idx + 1, endIdx), matched = text2.match(/\\+$/);
|
|
843
843
|
if (!matched || matched[0] % 2 === 0) {
|
|
844
844
|
break;
|
|
845
845
|
} else {
|
|
@@ -1424,7 +1424,7 @@ var require_CSSStyleDeclaration = __commonJS({
|
|
|
1424
1424
|
}
|
|
1425
1425
|
return properties.join(" ");
|
|
1426
1426
|
},
|
|
1427
|
-
set cssText(
|
|
1427
|
+
set cssText(text2) {
|
|
1428
1428
|
var i6, name;
|
|
1429
1429
|
for (i6 = this.length; i6--; ) {
|
|
1430
1430
|
name = this[i6];
|
|
@@ -1432,7 +1432,7 @@ var require_CSSStyleDeclaration = __commonJS({
|
|
|
1432
1432
|
}
|
|
1433
1433
|
Array.prototype.splice.call(this, 0, this.length);
|
|
1434
1434
|
this._importants = {};
|
|
1435
|
-
var dummyRule = CSSOM.parse("#bogus{" +
|
|
1435
|
+
var dummyRule = CSSOM.parse("#bogus{" + text2 + "}").cssRules[0].style;
|
|
1436
1436
|
var length = dummyRule.length;
|
|
1437
1437
|
for (i6 = 0; i6 < length; ++i6) {
|
|
1438
1438
|
name = dummyRule[i6];
|
|
@@ -1562,15 +1562,15 @@ var require_canvas = __commonJS({
|
|
|
1562
1562
|
});
|
|
1563
1563
|
|
|
1564
1564
|
// src/server/main.ts
|
|
1565
|
-
var
|
|
1566
|
-
var
|
|
1565
|
+
var import_node_child_process2 = require("node:child_process");
|
|
1566
|
+
var import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
1567
1567
|
var import_node_os = __toESM(require("node:os"), 1);
|
|
1568
|
-
var
|
|
1568
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
1569
1569
|
|
|
1570
1570
|
// src/server/app.ts
|
|
1571
|
-
var
|
|
1571
|
+
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
1572
1572
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
1573
|
-
var
|
|
1573
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
1574
1574
|
|
|
1575
1575
|
// src/shared/types.ts
|
|
1576
1576
|
var ARTIFACT_TYPES = ["artboard", "document", "html"];
|
|
@@ -1744,8 +1744,8 @@ function nanoid(size = 21) {
|
|
|
1744
1744
|
// src/shared/comments.ts
|
|
1745
1745
|
var emptyComments = () => ({ version: 1, threads: [] });
|
|
1746
1746
|
var isObject = (value) => typeof value === "object" && value !== null;
|
|
1747
|
-
function parseComments(
|
|
1748
|
-
const raw = JSON.parse(
|
|
1747
|
+
function parseComments(text2) {
|
|
1748
|
+
const raw = JSON.parse(text2);
|
|
1749
1749
|
if (!isObject(raw)) throw new Error("comments.json must be an object");
|
|
1750
1750
|
if (!Array.isArray(raw.threads)) throw new Error("threads must be an array");
|
|
1751
1751
|
raw.threads.forEach((thread, i6) => {
|
|
@@ -1755,6 +1755,16 @@ function parseComments(text) {
|
|
|
1755
1755
|
});
|
|
1756
1756
|
return raw;
|
|
1757
1757
|
}
|
|
1758
|
+
var isSavedMessage = (m11) => !!m11.id && (m11.author === "human" || m11.author === "agent") && typeof m11.text === "string" && typeof m11.at === "string";
|
|
1759
|
+
function savedComments(incoming) {
|
|
1760
|
+
const threads = [];
|
|
1761
|
+
for (const t7 of incoming.threads) {
|
|
1762
|
+
if (!t7.id || !t7.anchor?.blockId || !t7.statusAt || t7.status !== "open" && t7.status !== "resolved") continue;
|
|
1763
|
+
const messages = (t7.messages ?? []).filter(isSavedMessage);
|
|
1764
|
+
threads.push({ id: t7.id, anchor: { blockId: t7.anchor.blockId, quote: t7.anchor.quote ?? "" }, status: t7.status, statusAt: t7.statusAt, messages });
|
|
1765
|
+
}
|
|
1766
|
+
return { version: 1, threads };
|
|
1767
|
+
}
|
|
1758
1768
|
var stampOf = (m11) => m11.editedAt ?? m11.at;
|
|
1759
1769
|
function mergeMessage(base, incoming, origin, now, warnings) {
|
|
1760
1770
|
if (base.deleted) return base;
|
|
@@ -1770,7 +1780,8 @@ function mergeMessage(base, incoming, origin, now, warnings) {
|
|
|
1770
1780
|
if (deleting) return { ...base, text: "", deleted: true, editedAt: now };
|
|
1771
1781
|
return { ...base, text: incoming.text, editedAt: incomingStamp === stampOf(base) ? now : incomingStamp };
|
|
1772
1782
|
}
|
|
1773
|
-
|
|
1783
|
+
var personOf = (who) => ({ ...who?.name ? { name: who.name } : {}, ...who?.avatar ? { avatar: who.avatar } : {} });
|
|
1784
|
+
function mergeThread(base, incoming, origin, now, newId, warnings, name) {
|
|
1774
1785
|
const messages = [...base.messages];
|
|
1775
1786
|
for (const message of incoming.messages ?? []) {
|
|
1776
1787
|
const index = message.id ? messages.findIndex((m11) => m11.id === message.id) : -1;
|
|
@@ -1785,7 +1796,7 @@ function mergeThread(base, incoming, origin, now, newId, warnings) {
|
|
|
1785
1796
|
continue;
|
|
1786
1797
|
}
|
|
1787
1798
|
if (typeof message.text !== "string" || message.text.length === 0) continue;
|
|
1788
|
-
messages.push({ id: message.id ?? newId(), author, text: message.text, at: message.at ?? now });
|
|
1799
|
+
messages.push({ id: message.id ?? newId(), author, ...personOf({ name }), text: message.text, at: message.at ?? now });
|
|
1789
1800
|
}
|
|
1790
1801
|
messages.sort((a5, b6) => a5.at < b6.at ? -1 : a5.at > b6.at ? 1 : 0);
|
|
1791
1802
|
let { status, statusAt } = base;
|
|
@@ -1799,13 +1810,13 @@ function mergeThread(base, incoming, origin, now, newId, warnings) {
|
|
|
1799
1810
|
return { ...base, status, statusAt, messages };
|
|
1800
1811
|
}
|
|
1801
1812
|
var sameUnsavedThread = (existing, incoming) => existing.anchor.blockId === incoming.anchor?.blockId && existing.anchor.quote === (incoming.anchor?.quote ?? "") && existing.messages[0]?.text === incoming.messages?.[0]?.text;
|
|
1802
|
-
function mergeComments(base, incoming, origin, now, newId) {
|
|
1813
|
+
function mergeComments(base, incoming, origin, now, newId, name) {
|
|
1803
1814
|
const warnings = [];
|
|
1804
1815
|
const threads = [...base.threads];
|
|
1805
1816
|
for (const thread of incoming.threads) {
|
|
1806
1817
|
const index = thread.id ? threads.findIndex((t7) => t7.id === thread.id) : threads.findIndex((t7) => sameUnsavedThread(t7, thread));
|
|
1807
1818
|
if (index >= 0) {
|
|
1808
|
-
threads[index] = mergeThread(threads[index], thread, origin, now, newId, warnings);
|
|
1819
|
+
threads[index] = mergeThread(threads[index], thread, origin, now, newId, warnings, name);
|
|
1809
1820
|
continue;
|
|
1810
1821
|
}
|
|
1811
1822
|
if (!thread.anchor?.blockId) {
|
|
@@ -1819,7 +1830,7 @@ function mergeComments(base, incoming, origin, now, newId) {
|
|
|
1819
1830
|
statusAt: now,
|
|
1820
1831
|
messages: []
|
|
1821
1832
|
};
|
|
1822
|
-
threads.push(mergeThread(fresh, { ...thread, status: thread.status ?? "open" }, origin, now, newId, warnings));
|
|
1833
|
+
threads.push(mergeThread(fresh, { ...thread, status: thread.status ?? "open" }, origin, now, newId, warnings, name));
|
|
1823
1834
|
}
|
|
1824
1835
|
return { file: { version: 1, threads }, warnings };
|
|
1825
1836
|
}
|
|
@@ -1831,7 +1842,7 @@ var updateHumanMessage = (thread, messageId, update2) => ({
|
|
|
1831
1842
|
...thread,
|
|
1832
1843
|
messages: thread.messages.map((m11) => m11.id === messageId && m11.author === "human" && !m11.deleted ? update2(m11) : m11)
|
|
1833
1844
|
});
|
|
1834
|
-
function applyHumanOp(file, op, now, newId) {
|
|
1845
|
+
function applyHumanOp(file, op, now, newId, who) {
|
|
1835
1846
|
switch (op.op) {
|
|
1836
1847
|
case "create":
|
|
1837
1848
|
return {
|
|
@@ -1843,12 +1854,12 @@ function applyHumanOp(file, op, now, newId) {
|
|
|
1843
1854
|
anchor: { blockId: op.blockId, quote: op.quote },
|
|
1844
1855
|
status: "open",
|
|
1845
1856
|
statusAt: now,
|
|
1846
|
-
messages: [{ id: newId(), author: "human", text: op.text, at: now }]
|
|
1857
|
+
messages: [{ id: newId(), author: "human", ...personOf(who), text: op.text, at: now }]
|
|
1847
1858
|
}
|
|
1848
1859
|
]
|
|
1849
1860
|
};
|
|
1850
1861
|
case "reply":
|
|
1851
|
-
return updateThread(file, op.threadId, (t7) => ({ ...t7, messages: [...t7.messages, { id: newId(), author: "human", text: op.text, at: now }] }));
|
|
1862
|
+
return updateThread(file, op.threadId, (t7) => ({ ...t7, messages: [...t7.messages, { id: newId(), author: "human", ...personOf(who), text: op.text, at: now }] }));
|
|
1852
1863
|
case "edit":
|
|
1853
1864
|
return updateThread(file, op.threadId, (t7) => updateHumanMessage(t7, op.messageId, (m11) => ({ ...m11, text: op.text, editedAt: now })));
|
|
1854
1865
|
case "delete":
|
|
@@ -1874,13 +1885,13 @@ var STICKY_FONT_SIZE = 18;
|
|
|
1874
1885
|
var STICKY_LINE_H = 27;
|
|
1875
1886
|
var STICKY_PAD = 16;
|
|
1876
1887
|
var isWide = (code) => code >= 11904;
|
|
1877
|
-
function textWidth(
|
|
1888
|
+
function textWidth(text2, fontSize) {
|
|
1878
1889
|
let width = 0;
|
|
1879
|
-
for (const char of
|
|
1890
|
+
for (const char of text2) width += fontSize * (isWide(char.codePointAt(0)) ? 1 : 0.56);
|
|
1880
1891
|
return width;
|
|
1881
1892
|
}
|
|
1882
|
-
function wrappedLines(
|
|
1883
|
-
return
|
|
1893
|
+
function wrappedLines(text2, fontSize, maxWidth) {
|
|
1894
|
+
return text2.split("\n").reduce((lines, paragraph) => lines + Math.max(1, Math.ceil(textWidth(paragraph, fontSize) / maxWidth)), 0);
|
|
1884
1895
|
}
|
|
1885
1896
|
function groupFrame(group, boards) {
|
|
1886
1897
|
const members = group.boards.map((id2) => boards[id2]).filter((b6) => Boolean(b6));
|
|
@@ -2108,14 +2119,14 @@ var resolveHtmlFile = (artifactDir, relative) => resolveFileWithin(artifactDir,
|
|
|
2108
2119
|
|
|
2109
2120
|
// src/server/state.ts
|
|
2110
2121
|
function readRaw(boardDir) {
|
|
2111
|
-
let
|
|
2122
|
+
let text2;
|
|
2112
2123
|
try {
|
|
2113
|
-
|
|
2124
|
+
text2 = import_node_fs5.default.readFileSync(import_node_path5.default.join(boardDir, "canvas.json"), "utf8");
|
|
2114
2125
|
} catch {
|
|
2115
2126
|
return { warning: "canvas.json not found" };
|
|
2116
2127
|
}
|
|
2117
2128
|
try {
|
|
2118
|
-
return { raw: JSON.parse(
|
|
2129
|
+
return { raw: JSON.parse(text2) };
|
|
2119
2130
|
} catch (err) {
|
|
2120
2131
|
return { warning: `canvas.json is not valid JSON: ${err.message}` };
|
|
2121
2132
|
}
|
|
@@ -2208,42 +2219,47 @@ function asHumanOp(value) {
|
|
|
2208
2219
|
return null;
|
|
2209
2220
|
}
|
|
2210
2221
|
}
|
|
2211
|
-
|
|
2222
|
+
var noNames = { human: () => void 0, agent: () => void 0 };
|
|
2223
|
+
function createCommentStore(file, names = noNames, now = () => (/* @__PURE__ */ new Date()).toISOString(), newId = () => nanoid(10)) {
|
|
2212
2224
|
let current = emptyComments();
|
|
2213
2225
|
let lastSeen = null;
|
|
2214
2226
|
let warnings = [];
|
|
2227
|
+
let loaded = false;
|
|
2215
2228
|
const write = () => {
|
|
2216
2229
|
writeJsonAtomic(file, current);
|
|
2217
2230
|
lastSeen = import_node_fs6.default.readFileSync(file, "utf8");
|
|
2218
2231
|
};
|
|
2219
2232
|
const sync = () => {
|
|
2220
|
-
let
|
|
2233
|
+
let text2;
|
|
2221
2234
|
try {
|
|
2222
|
-
|
|
2235
|
+
text2 = import_node_fs6.default.readFileSync(file, "utf8");
|
|
2223
2236
|
} catch {
|
|
2224
2237
|
return false;
|
|
2225
2238
|
}
|
|
2226
|
-
if (
|
|
2227
|
-
lastSeen =
|
|
2239
|
+
if (text2 === lastSeen) return false;
|
|
2240
|
+
lastSeen = text2;
|
|
2228
2241
|
try {
|
|
2229
|
-
const
|
|
2242
|
+
const incoming = parseComments(text2);
|
|
2243
|
+
const base = loaded ? current : savedComments(incoming);
|
|
2244
|
+
const merged = mergeComments(base, incoming, "agent", now(), newId, names.agent());
|
|
2230
2245
|
current = merged.file;
|
|
2231
2246
|
warnings = merged.warnings;
|
|
2232
2247
|
if (`${JSON.stringify(current, null, 2)}
|
|
2233
|
-
` !==
|
|
2248
|
+
` !== text2) write();
|
|
2234
2249
|
} catch (err) {
|
|
2235
2250
|
warnings = [`comments.json is not valid: ${err.message} (left as written; fix it)`];
|
|
2236
2251
|
}
|
|
2237
2252
|
return true;
|
|
2238
2253
|
};
|
|
2239
2254
|
sync();
|
|
2255
|
+
loaded = true;
|
|
2240
2256
|
return {
|
|
2241
2257
|
current: () => current,
|
|
2242
2258
|
warnings: () => warnings,
|
|
2243
2259
|
sync,
|
|
2244
2260
|
apply: (op) => {
|
|
2245
2261
|
sync();
|
|
2246
|
-
current = applyHumanOp(current, op, now(), newId);
|
|
2262
|
+
current = applyHumanOp(current, op, now(), newId, names.human());
|
|
2247
2263
|
write();
|
|
2248
2264
|
return current;
|
|
2249
2265
|
}
|
|
@@ -2749,8 +2765,8 @@ function $createDecoratorBoundaryAnchor() {
|
|
|
2749
2765
|
const img = $getDocument().createElement("img");
|
|
2750
2766
|
img.setAttribute("data-lexical-decorator-boundary", "true");
|
|
2751
2767
|
img.alt = "";
|
|
2752
|
-
for (const [
|
|
2753
|
-
img.style.setProperty(
|
|
2768
|
+
for (const [property2, value] of [["position", "absolute"], ["width", "0px"], ["height", "0px"], ["border", "0px"], ["margin", "0px"], ["padding", "0px"]]) {
|
|
2769
|
+
img.style.setProperty(property2, value, "important");
|
|
2754
2770
|
}
|
|
2755
2771
|
return img;
|
|
2756
2772
|
}
|
|
@@ -3114,19 +3130,19 @@ var ElementDOMSlot = class _ElementDOMSlot extends DOMSlot {
|
|
|
3114
3130
|
}
|
|
3115
3131
|
};
|
|
3116
3132
|
function indexPath(root, child) {
|
|
3117
|
-
const
|
|
3133
|
+
const path18 = [];
|
|
3118
3134
|
let node = child;
|
|
3119
3135
|
for (; node !== root && node !== null; node = node.parentNode) {
|
|
3120
3136
|
let i6 = 0;
|
|
3121
3137
|
for (let sibling = node.previousSibling; sibling !== null; sibling = sibling.previousSibling) {
|
|
3122
3138
|
i6++;
|
|
3123
3139
|
}
|
|
3124
|
-
|
|
3140
|
+
path18.push(i6);
|
|
3125
3141
|
}
|
|
3126
3142
|
if (!(node === root)) {
|
|
3127
3143
|
formatDevErrorMessage(`indexPath: root is not a parent of child`);
|
|
3128
3144
|
}
|
|
3129
|
-
return
|
|
3145
|
+
return path18.reverse();
|
|
3130
3146
|
}
|
|
3131
3147
|
// @__NO_SIDE_EFFECTS__
|
|
3132
3148
|
function readLexicalVersion() {
|
|
@@ -3526,9 +3542,9 @@ function $handleTextMutation(target, node, editor) {
|
|
|
3526
3542
|
anchorOffset = domSelectionPoints.anchorOffset;
|
|
3527
3543
|
focusOffset = domSelectionPoints.focusOffset;
|
|
3528
3544
|
}
|
|
3529
|
-
const
|
|
3530
|
-
if (
|
|
3531
|
-
$updateTextNodeFromDOMContent(node,
|
|
3545
|
+
const text2 = target.nodeValue;
|
|
3546
|
+
if (text2 !== null) {
|
|
3547
|
+
$updateTextNodeFromDOMContent(node, text2, anchorOffset, focusOffset, false);
|
|
3532
3548
|
}
|
|
3533
3549
|
}
|
|
3534
3550
|
function shouldUpdateTextNodeFromMutation(selection, targetDOM, targetNode) {
|
|
@@ -5470,7 +5486,7 @@ function $createNode(key2, slot) {
|
|
|
5470
5486
|
$reconcileDecoratorBoundaryAnchors(node, dom);
|
|
5471
5487
|
}
|
|
5472
5488
|
} else {
|
|
5473
|
-
const
|
|
5489
|
+
const text2 = node.getTextContent();
|
|
5474
5490
|
if ($isDecoratorNode(node)) {
|
|
5475
5491
|
const decorator = node.decorate(activeEditor$1, activeEditorConfig);
|
|
5476
5492
|
if (decorator !== null) {
|
|
@@ -5482,7 +5498,7 @@ function $createNode(key2, slot) {
|
|
|
5482
5498
|
$mountSlotChildren(node, dom, slots);
|
|
5483
5499
|
}
|
|
5484
5500
|
}
|
|
5485
|
-
subTreeTextContent +=
|
|
5501
|
+
subTreeTextContent += text2;
|
|
5486
5502
|
}
|
|
5487
5503
|
if (slot !== null) {
|
|
5488
5504
|
slot.insertChild(dom);
|
|
@@ -5761,18 +5777,18 @@ function $tryReconcileSuffixWithSizeDelta(prevElement, nextElement, slot, cacheD
|
|
|
5761
5777
|
if (node === void 0) {
|
|
5762
5778
|
return false;
|
|
5763
5779
|
}
|
|
5764
|
-
let
|
|
5780
|
+
let text2;
|
|
5765
5781
|
if ($isElementNode(node)) {
|
|
5766
5782
|
const childKeyedDom = activeEditor$1._keyToDOMMap.get(nextSuffixKeys[i6]);
|
|
5767
5783
|
const cached = childKeyedDom && childKeyedDom.__lexicalTextContent;
|
|
5768
5784
|
if (!(typeof cached === "string")) {
|
|
5769
5785
|
formatDevErrorMessage(`tryReconcileSuffixWithSizeDelta: missing __lexicalTextContent on child of type ${node.getType()} after suffix reconcile`);
|
|
5770
5786
|
}
|
|
5771
|
-
|
|
5787
|
+
text2 = cached;
|
|
5772
5788
|
} else {
|
|
5773
|
-
|
|
5789
|
+
text2 = node.getTextContent();
|
|
5774
5790
|
}
|
|
5775
|
-
newSuffix +=
|
|
5791
|
+
newSuffix += text2;
|
|
5776
5792
|
if (i6 < k5 - 1 && $isElementNode(node) && !node.isInline()) {
|
|
5777
5793
|
newSuffix += DOUBLE_LINE_BREAK;
|
|
5778
5794
|
}
|
|
@@ -5878,18 +5894,18 @@ function $reconcileChildren(prevElement, nextElement, slot) {
|
|
|
5878
5894
|
if (node === void 0) {
|
|
5879
5895
|
break;
|
|
5880
5896
|
}
|
|
5881
|
-
let
|
|
5897
|
+
let text2;
|
|
5882
5898
|
if ($isElementNode(node)) {
|
|
5883
5899
|
const childKeyedDom = activeEditor$1._keyToDOMMap.get(cur);
|
|
5884
5900
|
const cached = childKeyedDom && childKeyedDom.__lexicalTextContent;
|
|
5885
5901
|
if (!(typeof cached === "string")) {
|
|
5886
5902
|
formatDevErrorMessage(`reconcileChildren same-size suffix: missing __lexicalTextContent on child of type ${node.getType()} after reconcile`);
|
|
5887
5903
|
}
|
|
5888
|
-
|
|
5904
|
+
text2 = cached;
|
|
5889
5905
|
} else {
|
|
5890
|
-
|
|
5906
|
+
text2 = node.getTextContent();
|
|
5891
5907
|
}
|
|
5892
|
-
newSuffix +=
|
|
5908
|
+
newSuffix += text2;
|
|
5893
5909
|
if (i6 < k5 - 1 && $isElementNode(node) && !node.isInline()) {
|
|
5894
5910
|
newSuffix += DOUBLE_LINE_BREAK;
|
|
5895
5911
|
}
|
|
@@ -5928,7 +5944,7 @@ function $reconcileChildren(prevElement, nextElement, slot) {
|
|
|
5928
5944
|
if (isDirty) {
|
|
5929
5945
|
$reconcileNode(nodeKey, dom);
|
|
5930
5946
|
} else {
|
|
5931
|
-
let
|
|
5947
|
+
let text2;
|
|
5932
5948
|
let childKeyedDom;
|
|
5933
5949
|
if ($isElementNode(node)) {
|
|
5934
5950
|
childKeyedDom = activePrevKeyToDOMMap.get(nodeKey);
|
|
@@ -5936,11 +5952,11 @@ function $reconcileChildren(prevElement, nextElement, slot) {
|
|
|
5936
5952
|
if (!(typeof cached === "string")) {
|
|
5937
5953
|
formatDevErrorMessage(`reconcileChildren structurally-clean walk: missing __lexicalTextContent on non-dirty child of type ${node.getType()}`);
|
|
5938
5954
|
}
|
|
5939
|
-
|
|
5955
|
+
text2 = cached;
|
|
5940
5956
|
} else {
|
|
5941
|
-
|
|
5957
|
+
text2 = node.getTextContent();
|
|
5942
5958
|
}
|
|
5943
|
-
subTreeTextContent +=
|
|
5959
|
+
subTreeTextContent += text2;
|
|
5944
5960
|
if (childKeyedDom !== void 0) {
|
|
5945
5961
|
$bubbleChildFirstText(childKeyedDom);
|
|
5946
5962
|
}
|
|
@@ -6040,18 +6056,18 @@ function $reconcileNode(key2, parentDOM) {
|
|
|
6040
6056
|
const isDirty = treatAllNodesAsDirty || activeDirtyLeaves.has(key2) || activeDirtyElements.has(key2);
|
|
6041
6057
|
const dom = getElementByKeyOrThrow(activeEditor$1, key2);
|
|
6042
6058
|
if (prevNode === nextNode && !isDirty) {
|
|
6043
|
-
let
|
|
6059
|
+
let text2;
|
|
6044
6060
|
if ($isElementNode(prevNode)) {
|
|
6045
6061
|
const previousSubTreeTextContent = dom.__lexicalTextContent;
|
|
6046
6062
|
if (!(typeof previousSubTreeTextContent === "string")) {
|
|
6047
6063
|
formatDevErrorMessage(`reconcileNode: missing __lexicalTextContent on non-dirty element of type ${prevNode.getType()}`);
|
|
6048
6064
|
}
|
|
6049
|
-
|
|
6065
|
+
text2 = previousSubTreeTextContent;
|
|
6050
6066
|
$bubbleChildFirstText(dom);
|
|
6051
6067
|
} else {
|
|
6052
|
-
|
|
6068
|
+
text2 = prevNode.getTextContent();
|
|
6053
6069
|
}
|
|
6054
|
-
subTreeTextContent +=
|
|
6070
|
+
subTreeTextContent += text2;
|
|
6055
6071
|
return dom;
|
|
6056
6072
|
}
|
|
6057
6073
|
if (prevNode !== nextNode && isDirty) {
|
|
@@ -6123,7 +6139,7 @@ function $reconcileNode(key2, parentDOM) {
|
|
|
6123
6139
|
}
|
|
6124
6140
|
}
|
|
6125
6141
|
} else {
|
|
6126
|
-
const
|
|
6142
|
+
const text2 = nextNode.getTextContent();
|
|
6127
6143
|
if ($isDecoratorNode(nextNode)) {
|
|
6128
6144
|
const decorator = nextNode.decorate(activeEditor$1, activeEditorConfig);
|
|
6129
6145
|
if (decorator !== null) {
|
|
@@ -6133,7 +6149,7 @@ function $reconcileNode(key2, parentDOM) {
|
|
|
6133
6149
|
$reconcileSlotChildren(prevNode, nextNode, dom);
|
|
6134
6150
|
}
|
|
6135
6151
|
}
|
|
6136
|
-
subTreeTextContent +=
|
|
6152
|
+
subTreeTextContent += text2;
|
|
6137
6153
|
}
|
|
6138
6154
|
if (!activeEditorStateReadOnly && $isRootNode(nextNode)) {
|
|
6139
6155
|
const latestRoot = nextNode.getLatest();
|
|
@@ -6544,7 +6560,7 @@ var documentSelectionChange = /* @__PURE__ */ createRefCountedRegistry((doc) =>
|
|
|
6544
6560
|
doc.addEventListener("selectionchange", onDocumentSelectionChange);
|
|
6545
6561
|
return () => doc.removeEventListener("selectionchange", onDocumentSelectionChange);
|
|
6546
6562
|
});
|
|
6547
|
-
function $shouldPreventDefaultAndInsertText(selection, domTargetRange,
|
|
6563
|
+
function $shouldPreventDefaultAndInsertText(selection, domTargetRange, text2, timeStamp, isBeforeInput, cachedDOMSelectionPoints) {
|
|
6548
6564
|
const anchor = selection.anchor;
|
|
6549
6565
|
const focus = selection.focus;
|
|
6550
6566
|
const anchorNode = anchor.getNode();
|
|
@@ -6559,7 +6575,7 @@ function $shouldPreventDefaultAndInsertText(selection, domTargetRange, text, tim
|
|
|
6559
6575
|
const domAnchorNode = domSelectionPoints !== null ? domSelectionPoints.anchorNode : null;
|
|
6560
6576
|
const anchorKey = anchor.key;
|
|
6561
6577
|
const backingAnchorElement = editor.getElementByKey(anchorKey);
|
|
6562
|
-
const textLength =
|
|
6578
|
+
const textLength = text2.length;
|
|
6563
6579
|
return anchorKey !== focus.key || // If we're working with a non-text node.
|
|
6564
6580
|
!$isTextNode(anchorNode) || // If we are replacing a range with a single character or grapheme, and not composing.
|
|
6565
6581
|
(!isBeforeInput && (!CAN_USE_BEFORE_INPUT || // We check to see if there has been
|
|
@@ -6568,7 +6584,7 @@ function $shouldPreventDefaultAndInsertText(selection, domTargetRange, text, tim
|
|
|
6568
6584
|
// a dangling `input` event caused by execCommand('insertText').
|
|
6569
6585
|
editor._inputState.lastBeforeInputInsertTextTimeStamp < timeStamp + 50) || anchorNode.isDirty() && textLength < 2 || // TODO consider if there are other scenarios when multiple code units
|
|
6570
6586
|
// should be addressed here
|
|
6571
|
-
doesContainSurrogatePair(
|
|
6587
|
+
doesContainSurrogatePair(text2)) && anchor.offset !== focus.offset && !anchorNode.isComposing() || // Any non standard text node.
|
|
6572
6588
|
$isTokenOrSegmented(anchorNode) || // If the text length is more than a single character and we're either
|
|
6573
6589
|
// dealing with this in "beforeinput" or where the node has already recently
|
|
6574
6590
|
// been changed (thus is dirty).
|
|
@@ -6987,9 +7003,9 @@ function $handleBeforeInput(event) {
|
|
|
6987
7003
|
event.preventDefault();
|
|
6988
7004
|
dispatchCommand(editor, INSERT_PARAGRAPH_COMMAND);
|
|
6989
7005
|
} else if (data == null && event.dataTransfer) {
|
|
6990
|
-
const
|
|
7006
|
+
const text2 = event.dataTransfer.getData("text/plain");
|
|
6991
7007
|
event.preventDefault();
|
|
6992
|
-
selection.insertRawText(
|
|
7008
|
+
selection.insertRawText(text2);
|
|
6993
7009
|
} else if (data != null && $shouldPreventDefaultAndInsertText(selection, targetRange, data, event.timeStamp, true)) {
|
|
6994
7010
|
event.preventDefault();
|
|
6995
7011
|
dispatchCommand(editor, CONTROLLED_TEXT_INSERTION_COMMAND, data);
|
|
@@ -8228,11 +8244,11 @@ var LexicalNode = class {
|
|
|
8228
8244
|
*
|
|
8229
8245
|
* @param object - the node to perform the equality comparison on.
|
|
8230
8246
|
*/
|
|
8231
|
-
is(
|
|
8232
|
-
if (
|
|
8247
|
+
is(object2) {
|
|
8248
|
+
if (object2 == null) {
|
|
8233
8249
|
return false;
|
|
8234
8250
|
}
|
|
8235
|
-
return this.__key ===
|
|
8251
|
+
return this.__key === object2.__key;
|
|
8236
8252
|
}
|
|
8237
8253
|
/**
|
|
8238
8254
|
* Returns true if this node logically precedes the target node in the
|
|
@@ -9067,9 +9083,9 @@ var GENERATED_TEXT = (fields) => {
|
|
|
9067
9083
|
if (style !== void 0 && style !== "") {
|
|
9068
9084
|
json.style = style;
|
|
9069
9085
|
}
|
|
9070
|
-
const
|
|
9071
|
-
if (
|
|
9072
|
-
json.text =
|
|
9086
|
+
const text2 = node.__text;
|
|
9087
|
+
if (text2 !== void 0 && text2 !== "") {
|
|
9088
|
+
json.text = text2;
|
|
9073
9089
|
}
|
|
9074
9090
|
return json;
|
|
9075
9091
|
}
|
|
@@ -9082,8 +9098,8 @@ var GENERATED_TEXT = (fields) => {
|
|
|
9082
9098
|
node.__mode = typeof mode === "string" && mode in TEXT_MODE_SETTER ? TEXT_MODE_SETTER[mode] : TEXT_MODE_SETTER_DEFAULT;
|
|
9083
9099
|
const style = json.style;
|
|
9084
9100
|
node.__style = typeof style === "string" ? style : "";
|
|
9085
|
-
const
|
|
9086
|
-
node.__text = typeof
|
|
9101
|
+
const text2 = json.text;
|
|
9102
|
+
node.__text = typeof text2 === "string" ? text2 : "";
|
|
9087
9103
|
return node;
|
|
9088
9104
|
}
|
|
9089
9105
|
return {
|
|
@@ -9308,10 +9324,10 @@ function getStyleObjectFromCSS(css) {
|
|
|
9308
9324
|
}
|
|
9309
9325
|
chunkStart = -1;
|
|
9310
9326
|
}
|
|
9311
|
-
const
|
|
9327
|
+
const property3 = currentProperty.trim();
|
|
9312
9328
|
const value2 = currentValue.trim();
|
|
9313
|
-
if (
|
|
9314
|
-
styles[
|
|
9329
|
+
if (property3 !== "" && value2 !== "") {
|
|
9330
|
+
styles[property3] = value2;
|
|
9315
9331
|
}
|
|
9316
9332
|
currentProperty = "";
|
|
9317
9333
|
currentValue = "";
|
|
@@ -9329,30 +9345,30 @@ function getStyleObjectFromCSS(css) {
|
|
|
9329
9345
|
currentProperty += css.slice(chunkStart, length);
|
|
9330
9346
|
}
|
|
9331
9347
|
}
|
|
9332
|
-
const
|
|
9348
|
+
const property2 = currentProperty.trim();
|
|
9333
9349
|
const value = currentValue.trim();
|
|
9334
|
-
if (
|
|
9335
|
-
styles[
|
|
9350
|
+
if (property2 !== "" && value !== "") {
|
|
9351
|
+
styles[property2] = value;
|
|
9336
9352
|
}
|
|
9337
9353
|
return styles;
|
|
9338
9354
|
}
|
|
9339
|
-
function setDOMStyleProperty(domStyle,
|
|
9355
|
+
function setDOMStyleProperty(domStyle, property2, value) {
|
|
9340
9356
|
const trimmedValue = value.trimEnd();
|
|
9341
9357
|
const flagStart = trimmedValue.length - IMPORTANT_FLAG.length;
|
|
9342
9358
|
const hasImportant = flagStart >= 0 && trimmedValue.slice(flagStart).toLowerCase() === IMPORTANT_FLAG;
|
|
9343
9359
|
if (hasImportant) {
|
|
9344
|
-
domStyle.setProperty(
|
|
9360
|
+
domStyle.setProperty(property2, trimmedValue.slice(0, flagStart).trim(), "important");
|
|
9345
9361
|
} else {
|
|
9346
|
-
domStyle.setProperty(
|
|
9362
|
+
domStyle.setProperty(property2, value, "");
|
|
9347
9363
|
}
|
|
9348
9364
|
}
|
|
9349
9365
|
function setDOMStyleObject(domStyle, styleObject) {
|
|
9350
|
-
for (const
|
|
9351
|
-
const value = styleObject[
|
|
9366
|
+
for (const property2 in styleObject) {
|
|
9367
|
+
const value = styleObject[property2];
|
|
9352
9368
|
if (value == null) {
|
|
9353
|
-
domStyle.removeProperty(
|
|
9369
|
+
domStyle.removeProperty(property2);
|
|
9354
9370
|
} else {
|
|
9355
|
-
setDOMStyleProperty(domStyle,
|
|
9371
|
+
setDOMStyleProperty(domStyle, property2, value);
|
|
9356
9372
|
}
|
|
9357
9373
|
}
|
|
9358
9374
|
}
|
|
@@ -9362,12 +9378,12 @@ function setDOMStyleFromCSS(domStyle, cssText, prevCSSText = "") {
|
|
|
9362
9378
|
}
|
|
9363
9379
|
const prevCSS = getStyleObjectFromCSS(prevCSSText);
|
|
9364
9380
|
const nextCSS = getStyleObjectFromCSS(cssText);
|
|
9365
|
-
for (const
|
|
9366
|
-
delete prevCSS[
|
|
9367
|
-
setDOMStyleProperty(domStyle,
|
|
9381
|
+
for (const property2 in nextCSS) {
|
|
9382
|
+
delete prevCSS[property2];
|
|
9383
|
+
setDOMStyleProperty(domStyle, property2, nextCSS[property2]);
|
|
9368
9384
|
}
|
|
9369
|
-
for (const
|
|
9370
|
-
domStyle.removeProperty(
|
|
9385
|
+
for (const property2 in prevCSS) {
|
|
9386
|
+
domStyle.removeProperty(property2);
|
|
9371
9387
|
}
|
|
9372
9388
|
}
|
|
9373
9389
|
var textNodeSchema = /* @__PURE__ */ (/* @__PURE__ */ nodeSchema())({
|
|
@@ -9481,31 +9497,31 @@ function diffComposedText(a5, b6) {
|
|
|
9481
9497
|
function $setTextContent(nextText, dom, node) {
|
|
9482
9498
|
const isComposing = node.isComposing();
|
|
9483
9499
|
const suffix = isComposing ? COMPOSITION_SUFFIX : "";
|
|
9484
|
-
const
|
|
9500
|
+
const text2 = nextText + suffix;
|
|
9485
9501
|
const editor = $getEditor();
|
|
9486
9502
|
const slot = $getEditorDOMRenderConfig(editor).$getDOMSlot(node, dom, editor);
|
|
9487
9503
|
const firstChild = slot.getFirstChild();
|
|
9488
9504
|
if (firstChild === null || firstChild.nodeType !== Node.TEXT_NODE) {
|
|
9489
|
-
slot.insertChild($getDocument().createTextNode(
|
|
9505
|
+
slot.insertChild($getDocument().createTextNode(text2));
|
|
9490
9506
|
return;
|
|
9491
9507
|
}
|
|
9492
9508
|
const textChild = firstChild;
|
|
9493
9509
|
const nodeValue = textChild.nodeValue;
|
|
9494
|
-
if (nodeValue ===
|
|
9510
|
+
if (nodeValue === text2) {
|
|
9495
9511
|
return;
|
|
9496
9512
|
}
|
|
9497
9513
|
if (isComposing || IS_FIREFOX) {
|
|
9498
|
-
const [index, remove2, insert2] = diffComposedText(nodeValue,
|
|
9514
|
+
const [index, remove2, insert2] = diffComposedText(nodeValue, text2);
|
|
9499
9515
|
if (remove2 !== 0) {
|
|
9500
9516
|
textChild.deleteData(index, remove2);
|
|
9501
9517
|
}
|
|
9502
9518
|
textChild.insertData(index, insert2);
|
|
9503
9519
|
} else {
|
|
9504
|
-
textChild.nodeValue =
|
|
9520
|
+
textChild.nodeValue = text2;
|
|
9505
9521
|
}
|
|
9506
9522
|
}
|
|
9507
|
-
function $createTextInnerDOM(innerDOM, node, innerTag, format,
|
|
9508
|
-
$setTextContent(
|
|
9523
|
+
function $createTextInnerDOM(innerDOM, node, innerTag, format, text2, config) {
|
|
9524
|
+
$setTextContent(text2, innerDOM, node);
|
|
9509
9525
|
const theme = config.theme;
|
|
9510
9526
|
const textClassNames = theme.text;
|
|
9511
9527
|
if (textClassNames !== void 0) {
|
|
@@ -9592,9 +9608,9 @@ var TextNode = class extends LexicalNode {
|
|
|
9592
9608
|
json: textNodeSchema
|
|
9593
9609
|
});
|
|
9594
9610
|
}
|
|
9595
|
-
constructor(
|
|
9611
|
+
constructor(text2 = "", key2) {
|
|
9596
9612
|
super(key2);
|
|
9597
|
-
this.__text =
|
|
9613
|
+
this.__text = text2;
|
|
9598
9614
|
this.__format = 0;
|
|
9599
9615
|
this.__style = "";
|
|
9600
9616
|
this.__mode = 0;
|
|
@@ -9755,8 +9771,8 @@ var TextNode = class extends LexicalNode {
|
|
|
9755
9771
|
innerDOM = $getDocument().createElement(innerTag);
|
|
9756
9772
|
dom.appendChild(innerDOM);
|
|
9757
9773
|
}
|
|
9758
|
-
const
|
|
9759
|
-
$createTextInnerDOM(innerDOM, this, innerTag, format,
|
|
9774
|
+
const text2 = this.__text;
|
|
9775
|
+
$createTextInnerDOM(innerDOM, this, innerTag, format, text2, config);
|
|
9760
9776
|
const style = this.__style;
|
|
9761
9777
|
if (style !== "") {
|
|
9762
9778
|
setDOMStyleFromCSS(dom.style, style);
|
|
@@ -9956,12 +9972,12 @@ var TextNode = class extends LexicalNode {
|
|
|
9956
9972
|
*
|
|
9957
9973
|
* @returns this TextNode.
|
|
9958
9974
|
*/
|
|
9959
|
-
setTextContent(
|
|
9960
|
-
if (this.getLatest().__text ===
|
|
9975
|
+
setTextContent(text2) {
|
|
9976
|
+
if (this.getLatest().__text === text2) {
|
|
9961
9977
|
return this;
|
|
9962
9978
|
}
|
|
9963
9979
|
const self2 = this.getWritable();
|
|
9964
|
-
self2.__text =
|
|
9980
|
+
self2.__text = text2;
|
|
9965
9981
|
return self2;
|
|
9966
9982
|
}
|
|
9967
9983
|
/**
|
|
@@ -9977,10 +9993,10 @@ var TextNode = class extends LexicalNode {
|
|
|
9977
9993
|
let anchorOffset = _anchorOffset;
|
|
9978
9994
|
let focusOffset = _focusOffset;
|
|
9979
9995
|
const selection = $getSelection();
|
|
9980
|
-
const
|
|
9996
|
+
const text2 = this.getTextContent();
|
|
9981
9997
|
const key2 = this.__key;
|
|
9982
|
-
if (typeof
|
|
9983
|
-
const lastOffset =
|
|
9998
|
+
if (typeof text2 === "string") {
|
|
9999
|
+
const lastOffset = text2.length;
|
|
9984
10000
|
if (anchorOffset === void 0) {
|
|
9985
10001
|
anchorOffset = lastOffset;
|
|
9986
10002
|
}
|
|
@@ -10022,7 +10038,7 @@ var TextNode = class extends LexicalNode {
|
|
|
10022
10038
|
*/
|
|
10023
10039
|
spliceText(offset, delCount, newText, moveSelection) {
|
|
10024
10040
|
const writableSelf = this.getWritable();
|
|
10025
|
-
const
|
|
10041
|
+
const text2 = writableSelf.__text;
|
|
10026
10042
|
const handledTextLength = newText.length;
|
|
10027
10043
|
let index = offset;
|
|
10028
10044
|
if (index < 0) {
|
|
@@ -10036,7 +10052,7 @@ var TextNode = class extends LexicalNode {
|
|
|
10036
10052
|
const newOffset = offset + handledTextLength;
|
|
10037
10053
|
selection.setTextNodeRange(writableSelf, newOffset, writableSelf, newOffset);
|
|
10038
10054
|
}
|
|
10039
|
-
const updatedText =
|
|
10055
|
+
const updatedText = text2.slice(0, index) + newText + text2.slice(index + delCount);
|
|
10040
10056
|
writableSelf.__text = updatedText;
|
|
10041
10057
|
return writableSelf;
|
|
10042
10058
|
}
|
|
@@ -10188,8 +10204,8 @@ var TextNode = class extends LexicalNode {
|
|
|
10188
10204
|
}
|
|
10189
10205
|
const key2 = this.__key;
|
|
10190
10206
|
const targetKey = target.__key;
|
|
10191
|
-
const
|
|
10192
|
-
const textLength =
|
|
10207
|
+
const text2 = this.__text;
|
|
10208
|
+
const textLength = text2.length;
|
|
10193
10209
|
const compositionKey = $getCompositionKey();
|
|
10194
10210
|
if (compositionKey === targetKey) {
|
|
10195
10211
|
$setCompositionKey(key2);
|
|
@@ -10206,7 +10222,7 @@ var TextNode = class extends LexicalNode {
|
|
|
10206
10222
|
}
|
|
10207
10223
|
}
|
|
10208
10224
|
const targetText = target.__text;
|
|
10209
|
-
const newText = isBefore ? targetText +
|
|
10225
|
+
const newText = isBefore ? targetText + text2 : text2 + targetText;
|
|
10210
10226
|
this.setTextContent(newText);
|
|
10211
10227
|
const writableSelf = this.getWritable();
|
|
10212
10228
|
target.remove();
|
|
@@ -10321,8 +10337,8 @@ function $convertTextDOMNode(domNode) {
|
|
|
10321
10337
|
node: $createTextNode(textContent3)
|
|
10322
10338
|
};
|
|
10323
10339
|
}
|
|
10324
|
-
function findTextInLine(
|
|
10325
|
-
let node =
|
|
10340
|
+
function findTextInLine(text2, forward) {
|
|
10341
|
+
let node = text2;
|
|
10326
10342
|
while (true) {
|
|
10327
10343
|
let sibling;
|
|
10328
10344
|
while ((sibling = forward ? node.nextSibling : node.previousSibling) === null) {
|
|
@@ -10373,8 +10389,8 @@ function convertTextFormatElement(domNode) {
|
|
|
10373
10389
|
node: null
|
|
10374
10390
|
};
|
|
10375
10391
|
}
|
|
10376
|
-
function $createTextNode(
|
|
10377
|
-
return $applyNodeReplacement(new TextNode(
|
|
10392
|
+
function $createTextNode(text2 = "") {
|
|
10393
|
+
return $applyNodeReplacement(new TextNode(text2));
|
|
10378
10394
|
}
|
|
10379
10395
|
function $isTextNode(node) {
|
|
10380
10396
|
return node instanceof TextNode;
|
|
@@ -10645,13 +10661,13 @@ function $transferStartingElementPointToTextPoint(start, end, format, style) {
|
|
|
10645
10661
|
}
|
|
10646
10662
|
start.set(textNode.__key, 0, "text");
|
|
10647
10663
|
}
|
|
10648
|
-
function $insertTextAtPoint(selection,
|
|
10664
|
+
function $insertTextAtPoint(selection, text2, format, style) {
|
|
10649
10665
|
const anchorNode = selection.anchor.getNode();
|
|
10650
10666
|
if (!$isTextNode(anchorNode)) {
|
|
10651
10667
|
formatDevErrorMessage(`insertText: anchor is not a text node`);
|
|
10652
10668
|
}
|
|
10653
10669
|
const offset = selection.anchor.offset;
|
|
10654
|
-
const textNode = $createTextNode(
|
|
10670
|
+
const textNode = $createTextNode(text2);
|
|
10655
10671
|
textNode.setFormat(format);
|
|
10656
10672
|
textNode.setStyle(style);
|
|
10657
10673
|
const parent = anchorNode.getParentOrThrow();
|
|
@@ -10676,7 +10692,7 @@ function $insertTextAtPoint(selection, text, format, style) {
|
|
|
10676
10692
|
}
|
|
10677
10693
|
textNode.selectEnd();
|
|
10678
10694
|
if (textNode.isComposing() && selection.anchor.type === "text") {
|
|
10679
|
-
selection.anchor.set(selection.anchor.key, selection.anchor.offset -
|
|
10695
|
+
selection.anchor.set(selection.anchor.key, selection.anchor.offset - text2.length, selection.anchor.type);
|
|
10680
10696
|
}
|
|
10681
10697
|
}
|
|
10682
10698
|
var NodeSelection = class _NodeSelection {
|
|
@@ -10735,7 +10751,7 @@ var NodeSelection = class _NodeSelection {
|
|
|
10735
10751
|
extract() {
|
|
10736
10752
|
return this.getNodes();
|
|
10737
10753
|
}
|
|
10738
|
-
insertRawText(
|
|
10754
|
+
insertRawText(text2) {
|
|
10739
10755
|
}
|
|
10740
10756
|
insertText() {
|
|
10741
10757
|
}
|
|
@@ -10765,8 +10781,8 @@ var NodeSelection = class _NodeSelection {
|
|
|
10765
10781
|
}
|
|
10766
10782
|
const objects = this._nodes;
|
|
10767
10783
|
const nodes = [];
|
|
10768
|
-
for (const
|
|
10769
|
-
const node = $getNodeByKey(
|
|
10784
|
+
for (const object2 of objects) {
|
|
10785
|
+
const node = $getNodeByKey(object2);
|
|
10770
10786
|
if (node !== null) {
|
|
10771
10787
|
nodes.push(node);
|
|
10772
10788
|
}
|
|
@@ -10961,19 +10977,19 @@ var RangeSelection = class _RangeSelection {
|
|
|
10961
10977
|
} else {
|
|
10962
10978
|
prevWasElement = false;
|
|
10963
10979
|
if ($isTextNode(node)) {
|
|
10964
|
-
let
|
|
10980
|
+
let text2 = node.getTextContent();
|
|
10965
10981
|
if (node === firstNode) {
|
|
10966
10982
|
if (node === lastNode) {
|
|
10967
10983
|
if (anchor.type !== "element" || focus.type !== "element" || focus.offset === anchor.offset) {
|
|
10968
|
-
|
|
10984
|
+
text2 = anchorOffset < focusOffset ? text2.slice(anchorOffset, focusOffset) : text2.slice(focusOffset, anchorOffset);
|
|
10969
10985
|
}
|
|
10970
10986
|
} else {
|
|
10971
|
-
|
|
10987
|
+
text2 = isBefore ? text2.slice(anchorOffset) : text2.slice(focusOffset);
|
|
10972
10988
|
}
|
|
10973
10989
|
} else if (node === lastNode) {
|
|
10974
|
-
|
|
10990
|
+
text2 = isBefore ? text2.slice(0, focusOffset) : text2.slice(0, anchorOffset);
|
|
10975
10991
|
}
|
|
10976
|
-
textContent3 +=
|
|
10992
|
+
textContent3 += text2;
|
|
10977
10993
|
} else if (($isDecoratorNode(node) || $isLineBreakNode(node)) && (node !== lastNode || !this.isCollapsed())) {
|
|
10978
10994
|
textContent3 += node.getTextContent();
|
|
10979
10995
|
}
|
|
@@ -11058,15 +11074,15 @@ var RangeSelection = class _RangeSelection {
|
|
|
11058
11074
|
*
|
|
11059
11075
|
* @param text the text to insert into the Selection
|
|
11060
11076
|
*/
|
|
11061
|
-
insertRawText(
|
|
11062
|
-
this.insertNodes($generateNodesFromRawText(
|
|
11077
|
+
insertRawText(text2) {
|
|
11078
|
+
this.insertNodes($generateNodesFromRawText(text2));
|
|
11063
11079
|
}
|
|
11064
11080
|
/**
|
|
11065
11081
|
* Insert the provided text into the EditorState at the current Selection.
|
|
11066
11082
|
*
|
|
11067
11083
|
* @param text the text to insert into the Selection
|
|
11068
11084
|
*/
|
|
11069
|
-
insertText(
|
|
11085
|
+
insertText(text2) {
|
|
11070
11086
|
let format = this.format;
|
|
11071
11087
|
let style = this.style;
|
|
11072
11088
|
if (!this.isCollapsed()) {
|
|
@@ -11079,14 +11095,14 @@ var RangeSelection = class _RangeSelection {
|
|
|
11079
11095
|
this.removeText();
|
|
11080
11096
|
this.format = format;
|
|
11081
11097
|
this.style = style;
|
|
11082
|
-
if (
|
|
11098
|
+
if (text2 === "") {
|
|
11083
11099
|
return;
|
|
11084
11100
|
}
|
|
11085
11101
|
if ($getCompositionKey() === null) {
|
|
11086
11102
|
if (this.anchor.type === "element") {
|
|
11087
11103
|
$transferStartingElementPointToTextPoint(this.anchor, this.focus, format, style);
|
|
11088
11104
|
}
|
|
11089
|
-
$insertTextAtPoint(this,
|
|
11105
|
+
$insertTextAtPoint(this, text2, format, style);
|
|
11090
11106
|
return;
|
|
11091
11107
|
}
|
|
11092
11108
|
}
|
|
@@ -11116,12 +11132,12 @@ var RangeSelection = class _RangeSelection {
|
|
|
11116
11132
|
$setSelection(this);
|
|
11117
11133
|
}
|
|
11118
11134
|
}
|
|
11119
|
-
if (
|
|
11120
|
-
this.insertText(
|
|
11135
|
+
if (text2 !== "") {
|
|
11136
|
+
this.insertText(text2);
|
|
11121
11137
|
}
|
|
11122
11138
|
return;
|
|
11123
11139
|
}
|
|
11124
|
-
if (
|
|
11140
|
+
if (text2 === "") {
|
|
11125
11141
|
return;
|
|
11126
11142
|
}
|
|
11127
11143
|
if (offset === 0) {
|
|
@@ -11139,7 +11155,7 @@ var RangeSelection = class _RangeSelection {
|
|
|
11139
11155
|
}
|
|
11140
11156
|
newNode2.select();
|
|
11141
11157
|
}
|
|
11142
|
-
this.insertText(
|
|
11158
|
+
this.insertText(text2);
|
|
11143
11159
|
return;
|
|
11144
11160
|
} else if (offset === anchorSize) {
|
|
11145
11161
|
const next = anchorNode.getNextSibling();
|
|
@@ -11156,17 +11172,17 @@ var RangeSelection = class _RangeSelection {
|
|
|
11156
11172
|
}
|
|
11157
11173
|
newNode2.select(0, 0);
|
|
11158
11174
|
}
|
|
11159
|
-
this.insertText(
|
|
11175
|
+
this.insertText(text2);
|
|
11160
11176
|
return;
|
|
11161
11177
|
}
|
|
11162
|
-
const newNode = $createTextNode(
|
|
11178
|
+
const newNode = $createTextNode(text2);
|
|
11163
11179
|
newNode.setFormat(format);
|
|
11164
11180
|
newNode.setStyle(style);
|
|
11165
11181
|
anchorNode.replace(newNode);
|
|
11166
11182
|
newNode.select();
|
|
11167
11183
|
return;
|
|
11168
11184
|
}
|
|
11169
|
-
if (
|
|
11185
|
+
if (text2 === "") {
|
|
11170
11186
|
return;
|
|
11171
11187
|
}
|
|
11172
11188
|
const atStartOfInline = anchorParent.isInline() && offset === 0 && !anchorNode.__prev;
|
|
@@ -11177,13 +11193,13 @@ var RangeSelection = class _RangeSelection {
|
|
|
11177
11193
|
anchorNode.setFormat(format);
|
|
11178
11194
|
anchorNode.setStyle(style);
|
|
11179
11195
|
} else {
|
|
11180
|
-
$insertTextAtPoint(this,
|
|
11196
|
+
$insertTextAtPoint(this, text2, format, style);
|
|
11181
11197
|
return;
|
|
11182
11198
|
}
|
|
11183
11199
|
}
|
|
11184
|
-
anchorNode.spliceText(offset, 0,
|
|
11200
|
+
anchorNode.spliceText(offset, 0, text2, true);
|
|
11185
11201
|
if (anchorNode.isComposing() && this.anchor.type === "text") {
|
|
11186
|
-
this.anchor.set(this.anchor.key, this.anchor.offset -
|
|
11202
|
+
this.anchor.set(this.anchor.key, this.anchor.offset - text2.length, this.anchor.type);
|
|
11187
11203
|
}
|
|
11188
11204
|
}
|
|
11189
11205
|
/**
|
|
@@ -12112,8 +12128,8 @@ function $updateCaretSelectionForUnicodeCharacter(selection, isBackward) {
|
|
|
12112
12128
|
const endOffset = isBefore ? focusOffset : anchorOffset;
|
|
12113
12129
|
const characterOffset = endOffset - 1;
|
|
12114
12130
|
if (startOffset !== characterOffset) {
|
|
12115
|
-
const
|
|
12116
|
-
if (shouldDeleteExactlyOneCodeUnit(
|
|
12131
|
+
const text2 = anchorNode.getTextContent().slice(startOffset, endOffset);
|
|
12132
|
+
if (shouldDeleteExactlyOneCodeUnit(text2)) {
|
|
12117
12133
|
if (isBackward) {
|
|
12118
12134
|
focus.set(focus.key, characterOffset, focus.type);
|
|
12119
12135
|
} else {
|
|
@@ -12123,13 +12139,13 @@ function $updateCaretSelectionForUnicodeCharacter(selection, isBackward) {
|
|
|
12123
12139
|
}
|
|
12124
12140
|
}
|
|
12125
12141
|
}
|
|
12126
|
-
function shouldDeleteExactlyOneCodeUnit(
|
|
12142
|
+
function shouldDeleteExactlyOneCodeUnit(text2) {
|
|
12127
12143
|
{
|
|
12128
|
-
if (!(
|
|
12144
|
+
if (!(text2.length > 1)) {
|
|
12129
12145
|
formatDevErrorMessage(`shouldDeleteExactlyOneCodeUnit: expecting to be called only with sequences of two or more code units`);
|
|
12130
12146
|
}
|
|
12131
12147
|
}
|
|
12132
|
-
return !(doesContainSurrogatePair(
|
|
12148
|
+
return !(doesContainSurrogatePair(text2) || doesContainEmoji(text2));
|
|
12133
12149
|
}
|
|
12134
12150
|
// @__NO_SIDE_EFFECTS__
|
|
12135
12151
|
function createEmojiTest() {
|
|
@@ -12157,10 +12173,10 @@ function $removeSegment(node, isBackward, offset) {
|
|
|
12157
12173
|
let segmentOffset = 0;
|
|
12158
12174
|
let restoreOffset = 0;
|
|
12159
12175
|
for (let i6 = 0; i6 < splitLength; i6++) {
|
|
12160
|
-
const
|
|
12176
|
+
const text2 = split[i6];
|
|
12161
12177
|
const isLast = i6 === splitLength - 1;
|
|
12162
12178
|
restoreOffset = segmentOffset;
|
|
12163
|
-
segmentOffset +=
|
|
12179
|
+
segmentOffset += text2.length;
|
|
12164
12180
|
if (isBackward && segmentOffset === offset || segmentOffset > offset || isLast) {
|
|
12165
12181
|
split.splice(i6, 1);
|
|
12166
12182
|
if (isLast) {
|
|
@@ -12844,8 +12860,8 @@ function $insertNodes(nodes) {
|
|
|
12844
12860
|
}
|
|
12845
12861
|
selection.insertNodes(nodes);
|
|
12846
12862
|
}
|
|
12847
|
-
function tokenizeRawText(
|
|
12848
|
-
for (const part of
|
|
12863
|
+
function tokenizeRawText(text2, visitor) {
|
|
12864
|
+
for (const part of text2.split(/(\r?\n|\t)/)) {
|
|
12849
12865
|
if (part === "\n" || part === "\r\n") {
|
|
12850
12866
|
visitor.linebreak();
|
|
12851
12867
|
} else if (part === " ") {
|
|
@@ -12855,9 +12871,9 @@ function tokenizeRawText(text, visitor) {
|
|
|
12855
12871
|
}
|
|
12856
12872
|
}
|
|
12857
12873
|
}
|
|
12858
|
-
function $generateNodesFromRawText(
|
|
12874
|
+
function $generateNodesFromRawText(text2) {
|
|
12859
12875
|
const nodes = [];
|
|
12860
|
-
tokenizeRawText(
|
|
12876
|
+
tokenizeRawText(text2, {
|
|
12861
12877
|
linebreak: () => nodes.push($createLineBreakNode()),
|
|
12862
12878
|
tab: () => nodes.push($createTabNode()),
|
|
12863
12879
|
text: (part) => nodes.push($createTextNode(part))
|
|
@@ -16640,11 +16656,11 @@ function getNearestEditorFromDOMNode(node) {
|
|
|
16640
16656
|
function getEditorPropertyFromDOMNode(node) {
|
|
16641
16657
|
return node ? node.__lexicalEditor : null;
|
|
16642
16658
|
}
|
|
16643
|
-
function getTextDirection(
|
|
16644
|
-
if (RTL_REGEX.test(
|
|
16659
|
+
function getTextDirection(text2) {
|
|
16660
|
+
if (RTL_REGEX.test(text2)) {
|
|
16645
16661
|
return "rtl";
|
|
16646
16662
|
}
|
|
16647
|
-
if (LTR_REGEX.test(
|
|
16663
|
+
if (LTR_REGEX.test(text2)) {
|
|
16648
16664
|
return "ltr";
|
|
16649
16665
|
}
|
|
16650
16666
|
return null;
|
|
@@ -17906,9 +17922,9 @@ function getActiveElementDeep(root) {
|
|
|
17906
17922
|
function getComposedEventTarget(event) {
|
|
17907
17923
|
const target = event.target;
|
|
17908
17924
|
if (target !== null && isHTMLElement(target) && target.shadowRoot !== null && typeof event.composedPath === "function") {
|
|
17909
|
-
const
|
|
17910
|
-
if (
|
|
17911
|
-
return
|
|
17925
|
+
const path18 = event.composedPath();
|
|
17926
|
+
if (path18.length > 0) {
|
|
17927
|
+
return path18[0];
|
|
17912
17928
|
}
|
|
17913
17929
|
}
|
|
17914
17930
|
return target;
|
|
@@ -19548,8 +19564,8 @@ var TextPointCaretSliceImpl = class {
|
|
|
19548
19564
|
}
|
|
19549
19565
|
} = this;
|
|
19550
19566
|
const [indexStart, indexEnd] = this.getSliceIndices();
|
|
19551
|
-
const
|
|
19552
|
-
return $getTextPointCaret(origin.setTextContent(
|
|
19567
|
+
const text2 = origin.getTextContent();
|
|
19568
|
+
return $getTextPointCaret(origin.setTextContent(text2.slice(0, indexStart) + text2.slice(indexEnd)), direction, indexStart);
|
|
19553
19569
|
}
|
|
19554
19570
|
};
|
|
19555
19571
|
function $getSliceFromTextPointCaret(caret, anchorOrFocus) {
|
|
@@ -28004,10 +28020,10 @@ function _loadWasmModule(sync, filepath, src, imports2) {
|
|
|
28004
28020
|
var buf = null;
|
|
28005
28021
|
var isNode2 = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
28006
28022
|
if (filepath && isNode2) {
|
|
28007
|
-
var
|
|
28008
|
-
var
|
|
28023
|
+
var fs22 = null;
|
|
28024
|
+
var path18 = null;
|
|
28009
28025
|
return new Promise((resolve, reject) => {
|
|
28010
|
-
|
|
28026
|
+
fs22.readFile(path18.resolve(__dirname, filepath), (error, buffer) => {
|
|
28011
28027
|
if (error != null) {
|
|
28012
28028
|
reject(error);
|
|
28013
28029
|
} else {
|
|
@@ -28072,8 +28088,8 @@ function stateBinary(bytes) {
|
|
|
28072
28088
|
function stateIndex(array, index, value) {
|
|
28073
28089
|
Object.defineProperty(array, index, { value, enumerable: true, writable: true, configurable: true });
|
|
28074
28090
|
}
|
|
28075
|
-
function stateSet(
|
|
28076
|
-
Object.defineProperty(
|
|
28091
|
+
function stateSet(object2, key2, value) {
|
|
28092
|
+
Object.defineProperty(object2, key2, { value, enumerable: true, writable: true, configurable: true });
|
|
28077
28093
|
}
|
|
28078
28094
|
var wasm;
|
|
28079
28095
|
function __wbg_set_wasm(val) {
|
|
@@ -29310,10 +29326,10 @@ var LoroDoc = class _LoroDoc {
|
|
|
29310
29326
|
* @param {string} path
|
|
29311
29327
|
* @returns {Value | Container | undefined}
|
|
29312
29328
|
*/
|
|
29313
|
-
getByPath(
|
|
29329
|
+
getByPath(path18) {
|
|
29314
29330
|
try {
|
|
29315
29331
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29316
|
-
const ptr0 = passStringToWasm0(
|
|
29332
|
+
const ptr0 = passStringToWasm0(path18, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29317
29333
|
const len0 = WASM_VECTOR_LEN;
|
|
29318
29334
|
wasm.lorodoc_getByPath(retptr, this.__wbg_ptr, ptr0, len0);
|
|
29319
29335
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
@@ -33572,10 +33588,10 @@ var LoroText = class _LoroText {
|
|
|
33572
33588
|
* @param {string} text
|
|
33573
33589
|
* @param {any} options
|
|
33574
33590
|
*/
|
|
33575
|
-
updateByLine(
|
|
33591
|
+
updateByLine(text2, options) {
|
|
33576
33592
|
try {
|
|
33577
33593
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
33578
|
-
const ptr0 = passStringToWasm0(
|
|
33594
|
+
const ptr0 = passStringToWasm0(text2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
33579
33595
|
const len0 = WASM_VECTOR_LEN;
|
|
33580
33596
|
wasm.lorotext_updateByLine(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(options));
|
|
33581
33597
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
@@ -34011,10 +34027,10 @@ var LoroText = class _LoroText {
|
|
|
34011
34027
|
* @param {string} text
|
|
34012
34028
|
* @param {any} options
|
|
34013
34029
|
*/
|
|
34014
|
-
update(
|
|
34030
|
+
update(text2, options) {
|
|
34015
34031
|
try {
|
|
34016
34032
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
34017
|
-
const ptr0 = passStringToWasm0(
|
|
34033
|
+
const ptr0 = passStringToWasm0(text2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
34018
34034
|
const len0 = WASM_VECTOR_LEN;
|
|
34019
34035
|
wasm.lorotext_update(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(options));
|
|
34020
34036
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
@@ -36665,9 +36681,9 @@ function createLoroBinding(editor, doc, options = {}) {
|
|
|
36665
36681
|
synced.set(node.getKey(), props);
|
|
36666
36682
|
if (wrote) readBaseline.set(treeNode.id, stable(storedProps(treeNode)));
|
|
36667
36683
|
if ($isTextNode2(node)) {
|
|
36668
|
-
const
|
|
36684
|
+
const text2 = data.getOrCreateContainer(TEXT_KEY, new LoroText());
|
|
36669
36685
|
const next = node.getTextContent();
|
|
36670
|
-
if (
|
|
36686
|
+
if (text2.toString() !== next) text2.update(next);
|
|
36671
36687
|
}
|
|
36672
36688
|
};
|
|
36673
36689
|
const writeChildren = (parent, parentId, visited) => {
|
|
@@ -36713,14 +36729,14 @@ function createLoroBinding(editor, doc, options = {}) {
|
|
|
36713
36729
|
node.setTextContent(next);
|
|
36714
36730
|
points.forEach((point, index) => point.set(node.getKey(), offsets[index], "text"));
|
|
36715
36731
|
};
|
|
36716
|
-
const
|
|
36732
|
+
const readNode2 = (treeNode) => {
|
|
36717
36733
|
const node = readNodeUnsynced(treeNode);
|
|
36718
36734
|
synced.set(node.getKey(), nodeProps(node));
|
|
36719
36735
|
return node;
|
|
36720
36736
|
};
|
|
36721
36737
|
const readNodeUnsynced = (treeNode) => {
|
|
36722
36738
|
const props = storedProps(treeNode);
|
|
36723
|
-
const
|
|
36739
|
+
const text2 = $isTextLike(props) ? String(treeNode.data.get(TEXT_KEY) ?? "") : void 0;
|
|
36724
36740
|
const key2 = idToKey.get(treeNode.id);
|
|
36725
36741
|
const existing = key2 === void 0 ? null : $getNodeByKey2(key2);
|
|
36726
36742
|
if (existing && existing.getType() === props.type) {
|
|
@@ -36729,7 +36745,7 @@ function createLoroBinding(editor, doc, options = {}) {
|
|
|
36729
36745
|
...props,
|
|
36730
36746
|
text: existing.getTextContent()
|
|
36731
36747
|
});
|
|
36732
|
-
applyText(existing,
|
|
36748
|
+
applyText(existing, text2 ?? "");
|
|
36733
36749
|
return existing;
|
|
36734
36750
|
}
|
|
36735
36751
|
const storedKey = stable(props);
|
|
@@ -36752,7 +36768,7 @@ function createLoroBinding(editor, doc, options = {}) {
|
|
|
36752
36768
|
}
|
|
36753
36769
|
const created = $parseSerializedNode2({
|
|
36754
36770
|
...props,
|
|
36755
|
-
...
|
|
36771
|
+
...text2 === void 0 ? {} : { text: text2 },
|
|
36756
36772
|
children: []
|
|
36757
36773
|
});
|
|
36758
36774
|
readBaseline.set(treeNode.id, stable(props));
|
|
@@ -36761,7 +36777,7 @@ function createLoroBinding(editor, doc, options = {}) {
|
|
|
36761
36777
|
};
|
|
36762
36778
|
const readChildren = (parent, treeNode, visited) => {
|
|
36763
36779
|
(treeNode.children() ?? []).forEach((child, index) => {
|
|
36764
|
-
const node =
|
|
36780
|
+
const node = readNode2(child);
|
|
36765
36781
|
visited.add(node.getKey());
|
|
36766
36782
|
const current = parent.getChildAtIndex(index);
|
|
36767
36783
|
if (!current || !current.is(node)) {
|
|
@@ -36824,14 +36840,14 @@ function sliceRuns(runs, start, end) {
|
|
|
36824
36840
|
const out = [];
|
|
36825
36841
|
let offset = 0;
|
|
36826
36842
|
for (const run2 of runs) {
|
|
36827
|
-
const
|
|
36843
|
+
const text2 = run2.text ?? "";
|
|
36828
36844
|
const from = Math.max(start, offset);
|
|
36829
|
-
const to3 = Math.min(end, offset +
|
|
36845
|
+
const to3 = Math.min(end, offset + text2.length);
|
|
36830
36846
|
if (to3 > from) out.push({
|
|
36831
36847
|
...run2,
|
|
36832
|
-
text:
|
|
36848
|
+
text: text2.slice(from - offset, to3 - offset)
|
|
36833
36849
|
});
|
|
36834
|
-
offset +=
|
|
36850
|
+
offset += text2.length;
|
|
36835
36851
|
}
|
|
36836
36852
|
return out;
|
|
36837
36853
|
}
|
|
@@ -36937,10 +36953,10 @@ function $locate(focus) {
|
|
|
36937
36953
|
};
|
|
36938
36954
|
let remaining = focus.offset;
|
|
36939
36955
|
const texts = block.getChildren().filter($isTextNode2);
|
|
36940
|
-
for (const
|
|
36941
|
-
const size =
|
|
36956
|
+
for (const text2 of texts) {
|
|
36957
|
+
const size = text2.getTextContentSize();
|
|
36942
36958
|
if (remaining <= size) return {
|
|
36943
|
-
key:
|
|
36959
|
+
key: text2.getKey(),
|
|
36944
36960
|
offset: remaining
|
|
36945
36961
|
};
|
|
36946
36962
|
remaining -= size;
|
|
@@ -37742,12 +37758,12 @@ function $sliceSelectedTextNodeContent(selection, textNode, mutates = "self") {
|
|
|
37742
37758
|
startOffset = 0;
|
|
37743
37759
|
endOffset = offset;
|
|
37744
37760
|
}
|
|
37745
|
-
const
|
|
37746
|
-
if (
|
|
37761
|
+
const text2 = textNode.__text.slice(startOffset, endOffset);
|
|
37762
|
+
if (text2 !== textNode.__text) {
|
|
37747
37763
|
if (mutates === "clone") {
|
|
37748
37764
|
textNode = $cloneWithPropertiesEphemeral2(textNode);
|
|
37749
37765
|
}
|
|
37750
|
-
textNode.__text =
|
|
37766
|
+
textNode.__text = text2;
|
|
37751
37767
|
}
|
|
37752
37768
|
}
|
|
37753
37769
|
}
|
|
@@ -37797,11 +37813,11 @@ function $trimTextContentFromAnchor(editor, anchor, delCount) {
|
|
|
37797
37813
|
nextNode = parentSibling;
|
|
37798
37814
|
}
|
|
37799
37815
|
}
|
|
37800
|
-
let
|
|
37801
|
-
if (
|
|
37802
|
-
|
|
37816
|
+
let text2 = currentNode.getTextContent();
|
|
37817
|
+
if (text2 === "" && $isElementNode2(currentNode) && !currentNode.isInline()) {
|
|
37818
|
+
text2 = "\n\n";
|
|
37803
37819
|
}
|
|
37804
|
-
const currentNodeSize =
|
|
37820
|
+
const currentNodeSize = text2.length;
|
|
37805
37821
|
if (!$isTextNode2(currentNode) || remaining >= currentNodeSize) {
|
|
37806
37822
|
const parent = currentNode.getParent();
|
|
37807
37823
|
currentNode.remove();
|
|
@@ -37820,8 +37836,8 @@ function $trimTextContentFromAnchor(editor, anchor, delCount) {
|
|
|
37820
37836
|
return null;
|
|
37821
37837
|
});
|
|
37822
37838
|
const offset = currentNodeSize - remaining;
|
|
37823
|
-
const slicedText =
|
|
37824
|
-
if (prevTextContent !== null && prevTextContent !==
|
|
37839
|
+
const slicedText = text2.slice(0, offset);
|
|
37840
|
+
if (prevTextContent !== null && prevTextContent !== text2) {
|
|
37825
37841
|
const prevSelection = $getPreviousSelection2();
|
|
37826
37842
|
let target = currentNode;
|
|
37827
37843
|
if (!currentNode.isSimpleText()) {
|
|
@@ -39523,11 +39539,11 @@ function $wrapNodeInElement(node, createElementNode) {
|
|
|
39523
39539
|
elementNode.append(node);
|
|
39524
39540
|
return elementNode;
|
|
39525
39541
|
}
|
|
39526
|
-
function objectKlassEquals(
|
|
39527
|
-
if (
|
|
39542
|
+
function objectKlassEquals(object2, objectClass) {
|
|
39543
|
+
if (object2 == null) {
|
|
39528
39544
|
return false;
|
|
39529
39545
|
}
|
|
39530
|
-
const prototype2 = Object.getPrototypeOf(
|
|
39546
|
+
const prototype2 = Object.getPrototypeOf(object2);
|
|
39531
39547
|
if (prototype2 == null || prototype2.constructor == null) {
|
|
39532
39548
|
return false;
|
|
39533
39549
|
}
|
|
@@ -43285,8 +43301,8 @@ function isInsidePreserveWhitespace(node, wsConfig) {
|
|
|
43285
43301
|
}
|
|
43286
43302
|
return false;
|
|
43287
43303
|
}
|
|
43288
|
-
function findAdjacentTextOnLine(
|
|
43289
|
-
let node =
|
|
43304
|
+
function findAdjacentTextOnLine(text2, forward, wsConfig) {
|
|
43305
|
+
let node = text2;
|
|
43290
43306
|
while (true) {
|
|
43291
43307
|
let sibling = null;
|
|
43292
43308
|
while ((sibling = forward ? node.nextSibling : node.previousSibling) === null) {
|
|
@@ -43389,10 +43405,10 @@ var TextRule = {
|
|
|
43389
43405
|
if (collapsed === "") {
|
|
43390
43406
|
return [];
|
|
43391
43407
|
}
|
|
43392
|
-
const
|
|
43393
|
-
$applyFormat(
|
|
43394
|
-
$applyTextStyle(
|
|
43395
|
-
return [
|
|
43408
|
+
const text2 = $createTextNode2(collapsed);
|
|
43409
|
+
$applyFormat(text2, format);
|
|
43410
|
+
$applyTextStyle(text2, style);
|
|
43411
|
+
return [text2];
|
|
43396
43412
|
},
|
|
43397
43413
|
match: /* @__PURE__ */ sel$1.text(),
|
|
43398
43414
|
name: "@lexical/html/#text"
|
|
@@ -43496,23 +43512,23 @@ function compileImportRules(rules) {
|
|
|
43496
43512
|
wildcardIndices.push(i6);
|
|
43497
43513
|
} else {
|
|
43498
43514
|
for (const tag of sel3.tags) {
|
|
43499
|
-
let
|
|
43500
|
-
if (!
|
|
43501
|
-
|
|
43502
|
-
byTag.set(tag,
|
|
43515
|
+
let list2 = byTag.get(tag);
|
|
43516
|
+
if (!list2) {
|
|
43517
|
+
list2 = [];
|
|
43518
|
+
byTag.set(tag, list2);
|
|
43503
43519
|
}
|
|
43504
|
-
|
|
43520
|
+
list2.push(i6);
|
|
43505
43521
|
}
|
|
43506
43522
|
}
|
|
43507
43523
|
});
|
|
43508
43524
|
const finalByTag = /* @__PURE__ */ new Map();
|
|
43509
43525
|
if (wildcardIndices.length === 0) {
|
|
43510
|
-
for (const [tag,
|
|
43511
|
-
finalByTag.set(tag,
|
|
43526
|
+
for (const [tag, list2] of byTag) {
|
|
43527
|
+
finalByTag.set(tag, list2);
|
|
43512
43528
|
}
|
|
43513
43529
|
} else {
|
|
43514
|
-
for (const [tag,
|
|
43515
|
-
finalByTag.set(tag, mergeSortedAsc(
|
|
43530
|
+
for (const [tag, list2] of byTag) {
|
|
43531
|
+
finalByTag.set(tag, mergeSortedAsc(list2, wildcardIndices));
|
|
43516
43532
|
}
|
|
43517
43533
|
}
|
|
43518
43534
|
return {
|
|
@@ -45507,9 +45523,9 @@ function $getLexicalContent(editor, selection = $getSelection2()) {
|
|
|
45507
45523
|
return JSON.stringify($generateJSONFromSelectedNodes(editor, selection));
|
|
45508
45524
|
}
|
|
45509
45525
|
function $insertDataTransferForPlainText(dataTransfer, selection) {
|
|
45510
|
-
const
|
|
45511
|
-
if (
|
|
45512
|
-
selection.insertRawText(
|
|
45526
|
+
const text2 = dataTransfer.getData("text/plain") || dataTransfer.getData("text/uri-list");
|
|
45527
|
+
if (text2 != null) {
|
|
45528
|
+
selection.insertRawText(text2);
|
|
45513
45529
|
}
|
|
45514
45530
|
}
|
|
45515
45531
|
function $insertDataTransferForRichText(dataTransfer, selection, _editor) {
|
|
@@ -48264,11 +48280,11 @@ var TableSelection = class _TableSelection {
|
|
|
48264
48280
|
extract() {
|
|
48265
48281
|
return this.getNodes();
|
|
48266
48282
|
}
|
|
48267
|
-
insertRawText(
|
|
48268
|
-
if (
|
|
48283
|
+
insertRawText(text2) {
|
|
48284
|
+
if (text2 === "") {
|
|
48269
48285
|
return;
|
|
48270
48286
|
}
|
|
48271
|
-
const trimmed =
|
|
48287
|
+
const trimmed = text2.endsWith("\n") ? text2.slice(0, -1) : text2;
|
|
48272
48288
|
const tsvGrid = trimmed.split("\n").map((line) => line.split(" "));
|
|
48273
48289
|
const tableNode = $createTableNode();
|
|
48274
48290
|
for (const row2 of tsvGrid) {
|
|
@@ -51301,17 +51317,17 @@ function $tableSelectionInsertClipboardNodesCommand(selectionPayload, hasNestedT
|
|
|
51301
51317
|
const hasTables = nodes.some((n7) => $isTableNode(n7) || $dfs2(n7).some((d9) => $isTableNode(d9.node)));
|
|
51302
51318
|
if (!hasTables) {
|
|
51303
51319
|
if ($isTableSelection(selection)) {
|
|
51304
|
-
let
|
|
51320
|
+
let text2 = "";
|
|
51305
51321
|
let lastWasBlock = false;
|
|
51306
51322
|
for (const node of nodes) {
|
|
51307
51323
|
const isBlock = $isElementNode2(node) && !node.isInline();
|
|
51308
|
-
if (
|
|
51309
|
-
|
|
51324
|
+
if (text2.length > 0 && (isBlock || lastWasBlock)) {
|
|
51325
|
+
text2 += "\n";
|
|
51310
51326
|
}
|
|
51311
|
-
|
|
51327
|
+
text2 += node.getTextContent();
|
|
51312
51328
|
lastWasBlock = isBlock;
|
|
51313
51329
|
}
|
|
51314
|
-
selection.insertRawText(
|
|
51330
|
+
selection.insertRawText(text2);
|
|
51315
51331
|
return true;
|
|
51316
51332
|
}
|
|
51317
51333
|
return false;
|
|
@@ -54380,9 +54396,9 @@ function $getEndOfCodeInLine(anchor) {
|
|
|
54380
54396
|
}
|
|
54381
54397
|
return lastNode;
|
|
54382
54398
|
}
|
|
54383
|
-
function $plainifyCodeContent(
|
|
54399
|
+
function $plainifyCodeContent(text2) {
|
|
54384
54400
|
const out = [];
|
|
54385
|
-
tokenizeRawText2(
|
|
54401
|
+
tokenizeRawText2(text2, {
|
|
54386
54402
|
linebreak: () => out.push($createLineBreakNode2()),
|
|
54387
54403
|
tab: () => out.push($createTabNode2()),
|
|
54388
54404
|
text: (part) => out.push($createCodeHighlightNode(part))
|
|
@@ -54393,8 +54409,8 @@ function $outdentLeadingSpaces(node, tabSize, selection) {
|
|
|
54393
54409
|
if (!Number.isInteger(tabSize) || tabSize <= 0) {
|
|
54394
54410
|
return false;
|
|
54395
54411
|
}
|
|
54396
|
-
const
|
|
54397
|
-
const leading = /^ +/.exec(
|
|
54412
|
+
const text2 = node.getTextContent();
|
|
54413
|
+
const leading = /^ +/.exec(text2);
|
|
54398
54414
|
if (!leading) {
|
|
54399
54415
|
return false;
|
|
54400
54416
|
}
|
|
@@ -54553,9 +54569,9 @@ var GENERATED_CODEHIGHLIGHT = (fields) => {
|
|
|
54553
54569
|
if (style !== void 0 && style !== "") {
|
|
54554
54570
|
json.style = style;
|
|
54555
54571
|
}
|
|
54556
|
-
const
|
|
54557
|
-
if (
|
|
54558
|
-
json.text =
|
|
54572
|
+
const text2 = node.__text;
|
|
54573
|
+
if (text2 !== void 0 && text2 !== "") {
|
|
54574
|
+
json.text = text2;
|
|
54559
54575
|
}
|
|
54560
54576
|
return json;
|
|
54561
54577
|
}
|
|
@@ -54568,8 +54584,8 @@ var GENERATED_CODEHIGHLIGHT = (fields) => {
|
|
|
54568
54584
|
node.__mode = typeof mode === "string" && mode in CODEHIGHLIGHT_MODE_SETTER ? CODEHIGHLIGHT_MODE_SETTER[mode] : CODEHIGHLIGHT_MODE_SETTER_DEFAULT;
|
|
54569
54585
|
const style = json.style;
|
|
54570
54586
|
node.__style = typeof style === "string" ? style : "";
|
|
54571
|
-
const
|
|
54572
|
-
node.__text = typeof
|
|
54587
|
+
const text2 = json.text;
|
|
54588
|
+
node.__text = typeof text2 === "string" ? text2 : "";
|
|
54573
54589
|
const highlightType = json.highlightType;
|
|
54574
54590
|
node.setHighlightType(highlightType == null ? highlightType : typeof highlightType === "string" ? highlightType : "");
|
|
54575
54591
|
return node;
|
|
@@ -54810,9 +54826,9 @@ var CodeNode = class extends ElementNode2 {
|
|
|
54810
54826
|
node = node.getNextSibling();
|
|
54811
54827
|
} else if ($isCodeHighlightNode(node)) {
|
|
54812
54828
|
let spaces = 0;
|
|
54813
|
-
const
|
|
54829
|
+
const text2 = node.getTextContent();
|
|
54814
54830
|
const textSize = node.getTextContentSize();
|
|
54815
|
-
while (spaces < textSize &&
|
|
54831
|
+
while (spaces < textSize && text2[spaces] === " ") {
|
|
54816
54832
|
spaces++;
|
|
54817
54833
|
}
|
|
54818
54834
|
if (spaces !== 0) {
|
|
@@ -54974,8 +54990,8 @@ var codeHighlightNodeSchema = /* @__PURE__ */ nodeSchema2()({
|
|
|
54974
54990
|
var CodeHighlightNode = class extends TextNode2 {
|
|
54975
54991
|
/** @internal */
|
|
54976
54992
|
__highlightType;
|
|
54977
|
-
constructor(
|
|
54978
|
-
super(
|
|
54993
|
+
constructor(text2 = "", highlightType, key2) {
|
|
54994
|
+
super(text2, key2);
|
|
54979
54995
|
this.__highlightType = highlightType;
|
|
54980
54996
|
}
|
|
54981
54997
|
$config() {
|
|
@@ -55031,8 +55047,8 @@ var CodeHighlightNode = class extends TextNode2 {
|
|
|
55031
55047
|
function getHighlightThemeClass(theme, highlightType) {
|
|
55032
55048
|
return highlightType && theme && theme.codeHighlight && theme.codeHighlight[highlightType];
|
|
55033
55049
|
}
|
|
55034
|
-
function $createCodeHighlightNode(
|
|
55035
|
-
return $applyNodeReplacement2(new CodeHighlightNode(
|
|
55050
|
+
function $createCodeHighlightNode(text2 = "", highlightType) {
|
|
55051
|
+
return $applyNodeReplacement2(new CodeHighlightNode(text2, highlightType));
|
|
55036
55052
|
}
|
|
55037
55053
|
function $isCodeHighlightNode(node) {
|
|
55038
55054
|
return node instanceof CodeHighlightNode;
|
|
@@ -55064,8 +55080,8 @@ var PreRule = {
|
|
|
55064
55080
|
};
|
|
55065
55081
|
var MultilineCodeRule = {
|
|
55066
55082
|
$import: (ctx, el2, $next) => {
|
|
55067
|
-
const
|
|
55068
|
-
const isMultiLine = /\r?\n/.test(
|
|
55083
|
+
const text2 = el2.textContent || "";
|
|
55084
|
+
const isMultiLine = /\r?\n/.test(text2) || el2.querySelector("br") !== null;
|
|
55069
55085
|
if (!isMultiLine) {
|
|
55070
55086
|
return $next();
|
|
55071
55087
|
}
|
|
@@ -56626,8 +56642,8 @@ var AriaLiveRegionExtension = {
|
|
|
56626
56642
|
const message = state.getInitResult();
|
|
56627
56643
|
return {
|
|
56628
56644
|
...namedSignals2(config),
|
|
56629
|
-
announce(
|
|
56630
|
-
message.value =
|
|
56645
|
+
announce(text2) {
|
|
56646
|
+
message.value = text2 === message.peek() ? text2 + "\u200B" : text2;
|
|
56631
56647
|
}
|
|
56632
56648
|
};
|
|
56633
56649
|
},
|
|
@@ -56682,10 +56698,10 @@ var AriaLiveRegionExtension = {
|
|
|
56682
56698
|
// region would make the screen reader re-announce it on every editor
|
|
56683
56699
|
// remount with no user action.
|
|
56684
56700
|
effect(() => {
|
|
56685
|
-
const
|
|
56701
|
+
const text2 = message.value;
|
|
56686
56702
|
const el2 = region.peek();
|
|
56687
56703
|
if (el2) {
|
|
56688
|
-
el2.textContent =
|
|
56704
|
+
el2.textContent = text2;
|
|
56689
56705
|
}
|
|
56690
56706
|
})
|
|
56691
56707
|
);
|
|
@@ -57968,9 +57984,9 @@ var ClickableLinkExtension = {
|
|
|
57968
57984
|
}
|
|
57969
57985
|
};
|
|
57970
57986
|
// @__NO_SIDE_EFFECTS__
|
|
57971
|
-
function createLinkMatcherWithRegExp(regExp, urlTransformer = (
|
|
57972
|
-
return (
|
|
57973
|
-
const match = regExp.exec(
|
|
57987
|
+
function createLinkMatcherWithRegExp(regExp, urlTransformer = (text2) => text2) {
|
|
57988
|
+
return (text2) => {
|
|
57989
|
+
const match = regExp.exec(text2);
|
|
57974
57990
|
if (match === null) {
|
|
57975
57991
|
return null;
|
|
57976
57992
|
}
|
|
@@ -57984,8 +58000,8 @@ function createLinkMatcherWithRegExp(regExp, urlTransformer = (text) => text) {
|
|
|
57984
58000
|
}
|
|
57985
58001
|
var URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-\p{L}\p{N}@:%._+~#=]{1,256}\.[\p{L}\p{N}]{1,6}(?:[-\p{L}\p{N}()@:%_+.~#?&//=]*[\p{L}\p{N}()@_~#?&//=])?/u;
|
|
57986
58002
|
var EMAIL_REGEX = /(([^<>()[\]\\.,;:\s@"]{1,64}(\.[^<>()[\]\\.,;:\s@"]{1,64}){0,63})|(".{1,255}"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]{1,63}\.){1,127}[a-zA-Z]{2,63}))/;
|
|
57987
|
-
var autoLinkUrlMatcher = (
|
|
57988
|
-
const match = URL_REGEX.exec(
|
|
58003
|
+
var autoLinkUrlMatcher = (text2) => {
|
|
58004
|
+
const match = URL_REGEX.exec(text2);
|
|
57989
58005
|
if (match === null) {
|
|
57990
58006
|
return null;
|
|
57991
58007
|
}
|
|
@@ -58009,10 +58025,10 @@ var autoLinkUrlMatcher = (text) => {
|
|
|
58009
58025
|
url: matched.startsWith("http") ? matched : `https://${matched}`
|
|
58010
58026
|
};
|
|
58011
58027
|
};
|
|
58012
|
-
var autoLinkEmailMatcher = /* @__PURE__ */ createLinkMatcherWithRegExp(EMAIL_REGEX, (
|
|
58013
|
-
function findFirstMatch(
|
|
58028
|
+
var autoLinkEmailMatcher = /* @__PURE__ */ createLinkMatcherWithRegExp(EMAIL_REGEX, (text2) => `mailto:${text2}`);
|
|
58029
|
+
function findFirstMatch(text2, matchers) {
|
|
58014
58030
|
for (let i6 = 0; i6 < matchers.length; i6++) {
|
|
58015
|
-
const match = matchers[i6](
|
|
58031
|
+
const match = matchers[i6](text2);
|
|
58016
58032
|
if (match) {
|
|
58017
58033
|
return match;
|
|
58018
58034
|
}
|
|
@@ -58050,12 +58066,12 @@ function isNextNodeValid(node, separatorRegex) {
|
|
|
58050
58066
|
}
|
|
58051
58067
|
return nextNode === null || $isLineBreakNode2(nextNode) || $isTextNode2(nextNode) && startsWithSeparator(nextNode.getTextContent(), separatorRegex);
|
|
58052
58068
|
}
|
|
58053
|
-
function isContentAroundIsValid(matchStart, matchEnd, separatorRegex,
|
|
58054
|
-
const contentBeforeIsValid = matchStart > 0 ? isSeparator(
|
|
58069
|
+
function isContentAroundIsValid(matchStart, matchEnd, separatorRegex, text2, nodes) {
|
|
58070
|
+
const contentBeforeIsValid = matchStart > 0 ? isSeparator(text2[matchStart - 1], separatorRegex) : isPreviousNodeValid(nodes[0], separatorRegex);
|
|
58055
58071
|
if (!contentBeforeIsValid) {
|
|
58056
58072
|
return false;
|
|
58057
58073
|
}
|
|
58058
|
-
const contentAfterIsValid = matchEnd <
|
|
58074
|
+
const contentAfterIsValid = matchEnd < text2.length ? isSeparator(text2[matchEnd], separatorRegex) : isNextNodeValid(nodes[nodes.length - 1], separatorRegex);
|
|
58059
58075
|
return contentAfterIsValid;
|
|
58060
58076
|
}
|
|
58061
58077
|
function extractMatchingNodes(nodes, startIndex, endIndex) {
|
|
@@ -58157,10 +58173,10 @@ function $handleLinkCreation(nodes, matchers, onChange, separatorRegex) {
|
|
|
58157
58173
|
}
|
|
58158
58174
|
let currentNodes = [...nodes];
|
|
58159
58175
|
const initialText = currentNodes.map((node) => node.getTextContent()).join("");
|
|
58160
|
-
let
|
|
58176
|
+
let text2 = initialText;
|
|
58161
58177
|
let match;
|
|
58162
58178
|
let invalidMatchEnd = 0;
|
|
58163
|
-
while ((match = findFirstMatch(
|
|
58179
|
+
while ((match = findFirstMatch(text2, matchers)) && match !== null) {
|
|
58164
58180
|
const matchStart = match.index;
|
|
58165
58181
|
const matchLength = match.length;
|
|
58166
58182
|
const matchEnd = matchStart + matchLength;
|
|
@@ -58177,7 +58193,7 @@ function $handleLinkCreation(nodes, matchers, onChange, separatorRegex) {
|
|
|
58177
58193
|
}
|
|
58178
58194
|
if (alreadyLinked) {
|
|
58179
58195
|
invalidMatchEnd += matchEnd;
|
|
58180
|
-
|
|
58196
|
+
text2 = text2.substring(matchEnd);
|
|
58181
58197
|
continue;
|
|
58182
58198
|
}
|
|
58183
58199
|
const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset;
|
|
@@ -58189,7 +58205,7 @@ function $handleLinkCreation(nodes, matchers, onChange, separatorRegex) {
|
|
|
58189
58205
|
} else {
|
|
58190
58206
|
invalidMatchEnd += matchEnd;
|
|
58191
58207
|
}
|
|
58192
|
-
|
|
58208
|
+
text2 = text2.substring(matchEnd);
|
|
58193
58209
|
}
|
|
58194
58210
|
}
|
|
58195
58211
|
function handleLinkEdit(linkNode, matchers, onChange, separatorRegex) {
|
|
@@ -58203,9 +58219,9 @@ function handleLinkEdit(linkNode, matchers, onChange, separatorRegex) {
|
|
|
58203
58219
|
return;
|
|
58204
58220
|
}
|
|
58205
58221
|
}
|
|
58206
|
-
const
|
|
58207
|
-
const match = findFirstMatch(
|
|
58208
|
-
if (match === null || match.text !==
|
|
58222
|
+
const text2 = linkNode.getTextContent();
|
|
58223
|
+
const match = findFirstMatch(text2, matchers);
|
|
58224
|
+
if (match === null || match.text !== text2) {
|
|
58209
58225
|
replaceWithChildren(linkNode);
|
|
58210
58226
|
onChange(null, linkNode.getURL());
|
|
58211
58227
|
return;
|
|
@@ -58236,19 +58252,19 @@ function handleBadNeighbors(textNode, matchers, onChange, separatorRegex) {
|
|
|
58236
58252
|
const parent = textNode.getParent();
|
|
58237
58253
|
const previousSibling2 = textNode.getPreviousSibling();
|
|
58238
58254
|
const nextSibling2 = textNode.getNextSibling();
|
|
58239
|
-
const
|
|
58255
|
+
const text2 = textNode.getTextContent();
|
|
58240
58256
|
if ($isAutoLinkNode(parent) && !parent.getIsUnlinked()) {
|
|
58241
58257
|
return;
|
|
58242
58258
|
}
|
|
58243
58259
|
if ($isAutoLinkNode(previousSibling2) && !previousSibling2.getIsUnlinked()) {
|
|
58244
58260
|
if (previousSibling2.is(textNode.getPreviousSibling()) && textNode.getParent() === previousSibling2.getParent()) {
|
|
58245
|
-
if (!startsWithSeparator(
|
|
58261
|
+
if (!startsWithSeparator(text2, separatorRegex)) {
|
|
58246
58262
|
replaceWithChildren(previousSibling2);
|
|
58247
58263
|
onChange(null, previousSibling2.getURL());
|
|
58248
58264
|
return;
|
|
58249
58265
|
}
|
|
58250
|
-
if (startsWithTLD(
|
|
58251
|
-
const combinedText = previousSibling2.getTextContent() +
|
|
58266
|
+
if (startsWithTLD(text2, previousSibling2.isEmailURI())) {
|
|
58267
|
+
const combinedText = previousSibling2.getTextContent() + text2;
|
|
58252
58268
|
const match = findFirstMatch(combinedText, matchers);
|
|
58253
58269
|
if (match !== null && match.text === combinedText) {
|
|
58254
58270
|
previousSibling2.append(textNode);
|
|
@@ -58258,7 +58274,7 @@ function handleBadNeighbors(textNode, matchers, onChange, separatorRegex) {
|
|
|
58258
58274
|
}
|
|
58259
58275
|
}
|
|
58260
58276
|
}
|
|
58261
|
-
if ($isAutoLinkNode(nextSibling2) && !nextSibling2.getIsUnlinked() && !endsWithSeparator(
|
|
58277
|
+
if ($isAutoLinkNode(nextSibling2) && !nextSibling2.getIsUnlinked() && !endsWithSeparator(text2, separatorRegex)) {
|
|
58262
58278
|
if (nextSibling2.is(textNode.getNextSibling()) && textNode.getParent() === nextSibling2.getParent()) {
|
|
58263
58279
|
replaceWithChildren(nextSibling2);
|
|
58264
58280
|
onChange(null, nextSibling2.getURL());
|
|
@@ -59133,15 +59149,15 @@ function $getTopListNode(listItem) {
|
|
|
59133
59149
|
formatDevErrorMessage12(`A ListItemNode must have a ListNode for a parent.`);
|
|
59134
59150
|
}
|
|
59135
59151
|
}
|
|
59136
|
-
let
|
|
59152
|
+
let list2 = parentList;
|
|
59137
59153
|
let parent = parentList;
|
|
59138
59154
|
while (parent !== null) {
|
|
59139
59155
|
parent = parent.getParent();
|
|
59140
59156
|
if ($isListNode(parent)) {
|
|
59141
|
-
|
|
59157
|
+
list2 = parent;
|
|
59142
59158
|
}
|
|
59143
59159
|
}
|
|
59144
|
-
return
|
|
59160
|
+
return list2;
|
|
59145
59161
|
}
|
|
59146
59162
|
function $getAllListItems(node) {
|
|
59147
59163
|
let listItemNodes = [];
|
|
@@ -59171,14 +59187,14 @@ function $removeHighestEmptyListParent(sublist) {
|
|
|
59171
59187
|
}
|
|
59172
59188
|
emptyListPtr.remove();
|
|
59173
59189
|
}
|
|
59174
|
-
function $getNewListStart(
|
|
59190
|
+
function $getNewListStart(list2, listItem) {
|
|
59175
59191
|
return listItem.getValue();
|
|
59176
59192
|
}
|
|
59177
59193
|
function $isSelectingEmptyListItem(anchorNode, nodes) {
|
|
59178
59194
|
return $isListItemNode(anchorNode) && (nodes.length === 0 || nodes.length === 1 && anchorNode.is(nodes[0]) && anchorNode.getChildrenSize() === 0);
|
|
59179
59195
|
}
|
|
59180
|
-
function $newListFrom(
|
|
59181
|
-
return $isListNode(
|
|
59196
|
+
function $newListFrom(list2, listType) {
|
|
59197
|
+
return $isListNode(list2) ? $copyNode2(list2).setListType(listType) : $createListNode(listType);
|
|
59182
59198
|
}
|
|
59183
59199
|
function $insertList(listType) {
|
|
59184
59200
|
const selection = $getSelection2();
|
|
@@ -59199,20 +59215,20 @@ function $insertList(listType) {
|
|
|
59199
59215
|
}
|
|
59200
59216
|
} else if ($isSelectingEmptyListItem(anchorNode, nodes)) {
|
|
59201
59217
|
if ($isRootOrShadowRoot2(anchorNodeParent)) {
|
|
59202
|
-
const
|
|
59203
|
-
anchorNode.replace(
|
|
59218
|
+
const list2 = $createListNode(listType);
|
|
59219
|
+
anchorNode.replace(list2);
|
|
59204
59220
|
const listItem = $createListItemNode();
|
|
59205
59221
|
if ($isElementNode2(anchorNode)) {
|
|
59206
59222
|
listItem.setFormat(anchorNode.getFormatType());
|
|
59207
59223
|
listItem.setIndent(anchorNode.getIndent());
|
|
59208
59224
|
}
|
|
59209
|
-
|
|
59225
|
+
list2.append(listItem);
|
|
59210
59226
|
} else if ($isListItemNode(anchorNode)) {
|
|
59211
59227
|
const parent = anchorNode.getParentOrThrow();
|
|
59212
59228
|
if ($getSlotHost2(parent) === null) {
|
|
59213
|
-
const
|
|
59214
|
-
append(
|
|
59215
|
-
parent.replace(
|
|
59229
|
+
const list2 = $newListFrom(parent, listType);
|
|
59230
|
+
append(list2, parent.getChildren());
|
|
59231
|
+
parent.replace(list2);
|
|
59216
59232
|
}
|
|
59217
59233
|
}
|
|
59218
59234
|
return;
|
|
@@ -59275,10 +59291,10 @@ function $createListOrMerge(node, listType) {
|
|
|
59275
59291
|
nextSibling2.getFirstChildOrThrow().insertBefore(listItem);
|
|
59276
59292
|
targetList = nextSibling2;
|
|
59277
59293
|
} else {
|
|
59278
|
-
const
|
|
59279
|
-
|
|
59280
|
-
node.replace(
|
|
59281
|
-
targetList =
|
|
59294
|
+
const list2 = $createListNode(listType);
|
|
59295
|
+
list2.append(listItem);
|
|
59296
|
+
node.replace(list2);
|
|
59297
|
+
targetList = list2;
|
|
59282
59298
|
}
|
|
59283
59299
|
listItem.setFormat(node.getFormatType());
|
|
59284
59300
|
listItem.setIndent(node.getIndent());
|
|
@@ -59352,10 +59368,10 @@ function $removeList() {
|
|
|
59352
59368
|
}
|
|
59353
59369
|
}
|
|
59354
59370
|
}
|
|
59355
|
-
function updateChildrenListItemValue(
|
|
59356
|
-
const isNotChecklist =
|
|
59357
|
-
let value =
|
|
59358
|
-
for (const child of
|
|
59371
|
+
function updateChildrenListItemValue(list2) {
|
|
59372
|
+
const isNotChecklist = list2.getListType() !== "check";
|
|
59373
|
+
let value = list2.getStart();
|
|
59374
|
+
for (const child of list2.getChildren()) {
|
|
59359
59375
|
if ($isListItemNode(child)) {
|
|
59360
59376
|
if (child.getValue() !== value) {
|
|
59361
59377
|
child.setValue(value);
|
|
@@ -59369,10 +59385,10 @@ function updateChildrenListItemValue(list) {
|
|
|
59369
59385
|
}
|
|
59370
59386
|
}
|
|
59371
59387
|
}
|
|
59372
|
-
function mergeNextSiblingListIfSameType(
|
|
59373
|
-
const nextSibling2 =
|
|
59374
|
-
if ($isListNode(nextSibling2) &&
|
|
59375
|
-
mergeLists(
|
|
59388
|
+
function mergeNextSiblingListIfSameType(list2) {
|
|
59389
|
+
const nextSibling2 = list2.getNextSibling();
|
|
59390
|
+
if ($isListNode(nextSibling2) && list2.getListType() === nextSibling2.getListType()) {
|
|
59391
|
+
mergeLists(list2, nextSibling2);
|
|
59376
59392
|
}
|
|
59377
59393
|
}
|
|
59378
59394
|
function $handleIndent(listItemNode) {
|
|
@@ -59874,23 +59890,23 @@ var ListItemNode = class extends ElementNode2 {
|
|
|
59874
59890
|
return super.replace(replaceWithNode);
|
|
59875
59891
|
}
|
|
59876
59892
|
this.setIndent(0);
|
|
59877
|
-
const
|
|
59878
|
-
if (!$isListNode(
|
|
59893
|
+
const list2 = this.getParentOrThrow();
|
|
59894
|
+
if (!$isListNode(list2)) {
|
|
59879
59895
|
return replaceWithNode;
|
|
59880
59896
|
}
|
|
59881
|
-
if (
|
|
59882
|
-
|
|
59883
|
-
} else if (
|
|
59884
|
-
|
|
59897
|
+
if (list2.__first === this.getKey()) {
|
|
59898
|
+
list2.insertBefore(replaceWithNode);
|
|
59899
|
+
} else if (list2.__last === this.getKey()) {
|
|
59900
|
+
list2.insertAfter(replaceWithNode);
|
|
59885
59901
|
} else {
|
|
59886
|
-
const newList = $copyNode2(
|
|
59902
|
+
const newList = $copyNode2(list2);
|
|
59887
59903
|
let nextSibling2 = this.getNextSibling();
|
|
59888
59904
|
while (nextSibling2) {
|
|
59889
59905
|
const nodeToAppend = nextSibling2;
|
|
59890
59906
|
nextSibling2 = nextSibling2.getNextSibling();
|
|
59891
59907
|
newList.append(nodeToAppend);
|
|
59892
59908
|
}
|
|
59893
|
-
|
|
59909
|
+
list2.insertAfter(replaceWithNode);
|
|
59894
59910
|
replaceWithNode.insertAfter(newList);
|
|
59895
59911
|
}
|
|
59896
59912
|
const toReplaceKey = this.__key;
|
|
@@ -59913,8 +59929,8 @@ var ListItemNode = class extends ElementNode2 {
|
|
|
59913
59929
|
}
|
|
59914
59930
|
}
|
|
59915
59931
|
this.remove();
|
|
59916
|
-
if (
|
|
59917
|
-
|
|
59932
|
+
if (list2.getChildrenSize() === 0) {
|
|
59933
|
+
list2.remove();
|
|
59918
59934
|
}
|
|
59919
59935
|
return replaceWithNode;
|
|
59920
59936
|
}
|
|
@@ -62409,8 +62425,8 @@ function handleMessage(event) {
|
|
|
62409
62425
|
if (payload && payload.functionId === "makeChanges") {
|
|
62410
62426
|
const args = payload.args;
|
|
62411
62427
|
if (Array.isArray(args)) {
|
|
62412
|
-
const [elementStart, elementLength,
|
|
62413
|
-
if (![elementStart, elementLength, selStart, selLength].every(Number.isFinite) || typeof
|
|
62428
|
+
const [elementStart, elementLength, text2, selStart, selLength, formatCommand] = args;
|
|
62429
|
+
if (![elementStart, elementLength, selStart, selLength].every(Number.isFinite) || typeof text2 !== "string" && text2 !== -1) {
|
|
62414
62430
|
return;
|
|
62415
62431
|
}
|
|
62416
62432
|
editor.update(() => {
|
|
@@ -62427,8 +62443,8 @@ function handleMessage(event) {
|
|
|
62427
62443
|
selection.setTextNodeRange(anchorNode, setSelStart, anchorNode, setSelEnd);
|
|
62428
62444
|
}
|
|
62429
62445
|
}
|
|
62430
|
-
if (typeof
|
|
62431
|
-
selection.insertRawText(
|
|
62446
|
+
if (typeof text2 === "string" && (setSelStart !== setSelEnd || text2 !== "")) {
|
|
62447
|
+
selection.insertRawText(text2);
|
|
62432
62448
|
anchorNode = anchor.getNode();
|
|
62433
62449
|
}
|
|
62434
62450
|
if ($isTextNode2(anchorNode)) {
|
|
@@ -64994,9 +65010,9 @@ var quoteShadowRootState2 = mod27.quoteShadowRootState;
|
|
|
64994
65010
|
var registerRichText2 = mod27.registerRichText;
|
|
64995
65011
|
|
|
64996
65012
|
// node_modules/.pnpm/@lexical+markdown@0.52.0_typescript@5.9.3/node_modules/@lexical/markdown/dist/LexicalMarkdown.dev.js
|
|
64997
|
-
function indexBy(
|
|
65013
|
+
function indexBy(list2, callback) {
|
|
64998
65014
|
const index = {};
|
|
64999
|
-
for (const item of
|
|
65015
|
+
for (const item of list2) {
|
|
65000
65016
|
const key2 = callback(item);
|
|
65001
65017
|
if (!key2) {
|
|
65002
65018
|
continue;
|
|
@@ -65136,8 +65152,8 @@ function $extractMarkdownHardLineBreakMarker(previousNode) {
|
|
|
65136
65152
|
const lastText = lastChild.getTextContent();
|
|
65137
65153
|
const hardLineBreak = parseMarkdownHardLineBreak(lastText);
|
|
65138
65154
|
if (hardLineBreak !== null) {
|
|
65139
|
-
const [
|
|
65140
|
-
lastChild.setTextContent(
|
|
65155
|
+
const [text2, marker] = hardLineBreak;
|
|
65156
|
+
lastChild.setTextContent(text2);
|
|
65141
65157
|
return marker;
|
|
65142
65158
|
}
|
|
65143
65159
|
if (/^ {2,}$/.test(lastText) && hasNonWhitespaceContentOnLine(children, lastChildIndex)) {
|
|
@@ -65281,9 +65297,9 @@ var listReplace = /* @__NO_SIDE_EFFECTS__ */ (listType) => {
|
|
|
65281
65297
|
precedingBlock.append(listItem);
|
|
65282
65298
|
parentNode.remove();
|
|
65283
65299
|
} else {
|
|
65284
|
-
const
|
|
65285
|
-
|
|
65286
|
-
parentNode.replace(
|
|
65300
|
+
const list2 = $createListNode2(listType, listType === "number" ? Number(match[2]) : void 0);
|
|
65301
|
+
list2.append(listItem);
|
|
65302
|
+
parentNode.replace(list2);
|
|
65287
65303
|
}
|
|
65288
65304
|
listItem.append(...children);
|
|
65289
65305
|
if (!isImport) {
|
|
@@ -66110,20 +66126,20 @@ function findOutermostTextFormatTransformer(textNode, textFormatTransformersInde
|
|
|
66110
66126
|
transformer: resultTransformer
|
|
66111
66127
|
};
|
|
66112
66128
|
}
|
|
66113
|
-
function scanCodeSpans(
|
|
66129
|
+
function scanCodeSpans(text2) {
|
|
66114
66130
|
const isEscaped = (index) => {
|
|
66115
66131
|
let count = 0;
|
|
66116
|
-
for (let i7 = index - 1; i7 >= 0 &&
|
|
66132
|
+
for (let i7 = index - 1; i7 >= 0 && text2[i7] === "\\"; i7--) {
|
|
66117
66133
|
count++;
|
|
66118
66134
|
}
|
|
66119
66135
|
return count % 2 === 1;
|
|
66120
66136
|
};
|
|
66121
66137
|
const runs = [];
|
|
66122
66138
|
let i6 = 0;
|
|
66123
|
-
while (i6 <
|
|
66124
|
-
if (
|
|
66139
|
+
while (i6 < text2.length) {
|
|
66140
|
+
if (text2[i6] === "`") {
|
|
66125
66141
|
let length = 1;
|
|
66126
|
-
while (i6 + length <
|
|
66142
|
+
while (i6 + length < text2.length && text2[i6 + length] === "`") {
|
|
66127
66143
|
length++;
|
|
66128
66144
|
}
|
|
66129
66145
|
runs.push({
|
|
@@ -66155,7 +66171,7 @@ function scanCodeSpans(text) {
|
|
|
66155
66171
|
continue;
|
|
66156
66172
|
}
|
|
66157
66173
|
const closer = runs[closeIdx];
|
|
66158
|
-
let content =
|
|
66174
|
+
let content = text2.slice(opener.index + opener.length, closer.index);
|
|
66159
66175
|
if (content.length >= 2 && content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) {
|
|
66160
66176
|
content = content.slice(1, -1);
|
|
66161
66177
|
}
|
|
@@ -66168,12 +66184,12 @@ function scanCodeSpans(text) {
|
|
|
66168
66184
|
}
|
|
66169
66185
|
return spans;
|
|
66170
66186
|
}
|
|
66171
|
-
function scanDelimiters(
|
|
66187
|
+
function scanDelimiters(text2, transformersIndex, excludeRanges = []) {
|
|
66172
66188
|
const delimiters = [];
|
|
66173
66189
|
const delimiterChars = new Set(Object.keys(transformersIndex.transformersByTag).filter((tag) => tag[0] !== "`").map((tag) => tag[0]));
|
|
66174
66190
|
const isEscaped = (index) => {
|
|
66175
66191
|
let count = 0;
|
|
66176
|
-
for (let i7 = index - 1; i7 >= 0 &&
|
|
66192
|
+
for (let i7 = index - 1; i7 >= 0 && text2[i7] === "\\"; i7--) {
|
|
66177
66193
|
count++;
|
|
66178
66194
|
}
|
|
66179
66195
|
return count % 2 === 1;
|
|
@@ -66182,18 +66198,18 @@ function scanDelimiters(text, transformersIndex, excludeRanges = []) {
|
|
|
66182
66198
|
return excludeRanges.some((range) => index >= range.start && index < range.end);
|
|
66183
66199
|
};
|
|
66184
66200
|
let i6 = 0;
|
|
66185
|
-
while (i6 <
|
|
66186
|
-
const char =
|
|
66201
|
+
while (i6 < text2.length) {
|
|
66202
|
+
const char = text2[i6];
|
|
66187
66203
|
if (!delimiterChars.has(char) || isEscaped(i6) || isInExcludedRange(i6)) {
|
|
66188
66204
|
i6++;
|
|
66189
66205
|
continue;
|
|
66190
66206
|
}
|
|
66191
66207
|
let len = 1;
|
|
66192
|
-
while (i6 + len <
|
|
66208
|
+
while (i6 + len < text2.length && text2[i6 + len] === char) {
|
|
66193
66209
|
len++;
|
|
66194
66210
|
}
|
|
66195
|
-
const canOpen = canEmphasis(char,
|
|
66196
|
-
const canClose = canEmphasis(char,
|
|
66211
|
+
const canOpen = canEmphasis(char, text2, i6, len, true);
|
|
66212
|
+
const canClose = canEmphasis(char, text2, i6, len, false);
|
|
66197
66213
|
if (canOpen || canClose) {
|
|
66198
66214
|
delimiters.push({
|
|
66199
66215
|
active: true,
|
|
@@ -66208,7 +66224,7 @@ function scanDelimiters(text, transformersIndex, excludeRanges = []) {
|
|
|
66208
66224
|
}
|
|
66209
66225
|
return delimiters;
|
|
66210
66226
|
}
|
|
66211
|
-
function processEmphasis(
|
|
66227
|
+
function processEmphasis(text2, delimiters, transformersIndex) {
|
|
66212
66228
|
const openersBottom = {};
|
|
66213
66229
|
let currentPos = 0;
|
|
66214
66230
|
let result = null;
|
|
@@ -66240,7 +66256,7 @@ function processEmphasis(text, delimiters, transformersIndex) {
|
|
|
66240
66256
|
foundOpener = true;
|
|
66241
66257
|
const matchLen = matchedTag.length;
|
|
66242
66258
|
const match = {
|
|
66243
|
-
content:
|
|
66259
|
+
content: text2.slice(opener.index + opener.length, closer.index),
|
|
66244
66260
|
endIndex: closer.index + matchLen,
|
|
66245
66261
|
startIndex: opener.index + (opener.length - matchLen),
|
|
66246
66262
|
tag: matchedTag
|
|
@@ -66272,25 +66288,25 @@ function processEmphasis(text, delimiters, transformersIndex) {
|
|
|
66272
66288
|
}
|
|
66273
66289
|
return result;
|
|
66274
66290
|
}
|
|
66275
|
-
function canEmphasis(char,
|
|
66276
|
-
if (!isFlanking(
|
|
66291
|
+
function canEmphasis(char, text2, index, length, isOpen) {
|
|
66292
|
+
if (!isFlanking(text2, index, length, isOpen)) {
|
|
66277
66293
|
return false;
|
|
66278
66294
|
}
|
|
66279
66295
|
if (char === "*") {
|
|
66280
66296
|
return true;
|
|
66281
66297
|
}
|
|
66282
66298
|
if (char === "_") {
|
|
66283
|
-
if (!isFlanking(
|
|
66299
|
+
if (!isFlanking(text2, index, length, !isOpen)) {
|
|
66284
66300
|
return true;
|
|
66285
66301
|
}
|
|
66286
|
-
const adjacentChar = isOpen ?
|
|
66302
|
+
const adjacentChar = isOpen ? text2[index - 1] : text2[index + length];
|
|
66287
66303
|
return adjacentChar !== void 0 && PUNCTUATION.test(adjacentChar);
|
|
66288
66304
|
}
|
|
66289
66305
|
return true;
|
|
66290
66306
|
}
|
|
66291
|
-
function isFlanking(
|
|
66292
|
-
const charBefore =
|
|
66293
|
-
const charAfter =
|
|
66307
|
+
function isFlanking(text2, index, length, isLeft) {
|
|
66308
|
+
const charBefore = text2[index - 1];
|
|
66309
|
+
const charAfter = text2[index + length];
|
|
66294
66310
|
const [primary, secondary] = isLeft ? [charAfter, charBefore] : [charBefore, charAfter];
|
|
66295
66311
|
if (primary === void 0 || WHITESPACE.test(primary)) {
|
|
66296
66312
|
return false;
|
|
@@ -66510,11 +66526,11 @@ function $importMultiline(lines, startLineIndex, multilineElementTransformers, r
|
|
|
66510
66526
|
} else {
|
|
66511
66527
|
for (let i6 = startLineIndex; i6 <= endLineIndex; i6++) {
|
|
66512
66528
|
if (i6 === startLineIndex) {
|
|
66513
|
-
const
|
|
66514
|
-
linesInBetween.push(
|
|
66529
|
+
const text2 = lines[i6].slice(startMatch[0].length);
|
|
66530
|
+
linesInBetween.push(text2);
|
|
66515
66531
|
} else if (i6 === endLineIndex && endMatch) {
|
|
66516
|
-
const
|
|
66517
|
-
linesInBetween.push(
|
|
66532
|
+
const text2 = lines[i6].slice(0, -endMatch[0].length);
|
|
66533
|
+
linesInBetween.push(text2);
|
|
66518
66534
|
} else {
|
|
66519
66535
|
linesInBetween.push(lines[i6]);
|
|
66520
66536
|
}
|
|
@@ -66570,23 +66586,23 @@ function $normalizeMarkdownTextNode(textNode) {
|
|
|
66570
66586
|
if ($isTabNode2(textNode)) {
|
|
66571
66587
|
return;
|
|
66572
66588
|
}
|
|
66573
|
-
const
|
|
66574
|
-
if (!
|
|
66589
|
+
const text2 = textNode.getTextContent();
|
|
66590
|
+
if (!text2.includes(" ")) {
|
|
66575
66591
|
return;
|
|
66576
66592
|
}
|
|
66577
66593
|
const format = textNode.getFormat();
|
|
66578
66594
|
const style = textNode.getStyle();
|
|
66579
66595
|
const nodes = [];
|
|
66580
66596
|
let start = 0;
|
|
66581
|
-
for (let index =
|
|
66597
|
+
for (let index = text2.indexOf(" "); index !== -1; index = text2.indexOf(" ", index + 1)) {
|
|
66582
66598
|
if (index > start) {
|
|
66583
|
-
nodes.push($createTextNode2(
|
|
66599
|
+
nodes.push($createTextNode2(text2.slice(start, index)).setFormat(format).setStyle(style));
|
|
66584
66600
|
}
|
|
66585
66601
|
nodes.push($createTabNode2());
|
|
66586
66602
|
start = index + 1;
|
|
66587
66603
|
}
|
|
66588
|
-
if (start <
|
|
66589
|
-
nodes.push($createTextNode2(
|
|
66604
|
+
if (start < text2.length) {
|
|
66605
|
+
nodes.push($createTextNode2(text2.slice(start)).setFormat(format).setStyle(style));
|
|
66590
66606
|
}
|
|
66591
66607
|
textNode.getParentOrThrow().splice(textNode.getIndexWithinParent(), 1, nodes);
|
|
66592
66608
|
}
|
|
@@ -66810,9 +66826,9 @@ function $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransfor
|
|
|
66810
66826
|
}
|
|
66811
66827
|
function $isInsideUnclosedCodeSpan(node, offset) {
|
|
66812
66828
|
let backtickCount = 0;
|
|
66813
|
-
const
|
|
66829
|
+
const text2 = node.getTextContent();
|
|
66814
66830
|
for (let i6 = 0; i6 < offset; i6++) {
|
|
66815
|
-
if (
|
|
66831
|
+
if (text2[i6] === "`") {
|
|
66816
66832
|
backtickCount++;
|
|
66817
66833
|
}
|
|
66818
66834
|
}
|
|
@@ -68120,10 +68136,10 @@ var LEGACY_CODE_NODE_TRANSFORMER = {
|
|
|
68120
68136
|
export: (node) => {
|
|
68121
68137
|
if (node.getType() !== "code") return null;
|
|
68122
68138
|
const lang = node.getLanguage?.() ?? "";
|
|
68123
|
-
const
|
|
68124
|
-
const f6 = fence(
|
|
68139
|
+
const text2 = node.getTextContent();
|
|
68140
|
+
const f6 = fence(text2);
|
|
68125
68141
|
return `${f6}${lang}
|
|
68126
|
-
${
|
|
68142
|
+
${text2}
|
|
68127
68143
|
${f6}`;
|
|
68128
68144
|
},
|
|
68129
68145
|
regExp: NEVER,
|
|
@@ -72347,10 +72363,10 @@ function registerCustomWriters(registry2) {
|
|
|
72347
72363
|
registry2.registerWriter("footnote-section", (node) => {
|
|
72348
72364
|
const n7 = node;
|
|
72349
72365
|
const defs = n7.definitions ?? {};
|
|
72350
|
-
const children = Object.entries(defs).map(([ref,
|
|
72366
|
+
const children = Object.entries(defs).map(([ref, text2]) => ({
|
|
72351
72367
|
tag: "def",
|
|
72352
72368
|
attrs: { ref },
|
|
72353
|
-
children: [
|
|
72369
|
+
children: [text2]
|
|
72354
72370
|
}));
|
|
72355
72371
|
return {
|
|
72356
72372
|
tag: "footnote-section",
|
|
@@ -72486,8 +72502,8 @@ var FORMAT_TAG_TO_BIT = {
|
|
|
72486
72502
|
sup: 64,
|
|
72487
72503
|
mark: 128
|
|
72488
72504
|
};
|
|
72489
|
-
function wrapWithFormatTags(
|
|
72490
|
-
return wrapContentWithFormatTags([
|
|
72505
|
+
function wrapWithFormatTags(text2, format) {
|
|
72506
|
+
return wrapContentWithFormatTags([text2], format);
|
|
72491
72507
|
}
|
|
72492
72508
|
function wrapContentWithFormatTags(content, format) {
|
|
72493
72509
|
if (format === 0) return content;
|
|
@@ -72513,8 +72529,8 @@ var ESCAPE_MAP = {
|
|
|
72513
72529
|
'"': """,
|
|
72514
72530
|
"'": "'"
|
|
72515
72531
|
};
|
|
72516
|
-
function escapeXml(
|
|
72517
|
-
return
|
|
72532
|
+
function escapeXml(text2) {
|
|
72533
|
+
return text2.replaceAll(/["&'<>]/g, (ch) => ESCAPE_MAP[ch]);
|
|
72518
72534
|
}
|
|
72519
72535
|
function buildAttrs(attrs) {
|
|
72520
72536
|
return Object.entries(attrs).filter(([, v6]) => v6 !== void 0 && v6 !== "").map(([k5, v6]) => ` ${k5}="${escapeXml(v6)}"`).join("");
|
|
@@ -72774,10 +72790,10 @@ function parseFallbackNode(element) {
|
|
|
72774
72790
|
version: 1
|
|
72775
72791
|
};
|
|
72776
72792
|
}
|
|
72777
|
-
function makeTextNode(
|
|
72793
|
+
function makeTextNode(text2, format) {
|
|
72778
72794
|
return {
|
|
72779
72795
|
type: "text",
|
|
72780
|
-
text,
|
|
72796
|
+
text: text2,
|
|
72781
72797
|
format,
|
|
72782
72798
|
detail: 0,
|
|
72783
72799
|
mode: "normal",
|
|
@@ -74955,11 +74971,11 @@ var DomHandler = class {
|
|
|
74955
74971
|
this.lastNode = null;
|
|
74956
74972
|
}
|
|
74957
74973
|
oncdatastart() {
|
|
74958
|
-
const
|
|
74959
|
-
const node = new CDATA2([
|
|
74974
|
+
const text2 = new Text2("");
|
|
74975
|
+
const node = new CDATA2([text2]);
|
|
74960
74976
|
this.addNode(node);
|
|
74961
|
-
|
|
74962
|
-
this.lastNode =
|
|
74977
|
+
text2.parent = node;
|
|
74978
|
+
this.lastNode = text2;
|
|
74963
74979
|
}
|
|
74964
74980
|
oncdataend() {
|
|
74965
74981
|
this.lastNode = null;
|
|
@@ -76640,11 +76656,11 @@ var parseFromString = (document2, isHTML, markupLanguage) => {
|
|
|
76640
76656
|
oncomment(data) {
|
|
76641
76657
|
append3(node, document2.createComment(data), active);
|
|
76642
76658
|
},
|
|
76643
|
-
ontext(
|
|
76659
|
+
ontext(text2) {
|
|
76644
76660
|
if (parsingCData) {
|
|
76645
|
-
append3(node, document2.createCDATASection(
|
|
76661
|
+
append3(node, document2.createCDATASection(text2), active);
|
|
76646
76662
|
} else {
|
|
76647
|
-
append3(node, document2.createTextNode(
|
|
76663
|
+
append3(node, document2.createTextNode(text2), active);
|
|
76648
76664
|
}
|
|
76649
76665
|
},
|
|
76650
76666
|
// #cdata
|
|
@@ -78558,10 +78574,10 @@ function getOneElement2(tagName19, node) {
|
|
|
78558
78574
|
function fetch3(tagName19, where, recurse = false) {
|
|
78559
78575
|
return textContent2(getElementsByTagName2(tagName19, where, recurse, 1)).trim();
|
|
78560
78576
|
}
|
|
78561
|
-
function addConditionally2(
|
|
78577
|
+
function addConditionally2(object2, property2, tagName19, where, recurse = false) {
|
|
78562
78578
|
const value = fetch3(tagName19, where, recurse);
|
|
78563
78579
|
if (value)
|
|
78564
|
-
|
|
78580
|
+
object2[property2] = value;
|
|
78565
78581
|
}
|
|
78566
78582
|
function isValidFeed2(value) {
|
|
78567
78583
|
return value === "rss" || value === "feed" || value === "rdf:RDF";
|
|
@@ -79260,12 +79276,12 @@ function compileNth(reverse, ofType) {
|
|
|
79260
79276
|
};
|
|
79261
79277
|
}
|
|
79262
79278
|
var filters = {
|
|
79263
|
-
contains(next,
|
|
79279
|
+
contains(next, text2, options) {
|
|
79264
79280
|
const { getText: getText4 } = options.adapter;
|
|
79265
|
-
return cacheParentResults(next, options, (element) => getText4(element).includes(
|
|
79281
|
+
return cacheParentResults(next, options, (element) => getText4(element).includes(text2));
|
|
79266
79282
|
},
|
|
79267
|
-
icontains(next,
|
|
79268
|
-
const itext =
|
|
79283
|
+
icontains(next, text2, options) {
|
|
79284
|
+
const itext = text2.toLowerCase();
|
|
79269
79285
|
const { getText: getText4 } = options.adapter;
|
|
79270
79286
|
return cacheParentResults(next, options, (element) => getText4(element).toLowerCase().includes(itext));
|
|
79271
79287
|
},
|
|
@@ -79929,24 +79945,24 @@ var Text4 = class _Text extends CharacterData {
|
|
|
79929
79945
|
super(ownerDocument, "#text", TEXT_NODE, data);
|
|
79930
79946
|
}
|
|
79931
79947
|
get wholeText() {
|
|
79932
|
-
const
|
|
79948
|
+
const text2 = [];
|
|
79933
79949
|
let { previousSibling: previousSibling2, nextSibling: nextSibling2 } = this;
|
|
79934
79950
|
while (previousSibling2) {
|
|
79935
79951
|
if (previousSibling2.nodeType === TEXT_NODE)
|
|
79936
|
-
|
|
79952
|
+
text2.unshift(previousSibling2[VALUE]);
|
|
79937
79953
|
else
|
|
79938
79954
|
break;
|
|
79939
79955
|
previousSibling2 = previousSibling2.previousSibling;
|
|
79940
79956
|
}
|
|
79941
|
-
|
|
79957
|
+
text2.push(this[VALUE]);
|
|
79942
79958
|
while (nextSibling2) {
|
|
79943
79959
|
if (nextSibling2.nodeType === TEXT_NODE)
|
|
79944
|
-
|
|
79960
|
+
text2.push(nextSibling2[VALUE]);
|
|
79945
79961
|
else
|
|
79946
79962
|
break;
|
|
79947
79963
|
nextSibling2 = nextSibling2.nextSibling;
|
|
79948
79964
|
}
|
|
79949
|
-
return
|
|
79965
|
+
return text2.join("");
|
|
79950
79966
|
}
|
|
79951
79967
|
cloneNode() {
|
|
79952
79968
|
const { ownerDocument, [VALUE]: data } = this;
|
|
@@ -80745,36 +80761,36 @@ var Element2 = class extends ParentNode {
|
|
|
80745
80761
|
// </specialGetters>
|
|
80746
80762
|
// <contentRelated>
|
|
80747
80763
|
get innerText() {
|
|
80748
|
-
const
|
|
80764
|
+
const text2 = [];
|
|
80749
80765
|
let { [NEXT]: next, [END]: end } = this;
|
|
80750
80766
|
while (next !== end) {
|
|
80751
80767
|
if (next.nodeType === TEXT_NODE) {
|
|
80752
|
-
|
|
80753
|
-
} else if (
|
|
80754
|
-
|
|
80768
|
+
text2.push(next.textContent.replace(/\s+/g, " "));
|
|
80769
|
+
} else if (text2.length && next[NEXT] != end && BLOCK_ELEMENTS.has(next.tagName)) {
|
|
80770
|
+
text2.push("\n");
|
|
80755
80771
|
}
|
|
80756
80772
|
next = next[NEXT];
|
|
80757
80773
|
}
|
|
80758
|
-
return
|
|
80774
|
+
return text2.join("");
|
|
80759
80775
|
}
|
|
80760
80776
|
/**
|
|
80761
80777
|
* @returns {String}
|
|
80762
80778
|
*/
|
|
80763
80779
|
get textContent() {
|
|
80764
|
-
const
|
|
80780
|
+
const text2 = [];
|
|
80765
80781
|
let { [NEXT]: next, [END]: end } = this;
|
|
80766
80782
|
while (next !== end) {
|
|
80767
80783
|
const nodeType = next.nodeType;
|
|
80768
80784
|
if (nodeType === TEXT_NODE || nodeType === CDATA_SECTION_NODE)
|
|
80769
|
-
|
|
80785
|
+
text2.push(next.textContent);
|
|
80770
80786
|
next = next[NEXT];
|
|
80771
80787
|
}
|
|
80772
|
-
return
|
|
80788
|
+
return text2.join("");
|
|
80773
80789
|
}
|
|
80774
|
-
set textContent(
|
|
80790
|
+
set textContent(text2) {
|
|
80775
80791
|
this.replaceChildren();
|
|
80776
|
-
if (
|
|
80777
|
-
this.appendChild(new Text4(this.ownerDocument,
|
|
80792
|
+
if (text2 != null && text2 !== "")
|
|
80793
|
+
this.appendChild(new Text4(this.ownerDocument, text2));
|
|
80778
80794
|
}
|
|
80779
80795
|
get innerHTML() {
|
|
80780
80796
|
return getInnerHtml(this);
|
|
@@ -80954,8 +80970,8 @@ var Element2 = class extends ParentNode {
|
|
|
80954
80970
|
insertAdjacentHTML(position, html) {
|
|
80955
80971
|
this.insertAdjacentElement(position, htmlToFragment(this.ownerDocument, html));
|
|
80956
80972
|
}
|
|
80957
|
-
insertAdjacentText(position,
|
|
80958
|
-
const node = this.ownerDocument.createTextNode(
|
|
80973
|
+
insertAdjacentText(position, text2) {
|
|
80974
|
+
const node = this.ownerDocument.createTextNode(text2);
|
|
80959
80975
|
this.insertAdjacentElement(position, node);
|
|
80960
80976
|
}
|
|
80961
80977
|
// </insertAdjacent>
|
|
@@ -83646,8 +83662,8 @@ function blockStats(before2, after2) {
|
|
|
83646
83662
|
const changed = Math.min(added, removed);
|
|
83647
83663
|
return `+${added - changed} ~${changed} -${removed - changed} blocks`;
|
|
83648
83664
|
}
|
|
83649
|
-
function closestBase(written,
|
|
83650
|
-
const wanted = new Set(
|
|
83665
|
+
function closestBase(written, text2, fallback) {
|
|
83666
|
+
const wanted = new Set(text2.split("\n").map((line) => line.trim()));
|
|
83651
83667
|
let best = fallback;
|
|
83652
83668
|
let bestScore = -1;
|
|
83653
83669
|
for (const candidate of written.keys()) {
|
|
@@ -83694,9 +83710,9 @@ async function createDocumentSession(options) {
|
|
|
83694
83710
|
const binding = createLoroBinding(editor, loro);
|
|
83695
83711
|
loro.subscribeLocalUpdates((bytes) => emit({ type: "update", bytes }));
|
|
83696
83712
|
const written = /* @__PURE__ */ new Map();
|
|
83697
|
-
const remember = (
|
|
83698
|
-
written.delete(
|
|
83699
|
-
written.set(
|
|
83713
|
+
const remember = (text2, frontiers = loro.frontiers()) => {
|
|
83714
|
+
written.delete(text2);
|
|
83715
|
+
written.set(text2, frontiers);
|
|
83700
83716
|
if (written.size > WRITTEN_LIMIT) written.delete(written.keys().next().value);
|
|
83701
83717
|
};
|
|
83702
83718
|
let outcome = { kind: "idle" };
|
|
@@ -83722,7 +83738,7 @@ async function createDocumentSession(options) {
|
|
|
83722
83738
|
let snapshotDirty = true;
|
|
83723
83739
|
let writing = Promise.resolve();
|
|
83724
83740
|
let playing = Promise.resolve();
|
|
83725
|
-
const prepareAgentEdit = (baseText,
|
|
83741
|
+
const prepareAgentEdit = (baseText, text2, target) => {
|
|
83726
83742
|
const baseState = parseDocument2(baseText);
|
|
83727
83743
|
const stats = blockStats(baseState, target);
|
|
83728
83744
|
const { frontiers, steps } = streamAtVersion(
|
|
@@ -83733,7 +83749,7 @@ async function createDocumentSession(options) {
|
|
|
83733
83749
|
target,
|
|
83734
83750
|
`agent: ${stats}`
|
|
83735
83751
|
);
|
|
83736
|
-
remember(
|
|
83752
|
+
remember(text2, frontiers);
|
|
83737
83753
|
return { stats, steps };
|
|
83738
83754
|
};
|
|
83739
83755
|
const applyStep = (step) => {
|
|
@@ -83744,24 +83760,24 @@ async function createDocumentSession(options) {
|
|
|
83744
83760
|
emit({ type: "cursor", cursor: step.cursor });
|
|
83745
83761
|
}
|
|
83746
83762
|
};
|
|
83747
|
-
const onFileText = (
|
|
83748
|
-
if (
|
|
83749
|
-
lastFileText =
|
|
83763
|
+
const onFileText = (text2) => {
|
|
83764
|
+
if (text2 === lastFileText) return;
|
|
83765
|
+
lastFileText = text2;
|
|
83750
83766
|
let target;
|
|
83751
83767
|
try {
|
|
83752
|
-
target = parseDocument2(
|
|
83768
|
+
target = parseDocument2(text2);
|
|
83753
83769
|
} catch (err) {
|
|
83754
83770
|
log(`agent edit rejected: ${messageOf(err)}`);
|
|
83755
83771
|
setOutcome({ kind: "rejected", message: messageOf(err) });
|
|
83756
83772
|
return;
|
|
83757
83773
|
}
|
|
83758
|
-
const baseText = closestBase(written,
|
|
83759
|
-
lastGoodText =
|
|
83774
|
+
const baseText = closestBase(written, text2, lastGoodText ?? serializeDocument(editor.getEditorState().toJSON()));
|
|
83775
|
+
lastGoodText = text2;
|
|
83760
83776
|
streaming += 1;
|
|
83761
83777
|
emit({ type: "status", outcome, streaming: true });
|
|
83762
83778
|
playing = playing.then(async () => {
|
|
83763
83779
|
try {
|
|
83764
|
-
const { stats, steps } = prepareAgentEdit(baseText,
|
|
83780
|
+
const { stats, steps } = prepareAgentEdit(baseText, text2, target);
|
|
83765
83781
|
for (const step of steps) {
|
|
83766
83782
|
applyStep(step);
|
|
83767
83783
|
if (stepDelayMs > 0) await new Promise((resolve) => setTimeout(resolve, stepDelayMs * (0.6 + Math.random() * 0.8)));
|
|
@@ -83799,17 +83815,17 @@ async function createDocumentSession(options) {
|
|
|
83799
83815
|
if (stamped !== current && JSON.stringify(stamped) !== JSON.stringify(current)) {
|
|
83800
83816
|
editor.update(() => $reconcileRoot2(stamped.root), { discrete: true });
|
|
83801
83817
|
}
|
|
83802
|
-
const
|
|
83803
|
-
if (
|
|
83818
|
+
const text2 = serializeDocument(editor.getEditorState().toJSON());
|
|
83819
|
+
if (text2 !== lastFileText) {
|
|
83804
83820
|
const beforeRename = await readText(file);
|
|
83805
83821
|
if (beforeRename !== null && beforeRename !== lastFileText) {
|
|
83806
83822
|
onFileText(beforeRename);
|
|
83807
83823
|
return;
|
|
83808
83824
|
}
|
|
83809
|
-
await writeAtomic(file,
|
|
83810
|
-
lastFileText =
|
|
83811
|
-
lastGoodText =
|
|
83812
|
-
remember(
|
|
83825
|
+
await writeAtomic(file, text2);
|
|
83826
|
+
lastFileText = text2;
|
|
83827
|
+
lastGoodText = text2;
|
|
83828
|
+
remember(text2);
|
|
83813
83829
|
}
|
|
83814
83830
|
snapshotDirty = true;
|
|
83815
83831
|
await saveSnapshot();
|
|
@@ -83875,7 +83891,7 @@ function createDocumentRegistry(options) {
|
|
|
83875
83891
|
const commentStore = (id2) => {
|
|
83876
83892
|
let store = commentStores.get(id2);
|
|
83877
83893
|
if (!store) {
|
|
83878
|
-
store = createCommentStore(import_node_path7.default.join(options.root, "document", id2, "comments.json"));
|
|
83894
|
+
store = createCommentStore(import_node_path7.default.join(options.root, "document", id2, "comments.json"), options.names);
|
|
83879
83895
|
commentStores.set(id2, store);
|
|
83880
83896
|
}
|
|
83881
83897
|
return store;
|
|
@@ -83928,8 +83944,8 @@ function createDocumentRegistry(options) {
|
|
|
83928
83944
|
const known = sessions.has(id2);
|
|
83929
83945
|
void open(id2).then((session) => {
|
|
83930
83946
|
if (!session || !known) return;
|
|
83931
|
-
import_node_fs7.default.readFile(docFile(id2), "utf8", (err,
|
|
83932
|
-
if (!err) session.onFileText(
|
|
83947
|
+
import_node_fs7.default.readFile(docFile(id2), "utf8", (err, text2) => {
|
|
83948
|
+
if (!err) session.onFileText(text2);
|
|
83933
83949
|
});
|
|
83934
83950
|
});
|
|
83935
83951
|
},
|
|
@@ -83972,10 +83988,14 @@ function installInspector(win, properties) {
|
|
|
83972
83988
|
let hovered = null;
|
|
83973
83989
|
let selectedRect = null;
|
|
83974
83990
|
let hoverRect = null;
|
|
83991
|
+
let hoverId = null;
|
|
83975
83992
|
let dragging = null;
|
|
83976
83993
|
let marquee = null;
|
|
83977
83994
|
let suppressClick = false;
|
|
83978
83995
|
const tracked = /* @__PURE__ */ new Map();
|
|
83996
|
+
const cursor = doc.createElement("style");
|
|
83997
|
+
cursor.setAttribute("data-ryugi-inspector", "");
|
|
83998
|
+
cursor.textContent = "*{cursor:default!important}";
|
|
83979
83999
|
const post = (type, data) => win.parent.postMessage({ type: `ryugi:inspect:${type}`, session, connection, ...data }, "*");
|
|
83980
84000
|
const idOf = (el2) => {
|
|
83981
84001
|
let id2 = ids.get(el2);
|
|
@@ -83988,6 +84008,21 @@ function installInspector(win, properties) {
|
|
|
83988
84008
|
};
|
|
83989
84009
|
const label = (el2) => (el2.getAttribute("data-layer-name") || el2.getAttribute("aria-label") || el2.id || (!el2.childElementCount ? el2.textContent?.trim() : "") || "").slice(0, 100);
|
|
83990
84010
|
const selector = (el2) => (el2.id ? `#${el2.id}` : el2.tagName.toLowerCase() + Array.from(el2.classList).slice(0, 2).map((name) => `.${name}`).join("")).slice(0, 200);
|
|
84011
|
+
const pathOf = (el2) => {
|
|
84012
|
+
const segments = [];
|
|
84013
|
+
for (let node = el2; node && node !== doc.documentElement; node = node.parentElement) {
|
|
84014
|
+
const tag = node.tagName.toLowerCase();
|
|
84015
|
+
const parent = node.parentElement;
|
|
84016
|
+
const same = parent && node !== doc.body ? Array.from(parent.children).filter((child) => child.tagName === node.tagName) : [];
|
|
84017
|
+
segments.unshift(node.id && node.id.length <= 64 && /^[A-Za-z][\w-]*$/.test(node.id) ? `${tag}#${node.id}` : same.length > 1 ? `${tag}:nth-of-type(${same.indexOf(node) + 1})` : tag);
|
|
84018
|
+
if (node === doc.body) break;
|
|
84019
|
+
}
|
|
84020
|
+
return segments.join(" > ").slice(0, 4e3);
|
|
84021
|
+
};
|
|
84022
|
+
const treeId = (el2) => {
|
|
84023
|
+
const id2 = ids.get(el2);
|
|
84024
|
+
return id2 !== void 0 && elements.get(id2) === el2 ? id2 : null;
|
|
84025
|
+
};
|
|
83991
84026
|
const kind = (el2, style) => {
|
|
83992
84027
|
if (/^H[1-6]$/.test(el2.tagName)) return "Title";
|
|
83993
84028
|
if (["IMG", "SVG", "CANVAS", "VIDEO"].includes(el2.tagName.toUpperCase())) return "Image";
|
|
@@ -84015,7 +84050,7 @@ function installInspector(win, properties) {
|
|
|
84015
84050
|
tag: el2.tagName.toLowerCase(),
|
|
84016
84051
|
selector: selector(el2),
|
|
84017
84052
|
rect: selectedRect = rectOf(el2),
|
|
84018
|
-
css: Object.fromEntries(properties.map((
|
|
84053
|
+
css: Object.fromEntries(properties.map((property2) => [property2, style.getPropertyValue(property2)])),
|
|
84019
84054
|
html: el2.outerHTML.slice(0, 2e4),
|
|
84020
84055
|
widthMode: inline?.width === "100%" ? "fill" : inline?.width === "max-content" ? "hug" : "fixed",
|
|
84021
84056
|
heightMode: inline?.height && inline.height !== "auto" ? "fixed" : "hug"
|
|
@@ -84023,15 +84058,15 @@ function installInspector(win, properties) {
|
|
|
84023
84058
|
post("selection", { selection: info, reason, toggle });
|
|
84024
84059
|
};
|
|
84025
84060
|
const tweaks = () => {
|
|
84026
|
-
const
|
|
84061
|
+
const list2 = [];
|
|
84027
84062
|
for (const [el2, changes] of originals) {
|
|
84028
84063
|
if (!el2.isConnected) {
|
|
84029
84064
|
originals.delete(el2);
|
|
84030
84065
|
continue;
|
|
84031
84066
|
}
|
|
84032
|
-
for (const [
|
|
84067
|
+
for (const [property2, saved] of changes) list2.push({ id: idOf(el2), name: label(el2) || selector(el2), property: property2, from: saved.from, value: saved.applied });
|
|
84033
84068
|
}
|
|
84034
|
-
post("tweaks", { tweaks:
|
|
84069
|
+
post("tweaks", { tweaks: list2 });
|
|
84035
84070
|
};
|
|
84036
84071
|
const tree = () => {
|
|
84037
84072
|
if (!enabled || !doc.body) return;
|
|
@@ -84045,7 +84080,7 @@ function installInspector(win, properties) {
|
|
|
84045
84080
|
return null;
|
|
84046
84081
|
}
|
|
84047
84082
|
const id2 = idOf(el2);
|
|
84048
|
-
const node = { id: id2, parentId, name: label(el2), tag: el2.tagName.toLowerCase(), selector: selector(el2), kind: kind(el2, win.getComputedStyle(el2)), children: [] };
|
|
84083
|
+
const node = { id: id2, parentId, name: label(el2), tag: el2.tagName.toLowerCase(), selector: selector(el2), path: pathOf(el2), kind: kind(el2, win.getComputedStyle(el2)), children: [] };
|
|
84049
84084
|
nodes.push(node);
|
|
84050
84085
|
for (const child of el2.children) {
|
|
84051
84086
|
if (nodes.length >= 2500) {
|
|
@@ -84095,13 +84130,16 @@ function installInspector(win, properties) {
|
|
|
84095
84130
|
}
|
|
84096
84131
|
if (hovered?.isConnected) {
|
|
84097
84132
|
const rect = rectOf(hovered);
|
|
84098
|
-
|
|
84133
|
+
const id2 = treeId(hovered);
|
|
84134
|
+
if (!sameRect(hoverRect, rect) || id2 !== hoverId) {
|
|
84099
84135
|
hoverRect = rect;
|
|
84100
|
-
|
|
84136
|
+
hoverId = id2;
|
|
84137
|
+
post("hover", { rect, id: id2 });
|
|
84101
84138
|
}
|
|
84102
84139
|
} else if (hoverRect) {
|
|
84103
84140
|
hoverRect = null;
|
|
84104
|
-
|
|
84141
|
+
hoverId = null;
|
|
84142
|
+
post("hover", { rect: null, id: null });
|
|
84105
84143
|
}
|
|
84106
84144
|
geometryFrame = win.requestAnimationFrame(geometry);
|
|
84107
84145
|
};
|
|
@@ -84161,7 +84199,8 @@ function installInspector(win, properties) {
|
|
|
84161
84199
|
const leave = () => {
|
|
84162
84200
|
hovered = null;
|
|
84163
84201
|
hoverRect = null;
|
|
84164
|
-
|
|
84202
|
+
hoverId = null;
|
|
84203
|
+
if (enabled) post("hover", { rect: null, id: null });
|
|
84165
84204
|
};
|
|
84166
84205
|
const wheel = (event) => {
|
|
84167
84206
|
if (!enabled) return;
|
|
@@ -84184,13 +84223,15 @@ function installInspector(win, properties) {
|
|
|
84184
84223
|
endDrag(new win.Event("pointercancel"));
|
|
84185
84224
|
enabled = false;
|
|
84186
84225
|
observer.disconnect();
|
|
84226
|
+
cursor.remove();
|
|
84187
84227
|
win.clearTimeout(treeTimer);
|
|
84188
84228
|
win.cancelAnimationFrame(geometryFrame);
|
|
84189
84229
|
treeTimer = 0;
|
|
84190
84230
|
geometryFrame = 0;
|
|
84191
84231
|
hovered = null;
|
|
84192
84232
|
hoverRect = null;
|
|
84193
|
-
|
|
84233
|
+
hoverId = null;
|
|
84234
|
+
post("hover", { rect: null, id: null });
|
|
84194
84235
|
};
|
|
84195
84236
|
const onMessage = (event) => {
|
|
84196
84237
|
if (event.source !== win.parent || event.data?.type !== "ryugi:inspect") return;
|
|
@@ -84199,6 +84240,7 @@ function installInspector(win, properties) {
|
|
|
84199
84240
|
if (typeof data.connection !== "string" || !data.connection || data.connection.length > 128) return;
|
|
84200
84241
|
connection = data.connection;
|
|
84201
84242
|
enabled = true;
|
|
84243
|
+
if (!cursor.isConnected) (doc.head || doc.documentElement).append(cursor);
|
|
84202
84244
|
observer.observe(doc.documentElement, { subtree: true, childList: true, characterData: true, attributes: true });
|
|
84203
84245
|
win.cancelAnimationFrame(geometryFrame);
|
|
84204
84246
|
geometryFrame = win.requestAnimationFrame(geometry);
|
|
@@ -84230,44 +84272,52 @@ function installInspector(win, properties) {
|
|
|
84230
84272
|
const el2 = elements.get(id2);
|
|
84231
84273
|
if (el2?.isConnected) tracked.set(id2, rectOf(el2));
|
|
84232
84274
|
}
|
|
84233
|
-
} else if (data.action === "
|
|
84234
|
-
const
|
|
84235
|
-
|
|
84236
|
-
const
|
|
84275
|
+
} else if (data.action === "leaves" && Number.isSafeInteger(data.request) && data.request > 0) {
|
|
84276
|
+
const inTree = (el2) => treeId(el2) !== null;
|
|
84277
|
+
const content = (el2) => el2.tagName.toLowerCase() === "svg" || Array.from(el2.childNodes).some((child) => child.nodeType === 3 && child.textContent.trim()) || !Array.from(el2.children).some(inTree);
|
|
84278
|
+
const picked = /* @__PURE__ */ new Set();
|
|
84237
84279
|
const targets = [];
|
|
84238
84280
|
for (const [id2, el2] of elements) {
|
|
84239
|
-
if (el2 === doc.body || !el2.isConnected) continue;
|
|
84240
|
-
const rect = rectOf(el2);
|
|
84241
|
-
if (rect.width <= 0 || rect.height <= 0 || rect.x < r7.x || rect.y < r7.y || rect.x + rect.width > r7.x + r7.width || rect.y + rect.height > r7.y + r7.height) continue;
|
|
84281
|
+
if (el2 === doc.body || !el2.isConnected || el2.parentElement?.closest("svg") || !content(el2)) continue;
|
|
84242
84282
|
let parent = el2.parentElement;
|
|
84243
|
-
while (parent && !
|
|
84283
|
+
while (parent && !picked.has(parent)) parent = parent.parentElement;
|
|
84244
84284
|
if (parent) continue;
|
|
84245
|
-
|
|
84285
|
+
const rect = rectOf(el2);
|
|
84286
|
+
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
84287
|
+
picked.add(el2);
|
|
84246
84288
|
targets.push({ id: id2, name: label(el2) || selector(el2), rect });
|
|
84247
84289
|
}
|
|
84248
84290
|
post("targets", { request: data.request, targets });
|
|
84291
|
+
} else if (data.action === "describe" && Number.isSafeInteger(data.request) && data.request > 0 && Array.isArray(data.ids) && data.ids.length <= 2500) {
|
|
84292
|
+
const nodes = [];
|
|
84293
|
+
for (const id2 of data.ids) {
|
|
84294
|
+
const el2 = Number.isSafeInteger(id2) ? elements.get(id2) : void 0;
|
|
84295
|
+
if (el2?.isConnected) nodes.push({ id: id2, text: (el2.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 200), html: el2.outerHTML.slice(0, 2e3) });
|
|
84296
|
+
}
|
|
84297
|
+
post("details", { request: data.request, nodes });
|
|
84249
84298
|
} else if (data.action === "hover") {
|
|
84250
84299
|
const el2 = elements.get(data.id);
|
|
84251
84300
|
hovered = el2?.isConnected ? el2 : null;
|
|
84252
84301
|
hoverRect = hovered ? rectOf(hovered) : null;
|
|
84253
|
-
|
|
84302
|
+
hoverId = hovered ? treeId(hovered) : null;
|
|
84303
|
+
post("hover", { rect: hoverRect, id: hoverId });
|
|
84254
84304
|
} else if (data.action === "style" && data.session === session && selected && ids.get(selected) === data.id && properties.includes(data.property) && typeof data.value === "string" && data.value.length <= 300) {
|
|
84255
84305
|
const el2 = selected;
|
|
84256
84306
|
if (!el2.style || !el2.isConnected) return;
|
|
84257
|
-
const
|
|
84307
|
+
const property2 = data.property;
|
|
84258
84308
|
const probe = doc.createElement("div").style;
|
|
84259
|
-
probe.setProperty(
|
|
84260
|
-
const value = probe.getPropertyValue(
|
|
84309
|
+
probe.setProperty(property2, data.value);
|
|
84310
|
+
const value = probe.getPropertyValue(property2);
|
|
84261
84311
|
if (!value) return;
|
|
84262
84312
|
if (!originals.has(el2)) originals.set(el2, /* @__PURE__ */ new Map());
|
|
84263
84313
|
const changes = originals.get(el2);
|
|
84264
|
-
if (!changes.has(
|
|
84314
|
+
if (!changes.has(property2)) {
|
|
84265
84315
|
const affected = /* @__PURE__ */ new Set([...Array.from(probe), ...Array.from(el2.style).filter((name) => probe.getPropertyValue(name))]);
|
|
84266
|
-
changes.set(
|
|
84316
|
+
changes.set(property2, { from: win.getComputedStyle(el2).getPropertyValue(property2).slice(0, 2e3), applied: "", declarations: new Map(Array.from(affected, (name) => [name, { value: el2.style.getPropertyValue(name), priority: el2.style.getPropertyPriority(name), applied: "" }])) });
|
|
84267
84317
|
}
|
|
84268
|
-
el2.style.setProperty(
|
|
84269
|
-
const saved = changes.get(
|
|
84270
|
-
saved.applied = el2.style.getPropertyValue(
|
|
84318
|
+
el2.style.setProperty(property2, value);
|
|
84319
|
+
const saved = changes.get(property2);
|
|
84320
|
+
saved.applied = el2.style.getPropertyValue(property2);
|
|
84271
84321
|
for (const [name, declaration] of saved.declarations) declaration.applied = el2.style.getPropertyValue(name);
|
|
84272
84322
|
selection("update");
|
|
84273
84323
|
tweaks();
|
|
@@ -84607,10 +84657,110 @@ function createDynamicBlocks(limits) {
|
|
|
84607
84657
|
};
|
|
84608
84658
|
}
|
|
84609
84659
|
|
|
84610
|
-
// src/server/
|
|
84660
|
+
// src/server/selection.ts
|
|
84611
84661
|
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
84612
84662
|
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
84613
84663
|
|
|
84664
|
+
// src/shared/selection.ts
|
|
84665
|
+
var SELECTION_FULL_NODES = 20;
|
|
84666
|
+
var SELECTION_MAX_NODES = 25e3;
|
|
84667
|
+
var SELECTION_MAX_BYTES = 4 * 1024 * 1024;
|
|
84668
|
+
var SELECTION_LIMITS = { id: 200, board: 100, file: 500, tag: 80, path: 4e3, name: 100, text: 200, html: 2e3, from: 2e3, value: 300 };
|
|
84669
|
+
|
|
84670
|
+
// src/server/selection.ts
|
|
84671
|
+
var object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
84672
|
+
var text = (value, max) => typeof value === "string" && value.length <= max;
|
|
84673
|
+
var list = (value, max) => Array.isArray(value) && value.length <= max;
|
|
84674
|
+
var property = (value) => INSPECTOR_PROPERTIES.some((item) => item === value);
|
|
84675
|
+
function readNode(value) {
|
|
84676
|
+
if (!object(value) || !text(value.id, SELECTION_LIMITS.id) || !text(value.board, SELECTION_LIMITS.board) || !text(value.file, SELECTION_LIMITS.file) || !text(value.tag, SELECTION_LIMITS.tag) || !text(value.path, SELECTION_LIMITS.path) || !text(value.name, SELECTION_LIMITS.name)) return null;
|
|
84677
|
+
return { id: value.id, board: value.board, file: value.file, tag: value.tag, path: value.path, name: value.name };
|
|
84678
|
+
}
|
|
84679
|
+
function readChange(value) {
|
|
84680
|
+
if (!object(value) || !property(value.property) || !text(value.from, SELECTION_LIMITS.from) || !text(value.value, SELECTION_LIMITS.value)) return null;
|
|
84681
|
+
return { property: value.property, from: value.from, value: value.value };
|
|
84682
|
+
}
|
|
84683
|
+
function readAll(values, read) {
|
|
84684
|
+
const out = [];
|
|
84685
|
+
for (const value of values) {
|
|
84686
|
+
const item = read(value);
|
|
84687
|
+
if (!item) return null;
|
|
84688
|
+
out.push(item);
|
|
84689
|
+
}
|
|
84690
|
+
return out;
|
|
84691
|
+
}
|
|
84692
|
+
function readSelectionMessage(value) {
|
|
84693
|
+
if (!object(value) || value.type !== "selection" || !text(value.artifact, 200) || !text(value.tab, 64) || !value.tab || typeof value.human !== "boolean") return null;
|
|
84694
|
+
const id2 = value.artifact.startsWith("artboard/") ? value.artifact.slice("artboard/".length) : "";
|
|
84695
|
+
if (!isArtifactId(id2) || !Number.isSafeInteger(value.more) || value.more < 0) return null;
|
|
84696
|
+
if (!list(value.selected, SELECTION_FULL_NODES) || !list(value.tweaks, SELECTION_MAX_NODES) || !list(value.nodes, SELECTION_MAX_NODES)) return null;
|
|
84697
|
+
const selected = readAll(value.selected, (item) => {
|
|
84698
|
+
const node = readNode(item);
|
|
84699
|
+
if (!node || !object(item) || !text(item.text, SELECTION_LIMITS.text) || !text(item.html, SELECTION_LIMITS.html) || !list(item.tweaks, INSPECTOR_PROPERTIES.length)) return null;
|
|
84700
|
+
const tweaks2 = readAll(item.tweaks, readChange);
|
|
84701
|
+
return tweaks2 && { ...node, text: item.text, html: item.html, tweaks: tweaks2 };
|
|
84702
|
+
});
|
|
84703
|
+
const tweaks = readAll(value.tweaks, (item) => {
|
|
84704
|
+
const node = readNode(item);
|
|
84705
|
+
const change = readChange(item);
|
|
84706
|
+
return node && change && { ...node, ...change };
|
|
84707
|
+
});
|
|
84708
|
+
const nodes = readAll(value.nodes, readNode);
|
|
84709
|
+
if (!selected || !tweaks || !nodes) return null;
|
|
84710
|
+
return { id: id2, tab: value.tab, human: value.human, state: { selected, more: value.more, tweaks, nodes } };
|
|
84711
|
+
}
|
|
84712
|
+
function createSelectionStore(stateDir, exists) {
|
|
84713
|
+
const tabs = /* @__PURE__ */ new Map();
|
|
84714
|
+
let clock = 0;
|
|
84715
|
+
const fileOf = (id2) => import_node_path10.default.join(stateDir, "artboard", id2, "selection.json");
|
|
84716
|
+
const write = (id2) => {
|
|
84717
|
+
let winner;
|
|
84718
|
+
for (const tab of tabs.values()) {
|
|
84719
|
+
if (tab.id !== id2) continue;
|
|
84720
|
+
if (!winner || tab.humanAt > winner.humanAt || tab.humanAt === winner.humanAt && tab.seenAt > winner.seenAt) winner = tab;
|
|
84721
|
+
}
|
|
84722
|
+
if (!winner) import_node_fs10.default.rmSync(fileOf(id2), { force: true });
|
|
84723
|
+
else writeJsonAtomic(fileOf(id2), { artifact: `artboard/${id2}`, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), ...winner.state });
|
|
84724
|
+
};
|
|
84725
|
+
return {
|
|
84726
|
+
accept(socket, value) {
|
|
84727
|
+
const message = readSelectionMessage(value);
|
|
84728
|
+
const previous = tabs.get(socket);
|
|
84729
|
+
if (!message || !exists(message.id)) {
|
|
84730
|
+
if (previous) {
|
|
84731
|
+
tabs.delete(socket);
|
|
84732
|
+
write(previous.id);
|
|
84733
|
+
}
|
|
84734
|
+
return;
|
|
84735
|
+
}
|
|
84736
|
+
const humanAt = message.human ? ++clock : previous?.id === message.id ? previous.humanAt : 0;
|
|
84737
|
+
tabs.set(socket, { id: message.id, state: message.state, humanAt, seenAt: ++clock });
|
|
84738
|
+
if (previous && previous.id !== message.id) write(previous.id);
|
|
84739
|
+
write(message.id);
|
|
84740
|
+
},
|
|
84741
|
+
drop(socket) {
|
|
84742
|
+
const tab = tabs.get(socket);
|
|
84743
|
+
if (!tab) return;
|
|
84744
|
+
tabs.delete(socket);
|
|
84745
|
+
write(tab.id);
|
|
84746
|
+
},
|
|
84747
|
+
clearAll() {
|
|
84748
|
+
tabs.clear();
|
|
84749
|
+
let ids = [];
|
|
84750
|
+
try {
|
|
84751
|
+
ids = import_node_fs10.default.readdirSync(import_node_path10.default.join(stateDir, "artboard"));
|
|
84752
|
+
} catch {
|
|
84753
|
+
return;
|
|
84754
|
+
}
|
|
84755
|
+
for (const id2 of ids) import_node_fs10.default.rmSync(fileOf(id2), { force: true });
|
|
84756
|
+
}
|
|
84757
|
+
};
|
|
84758
|
+
}
|
|
84759
|
+
|
|
84760
|
+
// src/server/config.ts
|
|
84761
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
84762
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
84763
|
+
|
|
84614
84764
|
// src/shared/cloud.ts
|
|
84615
84765
|
var isVisibility = (value) => value === "private" || value === "public";
|
|
84616
84766
|
|
|
@@ -84638,35 +84788,35 @@ function normalize(raw) {
|
|
|
84638
84788
|
return config;
|
|
84639
84789
|
}
|
|
84640
84790
|
function readConfig(file) {
|
|
84641
|
-
let
|
|
84791
|
+
let text2;
|
|
84642
84792
|
try {
|
|
84643
|
-
|
|
84793
|
+
text2 = import_node_fs11.default.readFileSync(file, "utf8");
|
|
84644
84794
|
} catch {
|
|
84645
84795
|
return { config: defaults() };
|
|
84646
84796
|
}
|
|
84647
84797
|
try {
|
|
84648
|
-
return { config: normalize(JSON.parse(
|
|
84798
|
+
return { config: normalize(JSON.parse(text2)) };
|
|
84649
84799
|
} catch (err) {
|
|
84650
84800
|
return { config: defaults(), warning: `config.json is not valid JSON: ${err.message}` };
|
|
84651
84801
|
}
|
|
84652
84802
|
}
|
|
84653
84803
|
function ensureGitignore(dir) {
|
|
84654
|
-
const file =
|
|
84804
|
+
const file = import_node_path11.default.join(dir, ".gitignore");
|
|
84655
84805
|
let current = "";
|
|
84656
84806
|
try {
|
|
84657
|
-
current =
|
|
84807
|
+
current = import_node_fs11.default.readFileSync(file, "utf8");
|
|
84658
84808
|
} catch {
|
|
84659
|
-
|
|
84809
|
+
import_node_fs11.default.writeFileSync(file, "config.json\n");
|
|
84660
84810
|
return;
|
|
84661
84811
|
}
|
|
84662
84812
|
if (current.split(/\r?\n/).some((line) => line.trim() === "config.json")) return;
|
|
84663
|
-
|
|
84813
|
+
import_node_fs11.default.writeFileSync(file, `${current}${current === "" || current.endsWith("\n") ? "" : "\n"}config.json
|
|
84664
84814
|
`);
|
|
84665
84815
|
}
|
|
84666
84816
|
function ensureConfig(file) {
|
|
84667
|
-
|
|
84668
|
-
ensureGitignore(
|
|
84669
|
-
if (!
|
|
84817
|
+
import_node_fs11.default.mkdirSync(import_node_path11.default.dirname(file), { recursive: true });
|
|
84818
|
+
ensureGitignore(import_node_path11.default.dirname(file));
|
|
84819
|
+
if (!import_node_fs11.default.existsSync(file)) writeJsonAtomic(file, defaults());
|
|
84670
84820
|
}
|
|
84671
84821
|
function updateArtifactConfig(file, key2, patch) {
|
|
84672
84822
|
const { config, warning } = readConfig(file);
|
|
@@ -84680,8 +84830,49 @@ function updateArtifactConfig(file, key2, patch) {
|
|
|
84680
84830
|
return entry;
|
|
84681
84831
|
}
|
|
84682
84832
|
|
|
84833
|
+
// src/server/avatars.ts
|
|
84834
|
+
var import_node_crypto3 = require("node:crypto");
|
|
84835
|
+
var AVATAR_ROUTE = /^\/api\/avatar\/([a-z]+)\/([^/]+)$/;
|
|
84836
|
+
var MAX_BYTES = 512 * 1024;
|
|
84837
|
+
var TIMEOUT_MS = 5e3;
|
|
84838
|
+
var SOURCES = {
|
|
84839
|
+
github: { valid: /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/, url: (id2) => `https://avatars.githubusercontent.com/${id2}?s=64` },
|
|
84840
|
+
gravatar: { valid: /^[0-9a-f]{64}$/, url: (id2) => `https://gravatar.com/avatar/${id2}?s=64&d=404` }
|
|
84841
|
+
};
|
|
84842
|
+
var githubAvatar = (login) => `/api/avatar/github/${login}`;
|
|
84843
|
+
var gravatarAvatar = (email) => `/api/avatar/gravatar/${(0, import_node_crypto3.createHash)("sha256").update(email.trim().toLowerCase()).digest("hex")}`;
|
|
84844
|
+
function createAvatars(fetchImpl = fetch) {
|
|
84845
|
+
const cache = /* @__PURE__ */ new Map();
|
|
84846
|
+
const fetchAvatar = async (url) => {
|
|
84847
|
+
try {
|
|
84848
|
+
const res = await fetchImpl(url, { signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
84849
|
+
const type = res.headers.get("content-type") ?? "";
|
|
84850
|
+
if (!res.ok || !type.startsWith("image/")) return { status: 404 };
|
|
84851
|
+
const body = Buffer.from(await res.arrayBuffer());
|
|
84852
|
+
return body.length > MAX_BYTES ? { status: 404 } : { status: 200, type, body };
|
|
84853
|
+
} catch {
|
|
84854
|
+
return { status: 502 };
|
|
84855
|
+
}
|
|
84856
|
+
};
|
|
84857
|
+
return {
|
|
84858
|
+
load(source, id2) {
|
|
84859
|
+
const known = SOURCES[source];
|
|
84860
|
+
if (!known || !known.valid.test(id2)) return Promise.resolve({ status: 404 });
|
|
84861
|
+
const key2 = `${source}/${id2}`;
|
|
84862
|
+
const cached = cache.get(key2);
|
|
84863
|
+
if (cached) return cached;
|
|
84864
|
+
const pending = fetchAvatar(known.url(id2)).then((result) => {
|
|
84865
|
+
if (result.status === 502) cache.delete(key2);
|
|
84866
|
+
return result;
|
|
84867
|
+
});
|
|
84868
|
+
cache.set(key2, pending);
|
|
84869
|
+
return pending;
|
|
84870
|
+
}
|
|
84871
|
+
};
|
|
84872
|
+
}
|
|
84873
|
+
|
|
84683
84874
|
// src/server/cloud.ts
|
|
84684
|
-
var
|
|
84875
|
+
var import_node_crypto4 = __toESM(require("node:crypto"), 1);
|
|
84685
84876
|
|
|
84686
84877
|
// src/shared/brand.ts
|
|
84687
84878
|
var RYUGI_MARK_VIEWBOX = "0 0 512 512";
|
|
@@ -84791,16 +84982,16 @@ function callbackPage(result) {
|
|
|
84791
84982
|
}
|
|
84792
84983
|
|
|
84793
84984
|
// src/server/credentials.ts
|
|
84794
|
-
var
|
|
84795
|
-
var
|
|
84985
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
84986
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
84796
84987
|
function credentialsFile(env, platform, home) {
|
|
84797
|
-
if (platform === "win32" && env.APPDATA) return
|
|
84798
|
-
return
|
|
84988
|
+
if (platform === "win32" && env.APPDATA) return import_node_path12.default.join(env.APPDATA, "ryugi", "credentials.json");
|
|
84989
|
+
return import_node_path12.default.join(env.XDG_CONFIG_HOME || import_node_path12.default.join(home, ".config"), "ryugi", "credentials.json");
|
|
84799
84990
|
}
|
|
84800
84991
|
function readCredentials(file, origin) {
|
|
84801
84992
|
let raw;
|
|
84802
84993
|
try {
|
|
84803
|
-
raw = JSON.parse(
|
|
84994
|
+
raw = JSON.parse(import_node_fs12.default.readFileSync(file, "utf8"));
|
|
84804
84995
|
} catch {
|
|
84805
84996
|
return null;
|
|
84806
84997
|
}
|
|
@@ -84811,16 +85002,16 @@ function readCredentials(file, origin) {
|
|
|
84811
85002
|
return { origin: savedOrigin, token, login };
|
|
84812
85003
|
}
|
|
84813
85004
|
function writeCredentials(file, credentials) {
|
|
84814
|
-
|
|
85005
|
+
import_node_fs12.default.mkdirSync(import_node_path12.default.dirname(file), { recursive: true, mode: 448 });
|
|
84815
85006
|
writeJsonAtomic(file, credentials);
|
|
84816
85007
|
}
|
|
84817
85008
|
function clearCredentials(file) {
|
|
84818
|
-
|
|
85009
|
+
import_node_fs12.default.rmSync(file, { force: true });
|
|
84819
85010
|
}
|
|
84820
85011
|
|
|
84821
85012
|
// src/server/pack.ts
|
|
84822
|
-
var
|
|
84823
|
-
var
|
|
85013
|
+
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
85014
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
84824
85015
|
var MAX_ARTIFACT_BYTES = 20 * 1024 * 1024;
|
|
84825
85016
|
function formatBytes(bytes) {
|
|
84826
85017
|
if (bytes < 1024) return `${bytes} B`;
|
|
@@ -84829,22 +85020,22 @@ function formatBytes(bytes) {
|
|
|
84829
85020
|
}
|
|
84830
85021
|
var excluded = (type, relative) => type === "document" && relative === "comments.json";
|
|
84831
85022
|
function packArtifact(dir, type, { maxBytes = MAX_ARTIFACT_BYTES } = {}) {
|
|
84832
|
-
const rootReal =
|
|
85023
|
+
const rootReal = import_node_fs13.default.realpathSync(dir);
|
|
84833
85024
|
const found = [];
|
|
84834
85025
|
const visited = /* @__PURE__ */ new Set([rootReal]);
|
|
84835
85026
|
let total = 0;
|
|
84836
85027
|
const walk = (current) => {
|
|
84837
|
-
for (const entry of
|
|
85028
|
+
for (const entry of import_node_fs13.default.readdirSync(current, { withFileTypes: true })) {
|
|
84838
85029
|
if (entry.name.startsWith(".")) continue;
|
|
84839
|
-
const full =
|
|
85030
|
+
const full = import_node_path13.default.join(current, entry.name);
|
|
84840
85031
|
let real;
|
|
84841
85032
|
try {
|
|
84842
|
-
real =
|
|
85033
|
+
real = import_node_fs13.default.realpathSync(full);
|
|
84843
85034
|
} catch {
|
|
84844
85035
|
continue;
|
|
84845
85036
|
}
|
|
84846
|
-
if (!real.startsWith(rootReal +
|
|
84847
|
-
const stat =
|
|
85037
|
+
if (!real.startsWith(rootReal + import_node_path13.default.sep)) continue;
|
|
85038
|
+
const stat = import_node_fs13.default.statSync(real);
|
|
84848
85039
|
if (stat.isDirectory()) {
|
|
84849
85040
|
if (visited.has(real)) continue;
|
|
84850
85041
|
visited.add(real);
|
|
@@ -84852,7 +85043,7 @@ function packArtifact(dir, type, { maxBytes = MAX_ARTIFACT_BYTES } = {}) {
|
|
|
84852
85043
|
continue;
|
|
84853
85044
|
}
|
|
84854
85045
|
if (!stat.isFile()) continue;
|
|
84855
|
-
const relative =
|
|
85046
|
+
const relative = import_node_path13.default.relative(dir, full).split(import_node_path13.default.sep).join("/");
|
|
84856
85047
|
if (excluded(type, relative)) continue;
|
|
84857
85048
|
total += stat.size;
|
|
84858
85049
|
found.push({ path: relative, real });
|
|
@@ -84862,19 +85053,19 @@ function packArtifact(dir, type, { maxBytes = MAX_ARTIFACT_BYTES } = {}) {
|
|
|
84862
85053
|
if (total > maxBytes) {
|
|
84863
85054
|
throw new Error(`artifact is ${formatBytes(total)}; the limit is ${formatBytes(maxBytes)}`);
|
|
84864
85055
|
}
|
|
84865
|
-
return found.map((file) => ({ path: file.path, data:
|
|
85056
|
+
return found.map((file) => ({ path: file.path, data: import_node_fs13.default.readFileSync(file.real) }));
|
|
84866
85057
|
}
|
|
84867
85058
|
|
|
84868
85059
|
// src/server/publish-payload.ts
|
|
84869
|
-
var
|
|
84870
|
-
var
|
|
85060
|
+
var import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
85061
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
84871
85062
|
var CLOUD_RUNTIME_URL = "/_ryugi/runtime/ryugi-ui.js";
|
|
84872
85063
|
function publishPayload(ref, dir, title, payload) {
|
|
84873
85064
|
if (ref.type === "artboard") {
|
|
84874
85065
|
const { canvas, layout, versions } = payload;
|
|
84875
85066
|
return { canvas, layout, versions };
|
|
84876
85067
|
}
|
|
84877
|
-
if (ref.type === "document") return { title, state: parseDocument2(
|
|
85068
|
+
if (ref.type === "document") return { title, state: parseDocument2(import_node_fs14.default.readFileSync(import_node_path14.default.join(dir, "doc.xml"), "utf8")) };
|
|
84878
85069
|
return { title };
|
|
84879
85070
|
}
|
|
84880
85071
|
var isPage = (type, file) => type === "html" ? file === "index.html" : (type === "document" || type === "artboard") && file.endsWith(".html");
|
|
@@ -84914,12 +85105,12 @@ async function readJsonBody(req) {
|
|
|
84914
85105
|
}
|
|
84915
85106
|
}
|
|
84916
85107
|
async function errorMessage(res) {
|
|
84917
|
-
const
|
|
85108
|
+
const text2 = await res.text().catch(() => "");
|
|
84918
85109
|
try {
|
|
84919
|
-
const parsed = JSON.parse(
|
|
84920
|
-
return typeof parsed.error === "string" ? parsed.error :
|
|
85110
|
+
const parsed = JSON.parse(text2);
|
|
85111
|
+
return typeof parsed.error === "string" ? parsed.error : text2;
|
|
84921
85112
|
} catch {
|
|
84922
|
-
return
|
|
85113
|
+
return text2 || res.statusText;
|
|
84923
85114
|
}
|
|
84924
85115
|
}
|
|
84925
85116
|
function createCloudRoutes(options) {
|
|
@@ -84931,10 +85122,10 @@ function createCloudRoutes(options) {
|
|
|
84931
85122
|
const state = randomToken();
|
|
84932
85123
|
const verifier = randomToken();
|
|
84933
85124
|
pendingStates.set(state, { expires: now + LOGIN_STATE_TTL_MS, verifier });
|
|
84934
|
-
const challenge =
|
|
85125
|
+
const challenge = import_node_crypto4.default.createHash("sha256").update(verifier).digest("base64url");
|
|
84935
85126
|
return `${origin}/auth/cli?port=${options.port()}&state=${state}&challenge=${challenge}`;
|
|
84936
85127
|
};
|
|
84937
|
-
const cloudFetch = async (method,
|
|
85128
|
+
const cloudFetch = async (method, path18, body) => {
|
|
84938
85129
|
const credentials = readCredentials(credentialsFile2, origin);
|
|
84939
85130
|
if (!credentials) throw new SignedOut();
|
|
84940
85131
|
const headers = { Authorization: `Bearer ${credentials.token}` };
|
|
@@ -84948,7 +85139,7 @@ function createCloudRoutes(options) {
|
|
|
84948
85139
|
}
|
|
84949
85140
|
let res;
|
|
84950
85141
|
try {
|
|
84951
|
-
res = await fetch(`${origin}${
|
|
85142
|
+
res = await fetch(`${origin}${path18}`, { method, headers, body: payload });
|
|
84952
85143
|
} catch (err) {
|
|
84953
85144
|
throw new CloudRefused(502, `could not reach ${origin}: ${err.message}`);
|
|
84954
85145
|
}
|
|
@@ -84972,9 +85163,9 @@ function createCloudRoutes(options) {
|
|
|
84972
85163
|
}
|
|
84973
85164
|
const key2 = `${ref.type}/${ref.id}`;
|
|
84974
85165
|
const entry = artifactEntry(key2);
|
|
84975
|
-
const hashed = files.map((file) => ({ ...file, hash:
|
|
85166
|
+
const hashed = files.map((file) => ({ ...file, hash: import_node_crypto4.default.createHash("sha256").update(file.data).digest("hex") }));
|
|
84976
85167
|
const byHash = new Map(hashed.map((file) => [file.hash, file.data]));
|
|
84977
|
-
const manifest = hashed.map(({ path:
|
|
85168
|
+
const manifest = hashed.map(({ path: path18, hash }) => ({ path: path18, hash }));
|
|
84978
85169
|
const version = (visibility) => ({ title: inspected.title, payload: inspected.payload, files: manifest, ...visibility ? { visibility } : {} });
|
|
84979
85170
|
const create3 = async () => {
|
|
84980
85171
|
const res2 = await cloudFetch("POST", "/api/artifacts", { type: ref.type, visibility: requested ?? entry.visibility ?? "private" });
|
|
@@ -85151,6 +85342,97 @@ function createCloudRoutes(options) {
|
|
|
85151
85342
|
};
|
|
85152
85343
|
}
|
|
85153
85344
|
|
|
85345
|
+
// src/server/comment-names.ts
|
|
85346
|
+
var import_node_child_process = require("node:child_process");
|
|
85347
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
85348
|
+
|
|
85349
|
+
// src/server/agent.ts
|
|
85350
|
+
var NAMES = {
|
|
85351
|
+
claude: "Claude Code",
|
|
85352
|
+
"claude-code": "Claude Code",
|
|
85353
|
+
cowork: "Claude Cowork",
|
|
85354
|
+
codex: "Codex",
|
|
85355
|
+
cursor: "Cursor",
|
|
85356
|
+
"cursor-cli": "Cursor",
|
|
85357
|
+
gemini: "Gemini CLI",
|
|
85358
|
+
"gemini-cli": "Gemini CLI",
|
|
85359
|
+
"github-copilot": "GitHub Copilot",
|
|
85360
|
+
"github-copilot-cli": "GitHub Copilot",
|
|
85361
|
+
kilo: "Kilo Code",
|
|
85362
|
+
opencode: "OpenCode",
|
|
85363
|
+
"qwen-code": "Qwen Code",
|
|
85364
|
+
antigravity: "Antigravity",
|
|
85365
|
+
augment: "Augment",
|
|
85366
|
+
"augment-cli": "Augment",
|
|
85367
|
+
goose: "Goose",
|
|
85368
|
+
amp: "Amp",
|
|
85369
|
+
cline: "Cline",
|
|
85370
|
+
roo: "Roo Code",
|
|
85371
|
+
devin: "Devin",
|
|
85372
|
+
replit: "Replit",
|
|
85373
|
+
v0: "v0"
|
|
85374
|
+
};
|
|
85375
|
+
var AGENT_DISPLAY_NAMES = [...new Set(Object.values(NAMES))];
|
|
85376
|
+
var MARKERS = [
|
|
85377
|
+
["cowork", (env) => !!env.CLAUDE_CODE_IS_COWORK],
|
|
85378
|
+
["kilo", (env) => !!env.KILO],
|
|
85379
|
+
["codex", (env) => !!(env.CODEX_THREAD_ID || env.CODEX_SANDBOX || env.CODEX_CI)],
|
|
85380
|
+
["cursor", (env) => !!(env.CURSOR_AGENT || env.CURSOR_TRACE_ID)],
|
|
85381
|
+
["gemini", (env) => !!env.GEMINI_CLI],
|
|
85382
|
+
["github-copilot", (env) => !!env.COPILOT_CLI],
|
|
85383
|
+
["opencode", (env) => env.OPENCODE === "1" || !!env.OPENCODE_CLIENT],
|
|
85384
|
+
["qwen-code", (env) => !!env.QWEN_CODE],
|
|
85385
|
+
["antigravity", (env) => !!env.ANTIGRAVITY_AGENT],
|
|
85386
|
+
["augment", (env) => !!env.AUGMENT_AGENT],
|
|
85387
|
+
["cline", (env) => !!env.CLINE_ACTIVE],
|
|
85388
|
+
["roo", (env) => !!env.ROO_ACTIVE],
|
|
85389
|
+
["claude", (env) => !!(env.CLAUDECODE || env.CLAUDE_CODE)]
|
|
85390
|
+
];
|
|
85391
|
+
var declaredName = (value) => value?.trim().split(/[@_]/)[0]?.toLowerCase() || void 0;
|
|
85392
|
+
function detectAgent(env) {
|
|
85393
|
+
if (env.CLAUDE_CODE_IS_COWORK) return NAMES.cowork;
|
|
85394
|
+
const declared = declaredName(env.AI_AGENT);
|
|
85395
|
+
if (declared) return NAMES[declared] ?? declared;
|
|
85396
|
+
const marked = MARKERS.find(([, test]) => test(env))?.[0];
|
|
85397
|
+
if (marked) return NAMES[marked];
|
|
85398
|
+
const agent = declaredName(env.AGENT);
|
|
85399
|
+
if (agent && !/^(1|true|yes)$/.test(agent)) return NAMES[agent] ?? agent;
|
|
85400
|
+
return void 0;
|
|
85401
|
+
}
|
|
85402
|
+
|
|
85403
|
+
// src/server/comment-names.ts
|
|
85404
|
+
function gitConfig(cwd, key2) {
|
|
85405
|
+
try {
|
|
85406
|
+
return (0, import_node_child_process.execFileSync)("git", ["config", key2], { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }).trim() || void 0;
|
|
85407
|
+
} catch {
|
|
85408
|
+
return void 0;
|
|
85409
|
+
}
|
|
85410
|
+
}
|
|
85411
|
+
function gitPerson(cwd) {
|
|
85412
|
+
const name = gitConfig(cwd, "user.name");
|
|
85413
|
+
if (!name) return void 0;
|
|
85414
|
+
const email = gitConfig(cwd, "user.email");
|
|
85415
|
+
return email ? { name, avatar: gravatarAvatar(email) } : { name };
|
|
85416
|
+
}
|
|
85417
|
+
function commentNames({ agentFile, projectDir, cloud }) {
|
|
85418
|
+
let git;
|
|
85419
|
+
return {
|
|
85420
|
+
human: () => {
|
|
85421
|
+
const login = cloud ? readCredentials(cloud.credentialsFile, cloud.origin)?.login : void 0;
|
|
85422
|
+
if (login) return { name: login, avatar: githubAvatar(login) };
|
|
85423
|
+
git ??= { person: gitPerson(projectDir) };
|
|
85424
|
+
return git.person;
|
|
85425
|
+
},
|
|
85426
|
+
agent: () => {
|
|
85427
|
+
try {
|
|
85428
|
+
return detectAgent(JSON.parse(import_node_fs15.default.readFileSync(agentFile, "utf8")));
|
|
85429
|
+
} catch {
|
|
85430
|
+
return void 0;
|
|
85431
|
+
}
|
|
85432
|
+
}
|
|
85433
|
+
};
|
|
85434
|
+
}
|
|
85435
|
+
|
|
85154
85436
|
// src/server/viewer-page.ts
|
|
85155
85437
|
var escapeHtml2 = (value) => value.replace(/[&<>"']/g, (ch) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[ch]);
|
|
85156
85438
|
function viewerPage(template, page) {
|
|
@@ -85171,25 +85453,25 @@ function viewerPage(template, page) {
|
|
|
85171
85453
|
}
|
|
85172
85454
|
|
|
85173
85455
|
// src/server/watch.ts
|
|
85174
|
-
var
|
|
85175
|
-
var
|
|
85176
|
-
var toPosix = (file) => file.split(
|
|
85456
|
+
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
85457
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
85458
|
+
var toPosix = (file) => file.split(import_node_path15.default.sep).join("/");
|
|
85177
85459
|
var ignored = (file) => file === ".state" || file.startsWith(".state/");
|
|
85178
85460
|
function snapshot(root, dir = root, out = /* @__PURE__ */ new Map()) {
|
|
85179
85461
|
let entries2;
|
|
85180
85462
|
try {
|
|
85181
|
-
entries2 =
|
|
85463
|
+
entries2 = import_node_fs16.default.readdirSync(dir, { withFileTypes: true });
|
|
85182
85464
|
} catch {
|
|
85183
85465
|
return out;
|
|
85184
85466
|
}
|
|
85185
85467
|
for (const entry of entries2) {
|
|
85186
|
-
const full =
|
|
85187
|
-
const rel = toPosix(
|
|
85468
|
+
const full = import_node_path15.default.join(dir, entry.name);
|
|
85469
|
+
const rel = toPosix(import_node_path15.default.relative(root, full));
|
|
85188
85470
|
if (ignored(rel)) continue;
|
|
85189
85471
|
if (entry.isDirectory()) snapshot(root, full, out);
|
|
85190
85472
|
else {
|
|
85191
85473
|
try {
|
|
85192
|
-
out.set(rel,
|
|
85474
|
+
out.set(rel, import_node_fs16.default.statSync(full).mtimeMs);
|
|
85193
85475
|
} catch {
|
|
85194
85476
|
}
|
|
85195
85477
|
}
|
|
@@ -85222,7 +85504,7 @@ function watchTree(root, onChange, debounceMs = 120, backupPollMs = 1e3) {
|
|
|
85222
85504
|
}, debounceMs);
|
|
85223
85505
|
};
|
|
85224
85506
|
try {
|
|
85225
|
-
const watcher =
|
|
85507
|
+
const watcher = import_node_fs16.default.watch(root, { recursive: true }, (_event, filename) => {
|
|
85226
85508
|
if (filename) queue([toPosix(filename.toString())]);
|
|
85227
85509
|
});
|
|
85228
85510
|
watcher.on("error", () => {
|
|
@@ -85247,14 +85529,15 @@ function watchTree(root, onChange, debounceMs = 120, backupPollMs = 1e3) {
|
|
|
85247
85529
|
}
|
|
85248
85530
|
|
|
85249
85531
|
// src/server/ws.ts
|
|
85250
|
-
var
|
|
85532
|
+
var import_node_crypto5 = __toESM(require("node:crypto"), 1);
|
|
85251
85533
|
var WS_MAGIC = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
85252
85534
|
var OPCODE_TEXT = 1;
|
|
85253
85535
|
var OPCODE_CLOSE = 8;
|
|
85254
85536
|
var OPCODE_PING = 9;
|
|
85255
85537
|
var OPCODE_PONG = 10;
|
|
85538
|
+
var MAX_CLIENT_FRAME = 8 * 1024 * 1024;
|
|
85256
85539
|
function acceptKey(clientKey) {
|
|
85257
|
-
return
|
|
85540
|
+
return import_node_crypto5.default.createHash("sha1").update(clientKey + WS_MAGIC).digest("base64");
|
|
85258
85541
|
}
|
|
85259
85542
|
function encodeFrame(opcode, payload) {
|
|
85260
85543
|
const len = payload.length;
|
|
@@ -85274,7 +85557,7 @@ function encodeFrame(opcode, payload) {
|
|
|
85274
85557
|
}
|
|
85275
85558
|
return Buffer.concat([header, payload]);
|
|
85276
85559
|
}
|
|
85277
|
-
var textFrame = (
|
|
85560
|
+
var textFrame = (text2) => encodeFrame(OPCODE_TEXT, Buffer.from(text2));
|
|
85278
85561
|
function completeHandshake(socket, clientKey) {
|
|
85279
85562
|
socket.write(
|
|
85280
85563
|
`HTTP/1.1 101 Switching Protocols\r
|
|
@@ -85306,8 +85589,14 @@ function handleClientFrames(socket, onText) {
|
|
|
85306
85589
|
len = buffer.readUInt16BE(2);
|
|
85307
85590
|
offset = 4;
|
|
85308
85591
|
} else if (len === 127) {
|
|
85309
|
-
|
|
85310
|
-
|
|
85592
|
+
if (buffer.length < 10) return;
|
|
85593
|
+
const big = buffer.readBigUInt64BE(2);
|
|
85594
|
+
if (big > BigInt(MAX_CLIENT_FRAME)) {
|
|
85595
|
+
socket.destroy();
|
|
85596
|
+
return;
|
|
85597
|
+
}
|
|
85598
|
+
len = Number(big);
|
|
85599
|
+
offset = 10;
|
|
85311
85600
|
}
|
|
85312
85601
|
const total = offset + 4 + len;
|
|
85313
85602
|
if (buffer.length < total) return;
|
|
@@ -85366,17 +85655,17 @@ function titleOf(payload, ref) {
|
|
|
85366
85655
|
return payload.canvas?.title || ref.id;
|
|
85367
85656
|
}
|
|
85368
85657
|
async function startArtifactsServer(options) {
|
|
85369
|
-
const root =
|
|
85370
|
-
const viewerDir =
|
|
85371
|
-
const runtimeDir = options.runtimeDir ?
|
|
85372
|
-
const stateDir =
|
|
85373
|
-
|
|
85374
|
-
|
|
85658
|
+
const root = import_node_path16.default.resolve(options.root);
|
|
85659
|
+
const viewerDir = import_node_path16.default.resolve(options.viewerDir);
|
|
85660
|
+
const runtimeDir = options.runtimeDir ? import_node_path16.default.resolve(options.runtimeDir) : null;
|
|
85661
|
+
const stateDir = import_node_path16.default.join(root, ".state");
|
|
85662
|
+
import_node_fs17.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
|
|
85663
|
+
import_node_fs17.default.writeFileSync(import_node_path16.default.join(stateDir, ".gitignore"), "*\n");
|
|
85375
85664
|
if (options.configFile) ensureConfig(options.configFile);
|
|
85376
|
-
const portFile =
|
|
85377
|
-
const tokenFile =
|
|
85665
|
+
const portFile = import_node_path16.default.join(stateDir, ".last-port");
|
|
85666
|
+
const tokenFile = import_node_path16.default.join(stateDir, ".last-token");
|
|
85378
85667
|
const token = readPersisted(tokenFile) || randomToken();
|
|
85379
|
-
|
|
85668
|
+
import_node_fs17.default.writeFileSync(tokenFile, `${token}
|
|
85380
85669
|
`, { mode: 384 });
|
|
85381
85670
|
const contentToken = randomToken();
|
|
85382
85671
|
const runtimeWarnings = /* @__PURE__ */ new Map();
|
|
@@ -85385,6 +85674,8 @@ async function startArtifactsServer(options) {
|
|
|
85385
85674
|
const runtimeOf = (ref, dir) => ref.type === "document" ? [...documents.warnings(ref.id), ...dynamicBlocks.state(ref.id, dir).warnings] : runtimeWarnings.get(`${ref.type}/${ref.id}`) ?? [];
|
|
85386
85675
|
const contentPrefix = `/c/${contentToken}/`;
|
|
85387
85676
|
const clients = /* @__PURE__ */ new Set();
|
|
85677
|
+
const selections = createSelectionStore(stateDir, (id2) => resolveArtifactDir(root, "artboard", id2) !== null);
|
|
85678
|
+
selections.clearAll();
|
|
85388
85679
|
const changeListeners = [];
|
|
85389
85680
|
const activityListeners = [];
|
|
85390
85681
|
const touch = () => activityListeners.forEach((listener) => listener());
|
|
@@ -85394,11 +85685,13 @@ async function startArtifactsServer(options) {
|
|
|
85394
85685
|
const frame = textFrame(JSON.stringify(message));
|
|
85395
85686
|
for (const socket of clients) socket.write(frame);
|
|
85396
85687
|
};
|
|
85688
|
+
const avatars = createAvatars(options.fetch);
|
|
85397
85689
|
const documents = createDocumentRegistry({
|
|
85398
85690
|
root,
|
|
85399
85691
|
stateDir,
|
|
85400
85692
|
timing: options.documentTiming,
|
|
85401
85693
|
broadcast,
|
|
85694
|
+
names: commentNames({ agentFile: import_node_path16.default.join(stateDir, "agent"), projectDir: import_node_path16.default.resolve(root, "../.."), cloud: options.cloud }),
|
|
85402
85695
|
onWarningsChange: (id2) => {
|
|
85403
85696
|
const dir = resolveArtifactDir(root, "document", id2);
|
|
85404
85697
|
if (!dir) return;
|
|
@@ -85541,7 +85834,7 @@ async function startArtifactsServer(options) {
|
|
|
85541
85834
|
sendFile(res, target, headers);
|
|
85542
85835
|
return;
|
|
85543
85836
|
}
|
|
85544
|
-
|
|
85837
|
+
import_node_fs17.default.readFile(target, "utf8", (err, source) => {
|
|
85545
85838
|
if (err) send(res, 404, "Not found");
|
|
85546
85839
|
else {
|
|
85547
85840
|
const uiRuntimeUrl = runtimeDir ? `${contentPrefix}runtime/ryugi-ui.js` : void 0;
|
|
@@ -85566,16 +85859,20 @@ async function startArtifactsServer(options) {
|
|
|
85566
85859
|
title: titleOf(readArtifact(entry.dir, entry), entry),
|
|
85567
85860
|
updatedAt: latestMtime(entry.dir)
|
|
85568
85861
|
}));
|
|
85569
|
-
sendJson(res, 200, { project:
|
|
85862
|
+
sendJson(res, 200, { project: import_node_path16.default.basename(import_node_path16.default.dirname(import_node_path16.default.dirname(root))), artifacts: summaries, warnings });
|
|
85570
85863
|
};
|
|
85571
|
-
function onClientText(
|
|
85864
|
+
function onClientText(socket, text2) {
|
|
85572
85865
|
let message;
|
|
85573
85866
|
try {
|
|
85574
|
-
message = JSON.parse(
|
|
85867
|
+
message = JSON.parse(text2);
|
|
85575
85868
|
} catch {
|
|
85576
85869
|
return;
|
|
85577
85870
|
}
|
|
85578
85871
|
if (typeof message !== "object" || message === null) return;
|
|
85872
|
+
if (message.type === "selection") {
|
|
85873
|
+
selections.accept(socket, message);
|
|
85874
|
+
return;
|
|
85875
|
+
}
|
|
85579
85876
|
const { type, artifact, message: detail, version, file } = message;
|
|
85580
85877
|
if (typeof artifact !== "string") return;
|
|
85581
85878
|
const ref = artifactKeyOf(artifact);
|
|
@@ -85603,12 +85900,12 @@ async function startArtifactsServer(options) {
|
|
|
85603
85900
|
}
|
|
85604
85901
|
if (type !== "runtime-error" || typeof detail !== "string") return;
|
|
85605
85902
|
if (detail.length === 0 || detail.length > MAX_RUNTIME_MESSAGE) return;
|
|
85606
|
-
const
|
|
85607
|
-
if (
|
|
85608
|
-
runtimeWarnings.set(artifact, [...
|
|
85903
|
+
const list2 = runtimeWarnings.get(artifact) ?? [];
|
|
85904
|
+
if (list2.includes(detail) || list2.length >= MAX_RUNTIME_WARNINGS) return;
|
|
85905
|
+
runtimeWarnings.set(artifact, [...list2, detail]);
|
|
85609
85906
|
writeState(ref, dir);
|
|
85610
85907
|
const frame = textFrame(JSON.stringify({ type: "change", artifact, files: [] }));
|
|
85611
|
-
for (const
|
|
85908
|
+
for (const socket2 of clients) socket2.write(frame);
|
|
85612
85909
|
}
|
|
85613
85910
|
const handleRequest = (req, res) => {
|
|
85614
85911
|
touch();
|
|
@@ -85622,7 +85919,7 @@ async function startArtifactsServer(options) {
|
|
|
85622
85919
|
return;
|
|
85623
85920
|
}
|
|
85624
85921
|
if (pathname === "/robots.txt") {
|
|
85625
|
-
sendFile(res,
|
|
85922
|
+
sendFile(res, import_node_path16.default.join(viewerDir, "robots.txt"));
|
|
85626
85923
|
return;
|
|
85627
85924
|
}
|
|
85628
85925
|
if (pathname.startsWith("/c/")) {
|
|
@@ -85645,6 +85942,14 @@ async function startArtifactsServer(options) {
|
|
|
85645
85942
|
serveList(res);
|
|
85646
85943
|
return;
|
|
85647
85944
|
}
|
|
85945
|
+
const avatarMatch = AVATAR_ROUTE.exec(pathname);
|
|
85946
|
+
if (avatarMatch) {
|
|
85947
|
+
void avatars.load(avatarMatch[1], avatarMatch[2]).then(({ status, type, body }) => {
|
|
85948
|
+
if (body && type) send(res, status, body, { "Content-Type": type, "Cache-Control": "private, max-age=86400" });
|
|
85949
|
+
else send(res, status, "No avatar");
|
|
85950
|
+
});
|
|
85951
|
+
return;
|
|
85952
|
+
}
|
|
85648
85953
|
const previewMatch = API_PREVIEW_ROUTE.exec(pathname);
|
|
85649
85954
|
if (previewMatch) {
|
|
85650
85955
|
const [, type = "", id2 = ""] = previewMatch;
|
|
@@ -85687,7 +85992,7 @@ async function startArtifactsServer(options) {
|
|
|
85687
85992
|
if (SHELL_ROUTE.test(pathname) || PREVIEW_ROUTE.test(pathname) || pathname === "/index.html") {
|
|
85688
85993
|
const ref = artifactKeyOf(pathname.replace(/^\/(?:preview\/)?/, "").replace(/\/$/, ""));
|
|
85689
85994
|
const dir = ref && resolveArtifactDir(root, ref.type, ref.id);
|
|
85690
|
-
const project =
|
|
85995
|
+
const project = import_node_path16.default.basename(import_node_path16.default.dirname(import_node_path16.default.dirname(root)));
|
|
85691
85996
|
const title = ref ? dir ? titleOf(readArtifact(dir, ref), ref) : ref.id : `${project} \xB7 Artifacts`;
|
|
85692
85997
|
const description = ref ? `\u5728 ${project} \u9879\u76EE\u4E2D\u67E5\u770B ${title}\uFF0C\u8FD9\u662F\u4E00\u4E2A ${ref.type === "artboard" ? "Artboard" : ref.type === "document" ? "Document" : "HTML"} Artifact\u3002` : `\u6D4F\u89C8 ${project} \u9879\u76EE\u7684\u5168\u90E8 Artboard\u3001Document \u548C HTML Artifact\uFF0C\u9884\u89C8\u771F\u5B9E\u5185\u5BB9\uFF0C\u6309\u7C7B\u578B\u3001\u540D\u79F0\u548C\u66F4\u65B0\u65F6\u95F4\u67E5\u627E\u4F5C\u54C1\u3002`;
|
|
85693
85998
|
const canonical = `http://${urlHostForHttp(options.urlHost)}:${port}/${ref ? `${ref.type}/${ref.id}` : ""}`;
|
|
@@ -85696,7 +86001,7 @@ async function startArtifactsServer(options) {
|
|
|
85696
86001
|
"Content-Security-Policy": PREVIEW_ROUTE.test(pathname) ? VIEWER_CSP.replace("frame-ancestors 'none'", "frame-ancestors 'self'") : VIEWER_CSP
|
|
85697
86002
|
};
|
|
85698
86003
|
if (key2 !== null) headers["Set-Cookie"] = `${cookieName}=${token}; HttpOnly; SameSite=Strict; Path=/`;
|
|
85699
|
-
void
|
|
86004
|
+
void import_node_fs17.default.promises.readFile(import_node_path16.default.join(viewerDir, "index.html"), "utf8").then((template) => send(res, 200, viewerPage(template, { title, description, url: canonical }), headers)).catch((err) => send(res, err.code === "ENOENT" ? 404 : 500, "Viewer unavailable"));
|
|
85700
86005
|
return;
|
|
85701
86006
|
}
|
|
85702
86007
|
const target = resolveInside(viewerDir, pathname.slice(1));
|
|
@@ -85723,9 +86028,17 @@ async function startArtifactsServer(options) {
|
|
|
85723
86028
|
}
|
|
85724
86029
|
completeHandshake(socket, clientKey);
|
|
85725
86030
|
clients.add(socket);
|
|
85726
|
-
handleClientFrames(socket, onClientText);
|
|
85727
|
-
|
|
85728
|
-
|
|
86031
|
+
handleClientFrames(socket, (text2) => onClientText(socket, text2));
|
|
86032
|
+
const forget = () => {
|
|
86033
|
+
clients.delete(socket);
|
|
86034
|
+
selections.drop(socket);
|
|
86035
|
+
};
|
|
86036
|
+
socket.on("end", () => {
|
|
86037
|
+
forget();
|
|
86038
|
+
socket.end();
|
|
86039
|
+
});
|
|
86040
|
+
socket.on("close", forget);
|
|
86041
|
+
socket.on("error", forget);
|
|
85729
86042
|
touch();
|
|
85730
86043
|
});
|
|
85731
86044
|
const previousPort = Number(readPersisted(portFile));
|
|
@@ -85735,7 +86048,7 @@ async function startArtifactsServer(options) {
|
|
|
85735
86048
|
port = await listen(server, options.host, 0);
|
|
85736
86049
|
}
|
|
85737
86050
|
cookieName = `ryugi_artifacts_${port}`;
|
|
85738
|
-
|
|
86051
|
+
import_node_fs17.default.writeFileSync(portFile, `${port}
|
|
85739
86052
|
`, { mode: 384 });
|
|
85740
86053
|
const origin = `http://${urlHostForHttp(options.urlHost)}:${port}`;
|
|
85741
86054
|
const url = `${origin}/?key=${token}`;
|
|
@@ -85761,7 +86074,7 @@ async function startArtifactsServer(options) {
|
|
|
85761
86074
|
initialChanges.push({ ref: entry, payload, files: [] });
|
|
85762
86075
|
if (entry.type === "document") void documents.open(entry.id);
|
|
85763
86076
|
}
|
|
85764
|
-
writeJsonAtomic(
|
|
86077
|
+
writeJsonAtomic(import_node_path16.default.join(stateDir, "server-info"), { type: "server-started", url, port, root });
|
|
85765
86078
|
const watcher = watchTree(
|
|
85766
86079
|
root,
|
|
85767
86080
|
(files) => {
|
|
@@ -85810,6 +86123,7 @@ async function startArtifactsServer(options) {
|
|
|
85810
86123
|
onActivity: (listener) => activityListeners.push(listener),
|
|
85811
86124
|
close: () => new Promise((resolve) => {
|
|
85812
86125
|
watcher.close();
|
|
86126
|
+
selections.clearAll();
|
|
85813
86127
|
for (const socket of clients) socket.destroy();
|
|
85814
86128
|
server.close(() => resolve());
|
|
85815
86129
|
server.closeAllConnections();
|
|
@@ -85818,7 +86132,7 @@ async function startArtifactsServer(options) {
|
|
|
85818
86132
|
}
|
|
85819
86133
|
|
|
85820
86134
|
// src/server/lifecycle.ts
|
|
85821
|
-
var
|
|
86135
|
+
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
85822
86136
|
var DEFAULT_IDLE_TIMEOUT_MS = 4 * 60 * 60 * 1e3;
|
|
85823
86137
|
var DEFAULT_LIFECYCLE_CHECK_MS = 60 * 1e3;
|
|
85824
86138
|
var SERVER_ID_ARG = "--artifacts-server-id=";
|
|
@@ -85848,13 +86162,13 @@ function parseEnv(env, argv = []) {
|
|
|
85848
86162
|
};
|
|
85849
86163
|
}
|
|
85850
86164
|
function readOwners(file) {
|
|
85851
|
-
let
|
|
86165
|
+
let text2;
|
|
85852
86166
|
try {
|
|
85853
|
-
|
|
86167
|
+
text2 = import_node_fs18.default.readFileSync(file, "utf8");
|
|
85854
86168
|
} catch {
|
|
85855
86169
|
return [];
|
|
85856
86170
|
}
|
|
85857
|
-
const pids =
|
|
86171
|
+
const pids = text2.split("\n").map((line) => Number(line.trim())).filter((pid) => Number.isInteger(pid) && pid > 1);
|
|
85858
86172
|
return [...new Set(pids)];
|
|
85859
86173
|
}
|
|
85860
86174
|
var liveOwners = (pids, alive) => pids.filter(alive);
|
|
@@ -85914,15 +86228,15 @@ function openReady(payload) {
|
|
|
85914
86228
|
// src/server/main.ts
|
|
85915
86229
|
async function main() {
|
|
85916
86230
|
const config = parseEnv(process.env, process.argv.slice(2));
|
|
85917
|
-
const root =
|
|
85918
|
-
const stateDir =
|
|
86231
|
+
const root = import_node_path17.default.resolve(config.root);
|
|
86232
|
+
const stateDir = import_node_path17.default.join(root, ".state");
|
|
85919
86233
|
const server = await startArtifactsServer({
|
|
85920
86234
|
root,
|
|
85921
|
-
viewerDir:
|
|
85922
|
-
runtimeDir:
|
|
86235
|
+
viewerDir: import_node_path17.default.join(__dirname, "viewer"),
|
|
86236
|
+
runtimeDir: import_node_path17.default.join(__dirname, "runtime"),
|
|
85923
86237
|
host: config.host,
|
|
85924
86238
|
urlHost: config.urlHost,
|
|
85925
|
-
configFile:
|
|
86239
|
+
configFile: import_node_path17.default.join(import_node_path17.default.dirname(root), "config.json"),
|
|
85926
86240
|
cloud: { origin: config.cloudOrigin, credentialsFile: credentialsFile(process.env, process.platform, import_node_os.default.homedir()) }
|
|
85927
86241
|
});
|
|
85928
86242
|
let lastActivity = Date.now();
|
|
@@ -85938,12 +86252,12 @@ async function main() {
|
|
|
85938
86252
|
if (server.clientCount() > 0) return;
|
|
85939
86253
|
const link = server.linkFor(ref.type, ref.id);
|
|
85940
86254
|
if (config.openCmd) {
|
|
85941
|
-
(0,
|
|
86255
|
+
(0, import_node_child_process2.exec)(`${config.openCmd} ${JSON.stringify(link)}`, () => {
|
|
85942
86256
|
});
|
|
85943
86257
|
return;
|
|
85944
86258
|
}
|
|
85945
86259
|
const launcher = browserLauncher(process.platform, link);
|
|
85946
|
-
if (launcher) (0,
|
|
86260
|
+
if (launcher) (0, import_node_child_process2.execFile)(launcher.bin, launcher.args, () => {
|
|
85947
86261
|
});
|
|
85948
86262
|
});
|
|
85949
86263
|
let stopping = false;
|
|
@@ -85951,12 +86265,12 @@ async function main() {
|
|
|
85951
86265
|
if (stopping) return;
|
|
85952
86266
|
stopping = true;
|
|
85953
86267
|
console.log(JSON.stringify({ type: "server-stopped", reason }));
|
|
85954
|
-
|
|
85955
|
-
writeJsonAtomic(
|
|
86268
|
+
import_node_fs19.default.rmSync(import_node_path17.default.join(stateDir, "server-info"), { force: true });
|
|
86269
|
+
writeJsonAtomic(import_node_path17.default.join(stateDir, "server-stopped"), { reason, timestamp: Date.now() });
|
|
85956
86270
|
await server.close();
|
|
85957
86271
|
process.exit(0);
|
|
85958
86272
|
};
|
|
85959
|
-
const ownersFile =
|
|
86273
|
+
const ownersFile = import_node_path17.default.join(stateDir, "owners");
|
|
85960
86274
|
const timer = setInterval(() => {
|
|
85961
86275
|
const owners = readOwners(ownersFile);
|
|
85962
86276
|
const reason = shutdownReason({
|
|
@@ -85970,7 +86284,7 @@ async function main() {
|
|
|
85970
86284
|
timer.unref();
|
|
85971
86285
|
process.on("SIGTERM", () => void shutdown("SIGTERM"));
|
|
85972
86286
|
process.on("SIGINT", () => void shutdown("SIGINT"));
|
|
85973
|
-
|
|
86287
|
+
import_node_fs19.default.rmSync(import_node_path17.default.join(stateDir, "server-stopped"), { force: true });
|
|
85974
86288
|
console.log(JSON.stringify({ type: "server-started", url: server.url, port: server.port, root }));
|
|
85975
86289
|
}
|
|
85976
86290
|
main().catch((err) => {
|