@globalpayments/vega 2.45.0 → 2.47.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/dist/cjs/app-globals-981f7aba.js +334 -0
- package/dist/cjs/child-nodes-event-prevent-slimmer-37870b2e.js +158 -0
- package/dist/cjs/child-nodes-notify-observer-slimmer-5817a53b.js +90 -0
- package/dist/cjs/content-state-605de6a3.js +3628 -0
- package/dist/cjs/country-flags-dc0f0d09.js +2403 -0
- package/dist/cjs/dark-mode-state-controller-slimmer-2af3e67c.js +51 -0
- package/dist/cjs/dark-mode-style-controller-c93b94d2.js +3467 -0
- package/dist/cjs/design-token-117a19a8.js +403 -0
- package/dist/cjs/dom-node-subject-factory-d5826bff.js +252 -0
- package/dist/cjs/dom-node-subject-observer-factory-a7a3b196.js +45 -0
- package/dist/cjs/element-appender-slimmer-4bdbd76d.js +1466 -0
- package/dist/cjs/event-emit-slimmer-8247249c.js +266 -0
- package/dist/cjs/form-field-controller-slimmer-6d69c74f.js +1256 -0
- package/dist/cjs/image-annotation-action-5e3aa73c.js +277 -0
- package/dist/cjs/index-09acd3c9.js +8 -0
- package/dist/cjs/index-ec9a1f36.js +43 -0
- package/dist/cjs/index.cjs.js +22 -20
- package/dist/cjs/internal-icon-manager-00f49470.js +55 -0
- package/dist/cjs/internal-vega-event-manager-c9948b59.js +475 -0
- package/dist/cjs/loader.cjs.js +16 -14
- package/dist/cjs/observer-f49483e8.js +32 -0
- package/dist/cjs/public-rules-66f53e7e.js +43 -0
- package/dist/cjs/remote-invocation-registry-fc22fdd0.js +65 -0
- package/dist/cjs/responsive-format-facade-3542fc47.js +923 -0
- package/dist/cjs/rich-text-editor-required-rule-649ef4b4.js +64 -0
- package/dist/cjs/static-subject-title-1d23c102.js +79 -0
- package/dist/cjs/string-input-formatter-slimmer-56a2401f.js +434 -0
- package/dist/cjs/style-formatter-b735d506.js +34 -0
- package/dist/cjs/sub-state-notify-slimmer-b16c9094.js +81 -0
- package/dist/cjs/sub-state-observer-slimmer-1b6de09f.js +134 -0
- package/dist/cjs/translation-5173d223.js +339 -0
- package/dist/cjs/translation-slimmer-e900e8d4.js +42 -0
- package/dist/cjs/vega-accordion.cjs.entry.js +16 -14
- package/dist/cjs/vega-app-footer.cjs.entry.js +40 -7
- package/dist/cjs/vega-app-header-button.cjs.entry.js +18 -16
- package/dist/cjs/vega-banner.cjs.entry.js +6 -5
- package/dist/cjs/vega-box.cjs.entry.js +14 -12
- package/dist/cjs/vega-brand-logo.cjs.entry.js +232 -0
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +6 -5
- package/dist/cjs/vega-button-circle.cjs.entry.js +16 -14
- package/dist/cjs/vega-button-group_2.cjs.entry.js +11 -10
- package/dist/cjs/vega-button-link.cjs.entry.js +14 -11
- package/dist/cjs/vega-button.cjs.entry.js +15 -13
- package/dist/cjs/vega-calendar_3.cjs.entry.js +13 -12
- package/dist/cjs/vega-card.cjs.entry.js +13 -11
- package/dist/cjs/vega-carousel.cjs.entry.js +15 -13
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +15 -13
- package/dist/cjs/vega-chip.cjs.entry.js +17 -15
- package/dist/cjs/vega-color-picker.cjs.entry.js +20 -15
- package/dist/cjs/vega-combo-box.cjs.entry.js +12 -10
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +22 -19
- package/dist/cjs/vega-dialog_2.cjs.entry.js +15 -13
- package/dist/cjs/vega-divider.cjs.entry.js +13 -11
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +282 -187
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +1 -1
- package/dist/cjs/vega-field-label.cjs.entry.js +5 -4
- package/dist/cjs/vega-file-uploader.cjs.entry.js +12 -10
- package/dist/cjs/vega-flag-icon.cjs.entry.js +207 -0
- package/dist/cjs/vega-flex.cjs.entry.js +12 -10
- package/dist/cjs/vega-font.cjs.entry.js +13 -11
- package/dist/cjs/vega-form.cjs.entry.js +71 -15
- package/dist/cjs/vega-grid.cjs.entry.js +13 -11
- package/dist/cjs/vega-icon.cjs.entry.js +13 -11
- package/dist/cjs/vega-image-uploader.cjs.entry.js +18 -15
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +12 -10
- package/dist/cjs/vega-input-numeric.cjs.entry.js +12 -10
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +86 -2472
- package/dist/cjs/vega-input-range.cjs.entry.js +13 -11
- package/dist/cjs/vega-input-select.cjs.entry.js +133 -73
- package/dist/cjs/vega-input.cjs.entry.js +13 -12
- package/dist/cjs/vega-internal-event-id-dc866d43.js +80 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +5 -4
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +32 -20
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +12 -10
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +3 -2
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +6 -5
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +7 -6
- package/dist/cjs/vega-pagination.cjs.entry.js +16 -14
- package/dist/cjs/vega-popover_2.cjs.entry.js +15 -13
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +6 -5
- package/dist/cjs/vega-radio_2.cjs.entry.js +15 -13
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +13 -11
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +136 -176
- package/dist/cjs/vega-segment-control.cjs.entry.js +5 -4
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +18 -16
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +14 -13
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +18 -16
- package/dist/cjs/vega-signature-capture.cjs.entry.js +19 -16
- package/dist/cjs/vega-skeleton-loader-controller-8cbd7656.js +1291 -0
- package/dist/cjs/vega-stepper.cjs.entry.js +12 -10
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +9 -8
- package/dist/cjs/vega-table_8.cjs.entry.js +30 -28
- package/dist/cjs/vega-textarea.cjs.entry.js +12 -10
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +19 -16
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +11 -9
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +14 -12
- package/dist/cjs/vega.cjs.js +16 -14
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/vega-app-footer/vega-app-footer.css +3 -4
- package/dist/collection/components/vega-app-footer/vega-app-footer.js +40 -13
- package/dist/collection/components/vega-app-header-button/vega-app-header-button.css +9 -4
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/g-symbol-large.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/g-symbol-medium.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/g-symbol-small.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/genius-large.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/genius-medium.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/genius-small.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/global-payments-large.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/global-payments-medium.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/dark-mode/global-payments-small.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/index.js +18 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/g-symbol-large.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/g-symbol-medium.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/g-symbol-small.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/genius-large.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/genius-medium.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/genius-small.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/global-payments-large.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/global-payments-medium.js +4 -0
- package/dist/collection/components/vega-brand-logo/assets/light-mode/global-payments-small.js +4 -0
- package/dist/collection/components/vega-brand-logo/slimmers/renderers/vega-brand-logo-renderer.js +62 -0
- package/dist/collection/components/vega-brand-logo/vega-brand-logo.css +8 -0
- package/dist/collection/components/vega-brand-logo/vega-brand-logo.js +140 -0
- package/dist/collection/components/vega-button/vega-button.css +11 -6
- package/dist/collection/components/vega-button-circle/vega-button-circle.css +15 -10
- package/dist/collection/components/vega-button-group/vega-button-group-item/vega-button-group-item.css +11 -12
- package/dist/collection/components/vega-button-group/vega-button-group.css +0 -2
- package/dist/collection/components/vega-button-link/vega-button-link.css +21 -37
- package/dist/collection/components/vega-button-link/vega-button-link.js +7 -6
- package/dist/collection/components/vega-carousel/vega-carousel.css +2 -1
- package/dist/collection/components/vega-checkbox/vega-checkbox.css +4 -6
- package/dist/collection/components/vega-chip/vega-chip.css +5 -4
- package/dist/collection/components/vega-color-picker/vega-color-picker.css +14 -8
- package/dist/collection/components/vega-color-picker/vega-color-picker.js +9 -6
- package/dist/collection/components/vega-combo-box/vega-combo-box.css +4 -2
- package/dist/collection/components/vega-date-picker/vega-date-picker.css +6 -4
- package/dist/collection/components/vega-dropdown/slimmers/controllers/vega-dropdown-scrollable-controller.js +34 -5
- package/dist/collection/components/vega-dropdown/slimmers/controllers/vega-dropdown-selected-controller.js +13 -0
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-renderer.js +5 -4
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-reset-renderer.js +31 -0
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-search-renderer.js +19 -15
- package/dist/collection/components/vega-dropdown/vega-dropdown-content-box/vega-dropdown-content-box.css +34 -21
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +77 -1
- package/dist/collection/components/vega-flag-icon/assets/flags/ac.js +692 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ad.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ae.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/af.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ag.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ai.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/al.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/am.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ao.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ar.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/as.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/at.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/au.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/aw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ax.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/az.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ba.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bb.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bd.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/be.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bf.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bh.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bi.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bj.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bl.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bo.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bq.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/br.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bs.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bt.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/by.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/bz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ca.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cc.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cd.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cf.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ch.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ci.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ck.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cl.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/co.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cu.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cv.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cx.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cy.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/cz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/de.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/dj.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/dk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/dm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/do.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/dz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ec.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ee.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/eg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/eh.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/er.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/es.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/et.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/fi.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/fj.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/fk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/fm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/fo.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/fr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ga.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gb.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gd.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ge.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gf.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gh.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gi.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gl.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gp.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gq.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gt.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gu.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/gy.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/hk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/hn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/hr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ht.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/hu.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/id.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ie.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/il.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/im.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/in.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/io.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/iq.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ir.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/is.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/it.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/je.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/jm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/jo.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/jp.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ke.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/kg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/kh.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ki.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/km.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/kn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/kp.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/kr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/kw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ky.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/kz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/la.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/lb.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/lc.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/li.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/lk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/lr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ls.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/lt.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/lu.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/lv.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ly.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ma.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mc.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/md.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/me.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mf.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mh.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ml.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mo.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mp.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mq.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ms.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mt.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mu.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mv.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mx.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/my.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/mz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/na.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/nc.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ne.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/nf.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ng.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ni.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/nl.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/no.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/np.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/nr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/nu.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/nz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/om.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pa.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pe.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pf.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ph.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pl.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ps.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pt.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/pw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/py.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/qa.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/re.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ro.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/rs.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ru.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/rw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sa.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sb.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sc.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sd.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/se.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sh.js +167 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/si.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sj.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sl.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/so.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ss.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/st.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sv.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sx.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sy.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/sz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ta.js +79 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tc.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/td.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/th.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tj.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tl.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/to.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tr.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tt.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tv.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tw.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/tz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ua.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ug.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/us.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/uy.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/uz.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/va.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/vc.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ve.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/vg.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/vi.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/vn.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/vu.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/wf.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ws.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/xk.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/ye.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/yt.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/za.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/zm.js +4 -0
- package/dist/collection/components/vega-flag-icon/assets/flags/zw.js +4 -0
- package/dist/collection/components/vega-flag-icon/slimmers/controllers/vega-flag-icon-controller.js +102 -0
- package/dist/collection/components/vega-flag-icon/slimmers/renderers/vega-flag-icon-renderer.js +28 -0
- package/dist/collection/components/vega-flag-icon/vega-flag-icon.css +13 -0
- package/dist/collection/components/vega-flag-icon/vega-flag-icon.js +106 -0
- package/dist/collection/components/vega-form/slimmers/controllers/vega-form-nest-state-controller.js +31 -0
- package/dist/collection/components/vega-form/vega-form.js +50 -1
- package/dist/collection/components/vega-image-uploader/vega-image-uploader.css +19 -9
- package/dist/collection/components/vega-input/vega-input.css +2 -2
- package/dist/collection/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.js +28 -52
- package/dist/collection/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.js +35 -7
- package/dist/collection/components/vega-input-phone-number/slimmers/renderers/phone-number-input-renderer.js +10 -3
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.css +1 -1
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +3 -3
- package/dist/collection/components/vega-input-range/vega-input-range.css +2 -2
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-dropdown-controller.js +7 -1
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +8 -6
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-prefix-icon-renderer.js +48 -0
- package/dist/collection/components/vega-input-select/vega-input-select.css +2 -2
- package/dist/collection/components/vega-input-select/vega-input-select.js +6 -1
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/renderers/vega-left-nav-header-renderer.js +12 -1
- package/dist/collection/components/vega-nav/vega-left-nav/vega-left-nav.css +0 -5
- package/dist/collection/components/vega-nav/vega-left-nav-group/vega-left-nav-group.css +2 -2
- package/dist/collection/components/vega-nav/vega-left-nav-link/vega-left-nav-link.css +2 -4
- package/dist/collection/components/vega-pagination/vega-pagination.css +2 -1
- package/dist/collection/components/vega-progress-tracker/vega-progress-tracker.css +2 -1
- package/dist/collection/components/vega-radio/vega-radio.css +6 -5
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +2 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +2 -2
- package/dist/collection/components/vega-signature-capture/vega-signature-capture.css +2 -2
- package/dist/collection/components/vega-stepper/vega-stepper.css +1 -1
- package/dist/collection/components/vega-tab-group/vega-tab-group.css +1 -1
- package/dist/collection/components/vega-textarea/vega-textarea.css +6 -2
- package/dist/collection/components/vega-time-picker/vega-time-picker.css +2 -2
- package/dist/collection/components/vega-toggle-switch/vega-toggle-switch.css +2 -1
- package/dist/collection/constants/misc.js +2 -0
- package/dist/collection/constants/runtime-metrics-payload-definition/public-api/ThemeManager/runtime-metrics-payload-definition.js +20 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-border-tokens.js +32 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-color-tokens.js +184 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-ring-tokens.js +7 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-shadow-tokens.js +12 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-border-tokens.js +32 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-color-tokens.js +184 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-shadow-tokens.js +12 -0
- package/dist/collection/constants/ui.js +1 -0
- package/dist/collection/global/scripts/before-vega-load.js +9 -0
- package/dist/collection/global/tests/before-vega-load.test.js +7 -0
- package/dist/collection/helpers/change-manager/subject/static-subject/static-subject-title.js +2 -0
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +2 -1
- package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/slimmers/event-emit-slimmer.js +8 -0
- package/dist/collection/helpers/event-manager/test/event-emit-slimmer.test.js +28 -1
- package/dist/collection/helpers/event-manager/test/vega-event-manager.test.js +2 -1
- package/dist/collection/helpers/icon/internal-icon-manager.js +10 -0
- package/dist/collection/helpers/slimmers/form-field-controller-slimmer.js +6 -1
- package/dist/collection/helpers/slimmers/form-field-state-controller-slimmer.js +45 -0
- package/dist/collection/helpers/theme/controllers/dark-mode-style-controller.js +17 -30
- package/dist/collection/helpers/theme/controllers/new-brand-style-controller.js +50 -0
- package/dist/collection/helpers/theme/controllers/style-controller.abstract.js +31 -0
- package/dist/collection/helpers/theme/internal-theme-manager.js +68 -0
- package/dist/collection/helpers/theme/tests/theme-manager-controller.test.js +17 -0
- package/dist/collection/helpers/theme/theme-manager.js +16 -17
- package/dist/collection/helpers/translation/locales/en.js +1 -0
- package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +1 -0
- package/dist/collection/helpers/validator/form-field-controller.js +9 -1
- package/dist/esm/app-globals-c055c18a.js +332 -0
- package/dist/esm/child-nodes-event-prevent-slimmer-d3a94ef2.js +156 -0
- package/dist/esm/child-nodes-notify-observer-slimmer-ddaad39a.js +88 -0
- package/dist/esm/content-state-8d0d38d7.js +3586 -0
- package/dist/esm/country-flags-b68c3349.js +2401 -0
- package/dist/esm/dark-mode-state-controller-slimmer-0678a94b.js +49 -0
- package/dist/esm/dark-mode-style-controller-e5915f26.js +3464 -0
- package/dist/esm/design-token-7406782c.js +389 -0
- package/dist/esm/dom-node-subject-factory-f77cf9cc.js +202 -0
- package/dist/esm/dom-node-subject-observer-factory-715dccf9.js +43 -0
- package/dist/esm/element-appender-slimmer-16eaeb31.js +1464 -0
- package/dist/esm/event-emit-slimmer-b7d511f6.js +264 -0
- package/dist/esm/form-field-controller-slimmer-a383d067.js +1254 -0
- package/dist/esm/image-annotation-action-de567e61.js +272 -0
- package/dist/esm/index-187f71d1.js +8 -0
- package/dist/esm/index-96374234.js +40 -0
- package/dist/esm/index.js +15 -13
- package/dist/esm/internal-icon-manager-58cf8aa6.js +53 -0
- package/dist/esm/internal-vega-event-manager-87dc436c.js +471 -0
- package/dist/esm/loader.js +16 -14
- package/dist/esm/observer-3959f9dd.js +30 -0
- package/dist/esm/public-rules-f9fe1987.js +28 -0
- package/dist/esm/remote-invocation-registry-d69245c2.js +63 -0
- package/dist/esm/responsive-format-facade-299d8ee9.js +919 -0
- package/dist/esm/rich-text-editor-required-rule-7fd7dcb3.js +62 -0
- package/dist/esm/static-subject-title-4a9deb68.js +51 -0
- package/dist/esm/string-input-formatter-slimmer-8c7987ac.js +430 -0
- package/dist/esm/style-formatter-2ebb1fd2.js +32 -0
- package/dist/esm/sub-state-notify-slimmer-2216c7dc.js +79 -0
- package/dist/esm/sub-state-observer-slimmer-da938c88.js +132 -0
- package/dist/esm/translation-78207e81.js +335 -0
- package/dist/esm/translation-slimmer-d49fcdf4.js +40 -0
- package/dist/esm/vega-accordion.entry.js +15 -13
- package/dist/esm/vega-app-footer.entry.js +40 -7
- package/dist/esm/vega-app-header-button.entry.js +18 -16
- package/dist/esm/vega-banner.entry.js +6 -5
- package/dist/esm/vega-box.entry.js +14 -12
- package/dist/esm/vega-brand-logo.entry.js +228 -0
- package/dist/esm/vega-breadcrumb.entry.js +6 -5
- package/dist/esm/vega-button-circle.entry.js +16 -14
- package/dist/esm/vega-button-group_2.entry.js +11 -10
- package/dist/esm/vega-button-link.entry.js +14 -11
- package/dist/esm/vega-button.entry.js +15 -13
- package/dist/esm/vega-calendar_3.entry.js +13 -12
- package/dist/esm/vega-card.entry.js +13 -11
- package/dist/esm/vega-carousel.entry.js +15 -13
- package/dist/esm/vega-checkbox_2.entry.js +13 -11
- package/dist/esm/vega-chip.entry.js +17 -15
- package/dist/esm/vega-color-picker.entry.js +20 -15
- package/dist/esm/vega-combo-box.entry.js +12 -10
- package/dist/esm/vega-date-picker_2.entry.js +22 -19
- package/dist/esm/vega-dialog_2.entry.js +15 -13
- package/dist/esm/vega-divider.entry.js +13 -11
- package/dist/esm/vega-dropdown_5.entry.js +282 -187
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +1 -1
- package/dist/esm/vega-field-label.entry.js +5 -4
- package/dist/esm/vega-file-uploader.entry.js +12 -10
- package/dist/esm/vega-flag-icon.entry.js +203 -0
- package/dist/esm/vega-flex.entry.js +12 -10
- package/dist/esm/vega-font.entry.js +13 -11
- package/dist/esm/vega-form.entry.js +68 -12
- package/dist/esm/vega-grid.entry.js +13 -11
- package/dist/esm/vega-icon.entry.js +13 -11
- package/dist/esm/vega-image-uploader.entry.js +18 -15
- package/dist/esm/vega-input-credit-card.entry.js +12 -10
- package/dist/esm/vega-input-numeric.entry.js +12 -10
- package/dist/esm/vega-input-phone-number.entry.js +86 -2472
- package/dist/esm/vega-input-range.entry.js +13 -11
- package/dist/esm/vega-input-select.entry.js +133 -73
- package/dist/esm/vega-input.entry.js +13 -12
- package/dist/esm/vega-internal-event-id-7d1ff289.js +50 -0
- package/dist/esm/vega-item-toggle.entry.js +5 -4
- package/dist/esm/vega-left-nav_5.entry.js +30 -18
- package/dist/esm/vega-loader-wrapper_2.entry.js +12 -10
- package/dist/esm/vega-page-notification_2.entry.js +3 -2
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +6 -5
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +7 -6
- package/dist/esm/vega-pagination.entry.js +16 -14
- package/dist/esm/vega-popover_2.entry.js +15 -13
- package/dist/esm/vega-progress-tracker.entry.js +6 -5
- package/dist/esm/vega-radio_2.entry.js +13 -11
- package/dist/esm/vega-rich-text-content.entry.js +12 -10
- package/dist/esm/vega-rich-text-editor_4.entry.js +132 -172
- package/dist/esm/vega-segment-control.entry.js +5 -4
- package/dist/esm/vega-selection-chip_2.entry.js +17 -15
- package/dist/esm/vega-selection-tile_2.entry.js +13 -12
- package/dist/esm/vega-sidenav_3.entry.js +16 -14
- package/dist/esm/vega-signature-capture.entry.js +19 -16
- package/dist/esm/vega-skeleton-loader-controller-90e8d34d.js +1282 -0
- package/dist/esm/vega-stepper.entry.js +12 -10
- package/dist/esm/vega-tab-group_2.entry.js +8 -7
- package/dist/esm/vega-table_8.entry.js +19 -17
- package/dist/esm/vega-textarea.entry.js +12 -10
- package/dist/esm/vega-time-picker_2.entry.js +19 -16
- package/dist/esm/vega-toggle-switch.entry.js +11 -9
- package/dist/esm/vega-tooltip_2.entry.js +14 -12
- package/dist/esm/vega.js +16 -14
- package/dist/types/components/vega-app-footer/vega-app-footer.d.ts +7 -3
- package/dist/types/components/vega-brand-logo/assets/dark-mode/g-symbol-large.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/g-symbol-medium.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/g-symbol-small.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/genius-large.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/genius-medium.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/genius-small.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/global-payments-large.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/global-payments-medium.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/dark-mode/global-payments-small.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/index.d.ts +18 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/g-symbol-large.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/g-symbol-medium.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/g-symbol-small.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/genius-large.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/genius-medium.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/genius-small.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/global-payments-large.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/global-payments-medium.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/assets/light-mode/global-payments-small.d.ts +2 -0
- package/dist/types/components/vega-brand-logo/slimmers/renderers/vega-brand-logo-renderer.d.ts +12 -0
- package/dist/types/components/vega-brand-logo/vega-brand-logo.d.ts +39 -0
- package/dist/types/components/vega-dropdown/slimmers/controllers/vega-dropdown-scrollable-controller.d.ts +10 -0
- package/dist/types/components/vega-dropdown/slimmers/controllers/vega-dropdown-selected-controller.d.ts +5 -0
- package/dist/types/components/vega-dropdown/slimmers/renderers/vega-dropdown-renderer.d.ts +1 -0
- package/dist/types/components/vega-dropdown/slimmers/renderers/vega-dropdown-reset-renderer.d.ts +9 -0
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +23 -0
- package/dist/types/components/vega-flag-icon/assets/country-flags.d.ts +3 -0
- package/dist/types/components/vega-flag-icon/slimmers/controllers/vega-flag-icon-controller.d.ts +45 -0
- package/dist/types/components/vega-flag-icon/slimmers/renderers/vega-flag-icon-renderer.d.ts +7 -0
- package/dist/types/components/vega-flag-icon/vega-flag-icon.d.ts +29 -0
- package/dist/types/components/vega-form/slimmers/controllers/vega-form-nest-state-controller.d.ts +10 -0
- package/dist/types/components/vega-form/vega-form.d.ts +16 -0
- package/dist/types/components/vega-input-phone-number/slimmers/controllers/country-select-controller.d.ts +1 -1
- package/dist/types/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.d.ts +12 -29
- package/dist/types/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.d.ts +16 -1
- package/dist/types/components/vega-input-phone-number/types.d.ts +1 -3
- package/dist/types/components/vega-input-phone-number/vega-input-phone-number.d.ts +2 -1
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-dropdown-controller.d.ts +1 -0
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.d.ts +2 -1
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-prefix-icon-renderer.d.ts +21 -0
- package/dist/types/components/vega-input-select/types.d.ts +1 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +2 -0
- package/dist/types/components/vega-nav/vega-left-nav/slimmers/renderers/vega-left-nav-header-renderer.d.ts +1 -0
- package/dist/types/components.d.ts +115 -7
- package/dist/types/constants/misc.d.ts +2 -0
- package/dist/types/constants/tokens/themes/v2-new-brand/dark-mode-border-tokens.d.ts +1 -0
- package/dist/types/constants/tokens/themes/v2-new-brand/dark-mode-color-tokens.d.ts +1 -0
- package/dist/types/constants/tokens/themes/v2-new-brand/dark-mode-ring-tokens.d.ts +1 -0
- package/dist/types/constants/tokens/themes/v2-new-brand/dark-mode-shadow-tokens.d.ts +1 -0
- package/dist/types/constants/tokens/themes/v2-new-brand/light-mode-border-tokens.d.ts +1 -0
- package/dist/types/constants/tokens/themes/v2-new-brand/light-mode-color-tokens.d.ts +1 -0
- package/dist/types/constants/tokens/themes/v2-new-brand/light-mode-shadow-tokens.d.ts +1 -0
- package/dist/types/constants/ui.d.ts +1 -1
- package/dist/types/helpers/change-manager/subject/static-subject/static-subject-title.d.ts +3 -1
- package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/helpers/event-manager/slimmers/event-emit-slimmer.d.ts +9 -0
- package/dist/types/helpers/icon/internal-icon-manager.d.ts +8 -0
- package/dist/types/helpers/slimmers/form-field-controller-slimmer.d.ts +4 -2
- package/dist/types/helpers/slimmers/form-field-state-controller-slimmer.d.ts +15 -0
- package/dist/types/helpers/theme/controllers/dark-mode-style-controller.d.ts +4 -12
- package/dist/types/helpers/theme/controllers/new-brand-style-controller.d.ts +22 -0
- package/dist/types/helpers/theme/controllers/style-controller.abstract.d.ts +19 -0
- package/dist/types/helpers/theme/internal-theme-manager.d.ts +48 -0
- package/dist/types/helpers/theme/theme-manager.d.ts +9 -1
- package/dist/types/helpers/theme/theme.d.ts +2 -0
- package/dist/types/helpers/translation/interface.d.ts +3 -1
- package/dist/types/helpers/validator/form-field-controller.d.ts +7 -0
- package/dist/types/helpers/validator/rules/valid-phone-number-rule.d.ts +1 -1
- package/dist/types/types/components.type.d.ts +2 -1
- package/dist/types/types/flag.type.d.ts +3 -0
- package/dist/types/types/public-api.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-06d7990e.js +1 -0
- package/dist/vega/p-0835a2fd.js +1 -0
- package/dist/vega/p-0a3607f7.entry.js +1 -0
- package/dist/vega/p-0e7fc736.entry.js +1 -0
- package/dist/vega/p-10a40dfb.entry.js +1 -0
- package/dist/vega/p-1114896d.entry.js +1 -0
- package/dist/vega/p-1138fa63.entry.js +1 -0
- package/dist/vega/p-1154e439.entry.js +1 -0
- package/dist/vega/p-12a8d705.js +1 -0
- package/dist/vega/p-12d60f5f.js +1 -0
- package/dist/vega/p-1486bc3f.js +1 -0
- package/dist/vega/p-1e926324.js +1 -0
- package/dist/vega/p-20af6415.entry.js +1 -0
- package/dist/vega/p-214aa52e.js +1 -0
- package/dist/vega/p-23a26150.js +1 -0
- package/dist/vega/p-23ff7605.entry.js +1 -0
- package/dist/vega/p-26005df1.js +1 -0
- package/dist/vega/p-27003a81.entry.js +1 -0
- package/dist/vega/p-27287998.entry.js +1 -0
- package/dist/vega/p-28b7d6ba.entry.js +1 -0
- package/dist/vega/p-2c0d1ec9.entry.js +1 -0
- package/dist/vega/p-3165ee95.entry.js +1 -0
- package/dist/vega/p-327a017b.entry.js +1 -0
- package/dist/vega/p-331a62d5.js +1 -0
- package/dist/vega/p-380ba357.entry.js +1 -0
- package/dist/vega/p-414e7edc.entry.js +1 -0
- package/dist/vega/p-41c48bcc.entry.js +1 -0
- package/dist/vega/p-42b62b48.js +1 -0
- package/dist/vega/p-431ab4dd.js +1 -0
- package/dist/vega/p-4640d35d.entry.js +1 -0
- package/dist/vega/p-48517a5d.entry.js +1 -0
- package/dist/vega/p-4b541ce8.entry.js +1 -0
- package/dist/vega/p-4c62c178.entry.js +1 -0
- package/dist/vega/p-5064a804.js +1 -0
- package/dist/vega/p-562de411.entry.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-626dd54f.entry.js +1 -0
- package/dist/vega/p-63ea4f38.entry.js +1 -0
- package/dist/vega/p-6586e2a2.entry.js +1 -0
- package/dist/vega/p-693934d5.entry.js +1 -0
- package/dist/vega/p-69cc3fa2.js +1 -0
- package/dist/vega/p-6cd8e6f4.entry.js +1 -0
- package/dist/vega/p-6e898779.js +1 -0
- package/dist/vega/p-6f2faa34.js +1 -0
- package/dist/vega/p-6f81fe1e.js +1 -0
- package/dist/vega/p-6f9731a1.entry.js +1 -0
- package/dist/vega/p-704d9730.js +1 -0
- package/dist/vega/p-720d87f9.entry.js +1 -0
- package/dist/vega/p-76a3a552.entry.js +13 -0
- package/dist/vega/p-77e64f26.js +1 -0
- package/dist/vega/p-7a3826a0.entry.js +1 -0
- package/dist/vega/p-7cc3feb4.entry.js +1 -0
- package/dist/vega/p-7f1a7346.entry.js +1 -0
- package/dist/vega/p-7f9dd834.entry.js +1 -0
- package/dist/vega/p-804f71b3.js +1 -0
- package/dist/vega/p-84aa2ebc.entry.js +1 -0
- package/dist/vega/p-865b45dc.entry.js +1 -0
- package/dist/vega/p-8f98e604.entry.js +1 -0
- package/dist/vega/p-90e70662.entry.js +1 -0
- package/dist/vega/p-90ebcda7.entry.js +1 -0
- package/dist/vega/p-a0b6da44.js +1 -0
- package/dist/vega/p-a5c39ba2.entry.js +1 -0
- package/dist/vega/p-a821bcf3.js +1 -0
- package/dist/vega/p-a8e9bfae.entry.js +1 -0
- package/dist/vega/p-a9f2ad08.entry.js +1 -0
- package/dist/vega/p-aa29ccd4.entry.js +1 -0
- package/dist/vega/p-b07add9c.entry.js +1 -0
- package/dist/vega/p-b2643e88.js +1 -0
- package/dist/vega/p-b4108ddb.entry.js +1 -0
- package/dist/vega/p-b5f05d21.entry.js +1 -0
- package/dist/vega/p-ba0a76fe.entry.js +1 -0
- package/dist/vega/p-be186a9f.entry.js +1 -0
- package/dist/vega/p-c17b7a1f.js +1 -0
- package/dist/vega/p-c87b5c83.entry.js +1 -0
- package/dist/vega/p-c9b9322b.js +1 -0
- package/dist/vega/p-d2947f32.entry.js +1 -0
- package/dist/vega/p-d296cf86.entry.js +1 -0
- package/dist/vega/p-d2a65457.entry.js +1 -0
- package/dist/vega/p-d54c48b0.js +1 -0
- package/dist/vega/p-d7642125.js +1 -0
- package/dist/vega/p-da40b4c3.js +1 -0
- package/dist/vega/p-e309bfd1.entry.js +1 -0
- package/dist/vega/p-e3b70eed.entry.js +1 -0
- package/dist/vega/p-e66515c7.js +1 -0
- package/dist/vega/p-eaab3fea.entry.js +1 -0
- package/dist/vega/p-f01300ea.entry.js +1 -0
- package/dist/vega/p-f0c85061.js +1 -0
- package/dist/vega/p-f3efc8f0.entry.js +1 -0
- package/dist/vega/p-f3f73fd3.entry.js +1 -0
- package/dist/vega/p-f5fdf1ae.entry.js +1 -0
- package/dist/vega/p-fb6d87cd.entry.js +1 -0
- package/dist/vega/p-ff8ef8af.entry.js +1 -0
- package/dist/vega/p-ff9ccfa8.js +1 -0
- package/dist/vega/p-ff9e8753.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/app-globals-c99ca280.js +0 -325
- package/dist/cjs/child-nodes-event-prevent-slimmer-4982065c.js +0 -158
- package/dist/cjs/child-nodes-notify-observer-slimmer-100dbe59.js +0 -90
- package/dist/cjs/content-state-5659cad7.js +0 -6647
- package/dist/cjs/design-token-61572ad6.js +0 -403
- package/dist/cjs/dom-node-subject-factory-6a2aa462.js +0 -280
- package/dist/cjs/dom-node-subject-observer-factory-8f9ed458.js +0 -44
- package/dist/cjs/element-appender-slimmer-6de02fb6.js +0 -1465
- package/dist/cjs/event-emit-slimmer-93183c4d.js +0 -258
- package/dist/cjs/form-field-controller-slimmer-ac875498.js +0 -1198
- package/dist/cjs/image-annotation-action-cd529b25.js +0 -276
- package/dist/cjs/index-cea30b8b.js +0 -42
- package/dist/cjs/internal-icon-manager-cf3347e7.js +0 -45
- package/dist/cjs/internal-vega-event-manager-cd87600e.js +0 -474
- package/dist/cjs/public-rules-a23c74a9.js +0 -41
- package/dist/cjs/remote-invocation-registry-08e3c509.js +0 -65
- package/dist/cjs/responsive-format-facade-bf7d9ab2.js +0 -923
- package/dist/cjs/rich-text-editor-required-rule-cdc2e15e.js +0 -64
- package/dist/cjs/static-subject-title-64175f06.js +0 -75
- package/dist/cjs/string-input-formatter-slimmer-90bdfcf6.js +0 -434
- package/dist/cjs/style-formatter-f26738b9.js +0 -34
- package/dist/cjs/sub-state-notify-slimmer-88e2f4aa.js +0 -80
- package/dist/cjs/sub-state-observer-slimmer-8ed18a5a.js +0 -133
- package/dist/cjs/translation-f7279bf1.js +0 -338
- package/dist/cjs/translation-slimmer-4d852eab.js +0 -42
- package/dist/cjs/vega-internal-event-id-a0ca9af9.js +0 -78
- package/dist/cjs/vega-skeleton-loader-controller-1c91112a.js +0 -1120
- package/dist/collection/components/vega-input-phone-number/assets/flags/ac.js +0 -692
- package/dist/collection/components/vega-input-phone-number/assets/flags/ad.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ae.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/af.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ag.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ai.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/al.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/am.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ao.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ar.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/as.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/at.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/au.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/aw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ax.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/az.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ba.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bb.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bd.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/be.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bf.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bh.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bi.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bj.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bl.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bo.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bq.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/br.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bs.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bt.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/by.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/bz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ca.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cc.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cd.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cf.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ch.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ci.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ck.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cl.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/co.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cu.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cv.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cx.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cy.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/cz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/de.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/dj.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/dk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/dm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/do.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/dz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ec.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ee.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/eg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/eh.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/er.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/es.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/et.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/fi.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/fj.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/fk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/fm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/fo.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/fr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ga.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gb.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gd.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ge.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gf.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gh.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gi.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gl.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gp.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gq.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gt.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gu.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/gy.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/hk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/hn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/hr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ht.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/hu.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/id.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ie.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/il.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/im.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/in.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/io.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/iq.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ir.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/is.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/it.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/je.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/jm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/jo.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/jp.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ke.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/kg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/kh.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ki.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/km.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/kn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/kp.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/kr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/kw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ky.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/kz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/la.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/lb.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/lc.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/li.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/lk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/lr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ls.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/lt.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/lu.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/lv.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ly.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ma.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mc.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/md.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/me.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mf.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mh.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ml.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mo.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mp.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mq.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ms.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mt.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mu.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mv.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mx.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/my.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/mz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/na.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/nc.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ne.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/nf.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ng.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ni.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/nl.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/no.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/np.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/nr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/nu.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/nz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/om.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pa.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pe.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pf.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ph.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pl.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ps.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pt.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/pw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/py.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/qa.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/re.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ro.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/rs.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ru.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/rw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sa.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sb.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sc.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sd.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/se.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sh.js +0 -167
- package/dist/collection/components/vega-input-phone-number/assets/flags/si.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sj.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sl.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/so.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ss.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/st.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sv.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sx.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sy.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/sz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ta.js +0 -79
- package/dist/collection/components/vega-input-phone-number/assets/flags/tc.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/td.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/th.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tj.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tl.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/to.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tr.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tt.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tv.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tw.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/tz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ua.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ug.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/us.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/uy.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/uz.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/va.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/vc.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ve.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/vg.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/vi.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/vn.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/vu.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/wf.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ws.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/xk.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/ye.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/yt.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/za.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/zm.js +0 -4
- package/dist/collection/components/vega-input-phone-number/assets/flags/zw.js +0 -4
- package/dist/esm/app-globals-6a7d90a9.js +0 -323
- package/dist/esm/child-nodes-event-prevent-slimmer-aab1c019.js +0 -156
- package/dist/esm/child-nodes-notify-observer-slimmer-12d38571.js +0 -88
- package/dist/esm/content-state-7e9f3421.js +0 -6603
- package/dist/esm/design-token-e349fd57.js +0 -389
- package/dist/esm/dom-node-subject-factory-286df025.js +0 -230
- package/dist/esm/dom-node-subject-observer-factory-d661fc7c.js +0 -42
- package/dist/esm/element-appender-slimmer-a187435b.js +0 -1463
- package/dist/esm/event-emit-slimmer-acc7fbb7.js +0 -256
- package/dist/esm/form-field-controller-slimmer-c9280871.js +0 -1196
- package/dist/esm/image-annotation-action-2541490e.js +0 -271
- package/dist/esm/index-707fec53.js +0 -39
- package/dist/esm/internal-icon-manager-c05720ca.js +0 -43
- package/dist/esm/internal-vega-event-manager-d2c962d2.js +0 -470
- package/dist/esm/public-rules-596db5ba.js +0 -26
- package/dist/esm/remote-invocation-registry-0b330137.js +0 -63
- package/dist/esm/responsive-format-facade-ce8a1ef5.js +0 -919
- package/dist/esm/rich-text-editor-required-rule-ef25c4da.js +0 -62
- package/dist/esm/static-subject-title-249c76cd.js +0 -49
- package/dist/esm/string-input-formatter-slimmer-452c439c.js +0 -430
- package/dist/esm/style-formatter-3b67ed25.js +0 -32
- package/dist/esm/sub-state-notify-slimmer-c7169226.js +0 -78
- package/dist/esm/sub-state-observer-slimmer-1d3336d6.js +0 -131
- package/dist/esm/translation-4bed3392.js +0 -334
- package/dist/esm/translation-slimmer-fc1ddf17.js +0 -40
- package/dist/esm/vega-internal-event-id-d7113cf7.js +0 -49
- package/dist/esm/vega-skeleton-loader-controller-722a41c2.js +0 -1112
- package/dist/types/components/vega-input-phone-number/assets/country-flags.d.ts +0 -5
- package/dist/vega/p-01d4c679.js +0 -1
- package/dist/vega/p-0a8b91f5.entry.js +0 -1
- package/dist/vega/p-0d8136bc.entry.js +0 -1
- package/dist/vega/p-0f1a56d0.entry.js +0 -1
- package/dist/vega/p-11249b56.entry.js +0 -1
- package/dist/vega/p-11ccc1a9.entry.js +0 -1
- package/dist/vega/p-179887da.js +0 -1
- package/dist/vega/p-179c59ff.js +0 -1
- package/dist/vega/p-1d46d29d.entry.js +0 -1
- package/dist/vega/p-25d18888.entry.js +0 -1
- package/dist/vega/p-27192960.js +0 -1
- package/dist/vega/p-2b7252c6.js +0 -1
- package/dist/vega/p-2d6928c3.entry.js +0 -1
- package/dist/vega/p-32af415d.entry.js +0 -1
- package/dist/vega/p-39bb2289.js +0 -1
- package/dist/vega/p-39d3782b.entry.js +0 -1
- package/dist/vega/p-3b877fa3.entry.js +0 -1
- package/dist/vega/p-3c36bd11.entry.js +0 -1
- package/dist/vega/p-3d236584.entry.js +0 -1
- package/dist/vega/p-46555732.entry.js +0 -1
- package/dist/vega/p-4868e57c.entry.js +0 -1
- package/dist/vega/p-4a47bc03.entry.js +0 -1
- package/dist/vega/p-4e406f70.entry.js +0 -1
- package/dist/vega/p-51686ec2.js +0 -1
- package/dist/vega/p-5299a287.entry.js +0 -1
- package/dist/vega/p-55101775.entry.js +0 -1
- package/dist/vega/p-57f406cf.entry.js +0 -1
- package/dist/vega/p-5825343a.entry.js +0 -1
- package/dist/vega/p-59c9de55.js +0 -1
- package/dist/vega/p-5f5bfd9c.js +0 -1
- package/dist/vega/p-60234e0a.entry.js +0 -1
- package/dist/vega/p-619fdde5.js +0 -1
- package/dist/vega/p-631c8001.entry.js +0 -1
- package/dist/vega/p-639c3322.entry.js +0 -1
- package/dist/vega/p-65dc0b25.entry.js +0 -1
- package/dist/vega/p-66c5fa14.js +0 -1
- package/dist/vega/p-6be0a9bf.entry.js +0 -1
- package/dist/vega/p-71b82ba5.entry.js +0 -1
- package/dist/vega/p-7617b2ac.js +0 -1
- package/dist/vega/p-7839a201.entry.js +0 -1
- package/dist/vega/p-8b044ac7.entry.js +0 -1
- package/dist/vega/p-8d1e0418.entry.js +0 -1
- package/dist/vega/p-901c5b75.js +0 -1
- package/dist/vega/p-99289273.js +0 -1
- package/dist/vega/p-9955844c.entry.js +0 -1
- package/dist/vega/p-9ba28523.js +0 -1
- package/dist/vega/p-9bebdace.entry.js +0 -1
- package/dist/vega/p-9d3d7854.entry.js +0 -1
- package/dist/vega/p-a02f52b7.js +0 -1
- package/dist/vega/p-a04624f3.entry.js +0 -1
- package/dist/vega/p-a247e073.js +0 -1
- package/dist/vega/p-a3fa41c8.js +0 -1
- package/dist/vega/p-a501fb74.entry.js +0 -1
- package/dist/vega/p-a88acecd.entry.js +0 -1
- package/dist/vega/p-acba84aa.entry.js +0 -1
- package/dist/vega/p-b196eab0.entry.js +0 -1
- package/dist/vega/p-b288e52e.entry.js +0 -1
- package/dist/vega/p-b54328c6.js +0 -1
- package/dist/vega/p-b587e576.entry.js +0 -1
- package/dist/vega/p-b6c155d4.entry.js +0 -1
- package/dist/vega/p-b87ede84.entry.js +0 -1
- package/dist/vega/p-c00d95d2.entry.js +0 -13
- package/dist/vega/p-c66b55f8.js +0 -1
- package/dist/vega/p-c8408c13.js +0 -1
- package/dist/vega/p-c8f914d2.js +0 -1
- package/dist/vega/p-c906aa4f.js +0 -1
- package/dist/vega/p-cf3d8e47.entry.js +0 -1
- package/dist/vega/p-d3101d07.entry.js +0 -1
- package/dist/vega/p-d3aa2ea7.entry.js +0 -1
- package/dist/vega/p-d82cdded.entry.js +0 -1
- package/dist/vega/p-d8683a5f.js +0 -1
- package/dist/vega/p-dbd3e747.entry.js +0 -1
- package/dist/vega/p-dd94bd57.entry.js +0 -1
- package/dist/vega/p-e06361df.js +0 -1
- package/dist/vega/p-e244aa52.entry.js +0 -1
- package/dist/vega/p-e8bb5d2e.entry.js +0 -1
- package/dist/vega/p-e8be1bd4.entry.js +0 -1
- package/dist/vega/p-eae914b0.entry.js +0 -1
- package/dist/vega/p-ed569397.entry.js +0 -1
- package/dist/vega/p-f18ed03e.entry.js +0 -1
- package/dist/vega/p-f1e0e7d4.js +0 -1
- package/dist/vega/p-f3ffe0ee.entry.js +0 -1
- package/dist/vega/p-f5c32d70.entry.js +0 -1
- package/dist/vega/p-f8f056db.entry.js +0 -1
- package/dist/vega/p-fe51bfea.entry.js +0 -1
- package/dist/vega/p-fea464ce.entry.js +0 -1
- package/dist/vega/p-ffaafd34.js +0 -1
- /package/dist/collection/components/{vega-input-phone-number → vega-flag-icon}/assets/country-flags.js +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ac.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ad.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ae.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/af.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ag.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ai.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/al.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/am.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ao.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ar.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/as.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/at.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/au.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/aw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ax.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/az.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ba.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bb.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bd.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/be.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bf.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bh.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bi.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bj.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bl.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bo.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bq.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/br.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bs.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bt.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/by.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/bz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ca.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cc.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cd.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cf.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ch.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ci.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ck.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cl.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/co.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cu.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cv.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cx.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cy.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/cz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/de.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/dj.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/dk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/dm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/do.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/dz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ec.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ee.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/eg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/eh.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/er.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/es.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/et.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/fi.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/fj.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/fk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/fm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/fo.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/fr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ga.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gb.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gd.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ge.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gf.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gh.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gi.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gl.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gp.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gq.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gt.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gu.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/gy.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/hk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/hn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/hr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ht.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/hu.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/id.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ie.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/il.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/im.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/in.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/io.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/iq.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ir.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/is.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/it.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/je.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/jm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/jo.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/jp.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ke.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/kg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/kh.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ki.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/km.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/kn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/kp.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/kr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/kw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ky.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/kz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/la.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/lb.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/lc.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/li.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/lk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/lr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ls.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/lt.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/lu.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/lv.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ly.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ma.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mc.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/md.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/me.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mf.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mh.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ml.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mo.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mp.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mq.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ms.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mt.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mu.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mv.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mx.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/my.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/mz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/na.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/nc.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ne.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/nf.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ng.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ni.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/nl.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/no.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/np.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/nr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/nu.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/nz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/om.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pa.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pe.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pf.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ph.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pl.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ps.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pt.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/pw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/py.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/qa.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/re.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ro.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/rs.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ru.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/rw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sa.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sb.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sc.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sd.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/se.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sh.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/si.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sj.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sl.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/so.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ss.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/st.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sv.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sx.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sy.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/sz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ta.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tc.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/td.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/th.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tj.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tl.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/to.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tr.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tt.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tv.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tw.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/tz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ua.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ug.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/us.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/uy.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/uz.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/va.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/vc.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ve.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/vg.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/vi.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/vn.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/vu.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/wf.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ws.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/xk.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/ye.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/yt.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/za.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/zm.d.ts +0 -0
- /package/dist/types/components/{vega-input-phone-number → vega-flag-icon}/assets/flags/zw.d.ts +0 -0
|
@@ -0,0 +1,3586 @@
|
|
|
1
|
+
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
2
|
+
import { d as domNodeSubjectFactory } from './dom-node-subject-factory-f77cf9cc.js';
|
|
3
|
+
import { a as VegaInternalRichTextEditorFlushChanges, b as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-7d1ff289.js';
|
|
4
|
+
import { L as LogUtility } from './global-slimmer-registry-17c4efd4.js';
|
|
5
|
+
import { i as isNonNullable } from './type-guard-158f6d7a.js';
|
|
6
|
+
import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-8ada793f.js';
|
|
7
|
+
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-e5915f26.js';
|
|
8
|
+
|
|
9
|
+
var InternalAnnotationTypeEnum;
|
|
10
|
+
(function (InternalAnnotationTypeEnum) {
|
|
11
|
+
InternalAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
12
|
+
InternalAnnotationTypeEnum["CLEAR_FORMATTING"] = "CLEAR_FORMATTING";
|
|
13
|
+
InternalAnnotationTypeEnum["LINK_GROUP"] = "LINK_GROUP";
|
|
14
|
+
})(InternalAnnotationTypeEnum || (InternalAnnotationTypeEnum = {}));
|
|
15
|
+
/**
|
|
16
|
+
* Abstract class for all annotations
|
|
17
|
+
*/
|
|
18
|
+
class Annotation {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var BlockAnnotationTypeEnum;
|
|
22
|
+
(function (BlockAnnotationTypeEnum) {
|
|
23
|
+
BlockAnnotationTypeEnum["ALIGNMENT"] = "ALIGNMENT";
|
|
24
|
+
BlockAnnotationTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
|
|
25
|
+
BlockAnnotationTypeEnum["INDENT"] = "INDENT";
|
|
26
|
+
})(BlockAnnotationTypeEnum || (BlockAnnotationTypeEnum = {}));
|
|
27
|
+
/**
|
|
28
|
+
* BlockAnnotation is an abstract class that represents a block annotation.
|
|
29
|
+
*/
|
|
30
|
+
class BlockAnnotation extends Annotation {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* This class is responsible for keeping track of the DOM elements and their corresponding entities.
|
|
35
|
+
*/
|
|
36
|
+
class StateEntityRenderingRegistry {
|
|
37
|
+
constructor() {
|
|
38
|
+
this.domToEntity = new WeakMap();
|
|
39
|
+
this.entityToDOM = new WeakMap();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Registers a DOM element and its corresponding entity.
|
|
43
|
+
*
|
|
44
|
+
* @param {HTMLElement} dom The DOM element to register.
|
|
45
|
+
* @param {RTEBlock | RTENode} entity The entity to register.
|
|
46
|
+
*/
|
|
47
|
+
register(dom, entity) {
|
|
48
|
+
this.domToEntity.set(dom, entity);
|
|
49
|
+
this.entityToDOM.set(entity, dom);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves the entity corresponding to a DOM element.
|
|
53
|
+
*
|
|
54
|
+
* @param {HTMLElement} dom The DOM element to retrieve the entity for.
|
|
55
|
+
* @returns {Nullable<RTEBlock | RTENode>} The entity corresponding to the DOM element, or null if not found.
|
|
56
|
+
*/
|
|
57
|
+
getEntityByDOM(dom) {
|
|
58
|
+
return this.domToEntity.get(dom);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Retrieves the DOM element corresponding to an entity.
|
|
62
|
+
*
|
|
63
|
+
* @param {RTEBlock | RTENode} entity The entity to retrieve the DOM element for.
|
|
64
|
+
* @returns {Nullable<HTMLElement>} The DOM element corresponding to the entity, or null if not found.
|
|
65
|
+
*/
|
|
66
|
+
getDOMByEntity(entity) {
|
|
67
|
+
return this.entityToDOM.get(entity);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Delete the dirty element to entity ref.
|
|
71
|
+
*
|
|
72
|
+
* @example Convert text node to the link node, the old span will change to the link wrapper element, and there will be a new text span, so we need remove the old span ref from the map.
|
|
73
|
+
* @param {HTMLElement} dom - The dirty element ref.
|
|
74
|
+
*/
|
|
75
|
+
removeDirtyDomRef(dom) {
|
|
76
|
+
this.domToEntity.delete(dom);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const stateEntityRenderingRegistry = new StateEntityRenderingRegistry();
|
|
80
|
+
|
|
81
|
+
var ModifyContentActionType;
|
|
82
|
+
(function (ModifyContentActionType) {
|
|
83
|
+
ModifyContentActionType["DELETE_CHILD"] = "DELETE_CHILD";
|
|
84
|
+
ModifyContentActionType["DELETE_NEST_LIST"] = "DELETE_NEST_LIST";
|
|
85
|
+
ModifyContentActionType["UPDATE_TEXT"] = "UPDATE_TEXT";
|
|
86
|
+
ModifyContentActionType["REPLACE_SELECTED_TEXT"] = "REPLACE_SELECTED_TEXT";
|
|
87
|
+
ModifyContentActionType["APPEND_CHILD_NODES"] = "APPEND_CHILD_NODES";
|
|
88
|
+
ModifyContentActionType["INSERT_BLOCKS_AFTER"] = "INSERT_BLOCKS_AFTER";
|
|
89
|
+
ModifyContentActionType["INSERT_BLOCKS_BEFORE"] = "INSERT_BLOCKS_BEFORE";
|
|
90
|
+
ModifyContentActionType["INSERT_NODES_AFTER"] = "INSERT_NODES_AFTER";
|
|
91
|
+
ModifyContentActionType["INSERT_NODES_BEFORE"] = "INSERT_NODES_BEFORE";
|
|
92
|
+
ModifyContentActionType["SPLIT_BLOCK_WITH_NODE"] = "SPLIT_BLOCK_WITH_NODE";
|
|
93
|
+
ModifyContentActionType["REPLACE_CHILD_NODES"] = "REPLACE_CHILD_NODES";
|
|
94
|
+
ModifyContentActionType["REPLACE_NEST_LIST"] = "REPLACE_NEST_LIST";
|
|
95
|
+
ModifyContentActionType["MERGE_TWO_BLOCKS_NODES"] = "MERGE_TWO_BLOCKS_NODES";
|
|
96
|
+
ModifyContentActionType["BREAK_SINGLE_BLOCK"] = "BREAK_SINGLE_BLOCK";
|
|
97
|
+
ModifyContentActionType["LINE_BREAK_SINGLE_BLOCK"] = "LINE_BREAK_SINGLE_BLOCK";
|
|
98
|
+
ModifyContentActionType["LINE_BREAK_MULTIPLE_BLOCKS"] = "LINE_BREAK_MULTIPLE_BLOCKS";
|
|
99
|
+
ModifyContentActionType["TRANSFORM_LIST_BLOCK"] = "TRANSFORM_LIST_BLOCK";
|
|
100
|
+
ModifyContentActionType["TRANSFORM_PARAGRAPH_BLOCK"] = "TRANSFORM_PARAGRAPH_BLOCK";
|
|
101
|
+
ModifyContentActionType["DELETE_BLOCK_CONTENT"] = "DELETE_BLOCK_CONTENT";
|
|
102
|
+
ModifyContentActionType["INSERT_IMAGE_TO_BLOCK"] = "INSERT_IMAGE_TO_BLOCK";
|
|
103
|
+
ModifyContentActionType["UPDATE_IMAGE_NODE_URL"] = "UPDATE_IMAGE_NODE_URL";
|
|
104
|
+
})(ModifyContentActionType || (ModifyContentActionType = {}));
|
|
105
|
+
/**
|
|
106
|
+
* Abstract class for update node content, delete node, insert node
|
|
107
|
+
*/
|
|
108
|
+
class ModifyContentAction {
|
|
109
|
+
constructor() {
|
|
110
|
+
this.isFlushable = false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Annotation to make block with horizontal alignment
|
|
116
|
+
*/
|
|
117
|
+
class HorizontalAlignmentAnnotation extends BlockAnnotation {
|
|
118
|
+
constructor(textAlign) {
|
|
119
|
+
super();
|
|
120
|
+
this.type = BlockAnnotationTypeEnum.ALIGNMENT;
|
|
121
|
+
this.textAlign = textAlign;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Generate the map item for the annotation
|
|
125
|
+
*
|
|
126
|
+
* @param {VegaRTEBlockAlignment} textAlign - Text alignment
|
|
127
|
+
* @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
|
|
128
|
+
*/
|
|
129
|
+
static from(textAlign) {
|
|
130
|
+
return [BlockAnnotationTypeEnum.ALIGNMENT, new HorizontalAlignmentAnnotation(textAlign)];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Generate the JSON item of the annotation
|
|
134
|
+
*
|
|
135
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
136
|
+
*/
|
|
137
|
+
toJSON() {
|
|
138
|
+
return {
|
|
139
|
+
textAlign: this.textAlign,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Generate the class for the annotation
|
|
144
|
+
*
|
|
145
|
+
* @returns {string} - Annotation class
|
|
146
|
+
*/
|
|
147
|
+
renderClass() {
|
|
148
|
+
return `v-rte--horizontal-alignment-${this.textAlign}`;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Generate the style for the annotation
|
|
152
|
+
*
|
|
153
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
154
|
+
*/
|
|
155
|
+
render() {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Annotation for block indentation
|
|
162
|
+
*/
|
|
163
|
+
class IndentAnnotation extends BlockAnnotation {
|
|
164
|
+
constructor(indent) {
|
|
165
|
+
super();
|
|
166
|
+
this.type = BlockAnnotationTypeEnum.INDENT;
|
|
167
|
+
this.indent = Math.max(0, indent);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Generate the map item for the annotation
|
|
171
|
+
*
|
|
172
|
+
* @param {number} indent - Text alignment
|
|
173
|
+
* @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
|
|
174
|
+
*/
|
|
175
|
+
static from(indent) {
|
|
176
|
+
return [BlockAnnotationTypeEnum.INDENT, new IndentAnnotation(indent)];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Generate the JSON item of the annotation
|
|
180
|
+
*
|
|
181
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
182
|
+
*/
|
|
183
|
+
toJSON() {
|
|
184
|
+
return this.indent > 0 ? { indent: this.indent } : null;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Generate the style for the annotation
|
|
188
|
+
*
|
|
189
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
190
|
+
*/
|
|
191
|
+
render() {
|
|
192
|
+
return this.indent > 0 ? { 'margin-left': `${this.indent * 16}px` } : null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The strategies registry, contains static methods `register`, `get` and `getStrategyAndExecute`.
|
|
198
|
+
*/
|
|
199
|
+
class ActionHandleStrategyRegistry {
|
|
200
|
+
/**
|
|
201
|
+
* Bind a specific strategy to a special action type of the rich text node.
|
|
202
|
+
*
|
|
203
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
204
|
+
* @param {string} targetClass - The rich text node class name.
|
|
205
|
+
* @param {ActionHandleStrategy} strategy - The action handle strategy instance.
|
|
206
|
+
*/
|
|
207
|
+
static register(actionType, targetClass, strategy) {
|
|
208
|
+
if (!this.registry.has(targetClass)) {
|
|
209
|
+
this.registry.set(targetClass, new Map());
|
|
210
|
+
}
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
212
|
+
this.registry.get(targetClass).set(actionType, strategy);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get the special strategy that handle the action logic.
|
|
216
|
+
*
|
|
217
|
+
* @typedef T generic type
|
|
218
|
+
* @typedef target generic type
|
|
219
|
+
* @typedef R generic type
|
|
220
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
221
|
+
* @param {string} targetClass - The rich text node class name.
|
|
222
|
+
* @returns {Nullable<ActionHandleStrategy<T, target, R>>} - The action handle strategy instance if defined.
|
|
223
|
+
*/
|
|
224
|
+
static get(actionType, targetClass) {
|
|
225
|
+
const strategyMap = this.registry.get(targetClass);
|
|
226
|
+
if (strategyMap) {
|
|
227
|
+
return strategyMap.get(actionType);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get the special strategy from the registry and run the strategy execute method.
|
|
232
|
+
*
|
|
233
|
+
* @typedef R generic type
|
|
234
|
+
* @param {ModifyContentAction | AnnotationAction} action - The update node action instance.
|
|
235
|
+
* @param {RTENode | RTEBlock | VegaRTEContent} RTEInstance - The rich text editor node.
|
|
236
|
+
* @returns {R | undefined} The return value of the strategy method execute invoke result.
|
|
237
|
+
*/
|
|
238
|
+
static executeTheStrategy(action, RTEInstance) {
|
|
239
|
+
const actionType = action instanceof ModifyContentAction ? action.type : action.constructor.name;
|
|
240
|
+
const strategy = ActionHandleStrategyRegistry.get(actionType, RTEInstance.constructor.name);
|
|
241
|
+
if (strategy) {
|
|
242
|
+
return strategy.execute(action, RTEInstance);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
LogUtility.error(`Type ${actionType} action handle strategy is not registered in class ${RTEInstance.constructor.name}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
ActionHandleStrategyRegistry.registry = new Map();
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Abstract class for block
|
|
253
|
+
*/
|
|
254
|
+
class RTEBlock {
|
|
255
|
+
constructor(id) {
|
|
256
|
+
this.annotationMap = new Map();
|
|
257
|
+
this.id = id;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
261
|
+
* and value.
|
|
262
|
+
*
|
|
263
|
+
* @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
|
|
264
|
+
* the type of annotation entity to create.
|
|
265
|
+
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
266
|
+
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
267
|
+
* annotation being created.
|
|
268
|
+
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
269
|
+
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
270
|
+
*/
|
|
271
|
+
static createAnnotationEntity(type, value) {
|
|
272
|
+
switch (type) {
|
|
273
|
+
case 'textAlign':
|
|
274
|
+
return HorizontalAlignmentAnnotation.from(value);
|
|
275
|
+
case 'indent':
|
|
276
|
+
return IndentAnnotation.from(value);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Class to JSON object
|
|
281
|
+
*
|
|
282
|
+
* @returns {VegaRTEBlockBase} - JSON object
|
|
283
|
+
*/
|
|
284
|
+
toJSON() {
|
|
285
|
+
const annotations = Array.from(this.annotationMap.values())
|
|
286
|
+
.filter((annotation) => annotation instanceof BlockAnnotation)
|
|
287
|
+
.reduce((record, annotation) => {
|
|
288
|
+
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
289
|
+
}, {});
|
|
290
|
+
return Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {}));
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Get annotation by type
|
|
294
|
+
*
|
|
295
|
+
* @typedef T generic type
|
|
296
|
+
* @param {keyof typeof BlockAnnotationTypeEnum} type - Annotation type
|
|
297
|
+
* @returns {Nullable<T>} - Annotation
|
|
298
|
+
*/
|
|
299
|
+
getAnnotationByType(type) {
|
|
300
|
+
return this.annotationMap.get(type);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Apply action to block
|
|
304
|
+
*
|
|
305
|
+
* @param {AnnotationAction} action - Annotation action
|
|
306
|
+
*/
|
|
307
|
+
apply(action) {
|
|
308
|
+
this.doApply(action);
|
|
309
|
+
if (action.isFlushable) {
|
|
310
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
311
|
+
if (domNode) {
|
|
312
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
|
|
313
|
+
if (nodeSubject) {
|
|
314
|
+
ChangeManager.notify(nodeSubject, {});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Apply action to block
|
|
321
|
+
*
|
|
322
|
+
* @param {AnnotationAction|ModifyContentAction} action - Annotation action
|
|
323
|
+
*/
|
|
324
|
+
doApply(action) {
|
|
325
|
+
if (action instanceof ModifyContentAction) {
|
|
326
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
this.applyAnnotationAction(action);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Apply annotation action to block
|
|
334
|
+
*
|
|
335
|
+
* @param {AnnotationAction} action - Annotation action
|
|
336
|
+
*/
|
|
337
|
+
applyAnnotationAction(action) {
|
|
338
|
+
const annotation = action.toAnnotation();
|
|
339
|
+
this.annotationMap.set(annotation.type, annotation);
|
|
340
|
+
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
var NodeTypeEnum;
|
|
345
|
+
(function (NodeTypeEnum) {
|
|
346
|
+
NodeTypeEnum["TEXT"] = "TEXT";
|
|
347
|
+
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
348
|
+
})(NodeTypeEnum || (NodeTypeEnum = {}));
|
|
349
|
+
/**
|
|
350
|
+
* Abstract class for all nodes
|
|
351
|
+
*/
|
|
352
|
+
class RTENode {
|
|
353
|
+
constructor(id, annotationMap) {
|
|
354
|
+
this.annotationMap = new Map();
|
|
355
|
+
this.id = id;
|
|
356
|
+
if (annotationMap) {
|
|
357
|
+
this.annotationMap = annotationMap;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Get annotation by type
|
|
362
|
+
*
|
|
363
|
+
* @typedef T generic type
|
|
364
|
+
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
365
|
+
* @returns {Nullable<T>} - Annotation
|
|
366
|
+
*/
|
|
367
|
+
getAnnotationByType(type) {
|
|
368
|
+
return this.annotationMap.get(type);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Delete annotation by type
|
|
372
|
+
*
|
|
373
|
+
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
374
|
+
*/
|
|
375
|
+
deleteAnnotationByType(type) {
|
|
376
|
+
this.annotationMap.delete(type);
|
|
377
|
+
this.flushChange();
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Apply action to node
|
|
381
|
+
*
|
|
382
|
+
* @param {AnnotationAction} action - Annotation action
|
|
383
|
+
* @returns {this} - Node
|
|
384
|
+
*/
|
|
385
|
+
apply(action) {
|
|
386
|
+
this.doApply(action);
|
|
387
|
+
if (action.isFlushable) {
|
|
388
|
+
this.flushChange();
|
|
389
|
+
}
|
|
390
|
+
return this;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* apply annotation action or modify content action
|
|
394
|
+
*
|
|
395
|
+
* @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
|
|
396
|
+
*/
|
|
397
|
+
doApply(action) {
|
|
398
|
+
if (action instanceof ModifyContentAction) {
|
|
399
|
+
this.doModifyActionApply(action);
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
this.doAnnotationActionApply(action);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Flush the value change
|
|
407
|
+
*/
|
|
408
|
+
flushChange() {
|
|
409
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
410
|
+
if (domNode) {
|
|
411
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
|
|
412
|
+
if (nodeSubject) {
|
|
413
|
+
ChangeManager.notify(nodeSubject, {});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
var NodeAnnotationTypeEnum;
|
|
420
|
+
(function (NodeAnnotationTypeEnum) {
|
|
421
|
+
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
422
|
+
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
423
|
+
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
424
|
+
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
425
|
+
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
426
|
+
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
427
|
+
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
428
|
+
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
429
|
+
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
430
|
+
})(NodeAnnotationTypeEnum || (NodeAnnotationTypeEnum = {}));
|
|
431
|
+
/**
|
|
432
|
+
* Abstract class for all annotations
|
|
433
|
+
*/
|
|
434
|
+
class NodeAnnotation extends Annotation {
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Annotation for image
|
|
439
|
+
*/
|
|
440
|
+
class ImageAnnotation extends NodeAnnotation {
|
|
441
|
+
constructor(size = 'md', alt) {
|
|
442
|
+
super();
|
|
443
|
+
this.type = NodeAnnotationTypeEnum.IMAGE;
|
|
444
|
+
this.size = size;
|
|
445
|
+
this.alt = alt;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Generate the map item for the annotation
|
|
449
|
+
*
|
|
450
|
+
* @param {string} size - Image size
|
|
451
|
+
* @param {string} alt - Image alt
|
|
452
|
+
* @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
|
|
453
|
+
*/
|
|
454
|
+
static from(size, alt) {
|
|
455
|
+
return [NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Generate the JSON representation of the annotation
|
|
459
|
+
*
|
|
460
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
461
|
+
*/
|
|
462
|
+
toJSON() {
|
|
463
|
+
return isNonNullable(this.alt)
|
|
464
|
+
? {
|
|
465
|
+
size: this.size,
|
|
466
|
+
alt: this.alt,
|
|
467
|
+
}
|
|
468
|
+
: {
|
|
469
|
+
size: this.size,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Generate the style for the image
|
|
474
|
+
*
|
|
475
|
+
* @returns {Nullable<AnnotationStyle>} image style
|
|
476
|
+
*/
|
|
477
|
+
render() {
|
|
478
|
+
switch (this.size) {
|
|
479
|
+
case 'sm': {
|
|
480
|
+
return { width: '25%' };
|
|
481
|
+
}
|
|
482
|
+
case 'md': {
|
|
483
|
+
return { width: '50%' };
|
|
484
|
+
}
|
|
485
|
+
case 'lg': {
|
|
486
|
+
return { width: '100%' };
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* The base action handle strategy class, use to modify the rich text node content or modify the annotation.
|
|
494
|
+
*/
|
|
495
|
+
class ActionHandleStrategy {
|
|
496
|
+
/**
|
|
497
|
+
* Public method to invoke the handle logic.
|
|
498
|
+
*
|
|
499
|
+
* @typedef R generic type
|
|
500
|
+
* @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
|
|
501
|
+
* @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
|
|
502
|
+
* @returns {R} - The invoke result in special strategy.
|
|
503
|
+
*/
|
|
504
|
+
execute(action, target) {
|
|
505
|
+
LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
|
|
506
|
+
return this.handleAction(action, target);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Checks if the caret position is at the end of a specified RTETextNode.
|
|
510
|
+
*
|
|
511
|
+
* @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
|
|
512
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
513
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
514
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
515
|
+
*/
|
|
516
|
+
isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
|
|
517
|
+
const lastNode = textBlock.nodes[textBlock.nodes.length - 1];
|
|
518
|
+
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Checks if the caret position is at the start of a specified RTETextNode.
|
|
522
|
+
*
|
|
523
|
+
* @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
|
|
524
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
525
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
526
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
527
|
+
*/
|
|
528
|
+
isCaretPositionAtTextBlockStart(textBlock, node, startOffset) {
|
|
529
|
+
return node === textBlock.nodes[0] && startOffset === 0;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Checks if the caret position is at the start of a specified RTEImageNode.
|
|
533
|
+
*
|
|
534
|
+
* @param {RTEImageBlock} target - The image block.
|
|
535
|
+
* @param {RTEImageNode} node - `RTEImageNode` - a node representing an image in a rich text editor.
|
|
536
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
537
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTEImageNode.
|
|
538
|
+
*/
|
|
539
|
+
isCaretPositionAtImageBlockStart(target, node, startOffset) {
|
|
540
|
+
return node === target.nodes[0] && startOffset === 0;
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Checks if the caret position is at the end of a given RTEImageNode.
|
|
544
|
+
*
|
|
545
|
+
* @param {RTEImageBlock} target - The image block.
|
|
546
|
+
* @param {RTEImageNode} node - `node` is a RTEImageNode
|
|
547
|
+
* @param {number} startOffset - The position within the `RTEImageNode` where the caret is located.
|
|
548
|
+
* @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEImageNode`.
|
|
549
|
+
*/
|
|
550
|
+
isCaretPositionAtImageBlockEnd(target, node, startOffset) {
|
|
551
|
+
const lastNode = target.nodes[target.nodes.length - 1];
|
|
552
|
+
return node === lastNode && startOffset === 1;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Update the image node annotation map strategy.
|
|
558
|
+
*/
|
|
559
|
+
class ImageSetAnnotationMapStrategy extends ActionHandleStrategy {
|
|
560
|
+
/**
|
|
561
|
+
* @inheritDoc
|
|
562
|
+
*/
|
|
563
|
+
handleAction(action, target) {
|
|
564
|
+
const annotation = action.toAnnotation();
|
|
565
|
+
target.annotationMap.set(annotation.type, annotation);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* The image node update property url strategy.
|
|
571
|
+
*/
|
|
572
|
+
class ImageUpdateUrlStrategy extends ActionHandleStrategy {
|
|
573
|
+
/**
|
|
574
|
+
* @inheritDoc
|
|
575
|
+
*/
|
|
576
|
+
handleAction(action, target) {
|
|
577
|
+
target.url = action.url;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Abstract class for annotation actions
|
|
583
|
+
*/
|
|
584
|
+
class AnnotationAction {
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Image node
|
|
589
|
+
*/
|
|
590
|
+
class RTEImageNode extends RTENode {
|
|
591
|
+
constructor(id, url, parentBlock, annotationMap) {
|
|
592
|
+
super(id, annotationMap);
|
|
593
|
+
this.type = NodeTypeEnum.IMAGE;
|
|
594
|
+
this.url = url;
|
|
595
|
+
this.parentBlock = parentBlock;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Converts a VegaRTEImageNode into an RTEImageNode by mapping nodes and creating annotations.
|
|
599
|
+
*
|
|
600
|
+
* @param {VegaRTEImageNode} node - The node to be converted.
|
|
601
|
+
* @param {RTEImageBlock} parentBlock - The parent block
|
|
602
|
+
* @returns {RTEImageNode} An instance of `RTEImageBlock`
|
|
603
|
+
*/
|
|
604
|
+
static from(node, parentBlock) {
|
|
605
|
+
const imageNode = new RTEImageNode(node.id, node.url, parentBlock);
|
|
606
|
+
let annotations;
|
|
607
|
+
if (!node.annotations || Object.keys(node.annotations).length === 0) {
|
|
608
|
+
annotations = { size: 'md' };
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
annotations = node.annotations;
|
|
612
|
+
}
|
|
613
|
+
imageNode.annotationMap = new Map(Object.keys(annotations)
|
|
614
|
+
.map(() => ImageAnnotation.from(annotations.size, annotations.alt))
|
|
615
|
+
.filter(isNonNullable));
|
|
616
|
+
return imageNode;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* @inheritDoc
|
|
620
|
+
*/
|
|
621
|
+
toJSON() {
|
|
622
|
+
const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
|
|
623
|
+
const annotations = {};
|
|
624
|
+
if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.size) {
|
|
625
|
+
annotations.size = imageAnnotation.size;
|
|
626
|
+
}
|
|
627
|
+
if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt) {
|
|
628
|
+
annotations.alt = imageAnnotation.alt;
|
|
629
|
+
}
|
|
630
|
+
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* @inheritDoc
|
|
634
|
+
*/
|
|
635
|
+
doAnnotationActionApply(action) {
|
|
636
|
+
const strategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTEImageNode.name);
|
|
637
|
+
if (strategy) {
|
|
638
|
+
strategy.execute(action, this);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* @inheritDoc
|
|
643
|
+
*/
|
|
644
|
+
doModifyActionApply(action) {
|
|
645
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
(() => {
|
|
649
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_IMAGE_NODE_URL, RTEImageNode.name, new ImageUpdateUrlStrategy());
|
|
650
|
+
ActionHandleStrategyRegistry.register(AnnotationAction.name, RTEImageNode.name, new ImageSetAnnotationMapStrategy());
|
|
651
|
+
})();
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Delete child node or child block from the current list action
|
|
655
|
+
*
|
|
656
|
+
* @example needRemovedNode.parentBlock.apply(new RemoveChildAction(needRemovedNode))
|
|
657
|
+
* @example needRemovedBlock.parent.apply(new RemoveChildAction(needRemovedBlock))
|
|
658
|
+
*/
|
|
659
|
+
class RemoveChildAction extends ModifyContentAction {
|
|
660
|
+
constructor(childNode) {
|
|
661
|
+
super();
|
|
662
|
+
this.type = ModifyContentActionType.DELETE_CHILD;
|
|
663
|
+
this.entityToBeRemoved = childNode;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
|
|
669
|
+
*/
|
|
670
|
+
class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
671
|
+
/**
|
|
672
|
+
* Returns the previous node relative to the current node in a rich text editor structure.
|
|
673
|
+
*
|
|
674
|
+
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
675
|
+
* @returns {Nullable<RTENode>} the previous block last node
|
|
676
|
+
*/
|
|
677
|
+
getPreviousNode(currentNode) {
|
|
678
|
+
const currentBlock = currentNode.parentBlock;
|
|
679
|
+
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
680
|
+
if (currentIndex > 0) {
|
|
681
|
+
return currentBlock['nodes'][currentIndex - 1];
|
|
682
|
+
}
|
|
683
|
+
else if (currentBlock.parent) {
|
|
684
|
+
const previousBlock = this.getPreviousBlock(currentBlock);
|
|
685
|
+
if (previousBlock) {
|
|
686
|
+
return this.getBlockLastNode(previousBlock);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Returns the next node relative to the current node in a rich text editor structure.
|
|
692
|
+
*
|
|
693
|
+
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
694
|
+
* @returns {Nullable<RTENode>} the next block first node
|
|
695
|
+
*/
|
|
696
|
+
getNextNode(currentNode) {
|
|
697
|
+
const currentBlock = currentNode.parentBlock;
|
|
698
|
+
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
699
|
+
if (currentBlock['nodes'][currentIndex + 1]) {
|
|
700
|
+
return currentBlock['nodes'][currentIndex + 1];
|
|
701
|
+
}
|
|
702
|
+
else if (currentBlock.parent) {
|
|
703
|
+
const nextBlock = this.getNextBlock(currentBlock);
|
|
704
|
+
if (nextBlock) {
|
|
705
|
+
return this.getBlockFirstNode(nextBlock);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Determines if a given node is the first node within the current state.
|
|
711
|
+
*
|
|
712
|
+
* @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
|
|
713
|
+
* @returns {boolean} True or false;
|
|
714
|
+
*/
|
|
715
|
+
isContentFirstNode(currentNode) {
|
|
716
|
+
const currentBlock = currentNode.parentBlock;
|
|
717
|
+
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
718
|
+
const parent = currentBlock.parent;
|
|
719
|
+
if (currentBlock.type === 'list-item') {
|
|
720
|
+
const listParent = parent.parent;
|
|
721
|
+
return (currentIndex === 0 &&
|
|
722
|
+
Array.isArray(parent['blocks']) &&
|
|
723
|
+
parent['blocks'][0] === currentBlock &&
|
|
724
|
+
listParent['type'] !== 'list-item' &&
|
|
725
|
+
Array.isArray(listParent['blocks']) &&
|
|
726
|
+
listParent['blocks'][0] === parent);
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
return (currentIndex === 0 && Array.isArray(parent['blocks']) && parent['blocks'][0] === currentBlock);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* TODO: The getPreviousBlock add nest list support
|
|
734
|
+
* This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
735
|
+
*
|
|
736
|
+
* @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
|
|
737
|
+
* @returns {Nullable<RTEBlock>} The previous block if existing
|
|
738
|
+
*/
|
|
739
|
+
getPreviousBlock(currentBlock) {
|
|
740
|
+
if (currentBlock && currentBlock.parent && currentBlock.parent['blocks']) {
|
|
741
|
+
const currentBlockIndex = currentBlock.parent['blocks'].indexOf(currentBlock);
|
|
742
|
+
if (currentBlockIndex > 0) {
|
|
743
|
+
return currentBlock.parent['blocks'][currentBlockIndex - 1];
|
|
744
|
+
}
|
|
745
|
+
else if ((currentBlock.parent['type'] === 'number-list' ||
|
|
746
|
+
currentBlock.parent['type'] === 'bullet-list') &&
|
|
747
|
+
currentBlockIndex === 0) {
|
|
748
|
+
return this.getPreviousBlock(currentBlock.parent);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Returns the last node within a given RTE block, handling different block types accordingly.
|
|
754
|
+
*
|
|
755
|
+
* @param {RTEBlock} currentBlock - Returns the last node within that block.
|
|
756
|
+
* @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
|
|
757
|
+
*/
|
|
758
|
+
getBlockLastNode(currentBlock) {
|
|
759
|
+
if (currentBlock.type === 'list-item') {
|
|
760
|
+
if (currentBlock['children'] && currentBlock['children'].length > 0) {
|
|
761
|
+
return this.getBlockLastNode(currentBlock['children'][currentBlock['children'].length - 1]);
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
return currentBlock['nodes'][currentBlock['nodes'].length - 1];
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
else if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
|
|
768
|
+
const listItems = currentBlock.blocks;
|
|
769
|
+
if (listItems) {
|
|
770
|
+
const lastListItem = listItems[listItems.length - 1];
|
|
771
|
+
return this.getBlockLastNode(lastListItem);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
if (currentBlock['nodes']) {
|
|
776
|
+
return currentBlock['nodes'][currentBlock['nodes'].length - 1];
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Returns the first node within a given RTE block, handling different block types accordingly.
|
|
782
|
+
*
|
|
783
|
+
* @param {RTEBlock} currentBlock - Returns the first node within that block.
|
|
784
|
+
* @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
|
|
785
|
+
*/
|
|
786
|
+
getBlockFirstNode(currentBlock) {
|
|
787
|
+
if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
|
|
788
|
+
if (currentBlock.blocks) {
|
|
789
|
+
const firstListItem = currentBlock.blocks[0];
|
|
790
|
+
return this.getBlockFirstNode(firstListItem);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
else {
|
|
794
|
+
if (currentBlock['nodes']) {
|
|
795
|
+
return currentBlock['nodes'][0];
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
801
|
+
*
|
|
802
|
+
* @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
|
|
803
|
+
* @returns {Nullable<RTEBlock>} The next block if existing
|
|
804
|
+
*/
|
|
805
|
+
getNextBlock(currentBlock) {
|
|
806
|
+
if (currentBlock && currentBlock.parent && currentBlock.parent['blocks']) {
|
|
807
|
+
const currentBlockIndex = currentBlock.parent['blocks'].indexOf(currentBlock);
|
|
808
|
+
if (currentBlock.parent['blocks'][currentBlockIndex + 1]) {
|
|
809
|
+
return currentBlock.parent['blocks'][currentBlockIndex + 1];
|
|
810
|
+
}
|
|
811
|
+
else if (currentBlock.type === 'list-item' &&
|
|
812
|
+
currentBlock.parent.blocks.length === currentBlockIndex + 1) {
|
|
813
|
+
return this.getNextBlock(currentBlock.parent);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* The image block delete the image node strategy.
|
|
821
|
+
*/
|
|
822
|
+
class BlockDeleteImageStrategy extends BlockDeleteNodeContentStrategy {
|
|
823
|
+
/**
|
|
824
|
+
* @inheritDoc
|
|
825
|
+
*/
|
|
826
|
+
handleAction(action, target) {
|
|
827
|
+
this.deleteNodeContent(action, target);
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Deletes content from a block node based on specific conditions.
|
|
831
|
+
*
|
|
832
|
+
* @param {DeleteBlockContentAction} action - Delete block content action
|
|
833
|
+
* @param {RTEImageBlock} target - The image block.
|
|
834
|
+
*/
|
|
835
|
+
deleteNodeContent(action, target) {
|
|
836
|
+
const startContainerNode = action
|
|
837
|
+
.startContainerNode, startOffset = action.startOffset;
|
|
838
|
+
let previousNode = this.getPreviousNode(startContainerNode);
|
|
839
|
+
let nextNode = null;
|
|
840
|
+
if (startOffset === 1) {
|
|
841
|
+
const parentBlock = target;
|
|
842
|
+
if (this.isContentFirstNode(startContainerNode)) {
|
|
843
|
+
nextNode = this.getNextNode(startContainerNode);
|
|
844
|
+
}
|
|
845
|
+
if (parentBlock.nodes.length === 1) {
|
|
846
|
+
parentBlock.parent.apply(new RemoveChildAction(parentBlock));
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
parentBlock.apply(new RemoveChildAction(startContainerNode));
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
else {
|
|
853
|
+
const shouldRemoveNode = previousNode;
|
|
854
|
+
if (shouldRemoveNode && shouldRemoveNode instanceof RTEImageNode) {
|
|
855
|
+
previousNode = this.getPreviousNode(shouldRemoveNode);
|
|
856
|
+
shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
|
|
857
|
+
if (!previousNode) {
|
|
858
|
+
action.nextNode = startContainerNode;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
if (previousNode) {
|
|
863
|
+
action.previousNode = previousNode;
|
|
864
|
+
}
|
|
865
|
+
else if (nextNode) {
|
|
866
|
+
action.nextNode = nextNode;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/** Append blocks or nodes to a block */
|
|
872
|
+
class AppendChildNodesAction extends ModifyContentAction {
|
|
873
|
+
constructor(childNodes) {
|
|
874
|
+
super();
|
|
875
|
+
this.type = ModifyContentActionType.APPEND_CHILD_NODES;
|
|
876
|
+
this.entityToBeAppended = childNodes;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* Append the second block child nodes to the first block child nodes and remove the second block strategy.
|
|
882
|
+
*/
|
|
883
|
+
class BlockMergeNodesStrategy extends ActionHandleStrategy {
|
|
884
|
+
/**
|
|
885
|
+
* Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
|
|
886
|
+
*
|
|
887
|
+
* @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
|
|
888
|
+
* @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
|
|
889
|
+
*/
|
|
890
|
+
handleAction(action, target) {
|
|
891
|
+
const anotherBlock = action.blockNeedToBeMerged;
|
|
892
|
+
if (target.type === anotherBlock.type || (target.type !== 'image' && anotherBlock.type !== 'image')) {
|
|
893
|
+
let shouldMergeNodes = anotherBlock['nodes'];
|
|
894
|
+
if (anotherBlock['type'] !== 'image') {
|
|
895
|
+
shouldMergeNodes = anotherBlock['nodes'].filter((node) => node.text);
|
|
896
|
+
}
|
|
897
|
+
target.apply(new AppendChildNodesAction(shouldMergeNodes));
|
|
898
|
+
anotherBlock.parent.apply(new RemoveChildAction(anotherBlock));
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Remove the node from the text block or image block strategy.
|
|
905
|
+
*/
|
|
906
|
+
class BlockRemoveNodeStrategy extends ActionHandleStrategy {
|
|
907
|
+
/**
|
|
908
|
+
* Remove the text node from the parent text block or remove the image node from the parent image block.
|
|
909
|
+
* Remove the block if the block nodes is empty after delete the current node.
|
|
910
|
+
*
|
|
911
|
+
* @param {RemoveChildAction} action - The remove child action instance.
|
|
912
|
+
* @param {RTETextBlock | RTEImageBlock} target - The parent block of the node that will be removed.
|
|
913
|
+
*/
|
|
914
|
+
handleAction(action, target) {
|
|
915
|
+
const arrayFixed = target.nodes;
|
|
916
|
+
target.nodes = arrayFixed.filter((node) => node !== action.entityToBeRemoved);
|
|
917
|
+
if (target.nodes.length === 0 && target.parent) {
|
|
918
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Append the nodes to the text block or image block strategy.
|
|
925
|
+
*/
|
|
926
|
+
class BlockAppendNodesStrategy extends ActionHandleStrategy {
|
|
927
|
+
/**
|
|
928
|
+
* Append the text nodes to the text block or the image block.
|
|
929
|
+
*
|
|
930
|
+
* @param {AppendChildNodesAction} action - The remove child action instance.
|
|
931
|
+
* @param {RTETextBlock | RTEImageBlock} target - The parent block of the node that will be removed.
|
|
932
|
+
*/
|
|
933
|
+
handleAction(action, target) {
|
|
934
|
+
const nodesToBeAppended = action.entityToBeAppended;
|
|
935
|
+
nodesToBeAppended.forEach((node) => {
|
|
936
|
+
node.parentBlock = target;
|
|
937
|
+
});
|
|
938
|
+
// This line is used to fix the typescript error `This expression is not callable`. https://github.com/microsoft/TypeScript/issues/44373
|
|
939
|
+
const arrayFixed = target.nodes;
|
|
940
|
+
target.nodes = arrayFixed.concat(nodesToBeAppended);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Remove all nodes and append new nodes strategy.
|
|
946
|
+
*/
|
|
947
|
+
class BlockReplaceNodesStrategy extends ActionHandleStrategy {
|
|
948
|
+
/**
|
|
949
|
+
* Empty the text block or image block nodes and add new nodes.
|
|
950
|
+
*
|
|
951
|
+
* @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
|
|
952
|
+
* @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
|
|
953
|
+
*/
|
|
954
|
+
handleAction(action, target) {
|
|
955
|
+
target.nodes = [];
|
|
956
|
+
target.apply(new AppendChildNodesAction(action.newChildNodes));
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Insert a new block after a existing block
|
|
962
|
+
*
|
|
963
|
+
* @example currentBlock.parent.apply(new InsertBlocksAfterAction(currentBlock, newBlock, ...))
|
|
964
|
+
*/
|
|
965
|
+
class InsertBlocksAfterAction extends ModifyContentAction {
|
|
966
|
+
constructor(referBlock, ...blocksToBeInserted) {
|
|
967
|
+
super();
|
|
968
|
+
this.type = ModifyContentActionType.INSERT_BLOCKS_AFTER;
|
|
969
|
+
this.referBlock = referBlock;
|
|
970
|
+
this.blocksToBeInserted = blocksToBeInserted;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Clear the current block nodes and append new nodes
|
|
976
|
+
*
|
|
977
|
+
* @example block.apply(new ReplaceChildNodesAction(newNodes))
|
|
978
|
+
*/
|
|
979
|
+
class ReplaceChildNodesAction extends ModifyContentAction {
|
|
980
|
+
constructor(newChildNodes) {
|
|
981
|
+
super();
|
|
982
|
+
this.type = ModifyContentActionType.REPLACE_CHILD_NODES;
|
|
983
|
+
this.newChildNodes = newChildNodes;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Split the current image block with a special position strategy.
|
|
989
|
+
*/
|
|
990
|
+
class BlockSplitWithImageNodeStrategy extends ActionHandleStrategy {
|
|
991
|
+
/**
|
|
992
|
+
* @inheritDoc
|
|
993
|
+
*/
|
|
994
|
+
handleAction(action, target) {
|
|
995
|
+
action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode, target);
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* The image offset should be 0 or 1
|
|
999
|
+
* <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
|
|
1000
|
+
*
|
|
1001
|
+
* @param {RTEImageNode} imageNode The split point image node.
|
|
1002
|
+
* @param {number} imageOffset The cursor point 0 | 1.
|
|
1003
|
+
* @param {RTEImageBlock} target The image block.
|
|
1004
|
+
* @returns {Nullable<RTEBlock>} The new block after split
|
|
1005
|
+
*/
|
|
1006
|
+
splitImageNodes(imageNode, imageOffset, target) {
|
|
1007
|
+
const nodesSplitIndex = target.nodes.indexOf(imageNode);
|
|
1008
|
+
if (nodesSplitIndex > -1) {
|
|
1009
|
+
const beforeNodes = target.nodes.slice(0, nodesSplitIndex + imageOffset);
|
|
1010
|
+
const afterNodes = target.nodes.slice(nodesSplitIndex + imageOffset);
|
|
1011
|
+
target.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
1012
|
+
const newBlock = this.cloneWithNodes(afterNodes, target);
|
|
1013
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newBlock));
|
|
1014
|
+
return newBlock;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
|
|
1019
|
+
*
|
|
1020
|
+
* @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
|
|
1021
|
+
* @param {RTEImageBlock} target The image block.
|
|
1022
|
+
* @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
|
|
1023
|
+
*/
|
|
1024
|
+
cloneWithNodes(nodes, target) {
|
|
1025
|
+
const block = target.createNewImageBlock();
|
|
1026
|
+
block.nodes = [];
|
|
1027
|
+
block.apply(new AppendChildNodesAction(nodes));
|
|
1028
|
+
return block;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Insert a new block before a existing block
|
|
1034
|
+
*
|
|
1035
|
+
* @example currentBlock.parent.apply(new InsertBlocksBeforeAction(currentBlock, newBlock, ...))
|
|
1036
|
+
*/
|
|
1037
|
+
class InsertBlocksBeforeAction extends ModifyContentAction {
|
|
1038
|
+
constructor(referBlock, ...blocksToBeInserted) {
|
|
1039
|
+
super();
|
|
1040
|
+
this.type = ModifyContentActionType.INSERT_BLOCKS_BEFORE;
|
|
1041
|
+
this.referBlock = referBlock;
|
|
1042
|
+
this.blocksToBeInserted = blocksToBeInserted;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Split the block with a split point node.
|
|
1048
|
+
* The property `newBlock` use to store the new create block if need.
|
|
1049
|
+
*
|
|
1050
|
+
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
1051
|
+
*/
|
|
1052
|
+
class SplitBlockWithNodeAction extends ModifyContentAction {
|
|
1053
|
+
constructor(splitPointNode, startOffsetOfNode) {
|
|
1054
|
+
super();
|
|
1055
|
+
this.type = ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
|
|
1056
|
+
this.splitPointNode = splitPointNode;
|
|
1057
|
+
this.startOffsetOfNode = startOffsetOfNode;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Abstract class for which can be splittable
|
|
1063
|
+
*/
|
|
1064
|
+
class TextSplittableAction extends AnnotationAction {
|
|
1065
|
+
constructor() {
|
|
1066
|
+
super(...arguments);
|
|
1067
|
+
/**
|
|
1068
|
+
* Whether the action should split the node
|
|
1069
|
+
*/
|
|
1070
|
+
this.doSplit = true;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Annotation to represent a selection range
|
|
1076
|
+
*/
|
|
1077
|
+
class SelectionRangeAnnotation extends Annotation {
|
|
1078
|
+
constructor(range) {
|
|
1079
|
+
super();
|
|
1080
|
+
this.type = InternalAnnotationTypeEnum.SELECTION_RANGE;
|
|
1081
|
+
this.range = range;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Annotation to make text with strikethrough
|
|
1087
|
+
*/
|
|
1088
|
+
class StrikethroughAnnotation extends NodeAnnotation {
|
|
1089
|
+
constructor(underline) {
|
|
1090
|
+
super();
|
|
1091
|
+
this.type = NodeAnnotationTypeEnum.STRIKETHROUGH;
|
|
1092
|
+
this.strikethrough = underline;
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Generate the map item for the annotation
|
|
1096
|
+
*
|
|
1097
|
+
* @param {Nullable<boolean>} strikethrough - Strikethrough annotation
|
|
1098
|
+
* @returns {[NodeAnnotationTypeEnum.STRIKETHROUGH, StrikethroughAnnotation]} Map item for the annotation
|
|
1099
|
+
*/
|
|
1100
|
+
static from(strikethrough) {
|
|
1101
|
+
return [NodeAnnotationTypeEnum.STRIKETHROUGH, new StrikethroughAnnotation(strikethrough)];
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Generate the JSON representation of the annotation
|
|
1105
|
+
*
|
|
1106
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
1107
|
+
*/
|
|
1108
|
+
toJSON() {
|
|
1109
|
+
return {
|
|
1110
|
+
strikethrough: this.strikethrough,
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Generate the class for the annotation
|
|
1115
|
+
*
|
|
1116
|
+
* @returns {Nullable<string>} - Annotation class
|
|
1117
|
+
*/
|
|
1118
|
+
renderClass() {
|
|
1119
|
+
return this.strikethrough ? 'v-rte--strikethrough' : null;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Generate the style for the annotation
|
|
1123
|
+
*
|
|
1124
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
1125
|
+
*/
|
|
1126
|
+
render() {
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Annotation to make text with underline
|
|
1133
|
+
*/
|
|
1134
|
+
class UnderlineAnnotation extends NodeAnnotation {
|
|
1135
|
+
constructor(underline) {
|
|
1136
|
+
super();
|
|
1137
|
+
this.type = NodeAnnotationTypeEnum.UNDERLINE;
|
|
1138
|
+
this.underline = underline;
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Generate the map item for the annotation
|
|
1142
|
+
*
|
|
1143
|
+
* @param {boolean} underline - Underline annotation
|
|
1144
|
+
* @returns {[NodeAnnotationTypeEnum.UNDERLINE, UnderlineAnnotation]} Map item for the annotation
|
|
1145
|
+
*/
|
|
1146
|
+
static from(underline) {
|
|
1147
|
+
return [NodeAnnotationTypeEnum.UNDERLINE, new UnderlineAnnotation(underline)];
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Generate the JSON representation of the annotation
|
|
1151
|
+
*
|
|
1152
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
1153
|
+
*/
|
|
1154
|
+
toJSON() {
|
|
1155
|
+
return {
|
|
1156
|
+
underline: this.underline,
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Generate the class for the annotation
|
|
1161
|
+
*
|
|
1162
|
+
* @returns {Nullable<string>} - Annotation class
|
|
1163
|
+
*/
|
|
1164
|
+
renderClass() {
|
|
1165
|
+
return this.underline ? 'v-rte--underline' : null;
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Generate the style for the annotation
|
|
1169
|
+
*
|
|
1170
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
1171
|
+
*/
|
|
1172
|
+
render() {
|
|
1173
|
+
return null;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Annotation to make text Italic
|
|
1179
|
+
*/
|
|
1180
|
+
class ItalicAnnotation extends NodeAnnotation {
|
|
1181
|
+
constructor(italic) {
|
|
1182
|
+
super();
|
|
1183
|
+
this.type = NodeAnnotationTypeEnum.ITALIC;
|
|
1184
|
+
this.italic = italic;
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Generate the map item for the annotation
|
|
1188
|
+
*
|
|
1189
|
+
* @param {boolean} italic - Italic annotation
|
|
1190
|
+
* @returns {[NodeAnnotationTypeEnum.ITALIC, ItalicAnnotation]} Map item for the annotation
|
|
1191
|
+
*/
|
|
1192
|
+
static from(italic) {
|
|
1193
|
+
return [NodeAnnotationTypeEnum.ITALIC, new ItalicAnnotation(italic)];
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Generate the JSON representation of the annotation
|
|
1197
|
+
*
|
|
1198
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
1199
|
+
*/
|
|
1200
|
+
toJSON() {
|
|
1201
|
+
return {
|
|
1202
|
+
italic: this.italic,
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Generate the style for the annotation
|
|
1207
|
+
*
|
|
1208
|
+
* @returns {Nullable<AnnotationStyle>} Italic style
|
|
1209
|
+
*/
|
|
1210
|
+
render() {
|
|
1211
|
+
return this.italic ? { 'font-style': 'italic' } : null;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Annotation to make text bold
|
|
1217
|
+
*/
|
|
1218
|
+
class BoldAnnotation extends NodeAnnotation {
|
|
1219
|
+
constructor(bold) {
|
|
1220
|
+
super();
|
|
1221
|
+
this.type = NodeAnnotationTypeEnum.BOLD;
|
|
1222
|
+
this.bold = bold;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Generate the map item for the annotation
|
|
1226
|
+
*
|
|
1227
|
+
* @param {boolean} bold - Bold annotation
|
|
1228
|
+
* @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
|
|
1229
|
+
*/
|
|
1230
|
+
static from(bold) {
|
|
1231
|
+
return [NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Generate the JSON representation of the annotation
|
|
1235
|
+
*
|
|
1236
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
1237
|
+
*/
|
|
1238
|
+
toJSON() {
|
|
1239
|
+
return {
|
|
1240
|
+
bold: this.bold,
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Generate the style for the annotation
|
|
1245
|
+
*
|
|
1246
|
+
* @returns {Nullable<AnnotationStyle>} Bold style
|
|
1247
|
+
*/
|
|
1248
|
+
render() {
|
|
1249
|
+
return this.bold ? { 'font-weight': '700' } : null;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Annotation to make text code
|
|
1255
|
+
*/
|
|
1256
|
+
class CodeAnnotation extends NodeAnnotation {
|
|
1257
|
+
constructor(code) {
|
|
1258
|
+
super();
|
|
1259
|
+
this.type = NodeAnnotationTypeEnum.CODE;
|
|
1260
|
+
this.code = code;
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Generate the map item for the annotation
|
|
1264
|
+
*
|
|
1265
|
+
* @param {boolean} code - Bold annotation
|
|
1266
|
+
* @returns {[NodeAnnotationTypeEnum.CODE, CodeAnnotation]} Map item for the annotation
|
|
1267
|
+
*/
|
|
1268
|
+
static from(code) {
|
|
1269
|
+
return [NodeAnnotationTypeEnum.CODE, new CodeAnnotation(code)];
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Generate the JSON representation of the annotation
|
|
1273
|
+
*
|
|
1274
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
1275
|
+
*/
|
|
1276
|
+
toJSON() {
|
|
1277
|
+
return {
|
|
1278
|
+
code: this.code,
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Generate the class for the annotation
|
|
1283
|
+
*
|
|
1284
|
+
* @returns {Nullable<string>} - Annotation class
|
|
1285
|
+
*/
|
|
1286
|
+
renderClass() {
|
|
1287
|
+
return this.code ? 'v-rte--code' : null;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Generate the style for the annotation
|
|
1291
|
+
*
|
|
1292
|
+
* @returns {Nullable<AnnotationStyle>} Bold style
|
|
1293
|
+
*/
|
|
1294
|
+
render() {
|
|
1295
|
+
return null;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
const RTE_TEXT_COLORS = [
|
|
1300
|
+
{
|
|
1301
|
+
key: 'black',
|
|
1302
|
+
light: '#111128',
|
|
1303
|
+
dark: '#E3E3E8',
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
key: 'gray',
|
|
1307
|
+
light: '#5E5E6D',
|
|
1308
|
+
dark: '#B9B9C1',
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
key: 'green',
|
|
1312
|
+
light: '#01801F',
|
|
1313
|
+
dark: '#59D977',
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
key: 'red',
|
|
1317
|
+
light: '#BD2947',
|
|
1318
|
+
dark: '#FFB2B5',
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
key: 'purple',
|
|
1322
|
+
light: '#563D82',
|
|
1323
|
+
dark: '#BEB2FF',
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
key: 'teal',
|
|
1327
|
+
light: '#17758F',
|
|
1328
|
+
dark: '#4CD8FF',
|
|
1329
|
+
},
|
|
1330
|
+
];
|
|
1331
|
+
const ZERO_WIDTH_SPACE = '\u200b';
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Annotation to make text with text color
|
|
1335
|
+
*/
|
|
1336
|
+
class TextColorAnnotation extends NodeAnnotation {
|
|
1337
|
+
constructor(textColor) {
|
|
1338
|
+
super();
|
|
1339
|
+
this.type = NodeAnnotationTypeEnum.TEXT_COLOR;
|
|
1340
|
+
this.textColor = this.formatTextColor(textColor);
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Generate the map item for the annotation
|
|
1344
|
+
*
|
|
1345
|
+
* @param {string} textColor - text color annotation
|
|
1346
|
+
* @returns {[NodeAnnotationTypeEnum.TEXT_COLOR, TextColorAnnotation]} Map item for the annotation
|
|
1347
|
+
*/
|
|
1348
|
+
static from(textColor) {
|
|
1349
|
+
return [NodeAnnotationTypeEnum.TEXT_COLOR, new TextColorAnnotation(textColor)];
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Generate the JSON representation of the annotation
|
|
1353
|
+
*
|
|
1354
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
1355
|
+
*/
|
|
1356
|
+
toJSON() {
|
|
1357
|
+
return {
|
|
1358
|
+
textColor: this.textColor.key,
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Generate the class for the annotation
|
|
1363
|
+
*
|
|
1364
|
+
* @returns {Nullable<string>} - Annotation class
|
|
1365
|
+
*/
|
|
1366
|
+
renderClass() {
|
|
1367
|
+
return null;
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Generate the style for the annotation
|
|
1371
|
+
*
|
|
1372
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
1373
|
+
*/
|
|
1374
|
+
render() {
|
|
1375
|
+
return {
|
|
1376
|
+
color: VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* format text color
|
|
1381
|
+
*
|
|
1382
|
+
* @param {string} textColor - text color
|
|
1383
|
+
* @returns {VegaRTEColorSchema} - VegaRTEColorSchema
|
|
1384
|
+
*/
|
|
1385
|
+
formatTextColor(textColor) {
|
|
1386
|
+
return (RTE_TEXT_COLORS.find((item) => item.key === textColor) || RTE_TEXT_COLORS[0]);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Annotation to make text a link
|
|
1392
|
+
*/
|
|
1393
|
+
class LinkAnnotation extends NodeAnnotation {
|
|
1394
|
+
constructor(link) {
|
|
1395
|
+
super();
|
|
1396
|
+
this.type = NodeAnnotationTypeEnum.LINK;
|
|
1397
|
+
this.link = link;
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Generate the map item for the annotation
|
|
1401
|
+
*
|
|
1402
|
+
* @param {VegaRTELink} link - Bold annotation
|
|
1403
|
+
* @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
|
|
1404
|
+
*/
|
|
1405
|
+
static from(link) {
|
|
1406
|
+
return [
|
|
1407
|
+
NodeAnnotationTypeEnum.LINK,
|
|
1408
|
+
new LinkAnnotation({ href: link.href, groupKey: link.groupKey }),
|
|
1409
|
+
];
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Generate the JSON representation of the annotation
|
|
1413
|
+
*
|
|
1414
|
+
* @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
|
|
1415
|
+
*/
|
|
1416
|
+
toJSON() {
|
|
1417
|
+
return { link: { href: this.link.href, groupKey: this.link.groupKey } };
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Verify whether two link annotation is same or not
|
|
1421
|
+
*
|
|
1422
|
+
* @param {LinkAnnotation} annotation - Compared annotation
|
|
1423
|
+
* @returns {boolean} Whether two link annotation is same or not
|
|
1424
|
+
*/
|
|
1425
|
+
toEqual(annotation) {
|
|
1426
|
+
return this.link.groupKey === annotation.link.groupKey;
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Generate the style for the annotation
|
|
1430
|
+
*
|
|
1431
|
+
* @returns {Nullable<AnnotationStyle>} Link style
|
|
1432
|
+
*/
|
|
1433
|
+
render() {
|
|
1434
|
+
return null;
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
* Annotation to represent a link of grouped nodes
|
|
1440
|
+
*/
|
|
1441
|
+
class LinkGroupAnnotation extends Annotation {
|
|
1442
|
+
constructor(groupKey) {
|
|
1443
|
+
super();
|
|
1444
|
+
this.type = InternalAnnotationTypeEnum.LINK_GROUP;
|
|
1445
|
+
this.linkGroups = new Map();
|
|
1446
|
+
this.linkGroups = new Map([[groupKey, []]]);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
/**
|
|
1451
|
+
* Action to link a group of nodes
|
|
1452
|
+
*/
|
|
1453
|
+
class LinkGroupAnnotationAction extends AnnotationAction {
|
|
1454
|
+
constructor(groupKey, nodes) {
|
|
1455
|
+
super();
|
|
1456
|
+
this.isFlushable = false;
|
|
1457
|
+
this.groupKey = groupKey;
|
|
1458
|
+
this.nodes = nodes;
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Converts the action to an annotation
|
|
1462
|
+
*
|
|
1463
|
+
* @returns {Annotation} The annotation
|
|
1464
|
+
*/
|
|
1465
|
+
toAnnotation() {
|
|
1466
|
+
return new LinkGroupAnnotation(this.groupKey);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
/**
|
|
1471
|
+
* Sync up selection action
|
|
1472
|
+
*/
|
|
1473
|
+
class SyncUpSelectionAction extends AnnotationAction {
|
|
1474
|
+
constructor() {
|
|
1475
|
+
super();
|
|
1476
|
+
this.isFlushable = false;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* annotation null
|
|
1480
|
+
*
|
|
1481
|
+
* @returns {Nullable<Annotation>} null
|
|
1482
|
+
*/
|
|
1483
|
+
toAnnotation() {
|
|
1484
|
+
return null;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
/**
|
|
1489
|
+
* Update the editor text node text content strategy.
|
|
1490
|
+
*/
|
|
1491
|
+
class NodeUpdateTextStrategy extends ActionHandleStrategy {
|
|
1492
|
+
/**
|
|
1493
|
+
* Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
|
|
1494
|
+
*
|
|
1495
|
+
* @param {UpdateTextAction} action - The update text action instance.
|
|
1496
|
+
* @param {RTETextNode} target - The text node instance which need update the text.
|
|
1497
|
+
*/
|
|
1498
|
+
handleAction(action, target) {
|
|
1499
|
+
target.text = action.newTextContent;
|
|
1500
|
+
// The link node should unlink when delete all text
|
|
1501
|
+
if (!target.text && target.annotationMap.has('LINK')) {
|
|
1502
|
+
target.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* Update the text node property text action
|
|
1509
|
+
*
|
|
1510
|
+
* @example textNode.apply(new UpdateTextAction(newText))
|
|
1511
|
+
*/
|
|
1512
|
+
class UpdateTextAction extends ModifyContentAction {
|
|
1513
|
+
constructor(text) {
|
|
1514
|
+
super();
|
|
1515
|
+
this.type = ModifyContentActionType.UPDATE_TEXT;
|
|
1516
|
+
this.newTextContent = '';
|
|
1517
|
+
this.newTextContent = text;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
/**
|
|
1522
|
+
* Replaces the rich text node selected text strategy.
|
|
1523
|
+
*/
|
|
1524
|
+
class NodeReplaceSelectedTextStrategy extends ActionHandleStrategy {
|
|
1525
|
+
/**
|
|
1526
|
+
* @inheritDoc
|
|
1527
|
+
*/
|
|
1528
|
+
handleAction(action, target) {
|
|
1529
|
+
this.replaceSelectedText(action.textToBeInsert, action.currentRange, target);
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Replaces the selected text within a given range with a new text in a TypeScript class.
|
|
1533
|
+
*
|
|
1534
|
+
* @param {string} text - The new text that will replace the currently selected text within the specified range.
|
|
1535
|
+
* @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
|
|
1536
|
+
* @param {RTETextNode} target - The RTE text node instance.
|
|
1537
|
+
*/
|
|
1538
|
+
replaceSelectedText(text, currentRange, target) {
|
|
1539
|
+
if (currentRange && currentRange.startContainer && currentRange.endContainer) {
|
|
1540
|
+
const { startContainer, endContainer, startOffset, endOffset } = currentRange;
|
|
1541
|
+
let newText = target.text;
|
|
1542
|
+
if (startContainer === endContainer && startOffset === endOffset && text) {
|
|
1543
|
+
newText = target.text.slice(0, startOffset) + text + target.text.slice(startOffset);
|
|
1544
|
+
}
|
|
1545
|
+
else {
|
|
1546
|
+
const startNode = startContainer.parentElement;
|
|
1547
|
+
const endNode = endContainer.parentElement;
|
|
1548
|
+
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
1549
|
+
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
1550
|
+
let startIndex = 0, endIndex = target.text.length;
|
|
1551
|
+
if (startItemDto && startItemDto === target) {
|
|
1552
|
+
startIndex = startOffset;
|
|
1553
|
+
endIndex = startContainer === endContainer ? endOffset : endIndex;
|
|
1554
|
+
}
|
|
1555
|
+
else if (endItemDto && endItemDto === target) {
|
|
1556
|
+
endIndex = endOffset;
|
|
1557
|
+
}
|
|
1558
|
+
newText = target.text.slice(0, startIndex) + text + target.text.slice(endIndex);
|
|
1559
|
+
}
|
|
1560
|
+
target.apply(new UpdateTextAction(newText));
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
/**
|
|
1566
|
+
* Split the text node into two or there nodes according to the rules.
|
|
1567
|
+
*/
|
|
1568
|
+
class NodeSplitTextStrategy extends ActionHandleStrategy {
|
|
1569
|
+
constructor() {
|
|
1570
|
+
super(...arguments);
|
|
1571
|
+
// The new create node that need apply annotation or the current target. This property used to export after the execute method invoke.
|
|
1572
|
+
this.applyTargetNode = null;
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Split the text node.
|
|
1576
|
+
*
|
|
1577
|
+
* @param {TextSplittableAction} action - The split action.
|
|
1578
|
+
* @param {RTETextNode} target - The text node that need to be splited.
|
|
1579
|
+
* @returns {Nullable<RTETextNode>} - The new insert text node or the current text node that need to apply the action.
|
|
1580
|
+
*/
|
|
1581
|
+
handleAction(action, target) {
|
|
1582
|
+
const selectionRangeAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
1583
|
+
this.setApplyTargetNode(null);
|
|
1584
|
+
if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
|
|
1585
|
+
const { startContainer, endContainer, startOffset, endOffset } = selectionRangeAnnotation.range;
|
|
1586
|
+
const noTextRangeSelected = startContainer === endContainer && startOffset === endOffset;
|
|
1587
|
+
target.parentBlock.nodes = target.parentBlock.nodes.flatMap((item) => {
|
|
1588
|
+
if (item.id === target.id) {
|
|
1589
|
+
if (noTextRangeSelected) {
|
|
1590
|
+
return this.insertNewNode(startOffset, target);
|
|
1591
|
+
}
|
|
1592
|
+
if (this.shouldSplitSelection(selectionRangeAnnotation.range)) {
|
|
1593
|
+
return this.splitTextNode(selectionRangeAnnotation.range, target);
|
|
1594
|
+
}
|
|
1595
|
+
else {
|
|
1596
|
+
this.setApplyTargetNode(target);
|
|
1597
|
+
return target;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
return item;
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
return this.applyTargetNode;
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Insert the new node at the start offset
|
|
1607
|
+
*
|
|
1608
|
+
* @param {number} startOffset - The start position offset
|
|
1609
|
+
* @param {RTETextNode} target - RTETextNode
|
|
1610
|
+
* @returns {RTETextNode[]} - RTETextNode array
|
|
1611
|
+
*/
|
|
1612
|
+
insertNewNode(startOffset, target) {
|
|
1613
|
+
const newNode = target.cloneWithText('');
|
|
1614
|
+
this.setApplyTargetNode(newNode);
|
|
1615
|
+
if (startOffset === 0) {
|
|
1616
|
+
return [newNode, target];
|
|
1617
|
+
}
|
|
1618
|
+
if (startOffset === target.text.length) {
|
|
1619
|
+
return [target, newNode];
|
|
1620
|
+
}
|
|
1621
|
+
const beforeNode = target.cloneWithText(target.text.substring(0, startOffset));
|
|
1622
|
+
const afterNode = target.cloneWithText(target.text.substring(startOffset));
|
|
1623
|
+
return [beforeNode, newNode, afterNode];
|
|
1624
|
+
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Whether a given range should be split based on various conditions within the range.
|
|
1627
|
+
*
|
|
1628
|
+
* @param {Range} range - Selection range
|
|
1629
|
+
* @returns {boolean} Returns a boolean value indicating whether the selection range should be split.
|
|
1630
|
+
*/
|
|
1631
|
+
shouldSplitSelection(range) {
|
|
1632
|
+
const { startContainer, endContainer, startOffset, endOffset } = range;
|
|
1633
|
+
const isCrossNode = startContainer !== endContainer;
|
|
1634
|
+
const isPartialStart = startOffset > 0;
|
|
1635
|
+
const isPartialEnd = endOffset < (endContainer.textContent ? endContainer.textContent.length : 0);
|
|
1636
|
+
const isPartialSelection = isPartialStart || isPartialEnd;
|
|
1637
|
+
return isCrossNode || isPartialSelection;
|
|
1638
|
+
}
|
|
1639
|
+
/**
|
|
1640
|
+
* Split text node with range
|
|
1641
|
+
*
|
|
1642
|
+
* @param {Range} range - Selection range
|
|
1643
|
+
* @param {RTETextNode} target - RTETextNode
|
|
1644
|
+
* @returns {RTETextNode[] | RTETextNode} RTETextNode array
|
|
1645
|
+
*/
|
|
1646
|
+
splitTextNode(range, target) {
|
|
1647
|
+
const { startContainer, endContainer, startOffset } = range;
|
|
1648
|
+
const startNode = startContainer.parentElement;
|
|
1649
|
+
const endNode = endContainer.parentElement;
|
|
1650
|
+
/**
|
|
1651
|
+
* Split the text from the start offset to the end offset
|
|
1652
|
+
*
|
|
1653
|
+
* @param {string} text - The text string
|
|
1654
|
+
* @param {number} startOffset - The start offset position
|
|
1655
|
+
* @param {number} endOffset - The end offset position
|
|
1656
|
+
* @returns {RTETextNode[]} - The split text node array
|
|
1657
|
+
*/
|
|
1658
|
+
const splitText = (text, startOffset, endOffset) => {
|
|
1659
|
+
const beforeText = text.substring(0, startOffset);
|
|
1660
|
+
const selectedText = text.substring(startOffset, endOffset);
|
|
1661
|
+
const afterText = text.substring(endOffset);
|
|
1662
|
+
return [
|
|
1663
|
+
target.cloneWithText(beforeText),
|
|
1664
|
+
target.cloneWithText(selectedText),
|
|
1665
|
+
target.cloneWithText(afterText),
|
|
1666
|
+
];
|
|
1667
|
+
};
|
|
1668
|
+
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
1669
|
+
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
1670
|
+
if (startItemDto && startItemDto.id === target.id) {
|
|
1671
|
+
const endOffset = startContainer === endContainer ? range.endOffset : target.text.length;
|
|
1672
|
+
const [beforeNode, selectedNode, afterNode] = splitText(target.text, startOffset, endOffset);
|
|
1673
|
+
this.setApplyTargetNode(selectedNode);
|
|
1674
|
+
return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
|
|
1675
|
+
}
|
|
1676
|
+
else if (endItemDto && endItemDto.id === target.id) {
|
|
1677
|
+
const [beforeNode, selectedNode, afterNode] = splitText(target.text, 0, range.endOffset);
|
|
1678
|
+
this.setApplyTargetNode(selectedNode);
|
|
1679
|
+
return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
|
|
1680
|
+
}
|
|
1681
|
+
else {
|
|
1682
|
+
this.setApplyTargetNode(target);
|
|
1683
|
+
return target;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Store the text node which need to apply the annotation. Clear the value if the input is null.
|
|
1688
|
+
*
|
|
1689
|
+
* @param {RTETextNode | null} node - The new text node.
|
|
1690
|
+
*/
|
|
1691
|
+
setApplyTargetNode(node) {
|
|
1692
|
+
this.applyTargetNode = node;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* Annotation to host which annotations will be clear formatting
|
|
1698
|
+
*/
|
|
1699
|
+
class ClearFormattingAnnotation extends Annotation {
|
|
1700
|
+
constructor() {
|
|
1701
|
+
super(...arguments);
|
|
1702
|
+
this.type = InternalAnnotationTypeEnum.CLEAR_FORMATTING;
|
|
1703
|
+
this.items = [
|
|
1704
|
+
NodeAnnotationTypeEnum.BOLD,
|
|
1705
|
+
NodeAnnotationTypeEnum.ITALIC,
|
|
1706
|
+
NodeAnnotationTypeEnum.UNDERLINE,
|
|
1707
|
+
NodeAnnotationTypeEnum.STRIKETHROUGH,
|
|
1708
|
+
NodeAnnotationTypeEnum.TEXT_COLOR,
|
|
1709
|
+
NodeAnnotationTypeEnum.CODE,
|
|
1710
|
+
];
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* Action to toggle clear formatting
|
|
1716
|
+
*/
|
|
1717
|
+
class ClearFormattingAnnotationAction extends TextSplittableAction {
|
|
1718
|
+
constructor() {
|
|
1719
|
+
super(...arguments);
|
|
1720
|
+
this.isFlushable = true;
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Converts the action to an annotation
|
|
1724
|
+
*
|
|
1725
|
+
* @returns {Annotation} the annotation
|
|
1726
|
+
*/
|
|
1727
|
+
toAnnotation() {
|
|
1728
|
+
return new ClearFormattingAnnotation();
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
/**
|
|
1733
|
+
* Action to toggle code annotation
|
|
1734
|
+
*/
|
|
1735
|
+
class CodeAnnotationAction extends TextSplittableAction {
|
|
1736
|
+
constructor(code) {
|
|
1737
|
+
super();
|
|
1738
|
+
this.isFlushable = true;
|
|
1739
|
+
this.code = code;
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Converts the action to an annotation
|
|
1743
|
+
*
|
|
1744
|
+
* @returns {CodeAnnotation} the annotation
|
|
1745
|
+
*/
|
|
1746
|
+
toAnnotation() {
|
|
1747
|
+
return new CodeAnnotation(this.code);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
/**
|
|
1752
|
+
* Delete the node annotation by type
|
|
1753
|
+
*/
|
|
1754
|
+
class DeleteNodeAnnotationAction extends AnnotationAction {
|
|
1755
|
+
constructor(annotationType) {
|
|
1756
|
+
super();
|
|
1757
|
+
this.isFlushable = true;
|
|
1758
|
+
this.annotationType = annotationType;
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Don't need this for this action
|
|
1762
|
+
*
|
|
1763
|
+
* @returns {Nullable<Annotation>} undefined
|
|
1764
|
+
*/
|
|
1765
|
+
toAnnotation() {
|
|
1766
|
+
return undefined;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* Action to toggle link annotation
|
|
1772
|
+
*/
|
|
1773
|
+
class LinkAnnotationAction extends TextSplittableAction {
|
|
1774
|
+
constructor({ link, newText, needMergeNode, doSplit, }) {
|
|
1775
|
+
super();
|
|
1776
|
+
this.isFlushable = true;
|
|
1777
|
+
this.link = link;
|
|
1778
|
+
this.needMergeNode = needMergeNode;
|
|
1779
|
+
this.newText = newText;
|
|
1780
|
+
if (isNonNullable(doSplit)) {
|
|
1781
|
+
this.doSplit = doSplit;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Converts the action to an annotation
|
|
1786
|
+
*
|
|
1787
|
+
* @returns {LinkAnnotation} the annotation
|
|
1788
|
+
*/
|
|
1789
|
+
toAnnotation() {
|
|
1790
|
+
return new LinkAnnotation(this.link);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
/**
|
|
1795
|
+
* The current strategy used to modify the text node annotation map.
|
|
1796
|
+
*/
|
|
1797
|
+
class NodeUpdateAnnotationMapStrategy extends ActionHandleStrategy {
|
|
1798
|
+
/**
|
|
1799
|
+
* Remove or set annotation to the text node annotation map.
|
|
1800
|
+
*
|
|
1801
|
+
* @param {AnnotationAction} action - The annotation action instance.
|
|
1802
|
+
* @param {RTETextNode} target - The current text node.
|
|
1803
|
+
*/
|
|
1804
|
+
handleAction(action, target) {
|
|
1805
|
+
const annotation = action.toAnnotation();
|
|
1806
|
+
if (action instanceof DeleteNodeAnnotationAction) {
|
|
1807
|
+
target.annotationMap.delete(action.annotationType);
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
if (annotation instanceof ClearFormattingAnnotation) {
|
|
1811
|
+
annotation.items.forEach((item) => {
|
|
1812
|
+
target.deleteAnnotationByType(item);
|
|
1813
|
+
});
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
if (annotation instanceof NodeAnnotation || annotation instanceof SelectionRangeAnnotation) {
|
|
1817
|
+
if (action instanceof LinkAnnotationAction) {
|
|
1818
|
+
if (isNonNullable(action.newText)) {
|
|
1819
|
+
target.text = action.newText;
|
|
1820
|
+
}
|
|
1821
|
+
target.parentBlock.apply(new LinkGroupAnnotationAction(action.link.groupKey, [target]));
|
|
1822
|
+
}
|
|
1823
|
+
if (action instanceof CodeAnnotationAction) {
|
|
1824
|
+
this.handleAction(new ClearFormattingAnnotationAction(), target);
|
|
1825
|
+
}
|
|
1826
|
+
target.annotationMap.set(annotation.type, annotation);
|
|
1827
|
+
return;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* Text node
|
|
1834
|
+
*/
|
|
1835
|
+
class RTETextNode extends RTENode {
|
|
1836
|
+
constructor(id, text, parentBlock, annotationMap) {
|
|
1837
|
+
super(id, annotationMap);
|
|
1838
|
+
this.type = NodeTypeEnum.TEXT;
|
|
1839
|
+
this.parentBlock = parentBlock;
|
|
1840
|
+
this.text = text;
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Creates an RTETextNode from a VegaRTETextNode with annotations and a parent RTETextBlock.
|
|
1844
|
+
*
|
|
1845
|
+
* @param {VegaRTETextNode} richText - A rich text node
|
|
1846
|
+
* @param {RTETextBlock} parentBlock - Parent block
|
|
1847
|
+
* @returns {RTETextNode} an RTETextNode
|
|
1848
|
+
*/
|
|
1849
|
+
static from(richText, parentBlock) {
|
|
1850
|
+
const textNode = new RTETextNode(richText.id, richText.text, parentBlock);
|
|
1851
|
+
const { annotations } = richText;
|
|
1852
|
+
if (annotations) {
|
|
1853
|
+
textNode.annotationMap = new Map(Object.keys(annotations)
|
|
1854
|
+
.map((type) => {
|
|
1855
|
+
if (annotations.link) {
|
|
1856
|
+
parentBlock.apply(new LinkGroupAnnotationAction(annotations.link.groupKey, [textNode]));
|
|
1857
|
+
}
|
|
1858
|
+
return this.createAnnotationEntity(type, annotations[type]);
|
|
1859
|
+
})
|
|
1860
|
+
.filter(isNonNullable));
|
|
1861
|
+
}
|
|
1862
|
+
return textNode;
|
|
1863
|
+
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Creates different types of text annotations based on the provided type and value.
|
|
1866
|
+
*
|
|
1867
|
+
* @param {keyof VegaRTETextAnnotations} type - The key of the type.
|
|
1868
|
+
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
1869
|
+
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
1870
|
+
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
1871
|
+
*/
|
|
1872
|
+
static createAnnotationEntity(type, value) {
|
|
1873
|
+
switch (type) {
|
|
1874
|
+
case 'bold':
|
|
1875
|
+
return BoldAnnotation.from(value);
|
|
1876
|
+
case 'italic':
|
|
1877
|
+
return ItalicAnnotation.from(value);
|
|
1878
|
+
case 'underline':
|
|
1879
|
+
return UnderlineAnnotation.from(value);
|
|
1880
|
+
case 'strikethrough':
|
|
1881
|
+
return StrikethroughAnnotation.from(value);
|
|
1882
|
+
case 'code':
|
|
1883
|
+
return CodeAnnotation.from(value);
|
|
1884
|
+
case 'textColor':
|
|
1885
|
+
return TextColorAnnotation.from(value);
|
|
1886
|
+
case 'link':
|
|
1887
|
+
return LinkAnnotation.from(value);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* @inheritDoc
|
|
1892
|
+
*/
|
|
1893
|
+
toJSON() {
|
|
1894
|
+
const annotations = Array.from(this.annotationMap.values())
|
|
1895
|
+
.filter((annotation) => annotation instanceof NodeAnnotation)
|
|
1896
|
+
.reduce((record, annotation) => {
|
|
1897
|
+
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
1898
|
+
}, {});
|
|
1899
|
+
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'text', text: this.text });
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Creates a new RTETextNode with the specified text and copies the parent block and annotation map from the original node.
|
|
1903
|
+
*
|
|
1904
|
+
* @param {string} text - The text content of the RTETextNode that will be created.
|
|
1905
|
+
* @returns {RTETextNode} An new RTETextNode
|
|
1906
|
+
*/
|
|
1907
|
+
cloneWithText(text) {
|
|
1908
|
+
return new RTETextNode(generateUUID(), text, this.parentBlock, new Map(this.annotationMap));
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Checks if a node is empty
|
|
1912
|
+
*
|
|
1913
|
+
* @returns {boolean} It returns `true` if the node is empty
|
|
1914
|
+
*/
|
|
1915
|
+
isEmpty() {
|
|
1916
|
+
return !this.text || this.text === ZERO_WIDTH_SPACE || this.text === '\n';
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* @inheritDoc
|
|
1920
|
+
*/
|
|
1921
|
+
doAnnotationActionApply(action) {
|
|
1922
|
+
const selectionRangeAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
1923
|
+
if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
|
|
1924
|
+
const splitStrategy = ActionHandleStrategyRegistry.get(TextSplittableAction.name, RTETextNode.name);
|
|
1925
|
+
if (splitStrategy) {
|
|
1926
|
+
const newNode = splitStrategy.execute(action, this);
|
|
1927
|
+
if (newNode) {
|
|
1928
|
+
this.applyActionToNode(newNode, action);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
else {
|
|
1933
|
+
this.applyActionToNode(this, action);
|
|
1934
|
+
}
|
|
1935
|
+
this.parentBlock.mergeNodes(action);
|
|
1936
|
+
}
|
|
1937
|
+
/**
|
|
1938
|
+
* @inheritDoc
|
|
1939
|
+
*/
|
|
1940
|
+
doModifyActionApply(action) {
|
|
1941
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Apply action to node
|
|
1945
|
+
*
|
|
1946
|
+
* @param {RTETextNode} node - Text node
|
|
1947
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
1948
|
+
*/
|
|
1949
|
+
applyActionToNode(node, action) {
|
|
1950
|
+
const annotation = action.toAnnotation();
|
|
1951
|
+
if (action instanceof SyncUpSelectionAction) {
|
|
1952
|
+
this.syncUpSelectedNodes(node);
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
// Sync up RTETextNode selected state to selection controller for any action apply, except selection range change.
|
|
1956
|
+
if (!(annotation instanceof SelectionRangeAnnotation)) {
|
|
1957
|
+
this.syncUpSelectedNodes(node);
|
|
1958
|
+
}
|
|
1959
|
+
const updateAnnotationMapStrategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTETextNode.name);
|
|
1960
|
+
if (updateAnnotationMapStrategy) {
|
|
1961
|
+
updateAnnotationMapStrategy.execute(action, node);
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
/**
|
|
1966
|
+
* Sync up the selected node by change manager
|
|
1967
|
+
*
|
|
1968
|
+
* @param {RTETextNode} selectedNode - The selected node
|
|
1969
|
+
*/
|
|
1970
|
+
syncUpSelectedNodes(selectedNode) {
|
|
1971
|
+
const currentNodeDom = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1972
|
+
if (currentNodeDom) {
|
|
1973
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, VegaInternalRichTextEditorSelectionRangeChange);
|
|
1974
|
+
if (nodeSubject) {
|
|
1975
|
+
ChangeManager.notify(nodeSubject, { node: selectedNode });
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
(() => {
|
|
1981
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_TEXT, RTETextNode.name, new NodeUpdateTextStrategy());
|
|
1982
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_SELECTED_TEXT, RTETextNode.name, new NodeReplaceSelectedTextStrategy());
|
|
1983
|
+
ActionHandleStrategyRegistry.register(TextSplittableAction.name, RTETextNode.name, new NodeSplitTextStrategy());
|
|
1984
|
+
ActionHandleStrategyRegistry.register(AnnotationAction.name, RTETextNode.name, new NodeUpdateAnnotationMapStrategy());
|
|
1985
|
+
})();
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Text style annotation
|
|
1989
|
+
*/
|
|
1990
|
+
class TextStyleAnnotation extends BlockAnnotation {
|
|
1991
|
+
constructor(textStyle) {
|
|
1992
|
+
super();
|
|
1993
|
+
this.type = BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
1994
|
+
this.textStyle = textStyle;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Generate the map item for the annotations
|
|
1998
|
+
*
|
|
1999
|
+
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
2000
|
+
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
2001
|
+
*/
|
|
2002
|
+
static from(textStyle) {
|
|
2003
|
+
return [BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Generate the JSON representation of the annotation
|
|
2007
|
+
*
|
|
2008
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
2009
|
+
*/
|
|
2010
|
+
toJSON() {
|
|
2011
|
+
return { textStyle: this.textStyle };
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Render the styles by block type
|
|
2015
|
+
*
|
|
2016
|
+
* @returns {AnnotationStyle} the styles to apply
|
|
2017
|
+
*/
|
|
2018
|
+
render() {
|
|
2019
|
+
const paragraphStyle = {
|
|
2020
|
+
fontFamily: 'Inter',
|
|
2021
|
+
fontSize: '16px',
|
|
2022
|
+
lineHeight: '22px',
|
|
2023
|
+
fontWeight: '500',
|
|
2024
|
+
};
|
|
2025
|
+
switch (this.textStyle) {
|
|
2026
|
+
case 'paragraph': {
|
|
2027
|
+
return paragraphStyle;
|
|
2028
|
+
}
|
|
2029
|
+
case 'title': {
|
|
2030
|
+
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
2031
|
+
}
|
|
2032
|
+
case 'subtitle': {
|
|
2033
|
+
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
2034
|
+
}
|
|
2035
|
+
case 'heading-1': {
|
|
2036
|
+
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
2037
|
+
}
|
|
2038
|
+
case 'heading-2': {
|
|
2039
|
+
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
2040
|
+
}
|
|
2041
|
+
case 'heading-3': {
|
|
2042
|
+
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* Action to change the text style of a block
|
|
2050
|
+
*/
|
|
2051
|
+
class TextStyleAnnotationAction extends AnnotationAction {
|
|
2052
|
+
constructor(textStyle, bold) {
|
|
2053
|
+
super();
|
|
2054
|
+
this.isFlushable = true;
|
|
2055
|
+
this.textStyle = textStyle;
|
|
2056
|
+
this.bold = bold;
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Converts the action to a block annotation
|
|
2060
|
+
*
|
|
2061
|
+
* @returns {BlockAnnotation} the block annotation
|
|
2062
|
+
*/
|
|
2063
|
+
toAnnotation() {
|
|
2064
|
+
return new TextStyleAnnotation(this.textStyle);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* Action to toggle bold annotation
|
|
2070
|
+
*/
|
|
2071
|
+
class BoldAnnotationAction extends TextSplittableAction {
|
|
2072
|
+
constructor(bold) {
|
|
2073
|
+
super();
|
|
2074
|
+
this.isFlushable = true;
|
|
2075
|
+
this.bold = bold;
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Converts the action to an annotation
|
|
2079
|
+
*
|
|
2080
|
+
* @returns {BoldAnnotation} the annotation
|
|
2081
|
+
*/
|
|
2082
|
+
toAnnotation() {
|
|
2083
|
+
return new BoldAnnotation(this.bold);
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* Update the text block text style strategy.
|
|
2089
|
+
*/
|
|
2090
|
+
class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
|
|
2091
|
+
/**
|
|
2092
|
+
* Update the text block type and add or remove the bold style from child nodes.
|
|
2093
|
+
*
|
|
2094
|
+
* @param {TextStyleAnnotationAction} action - The text style annotation action.
|
|
2095
|
+
* @param {RTETextBlock} target - The current text block.
|
|
2096
|
+
*/
|
|
2097
|
+
handleAction(action, target) {
|
|
2098
|
+
if (target.type !== 'list-item') {
|
|
2099
|
+
target.type = action.textStyle;
|
|
2100
|
+
}
|
|
2101
|
+
if (action.bold) {
|
|
2102
|
+
target.nodes.forEach((node) => {
|
|
2103
|
+
const boldAnnotationAction = new BoldAnnotationAction(true);
|
|
2104
|
+
boldAnnotationAction.doSplit = false;
|
|
2105
|
+
node.apply(boldAnnotationAction);
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
else {
|
|
2109
|
+
target.nodes.forEach((node) => {
|
|
2110
|
+
node.apply(new DeleteNodeAnnotationAction(NodeAnnotationTypeEnum.BOLD));
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
/**
|
|
2117
|
+
* Update the text block link group annotation strategy.
|
|
2118
|
+
*/
|
|
2119
|
+
class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
|
|
2120
|
+
/**
|
|
2121
|
+
* Update link group after the child link node update.
|
|
2122
|
+
*
|
|
2123
|
+
* @param {LinkGroupAnnotationAction} action - The link group annotation action instance.
|
|
2124
|
+
* @param {RTETextBlock} target - The current text block.
|
|
2125
|
+
*/
|
|
2126
|
+
handleAction(action, target) {
|
|
2127
|
+
const linkGroupAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2128
|
+
if (linkGroupAnnotation) {
|
|
2129
|
+
const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
|
|
2130
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
|
|
2131
|
+
target.annotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
/**
|
|
2137
|
+
* Split the current node with a special position strategy.
|
|
2138
|
+
*/
|
|
2139
|
+
class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
|
|
2140
|
+
/**
|
|
2141
|
+
* @inheritDoc
|
|
2142
|
+
*/
|
|
2143
|
+
handleAction(action, target) {
|
|
2144
|
+
action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode, target);
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Splits a text node at a specified offset within a block of nodes and returns a new block with the split nodes.
|
|
2148
|
+
*
|
|
2149
|
+
* @param {RTETextNode} splitNode - The text node that will be split
|
|
2150
|
+
* @param {number} startOffsetOfNode - The index at which will split the text content of the `splitNode`.
|
|
2151
|
+
* @param {RTETextBlock} textBlock - The text block need to be splited.
|
|
2152
|
+
* @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
|
|
2153
|
+
*/
|
|
2154
|
+
splitTextNodeBlock(splitNode, startOffsetOfNode, textBlock) {
|
|
2155
|
+
if (splitNode) {
|
|
2156
|
+
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
2157
|
+
const afterText = splitNode.text.slice(startOffsetOfNode);
|
|
2158
|
+
const nodesSplitIndex = textBlock.nodes.indexOf(splitNode);
|
|
2159
|
+
if (nodesSplitIndex > -1) {
|
|
2160
|
+
const beforeNodes = textBlock.nodes.slice(0, nodesSplitIndex);
|
|
2161
|
+
const afterNodes = textBlock.nodes.slice(nodesSplitIndex + 1);
|
|
2162
|
+
if (beforeText) {
|
|
2163
|
+
beforeNodes.push(splitNode.cloneWithText(beforeText));
|
|
2164
|
+
}
|
|
2165
|
+
if (afterText) {
|
|
2166
|
+
afterNodes.unshift(splitNode.cloneWithText(afterText));
|
|
2167
|
+
}
|
|
2168
|
+
textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
2169
|
+
const newBlock = textBlock.cloneWithNodes(afterNodes);
|
|
2170
|
+
textBlock.parent.apply(new InsertBlocksAfterAction(textBlock, newBlock));
|
|
2171
|
+
return newBlock;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
/**
|
|
2178
|
+
* Insert new paragraph into current text block at special position.
|
|
2179
|
+
*/
|
|
2180
|
+
class BlockInsertNewParagraphStrategy extends ActionHandleStrategy {
|
|
2181
|
+
/**
|
|
2182
|
+
* @inheritDoc
|
|
2183
|
+
*/
|
|
2184
|
+
handleAction(action, target) {
|
|
2185
|
+
action.newBlock = this.breakSingleTextBlock(action.startContainerNode, action.startOffset, target);
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* breakSingleTextBlock
|
|
2189
|
+
*
|
|
2190
|
+
* @param {RTETextNode} splitNode -
|
|
2191
|
+
* @param {number} startOffsetOfNode -
|
|
2192
|
+
* @param {RTETextBlock} target -
|
|
2193
|
+
* @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
|
|
2194
|
+
*/
|
|
2195
|
+
breakSingleTextBlock(splitNode, startOffsetOfNode, target) {
|
|
2196
|
+
const newParagraph = this.copyInlineStyleToNewParagraph(splitNode, target);
|
|
2197
|
+
if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
2198
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
|
|
2199
|
+
}
|
|
2200
|
+
else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
2201
|
+
target.parent.apply(new InsertBlocksBeforeAction(target, newParagraph));
|
|
2202
|
+
}
|
|
2203
|
+
else {
|
|
2204
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
2205
|
+
target.apply(splitBlockAction);
|
|
2206
|
+
return splitBlockAction.newBlock;
|
|
2207
|
+
}
|
|
2208
|
+
return newParagraph;
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* copyInlineStyleToNewParagraph
|
|
2212
|
+
*
|
|
2213
|
+
* @param {RTETextNode} needCopedNode - The text node.
|
|
2214
|
+
* @param {RTETextBlock} target - The text block.
|
|
2215
|
+
* @returns {RTETextBlock} - The new paragraph.
|
|
2216
|
+
*/
|
|
2217
|
+
copyInlineStyleToNewParagraph(needCopedNode, target) {
|
|
2218
|
+
const textNode = needCopedNode.cloneWithText('');
|
|
2219
|
+
// The link annotation don't need inherited
|
|
2220
|
+
textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
2221
|
+
const newParagraph = target.createNewParagraph();
|
|
2222
|
+
newParagraph.apply(new AppendChildNodesAction([textNode]));
|
|
2223
|
+
return newParagraph;
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* Insert a line break node into current text block at special position strategy.
|
|
2229
|
+
*/
|
|
2230
|
+
class BlockInsertLineBreakStrategy extends ActionHandleStrategy {
|
|
2231
|
+
/**
|
|
2232
|
+
* @inheritDoc
|
|
2233
|
+
*/
|
|
2234
|
+
handleAction(action, target) {
|
|
2235
|
+
action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset, target);
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* lineBreakSingleBlock
|
|
2239
|
+
*
|
|
2240
|
+
* @param {RTETextNode} splitNode -
|
|
2241
|
+
* @param {number} startOffsetOfNode -
|
|
2242
|
+
* @param {RTETextBlock} target -
|
|
2243
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
2244
|
+
*/
|
|
2245
|
+
lineBreakSingleBlock(splitNode, startOffsetOfNode, target) {
|
|
2246
|
+
if (splitNode) {
|
|
2247
|
+
const lineBreakNode = new RTETextNode(generateUUID(), '\n', target);
|
|
2248
|
+
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
2249
|
+
const afterText = splitNode.text.slice(startOffsetOfNode);
|
|
2250
|
+
const nodesSplitIndex = target.nodes.indexOf(splitNode);
|
|
2251
|
+
if (nodesSplitIndex > -1) {
|
|
2252
|
+
const beforeNodes = target.nodes.slice(0, nodesSplitIndex);
|
|
2253
|
+
const afterNodes = target.nodes.slice(nodesSplitIndex + 1);
|
|
2254
|
+
if (beforeText) {
|
|
2255
|
+
beforeNodes.push(splitNode.cloneWithText(beforeText));
|
|
2256
|
+
}
|
|
2257
|
+
if (afterText) {
|
|
2258
|
+
afterNodes.unshift(splitNode.cloneWithText(afterText));
|
|
2259
|
+
}
|
|
2260
|
+
this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes, target);
|
|
2261
|
+
}
|
|
2262
|
+
return lineBreakNode;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* mergeLineBreakNodes
|
|
2267
|
+
*
|
|
2268
|
+
* @param {RTENode[]} beforeNodes -
|
|
2269
|
+
* @param {RTETextNode} lineBreakNode -
|
|
2270
|
+
* @param {RTENode[]} afterNodes -
|
|
2271
|
+
* @param {RTETextBlock} target -
|
|
2272
|
+
*/
|
|
2273
|
+
mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes, target) {
|
|
2274
|
+
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
2275
|
+
afterNodes.push(new RTETextNode(generateUUID(), '\n', target, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
|
|
2276
|
+
}
|
|
2277
|
+
target.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Insert a line break node into multiple blocks selection at special position strategy.
|
|
2283
|
+
*/
|
|
2284
|
+
class BlockInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
|
|
2285
|
+
/**
|
|
2286
|
+
* @inheritDoc
|
|
2287
|
+
*/
|
|
2288
|
+
handleAction(action, target) {
|
|
2289
|
+
action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* lineBreakMultipleBlocks
|
|
2293
|
+
*
|
|
2294
|
+
* @param {RTEBlock[]} selectedBlocks -
|
|
2295
|
+
* @param {RTETextBlock} target -
|
|
2296
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
2297
|
+
*/
|
|
2298
|
+
lineBreakMultipleBlocks(selectedBlocks, target) {
|
|
2299
|
+
const beforeNodes = target.nodes;
|
|
2300
|
+
const lineBreakNode = new RTETextNode(generateUUID(), '\n', target);
|
|
2301
|
+
const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
|
|
2302
|
+
this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes, target);
|
|
2303
|
+
return lineBreakNode;
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Concat the child nodes of multiple RTEBlocks if both are not images.
|
|
2307
|
+
*
|
|
2308
|
+
* @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
2309
|
+
* @returns {RTENode[]} Array of connected block nodes
|
|
2310
|
+
*/
|
|
2311
|
+
concatBlocksNodes(blocks) {
|
|
2312
|
+
const nodes = [];
|
|
2313
|
+
blocks.map((block) => {
|
|
2314
|
+
if (block.type !== 'image') {
|
|
2315
|
+
nodes.push(...block['nodes']);
|
|
2316
|
+
block.parent.apply(new RemoveChildAction(block));
|
|
2317
|
+
}
|
|
2318
|
+
});
|
|
2319
|
+
return nodes;
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* mergeLineBreakNodes
|
|
2323
|
+
*
|
|
2324
|
+
* @param {RTENode[]} beforeNodes -
|
|
2325
|
+
* @param {RTETextNode} lineBreakNode -
|
|
2326
|
+
* @param {RTENode[]} afterNodes -
|
|
2327
|
+
* @param {RTETextBlock} target -
|
|
2328
|
+
*/
|
|
2329
|
+
mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes, target) {
|
|
2330
|
+
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
2331
|
+
afterNodes.push(new RTETextNode(generateUUID(), '\n', target, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
|
|
2332
|
+
}
|
|
2333
|
+
target.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
/**
|
|
2338
|
+
* Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
|
|
2339
|
+
*
|
|
2340
|
+
* @example firstBlock.apply(new MergeTwoBlocksNodesAction(secondBlock))
|
|
2341
|
+
*/
|
|
2342
|
+
class MergeTwoBlocksNodesAction extends ModifyContentAction {
|
|
2343
|
+
constructor(blockNeedToBeMerged) {
|
|
2344
|
+
super();
|
|
2345
|
+
this.type = ModifyContentActionType.MERGE_TWO_BLOCKS_NODES;
|
|
2346
|
+
this.blockNeedToBeMerged = blockNeedToBeMerged;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
/**
|
|
2351
|
+
* The text block delete text content strategy.
|
|
2352
|
+
*/
|
|
2353
|
+
class BlockDeleteTextContentStrategy extends BlockDeleteNodeContentStrategy {
|
|
2354
|
+
/**
|
|
2355
|
+
* @inheritDoc
|
|
2356
|
+
*/
|
|
2357
|
+
handleAction(action, target) {
|
|
2358
|
+
this.deleteNodeContent(action, target);
|
|
2359
|
+
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Handle the delete text logic when press delete key.
|
|
2362
|
+
*
|
|
2363
|
+
* @param {DeleteBlockContentAction} action - ModifyContentAction
|
|
2364
|
+
* @param {RTETextBlock} target - Current text block
|
|
2365
|
+
*/
|
|
2366
|
+
deleteNodeContent(action, target) {
|
|
2367
|
+
const startContainerNode = action.startContainerNode;
|
|
2368
|
+
const startOffset = action.startOffset;
|
|
2369
|
+
if (startOffset !== 0 && !startContainerNode.isEmpty()) {
|
|
2370
|
+
const newText = startContainerNode.text.slice(0, startOffset - 1) +
|
|
2371
|
+
startContainerNode.text.slice(startOffset);
|
|
2372
|
+
startContainerNode.apply(new UpdateTextAction(newText));
|
|
2373
|
+
if (newText) {
|
|
2374
|
+
action.previousNode = startContainerNode;
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
else {
|
|
2378
|
+
const previousNode = this.getPreviousNode(startContainerNode);
|
|
2379
|
+
// Remove the last character will not delete paragraph, the paragraph will removed after press delete again
|
|
2380
|
+
if ((previousNode && previousNode.parentBlock === target && previousNode['text'] === '\n') ||
|
|
2381
|
+
target.nodes.length === 1) {
|
|
2382
|
+
action.previousNode = startContainerNode;
|
|
2383
|
+
return;
|
|
2384
|
+
}
|
|
2385
|
+
else {
|
|
2386
|
+
target.apply(new RemoveChildAction(startContainerNode));
|
|
2387
|
+
action.previousNode = previousNode;
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
else {
|
|
2393
|
+
let previousNode = this.getPreviousNode(startContainerNode);
|
|
2394
|
+
let nextNode = null;
|
|
2395
|
+
if (target.nodes.length && previousNode && previousNode.parentBlock !== target) {
|
|
2396
|
+
if (startContainerNode.isEmpty()) {
|
|
2397
|
+
target.apply(new RemoveChildAction(startContainerNode));
|
|
2398
|
+
}
|
|
2399
|
+
previousNode.parentBlock.apply(new MergeTwoBlocksNodesAction(target));
|
|
2400
|
+
}
|
|
2401
|
+
else {
|
|
2402
|
+
if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
|
|
2403
|
+
nextNode = this.getNextNode(startContainerNode);
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Remove line break
|
|
2407
|
+
*
|
|
2408
|
+
* @example caret at the first line
|
|
2409
|
+
* \n
|
|
2410
|
+
* test
|
|
2411
|
+
*/
|
|
2412
|
+
if (startContainerNode.isEmpty()) {
|
|
2413
|
+
target.apply(new RemoveChildAction(startContainerNode));
|
|
2414
|
+
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Remove line break
|
|
2417
|
+
*
|
|
2418
|
+
* @example caret at the begin of second line
|
|
2419
|
+
* \n
|
|
2420
|
+
* test
|
|
2421
|
+
*/
|
|
2422
|
+
if (previousNode instanceof RTETextNode && previousNode.isEmpty()) {
|
|
2423
|
+
const shouldRemoveNode = previousNode;
|
|
2424
|
+
previousNode = this.getPreviousNode(previousNode);
|
|
2425
|
+
shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
|
|
2426
|
+
if (!previousNode) {
|
|
2427
|
+
nextNode = startContainerNode;
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
//Remove the paragraph block if the content is empty
|
|
2432
|
+
if (target.nodes.length === 0) {
|
|
2433
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
2434
|
+
}
|
|
2435
|
+
if (previousNode) {
|
|
2436
|
+
action.previousNode = previousNode;
|
|
2437
|
+
}
|
|
2438
|
+
else if (nextNode) {
|
|
2439
|
+
action.nextNode = nextNode;
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* Insert a image block into the text block at special position strategy.
|
|
2447
|
+
*/
|
|
2448
|
+
class BlockInsertImageIntoTextStrategy extends ActionHandleStrategy {
|
|
2449
|
+
/**
|
|
2450
|
+
* insertImage
|
|
2451
|
+
*
|
|
2452
|
+
* @param {InsertImageToBlockAction} action - Insert image action instance.
|
|
2453
|
+
* @param {RTETextBlock} target - The text block.
|
|
2454
|
+
*/
|
|
2455
|
+
handleAction(action, target) {
|
|
2456
|
+
const splitNode = action.splitPointNode;
|
|
2457
|
+
const startOffsetOfNode = action.startOffsetOfNode;
|
|
2458
|
+
const newImageBlock = action.imageBlockToBeInserted;
|
|
2459
|
+
if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
2460
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
|
|
2461
|
+
}
|
|
2462
|
+
else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
2463
|
+
target.parent.apply(new InsertBlocksBeforeAction(target, newImageBlock));
|
|
2464
|
+
}
|
|
2465
|
+
else {
|
|
2466
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
2467
|
+
target.apply(splitBlockAction);
|
|
2468
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
/**
|
|
2474
|
+
* Replace the node with new node array strategy.
|
|
2475
|
+
*/
|
|
2476
|
+
class BlockReplaceNodeWithNodesStrategy extends ActionHandleStrategy {
|
|
2477
|
+
/**
|
|
2478
|
+
* Replace the current node to the new node array.
|
|
2479
|
+
*
|
|
2480
|
+
* @param {RTEBlock} target - The image block or the text block.
|
|
2481
|
+
* @param {RTENode} referNode - The text node or the image node.
|
|
2482
|
+
* @param {RTENode[]} newNodes - The array of the text node or the image node.
|
|
2483
|
+
*/
|
|
2484
|
+
replaceNodeWithNodes(target, referNode, newNodes) {
|
|
2485
|
+
if (target['nodes']) {
|
|
2486
|
+
newNodes.forEach((node) => {
|
|
2487
|
+
node.parentBlock = target;
|
|
2488
|
+
});
|
|
2489
|
+
target['nodes'] = target['nodes'].flatMap((node) => {
|
|
2490
|
+
if (node === referNode) {
|
|
2491
|
+
return newNodes;
|
|
2492
|
+
}
|
|
2493
|
+
else {
|
|
2494
|
+
return node;
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* Insert some text nodes at the before of the node strategy.
|
|
2503
|
+
*/
|
|
2504
|
+
class BlockInsertNodesBeforeNodeStrategy extends BlockReplaceNodeWithNodesStrategy {
|
|
2505
|
+
/**
|
|
2506
|
+
* @inheritDoc
|
|
2507
|
+
*/
|
|
2508
|
+
handleAction(action, target) {
|
|
2509
|
+
const referNode = action.referNode;
|
|
2510
|
+
const nodes = [...action.nodesToBeInserted, referNode];
|
|
2511
|
+
this.replaceNodeWithNodes(target, referNode, nodes);
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
/**
|
|
2516
|
+
* Convert the selected blocks to list strategy.
|
|
2517
|
+
*/
|
|
2518
|
+
class BlockTransformToListStrategy extends ActionHandleStrategy {
|
|
2519
|
+
/**
|
|
2520
|
+
* This method will create a empty list block and append all selected blocks as list item block.
|
|
2521
|
+
*
|
|
2522
|
+
* @param {TransformListAction} action - The transform list action instance.
|
|
2523
|
+
* @param {RTETextBlock} target - The first item of the selected block.
|
|
2524
|
+
*/
|
|
2525
|
+
handleAction(action, target) {
|
|
2526
|
+
const contentState = target.parent;
|
|
2527
|
+
const bulletList = contentState.createList(action.listType);
|
|
2528
|
+
const selectedBlocks = action.selectedBlocks;
|
|
2529
|
+
const listItems = selectedBlocks.map((block) => contentState.toListItem(block));
|
|
2530
|
+
bulletList.apply(new AppendChildNodesAction(listItems));
|
|
2531
|
+
contentState.apply(new InsertBlocksAfterAction(action.selectedBlocks[0], bulletList));
|
|
2532
|
+
selectedBlocks.forEach((block) => {
|
|
2533
|
+
block.parent.apply(new RemoveChildAction(block));
|
|
2534
|
+
});
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* Text block
|
|
2540
|
+
*/
|
|
2541
|
+
class RTETextBlock extends RTEBlock {
|
|
2542
|
+
constructor(id, type) {
|
|
2543
|
+
super(id);
|
|
2544
|
+
this.nodes = [];
|
|
2545
|
+
this.type = type;
|
|
2546
|
+
if (RTETextBlock.isAcceptableTextStyle(type)) {
|
|
2547
|
+
this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
|
|
2548
|
+
}
|
|
2549
|
+
else {
|
|
2550
|
+
this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
/**
|
|
2554
|
+
* Converts a VegaRTETextBlock into an RTETextBlock.
|
|
2555
|
+
*
|
|
2556
|
+
* @param {VegaRTETextBlock} block - The block object
|
|
2557
|
+
* @returns {RTETextBlock} A RTETextBlock class
|
|
2558
|
+
*/
|
|
2559
|
+
static from(block) {
|
|
2560
|
+
const textBlock = new RTETextBlock(block.id, block.type);
|
|
2561
|
+
const { annotations } = block;
|
|
2562
|
+
textBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, textBlock));
|
|
2563
|
+
if (annotations) {
|
|
2564
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
2565
|
+
const item = this.createAnnotationEntity(type, value);
|
|
2566
|
+
if (isNonNullable(item)) {
|
|
2567
|
+
textBlock.annotationMap.set(...item);
|
|
2568
|
+
}
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
return textBlock;
|
|
2572
|
+
}
|
|
2573
|
+
/**
|
|
2574
|
+
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
2575
|
+
* and value.
|
|
2576
|
+
*
|
|
2577
|
+
* @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
|
|
2578
|
+
* the type of annotation entity to create.
|
|
2579
|
+
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
2580
|
+
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
2581
|
+
* annotation being created.
|
|
2582
|
+
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
2583
|
+
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
2584
|
+
*/
|
|
2585
|
+
static createAnnotationEntity(type, value) {
|
|
2586
|
+
if (type === 'textStyle') {
|
|
2587
|
+
return TextStyleAnnotation.from(value);
|
|
2588
|
+
}
|
|
2589
|
+
else {
|
|
2590
|
+
return super.createAnnotationEntity(type, value);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
/**
|
|
2594
|
+
* Checks if a given text block type is one of the acceptable text styles.
|
|
2595
|
+
*
|
|
2596
|
+
* @param {VegaRTETextBlockType} type - The text block type
|
|
2597
|
+
* @returns {boolean} Return a boolean value indicating whether the `type` parameter is valid.
|
|
2598
|
+
*/
|
|
2599
|
+
static isAcceptableTextStyle(type) {
|
|
2600
|
+
return ['title', 'subtitle', 'paragraph', 'heading-1', 'heading-2', 'heading-3'].includes(type);
|
|
2601
|
+
}
|
|
2602
|
+
/**
|
|
2603
|
+
* Merges RTETextNode nodes based on certain conditions.
|
|
2604
|
+
*
|
|
2605
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
2606
|
+
*/
|
|
2607
|
+
mergeNodes(action) {
|
|
2608
|
+
this.nodes = this.nodes.reduce((prev, cur) => {
|
|
2609
|
+
const lastNode = prev.at(-1);
|
|
2610
|
+
if (action instanceof LinkAnnotationAction && action.needMergeNode) {
|
|
2611
|
+
const lastNodeLinkAnnotation = lastNode === null || lastNode === void 0 ? void 0 : lastNode.getAnnotationByType(NodeAnnotationTypeEnum.LINK);
|
|
2612
|
+
const curNodeLinkAnnotation = cur.getAnnotationByType(NodeAnnotationTypeEnum.LINK);
|
|
2613
|
+
if (lastNodeLinkAnnotation &&
|
|
2614
|
+
curNodeLinkAnnotation &&
|
|
2615
|
+
lastNodeLinkAnnotation.toEqual(curNodeLinkAnnotation)) {
|
|
2616
|
+
return prev;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
// TODO: handle other cases like merge bold nodes
|
|
2620
|
+
return [...prev, cur];
|
|
2621
|
+
}, []);
|
|
2622
|
+
}
|
|
2623
|
+
/**
|
|
2624
|
+
* @inheritDoc
|
|
2625
|
+
*/
|
|
2626
|
+
toJSON() {
|
|
2627
|
+
return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.nodes.map((node) => node.toJSON()) });
|
|
2628
|
+
}
|
|
2629
|
+
/**
|
|
2630
|
+
* Clone the nodes to a new block
|
|
2631
|
+
*
|
|
2632
|
+
* @param {RTEBlock} nodes - The nodes will be copied
|
|
2633
|
+
* @returns {RTEBlock} New block
|
|
2634
|
+
*/
|
|
2635
|
+
cloneWithNodes(nodes) {
|
|
2636
|
+
const block = new RTETextBlock(generateUUID(), this.type);
|
|
2637
|
+
block.nodes = [];
|
|
2638
|
+
block.apply(new AppendChildNodesAction(nodes));
|
|
2639
|
+
return block;
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* @inheritDoc
|
|
2643
|
+
*/
|
|
2644
|
+
isNotEmpty() {
|
|
2645
|
+
return this.nodes.length > 0 && this.nodes.some((node) => !node.isEmpty());
|
|
2646
|
+
}
|
|
2647
|
+
/**
|
|
2648
|
+
* @inheritDoc
|
|
2649
|
+
*/
|
|
2650
|
+
getLastNode() {
|
|
2651
|
+
return this.nodes[this.nodes.length - 1];
|
|
2652
|
+
}
|
|
2653
|
+
/**
|
|
2654
|
+
* Create new empty paragraph.
|
|
2655
|
+
*
|
|
2656
|
+
* @returns {RTETextBlock} Paragraph.
|
|
2657
|
+
*/
|
|
2658
|
+
createNewParagraph() {
|
|
2659
|
+
return new RTETextBlock(generateUUID(), 'paragraph');
|
|
2660
|
+
}
|
|
2661
|
+
/**
|
|
2662
|
+
* @inheritDoc
|
|
2663
|
+
*/
|
|
2664
|
+
doAnnotationActionApply(action) {
|
|
2665
|
+
const strategy = ActionHandleStrategyRegistry.get(action.constructor.name, RTETextBlock.name);
|
|
2666
|
+
if (strategy) {
|
|
2667
|
+
strategy.execute(action, this);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
(() => {
|
|
2672
|
+
ActionHandleStrategyRegistry.register(TextStyleAnnotationAction.name, RTETextBlock.name, new BlockUpdateTextStyleStrategy());
|
|
2673
|
+
ActionHandleStrategyRegistry.register(LinkGroupAnnotationAction.name, RTETextBlock.name, new BlockUpdateLinkGroupStrategy());
|
|
2674
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTETextBlock.name, new BlockRemoveNodeStrategy());
|
|
2675
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTETextBlock.name, new BlockAppendNodesStrategy());
|
|
2676
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTETextBlock.name, new BlockSplitWithTextNodeStrategy());
|
|
2677
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTETextBlock.name, new BlockReplaceNodesStrategy());
|
|
2678
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTETextBlock.name, new BlockMergeNodesStrategy());
|
|
2679
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTETextBlock.name, new BlockInsertNewParagraphStrategy());
|
|
2680
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTETextBlock.name, new BlockInsertLineBreakStrategy());
|
|
2681
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTETextBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
|
|
2682
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTETextBlock.name, new BlockDeleteTextContentStrategy());
|
|
2683
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTETextBlock.name, new BlockInsertImageIntoTextStrategy());
|
|
2684
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_BEFORE, RTETextBlock.name, new BlockInsertNodesBeforeNodeStrategy());
|
|
2685
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTETextBlock.name, new BlockTransformToListStrategy());
|
|
2686
|
+
})();
|
|
2687
|
+
|
|
2688
|
+
/**
|
|
2689
|
+
* Insert a new paragraph at the image block special position strategy.
|
|
2690
|
+
*/
|
|
2691
|
+
class ImageInsertNewParagraphStrategy extends ActionHandleStrategy {
|
|
2692
|
+
/**
|
|
2693
|
+
* @inheritDoc
|
|
2694
|
+
*/
|
|
2695
|
+
handleAction(action, target) {
|
|
2696
|
+
action.newBlock = this.breakSingleBlock(action.startContainerNode, action.startOffset, target);
|
|
2697
|
+
}
|
|
2698
|
+
/**
|
|
2699
|
+
* Used to split a block of text at a specific position and insert a new paragraph block.
|
|
2700
|
+
*
|
|
2701
|
+
* @param {RTEImageNode} splitNode - The node that needs to be split into separate blocks.
|
|
2702
|
+
* @param {number} startOffsetOfNode - The index or position within the `splitNode` where the block should be broken or split.
|
|
2703
|
+
* @param {RTEImageBlock} target - The image block.
|
|
2704
|
+
* @returns {Nullable<RTEBlock>} Returns either a new paragraph block or the new block created after splitting the original block.
|
|
2705
|
+
*/
|
|
2706
|
+
breakSingleBlock(splitNode, startOffsetOfNode, target) {
|
|
2707
|
+
const newParagraph = RTETextBlock.from({
|
|
2708
|
+
id: generateUUID(),
|
|
2709
|
+
type: 'paragraph',
|
|
2710
|
+
nodes: [{ id: generateUUID(), type: 'text', text: '' }],
|
|
2711
|
+
});
|
|
2712
|
+
if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
2713
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
|
|
2714
|
+
}
|
|
2715
|
+
else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
2716
|
+
target.parent.apply(new InsertBlocksBeforeAction(target, newParagraph));
|
|
2717
|
+
}
|
|
2718
|
+
else {
|
|
2719
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
2720
|
+
target.apply(splitBlockAction);
|
|
2721
|
+
return splitBlockAction.newBlock;
|
|
2722
|
+
}
|
|
2723
|
+
return newParagraph;
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
/**
|
|
2728
|
+
* Break the current block after press enter, this action is similar with the SplitBlockWithNodeAction,
|
|
2729
|
+
* The SplitBlockWithNodeAction split the current block to two same type blocks, but this action will create new paragraph or list item when break at start or end.
|
|
2730
|
+
* The property `newBlock` use to store the new create block if need.
|
|
2731
|
+
*
|
|
2732
|
+
* @example currentBlock.apply(new BreakSingleBlockAction(startContainerNode, startOffset))
|
|
2733
|
+
*/
|
|
2734
|
+
class BreakSingleBlockAction extends ModifyContentAction {
|
|
2735
|
+
constructor(startContainerNode, startOffset) {
|
|
2736
|
+
super();
|
|
2737
|
+
this.type = ModifyContentActionType.BREAK_SINGLE_BLOCK;
|
|
2738
|
+
this.startContainerNode = startContainerNode;
|
|
2739
|
+
this.startOffset = startOffset;
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
/**
|
|
2744
|
+
* The image block insert line break strategy.
|
|
2745
|
+
*/
|
|
2746
|
+
class ImageInsertLineBreakStrategy extends ActionHandleStrategy {
|
|
2747
|
+
/**
|
|
2748
|
+
* The image block not support insert the line break node, so invoke the insert new paragraph logic directly.
|
|
2749
|
+
*
|
|
2750
|
+
* @param {LineBreakSingleBlockAction} action - The action instance.
|
|
2751
|
+
* @param {RTEImageBlock} target - The image block.
|
|
2752
|
+
*/
|
|
2753
|
+
handleAction(action, target) {
|
|
2754
|
+
const insertNewParagraphAction = new BreakSingleBlockAction(action.startContainerNode, action.startOffset);
|
|
2755
|
+
target.apply(insertNewParagraphAction);
|
|
2756
|
+
const newBlock = insertNewParagraphAction.newBlock;
|
|
2757
|
+
if (newBlock) {
|
|
2758
|
+
action.lineBreakNode = newBlock.nodes[0];
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
/**
|
|
2764
|
+
* Insert a line break node into multiple blocks selection at special position strategy.
|
|
2765
|
+
*/
|
|
2766
|
+
class ImageInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
|
|
2767
|
+
/**
|
|
2768
|
+
* @inheritDoc
|
|
2769
|
+
*/
|
|
2770
|
+
handleAction(action, target) {
|
|
2771
|
+
action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
|
|
2772
|
+
}
|
|
2773
|
+
/**
|
|
2774
|
+
* Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
|
|
2775
|
+
*
|
|
2776
|
+
* @param {RTEBlock[]} selectedBlocks - An array of RTEBlock objects that represent the blocks that have been selected for a specific action in the Rich Text Editor.
|
|
2777
|
+
* @param {RTEImageBlock} target - The image block.
|
|
2778
|
+
* @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
|
|
2779
|
+
*/
|
|
2780
|
+
lineBreakMultipleBlocks(selectedBlocks, target) {
|
|
2781
|
+
const newParagraph = RTETextBlock.from({
|
|
2782
|
+
id: generateUUID(),
|
|
2783
|
+
type: 'paragraph',
|
|
2784
|
+
nodes: [{ id: generateUUID(), type: 'text', text: '\n' }],
|
|
2785
|
+
});
|
|
2786
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
|
|
2787
|
+
const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
|
|
2788
|
+
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
2789
|
+
afterNodes.push(new RTETextNode(generateUUID(), '\n', newParagraph));
|
|
2790
|
+
}
|
|
2791
|
+
newParagraph.apply(new AppendChildNodesAction(afterNodes));
|
|
2792
|
+
return newParagraph['nodes'][0];
|
|
2793
|
+
}
|
|
2794
|
+
/**
|
|
2795
|
+
* Concat the child nodes of multiple RTEBlocks if both are not images.
|
|
2796
|
+
*
|
|
2797
|
+
* @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
2798
|
+
* @returns {RTENode[]} Array of connected block nodes
|
|
2799
|
+
*/
|
|
2800
|
+
concatBlocksNodes(blocks) {
|
|
2801
|
+
const nodes = [];
|
|
2802
|
+
blocks.map((block) => {
|
|
2803
|
+
if (block.type !== 'image') {
|
|
2804
|
+
nodes.push(...block['nodes']);
|
|
2805
|
+
block.parent.apply(new RemoveChildAction(block));
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
return nodes;
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* Insert a image node at the special position of image block.
|
|
2814
|
+
*/
|
|
2815
|
+
class ImageBlockInsertImageStrategy extends ActionHandleStrategy {
|
|
2816
|
+
/**
|
|
2817
|
+
* @inheritDoc
|
|
2818
|
+
*/
|
|
2819
|
+
handleAction(action, target) {
|
|
2820
|
+
const splitNode = action.splitPointNode;
|
|
2821
|
+
const startOffsetOfNode = action.startOffsetOfNode;
|
|
2822
|
+
const newImageBlock = action.imageBlockToBeInserted;
|
|
2823
|
+
const newImageNodes = newImageBlock.nodes;
|
|
2824
|
+
if (target.nodes.length < 1) {
|
|
2825
|
+
target.apply(new AppendChildNodesAction(newImageNodes));
|
|
2826
|
+
}
|
|
2827
|
+
else if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
2828
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
|
|
2829
|
+
}
|
|
2830
|
+
else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
2831
|
+
target.parent.apply(new InsertBlocksBeforeAction(target, newImageBlock));
|
|
2832
|
+
}
|
|
2833
|
+
else {
|
|
2834
|
+
target.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
|
|
2835
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
/**
|
|
2841
|
+
* Insert some text nodes at the behind of the node strategy.
|
|
2842
|
+
*/
|
|
2843
|
+
class BlockInsertNodesAfterNodeStrategy extends BlockReplaceNodeWithNodesStrategy {
|
|
2844
|
+
/**
|
|
2845
|
+
* @inheritDoc
|
|
2846
|
+
*/
|
|
2847
|
+
handleAction(action, target) {
|
|
2848
|
+
const referNode = action.referNode;
|
|
2849
|
+
const nodes = [referNode, ...action.nodesToBeInserted];
|
|
2850
|
+
this.replaceNodeWithNodes(target, referNode, nodes);
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
/**
|
|
2855
|
+
* Image block
|
|
2856
|
+
*/
|
|
2857
|
+
class RTEImageBlock extends RTEBlock {
|
|
2858
|
+
constructor(id) {
|
|
2859
|
+
super(id);
|
|
2860
|
+
this.type = 'image';
|
|
2861
|
+
this.nodes = [];
|
|
2862
|
+
}
|
|
2863
|
+
/**
|
|
2864
|
+
* Converts a VegaRTEImageBlock object into an RTEImageBlock object by mapping nodes and creating annotations.
|
|
2865
|
+
*
|
|
2866
|
+
* @param {VegaRTEImageBlock} block - The block object to be converted.
|
|
2867
|
+
* @returns {RTEImageBlock} An instance of `RTEImageBlock`
|
|
2868
|
+
*/
|
|
2869
|
+
static from(block) {
|
|
2870
|
+
const imageBlock = new RTEImageBlock(block.id);
|
|
2871
|
+
const { annotations } = block;
|
|
2872
|
+
imageBlock.nodes = block.nodes.map((image) => RTEImageNode.from(image, imageBlock));
|
|
2873
|
+
if (annotations) {
|
|
2874
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
2875
|
+
const item = this.createAnnotationEntity(type, value);
|
|
2876
|
+
if (isNonNullable(item)) {
|
|
2877
|
+
imageBlock.annotationMap.set(...item);
|
|
2878
|
+
}
|
|
2879
|
+
});
|
|
2880
|
+
}
|
|
2881
|
+
return imageBlock;
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* @inheritDoc
|
|
2885
|
+
*/
|
|
2886
|
+
toJSON() {
|
|
2887
|
+
return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
|
|
2888
|
+
}
|
|
2889
|
+
/**
|
|
2890
|
+
* @inheritDoc
|
|
2891
|
+
*/
|
|
2892
|
+
isNotEmpty() {
|
|
2893
|
+
return this.nodes.length > 0 && this.nodes.some((node) => node.url.length > 0);
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* @inheritDoc
|
|
2897
|
+
*/
|
|
2898
|
+
getLastNode() {
|
|
2899
|
+
return this.nodes[this.nodes.length - 1];
|
|
2900
|
+
}
|
|
2901
|
+
/**
|
|
2902
|
+
* Create a new image block.
|
|
2903
|
+
*
|
|
2904
|
+
* @returns {RTEImageBlock} - The empty image block.
|
|
2905
|
+
*/
|
|
2906
|
+
createNewImageBlock() {
|
|
2907
|
+
return new RTEImageBlock(generateUUID());
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
(() => {
|
|
2911
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEImageBlock.name, new BlockDeleteImageStrategy());
|
|
2912
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEImageBlock.name, new BlockMergeNodesStrategy());
|
|
2913
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTEImageBlock.name, new BlockRemoveNodeStrategy());
|
|
2914
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTEImageBlock.name, new BlockAppendNodesStrategy());
|
|
2915
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name, new BlockReplaceNodesStrategy());
|
|
2916
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name, new BlockSplitWithImageNodeStrategy());
|
|
2917
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertNewParagraphStrategy());
|
|
2918
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertLineBreakStrategy());
|
|
2919
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name, new ImageInsertLineBreakWithBlocksStrategy());
|
|
2920
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name, new ImageBlockInsertImageStrategy());
|
|
2921
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_BEFORE, RTEImageBlock.name, new BlockInsertNodesBeforeNodeStrategy());
|
|
2922
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_AFTER, RTEImageBlock.name, new BlockInsertNodesAfterNodeStrategy());
|
|
2923
|
+
})();
|
|
2924
|
+
|
|
2925
|
+
/**
|
|
2926
|
+
* The list item block block delete text content strategy.
|
|
2927
|
+
*/
|
|
2928
|
+
class ListItemDeleteTextContentStrategy extends BlockDeleteTextContentStrategy {
|
|
2929
|
+
/**
|
|
2930
|
+
* Delete the list item content and delete the parent list after delete the last item.
|
|
2931
|
+
*
|
|
2932
|
+
* @param {DeleteBlockContentAction} action - The delete block content action instance.
|
|
2933
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
2934
|
+
*/
|
|
2935
|
+
handleAction(action, target) {
|
|
2936
|
+
const listBlock = target.parent;
|
|
2937
|
+
this.deleteNodeContent(action, target);
|
|
2938
|
+
if (listBlock.blocks.length === 0) {
|
|
2939
|
+
listBlock.parent.apply(new RemoveChildAction(listBlock));
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
/**
|
|
2945
|
+
* Remove list item child node strategy.
|
|
2946
|
+
*/
|
|
2947
|
+
class ListItemRemoveNodeStrategy extends ActionHandleStrategy {
|
|
2948
|
+
/**
|
|
2949
|
+
* Remove child node from the list item, remove the list item if the list item is empty.
|
|
2950
|
+
*
|
|
2951
|
+
* @param {RemoveChildAction} action - The remove child action instance.
|
|
2952
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
2953
|
+
*/
|
|
2954
|
+
handleAction(action, target) {
|
|
2955
|
+
target.nodes = target.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
2956
|
+
if (target.nodes.length === 0 && (!target.children || !target.children.length)) {
|
|
2957
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
/**
|
|
2963
|
+
* Remove list item nest list block strategy.
|
|
2964
|
+
*/
|
|
2965
|
+
class ListItemRemoveNestListStrategy extends ActionHandleStrategy {
|
|
2966
|
+
/**
|
|
2967
|
+
* Remove the nest list block from the list item, clear the property children when the children is empty.
|
|
2968
|
+
*
|
|
2969
|
+
* @param {RemoveNestListAction} action - The action instance.
|
|
2970
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
2971
|
+
*/
|
|
2972
|
+
handleAction(action, target) {
|
|
2973
|
+
if (target.children) {
|
|
2974
|
+
if (target.children.length > 1) {
|
|
2975
|
+
target.children = target.children.filter((child) => child !== action.nestListBlockToBeRemoved);
|
|
2976
|
+
}
|
|
2977
|
+
else {
|
|
2978
|
+
target.children = undefined;
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
/**
|
|
2985
|
+
* Replace list item nest list strategy.
|
|
2986
|
+
*/
|
|
2987
|
+
class ListItemReplaceNestListStrategy extends ActionHandleStrategy {
|
|
2988
|
+
/**
|
|
2989
|
+
* @inheritDoc
|
|
2990
|
+
*/
|
|
2991
|
+
handleAction(action, target) {
|
|
2992
|
+
action.newList.forEach((listBlock) => {
|
|
2993
|
+
listBlock.parent = target;
|
|
2994
|
+
});
|
|
2995
|
+
target.children = action.newList;
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
/**
|
|
3000
|
+
* Insert new paragraph into current list item block at special position.
|
|
3001
|
+
*/
|
|
3002
|
+
class ListItemInsertNewParagraphStrategy extends ActionHandleStrategy {
|
|
3003
|
+
/**
|
|
3004
|
+
* @inheritDoc
|
|
3005
|
+
*/
|
|
3006
|
+
handleAction(action, target) {
|
|
3007
|
+
action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset, target);
|
|
3008
|
+
}
|
|
3009
|
+
/**
|
|
3010
|
+
* Breaks a single list item block at a specific position.
|
|
3011
|
+
*
|
|
3012
|
+
* @param {RTETextNode} splitNode - The node that needs to be split within a list item block.
|
|
3013
|
+
* @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
|
|
3014
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
3015
|
+
* @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
|
|
3016
|
+
* position is at the end of the `splitNode`, or it returns the result of splitting the block at the
|
|
3017
|
+
* caret position if it is neither at the start nor at the end.
|
|
3018
|
+
*/
|
|
3019
|
+
breakSingleListItemBlock(splitNode, startOffsetOfNode, target) {
|
|
3020
|
+
const newListItem = target.createNewListItem();
|
|
3021
|
+
const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
|
|
3022
|
+
newListItem.apply(new AppendChildNodesAction([newBreakNode]));
|
|
3023
|
+
if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
3024
|
+
return this.breakListItemAtEnd(newListItem, target);
|
|
3025
|
+
}
|
|
3026
|
+
else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
3027
|
+
target.parent.apply(new InsertBlocksBeforeAction(target, newListItem));
|
|
3028
|
+
}
|
|
3029
|
+
else {
|
|
3030
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
3031
|
+
target.apply(splitBlockAction);
|
|
3032
|
+
return splitBlockAction.newBlock;
|
|
3033
|
+
}
|
|
3034
|
+
return newListItem;
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* Breaks a list item at the end and handles the insertion of a new list item or paragraph accordingly.
|
|
3038
|
+
*
|
|
3039
|
+
* @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
|
|
3040
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
3041
|
+
* @returns {RTEBlock} Returns a `RTEBlock`.
|
|
3042
|
+
*/
|
|
3043
|
+
breakListItemAtEnd(newListItem, target) {
|
|
3044
|
+
const lastItem = target.parent.blocks[target.parent.blocks.length - 1];
|
|
3045
|
+
const currentItemIsEmpty = target.nodes.length === 1 && target.nodes[0].isEmpty();
|
|
3046
|
+
if (target === lastItem && currentItemIsEmpty) {
|
|
3047
|
+
const parentParent = target.parent.parent;
|
|
3048
|
+
if (parentParent['type'] !== 'list-item') {
|
|
3049
|
+
const newParagraph = RTETextBlock.from({
|
|
3050
|
+
id: generateUUID(),
|
|
3051
|
+
type: 'paragraph',
|
|
3052
|
+
nodes: [],
|
|
3053
|
+
});
|
|
3054
|
+
newParagraph.apply(new AppendChildNodesAction(newListItem.nodes));
|
|
3055
|
+
parentParent.apply(new InsertBlocksAfterAction(target.parent, newParagraph));
|
|
3056
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
3057
|
+
return newParagraph;
|
|
3058
|
+
}
|
|
3059
|
+
else {
|
|
3060
|
+
parentParent.parent.apply(new InsertBlocksAfterAction(parentParent, newListItem));
|
|
3061
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
else {
|
|
3065
|
+
target.parent.apply(new InsertBlocksAfterAction(target, newListItem));
|
|
3066
|
+
}
|
|
3067
|
+
return newListItem;
|
|
3068
|
+
}
|
|
3069
|
+
/**
|
|
3070
|
+
* Copy the inline style to new node
|
|
3071
|
+
*
|
|
3072
|
+
* @param {RTETextNode} needCopedNode - The node that needed to be copied to
|
|
3073
|
+
* @returns {RTETextNode} Returns a `RTETextNode`.
|
|
3074
|
+
*/
|
|
3075
|
+
copyInlineStyleToNewNode(needCopedNode) {
|
|
3076
|
+
const textNode = needCopedNode.cloneWithText('');
|
|
3077
|
+
// The link annotation doesn't need to inherit
|
|
3078
|
+
textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
3079
|
+
return textNode;
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
/**
|
|
3084
|
+
* Insert image node to list item block strategy.
|
|
3085
|
+
*/
|
|
3086
|
+
class ListItemInsertImageStrategy extends ActionHandleStrategy {
|
|
3087
|
+
/**
|
|
3088
|
+
* The image node can not insert into list item block, so insert image after parent list block.
|
|
3089
|
+
*
|
|
3090
|
+
* @param {InsertImageToBlockAction} action - The action instance.
|
|
3091
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
3092
|
+
*/
|
|
3093
|
+
handleAction(action, target) {
|
|
3094
|
+
target.parent.apply(action);
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
/**
|
|
3099
|
+
* List item block
|
|
3100
|
+
*/
|
|
3101
|
+
class RTEListItemBlock extends RTETextBlock {
|
|
3102
|
+
constructor(id, children) {
|
|
3103
|
+
super(id, 'list-item');
|
|
3104
|
+
this.children = [];
|
|
3105
|
+
this.children = children;
|
|
3106
|
+
}
|
|
3107
|
+
/**
|
|
3108
|
+
* Converts a VegaRTEListItemBlock object to an RTEListItemBlock
|
|
3109
|
+
*
|
|
3110
|
+
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
|
|
3111
|
+
* @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
|
|
3112
|
+
*/
|
|
3113
|
+
static from(block) {
|
|
3114
|
+
const listItemBlock = new RTEListItemBlock(block.id);
|
|
3115
|
+
listItemBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock));
|
|
3116
|
+
if (block.children) {
|
|
3117
|
+
listItemBlock.children = block.children.map((child) => {
|
|
3118
|
+
const listBlock = RTEListBlock.from(child);
|
|
3119
|
+
listBlock.parent = listItemBlock;
|
|
3120
|
+
return listBlock;
|
|
3121
|
+
});
|
|
3122
|
+
}
|
|
3123
|
+
const { annotations } = block;
|
|
3124
|
+
if (annotations) {
|
|
3125
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
3126
|
+
const item = this.createAnnotationEntity(type, value);
|
|
3127
|
+
if (isNonNullable(item)) {
|
|
3128
|
+
listItemBlock.annotationMap.set(...item);
|
|
3129
|
+
}
|
|
3130
|
+
});
|
|
3131
|
+
}
|
|
3132
|
+
return listItemBlock;
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* @inheritDoc
|
|
3136
|
+
*/
|
|
3137
|
+
toJSON() {
|
|
3138
|
+
var _a;
|
|
3139
|
+
return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
|
|
3140
|
+
}
|
|
3141
|
+
/**
|
|
3142
|
+
* @inheritDoc
|
|
3143
|
+
*/
|
|
3144
|
+
cloneWithNodes(nodes) {
|
|
3145
|
+
const block = new RTEListItemBlock(generateUUID());
|
|
3146
|
+
block.nodes = [];
|
|
3147
|
+
block.apply(new AppendChildNodesAction(nodes));
|
|
3148
|
+
return block;
|
|
3149
|
+
}
|
|
3150
|
+
/**
|
|
3151
|
+
* @inheritDoc
|
|
3152
|
+
*/
|
|
3153
|
+
getLastNode() {
|
|
3154
|
+
if (this.children && this.children.length > 0) {
|
|
3155
|
+
const childListBlock = this.children[this.children.length - 1];
|
|
3156
|
+
return childListBlock.getLastNode();
|
|
3157
|
+
}
|
|
3158
|
+
return super.getLastNode();
|
|
3159
|
+
}
|
|
3160
|
+
/**
|
|
3161
|
+
* Create a new list item block.
|
|
3162
|
+
*
|
|
3163
|
+
* @returns {RTEListItemBlock} - A list item block.
|
|
3164
|
+
*/
|
|
3165
|
+
createNewListItem() {
|
|
3166
|
+
return new RTEListItemBlock(generateUUID());
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
(() => {
|
|
3170
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEListItemBlock.name, new ListItemDeleteTextContentStrategy());
|
|
3171
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new BlockInsertLineBreakStrategy());
|
|
3172
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
|
|
3173
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTEListItemBlock.name, new ListItemRemoveNodeStrategy());
|
|
3174
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
|
|
3175
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTEListItemBlock.name, new BlockAppendNodesStrategy());
|
|
3176
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new BlockSplitWithTextNodeStrategy());
|
|
3177
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new BlockReplaceNodesStrategy());
|
|
3178
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
|
|
3179
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new BlockMergeNodesStrategy());
|
|
3180
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new ListItemInsertNewParagraphStrategy());
|
|
3181
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
|
|
3182
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_BEFORE, RTEListItemBlock.name, new BlockInsertNodesBeforeNodeStrategy());
|
|
3183
|
+
})();
|
|
3184
|
+
|
|
3185
|
+
/**
|
|
3186
|
+
* Insert block array at the front of the block strategy.
|
|
3187
|
+
*/
|
|
3188
|
+
class BlockInsertBlocksBeforeStrategy extends ActionHandleStrategy {
|
|
3189
|
+
/**
|
|
3190
|
+
* @inheritDoc
|
|
3191
|
+
*/
|
|
3192
|
+
handleAction(action, target) {
|
|
3193
|
+
this.replaceBlockWithBlocks(target, action.referBlock, [
|
|
3194
|
+
...action.blocksToBeInserted,
|
|
3195
|
+
action.referBlock,
|
|
3196
|
+
]);
|
|
3197
|
+
}
|
|
3198
|
+
/**
|
|
3199
|
+
* Replaces a specific block with an array of blocks within a RTEContentBlock array.
|
|
3200
|
+
*
|
|
3201
|
+
* @param {RTEListBlock|VegaRTEContent} target - The list block or the VegaRTEContent instance.
|
|
3202
|
+
* @param {RTEBlock} referBlock - Used as a reference block to identify the block that needs to be replaced in the `blocks` array.
|
|
3203
|
+
* @param {RTEBlock[]} blocks - An array of RTEBlock objects that you want to replace the `referBlock` with in the `blocks` array.
|
|
3204
|
+
*/
|
|
3205
|
+
replaceBlockWithBlocks(target, referBlock, blocks) {
|
|
3206
|
+
if (target.blocks) {
|
|
3207
|
+
blocks.forEach((block) => {
|
|
3208
|
+
block.parent = target;
|
|
3209
|
+
});
|
|
3210
|
+
const arrayFixed = target.blocks;
|
|
3211
|
+
target.blocks = arrayFixed.flatMap((block) => {
|
|
3212
|
+
if (block === referBlock) {
|
|
3213
|
+
return blocks;
|
|
3214
|
+
}
|
|
3215
|
+
else {
|
|
3216
|
+
return block;
|
|
3217
|
+
}
|
|
3218
|
+
});
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
/**
|
|
3224
|
+
* Insert block array at the behind of the block strategy.
|
|
3225
|
+
*/
|
|
3226
|
+
class BlockInsertBlocksAfterStrategy extends BlockInsertBlocksBeforeStrategy {
|
|
3227
|
+
/**
|
|
3228
|
+
* @inheritDoc
|
|
3229
|
+
*/
|
|
3230
|
+
handleAction(action, target) {
|
|
3231
|
+
this.replaceBlockWithBlocks(target, action.referBlock, [
|
|
3232
|
+
action.referBlock,
|
|
3233
|
+
...action.blocksToBeInserted,
|
|
3234
|
+
]);
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
/**
|
|
3239
|
+
* Append new block array to list block or VegaRTEContent instance strategy.
|
|
3240
|
+
*/
|
|
3241
|
+
class BlockAppendBlocksStrategy extends ActionHandleStrategy {
|
|
3242
|
+
/**
|
|
3243
|
+
* @inheritDoc
|
|
3244
|
+
*/
|
|
3245
|
+
handleAction(action, target) {
|
|
3246
|
+
const newBlocks = action.entityToBeAppended;
|
|
3247
|
+
if (target.blocks) {
|
|
3248
|
+
newBlocks.forEach((block) => {
|
|
3249
|
+
block.parent = target;
|
|
3250
|
+
});
|
|
3251
|
+
const arrayFixed = target.blocks;
|
|
3252
|
+
target.blocks = arrayFixed.concat(newBlocks);
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* Delete the nest list block action
|
|
3259
|
+
*
|
|
3260
|
+
* @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
|
|
3261
|
+
*/
|
|
3262
|
+
class RemoveNestListAction extends ModifyContentAction {
|
|
3263
|
+
constructor(childList) {
|
|
3264
|
+
super();
|
|
3265
|
+
this.type = ModifyContentActionType.DELETE_NEST_LIST;
|
|
3266
|
+
this.nestListBlockToBeRemoved = childList;
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
/**
|
|
3271
|
+
* List block or VegaRTEContent remove child block strategy.
|
|
3272
|
+
*/
|
|
3273
|
+
class BlockRemoveChildBlockStrategy extends ActionHandleStrategy {
|
|
3274
|
+
/**
|
|
3275
|
+
* @inheritDoc
|
|
3276
|
+
*/
|
|
3277
|
+
handleAction(action, target) {
|
|
3278
|
+
const blockToBeRemoved = action.entityToBeRemoved;
|
|
3279
|
+
if (target.blocks) {
|
|
3280
|
+
target.blocks = target.blocks.filter((block) => block !== blockToBeRemoved);
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
/**
|
|
3286
|
+
* List remove list item strategy.
|
|
3287
|
+
*/
|
|
3288
|
+
class ListRemoveListItemStrategy extends BlockRemoveChildBlockStrategy {
|
|
3289
|
+
/**
|
|
3290
|
+
* Remove the list item, check the list item and remove self if the list item is empty.
|
|
3291
|
+
*
|
|
3292
|
+
* @param {RemoveChildAction} action - The remove action instance.
|
|
3293
|
+
* @param {RTEListBlock} target - The list block.
|
|
3294
|
+
*/
|
|
3295
|
+
handleAction(action, target) {
|
|
3296
|
+
super.handleAction(action, target);
|
|
3297
|
+
const parent = target.parent;
|
|
3298
|
+
if (target.blocks.length === 0 && parent) {
|
|
3299
|
+
// The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
|
|
3300
|
+
if (parent['type'] === 'list-item') {
|
|
3301
|
+
parent.apply(new RemoveNestListAction(target));
|
|
3302
|
+
}
|
|
3303
|
+
else {
|
|
3304
|
+
parent.apply(new RemoveChildAction(target));
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
/**
|
|
3311
|
+
* Convert the selected blocks to list strategy.
|
|
3312
|
+
*/
|
|
3313
|
+
class ListTransformToListStrategy extends ActionHandleStrategy {
|
|
3314
|
+
/**
|
|
3315
|
+
* @inheritDoc
|
|
3316
|
+
*/
|
|
3317
|
+
handleAction(action, target) {
|
|
3318
|
+
const selectedBlocks = action.selectedBlocks;
|
|
3319
|
+
const bulletList = target.parent.createList(action.listType);
|
|
3320
|
+
const isSameList = selectedBlocks.every((block) => block.parent === target);
|
|
3321
|
+
if (isSameList) {
|
|
3322
|
+
// Select one or more list items belonging to the same list, and all items in this list should be updated
|
|
3323
|
+
bulletList.apply(new AppendChildNodesAction(target.blocks));
|
|
3324
|
+
target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
|
|
3325
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
3326
|
+
selectedBlocks.forEach((block) => block.nodes.map((node) => node.apply(new SyncUpSelectionAction())));
|
|
3327
|
+
}
|
|
3328
|
+
else {
|
|
3329
|
+
const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
|
|
3330
|
+
bulletList.apply(new AppendChildNodesAction(listItems));
|
|
3331
|
+
target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
|
|
3332
|
+
action.selectedBlocks.forEach((block) => {
|
|
3333
|
+
block.parent.apply(new RemoveChildAction(block));
|
|
3334
|
+
});
|
|
3335
|
+
if (target.blocks.length === 0) {
|
|
3336
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
/**
|
|
3343
|
+
* Convert the selected list block to paragraph strategy.
|
|
3344
|
+
*/
|
|
3345
|
+
class ListTransformToParagraphStrategy extends ActionHandleStrategy {
|
|
3346
|
+
/**
|
|
3347
|
+
* @inheritDoc
|
|
3348
|
+
*/
|
|
3349
|
+
handleAction(action, target) {
|
|
3350
|
+
let isSelectedFirstBlock = false;
|
|
3351
|
+
let isSelectedLastBlock = false;
|
|
3352
|
+
const selectedBlocks = action.selectedBlocks;
|
|
3353
|
+
const currentParagraph = selectedBlocks.map((block) => {
|
|
3354
|
+
block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
3355
|
+
if (block === target.blocks[0])
|
|
3356
|
+
isSelectedFirstBlock = true;
|
|
3357
|
+
if (block === target.blocks[target.blocks.length - 1])
|
|
3358
|
+
isSelectedLastBlock = true;
|
|
3359
|
+
return this.toParagraph(block);
|
|
3360
|
+
});
|
|
3361
|
+
if (isSelectedFirstBlock) {
|
|
3362
|
+
target.parent.apply(new InsertBlocksBeforeAction(target, ...currentParagraph));
|
|
3363
|
+
}
|
|
3364
|
+
else if (isSelectedLastBlock) {
|
|
3365
|
+
target.parent.apply(new InsertBlocksAfterAction(target, ...currentParagraph));
|
|
3366
|
+
}
|
|
3367
|
+
else {
|
|
3368
|
+
const startIndex = target.blocks.indexOf(selectedBlocks[0]);
|
|
3369
|
+
const lastIndex = target.blocks.indexOf(selectedBlocks[selectedBlocks.length - 1]);
|
|
3370
|
+
const firstBulletList = target.parent.createList(target.type);
|
|
3371
|
+
firstBulletList.apply(new AppendChildNodesAction(target.blocks.slice(0, startIndex)));
|
|
3372
|
+
const lastBulletList = target.parent.createList(target.type);
|
|
3373
|
+
lastBulletList.apply(new AppendChildNodesAction(target.blocks.slice(lastIndex + 1)));
|
|
3374
|
+
target.parent.apply(new InsertBlocksBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
|
|
3375
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
3376
|
+
}
|
|
3377
|
+
selectedBlocks.map((block) => {
|
|
3378
|
+
target.apply(new RemoveChildAction(block));
|
|
3379
|
+
});
|
|
3380
|
+
if (target.blocks.length === 0) {
|
|
3381
|
+
target.parent.apply(new RemoveChildAction(target));
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
/**
|
|
3385
|
+
* Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
|
|
3386
|
+
*
|
|
3387
|
+
* @param {RTEListItemBlock} block - The block that will be covered
|
|
3388
|
+
* @returns {RTETextBlock} Returns a `RTETextBlock`.
|
|
3389
|
+
*/
|
|
3390
|
+
toParagraph(block) {
|
|
3391
|
+
const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
|
|
3392
|
+
textBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
3393
|
+
textBlock['annotationMap'] = block['annotationMap'];
|
|
3394
|
+
return textBlock;
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
/**
|
|
3399
|
+
* Insert image to list block strategy.
|
|
3400
|
+
*/
|
|
3401
|
+
class ListInsertImageStrategy extends ActionHandleStrategy {
|
|
3402
|
+
/**
|
|
3403
|
+
* Insert image block at behind of the list item block.
|
|
3404
|
+
*
|
|
3405
|
+
* @param {InsertImageToBlockAction} action - The insert image action instance.
|
|
3406
|
+
* @param {RTEListBlock} target - The list block.
|
|
3407
|
+
*/
|
|
3408
|
+
handleAction(action, target) {
|
|
3409
|
+
const imageBlock = action.imageBlockToBeInserted;
|
|
3410
|
+
if (target.parent['type'] !== 'list-item') {
|
|
3411
|
+
target.parent.apply(new InsertBlocksAfterAction(target, imageBlock));
|
|
3412
|
+
}
|
|
3413
|
+
else {
|
|
3414
|
+
target.parent.apply(action);
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
/**
|
|
3420
|
+
* List block
|
|
3421
|
+
*/
|
|
3422
|
+
class RTEListBlock extends RTEBlock {
|
|
3423
|
+
constructor(id, type) {
|
|
3424
|
+
super(id);
|
|
3425
|
+
this.type = 'bullet-list';
|
|
3426
|
+
this.blocks = [];
|
|
3427
|
+
this.type = type;
|
|
3428
|
+
}
|
|
3429
|
+
/**
|
|
3430
|
+
* Converts a VegaRTEListBlock object to an RTEListBlock
|
|
3431
|
+
*
|
|
3432
|
+
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
|
|
3433
|
+
* @returns {RTEListBlock} Return an instance of `RTEListBlock`
|
|
3434
|
+
*/
|
|
3435
|
+
static from(block) {
|
|
3436
|
+
const listBlock = new RTEListBlock(block.id, block.type);
|
|
3437
|
+
listBlock.blocks = block.blocks.map((item) => {
|
|
3438
|
+
const listItemBlock = RTEListItemBlock.from(item);
|
|
3439
|
+
listItemBlock.parent = listBlock;
|
|
3440
|
+
return listItemBlock;
|
|
3441
|
+
});
|
|
3442
|
+
return listBlock;
|
|
3443
|
+
}
|
|
3444
|
+
/**
|
|
3445
|
+
* @inheritDoc
|
|
3446
|
+
*/
|
|
3447
|
+
toJSON() {
|
|
3448
|
+
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
3449
|
+
}
|
|
3450
|
+
/**
|
|
3451
|
+
* @inheritDoc
|
|
3452
|
+
*/
|
|
3453
|
+
isNotEmpty() {
|
|
3454
|
+
return this.blocks.length > 0;
|
|
3455
|
+
}
|
|
3456
|
+
/**
|
|
3457
|
+
* @inheritDoc
|
|
3458
|
+
*/
|
|
3459
|
+
getLastNode() {
|
|
3460
|
+
return this.blocks[this.blocks.length - 1].getLastNode();
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
(() => {
|
|
3464
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTEListBlock.name, new ListRemoveListItemStrategy());
|
|
3465
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_BLOCKS_BEFORE, RTEListBlock.name, new BlockInsertBlocksBeforeStrategy());
|
|
3466
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_BLOCKS_AFTER, RTEListBlock.name, new BlockInsertBlocksAfterStrategy());
|
|
3467
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTEListBlock.name, new BlockAppendBlocksStrategy());
|
|
3468
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
|
|
3469
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
|
|
3470
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
|
|
3471
|
+
})();
|
|
3472
|
+
|
|
3473
|
+
/**
|
|
3474
|
+
* Class representing the content state of the rich text editor.
|
|
3475
|
+
*/
|
|
3476
|
+
class VegaRTEContent {
|
|
3477
|
+
constructor(blocks) {
|
|
3478
|
+
blocks.forEach((block) => {
|
|
3479
|
+
block.parent = this;
|
|
3480
|
+
});
|
|
3481
|
+
this.blocks = blocks;
|
|
3482
|
+
}
|
|
3483
|
+
/**
|
|
3484
|
+
* Converts a JSON array of blocks to a class array of RTEContentBlock.
|
|
3485
|
+
*
|
|
3486
|
+
* @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
|
|
3487
|
+
* @returns {VegaRTEContent} The converted array of RTEContentBlock.
|
|
3488
|
+
*/
|
|
3489
|
+
static fromJSON(value) {
|
|
3490
|
+
const blocks = value.map((block) => {
|
|
3491
|
+
switch (block.type) {
|
|
3492
|
+
case 'paragraph':
|
|
3493
|
+
case 'title':
|
|
3494
|
+
case 'subtitle':
|
|
3495
|
+
case 'heading-1':
|
|
3496
|
+
case 'heading-2':
|
|
3497
|
+
case 'heading-3': {
|
|
3498
|
+
return RTETextBlock.from(block);
|
|
3499
|
+
}
|
|
3500
|
+
case 'image':
|
|
3501
|
+
return RTEImageBlock.from(block);
|
|
3502
|
+
case 'bullet-list':
|
|
3503
|
+
case 'number-list':
|
|
3504
|
+
return RTEListBlock.from(block);
|
|
3505
|
+
default: {
|
|
3506
|
+
throw new Error(`[Vega] Unknown block type: ${block.type}`);
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
});
|
|
3510
|
+
return new VegaRTEContent(blocks);
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* Create an empty content state
|
|
3514
|
+
*
|
|
3515
|
+
* @returns {VegaRTEContent} An empty content state
|
|
3516
|
+
*/
|
|
3517
|
+
static createEmptyContent() {
|
|
3518
|
+
return VegaRTEContent.fromJSON([
|
|
3519
|
+
{
|
|
3520
|
+
id: generateUUID(),
|
|
3521
|
+
type: 'paragraph',
|
|
3522
|
+
nodes: [
|
|
3523
|
+
{
|
|
3524
|
+
id: generateUUID(),
|
|
3525
|
+
type: 'text',
|
|
3526
|
+
text: '',
|
|
3527
|
+
},
|
|
3528
|
+
],
|
|
3529
|
+
},
|
|
3530
|
+
]);
|
|
3531
|
+
}
|
|
3532
|
+
/**
|
|
3533
|
+
* Clones the content state.
|
|
3534
|
+
*
|
|
3535
|
+
* @returns {VegaRTEContent} The cloned content state.
|
|
3536
|
+
*/
|
|
3537
|
+
clone() {
|
|
3538
|
+
return new VegaRTEContent([...this.blocks]);
|
|
3539
|
+
}
|
|
3540
|
+
/**
|
|
3541
|
+
* Converts the content state to a JSON array of blocks.
|
|
3542
|
+
*
|
|
3543
|
+
* @returns {VegaRTEContentBlock[]} The JSON array of blocks.
|
|
3544
|
+
*/
|
|
3545
|
+
toJSON() {
|
|
3546
|
+
return this.blocks.map((block) => block.toJSON());
|
|
3547
|
+
}
|
|
3548
|
+
/**
|
|
3549
|
+
* Internal method to add the block item, remove the block item
|
|
3550
|
+
*
|
|
3551
|
+
* @param {ModifyContentAction} action - Modify content action
|
|
3552
|
+
*/
|
|
3553
|
+
apply(action) {
|
|
3554
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
3555
|
+
}
|
|
3556
|
+
/**
|
|
3557
|
+
* Convert text to list.
|
|
3558
|
+
*
|
|
3559
|
+
* @param {RTETextBlock} block - block
|
|
3560
|
+
* @returns {RTEListItemBlock} list item block dto.
|
|
3561
|
+
*/
|
|
3562
|
+
toListItem(block) {
|
|
3563
|
+
block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
3564
|
+
const listItemBlock = new RTEListItemBlock(generateUUID());
|
|
3565
|
+
listItemBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
3566
|
+
listItemBlock['annotationMap'] = block['annotationMap'];
|
|
3567
|
+
return listItemBlock;
|
|
3568
|
+
}
|
|
3569
|
+
/**
|
|
3570
|
+
* create list.
|
|
3571
|
+
*
|
|
3572
|
+
* @param {ListType} type - type
|
|
3573
|
+
* @returns {RTEListBlock} list block dto.
|
|
3574
|
+
*/
|
|
3575
|
+
createList(type) {
|
|
3576
|
+
return new RTEListBlock(generateUUID(), type);
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
(() => {
|
|
3580
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, VegaRTEContent.name, new BlockRemoveChildBlockStrategy());
|
|
3581
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, VegaRTEContent.name, new BlockAppendBlocksStrategy());
|
|
3582
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_BLOCKS_BEFORE, VegaRTEContent.name, new BlockInsertBlocksBeforeStrategy());
|
|
3583
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_BLOCKS_AFTER, VegaRTEContent.name, new BlockInsertBlocksAfterStrategy());
|
|
3584
|
+
})();
|
|
3585
|
+
|
|
3586
|
+
export { AnnotationAction as A, BlockAnnotation as B, ClearFormattingAnnotationAction as C, BreakSingleBlockAction as D, RemoveChildAction as E, ReplaceChildNodesAction as F, InsertBlocksBeforeAction as G, HorizontalAlignmentAnnotation as H, InternalAnnotationTypeEnum as I, InsertBlocksAfterAction as J, LinkAnnotationAction as L, ModifyContentAction as M, NodeAnnotation as N, RTETextBlock as R, StrikethroughAnnotation as S, TextSplittableAction as T, UnderlineAnnotation as U, VegaRTEContent as V, ZERO_WIDTH_SPACE as Z, RTEImageBlock as a, RTEListItemBlock as b, RTEListBlock as c, RTEBlock as d, RTEImageNode as e, RTETextNode as f, RTENode as g, NodeAnnotationTypeEnum as h, ImageAnnotation as i, TextColorAnnotation as j, RTE_TEXT_COLORS as k, BoldAnnotationAction as l, ItalicAnnotation as m, TextStyleAnnotationAction as n, TextStyleAnnotation as o, BoldAnnotation as p, BlockAnnotationTypeEnum as q, CodeAnnotationAction as r, stateEntityRenderingRegistry as s, SelectionRangeAnnotation as t, IndentAnnotation as u, ModifyContentActionType as v, AppendChildNodesAction as w, UpdateTextAction as x, MergeTwoBlocksNodesAction as y, SplitBlockWithNodeAction as z };
|