@nldd/design-system 0.20.0 → 0.21.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/custom-elements.json +204 -8
- package/dist/cdn/autoloader.js +181 -0
- package/dist/cdn/chunks/activity-indicator-JglZJ8dh.js +356 -0
- package/dist/cdn/chunks/activity-indicator.i18n-D7mCy6d2.js +3 -0
- package/dist/cdn/chunks/avatar-ASqePVhU.js +308 -0
- package/dist/cdn/chunks/avatar-group-rknt4FBO.js +338 -0
- package/dist/cdn/chunks/avatar-group.i18n-BYw_9wt_.js +7 -0
- package/dist/cdn/chunks/avatar.i18n-CMwQjBkS.js +7 -0
- package/dist/cdn/chunks/badge-Cc2Nufoc.js +323 -0
- package/dist/cdn/chunks/badge.i18n-DqW7hLQj.js +3 -0
- package/dist/cdn/chunks/banner-BLVKM07M.js +325 -0
- package/dist/cdn/chunks/banner.i18n-BOCM9rGN.js +3 -0
- package/dist/cdn/chunks/bar-split-view-Clbg-p9H.js +259 -0
- package/dist/cdn/chunks/base-CfuoYRhN.js +3 -0
- package/dist/cdn/chunks/blockquote-BoOqbGdm.js +189 -0
- package/dist/cdn/chunks/box-WkhyjQVy.js +88 -0
- package/dist/cdn/chunks/breadcrumbs-D9YxZzRj.js +162 -0
- package/dist/cdn/chunks/breadcrumbs.i18n-zmO8jaTO.js +3 -0
- package/dist/cdn/chunks/breakpoints-Cwor8TRP.js +15 -0
- package/dist/cdn/chunks/button-DO90Lo6q.js +863 -0
- package/dist/cdn/chunks/button-bar-Bxgdbyh3.js +225 -0
- package/dist/cdn/chunks/button-group-BYGPPLmZ.js +205 -0
- package/dist/{components/button.i18n-DiDGynnq.js → cdn/chunks/button.i18n-BGFt7Z9u.js} +2 -2
- package/dist/cdn/chunks/card-BP0jfOkS.js +262 -0
- package/dist/cdn/chunks/card.i18n-CpafLm3i.js +8 -0
- package/dist/cdn/chunks/carried-context-DlMSujiJ.js +37 -0
- package/dist/cdn/chunks/cell-BRD2ilQh.js +144 -0
- package/dist/cdn/chunks/checkbox-Cazx8CQn.js +296 -0
- package/dist/cdn/chunks/checkbox-field-DDZ-B6vH.js +157 -0
- package/dist/cdn/chunks/class-map-CXSdNjt8.js +26 -0
- package/dist/cdn/chunks/code-editor-D6Q55oaY.js +286 -0
- package/dist/cdn/chunks/code-viewer-DspLH2T1.js +766 -0
- package/dist/cdn/chunks/code-viewer.i18n-BHfSDRbK.js +13 -0
- package/dist/cdn/chunks/codemirror-input-Db65x22n.js +1232 -0
- package/dist/cdn/chunks/collection-NVtkvDls.js +396 -0
- package/dist/cdn/chunks/collection.i18n-DqWPGnZO.js +8 -0
- package/dist/cdn/chunks/combo-box-DyBQSaQl.js +512 -0
- package/dist/cdn/chunks/combo-box.i18n-BorzYnJ2.js +6 -0
- package/dist/cdn/chunks/container-rrbwk0z4.js +602 -0
- package/dist/cdn/chunks/custom-element-BW8Ua4c7.js +7 -0
- package/dist/cdn/chunks/custom-element-q6NzoL5b.js +301 -0
- package/dist/cdn/chunks/custom-font-size-D7KNr84p.js +57 -0
- package/dist/cdn/chunks/date-field-Clti_wKN.js +654 -0
- package/dist/cdn/chunks/date-field.i18n-BTzc0E9a.js +15 -0
- package/dist/cdn/chunks/date-picker-2TCQLd5D.js +993 -0
- package/dist/cdn/chunks/date-picker.i18n-Dsc_M5QK.js +82 -0
- package/dist/cdn/chunks/decorate-TduJMFD_.js +280 -0
- package/dist/cdn/chunks/defer-focus-F73ud2D9.js +9 -0
- package/dist/cdn/chunks/described-by-mixin-daRE7orX.js +32 -0
- package/dist/cdn/chunks/description-cell-CQwOj_rN.js +166 -0
- package/dist/cdn/chunks/dev-checks-zW_W-hnh.js +2695 -0
- package/dist/cdn/chunks/directive-CwRgozUW.js +27 -0
- package/dist/cdn/chunks/dismiss-from-title-bar-C6mP7sWP.js +5 -0
- package/dist/cdn/chunks/dist-3C80SZN9.js +849 -0
- package/dist/cdn/chunks/dist-A7_1pHX0.js +379 -0
- package/dist/cdn/chunks/dist-BEfLdOvy.js +1346 -0
- package/dist/cdn/chunks/dist-BTUxFM2V.js +268 -0
- package/dist/cdn/chunks/dist-CP3G1pSK.js +1037 -0
- package/dist/cdn/chunks/dist-C_dGY6zR.js +468 -0
- package/dist/{components/dist-B9YBOGFW.js → cdn/chunks/dist-ChmCRv39.js} +109 -153
- package/dist/{components/dist-CJm4tkNC.js → cdn/chunks/dist-D2qap2OY.js} +23 -31
- package/dist/cdn/chunks/dist-DPUBF0MZ.js +1593 -0
- package/dist/{components/dist-4g23YHP0.js → cdn/chunks/dist-DrTzvgE7.js} +291 -404
- package/dist/cdn/chunks/dist-EM4MWLQq.js +385 -0
- package/dist/cdn/chunks/dist-EgIBI-FG.js +293 -0
- package/dist/{components/dist-Bf823YyL.js → cdn/chunks/dist-Rm6FvrSR.js} +272 -551
- package/dist/cdn/chunks/divider-CCNbnplA.js +53 -0
- package/dist/cdn/chunks/document-tab-bar-CUc4WWY3.js +973 -0
- package/dist/cdn/chunks/document-tab-bar.i18n-DKrA9TnB.js +9 -0
- package/dist/cdn/chunks/drag-handle-cell-CbzDYebG.js +206 -0
- package/dist/cdn/chunks/drag-handle-cell.i18n-CKUrbm2q.js +3 -0
- package/dist/cdn/chunks/dropdown-DZTZtkm5.js +350 -0
- package/dist/cdn/chunks/element-state-B-44fVqq.js +20 -0
- package/dist/cdn/chunks/file-field-Bff6_1pp.js +1484 -0
- package/dist/cdn/chunks/file-field.i18n-pDM7Utud.js +40 -0
- package/dist/cdn/chunks/floating-ui.dom-B8J1rV2c.js +753 -0
- package/dist/cdn/chunks/focus-target-DSLGcCWq.js +24 -0
- package/dist/cdn/chunks/form-actions-C_7hINq-.js +90 -0
- package/dist/cdn/chunks/form-associated-mixin--GIbl98p.js +62 -0
- package/dist/cdn/chunks/form-field--4nWJ_DK.js +364 -0
- package/dist/cdn/chunks/form-hXLgy_tY.js +84 -0
- package/dist/cdn/chunks/form-section-By-D4un0.js +64 -0
- package/dist/cdn/chunks/full-bleed-section-Dg4sIJG1.js +161 -0
- package/dist/cdn/chunks/gherkin-eseYvsxh.js +29 -0
- package/dist/cdn/chunks/hero-CQQMNCT_.js +761 -0
- package/dist/{components/icon-_Eox7ZfO.js → cdn/chunks/icon-BORlalt0.js} +298 -308
- package/dist/cdn/chunks/icon-button-rKiIHs7A.js +632 -0
- package/dist/{components/icon-button.i18n-1_N-wN6x.js → cdn/chunks/icon-button.i18n-DpZOfIS4.js} +2 -4
- package/dist/cdn/chunks/icon-cell-rk4NQid2.js +156 -0
- package/dist/cdn/chunks/identity-Cg1l0HhB.js +187 -0
- package/dist/cdn/chunks/if-defined-CaKKERku.js +4 -0
- package/dist/cdn/chunks/image-DZMW6JgL.js +659 -0
- package/dist/cdn/chunks/image.i18n-ONcm1h7o.js +3 -0
- package/dist/cdn/chunks/implicit-submission-Csbcor_E.js +27 -0
- package/dist/cdn/chunks/inline-dialog-WlqtPBPJ.js +259 -0
- package/dist/cdn/chunks/input-modality-XE0B7yCn.js +42 -0
- package/dist/cdn/chunks/just-in-time-education-DRcb5g7x.js +611 -0
- package/dist/cdn/chunks/just-in-time-education.i18n-CW_dsaxf.js +6 -0
- package/dist/cdn/chunks/kanban-Ca_mfqsA.js +400 -0
- package/dist/cdn/chunks/kanban-column-fgIMc7pw.js +375 -0
- package/dist/cdn/chunks/kanban.i18n-CWqc3e0B.js +11 -0
- package/dist/cdn/chunks/keyboard-shortcut-EknnW7Ub.js +267 -0
- package/dist/cdn/chunks/languages-yKikVFv_.js +8893 -0
- package/dist/cdn/chunks/link-FBSAJ3UC.js +229 -0
- package/dist/cdn/chunks/link-group-90qVfKa0.js +111 -0
- package/dist/cdn/chunks/link-hint-KFhgr5Ng.js +24 -0
- package/dist/cdn/chunks/link-rel-DvrTEfVT.js +8 -0
- package/dist/cdn/chunks/link.i18n-DJPobGmu.js +8 -0
- package/dist/cdn/chunks/list-CaWl3q0Z.js +880 -0
- package/dist/cdn/chunks/list-item-Cagnf6eG.js +802 -0
- package/dist/cdn/chunks/list-item-segment-BRzBF1y_.js +315 -0
- package/dist/cdn/chunks/list-item-segment.i18n-DHnrQL4V.js +8 -0
- package/dist/{components/list-item.i18n-89uqlBMK.js → cdn/chunks/list-item.i18n-Br6J5Ev9.js} +2 -2
- package/dist/cdn/chunks/list-items-Du0RCWsY.js +6 -0
- package/dist/{components/list.i18n-CKqbhFQ_.js → cdn/chunks/list.i18n-C40ltgdI.js} +2 -2
- package/dist/cdn/chunks/loading-tags-DtUr-DR7.js +3 -0
- package/dist/cdn/chunks/menu-BOu_pD1Q.js +719 -0
- package/dist/cdn/chunks/menu-bar-0NFXvq-v.js +253 -0
- package/dist/cdn/chunks/menu-bar-item-DGSC_ETi.js +365 -0
- package/dist/cdn/chunks/menu-bar.i18n-BoMu4Eoz.js +3 -0
- package/dist/cdn/chunks/menu-divider-CLLRgMll.js +15 -0
- package/dist/cdn/chunks/menu-group-BL24ChpR.js +23 -0
- package/dist/cdn/chunks/menu-item-CooKfrFa.js +140 -0
- package/dist/cdn/chunks/menu.i18n-C6uYJsG3.js +10 -0
- package/dist/cdn/chunks/menu.template-C6rbfI-u.js +642 -0
- package/dist/cdn/chunks/modal-dialog-BrUMP4Jm.js +240 -0
- package/dist/cdn/chunks/multi-line-text-field-D7hXhyOn.js +318 -0
- package/dist/cdn/chunks/navigation-split-view-B2ZQhxEb.js +621 -0
- package/dist/cdn/chunks/nl.generated-D6T41jG3.js +112 -0
- package/dist/cdn/chunks/notification-DSGP14d1.js +492 -0
- package/dist/cdn/chunks/notification.i18n-BKUSLN5c.js +6 -0
- package/dist/cdn/chunks/number-field-B8op14Y_.js +301 -0
- package/dist/cdn/chunks/number-field.i18n-BS0bINWY.js +7 -0
- package/dist/cdn/chunks/one-half-one-half-section-ZYmHYf4Q.js +213 -0
- package/dist/cdn/chunks/one-third-two-thirds-section-Ds10K6AS.js +213 -0
- package/dist/cdn/chunks/one-time-code-field-Cgy_tTS4.js +693 -0
- package/dist/cdn/chunks/open-when-rendered-CW_2_WUZ.js +20 -0
- package/dist/cdn/chunks/owned-attribute-x9OCTy_4.js +6 -0
- package/dist/cdn/chunks/owner-form-Cq8tT7ac.js +7 -0
- package/dist/cdn/chunks/page-CBf_Decp.js +431 -0
- package/dist/cdn/chunks/page-footer-CSv1dU7M.js +396 -0
- package/dist/cdn/chunks/page-footer.i18n-pbdr4lN3.js +3 -0
- package/dist/cdn/chunks/page-section-mixin-Dp6X8GKd.js +132 -0
- package/dist/cdn/chunks/pagination-CMUcFB53.js +485 -0
- package/dist/cdn/chunks/pagination.i18n-QQMx14CQ.js +9 -0
- package/dist/cdn/chunks/password-field-C76Vm3rm.js +368 -0
- package/dist/cdn/chunks/password-field.i18n-CzdBn-1b.js +8 -0
- package/dist/cdn/chunks/popover-C-CVVtfl.js +334 -0
- package/dist/cdn/chunks/popover-target-B25dxnmt.js +10 -0
- package/dist/cdn/chunks/popover.i18n-DmFBHUvB.js +3 -0
- package/dist/cdn/chunks/popup-anchor-controller-VZw0bXf2.js +30 -0
- package/dist/cdn/chunks/progress-bar-BLiHaRUS.js +674 -0
- package/dist/cdn/chunks/progress-bar.i18n-Cr5miGTx.js +8 -0
- package/dist/cdn/chunks/progress-circle-CjkovRbL.js +667 -0
- package/dist/cdn/chunks/progress-circle.i18n-CRrXuY4V.js +8 -0
- package/dist/cdn/chunks/query-ChDzi9FQ.js +28 -0
- package/dist/cdn/chunks/radio-button-GHyO-GQB.js +338 -0
- package/dist/cdn/chunks/radio-button-field-C-Z6Lnd4.js +192 -0
- package/dist/cdn/chunks/radio-button-group-ChTqBCnQ.js +118 -0
- package/dist/cdn/chunks/radio-position-CXWYAjaz.js +10 -0
- package/dist/cdn/chunks/reflect-non-default-Bu3rpCvg.js +9 -0
- package/dist/cdn/chunks/render-marked-DX_5ISZE.js +37 -0
- package/dist/cdn/chunks/repeat-Ch_5OsXE.js +76 -0
- package/dist/cdn/chunks/return-focus-Xmagtk6r.js +52 -0
- package/dist/cdn/chunks/rich-text-CQ2uwMSp.js +47 -0
- package/dist/cdn/chunks/rich-text.i18n-BlJ68YuU.js +3 -0
- package/dist/cdn/chunks/row-header-mixin-CgqvREoV.js +16 -0
- package/dist/cdn/chunks/sanitize-url-CBuGmY0W.js +7 -0
- package/dist/cdn/chunks/scroll-mode-controller-COUD1-3P.js +42 -0
- package/dist/cdn/chunks/search-field-BGNfERhn.js +396 -0
- package/dist/cdn/chunks/search-field.i18n-B_Oc7hc-.js +6 -0
- package/dist/cdn/chunks/segmented-control-BYAG4VRp.js +671 -0
- package/dist/cdn/chunks/shadow-resets-6SToDsPu.js +12 -0
- package/dist/cdn/chunks/sheet-BdVCqm2H.js +340 -0
- package/dist/cdn/chunks/shell-C9rds_D9.js +146 -0
- package/dist/cdn/chunks/shell-DmJOYhyF.js +108 -0
- package/dist/cdn/chunks/side-by-side-split-view-C5oX4c6Z.js +166 -0
- package/dist/cdn/chunks/sidebar-section-DP4jnS7g.js +353 -0
- package/dist/cdn/chunks/sidebar-section.i18n-BuGfRMpD.js +6 -0
- package/dist/cdn/chunks/simple-section-qrCqXeBa.js +192 -0
- package/dist/cdn/chunks/skip-link-DWh4W6-J.js +161 -0
- package/dist/cdn/chunks/skip-link.i18n--PbEdAmJ.js +3 -0
- package/dist/cdn/chunks/slider--hODfOwh.js +772 -0
- package/dist/cdn/chunks/slider.i18n-DVw0c8AG.js +6 -0
- package/dist/cdn/chunks/slot-content-BLuPqVXw.js +13 -0
- package/dist/cdn/chunks/spacer-CFzq_JCh.js +237 -0
- package/dist/cdn/chunks/spacer-cell-DuVOgIj8.js +68 -0
- package/dist/cdn/chunks/spacing-scale-SufIjHeN.js +28 -0
- package/dist/cdn/chunks/split-button-BeXnOUTt.js +268 -0
- package/dist/cdn/chunks/split-button.i18n-DtClSMga.js +3 -0
- package/dist/cdn/chunks/split-view-divider-jzcPmnMh.js +100 -0
- package/dist/cdn/chunks/split-view-pane-BLsZz263.js +128 -0
- package/dist/cdn/chunks/stacked-split-view-CcOR8LrJ.js +157 -0
- package/dist/cdn/chunks/static-html-Cf4ccUIg.js +26 -0
- package/dist/cdn/chunks/status-bar-CINbOihq.js +284 -0
- package/dist/cdn/chunks/status-bar-change-CR9l0Gyk.js +3 -0
- package/dist/cdn/chunks/step-bar-6FvZL1Ti.js +474 -0
- package/dist/cdn/chunks/step-bar.i18n-DocExlD7.js +9 -0
- package/dist/cdn/chunks/step-cell-CejRisgS.js +287 -0
- package/dist/cdn/chunks/stepper-CY2rJWOJ.js +223 -0
- package/dist/cdn/chunks/stepper.i18n-COOAkaBl.js +7 -0
- package/dist/cdn/chunks/style-map-DsIw6lkq.js +29 -0
- package/dist/cdn/chunks/style-mod-DGMhzWuk.js +1583 -0
- package/dist/cdn/chunks/swatch-picker-BY3DBIl6.js +430 -0
- package/dist/cdn/chunks/swatch-picker.i18n-_G0nmnGe.js +22 -0
- package/dist/cdn/chunks/switch-DDSsZFwK.js +275 -0
- package/dist/cdn/chunks/switch-field-CMoM9I38.js +137 -0
- package/dist/cdn/chunks/tab-bar-DmslEoPD.js +697 -0
- package/dist/cdn/chunks/tab-bar.i18n-Crsc7ShA.js +3 -0
- package/dist/cdn/chunks/table-DwXjCSD5.js +308 -0
- package/dist/cdn/chunks/table.i18n-Bmb_uw_w.js +3 -0
- package/dist/cdn/chunks/tag-DM3APy3B.js +306 -0
- package/dist/cdn/chunks/text-B1CatNR1.js +421 -0
- package/dist/cdn/chunks/text-cell-BkEsGI3g.js +299 -0
- package/dist/cdn/chunks/text-editor-BvTiMeNV.js +3743 -0
- package/dist/cdn/chunks/text-editor.i18n-sJKiRQ4i.js +17 -0
- package/dist/cdn/chunks/text-field-CUyh1-V8.js +398 -0
- package/dist/cdn/chunks/time-field-Cj5WojfO.js +597 -0
- package/dist/cdn/chunks/time-field.i18n-CLH5vmS7.js +11 -0
- package/dist/cdn/chunks/time-picker-W0xYXLy8.js +508 -0
- package/dist/cdn/chunks/time-picker.i18n-BilOCXlS.js +7 -0
- package/dist/cdn/chunks/title-BuT7tWqN.js +437 -0
- package/dist/cdn/chunks/title-bar-label-controller-DSxdKZOg.js +24 -0
- package/dist/cdn/chunks/title-cell-8d8psUBX.js +327 -0
- package/dist/cdn/chunks/toggle-button-DNXWXZpE.js +528 -0
- package/dist/cdn/chunks/toggle-button-group-ByowJYgs.js +156 -0
- package/dist/cdn/chunks/token-CnkEB3hB.js +266 -0
- package/dist/cdn/chunks/token-field-hvDB3l6O.js +664 -0
- package/dist/cdn/chunks/token-field.i18n-BclzoR8F.js +9 -0
- package/dist/cdn/chunks/token.i18n-RGD5zAtl.js +7 -0
- package/dist/cdn/chunks/toml-w97zZfFO.js +27 -0
- package/dist/cdn/chunks/toolbar-iNd1VmuG.js +408 -0
- package/dist/cdn/chunks/toolbar-item-DpPfPxCi.js +50 -0
- package/dist/cdn/chunks/toolbar-title-KBMpfL9d.js +84 -0
- package/dist/cdn/chunks/toolbar.i18n-QwS37CBC.js +8 -0
- package/dist/cdn/chunks/toolbar.styles-BQkG4gVc.js +383 -0
- package/dist/cdn/chunks/tooltip-BsAHJjci.js +325 -0
- package/dist/cdn/chunks/top-navigation-bar-D1hjWIF3.js +925 -0
- package/dist/cdn/chunks/top-navigation-bar.i18n-C-lcH1nB.js +10 -0
- package/dist/cdn/chunks/top-title-bar-iNFB2zQL.js +344 -0
- package/dist/cdn/chunks/translations-wxBSz213.js +8 -0
- package/dist/cdn/chunks/two-thirds-one-third-section-D-UANbHC.js +213 -0
- package/dist/cdn/chunks/validation-list-C5BhHZIG.js +202 -0
- package/dist/cdn/chunks/validation-list.i18n-CM6In8zD.js +12 -0
- package/dist/cdn/chunks/visibility-mixin-COAZ9pON.js +74 -0
- package/dist/cdn/chunks/visually-hidden-BPgATaH0.js +43 -0
- package/dist/cdn/chunks/window-t5iFkMLY.js +227 -0
- package/dist/cdn/chunks/window.i18n-CsEnUPAk.js +3 -0
- package/dist/cdn/chunks/with-translations-XX14GKFh.js +16 -0
- package/dist/components/actions/menu/menu-item.d.ts +6 -2
- package/dist/components/actions/menu/menu-item.d.ts.map +1 -1
- package/dist/components/actions/menu/menu-item.js +12 -1
- package/dist/components/actions/menu/menu-item.js.map +1 -1
- package/dist/components/actions/menu/menu.js +1 -1
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.template.js +2 -1
- package/dist/components/actions/menu/menu.template.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.d.ts +22 -2
- package/dist/components/inputs/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.js +67 -11
- package/dist/components/inputs/dropdown/dropdown.js.map +1 -1
- package/dist/components/layout/container/container.d.ts +15 -2
- package/dist/components/layout/container/container.d.ts.map +1 -1
- package/dist/components/layout/container/container.js +38 -3
- package/dist/components/layout/container/container.js.map +1 -1
- package/dist/components/layout/container/container.styles.js +1 -1
- package/dist/components/layout/container/container.template.js +1 -1
- package/dist/components/layout/container/container.template.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.d.ts +7 -0
- package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.js +13 -3
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts +11 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js +19 -3
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js.map +1 -1
- package/dist/nldd.min.js +298 -298
- package/dist/types/react.d.ts +3323 -0
- package/dist/types/vue.d.ts +11 -3
- package/dist/utilities/autoloader.d.ts +33 -0
- package/dist/utilities/autoloader.d.ts.map +1 -0
- package/dist/utilities/autoloader.generated.d.ts +3 -0
- package/dist/utilities/autoloader.generated.d.ts.map +1 -0
- package/dist/utilities/autoloader.generated.js +141 -0
- package/dist/utilities/autoloader.generated.js.map +1 -0
- package/dist/utilities/autoloader.js +94 -0
- package/dist/utilities/autoloader.js.map +1 -0
- package/dist/utilities/dev-checks.d.ts +9 -0
- package/dist/utilities/dev-checks.d.ts.map +1 -1
- package/dist/utilities/dev-checks.js +45 -3
- package/dist/utilities/dev-checks.js.map +1 -1
- package/dist/utilities/dev-rules.generated.d.ts.map +1 -1
- package/dist/utilities/dev-rules.generated.js +12 -2
- package/dist/utilities/dev-rules.generated.js.map +1 -1
- package/dist/utilities/loading-tags.d.ts +7 -0
- package/dist/utilities/loading-tags.d.ts.map +1 -0
- package/dist/utilities/loading-tags.js +7 -0
- package/dist/utilities/loading-tags.js.map +1 -0
- package/dist/utilities/owner-form.d.ts +3 -3
- package/dist/utilities/owner-form.d.ts.map +1 -1
- package/dist/utilities/owner-form.js +6 -3
- package/dist/utilities/owner-form.js.map +1 -1
- package/lint/data.generated.json +1 -1
- package/package.json +50 -11
- package/dist/components/breakpoints-DtL62nLI.js +0 -45
- package/dist/components/components.js +0 -68243
- package/dist/components/decorate-DD7uUxHb.js +0 -51
- package/dist/components/defer-focus-dzorHsCQ.js +0 -176
- package/dist/components/dev-checks-CLB9G43h.js +0 -2711
- package/dist/components/dist-245LaK9m.js +0 -1479
- package/dist/components/dist-BFZM0YsR.js +0 -15772
- package/dist/components/dist-BNkeFjc3.js +0 -1180
- package/dist/components/dist-CSC1dG3L.js +0 -365
- package/dist/components/dist-CeMOOqgP.js +0 -1509
- package/dist/components/dist-DFjwTlJV.js +0 -624
- package/dist/components/dist-DHhnz3Gv.js +0 -381
- package/dist/components/dist-PeUX4vPq.js +0 -2857
- package/dist/components/dist-m70B83qb.js +0 -463
- package/dist/components/element-state-BnarBv0M.js +0 -42
- package/dist/components/gherkin-DzYbEwDO.js +0 -107
- package/dist/components/icon-button-8gvQCwCW.js +0 -2305
- package/dist/components/input-modality-D_CY185R.js +0 -48
- package/dist/components/just-in-time-education.i18n-BqU1ImP4.js +0 -423
- package/dist/components/nl.generated-DzZkOgnP.js +0 -64
- package/dist/components/rolldown-runtime-D8jQpDG7.js +0 -12
- package/dist/components/shadow-resets-BwOyyZFH.js +0 -60
- package/dist/components/shell-Dh5IwHd-.js +0 -222
- package/dist/components/toml-D0Pix_8Q.js +0 -58
- package/dist/components/visibility-mixin-Dzn48SL8.js +0 -153
|
@@ -0,0 +1,3743 @@
|
|
|
1
|
+
import "./icon-BORlalt0.js";
|
|
2
|
+
import { $ as e, A as t, D as n, F as r, H as i, I as a, J as o, K as s, L as c, M as l, N as u, O as d, P as f, Q as p, V as m, Z as h, et as g, it as _, lt as ee, n as te, nt as v, ot as y, q as ne, r as re, st as b } from "./languages-yKikVFv_.js";
|
|
3
|
+
import { a as ie, c as ae, i as oe, n as se } from "./dist-CP3G1pSK.js";
|
|
4
|
+
import { n as ce, r as le } from "./dist-DPUBF0MZ.js";
|
|
5
|
+
import { i as ue, n as x } from "./custom-element-q6NzoL5b.js";
|
|
6
|
+
import { o as de, t as S } from "./decorate-TduJMFD_.js";
|
|
7
|
+
import { t as fe } from "./custom-element-BW8Ua4c7.js";
|
|
8
|
+
import { t as pe } from "./query-ChDzi9FQ.js";
|
|
9
|
+
import { t as me } from "./reflect-non-default-Bu3rpCvg.js";
|
|
10
|
+
import { r as he } from "./element-state-B-44fVqq.js";
|
|
11
|
+
import { t as ge } from "./shadow-resets-6SToDsPu.js";
|
|
12
|
+
import { t as _e } from "./translations-wxBSz213.js";
|
|
13
|
+
import "./avatar-ASqePVhU.js";
|
|
14
|
+
import { a as ve, c as ye, d as be, i as xe, l as Se, n as Ce, o as we, r as Te, s as Ee, t as De, u as Oe } from "./codemirror-input-Db65x22n.js";
|
|
15
|
+
import { t as ke } from "./text-editor.i18n-sJKiRQ4i.js";
|
|
16
|
+
// src/components/inputs/text-editor/text-editor.labels.ts
|
|
17
|
+
var Ae = y.define();
|
|
18
|
+
// src/components/inputs/text-editor/text-editor.syntax.ts
|
|
19
|
+
function C(e, t, r, i) {
|
|
20
|
+
for (let a = n(e).resolveInner(t, r); a; a = a.parent) if (i(a)) return a;
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
var je = /* @__PURE__ */ new Set(["FencedCode", "CodeBlock"]), Me = /* @__PURE__ */ new Set([...je, "InlineCode"]);
|
|
24
|
+
function Ne(e, t) {
|
|
25
|
+
return T(e, t, 1, je) !== null;
|
|
26
|
+
}
|
|
27
|
+
function Pe(e, t) {
|
|
28
|
+
return T(e, t, 1, Me) !== null;
|
|
29
|
+
}
|
|
30
|
+
function Fe(e, t, n, r) {
|
|
31
|
+
for (let i = t; i <= n;) {
|
|
32
|
+
let t = e.doc.lineAt(i);
|
|
33
|
+
r(t.from), i = t.to + 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function w(e, t) {
|
|
37
|
+
return n(e) !== n(t);
|
|
38
|
+
}
|
|
39
|
+
function Ie(e, t) {
|
|
40
|
+
return T(e, t, 1, "HorizontalRule") !== null;
|
|
41
|
+
}
|
|
42
|
+
function T(e, t, n, r) {
|
|
43
|
+
return C(e, t, n, typeof r == "string" ? (e) => e.name === r : (e) => r.has(e.name));
|
|
44
|
+
}
|
|
45
|
+
function Le(e) {
|
|
46
|
+
let t = [];
|
|
47
|
+
for (let n = e.firstChild; n; n = n.nextSibling) n.name === "LinkMark" && t.push(n);
|
|
48
|
+
if (t.length < 2) return null;
|
|
49
|
+
let n = t[0].to, r = t[1].from;
|
|
50
|
+
return r > n ? {
|
|
51
|
+
from: n,
|
|
52
|
+
to: r
|
|
53
|
+
} : null;
|
|
54
|
+
}
|
|
55
|
+
// src/components/inputs/text-editor/text-editor.mention.ts
|
|
56
|
+
var Re = "user:";
|
|
57
|
+
function ze(e) {
|
|
58
|
+
return `[@${e.text.replace(/[[\]\\]/g, (e) => "\\" + e)}](${Re}${encodeURIComponent(e.id).replace(/[()<>]/g, (e) => "%" + e.charCodeAt(0).toString(16).toUpperCase())})`;
|
|
59
|
+
}
|
|
60
|
+
function Be(e) {
|
|
61
|
+
return `${ze(e)} `;
|
|
62
|
+
}
|
|
63
|
+
function Ve(e) {
|
|
64
|
+
return e.replace(/\\([[\]\\])/g, "$1");
|
|
65
|
+
}
|
|
66
|
+
function He(e) {
|
|
67
|
+
try {
|
|
68
|
+
return decodeURIComponent(e);
|
|
69
|
+
} catch {
|
|
70
|
+
return e;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
var Ue = RegExp(`\\[(@[^\\]]*)\\]\\(${Re}[^)]*\\)`, "g");
|
|
74
|
+
function E(e) {
|
|
75
|
+
return e.startsWith(Re);
|
|
76
|
+
}
|
|
77
|
+
function D(e, t) {
|
|
78
|
+
let n = t.getChild("URL");
|
|
79
|
+
return n !== null && E(e.sliceDoc(n.from, n.to));
|
|
80
|
+
}
|
|
81
|
+
function We(e, t, n) {
|
|
82
|
+
return e.from === e.to || e.from > t || e.to < n ? "none" : e.from === t && e.to === n ? "alone" : "within";
|
|
83
|
+
}
|
|
84
|
+
var Ge = class extends f {
|
|
85
|
+
constructor(e, t, n) {
|
|
86
|
+
super(), this.label = e, this.id = t, this.selected = n;
|
|
87
|
+
}
|
|
88
|
+
eq(e) {
|
|
89
|
+
return e.label === this.label && e.id === this.id && e.selected === this.selected;
|
|
90
|
+
}
|
|
91
|
+
toDOM() {
|
|
92
|
+
let e = document.createElement("span");
|
|
93
|
+
e.className = "cm-md-mention-token", e.setAttribute("data-user", this.id), e.setAttribute("spellcheck", "false"), this.selected !== "none" && e.setAttribute("data-selected", this.selected);
|
|
94
|
+
let t = document.createElement("nldd-icon");
|
|
95
|
+
t.className = "cm-md-mention-token-icon", t.setAttribute("icon", "at"), t.setAttribute("aria-hidden", "true");
|
|
96
|
+
let n = document.createElement("span");
|
|
97
|
+
return n.className = "cm-md-mention-token-name", n.dataset.label = this.label, e.append(t, n), e;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
function Ke(e) {
|
|
101
|
+
let t = [], r = e.selection.main;
|
|
102
|
+
return n(e).iterate({ enter: (n) => {
|
|
103
|
+
if (Me.has(n.name)) return !1;
|
|
104
|
+
if (n.name !== "Link") return;
|
|
105
|
+
let i = n.node, a = i.getChild("URL");
|
|
106
|
+
if (!a || !D(e, i)) return;
|
|
107
|
+
let o = Le(i);
|
|
108
|
+
if (!o) return;
|
|
109
|
+
let s = Ve(e.sliceDoc(o.from, o.to).replace(/^@/, "")), c = He(e.sliceDoc(a.from, a.to).slice(5)), l = We(r, i.from, i.to);
|
|
110
|
+
t.push(d.replace({ widget: new Ge(s, c, l) }).range(i.from, i.to));
|
|
111
|
+
} }), d.set(t, !0);
|
|
112
|
+
}
|
|
113
|
+
function qe(e, t, n) {
|
|
114
|
+
let r = !1;
|
|
115
|
+
return e.between(0, 1e9, (e, i) => {
|
|
116
|
+
if (We(t, e, i) !== We(n, e, i)) return r = !0, !1;
|
|
117
|
+
}), r;
|
|
118
|
+
}
|
|
119
|
+
var Je = b.define({
|
|
120
|
+
create: (e) => Ke(e),
|
|
121
|
+
update: (e, t) => t.docChanged || w(t.startState, t.state) ? Ke(t.state) : t.startState.selection.eq(t.state.selection) ? e : qe(e, t.startState.selection.main, t.state.selection.main) ? Ke(t.state) : e,
|
|
122
|
+
provide: (e) => t.decorations.from(e)
|
|
123
|
+
}), Ye = t.atomicRanges.of((e) => e.state.field(Je, !1) ?? d.none), Xe = [v.highest(Je), Ye];
|
|
124
|
+
function Ze(e, t, n) {
|
|
125
|
+
return C(e, t, n, (t) => t.name === "Link" && D(e, t));
|
|
126
|
+
}
|
|
127
|
+
function Qe(e, t) {
|
|
128
|
+
let n = Ze(e, t, 1);
|
|
129
|
+
return n ? {
|
|
130
|
+
from: n.from,
|
|
131
|
+
to: n.to
|
|
132
|
+
} : null;
|
|
133
|
+
}
|
|
134
|
+
function $e(e, t) {
|
|
135
|
+
let n = Ze(e, t, -1);
|
|
136
|
+
return n && n.to === t ? {
|
|
137
|
+
from: n.from,
|
|
138
|
+
to: n.to
|
|
139
|
+
} : null;
|
|
140
|
+
}
|
|
141
|
+
function et(e, t) {
|
|
142
|
+
let n = Ze(e, t, 1);
|
|
143
|
+
return n && n.from === t ? {
|
|
144
|
+
from: n.from,
|
|
145
|
+
to: n.to
|
|
146
|
+
} : null;
|
|
147
|
+
}
|
|
148
|
+
function tt(e, t) {
|
|
149
|
+
let n = e.state.selection.main;
|
|
150
|
+
if (!n.empty) return !1;
|
|
151
|
+
let r = t < 0 ? $e(e.state, n.head) : et(e.state, n.head);
|
|
152
|
+
return r ? (e.dispatch({ selection: {
|
|
153
|
+
anchor: r.from,
|
|
154
|
+
head: r.to
|
|
155
|
+
} }), !0) : !1;
|
|
156
|
+
}
|
|
157
|
+
// src/components/inputs/text-editor/text-editor.caret.ts
|
|
158
|
+
function nt(e) {
|
|
159
|
+
let n = t.findFromDOM(e);
|
|
160
|
+
if (!n) return null;
|
|
161
|
+
let r = n.posAtDOM(e);
|
|
162
|
+
if (r <= n.state.doc.lineAt(r).from) return null;
|
|
163
|
+
try {
|
|
164
|
+
let e = n.coordsAtPos(r - 1, 1);
|
|
165
|
+
return e ? {
|
|
166
|
+
top: e.top,
|
|
167
|
+
bottom: e.bottom
|
|
168
|
+
} : null;
|
|
169
|
+
} catch {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// src/components/inputs/text-editor/text-editor.links.ts
|
|
174
|
+
var rt = class extends f {
|
|
175
|
+
constructor(e, t) {
|
|
176
|
+
super(), this.href = e, this.ariaLabel = t(e);
|
|
177
|
+
}
|
|
178
|
+
eq(e) {
|
|
179
|
+
return e.href === this.href && e.ariaLabel === this.ariaLabel;
|
|
180
|
+
}
|
|
181
|
+
toDOM() {
|
|
182
|
+
let e = document.createElement("a");
|
|
183
|
+
e.className = "cm-link-badge", e.href = this.href, e.target = "_blank", e.rel = "noopener noreferrer", e.setAttribute("aria-label", this.ariaLabel);
|
|
184
|
+
let t = document.createElement("nldd-icon");
|
|
185
|
+
return t.setAttribute("icon", "external-link"), t.setAttribute("aria-hidden", "true"), e.append(t), e.addEventListener("mousedown", (e) => e.preventDefault()), e;
|
|
186
|
+
}
|
|
187
|
+
ignoreEvent() {
|
|
188
|
+
return !0;
|
|
189
|
+
}
|
|
190
|
+
coordsAt(e, t, n) {
|
|
191
|
+
let r = e.getBoundingClientRect(), i = nt(e) ?? {
|
|
192
|
+
top: r.top,
|
|
193
|
+
bottom: r.bottom
|
|
194
|
+
}, a = getComputedStyle(e), o = n < 0 ? r.left - parseFloat(a.marginLeft) : r.right + parseFloat(a.marginRight);
|
|
195
|
+
return {
|
|
196
|
+
left: o,
|
|
197
|
+
right: o,
|
|
198
|
+
top: i.top,
|
|
199
|
+
bottom: i.bottom
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
function it(e) {
|
|
204
|
+
return e.replace(/^\[|\]$/g, "").trim().replace(/\s+/g, " ").toLowerCase();
|
|
205
|
+
}
|
|
206
|
+
function at(e) {
|
|
207
|
+
let t = /* @__PURE__ */ new Map();
|
|
208
|
+
return n(e).iterate({ enter: (n) => {
|
|
209
|
+
if (n.name !== "LinkReference") return;
|
|
210
|
+
let r = null, i = null;
|
|
211
|
+
for (let t = n.node.firstChild; t; t = t.nextSibling) t.name === "LinkLabel" ? r = it(e.sliceDoc(t.from, t.to)) : t.name === "URL" && (i = e.sliceDoc(t.from, t.to));
|
|
212
|
+
r && i && !t.has(r) && t.set(r, i);
|
|
213
|
+
} }), t;
|
|
214
|
+
}
|
|
215
|
+
function ot(e) {
|
|
216
|
+
let t = e.replace(/[\u0000-\u0020\u007f-\u009f]/g, "");
|
|
217
|
+
return !/^[a-z][a-z0-9+.-]*:/i.test(t) || /^(?:https?|mailto|tel):/i.test(t);
|
|
218
|
+
}
|
|
219
|
+
function st(e, t, n) {
|
|
220
|
+
let r = null;
|
|
221
|
+
for (let n = t.firstChild; n; n = n.nextSibling) {
|
|
222
|
+
if (n.name === "URL") {
|
|
223
|
+
let t = e.sliceDoc(n.from, n.to);
|
|
224
|
+
return t && !E(t) && ot(t) ? t : null;
|
|
225
|
+
}
|
|
226
|
+
n.name === "LinkLabel" && (r = it(e.sliceDoc(n.from, n.to)));
|
|
227
|
+
}
|
|
228
|
+
if (r) {
|
|
229
|
+
let e = n().get(r);
|
|
230
|
+
return e && !E(e) && ot(e) ? e : null;
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
function O(e) {
|
|
235
|
+
for (let t = e.parent; t; t = t.parent) if (t.name === "Link" || t.name === "LinkReference" || t.name === "Image") return !0;
|
|
236
|
+
return !1;
|
|
237
|
+
}
|
|
238
|
+
function ct(e, t) {
|
|
239
|
+
let n = e.sliceDoc(t.from, t.to);
|
|
240
|
+
if (!n || E(n)) return null;
|
|
241
|
+
let r = n;
|
|
242
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(n) || (/^www\./i.test(n) ? r = `https://${n}` : /^[^\s@]+@[^\s@]+$/.test(n) && (r = `mailto:${n}`)), ot(r) ? r : null;
|
|
243
|
+
}
|
|
244
|
+
function lt(e, t) {
|
|
245
|
+
let r = new _(), i = n(e.state), a = null, o = () => a ?? (a = at(e.state)), s = (e, n) => r.add(e, e, d.widget({
|
|
246
|
+
widget: new rt(n, t),
|
|
247
|
+
side: -1
|
|
248
|
+
}));
|
|
249
|
+
for (let { from: t, to: n } of e.visibleRanges) i.iterate({
|
|
250
|
+
from: t,
|
|
251
|
+
to: n,
|
|
252
|
+
enter: (t) => {
|
|
253
|
+
if (t.name === "Link") {
|
|
254
|
+
let n = st(e.state, t.node, o);
|
|
255
|
+
n && s(t.to, n);
|
|
256
|
+
} else if (t.name === "URL" && !O(t.node)) {
|
|
257
|
+
let n = ct(e.state, t.node);
|
|
258
|
+
n && s(t.to, n);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
return r.finish();
|
|
263
|
+
}
|
|
264
|
+
function ut(e) {
|
|
265
|
+
return u.fromClass(class {
|
|
266
|
+
constructor(t) {
|
|
267
|
+
this.decorations = lt(t, e);
|
|
268
|
+
}
|
|
269
|
+
update(t) {
|
|
270
|
+
(t.docChanged || t.viewportChanged || w(t.startState, t.state) || t.transactions.some((e) => e.effects.some((e) => e.is(Ae)))) && (this.decorations = lt(t.view, e));
|
|
271
|
+
}
|
|
272
|
+
}, { decorations: (e) => e.decorations });
|
|
273
|
+
}
|
|
274
|
+
function dt(e, t) {
|
|
275
|
+
let n = null;
|
|
276
|
+
return C(e, t, -1, (r) => r.to === t ? r.name === "Link" ? st(e, r, () => n ?? (n = at(e))) !== null : r.name === "URL" && !O(r) && ct(e, r) !== null : !1) !== null;
|
|
277
|
+
}
|
|
278
|
+
function ft(e, t) {
|
|
279
|
+
return C(e, t, -1, (n) => n.name === "URL" && n.to === t && !O(n) && ct(e, n) !== null) !== null;
|
|
280
|
+
}
|
|
281
|
+
// src/components/inputs/text-editor/text-editor.emphasis.ts
|
|
282
|
+
var k = /* @__PURE__ */ new Map([
|
|
283
|
+
["StrongEmphasis", "**"],
|
|
284
|
+
["Emphasis", "*"],
|
|
285
|
+
["Strikethrough", "~~"]
|
|
286
|
+
]), pt = /* @__PURE__ */ new Set([
|
|
287
|
+
"Paragraph",
|
|
288
|
+
"ATXHeading1",
|
|
289
|
+
"ATXHeading2",
|
|
290
|
+
"ATXHeading3",
|
|
291
|
+
"ATXHeading4",
|
|
292
|
+
"ATXHeading5",
|
|
293
|
+
"ATXHeading6",
|
|
294
|
+
"SetextHeading1",
|
|
295
|
+
"SetextHeading2",
|
|
296
|
+
"TableCell"
|
|
297
|
+
]), mt = /^\s*(?:\n\s*(?:(?:[-*+]|\d+[.)]|>|\[[ xX]\])\s*)*)*$/, ht = y.define({ map: (e, t) => ({
|
|
298
|
+
...e,
|
|
299
|
+
from: t.mapPos(e.from, 1),
|
|
300
|
+
to: t.mapPos(e.to, -1)
|
|
301
|
+
}) });
|
|
302
|
+
function gt(e, t, n) {
|
|
303
|
+
return C(e, t, n, (e) => k.has(e.name));
|
|
304
|
+
}
|
|
305
|
+
function _t(e, t) {
|
|
306
|
+
return T(e, t, 1, pt);
|
|
307
|
+
}
|
|
308
|
+
function vt(e) {
|
|
309
|
+
let { from: t, to: n } = e.selection.main, r = gt(e, t, -1), i = r && gt(e, n, 1);
|
|
310
|
+
if (!r || !i || r.from !== i.from || r.to !== i.to) return null;
|
|
311
|
+
let a = k.get(r.name).length;
|
|
312
|
+
return {
|
|
313
|
+
from: r.from,
|
|
314
|
+
to: r.to,
|
|
315
|
+
name: r.name,
|
|
316
|
+
marker: e.sliceDoc(r.from, r.from + a),
|
|
317
|
+
live: !0
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function yt(e, t) {
|
|
321
|
+
let n = t.marker.length, { from: r, to: i } = e.selection.main;
|
|
322
|
+
if (r < t.from + n || i > t.to - n) return !1;
|
|
323
|
+
let a = e.sliceDoc(t.from, t.to);
|
|
324
|
+
if (a.length < 2 * n || !a.startsWith(t.marker) || !a.endsWith(t.marker)) return !1;
|
|
325
|
+
let o = _t(e, t.from);
|
|
326
|
+
if (!o || o.to < t.to) return !1;
|
|
327
|
+
let s = gt(e, t.from, 1);
|
|
328
|
+
return !(s && s.name === t.name && s.from === t.from);
|
|
329
|
+
}
|
|
330
|
+
function bt(e, t) {
|
|
331
|
+
return {
|
|
332
|
+
...e,
|
|
333
|
+
from: t.changes.mapPos(e.from, 1),
|
|
334
|
+
to: t.changes.mapPos(e.to, -1)
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
var A = b.define({
|
|
338
|
+
create: (e) => vt(e),
|
|
339
|
+
update(e, t) {
|
|
340
|
+
if (e) {
|
|
341
|
+
let n = bt({
|
|
342
|
+
...e,
|
|
343
|
+
live: !1
|
|
344
|
+
}, t);
|
|
345
|
+
if (yt(t.state, n)) return n;
|
|
346
|
+
}
|
|
347
|
+
let n = vt(t.state);
|
|
348
|
+
if (n) return n;
|
|
349
|
+
let r = t.effects.find((e) => e.is(ht));
|
|
350
|
+
return r ? {
|
|
351
|
+
...r.value,
|
|
352
|
+
live: !1
|
|
353
|
+
} : null;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
function xt(e, t) {
|
|
357
|
+
let n = t.marker.length, r = e.sliceDoc(t.from, t.to);
|
|
358
|
+
if (r.length < 2 * n || !r.startsWith(t.marker) || !r.endsWith(t.marker)) return null;
|
|
359
|
+
let i = r.slice(n, r.length - n), a = /^\s*/.exec(i)[0].length, o = _t(e, t.from), s = e.sliceDoc(t.from + n, Math.min(t.to - n, o ? o.to : t.to - n)), c = t.from + n + s.replace(/\s+$/, "").length;
|
|
360
|
+
if (c <= t.from + n + a) return null;
|
|
361
|
+
let l = t.to - n - c;
|
|
362
|
+
return !a && !l || !mt.test(e.sliceDoc(c, t.to - n)) ? null : {
|
|
363
|
+
from: t.from,
|
|
364
|
+
to: t.to,
|
|
365
|
+
len: n,
|
|
366
|
+
lead: a,
|
|
367
|
+
trail: l
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function St(e, t) {
|
|
371
|
+
let n = [];
|
|
372
|
+
return t.lead && n.push({
|
|
373
|
+
from: t.from,
|
|
374
|
+
insert: e.sliceDoc(t.from + t.len, t.from + t.len + t.lead)
|
|
375
|
+
}, {
|
|
376
|
+
from: t.from + t.len,
|
|
377
|
+
to: t.from + t.len + t.lead
|
|
378
|
+
}), t.trail && n.push({
|
|
379
|
+
from: t.to - t.len - t.trail,
|
|
380
|
+
to: t.to - t.len
|
|
381
|
+
}, {
|
|
382
|
+
from: t.to,
|
|
383
|
+
insert: e.sliceDoc(t.to - t.len - t.trail, t.to - t.len)
|
|
384
|
+
}), n;
|
|
385
|
+
}
|
|
386
|
+
function Ct(e, t, n) {
|
|
387
|
+
let r = t.from + t.len + t.lead, i = t.to - t.len - t.trail;
|
|
388
|
+
if (t.lead) {
|
|
389
|
+
if (e > t.from && e < t.from + t.len) return e + t.lead;
|
|
390
|
+
if (e >= t.from + t.len && e < r) return n ? r : e - t.len;
|
|
391
|
+
}
|
|
392
|
+
if (t.trail) {
|
|
393
|
+
if (e > i && e <= t.to - t.len) return n ? i : e + t.len;
|
|
394
|
+
if (e > t.to - t.len && e < t.to) return e - t.trail;
|
|
395
|
+
}
|
|
396
|
+
return e;
|
|
397
|
+
}
|
|
398
|
+
function wt(e, t, n) {
|
|
399
|
+
let r = xt(e, t);
|
|
400
|
+
if (!r) return null;
|
|
401
|
+
let i = e.selection;
|
|
402
|
+
return {
|
|
403
|
+
changes: St(e, r),
|
|
404
|
+
selection: p.create(i.ranges.map((e) => p.range(Ct(e.anchor, r, n), Ct(e.head, r, n))), i.mainIndex),
|
|
405
|
+
userEvent: "input.emphasis"
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function Tt(e, t) {
|
|
409
|
+
let n = xt(e, t);
|
|
410
|
+
return n ? St(e, n) : [];
|
|
411
|
+
}
|
|
412
|
+
function Et(e) {
|
|
413
|
+
let t = e.state.field(A, !1);
|
|
414
|
+
if (!t || t.live || e.state.readOnly) return;
|
|
415
|
+
let n = wt(e.state, t, !0);
|
|
416
|
+
n && e.dispatch(n);
|
|
417
|
+
}
|
|
418
|
+
var Dt = [A, u.fromClass(class {
|
|
419
|
+
constructor(e) {
|
|
420
|
+
this.view = e, this.pending = null, this.destroyed = !1;
|
|
421
|
+
}
|
|
422
|
+
update(e) {
|
|
423
|
+
this.pending && (this.pending = bt(this.pending, e));
|
|
424
|
+
let t = e.startState.field(A);
|
|
425
|
+
if (!t) return;
|
|
426
|
+
let n = bt(t, e), r = e.state.field(A);
|
|
427
|
+
r && r.name === n.name && r.from === n.from && r.to === n.to || (this.pending = n, queueMicrotask(() => this.flush()));
|
|
428
|
+
}
|
|
429
|
+
flush() {
|
|
430
|
+
let e = this.pending;
|
|
431
|
+
if (this.pending = null, !e || this.destroyed || this.view.state.readOnly) return;
|
|
432
|
+
let t = wt(this.view.state, e, !1);
|
|
433
|
+
t && this.view.dispatch(t);
|
|
434
|
+
}
|
|
435
|
+
destroy() {
|
|
436
|
+
this.destroyed = !0;
|
|
437
|
+
}
|
|
438
|
+
})], Ot = {
|
|
439
|
+
ATXHeading1: "cm-md-h1",
|
|
440
|
+
ATXHeading2: "cm-md-h2",
|
|
441
|
+
ATXHeading3: "cm-md-h3",
|
|
442
|
+
ATXHeading4: "cm-md-h4",
|
|
443
|
+
ATXHeading5: "cm-md-h5",
|
|
444
|
+
ATXHeading6: "cm-md-h6",
|
|
445
|
+
StrongEmphasis: "cm-md-strong",
|
|
446
|
+
Emphasis: "cm-md-emphasis",
|
|
447
|
+
Strikethrough: "cm-md-strike",
|
|
448
|
+
InlineCode: "cm-md-code",
|
|
449
|
+
URL: "cm-md-url",
|
|
450
|
+
Blockquote: "cm-md-quote"
|
|
451
|
+
}, kt = /* @__PURE__ */ new Set([
|
|
452
|
+
"HeaderMark",
|
|
453
|
+
"EmphasisMark",
|
|
454
|
+
"StrikethroughMark",
|
|
455
|
+
"CodeMark",
|
|
456
|
+
"QuoteMark",
|
|
457
|
+
"ListMark",
|
|
458
|
+
"LinkMark"
|
|
459
|
+
]), At = d.mark({ class: "cm-md-mark" }), jt = d.line({ class: "cm-md-quote-row" }), Mt = {};
|
|
460
|
+
function j(e) {
|
|
461
|
+
return Mt[e] ?? (Mt[e] = d.mark({
|
|
462
|
+
class: e,
|
|
463
|
+
inclusiveEnd: !0
|
|
464
|
+
}));
|
|
465
|
+
}
|
|
466
|
+
var Nt = d.line({ class: "cm-md-codeblock" }), Pt = d.line({ class: "cm-md-codeblock-first" }), Ft = d.line({ class: "cm-md-codeblock-last" }), It = d.line({ class: "cm-md-codeblock-line-selected" });
|
|
467
|
+
function Lt(e, t, n, r) {
|
|
468
|
+
if (t.length === 0) return;
|
|
469
|
+
let i = e.doc.line(t[0]), a = e.doc.line(t[t.length - 1]), o = !n.empty && n.from <= i.from && n.to >= a.to;
|
|
470
|
+
t.forEach((i, a) => {
|
|
471
|
+
let s = e.doc.line(i);
|
|
472
|
+
if (r.push(Nt.range(s.from)), a === 0 && r.push(Pt.range(s.from)), a === t.length - 1 && r.push(Ft.range(s.from)), o) r.push(It.range(s.from));
|
|
473
|
+
else if (!n.empty) {
|
|
474
|
+
let e = Math.max(s.from, n.from), t = Math.min(s.to, n.to);
|
|
475
|
+
t > e && r.push(j("cm-md-codeblock-selected").range(e, t));
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function Rt(e, t, n, r, i) {
|
|
480
|
+
let a = e.doc.lineAt(t).number, o = e.doc.lineAt(Math.max(t, n - 1)).number, s = [];
|
|
481
|
+
for (let e = a; e <= o; e++) s.push(e);
|
|
482
|
+
Lt(e, s, r, i);
|
|
483
|
+
}
|
|
484
|
+
function zt(e, t, n, r) {
|
|
485
|
+
let i = /* @__PURE__ */ new Set();
|
|
486
|
+
for (let n = t.firstChild; n; n = n.nextSibling) n.name === "CodeMark" && i.add(e.doc.lineAt(n.from).number);
|
|
487
|
+
let a = e.doc.lineAt(t.from).number, o = e.doc.lineAt(Math.max(t.from, t.to - 1)).number, s = [];
|
|
488
|
+
for (let e = a; e <= o; e++) i.has(e) || s.push(e);
|
|
489
|
+
Lt(e, s, n, r);
|
|
490
|
+
}
|
|
491
|
+
function Bt(e, t, n) {
|
|
492
|
+
D(e, t) || n.push(j("cm-md-link").range(t.from, t.to));
|
|
493
|
+
}
|
|
494
|
+
function Vt(e) {
|
|
495
|
+
let t = [], r = e.state.selection.main;
|
|
496
|
+
for (let { from: i, to: a } of e.visibleRanges) n(e.state).iterate({
|
|
497
|
+
from: i,
|
|
498
|
+
to: a,
|
|
499
|
+
enter: (n) => {
|
|
500
|
+
if (n.from >= n.to) return;
|
|
501
|
+
if (n.name === "Link") {
|
|
502
|
+
Bt(e.state, n.node, t);
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (n.name === "FencedCode") {
|
|
506
|
+
zt(e.state, n.node, r, t);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (n.name === "CodeBlock") {
|
|
510
|
+
Rt(e.state, n.from, n.to, r, t);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
if (n.name === "URL" && !O(n.node)) {
|
|
514
|
+
t.push(j("cm-md-autolink").range(n.from, n.to));
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
n.name === "Blockquote" && n.node.parent?.name !== "Blockquote" && Fe(e.state, n.from, n.to, (e) => t.push(jt.range(e)));
|
|
518
|
+
let i = Ot[n.name];
|
|
519
|
+
if (i) {
|
|
520
|
+
if (i === "cm-md-code" && !r.empty && r.from <= n.from && r.to >= n.to) t.push(j("cm-md-code cm-md-code-selected").range(n.from, n.to));
|
|
521
|
+
else if (t.push(j(i).range(n.from, n.to)), !r.empty && i === "cm-md-code") {
|
|
522
|
+
let e = Math.max(n.from, r.from), i = Math.min(n.to, r.to), a = (e === n.from ? " cm-md-code-selected-start" : "") + (i === n.to ? " cm-md-code-selected-end" : "");
|
|
523
|
+
i > e && t.push(j(`cm-md-code-selected${a}`).range(e, i));
|
|
524
|
+
}
|
|
525
|
+
} else kt.has(n.name) && t.push(At.range(n.from, n.to));
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
let i = e.state.field(A, !1);
|
|
529
|
+
if (i && !i.live) {
|
|
530
|
+
let e = i.marker.length;
|
|
531
|
+
t.push(j(Ot[i.name]).range(i.from, i.to)), t.push(At.range(i.from, i.from + e), At.range(i.to - e, i.to));
|
|
532
|
+
}
|
|
533
|
+
return d.set(t, !0);
|
|
534
|
+
}
|
|
535
|
+
var Ht = u.fromClass(class {
|
|
536
|
+
constructor(e) {
|
|
537
|
+
this.decorations = Vt(e);
|
|
538
|
+
}
|
|
539
|
+
update(e) {
|
|
540
|
+
(e.docChanged || e.viewportChanged || e.selectionSet || w(e.startState, e.state)) && (this.decorations = Vt(e.view));
|
|
541
|
+
}
|
|
542
|
+
}, { decorations: (e) => e.decorations }), Ut = /^((?:[ \t]*(?:[-*+][ \t]+(?:\[[ xX]\][ \t]+)?|\d+[.)][ \t]+|>[ \t]?))+)/;
|
|
543
|
+
function Wt(e) {
|
|
544
|
+
return Ut.exec(e)?.[1].length ?? 0;
|
|
545
|
+
}
|
|
546
|
+
var Gt = d.mark({ class: "cm-md-listprefix" }), Kt = {};
|
|
547
|
+
function qt(e) {
|
|
548
|
+
return Kt[e] ?? (Kt[e] = d.line({ attributes: { style: `text-indent:calc(${e} * var(--_text-editor-marker-advance) * -1);padding-left:calc(${e} * var(--_text-editor-marker-advance))` } }));
|
|
549
|
+
}
|
|
550
|
+
function Jt(e) {
|
|
551
|
+
let t = [], n = 0;
|
|
552
|
+
for (let r = e.doc.iterLines(); !r.next().done;) {
|
|
553
|
+
let i = r.value, a = Ut.exec(i);
|
|
554
|
+
if (a && a[1].length && !Ne(e, n) && !Ie(e, n)) {
|
|
555
|
+
let e = a[1].length;
|
|
556
|
+
t.push(qt(e).range(n)), t.push(Gt.range(n, n + e));
|
|
557
|
+
}
|
|
558
|
+
n += i.length + 1;
|
|
559
|
+
}
|
|
560
|
+
return d.set(t, !0);
|
|
561
|
+
}
|
|
562
|
+
var Yt = b.define({
|
|
563
|
+
create: (e) => Jt(e),
|
|
564
|
+
update: (e, t) => t.docChanged || w(t.startState, t.state) ? Jt(t.state) : e,
|
|
565
|
+
provide: (e) => t.decorations.from(e)
|
|
566
|
+
}), Xt = [
|
|
567
|
+
ce({
|
|
568
|
+
extensions: le,
|
|
569
|
+
codeLanguages: te
|
|
570
|
+
}),
|
|
571
|
+
Ht,
|
|
572
|
+
Dt,
|
|
573
|
+
Yt,
|
|
574
|
+
Xe
|
|
575
|
+
], Zt = "[\\p{L}\\p{M}\\p{N}_.+-]*", Qt = /* @__PURE__ */ new Map();
|
|
576
|
+
function $t(e, t) {
|
|
577
|
+
if (e.length !== 1 || /[\s\p{L}\p{N}_]/u.test(e)) return null;
|
|
578
|
+
let n = `${e}\u0000${t}`;
|
|
579
|
+
if (Qt.has(n)) return Qt.get(n);
|
|
580
|
+
let r;
|
|
581
|
+
try {
|
|
582
|
+
r = RegExp(`(^|\\s)(${e.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&")})(${t})$`, "u");
|
|
583
|
+
} catch {
|
|
584
|
+
r = t === "[\\p{L}\\p{M}\\p{N}_.+-]*" ? null : $t(e, Zt);
|
|
585
|
+
}
|
|
586
|
+
return Qt.set(n, r), r;
|
|
587
|
+
}
|
|
588
|
+
function en(e) {
|
|
589
|
+
return e.some(({ query: e }) => {
|
|
590
|
+
if (e === void 0) return !1;
|
|
591
|
+
try {
|
|
592
|
+
return new RegExp(e, "u"), !1;
|
|
593
|
+
} catch {
|
|
594
|
+
return !0;
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function tn(e) {
|
|
599
|
+
let t = /* @__PURE__ */ new Map();
|
|
600
|
+
for (let n of e) {
|
|
601
|
+
let { trigger: e, query: r } = typeof n == "string" ? {
|
|
602
|
+
trigger: n,
|
|
603
|
+
query: void 0
|
|
604
|
+
} : n;
|
|
605
|
+
(!t.has(e) || t.get(e) === void 0 && r !== void 0) && t.set(e, r);
|
|
606
|
+
}
|
|
607
|
+
return Array.from(t, ([e, t]) => $t(e, t ?? "[\\p{L}\\p{M}\\p{N}_.+-]*")).filter((e) => e !== null);
|
|
608
|
+
}
|
|
609
|
+
function nn(e, t, n) {
|
|
610
|
+
let r = e.doc.lineAt(t), i = e.sliceDoc(r.from, t), a = null;
|
|
611
|
+
for (let e of tn(n)) {
|
|
612
|
+
let t = e.exec(i);
|
|
613
|
+
t && (!a || t.index + t[1].length > a.index + a[1].length) && (a = t);
|
|
614
|
+
}
|
|
615
|
+
if (!a) return null;
|
|
616
|
+
let o = r.from + a.index + a[1].length;
|
|
617
|
+
return Pe(e, o) ? null : {
|
|
618
|
+
from: o,
|
|
619
|
+
to: t,
|
|
620
|
+
query: a[3],
|
|
621
|
+
trigger: a[2]
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
function rn(e) {
|
|
625
|
+
return (t) => `${e}${t.text} `;
|
|
626
|
+
}
|
|
627
|
+
function an(e) {
|
|
628
|
+
let { candidate: t } = e;
|
|
629
|
+
if (t.avatar) {
|
|
630
|
+
let e = document.createElement("nldd-avatar");
|
|
631
|
+
return e.setAttribute("name", t.avatar.name ?? t.text), e.setAttribute("size", "32"), e.setAttribute("decorative", ""), t.avatar.initials && e.setAttribute("initials", t.avatar.initials), t.avatar.src && e.setAttribute("src", t.avatar.src), t.avatar.type && e.setAttribute("type", t.avatar.type), e;
|
|
632
|
+
}
|
|
633
|
+
if (t.icon) {
|
|
634
|
+
let e = document.createElement("nldd-icon");
|
|
635
|
+
return e.setAttribute("icon", t.icon), e.setAttribute("size", "20"), e.setAttribute("aria-hidden", "true"), e;
|
|
636
|
+
}
|
|
637
|
+
if (t.symbol) {
|
|
638
|
+
let e = document.createElement("span");
|
|
639
|
+
return e.className = "cm-nldd-symbol", e.textContent = t.symbol, e.setAttribute("aria-hidden", "true"), e;
|
|
640
|
+
}
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
function on(e) {
|
|
644
|
+
return e.candidate.avatar ? "cm-nldd-row-avatar" : "";
|
|
645
|
+
}
|
|
646
|
+
var M = y.define();
|
|
647
|
+
function sn(e, t, n) {
|
|
648
|
+
return async (r) => {
|
|
649
|
+
let i = e(), a = nn(r.state, r.pos, i);
|
|
650
|
+
if (!a) return null;
|
|
651
|
+
let o = i.filter((e) => e.trigger === a.trigger), s = await Promise.all(o.map((e) => e.source(a.query))), c = [];
|
|
652
|
+
s.forEach((e, n) => {
|
|
653
|
+
let r = o[n], i = r.insert ?? rn(a.trigger);
|
|
654
|
+
for (let n of e ?? []) c.push({
|
|
655
|
+
label: `${a.trigger}${n.text}`,
|
|
656
|
+
detail: n.supportingText,
|
|
657
|
+
candidate: n,
|
|
658
|
+
apply: (e, o, s, c) => {
|
|
659
|
+
let l = i(n);
|
|
660
|
+
e.dispatch({
|
|
661
|
+
changes: {
|
|
662
|
+
from: s,
|
|
663
|
+
to: c,
|
|
664
|
+
insert: l
|
|
665
|
+
},
|
|
666
|
+
selection: { anchor: s + l.length },
|
|
667
|
+
userEvent: "input.complete"
|
|
668
|
+
}), t({
|
|
669
|
+
typeahead: r,
|
|
670
|
+
trigger: a.trigger,
|
|
671
|
+
candidate: n,
|
|
672
|
+
from: s,
|
|
673
|
+
to: s + l.length
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
let l = c.length ? null : cn(o, a.query, n), u = r.view;
|
|
679
|
+
if (u && !r.aborted && u.state.doc === r.state.doc) {
|
|
680
|
+
let e = u.state.field(N, !1), t = l === null ? null : {
|
|
681
|
+
from: a.from,
|
|
682
|
+
text: l
|
|
683
|
+
};
|
|
684
|
+
(e?.text !== t?.text || e?.from !== t?.from) && u.dispatch({ effects: M.of(t) });
|
|
685
|
+
}
|
|
686
|
+
return c.length ? {
|
|
687
|
+
from: a.from,
|
|
688
|
+
filter: !1,
|
|
689
|
+
options: c
|
|
690
|
+
} : null;
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
function cn(e, t, n) {
|
|
694
|
+
for (let n of e) {
|
|
695
|
+
let e = n.emptyText?.(t);
|
|
696
|
+
if (e !== void 0) return e || null;
|
|
697
|
+
}
|
|
698
|
+
return n(t);
|
|
699
|
+
}
|
|
700
|
+
var N = b.define({
|
|
701
|
+
create: () => null,
|
|
702
|
+
update(e, t) {
|
|
703
|
+
for (let e of t.effects) if (e.is(M)) return e.value;
|
|
704
|
+
if (!e) return null;
|
|
705
|
+
if (t.docChanged && (e = {
|
|
706
|
+
...e,
|
|
707
|
+
from: t.changes.mapPos(e.from)
|
|
708
|
+
}), t.docChanged || t.selection) {
|
|
709
|
+
let n = t.state.selection.main.head, r = t.state.doc.lineAt(n);
|
|
710
|
+
if (e.from < r.from || e.from >= n) return null;
|
|
711
|
+
}
|
|
712
|
+
return e;
|
|
713
|
+
},
|
|
714
|
+
provide: (e) => s.from(e, (e) => e && {
|
|
715
|
+
pos: e.from,
|
|
716
|
+
above: !1,
|
|
717
|
+
create: () => {
|
|
718
|
+
let t = document.createElement("div");
|
|
719
|
+
return t.className = "cm-nldd-typeahead-empty", t.textContent = e.text, { dom: t };
|
|
720
|
+
}
|
|
721
|
+
})
|
|
722
|
+
}), ln = [
|
|
723
|
+
v.high(m.of([{
|
|
724
|
+
key: "Escape",
|
|
725
|
+
run: (e) => e.state.field(N, !1) ? (e.dispatch({ effects: M.of(null) }), !0) : !1
|
|
726
|
+
}])),
|
|
727
|
+
t.focusChangeEffect.of((e, t) => !t && e.field(N, !1) ? M.of(null) : null),
|
|
728
|
+
t.updateListener.of((e) => {
|
|
729
|
+
oe(e.state) === "active" && e.state.field(N, !1) && queueMicrotask(() => e.view.dispatch({ effects: M.of(null) }));
|
|
730
|
+
})
|
|
731
|
+
];
|
|
732
|
+
function un(e) {
|
|
733
|
+
return u.fromClass(class {
|
|
734
|
+
constructor(e) {
|
|
735
|
+
this.status = document.createElement("div"), this.status.className = "cm-nldd-typeahead-status", this.status.setAttribute("role", "status"), e.dom.append(this.status);
|
|
736
|
+
}
|
|
737
|
+
update(t) {
|
|
738
|
+
let n = oe(t.state);
|
|
739
|
+
if (n === "pending") return;
|
|
740
|
+
let r = t.state.field(N, !1), i = "";
|
|
741
|
+
r ? i = r.text : n === "active" && (i = e(ie(t.state).length)), this.status.textContent !== i && (this.status.textContent = i);
|
|
742
|
+
}
|
|
743
|
+
destroy() {
|
|
744
|
+
this.status.remove();
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
var P = 16;
|
|
749
|
+
function dn() {
|
|
750
|
+
let e = document.createElement("div");
|
|
751
|
+
e.popover = "manual", e.className = "cm-nldd-popups";
|
|
752
|
+
let t = () => {
|
|
753
|
+
let t = e.querySelector(".cm-tooltip") !== null;
|
|
754
|
+
if (t !== e.matches(":popover-open")) try {
|
|
755
|
+
t ? e.showPopover() : e.hidePopover();
|
|
756
|
+
} catch {}
|
|
757
|
+
}, n = u.define((n) => {
|
|
758
|
+
n.dom.appendChild(e);
|
|
759
|
+
let r = new MutationObserver(t);
|
|
760
|
+
return r.observe(e, {
|
|
761
|
+
childList: !0,
|
|
762
|
+
subtree: !0
|
|
763
|
+
}), { destroy() {
|
|
764
|
+
r.disconnect(), e.remove();
|
|
765
|
+
} };
|
|
766
|
+
});
|
|
767
|
+
return [ne({
|
|
768
|
+
parent: e,
|
|
769
|
+
tooltipSpace: () => ({
|
|
770
|
+
left: P,
|
|
771
|
+
top: P,
|
|
772
|
+
right: window.innerWidth - P,
|
|
773
|
+
bottom: window.innerHeight - P
|
|
774
|
+
})
|
|
775
|
+
}), n];
|
|
776
|
+
}
|
|
777
|
+
function fn(e, n, r = () => null, i = (e) => String(e)) {
|
|
778
|
+
let a = t.updateListener.of((t) => {
|
|
779
|
+
t.docChanged && oe(t.state) === null && t.transactions.some((e) => e.isUserEvent("delete")) && nn(t.state, t.state.selection.main.head, e()) && ae(t.view);
|
|
780
|
+
});
|
|
781
|
+
return [
|
|
782
|
+
dn(),
|
|
783
|
+
se({
|
|
784
|
+
override: [sn(e, n, r)],
|
|
785
|
+
icons: !1,
|
|
786
|
+
addToOptions: [{
|
|
787
|
+
position: 20,
|
|
788
|
+
render: an
|
|
789
|
+
}],
|
|
790
|
+
optionClass: on
|
|
791
|
+
}),
|
|
792
|
+
a,
|
|
793
|
+
N,
|
|
794
|
+
ln,
|
|
795
|
+
un(i)
|
|
796
|
+
];
|
|
797
|
+
}
|
|
798
|
+
// src/components/inputs/text-editor/text-editor.spellcheck.ts
|
|
799
|
+
var pn = g.define(), mn = /* @__PURE__ */ new Set([
|
|
800
|
+
"InlineCode",
|
|
801
|
+
"FencedCode",
|
|
802
|
+
"CodeBlock",
|
|
803
|
+
"URL",
|
|
804
|
+
"Autolink"
|
|
805
|
+
]);
|
|
806
|
+
function hn(e, t) {
|
|
807
|
+
return e.name === "Link" && D(t, e.node);
|
|
808
|
+
}
|
|
809
|
+
var gn = pn.of((e, t) => mn.has(e.name) || hn(e, t)), _n = d.mark({ attributes: { spellcheck: "false" } });
|
|
810
|
+
function vn(e) {
|
|
811
|
+
let t = e.state.facet(pn), r = new _(), i = n(e.state), a = -1;
|
|
812
|
+
for (let { from: n, to: o } of e.visibleRanges) i.iterate({
|
|
813
|
+
from: n,
|
|
814
|
+
to: o,
|
|
815
|
+
enter: (n) => {
|
|
816
|
+
if (t.some((t) => t(n, e.state))) return n.to > n.from && n.from >= a && (r.add(n.from, n.to, _n), a = n.to), !1;
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
return r.finish();
|
|
820
|
+
}
|
|
821
|
+
var yn = u.fromClass(class {
|
|
822
|
+
constructor(e) {
|
|
823
|
+
this.decorations = vn(e);
|
|
824
|
+
}
|
|
825
|
+
update(e) {
|
|
826
|
+
(e.docChanged || e.viewportChanged || w(e.startState, e.state)) && (this.decorations = vn(e.view));
|
|
827
|
+
}
|
|
828
|
+
}, { decorations: (e) => e.decorations }), bn = g.define({ combine: (e) => e.some(Boolean) }), xn = /* @__PURE__ */ new WeakMap(), Sn = t.domEventObservers({ keydown(e, t) {
|
|
829
|
+
let n = e.isTrusted && !e.isComposing && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey;
|
|
830
|
+
xn.set(t, n && (e.key === "Backspace" || e.key === "Delete") ? e.key : null);
|
|
831
|
+
} });
|
|
832
|
+
function Cn(e, t) {
|
|
833
|
+
let { node: n, offset: r } = e.domAtPos(t);
|
|
834
|
+
return n.nodeType === Node.TEXT_NODE ? {
|
|
835
|
+
node: n,
|
|
836
|
+
offset: r
|
|
837
|
+
} : null;
|
|
838
|
+
}
|
|
839
|
+
function wn(e, t) {
|
|
840
|
+
if (!e.state.facet(bn) || xn.get(e) !== t) return !1;
|
|
841
|
+
let { selection: n, doc: r } = e.state;
|
|
842
|
+
if (n.ranges.length > 1) return !1;
|
|
843
|
+
let { from: i, to: a, empty: o } = n.main, s = r.lineAt(i);
|
|
844
|
+
if (!/\S/.test(e.state.sliceDoc(s.from, i)) && !(t === "Delete" && o)) return !1;
|
|
845
|
+
let c = Cn(e, i);
|
|
846
|
+
if (!c) return !1;
|
|
847
|
+
if (!o) {
|
|
848
|
+
let t = Cn(e, a);
|
|
849
|
+
return t !== null && t.node === c.node && c.offset >= 1;
|
|
850
|
+
}
|
|
851
|
+
return t === "Backspace" ? c.offset >= 2 : c.offset >= 1 && c.offset <= c.node.length - 2;
|
|
852
|
+
}
|
|
853
|
+
function Tn() {
|
|
854
|
+
return [
|
|
855
|
+
t.contentAttributes.of({ spellcheck: "true" }),
|
|
856
|
+
gn,
|
|
857
|
+
v.highest(yn),
|
|
858
|
+
bn.of(!0),
|
|
859
|
+
Sn
|
|
860
|
+
];
|
|
861
|
+
}
|
|
862
|
+
function F(e) {
|
|
863
|
+
return e.includes("") ? e.split("").join("") : e;
|
|
864
|
+
}
|
|
865
|
+
function En(e) {
|
|
866
|
+
let t = [];
|
|
867
|
+
for (let n = e.indexOf(""); n !== -1; n = e.indexOf("", n + 1)) t.push(n);
|
|
868
|
+
return t;
|
|
869
|
+
}
|
|
870
|
+
function Dn(e, t) {
|
|
871
|
+
let n = e.indexOf(""), r = 0;
|
|
872
|
+
for (; n !== -1 && n < t;) r++, n = e.indexOf("", n + 1);
|
|
873
|
+
return r;
|
|
874
|
+
}
|
|
875
|
+
function I(e, t) {
|
|
876
|
+
return t - Dn(e, t);
|
|
877
|
+
}
|
|
878
|
+
function L(e, t) {
|
|
879
|
+
let n = t;
|
|
880
|
+
for (let t of e) t <= n && n++;
|
|
881
|
+
return n;
|
|
882
|
+
}
|
|
883
|
+
function On(e, t, n = Mn) {
|
|
884
|
+
let r = [];
|
|
885
|
+
for (let i of e) i.to <= i.from || (n(t, i.from, "start") && r.push({
|
|
886
|
+
pos: i.from,
|
|
887
|
+
kind: "start"
|
|
888
|
+
}), n(t, i.to, "end") && r.push({
|
|
889
|
+
pos: i.to,
|
|
890
|
+
kind: "end"
|
|
891
|
+
}));
|
|
892
|
+
return r;
|
|
893
|
+
}
|
|
894
|
+
function kn(e) {
|
|
895
|
+
let t = /* @__PURE__ */ new Map();
|
|
896
|
+
for (let n of e) t.set(n.pos, (t.get(n.pos) ?? 0) + 1);
|
|
897
|
+
return t;
|
|
898
|
+
}
|
|
899
|
+
function An(e, t, n = Mn) {
|
|
900
|
+
let r = kn(On(t, t.length ? F(e) : "", n)), i = [], a = 0, o = 0;
|
|
901
|
+
for (;;) {
|
|
902
|
+
let t = 0;
|
|
903
|
+
for (; a + t < e.length && e[a + t] === "";) t++;
|
|
904
|
+
let n = r.get(o) ?? 0;
|
|
905
|
+
if (t > n ? i.push({
|
|
906
|
+
from: a + n,
|
|
907
|
+
to: a + t
|
|
908
|
+
}) : n > t && i.push({
|
|
909
|
+
from: a + t,
|
|
910
|
+
to: a + t,
|
|
911
|
+
insert: "".repeat(n - t)
|
|
912
|
+
}), a += t, a >= e.length) return i;
|
|
913
|
+
a++, o++;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
var jn = /^(\s*)(#{1,6}\s|[-*+]\s|\d+[.)]\s|>|`{3,}|~{3,})/;
|
|
917
|
+
function Mn(e, t, n) {
|
|
918
|
+
let r = e.lastIndexOf("\n", t - 1) + 1, i = e.indexOf("\n", t) === -1 ? e.length : e.indexOf("\n", t), a = e.slice(r, i), o = a.match(jn);
|
|
919
|
+
return !(o && t < r + o[0].length || (a.slice(0, t - r).match(/~~/g) ?? []).length % 2 == 1);
|
|
920
|
+
}
|
|
921
|
+
// src/components/inputs/text-editor/text-editor.annotations.ts
|
|
922
|
+
var Nn = y.define(), R = y.define(), Pn = y.define(), Fn = y.define();
|
|
923
|
+
function In(e) {
|
|
924
|
+
return e.field(z, !1) ?? [];
|
|
925
|
+
}
|
|
926
|
+
function Ln(e, t) {
|
|
927
|
+
return e.map((e) => ({
|
|
928
|
+
id: e.id,
|
|
929
|
+
from: Math.max(0, Math.min(e.start, t)),
|
|
930
|
+
to: Math.max(0, Math.min(e.end, t))
|
|
931
|
+
})).filter((e) => e.to > e.from);
|
|
932
|
+
}
|
|
933
|
+
function Rn(e, t) {
|
|
934
|
+
return {
|
|
935
|
+
from: L(t, e.from),
|
|
936
|
+
to: L(t, e.to - 1) + 1
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
var z = b.define({
|
|
940
|
+
create: () => [],
|
|
941
|
+
update: (e, t) => {
|
|
942
|
+
let n = t.effects.find((e) => e.is(R));
|
|
943
|
+
return n ? n.value : e;
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
function zn(e) {
|
|
947
|
+
let t = [];
|
|
948
|
+
for (let n of [...e].sort((e, t) => e.from - t.from || e.to - t.to)) {
|
|
949
|
+
let e = t[t.length - 1];
|
|
950
|
+
e && n.from < e.to ? (e.to = Math.max(e.to, n.to), e.ids.push(n.id)) : t.push({
|
|
951
|
+
from: n.from,
|
|
952
|
+
to: n.to,
|
|
953
|
+
ids: [n.id]
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
return t;
|
|
957
|
+
}
|
|
958
|
+
var Bn = 40;
|
|
959
|
+
function Vn(e) {
|
|
960
|
+
return e.length > Bn ? `${e.slice(0, Bn)}…` : e;
|
|
961
|
+
}
|
|
962
|
+
var Hn = class extends f {
|
|
963
|
+
constructor(e, t, n) {
|
|
964
|
+
super(), this.ids = e, this.quote = t, this.ariaLabel = n(e.length, Vn(t));
|
|
965
|
+
}
|
|
966
|
+
eq(e) {
|
|
967
|
+
return e.quote === this.quote && e.ids.length === this.ids.length && e.ids.every((e, t) => e === this.ids[t]) && e.ariaLabel === this.ariaLabel;
|
|
968
|
+
}
|
|
969
|
+
toDOM() {
|
|
970
|
+
let e = document.createElement("button");
|
|
971
|
+
return e.className = "cm-annotation-badge", e.type = "button", e.dataset.annotations = this.ids.join(" "), e.textContent = String(this.ids.length), e.setAttribute("aria-label", this.ariaLabel), e;
|
|
972
|
+
}
|
|
973
|
+
coordsAt(e, t, n) {
|
|
974
|
+
let r = e.getBoundingClientRect(), i = getComputedStyle(e), a = nt(e) ?? {
|
|
975
|
+
top: r.top,
|
|
976
|
+
bottom: r.bottom
|
|
977
|
+
}, o = e.closest(".cm-annotation"), s = o ? o.getClientRects() : null, c = s && s.length ? s[s.length - 1] : null, l = t <= 0 ? r.left - parseFloat(i.marginLeft) : c ? c.right : r.right + parseFloat(i.marginRight);
|
|
978
|
+
return {
|
|
979
|
+
left: l,
|
|
980
|
+
right: l,
|
|
981
|
+
top: a.top,
|
|
982
|
+
bottom: a.bottom
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
}, Un = d.mark({
|
|
986
|
+
class: "cm-annotation",
|
|
987
|
+
inclusiveEnd: !0
|
|
988
|
+
}), Wn = d.mark({
|
|
989
|
+
class: "cm-annotation is-selected",
|
|
990
|
+
inclusiveEnd: !0
|
|
991
|
+
}), Gn = d.mark({ class: "is-selected" }), Kn = class e extends f {
|
|
992
|
+
eq(t) {
|
|
993
|
+
return t instanceof e;
|
|
994
|
+
}
|
|
995
|
+
toDOM() {
|
|
996
|
+
let e = document.createElement("span");
|
|
997
|
+
return e.className = "cm-annotation-start", e;
|
|
998
|
+
}
|
|
999
|
+
coordsAt(e, t, n) {
|
|
1000
|
+
let r = e.nextElementSibling;
|
|
1001
|
+
for (; r instanceof HTMLElement && r.classList.contains("cm-widgetBuffer");) r = r.nextElementSibling;
|
|
1002
|
+
if (!(r instanceof HTMLElement) || !r.classList.contains("cm-annotation")) return null;
|
|
1003
|
+
let i = parseFloat(getComputedStyle(r).paddingInlineStart || "0"), a = r.getClientRects()[0] ?? r.getBoundingClientRect(), o = nt(e) ?? {
|
|
1004
|
+
top: a.top,
|
|
1005
|
+
bottom: a.bottom
|
|
1006
|
+
}, s = t <= 0 ? a.left : a.left + i;
|
|
1007
|
+
return {
|
|
1008
|
+
left: s,
|
|
1009
|
+
right: s,
|
|
1010
|
+
top: o.top,
|
|
1011
|
+
bottom: o.bottom
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
}, qn = d.replace({ widget: new Kn() }), Jn = d.mark({}), Yn = d.mark({
|
|
1015
|
+
class: "cm-annotation-tail",
|
|
1016
|
+
inclusiveEnd: !0
|
|
1017
|
+
});
|
|
1018
|
+
function Xn(e, t, n) {
|
|
1019
|
+
let r = L(n, e.from), i = L(n, e.to - 1) + 1;
|
|
1020
|
+
return {
|
|
1021
|
+
docFrom: r,
|
|
1022
|
+
textTo: i,
|
|
1023
|
+
startSent: r - 1 >= 0 && t[r - 1] === "" ? r - 1 : null,
|
|
1024
|
+
endSent: i < t.length && t[i] === "" ? i : null
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
var Zn = {
|
|
1028
|
+
deco: d.none,
|
|
1029
|
+
atomic: d.none
|
|
1030
|
+
};
|
|
1031
|
+
function Qn(e, t) {
|
|
1032
|
+
if (!e.field(z).length) return Zn;
|
|
1033
|
+
let n = e.doc.toString(), r = e.selection.main, i = En(n), a = n.length - i.length, o = F(n), s = e.field(z).map((e) => ({
|
|
1034
|
+
id: e.id,
|
|
1035
|
+
from: Math.min(e.from, a),
|
|
1036
|
+
to: Math.min(e.to, a)
|
|
1037
|
+
})).filter((e) => e.to > e.from), c = [], l = [];
|
|
1038
|
+
for (let e of zn(s)) {
|
|
1039
|
+
if (e.to <= e.from) continue;
|
|
1040
|
+
let { docFrom: a, textTo: s, startSent: u, endSent: f } = Xn(e, n, i), p = o.slice(e.from, e.to), m = f === null ? s : s + 1, h = !r.empty && r.from <= a && r.to >= m;
|
|
1041
|
+
if (c.push((h ? Wn : Un).range(a, m)), !h && !r.empty) {
|
|
1042
|
+
let e = Math.max(a, r.from), t = Math.min(m, r.to);
|
|
1043
|
+
t > e && c.push(Gn.range(e, t));
|
|
1044
|
+
}
|
|
1045
|
+
let g = f === null ? s : f + 1, _ = n.slice(a, s).match(/\S+$/);
|
|
1046
|
+
_ && c.push(Yn.range(a + (_.index ?? 0), g)), f === null ? c.push(d.widget({
|
|
1047
|
+
widget: new Hn(e.ids, p, t),
|
|
1048
|
+
side: -1
|
|
1049
|
+
}).range(s)) : (c.push(d.replace({ widget: new Hn(e.ids, p, t) }).range(f, f + 1)), l.push(Jn.range(f, f + 1))), u !== null && (c.push(qn.range(u, u + 1)), l.push(Jn.range(u, u + 1)));
|
|
1050
|
+
}
|
|
1051
|
+
return {
|
|
1052
|
+
deco: d.set(c, !0),
|
|
1053
|
+
atomic: d.set(l, !0)
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
function $n(e) {
|
|
1057
|
+
return b.define({
|
|
1058
|
+
create: (t) => Qn(t, e),
|
|
1059
|
+
update: (t, n) => t === Zn && !n.state.field(z).length ? t : n.docChanged || !n.startState.selection.eq(n.state.selection) || n.effects.some((e) => e.is(Nn) || e.is(Ae)) ? Qn(n.state, e) : t,
|
|
1060
|
+
provide: (e) => t.decorations.from(e, (e) => e.deco)
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
var er = e.transactionFilter.of((e) => {
|
|
1064
|
+
let t = e.effects.find((e) => e.is(Nn));
|
|
1065
|
+
if (!e.docChanged && !t || !(t || e.effects.some((e) => e.is(Fn) || e.is(Pn))) && !(e.startState.field(z, !1) ?? []).length) return e;
|
|
1066
|
+
let n = e.newDoc.toString(), r = F(n).length, i;
|
|
1067
|
+
if (t) i = Ln(t.value, r);
|
|
1068
|
+
else {
|
|
1069
|
+
let t = En(e.startState.doc.toString()), a = e.effects.find((e) => e.is(Pn))?.value;
|
|
1070
|
+
i = (e.startState.field(z, !1) ?? []).map((r) => {
|
|
1071
|
+
if (a && r.from >= a.from && r.to <= a.to) return {
|
|
1072
|
+
id: r.id,
|
|
1073
|
+
from: a.insertAt + (r.from - a.from),
|
|
1074
|
+
to: a.insertAt + (r.to - a.from)
|
|
1075
|
+
};
|
|
1076
|
+
let i = Rn(r, t), o = e.changes.mapPos(i.from, -1), s = e.changes.mapPos(i.to, 1);
|
|
1077
|
+
return {
|
|
1078
|
+
id: r.id,
|
|
1079
|
+
from: I(n, o),
|
|
1080
|
+
to: I(n, s)
|
|
1081
|
+
};
|
|
1082
|
+
}).filter((e) => e.to > e.from);
|
|
1083
|
+
let o = e.effects.find((e) => e.is(Fn))?.value;
|
|
1084
|
+
o && (i = i.concat(o.anns.map((e) => ({
|
|
1085
|
+
id: e.id,
|
|
1086
|
+
from: Math.max(0, Math.min(o.at + e.from, r)),
|
|
1087
|
+
to: Math.max(0, Math.min(o.at + e.to, r))
|
|
1088
|
+
})).filter((e) => e.to > e.from)));
|
|
1089
|
+
}
|
|
1090
|
+
return [e, {
|
|
1091
|
+
changes: An(n, zn(i)),
|
|
1092
|
+
effects: [R.of(i)],
|
|
1093
|
+
sequential: !0
|
|
1094
|
+
}];
|
|
1095
|
+
}), tr = Ee.of((e) => {
|
|
1096
|
+
if (!e.effects.some((e) => e.is(R))) return [];
|
|
1097
|
+
let t = e.startState.field(z, !1) ?? [];
|
|
1098
|
+
return [R.of(t)];
|
|
1099
|
+
}), nr = [t.clipboardOutputFilter.of((e) => F(e)), t.clipboardInputFilter.of((e) => F(e))];
|
|
1100
|
+
function rr(e) {
|
|
1101
|
+
let n = $n(e), r = t.atomicRanges.of((e) => e.state.field(n).atomic);
|
|
1102
|
+
return [
|
|
1103
|
+
z,
|
|
1104
|
+
v.highest(n),
|
|
1105
|
+
r,
|
|
1106
|
+
er,
|
|
1107
|
+
tr,
|
|
1108
|
+
nr
|
|
1109
|
+
];
|
|
1110
|
+
}
|
|
1111
|
+
// src/components/inputs/text-editor/text-editor.clipboard.ts
|
|
1112
|
+
var ir = class {
|
|
1113
|
+
constructor() {
|
|
1114
|
+
this.cut = null;
|
|
1115
|
+
}
|
|
1116
|
+
annotationsInSelection(e) {
|
|
1117
|
+
let { from: t, to: n } = e.state.selection.main, r = e.state.doc.toString(), i = I(r, t), a = I(r, n);
|
|
1118
|
+
return In(e.state).filter((e) => e.from >= i && e.to <= a).map((e) => ({
|
|
1119
|
+
id: e.id,
|
|
1120
|
+
from: e.from - i,
|
|
1121
|
+
to: e.to - i
|
|
1122
|
+
}));
|
|
1123
|
+
}
|
|
1124
|
+
selectedText(e) {
|
|
1125
|
+
let { from: t, to: n } = e.state.selection.main;
|
|
1126
|
+
return F(e.state.sliceDoc(t, n));
|
|
1127
|
+
}
|
|
1128
|
+
rememberCut(e) {
|
|
1129
|
+
let { from: t, to: n } = e.state.selection.main;
|
|
1130
|
+
this.cut = t === n ? null : {
|
|
1131
|
+
text: this.selectedText(e),
|
|
1132
|
+
anns: this.annotationsInSelection(e)
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
forget() {
|
|
1136
|
+
this.cut = null;
|
|
1137
|
+
}
|
|
1138
|
+
paste(e, t) {
|
|
1139
|
+
let n = F(t);
|
|
1140
|
+
if (!n || e.state.readOnly) return;
|
|
1141
|
+
let r = this.cut, i = !!(r && ((e, t) => e.replace(/\r\n/g, "\n") === t.replace(/\r\n/g, "\n"))(r.text, n) && r.anns.length > 0), a = I(e.state.doc.toString(), e.state.selection.main.from), o = {
|
|
1142
|
+
...e.state.replaceSelection(n),
|
|
1143
|
+
userEvent: "input.paste"
|
|
1144
|
+
};
|
|
1145
|
+
e.dispatch(i ? {
|
|
1146
|
+
...o,
|
|
1147
|
+
effects: Fn.of({
|
|
1148
|
+
at: a,
|
|
1149
|
+
anns: r.anns
|
|
1150
|
+
})
|
|
1151
|
+
} : o), i && (this.cut = null);
|
|
1152
|
+
}
|
|
1153
|
+
}, ar = {
|
|
1154
|
+
bold: !1,
|
|
1155
|
+
italic: !1,
|
|
1156
|
+
inlineCode: !1,
|
|
1157
|
+
codeBlock: !1,
|
|
1158
|
+
strikethrough: !1,
|
|
1159
|
+
link: !1,
|
|
1160
|
+
bulletList: !1,
|
|
1161
|
+
orderedList: !1,
|
|
1162
|
+
taskList: !1,
|
|
1163
|
+
quote: !1,
|
|
1164
|
+
heading: 0
|
|
1165
|
+
};
|
|
1166
|
+
function B(e, t, n, r = 1) {
|
|
1167
|
+
return T(e.state, t, r, n);
|
|
1168
|
+
}
|
|
1169
|
+
function or(e, t, n) {
|
|
1170
|
+
let r = B(e, t, n, -1), i = B(e, t, n, 1);
|
|
1171
|
+
return r && i && r.from === i.from && r.to === i.to ? i : null;
|
|
1172
|
+
}
|
|
1173
|
+
function V(e, t, n) {
|
|
1174
|
+
if (e.state.readOnly) return;
|
|
1175
|
+
let { state: r } = e, i = t.length, a = r.field(A, !1);
|
|
1176
|
+
e.dispatch(r.changeByRange((o) => {
|
|
1177
|
+
let s = r.sliceDoc(o.from, o.to), c = /^\s*/.exec(s)[0].length;
|
|
1178
|
+
if (!o.empty && c === s.length) return { range: o };
|
|
1179
|
+
let l = o.from + c, u = o.to - /\s*$/.exec(s)[0].length, d = B(e, l, n) ?? (a && a.name === n && l >= a.from && u <= a.to ? a : null);
|
|
1180
|
+
if (d) {
|
|
1181
|
+
let e = r.sliceDoc(d.from + i, d.to - i);
|
|
1182
|
+
if (o.empty && l === d.to - i && e.trim()) {
|
|
1183
|
+
let e = {
|
|
1184
|
+
from: d.from,
|
|
1185
|
+
to: d.to,
|
|
1186
|
+
name: n,
|
|
1187
|
+
marker: r.sliceDoc(d.from, d.from + i),
|
|
1188
|
+
live: !1
|
|
1189
|
+
}, t = k.has(n) ? Tt(r, e) : [], a = d.to;
|
|
1190
|
+
for (; /[ \t]/.test(r.sliceDoc(a, a + 1));) a++;
|
|
1191
|
+
return {
|
|
1192
|
+
changes: t,
|
|
1193
|
+
range: p.cursor(a)
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
let t = r.changes([{
|
|
1197
|
+
from: d.from,
|
|
1198
|
+
to: d.from + i
|
|
1199
|
+
}, {
|
|
1200
|
+
from: d.to - i,
|
|
1201
|
+
to: d.to
|
|
1202
|
+
}]);
|
|
1203
|
+
return {
|
|
1204
|
+
changes: t,
|
|
1205
|
+
range: p.range(t.mapPos(o.anchor), t.mapPos(o.head))
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
return {
|
|
1209
|
+
changes: [{
|
|
1210
|
+
from: l,
|
|
1211
|
+
insert: t
|
|
1212
|
+
}, {
|
|
1213
|
+
from: u,
|
|
1214
|
+
insert: t
|
|
1215
|
+
}],
|
|
1216
|
+
range: p.range(l + i, u + i),
|
|
1217
|
+
effects: o.empty && o === r.selection.main && k.has(n) ? ht.of({
|
|
1218
|
+
from: l,
|
|
1219
|
+
to: l + 2 * i,
|
|
1220
|
+
name: n,
|
|
1221
|
+
marker: t
|
|
1222
|
+
}) : void 0
|
|
1223
|
+
};
|
|
1224
|
+
})), e.focus();
|
|
1225
|
+
}
|
|
1226
|
+
function sr(e, t) {
|
|
1227
|
+
let n = e.text;
|
|
1228
|
+
if (t === n) return null;
|
|
1229
|
+
let r = 0;
|
|
1230
|
+
for (; r < n.length && r < t.length && n[r] === t[r];) r++;
|
|
1231
|
+
let i = 0;
|
|
1232
|
+
for (; i < n.length - r && i < t.length - r && n[n.length - 1 - i] === t[t.length - 1 - i];) i++;
|
|
1233
|
+
return {
|
|
1234
|
+
from: e.from + r,
|
|
1235
|
+
to: e.from + n.length - i,
|
|
1236
|
+
insert: t.slice(r, t.length - i)
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
function cr(e, t) {
|
|
1240
|
+
if (t.length) {
|
|
1241
|
+
let { state: n } = e, r = n.changes(t), i = n.selection.main;
|
|
1242
|
+
e.dispatch({
|
|
1243
|
+
changes: r,
|
|
1244
|
+
selection: {
|
|
1245
|
+
anchor: r.mapPos(i.anchor, 1),
|
|
1246
|
+
head: r.mapPos(i.head, 1)
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
e.focus();
|
|
1251
|
+
}
|
|
1252
|
+
function H(e) {
|
|
1253
|
+
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n).number, a = t.doc.lineAt(r).number;
|
|
1254
|
+
return {
|
|
1255
|
+
first: i,
|
|
1256
|
+
last: a,
|
|
1257
|
+
loneBlank: i === a && t.doc.line(i).text.trim() === ""
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
function U(e, t) {
|
|
1261
|
+
if (e.state.readOnly) return;
|
|
1262
|
+
let { state: n } = e, { first: r, last: i } = H(e), a = [];
|
|
1263
|
+
for (let e = r; e <= i; e++) {
|
|
1264
|
+
let r = n.doc.line(e), i = sr(r, t(r.text));
|
|
1265
|
+
i && a.push(i);
|
|
1266
|
+
}
|
|
1267
|
+
cr(e, a);
|
|
1268
|
+
}
|
|
1269
|
+
function lr(e, t) {
|
|
1270
|
+
let { first: n, last: r } = H(e);
|
|
1271
|
+
for (let i = n; i <= r; i++) if (!t(e.state.doc.line(i).text)) return !1;
|
|
1272
|
+
return !0;
|
|
1273
|
+
}
|
|
1274
|
+
function ur(e, t) {
|
|
1275
|
+
U(e, (e) => {
|
|
1276
|
+
let n = e.match(/^(#{1,6})\s+/), r = n ? n[1].length : 0, i = n ? e.slice(n[0].length) : e;
|
|
1277
|
+
return t === 0 || r === t ? i : `${"#".repeat(t)} ${i}`;
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
function dr(e, t) {
|
|
1281
|
+
U(e, (e) => {
|
|
1282
|
+
let n = e.replace(/^#{1,6}\s+/, "");
|
|
1283
|
+
return t === 0 ? n : `${"#".repeat(t)} ${n}`;
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
function fr(e) {
|
|
1287
|
+
let t = /^(\s*)[-*+]\s+/, { loneBlank: n } = H(e), r = !n && lr(e, (e) => t.test(e) || e.trim() === "");
|
|
1288
|
+
U(e, (e) => e.trim() === "" && !n ? e : r ? e.replace(t, "$1") : t.test(e) ? e : e.replace(/^(\s*)/, "$1- "));
|
|
1289
|
+
}
|
|
1290
|
+
var W = /^(\s*)[-*+]\s+\[[ xX]\]\s+/;
|
|
1291
|
+
function pr(e) {
|
|
1292
|
+
let { loneBlank: t } = H(e), n = !t && lr(e, (e) => W.test(e) || e.trim() === "");
|
|
1293
|
+
U(e, (e) => e.trim() === "" && !t ? e : n ? e.replace(W, "$1- ") : W.test(e) ? e : e.replace(G, "$1").replace(/^(\s*)/, "$1- [ ] "));
|
|
1294
|
+
}
|
|
1295
|
+
var G = /^(\s*)(?:[-*+]|\d+[.)])(?:\s+|$)/, mr = /^(\s*)\[[ xX]\]\s+/;
|
|
1296
|
+
function hr(e, t) {
|
|
1297
|
+
if (e.state.readOnly) return;
|
|
1298
|
+
let { state: n } = e, { first: r, last: i, loneBlank: a } = H(e), o = [], s = 0;
|
|
1299
|
+
for (let e = r; e <= i; e++) {
|
|
1300
|
+
let r = n.doc.line(e), i = r.text.replace(G, t === "none" ? "" : "$1"), c = i !== r.text, l = c ? i.replace(mr, t === "none" ? "" : "$1") : i, u = l;
|
|
1301
|
+
if (t !== "none" && (l.trim() !== "" || c || a)) {
|
|
1302
|
+
s += 1;
|
|
1303
|
+
let e = t === "bullet" ? "- " : t === "task" ? "- [ ] " : `${s}. `;
|
|
1304
|
+
u = l.replace(/^(\s*)/, `$1${e}`);
|
|
1305
|
+
}
|
|
1306
|
+
let d = sr(r, u);
|
|
1307
|
+
d && o.push(d);
|
|
1308
|
+
}
|
|
1309
|
+
cr(e, o);
|
|
1310
|
+
}
|
|
1311
|
+
function gr(e, t, n) {
|
|
1312
|
+
for (let r = t - 1; r >= 1; r--) {
|
|
1313
|
+
let t = e.doc.line(r).text;
|
|
1314
|
+
if (t.trim() === "") continue;
|
|
1315
|
+
let i = t.match(G);
|
|
1316
|
+
if (!i) return null;
|
|
1317
|
+
if (n(i[1].length)) return i;
|
|
1318
|
+
}
|
|
1319
|
+
return null;
|
|
1320
|
+
}
|
|
1321
|
+
function _r(e) {
|
|
1322
|
+
if (e.state.readOnly) return;
|
|
1323
|
+
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n).number, a = t.doc.lineAt(r).number, o = [];
|
|
1324
|
+
for (let e = i; e <= a; e++) {
|
|
1325
|
+
let n = t.doc.line(e), r = n.text.match(G);
|
|
1326
|
+
if (!r) continue;
|
|
1327
|
+
let i = r[1].length, a = gr(t, e, (e) => e <= i)?.[0].length ?? -1;
|
|
1328
|
+
a > i && o.push({
|
|
1329
|
+
from: n.from,
|
|
1330
|
+
insert: " ".repeat(a - i)
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
o.length && e.dispatch({ changes: o }), e.focus();
|
|
1334
|
+
}
|
|
1335
|
+
function vr(e) {
|
|
1336
|
+
if (e.state.readOnly) return;
|
|
1337
|
+
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n).number, a = t.doc.lineAt(r).number, o = [];
|
|
1338
|
+
for (let e = i; e <= a; e++) {
|
|
1339
|
+
let n = t.doc.line(e), r = n.text.match(G);
|
|
1340
|
+
if (!r) continue;
|
|
1341
|
+
let i = r[1].length;
|
|
1342
|
+
if (i === 0) continue;
|
|
1343
|
+
let a = gr(t, e, (e) => e < i)?.[1].length ?? 0;
|
|
1344
|
+
o.push({
|
|
1345
|
+
from: n.from,
|
|
1346
|
+
to: n.from + (i - a)
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
o.length && e.dispatch({ changes: o }), e.focus();
|
|
1350
|
+
}
|
|
1351
|
+
function yr(e) {
|
|
1352
|
+
let { state: t } = e, n = t.doc.lineAt(t.selection.main.head), r = n.text.match(G);
|
|
1353
|
+
if (!r) return !1;
|
|
1354
|
+
let i = r[1].length, a = gr(t, n.number, (e) => e <= i);
|
|
1355
|
+
return a !== null && a[0].length > i;
|
|
1356
|
+
}
|
|
1357
|
+
function br(e) {
|
|
1358
|
+
let t = e.state.doc.lineAt(e.state.selection.main.head).text.match(G);
|
|
1359
|
+
return !!t && t[1].length > 0;
|
|
1360
|
+
}
|
|
1361
|
+
function xr(e) {
|
|
1362
|
+
if (e.state.readOnly) return !0;
|
|
1363
|
+
let { state: t } = e, n = t.selection.main;
|
|
1364
|
+
if (!n.empty) return !1;
|
|
1365
|
+
let r = t.doc.lineAt(n.head), i = r.text.match(/^(\s*)(?:\d+[.)]|[-*+])\s/);
|
|
1366
|
+
if (!i || n.head !== r.from + i[0].length || Ne(t, r.from)) return !1;
|
|
1367
|
+
let a = r.from + i[1].length;
|
|
1368
|
+
return e.dispatch({
|
|
1369
|
+
changes: {
|
|
1370
|
+
from: a,
|
|
1371
|
+
to: r.from + i[0].length
|
|
1372
|
+
},
|
|
1373
|
+
selection: { anchor: a },
|
|
1374
|
+
userEvent: "delete.backward"
|
|
1375
|
+
}), !0;
|
|
1376
|
+
}
|
|
1377
|
+
function Sr(e) {
|
|
1378
|
+
let t = /^(\s*)>\s?/, n = lr(e, (e) => t.test(e) || e.trim() === "");
|
|
1379
|
+
U(e, (e) => e.trim() === "" ? e : n ? e.replace(t, "$1") : t.test(e) ? e : e.replace(/^(\s*)/, "$1> "));
|
|
1380
|
+
}
|
|
1381
|
+
function Cr(e, t) {
|
|
1382
|
+
let n = B(e, t, "Link");
|
|
1383
|
+
return n && !D(e.state, n) ? n : null;
|
|
1384
|
+
}
|
|
1385
|
+
function wr(e, t = "") {
|
|
1386
|
+
if (e.state.readOnly) return;
|
|
1387
|
+
let n = Cr(e, e.state.selection.main.head);
|
|
1388
|
+
if (n) {
|
|
1389
|
+
let t = e.state.sliceDoc(n.from, n.to).replace(/^\[(.*)\]\([^)]*\)$/, "$1");
|
|
1390
|
+
e.dispatch({
|
|
1391
|
+
changes: {
|
|
1392
|
+
from: n.from,
|
|
1393
|
+
to: n.to,
|
|
1394
|
+
insert: t
|
|
1395
|
+
},
|
|
1396
|
+
selection: p.range(n.from, n.from + t.length)
|
|
1397
|
+
}), e.focus();
|
|
1398
|
+
} else e.dispatch(e.state.changeByRange((n) => {
|
|
1399
|
+
let r = e.state.sliceDoc(n.from, n.to), i = `[${r}](${t})`, a;
|
|
1400
|
+
return a = r ? t ? n.from + i.length : n.from + 1 + r.length + 2 : n.from + 1, {
|
|
1401
|
+
changes: {
|
|
1402
|
+
from: n.from,
|
|
1403
|
+
to: n.to,
|
|
1404
|
+
insert: i
|
|
1405
|
+
},
|
|
1406
|
+
range: p.cursor(a)
|
|
1407
|
+
};
|
|
1408
|
+
})), e.focus();
|
|
1409
|
+
}
|
|
1410
|
+
function Tr(e) {
|
|
1411
|
+
if (e.state.readOnly) return;
|
|
1412
|
+
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n), a = t.doc.lineAt(r), o = i.number > 1 ? t.doc.line(i.number - 1) : null, s = a.number < t.doc.lines ? t.doc.line(a.number + 1) : null;
|
|
1413
|
+
o?.text.trim().startsWith("```") && s?.text.trim().startsWith("```") && o && s ? e.dispatch({ changes: [{
|
|
1414
|
+
from: o.from,
|
|
1415
|
+
to: i.from
|
|
1416
|
+
}, {
|
|
1417
|
+
from: a.to,
|
|
1418
|
+
to: s.to
|
|
1419
|
+
}] }) : e.dispatch({ changes: [{
|
|
1420
|
+
from: i.from,
|
|
1421
|
+
insert: "```\n"
|
|
1422
|
+
}, {
|
|
1423
|
+
from: a.to,
|
|
1424
|
+
insert: "\n```"
|
|
1425
|
+
}] }), e.focus();
|
|
1426
|
+
}
|
|
1427
|
+
function Er(e) {
|
|
1428
|
+
let { state: t } = e, n = t.selection.main.head, r = t.field(A, !1), i = (t) => or(e, n, t) !== null || r?.name === t, a = t.doc.lineAt(n).text, o = t.doc.lineAt(n).from, s = a.match(/^(#{1,6})\s/), c = Ne(t, o);
|
|
1429
|
+
return {
|
|
1430
|
+
bold: i("StrongEmphasis"),
|
|
1431
|
+
italic: i("Emphasis"),
|
|
1432
|
+
inlineCode: i("InlineCode"),
|
|
1433
|
+
codeBlock: c,
|
|
1434
|
+
strikethrough: i("Strikethrough"),
|
|
1435
|
+
link: Cr(e, n) !== null,
|
|
1436
|
+
bulletList: !c && /^\s*[-*+]\s/.test(a) && !Ie(t, o),
|
|
1437
|
+
orderedList: !c && /^\s*\d+[.)]\s/.test(a),
|
|
1438
|
+
taskList: !c && W.test(a),
|
|
1439
|
+
quote: B(e, o, "Blockquote") !== null,
|
|
1440
|
+
heading: c || !s ? 0 : s[1].length
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
// src/components/inputs/text-editor/text-editor.keymap.ts
|
|
1444
|
+
var Dr = [v.highest(m.of([{
|
|
1445
|
+
key: "Backspace",
|
|
1446
|
+
run: xr
|
|
1447
|
+
}])), m.of([
|
|
1448
|
+
{
|
|
1449
|
+
key: "Mod-b",
|
|
1450
|
+
run: (e) => (V(e, "**", "StrongEmphasis"), !0)
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
key: "Mod-i",
|
|
1454
|
+
run: (e) => (V(e, "*", "Emphasis"), !0)
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
key: "Mod-e",
|
|
1458
|
+
run: (e) => (V(e, "`", "InlineCode"), !0)
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
key: "Mod-k",
|
|
1462
|
+
run: (e) => (wr(e), !0)
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
key: "Backspace",
|
|
1466
|
+
run: (e) => tt(e, -1)
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
key: "Delete",
|
|
1470
|
+
run: (e) => tt(e, 1)
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
key: "Mod-]",
|
|
1474
|
+
run: (e) => (_r(e), !0)
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
key: "Mod-[",
|
|
1478
|
+
run: (e) => (vr(e), !0)
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
key: "Backspace",
|
|
1482
|
+
run: (e) => !wn(e, "Backspace") && Te(e),
|
|
1483
|
+
shift: Te
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
key: "Delete",
|
|
1487
|
+
run: (e) => !wn(e, "Delete") && xe(e)
|
|
1488
|
+
},
|
|
1489
|
+
...Ce.filter((e) => e.key !== "Backspace" && e.key !== "Delete"),
|
|
1490
|
+
...we
|
|
1491
|
+
])], Or = /^(\s*)(\d+)[.)](?=\s|$)/, kr = /^(?:[ ]{0,3}>[ ]?)*/, Ar = /^\s*(?:```|~~~)/, jr = 1e3;
|
|
1492
|
+
function Mr(e) {
|
|
1493
|
+
let t = [], n = [], r = 0, i = !1, a = 0;
|
|
1494
|
+
for (let o of e.split("\n")) {
|
|
1495
|
+
let e = r;
|
|
1496
|
+
if (r += o.length + 1, Ar.test(o)) {
|
|
1497
|
+
i = !i, n.length = 0, a = 0;
|
|
1498
|
+
continue;
|
|
1499
|
+
}
|
|
1500
|
+
if (i) continue;
|
|
1501
|
+
let s = kr.exec(o)[0], c = o.slice(s.length), l = (s.match(/>/g) ?? []).length, u = Or.exec(c);
|
|
1502
|
+
if (!u) {
|
|
1503
|
+
if (c.trim() === "") {
|
|
1504
|
+
++a >= 2 && (n.length = 0);
|
|
1505
|
+
continue;
|
|
1506
|
+
}
|
|
1507
|
+
a = 0;
|
|
1508
|
+
let e = l * jr + /^\s*/.exec(c)[0].length;
|
|
1509
|
+
for (; n.length && n[n.length - 1].indent >= e;) n.pop();
|
|
1510
|
+
continue;
|
|
1511
|
+
}
|
|
1512
|
+
a = 0;
|
|
1513
|
+
let d = u[1].length, f = l * jr + d, p = u[2];
|
|
1514
|
+
for (; n.length && n[n.length - 1].indent > f;) n.pop();
|
|
1515
|
+
let m = n[n.length - 1], h;
|
|
1516
|
+
m && m.indent === f ? (h = m.next, m.next += 1) : (h = 1, n.push({
|
|
1517
|
+
indent: f,
|
|
1518
|
+
next: 2
|
|
1519
|
+
}));
|
|
1520
|
+
let g = String(h);
|
|
1521
|
+
if (g !== p) {
|
|
1522
|
+
let n = e + s.length + d;
|
|
1523
|
+
t.push({
|
|
1524
|
+
from: n,
|
|
1525
|
+
to: n + p.length,
|
|
1526
|
+
insert: g
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
return t;
|
|
1531
|
+
}
|
|
1532
|
+
function Nr(e) {
|
|
1533
|
+
let t = !1;
|
|
1534
|
+
return e.changes.iterChanges((n, r, i, a, o) => {
|
|
1535
|
+
if (t) return;
|
|
1536
|
+
let s = e.startState.doc;
|
|
1537
|
+
if (o.lines > 1 || s.lineAt(n).number !== s.lineAt(r).number) {
|
|
1538
|
+
t = !0;
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
let c = (e) => Or.test(e.slice(kr.exec(e)[0].length));
|
|
1542
|
+
(c(s.lineAt(n).text) || c(e.newDoc.lineAt(i).text) || c(e.newDoc.lineAt(a).text)) && (t = !0);
|
|
1543
|
+
}), t;
|
|
1544
|
+
}
|
|
1545
|
+
var Pr = e.transactionFilter.of((e) => {
|
|
1546
|
+
if (!e.docChanged || !Nr(e)) return e;
|
|
1547
|
+
let t = Mr(e.newDoc.toString());
|
|
1548
|
+
return t.length === 0 ? e : [e, {
|
|
1549
|
+
changes: t,
|
|
1550
|
+
sequential: !0
|
|
1551
|
+
}];
|
|
1552
|
+
}), Fr = y.define(), K = b.define({
|
|
1553
|
+
create: () => null,
|
|
1554
|
+
update(e, t) {
|
|
1555
|
+
for (let e of t.effects) if (e.is(Fr)) return e.value;
|
|
1556
|
+
return e === null ? null : t.changes.mapPos(e);
|
|
1557
|
+
}
|
|
1558
|
+
}), Ir = class {
|
|
1559
|
+
constructor(e) {
|
|
1560
|
+
this.view = e, this.cursor = null, this.readPos = () => {
|
|
1561
|
+
let e = this.view.state.field(K);
|
|
1562
|
+
if (e === null) return null;
|
|
1563
|
+
let t = this.view.coordsAtPos(e, 1);
|
|
1564
|
+
if (!t) return null;
|
|
1565
|
+
let n = this.view.scrollDOM.getBoundingClientRect();
|
|
1566
|
+
return {
|
|
1567
|
+
left: t.left - n.left + this.view.scrollDOM.scrollLeft,
|
|
1568
|
+
top: t.top - n.top + this.view.scrollDOM.scrollTop,
|
|
1569
|
+
height: t.bottom - t.top
|
|
1570
|
+
};
|
|
1571
|
+
}, this.drawCursor = (e) => {
|
|
1572
|
+
e ? (this.cursor || (this.cursor = document.createElement("div"), this.cursor.className = "cm-drag-and-drop-cursor", this.view.scrollDOM.appendChild(this.cursor)), this.cursor.style.left = `${e.left}px`, this.cursor.style.top = `${e.top}px`, this.cursor.style.height = `${e.height}px`) : this.remove();
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
update(e) {
|
|
1576
|
+
let t = e.state.field(K);
|
|
1577
|
+
t === null ? this.remove() : (e.startState.field(K) !== t || e.docChanged || e.geometryChanged) && this.view.requestMeasure({
|
|
1578
|
+
read: this.readPos,
|
|
1579
|
+
write: this.drawCursor
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
remove() {
|
|
1583
|
+
this.cursor?.remove(), this.cursor = null;
|
|
1584
|
+
}
|
|
1585
|
+
destroy() {
|
|
1586
|
+
this.remove();
|
|
1587
|
+
}
|
|
1588
|
+
}, Lr = u.fromClass(Ir), Rr = class {
|
|
1589
|
+
constructor(e) {
|
|
1590
|
+
this.view = e, this.state = null, this.ghost = null, this.onMove = (e) => {
|
|
1591
|
+
let t = this.state;
|
|
1592
|
+
if (!t) return;
|
|
1593
|
+
if (!t.dragging) {
|
|
1594
|
+
if (Math.abs(e.clientX - t.startX) + Math.abs(e.clientY - t.startY) < 4) return;
|
|
1595
|
+
t.dragging = !0, this.view.scrollDOM.style.cursor = "default", this.showGhost(t.from, t.to);
|
|
1596
|
+
}
|
|
1597
|
+
this.moveGhost(e.clientX, e.clientY);
|
|
1598
|
+
let n = this.isInside(e.clientX, e.clientY) ? this.view.posAtCoords({
|
|
1599
|
+
x: e.clientX,
|
|
1600
|
+
y: e.clientY
|
|
1601
|
+
}) : null, r = n === null || n >= t.from && n <= t.to ? null : n;
|
|
1602
|
+
this.view.dispatch({ effects: Fr.of(r) });
|
|
1603
|
+
}, this.onUp = (e) => {
|
|
1604
|
+
this.removeListeners(), this.view.scrollDOM.style.cursor = "", this.clearGhost();
|
|
1605
|
+
let t = this.state;
|
|
1606
|
+
if (this.state = null, this.view.dispatch({ effects: Fr.of(null) }), !t) return;
|
|
1607
|
+
let n = this.view.posAtCoords({
|
|
1608
|
+
x: e.clientX,
|
|
1609
|
+
y: e.clientY
|
|
1610
|
+
});
|
|
1611
|
+
if (!t.dragging) !t.isMention && n !== null && this.view.dispatch({ selection: { anchor: n } }), this.view.focus();
|
|
1612
|
+
else {
|
|
1613
|
+
if (this.isInside(e.clientX, e.clientY) && n !== null && (n < t.from || n > t.to)) {
|
|
1614
|
+
let e = this.view.state.doc.toString(), r = F(this.view.state.sliceDoc(t.from, t.to)), i = n > t.to ? n - (t.to - t.from) : n, a = I(e, t.from), o = I(e, t.to), s = I(e, n), c = s > o ? s - (o - a) : s;
|
|
1615
|
+
this.view.dispatch({
|
|
1616
|
+
changes: [{
|
|
1617
|
+
from: t.from,
|
|
1618
|
+
to: t.to
|
|
1619
|
+
}, {
|
|
1620
|
+
from: n,
|
|
1621
|
+
insert: r
|
|
1622
|
+
}],
|
|
1623
|
+
selection: {
|
|
1624
|
+
anchor: i,
|
|
1625
|
+
head: i + r.length
|
|
1626
|
+
},
|
|
1627
|
+
effects: Pn.of({
|
|
1628
|
+
from: a,
|
|
1629
|
+
to: o,
|
|
1630
|
+
insertAt: c
|
|
1631
|
+
})
|
|
1632
|
+
});
|
|
1633
|
+
} else this.view.dispatch({ selection: {
|
|
1634
|
+
anchor: t.from,
|
|
1635
|
+
head: t.to
|
|
1636
|
+
} });
|
|
1637
|
+
this.view.focus();
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
start(e) {
|
|
1642
|
+
if (e.button !== 0 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey || e.detail >= 2 || this.view.state.readOnly || e.target?.closest?.(".cm-md-mention-token")) return !1;
|
|
1643
|
+
let t = this.view.state.selection.main;
|
|
1644
|
+
if (t.empty) return !1;
|
|
1645
|
+
let n = this.view.posAtCoords({
|
|
1646
|
+
x: e.clientX,
|
|
1647
|
+
y: e.clientY
|
|
1648
|
+
});
|
|
1649
|
+
return n === null || n < t.from || n > t.to ? !1 : (this.state = {
|
|
1650
|
+
startX: e.clientX,
|
|
1651
|
+
startY: e.clientY,
|
|
1652
|
+
from: t.from,
|
|
1653
|
+
to: t.to,
|
|
1654
|
+
dragging: !1,
|
|
1655
|
+
isMention: !1
|
|
1656
|
+
}, window.addEventListener("mousemove", this.onMove, !0), window.addEventListener("mouseup", this.onUp, !0), e.preventDefault(), !0);
|
|
1657
|
+
}
|
|
1658
|
+
startFor(e, t, n) {
|
|
1659
|
+
this.view.state.readOnly || (this.state = {
|
|
1660
|
+
startX: e.clientX,
|
|
1661
|
+
startY: e.clientY,
|
|
1662
|
+
from: t,
|
|
1663
|
+
to: n,
|
|
1664
|
+
dragging: !1,
|
|
1665
|
+
isMention: !0
|
|
1666
|
+
}, window.addEventListener("pointermove", this.onMove, !0), window.addEventListener("pointerup", this.onUp, !0));
|
|
1667
|
+
}
|
|
1668
|
+
removeListeners() {
|
|
1669
|
+
window.removeEventListener("mousemove", this.onMove, !0), window.removeEventListener("mouseup", this.onUp, !0), window.removeEventListener("pointermove", this.onMove, !0), window.removeEventListener("pointerup", this.onUp, !0);
|
|
1670
|
+
}
|
|
1671
|
+
isInside(e, t) {
|
|
1672
|
+
let n = this.view.scrollDOM.getBoundingClientRect();
|
|
1673
|
+
return e >= n.left && e <= n.right && t >= n.top && t <= n.bottom;
|
|
1674
|
+
}
|
|
1675
|
+
showGhost(e, t) {
|
|
1676
|
+
let n = document.createElement("div");
|
|
1677
|
+
n.className = "cm-drag-ghost", n.textContent = F(this.view.state.sliceDoc(e, t)).replace(Ue, "$1"), this.view.dom.appendChild(n), this.ghost = n;
|
|
1678
|
+
}
|
|
1679
|
+
moveGhost(e, t) {
|
|
1680
|
+
this.ghost && (this.ghost.style.left = `${e + 12}px`, this.ghost.style.top = `${t + 12}px`);
|
|
1681
|
+
}
|
|
1682
|
+
clearGhost() {
|
|
1683
|
+
this.ghost?.remove(), this.ghost = null;
|
|
1684
|
+
}
|
|
1685
|
+
destroy() {
|
|
1686
|
+
this.removeListeners(), this.clearGhost();
|
|
1687
|
+
}
|
|
1688
|
+
}, zr = u.fromClass(Rr, { eventHandlers: { mousedown(e) {
|
|
1689
|
+
return this.start(e);
|
|
1690
|
+
} } }), Br = [
|
|
1691
|
+
K,
|
|
1692
|
+
Lr,
|
|
1693
|
+
zr
|
|
1694
|
+
], Vr = 2, q = /* @__PURE__ */ new WeakMap(), Hr = o.define(), J = /* @__PURE__ */ new WeakMap();
|
|
1695
|
+
function Ur(e, t) {
|
|
1696
|
+
let n = e.coordsAtPos(t, -1), r = e.coordsAtPos(t, 1);
|
|
1697
|
+
return n && r ? {
|
|
1698
|
+
before: n,
|
|
1699
|
+
after: r
|
|
1700
|
+
} : null;
|
|
1701
|
+
}
|
|
1702
|
+
var Wr = 8;
|
|
1703
|
+
function Gr(e) {
|
|
1704
|
+
return Math.abs(e.before.top - e.after.top) < Wr;
|
|
1705
|
+
}
|
|
1706
|
+
function Kr(e, t, n) {
|
|
1707
|
+
let r = Ur(e, t);
|
|
1708
|
+
if (r && Gr(r) && Math.abs(r.before.left - r.after.left) <= Vr) return 1;
|
|
1709
|
+
let i = q.get(e);
|
|
1710
|
+
if (i && i.head === t) {
|
|
1711
|
+
if (i.side !== "pointer") return i.side;
|
|
1712
|
+
let t = J.get(e);
|
|
1713
|
+
if (t && r) return Math.abs(t.x - r.before.left) <= Math.abs(t.x - r.after.left) ? -1 : 1;
|
|
1714
|
+
}
|
|
1715
|
+
return n && n < 0 ? -1 : 1;
|
|
1716
|
+
}
|
|
1717
|
+
var qr = t.domEventHandlers({
|
|
1718
|
+
mousedown(e, t) {
|
|
1719
|
+
return J.set(t, {
|
|
1720
|
+
x: e.clientX,
|
|
1721
|
+
y: e.clientY
|
|
1722
|
+
}), !1;
|
|
1723
|
+
},
|
|
1724
|
+
mousemove(e, t) {
|
|
1725
|
+
return e.buttons && J.set(t, {
|
|
1726
|
+
x: e.clientX,
|
|
1727
|
+
y: e.clientY
|
|
1728
|
+
}), !1;
|
|
1729
|
+
},
|
|
1730
|
+
touchstart(e, t) {
|
|
1731
|
+
let n = e.touches[0];
|
|
1732
|
+
return n && J.set(t, {
|
|
1733
|
+
x: n.clientX,
|
|
1734
|
+
y: n.clientY
|
|
1735
|
+
}), !1;
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
function Y(e) {
|
|
1739
|
+
return (t) => {
|
|
1740
|
+
let { main: n } = t.state.selection;
|
|
1741
|
+
return !n.empty || !dt(t.state, n.head) || !Ur(t, n.head) || Kr(t, n.head, n.assoc) === e ? !1 : (t.dispatch({
|
|
1742
|
+
selection: p.cursor(n.head, e),
|
|
1743
|
+
annotations: Hr.of(e),
|
|
1744
|
+
userEvent: "select"
|
|
1745
|
+
}), !0);
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
var Jr = v.high(m.of([
|
|
1749
|
+
{
|
|
1750
|
+
key: "ArrowLeft",
|
|
1751
|
+
run: Y(-1)
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
key: "ArrowRight",
|
|
1755
|
+
run: Y(1)
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
key: "Backspace",
|
|
1759
|
+
run: Y(-1)
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
key: "Delete",
|
|
1763
|
+
run: Y(1)
|
|
1764
|
+
}
|
|
1765
|
+
])), Yr = /^[\s<?!.,:*_~)]/, Xr = t.inputHandler.of((e, t, n, r) => {
|
|
1766
|
+
if (t !== n || !r || e.composing || Yr.test(r)) return !1;
|
|
1767
|
+
let { main: i } = e.state.selection;
|
|
1768
|
+
return !i.empty || i.head !== t || !ft(e.state, t) || !Ur(e, t) || Kr(e, t, i.assoc) !== 1 ? !1 : (e.dispatch({
|
|
1769
|
+
changes: {
|
|
1770
|
+
from: t,
|
|
1771
|
+
insert: ` ${r}`
|
|
1772
|
+
},
|
|
1773
|
+
selection: { anchor: t + 1 + r.length },
|
|
1774
|
+
userEvent: "input.type",
|
|
1775
|
+
scrollIntoView: !0
|
|
1776
|
+
}), !0);
|
|
1777
|
+
}), Zr = [
|
|
1778
|
+
i({
|
|
1779
|
+
above: !0,
|
|
1780
|
+
class: "cm-nldd-cursorLayer",
|
|
1781
|
+
markers(e) {
|
|
1782
|
+
let { state: t } = e, n = c(t), r = [];
|
|
1783
|
+
for (let i of t.selection.ranges) {
|
|
1784
|
+
if (!i.empty && !n.drawRangeCursor) continue;
|
|
1785
|
+
let a = i === t.selection.main ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary", o = p.cursor(i.head, Kr(e, i.head, i.assoc));
|
|
1786
|
+
r.push(...l.forRange(e, a, o));
|
|
1787
|
+
}
|
|
1788
|
+
return r;
|
|
1789
|
+
},
|
|
1790
|
+
update(e, t) {
|
|
1791
|
+
if (e.docChanged || e.selectionSet) {
|
|
1792
|
+
let { view: t } = e, n = e.state.selection.main.head, r = q.get(t), i = r ? {
|
|
1793
|
+
...r,
|
|
1794
|
+
head: e.changes.mapPos(r.head)
|
|
1795
|
+
} : null, a = e.startState.selection.main.head;
|
|
1796
|
+
for (let t of e.transactions) {
|
|
1797
|
+
let r = t.annotation(Hr);
|
|
1798
|
+
if (r) i = {
|
|
1799
|
+
head: n,
|
|
1800
|
+
side: r
|
|
1801
|
+
};
|
|
1802
|
+
else if (t.isUserEvent("select.pointer")) i = {
|
|
1803
|
+
head: n,
|
|
1804
|
+
side: "pointer"
|
|
1805
|
+
};
|
|
1806
|
+
else if (t.isUserEvent("input") || t.isUserEvent("delete.backward")) {
|
|
1807
|
+
let r = t.isUserEvent("input") && ft(e.state, n);
|
|
1808
|
+
i = {
|
|
1809
|
+
head: n,
|
|
1810
|
+
side: dt(e.state, n) && !dt(e.startState, a) && !r ? 1 : -1
|
|
1811
|
+
};
|
|
1812
|
+
} else t.isUserEvent("delete.forward") ? i = {
|
|
1813
|
+
head: n,
|
|
1814
|
+
side: 1
|
|
1815
|
+
} : t.selection && (i = null);
|
|
1816
|
+
}
|
|
1817
|
+
i ? q.set(t, i) : q.delete(t);
|
|
1818
|
+
}
|
|
1819
|
+
return e.transactions.some((e) => e.selection) && (t.style.animationName = t.style.animationName === "cm-blink" ? "cm-blink2" : "cm-blink"), e.docChanged || e.selectionSet;
|
|
1820
|
+
},
|
|
1821
|
+
mount(e, t) {
|
|
1822
|
+
e.style.animationDuration = `${c(t.state).cursorBlinkRate}ms`;
|
|
1823
|
+
}
|
|
1824
|
+
}),
|
|
1825
|
+
qr,
|
|
1826
|
+
Jr,
|
|
1827
|
+
Xr
|
|
1828
|
+
], Qr = 200;
|
|
1829
|
+
function $r() {
|
|
1830
|
+
let n = 0, r = 0, i = () => (r = Date.now(), !1);
|
|
1831
|
+
return [t.domEventHandlers({
|
|
1832
|
+
focus: () => (n = Date.now(), !1),
|
|
1833
|
+
keydown: i,
|
|
1834
|
+
pointerdown: i,
|
|
1835
|
+
touchstart: i
|
|
1836
|
+
}), e.transactionFilter.of((e) => {
|
|
1837
|
+
if (e.docChanged || !e.selection || !e.isUserEvent("select") || e.isUserEvent("select.pointer") || Date.now() - n > Qr || r >= n) return e;
|
|
1838
|
+
let t = e.startState.selection.main, i = e.selection.main;
|
|
1839
|
+
if (t.from === 0 || i.from !== 0) return e;
|
|
1840
|
+
let a = i.anchor === 0 ? i.head : i.anchor;
|
|
1841
|
+
return a !== t.anchor && a !== t.head ? e : {
|
|
1842
|
+
selection: e.startState.selection,
|
|
1843
|
+
userEvent: "select"
|
|
1844
|
+
};
|
|
1845
|
+
})];
|
|
1846
|
+
}
|
|
1847
|
+
// src/components/inputs/text-editor/text-editor.tasks.ts
|
|
1848
|
+
var ei = g.define({ combine: (e) => e[0] ?? {
|
|
1849
|
+
open: () => "Taak, open",
|
|
1850
|
+
done: () => "Taak, afgerond"
|
|
1851
|
+
} }), ti = class extends f {
|
|
1852
|
+
constructor(e, t) {
|
|
1853
|
+
super(), this.checked = e, this.label = t;
|
|
1854
|
+
}
|
|
1855
|
+
eq(e) {
|
|
1856
|
+
return e.checked === this.checked && e.label === this.label;
|
|
1857
|
+
}
|
|
1858
|
+
toDOM() {
|
|
1859
|
+
let e = document.createElement("span");
|
|
1860
|
+
e.className = "cm-md-task-box", this.checked && e.setAttribute("data-checked", "");
|
|
1861
|
+
let t = document.createElement("nldd-icon");
|
|
1862
|
+
t.className = "cm-md-task-box-icon", t.setAttribute("icon", this.checked ? "check-mark-square" : "square"), t.setAttribute("aria-hidden", "true");
|
|
1863
|
+
let n = document.createElement("span");
|
|
1864
|
+
return n.className = "cm-md-task-box-label", n.textContent = this.label, e.append(t, n), e;
|
|
1865
|
+
}
|
|
1866
|
+
ignoreEvent() {
|
|
1867
|
+
return !1;
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
function ni(e, t) {
|
|
1871
|
+
let n = e.facet(ei);
|
|
1872
|
+
return d.replace({ widget: new ti(t, t ? n.done() : n.open()) });
|
|
1873
|
+
}
|
|
1874
|
+
function ri(e) {
|
|
1875
|
+
let t = [];
|
|
1876
|
+
return n(e).iterate({ enter: (n) => {
|
|
1877
|
+
if (n.name === "FencedCode" || n.name === "CodeBlock") return !1;
|
|
1878
|
+
if (n.name === "TaskMarker") return t.push({
|
|
1879
|
+
from: n.from,
|
|
1880
|
+
to: n.to,
|
|
1881
|
+
checked: /x/i.test(e.sliceDoc(n.from, n.to))
|
|
1882
|
+
}), !1;
|
|
1883
|
+
} }), t;
|
|
1884
|
+
}
|
|
1885
|
+
function ii(e, t, n) {
|
|
1886
|
+
let r = ri(e).filter((e) => e.from <= n && e.to >= t);
|
|
1887
|
+
if (r.length === 0) return null;
|
|
1888
|
+
let i = r.some((e) => !e.checked);
|
|
1889
|
+
return r.map((e) => ({
|
|
1890
|
+
from: e.from + 1,
|
|
1891
|
+
to: e.from + 2,
|
|
1892
|
+
insert: i ? "x" : " "
|
|
1893
|
+
}));
|
|
1894
|
+
}
|
|
1895
|
+
function ai(e) {
|
|
1896
|
+
let { state: t } = e;
|
|
1897
|
+
if (t.readOnly) return !1;
|
|
1898
|
+
let n = t.selection.ranges.flatMap((e) => {
|
|
1899
|
+
let n = t.doc.lineAt(e.from).from, r = t.doc.lineAt(e.to).to;
|
|
1900
|
+
return ii(t, n, r) ?? [];
|
|
1901
|
+
});
|
|
1902
|
+
return n.length !== 0 && (e.dispatch({
|
|
1903
|
+
changes: n,
|
|
1904
|
+
userEvent: "input.task"
|
|
1905
|
+
}), !0);
|
|
1906
|
+
}
|
|
1907
|
+
var oi = t.domEventHandlers({ mousedown(e, t) {
|
|
1908
|
+
let n = e.target, r = n?.closest?.(".cm-md-task-box") ?? n?.closest?.(".cm-md-listprefix")?.querySelector(":scope > .cm-md-task-box");
|
|
1909
|
+
if (!r || e.button !== 0) return !1;
|
|
1910
|
+
if (e.preventDefault(), t.state.readOnly) return !0;
|
|
1911
|
+
let i = t.posAtDOM(r), a = ii(t.state, i, i);
|
|
1912
|
+
return a && t.dispatch({
|
|
1913
|
+
changes: a,
|
|
1914
|
+
userEvent: "input.task"
|
|
1915
|
+
}), !0;
|
|
1916
|
+
} });
|
|
1917
|
+
function si(e) {
|
|
1918
|
+
return [
|
|
1919
|
+
ei.of(e),
|
|
1920
|
+
oi,
|
|
1921
|
+
v.high(m.of([{
|
|
1922
|
+
key: "Mod-Enter",
|
|
1923
|
+
run: ai
|
|
1924
|
+
}]))
|
|
1925
|
+
];
|
|
1926
|
+
}
|
|
1927
|
+
// src/components/inputs/text-editor/text-editor.hidden-syntax.ts
|
|
1928
|
+
var ci = {
|
|
1929
|
+
EmphasisMark: ["Emphasis", "StrongEmphasis"],
|
|
1930
|
+
StrikethroughMark: ["Strikethrough"],
|
|
1931
|
+
CodeMark: ["InlineCode"]
|
|
1932
|
+
}, X = d.replace({}), li = d.mark({ class: "cm-md-bullet" }), ui = /^(\s*)[-*+]\s+\[[ xX]\](\s+)/, di = 2.5, fi = {};
|
|
1933
|
+
function pi(e) {
|
|
1934
|
+
return fi[e] ?? (fi[e] = d.line({ attributes: { style: `text-indent:calc(${e} * var(--_text-editor-marker-advance) * -1) !important;padding-left:calc(${e} * var(--_text-editor-marker-advance)) !important` } }));
|
|
1935
|
+
}
|
|
1936
|
+
var mi = d.mark({ class: "cm-md-ordinal" }), hi = {};
|
|
1937
|
+
function gi(e) {
|
|
1938
|
+
let t = e.join(",");
|
|
1939
|
+
return hi[t] ?? (hi[t] = d.line({
|
|
1940
|
+
class: "cm-md-quote-line",
|
|
1941
|
+
attributes: { style: `background-image:${e.map(() => "var(--_text-editor-quote-rule)").join(",")};background-position:${e.map((e) => `calc(${e} * var(--_text-editor-marker-advance)) 0`).join(",")}` }
|
|
1942
|
+
}));
|
|
1943
|
+
}
|
|
1944
|
+
var _i = d.mark({ class: "cm-md-quote-mark-hidden" }), vi = d.mark({ class: "cm-md-quote-gap" }), yi = d.mark({ class: "cm-md-code-bare" }), bi = class extends f {
|
|
1945
|
+
toDOM() {
|
|
1946
|
+
let e = document.createElement("span");
|
|
1947
|
+
return e.className = "cm-md-rule", e.setAttribute("aria-hidden", "true"), e;
|
|
1948
|
+
}
|
|
1949
|
+
eq() {
|
|
1950
|
+
return !0;
|
|
1951
|
+
}
|
|
1952
|
+
ignoreEvent() {
|
|
1953
|
+
return !1;
|
|
1954
|
+
}
|
|
1955
|
+
}, xi = d.replace({ widget: new bi() });
|
|
1956
|
+
function Si(e) {
|
|
1957
|
+
let t = e;
|
|
1958
|
+
for (let n = e.parent; n; n = n.parent) n.name === "Blockquote" && (t = n);
|
|
1959
|
+
return t;
|
|
1960
|
+
}
|
|
1961
|
+
var Ci = 2, wi = {};
|
|
1962
|
+
function Ti(e, t) {
|
|
1963
|
+
var n;
|
|
1964
|
+
return wi[n = `${e},${t}`] ?? (wi[n] = d.line({ attributes: { style: `text-indent:calc(${e} * var(--_text-editor-marker-advance) * -1) !important;padding-left:calc(${e + t} * var(--_text-editor-marker-advance)) !important` } }));
|
|
1965
|
+
}
|
|
1966
|
+
function Ei(e, t) {
|
|
1967
|
+
let r = /* @__PURE__ */ new Map();
|
|
1968
|
+
return n(e).iterate({
|
|
1969
|
+
from: t.from,
|
|
1970
|
+
to: t.to,
|
|
1971
|
+
enter: (t) => {
|
|
1972
|
+
t.name === "Blockquote" && Fe(e, t.from, t.to, (e) => r.set(e, (r.get(e) ?? 0) + 1));
|
|
1973
|
+
}
|
|
1974
|
+
}), r;
|
|
1975
|
+
}
|
|
1976
|
+
function Di(e, t) {
|
|
1977
|
+
for (let n = e.doc.lineAt(t.to);; n = e.doc.line(n.number - 1)) if (/[^\s>]/.test(n.text) || n.from <= t.from) return n.from;
|
|
1978
|
+
}
|
|
1979
|
+
function Oi(e, t) {
|
|
1980
|
+
let n = [];
|
|
1981
|
+
for (let r of t) {
|
|
1982
|
+
let t = /^[ ]*/.exec(e.slice(r + 1))[0].length;
|
|
1983
|
+
t >= 2 && t <= 4 && n.push([r + 2, r + 1 + t]);
|
|
1984
|
+
}
|
|
1985
|
+
return n;
|
|
1986
|
+
}
|
|
1987
|
+
function ki(e, t) {
|
|
1988
|
+
let r = /* @__PURE__ */ new Map();
|
|
1989
|
+
return n(e).iterate({
|
|
1990
|
+
from: t.from,
|
|
1991
|
+
to: t.to,
|
|
1992
|
+
enter: (t) => {
|
|
1993
|
+
if (t.name !== "QuoteMark") return;
|
|
1994
|
+
let n = e.doc.lineAt(t.from), i = r.get(n.from) ?? [];
|
|
1995
|
+
i.push(t.from - n.from), r.set(n.from, i);
|
|
1996
|
+
}
|
|
1997
|
+
}), r;
|
|
1998
|
+
}
|
|
1999
|
+
function Ai(e) {
|
|
2000
|
+
return !e.readOnly && e.facet(t.editable);
|
|
2001
|
+
}
|
|
2002
|
+
function ji(e, t, n) {
|
|
2003
|
+
return Ai(e) && e.selection.ranges.some((e) => e.from <= n && e.to >= t);
|
|
2004
|
+
}
|
|
2005
|
+
var Mi = d.replace({ block: !0 }), Ni = d.replace({}), Pi = d.mark({ class: "cm-md-code-language" }), Fi = /* @__PURE__ */ new Set([
|
|
2006
|
+
"Document",
|
|
2007
|
+
"Blockquote",
|
|
2008
|
+
"BulletList",
|
|
2009
|
+
"OrderedList",
|
|
2010
|
+
"ListItem"
|
|
2011
|
+
]);
|
|
2012
|
+
function Ii(e) {
|
|
2013
|
+
let t = [];
|
|
2014
|
+
return n(e).iterate({ enter: (n) => {
|
|
2015
|
+
if (n.name !== "FencedCode") return Fi.has(n.name);
|
|
2016
|
+
if (ji(e, n.from, n.to)) return !1;
|
|
2017
|
+
let r = n.node.getChildren("CodeMark").map((t) => e.doc.lineAt(t.from)), i = e.doc.lineAt(n.from).number;
|
|
2018
|
+
if (e.doc.lineAt(n.to).number - i + 1 <= r.length) return !1;
|
|
2019
|
+
let a = n.node.getChild("CodeInfo"), o = n.node.getChild("CodeMark");
|
|
2020
|
+
for (let [e, n] of r.entries()) e === 0 ? (t.push(Ni.range(o.from, a ? a.from : o.to)), a && t.push(Pi.range(a.from, a.to))) : t.push(Mi.range(n.from, n.to));
|
|
2021
|
+
return !1;
|
|
2022
|
+
} }), d.set(t, !0);
|
|
2023
|
+
}
|
|
2024
|
+
function Li(e) {
|
|
2025
|
+
let t = [];
|
|
2026
|
+
for (let r of e.selection.ranges) n(e).iterate({
|
|
2027
|
+
from: r.from,
|
|
2028
|
+
to: r.to,
|
|
2029
|
+
enter: (e) => (e.name === "FencedCode" && t.push(e.from), e.name !== "FencedCode" && Fi.has(e.name))
|
|
2030
|
+
});
|
|
2031
|
+
return t.join(",");
|
|
2032
|
+
}
|
|
2033
|
+
var Ri = b.define({
|
|
2034
|
+
create: Ii,
|
|
2035
|
+
update: (e, t) => t.docChanged || t.reconfigured || w(t.startState, t.state) || t.selection && Li(t.startState) !== Li(t.state) ? Ii(t.state) : e,
|
|
2036
|
+
provide: (e) => t.decorations.from(e)
|
|
2037
|
+
});
|
|
2038
|
+
function zi(e) {
|
|
2039
|
+
let { state: t } = e, r = (e, n) => ji(t, e, n), i = [];
|
|
2040
|
+
for (let { from: a, to: o } of e.visibleRanges) n(t).iterate({
|
|
2041
|
+
from: a,
|
|
2042
|
+
to: o,
|
|
2043
|
+
enter: (e) => {
|
|
2044
|
+
let n = e.node.parent;
|
|
2045
|
+
if (e.name === "HorizontalRule") return r(e.from, e.to) || i.push(xi.range(e.from, e.to)), !1;
|
|
2046
|
+
if (e.name === "Blockquote") {
|
|
2047
|
+
let n = Si(e.node);
|
|
2048
|
+
if (n !== e.node || r(n.from, n.to)) return;
|
|
2049
|
+
let a = ki(t, n), o = Ei(t, n), s = Di(t, n), c = [0];
|
|
2050
|
+
Fe(t, n.from, n.to, (e) => {
|
|
2051
|
+
if (e > s) return;
|
|
2052
|
+
let n = t.doc.lineAt(e), r = a.get(e) ?? [], l = Oi(n.text, r), u = l.reduce((e, [t, n]) => e + n - t, 0);
|
|
2053
|
+
for (let [t, n] of l) i.push(X.range(e + t, e + n));
|
|
2054
|
+
let d = r.filter((e) => /[^ \t]/.test(n.text.charAt(e + 1)));
|
|
2055
|
+
for (let t of d) i.push(vi.range(e + t, e + t + 1));
|
|
2056
|
+
let f = r.map((e) => e - l.filter(([t]) => t < e).reduce((e, [t, n]) => e + n - t, 0) + d.filter((t) => t < e).length), p = Math.max(1, o.get(e) ?? 0), m = Wt(n.text) - u + d.length, h = (f.length ? f : c).slice(0, p);
|
|
2057
|
+
for (; h.length < p;) h.push(h.length ? h[h.length - 1] + Ci : 0);
|
|
2058
|
+
let g = f.length ? (p - f.length) * Ci : h[h.length - 1] + Ci;
|
|
2059
|
+
g > 0 ? i.push(Ti(m, g).range(e)) : (u || d.length) && i.push(pi(m).range(e)), i.push(gi(h).range(e)), c = h;
|
|
2060
|
+
});
|
|
2061
|
+
} else if (n) {
|
|
2062
|
+
if (e.name === "QuoteMark") {
|
|
2063
|
+
let n = Si(e.node), a = t.sliceDoc(e.to, e.to + 1) === " " ? e.to + 1 : e.to;
|
|
2064
|
+
r(n.from, n.to) || i.push(_i.range(e.from, a));
|
|
2065
|
+
} else if (e.name === "ListMark" && /^[-*+]$/.test(t.sliceDoc(e.from, e.to)) && /^[ \t]/.test(t.sliceDoc(e.to, e.to + 1))) {
|
|
2066
|
+
let n = t.doc.lineAt(e.from);
|
|
2067
|
+
if (r(n.from, n.to)) return;
|
|
2068
|
+
let a = ui.exec(n.text), o = a && e.node.parent?.getChild("Task")?.getChild("TaskMarker");
|
|
2069
|
+
if (a && o) {
|
|
2070
|
+
i.push(pi(a[1].length + di + a[2].length).range(n.from), X.range(e.from, o.from), ni(t, /x/i.test(t.sliceDoc(o.from, o.to))).range(o.from, o.to));
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
i.push(li.range(e.from, e.to));
|
|
2074
|
+
} else if (e.name === "ListMark" && /^\d+[.)]$/.test(t.sliceDoc(e.from, e.to))) i.push(mi.range(e.from, e.to));
|
|
2075
|
+
else if (e.name === "HeaderMark" && n.name.startsWith("ATXHeading")) {
|
|
2076
|
+
let a = t.sliceDoc(e.to, e.to + 1) === " " ? e.to + 1 : e.to;
|
|
2077
|
+
r(n.from, n.to) || i.push(X.range(e.from, a));
|
|
2078
|
+
} else if (e.name === "Link") {
|
|
2079
|
+
let n = e.node.getChild("URL"), a = e.node.getChildren("LinkMark");
|
|
2080
|
+
if (!n || a.length < 2 || D(t, e.node)) return;
|
|
2081
|
+
r(e.from, e.to) || i.push(X.range(a[0].from, a[0].to), X.range(a[1].from, e.to));
|
|
2082
|
+
} else if (ci[e.name]?.includes(n.name) && !r(n.from, n.to) && (i.push(X.range(e.from, e.to)), e.name === "CodeMark" && e.from === n.from)) {
|
|
2083
|
+
let t = n.lastChild;
|
|
2084
|
+
t && t.from > e.to && i.push(yi.range(e.to, t.from));
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
return d.set(i, !0);
|
|
2090
|
+
}
|
|
2091
|
+
var Bi = 3, Vi = class {
|
|
2092
|
+
constructor(e) {
|
|
2093
|
+
this.view = e, this.layerObserver = new MutationObserver(() => this.mendSelection()), this.observing = !1, this.checked = "", this.mends = 0, this.decorations = zi(e), queueMicrotask(() => this.observeLayer());
|
|
2094
|
+
}
|
|
2095
|
+
observeLayer() {
|
|
2096
|
+
if (this.observing) return;
|
|
2097
|
+
let e = this.view.dom.querySelector(".cm-selectionLayer");
|
|
2098
|
+
e && (this.layerObserver.observe(e, {
|
|
2099
|
+
childList: !0,
|
|
2100
|
+
subtree: !0,
|
|
2101
|
+
attributes: !0
|
|
2102
|
+
}), this.observing = !0);
|
|
2103
|
+
}
|
|
2104
|
+
update(e) {
|
|
2105
|
+
this.observeLayer(), (e.docChanged || e.selectionSet || e.viewportChanged || w(e.startState, e.state) || e.transactions.some((e) => e.reconfigured)) && (this.decorations = zi(e.view));
|
|
2106
|
+
}
|
|
2107
|
+
mendSelection() {
|
|
2108
|
+
let { view: e } = this, { from: t, to: n, empty: r } = e.state.selection.main, i = `${t}-${n}-${e.state.doc.length}`;
|
|
2109
|
+
if (i !== this.checked && (this.checked = i, this.mends = 0), r || this.mends >= Bi) return;
|
|
2110
|
+
let a = e.dom.querySelector(".cm-selectionLayer"), o = a ? [...a.querySelectorAll(".cm-selectionBackground")] : [];
|
|
2111
|
+
if (o.length < 2) return;
|
|
2112
|
+
let s = e.coordsAtPos(t, 1), c = e.coordsAtPos(n, -1);
|
|
2113
|
+
if (!s || !c || Math.abs(s.top - c.top) > 2) return;
|
|
2114
|
+
this.mends += 1;
|
|
2115
|
+
let [l] = o, u = o[o.length - 1];
|
|
2116
|
+
l.style.width = `${u.offsetLeft + u.offsetWidth - l.offsetLeft}px`, o.slice(1).forEach((e) => e.remove()), e.dispatch({ selection: e.state.selection });
|
|
2117
|
+
}
|
|
2118
|
+
destroy() {
|
|
2119
|
+
this.layerObserver.disconnect();
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
function Hi() {
|
|
2123
|
+
return [v.highest(u.fromClass(Vi, { decorations: (e) => e.decorations })), Ri];
|
|
2124
|
+
}
|
|
2125
|
+
// src/components/inputs/text-editor/text-editor.selection.ts
|
|
2126
|
+
function Ui(e) {
|
|
2127
|
+
let t = e.dom.querySelector(".cm-selectionLayer");
|
|
2128
|
+
if (!t) return;
|
|
2129
|
+
let n = e.defaultLineHeight, r = e.contentDOM, i = r.getBoundingClientRect().right - (parseFloat(getComputedStyle(r).paddingRight) || 0);
|
|
2130
|
+
Wi([...t.querySelectorAll(".cm-selectionBackground")].map((t) => {
|
|
2131
|
+
let r = t.getBoundingClientRect();
|
|
2132
|
+
if (r.height >= n * 1.25) return {
|
|
2133
|
+
piece: t,
|
|
2134
|
+
box: r,
|
|
2135
|
+
row: null
|
|
2136
|
+
};
|
|
2137
|
+
let i = e.posAtCoords({
|
|
2138
|
+
x: r.left + 1,
|
|
2139
|
+
y: r.top + r.height / 2
|
|
2140
|
+
}, !1);
|
|
2141
|
+
return {
|
|
2142
|
+
piece: t,
|
|
2143
|
+
box: r,
|
|
2144
|
+
row: e.coordsAtPos(i, 1) ?? e.coordsAtPos(i, -1)
|
|
2145
|
+
};
|
|
2146
|
+
}).map(({ piece: e, box: t, row: r }) => {
|
|
2147
|
+
let a = t.right - i;
|
|
2148
|
+
a > .25 && (e.style.width = `${Math.max(0, (parseFloat(e.style.width) || t.width) - a)}px`);
|
|
2149
|
+
let o = {
|
|
2150
|
+
piece: e,
|
|
2151
|
+
top: t.top,
|
|
2152
|
+
height: t.height
|
|
2153
|
+
};
|
|
2154
|
+
if (!r) return o;
|
|
2155
|
+
let s = parseFloat(e.style.top) || 0, c = s + ((r.top + r.bottom) / 2 - n / 2 - t.top);
|
|
2156
|
+
return Math.abs(c - s) > .25 && (e.style.top = `${c}px`, o.top = t.top + (c - s)), Math.abs(t.height - n) > .25 && (e.style.height = `${n}px`, o.height = n), o;
|
|
2157
|
+
}), n);
|
|
2158
|
+
}
|
|
2159
|
+
function Wi(e, t) {
|
|
2160
|
+
let n = [...e].sort((e, t) => e.top - t.top);
|
|
2161
|
+
for (let e = 1; e < n.length; e++) {
|
|
2162
|
+
let r = n[e - 1], i = n[e].top - (r.top + r.height);
|
|
2163
|
+
i > .25 && i < t / 2 && (r.piece.style.height = `${r.height + i}px`);
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
var Gi = class {
|
|
2167
|
+
constructor(e) {
|
|
2168
|
+
this.view = e, this.observer = new MutationObserver(() => {
|
|
2169
|
+
Ui(this.view), this.observer.takeRecords();
|
|
2170
|
+
}), this.observing = !1, queueMicrotask(() => this.observe());
|
|
2171
|
+
}
|
|
2172
|
+
update() {
|
|
2173
|
+
this.observe();
|
|
2174
|
+
}
|
|
2175
|
+
observe() {
|
|
2176
|
+
if (this.observing) return;
|
|
2177
|
+
let e = this.view.dom.querySelector(".cm-selectionLayer");
|
|
2178
|
+
e && (this.observer.observe(e, {
|
|
2179
|
+
childList: !0,
|
|
2180
|
+
subtree: !0,
|
|
2181
|
+
attributes: !0
|
|
2182
|
+
}), this.observing = !0);
|
|
2183
|
+
}
|
|
2184
|
+
destroy() {
|
|
2185
|
+
this.observer.disconnect();
|
|
2186
|
+
}
|
|
2187
|
+
}, Ki = u.fromClass(Gi), qi = ue`
|
|
2188
|
+
|
|
2189
|
+
|
|
2190
|
+
/* # Host */
|
|
2191
|
+
|
|
2192
|
+
:host {
|
|
2193
|
+
--_text-editor-caret-width: var(--primitives-border-width-regular);
|
|
2194
|
+
--_text-editor-caret-color: var(--components-text-editor-caret-color);
|
|
2195
|
+
--_text-editor-drop-cursor-color: var(--components-text-editor-drop-cursor-color);
|
|
2196
|
+
--_text-editor-drag-ghost-background-color: var(--components-text-editor-drag-ghost-background-color);
|
|
2197
|
+
--_text-editor-caret-ring-width: var(--primitives-border-width-thin);
|
|
2198
|
+
--_text-editor-caret-ring-color: var(--semantics-surfaces-base-background-color);
|
|
2199
|
+
--_text-editor-corner-radius: 0;
|
|
2200
|
+
--_text-editor-background-color: transparent;
|
|
2201
|
+
--_text-editor-input-field-border-color: transparent;
|
|
2202
|
+
--_text-editor-input-field-border-shadow: none;
|
|
2203
|
+
--_text-editor-input-field-border-z-index: 1;
|
|
2204
|
+
--_text-editor-padding-block: 0px;
|
|
2205
|
+
/* Room for the caret's own ink at the first and last position of a line:
|
|
2206
|
+
its width plus its ring. Without it the edge carets are clipped. */
|
|
2207
|
+
--_text-editor-padding-inline: calc(var(--_text-editor-caret-width) + var(--_text-editor-caret-ring-width));
|
|
2208
|
+
--_text-editor-content-color: var(--semantics-content-color);
|
|
2209
|
+
--_text-editor-mark-color: var(--semantics-content-secondary-color);
|
|
2210
|
+
--_text-editor-link-color: var(--semantics-links-color);
|
|
2211
|
+
--_text-editor-strong-font-weight: var(--primitives-font-weight-body-bold);
|
|
2212
|
+
--_text-editor-heading-1-font: var(--primitives-font-display-1-sm);
|
|
2213
|
+
--_text-editor-heading-2-font: var(--primitives-font-display-2-sm);
|
|
2214
|
+
--_text-editor-heading-3-font: var(--primitives-font-display-3-sm);
|
|
2215
|
+
--_text-editor-heading-4-font: var(--primitives-font-display-4-sm);
|
|
2216
|
+
--_text-editor-heading-5-font: var(--primitives-font-display-5-sm);
|
|
2217
|
+
--_text-editor-heading-6-font: var(--primitives-font-display-6-sm);
|
|
2218
|
+
--_text-editor-quote-font-size: var(--primitives-font-size-200);
|
|
2219
|
+
--_text-editor-font: var(--primitives-font-body-md-regular-snug);
|
|
2220
|
+
--_text-editor-code-font: var(--primitives-font-monospace-sm-regular-snug);
|
|
2221
|
+
--_text-editor-code-font-size: var(--semantics-code-inline-font-size);
|
|
2222
|
+
--_text-editor-code-font-family: var(--primitives-font-family-monospace);
|
|
2223
|
+
--_text-editor-code-font-weight: var(--primitives-font-weight-body-regular);
|
|
2224
|
+
/* The scale of --semantics-code-inline-font-size, and the JetBrains Mono box
|
|
2225
|
+
(ascent 1020 + descent 300 per 1000), to size inline code like a token. */
|
|
2226
|
+
--_text-editor-code-scale: 0.85;
|
|
2227
|
+
--_text-editor-code-content-height: 1.32em;
|
|
2228
|
+
--_text-editor-marker-font-size: var(--primitives-font-size-90);
|
|
2229
|
+
--_text-editor-task-box-size: 1.7em;
|
|
2230
|
+
--_text-editor-code-copy-gap: var(--primitives-space-4);
|
|
2231
|
+
--_text-editor-code-copy-font: var(--semantics-buttons-sm-primary-text-font);
|
|
2232
|
+
--_text-editor-code-copy-content-color: var(--semantics-buttons-accent-transparent-content-color);
|
|
2233
|
+
--_text-editor-code-copy-is-hovered-content-color: var(--semantics-buttons-accent-transparent-is-hovered-content-color);
|
|
2234
|
+
--_text-editor-code-copy-is-active-content-color: var(--semantics-buttons-accent-transparent-is-active-content-color);
|
|
2235
|
+
--_text-editor-task-box-shift: -0.11em;
|
|
2236
|
+
/* JetBrains Mono advance (600/1000 em) at the marker size; leading
|
|
2237
|
+
list/quote markers are mono so the hanging indent equals their width. */
|
|
2238
|
+
--_text-editor-marker-advance: calc(0.6 * var(--_text-editor-marker-font-size));
|
|
2239
|
+
--_text-editor-bullet-size: 0.45em;
|
|
2240
|
+
--_text-editor-bullet-color: var(--semantics-content-color);
|
|
2241
|
+
--_text-editor-rule-thickness: var(--semantics-dividers-thickness);
|
|
2242
|
+
--_text-editor-quote-border-width: var(--primitives-border-width-regular);
|
|
2243
|
+
--_text-editor-quote-border-color: var(--semantics-content-color);
|
|
2244
|
+
--_text-editor-quote-rule: linear-gradient(var(--_text-editor-quote-border-color), var(--_text-editor-quote-border-color));
|
|
2245
|
+
--_text-editor-rule-color: var(--semantics-dividers-color);
|
|
2246
|
+
--_text-editor-heading-marker-scale: 75%;
|
|
2247
|
+
--_text-editor-token-corner-radius: var(--primitives-corner-radius-sm);
|
|
2248
|
+
--_text-editor-token-inline-padding: 0.3em;
|
|
2249
|
+
/* Vertical padding for an inline token that inherits the block font (tint,
|
|
2250
|
+
mention): fills the line up to its line-height, never past it, so tokens on
|
|
2251
|
+
adjacent lines never overlap. 1lh and em resolve on the token, so it adapts
|
|
2252
|
+
to a heading's tighter line. (~1.2em is the text's own box.) */
|
|
2253
|
+
--_text-editor-token-block-padding-fit: max(0em, (1lh - 1.2em) / 2);
|
|
2254
|
+
--_text-editor-code-token-background-color: var(--semantics-surfaces-tinted-background-color);
|
|
2255
|
+
--_text-editor-code-token-highlight-border-color: var(--semantics-surfaces-tinted-highlight-border-color);
|
|
2256
|
+
--_text-editor-token-highlight-border-width: var(--semantics-surfaces-highlight-border-width);
|
|
2257
|
+
--_text-editor-code-token-is-selected-background-color: light-dark(var(--primitives-color-neutral-200), var(--primitives-color-neutral-300));
|
|
2258
|
+
--_text-editor-code-block-inline-padding: var(--primitives-space-16);
|
|
2259
|
+
--_text-editor-code-block-block-padding: var(--primitives-space-16);
|
|
2260
|
+
--_text-editor-code-block-corner-radius: var(--semantics-surfaces-corner-radius);
|
|
2261
|
+
--_text-editor-annotation-token-background-color: light-dark(var(--primitives-color-mark-75), var(--primitives-color-mark-150));
|
|
2262
|
+
--_text-editor-annotation-token-is-selected-background-color: light-dark(var(--primitives-color-mark-200), var(--primitives-color-mark-400));
|
|
2263
|
+
--_text-editor-annotation-token-badge-content-color: var(--primitives-color-mark-1000);
|
|
2264
|
+
--_text-editor-annotation-token-badge-background-color: light-dark(var(--primitives-color-mark-250), var(--primitives-color-mark-300));
|
|
2265
|
+
--_text-editor-annotation-token-badge-highlight-border-color: light-dark(var(--primitives-color-mark-300), var(--primitives-color-mark-350));
|
|
2266
|
+
--_text-editor-annotation-token-badge-is-hovered-background-color: light-dark(var(--primitives-color-mark-300), var(--primitives-color-mark-350));
|
|
2267
|
+
--_text-editor-annotation-token-badge-is-hovered-highlight-border-color: light-dark(var(--primitives-color-mark-350), var(--primitives-color-mark-400));
|
|
2268
|
+
--_text-editor-annotation-token-badge-is-active-background-color: light-dark(var(--primitives-color-mark-350), var(--primitives-color-mark-400));
|
|
2269
|
+
--_text-editor-annotation-token-badge-is-active-highlight-border-color: light-dark(var(--primitives-color-mark-400), var(--primitives-color-mark-450));
|
|
2270
|
+
/* Same step in both themes: mark-450 keeps light mode as-is and, in dark
|
|
2271
|
+
mode, stays a readable amber instead of jumping to a near-white fill
|
|
2272
|
+
that swallows the white (mark-1000) badge number. */
|
|
2273
|
+
--_text-editor-annotation-token-is-selected-badge-background-color: var(--primitives-color-mark-450);
|
|
2274
|
+
--_text-editor-annotation-token-is-selected-badge-highlight-border-color: var(--primitives-color-mark-500);
|
|
2275
|
+
--_text-editor-annotation-token-is-selected-content-color: var(--primitives-color-neutral-950);
|
|
2276
|
+
--_text-editor-annotation-badge-font-family: var(--primitives-font-family-body);
|
|
2277
|
+
--_text-editor-annotation-badge-size: 1.5em;
|
|
2278
|
+
--_text-editor-annotation-badge-font-scale: 0.62;
|
|
2279
|
+
--_text-editor-link-badge-size: calc(1em + 2 * var(--_text-editor-token-block-padding-fit));
|
|
2280
|
+
--_text-editor-link-badge-gap: 0.1em;
|
|
2281
|
+
--_text-editor-link-badge-content-color: var(--components-text-editor-link-badge-content-color);
|
|
2282
|
+
--_text-editor-link-badge-background-color: var(--components-text-editor-link-badge-background-color);
|
|
2283
|
+
--_text-editor-link-badge-highlight-border-color: var(--components-text-editor-link-badge-highlight-border-color);
|
|
2284
|
+
--_text-editor-link-badge-is-hovered-background-color: var(--components-text-editor-link-badge-is-hovered-background-color);
|
|
2285
|
+
--_text-editor-link-badge-is-active-background-color: var(--components-text-editor-link-badge-is-active-background-color);
|
|
2286
|
+
--_text-editor-link-badge-is-hovered-highlight-border-color: var(--components-text-editor-link-badge-is-hovered-highlight-border-color);
|
|
2287
|
+
--_text-editor-link-badge-is-active-highlight-border-color: var(--components-text-editor-link-badge-is-active-highlight-border-color);
|
|
2288
|
+
--_text-editor-mention-icon-size: 0.95em;
|
|
2289
|
+
--_text-editor-mention-token-background-color: var(--semantics-mentions-background-color);
|
|
2290
|
+
--_text-editor-selection-color: var(--semantics-text-selection-background-color);
|
|
2291
|
+
--_text-editor-selection-content-color: var(--primitives-color-neutral-1000);
|
|
2292
|
+
--_text-editor-mention-token-highlight-border-color: var(--semantics-mentions-highlight-border-color);
|
|
2293
|
+
--_text-editor-mention-token-content-color: var(--semantics-mentions-content-color);
|
|
2294
|
+
--_text-editor-mention-token-is-selected-background-color: var(--semantics-mentions-is-selected-background-color);
|
|
2295
|
+
--_text-editor-mention-token-is-selected-content-color: var(--semantics-mentions-is-selected-content-color);
|
|
2296
|
+
--_text-editor-rows: 6;
|
|
2297
|
+
--_text-editor-popup-corner-radius: var(--semantics-overlays-corner-radius);
|
|
2298
|
+
--_text-editor-popup-background-color: var(--semantics-surfaces-base-background-color);
|
|
2299
|
+
--_text-editor-popup-box-shadow: var(--semantics-overlays-box-shadow);
|
|
2300
|
+
--_text-editor-popup-font-family: var(--primitives-font-family-body);
|
|
2301
|
+
--_text-editor-popup-font-size: var(--primitives-font-size-100);
|
|
2302
|
+
--_text-editor-popup-min-width: var(--primitives-area-280);
|
|
2303
|
+
--_text-editor-popup-max-height: 14em;
|
|
2304
|
+
--_text-editor-popup-padding: var(--primitives-space-8);
|
|
2305
|
+
--_text-editor-popup-row-min-height: var(--semantics-controls-sm-min-size);
|
|
2306
|
+
--_text-editor-popup-row-gap: var(--primitives-space-8);
|
|
2307
|
+
--_text-editor-popup-row-padding-block: var(--primitives-space-4);
|
|
2308
|
+
--_text-editor-popup-row-padding-inline: var(--primitives-space-8);
|
|
2309
|
+
--_text-editor-popup-row-corner-radius: var(--semantics-controls-sm-corner-radius);
|
|
2310
|
+
--_text-editor-popup-row-content-color: var(--semantics-content-color);
|
|
2311
|
+
--_text-editor-popup-row-is-highlighted-background-color: var(--semantics-list-items-is-highlighted-background-color);
|
|
2312
|
+
--_text-editor-popup-row-is-highlighted-content-color: var(--semantics-list-items-is-highlighted-content-color);
|
|
2313
|
+
--_text-editor-popup-row-is-hovered-background-color: var(--semantics-list-items-is-hovered-background-color);
|
|
2314
|
+
--_text-editor-popup-row-is-hovered-content-color: var(--semantics-list-items-is-hovered-content-color);
|
|
2315
|
+
--_text-editor-popup-avatar-row-min-height: var(--semantics-controls-md-min-size);
|
|
2316
|
+
--_text-editor-popup-text-font: var(--primitives-font-body-md-regular-tight);
|
|
2317
|
+
--_text-editor-popup-supporting-text-font: var(--primitives-font-body-sm-regular-tight);
|
|
2318
|
+
--_text-editor-popup-supporting-text-color: var(--semantics-content-secondary-color);
|
|
2319
|
+
--_text-editor-popup-symbol-size: var(--primitives-space-20);
|
|
2320
|
+
--_text-editor-popup-message-max-width: var(--primitives-area-400);
|
|
2321
|
+
--_text-editor-popup-message-padding-block: var(--primitives-space-12);
|
|
2322
|
+
--_text-editor-popup-message-padding-inline: var(--primitives-space-16);
|
|
2323
|
+
--_text-editor-popup-message-color: var(--semantics-content-secondary-color);
|
|
2324
|
+
|
|
2325
|
+
${ge}
|
|
2326
|
+
display: flex;
|
|
2327
|
+
min-height: 0;
|
|
2328
|
+
flex-direction: column;
|
|
2329
|
+
flex-grow: 1;
|
|
2330
|
+
flex-shrink: 1;
|
|
2331
|
+
flex-basis: auto;
|
|
2332
|
+
-webkit-tap-highlight-color: transparent;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
:host([hidden]) {
|
|
2336
|
+
display: none;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
@media (pointer: coarse) {
|
|
2340
|
+
:host {
|
|
2341
|
+
--_text-editor-popup-row-min-height: var(--semantics-controls-md-min-size);
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
|
|
2346
|
+
/* ## Appearance — input-field adds the framed surface + a default content padding */
|
|
2347
|
+
|
|
2348
|
+
:host([appearance="input-field"]) {
|
|
2349
|
+
--_text-editor-corner-radius: var(--primitives-corner-radius-lg);
|
|
2350
|
+
--_text-editor-background-color: var(--semantics-input-fields-background-color);
|
|
2351
|
+
--_text-editor-input-field-border-color: var(--semantics-input-fields-border-color);
|
|
2352
|
+
--_text-editor-input-field-border-shadow: inset 0 0 0 var(--semantics-input-fields-border-width) var(--_text-editor-input-field-border-color);
|
|
2353
|
+
--_text-editor-padding-block: var(--semantics-controls-md-inline-padding);
|
|
2354
|
+
--_text-editor-padding-inline: var(--semantics-controls-md-inline-padding);
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
/* # Block — the frame only; CodeMirror fills it */
|
|
2359
|
+
|
|
2360
|
+
.text-editor {
|
|
2361
|
+
box-sizing: border-box;
|
|
2362
|
+
display: flex;
|
|
2363
|
+
position: relative;
|
|
2364
|
+
border-radius: var(--_text-editor-corner-radius);
|
|
2365
|
+
background-color: var(--_text-editor-background-color);
|
|
2366
|
+
min-height: 0;
|
|
2367
|
+
flex-direction: column;
|
|
2368
|
+
flex-grow: 1;
|
|
2369
|
+
flex-shrink: 1;
|
|
2370
|
+
flex-basis: auto;
|
|
2371
|
+
color: var(--_text-editor-content-color);
|
|
2372
|
+
font: var(--_text-editor-font);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
/* The border ring lies over the content, so a selection or a block that runs
|
|
2376
|
+
to the edge cannot cover it. Inset, it takes no layout space. */
|
|
2377
|
+
.text-editor::after {
|
|
2378
|
+
content: '';
|
|
2379
|
+
position: absolute;
|
|
2380
|
+
inset: 0;
|
|
2381
|
+
z-index: var(--_text-editor-input-field-border-z-index);
|
|
2382
|
+
border-radius: inherit;
|
|
2383
|
+
box-shadow: var(--_text-editor-input-field-border-shadow);
|
|
2384
|
+
pointer-events: none;
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
.text-editor .cm-editor {
|
|
2388
|
+
isolation: isolate;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
:host([disabled]) .text-editor {
|
|
2392
|
+
opacity: var(--primitives-opacity-disabled);
|
|
2393
|
+
pointer-events: none;
|
|
2394
|
+
-webkit-user-select: none;
|
|
2395
|
+
user-select: none;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
/* Focus ring only on the input-field variant; simple relies on the accent caret and
|
|
2399
|
+
lets a wrapping composition own its focus treatment. */
|
|
2400
|
+
:host([appearance="input-field"]) .text-editor:focus-within {
|
|
2401
|
+
outline: var(--semantics-focus-ring-outline);
|
|
2402
|
+
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
2403
|
+
box-shadow: var(--semantics-focus-ring-box-shadow);
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
/* # CodeMirror surface */
|
|
2408
|
+
|
|
2409
|
+
/* Inline padding on the scroller (left of any future gutter), block + right
|
|
2410
|
+
on the content for click mapping + scroll-end padding. :host beats the
|
|
2411
|
+
shared theme's .cm-content reset. */
|
|
2412
|
+
:host .cm-scroller {
|
|
2413
|
+
padding-left: var(--_text-editor-padding-inline);
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
:host .cm-content {
|
|
2417
|
+
padding-block: var(--_text-editor-padding-block);
|
|
2418
|
+
padding-right: var(--_text-editor-padding-inline);
|
|
2419
|
+
min-height: calc(var(--_text-editor-rows) * 1lh);
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
/* drawSelection() keeps drawing its own cursors; .cm-nldd-cursorLayer takes
|
|
2423
|
+
over, with the blink CodeMirror gives its own layer. */
|
|
2424
|
+
:host .cm-cursorLayer {
|
|
2425
|
+
display: none;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
:host .cm-nldd-cursorLayer {
|
|
2429
|
+
pointer-events: none;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
:host .cm-editor.cm-focused > .cm-scroller > .cm-nldd-cursorLayer {
|
|
2433
|
+
animation: steps(1) cm-blink 1.2s infinite;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
:host .cm-editor.cm-focused > .cm-scroller > .cm-nldd-cursorLayer .cm-cursor {
|
|
2437
|
+
display: block;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
/* Read-only, like a native read-only field: select and copy, but no caret. */
|
|
2441
|
+
:host([readonly]) .cm-nldd-cursorLayer {
|
|
2442
|
+
visibility: hidden;
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
/* Prominent accent caret in both variants (the input-field variant additionally has the focus
|
|
2446
|
+
ring). The doubled class is purely for specificity — it outweighs
|
|
2447
|
+
CodeMirror's theme cursor color without depending on an attribute. */
|
|
2448
|
+
:host .cm-cursor.cm-cursor {
|
|
2449
|
+
/* accent-700: it keeps a >=525 lightness gap from both the base and tinted
|
|
2450
|
+
surfaces in light and dark (accent-600 fell just short on white), so the
|
|
2451
|
+
caret stays clearly visible without washing out. */
|
|
2452
|
+
border-left-color: var(--_text-editor-caret-color);
|
|
2453
|
+
border-left-width: var(--_text-editor-caret-width);
|
|
2454
|
+
/* CodeMirror centers its own 1.2px caret with a -0.6px margin. Ours is wider,
|
|
2455
|
+
so recenter it on the insertion point from its own width. */
|
|
2456
|
+
margin-left: calc(var(--_text-editor-caret-width) / -2);
|
|
2457
|
+
/* A thin surface-colored ring, like the drop cursor, so the caret stays legible
|
|
2458
|
+
even over a tinted token (annotation, inline code) where the accent alone can
|
|
2459
|
+
blend in. Blinks with the caret (opacity covers the shadow too). */
|
|
2460
|
+
box-shadow: 0 0 0 var(--_text-editor-caret-ring-width) var(--_text-editor-caret-ring-color);
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
:host .cm-scroller {
|
|
2464
|
+
resize: none;
|
|
2465
|
+
min-height: calc(var(--_text-editor-rows) * 1lh + 2 * var(--_text-editor-padding-block));
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
:host([resize="vertical"]) .cm-scroller {
|
|
2469
|
+
resize: vertical;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
:host([resize="none"]) .cm-editor {
|
|
2473
|
+
height: calc(var(--_text-editor-rows) * 1lh + 2 * var(--_text-editor-padding-block));
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
|
|
2477
|
+
/* # Hybrid markdown decorations
|
|
2478
|
+
Headings follow rich-text's display scale at its sm step. Markers are kept
|
|
2479
|
+
visible but dimmed in monospace, which also gives the leading list/quote
|
|
2480
|
+
prefix a predictable width for the hanging indent (see --_text-editor-marker-advance). */
|
|
2481
|
+
|
|
2482
|
+
.cm-md-h1 {
|
|
2483
|
+
font: var(--_text-editor-heading-1-font);
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
.cm-md-h2 {
|
|
2487
|
+
font: var(--_text-editor-heading-2-font);
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
.cm-md-h3 {
|
|
2491
|
+
font: var(--_text-editor-heading-3-font);
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
.cm-md-h4 {
|
|
2495
|
+
font: var(--_text-editor-heading-4-font);
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
.cm-md-h5 {
|
|
2499
|
+
font: var(--_text-editor-heading-5-font);
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
.cm-md-h6 {
|
|
2503
|
+
font: var(--_text-editor-heading-6-font);
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
:is(.cm-md-h1, .cm-md-h2, .cm-md-h3, .cm-md-h4, .cm-md-h5, .cm-md-h6) .cm-md-mark {
|
|
2507
|
+
font-size: var(--_text-editor-heading-marker-scale);
|
|
2508
|
+
}
|
|
2509
|
+
.cm-md-strong {
|
|
2510
|
+
font-weight: var(--_text-editor-strong-font-weight);
|
|
2511
|
+
}
|
|
2512
|
+
.cm-md-emphasis {
|
|
2513
|
+
font-style: italic;
|
|
2514
|
+
}
|
|
2515
|
+
.cm-md-strike {
|
|
2516
|
+
text-decoration: line-through;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/* The selected run is darkened with a decoration (see cm-md-code-selected
|
|
2520
|
+
below), since drawSelection hides the native selection. */
|
|
2521
|
+
.cm-md-code {
|
|
2522
|
+
padding-block: max(0em, (1lh / var(--_text-editor-code-scale) - var(--_text-editor-code-content-height)) / 2);
|
|
2523
|
+
/* No inline padding: the tint hugs the backticks, which are the visible bounds
|
|
2524
|
+
anyway. A padded mark has no coordsAt hook, so the caret at its edge would
|
|
2525
|
+
otherwise jump by the padding depending on the direction it arrives from. */
|
|
2526
|
+
/* line-height is left to inherit from the block, so a fixed snug line-height
|
|
2527
|
+
won't make the chip overflow inside a tight heading. */
|
|
2528
|
+
font-family: var(--_text-editor-code-font-family);
|
|
2529
|
+
font-size: var(--_text-editor-code-font-size);
|
|
2530
|
+
font-weight: var(--_text-editor-code-font-weight);
|
|
2531
|
+
box-shadow: inset 0 0 0 var(--_text-editor-token-highlight-border-width) var(--_text-editor-code-token-highlight-border-color);
|
|
2532
|
+
background-color: var(--_text-editor-code-token-background-color);
|
|
2533
|
+
border-radius: var(--_text-editor-token-corner-radius);
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
.cm-md-code-bare {
|
|
2537
|
+
padding-inline: var(--_text-editor-token-inline-padding);
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
.cm-md-rule {
|
|
2541
|
+
display: inline-block;
|
|
2542
|
+
border-top: var(--_text-editor-rule-thickness) solid var(--_text-editor-rule-color);
|
|
2543
|
+
width: 100%;
|
|
2544
|
+
vertical-align: middle;
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
/* :host beats the shared theme's ".cm-line { padding: 0 }" reset (equal
|
|
2548
|
+
specificity otherwise wins on source order), same as .cm-content above —
|
|
2549
|
+
without it the block padding never lands and the surface reads cramped. */
|
|
2550
|
+
/* The block is drawn line by line, so its edge is too: the sides on every
|
|
2551
|
+
line, the top on the first and the bottom on the last. */
|
|
2552
|
+
:host .cm-md-codeblock {
|
|
2553
|
+
--_text-editor-code-block-edge: var(--_text-editor-token-highlight-border-width);
|
|
2554
|
+
|
|
2555
|
+
padding-inline: var(--_text-editor-code-block-inline-padding);
|
|
2556
|
+
box-shadow:
|
|
2557
|
+
inset var(--_text-editor-code-block-edge) 0 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2558
|
+
inset calc(-1 * var(--_text-editor-code-block-edge)) 0 0 var(--_text-editor-code-token-highlight-border-color);
|
|
2559
|
+
font: var(--_text-editor-code-font);
|
|
2560
|
+
background-color: var(--_text-editor-code-token-background-color);
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
:host .cm-md-codeblock-first {
|
|
2564
|
+
padding-top: var(--_text-editor-code-block-block-padding);
|
|
2565
|
+
box-shadow:
|
|
2566
|
+
inset var(--_text-editor-code-block-edge) 0 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2567
|
+
inset calc(-1 * var(--_text-editor-code-block-edge)) 0 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2568
|
+
inset 0 var(--_text-editor-code-block-edge) 0 var(--_text-editor-code-token-highlight-border-color);
|
|
2569
|
+
border-start-start-radius: var(--_text-editor-code-block-corner-radius);
|
|
2570
|
+
border-start-end-radius: var(--_text-editor-code-block-corner-radius);
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
:host .cm-md-codeblock-last {
|
|
2574
|
+
padding-bottom: var(--_text-editor-code-block-block-padding);
|
|
2575
|
+
box-shadow:
|
|
2576
|
+
inset var(--_text-editor-code-block-edge) 0 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2577
|
+
inset calc(-1 * var(--_text-editor-code-block-edge)) 0 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2578
|
+
inset 0 calc(-1 * var(--_text-editor-code-block-edge)) 0 var(--_text-editor-code-token-highlight-border-color);
|
|
2579
|
+
border-end-start-radius: var(--_text-editor-code-block-corner-radius);
|
|
2580
|
+
border-end-end-radius: var(--_text-editor-code-block-corner-radius);
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
:host .cm-md-codeblock-first.cm-md-codeblock-last {
|
|
2584
|
+
box-shadow: inset 0 0 0 var(--_text-editor-code-block-edge) var(--_text-editor-code-token-highlight-border-color);
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
/* Selected slice of a code span — drawSelection hides the native ::selection,
|
|
2588
|
+
so a decoration (cm-md-code-selected / cm-md-codeblock-selected) paints the
|
|
2589
|
+
darker tint over the part that's selected. */
|
|
2590
|
+
.cm-md-code-selected,
|
|
2591
|
+
.cm-md-codeblock-selected {
|
|
2592
|
+
background-color: var(--_text-editor-code-token-is-selected-background-color);
|
|
2593
|
+
}
|
|
2594
|
+
/* CM nests the base code mark inside the selected one, so the inner base tint
|
|
2595
|
+
would paint over the darker selected tint (leaving the token light, or split
|
|
2596
|
+
on a partial overlap). Clear it so the whole selected run reads as one block. */
|
|
2597
|
+
.cm-md-code-selected .cm-md-code {
|
|
2598
|
+
background-color: transparent;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
.cm-md-code .cm-md-code-selected {
|
|
2602
|
+
--_text-editor-code-slice-start: 0px;
|
|
2603
|
+
--_text-editor-code-slice-end: 0px;
|
|
2604
|
+
padding-block: max(0em, (1lh / var(--_text-editor-code-scale) - var(--_text-editor-code-content-height)) / 2);
|
|
2605
|
+
box-shadow:
|
|
2606
|
+
inset 0 var(--_text-editor-token-highlight-border-width) 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2607
|
+
inset 0 calc(-1 * var(--_text-editor-token-highlight-border-width)) 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2608
|
+
inset var(--_text-editor-code-slice-start) 0 0 var(--_text-editor-code-token-highlight-border-color),
|
|
2609
|
+
inset calc(-1 * var(--_text-editor-code-slice-end)) 0 0 var(--_text-editor-code-token-highlight-border-color);
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
.cm-md-code .cm-md-code-selected-start {
|
|
2613
|
+
--_text-editor-code-slice-start: var(--_text-editor-token-highlight-border-width);
|
|
2614
|
+
border-start-start-radius: var(--_text-editor-token-corner-radius);
|
|
2615
|
+
border-end-start-radius: var(--_text-editor-token-corner-radius);
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
.cm-md-code .cm-md-code-selected-end {
|
|
2619
|
+
--_text-editor-code-slice-end: var(--_text-editor-token-highlight-border-width);
|
|
2620
|
+
border-start-end-radius: var(--_text-editor-token-corner-radius);
|
|
2621
|
+
border-end-end-radius: var(--_text-editor-token-corner-radius);
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
/* Whole code block selected: the line background (its padding-inline, the
|
|
2625
|
+
first/last line's block padding, and the rounded corners) takes the selected
|
|
2626
|
+
tint, so the block lights up edge to edge — the padding included, like a
|
|
2627
|
+
fully selected token. :host to beat the base ".cm-md-codeblock" background. */
|
|
2628
|
+
:host .cm-md-codeblock-line-selected {
|
|
2629
|
+
background-color: var(--_text-editor-code-token-is-selected-background-color);
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
|
|
2633
|
+
.cm-md-mention-token {
|
|
2634
|
+
position: relative;
|
|
2635
|
+
padding-block: var(--_text-editor-token-block-padding-fit);
|
|
2636
|
+
/* Left space equals the @ icon's vertical inset (token height minus the icon,
|
|
2637
|
+
halved), so the icon sits equally clear left, top and bottom; the right keeps
|
|
2638
|
+
the normal token inset around the name. */
|
|
2639
|
+
padding-inline: max(0em, (max(1.2em, 1lh) - var(--_text-editor-mention-icon-size)) / 2) var(--_text-editor-token-inline-padding);
|
|
2640
|
+
box-shadow: inset 0 0 0 var(--_text-editor-token-highlight-border-width) var(--_text-editor-mention-token-highlight-border-color);
|
|
2641
|
+
color: var(--_text-editor-mention-token-content-color);
|
|
2642
|
+
background-color: var(--_text-editor-mention-token-background-color);
|
|
2643
|
+
border-radius: var(--_text-editor-token-corner-radius);
|
|
2644
|
+
font-weight: 600;
|
|
2645
|
+
white-space: nowrap;
|
|
2646
|
+
cursor: default;
|
|
2647
|
+
-webkit-box-decoration-break: clone;
|
|
2648
|
+
box-decoration-break: clone;
|
|
2649
|
+
/* List/quote lines carry a negative text-indent (the hanging indent), which
|
|
2650
|
+
is inherited; Safari applies it to the token and shoves the @ over the
|
|
2651
|
+
name. Reset it so the token lays out the same everywhere. */
|
|
2652
|
+
text-indent: 0;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
.cm-md-mention-token-icon {
|
|
2656
|
+
width: var(--_text-editor-mention-icon-size);
|
|
2657
|
+
height: var(--_text-editor-mention-icon-size);
|
|
2658
|
+
margin-inline-end: 0.1em;
|
|
2659
|
+
vertical-align: -0.16em;
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
/* Generated content, not a text node: Safari spellchecks a name in the
|
|
2663
|
+
editor despite spellcheck="false", and it cannot see this. */
|
|
2664
|
+
.cm-md-mention-token-name::after {
|
|
2665
|
+
content: attr(data-label);
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
/* CodeMirror draws no selection under a token, so its rounded corners showed
|
|
2669
|
+
white. A selected token puts the selection color behind itself, in the
|
|
2670
|
+
selection layer's stacking (the scroller), so the corners take it. */
|
|
2671
|
+
.cm-md-mention-token[data-selected="within"]::before {
|
|
2672
|
+
content: '';
|
|
2673
|
+
position: absolute;
|
|
2674
|
+
inset: 0;
|
|
2675
|
+
z-index: -1;
|
|
2676
|
+
background-color: var(--_text-editor-selection-color);
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
/* A mention selected on its own keeps its rounded corners: the selection is the token. */
|
|
2680
|
+
:host .cm-editor:has(.cm-md-mention-token[data-selected="alone"]) .cm-selectionLayer {
|
|
2681
|
+
visibility: hidden;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
.cm-md-mention-token[data-selected] {
|
|
2685
|
+
box-shadow: none;
|
|
2686
|
+
color: var(--_text-editor-mention-token-is-selected-content-color);
|
|
2687
|
+
background-color: var(--_text-editor-mention-token-is-selected-background-color);
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
/* A native selection over a mention keeps its text light on the filled accent.
|
|
2691
|
+
:host bumps specificity so it wins over .cm-content ::selection wherever it sits. */
|
|
2692
|
+
:host .cm-md-mention-token ::selection {
|
|
2693
|
+
color: var(--_text-editor-mention-token-is-selected-content-color);
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
.cm-md-link {
|
|
2697
|
+
color: var(--_text-editor-link-color);
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
.cm-md-url {
|
|
2701
|
+
color: var(--_text-editor-mark-color);
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
/* The markdown highlight style tints the URL token (teal); make its span inherit
|
|
2705
|
+
the dimmed color so the address reads as secondary, like the surrounding marks. */
|
|
2706
|
+
.cm-md-url span {
|
|
2707
|
+
color: inherit;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
/* A bare / autolinked URL reads as the link itself: color it like link text,
|
|
2711
|
+
and override the highlight-style URL tint (teal) on its token span so the
|
|
2712
|
+
whole address is the link color, not just the mark wrapper. */
|
|
2713
|
+
.cm-md-autolink {
|
|
2714
|
+
color: var(--_text-editor-link-color);
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
.cm-md-autolink span {
|
|
2718
|
+
color: inherit;
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
.cm-md-quote {
|
|
2722
|
+
color: var(--_text-editor-content-color);
|
|
2723
|
+
font-style: italic;
|
|
2724
|
+
font-size: var(--_text-editor-quote-font-size);
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
.cm-md-quote-row {
|
|
2728
|
+
font-size: var(--_text-editor-quote-font-size);
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
/* Markers: dimmed (secondary color, not opacity, so contrast holds) and
|
|
2732
|
+
monospace at the 16px marker size — tidy, and a fixed-width leading prefix. */
|
|
2733
|
+
.cm-md-mark {
|
|
2734
|
+
color: var(--_text-editor-mark-color);
|
|
2735
|
+
font-family: var(--_text-editor-code-font-family);
|
|
2736
|
+
font-size: var(--_text-editor-marker-font-size);
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
.cm-md-code .cm-md-mark {
|
|
2740
|
+
font-size: 1em;
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
/* A shadow, not a border, so the line takes no room and the text stays put
|
|
2744
|
+
when the quote shows its marks instead. */
|
|
2745
|
+
/* A gradient, not an inset shadow with an offset: iOS Safari leaves a hairline
|
|
2746
|
+
of such a shadow along the bottom of a line with a fractional height. */
|
|
2747
|
+
.cm-md-quote-line {
|
|
2748
|
+
background-repeat: no-repeat;
|
|
2749
|
+
background-size: var(--_text-editor-quote-border-width) 100%;
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
.cm-md-quote-gap {
|
|
2753
|
+
padding-inline-end: var(--_text-editor-marker-advance);
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
:host .cm-md-quote-mark-hidden,
|
|
2757
|
+
:host .cm-md-quote-mark-hidden * {
|
|
2758
|
+
color: transparent;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
/* A task's box, in a width the hanging indent counts on (TASK_BOX_WIDTH in
|
|
2762
|
+
text-editor.hidden-syntax.ts), so wrapped lines line up under the text. */
|
|
2763
|
+
/* No height of its own, so a box a little taller than the text does not
|
|
2764
|
+
make its line taller than the others; the icon is centered on it. */
|
|
2765
|
+
.cm-md-listprefix:has(> .cm-md-task-box) {
|
|
2766
|
+
cursor: default;
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
.cm-md-task-box {
|
|
2770
|
+
position: relative;
|
|
2771
|
+
display: inline-flex;
|
|
2772
|
+
width: 2.5ch;
|
|
2773
|
+
height: 0;
|
|
2774
|
+
vertical-align: middle;
|
|
2775
|
+
justify-content: flex-start;
|
|
2776
|
+
align-items: center;
|
|
2777
|
+
color: var(--_text-editor-content-color);
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
/* What a press hits: one line high, from the edge of the text to where the
|
|
2781
|
+
text starts, so the space around the box counts as well. */
|
|
2782
|
+
.cm-md-task-box::before {
|
|
2783
|
+
content: '';
|
|
2784
|
+
position: absolute;
|
|
2785
|
+
top: 50%;
|
|
2786
|
+
left: calc(-1 * var(--_text-editor-padding-inline));
|
|
2787
|
+
right: 0;
|
|
2788
|
+
height: 1lh;
|
|
2789
|
+
translate: 0 -50%;
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
/* Up from the middle of the x-height to the middle of the capitals: next to
|
|
2793
|
+
a line with capitals and ascenders, that is where the eye puts its middle. */
|
|
2794
|
+
.cm-md-task-box-icon {
|
|
2795
|
+
flex-shrink: 0;
|
|
2796
|
+
width: var(--_text-editor-task-box-size);
|
|
2797
|
+
translate: 0 var(--_text-editor-task-box-shift);
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
.cm-md-task-box-label {
|
|
2801
|
+
position: absolute;
|
|
2802
|
+
width: 1px;
|
|
2803
|
+
height: 1px;
|
|
2804
|
+
overflow: hidden;
|
|
2805
|
+
clip-path: inset(50%);
|
|
2806
|
+
white-space: nowrap;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
/* The opening line of a code block is its head: the language on the left,
|
|
2810
|
+
the copy button on the right edge of the block. */
|
|
2811
|
+
.cm-md-code-head {
|
|
2812
|
+
position: relative;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
.cm-md-code-copy-wrap {
|
|
2816
|
+
position: absolute;
|
|
2817
|
+
top: 50%;
|
|
2818
|
+
right: 0;
|
|
2819
|
+
translate: 0 -50%;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
.cm-md-code-copy {
|
|
2823
|
+
display: inline-flex;
|
|
2824
|
+
gap: var(--_text-editor-code-copy-gap);
|
|
2825
|
+
align-items: center;
|
|
2826
|
+
border: none;
|
|
2827
|
+
border-radius: var(--_text-editor-token-corner-radius);
|
|
2828
|
+
background: none;
|
|
2829
|
+
padding: 0;
|
|
2830
|
+
color: var(--_text-editor-code-copy-content-color);
|
|
2831
|
+
font: var(--_text-editor-code-copy-font);
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
.cm-md-code-copy:hover {
|
|
2835
|
+
color: var(--_text-editor-code-copy-is-hovered-content-color);
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
.cm-md-code-copy:active {
|
|
2839
|
+
color: var(--_text-editor-code-copy-is-active-content-color);
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
.cm-md-code-copy:focus-visible {
|
|
2843
|
+
outline: var(--semantics-focus-ring-outline);
|
|
2844
|
+
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
2845
|
+
box-shadow: var(--semantics-focus-ring-box-shadow);
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
.cm-md-code-copy-icon {
|
|
2849
|
+
width: 1.1em;
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2852
|
+
.cm-md-code-copy-status {
|
|
2853
|
+
position: absolute;
|
|
2854
|
+
width: 1px;
|
|
2855
|
+
height: 1px;
|
|
2856
|
+
overflow: hidden;
|
|
2857
|
+
clip-path: inset(50%);
|
|
2858
|
+
white-space: nowrap;
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
.cm-md-code-language {
|
|
2862
|
+
color: var(--_text-editor-mark-color);
|
|
2863
|
+
font-family: var(--_text-editor-code-font-family);
|
|
2864
|
+
font-size: var(--_text-editor-marker-font-size);
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
.cm-md-ordinal,
|
|
2868
|
+
.cm-md-ordinal .cm-md-mark,
|
|
2869
|
+
.cm-md-mark .cm-md-ordinal {
|
|
2870
|
+
color: var(--_text-editor-content-color);
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
/* A bullet with syntax="hidden": the character keeps its mono advance, so a
|
|
2874
|
+
wrapped line still aligns under the text, and a dot is drawn over it. */
|
|
2875
|
+
.cm-md-bullet {
|
|
2876
|
+
position: relative;
|
|
2877
|
+
color: transparent;
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
.cm-md-bullet::before {
|
|
2881
|
+
content: '';
|
|
2882
|
+
position: absolute;
|
|
2883
|
+
top: 50%;
|
|
2884
|
+
left: 50%;
|
|
2885
|
+
width: var(--_text-editor-bullet-size);
|
|
2886
|
+
height: var(--_text-editor-bullet-size);
|
|
2887
|
+
transform: translate(-50%, -50%);
|
|
2888
|
+
border-radius: var(--primitives-corner-radius-full);
|
|
2889
|
+
background-color: var(--_text-editor-bullet-color);
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
/* The leading prefix (and anything nested in it, e.g. a blockquote's own
|
|
2893
|
+
span) renders at the marker size, so its width stays prefixLength × the
|
|
2894
|
+
mono advance and the hanging indent lines up exactly. */
|
|
2895
|
+
.cm-md-listprefix,
|
|
2896
|
+
.cm-md-listprefix * {
|
|
2897
|
+
font-family: var(--_text-editor-code-font-family);
|
|
2898
|
+
font-size: var(--_text-editor-marker-font-size);
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
/* # Typeahead popup */
|
|
2903
|
+
|
|
2904
|
+
/* Only a frame in the top layer for CodeMirror's tooltips, which place
|
|
2905
|
+
themselves against the window: no surface that would swallow a click. */
|
|
2906
|
+
:host .cm-nldd-popups {
|
|
2907
|
+
position: fixed;
|
|
2908
|
+
inset: 0;
|
|
2909
|
+
width: auto;
|
|
2910
|
+
height: auto;
|
|
2911
|
+
margin: 0;
|
|
2912
|
+
border: none;
|
|
2913
|
+
padding: 0;
|
|
2914
|
+
background: none;
|
|
2915
|
+
overflow: visible;
|
|
2916
|
+
pointer-events: none;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
:host .cm-nldd-popups .cm-tooltip {
|
|
2920
|
+
pointer-events: auto;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
:host .cm-tooltip.cm-tooltip-autocomplete,
|
|
2924
|
+
:host .cm-tooltip.cm-nldd-typeahead-empty {
|
|
2925
|
+
box-sizing: border-box;
|
|
2926
|
+
border: none;
|
|
2927
|
+
border-radius: var(--_text-editor-popup-corner-radius);
|
|
2928
|
+
box-shadow: var(--_text-editor-popup-box-shadow);
|
|
2929
|
+
background-color: var(--_text-editor-popup-background-color);
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
/* The .cm-tooltip prefix matches CodeMirror's specificity, so these beat its
|
|
2933
|
+
monospace font and cramped rows. */
|
|
2934
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul {
|
|
2935
|
+
box-sizing: border-box;
|
|
2936
|
+
margin: 0;
|
|
2937
|
+
padding: var(--_text-editor-popup-padding);
|
|
2938
|
+
min-width: var(--_text-editor-popup-min-width);
|
|
2939
|
+
max-height: var(--_text-editor-popup-max-height);
|
|
2940
|
+
font-family: var(--_text-editor-popup-font-family);
|
|
2941
|
+
font-size: var(--_text-editor-popup-font-size);
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li {
|
|
2945
|
+
box-sizing: border-box;
|
|
2946
|
+
display: flex;
|
|
2947
|
+
border-radius: var(--_text-editor-popup-row-corner-radius);
|
|
2948
|
+
min-height: var(--_text-editor-popup-row-min-height);
|
|
2949
|
+
padding: var(--_text-editor-popup-row-padding-block) var(--_text-editor-popup-row-padding-inline);
|
|
2950
|
+
align-items: center;
|
|
2951
|
+
gap: var(--_text-editor-popup-row-gap);
|
|
2952
|
+
color: var(--_text-editor-popup-row-content-color);
|
|
2953
|
+
cursor: default;
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li > :is(nldd-avatar, nldd-icon, .cm-nldd-symbol) {
|
|
2957
|
+
flex: none;
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
:host .cm-nldd-symbol {
|
|
2961
|
+
display: inline-flex;
|
|
2962
|
+
inline-size: var(--_text-editor-popup-symbol-size);
|
|
2963
|
+
justify-content: center;
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar {
|
|
2967
|
+
display: grid;
|
|
2968
|
+
min-height: var(--_text-editor-popup-avatar-row-min-height);
|
|
2969
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
2970
|
+
align-content: center;
|
|
2971
|
+
row-gap: 0;
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar > nldd-avatar {
|
|
2975
|
+
grid-row: span 2;
|
|
2976
|
+
align-self: center;
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar > .cm-completionLabel {
|
|
2980
|
+
grid-column: 2;
|
|
2981
|
+
font: var(--_text-editor-popup-text-font);
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar > .cm-completionDetail {
|
|
2985
|
+
grid-column: 2;
|
|
2986
|
+
margin-left: 0;
|
|
2987
|
+
font: var(--_text-editor-popup-supporting-text-font);
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected] {
|
|
2991
|
+
background-color: var(--_text-editor-popup-row-is-highlighted-background-color);
|
|
2992
|
+
color: var(--_text-editor-popup-row-is-highlighted-content-color);
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
/* CodeMirror keeps the keyboard choice selected under the pointer, so hover
|
|
2996
|
+
gets a quieter look and only on the other rows. */
|
|
2997
|
+
@media (hover: hover) {
|
|
2998
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li:not([aria-selected]):hover {
|
|
2999
|
+
background-color: var(--_text-editor-popup-row-is-hovered-background-color);
|
|
3000
|
+
color: var(--_text-editor-popup-row-is-hovered-content-color);
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
:host .cm-completionDetail {
|
|
3005
|
+
margin-left: auto;
|
|
3006
|
+
color: var(--_text-editor-popup-supporting-text-color);
|
|
3007
|
+
font-style: normal;
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
:host .cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected] .cm-completionDetail {
|
|
3011
|
+
color: inherit;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
:host .cm-nldd-typeahead-status {
|
|
3015
|
+
position: absolute;
|
|
3016
|
+
width: 1px;
|
|
3017
|
+
height: 1px;
|
|
3018
|
+
overflow: hidden;
|
|
3019
|
+
clip-path: inset(50%);
|
|
3020
|
+
white-space: nowrap;
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
:host .cm-tooltip.cm-nldd-typeahead-empty {
|
|
3024
|
+
min-width: var(--_text-editor-popup-min-width);
|
|
3025
|
+
max-width: var(--_text-editor-popup-message-max-width);
|
|
3026
|
+
padding: var(--_text-editor-popup-message-padding-block) var(--_text-editor-popup-message-padding-inline);
|
|
3027
|
+
color: var(--_text-editor-popup-message-color);
|
|
3028
|
+
font-family: var(--_text-editor-popup-font-family);
|
|
3029
|
+
font-size: var(--_text-editor-popup-font-size);
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
|
|
3033
|
+
/* # Annotation overlay
|
|
3034
|
+
A light body tint marks the annotated text; a solid badge (the nub) sits at
|
|
3035
|
+
the end carrying the count, the cue that does not rest on color. One role
|
|
3036
|
+
for all annotations — the type is communicated by the consumer's pane. */
|
|
3037
|
+
|
|
3038
|
+
/* One cohesive yellow block: the light tint with rounded corners and a reserved
|
|
3039
|
+
space on the right for the solid nub (which lives inside this run, so it
|
|
3040
|
+
shares the tint and wraps with the text). box-decoration-break keeps the
|
|
3041
|
+
tint + rounding on every wrapped fragment; padding-block extends the tint
|
|
3042
|
+
without growing the line (vertical padding on an inline box is visual only). */
|
|
3043
|
+
.cm-annotation {
|
|
3044
|
+
background-color: var(--_text-editor-annotation-token-background-color);
|
|
3045
|
+
border-radius: var(--_text-editor-token-corner-radius);
|
|
3046
|
+
padding-block: var(--_text-editor-token-block-padding-fit);
|
|
3047
|
+
/* Right space mirrors the badge's vertical inset (token height minus the badge,
|
|
3048
|
+
halved), so the badge sits equally clear of the top, bottom and right edges.
|
|
3049
|
+
Token height is max(1.2em text box, 1lh); the badge height in token units is
|
|
3050
|
+
its box × its font scale. */
|
|
3051
|
+
padding-inline: var(--_text-editor-token-inline-padding)
|
|
3052
|
+
max(0em, (max(1.2em, 1lh) - var(--_text-editor-annotation-badge-size) * var(--_text-editor-annotation-badge-font-scale)) / 2);
|
|
3053
|
+
-webkit-box-decoration-break: clone;
|
|
3054
|
+
box-decoration-break: clone;
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
/* The annotated text's last word plus the badge, kept on one line so the badge
|
|
3058
|
+
never wraps onto a line by itself. Only this tail is nowrap; earlier words in a
|
|
3059
|
+
long annotation still wrap normally. :host to beat CM's own white-space rule. */
|
|
3060
|
+
:host .cm-annotation-tail {
|
|
3061
|
+
white-space: nowrap;
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
/* Selected annotation text in a darker yellow: the whole annotation
|
|
3065
|
+
(.cm-annotation.is-selected) or a slice of a partly-selected one (nested,
|
|
3066
|
+
.cm-annotation .is-selected). drawSelection's layer sits behind the tint, so this
|
|
3067
|
+
stands in for the hidden selection; the text takes the strongest content color. */
|
|
3068
|
+
.cm-annotation.is-selected,
|
|
3069
|
+
.cm-annotation .is-selected {
|
|
3070
|
+
background-color: var(--_text-editor-annotation-token-is-selected-background-color);
|
|
3071
|
+
color: var(--_text-editor-annotation-token-is-selected-content-color);
|
|
3072
|
+
}
|
|
3073
|
+
|
|
3074
|
+
.cm-content ::selection {
|
|
3075
|
+
color: var(--_text-editor-selection-content-color);
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
.cm-annotation ::selection {
|
|
3079
|
+
color: var(--_text-editor-annotation-token-is-selected-content-color);
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
.cm-annotation-badge {
|
|
3083
|
+
box-sizing: border-box;
|
|
3084
|
+
display: inline-flex;
|
|
3085
|
+
position: relative;
|
|
3086
|
+
align-items: center;
|
|
3087
|
+
justify-content: center;
|
|
3088
|
+
min-width: var(--_text-editor-annotation-badge-size);
|
|
3089
|
+
height: var(--_text-editor-annotation-badge-size);
|
|
3090
|
+
margin-inline: 0.4em 0;
|
|
3091
|
+
padding-inline: 0.3em;
|
|
3092
|
+
border: 0;
|
|
3093
|
+
border-radius: var(--primitives-corner-radius-full);
|
|
3094
|
+
background-color: var(--_text-editor-annotation-token-badge-background-color);
|
|
3095
|
+
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-annotation-token-badge-highlight-border-color);
|
|
3096
|
+
color: var(--_text-editor-annotation-token-badge-content-color);
|
|
3097
|
+
/* vertical-align: middle lands the nub ~1px below the text's em-box center, and
|
|
3098
|
+
the optical middle of the ink sits higher again, so it reads low; nudge up onto
|
|
3099
|
+
it. The em is the badge's own (scaled-down) font size, so the value is larger
|
|
3100
|
+
than it looks and scales with the token in headings. */
|
|
3101
|
+
vertical-align: middle;
|
|
3102
|
+
transform: translateY(-0.11em);
|
|
3103
|
+
font-family: var(--_text-editor-annotation-badge-font-family);
|
|
3104
|
+
font-size: calc(var(--_text-editor-annotation-badge-font-scale) * 1em);
|
|
3105
|
+
font-weight: 700;
|
|
3106
|
+
line-height: 1;
|
|
3107
|
+
cursor: default;
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
/* Enlarges the badge's hit area into the reserved space around it. */
|
|
3111
|
+
.cm-annotation-badge::before {
|
|
3112
|
+
content: '';
|
|
3113
|
+
position: absolute;
|
|
3114
|
+
inset-block: -0.3em;
|
|
3115
|
+
inset-inline: -0.55em -0.45em;
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
@media (hover: hover) {
|
|
3119
|
+
.cm-annotation-badge:hover {
|
|
3120
|
+
background-color: var(--_text-editor-annotation-token-badge-is-hovered-background-color);
|
|
3121
|
+
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-annotation-token-badge-is-hovered-highlight-border-color);
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
.cm-annotation-badge:active {
|
|
3126
|
+
background-color: var(--_text-editor-annotation-token-badge-is-active-background-color);
|
|
3127
|
+
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-annotation-token-badge-is-active-highlight-border-color);
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
/* The nub darkens with the block only when the whole annotation is selected (full
|
|
3131
|
+
mark) or the slice covering it is (a selection running through the badge). */
|
|
3132
|
+
.cm-annotation.is-selected .cm-annotation-badge,
|
|
3133
|
+
.cm-annotation .is-selected .cm-annotation-badge {
|
|
3134
|
+
background-color: var(--_text-editor-annotation-token-is-selected-badge-background-color);
|
|
3135
|
+
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-annotation-token-is-selected-badge-highlight-border-color);
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
.cm-annotation-badge:focus-visible {
|
|
3139
|
+
outline: var(--semantics-focus-ring-outline);
|
|
3140
|
+
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
3141
|
+
box-shadow: var(--semantics-focus-ring-box-shadow);
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
.cm-annotation-badge:focus:not(:focus-visible) {
|
|
3145
|
+
outline: none;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
@media (forced-colors: active) {
|
|
3149
|
+
.cm-annotation,
|
|
3150
|
+
.cm-md-mention-token {
|
|
3151
|
+
outline: 1px solid currentColor;
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
/* Drop cursor shown while dragging selected text to a new spot. An absolutely
|
|
3156
|
+
positioned overlay (not an inline widget), so it never splits an annotation it
|
|
3157
|
+
lands inside. A thin surface-colored halo keeps the accent bar clearly visible
|
|
3158
|
+
over tinted tokens too. Left/top/height are set by the drop-cursor plugin. */
|
|
3159
|
+
.cm-drag-and-drop-cursor {
|
|
3160
|
+
position: absolute;
|
|
3161
|
+
width: var(--primitives-border-width-regular);
|
|
3162
|
+
border-radius: var(--primitives-border-width-thin);
|
|
3163
|
+
background-color: var(--_text-editor-drop-cursor-color);
|
|
3164
|
+
box-shadow: 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-caret-ring-color);
|
|
3165
|
+
pointer-events: none;
|
|
3166
|
+
z-index: 4;
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
.cm-drag-ghost {
|
|
3170
|
+
position: fixed;
|
|
3171
|
+
z-index: 5;
|
|
3172
|
+
max-width: 24ch;
|
|
3173
|
+
padding: 0 var(--primitives-space-4);
|
|
3174
|
+
border-radius: var(--_text-editor-token-corner-radius);
|
|
3175
|
+
background-color: var(--_text-editor-drag-ghost-background-color);
|
|
3176
|
+
color: var(--_text-editor-content-color);
|
|
3177
|
+
font: var(--_text-editor-font);
|
|
3178
|
+
white-space: nowrap;
|
|
3179
|
+
overflow: hidden;
|
|
3180
|
+
text-overflow: ellipsis;
|
|
3181
|
+
opacity: 0.65;
|
|
3182
|
+
pointer-events: none;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
.cm-link-badge {
|
|
3186
|
+
box-sizing: border-box;
|
|
3187
|
+
display: inline-flex;
|
|
3188
|
+
align-items: center;
|
|
3189
|
+
justify-content: center;
|
|
3190
|
+
margin-inline: var(--_text-editor-link-badge-gap);
|
|
3191
|
+
min-width: var(--_text-editor-link-badge-size);
|
|
3192
|
+
height: var(--_text-editor-link-badge-size);
|
|
3193
|
+
border-radius: var(--primitives-corner-radius-full);
|
|
3194
|
+
background-color: var(--_text-editor-link-badge-background-color);
|
|
3195
|
+
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-link-badge-highlight-border-color);
|
|
3196
|
+
color: var(--_text-editor-link-badge-content-color);
|
|
3197
|
+
/* Match the annotation nub's optical centering next to the ink. */
|
|
3198
|
+
vertical-align: middle;
|
|
3199
|
+
transform: translateY(-0.05em);
|
|
3200
|
+
text-decoration: none;
|
|
3201
|
+
cursor: pointer;
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
@media (hover: hover) {
|
|
3205
|
+
.cm-link-badge:hover {
|
|
3206
|
+
background-color: var(--_text-editor-link-badge-is-hovered-background-color);
|
|
3207
|
+
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-link-badge-is-hovered-highlight-border-color);
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
.cm-link-badge:active {
|
|
3212
|
+
background-color: var(--_text-editor-link-badge-is-active-background-color);
|
|
3213
|
+
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_text-editor-link-badge-is-active-highlight-border-color);
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
.cm-link-badge nldd-icon {
|
|
3217
|
+
flex: none;
|
|
3218
|
+
width: calc(0.65 * var(--_text-editor-link-badge-size));
|
|
3219
|
+
height: calc(0.65 * var(--_text-editor-link-badge-size));
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
.cm-link-badge:focus-visible {
|
|
3223
|
+
outline: var(--semantics-focus-ring-outline);
|
|
3224
|
+
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
3225
|
+
box-shadow: var(--semantics-focus-ring-box-shadow);
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
.cm-link-badge:focus:not(:focus-visible) {
|
|
3229
|
+
outline: none;
|
|
3230
|
+
}
|
|
3231
|
+
`;
|
|
3232
|
+
// src/components/inputs/text-editor/text-editor.template.ts
|
|
3233
|
+
function Ji(e) {
|
|
3234
|
+
return de`<div class="text-editor"></div>`;
|
|
3235
|
+
}
|
|
3236
|
+
// src/components/inputs/text-editor/text-editor.code-copy.ts
|
|
3237
|
+
var Z = g.define({ combine: (e) => e[0] ?? {
|
|
3238
|
+
copy: () => "Kopieer",
|
|
3239
|
+
success: () => "Gekopieerd",
|
|
3240
|
+
failure: () => "Kopiëren mislukt"
|
|
3241
|
+
} }), Yi = 2e3;
|
|
3242
|
+
function Xi() {
|
|
3243
|
+
return typeof window < "u" && window.isSecureContext && typeof navigator.clipboard?.writeText == "function";
|
|
3244
|
+
}
|
|
3245
|
+
function Zi(e, t) {
|
|
3246
|
+
let r = "";
|
|
3247
|
+
return n(e).iterate({
|
|
3248
|
+
from: t,
|
|
3249
|
+
to: t,
|
|
3250
|
+
enter: (n) => {
|
|
3251
|
+
if (n.name !== "FencedCode" || n.from !== t) return;
|
|
3252
|
+
let i = n.node.getChild("CodeText");
|
|
3253
|
+
return i && (r = e.sliceDoc(i.from, i.to)), !1;
|
|
3254
|
+
}
|
|
3255
|
+
}), r;
|
|
3256
|
+
}
|
|
3257
|
+
function Q(e, t, n) {
|
|
3258
|
+
e.dataset.state = n, e.querySelector("nldd-icon").setAttribute("icon", n === "success" ? "check-mark" : "copy");
|
|
3259
|
+
let r = n === "success" ? t.success() : n === "failure" ? t.failure() : t.copy();
|
|
3260
|
+
e.querySelector(".cm-md-code-copy-text").textContent = r, e.nextElementSibling.textContent = n === "idle" ? "" : r;
|
|
3261
|
+
}
|
|
3262
|
+
var Qi = /* @__PURE__ */ new WeakMap(), $i = class extends f {
|
|
3263
|
+
constructor(e, t, n) {
|
|
3264
|
+
super(), this.lineFrom = e, this.focusable = t, this.label = n;
|
|
3265
|
+
}
|
|
3266
|
+
eq(e) {
|
|
3267
|
+
return e.lineFrom === this.lineFrom && e.focusable === this.focusable && e.label === this.label;
|
|
3268
|
+
}
|
|
3269
|
+
toDOM(e) {
|
|
3270
|
+
let t = () => e.state.facet(Z), n = document.createElement("button");
|
|
3271
|
+
n.type = "button", n.className = "cm-md-code-copy", this.focusable || (n.tabIndex = -1);
|
|
3272
|
+
let r = document.createElement("nldd-icon");
|
|
3273
|
+
r.setAttribute("aria-hidden", "true"), r.className = "cm-md-code-copy-icon";
|
|
3274
|
+
let i = document.createElement("span");
|
|
3275
|
+
i.className = "cm-md-code-copy-text";
|
|
3276
|
+
let a = document.createElement("span");
|
|
3277
|
+
a.className = "cm-md-code-copy-status", a.setAttribute("role", "status"), n.append(r, i);
|
|
3278
|
+
let o = document.createElement("span");
|
|
3279
|
+
return o.className = "cm-md-code-copy-wrap", o.append(n, a), Q(n, t(), "idle"), n.addEventListener("mousedown", (e) => e.preventDefault()), n.addEventListener("click", async () => {
|
|
3280
|
+
clearTimeout(Qi.get(o));
|
|
3281
|
+
try {
|
|
3282
|
+
await navigator.clipboard.writeText(Zi(e.state, e.state.doc.lineAt(e.posAtDOM(n)).from)), Q(n, t(), "success"), Qi.set(o, setTimeout(() => Q(n, t(), "idle"), Yi));
|
|
3283
|
+
} catch {
|
|
3284
|
+
Q(n, t(), "failure");
|
|
3285
|
+
}
|
|
3286
|
+
}), n.addEventListener("blur", () => {
|
|
3287
|
+
n.dataset.state === "failure" && Q(n, t(), "idle");
|
|
3288
|
+
}), n.addEventListener("keydown", (e) => {
|
|
3289
|
+
e.key === "Escape" && n.dataset.state === "failure" && Q(n, t(), "idle");
|
|
3290
|
+
}), o;
|
|
3291
|
+
}
|
|
3292
|
+
destroy(e) {
|
|
3293
|
+
clearTimeout(Qi.get(e));
|
|
3294
|
+
}
|
|
3295
|
+
ignoreEvent() {
|
|
3296
|
+
return !0;
|
|
3297
|
+
}
|
|
3298
|
+
};
|
|
3299
|
+
function ea(e) {
|
|
3300
|
+
if (!Xi()) return d.none;
|
|
3301
|
+
let t = [], r = e.readOnly, i = e.facet(Z).copy();
|
|
3302
|
+
return n(e).iterate({ enter: (n) => {
|
|
3303
|
+
if (n.name !== "FencedCode") return;
|
|
3304
|
+
let a = e.doc.lineAt(n.from);
|
|
3305
|
+
return t.push(ta.range(a.from), d.widget({
|
|
3306
|
+
widget: new $i(a.from, r, i),
|
|
3307
|
+
side: 1
|
|
3308
|
+
}).range(a.to)), !1;
|
|
3309
|
+
} }), d.set(t, !0);
|
|
3310
|
+
}
|
|
3311
|
+
var ta = d.line({ class: "cm-md-code-head" });
|
|
3312
|
+
function na(e, t) {
|
|
3313
|
+
let n = t.state.facet(Z);
|
|
3314
|
+
for (let e of t.dom.querySelectorAll(".cm-md-code-copy[data-state=\"failure\"]")) Q(e, n, "idle");
|
|
3315
|
+
return !1;
|
|
3316
|
+
}
|
|
3317
|
+
var ra = t.domEventHandlers({
|
|
3318
|
+
mousedown: na,
|
|
3319
|
+
keydown: na
|
|
3320
|
+
});
|
|
3321
|
+
function ia(e) {
|
|
3322
|
+
let n = b.define({
|
|
3323
|
+
create: ea,
|
|
3324
|
+
update: (e, t) => t.docChanged || t.reconfigured || w(t.startState, t.state) ? ea(t.state) : e,
|
|
3325
|
+
provide: (e) => t.decorations.from(e)
|
|
3326
|
+
});
|
|
3327
|
+
return [
|
|
3328
|
+
Z.of(e),
|
|
3329
|
+
n,
|
|
3330
|
+
ra
|
|
3331
|
+
];
|
|
3332
|
+
}
|
|
3333
|
+
// src/components/inputs/text-editor/text-editor.ts
|
|
3334
|
+
var aa = class extends De {
|
|
3335
|
+
constructor(...e) {
|
|
3336
|
+
super(...e), this.noSpellcheck = !1, this.wrap = !0, this.resize = "auto", this.appearance = "simple", this.syntax = "visible", this.typeaheads = [], this._mentionTypeahead = ((e) => ({
|
|
3337
|
+
trigger: "@",
|
|
3338
|
+
source: (t) => e.mentionSource?.(t) ?? [],
|
|
3339
|
+
insert: Be,
|
|
3340
|
+
get query() {
|
|
3341
|
+
return e.mentionQuery;
|
|
3342
|
+
},
|
|
3343
|
+
get emptyText() {
|
|
3344
|
+
return e.mentionEmptyText;
|
|
3345
|
+
}
|
|
3346
|
+
}))(this), this.annotatable = !1, this.annotations = [], this.translations = {}, this.rowsProperty = "--_text-editor-rows", this._wrapCompartment = new h(), this._spellcheckCompartment = new h(), this._historyCompartment = new h(), this._syntaxCompartment = new h(), this._labels = null, this._clipboard = new ir(), this._lastState = null, this._onMentionPointerDown = (e) => {
|
|
3347
|
+
let t = e.target?.closest?.(".cm-md-mention-token");
|
|
3348
|
+
if (!t || !this.view || this.view.state.readOnly) return;
|
|
3349
|
+
let n = Qe(this.view.state, this.view.posAtDOM(t));
|
|
3350
|
+
n && (e.preventDefault(), e.stopPropagation(), this.view.dispatch({ selection: {
|
|
3351
|
+
anchor: n.from,
|
|
3352
|
+
head: n.to
|
|
3353
|
+
} }), this.view.focus(), e.button !== 0 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey || this.view.plugin(zr)?.startFor(e, n.from, n.to));
|
|
3354
|
+
}, this._onAnnotationBadgeClick = (e) => {
|
|
3355
|
+
let t = e.target?.closest?.(".cm-annotation-badge");
|
|
3356
|
+
if (!t) return;
|
|
3357
|
+
let n = (t.dataset.annotations ?? "").split(" ").filter(Boolean);
|
|
3358
|
+
n.length && (e.preventDefault(), this.dispatchEvent(new CustomEvent("nldd-text-editor-annotation-click", {
|
|
3359
|
+
detail: {
|
|
3360
|
+
ids: n,
|
|
3361
|
+
rect: t.getBoundingClientRect()
|
|
3362
|
+
},
|
|
3363
|
+
bubbles: !0,
|
|
3364
|
+
composed: !0
|
|
3365
|
+
})));
|
|
3366
|
+
};
|
|
3367
|
+
}
|
|
3368
|
+
getEditorParent() {
|
|
3369
|
+
return this._container;
|
|
3370
|
+
}
|
|
3371
|
+
_t(e, t) {
|
|
3372
|
+
return _e(this.translations, ke, e, t);
|
|
3373
|
+
}
|
|
3374
|
+
_labelSignature() {
|
|
3375
|
+
return [
|
|
3376
|
+
"components.text-editor.open-in-new-tab-label",
|
|
3377
|
+
"components.text-editor.annotation-count-label",
|
|
3378
|
+
"components.text-editor.annotation-singular-lowercase",
|
|
3379
|
+
"components.text-editor.annotation-plural-lowercase",
|
|
3380
|
+
"components.text-editor.task-open-label",
|
|
3381
|
+
"components.text-editor.task-done-label",
|
|
3382
|
+
"components.text-editor.copy-code-action"
|
|
3383
|
+
].map((e) => this._t(e)).join("\n");
|
|
3384
|
+
}
|
|
3385
|
+
buildExtensions() {
|
|
3386
|
+
return [
|
|
3387
|
+
re,
|
|
3388
|
+
Xt,
|
|
3389
|
+
fn(() => this._typeaheadLists(), (e) => this._onTypeaheadChosen(e), (e) => this._t(e ? "components.text-editor.typeahead-no-results-text" : "components.text-editor.typeahead-start-typing-text"), (e) => e === 1 ? this._t("components.text-editor.typeahead-one-result-text") : this._t("components.text-editor.typeahead-results-text", { count: e })),
|
|
3390
|
+
v.low(Pr),
|
|
3391
|
+
rr((e, t) => this._t("components.text-editor.annotation-count-label", {
|
|
3392
|
+
count: e,
|
|
3393
|
+
noun: this._t(e === 1 ? "components.text-editor.annotation-singular-lowercase" : "components.text-editor.annotation-plural-lowercase"),
|
|
3394
|
+
quote: t
|
|
3395
|
+
})),
|
|
3396
|
+
v.highest(ut((e) => this._t("components.text-editor.open-in-new-tab-label", { url: e }))),
|
|
3397
|
+
ia({
|
|
3398
|
+
copy: () => this._t("components.text-editor.copy-code-action"),
|
|
3399
|
+
success: () => this._t("components.text-editor.code-copy-success-text"),
|
|
3400
|
+
failure: () => this._t("components.text-editor.code-copy-failure-text")
|
|
3401
|
+
}),
|
|
3402
|
+
si({
|
|
3403
|
+
open: () => this._t("components.text-editor.task-open-label"),
|
|
3404
|
+
done: () => this._t("components.text-editor.task-done-label")
|
|
3405
|
+
}),
|
|
3406
|
+
this._historyCompartment.of(ve()),
|
|
3407
|
+
r(),
|
|
3408
|
+
Ki,
|
|
3409
|
+
Zr,
|
|
3410
|
+
$r(),
|
|
3411
|
+
a(),
|
|
3412
|
+
Br,
|
|
3413
|
+
Dr,
|
|
3414
|
+
...this.inputExtensions(),
|
|
3415
|
+
this._wrapCompartment.of(this.wrap ? t.lineWrapping : []),
|
|
3416
|
+
this._spellcheckCompartment.of(this.noSpellcheck ? [] : Tn()),
|
|
3417
|
+
this._syntaxCompartment.of(this.syntax === "hidden" ? Hi() : []),
|
|
3418
|
+
t.updateListener.of((e) => {
|
|
3419
|
+
(e.docChanged || e.selectionSet) && this._emitState();
|
|
3420
|
+
}),
|
|
3421
|
+
t.domEventHandlers({
|
|
3422
|
+
mousedown: (e, t) => {
|
|
3423
|
+
if (e.detail < 3) return !1;
|
|
3424
|
+
let n = t.posAtCoords({
|
|
3425
|
+
x: e.clientX,
|
|
3426
|
+
y: e.clientY
|
|
3427
|
+
});
|
|
3428
|
+
if (n === null) return !1;
|
|
3429
|
+
let r = t.state.doc.lineAt(n);
|
|
3430
|
+
return t.dispatch({ selection: {
|
|
3431
|
+
anchor: r.from,
|
|
3432
|
+
head: r.to
|
|
3433
|
+
} }), e.preventDefault(), !0;
|
|
3434
|
+
},
|
|
3435
|
+
cut: (e, t) => (this._clipboard.rememberCut(t), !1),
|
|
3436
|
+
copy: () => (this._clipboard.forget(), !1),
|
|
3437
|
+
paste: (e, t) => {
|
|
3438
|
+
let n = e.clipboardData?.getData("text/plain");
|
|
3439
|
+
return n !== void 0 && (this._clipboard.paste(t, n), e.preventDefault(), !0);
|
|
3440
|
+
}
|
|
3441
|
+
})
|
|
3442
|
+
];
|
|
3443
|
+
}
|
|
3444
|
+
_redrawForSpellcheck() {
|
|
3445
|
+
let e = this.view;
|
|
3446
|
+
if (!e) return;
|
|
3447
|
+
let t = e.hasFocus;
|
|
3448
|
+
e.setState(e.state), t && e.focus();
|
|
3449
|
+
}
|
|
3450
|
+
contentAttributes() {
|
|
3451
|
+
return {
|
|
3452
|
+
autocorrect: "on",
|
|
3453
|
+
autocapitalize: "sentences"
|
|
3454
|
+
};
|
|
3455
|
+
}
|
|
3456
|
+
docToValue(e) {
|
|
3457
|
+
return F(e);
|
|
3458
|
+
}
|
|
3459
|
+
beforeChangeCheck(e) {
|
|
3460
|
+
Et(e);
|
|
3461
|
+
}
|
|
3462
|
+
onEditorMounted() {
|
|
3463
|
+
super.onEditorMounted(), this.view?.contentDOM.addEventListener("pointerdown", this._onMentionPointerDown, !0), this.view?.contentDOM.addEventListener("click", this._onAnnotationBadgeClick), this._syncAnnotations(), this._emitState();
|
|
3464
|
+
}
|
|
3465
|
+
updated(e) {
|
|
3466
|
+
if (super.updated(e), import.meta.env?.DEV && e.has("typeaheads") && he(this, "invalid-typeahead-query", en(this.typeaheads)), !this.view) return;
|
|
3467
|
+
let n = this._labelSignature();
|
|
3468
|
+
n !== this._labels && (this._labels !== null && this.view.dispatch({ effects: Ae.of(null) }), this._labels = n), e.has("wrap") && this.reconfigure(this._wrapCompartment, this.wrap ? t.lineWrapping : []), e.has("syntax") && this.reconfigure(this._syntaxCompartment, this.syntax === "hidden" ? Hi() : []), e.has("noSpellcheck") && (this.reconfigure(this._spellcheckCompartment, this.noSpellcheck ? [] : Tn()), this._redrawForSpellcheck()), (e.has("annotations") || e.has("annotatable")) && this._syncAnnotations();
|
|
3469
|
+
}
|
|
3470
|
+
_syncAnnotations() {
|
|
3471
|
+
this.view?.dispatch({
|
|
3472
|
+
effects: Nn.of(this.annotatable ? this.annotations : []),
|
|
3473
|
+
annotations: ee.addToHistory.of(!1)
|
|
3474
|
+
});
|
|
3475
|
+
}
|
|
3476
|
+
toggleBold() {
|
|
3477
|
+
this.view && V(this.view, "**", "StrongEmphasis");
|
|
3478
|
+
}
|
|
3479
|
+
toggleItalic() {
|
|
3480
|
+
this.view && V(this.view, "*", "Emphasis");
|
|
3481
|
+
}
|
|
3482
|
+
toggleInlineCode() {
|
|
3483
|
+
this.view && V(this.view, "`", "InlineCode");
|
|
3484
|
+
}
|
|
3485
|
+
toggleStrikethrough() {
|
|
3486
|
+
this.view && V(this.view, "~~", "Strikethrough");
|
|
3487
|
+
}
|
|
3488
|
+
toggleHeading(e) {
|
|
3489
|
+
this.view && ur(this.view, e);
|
|
3490
|
+
}
|
|
3491
|
+
setHeading(e) {
|
|
3492
|
+
this.view && dr(this.view, e);
|
|
3493
|
+
}
|
|
3494
|
+
toggleBulletList() {
|
|
3495
|
+
this.view && fr(this.view);
|
|
3496
|
+
}
|
|
3497
|
+
toggleTaskList() {
|
|
3498
|
+
this.view && pr(this.view);
|
|
3499
|
+
}
|
|
3500
|
+
setList(e) {
|
|
3501
|
+
this.view && hr(this.view, e);
|
|
3502
|
+
}
|
|
3503
|
+
toggleQuote() {
|
|
3504
|
+
this.view && Sr(this.view);
|
|
3505
|
+
}
|
|
3506
|
+
toggleLink(e = "") {
|
|
3507
|
+
this.view && wr(this.view, e);
|
|
3508
|
+
}
|
|
3509
|
+
toggleCodeBlock() {
|
|
3510
|
+
this.view && Tr(this.view);
|
|
3511
|
+
}
|
|
3512
|
+
indent() {
|
|
3513
|
+
this.view && _r(this.view);
|
|
3514
|
+
}
|
|
3515
|
+
outdent() {
|
|
3516
|
+
this.view && vr(this.view);
|
|
3517
|
+
}
|
|
3518
|
+
undo() {
|
|
3519
|
+
this.view && (Oe(this.view), this.view.focus());
|
|
3520
|
+
}
|
|
3521
|
+
redo() {
|
|
3522
|
+
this.view && (ye(this.view), this.view.focus());
|
|
3523
|
+
}
|
|
3524
|
+
clearHistory() {
|
|
3525
|
+
let e = this.view;
|
|
3526
|
+
e && (e.dispatch({ effects: this._historyCompartment.reconfigure([]) }), e.dispatch({ effects: this._historyCompartment.reconfigure(ve()) }), this._emitState());
|
|
3527
|
+
}
|
|
3528
|
+
async copy() {
|
|
3529
|
+
if (!this.view || this.view.state.selection.main.empty) return;
|
|
3530
|
+
let e = this._clipboard.selectedText(this.view);
|
|
3531
|
+
this._clipboard.forget();
|
|
3532
|
+
try {
|
|
3533
|
+
await navigator.clipboard.writeText(e);
|
|
3534
|
+
} catch {}
|
|
3535
|
+
this.view?.focus();
|
|
3536
|
+
}
|
|
3537
|
+
async cut() {
|
|
3538
|
+
if (!this.view || this.view.state.readOnly || this.view.state.selection.main.empty) return;
|
|
3539
|
+
let e = this._clipboard.selectedText(this.view);
|
|
3540
|
+
this._clipboard.rememberCut(this.view);
|
|
3541
|
+
try {
|
|
3542
|
+
await navigator.clipboard.writeText(e);
|
|
3543
|
+
} catch {}
|
|
3544
|
+
this.view && (this.view.dispatch(this.view.state.replaceSelection("")), this.view.focus());
|
|
3545
|
+
}
|
|
3546
|
+
async paste() {
|
|
3547
|
+
if (!this.view) return;
|
|
3548
|
+
let e;
|
|
3549
|
+
try {
|
|
3550
|
+
e = await navigator.clipboard.readText();
|
|
3551
|
+
} catch {
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3554
|
+
this.view && this._clipboard.paste(this.view, e), this.view?.focus();
|
|
3555
|
+
}
|
|
3556
|
+
insertAtCursor(e) {
|
|
3557
|
+
if (!this.view || this.view.state.readOnly) return;
|
|
3558
|
+
let t = F(e);
|
|
3559
|
+
t && this.view.dispatch({
|
|
3560
|
+
...this.view.state.replaceSelection(t),
|
|
3561
|
+
userEvent: "input"
|
|
3562
|
+
}), this.view.focus();
|
|
3563
|
+
}
|
|
3564
|
+
replaceRange(e, t, n) {
|
|
3565
|
+
if (!this.view || this.view.state.readOnly) return;
|
|
3566
|
+
let r = this.view.state.doc.toString(), i = En(r), a = r.length - i.length, o = Math.max(0, Math.min(e, a)), s = Math.max(o, Math.min(t, a)), c = F(n), l = L(i, o), u = L(i, s);
|
|
3567
|
+
this.view.dispatch({
|
|
3568
|
+
changes: {
|
|
3569
|
+
from: l,
|
|
3570
|
+
to: u,
|
|
3571
|
+
insert: c
|
|
3572
|
+
},
|
|
3573
|
+
selection: { anchor: l + c.length },
|
|
3574
|
+
userEvent: "input"
|
|
3575
|
+
}), this.view.focus();
|
|
3576
|
+
}
|
|
3577
|
+
runCommand(e, t) {
|
|
3578
|
+
let n = (e) => typeof t == "number" ? t : e;
|
|
3579
|
+
switch (e) {
|
|
3580
|
+
case "bold":
|
|
3581
|
+
this.toggleBold();
|
|
3582
|
+
break;
|
|
3583
|
+
case "italic":
|
|
3584
|
+
this.toggleItalic();
|
|
3585
|
+
break;
|
|
3586
|
+
case "inlineCode":
|
|
3587
|
+
this.toggleInlineCode();
|
|
3588
|
+
break;
|
|
3589
|
+
case "strikethrough":
|
|
3590
|
+
this.toggleStrikethrough();
|
|
3591
|
+
break;
|
|
3592
|
+
case "bulletList":
|
|
3593
|
+
this.toggleBulletList();
|
|
3594
|
+
break;
|
|
3595
|
+
case "taskList":
|
|
3596
|
+
this.toggleTaskList();
|
|
3597
|
+
break;
|
|
3598
|
+
case "quote":
|
|
3599
|
+
this.toggleQuote();
|
|
3600
|
+
break;
|
|
3601
|
+
case "codeBlock":
|
|
3602
|
+
this.toggleCodeBlock();
|
|
3603
|
+
break;
|
|
3604
|
+
case "heading":
|
|
3605
|
+
this.toggleHeading(n(1));
|
|
3606
|
+
break;
|
|
3607
|
+
case "setHeading":
|
|
3608
|
+
this.setHeading(n(0));
|
|
3609
|
+
break;
|
|
3610
|
+
case "setList":
|
|
3611
|
+
this.setList(typeof t == "string" ? t : "none");
|
|
3612
|
+
break;
|
|
3613
|
+
case "link":
|
|
3614
|
+
this.toggleLink(typeof t == "string" ? t : "");
|
|
3615
|
+
break;
|
|
3616
|
+
case "indent":
|
|
3617
|
+
this.indent();
|
|
3618
|
+
break;
|
|
3619
|
+
case "outdent":
|
|
3620
|
+
this.outdent();
|
|
3621
|
+
break;
|
|
3622
|
+
case "undo":
|
|
3623
|
+
this.undo();
|
|
3624
|
+
break;
|
|
3625
|
+
case "redo":
|
|
3626
|
+
this.redo();
|
|
3627
|
+
break;
|
|
3628
|
+
case "copy":
|
|
3629
|
+
this.copy();
|
|
3630
|
+
break;
|
|
3631
|
+
case "cut":
|
|
3632
|
+
this.cut();
|
|
3633
|
+
break;
|
|
3634
|
+
case "paste":
|
|
3635
|
+
this.paste();
|
|
3636
|
+
break;
|
|
3637
|
+
default: he(this, "unknown-command", !0);
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
getState() {
|
|
3641
|
+
return {
|
|
3642
|
+
active: this.view ? Er(this.view) : { ...ar },
|
|
3643
|
+
empty: !this.view || this.view.state.selection.main.empty,
|
|
3644
|
+
canIndent: this.view ? yr(this.view) : !1,
|
|
3645
|
+
canOutdent: this.view ? br(this.view) : !1,
|
|
3646
|
+
canUndo: this.view ? be(this.view.state) > 0 : !1,
|
|
3647
|
+
canRedo: this.view ? Se(this.view.state) > 0 : !1
|
|
3648
|
+
};
|
|
3649
|
+
}
|
|
3650
|
+
getSelection() {
|
|
3651
|
+
let e = this.view;
|
|
3652
|
+
if (!e) return {
|
|
3653
|
+
start: 0,
|
|
3654
|
+
end: 0,
|
|
3655
|
+
quote: "",
|
|
3656
|
+
empty: !0,
|
|
3657
|
+
rect: null
|
|
3658
|
+
};
|
|
3659
|
+
let t = e.state.doc.toString(), n = e.state.selection.main, r = I(t, n.from), i = I(t, n.to), a = e.coordsAtPos(n.from), o = e.coordsAtPos(n.to), s = a && o ? new DOMRect(Math.min(a.left, o.left), Math.min(a.top, o.top), Math.max(a.right, o.right) - Math.min(a.left, o.left), Math.max(a.bottom, o.bottom) - Math.min(a.top, o.top)) : null;
|
|
3660
|
+
return {
|
|
3661
|
+
start: r,
|
|
3662
|
+
end: i,
|
|
3663
|
+
quote: F(t).slice(r, i),
|
|
3664
|
+
empty: n.empty,
|
|
3665
|
+
rect: s
|
|
3666
|
+
};
|
|
3667
|
+
}
|
|
3668
|
+
getAnnotations() {
|
|
3669
|
+
let e = this.view;
|
|
3670
|
+
if (!e) return [];
|
|
3671
|
+
let t = F(e.state.doc.toString());
|
|
3672
|
+
return In(e.state).map((e) => ({
|
|
3673
|
+
id: e.id,
|
|
3674
|
+
start: e.from,
|
|
3675
|
+
end: e.to,
|
|
3676
|
+
quote: t.slice(e.from, e.to)
|
|
3677
|
+
}));
|
|
3678
|
+
}
|
|
3679
|
+
_emitState() {
|
|
3680
|
+
let e = this.getState(), t = this._lastState;
|
|
3681
|
+
t && t.empty === e.empty && t.canIndent === e.canIndent && t.canOutdent === e.canOutdent && t.canUndo === e.canUndo && t.canRedo === e.canRedo && Object.keys(e.active).every((n) => t.active[n] === e.active[n]) || (this._lastState = e, this.dispatchEvent(new CustomEvent("nldd-text-editor-state", {
|
|
3682
|
+
detail: e,
|
|
3683
|
+
bubbles: !0,
|
|
3684
|
+
composed: !0
|
|
3685
|
+
})));
|
|
3686
|
+
}
|
|
3687
|
+
_typeaheadLists() {
|
|
3688
|
+
return this.mentionSource ? [this._mentionTypeahead, ...this.typeaheads] : this.typeaheads;
|
|
3689
|
+
}
|
|
3690
|
+
_onTypeaheadChosen(e) {
|
|
3691
|
+
if (!this.view) return;
|
|
3692
|
+
let t = this.view.state.doc.toString(), n = I(t, e.from);
|
|
3693
|
+
if (e.typeahead === this._mentionTypeahead) {
|
|
3694
|
+
let { id: t, text: r } = e.candidate;
|
|
3695
|
+
this._emitMention({
|
|
3696
|
+
id: t,
|
|
3697
|
+
text: r,
|
|
3698
|
+
from: n,
|
|
3699
|
+
to: n + ze(e.candidate).length
|
|
3700
|
+
});
|
|
3701
|
+
} else this.dispatchEvent(new CustomEvent("nldd-text-editor-typeahead", {
|
|
3702
|
+
detail: {
|
|
3703
|
+
trigger: e.trigger,
|
|
3704
|
+
candidate: e.candidate,
|
|
3705
|
+
from: n,
|
|
3706
|
+
to: I(t, e.to)
|
|
3707
|
+
},
|
|
3708
|
+
bubbles: !0,
|
|
3709
|
+
composed: !0
|
|
3710
|
+
}));
|
|
3711
|
+
}
|
|
3712
|
+
_emitMention(e) {
|
|
3713
|
+
this.dispatchEvent(new CustomEvent("nldd-text-editor-mention", {
|
|
3714
|
+
detail: e,
|
|
3715
|
+
bubbles: !0,
|
|
3716
|
+
composed: !0
|
|
3717
|
+
}));
|
|
3718
|
+
}
|
|
3719
|
+
render() {
|
|
3720
|
+
return Ji(this);
|
|
3721
|
+
}
|
|
3722
|
+
}, $ = (aa.styles = qi, aa);
|
|
3723
|
+
S([x({
|
|
3724
|
+
type: Boolean,
|
|
3725
|
+
reflect: !0,
|
|
3726
|
+
attribute: "no-spellcheck"
|
|
3727
|
+
})], $.prototype, "noSpellcheck", void 0), S([x({
|
|
3728
|
+
type: Boolean,
|
|
3729
|
+
reflect: !0
|
|
3730
|
+
})], $.prototype, "wrap", void 0), S([x({
|
|
3731
|
+
reflect: !0,
|
|
3732
|
+
converter: me("auto")
|
|
3733
|
+
})], $.prototype, "resize", void 0), S([x({
|
|
3734
|
+
reflect: !0,
|
|
3735
|
+
converter: me("simple")
|
|
3736
|
+
})], $.prototype, "appearance", void 0), S([x({
|
|
3737
|
+
reflect: !0,
|
|
3738
|
+
converter: me("visible")
|
|
3739
|
+
})], $.prototype, "syntax", void 0), S([x({ attribute: !1 })], $.prototype, "mentionSource", void 0), S([x({ attribute: !1 })], $.prototype, "mentionQuery", void 0), S([x({ attribute: !1 })], $.prototype, "mentionEmptyText", void 0), S([x({ attribute: !1 })], $.prototype, "typeaheads", void 0), S([x({
|
|
3740
|
+
type: Boolean,
|
|
3741
|
+
reflect: !0
|
|
3742
|
+
})], $.prototype, "annotatable", void 0), S([x({ attribute: !1 })], $.prototype, "annotations", void 0), S([x({ type: Object })], $.prototype, "translations", void 0), S([pe(".text-editor")], $.prototype, "_container", void 0), $ = S([fe("nldd-text-editor")], $);
|
|
3743
|
+
export { Zt as DEFAULT_TYPEAHEAD_QUERY, $ as NLDDTextEditor };
|