@globalpayments/vega 2.100.0 → 2.101.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.
Files changed (394) hide show
  1. package/dist/cjs/{action-color-accessibility-validator-b8a9ef0f.js → action-color-accessibility-validator-61af71ae.js} +1 -1
  2. package/dist/cjs/{app-globals-48d067a7.js → app-globals-275ea7c7.js} +15 -7
  3. package/dist/cjs/{aria-dialog-focusable-trap-slimmer-62147489.js → aria-dialog-focusable-trap-slimmer-c79cc3f8.js} +1 -1
  4. package/dist/cjs/{child-nodes-event-prevent-slimmer-e0ac8467.js → child-nodes-event-prevent-slimmer-d720d7e9.js} +1 -1
  5. package/dist/cjs/{code-block-3b42c364.js → code-block-c598832d.js} +793 -781
  6. package/dist/cjs/{component-value-history-controller-slimmer.abstract-bbe3bcaf.js → component-value-history-controller-slimmer.abstract-4bd47aa1.js} +3 -3
  7. package/dist/cjs/{content-state-87a06c1a.js → content-state-da23e822.js} +2 -2
  8. package/dist/cjs/countries-a8e3812a.js +251 -0
  9. package/dist/cjs/{dark-mode-style-controller-f3da3342.js → dark-mode-style-controller-ec04ece9.js} +45 -45
  10. package/dist/cjs/{element-appender-slimmer-f7ba5d9a.js → element-appender-slimmer-2aaf8e24.js} +20 -1
  11. package/dist/cjs/{event-emit-slimmer-34aa195e.js → event-emit-slimmer-67b5c186.js} +1 -1
  12. package/dist/cjs/{form-field-controller-slimmer-fbaddc91.js → form-field-controller-slimmer-ac9337f4.js} +2 -2
  13. package/dist/cjs/{image-annotation-action-03d3e01a.js → image-annotation-action-378838c2.js} +4 -4
  14. package/dist/cjs/{image-extension-ccda26d3.js → image-extension-673ebe7f.js} +2 -2
  15. package/dist/cjs/index.cjs.js +14 -12
  16. package/dist/cjs/{internal-vega-event-manager-7003c84a.js → internal-vega-event-manager-976b9526.js} +10 -2
  17. package/dist/cjs/{link-extension-71eeaa9f.js → link-extension-f493e432.js} +2 -2
  18. package/dist/cjs/loader.cjs.js +13 -12
  19. package/dist/cjs/{public-rules-3dc5d02d.js → public-rules-bae12c47.js} +5 -5
  20. package/dist/cjs/{range-d29751e3.js → range-9f42fb40.js} +1 -1
  21. package/dist/cjs/{rich-text-editor-required-rule-05de7f0c.js → rich-text-editor-required-rule-bb232741.js} +1 -1
  22. package/dist/cjs/{split-cell-operation-ef783850.js → split-cell-operation-0d33123e.js} +3 -3
  23. package/dist/cjs/{string-input-formatter-slimmer-9747039f.js → string-input-formatter-slimmer-2e0a838e.js} +2 -2
  24. package/dist/cjs/{sub-state-notify-slimmer-e264a120.js → sub-state-notify-slimmer-3b33e31c.js} +1 -1
  25. package/dist/cjs/{sub-state-observer-slimmer-6033b824.js → sub-state-observer-slimmer-5b68ba3f.js} +1 -1
  26. package/dist/cjs/{token-extension-8d7bd451.js → token-extension-4badb962.js} +9 -9
  27. package/dist/cjs/vega-accordion.cjs.entry.js +3 -3
  28. package/dist/cjs/vega-app-footer.cjs.entry.js +4 -4
  29. package/dist/cjs/vega-app-header-button.cjs.entry.js +4 -4
  30. package/dist/cjs/vega-banner.cjs.entry.js +3 -3
  31. package/dist/cjs/vega-brand-logo.cjs.entry.js +1 -1
  32. package/dist/cjs/vega-breadcrumb.cjs.entry.js +4 -4
  33. package/dist/cjs/vega-button-circle.cjs.entry.js +6 -6
  34. package/dist/cjs/vega-button-group_2.cjs.entry.js +7 -7
  35. package/dist/cjs/vega-button-link.cjs.entry.js +5 -5
  36. package/dist/cjs/vega-button.cjs.entry.js +6 -6
  37. package/dist/cjs/vega-calendar_5.cjs.entry.js +122 -16
  38. package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
  39. package/dist/cjs/vega-checkbox_2.cjs.entry.js +7 -7
  40. package/dist/cjs/vega-chip.cjs.entry.js +4 -4
  41. package/dist/cjs/vega-code-block.cjs.entry.js +9 -9
  42. package/dist/cjs/vega-color-picker.cjs.entry.js +6 -6
  43. package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +7 -7
  44. package/dist/cjs/vega-color-swatch.cjs.entry.js +3 -3
  45. package/dist/cjs/vega-combo-box.cjs.entry.js +7 -7
  46. package/dist/cjs/vega-date-picker_2.cjs.entry.js +11 -11
  47. package/dist/cjs/vega-dialog_2.cjs.entry.js +6 -6
  48. package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -9
  49. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  50. package/dist/cjs/{vega-event-id-58afed7a.js → vega-event-id-987a170c.js} +2 -0
  51. package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
  52. package/dist/cjs/vega-file-uploader.cjs.entry.js +6 -6
  53. package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -6
  54. package/dist/cjs/vega-form.cjs.entry.js +7 -7
  55. package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
  56. package/dist/cjs/vega-input-credit-card.cjs.entry.js +7 -7
  57. package/dist/cjs/vega-input-numeric.cjs.entry.js +8 -8
  58. package/dist/cjs/vega-input-passcode.cjs.entry.js +7 -7
  59. package/dist/cjs/vega-input-phone-number.cjs.entry.js +16 -269
  60. package/dist/cjs/vega-input-range.cjs.entry.js +7 -7
  61. package/dist/cjs/vega-input-select.cjs.entry.js +16 -33
  62. package/dist/cjs/vega-input.cjs.entry.js +8 -8
  63. package/dist/cjs/{vega-internal-event-id-f4d33037.js → vega-internal-event-id-98d499d7.js} +6 -2
  64. package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
  65. package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -7
  66. package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
  67. package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +4 -4
  68. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
  69. package/dist/cjs/vega-pagination.cjs.entry.js +5 -5
  70. package/dist/cjs/vega-popover_2.cjs.entry.js +6 -6
  71. package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +6 -6
  72. package/dist/cjs/vega-radio_2.cjs.entry.js +7 -7
  73. package/dist/cjs/vega-rich-text-content.cjs.entry.js +9 -9
  74. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +18 -18
  75. package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +3 -3
  76. package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +3 -3
  77. package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
  78. package/dist/cjs/vega-segment-control.cjs.entry.js +11 -4
  79. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -8
  80. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +8 -8
  81. package/dist/cjs/vega-sidenav_3.cjs.entry.js +6 -6
  82. package/dist/cjs/vega-signature-capture.cjs.entry.js +6 -6
  83. package/dist/cjs/vega-stepper.cjs.entry.js +7 -7
  84. package/dist/cjs/vega-tab-group_2.cjs.entry.js +4 -4
  85. package/dist/cjs/vega-table_11.cjs.entry.js +620 -661
  86. package/dist/cjs/vega-textarea.cjs.entry.js +7 -7
  87. package/dist/cjs/vega-time-picker_2.cjs.entry.js +8 -8
  88. package/dist/cjs/vega-toggle-switch.cjs.entry.js +6 -6
  89. package/dist/cjs/vega-tooltip_2.cjs.entry.js +2 -2
  90. package/dist/cjs/vega.cjs.js +13 -12
  91. package/dist/cjs/{wait-for-component-did-render-44d006ee.js → wait-for-component-did-render-90edbc1a.js} +1 -1
  92. package/dist/collection/components/vega-button/vega-button.css +3 -3
  93. package/dist/collection/components/vega-button-circle/vega-button-circle.css +3 -3
  94. package/dist/collection/components/vega-button-link/vega-button-link.css +4 -4
  95. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +45 -5
  96. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.js +43 -1
  97. package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.js +23 -4
  98. package/dist/collection/components/vega-calendar/vega-calendar.js +77 -1
  99. package/dist/collection/components/vega-flag-icon/slimmers/controllers/vega-flag-icon-controller.js +6 -6
  100. package/dist/collection/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.js +4 -8
  101. package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-prefix-icon-renderer.js +8 -28
  102. package/dist/collection/components/vega-input-select/vega-input-select.js +3 -1
  103. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +1 -2
  104. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +18 -6
  105. package/dist/collection/components/vega-segment-control/slimmers/renderers/vega-segment-renderer.js +8 -1
  106. package/dist/collection/components/vega-segment-control/vega-segment-control.js +23 -0
  107. package/dist/collection/components/vega-table/slimmers/controllers/dto/column-render-input-model.js +25 -8
  108. package/dist/collection/components/vega-table/slimmers/controllers/dto/row-render-input-model.js +41 -0
  109. package/dist/collection/components/vega-table/slimmers/controllers/vega-table-head-template-structure-controller.js +1 -0
  110. package/dist/collection/components/vega-table/slimmers/controllers/vega-table-render-input-controller.js +316 -18
  111. package/dist/collection/components/vega-table/slimmers/renderers/vega-table-body-renderer.js +6 -1
  112. package/dist/collection/components/vega-table/slimmers/renderers/vega-table-header-renderer.js +1 -0
  113. package/dist/collection/components/vega-table/slimmers/renderers/vega-table-pinned-renderer.js +33 -530
  114. package/dist/collection/components/vega-table/slimmers/renderers/vega-table-row-renderer.js +1 -0
  115. package/dist/collection/components/vega-table/vega-table-cell/vega-table-cell.css +10 -0
  116. package/dist/collection/components/vega-table/vega-table-cell/vega-table-cell.js +25 -8
  117. package/dist/collection/components/vega-table/vega-table-expand-row/slimmers/renderers/vega-table-expand-row-renderer.js +14 -6
  118. package/dist/collection/components/vega-table/vega-table-expand-row/vega-table-expand-row.css +20 -0
  119. package/dist/collection/components/vega-table/vega-table-expand-row/vega-table-expand-row.js +7 -0
  120. package/dist/collection/components/vega-table/vega-table-foot-cell/slimmers/renderers/vega-table-foot-cell-renderer.js +21 -2
  121. package/dist/collection/components/vega-table/vega-table-foot-cell/vega-table-foot-cell.css +10 -0
  122. package/dist/collection/components/vega-table/vega-table-foot-cell/vega-table-foot-cell.js +12 -1
  123. package/dist/collection/components/vega-table/vega-table-foot-row/slimmers/renderers/vega-table-foot-row-renderer.js +20 -13
  124. package/dist/collection/components/vega-table/vega-table-foot-row/vega-table-foot-row.css +26 -0
  125. package/dist/collection/components/vega-table/vega-table-foot-row/vega-table-foot-row.js +12 -0
  126. package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.css +10 -0
  127. package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.js +19 -6
  128. package/dist/collection/components/vega-table/vega-table-head-row/slimmers/renderers/vega-table-head-row-renderer.js +21 -46
  129. package/dist/collection/components/vega-table/vega-table-head-row/vega-table-head-row.css +16 -7
  130. package/dist/collection/components/vega-table/vega-table-head-row/vega-table-head-row.js +9 -2
  131. package/dist/collection/components/vega-table/vega-table-row/slimmers/renderers/vega-table-row-renderer.js +28 -13
  132. package/dist/collection/components/vega-table/vega-table-row/vega-table-row.css +26 -0
  133. package/dist/collection/components/vega-table/vega-table-row/vega-table-row.js +11 -0
  134. package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-border-tokens.js +1 -1
  135. package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-color-tokens.js +20 -20
  136. package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-ring-tokens.js +1 -1
  137. package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-shadow-tokens.js +1 -1
  138. package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-border-tokens.js +1 -1
  139. package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-color-tokens.js +19 -19
  140. package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-shadow-tokens.js +1 -1
  141. package/dist/collection/constants/ui.js +1 -0
  142. package/dist/collection/global/scripts/before-vega-load.js +8 -0
  143. package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +10 -2
  144. package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +1 -0
  145. package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +3 -1
  146. package/dist/collection/helpers/public-api.js +1 -0
  147. package/dist/collection/helpers/slimmers/position-calculation/position-calculation-controller.js +8 -0
  148. package/dist/collection/helpers/slimmers/position-calculation/screen-position-calculation-strategy.js +10 -0
  149. package/dist/collection/helpers/slimmers/vega-table-child-render-input-consumer-slimmer.js +2 -0
  150. package/dist/collection/helpers/ui/element-appender.js +1 -0
  151. package/dist/esm/{action-color-accessibility-validator-08877515.js → action-color-accessibility-validator-3e824a59.js} +1 -1
  152. package/dist/esm/{app-globals-1e1371d5.js → app-globals-ad3c7cea.js} +15 -7
  153. package/dist/esm/{aria-dialog-focusable-trap-slimmer-b2a24a45.js → aria-dialog-focusable-trap-slimmer-27a6aa19.js} +1 -1
  154. package/dist/esm/{child-nodes-event-prevent-slimmer-82626871.js → child-nodes-event-prevent-slimmer-0ebcbf47.js} +1 -1
  155. package/dist/esm/{code-block-741d6b8e.js → code-block-1cdf7a51.js} +793 -781
  156. package/dist/esm/{component-value-history-controller-slimmer.abstract-2bcd749e.js → component-value-history-controller-slimmer.abstract-bdeeb43f.js} +3 -3
  157. package/dist/esm/{content-state-2f6f4204.js → content-state-6eb610b8.js} +2 -2
  158. package/dist/esm/countries-50d3339b.js +249 -0
  159. package/dist/esm/{dark-mode-style-controller-352f15ff.js → dark-mode-style-controller-4e04a2d3.js} +45 -45
  160. package/dist/esm/{element-appender-slimmer-c820c0bf.js → element-appender-slimmer-dd4e2908.js} +20 -1
  161. package/dist/esm/{event-emit-slimmer-e8bb2292.js → event-emit-slimmer-12ee1593.js} +1 -1
  162. package/dist/esm/{form-field-controller-slimmer-02165dbe.js → form-field-controller-slimmer-5c794b4d.js} +2 -2
  163. package/dist/esm/{image-annotation-action-972c1074.js → image-annotation-action-cdd50dcc.js} +4 -4
  164. package/dist/esm/{image-extension-59484e9a.js → image-extension-f6dbd70c.js} +2 -2
  165. package/dist/esm/index.js +13 -12
  166. package/dist/esm/{internal-vega-event-manager-2ecc9186.js → internal-vega-event-manager-0c381f3b.js} +10 -2
  167. package/dist/esm/{link-extension-e89acb5c.js → link-extension-bc234cf7.js} +2 -2
  168. package/dist/esm/loader.js +13 -12
  169. package/dist/esm/{public-rules-c154201b.js → public-rules-8dc3fb00.js} +5 -5
  170. package/dist/esm/{range-c818a1eb.js → range-d2439ba7.js} +1 -1
  171. package/dist/esm/{rich-text-editor-required-rule-878e91c6.js → rich-text-editor-required-rule-a0663a84.js} +1 -1
  172. package/dist/esm/{split-cell-operation-cc0cdf90.js → split-cell-operation-1a889fa0.js} +3 -3
  173. package/dist/esm/{string-input-formatter-slimmer-76fe52d3.js → string-input-formatter-slimmer-69887c40.js} +2 -2
  174. package/dist/esm/{sub-state-notify-slimmer-e306c849.js → sub-state-notify-slimmer-ba72f30b.js} +1 -1
  175. package/dist/esm/{sub-state-observer-slimmer-bd85f381.js → sub-state-observer-slimmer-bee1c7fa.js} +1 -1
  176. package/dist/esm/{token-extension-35c66684.js → token-extension-530d9bde.js} +9 -9
  177. package/dist/esm/vega-accordion.entry.js +3 -3
  178. package/dist/esm/vega-app-footer.entry.js +4 -4
  179. package/dist/esm/vega-app-header-button.entry.js +4 -4
  180. package/dist/esm/vega-banner.entry.js +3 -3
  181. package/dist/esm/vega-brand-logo.entry.js +1 -1
  182. package/dist/esm/vega-breadcrumb.entry.js +4 -4
  183. package/dist/esm/vega-button-circle.entry.js +6 -6
  184. package/dist/esm/vega-button-group_2.entry.js +7 -7
  185. package/dist/esm/vega-button-link.entry.js +5 -5
  186. package/dist/esm/vega-button.entry.js +6 -6
  187. package/dist/esm/vega-calendar_5.entry.js +122 -16
  188. package/dist/esm/vega-carousel.entry.js +3 -3
  189. package/dist/esm/vega-checkbox_2.entry.js +7 -7
  190. package/dist/esm/vega-chip.entry.js +4 -4
  191. package/dist/esm/vega-code-block.entry.js +9 -9
  192. package/dist/esm/vega-color-picker.entry.js +6 -6
  193. package/dist/esm/vega-color-swatch-picker.entry.js +7 -7
  194. package/dist/esm/vega-color-swatch.entry.js +3 -3
  195. package/dist/esm/vega-combo-box.entry.js +7 -7
  196. package/dist/esm/vega-date-picker_2.entry.js +11 -11
  197. package/dist/esm/vega-dialog_2.entry.js +6 -6
  198. package/dist/esm/vega-dropdown_5.entry.js +9 -9
  199. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  200. package/dist/esm/{vega-event-id-f55f6977.js → vega-event-id-59cd9297.js} +2 -1
  201. package/dist/esm/vega-field-label.entry.js +3 -3
  202. package/dist/esm/vega-file-uploader.entry.js +6 -6
  203. package/dist/esm/vega-flag-icon.entry.js +6 -6
  204. package/dist/esm/vega-form.entry.js +7 -7
  205. package/dist/esm/vega-image-uploader.entry.js +8 -8
  206. package/dist/esm/vega-input-credit-card.entry.js +7 -7
  207. package/dist/esm/vega-input-numeric.entry.js +8 -8
  208. package/dist/esm/vega-input-passcode.entry.js +7 -7
  209. package/dist/esm/vega-input-phone-number.entry.js +13 -266
  210. package/dist/esm/vega-input-range.entry.js +7 -7
  211. package/dist/esm/vega-input-select.entry.js +17 -34
  212. package/dist/esm/vega-input.entry.js +8 -8
  213. package/dist/esm/{vega-internal-event-id-86fce049.js → vega-internal-event-id-02093067.js} +4 -2
  214. package/dist/esm/vega-item-toggle.entry.js +3 -3
  215. package/dist/esm/vega-left-nav_5.entry.js +7 -7
  216. package/dist/esm/vega-page-notification_2.entry.js +1 -1
  217. package/dist/esm/vega-pagination-page-selector-mobile.entry.js +4 -4
  218. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
  219. package/dist/esm/vega-pagination.entry.js +5 -5
  220. package/dist/esm/vega-popover_2.entry.js +6 -6
  221. package/dist/esm/vega-progress-tracker_2.entry.js +6 -6
  222. package/dist/esm/vega-radio_2.entry.js +7 -7
  223. package/dist/esm/vega-rich-text-content.entry.js +9 -9
  224. package/dist/esm/vega-rich-text-editor_4.entry.js +18 -18
  225. package/dist/esm/vega-rich-text-find-replace-panel.entry.js +3 -3
  226. package/dist/esm/vega-rich-text-special-characters-panel.entry.js +3 -3
  227. package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
  228. package/dist/esm/vega-segment-control.entry.js +11 -4
  229. package/dist/esm/vega-selection-chip_2.entry.js +8 -8
  230. package/dist/esm/vega-selection-tile_2.entry.js +8 -8
  231. package/dist/esm/vega-sidenav_3.entry.js +6 -6
  232. package/dist/esm/vega-signature-capture.entry.js +6 -6
  233. package/dist/esm/vega-stepper.entry.js +7 -7
  234. package/dist/esm/vega-tab-group_2.entry.js +4 -4
  235. package/dist/esm/vega-table_11.entry.js +620 -661
  236. package/dist/esm/vega-textarea.entry.js +7 -7
  237. package/dist/esm/vega-time-picker_2.entry.js +8 -8
  238. package/dist/esm/vega-toggle-switch.entry.js +6 -6
  239. package/dist/esm/vega-tooltip_2.entry.js +2 -2
  240. package/dist/esm/vega.js +13 -12
  241. package/dist/esm/{wait-for-component-did-render-9b91a826.js → wait-for-component-did-render-9e84d92d.js} +1 -1
  242. package/dist/sri/vega-sri-manifest.json +308 -304
  243. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.d.ts +18 -0
  244. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.d.ts +9 -0
  245. package/dist/types/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.d.ts +9 -1
  246. package/dist/types/components/vega-calendar/types.d.ts +22 -0
  247. package/dist/types/components/vega-calendar/vega-calendar.d.ts +23 -1
  248. package/dist/types/components/vega-flag-icon/slimmers/controllers/vega-flag-icon-controller.d.ts +2 -2
  249. package/dist/types/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.d.ts +0 -1
  250. package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-prefix-icon-renderer.d.ts +2 -14
  251. package/dist/types/components/vega-input-select/vega-input-select.d.ts +1 -0
  252. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +11 -1
  253. package/dist/types/components/vega-segment-control/slimmers/renderers/vega-segment-renderer.d.ts +1 -0
  254. package/dist/types/components/vega-segment-control/types.d.ts +2 -0
  255. package/dist/types/components/vega-segment-control/vega-segment-control.d.ts +7 -1
  256. package/dist/types/components/vega-table/slimmers/controllers/dto/column-render-input-model.d.ts +17 -0
  257. package/dist/types/components/vega-table/slimmers/controllers/dto/row-render-input-model.d.ts +39 -0
  258. package/dist/types/components/vega-table/slimmers/controllers/vega-table-render-input-controller.d.ts +71 -7
  259. package/dist/types/components/vega-table/slimmers/renderers/vega-table-body-renderer.d.ts +1 -0
  260. package/dist/types/components/vega-table/slimmers/renderers/vega-table-pinned-renderer.d.ts +3 -88
  261. package/dist/types/components/vega-table/vega-table-expand-row/slimmers/renderers/vega-table-expand-row-renderer.d.ts +1 -1
  262. package/dist/types/components/vega-table/vega-table-expand-row/vega-table-expand-row.d.ts +5 -0
  263. package/dist/types/components/vega-table/vega-table-foot-cell/slimmers/renderers/vega-table-foot-cell-renderer.d.ts +1 -0
  264. package/dist/types/components/vega-table/vega-table-foot-cell/vega-table-foot-cell.d.ts +5 -0
  265. package/dist/types/components/vega-table/vega-table-foot-row/slimmers/renderers/vega-table-foot-row-renderer.d.ts +1 -3
  266. package/dist/types/components/vega-table/vega-table-foot-row/vega-table-foot-row.d.ts +5 -0
  267. package/dist/types/components/vega-table/vega-table-head-row/slimmers/renderers/vega-table-head-row-renderer.d.ts +0 -4
  268. package/dist/types/components/vega-table/vega-table-head-row/vega-table-head-row.d.ts +2 -2
  269. package/dist/types/components/vega-table/vega-table-row/slimmers/renderers/vega-table-row-renderer.d.ts +2 -3
  270. package/dist/types/components/vega-table/vega-table-row/vega-table-row.d.ts +4 -0
  271. package/dist/types/components.d.ts +33 -2
  272. package/dist/types/constants/ui.d.ts +1 -1
  273. package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +1 -0
  274. package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +3 -1
  275. package/dist/types/helpers/public-api.d.ts +1 -0
  276. package/dist/types/helpers/slimmers/position-calculation/position-calculation-controller.d.ts +6 -0
  277. package/dist/types/helpers/slimmers/position-calculation/screen-position-calculation-strategy.d.ts +6 -0
  278. package/dist/types/helpers/slimmers/position-calculation/screen-scroll-position-update.d.ts +2 -1
  279. package/dist/types/helpers/slimmers/vega-table-child-render-input-consumer-slimmer.d.ts +2 -1
  280. package/dist/types/types/components.type.d.ts +7 -1
  281. package/dist/types/types/public-api.d.ts +1 -0
  282. package/dist/vega/index.esm.js +1 -1
  283. package/dist/vega/{p-85de755f.js → p-022cbf8a.js} +1 -1
  284. package/dist/vega/{p-284a8828.entry.js → p-02c1284e.entry.js} +1 -1
  285. package/dist/vega/{p-a488447f.js → p-069bbb4a.js} +1 -1
  286. package/dist/vega/{p-9efa5d76.js → p-08fd229c.js} +1 -1
  287. package/dist/vega/{p-e11c6ec4.entry.js → p-131ce9df.entry.js} +1 -1
  288. package/dist/vega/{p-bedb575c.entry.js → p-143ee395.entry.js} +1 -1
  289. package/dist/vega/p-178634f3.js +1 -0
  290. package/dist/vega/{p-9e9f49f4.js → p-1836a6a5.js} +1 -1
  291. package/dist/vega/p-1dbf8d1f.js +1 -0
  292. package/dist/vega/p-2dda5c65.entry.js +1 -0
  293. package/dist/vega/{p-3abb793c.entry.js → p-30010c41.entry.js} +1 -1
  294. package/dist/vega/p-32f5a6dd.entry.js +1 -0
  295. package/dist/vega/{p-7ddc0bec.entry.js → p-3460a1c5.entry.js} +1 -1
  296. package/dist/vega/{p-b07f587a.entry.js → p-34b523da.entry.js} +1 -1
  297. package/dist/vega/{p-5b9b1631.entry.js → p-357c0226.entry.js} +1 -1
  298. package/dist/vega/p-361f8996.js +1 -0
  299. package/dist/vega/p-36ee9d54.js +1 -0
  300. package/dist/vega/{p-2c8dc0d2.entry.js → p-37d5c37e.entry.js} +1 -1
  301. package/dist/vega/{p-3f2a4b34.entry.js → p-45ad2d90.entry.js} +1 -1
  302. package/dist/vega/{p-5d9be870.entry.js → p-4b117bfd.entry.js} +1 -1
  303. package/dist/vega/p-4e70836a.entry.js +1 -0
  304. package/dist/vega/{p-8fc0a820.js → p-4ea477d5.js} +1 -1
  305. package/dist/vega/{p-cd0a108b.entry.js → p-50e8e24f.entry.js} +1 -1
  306. package/dist/vega/{p-7e22610b.entry.js → p-522a6eec.entry.js} +1 -1
  307. package/dist/vega/p-53e3f259.js +1 -0
  308. package/dist/vega/{p-2c737fc8.js → p-5536146c.js} +1 -1
  309. package/dist/vega/{p-5789690b.entry.js → p-55c2c0df.entry.js} +1 -1
  310. package/dist/vega/p-587130f6.entry.js +1 -0
  311. package/dist/vega/{p-379736e2.js → p-58c8a4ac.js} +1 -1
  312. package/dist/vega/{p-c422ee02.entry.js → p-5c17ddda.entry.js} +1 -1
  313. package/dist/vega/{p-ea1a0046.entry.js → p-5c9c0c0d.entry.js} +1 -1
  314. package/dist/vega/p-5f377954.js +1 -1
  315. package/dist/vega/p-60010f14.entry.js +1 -0
  316. package/dist/vega/p-6098c4bb.js +1 -0
  317. package/dist/vega/{p-debf9e06.entry.js → p-61e63c0e.entry.js} +1 -1
  318. package/dist/vega/{p-7469d0d1.entry.js → p-62254dc7.entry.js} +1 -1
  319. package/dist/vega/{p-7a03ef96.entry.js → p-62ae9327.entry.js} +1 -1
  320. package/dist/vega/p-66245bc0.entry.js +1 -0
  321. package/dist/vega/{p-46f22f6c.entry.js → p-68ca8d3c.entry.js} +1 -1
  322. package/dist/vega/p-6a6c1279.js +1 -0
  323. package/dist/vega/{p-61ed7268.entry.js → p-6ae93679.entry.js} +1 -1
  324. package/dist/vega/{p-c7d46740.entry.js → p-6d90d28d.entry.js} +1 -1
  325. package/dist/vega/{p-6fd8f14b.js → p-6fae6768.js} +1 -1
  326. package/dist/vega/{p-8cfdd0e8.entry.js → p-71813a9e.entry.js} +1 -1
  327. package/dist/vega/{p-816b5fd2.entry.js → p-729529d6.entry.js} +1 -1
  328. package/dist/vega/{p-7ae4cf82.entry.js → p-75bfbffe.entry.js} +1 -1
  329. package/dist/vega/{p-bfe5dff7.entry.js → p-764b4e51.entry.js} +1 -1
  330. package/dist/vega/{p-5c3649f9.js → p-7d3419c7.js} +1 -1
  331. package/dist/vega/{p-a48468b5.entry.js → p-8e8b5790.entry.js} +1 -1
  332. package/dist/vega/{p-bc0e5598.entry.js → p-9236b8d9.entry.js} +1 -1
  333. package/dist/vega/p-9402f32f.js +1 -0
  334. package/dist/vega/{p-02b5d4ac.entry.js → p-942f9ea6.entry.js} +1 -1
  335. package/dist/vega/{p-c032f626.entry.js → p-9fdf66a8.entry.js} +1 -1
  336. package/dist/vega/{p-edd7aa92.entry.js → p-a2c45173.entry.js} +1 -1
  337. package/dist/vega/{p-ab253867.entry.js → p-a54ed341.entry.js} +1 -1
  338. package/dist/vega/{p-0f344e02.entry.js → p-a8a246e8.entry.js} +1 -1
  339. package/dist/vega/{p-bc119e75.entry.js → p-af0e9bd5.entry.js} +1 -1
  340. package/dist/vega/p-b1557bbe.js +1 -0
  341. package/dist/vega/p-b94f164a.entry.js +1 -0
  342. package/dist/vega/{p-01ca92e6.entry.js → p-bbfffe6b.entry.js} +1 -1
  343. package/dist/vega/{p-5006404e.entry.js → p-beccc38c.entry.js} +1 -1
  344. package/dist/vega/{p-b52d7724.js → p-c51de680.js} +1 -1
  345. package/dist/vega/{p-fe985b52.js → p-c601eea6.js} +1 -1
  346. package/dist/vega/{p-d340ee3d.entry.js → p-c6d2513c.entry.js} +1 -1
  347. package/dist/vega/{p-4d1896e0.entry.js → p-ca6bd3a0.entry.js} +1 -1
  348. package/dist/vega/{p-411cadbc.entry.js → p-cab890be.entry.js} +1 -1
  349. package/dist/vega/p-cb1cd15f.entry.js +1 -0
  350. package/dist/vega/p-d1f47512.js +1 -0
  351. package/dist/vega/{p-23db0a92.entry.js → p-d37d2ea4.entry.js} +1 -1
  352. package/dist/vega/{p-76999ea1.entry.js → p-d3e99d4a.entry.js} +1 -1
  353. package/dist/vega/{p-7cc8855d.entry.js → p-d6bd3ce4.entry.js} +1 -1
  354. package/dist/vega/{p-cd04b149.entry.js → p-d7838f6e.entry.js} +1 -1
  355. package/dist/vega/{p-79b49e8d.entry.js → p-d8c9ea46.entry.js} +1 -1
  356. package/dist/vega/p-d9588b3f.entry.js +1 -0
  357. package/dist/vega/{p-74b20563.entry.js → p-db69a5c9.entry.js} +1 -1
  358. package/dist/vega/{p-9ba2fdff.js → p-de1d0284.js} +1 -1
  359. package/dist/vega/{p-e0a51e49.js → p-de6fc52c.js} +1 -1
  360. package/dist/vega/{p-efc08027.entry.js → p-e48b7a8a.entry.js} +1 -1
  361. package/dist/vega/{p-d897acd5.js → p-e6f67a44.js} +1 -1
  362. package/dist/vega/{p-844ad6aa.entry.js → p-e8e3bf74.entry.js} +1 -1
  363. package/dist/vega/p-eadc10bc.entry.js +1 -0
  364. package/dist/vega/p-ee329596.entry.js +1 -0
  365. package/dist/vega/p-f01bc6a2.js +1 -0
  366. package/dist/vega/p-f324e90e.js +1 -0
  367. package/dist/vega/{p-493108d5.js → p-f48519d2.js} +1 -1
  368. package/dist/vega/{p-35d37477.entry.js → p-f8d13d01.entry.js} +1 -1
  369. package/dist/vega/{p-aaaf21eb.entry.js → p-f99f054c.entry.js} +1 -1
  370. package/dist/vega/{p-49de5559.entry.js → p-fe41e3b6.entry.js} +1 -1
  371. package/dist/vega/vega.esm.js +1 -1
  372. package/package.json +1 -1
  373. package/dist/vega/p-06a42a9f.entry.js +0 -1
  374. package/dist/vega/p-0cd362f3.entry.js +0 -1
  375. package/dist/vega/p-0e10798b.entry.js +0 -1
  376. package/dist/vega/p-401c6764.js +0 -1
  377. package/dist/vega/p-4a2fe3a4.js +0 -1
  378. package/dist/vega/p-5447a8e8.js +0 -1
  379. package/dist/vega/p-5a086e93.js +0 -1
  380. package/dist/vega/p-5b3c8a56.js +0 -1
  381. package/dist/vega/p-6336d446.entry.js +0 -1
  382. package/dist/vega/p-7f395622.entry.js +0 -1
  383. package/dist/vega/p-8663314e.js +0 -1
  384. package/dist/vega/p-86fb46d2.entry.js +0 -1
  385. package/dist/vega/p-8c30a60d.js +0 -1
  386. package/dist/vega/p-9034f709.js +0 -1
  387. package/dist/vega/p-a306bb39.js +0 -1
  388. package/dist/vega/p-a647c856.entry.js +0 -1
  389. package/dist/vega/p-a92cd703.js +0 -1
  390. package/dist/vega/p-ad367b48.entry.js +0 -1
  391. package/dist/vega/p-d1bb6e7a.entry.js +0 -1
  392. package/dist/vega/p-e5abc288.entry.js +0 -1
  393. package/dist/vega/p-ef1bbf14.js +0 -1
  394. package/dist/vega/p-f8bf379c.entry.js +0 -1
@@ -2,13 +2,13 @@
2
2
 
3
3
  const changeManager = require('./change-manager-a297e4d2.js');
4
4
  const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-c82df135.js');
5
- const vegaInternalEventId = require('./vega-internal-event-id-f4d33037.js');
5
+ const vegaInternalEventId = require('./vega-internal-event-id-98d499d7.js');
6
6
  const string = require('./string-39438062.js');
7
7
  const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
8
8
  const typeGuard = require('./type-guard-00b8efc0.js');
9
9
  const typography = require('./typography-3ea4fe41.js');
10
10
  const misc = require('./misc-3d30df91.js');
11
- const darkModeStyleController = require('./dark-mode-style-controller-f3da3342.js');
11
+ const darkModeStyleController = require('./dark-mode-style-controller-ec04ece9.js');
12
12
  const object = require('./object-b53e9416.js');
13
13
  const ui = require('./ui-c91c37a7.js');
14
14
 
@@ -2035,22 +2035,654 @@ class RTEBlock {
2035
2035
  }
2036
2036
  }
2037
2037
 
2038
+ /**
2039
+ * Append children to a block or rte content
2040
+ *
2041
+ * @example parent.apply(new AppendChildrenAction([newChildren]))
2042
+ */
2043
+ class AppendChildrenAction extends ModifyContentAction {
2044
+ constructor(childNodes) {
2045
+ super();
2046
+ this.type = exports.ModifyContentActionType.APPEND_CHILDREN;
2047
+ this.entityToBeAppended = childNodes;
2048
+ }
2049
+ }
2050
+
2051
+ const TEXT_STYLE_DEFAULT_FONT_WEIGHT = '500';
2052
+ const TEXT_STYLE_BASE = {
2053
+ fontFamily: 'Inter',
2054
+ fontSize: '16px',
2055
+ lineHeight: '22px',
2056
+ minHeight: '22px',
2057
+ fontWeight: TEXT_STYLE_DEFAULT_FONT_WEIGHT,
2058
+ };
2059
+ const PARAGRAPH_TEXT_STYLE = Object.assign(Object.assign({}, TEXT_STYLE_BASE), { marginTop: '0px', marginBottom: '0px' });
2060
+ const TEXT_STYLE_DEFAULTS = {
2061
+ 'paragraph': PARAGRAPH_TEXT_STYLE,
2062
+ 'title': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '36px', lineHeight: '40px', minHeight: '40px' }),
2063
+ 'subtitle': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '28px', lineHeight: '32px', minHeight: '32px' }),
2064
+ 'heading-1': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '22px', lineHeight: '24px', minHeight: '24px' }),
2065
+ 'heading-2': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '20px', lineHeight: '24px', minHeight: '24px' }),
2066
+ 'heading-3': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '18px' }),
2067
+ 'heading-4': Object.assign({}, PARAGRAPH_TEXT_STYLE),
2068
+ 'heading-5': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '14px' }),
2069
+ 'heading-6': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '12px' }),
2070
+ };
2071
+
2072
+ /**
2073
+ * Text style annotation
2074
+ */
2075
+ class TextStyleAnnotation extends BlockAnnotation {
2076
+ constructor(textStyle) {
2077
+ super();
2078
+ this.type = exports.BlockAnnotationTypeEnum.TEXT_STYLE;
2079
+ this.textStyle = textStyle;
2080
+ }
2081
+ /**
2082
+ * Generate the map item for the annotations
2083
+ *
2084
+ * @param {VegaRTETextStyleType} textStyle - the text style type
2085
+ * @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
2086
+ */
2087
+ static from(textStyle) {
2088
+ return [exports.BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
2089
+ }
2090
+ /**
2091
+ * Get the default styles for a given text style type.
2092
+ *
2093
+ * @param {VegaRTETextStyleType} textStyle - The text style type.
2094
+ * @returns {Nullable<AnnotationStyle>} The default styles for the given text style type.
2095
+ */
2096
+ static getDefaultStyles(textStyle) {
2097
+ if (!textStyle)
2098
+ return null;
2099
+ return TEXT_STYLE_DEFAULTS[textStyle];
2100
+ }
2101
+ /**
2102
+ * Generate the JSON representation of the annotation
2103
+ *
2104
+ * @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
2105
+ */
2106
+ toJSON() {
2107
+ return { textStyle: this.textStyle };
2108
+ }
2109
+ /**
2110
+ * @inheritDoc
2111
+ */
2112
+ clone() {
2113
+ return new TextStyleAnnotation(this.textStyle);
2114
+ }
2115
+ /**
2116
+ * @inheritDoc
2117
+ */
2118
+ renderClass(options) {
2119
+ if (options === null || options === void 0 ? void 0 : options.standalone)
2120
+ return null;
2121
+ return this.textStyle ? `v-rte--text-style-${this.textStyle}` : null;
2122
+ }
2123
+ /**
2124
+ * @inheritDoc
2125
+ */
2126
+ renderStyle(options) {
2127
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
2128
+ return null;
2129
+ return this.textStyle ? TextStyleAnnotation.getDefaultStyles(this.textStyle) : null;
2130
+ }
2131
+ }
2132
+
2038
2133
  /**
2039
2134
  * Abstract class for annotation actions
2040
2135
  */
2041
- class AnnotationAction {
2136
+ class AnnotationAction {
2137
+ }
2138
+
2139
+ /**
2140
+ * Action to change the text style of a block
2141
+ */
2142
+ class TextStyleAnnotationAction extends AnnotationAction {
2143
+ constructor(textStyle, bold) {
2144
+ super();
2145
+ this.isFlushable = true;
2146
+ this.textStyle = textStyle;
2147
+ this.bold = bold;
2148
+ }
2149
+ /**
2150
+ * Converts the action to a block annotation
2151
+ *
2152
+ * @returns {BlockAnnotation} the block annotation
2153
+ */
2154
+ toAnnotation() {
2155
+ return new TextStyleAnnotation(this.textStyle);
2156
+ }
2157
+ }
2158
+
2159
+ /**
2160
+ * Annotation to make text a link
2161
+ */
2162
+ class LinkAnnotation extends NodeAnnotation {
2163
+ constructor(link, useInternalStyle = true) {
2164
+ super();
2165
+ this.type = exports.NodeAnnotationTypeEnum.LINK;
2166
+ this.link = link;
2167
+ this.useInternalStyle = useInternalStyle;
2168
+ }
2169
+ /**
2170
+ * Generate the map item for the annotation
2171
+ *
2172
+ * @param {VegaRTELink} link - Bold annotation
2173
+ * @param {boolean} useInternalStyle - Whether to use default style for the link
2174
+ * @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
2175
+ */
2176
+ static from(link, useInternalStyle = true) {
2177
+ return [exports.NodeAnnotationTypeEnum.LINK, new LinkAnnotation(link, useInternalStyle)];
2178
+ }
2179
+ /**
2180
+ * Generate the JSON representation of the annotation
2181
+ *
2182
+ * @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
2183
+ */
2184
+ toJSON() {
2185
+ return {
2186
+ link: this.link,
2187
+ };
2188
+ }
2189
+ /**
2190
+ * @inheritDoc
2191
+ */
2192
+ clone() {
2193
+ return new LinkAnnotation(this.link, this.useInternalStyle);
2194
+ }
2195
+ /**
2196
+ * Verify whether two link annotation is same or not
2197
+ *
2198
+ * @param {LinkAnnotation} annotation - Compared annotation
2199
+ * @returns {boolean} Whether two link annotation is same or not
2200
+ */
2201
+ toEqual(annotation) {
2202
+ return this.link.groupKey === annotation.link.groupKey;
2203
+ }
2204
+ /**
2205
+ * @inheritDoc
2206
+ */
2207
+ renderClass() {
2208
+ return null;
2209
+ }
2210
+ /**
2211
+ * @inheritDoc
2212
+ */
2213
+ renderStyle() {
2214
+ return null;
2215
+ }
2216
+ }
2217
+
2218
+ /**
2219
+ * Abstract class for which can be splittable
2220
+ */
2221
+ class TextSplittableAction extends AnnotationAction {
2222
+ constructor() {
2223
+ super(...arguments);
2224
+ /**
2225
+ * Whether the action should split the node
2226
+ */
2227
+ this.doSplit = true;
2228
+ }
2229
+ }
2230
+
2231
+ /**
2232
+ * Action to toggle link annotation
2233
+ */
2234
+ class LinkAnnotationAction extends TextSplittableAction {
2235
+ constructor({ link, newText, needMergeNode, doSplit, type, }) {
2236
+ super();
2237
+ this.isFlushable = true;
2238
+ this.link = link;
2239
+ this.needMergeNode = needMergeNode;
2240
+ this.newText = newText;
2241
+ this.type = type;
2242
+ if (typeGuard.isNonNullable(doSplit)) {
2243
+ this.doSplit = doSplit;
2244
+ }
2245
+ }
2246
+ /**
2247
+ * Converts the action to an annotation
2248
+ *
2249
+ * @returns {LinkAnnotation} the annotation
2250
+ */
2251
+ toAnnotation() {
2252
+ return new LinkAnnotation(this.link);
2253
+ }
2254
+ }
2255
+
2256
+ /**
2257
+ * Action to link a group of nodes
2258
+ */
2259
+ class LinkGroupAnnotationAction extends AnnotationAction {
2260
+ constructor(groupKey, nodes, type) {
2261
+ super();
2262
+ this.isFlushable = false;
2263
+ this.groupKey = groupKey;
2264
+ this.nodes = nodes;
2265
+ this.type = type;
2266
+ }
2267
+ /**
2268
+ * Converts the action to an annotation
2269
+ *
2270
+ * @returns {Annotation} The annotation
2271
+ */
2272
+ toAnnotation() {
2273
+ return new LinkGroupAnnotation(this.groupKey);
2274
+ }
2275
+ }
2276
+
2277
+ /**
2278
+ * Default CSS style values produced by inline text-formatting annotations.
2279
+ *
2280
+ * These constants are the single source of truth for the CSS values that
2281
+ * bold, italic, underline and strikethrough semantic annotations render as
2282
+ * (in standalone mode) and that annotation handlers / filter strategies use
2283
+ * to detect or remove redundant inline styles.
2284
+ */
2285
+ /** CSS `font-weight` value rendered by the bold annotation. */
2286
+ const BOLD_FONT_WEIGHT = '700';
2287
+ /** Alternative `font-weight` keyword that browsers report for bold elements. */
2288
+ const BOLD_FONT_WEIGHT_KEYWORD = 'bold';
2289
+ /** CSS `font-style` value rendered by the italic annotation. */
2290
+ const ITALIC_FONT_STYLE = 'italic';
2291
+ /** CSS `text-decoration` token rendered by the underline annotation. */
2292
+ const UNDERLINE_TEXT_DECORATION = 'underline';
2293
+ /** CSS `text-decoration` token rendered by the strikethrough annotation. */
2294
+ const STRIKETHROUGH_TEXT_DECORATION = 'line-through';
2295
+ /** CSS `font-family` value rendered by the code annotation. */
2296
+ const CODE_FONT_FAMILY = 'Roboto Mono';
2297
+ /** CSS `white-space` value rendered by the code annotation. */
2298
+ const CODE_WHITE_SPACE = 'pre-wrap';
2299
+
2300
+ /**
2301
+ * Annotation to make text bold
2302
+ */
2303
+ class BoldAnnotation extends NodeAnnotation {
2304
+ constructor(bold) {
2305
+ super();
2306
+ this.type = exports.NodeAnnotationTypeEnum.BOLD;
2307
+ this.bold = bold;
2308
+ }
2309
+ /**
2310
+ * Generate the map item for the annotation
2311
+ *
2312
+ * @param {boolean} bold - Bold annotation
2313
+ * @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
2314
+ */
2315
+ static from(bold) {
2316
+ return [exports.NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
2317
+ }
2318
+ /**
2319
+ * Generate the JSON representation of the annotation
2320
+ *
2321
+ * @returns {Record<string, unknown>} JSON representation of the annotation
2322
+ */
2323
+ toJSON() {
2324
+ return {
2325
+ bold: this.bold,
2326
+ };
2327
+ }
2328
+ /**
2329
+ * @inheritDoc
2330
+ */
2331
+ clone() {
2332
+ return new BoldAnnotation(this.bold);
2333
+ }
2334
+ /**
2335
+ * @inheritDoc
2336
+ */
2337
+ renderClass(options) {
2338
+ if (options === null || options === void 0 ? void 0 : options.standalone)
2339
+ return null;
2340
+ return this.bold ? 'v-rte--bold' : null;
2341
+ }
2342
+ /**
2343
+ * @inheritDoc
2344
+ */
2345
+ renderStyle(options) {
2346
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
2347
+ return null;
2348
+ return this.bold ? { fontWeight: BOLD_FONT_WEIGHT } : null;
2349
+ }
2350
+ }
2351
+
2352
+ /**
2353
+ * Action to toggle bold annotation
2354
+ */
2355
+ class BoldAnnotationAction extends TextSplittableAction {
2356
+ constructor(bold) {
2357
+ super();
2358
+ this.isFlushable = true;
2359
+ this.bold = bold;
2360
+ }
2361
+ /**
2362
+ * Converts the action to an annotation
2363
+ *
2364
+ * @returns {BoldAnnotation} the annotation
2365
+ */
2366
+ toAnnotation() {
2367
+ return new BoldAnnotation(this.bold);
2368
+ }
2369
+ }
2370
+
2371
+ /**
2372
+ * Delete the node annotation by type
2373
+ */
2374
+ class DeleteNodeAnnotationAction extends AnnotationAction {
2375
+ constructor(annotationType) {
2376
+ super();
2377
+ this.isFlushable = true;
2378
+ this.annotationType = annotationType;
2379
+ }
2380
+ /**
2381
+ * Don't need this for this action
2382
+ *
2383
+ * @returns {Nullable<Annotation>} undefined
2384
+ */
2385
+ toAnnotation() {
2386
+ return undefined;
2387
+ }
2388
+ }
2389
+
2390
+ /**
2391
+ * The base action handle strategy class, use to modify the rich text node content or modify the annotation.
2392
+ */
2393
+ class ActionHandleStrategy {
2394
+ /**
2395
+ * Public method to invoke the handle logic.
2396
+ *
2397
+ * @typedef R generic type
2398
+ * @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
2399
+ * @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
2400
+ * @returns {R} - The invoke result in special strategy.
2401
+ */
2402
+ execute(action, target) {
2403
+ globalSlimmerRegistry.LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
2404
+ return this.handleAction(action, target);
2405
+ }
2406
+ /**
2407
+ * Update the custom style annotation of a block or node
2408
+ *
2409
+ * @param {RTEBlock | RTETextNode} item - block or node
2410
+ * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
2411
+ */
2412
+ updateCustomStyleAnnotation(item, styleKeys) {
2413
+ const customStyleAnnotation = item.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_STYLE);
2414
+ if (customStyleAnnotation && this.isCustomStyle(customStyleAnnotation, styleKeys)) {
2415
+ item.annotationMap.set(customStyleAnnotation.type, new CustomStyleAnnotation(customStyleAnnotation.removeStyles(styleKeys)));
2416
+ }
2417
+ }
2418
+ /**
2419
+ * Create a new paragraph block with the given text.
2420
+ *
2421
+ * @param {string} text - The text content for the new paragraph.
2422
+ * @returns {Nullable<RTETextBlock>} - The newly created paragraph block, or null if creation failed.
2423
+ */
2424
+ createNewParagraph(text) {
2425
+ const dtoClass = RTEDTOClassManager$1.getRTEBlockClass('paragraph');
2426
+ if (dtoClass) {
2427
+ const newParagraph = dtoClass.from({
2428
+ id: misc.generateUUID(),
2429
+ type: 'paragraph',
2430
+ nodes: [{ id: misc.generateUUID(), type: 'text', text }],
2431
+ });
2432
+ return newParagraph;
2433
+ }
2434
+ }
2435
+ /**
2436
+ * Get the root content from a child block or node.
2437
+ *
2438
+ * @param {RTEBlock | RTENode} child - The child block or node.
2439
+ * @returns {Nullable<VegaRTEContent>} The root content, if found.
2440
+ */
2441
+ getRootContent(child) {
2442
+ const parent = child.parent;
2443
+ if (parent) {
2444
+ if (parent.dtoName === 'VegaRTEContent') {
2445
+ return parent;
2446
+ }
2447
+ else {
2448
+ return this.getRootContent(parent);
2449
+ }
2450
+ }
2451
+ }
2452
+ /**
2453
+ * Check the caret position at the start of a block.
2454
+ *
2455
+ * @param {RTEBlock} block - The RTE Block.
2456
+ * @param {RTENode} node - The RTE Node.
2457
+ * @param {number} offset - The offset position.
2458
+ * @returns {boolean} - Whether the caret is at the start of the block.
2459
+ */
2460
+ isCaretPositionAtBlockStart(block, node, offset) {
2461
+ return node === block.children[0] && offset === 0;
2462
+ }
2463
+ /**
2464
+ * Check the caret position at the end of a block.
2465
+ *
2466
+ * @param {RTEBlock} block - The RTE Block.
2467
+ * @param {RTENode} node - The RTE Node.
2468
+ * @param {number} offset - The offset position.
2469
+ * @returns {boolean} - Whether the caret is at the end of the block.
2470
+ */
2471
+ isCaretPositionAtBlockEnd(block, node, offset) {
2472
+ if (!node.isContentEditable()) {
2473
+ return this.isCaretPositionAtDecoratorBlockEnd(block, node, offset);
2474
+ }
2475
+ else {
2476
+ return this.isCaretPositionAtTextBlockEnd(block, node, offset);
2477
+ }
2478
+ }
2479
+ /**
2480
+ * Get the registered DOM element by the RTE entity.
2481
+ *
2482
+ * @param {RTEBlock | RTENode} instance - The RTE block or node instance.
2483
+ * @returns {Nullable<HTMLElement>} The registered DOM element.
2484
+ */
2485
+ getDOMByEntity(instance) {
2486
+ return stateEntityRenderingRegistry.getDOMByEntity(instance);
2487
+ }
2488
+ /**
2489
+ * Checks if the caret position is at the end of a specified RTETextNode.
2490
+ *
2491
+ * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
2492
+ * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
2493
+ * @param {number} startOffset - The position within the text node where the caret is located.
2494
+ * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
2495
+ */
2496
+ isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
2497
+ const lastNode = textBlock.children[textBlock.children.length - 1];
2498
+ return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
2499
+ }
2500
+ /**
2501
+ * Checks if the caret position is at the end of a given decorator node.
2502
+ *
2503
+ * @param {RTEBlock} target - The image block.
2504
+ * @param {RTENode} node - `node` is a RTEDecoratorNode or non-editable text node.
2505
+ * @param {number} startOffset - The position within the `RTEDecoratorNode` where the caret is located.
2506
+ * @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEDecoratorNode`.
2507
+ */
2508
+ isCaretPositionAtDecoratorBlockEnd(target, node, startOffset) {
2509
+ return node === target.children[target.children.length - 1] && startOffset !== 0;
2510
+ }
2511
+ /**
2512
+ * Determines if the custom style annotation includes any the custom style.
2513
+ *
2514
+ * @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
2515
+ * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
2516
+ * @returns {boolean} - True if the custom key includes the custom style, false otherwise.
2517
+ */
2518
+ isCustomStyle(customStyleAnnotation, styleKeys) {
2519
+ return styleKeys.some((item) => Object.keys(customStyleAnnotation.customStyle).includes(item));
2520
+ }
2521
+ }
2522
+
2523
+ /**
2524
+ * Update the text block text style strategy.
2525
+ */
2526
+ class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
2527
+ /**
2528
+ * Update the text block type and add or remove the bold style from child nodes.
2529
+ *
2530
+ * @param {TextStyleAnnotationAction} action - The text style annotation action.
2531
+ * @param {RTETextBlock} target - The current text block.
2532
+ */
2533
+ handleAction(action, target) {
2534
+ if (target.type !== 'list-item') {
2535
+ target.type = action.textStyle;
2536
+ }
2537
+ if (action.bold) {
2538
+ target.children.forEach((node) => {
2539
+ const boldAnnotationAction = new BoldAnnotationAction(true);
2540
+ boldAnnotationAction.doSplit = false;
2541
+ node.apply(boldAnnotationAction);
2542
+ });
2543
+ }
2544
+ else {
2545
+ target.children.forEach((node) => {
2546
+ node.apply(new DeleteNodeAnnotationAction(exports.NodeAnnotationTypeEnum.BOLD));
2547
+ });
2548
+ }
2549
+ this.updateCustomStyleAnnotation(target, ['fontFamily', 'lineHeight', 'fontWeight', 'fontSize']);
2550
+ }
2551
+ }
2552
+
2553
+ /**
2554
+ * Update the text block link group annotation strategy.
2555
+ */
2556
+ class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
2557
+ /**
2558
+ * Update link group after the child link node update.
2559
+ *
2560
+ * @param {LinkGroupAnnotationAction} action - The link group annotation action instance.
2561
+ * @param {RTETextBlock} target - The current text block.
2562
+ */
2563
+ handleAction(action, target) {
2564
+ let linkGroupAnnotation = target.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
2565
+ if (action.type === 'update_link') {
2566
+ if (linkGroupAnnotation) {
2567
+ const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
2568
+ if (linkGroup) {
2569
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [linkGroup[0]]);
2570
+ }
2571
+ }
2572
+ }
2573
+ else {
2574
+ if (linkGroupAnnotation) {
2575
+ const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey) || [];
2576
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
2577
+ }
2578
+ else {
2579
+ linkGroupAnnotation = action.toAnnotation();
2580
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [...action.nodes]);
2581
+ }
2582
+ target.annotationMap.set(exports.InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
2583
+ }
2584
+ }
2585
+ }
2586
+
2587
+ /**
2588
+ * Insert a new children after a existing children
2589
+ *
2590
+ * @example parent.apply(new InsertChildrenAfterAction(existingChildren, newChildren, ...))
2591
+ */
2592
+ class InsertChildrenAfterAction extends ModifyContentAction {
2593
+ constructor(referBlock, ...blocksToBeInserted) {
2594
+ super();
2595
+ this.type = exports.ModifyContentActionType.INSERT_CHILDREN_AFTER;
2596
+ this.referChildren = referBlock;
2597
+ this.childrenToBeInserted = blocksToBeInserted;
2598
+ }
2042
2599
  }
2043
2600
 
2044
2601
  /**
2045
- * Abstract class for which can be splittable
2602
+ * Clear the current block nodes and append new nodes
2603
+ *
2604
+ * @example block.apply(new ReplaceChildNodesAction(newNodes))
2046
2605
  */
2047
- class TextSplittableAction extends AnnotationAction {
2048
- constructor() {
2049
- super(...arguments);
2050
- /**
2051
- * Whether the action should split the node
2052
- */
2053
- this.doSplit = true;
2606
+ class ReplaceChildNodesAction extends ModifyContentAction {
2607
+ constructor(newChildNodes) {
2608
+ super();
2609
+ this.type = exports.ModifyContentActionType.REPLACE_CHILD_NODES;
2610
+ this.newChildNodes = newChildNodes;
2611
+ }
2612
+ }
2613
+
2614
+ /**
2615
+ * Split the current node with a special position strategy.
2616
+ */
2617
+ class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
2618
+ /**
2619
+ * @inheritDoc
2620
+ */
2621
+ handleAction(action, target) {
2622
+ action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode, target);
2623
+ }
2624
+ /**
2625
+ * Splits a text node at a specified offset within a block of nodes and returns a new block with the split nodes.
2626
+ *
2627
+ * @param {RTETextNode} splitNode - The text node that will be split
2628
+ * @param {number} startOffsetOfNode - The index at which will split the text content of the `splitNode`.
2629
+ * @param {RTETextBlock} textBlock - The text block need to be splited.
2630
+ * @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
2631
+ */
2632
+ splitTextNodeBlock(splitNode, startOffsetOfNode, textBlock) {
2633
+ if (splitNode) {
2634
+ const beforeText = splitNode.text.slice(0, startOffsetOfNode);
2635
+ const afterText = splitNode.text.slice(startOffsetOfNode);
2636
+ const nodesSplitIndex = textBlock.children.indexOf(splitNode);
2637
+ if (nodesSplitIndex > -1) {
2638
+ const beforeNodes = textBlock.children.slice(0, nodesSplitIndex);
2639
+ const afterNodes = textBlock.children.slice(nodesSplitIndex + 1);
2640
+ if (splitNode.isContentEditable()) {
2641
+ if (beforeText) {
2642
+ beforeNodes.push(splitNode.cloneWithText(beforeText));
2643
+ }
2644
+ if (afterText) {
2645
+ afterNodes.unshift(splitNode.cloneWithText(afterText));
2646
+ }
2647
+ }
2648
+ else {
2649
+ startOffsetOfNode > 0 ? beforeNodes.push(splitNode) : afterNodes.unshift(splitNode);
2650
+ }
2651
+ textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
2652
+ const newBlock = textBlock.cloneWithNodes(afterNodes);
2653
+ textBlock.parent.apply(new InsertChildrenAfterAction(textBlock, newBlock));
2654
+ return newBlock;
2655
+ }
2656
+ }
2657
+ }
2658
+ }
2659
+
2660
+ /**
2661
+ * Remove all nodes and append new nodes strategy.
2662
+ */
2663
+ class BlockReplaceNodesStrategy extends ActionHandleStrategy {
2664
+ /**
2665
+ * Empty the text block or image block nodes and add new nodes.
2666
+ *
2667
+ * @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
2668
+ * @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
2669
+ */
2670
+ handleAction(action, target) {
2671
+ target.children = [];
2672
+ target.apply(new AppendChildrenAction(action.newChildNodes));
2673
+ }
2674
+ }
2675
+
2676
+ /**
2677
+ * Remove a children from the current block
2678
+ *
2679
+ * @example needRemovedChildren.parent.apply(new RemoveChildrenAction(needRemovedChildren))
2680
+ */
2681
+ class RemoveChildrenAction extends ModifyContentAction {
2682
+ constructor(childNode) {
2683
+ super();
2684
+ this.type = exports.ModifyContentActionType.DELETE_CHILDREN;
2685
+ this.entityToBeRemoved = childNode;
2054
2686
  }
2055
2687
  }
2056
2688
 
@@ -2073,29 +2705,6 @@ class SelectionRangeAnnotation extends Annotation {
2073
2705
  }
2074
2706
  }
2075
2707
 
2076
- /**
2077
- * Default CSS style values produced by inline text-formatting annotations.
2078
- *
2079
- * These constants are the single source of truth for the CSS values that
2080
- * bold, italic, underline and strikethrough semantic annotations render as
2081
- * (in standalone mode) and that annotation handlers / filter strategies use
2082
- * to detect or remove redundant inline styles.
2083
- */
2084
- /** CSS `font-weight` value rendered by the bold annotation. */
2085
- const BOLD_FONT_WEIGHT = '700';
2086
- /** Alternative `font-weight` keyword that browsers report for bold elements. */
2087
- const BOLD_FONT_WEIGHT_KEYWORD = 'bold';
2088
- /** CSS `font-style` value rendered by the italic annotation. */
2089
- const ITALIC_FONT_STYLE = 'italic';
2090
- /** CSS `text-decoration` token rendered by the underline annotation. */
2091
- const UNDERLINE_TEXT_DECORATION = 'underline';
2092
- /** CSS `text-decoration` token rendered by the strikethrough annotation. */
2093
- const STRIKETHROUGH_TEXT_DECORATION = 'line-through';
2094
- /** CSS `font-family` value rendered by the code annotation. */
2095
- const CODE_FONT_FAMILY = 'Roboto Mono';
2096
- /** CSS `white-space` value rendered by the code annotation. */
2097
- const CODE_WHITE_SPACE = 'pre-wrap';
2098
-
2099
2708
  /**
2100
2709
  * Annotation to make text with strikethrough
2101
2710
  */
@@ -2252,58 +2861,6 @@ class ItalicAnnotation extends NodeAnnotation {
2252
2861
  }
2253
2862
  }
2254
2863
 
2255
- /**
2256
- * Annotation to make text bold
2257
- */
2258
- class BoldAnnotation extends NodeAnnotation {
2259
- constructor(bold) {
2260
- super();
2261
- this.type = exports.NodeAnnotationTypeEnum.BOLD;
2262
- this.bold = bold;
2263
- }
2264
- /**
2265
- * Generate the map item for the annotation
2266
- *
2267
- * @param {boolean} bold - Bold annotation
2268
- * @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
2269
- */
2270
- static from(bold) {
2271
- return [exports.NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
2272
- }
2273
- /**
2274
- * Generate the JSON representation of the annotation
2275
- *
2276
- * @returns {Record<string, unknown>} JSON representation of the annotation
2277
- */
2278
- toJSON() {
2279
- return {
2280
- bold: this.bold,
2281
- };
2282
- }
2283
- /**
2284
- * @inheritDoc
2285
- */
2286
- clone() {
2287
- return new BoldAnnotation(this.bold);
2288
- }
2289
- /**
2290
- * @inheritDoc
2291
- */
2292
- renderClass(options) {
2293
- if (options === null || options === void 0 ? void 0 : options.standalone)
2294
- return null;
2295
- return this.bold ? 'v-rte--bold' : null;
2296
- }
2297
- /**
2298
- * @inheritDoc
2299
- */
2300
- renderStyle(options) {
2301
- if (!(options === null || options === void 0 ? void 0 : options.standalone))
2302
- return null;
2303
- return this.bold ? { fontWeight: BOLD_FONT_WEIGHT } : null;
2304
- }
2305
- }
2306
-
2307
2864
  /**
2308
2865
  * Annotation to make text code
2309
2866
  */
@@ -2470,114 +3027,44 @@ const RTE_BLOCK_BOUNDARY_ATTRIBUTE = 'data-vega-rte-block-boundary';
2470
3027
  const RTE_PASTE_MODE_DATA_TYPE = 'application/x-vega-rte-paste-mode';
2471
3028
  /**
2472
3029
  * Custom DataTransfer MIME type value used to indicate that the paste content
2473
- * originated from Microsoft Word.
2474
- */
2475
- const RTE_PASTE_MODE_WORD = 'word';
2476
- const RTE_WORD_COUNT_KEY = 'rte-word-count';
2477
-
2478
- /**
2479
- * Annotation to make text with text color
2480
- */
2481
- class TextColorAnnotation extends NodeAnnotation {
2482
- constructor(textColor) {
2483
- super();
2484
- this.type = exports.NodeAnnotationTypeEnum.TEXT_COLOR;
2485
- this.textColor = this.formatTextColor(textColor);
2486
- }
2487
- /**
2488
- * Generate the map item for the annotation
2489
- *
2490
- * @param {string} textColor - text color annotation
2491
- * @returns {[NodeAnnotationTypeEnum.TEXT_COLOR, TextColorAnnotation]} Map item for the annotation
2492
- */
2493
- static from(textColor) {
2494
- return [exports.NodeAnnotationTypeEnum.TEXT_COLOR, new TextColorAnnotation(textColor)];
2495
- }
2496
- /**
2497
- * Generate the JSON representation of the annotation
2498
- *
2499
- * @returns {Record<string, unknown>} JSON representation of the annotation
2500
- */
2501
- toJSON() {
2502
- return {
2503
- textColor: this.textColor.key,
2504
- };
2505
- }
2506
- /**
2507
- * @inheritDoc
2508
- */
2509
- clone() {
2510
- return new TextColorAnnotation(this.textColor.key);
2511
- }
2512
- /**
2513
- * @inheritDoc
2514
- */
2515
- renderClass() {
2516
- return null;
2517
- }
2518
- /**
2519
- * @inheritDoc
2520
- */
2521
- renderStyle() {
2522
- return {
2523
- color: darkModeStyleController.VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
2524
- };
2525
- }
2526
- /**
2527
- * format text color
2528
- *
2529
- * @param {string} textColor - text color
2530
- * @returns {VegaRTEColorSchema} - VegaRTEColorSchema
2531
- */
2532
- formatTextColor(textColor) {
2533
- return (RTE_TEXT_COLORS.find((item) => item.key === textColor) || RTE_TEXT_COLORS[0]);
2534
- }
2535
- }
3030
+ * originated from Microsoft Word.
3031
+ */
3032
+ const RTE_PASTE_MODE_WORD = 'word';
3033
+ const RTE_WORD_COUNT_KEY = 'rte-word-count';
2536
3034
 
2537
3035
  /**
2538
- * Annotation to make text a link
3036
+ * Annotation to make text with text color
2539
3037
  */
2540
- class LinkAnnotation extends NodeAnnotation {
2541
- constructor(link, useInternalStyle = true) {
3038
+ class TextColorAnnotation extends NodeAnnotation {
3039
+ constructor(textColor) {
2542
3040
  super();
2543
- this.type = exports.NodeAnnotationTypeEnum.LINK;
2544
- this.link = link;
2545
- this.useInternalStyle = useInternalStyle;
3041
+ this.type = exports.NodeAnnotationTypeEnum.TEXT_COLOR;
3042
+ this.textColor = this.formatTextColor(textColor);
2546
3043
  }
2547
3044
  /**
2548
3045
  * Generate the map item for the annotation
2549
3046
  *
2550
- * @param {VegaRTELink} link - Bold annotation
2551
- * @param {boolean} useInternalStyle - Whether to use default style for the link
2552
- * @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
3047
+ * @param {string} textColor - text color annotation
3048
+ * @returns {[NodeAnnotationTypeEnum.TEXT_COLOR, TextColorAnnotation]} Map item for the annotation
2553
3049
  */
2554
- static from(link, useInternalStyle = true) {
2555
- return [exports.NodeAnnotationTypeEnum.LINK, new LinkAnnotation(link, useInternalStyle)];
3050
+ static from(textColor) {
3051
+ return [exports.NodeAnnotationTypeEnum.TEXT_COLOR, new TextColorAnnotation(textColor)];
2556
3052
  }
2557
3053
  /**
2558
3054
  * Generate the JSON representation of the annotation
2559
3055
  *
2560
- * @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
3056
+ * @returns {Record<string, unknown>} JSON representation of the annotation
2561
3057
  */
2562
3058
  toJSON() {
2563
3059
  return {
2564
- link: this.link,
3060
+ textColor: this.textColor.key,
2565
3061
  };
2566
3062
  }
2567
3063
  /**
2568
3064
  * @inheritDoc
2569
3065
  */
2570
3066
  clone() {
2571
- return new LinkAnnotation(this.link, this.useInternalStyle);
2572
- }
2573
- /**
2574
- * Verify whether two link annotation is same or not
2575
- *
2576
- * @param {LinkAnnotation} annotation - Compared annotation
2577
- * @returns {boolean} Whether two link annotation is same or not
2578
- */
2579
- toEqual(annotation) {
2580
- return this.link.groupKey === annotation.link.groupKey;
3067
+ return new TextColorAnnotation(this.textColor.key);
2581
3068
  }
2582
3069
  /**
2583
3070
  * @inheritDoc
@@ -2589,28 +3076,18 @@ class LinkAnnotation extends NodeAnnotation {
2589
3076
  * @inheritDoc
2590
3077
  */
2591
3078
  renderStyle() {
2592
- return null;
2593
- }
2594
- }
2595
-
2596
- /**
2597
- * Action to link a group of nodes
2598
- */
2599
- class LinkGroupAnnotationAction extends AnnotationAction {
2600
- constructor(groupKey, nodes, type) {
2601
- super();
2602
- this.isFlushable = false;
2603
- this.groupKey = groupKey;
2604
- this.nodes = nodes;
2605
- this.type = type;
3079
+ return {
3080
+ color: darkModeStyleController.VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
3081
+ };
2606
3082
  }
2607
3083
  /**
2608
- * Converts the action to an annotation
3084
+ * format text color
2609
3085
  *
2610
- * @returns {Annotation} The annotation
3086
+ * @param {string} textColor - text color
3087
+ * @returns {VegaRTEColorSchema} - VegaRTEColorSchema
2611
3088
  */
2612
- toAnnotation() {
2613
- return new LinkGroupAnnotation(this.groupKey);
3089
+ formatTextColor(textColor) {
3090
+ return (RTE_TEXT_COLORS.find((item) => item.key === textColor) || RTE_TEXT_COLORS[0]);
2614
3091
  }
2615
3092
  }
2616
3093
 
@@ -2632,139 +3109,6 @@ class SyncUpSelectionAction extends AnnotationAction {
2632
3109
  }
2633
3110
  }
2634
3111
 
2635
- /**
2636
- * The base action handle strategy class, use to modify the rich text node content or modify the annotation.
2637
- */
2638
- class ActionHandleStrategy {
2639
- /**
2640
- * Public method to invoke the handle logic.
2641
- *
2642
- * @typedef R generic type
2643
- * @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
2644
- * @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
2645
- * @returns {R} - The invoke result in special strategy.
2646
- */
2647
- execute(action, target) {
2648
- globalSlimmerRegistry.LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
2649
- return this.handleAction(action, target);
2650
- }
2651
- /**
2652
- * Update the custom style annotation of a block or node
2653
- *
2654
- * @param {RTEBlock | RTETextNode} item - block or node
2655
- * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
2656
- */
2657
- updateCustomStyleAnnotation(item, styleKeys) {
2658
- const customStyleAnnotation = item.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_STYLE);
2659
- if (customStyleAnnotation && this.isCustomStyle(customStyleAnnotation, styleKeys)) {
2660
- item.annotationMap.set(customStyleAnnotation.type, new CustomStyleAnnotation(customStyleAnnotation.removeStyles(styleKeys)));
2661
- }
2662
- }
2663
- /**
2664
- * Create a new paragraph block with the given text.
2665
- *
2666
- * @param {string} text - The text content for the new paragraph.
2667
- * @returns {Nullable<RTETextBlock>} - The newly created paragraph block, or null if creation failed.
2668
- */
2669
- createNewParagraph(text) {
2670
- const dtoClass = RTEDTOClassManager$1.getRTEBlockClass('paragraph');
2671
- if (dtoClass) {
2672
- const newParagraph = dtoClass.from({
2673
- id: misc.generateUUID(),
2674
- type: 'paragraph',
2675
- nodes: [{ id: misc.generateUUID(), type: 'text', text }],
2676
- });
2677
- return newParagraph;
2678
- }
2679
- }
2680
- /**
2681
- * Get the root content from a child block or node.
2682
- *
2683
- * @param {RTEBlock | RTENode} child - The child block or node.
2684
- * @returns {Nullable<VegaRTEContent>} The root content, if found.
2685
- */
2686
- getRootContent(child) {
2687
- const parent = child.parent;
2688
- if (parent) {
2689
- if (parent.dtoName === 'VegaRTEContent') {
2690
- return parent;
2691
- }
2692
- else {
2693
- return this.getRootContent(parent);
2694
- }
2695
- }
2696
- }
2697
- /**
2698
- * Check the caret position at the start of a block.
2699
- *
2700
- * @param {RTEBlock} block - The RTE Block.
2701
- * @param {RTENode} node - The RTE Node.
2702
- * @param {number} offset - The offset position.
2703
- * @returns {boolean} - Whether the caret is at the start of the block.
2704
- */
2705
- isCaretPositionAtBlockStart(block, node, offset) {
2706
- return node === block.children[0] && offset === 0;
2707
- }
2708
- /**
2709
- * Check the caret position at the end of a block.
2710
- *
2711
- * @param {RTEBlock} block - The RTE Block.
2712
- * @param {RTENode} node - The RTE Node.
2713
- * @param {number} offset - The offset position.
2714
- * @returns {boolean} - Whether the caret is at the end of the block.
2715
- */
2716
- isCaretPositionAtBlockEnd(block, node, offset) {
2717
- if (!node.isContentEditable()) {
2718
- return this.isCaretPositionAtDecoratorBlockEnd(block, node, offset);
2719
- }
2720
- else {
2721
- return this.isCaretPositionAtTextBlockEnd(block, node, offset);
2722
- }
2723
- }
2724
- /**
2725
- * Get the registered DOM element by the RTE entity.
2726
- *
2727
- * @param {RTEBlock | RTENode} instance - The RTE block or node instance.
2728
- * @returns {Nullable<HTMLElement>} The registered DOM element.
2729
- */
2730
- getDOMByEntity(instance) {
2731
- return stateEntityRenderingRegistry.getDOMByEntity(instance);
2732
- }
2733
- /**
2734
- * Checks if the caret position is at the end of a specified RTETextNode.
2735
- *
2736
- * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
2737
- * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
2738
- * @param {number} startOffset - The position within the text node where the caret is located.
2739
- * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
2740
- */
2741
- isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
2742
- const lastNode = textBlock.children[textBlock.children.length - 1];
2743
- return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
2744
- }
2745
- /**
2746
- * Checks if the caret position is at the end of a given decorator node.
2747
- *
2748
- * @param {RTEBlock} target - The image block.
2749
- * @param {RTENode} node - `node` is a RTEDecoratorNode or non-editable text node.
2750
- * @param {number} startOffset - The position within the `RTEDecoratorNode` where the caret is located.
2751
- * @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEDecoratorNode`.
2752
- */
2753
- isCaretPositionAtDecoratorBlockEnd(target, node, startOffset) {
2754
- return node === target.children[target.children.length - 1] && startOffset !== 0;
2755
- }
2756
- /**
2757
- * Determines if the custom style annotation includes any the custom style.
2758
- *
2759
- * @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
2760
- * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
2761
- * @returns {boolean} - True if the custom key includes the custom style, false otherwise.
2762
- */
2763
- isCustomStyle(customStyleAnnotation, styleKeys) {
2764
- return styleKeys.some((item) => Object.keys(customStyleAnnotation.customStyle).includes(item));
2765
- }
2766
- }
2767
-
2768
3112
  /**
2769
3113
  * Split the corresponding link group nodes *
2770
3114
  */
@@ -2914,25 +3258,6 @@ class NodeSplitTextStrategy extends ActionHandleStrategy {
2914
3258
  }
2915
3259
  }
2916
3260
 
2917
- /**
2918
- * Action to toggle bold annotation
2919
- */
2920
- class BoldAnnotationAction extends TextSplittableAction {
2921
- constructor(bold) {
2922
- super();
2923
- this.isFlushable = true;
2924
- this.bold = bold;
2925
- }
2926
- /**
2927
- * Converts the action to an annotation
2928
- *
2929
- * @returns {BoldAnnotation} the annotation
2930
- */
2931
- toAnnotation() {
2932
- return new BoldAnnotation(this.bold);
2933
- }
2934
- }
2935
-
2936
3261
  /**
2937
3262
  * Annotation to host which annotations will be clear formatting
2938
3263
  */
@@ -2990,65 +3315,21 @@ class CodeAnnotationAction extends TextSplittableAction {
2990
3315
  }
2991
3316
 
2992
3317
  /**
2993
- * Delete the node annotation by type
2994
- */
2995
- class DeleteNodeAnnotationAction extends AnnotationAction {
2996
- constructor(annotationType) {
2997
- super();
2998
- this.isFlushable = true;
2999
- this.annotationType = annotationType;
3000
- }
3001
- /**
3002
- * Don't need this for this action
3003
- *
3004
- * @returns {Nullable<Annotation>} undefined
3005
- */
3006
- toAnnotation() {
3007
- return undefined;
3008
- }
3009
- }
3010
-
3011
- /**
3012
- * Action to toggle the italic annotation
3013
- */
3014
- class ItalicAnnotationAction extends TextSplittableAction {
3015
- constructor(italic) {
3016
- super();
3017
- this.isFlushable = true;
3018
- this.italic = italic;
3019
- }
3020
- /**
3021
- * Converts the action to an annotation
3022
- *
3023
- * @returns {ItalicAnnotation} The annotation
3024
- */
3025
- toAnnotation() {
3026
- return new ItalicAnnotation(this.italic);
3027
- }
3028
- }
3029
-
3030
- /**
3031
- * Action to toggle link annotation
3318
+ * Action to toggle the italic annotation
3032
3319
  */
3033
- class LinkAnnotationAction extends TextSplittableAction {
3034
- constructor({ link, newText, needMergeNode, doSplit, type, }) {
3320
+ class ItalicAnnotationAction extends TextSplittableAction {
3321
+ constructor(italic) {
3035
3322
  super();
3036
3323
  this.isFlushable = true;
3037
- this.link = link;
3038
- this.needMergeNode = needMergeNode;
3039
- this.newText = newText;
3040
- this.type = type;
3041
- if (typeGuard.isNonNullable(doSplit)) {
3042
- this.doSplit = doSplit;
3043
- }
3324
+ this.italic = italic;
3044
3325
  }
3045
3326
  /**
3046
3327
  * Converts the action to an annotation
3047
3328
  *
3048
- * @returns {LinkAnnotation} the annotation
3329
+ * @returns {ItalicAnnotation} The annotation
3049
3330
  */
3050
3331
  toAnnotation() {
3051
- return new LinkAnnotation(this.link);
3332
+ return new ItalicAnnotation(this.italic);
3052
3333
  }
3053
3334
  }
3054
3335
 
@@ -3702,421 +3983,140 @@ class RTETextNode extends RTENode {
3702
3983
  }
3703
3984
  else {
3704
3985
  this.applyActionToNode(this, action);
3705
- }
3706
- if (typeof this.parent.mergeNodes === 'function') {
3707
- this.parent.mergeNodes(action);
3708
- }
3709
- }
3710
- /**
3711
- * @inheritDoc
3712
- */
3713
- doModifyActionApply(action) {
3714
- ActionHandleStrategyRegistry.executeTheStrategy(action, this);
3715
- }
3716
- /**
3717
- * Apply action to node
3718
- *
3719
- * @param {RTETextNode} node - Text node
3720
- * @param {AnnotationAction} action - AnnotationAction
3721
- */
3722
- applyActionToNode(node, action) {
3723
- const annotation = action.toAnnotation();
3724
- if (action instanceof SyncUpSelectionAction) {
3725
- this.syncUpSelectedNodes(node);
3726
- return;
3727
- }
3728
- // Sync up RTETextNode selected state to selection controller for any action apply, except selection range change.
3729
- if (!(annotation instanceof SelectionRangeAnnotation)) {
3730
- this.syncUpSelectedNodes(node);
3731
- }
3732
- /**
3733
- * 1. Try to get the specific strategy for the action and node type first (e.g., LinkAnnotationAction on RTETextNode).
3734
- * 2. If no specific strategy found, try to get the generic NodeUpdateAnnotationMapStrategy for AnnotationAction on RTETextNode.
3735
- */
3736
- const strategy = ActionHandleStrategyRegistry.get(action.constructor.name, node.constructor.name);
3737
- if (strategy) {
3738
- strategy.execute(action, node);
3739
- return;
3740
- }
3741
- const updateAnnotationMapStrategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTETextNode.name);
3742
- if (updateAnnotationMapStrategy) {
3743
- updateAnnotationMapStrategy.execute(action, node);
3744
- return;
3745
- }
3746
- }
3747
- /**
3748
- * Sync up the selected node by change manager
3749
- *
3750
- * @param {RTETextNode} selectedNode - The selected node
3751
- */
3752
- syncUpSelectedNodes(selectedNode) {
3753
- const currentNodeDom = this.getElementRef();
3754
- if (currentNodeDom) {
3755
- const nodeSubject = domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, vegaInternalEventId.VegaInternalRichTextEditorSelectionRangeChange);
3756
- if (nodeSubject) {
3757
- changeManager.ChangeManager.notify(nodeSubject, { node: selectedNode });
3758
- }
3759
- }
3760
- }
3761
- /**
3762
- * @param {InlineHtmlAnnotation} inlineHtmlNode - The inline HTML annotation to wrap the text node.
3763
- * @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
3764
- * @returns {string} The HTML string representation of the text node wrapped with the inline HTML.
3765
- */
3766
- renderWithWrapperStr(inlineHtmlNode, options) {
3767
- const { htmlTag, child } = inlineHtmlNode;
3768
- const attrStr = this.annotationAttrStr(inlineHtmlNode);
3769
- if (!child) {
3770
- if (HTML_VOID_TAGS.has(htmlTag)) {
3771
- return `<${htmlTag}${attrStr}>`;
3772
- }
3773
- if (!this.text) {
3774
- return `<${htmlTag}${attrStr}></${htmlTag}>`;
3775
- }
3776
- return `<${htmlTag}${attrStr}>${this.renderTextStr(options)}</${htmlTag}>`;
3777
- }
3778
- return `<${htmlTag}${attrStr}>${this.renderWithWrapperStr(child, options)}</${htmlTag}>`;
3779
- }
3780
- /**
3781
- * Generate the attribute string for the inline HTML annotation
3782
- *
3783
- * @param {InlineHtmlAnnotation} annotation - The inline HTML annotation
3784
- * @returns {string} The attribute string for the inline HTML annotation
3785
- */
3786
- annotationAttrStr(annotation) {
3787
- const { customAttribute, customClass, customStyle } = annotation;
3788
- const attrs = [
3789
- ...((customAttribute === null || customAttribute === void 0 ? void 0 : customAttribute.toString()) || []),
3790
- customClass === null || customClass === void 0 ? void 0 : customClass.toString(),
3791
- customStyle === null || customStyle === void 0 ? void 0 : customStyle.toString(),
3792
- ].filter(typeGuard.isNonNullable);
3793
- return attrs.length > 0 ? ` ${attrs.join(' ')}` : '';
3794
- }
3795
- /**
3796
- * Generates the HTML representation of the text node.
3797
- *
3798
- * @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
3799
- * @returns {string} The HTML string representation of the text node.
3800
- */
3801
- renderTextStr(options) {
3802
- var _a;
3803
- const NodeTag = ((_a = this.getAnnotationByType(exports.NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code)
3804
- ? 'code'
3805
- : 'span';
3806
- const attrStr = super.generateAttributeString(options);
3807
- // If the text contains a newline character, we need to replace it with a <br> tag.
3808
- if (this.text === '\n') {
3809
- return `<br>`;
3810
- }
3811
- if (this.shouldRenderAsPlainText()) {
3812
- return this.text;
3813
- }
3814
- const content = NodeTag === 'code' ? escapeHtml(this.text) : this.text;
3815
- return `<${NodeTag}${attrStr}>${content}</${NodeTag}>`;
3816
- }
3817
- /**
3818
- * Determines if the text node should be rendered as plain text.
3819
- *
3820
- * @returns {boolean} `true` if the text node should be rendered as plain text, otherwise `false`.
3821
- */
3822
- shouldRenderAsPlainText() {
3823
- const plainTextAnnotation = super.getAnnotationByType(exports.NodeAnnotationTypeEnum.PLAIN_TEXT);
3824
- if (plainTextAnnotation) {
3825
- return (plainTextAnnotation.plainText &&
3826
- Array.from(this.annotationMap.values()).filter((annotation) => (annotation instanceof NodeAnnotation &&
3827
- !(annotation instanceof LinkAnnotation) &&
3828
- !(annotation instanceof PlainTextAnnotation)) ||
3829
- annotation instanceof CommonAnnotation).length === 0);
3830
- }
3831
- else {
3832
- return false;
3833
- }
3834
- }
3835
- }
3836
- RTETextNode.registerActionStrategyStatus = {};
3837
- RTETextNode.htmlTag = 'span';
3838
- RTETextNode.dtoName = 'RTETextNode';
3839
-
3840
- /**
3841
- * Append children to a block or rte content
3842
- *
3843
- * @example parent.apply(new AppendChildrenAction([newChildren]))
3844
- */
3845
- class AppendChildrenAction extends ModifyContentAction {
3846
- constructor(childNodes) {
3847
- super();
3848
- this.type = exports.ModifyContentActionType.APPEND_CHILDREN;
3849
- this.entityToBeAppended = childNodes;
3850
- }
3851
- }
3852
-
3853
- const TEXT_STYLE_DEFAULT_FONT_WEIGHT = '500';
3854
- const TEXT_STYLE_BASE = {
3855
- fontFamily: 'Inter',
3856
- fontSize: '16px',
3857
- lineHeight: '22px',
3858
- minHeight: '22px',
3859
- fontWeight: TEXT_STYLE_DEFAULT_FONT_WEIGHT,
3860
- };
3861
- const PARAGRAPH_TEXT_STYLE = Object.assign(Object.assign({}, TEXT_STYLE_BASE), { marginTop: '0px', marginBottom: '0px' });
3862
- const TEXT_STYLE_DEFAULTS = {
3863
- 'paragraph': PARAGRAPH_TEXT_STYLE,
3864
- 'title': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '36px', lineHeight: '40px', minHeight: '40px' }),
3865
- 'subtitle': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '28px', lineHeight: '32px', minHeight: '32px' }),
3866
- 'heading-1': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '22px', lineHeight: '24px', minHeight: '24px' }),
3867
- 'heading-2': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '20px', lineHeight: '24px', minHeight: '24px' }),
3868
- 'heading-3': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '18px' }),
3869
- 'heading-4': Object.assign({}, PARAGRAPH_TEXT_STYLE),
3870
- 'heading-5': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '14px' }),
3871
- 'heading-6': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '12px' }),
3872
- };
3873
-
3874
- /**
3875
- * Text style annotation
3876
- */
3877
- class TextStyleAnnotation extends BlockAnnotation {
3878
- constructor(textStyle) {
3879
- super();
3880
- this.type = exports.BlockAnnotationTypeEnum.TEXT_STYLE;
3881
- this.textStyle = textStyle;
3882
- }
3883
- /**
3884
- * Generate the map item for the annotations
3885
- *
3886
- * @param {VegaRTETextStyleType} textStyle - the text style type
3887
- * @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
3888
- */
3889
- static from(textStyle) {
3890
- return [exports.BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
3891
- }
3892
- /**
3893
- * Get the default styles for a given text style type.
3894
- *
3895
- * @param {VegaRTETextStyleType} textStyle - The text style type.
3896
- * @returns {Nullable<AnnotationStyle>} The default styles for the given text style type.
3897
- */
3898
- static getDefaultStyles(textStyle) {
3899
- if (!textStyle)
3900
- return null;
3901
- return TEXT_STYLE_DEFAULTS[textStyle];
3902
- }
3903
- /**
3904
- * Generate the JSON representation of the annotation
3905
- *
3906
- * @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
3907
- */
3908
- toJSON() {
3909
- return { textStyle: this.textStyle };
3910
- }
3911
- /**
3912
- * @inheritDoc
3913
- */
3914
- clone() {
3915
- return new TextStyleAnnotation(this.textStyle);
3916
- }
3917
- /**
3918
- * @inheritDoc
3919
- */
3920
- renderClass(options) {
3921
- if (options === null || options === void 0 ? void 0 : options.standalone)
3922
- return null;
3923
- return this.textStyle ? `v-rte--text-style-${this.textStyle}` : null;
3924
- }
3925
- /**
3926
- * @inheritDoc
3927
- */
3928
- renderStyle(options) {
3929
- if (!(options === null || options === void 0 ? void 0 : options.standalone))
3930
- return null;
3931
- return this.textStyle ? TextStyleAnnotation.getDefaultStyles(this.textStyle) : null;
3932
- }
3933
- }
3934
-
3935
- /**
3936
- * Action to change the text style of a block
3937
- */
3938
- class TextStyleAnnotationAction extends AnnotationAction {
3939
- constructor(textStyle, bold) {
3940
- super();
3941
- this.isFlushable = true;
3942
- this.textStyle = textStyle;
3943
- this.bold = bold;
3986
+ }
3987
+ if (typeof this.parent.mergeNodes === 'function') {
3988
+ this.parent.mergeNodes(action);
3989
+ }
3944
3990
  }
3945
3991
  /**
3946
- * Converts the action to a block annotation
3947
- *
3948
- * @returns {BlockAnnotation} the block annotation
3992
+ * @inheritDoc
3949
3993
  */
3950
- toAnnotation() {
3951
- return new TextStyleAnnotation(this.textStyle);
3994
+ doModifyActionApply(action) {
3995
+ ActionHandleStrategyRegistry.executeTheStrategy(action, this);
3952
3996
  }
3953
- }
3954
-
3955
- /**
3956
- * Update the text block text style strategy.
3957
- */
3958
- class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
3959
3997
  /**
3960
- * Update the text block type and add or remove the bold style from child nodes.
3998
+ * Apply action to node
3961
3999
  *
3962
- * @param {TextStyleAnnotationAction} action - The text style annotation action.
3963
- * @param {RTETextBlock} target - The current text block.
4000
+ * @param {RTETextNode} node - Text node
4001
+ * @param {AnnotationAction} action - AnnotationAction
3964
4002
  */
3965
- handleAction(action, target) {
3966
- if (target.type !== 'list-item') {
3967
- target.type = action.textStyle;
4003
+ applyActionToNode(node, action) {
4004
+ const annotation = action.toAnnotation();
4005
+ if (action instanceof SyncUpSelectionAction) {
4006
+ this.syncUpSelectedNodes(node);
4007
+ return;
3968
4008
  }
3969
- if (action.bold) {
3970
- target.children.forEach((node) => {
3971
- const boldAnnotationAction = new BoldAnnotationAction(true);
3972
- boldAnnotationAction.doSplit = false;
3973
- node.apply(boldAnnotationAction);
3974
- });
4009
+ // Sync up RTETextNode selected state to selection controller for any action apply, except selection range change.
4010
+ if (!(annotation instanceof SelectionRangeAnnotation)) {
4011
+ this.syncUpSelectedNodes(node);
3975
4012
  }
3976
- else {
3977
- target.children.forEach((node) => {
3978
- node.apply(new DeleteNodeAnnotationAction(exports.NodeAnnotationTypeEnum.BOLD));
3979
- });
4013
+ /**
4014
+ * 1. Try to get the specific strategy for the action and node type first (e.g., LinkAnnotationAction on RTETextNode).
4015
+ * 2. If no specific strategy found, try to get the generic NodeUpdateAnnotationMapStrategy for AnnotationAction on RTETextNode.
4016
+ */
4017
+ const strategy = ActionHandleStrategyRegistry.get(action.constructor.name, node.constructor.name);
4018
+ if (strategy) {
4019
+ strategy.execute(action, node);
4020
+ return;
4021
+ }
4022
+ const updateAnnotationMapStrategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTETextNode.name);
4023
+ if (updateAnnotationMapStrategy) {
4024
+ updateAnnotationMapStrategy.execute(action, node);
4025
+ return;
3980
4026
  }
3981
- this.updateCustomStyleAnnotation(target, ['fontFamily', 'lineHeight', 'fontWeight', 'fontSize']);
3982
4027
  }
3983
- }
3984
-
3985
- /**
3986
- * Update the text block link group annotation strategy.
3987
- */
3988
- class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
3989
4028
  /**
3990
- * Update link group after the child link node update.
4029
+ * Sync up the selected node by change manager
3991
4030
  *
3992
- * @param {LinkGroupAnnotationAction} action - The link group annotation action instance.
3993
- * @param {RTETextBlock} target - The current text block.
4031
+ * @param {RTETextNode} selectedNode - The selected node
3994
4032
  */
3995
- handleAction(action, target) {
3996
- let linkGroupAnnotation = target.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
3997
- if (action.type === 'update_link') {
3998
- if (linkGroupAnnotation) {
3999
- const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
4000
- if (linkGroup) {
4001
- linkGroupAnnotation.linkGroups.set(action.groupKey, [linkGroup[0]]);
4002
- }
4033
+ syncUpSelectedNodes(selectedNode) {
4034
+ const currentNodeDom = this.getElementRef();
4035
+ if (currentNodeDom) {
4036
+ const nodeSubject = domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, vegaInternalEventId.VegaInternalRichTextEditorSelectionRangeChange);
4037
+ if (nodeSubject) {
4038
+ changeManager.ChangeManager.notify(nodeSubject, { node: selectedNode });
4003
4039
  }
4004
4040
  }
4005
- else {
4006
- if (linkGroupAnnotation) {
4007
- const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey) || [];
4008
- linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
4041
+ }
4042
+ /**
4043
+ * @param {InlineHtmlAnnotation} inlineHtmlNode - The inline HTML annotation to wrap the text node.
4044
+ * @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
4045
+ * @returns {string} The HTML string representation of the text node wrapped with the inline HTML.
4046
+ */
4047
+ renderWithWrapperStr(inlineHtmlNode, options) {
4048
+ const { htmlTag, child } = inlineHtmlNode;
4049
+ const attrStr = this.annotationAttrStr(inlineHtmlNode);
4050
+ if (!child) {
4051
+ if (HTML_VOID_TAGS.has(htmlTag)) {
4052
+ return `<${htmlTag}${attrStr}>`;
4009
4053
  }
4010
- else {
4011
- linkGroupAnnotation = action.toAnnotation();
4012
- linkGroupAnnotation.linkGroups.set(action.groupKey, [...action.nodes]);
4054
+ if (!this.text) {
4055
+ return `<${htmlTag}${attrStr}></${htmlTag}>`;
4013
4056
  }
4014
- target.annotationMap.set(exports.InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
4057
+ return `<${htmlTag}${attrStr}>${this.renderTextStr(options)}</${htmlTag}>`;
4015
4058
  }
4059
+ return `<${htmlTag}${attrStr}>${this.renderWithWrapperStr(child, options)}</${htmlTag}>`;
4016
4060
  }
4017
- }
4018
-
4019
- /**
4020
- * Insert a new children after a existing children
4021
- *
4022
- * @example parent.apply(new InsertChildrenAfterAction(existingChildren, newChildren, ...))
4023
- */
4024
- class InsertChildrenAfterAction extends ModifyContentAction {
4025
- constructor(referBlock, ...blocksToBeInserted) {
4026
- super();
4027
- this.type = exports.ModifyContentActionType.INSERT_CHILDREN_AFTER;
4028
- this.referChildren = referBlock;
4029
- this.childrenToBeInserted = blocksToBeInserted;
4030
- }
4031
- }
4032
-
4033
- /**
4034
- * Clear the current block nodes and append new nodes
4035
- *
4036
- * @example block.apply(new ReplaceChildNodesAction(newNodes))
4037
- */
4038
- class ReplaceChildNodesAction extends ModifyContentAction {
4039
- constructor(newChildNodes) {
4040
- super();
4041
- this.type = exports.ModifyContentActionType.REPLACE_CHILD_NODES;
4042
- this.newChildNodes = newChildNodes;
4043
- }
4044
- }
4045
-
4046
- /**
4047
- * Split the current node with a special position strategy.
4048
- */
4049
- class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
4050
4061
  /**
4051
- * @inheritDoc
4062
+ * Generate the attribute string for the inline HTML annotation
4063
+ *
4064
+ * @param {InlineHtmlAnnotation} annotation - The inline HTML annotation
4065
+ * @returns {string} The attribute string for the inline HTML annotation
4052
4066
  */
4053
- handleAction(action, target) {
4054
- action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode, target);
4067
+ annotationAttrStr(annotation) {
4068
+ const { customAttribute, customClass, customStyle } = annotation;
4069
+ const attrs = [
4070
+ ...((customAttribute === null || customAttribute === void 0 ? void 0 : customAttribute.toString()) || []),
4071
+ customClass === null || customClass === void 0 ? void 0 : customClass.toString(),
4072
+ customStyle === null || customStyle === void 0 ? void 0 : customStyle.toString(),
4073
+ ].filter(typeGuard.isNonNullable);
4074
+ return attrs.length > 0 ? ` ${attrs.join(' ')}` : '';
4055
4075
  }
4056
4076
  /**
4057
- * Splits a text node at a specified offset within a block of nodes and returns a new block with the split nodes.
4077
+ * Generates the HTML representation of the text node.
4058
4078
  *
4059
- * @param {RTETextNode} splitNode - The text node that will be split
4060
- * @param {number} startOffsetOfNode - The index at which will split the text content of the `splitNode`.
4061
- * @param {RTETextBlock} textBlock - The text block need to be splited.
4062
- * @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
4079
+ * @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
4080
+ * @returns {string} The HTML string representation of the text node.
4063
4081
  */
4064
- splitTextNodeBlock(splitNode, startOffsetOfNode, textBlock) {
4065
- if (splitNode) {
4066
- const beforeText = splitNode.text.slice(0, startOffsetOfNode);
4067
- const afterText = splitNode.text.slice(startOffsetOfNode);
4068
- const nodesSplitIndex = textBlock.children.indexOf(splitNode);
4069
- if (nodesSplitIndex > -1) {
4070
- const beforeNodes = textBlock.children.slice(0, nodesSplitIndex);
4071
- const afterNodes = textBlock.children.slice(nodesSplitIndex + 1);
4072
- if (splitNode.isContentEditable()) {
4073
- if (beforeText) {
4074
- beforeNodes.push(splitNode.cloneWithText(beforeText));
4075
- }
4076
- if (afterText) {
4077
- afterNodes.unshift(splitNode.cloneWithText(afterText));
4078
- }
4079
- }
4080
- else {
4081
- startOffsetOfNode > 0 ? beforeNodes.push(splitNode) : afterNodes.unshift(splitNode);
4082
- }
4083
- textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
4084
- const newBlock = textBlock.cloneWithNodes(afterNodes);
4085
- textBlock.parent.apply(new InsertChildrenAfterAction(textBlock, newBlock));
4086
- return newBlock;
4087
- }
4082
+ renderTextStr(options) {
4083
+ var _a;
4084
+ const NodeTag = ((_a = this.getAnnotationByType(exports.NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code)
4085
+ ? 'code'
4086
+ : 'span';
4087
+ const attrStr = super.generateAttributeString(options);
4088
+ // If the text contains a newline character, we need to replace it with a <br> tag.
4089
+ if (this.text === '\n') {
4090
+ return `<br>`;
4091
+ }
4092
+ if (this.shouldRenderAsPlainText()) {
4093
+ return this.text;
4088
4094
  }
4095
+ const content = NodeTag === 'code' ? escapeHtml(this.text) : this.text;
4096
+ return `<${NodeTag}${attrStr}>${content}</${NodeTag}>`;
4089
4097
  }
4090
- }
4091
-
4092
- /**
4093
- * Remove all nodes and append new nodes strategy.
4094
- */
4095
- class BlockReplaceNodesStrategy extends ActionHandleStrategy {
4096
4098
  /**
4097
- * Empty the text block or image block nodes and add new nodes.
4099
+ * Determines if the text node should be rendered as plain text.
4098
4100
  *
4099
- * @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
4100
- * @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
4101
+ * @returns {boolean} `true` if the text node should be rendered as plain text, otherwise `false`.
4101
4102
  */
4102
- handleAction(action, target) {
4103
- target.children = [];
4104
- target.apply(new AppendChildrenAction(action.newChildNodes));
4105
- }
4106
- }
4107
-
4108
- /**
4109
- * Remove a children from the current block
4110
- *
4111
- * @example needRemovedChildren.parent.apply(new RemoveChildrenAction(needRemovedChildren))
4112
- */
4113
- class RemoveChildrenAction extends ModifyContentAction {
4114
- constructor(childNode) {
4115
- super();
4116
- this.type = exports.ModifyContentActionType.DELETE_CHILDREN;
4117
- this.entityToBeRemoved = childNode;
4103
+ shouldRenderAsPlainText() {
4104
+ const plainTextAnnotation = super.getAnnotationByType(exports.NodeAnnotationTypeEnum.PLAIN_TEXT);
4105
+ if (plainTextAnnotation) {
4106
+ return (plainTextAnnotation.plainText &&
4107
+ Array.from(this.annotationMap.values()).filter((annotation) => (annotation instanceof NodeAnnotation &&
4108
+ !(annotation instanceof LinkAnnotation) &&
4109
+ !(annotation instanceof PlainTextAnnotation)) ||
4110
+ annotation instanceof CommonAnnotation).length === 0);
4111
+ }
4112
+ else {
4113
+ return false;
4114
+ }
4118
4115
  }
4119
4116
  }
4117
+ RTETextNode.registerActionStrategyStatus = {};
4118
+ RTETextNode.htmlTag = 'span';
4119
+ RTETextNode.dtoName = 'RTETextNode';
4120
4120
 
4121
4121
  /**
4122
4122
  * Append the second block child nodes to the first block child nodes and remove the second block strategy.
@@ -4516,18 +4516,30 @@ class RTETextBlock extends RTEBlock {
4516
4516
  const textBlock = new RTETextBlock(block.id, block.type, options);
4517
4517
  const annotations = options.autoMatchFormat
4518
4518
  ? Object.assign(Object.assign({}, block.annotations), { textStyle: (_b = (_a = block.annotations) === null || _a === void 0 ? void 0 : _a.textStyle) !== null && _b !== void 0 ? _b : textBlock.type }) : block.annotations;
4519
- textBlock.children = block.nodes
4519
+ textBlock.children = RTETextBlock.convertNodes(block.nodes, textBlock, options);
4520
+ if (annotations) {
4521
+ super.convertAnnotationsToMap(textBlock.annotationMap, annotations);
4522
+ }
4523
+ return textBlock;
4524
+ }
4525
+ /**
4526
+ * Convert raw node payloads to their registered `RTENode` subclasses via
4527
+ * `RTEDTOClassManager`, preserving custom types (e.g. `RTETokenNode`).
4528
+ *
4529
+ * @param {VegaRTETextNode[]} nodes - Raw node payloads.
4530
+ * @param {RTETextBlock} parent - Parent block for the converted nodes.
4531
+ * @param {VegaRTETransformOptions} [options] - Optional transform options.
4532
+ * @returns {RTETextNode[]} Converted nodes; unregistered types are dropped.
4533
+ */
4534
+ static convertNodes(nodes, parent, options) {
4535
+ return nodes
4520
4536
  .map((richText) => {
4521
4537
  const NodeClass = RTEDTOClassManager$1.getRTENodeClass(richText.type);
4522
4538
  if (NodeClass) {
4523
- return NodeClass.from(richText, textBlock, options);
4539
+ return NodeClass.from(richText, parent, options);
4524
4540
  }
4525
4541
  })
4526
4542
  .filter(typeGuard.isNonNullable);
4527
- if (annotations) {
4528
- super.convertAnnotationsToMap(textBlock.annotationMap, annotations);
4529
- }
4530
- return textBlock;
4531
4543
  }
4532
4544
  /**
4533
4545
  * The function `createAnnotationEntity` creates a block annotation entity based on the provided type
@@ -4959,7 +4971,7 @@ class RTEListItemBlock extends RTETextBlock {
4959
4971
  */
4960
4972
  static from(block, options = { autoMatchFormat: true }) {
4961
4973
  const listItemBlock = new RTEListItemBlock(block.id, undefined, options);
4962
- listItemBlock.children = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock, options));
4974
+ listItemBlock.children = RTEListItemBlock.convertNodes(block.nodes, listItemBlock, options);
4963
4975
  if (block.children) {
4964
4976
  listItemBlock.nestList = block.children.map((child) => {
4965
4977
  const listBlock = RTEListBlock.from(child, options);