@heartlandone/vega 2.79.0 → 2.81.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 (1373) hide show
  1. package/dist/cjs/app-globals-25e1bfac.js +430 -0
  2. package/dist/cjs/aria-dialog-focusable-trap-slimmer-ced9566d.js +217 -0
  3. package/dist/cjs/child-nodes-notify-observer-slimmer-2631c381.js +90 -0
  4. package/dist/cjs/code-block-24b3d0e7.js +5262 -0
  5. package/dist/cjs/component-value-history-controller-slimmer.abstract-bd662b32.js +714 -0
  6. package/dist/cjs/content-state-0f26036c.js +4962 -0
  7. package/dist/cjs/date-required-rule-4377217a.js +92 -0
  8. package/dist/cjs/design-token-40276b11.js +402 -0
  9. package/dist/cjs/dom-node-subject-observer-factory-9110cb94.js +141 -0
  10. package/dist/cjs/element-appender-slimmer-be1b4d57.js +1974 -0
  11. package/dist/cjs/event-emit-slimmer-bee6b676.js +267 -0
  12. package/dist/cjs/form-field-controller-slimmer-982dbfe4.js +1266 -0
  13. package/dist/cjs/image-annotation-action-e0df5a20.js +285 -0
  14. package/dist/cjs/index.cjs.js +16 -15
  15. package/dist/cjs/inject-keyboard-manager-12b65e98.js +37 -0
  16. package/dist/cjs/keyboard-manager-c89a66d3.js +148 -0
  17. package/dist/cjs/keyboard-manager-slimmer-93fcbf46.js +39 -0
  18. package/dist/cjs/loader.cjs.js +11 -11
  19. package/dist/cjs/month-view-generator-0d25e950.js +101 -0
  20. package/dist/cjs/page-size-option-utils-d038dd3a.js +68 -0
  21. package/dist/cjs/public-rules-652ec269.js +46 -0
  22. package/dist/cjs/range-cdd61881.js +178 -0
  23. package/dist/cjs/responsive-format-facade-9cae7f27.js +944 -0
  24. package/dist/cjs/rich-text-editor-required-rule-4b919054.js +64 -0
  25. package/dist/cjs/split-cell-operation-3596f738.js +2446 -0
  26. package/dist/cjs/string-format-strategy.abstract-ebdb2573.js +63 -0
  27. package/dist/cjs/string-input-formatter-slimmer-9b6a8399.js +230 -0
  28. package/dist/cjs/string-mask-strategy-6cc9f391.js +203 -0
  29. package/dist/cjs/style-formatter-18289c4d.js +34 -0
  30. package/dist/cjs/sub-state-notify-slimmer-39bfcfe3.js +81 -0
  31. package/dist/cjs/sub-state-observer-slimmer-e5b50cbf.js +134 -0
  32. package/dist/cjs/time-required-rule-3517beff.js +141 -0
  33. package/dist/cjs/token-extension-addc97c1.js +7612 -0
  34. package/dist/cjs/type-guard-362d7da3.js +2056 -0
  35. package/dist/cjs/ui-ae4ee13d.js +352 -0
  36. package/dist/cjs/valid-credit-card-number-rule-1d8bf49c.js +173 -0
  37. package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
  38. package/dist/cjs/vega-app-header-button.cjs.entry.js +6 -6
  39. package/dist/cjs/vega-backdrop.cjs.entry.js +1 -1
  40. package/dist/cjs/vega-banner.cjs.entry.js +5 -4
  41. package/dist/cjs/vega-box.cjs.entry.js +5 -5
  42. package/dist/cjs/vega-breadcrumb.cjs.entry.js +27 -10
  43. package/dist/cjs/vega-button-circle.cjs.entry.js +7 -7
  44. package/dist/cjs/vega-button-group_2.cjs.entry.js +6 -6
  45. package/dist/cjs/vega-button-link.cjs.entry.js +3 -3
  46. package/dist/cjs/vega-button.cjs.entry.js +6 -6
  47. package/dist/cjs/vega-calendar_4.cjs.entry.js +30 -17
  48. package/dist/cjs/vega-card.cjs.entry.js +5 -5
  49. package/dist/cjs/vega-carousel.cjs.entry.js +5 -5
  50. package/dist/cjs/vega-checkbox_2.cjs.entry.js +7 -7
  51. package/dist/cjs/vega-chip.cjs.entry.js +7 -7
  52. package/dist/cjs/vega-code-block.cjs.entry.js +10 -10
  53. package/dist/cjs/vega-color-picker.cjs.entry.js +6 -6
  54. package/dist/cjs/vega-combo-box.cjs.entry.js +9 -9
  55. package/dist/cjs/vega-date-picker_2.cjs.entry.js +343 -285
  56. package/dist/cjs/vega-dialog_2.cjs.entry.js +74 -10
  57. package/dist/cjs/vega-divider.cjs.entry.js +5 -5
  58. package/dist/cjs/vega-dropdown_5.cjs.entry.js +52 -14
  59. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  60. package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
  61. package/dist/cjs/vega-file-uploader.cjs.entry.js +6 -6
  62. package/dist/cjs/vega-flag-icon.cjs.entry.js +3 -3
  63. package/dist/cjs/vega-flex.cjs.entry.js +6 -6
  64. package/dist/cjs/vega-font.cjs.entry.js +4 -4
  65. package/dist/cjs/vega-form.cjs.entry.js +9 -9
  66. package/dist/cjs/vega-grid.cjs.entry.js +4 -4
  67. package/dist/cjs/vega-icon.cjs.entry.js +4 -4
  68. package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
  69. package/dist/cjs/vega-input-credit-card.cjs.entry.js +10 -10
  70. package/dist/cjs/vega-input-numeric.cjs.entry.js +10 -10
  71. package/dist/cjs/vega-input-passcode.cjs.entry.js +9 -9
  72. package/dist/cjs/vega-input-phone-number.cjs.entry.js +8 -8
  73. package/dist/cjs/vega-input-range.cjs.entry.js +6 -6
  74. package/dist/cjs/vega-input-select.cjs.entry.js +8 -8
  75. package/dist/cjs/vega-input.cjs.entry.js +41 -28
  76. package/dist/cjs/vega-internal-event-id-a1837fa2.js +126 -0
  77. package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
  78. package/dist/cjs/vega-left-nav_5.cjs.entry.js +118 -13
  79. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
  80. package/dist/cjs/vega-page-notification_2.cjs.entry.js +2 -2
  81. package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +3 -3
  82. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +24 -8
  83. package/dist/cjs/vega-pagination.cjs.entry.js +44 -20
  84. package/dist/cjs/vega-popover_2.cjs.entry.js +48 -12
  85. package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +43 -12
  86. package/dist/cjs/vega-radio_2.cjs.entry.js +10 -10
  87. package/dist/cjs/vega-rich-text-content.cjs.entry.js +101 -20
  88. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +30 -19
  89. package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +9 -9
  90. package/dist/cjs/vega-section-title.cjs.entry.js +21 -3
  91. package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
  92. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +9 -9
  93. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +8 -8
  94. package/dist/cjs/vega-sidenav_3.cjs.entry.js +8 -8
  95. package/dist/cjs/vega-signature-capture.cjs.entry.js +9 -9
  96. package/dist/cjs/vega-stepper.cjs.entry.js +7 -7
  97. package/dist/cjs/vega-tab-group_2.cjs.entry.js +3 -3
  98. package/dist/cjs/vega-table_11.cjs.entry.js +8 -8
  99. package/dist/cjs/vega-text.cjs.entry.js +1 -1
  100. package/dist/cjs/vega-textarea.cjs.entry.js +6 -6
  101. package/dist/cjs/vega-time-picker_2.cjs.entry.js +12 -12
  102. package/dist/cjs/vega-toggle-switch.cjs.entry.js +6 -6
  103. package/dist/cjs/vega-tooltip_2.cjs.entry.js +8 -8
  104. package/dist/cjs/vega.cjs.js +11 -11
  105. package/dist/cjs/wait-for-component-did-render-b6d12d51.js +32 -0
  106. package/dist/collection/components/vega-banner/slimmers/renderers/vega-banner-renderer.js +1 -0
  107. package/dist/collection/components/vega-banner/vega-banner.css +36 -0
  108. package/dist/collection/components/vega-box/vega-box.js +1 -1
  109. package/dist/collection/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-item-renderer.js +9 -6
  110. package/dist/collection/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-renderer.js +4 -0
  111. package/dist/collection/components/vega-breadcrumb/vega-breadcrumb.css +6 -0
  112. package/dist/collection/components/vega-breadcrumb/vega-breadcrumb.js +31 -0
  113. package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +4 -4
  114. package/dist/collection/components/vega-calendar/vega-calendar-event/vega-calendar-event.css +15 -12
  115. package/dist/collection/components/vega-calendar/vega-calendar-event/vega-calendar-event.js +1 -1
  116. package/dist/collection/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.js +17 -3
  117. package/dist/collection/components/vega-calendar/vega-calendar.css +1 -1
  118. package/dist/collection/components/vega-card/vega-card.css +157 -0
  119. package/dist/collection/components/vega-card/vega-card.js +1 -1
  120. package/dist/collection/components/vega-chip/vega-chip.js +26 -1
  121. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-current-period-controller.js +5 -10
  122. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-is-dual-months-controller.js +64 -0
  123. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-header-render.js +3 -6
  124. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.js +3 -11
  125. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-year-month-switcher-renderer.js +2 -2
  126. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.js +9 -10
  127. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.css +13 -15
  128. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.js +41 -2
  129. package/dist/collection/components/vega-dialog/vega-dialog.js +1 -1
  130. package/dist/collection/components/vega-divider/slimmers/controllers/vega-divider-size-controller.js +1 -1
  131. package/dist/collection/components/vega-divider/vega-divider.css +157 -0
  132. package/dist/collection/components/vega-divider/vega-divider.js +1 -1
  133. package/dist/collection/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.js +37 -1
  134. package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-renderer.js +4 -1
  135. package/dist/collection/components/vega-flex/vega-flex.css +157 -0
  136. package/dist/collection/components/vega-flex/vega-flex.js +1 -1
  137. package/dist/collection/components/vega-input/slimmers/controllers/vega-input-mask-config-controller.js +13 -12
  138. package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-renderer.js +4 -1
  139. package/dist/collection/components/vega-input/vega-input.js +26 -1
  140. package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.js +37 -1
  141. package/dist/collection/components/vega-modal/slimmers/renderers/vega-modal-renderer.js +11 -1
  142. package/dist/collection/components/vega-modal/vega-modal.css +2683 -7
  143. package/dist/collection/components/vega-modal/vega-modal.js +75 -0
  144. package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.js +85 -2
  145. package/dist/collection/components/vega-nav/vega-left-nav/vega-left-nav.js +23 -0
  146. package/dist/collection/components/vega-pagination/constants/page-size.js +2 -0
  147. package/dist/collection/components/vega-pagination/internal/vega-pagination-page-size-selector.js +11 -7
  148. package/dist/collection/components/vega-pagination/slimmers/controllers/vega-pagination-page-size-observer-controller.js +11 -1
  149. package/dist/collection/components/vega-pagination/utils/page-size-option-utils.js +57 -0
  150. package/dist/collection/components/vega-pagination/vega-pagination-page-size-selector-mobile/slimmers/renderers/page-size-selector-mobile-dropdown-renderer.js +15 -5
  151. package/dist/collection/components/vega-pagination/vega-pagination-page-size-selector-mobile/vega-pagination-page-size-selector-mobile.js +39 -3
  152. package/dist/collection/components/vega-pagination/vega-pagination.js +32 -11
  153. package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +25 -1
  154. package/dist/collection/components/vega-popover/vega-popover-content-box/vega-popover-content-box.js +6 -1
  155. package/dist/collection/components/vega-popover/vega-popover.js +7 -0
  156. package/dist/collection/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-direction-controller.js +34 -3
  157. package/dist/collection/components/vega-progress-tracker/slimmers/renderers/vega-progress-tracker-renderer.js +3 -2
  158. package/dist/collection/components/vega-rich-text-editor/constants/constant.js +20 -0
  159. package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +2 -1
  160. package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +13 -6
  161. package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +18 -9
  162. package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +12 -1
  163. package/dist/collection/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.js +12 -0
  164. package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +2 -1
  165. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +20 -3
  166. package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +12 -4
  167. package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +2 -1
  168. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-format-default-styles.js +22 -0
  169. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +43 -32
  170. package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +2 -1
  171. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +15 -4
  172. package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +6 -2
  173. package/dist/collection/components/vega-rich-text-editor/dto/blocks/html-block.js +9 -15
  174. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +3 -3
  175. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +3 -3
  176. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +3 -7
  177. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +50 -9
  178. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +25 -6
  179. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-block-filter-styles-strategy.js +39 -0
  180. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-node-filter-styles-strategy.js +47 -0
  181. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy-registry.js +64 -0
  182. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy.abstract.js +166 -2
  183. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/image-node/image-filter-styles-strategy.js +39 -0
  184. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-block-filter-styles-strategy.js +36 -0
  185. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-heading-item-block-filter-styles-strategy.js +29 -0
  186. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-item-block-filter-styles-strategy.js +51 -0
  187. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-title-item-block-filter-styles-strategy.js +29 -0
  188. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/predicate.js +94 -0
  189. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/alignment-filter-styles-strategy.js +39 -0
  190. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/heading-filter-styles-strategy.js +15 -0
  191. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/paragraph-filter-styles-strategy.js +48 -0
  192. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/title-filter-styles-strategy.js +16 -0
  193. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/code-filter-styles-strategy.js +55 -0
  194. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/link-filter-styles-strategy.js +69 -0
  195. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/text-format-filter-styles-strategy.js +89 -0
  196. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/title-heading-node-filter-styles-strategy.js +108 -0
  197. package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +7 -2
  198. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +2 -2
  199. package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +15 -4
  200. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +84 -14
  201. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +61 -6
  202. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +16 -0
  203. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +14 -3
  204. package/dist/collection/components/vega-rich-text-editor/dto/setup.js +50 -2
  205. package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +10 -0
  206. package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-extension.js +9 -3
  207. package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.js +17 -1
  208. package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.js +17 -18
  209. package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.js +19 -0
  210. package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-block.js +3 -3
  211. package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-body-block.js +3 -3
  212. package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.js +21 -4
  213. package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.js +3 -3
  214. package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-block.js +3 -3
  215. package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.js +3 -3
  216. package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-row-block.js +3 -3
  217. package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/caption-to-caption-block-strategy.js +2 -1
  218. package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/td-to-table-cell-block-strategy.js +2 -2
  219. package/dist/collection/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-block/table-block-filter-styles-strategy.js +39 -0
  220. package/dist/collection/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-caption/table-caption-filter-styles-strategy.js +39 -0
  221. package/dist/collection/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-cell/table-cell-filter-styles-strategy.js +63 -0
  222. package/dist/collection/components/vega-rich-text-editor/extensions/table/table-extension.js +7 -0
  223. package/dist/collection/components/vega-rich-text-editor/helpers/utils.js +24 -0
  224. package/dist/collection/components/vega-rich-text-editor/public-api.js +2 -0
  225. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/bold-annotaion-handler.js +3 -2
  226. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.js +2 -25
  227. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.js +47 -3
  228. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.js +30 -53
  229. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/italic-annotation-handler.js +2 -1
  230. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/link-annotation-handler.js +2 -1
  231. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/strike-through-annotation-handler.js +2 -1
  232. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.js +4 -1
  233. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/underline-annotation-handler.js +2 -1
  234. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +85 -17
  235. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +12 -5
  236. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.js +95 -43
  237. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-element-to-text-node-strategy.js +1 -2
  238. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/predicate.js +29 -0
  239. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/strategy-tags.js +142 -0
  240. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +1 -0
  241. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-source-view-renderer.js +12 -2
  242. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +1 -1
  243. package/dist/collection/components/vega-section-title/slimmers/renderers/vega-section-title-renderer.js +8 -2
  244. package/dist/collection/components/vega-section-title/vega-section-title.css +35 -0
  245. package/dist/collection/components/vega-section-title/vega-section-title.js +64 -0
  246. package/dist/collection/components/vega-stepper/vega-stepper.css +3 -0
  247. package/dist/collection/helpers/calendar/calendar-date.js +10 -0
  248. package/dist/collection/helpers/calendar/calendar-view-generator/calendar-view-generator.abstract.js +2 -2
  249. package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
  250. package/dist/collection/helpers/formatter/responsive-map-formatter/responsive-margin-formatter.js +3 -3
  251. package/dist/collection/helpers/formatter/string-formatter/custom-formatter-strategy.js +3 -1
  252. package/dist/collection/helpers/formatter/string-formatter/number-mask-strategy.js +3 -1
  253. package/dist/collection/helpers/formatter/string-formatter/number-thousand-comma-strategy.js +3 -2
  254. package/dist/collection/helpers/formatter/string-formatter/string-format-strategy.abstract.js +4 -1
  255. package/dist/collection/helpers/formatter/string-formatter/string-mask-strategy.js +38 -7
  256. package/dist/collection/helpers/formatter/string-formatter/thousand-comma-strategy.js +4 -0
  257. package/dist/collection/helpers/keyboard/keyboard-manager.js +11 -3
  258. package/dist/collection/helpers/slimmers/aria-dialog-focusable-trap-slimmer.js +67 -68
  259. package/dist/collection/types/type-guard.js +21 -0
  260. package/dist/collection/utils/ui.js +76 -2
  261. package/dist/esm/app-globals-80a7d395.js +428 -0
  262. package/dist/esm/aria-dialog-focusable-trap-slimmer-cc6a8c3e.js +215 -0
  263. package/dist/esm/child-nodes-notify-observer-slimmer-a8cb19cf.js +88 -0
  264. package/dist/esm/code-block-cd913077.js +5189 -0
  265. package/dist/esm/component-value-history-controller-slimmer.abstract-e595761d.js +709 -0
  266. package/dist/esm/content-state-89f8eecb.js +4942 -0
  267. package/dist/esm/date-required-rule-2b08f32c.js +90 -0
  268. package/dist/esm/design-token-7566d54c.js +388 -0
  269. package/dist/esm/dom-node-subject-observer-factory-aca0116e.js +138 -0
  270. package/dist/esm/element-appender-slimmer-df2a2da2.js +1972 -0
  271. package/dist/esm/event-emit-slimmer-9abc9241.js +265 -0
  272. package/dist/esm/form-field-controller-slimmer-40fcb5c2.js +1264 -0
  273. package/dist/esm/image-annotation-action-6048d32e.js +280 -0
  274. package/dist/esm/index.js +15 -15
  275. package/dist/esm/inject-keyboard-manager-c6557f50.js +35 -0
  276. package/dist/esm/keyboard-manager-c7b125d7.js +146 -0
  277. package/dist/esm/keyboard-manager-slimmer-6109039b.js +37 -0
  278. package/dist/esm/loader.js +11 -11
  279. package/dist/esm/month-view-generator-139ace5a.js +97 -0
  280. package/dist/esm/page-size-option-utils-50afc81a.js +61 -0
  281. package/dist/esm/public-rules-e42bce9d.js +31 -0
  282. package/dist/esm/range-b76edec7.js +176 -0
  283. package/dist/esm/responsive-format-facade-151dbd10.js +940 -0
  284. package/dist/esm/rich-text-editor-required-rule-1fc7c040.js +62 -0
  285. package/dist/esm/split-cell-operation-548ea374.js +2395 -0
  286. package/dist/esm/string-format-strategy.abstract-6488031a.js +61 -0
  287. package/dist/esm/string-input-formatter-slimmer-625e17a2.js +228 -0
  288. package/dist/esm/string-mask-strategy-a165d316.js +201 -0
  289. package/dist/esm/style-formatter-280757ae.js +32 -0
  290. package/dist/esm/sub-state-notify-slimmer-6c972bb4.js +79 -0
  291. package/dist/esm/sub-state-observer-slimmer-53643b5c.js +132 -0
  292. package/dist/esm/time-required-rule-3f5a8822.js +138 -0
  293. package/dist/esm/token-extension-5ee7a3f1.js +7591 -0
  294. package/dist/esm/type-guard-f6c9c89d.js +1979 -0
  295. package/dist/esm/ui-b7600a48.js +335 -0
  296. package/dist/esm/valid-credit-card-number-rule-3bf19ad6.js +171 -0
  297. package/dist/esm/vega-accordion.entry.js +6 -6
  298. package/dist/esm/vega-app-header-button.entry.js +6 -6
  299. package/dist/esm/vega-backdrop.entry.js +1 -1
  300. package/dist/esm/vega-banner.entry.js +5 -4
  301. package/dist/esm/vega-box.entry.js +5 -5
  302. package/dist/esm/vega-breadcrumb.entry.js +27 -10
  303. package/dist/esm/vega-button-circle.entry.js +7 -7
  304. package/dist/esm/vega-button-group_2.entry.js +6 -6
  305. package/dist/esm/vega-button-link.entry.js +3 -3
  306. package/dist/esm/vega-button.entry.js +6 -6
  307. package/dist/esm/vega-calendar_4.entry.js +30 -17
  308. package/dist/esm/vega-card.entry.js +5 -5
  309. package/dist/esm/vega-carousel.entry.js +5 -5
  310. package/dist/esm/vega-checkbox_2.entry.js +7 -7
  311. package/dist/esm/vega-chip.entry.js +7 -7
  312. package/dist/esm/vega-code-block.entry.js +10 -10
  313. package/dist/esm/vega-color-picker.entry.js +6 -6
  314. package/dist/esm/vega-combo-box.entry.js +9 -9
  315. package/dist/esm/vega-date-picker_2.entry.js +343 -285
  316. package/dist/esm/vega-dialog_2.entry.js +74 -10
  317. package/dist/esm/vega-divider.entry.js +5 -5
  318. package/dist/esm/vega-dropdown_5.entry.js +53 -15
  319. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  320. package/dist/esm/vega-field-label.entry.js +3 -3
  321. package/dist/esm/vega-file-uploader.entry.js +6 -6
  322. package/dist/esm/vega-flag-icon.entry.js +3 -3
  323. package/dist/esm/vega-flex.entry.js +6 -6
  324. package/dist/esm/vega-font.entry.js +4 -4
  325. package/dist/esm/vega-form.entry.js +9 -9
  326. package/dist/esm/vega-grid.entry.js +4 -4
  327. package/dist/esm/vega-icon.entry.js +4 -4
  328. package/dist/esm/vega-image-uploader.entry.js +8 -8
  329. package/dist/esm/vega-input-credit-card.entry.js +10 -10
  330. package/dist/esm/vega-input-numeric.entry.js +10 -10
  331. package/dist/esm/vega-input-passcode.entry.js +9 -9
  332. package/dist/esm/vega-input-phone-number.entry.js +8 -8
  333. package/dist/esm/vega-input-range.entry.js +6 -6
  334. package/dist/esm/vega-input-select.entry.js +8 -8
  335. package/dist/esm/vega-input.entry.js +41 -28
  336. package/dist/esm/vega-internal-event-id-70bd893d.js +73 -0
  337. package/dist/esm/vega-item-toggle.entry.js +3 -3
  338. package/dist/esm/vega-left-nav_5.entry.js +118 -13
  339. package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
  340. package/dist/esm/vega-page-notification_2.entry.js +2 -2
  341. package/dist/esm/vega-pagination-page-selector-mobile.entry.js +3 -3
  342. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +24 -8
  343. package/dist/esm/vega-pagination.entry.js +44 -20
  344. package/dist/esm/vega-popover_2.entry.js +48 -12
  345. package/dist/esm/vega-progress-tracker_2.entry.js +43 -12
  346. package/dist/esm/vega-radio_2.entry.js +10 -10
  347. package/dist/esm/vega-rich-text-content.entry.js +101 -20
  348. package/dist/esm/vega-rich-text-editor_4.entry.js +30 -19
  349. package/dist/esm/vega-rich-text-table-properties_3.entry.js +9 -9
  350. package/dist/esm/vega-section-title.entry.js +21 -3
  351. package/dist/esm/vega-segment-control.entry.js +3 -3
  352. package/dist/esm/vega-selection-chip_2.entry.js +9 -9
  353. package/dist/esm/vega-selection-tile_2.entry.js +8 -8
  354. package/dist/esm/vega-sidenav_3.entry.js +8 -8
  355. package/dist/esm/vega-signature-capture.entry.js +9 -9
  356. package/dist/esm/vega-stepper.entry.js +7 -7
  357. package/dist/esm/vega-tab-group_2.entry.js +3 -3
  358. package/dist/esm/vega-table_11.entry.js +8 -8
  359. package/dist/esm/vega-text.entry.js +1 -1
  360. package/dist/esm/vega-textarea.entry.js +6 -6
  361. package/dist/esm/vega-time-picker_2.entry.js +12 -12
  362. package/dist/esm/vega-toggle-switch.entry.js +6 -6
  363. package/dist/esm/vega-tooltip_2.entry.js +8 -8
  364. package/dist/esm/vega.js +11 -11
  365. package/dist/esm/wait-for-component-did-render-6980a1a6.js +30 -0
  366. package/dist/sri/vega-sri-manifest.json +343 -339
  367. package/dist/types/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-item-renderer.d.ts +1 -0
  368. package/dist/types/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-renderer.d.ts +1 -0
  369. package/dist/types/components/vega-breadcrumb/vega-breadcrumb.d.ts +10 -0
  370. package/dist/types/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.d.ts +5 -0
  371. package/dist/types/components/vega-chip/vega-chip.d.ts +9 -0
  372. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-current-period-controller.d.ts +1 -6
  373. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-is-dual-months-controller.d.ts +28 -0
  374. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-header-render.d.ts +1 -2
  375. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +1 -2
  376. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-year-month-switcher-renderer.d.ts +1 -1
  377. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.d.ts +1 -1
  378. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.d.ts +12 -0
  379. package/dist/types/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.d.ts +12 -0
  380. package/dist/types/components/vega-dropdown/slimmers/renderers/vega-dropdown-renderer.d.ts +1 -0
  381. package/dist/types/components/vega-input/slimmers/controllers/vega-input-mask-config-controller.d.ts +1 -0
  382. package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-renderer.d.ts +1 -0
  383. package/dist/types/components/vega-input/types.d.ts +35 -1
  384. package/dist/types/components/vega-input/vega-input.d.ts +17 -1
  385. package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.d.ts +9 -0
  386. package/dist/types/components/vega-modal/slimmers/renderers/vega-modal-renderer.d.ts +3 -0
  387. package/dist/types/components/vega-modal/vega-modal.d.ts +24 -1
  388. package/dist/types/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.d.ts +17 -0
  389. package/dist/types/components/vega-pagination/constants/page-size.d.ts +2 -0
  390. package/dist/types/components/vega-pagination/internal/vega-pagination-page-size-selector.d.ts +3 -2
  391. package/dist/types/components/vega-pagination/slimmers/controllers/vega-pagination-page-size-observer-controller.d.ts +2 -0
  392. package/dist/types/components/vega-pagination/types.d.ts +9 -0
  393. package/dist/types/components/vega-pagination/utils/page-size-option-utils.d.ts +42 -0
  394. package/dist/types/components/vega-pagination/vega-pagination-page-size-selector-mobile/slimmers/renderers/page-size-selector-mobile-dropdown-renderer.d.ts +2 -0
  395. package/dist/types/components/vega-pagination/vega-pagination-page-size-selector-mobile/vega-pagination-page-size-selector-mobile.d.ts +9 -2
  396. package/dist/types/components/vega-pagination/vega-pagination.d.ts +8 -3
  397. package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +6 -0
  398. package/dist/types/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-direction-controller.d.ts +14 -2
  399. package/dist/types/components/vega-progress-tracker/slimmers/renderers/vega-progress-tracker-renderer.d.ts +1 -1
  400. package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +5 -0
  401. package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +6 -0
  402. package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +7 -0
  403. package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +7 -0
  404. package/dist/types/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.d.ts +14 -0
  405. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +15 -2
  406. package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +6 -0
  407. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-format-default-styles.d.ts +22 -0
  408. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +7 -0
  409. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +4 -2
  410. package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +2 -2
  411. package/dist/types/components/vega-rich-text-editor/dto/blocks/html-block.d.ts +1 -11
  412. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +1 -1
  413. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +1 -1
  414. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +1 -1
  415. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +15 -2
  416. package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +9 -3
  417. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-block-filter-styles-strategy.d.ts +27 -0
  418. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-node-filter-styles-strategy.d.ts +27 -0
  419. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy-registry.d.ts +27 -1
  420. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy.abstract.d.ts +104 -0
  421. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/image-node/image-filter-styles-strategy.d.ts +28 -0
  422. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-block-filter-styles-strategy.d.ts +23 -0
  423. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-heading-item-block-filter-styles-strategy.d.ts +19 -0
  424. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-item-block-filter-styles-strategy.d.ts +34 -0
  425. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-title-item-block-filter-styles-strategy.d.ts +19 -0
  426. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/predicate.d.ts +72 -0
  427. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/alignment-filter-styles-strategy.d.ts +27 -0
  428. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/heading-filter-styles-strategy.d.ts +10 -0
  429. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/paragraph-filter-styles-strategy.d.ts +34 -0
  430. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/title-filter-styles-strategy.d.ts +11 -0
  431. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/code-filter-styles-strategy.d.ts +40 -0
  432. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/link-filter-styles-strategy.d.ts +37 -0
  433. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/text-format-filter-styles-strategy.d.ts +41 -0
  434. package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/title-heading-node-filter-styles-strategy.d.ts +62 -0
  435. package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +7 -3
  436. package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +1 -1
  437. package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +5 -3
  438. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +43 -4
  439. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +25 -0
  440. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +5 -0
  441. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.d.ts +12 -0
  442. package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +8 -0
  443. package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.d.ts +8 -0
  444. package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.d.ts +7 -1
  445. package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.d.ts +9 -1
  446. package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-block.d.ts +1 -1
  447. package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-body-block.d.ts +1 -1
  448. package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.d.ts +5 -2
  449. package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.d.ts +1 -1
  450. package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-block.d.ts +1 -1
  451. package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.d.ts +1 -1
  452. package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-row-block.d.ts +1 -1
  453. package/dist/types/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-block/table-block-filter-styles-strategy.d.ts +29 -0
  454. package/dist/types/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-caption/table-caption-filter-styles-strategy.d.ts +29 -0
  455. package/dist/types/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-cell/table-cell-filter-styles-strategy.d.ts +46 -0
  456. package/dist/types/components/vega-rich-text-editor/helpers/utils.d.ts +8 -0
  457. package/dist/types/components/vega-rich-text-editor/interface.d.ts +27 -5
  458. package/dist/types/components/vega-rich-text-editor/public-api.d.ts +1 -0
  459. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.d.ts +0 -7
  460. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.d.ts +11 -1
  461. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.d.ts +11 -1
  462. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +43 -7
  463. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +8 -3
  464. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.d.ts +34 -1
  465. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/predicate.d.ts +21 -0
  466. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/strategy-tags.d.ts +83 -0
  467. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-source-view-renderer.d.ts +6 -0
  468. package/dist/types/components/vega-section-title/slimmers/renderers/vega-section-title-renderer.d.ts +2 -0
  469. package/dist/types/components/vega-section-title/types.d.ts +1 -0
  470. package/dist/types/components/vega-section-title/vega-section-title.d.ts +14 -0
  471. package/dist/types/components.d.ts +93 -8
  472. package/dist/types/helpers/calendar/calendar-date.d.ts +7 -0
  473. package/dist/types/helpers/calendar/calendar-view-generator/calendar-view-generator.abstract.d.ts +0 -1
  474. package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
  475. package/dist/types/helpers/formatter/string-formatter/custom-formatter-strategy.d.ts +2 -1
  476. package/dist/types/helpers/formatter/string-formatter/number-mask-strategy.d.ts +2 -1
  477. package/dist/types/helpers/formatter/string-formatter/number-thousand-comma-strategy.d.ts +2 -1
  478. package/dist/types/helpers/formatter/string-formatter/string-format-strategy.abstract.d.ts +1 -0
  479. package/dist/types/helpers/formatter/string-formatter/string-mask-strategy.d.ts +32 -4
  480. package/dist/types/helpers/formatter/string-formatter/thousand-comma-strategy.d.ts +1 -0
  481. package/dist/types/helpers/keyboard/keyboard-manager.d.ts +1 -0
  482. package/dist/types/helpers/slimmers/aria-dialog-focusable-trap-slimmer.d.ts +20 -9
  483. package/dist/types/types/components.type.d.ts +3 -0
  484. package/dist/types/types/type-guard.d.ts +15 -1
  485. package/dist/types/types/ui.type.d.ts +11 -1
  486. package/dist/types/utils/ui.d.ts +17 -1
  487. package/dist/vega/index.esm.js +1 -1
  488. package/dist/vega/p-001d36af.js +1 -0
  489. package/dist/vega/p-01541820.entry.js +1 -0
  490. package/dist/vega/p-0304c3a7.js +1 -0
  491. package/dist/vega/p-08f03a52.entry.js +1 -0
  492. package/dist/vega/p-0a145766.entry.js +1 -0
  493. package/dist/vega/p-0d205fbf.js +1 -0
  494. package/dist/vega/p-0fc2ccc4.entry.js +1 -0
  495. package/dist/vega/p-118aeed1.entry.js +1 -0
  496. package/dist/vega/p-1a4e8d8a.js +1 -0
  497. package/dist/vega/p-23dc4064.entry.js +1 -0
  498. package/dist/vega/p-24b45c85.js +1 -0
  499. package/dist/vega/p-262a27d0.js +1 -0
  500. package/dist/vega/p-27dc6562.entry.js +1 -0
  501. package/dist/vega/p-295326ca.entry.js +1 -0
  502. package/dist/vega/p-2beace1c.entry.js +1 -0
  503. package/dist/vega/p-2ce2972f.js +1 -0
  504. package/dist/vega/p-2e7d5e28.entry.js +1 -0
  505. package/dist/vega/p-2f99c511.js +1 -0
  506. package/dist/vega/p-32592497.entry.js +1 -0
  507. package/dist/vega/p-33860e54.js +1 -0
  508. package/dist/vega/p-37a9f4b4.entry.js +1 -0
  509. package/dist/vega/p-4013d954.entry.js +1 -0
  510. package/dist/vega/p-42da45e3.entry.js +1 -0
  511. package/dist/vega/p-42e246e4.entry.js +1 -0
  512. package/dist/vega/p-479a169c.entry.js +1 -0
  513. package/dist/vega/p-47a2eec1.entry.js +1 -0
  514. package/dist/vega/p-49ae8c79.js +1 -0
  515. package/dist/vega/p-4ed416e7.js +1 -0
  516. package/dist/vega/p-53ba1adb.entry.js +1 -0
  517. package/dist/vega/p-55019e55.entry.js +1 -0
  518. package/dist/vega/p-565aac6e.entry.js +1 -0
  519. package/dist/vega/p-574586c9.entry.js +1 -0
  520. package/dist/vega/p-5781b9f4.entry.js +1 -0
  521. package/dist/vega/p-57827342.entry.js +1 -0
  522. package/dist/vega/p-59c6f795.js +1 -0
  523. package/dist/vega/p-5a8be21c.entry.js +1 -0
  524. package/dist/vega/p-5baff397.js +1 -0
  525. package/dist/vega/p-5e9f6fb6.entry.js +1 -0
  526. package/dist/vega/p-5f377954.js +1 -1
  527. package/dist/vega/p-5f95a2fa.js +1 -0
  528. package/dist/vega/p-6216c30e.js +1 -0
  529. package/dist/vega/p-62e80151.entry.js +1 -0
  530. package/dist/vega/p-63d73fa0.entry.js +1 -0
  531. package/dist/vega/p-64e22fe5.js +1 -0
  532. package/dist/vega/p-679b1f00.entry.js +1 -0
  533. package/dist/vega/p-6e70d3cc.js +1 -0
  534. package/dist/vega/p-757bfca2.entry.js +1 -0
  535. package/dist/vega/p-76063dcb.js +1 -0
  536. package/dist/vega/p-76daa632.entry.js +1 -0
  537. package/dist/vega/p-77c6f14a.entry.js +1 -0
  538. package/dist/vega/p-7ac9e8ff.entry.js +1 -0
  539. package/dist/vega/p-83863463.js +1 -0
  540. package/dist/vega/p-88e6618d.js +1 -0
  541. package/dist/vega/p-90a0b9f3.entry.js +1 -0
  542. package/dist/vega/p-9324dd2c.entry.js +1 -0
  543. package/dist/vega/p-98c44c03.js +1 -0
  544. package/dist/vega/p-9aa1c66a.entry.js +1 -0
  545. package/dist/vega/p-9b01a28a.entry.js +1 -0
  546. package/dist/vega/p-9b14ac66.entry.js +1 -0
  547. package/dist/vega/p-9dcecdd3.js +1 -0
  548. package/dist/vega/p-a1d51bc2.js +1 -0
  549. package/dist/vega/p-ab4b06c9.entry.js +1 -0
  550. package/dist/vega/p-ac43be09.entry.js +1 -0
  551. package/dist/vega/p-add63fe0.entry.js +1 -0
  552. package/dist/vega/p-ae0f03c1.js +1 -0
  553. package/dist/vega/p-b525c800.entry.js +1 -0
  554. package/dist/vega/p-be651266.entry.js +1 -0
  555. package/dist/vega/p-c0d45f77.entry.js +1 -0
  556. package/dist/vega/p-c2e7992b.js +1 -0
  557. package/dist/vega/p-c56aa01c.entry.js +1 -0
  558. package/dist/vega/p-cc3c661c.entry.js +1 -0
  559. package/dist/vega/p-cda09e99.entry.js +1 -0
  560. package/dist/vega/p-d0ac7af8.js +1 -0
  561. package/dist/vega/p-d289a6af.js +3 -0
  562. package/dist/vega/p-d29e8972.entry.js +1 -0
  563. package/dist/vega/p-d47aa28f.js +1 -0
  564. package/dist/vega/p-d90eee9a.entry.js +1 -0
  565. package/dist/vega/p-da742a7f.entry.js +1 -0
  566. package/dist/vega/p-dc6e7a77.js +1 -0
  567. package/dist/vega/p-dcf8f58f.entry.js +1 -0
  568. package/dist/vega/p-dff66a67.entry.js +1 -0
  569. package/dist/vega/p-e1117034.entry.js +1 -0
  570. package/dist/vega/p-e223e0dc.entry.js +1 -0
  571. package/dist/vega/p-e22e5aa1.js +1 -0
  572. package/dist/vega/p-e753fac2.entry.js +1 -0
  573. package/dist/vega/p-e7a4b760.entry.js +1 -0
  574. package/dist/vega/p-e8fc8495.entry.js +1 -0
  575. package/dist/vega/p-ea2b5dbb.js +1 -0
  576. package/dist/vega/p-eccabba7.entry.js +1 -0
  577. package/dist/vega/p-f0d605e9.entry.js +1 -0
  578. package/dist/vega/p-f28a6074.js +1 -0
  579. package/dist/vega/p-f2c65579.entry.js +1 -0
  580. package/dist/vega/p-f2cef51a.js +1 -0
  581. package/dist/vega/p-f40d479d.entry.js +1 -0
  582. package/dist/vega/p-f5013494.entry.js +1 -0
  583. package/dist/vega/p-f509b439.js +1 -0
  584. package/dist/vega/p-f5d3ce94.js +1 -0
  585. package/dist/vega/p-f69e2801.entry.js +1 -0
  586. package/dist/vega/p-fa654762.entry.js +1 -0
  587. package/dist/vega/p-fbc5a7f6.entry.js +1 -0
  588. package/dist/vega/p-fd5ddc55.js +1 -0
  589. package/dist/vega/p-ff47aeee.entry.js +1 -0
  590. package/dist/vega/vega.esm.js +1 -1
  591. package/package.json +3 -2
  592. package/dist/cjs/app-globals-e9fdfbf9.js +0 -430
  593. package/dist/cjs/aria-dialog-focusable-trap-slimmer-6faafc3e.js +0 -218
  594. package/dist/cjs/child-nodes-notify-observer-slimmer-06c78f97.js +0 -90
  595. package/dist/cjs/code-block-847534e3.js +0 -4453
  596. package/dist/cjs/component-value-history-controller-slimmer.abstract-d7f9812a.js +0 -714
  597. package/dist/cjs/content-state-99be18a3.js +0 -4076
  598. package/dist/cjs/date-required-rule-3823d506.js +0 -92
  599. package/dist/cjs/design-token-b497bb6e.js +0 -402
  600. package/dist/cjs/dom-node-subject-observer-factory-f7ed3bdc.js +0 -141
  601. package/dist/cjs/element-appender-slimmer-eba4f3a2.js +0 -1974
  602. package/dist/cjs/event-emit-slimmer-83f8e2bd.js +0 -267
  603. package/dist/cjs/form-field-controller-slimmer-93ca7239.js +0 -1266
  604. package/dist/cjs/image-annotation-action-9d6af380.js +0 -285
  605. package/dist/cjs/inject-keyboard-manager-23d07d87.js +0 -37
  606. package/dist/cjs/keyboard-manager-3923e29b.js +0 -140
  607. package/dist/cjs/keyboard-manager-slimmer-f602725d.js +0 -39
  608. package/dist/cjs/month-view-generator-aa8e8e74.js +0 -102
  609. package/dist/cjs/public-rules-1dbda124.js +0 -46
  610. package/dist/cjs/range-60fb9dd2.js +0 -178
  611. package/dist/cjs/responsive-format-facade-a32cdb67.js +0 -944
  612. package/dist/cjs/rich-text-editor-required-rule-b4aab68d.js +0 -64
  613. package/dist/cjs/split-cell-operation-190d4a87.js +0 -2411
  614. package/dist/cjs/string-format-strategy.abstract-730088ee.js +0 -60
  615. package/dist/cjs/string-input-formatter-slimmer-9d6df58b.js +0 -230
  616. package/dist/cjs/string-mask-strategy-b69e3b9e.js +0 -172
  617. package/dist/cjs/style-formatter-9d8a4ad2.js +0 -34
  618. package/dist/cjs/sub-state-notify-slimmer-c80b9d21.js +0 -81
  619. package/dist/cjs/sub-state-observer-slimmer-15740c97.js +0 -134
  620. package/dist/cjs/time-required-rule-6524b650.js +0 -141
  621. package/dist/cjs/token-extension-b7c4ea17.js +0 -7438
  622. package/dist/cjs/type-guard-2a46bca5.js +0 -2022
  623. package/dist/cjs/ui-b3db0122.js +0 -277
  624. package/dist/cjs/valid-credit-card-number-rule-8eb02ea7.js +0 -173
  625. package/dist/cjs/vega-internal-event-id-67bb91c1.js +0 -124
  626. package/dist/cjs/wait-for-component-did-render-9e41b39e.js +0 -32
  627. package/dist/collection/components/vega-calendar/slimmers/common/helpers/test/calendar-event-repeat-pattern-factory.test.js +0 -195
  628. package/dist/collection/components/vega-calendar/slimmers/common/layout/test/long-event-layout-generator.test.js +0 -94
  629. package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/layout/test/day-view-event-layout-generator.test.js +0 -72
  630. package/dist/collection/components/vega-code-block/test/code-block-range.test.js +0 -81
  631. package/dist/collection/components/vega-dropdown/test/share.js +0 -13
  632. package/dist/collection/components/vega-input-credit-card/test/share.js +0 -21
  633. package/dist/collection/components/vega-nav/vega-left-nav/test/vega-left-nav-mock-data.js +0 -147
  634. package/dist/collection/components/vega-rich-text-editor/helpers/extension-context-manager.test.js +0 -21
  635. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +0 -71
  636. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.js +0 -69
  637. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.js +0 -24
  638. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +0 -20
  639. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +0 -15
  640. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +0 -32
  641. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.js +0 -11
  642. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.js +0 -16
  643. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.js +0 -20
  644. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.js +0 -87
  645. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.js +0 -32
  646. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.js +0 -17
  647. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +0 -77
  648. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.js +0 -23
  649. package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-actions.test.js +0 -39
  650. package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-style.test.js +0 -71
  651. package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +0 -381
  652. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/code-block.test.js +0 -54
  653. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/html-block.test.js +0 -167
  654. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/image-block.test.js +0 -90
  655. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-block.test.js +0 -176
  656. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-item.test.js +0 -188
  657. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/text-block.test.js +0 -193
  658. package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +0 -3375
  659. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +0 -108
  660. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +0 -510
  661. package/dist/collection/components/vega-rich-text-editor/test/dto/range.test.js +0 -53
  662. package/dist/collection/components/vega-rich-text-editor/test/e2e-utils.js +0 -182
  663. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/custom-attribute-annotation-handler.test.js +0 -49
  664. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/element-to-text-node-strategy.test.js +0 -38
  665. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/html-element-to-annotation-generator.test.js +0 -26
  666. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.js +0 -32
  667. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.js +0 -61
  668. package/dist/collection/components/vega-rich-text-editor/test/extensions/extension-test-utils.js +0 -43
  669. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/annotation-handler-registration.test.js +0 -164
  670. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-annotation-handler.test.js +0 -298
  671. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-cell-annotation-handler.test.js +0 -316
  672. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-head-cell-annotation-handler.test.js +0 -411
  673. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/caption-operation.test.js +0 -99
  674. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-annotation.test.js +0 -181
  675. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-caption-annotations.test.js +0 -84
  676. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-cell-annotation.test.js +0 -331
  677. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-color-annotation.test.js +0 -32
  678. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-dto.test.js +0 -1094
  679. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-element-to-dto-strategies.test.js +0 -1590
  680. package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-test-utils.js +0 -172
  681. package/dist/collection/components/vega-rich-text-editor/test/filter-styles-strategies/filter-styles-strategy.test.js +0 -129
  682. package/dist/collection/components/vega-rich-text-editor/test/fixture.js +0 -257
  683. package/dist/collection/components/vega-rich-text-editor/test/html-cleaner/html-content-cleaner.test.js +0 -186
  684. package/dist/collection/components/vega-rich-text-editor/test/html-cleaner/remove-whitespace-after-opening-tag-processor.test.js +0 -22
  685. package/dist/collection/components/vega-rich-text-editor/test/html-cleaner/remove-whitespace-before-closing-tag-processor.test.js +0 -22
  686. package/dist/collection/components/vega-rich-text-editor/test/html-cleaner/remove-whitespace-between-tags-processor.test.js +0 -26
  687. package/dist/collection/components/vega-rich-text-editor/test/spec-utils.js +0 -35
  688. package/dist/collection/components/vega-sidenav/test/test.helper.js +0 -68
  689. package/dist/collection/components/vega-table/slimmers/controllers/dto/test/column-render-input-model.test.js +0 -83
  690. package/dist/collection/components/vega-table/slimmers/controllers/dto/test/column-structure-model.test.js +0 -147
  691. package/dist/collection/components/vega-table/test/utils.js +0 -22
  692. package/dist/collection/components/vega-table/test/vega-table-sorter.test.js +0 -508
  693. package/dist/collection/constants/tests/validator.test.js +0 -24
  694. package/dist/collection/decorators/method-decorators/tests/component-load-required.test.js +0 -114
  695. package/dist/collection/decorators/property-decorators/tests/inject-element-appender-proxy.test.js +0 -237
  696. package/dist/collection/decorators/property-decorators/tests/inject-keyboard-manager.test.js +0 -91
  697. package/dist/collection/global/tests/before-vega-load.test.js +0 -62
  698. package/dist/collection/helpers/calendar/test/calendar-date-time.test.js +0 -27
  699. package/dist/collection/helpers/calendar/test/calendar-date.test.js +0 -172
  700. package/dist/collection/helpers/calendar/test/calendar-event.test.js +0 -263
  701. package/dist/collection/helpers/calendar/test/calendar-period/day-period.test.js +0 -118
  702. package/dist/collection/helpers/calendar/test/calendar-period/month-period.test.js +0 -144
  703. package/dist/collection/helpers/calendar/test/calendar-period/week-period.test.js +0 -114
  704. package/dist/collection/helpers/calendar/test/calendar-time.test.js +0 -45
  705. package/dist/collection/helpers/calendar/test/calendar-view-generator/day-view-generator.test.js +0 -19
  706. package/dist/collection/helpers/calendar/test/calendar-view-generator/month-view-generator.test.js +0 -123
  707. package/dist/collection/helpers/calendar/test/calendar-view-generator/week-view-generator.test.js +0 -43
  708. package/dist/collection/helpers/calendar/test/calendar-view.test.js +0 -9
  709. package/dist/collection/helpers/calendar/test/index.test.js +0 -13
  710. package/dist/collection/helpers/calendar/test/utils.test.js +0 -62
  711. package/dist/collection/helpers/change-manager/test/change-manager.test.js +0 -30
  712. package/dist/collection/helpers/change-manager/test/dom-node-subject-factory.test.js +0 -38
  713. package/dist/collection/helpers/chart/test/controllers/chart-dimension-controller.test.js +0 -63
  714. package/dist/collection/helpers/chart/test/drawers/arc-path-drawer.test.js +0 -55
  715. package/dist/collection/helpers/chart/test/drawers/legend-drawer.test.js +0 -94
  716. package/dist/collection/helpers/chart/test/drawers/line-drawer.test.js +0 -25
  717. package/dist/collection/helpers/chart/test/drawers/path-drawer.test.js +0 -21
  718. package/dist/collection/helpers/chart/test/drawers/rect-drawer.test.js +0 -78
  719. package/dist/collection/helpers/chart/test/drawers/text-drawer.test.js +0 -25
  720. package/dist/collection/helpers/chart/test/drawers/x-axis-drawer.test.js +0 -38
  721. package/dist/collection/helpers/chart/test/drawers/y-axis-drawer.test.js +0 -44
  722. package/dist/collection/helpers/chart/test/graph-context-factory.test.js +0 -17
  723. package/dist/collection/helpers/chart/test/input-processors/format-time-positions-input-processor.test.js +0 -62
  724. package/dist/collection/helpers/chart/test/input-processors/horizontal-x-axis-input-processor.test.js +0 -45
  725. package/dist/collection/helpers/chart/test/input-processors/horizontal-y-axis-input-processor.test.js +0 -80
  726. package/dist/collection/helpers/chart/test/input-processors/layout-input-processor.test.js +0 -40
  727. package/dist/collection/helpers/chart/test/input-processors/line-path-input-processor.test.js +0 -16
  728. package/dist/collection/helpers/chart/test/input-processors/pie-chart-filter-input-processor.test.js +0 -20
  729. package/dist/collection/helpers/chart/test/input-processors/pie-chart-radius-input-processor.test.js +0 -48
  730. package/dist/collection/helpers/chart/test/input-processors/sort-positions-input-processor.test.js +0 -53
  731. package/dist/collection/helpers/chart/test/input-processors/x-axis-input-processor.test.js +0 -78
  732. package/dist/collection/helpers/chart/test/input-processors/x-axis-label-formatter-input-processor.test.js +0 -109
  733. package/dist/collection/helpers/chart/test/input-processors/y-axis-input-processor.coverage.test.js +0 -39
  734. package/dist/collection/helpers/chart/test/input-processors/y-axis-input-processor.test.js +0 -55
  735. package/dist/collection/helpers/chart/test/interacting-entry-generator/arc-path-hover-generator.test.js +0 -11
  736. package/dist/collection/helpers/chart/test/interacting-entry-generator/pie-legend-hover-generator.test.js +0 -25
  737. package/dist/collection/helpers/chart/test/interactors/interactor-factory.test.js +0 -19
  738. package/dist/collection/helpers/chart/test/interactors/svg-interactor.test.js +0 -48
  739. package/dist/collection/helpers/chart/test/line-chart.test.js +0 -96
  740. package/dist/collection/helpers/chart/test/pie-chart.test.js +0 -38
  741. package/dist/collection/helpers/chart/test/renderers/canvas-renderer.test.js +0 -31
  742. package/dist/collection/helpers/chart/test/renderers/renderer-factory.test.js +0 -19
  743. package/dist/collection/helpers/chart/test/renderers/svg-renderer.test.js +0 -99
  744. package/dist/collection/helpers/code-format/test/code-formatter.test.js +0 -410
  745. package/dist/collection/helpers/common/test/common.test.js +0 -7
  746. package/dist/collection/helpers/common/test/wait-for-component-did-render.test.js +0 -67
  747. package/dist/collection/helpers/common/test/wait-for-vega-handler.test.js +0 -17
  748. package/dist/collection/helpers/csp/test/styles-preservator.test.js +0 -207
  749. package/dist/collection/helpers/csp/test/vega-nonce-manager.test.js +0 -177
  750. package/dist/collection/helpers/dialog/test/vega-dialog-controller.test.js +0 -114
  751. package/dist/collection/helpers/event-manager/test/child-nodes-event-prevent-slimmer.test.js +0 -209
  752. package/dist/collection/helpers/event-manager/test/child-nodes-notify-observer-slimmer.test.js +0 -81
  753. package/dist/collection/helpers/event-manager/test/component-event-id-map.test.js +0 -16
  754. package/dist/collection/helpers/event-manager/test/event-emit-slimmer.test.js +0 -144
  755. package/dist/collection/helpers/event-manager/test/internal-vega-event-manager.test.js +0 -70
  756. package/dist/collection/helpers/event-manager/test/jquery-delegated-strategy-controller.test.js +0 -131
  757. package/dist/collection/helpers/event-manager/test/vega-event-id.test.js +0 -16
  758. package/dist/collection/helpers/event-manager/test/vega-event-manager.test.js +0 -97
  759. package/dist/collection/helpers/feature-control/tests/feature-flag-controller.test.js +0 -69
  760. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-border-radius-formatter.test.js +0 -64
  761. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-border-radius-style-formatter.test.js +0 -32
  762. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-box-display-formatter.test.js +0 -31
  763. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-custom-formatter.test.js +0 -17
  764. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-display-formatter.test.js +0 -23
  765. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-flex-direction-formatter.test.js +0 -19
  766. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-flex-wrap-formatter.test.js +0 -19
  767. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-format-mediator.test.js +0 -43
  768. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-gap-formatter.ts.test.js +0 -29
  769. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-grid-column-formatter.test.js +0 -23
  770. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-grid-justify-items-formatter.test.js +0 -19
  771. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-grid-row-formatter.test.js +0 -27
  772. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-margin-formatter.test.js +0 -43
  773. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-margin-style-formatter.test.js +0 -28
  774. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-padding-formatter.test.js +0 -43
  775. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-padding-style-formatter.test.js +0 -28
  776. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-size-formatter.test.js +0 -27
  777. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-text-align-formatter.test.js +0 -19
  778. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-translocation-formatter.test.js +0 -51
  779. package/dist/collection/helpers/formatter/test/responsive-map-formatter/responsive-width-and-height-formatter.test.js +0 -20
  780. package/dist/collection/helpers/formatter/test/state-formatter/state-background-color-formatter.test.js +0 -18
  781. package/dist/collection/helpers/formatter/test/state-formatter/state-border-color-formatter.test.js +0 -13
  782. package/dist/collection/helpers/formatter/test/state-formatter/state-border-formatter.test.js +0 -13
  783. package/dist/collection/helpers/formatter/test/state-formatter/state-format-facade.test.js +0 -27
  784. package/dist/collection/helpers/formatter/test/state-formatter/state-shadow-formatter.test.js +0 -13
  785. package/dist/collection/helpers/formatter/test/string-formatter/custom-formatter-strategy.test.js +0 -13
  786. package/dist/collection/helpers/formatter/test/string-formatter/number-mask-strategy.test.js +0 -101
  787. package/dist/collection/helpers/formatter/test/string-formatter/number-thousand-comma-mask-strategy.test.js +0 -40
  788. package/dist/collection/helpers/formatter/test/string-formatter/string-mask-strategy.test.js +0 -147
  789. package/dist/collection/helpers/formatter/test/string-formatter/thousand-comma-strategy.test.js +0 -21
  790. package/dist/collection/helpers/formatter/test/string-formatter/vega-phone-number-input-strategy.test.js +0 -43
  791. package/dist/collection/helpers/formatter/test/style-formatter.test.js +0 -16
  792. package/dist/collection/helpers/icon/test/icon-manager-controller.test.js +0 -101
  793. package/dist/collection/helpers/icon/test/internal-icon-manager.test.js +0 -18
  794. package/dist/collection/helpers/immutable/test/immutable-array.test.js +0 -78
  795. package/dist/collection/helpers/immutable/test/immutable-map.test.js +0 -83
  796. package/dist/collection/helpers/immutable/test/immutable-set.test.js +0 -87
  797. package/dist/collection/helpers/keyboard/test/keyboard-manager.test.js +0 -241
  798. package/dist/collection/helpers/level-tracker/test/nested-level-tracker.test.js +0 -33
  799. package/dist/collection/helpers/loading-indicator/tests/vega-loader-controller.test.js +0 -192
  800. package/dist/collection/helpers/notify/tests/vega-notify-controller.test.js +0 -165
  801. package/dist/collection/helpers/paginator/test/value-paginator.test.js +0 -15
  802. package/dist/collection/helpers/queue/test/synchronize-task-queue.test.js +0 -76
  803. package/dist/collection/helpers/remote-invocation/remote-invocation-registry.test.js +0 -17
  804. package/dist/collection/helpers/rte-manager/rte.manager.test.js +0 -94
  805. package/dist/collection/helpers/skeleton-loader/tests/vega-skeleton-loader-controller.test.js +0 -194
  806. package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/test/vega-popover-wrapper.test.js +0 -66
  807. package/dist/collection/helpers/slimmers/element-appender/test/element-appender-slimmer.test.js +0 -621
  808. package/dist/collection/helpers/slimmers/mutation-observer/test/aria-attributes-value-mapper.test.js +0 -248
  809. package/dist/collection/helpers/slimmers/mutation-observer/test/data-tab-index-value-mapper.test.js +0 -120
  810. package/dist/collection/helpers/slimmers/mutation-observer/test/mutation-observer-slimmer.test.js +0 -182
  811. package/dist/collection/helpers/slimmers/position-calculation/test/body-position-calculation-strategy.test.js +0 -399
  812. package/dist/collection/helpers/slimmers/position-calculation/test/screen-position-calculation-strategy.test.js +0 -383
  813. package/dist/collection/helpers/slimmers/runtime-metrics/test/public-api-runtime-metrics-slimmer-base.test.js +0 -96
  814. package/dist/collection/helpers/slimmers/sub-state/test/sub-state-observer-slimmer.test.js +0 -228
  815. package/dist/collection/helpers/slimmers/test/aria-dialog-focusable-trap-slimmer.test.js +0 -375
  816. package/dist/collection/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.js +0 -46
  817. package/dist/collection/helpers/slimmers/test/brand-switch-state-controller-slimmer.test.js +0 -75
  818. package/dist/collection/helpers/slimmers/test/component-global-style-slimmer.test.js +0 -104
  819. package/dist/collection/helpers/slimmers/test/component-usage-runtime-metrics.test.js +0 -72
  820. package/dist/collection/helpers/slimmers/test/dark-mode-state-controller.test.js +0 -65
  821. package/dist/collection/helpers/slimmers/test/deprecated-property-slimmer.test.js +0 -36
  822. package/dist/collection/helpers/slimmers/test/field-error-controller-slimmer.test.js +0 -55
  823. package/dist/collection/helpers/slimmers/test/form-field-controller-slimmer.test.js +0 -278
  824. package/dist/collection/helpers/slimmers/test/form-field-valid-invoke-slimmer.test.js +0 -106
  825. package/dist/collection/helpers/slimmers/test/global/vega-nonce-injector-slimmer.test.js +0 -64
  826. package/dist/collection/helpers/slimmers/test/global/vega-translate-observer-slimmer.test.js +0 -89
  827. package/dist/collection/helpers/slimmers/test/global/vega-watch-method-cancel-slimmer.test.js +0 -101
  828. package/dist/collection/helpers/slimmers/test/keyboard-manager-slimmer.test.js +0 -90
  829. package/dist/collection/helpers/slimmers/test/page-resize-observer-slimmer.test.js +0 -278
  830. package/dist/collection/helpers/slimmers/test/string-input-formatter-slimmer.test.js +0 -220
  831. package/dist/collection/helpers/slimmers/test/translation-slimmer.test.js +0 -89
  832. package/dist/collection/helpers/theme/tests/theme-manager-controller.test.js +0 -614
  833. package/dist/collection/helpers/touch-helper/test/touch-listener.test.js +0 -122
  834. package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +0 -288
  835. package/dist/collection/helpers/translation/tests/translation.test.js +0 -46
  836. package/dist/collection/helpers/ui/test/element-appender.test.js +0 -530
  837. package/dist/collection/helpers/validator/test/rules/check-box-required-rule.test.js +0 -88
  838. package/dist/collection/helpers/validator/test/rules/custom-validation-rule.test.js +0 -56
  839. package/dist/collection/helpers/validator/test/rules/date-range-rule.test.js +0 -67
  840. package/dist/collection/helpers/validator/test/rules/date-required-rule.test.js +0 -120
  841. package/dist/collection/helpers/validator/test/rules/email-field-rule.test.js +0 -69
  842. package/dist/collection/helpers/validator/test/rules/file-uploader-required-rule.test.js +0 -7
  843. package/dist/collection/helpers/validator/test/rules/input-phone-number-required-rule.test.js +0 -105
  844. package/dist/collection/helpers/validator/test/rules/input-range-min-and-max-rule.test.js +0 -146
  845. package/dist/collection/helpers/validator/test/rules/input-range-required-rule.test.js +0 -82
  846. package/dist/collection/helpers/validator/test/rules/input-select-value-in-source-rule.test.js +0 -99
  847. package/dist/collection/helpers/validator/test/rules/max-number-rule.test.js +0 -97
  848. package/dist/collection/helpers/validator/test/rules/max-string-length-rule.test.js +0 -85
  849. package/dist/collection/helpers/validator/test/rules/min-and-max-date-rule.test.js +0 -174
  850. package/dist/collection/helpers/validator/test/rules/min-number-rule.test.js +0 -97
  851. package/dist/collection/helpers/validator/test/rules/min-string-length-rule.test.js +0 -85
  852. package/dist/collection/helpers/validator/test/rules/public-rules.test.js +0 -80
  853. package/dist/collection/helpers/validator/test/rules/required-field-rule.test.js +0 -126
  854. package/dist/collection/helpers/validator/test/rules/rich-text-editor-required-rule.test.js +0 -360
  855. package/dist/collection/helpers/validator/test/rules/time-range-required-rule.test.js +0 -82
  856. package/dist/collection/helpers/validator/test/rules/time-range-rule.test.js +0 -67
  857. package/dist/collection/helpers/validator/test/rules/time-required-rule.test.js +0 -116
  858. package/dist/collection/helpers/validator/test/rules/toggle-switch-required-rule.test.js +0 -72
  859. package/dist/collection/helpers/validator/test/rules/valid-credit-card-number-rule.test.js +0 -135
  860. package/dist/collection/helpers/validator/test/rules/valid-phone-number-rule.test.js +0 -95
  861. package/dist/collection/helpers/validator/test/validation-rule-handler/form-field-validation-rule-handler-chain.test.js +0 -65
  862. package/dist/collection/helpers/validator/test/validation-rule-handler/form-field-validation-rule-handler.test.js +0 -82
  863. package/dist/collection/helpers/validator/test/validator/form-field-controller.test.js +0 -205
  864. package/dist/collection/helpers/vega-telemetry-helper/test/vega-env-manager.test.js +0 -14
  865. package/dist/collection/helpers/zindex/test/internal-vega-z-index-manager.test.js +0 -176
  866. package/dist/collection/helpers/zindex/test/vega-z-index-manager.test.js +0 -46
  867. package/dist/collection/polyfill/d3/test/d3-array-polyfill.test.js +0 -72
  868. package/dist/collection/polyfill/d3/test/d3-axis-polyfill.test.js +0 -171
  869. package/dist/collection/polyfill/d3/test/d3-integration.test.js +0 -137
  870. package/dist/collection/polyfill/d3/test/d3-scale-polyfill.test.js +0 -382
  871. package/dist/collection/polyfill/d3/test/d3-selection-polyfill.test.js +0 -239
  872. package/dist/collection/polyfill/d3/test/d3-shape-polyfill.test.js +0 -225
  873. package/dist/collection/polyfill/d3/test/d3-time-format-polyfill.test.js +0 -162
  874. package/dist/collection/polyfill/d3/test/d3-time-polyfill.test.js +0 -76
  875. package/dist/collection/polyfill/d3/test/index.test.js +0 -78
  876. package/dist/collection/polyfill/libphonenumber/test/as-you-type.test.js +0 -309
  877. package/dist/collection/polyfill/libphonenumber/test/format-helpers.test.js +0 -192
  878. package/dist/collection/polyfill/libphonenumber/test/index.test.js +0 -16
  879. package/dist/collection/polyfill/libphonenumber/test/metadata.test.js +0 -196
  880. package/dist/collection/polyfill/libphonenumber/test/parse-phone-number.test.js +0 -218
  881. package/dist/collection/polyfill/libphonenumber/test/phone-number.test.js +0 -56
  882. package/dist/collection/polyfill/prism/test/css.test.js +0 -61
  883. package/dist/collection/polyfill/prism/test/javascript.test.js +0 -113
  884. package/dist/collection/polyfill/prism/test/jsx.test.js +0 -48
  885. package/dist/collection/polyfill/prism/test/language-registry.test.js +0 -77
  886. package/dist/collection/polyfill/prism/test/markup.test.js +0 -57
  887. package/dist/collection/polyfill/prism/test/test-utils.js +0 -22
  888. package/dist/collection/polyfill/prism/test/tokenizer.test.js +0 -180
  889. package/dist/collection/polyfill/prism/test/tsx.test.js +0 -87
  890. package/dist/collection/polyfill/prism/test/typescript.test.js +0 -86
  891. package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +0 -234
  892. package/dist/collection/polyfill/test-polyfill/e2e/retry.js +0 -42
  893. package/dist/collection/polyfill/test-polyfill/unit/create-touch-event.js +0 -31
  894. package/dist/collection/polyfill/test-polyfill/unit/events.js +0 -100
  895. package/dist/collection/polyfill/test-polyfill/unit/index.js +0 -3
  896. package/dist/collection/polyfill/test-polyfill/unit/methods.js +0 -47
  897. package/dist/collection/polyfill/test-polyfill/unit/range.js +0 -15
  898. package/dist/collection/polyfill/test-polyfill/unit/shadow-selection.js +0 -17
  899. package/dist/collection/polyfill/tinycolor/tinycolor-polyfill.test.js +0 -361
  900. package/dist/collection/test-assets/test-icons.js +0 -5
  901. package/dist/collection/types/test/type-guard.test.js +0 -46
  902. package/dist/collection/utils/e2e-utils.js +0 -389
  903. package/dist/collection/utils/sanitize/test/empty-strategy.test.js +0 -12
  904. package/dist/collection/utils/sanitize/test/html-sanitizer.test.js +0 -57
  905. package/dist/collection/utils/sanitize/test/label-strategy.test.js +0 -56
  906. package/dist/collection/utils/sanitize/test/sanitize-strategy.test.js +0 -85
  907. package/dist/collection/utils/sanitize/test/sanitize.test.js +0 -22
  908. package/dist/collection/utils/sanitize/test/serialize-fragment.test.js +0 -25
  909. package/dist/collection/utils/sanitize/test/style-strategy.test.js +0 -45
  910. package/dist/collection/utils/spec-utils.js +0 -226
  911. package/dist/collection/utils/test/accessibility.test.js +0 -40
  912. package/dist/collection/utils/test/api.test.js +0 -34
  913. package/dist/collection/utils/test/array.test.js +0 -260
  914. package/dist/collection/utils/test/breakpoint.test.js +0 -37
  915. package/dist/collection/utils/test/component.test.js +0 -59
  916. package/dist/collection/utils/test/date.test.js +0 -104
  917. package/dist/collection/utils/test/design-token.test.js +0 -91
  918. package/dist/collection/utils/test/effect.test.js +0 -64
  919. package/dist/collection/utils/test/local-storage.test.js +0 -38
  920. package/dist/collection/utils/test/log.test.js +0 -49
  921. package/dist/collection/utils/test/misc.test.js +0 -40
  922. package/dist/collection/utils/test/number.test.js +0 -18
  923. package/dist/collection/utils/test/object.test.js +0 -77
  924. package/dist/collection/utils/test/pagination.test.js +0 -40
  925. package/dist/collection/utils/test/pixel.test.js +0 -29
  926. package/dist/collection/utils/test/safe-document.test.js +0 -13
  927. package/dist/collection/utils/test/spec-utils.test.js +0 -73
  928. package/dist/collection/utils/test/string.test.js +0 -8
  929. package/dist/collection/utils/test/test-utils.test.js +0 -70
  930. package/dist/collection/utils/test/timer.test.js +0 -16
  931. package/dist/collection/utils/test/ui.test.js +0 -301
  932. package/dist/collection/utils/test-utils.js +0 -156
  933. package/dist/esm/app-globals-776ccaa3.js +0 -428
  934. package/dist/esm/aria-dialog-focusable-trap-slimmer-cc98a7a4.js +0 -216
  935. package/dist/esm/child-nodes-notify-observer-slimmer-c7297b9f.js +0 -88
  936. package/dist/esm/code-block-58d1dbe5.js +0 -4395
  937. package/dist/esm/component-value-history-controller-slimmer.abstract-5beb8acb.js +0 -709
  938. package/dist/esm/content-state-dad1fd71.js +0 -4056
  939. package/dist/esm/date-required-rule-4c40a4eb.js +0 -90
  940. package/dist/esm/design-token-9c4eb6b1.js +0 -388
  941. package/dist/esm/dom-node-subject-observer-factory-94b2e2c3.js +0 -138
  942. package/dist/esm/element-appender-slimmer-fde815dc.js +0 -1972
  943. package/dist/esm/event-emit-slimmer-b236945b.js +0 -265
  944. package/dist/esm/form-field-controller-slimmer-00fa3678.js +0 -1264
  945. package/dist/esm/image-annotation-action-1ec7b461.js +0 -280
  946. package/dist/esm/inject-keyboard-manager-784b1364.js +0 -35
  947. package/dist/esm/keyboard-manager-e020039f.js +0 -138
  948. package/dist/esm/keyboard-manager-slimmer-4722d20c.js +0 -37
  949. package/dist/esm/month-view-generator-6fe1f491.js +0 -98
  950. package/dist/esm/public-rules-1626fb0d.js +0 -31
  951. package/dist/esm/range-4f9bf69d.js +0 -176
  952. package/dist/esm/responsive-format-facade-e8534e59.js +0 -940
  953. package/dist/esm/rich-text-editor-required-rule-c391aeb6.js +0 -62
  954. package/dist/esm/split-cell-operation-55cd9fae.js +0 -2360
  955. package/dist/esm/string-format-strategy.abstract-8c48e515.js +0 -58
  956. package/dist/esm/string-input-formatter-slimmer-519480ce.js +0 -228
  957. package/dist/esm/string-mask-strategy-8070817e.js +0 -170
  958. package/dist/esm/style-formatter-7afd0680.js +0 -32
  959. package/dist/esm/sub-state-notify-slimmer-54531808.js +0 -79
  960. package/dist/esm/sub-state-observer-slimmer-b3a773c5.js +0 -132
  961. package/dist/esm/time-required-rule-2569e5ad.js +0 -138
  962. package/dist/esm/token-extension-612575cb.js +0 -7417
  963. package/dist/esm/type-guard-c20cbbff.js +0 -1948
  964. package/dist/esm/ui-ac244bf0.js +0 -261
  965. package/dist/esm/valid-credit-card-number-rule-b9c3c2f8.js +0 -171
  966. package/dist/esm/vega-internal-event-id-8002b179.js +0 -72
  967. package/dist/esm/wait-for-component-did-render-1e62d6f7.js +0 -30
  968. package/dist/types/components/vega-calendar/slimmers/common/helpers/test/calendar-event-repeat-pattern-factory.test.d.ts +0 -1
  969. package/dist/types/components/vega-calendar/slimmers/common/layout/test/long-event-layout-generator.test.d.ts +0 -1
  970. package/dist/types/components/vega-calendar/slimmers/day-view/renderers/timed-event/layout/test/day-view-event-layout-generator.test.d.ts +0 -1
  971. package/dist/types/components/vega-code-block/test/code-block-range.test.d.ts +0 -1
  972. package/dist/types/components/vega-dropdown/test/share.d.ts +0 -12
  973. package/dist/types/components/vega-input-credit-card/test/share.d.ts +0 -18
  974. package/dist/types/components/vega-nav/vega-left-nav/test/vega-left-nav-mock-data.d.ts +0 -4
  975. package/dist/types/components/vega-rich-text-editor/helpers/extension-context-manager.test.d.ts +0 -1
  976. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.d.ts +0 -1
  977. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.d.ts +0 -1
  978. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.d.ts +0 -1
  979. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.d.ts +0 -1
  980. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.d.ts +0 -1
  981. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.d.ts +0 -1
  982. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.d.ts +0 -1
  983. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.d.ts +0 -1
  984. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.d.ts +0 -1
  985. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.d.ts +0 -1
  986. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.d.ts +0 -1
  987. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.d.ts +0 -1
  988. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.d.ts +0 -1
  989. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.d.ts +0 -1
  990. package/dist/types/components/vega-rich-text-editor/test/dto/annotation-actions.test.d.ts +0 -1
  991. package/dist/types/components/vega-rich-text-editor/test/dto/annotation-style.test.d.ts +0 -1
  992. package/dist/types/components/vega-rich-text-editor/test/dto/annotations.test.d.ts +0 -1
  993. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/code-block.test.d.ts +0 -1
  994. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/html-block.test.d.ts +0 -1
  995. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/image-block.test.d.ts +0 -1
  996. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/list-block.test.d.ts +0 -1
  997. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/list-item.test.d.ts +0 -1
  998. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/text-block.test.d.ts +0 -1
  999. package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +0 -1
  1000. package/dist/types/components/vega-rich-text-editor/test/dto/nodes/image-node.test.d.ts +0 -1
  1001. package/dist/types/components/vega-rich-text-editor/test/dto/nodes/text-node.test.d.ts +0 -1
  1002. package/dist/types/components/vega-rich-text-editor/test/dto/range.test.d.ts +0 -1
  1003. package/dist/types/components/vega-rich-text-editor/test/e2e-utils.d.ts +0 -67
  1004. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/custom-attribute-annotation-handler.test.d.ts +0 -1
  1005. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/element-to-text-node-strategy.test.d.ts +0 -1
  1006. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/html-element-to-annotation-generator.test.d.ts +0 -1
  1007. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.d.ts +0 -1
  1008. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.d.ts +0 -1
  1009. package/dist/types/components/vega-rich-text-editor/test/extensions/extension-test-utils.d.ts +0 -21
  1010. package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/annotation-handler-registration.test.d.ts +0 -1
  1011. package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-annotation-handler.test.d.ts +0 -1
  1012. package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-cell-annotation-handler.test.d.ts +0 -8
  1013. package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-head-cell-annotation-handler.test.d.ts +0 -1
  1014. package/dist/types/components/vega-rich-text-editor/test/extensions/table/caption-operation.test.d.ts +0 -1
  1015. package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-annotation.test.d.ts +0 -1
  1016. package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-caption-annotations.test.d.ts +0 -1
  1017. package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-cell-annotation.test.d.ts +0 -1
  1018. package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-color-annotation.test.d.ts +0 -1
  1019. package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-dto.test.d.ts +0 -1
  1020. package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-element-to-dto-strategies.test.d.ts +0 -1
  1021. package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-test-utils.d.ts +0 -11
  1022. package/dist/types/components/vega-rich-text-editor/test/filter-styles-strategies/filter-styles-strategy.test.d.ts +0 -1
  1023. package/dist/types/components/vega-rich-text-editor/test/fixture.d.ts +0 -19
  1024. package/dist/types/components/vega-rich-text-editor/test/html-cleaner/html-content-cleaner.test.d.ts +0 -1
  1025. package/dist/types/components/vega-rich-text-editor/test/html-cleaner/remove-whitespace-after-opening-tag-processor.test.d.ts +0 -1
  1026. package/dist/types/components/vega-rich-text-editor/test/html-cleaner/remove-whitespace-before-closing-tag-processor.test.d.ts +0 -1
  1027. package/dist/types/components/vega-rich-text-editor/test/html-cleaner/remove-whitespace-between-tags-processor.test.d.ts +0 -1
  1028. package/dist/types/components/vega-rich-text-editor/test/spec-utils.d.ts +0 -19
  1029. package/dist/types/components/vega-sidenav/test/test.helper.d.ts +0 -6
  1030. package/dist/types/components/vega-table/slimmers/controllers/dto/test/column-render-input-model.test.d.ts +0 -1
  1031. package/dist/types/components/vega-table/slimmers/controllers/dto/test/column-structure-model.test.d.ts +0 -1
  1032. package/dist/types/components/vega-table/test/utils.d.ts +0 -9
  1033. package/dist/types/components/vega-table/test/vega-table-sorter.test.d.ts +0 -1
  1034. package/dist/types/constants/tests/validator.test.d.ts +0 -1
  1035. package/dist/types/decorators/method-decorators/tests/component-load-required.test.d.ts +0 -1
  1036. package/dist/types/decorators/property-decorators/tests/inject-element-appender-proxy.test.d.ts +0 -1
  1037. package/dist/types/decorators/property-decorators/tests/inject-keyboard-manager.test.d.ts +0 -1
  1038. package/dist/types/global/tests/before-vega-load.test.d.ts +0 -1
  1039. package/dist/types/helpers/calendar/test/calendar-date-time.test.d.ts +0 -1
  1040. package/dist/types/helpers/calendar/test/calendar-date.test.d.ts +0 -1
  1041. package/dist/types/helpers/calendar/test/calendar-event.test.d.ts +0 -1
  1042. package/dist/types/helpers/calendar/test/calendar-period/day-period.test.d.ts +0 -1
  1043. package/dist/types/helpers/calendar/test/calendar-period/month-period.test.d.ts +0 -1
  1044. package/dist/types/helpers/calendar/test/calendar-period/week-period.test.d.ts +0 -1
  1045. package/dist/types/helpers/calendar/test/calendar-time.test.d.ts +0 -1
  1046. package/dist/types/helpers/calendar/test/calendar-view-generator/day-view-generator.test.d.ts +0 -1
  1047. package/dist/types/helpers/calendar/test/calendar-view-generator/month-view-generator.test.d.ts +0 -1
  1048. package/dist/types/helpers/calendar/test/calendar-view-generator/week-view-generator.test.d.ts +0 -1
  1049. package/dist/types/helpers/calendar/test/calendar-view.test.d.ts +0 -1
  1050. package/dist/types/helpers/calendar/test/index.test.d.ts +0 -1
  1051. package/dist/types/helpers/calendar/test/utils.test.d.ts +0 -1
  1052. package/dist/types/helpers/change-manager/test/change-manager.test.d.ts +0 -1
  1053. package/dist/types/helpers/change-manager/test/dom-node-subject-factory.test.d.ts +0 -1
  1054. package/dist/types/helpers/chart/test/controllers/chart-dimension-controller.test.d.ts +0 -1
  1055. package/dist/types/helpers/chart/test/drawers/arc-path-drawer.test.d.ts +0 -1
  1056. package/dist/types/helpers/chart/test/drawers/legend-drawer.test.d.ts +0 -1
  1057. package/dist/types/helpers/chart/test/drawers/line-drawer.test.d.ts +0 -1
  1058. package/dist/types/helpers/chart/test/drawers/path-drawer.test.d.ts +0 -1
  1059. package/dist/types/helpers/chart/test/drawers/rect-drawer.test.d.ts +0 -1
  1060. package/dist/types/helpers/chart/test/drawers/text-drawer.test.d.ts +0 -1
  1061. package/dist/types/helpers/chart/test/drawers/x-axis-drawer.test.d.ts +0 -1
  1062. package/dist/types/helpers/chart/test/drawers/y-axis-drawer.test.d.ts +0 -1
  1063. package/dist/types/helpers/chart/test/graph-context-factory.test.d.ts +0 -1
  1064. package/dist/types/helpers/chart/test/input-processors/format-time-positions-input-processor.test.d.ts +0 -1
  1065. package/dist/types/helpers/chart/test/input-processors/horizontal-x-axis-input-processor.test.d.ts +0 -1
  1066. package/dist/types/helpers/chart/test/input-processors/horizontal-y-axis-input-processor.test.d.ts +0 -1
  1067. package/dist/types/helpers/chart/test/input-processors/layout-input-processor.test.d.ts +0 -1
  1068. package/dist/types/helpers/chart/test/input-processors/line-path-input-processor.test.d.ts +0 -1
  1069. package/dist/types/helpers/chart/test/input-processors/pie-chart-filter-input-processor.test.d.ts +0 -1
  1070. package/dist/types/helpers/chart/test/input-processors/pie-chart-radius-input-processor.test.d.ts +0 -1
  1071. package/dist/types/helpers/chart/test/input-processors/sort-positions-input-processor.test.d.ts +0 -1
  1072. package/dist/types/helpers/chart/test/input-processors/x-axis-input-processor.test.d.ts +0 -1
  1073. package/dist/types/helpers/chart/test/input-processors/x-axis-label-formatter-input-processor.test.d.ts +0 -1
  1074. package/dist/types/helpers/chart/test/input-processors/y-axis-input-processor.coverage.test.d.ts +0 -1
  1075. package/dist/types/helpers/chart/test/input-processors/y-axis-input-processor.test.d.ts +0 -1
  1076. package/dist/types/helpers/chart/test/interacting-entry-generator/arc-path-hover-generator.test.d.ts +0 -1
  1077. package/dist/types/helpers/chart/test/interacting-entry-generator/pie-legend-hover-generator.test.d.ts +0 -1
  1078. package/dist/types/helpers/chart/test/interactors/interactor-factory.test.d.ts +0 -1
  1079. package/dist/types/helpers/chart/test/interactors/svg-interactor.test.d.ts +0 -1
  1080. package/dist/types/helpers/chart/test/line-chart.test.d.ts +0 -1
  1081. package/dist/types/helpers/chart/test/pie-chart.test.d.ts +0 -1
  1082. package/dist/types/helpers/chart/test/renderers/canvas-renderer.test.d.ts +0 -1
  1083. package/dist/types/helpers/chart/test/renderers/renderer-factory.test.d.ts +0 -1
  1084. package/dist/types/helpers/chart/test/renderers/svg-renderer.test.d.ts +0 -1
  1085. package/dist/types/helpers/code-format/test/code-formatter.test.d.ts +0 -1
  1086. package/dist/types/helpers/common/test/common.test.d.ts +0 -1
  1087. package/dist/types/helpers/common/test/wait-for-component-did-render.test.d.ts +0 -1
  1088. package/dist/types/helpers/common/test/wait-for-vega-handler.test.d.ts +0 -1
  1089. package/dist/types/helpers/csp/test/styles-preservator.test.d.ts +0 -1
  1090. package/dist/types/helpers/csp/test/vega-nonce-manager.test.d.ts +0 -1
  1091. package/dist/types/helpers/dialog/test/vega-dialog-controller.test.d.ts +0 -1
  1092. package/dist/types/helpers/event-manager/test/child-nodes-event-prevent-slimmer.test.d.ts +0 -1
  1093. package/dist/types/helpers/event-manager/test/child-nodes-notify-observer-slimmer.test.d.ts +0 -1
  1094. package/dist/types/helpers/event-manager/test/component-event-id-map.test.d.ts +0 -1
  1095. package/dist/types/helpers/event-manager/test/event-emit-slimmer.test.d.ts +0 -1
  1096. package/dist/types/helpers/event-manager/test/internal-vega-event-manager.test.d.ts +0 -1
  1097. package/dist/types/helpers/event-manager/test/jquery-delegated-strategy-controller.test.d.ts +0 -1
  1098. package/dist/types/helpers/event-manager/test/vega-event-id.test.d.ts +0 -1
  1099. package/dist/types/helpers/event-manager/test/vega-event-manager.test.d.ts +0 -1
  1100. package/dist/types/helpers/feature-control/tests/feature-flag-controller.test.d.ts +0 -1
  1101. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-border-radius-formatter.test.d.ts +0 -1
  1102. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-border-radius-style-formatter.test.d.ts +0 -1
  1103. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-box-display-formatter.test.d.ts +0 -1
  1104. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-custom-formatter.test.d.ts +0 -1
  1105. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-display-formatter.test.d.ts +0 -1
  1106. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-flex-direction-formatter.test.d.ts +0 -1
  1107. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-flex-wrap-formatter.test.d.ts +0 -1
  1108. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-format-mediator.test.d.ts +0 -1
  1109. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-gap-formatter.ts.test.d.ts +0 -1
  1110. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-grid-column-formatter.test.d.ts +0 -1
  1111. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-grid-justify-items-formatter.test.d.ts +0 -1
  1112. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-grid-row-formatter.test.d.ts +0 -1
  1113. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-margin-formatter.test.d.ts +0 -1
  1114. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-margin-style-formatter.test.d.ts +0 -1
  1115. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-padding-formatter.test.d.ts +0 -1
  1116. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-padding-style-formatter.test.d.ts +0 -1
  1117. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-size-formatter.test.d.ts +0 -1
  1118. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-text-align-formatter.test.d.ts +0 -1
  1119. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-translocation-formatter.test.d.ts +0 -1
  1120. package/dist/types/helpers/formatter/test/responsive-map-formatter/responsive-width-and-height-formatter.test.d.ts +0 -1
  1121. package/dist/types/helpers/formatter/test/state-formatter/state-background-color-formatter.test.d.ts +0 -1
  1122. package/dist/types/helpers/formatter/test/state-formatter/state-border-color-formatter.test.d.ts +0 -1
  1123. package/dist/types/helpers/formatter/test/state-formatter/state-border-formatter.test.d.ts +0 -1
  1124. package/dist/types/helpers/formatter/test/state-formatter/state-format-facade.test.d.ts +0 -1
  1125. package/dist/types/helpers/formatter/test/state-formatter/state-shadow-formatter.test.d.ts +0 -1
  1126. package/dist/types/helpers/formatter/test/string-formatter/custom-formatter-strategy.test.d.ts +0 -1
  1127. package/dist/types/helpers/formatter/test/string-formatter/number-mask-strategy.test.d.ts +0 -1
  1128. package/dist/types/helpers/formatter/test/string-formatter/number-thousand-comma-mask-strategy.test.d.ts +0 -1
  1129. package/dist/types/helpers/formatter/test/string-formatter/string-mask-strategy.test.d.ts +0 -1
  1130. package/dist/types/helpers/formatter/test/string-formatter/thousand-comma-strategy.test.d.ts +0 -1
  1131. package/dist/types/helpers/formatter/test/string-formatter/vega-phone-number-input-strategy.test.d.ts +0 -1
  1132. package/dist/types/helpers/formatter/test/style-formatter.test.d.ts +0 -1
  1133. package/dist/types/helpers/icon/test/icon-manager-controller.test.d.ts +0 -1
  1134. package/dist/types/helpers/icon/test/internal-icon-manager.test.d.ts +0 -1
  1135. package/dist/types/helpers/immutable/test/immutable-array.test.d.ts +0 -1
  1136. package/dist/types/helpers/immutable/test/immutable-map.test.d.ts +0 -1
  1137. package/dist/types/helpers/immutable/test/immutable-set.test.d.ts +0 -1
  1138. package/dist/types/helpers/keyboard/test/keyboard-manager.test.d.ts +0 -1
  1139. package/dist/types/helpers/level-tracker/test/nested-level-tracker.test.d.ts +0 -1
  1140. package/dist/types/helpers/loading-indicator/tests/vega-loader-controller.test.d.ts +0 -1
  1141. package/dist/types/helpers/notify/tests/vega-notify-controller.test.d.ts +0 -1
  1142. package/dist/types/helpers/paginator/test/value-paginator.test.d.ts +0 -1
  1143. package/dist/types/helpers/queue/test/synchronize-task-queue.test.d.ts +0 -1
  1144. package/dist/types/helpers/remote-invocation/remote-invocation-registry.test.d.ts +0 -1
  1145. package/dist/types/helpers/rte-manager/rte.manager.test.d.ts +0 -1
  1146. package/dist/types/helpers/skeleton-loader/tests/vega-skeleton-loader-controller.test.d.ts +0 -1
  1147. package/dist/types/helpers/slimmers/element-appender/body-positioned-wrapper/test/vega-popover-wrapper.test.d.ts +0 -1
  1148. package/dist/types/helpers/slimmers/element-appender/test/element-appender-slimmer.test.d.ts +0 -1
  1149. package/dist/types/helpers/slimmers/mutation-observer/test/aria-attributes-value-mapper.test.d.ts +0 -1
  1150. package/dist/types/helpers/slimmers/mutation-observer/test/data-tab-index-value-mapper.test.d.ts +0 -1
  1151. package/dist/types/helpers/slimmers/mutation-observer/test/mutation-observer-slimmer.test.d.ts +0 -1
  1152. package/dist/types/helpers/slimmers/position-calculation/test/body-position-calculation-strategy.test.d.ts +0 -15
  1153. package/dist/types/helpers/slimmers/position-calculation/test/screen-position-calculation-strategy.test.d.ts +0 -1
  1154. package/dist/types/helpers/slimmers/runtime-metrics/test/public-api-runtime-metrics-slimmer-base.test.d.ts +0 -1
  1155. package/dist/types/helpers/slimmers/sub-state/test/sub-state-observer-slimmer.test.d.ts +0 -1
  1156. package/dist/types/helpers/slimmers/test/aria-dialog-focusable-trap-slimmer.test.d.ts +0 -1
  1157. package/dist/types/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.d.ts +0 -1
  1158. package/dist/types/helpers/slimmers/test/brand-switch-state-controller-slimmer.test.d.ts +0 -1
  1159. package/dist/types/helpers/slimmers/test/component-global-style-slimmer.test.d.ts +0 -1
  1160. package/dist/types/helpers/slimmers/test/component-usage-runtime-metrics.test.d.ts +0 -1
  1161. package/dist/types/helpers/slimmers/test/dark-mode-state-controller.test.d.ts +0 -1
  1162. package/dist/types/helpers/slimmers/test/deprecated-property-slimmer.test.d.ts +0 -1
  1163. package/dist/types/helpers/slimmers/test/field-error-controller-slimmer.test.d.ts +0 -1
  1164. package/dist/types/helpers/slimmers/test/form-field-controller-slimmer.test.d.ts +0 -1
  1165. package/dist/types/helpers/slimmers/test/form-field-valid-invoke-slimmer.test.d.ts +0 -1
  1166. package/dist/types/helpers/slimmers/test/global/vega-nonce-injector-slimmer.test.d.ts +0 -1
  1167. package/dist/types/helpers/slimmers/test/global/vega-translate-observer-slimmer.test.d.ts +0 -1
  1168. package/dist/types/helpers/slimmers/test/global/vega-watch-method-cancel-slimmer.test.d.ts +0 -1
  1169. package/dist/types/helpers/slimmers/test/keyboard-manager-slimmer.test.d.ts +0 -1
  1170. package/dist/types/helpers/slimmers/test/page-resize-observer-slimmer.test.d.ts +0 -1
  1171. package/dist/types/helpers/slimmers/test/string-input-formatter-slimmer.test.d.ts +0 -1
  1172. package/dist/types/helpers/slimmers/test/translation-slimmer.test.d.ts +0 -1
  1173. package/dist/types/helpers/theme/tests/theme-manager-controller.test.d.ts +0 -1
  1174. package/dist/types/helpers/touch-helper/test/touch-listener.test.d.ts +0 -1
  1175. package/dist/types/helpers/translation/tests/internal-translation-controller.test.d.ts +0 -1
  1176. package/dist/types/helpers/translation/tests/translation.test.d.ts +0 -1
  1177. package/dist/types/helpers/ui/test/element-appender.test.d.ts +0 -1
  1178. package/dist/types/helpers/validator/test/rules/check-box-required-rule.test.d.ts +0 -1
  1179. package/dist/types/helpers/validator/test/rules/custom-validation-rule.test.d.ts +0 -1
  1180. package/dist/types/helpers/validator/test/rules/date-range-rule.test.d.ts +0 -1
  1181. package/dist/types/helpers/validator/test/rules/date-required-rule.test.d.ts +0 -1
  1182. package/dist/types/helpers/validator/test/rules/email-field-rule.test.d.ts +0 -1
  1183. package/dist/types/helpers/validator/test/rules/file-uploader-required-rule.test.d.ts +0 -1
  1184. package/dist/types/helpers/validator/test/rules/input-phone-number-required-rule.test.d.ts +0 -1
  1185. package/dist/types/helpers/validator/test/rules/input-range-min-and-max-rule.test.d.ts +0 -1
  1186. package/dist/types/helpers/validator/test/rules/input-range-required-rule.test.d.ts +0 -1
  1187. package/dist/types/helpers/validator/test/rules/input-select-value-in-source-rule.test.d.ts +0 -1
  1188. package/dist/types/helpers/validator/test/rules/max-number-rule.test.d.ts +0 -1
  1189. package/dist/types/helpers/validator/test/rules/max-string-length-rule.test.d.ts +0 -1
  1190. package/dist/types/helpers/validator/test/rules/min-and-max-date-rule.test.d.ts +0 -1
  1191. package/dist/types/helpers/validator/test/rules/min-number-rule.test.d.ts +0 -1
  1192. package/dist/types/helpers/validator/test/rules/min-string-length-rule.test.d.ts +0 -1
  1193. package/dist/types/helpers/validator/test/rules/public-rules.test.d.ts +0 -1
  1194. package/dist/types/helpers/validator/test/rules/required-field-rule.test.d.ts +0 -1
  1195. package/dist/types/helpers/validator/test/rules/rich-text-editor-required-rule.test.d.ts +0 -1
  1196. package/dist/types/helpers/validator/test/rules/time-range-required-rule.test.d.ts +0 -1
  1197. package/dist/types/helpers/validator/test/rules/time-range-rule.test.d.ts +0 -1
  1198. package/dist/types/helpers/validator/test/rules/time-required-rule.test.d.ts +0 -1
  1199. package/dist/types/helpers/validator/test/rules/toggle-switch-required-rule.test.d.ts +0 -1
  1200. package/dist/types/helpers/validator/test/rules/valid-credit-card-number-rule.test.d.ts +0 -1
  1201. package/dist/types/helpers/validator/test/rules/valid-phone-number-rule.test.d.ts +0 -1
  1202. package/dist/types/helpers/validator/test/validation-rule-handler/form-field-validation-rule-handler-chain.test.d.ts +0 -1
  1203. package/dist/types/helpers/validator/test/validation-rule-handler/form-field-validation-rule-handler.test.d.ts +0 -1
  1204. package/dist/types/helpers/validator/test/validator/form-field-controller.test.d.ts +0 -1
  1205. package/dist/types/helpers/vega-telemetry-helper/test/vega-env-manager.test.d.ts +0 -1
  1206. package/dist/types/helpers/zindex/test/internal-vega-z-index-manager.test.d.ts +0 -1
  1207. package/dist/types/helpers/zindex/test/vega-z-index-manager.test.d.ts +0 -1
  1208. package/dist/types/polyfill/d3/test/d3-array-polyfill.test.d.ts +0 -1
  1209. package/dist/types/polyfill/d3/test/d3-axis-polyfill.test.d.ts +0 -1
  1210. package/dist/types/polyfill/d3/test/d3-integration.test.d.ts +0 -1
  1211. package/dist/types/polyfill/d3/test/d3-scale-polyfill.test.d.ts +0 -1
  1212. package/dist/types/polyfill/d3/test/d3-selection-polyfill.test.d.ts +0 -1
  1213. package/dist/types/polyfill/d3/test/d3-shape-polyfill.test.d.ts +0 -1
  1214. package/dist/types/polyfill/d3/test/d3-time-format-polyfill.test.d.ts +0 -1
  1215. package/dist/types/polyfill/d3/test/d3-time-polyfill.test.d.ts +0 -1
  1216. package/dist/types/polyfill/d3/test/index.test.d.ts +0 -1
  1217. package/dist/types/polyfill/libphonenumber/test/as-you-type.test.d.ts +0 -1
  1218. package/dist/types/polyfill/libphonenumber/test/format-helpers.test.d.ts +0 -1
  1219. package/dist/types/polyfill/libphonenumber/test/index.test.d.ts +0 -1
  1220. package/dist/types/polyfill/libphonenumber/test/metadata.test.d.ts +0 -1
  1221. package/dist/types/polyfill/libphonenumber/test/parse-phone-number.test.d.ts +0 -1
  1222. package/dist/types/polyfill/libphonenumber/test/phone-number.test.d.ts +0 -1
  1223. package/dist/types/polyfill/prism/test/css.test.d.ts +0 -1
  1224. package/dist/types/polyfill/prism/test/javascript.test.d.ts +0 -1
  1225. package/dist/types/polyfill/prism/test/jsx.test.d.ts +0 -1
  1226. package/dist/types/polyfill/prism/test/language-registry.test.d.ts +0 -1
  1227. package/dist/types/polyfill/prism/test/markup.test.d.ts +0 -1
  1228. package/dist/types/polyfill/prism/test/test-utils.d.ts +0 -10
  1229. package/dist/types/polyfill/prism/test/tokenizer.test.d.ts +0 -1
  1230. package/dist/types/polyfill/prism/test/tsx.test.d.ts +0 -1
  1231. package/dist/types/polyfill/prism/test/typescript.test.d.ts +0 -1
  1232. package/dist/types/polyfill/shadow-selection/test/shadow-selection-polyfill.test.d.ts +0 -0
  1233. package/dist/types/polyfill/test-polyfill/e2e/retry.d.ts +0 -8
  1234. package/dist/types/polyfill/test-polyfill/unit/create-touch-event.d.ts +0 -11
  1235. package/dist/types/polyfill/test-polyfill/unit/events.d.ts +0 -1
  1236. package/dist/types/polyfill/test-polyfill/unit/index.d.ts +0 -3
  1237. package/dist/types/polyfill/test-polyfill/unit/methods.d.ts +0 -1
  1238. package/dist/types/polyfill/test-polyfill/unit/range.d.ts +0 -7
  1239. package/dist/types/polyfill/test-polyfill/unit/shadow-selection.d.ts +0 -0
  1240. package/dist/types/polyfill/tinycolor/tinycolor-polyfill.test.d.ts +0 -1
  1241. package/dist/types/test-assets/test-icons.d.ts +0 -4
  1242. package/dist/types/types/test/type-guard.test.d.ts +0 -1
  1243. package/dist/types/utils/e2e-utils.d.ts +0 -160
  1244. package/dist/types/utils/sanitize/test/empty-strategy.test.d.ts +0 -1
  1245. package/dist/types/utils/sanitize/test/html-sanitizer.test.d.ts +0 -1
  1246. package/dist/types/utils/sanitize/test/label-strategy.test.d.ts +0 -1
  1247. package/dist/types/utils/sanitize/test/sanitize-strategy.test.d.ts +0 -1
  1248. package/dist/types/utils/sanitize/test/sanitize.test.d.ts +0 -1
  1249. package/dist/types/utils/sanitize/test/serialize-fragment.test.d.ts +0 -1
  1250. package/dist/types/utils/sanitize/test/style-strategy.test.d.ts +0 -1
  1251. package/dist/types/utils/spec-utils.d.ts +0 -109
  1252. package/dist/types/utils/test/accessibility.test.d.ts +0 -1
  1253. package/dist/types/utils/test/api.test.d.ts +0 -1
  1254. package/dist/types/utils/test/array.test.d.ts +0 -1
  1255. package/dist/types/utils/test/breakpoint.test.d.ts +0 -1
  1256. package/dist/types/utils/test/component.test.d.ts +0 -1
  1257. package/dist/types/utils/test/date.test.d.ts +0 -1
  1258. package/dist/types/utils/test/design-token.test.d.ts +0 -1
  1259. package/dist/types/utils/test/effect.test.d.ts +0 -1
  1260. package/dist/types/utils/test/local-storage.test.d.ts +0 -1
  1261. package/dist/types/utils/test/log.test.d.ts +0 -1
  1262. package/dist/types/utils/test/misc.test.d.ts +0 -1
  1263. package/dist/types/utils/test/number.test.d.ts +0 -1
  1264. package/dist/types/utils/test/object.test.d.ts +0 -1
  1265. package/dist/types/utils/test/pagination.test.d.ts +0 -1
  1266. package/dist/types/utils/test/pixel.test.d.ts +0 -1
  1267. package/dist/types/utils/test/safe-document.test.d.ts +0 -1
  1268. package/dist/types/utils/test/spec-utils.test.d.ts +0 -1
  1269. package/dist/types/utils/test/string.test.d.ts +0 -1
  1270. package/dist/types/utils/test/test-utils.test.d.ts +0 -1
  1271. package/dist/types/utils/test/timer.test.d.ts +0 -1
  1272. package/dist/types/utils/test/ui.test.d.ts +0 -1
  1273. package/dist/types/utils/test-utils.d.ts +0 -61
  1274. package/dist/vega/p-02bab5ea.entry.js +0 -1
  1275. package/dist/vega/p-02fec68b.entry.js +0 -1
  1276. package/dist/vega/p-04f9b0d4.entry.js +0 -1
  1277. package/dist/vega/p-076c6445.entry.js +0 -1
  1278. package/dist/vega/p-085d45c9.js +0 -1
  1279. package/dist/vega/p-0ac91609.entry.js +0 -1
  1280. package/dist/vega/p-10e9438e.js +0 -1
  1281. package/dist/vega/p-14dfdba3.entry.js +0 -1
  1282. package/dist/vega/p-1665d4b8.entry.js +0 -1
  1283. package/dist/vega/p-1784724a.entry.js +0 -1
  1284. package/dist/vega/p-18378017.entry.js +0 -1
  1285. package/dist/vega/p-19adff1f.entry.js +0 -1
  1286. package/dist/vega/p-20981b17.entry.js +0 -1
  1287. package/dist/vega/p-2697b52b.js +0 -1
  1288. package/dist/vega/p-28c8ffb4.js +0 -1
  1289. package/dist/vega/p-28ed34b3.entry.js +0 -1
  1290. package/dist/vega/p-2bbbdf87.entry.js +0 -1
  1291. package/dist/vega/p-2fd266fa.js +0 -1
  1292. package/dist/vega/p-31945d6c.js +0 -1
  1293. package/dist/vega/p-32a0eed4.entry.js +0 -1
  1294. package/dist/vega/p-33475bcf.entry.js +0 -1
  1295. package/dist/vega/p-33cacbd6.entry.js +0 -1
  1296. package/dist/vega/p-3a0b3fed.entry.js +0 -1
  1297. package/dist/vega/p-405ab757.js +0 -1
  1298. package/dist/vega/p-4068e7de.js +0 -1
  1299. package/dist/vega/p-408a1baa.entry.js +0 -1
  1300. package/dist/vega/p-439c7c13.entry.js +0 -1
  1301. package/dist/vega/p-441fd2b3.entry.js +0 -1
  1302. package/dist/vega/p-46c7763f.entry.js +0 -1
  1303. package/dist/vega/p-4a9be903.js +0 -1
  1304. package/dist/vega/p-4e15958f.js +0 -1
  1305. package/dist/vega/p-4e76a84d.entry.js +0 -1
  1306. package/dist/vega/p-4ea3cf5f.entry.js +0 -1
  1307. package/dist/vega/p-5395faac.entry.js +0 -1
  1308. package/dist/vega/p-541ae774.entry.js +0 -1
  1309. package/dist/vega/p-558a707e.entry.js +0 -1
  1310. package/dist/vega/p-561e9097.entry.js +0 -1
  1311. package/dist/vega/p-5b90bbfe.js +0 -1
  1312. package/dist/vega/p-5d397ee0.entry.js +0 -1
  1313. package/dist/vega/p-5dfd36d3.entry.js +0 -1
  1314. package/dist/vega/p-603b851c.js +0 -1
  1315. package/dist/vega/p-615bc3de.entry.js +0 -1
  1316. package/dist/vega/p-6554a801.js +0 -1
  1317. package/dist/vega/p-667d5b80.entry.js +0 -1
  1318. package/dist/vega/p-679a4046.entry.js +0 -1
  1319. package/dist/vega/p-6b19d33a.entry.js +0 -1
  1320. package/dist/vega/p-6d6ea8b4.js +0 -1
  1321. package/dist/vega/p-6db0556d.js +0 -1
  1322. package/dist/vega/p-6e05fc55.js +0 -1
  1323. package/dist/vega/p-6e13e2fc.js +0 -1
  1324. package/dist/vega/p-71720290.entry.js +0 -1
  1325. package/dist/vega/p-76f2e0f5.js +0 -1
  1326. package/dist/vega/p-79df30e3.entry.js +0 -1
  1327. package/dist/vega/p-7f68abf7.js +0 -1
  1328. package/dist/vega/p-814c37be.entry.js +0 -1
  1329. package/dist/vega/p-820906b8.entry.js +0 -1
  1330. package/dist/vega/p-833b79ad.entry.js +0 -1
  1331. package/dist/vega/p-8b891f36.entry.js +0 -1
  1332. package/dist/vega/p-8cd70b3b.js +0 -1
  1333. package/dist/vega/p-8f88fb57.js +0 -1
  1334. package/dist/vega/p-905cf163.entry.js +0 -1
  1335. package/dist/vega/p-916ef5dd.entry.js +0 -1
  1336. package/dist/vega/p-937d5317.entry.js +0 -1
  1337. package/dist/vega/p-972c594b.entry.js +0 -1
  1338. package/dist/vega/p-9e6e76b2.entry.js +0 -1
  1339. package/dist/vega/p-a01ef160.entry.js +0 -1
  1340. package/dist/vega/p-a02f77c7.js +0 -1
  1341. package/dist/vega/p-a0a39ec3.js +0 -1
  1342. package/dist/vega/p-a2161e9d.js +0 -1
  1343. package/dist/vega/p-a5543b6a.entry.js +0 -1
  1344. package/dist/vega/p-a6ad6515.entry.js +0 -1
  1345. package/dist/vega/p-a6fb81c5.js +0 -1
  1346. package/dist/vega/p-ace7aa6c.entry.js +0 -1
  1347. package/dist/vega/p-b15a2d4b.js +0 -1
  1348. package/dist/vega/p-b4d72eff.entry.js +0 -1
  1349. package/dist/vega/p-b589cafd.entry.js +0 -1
  1350. package/dist/vega/p-b67672ae.entry.js +0 -1
  1351. package/dist/vega/p-b7dd3ef2.entry.js +0 -1
  1352. package/dist/vega/p-b91aff06.entry.js +0 -1
  1353. package/dist/vega/p-bc142c5c.entry.js +0 -1
  1354. package/dist/vega/p-c58c3e7e.entry.js +0 -1
  1355. package/dist/vega/p-c962cf5b.js +0 -1
  1356. package/dist/vega/p-cb0324e7.entry.js +0 -1
  1357. package/dist/vega/p-d5a8bb62.entry.js +0 -1
  1358. package/dist/vega/p-d6875e49.js +0 -1
  1359. package/dist/vega/p-d862195c.entry.js +0 -1
  1360. package/dist/vega/p-d94d785a.entry.js +0 -1
  1361. package/dist/vega/p-db29681a.entry.js +0 -1
  1362. package/dist/vega/p-dba91c23.entry.js +0 -1
  1363. package/dist/vega/p-dccda3d1.js +0 -1
  1364. package/dist/vega/p-dce9349e.js +0 -1
  1365. package/dist/vega/p-dd4c3d9b.entry.js +0 -1
  1366. package/dist/vega/p-e2268eef.js +0 -1
  1367. package/dist/vega/p-e5da9f66.js +0 -1
  1368. package/dist/vega/p-f7505267.js +0 -1
  1369. package/dist/vega/p-fadeb5a2.entry.js +0 -1
  1370. package/dist/vega/p-fb92092b.entry.js +0 -1
  1371. package/dist/vega/p-fc3d6d9d.js +0 -1
  1372. package/dist/vega/p-fc93b467.entry.js +0 -1
  1373. package/dist/vega/p-fef22245.js +0 -1
@@ -0,0 +1,4942 @@
1
+ import { g as ActionHandleStrategy, e as RTETextBlock, c as RTETextNode, h as AppendChildrenAction, A as ActionHandleStrategyRegistry, T as TextStyleAnnotationAction, q as BlockUpdateTextStyleStrategy, H as HorizontalAlignmentAnnotationAction, r as BlockUpdateHorizontalAlignmentStrategy, l as ModifyContentActionType, t as BlockInsertLineBreakStrategy, u as BlockInsertLineBreakWithBlocksStrategy, v as BlockSplitWithTextNodeStrategy, w as BlockReplaceNodesStrategy, x as BlockMergeNodesStrategy, I as InsertChildrenAfterAction, n as RemoveChildrenAction, S as SyncUpSelectionAction, j as InsertChildrenBeforeAction, B as BlockAnnotation, y as BlockAnnotationTypeEnum, d as RTEBlock, z as CustomStyleAnnotation, D as CustomClassAnnotation, o as CustomAttributeAnnotation, E as RTECodeBlock, s as stateEntityRenderingRegistry, N as NodeAnnotation, F as NodeAnnotationTypeEnum, G as RTEDecoratorNode, J as NodeTypeEnum, K as CommonAnnotation, m as AnnotationAction, L as ReplaceChildNodesAction, M as ModifyContentAction, O as SplitBlockWithNodeAction, P as HTML_VOID_TAGS, Q as BlockDeleteNodeContentStrategy, U as UpdateTextAction, W as RemoveChildrenStrategy, X as BOLD_FONT_WEIGHT_KEYWORD, Y as BOLD_FONT_WEIGHT, Z as createStyleMapFromElement, _ as RTE_TEXT_COLORS, $ as RTE_DEFAULT_TEXT_COLOR, a0 as ITALIC_FONT_STYLE, a1 as STRIKETHROUGH_TEXT_DECORATION, a2 as UNDERLINE_TEXT_DECORATION, R as RTEFilterStylesStrategyRegistry, a3 as TextStyleAnnotation, p as RTEFilterStylesStrategy, a4 as Predicate$1, a5 as HorizontalAlignmentAnnotation, a6 as CodeAnnotation, b as RTEDTOClassManager, a7 as LinkFilterStylesStrategy, a8 as CodeBlockFilterStylesStrategy, a9 as RTECodeBlockNode, aa as CodeBlockNodeFilterStylesStrategy } from './code-block-cd913077.js';
2
+ import { g as generateUUID } from './misc-9fdbcfbb.js';
3
+ import { i as isNonNullable } from './type-guard-f6c9c89d.js';
4
+ import { C as ChangeManager } from './change-manager-6a7eb88c.js';
5
+ import { d as domNodeSubjectFactory } from './dom-node-subject-observer-factory-aca0116e.js';
6
+ import { c as VegaInternalUpdateRTECursorPosition, d as VegaInternalRichTextEditorFlushChanges } from './vega-internal-event-id-70bd893d.js';
7
+ import { r as rgbToHex, i as isHTMLElement } from './ui-b7600a48.js';
8
+ import { c as cleanObject } from './object-0c277f57.js';
9
+ import { L as LogUtility } from './global-slimmer-registry-17c4efd4.js';
10
+
11
+ /**
12
+ * Remove list item nest list block strategy.
13
+ */
14
+ class ListItemRemoveNestListStrategy extends ActionHandleStrategy {
15
+ /**
16
+ * Remove the nest list block from the list item, clear the property children when the children is empty.
17
+ *
18
+ * @param {RemoveNestListAction} action - The action instance.
19
+ * @param {RTEListItemBlock} target - The list item block.
20
+ */
21
+ handleAction(action, target) {
22
+ if (target.nestList) {
23
+ if (target.nestList.length > 1) {
24
+ target.nestList = target.nestList.filter((child) => child !== action.nestListBlockToBeRemoved);
25
+ }
26
+ else {
27
+ target.nestList = undefined;
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Replace list item nest list strategy.
35
+ */
36
+ class ListItemReplaceNestListStrategy extends ActionHandleStrategy {
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ handleAction(action, target) {
41
+ action.newList.forEach((listBlock) => {
42
+ listBlock.parent = target;
43
+ });
44
+ target.nestList = action.newList;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Insert image node to list item block strategy.
50
+ */
51
+ class ListItemInsertImageStrategy extends ActionHandleStrategy {
52
+ /**
53
+ * The image node can not insert into list item block, so insert image after parent list block.
54
+ *
55
+ * @param {InsertImageToBlockAction} action - The action instance.
56
+ * @param {RTEListItemBlock} target - The list item block.
57
+ */
58
+ handleAction(action, target) {
59
+ target.parent.apply(action);
60
+ }
61
+ }
62
+
63
+ /**
64
+ * List item block
65
+ */
66
+ class RTEListItemBlock extends RTETextBlock {
67
+ constructor(id, nestList, options) {
68
+ super(id, 'list-item', options);
69
+ /**
70
+ * TODO: Refactor the list item properties children and nestList, merge two properties together.
71
+ *
72
+ * 1. Update the type of `children` to include `RTEListBlock` as a possible type.
73
+ * 2. The list block children should text block array and nest list block array, The text block should wrap a `li` tag when rendering.
74
+ */
75
+ this.nestList = [];
76
+ this.nestList = nestList;
77
+ }
78
+ /**
79
+ * Converts a VegaRTEListItemBlock object to an RTEListItemBlock
80
+ *
81
+ * @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
82
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
83
+ * @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
84
+ */
85
+ static from(block, options = { autoMatchFormat: true }) {
86
+ const listItemBlock = new RTEListItemBlock(block.id, undefined, options);
87
+ listItemBlock.children = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock, options));
88
+ if (block.children) {
89
+ listItemBlock.nestList = block.children.map((child) => {
90
+ const listBlock = RTEListBlock.from(child);
91
+ listBlock.parent = listItemBlock;
92
+ return listBlock;
93
+ });
94
+ }
95
+ const { annotations } = block;
96
+ if (annotations) {
97
+ Object.entries(annotations).forEach(([type, value]) => {
98
+ const item = this.createAnnotationEntity(type, value);
99
+ if (isNonNullable(item)) {
100
+ listItemBlock.annotationMap.set(...item);
101
+ }
102
+ });
103
+ }
104
+ return listItemBlock;
105
+ }
106
+ /**
107
+ * @inheritDoc
108
+ */
109
+ toJSON() {
110
+ var _a;
111
+ return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
112
+ }
113
+ /**
114
+ * @inheritDoc
115
+ */
116
+ toHtml(options) {
117
+ const attrStr = super.generateAttributeString(options);
118
+ return [`<li${attrStr}>`, this.getChildrenHtml(options), `</li>`].join('');
119
+ }
120
+ /**
121
+ * @inheritDoc
122
+ */
123
+ cloneWithNodes(nodes) {
124
+ const block = new RTEListItemBlock(generateUUID());
125
+ block.children = [];
126
+ block.apply(new AppendChildrenAction(nodes));
127
+ return block;
128
+ }
129
+ /**
130
+ * @inheritDoc
131
+ */
132
+ getLastNode() {
133
+ if (this.nestList && this.nestList.length > 0) {
134
+ const childListBlock = this.nestList[this.nestList.length - 1];
135
+ return childListBlock.getLastNode();
136
+ }
137
+ return super.getLastNode();
138
+ }
139
+ /**
140
+ * Create a new list item block.
141
+ *
142
+ * @returns {RTEListItemBlock} - A list item block.
143
+ */
144
+ createNewListItem() {
145
+ return new RTEListItemBlock(generateUUID());
146
+ }
147
+ /**
148
+ * @inheritDoc
149
+ */
150
+ clone(parent) {
151
+ var _a;
152
+ const block = new RTEListItemBlock(this.id);
153
+ block.children = this.children.map((node) => node.clone(block));
154
+ block.annotationMap = super.cloneAnnotations();
155
+ block.nestList = (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((child) => child.clone(block));
156
+ block.parent = parent;
157
+ return block;
158
+ }
159
+ }
160
+ (() => {
161
+ ActionHandleStrategyRegistry.register(TextStyleAnnotationAction.name, RTEListItemBlock.name, new BlockUpdateTextStyleStrategy());
162
+ ActionHandleStrategyRegistry.register(HorizontalAlignmentAnnotationAction.name, RTEListItemBlock.name, new BlockUpdateHorizontalAlignmentStrategy());
163
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new BlockInsertLineBreakStrategy());
164
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
165
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
166
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new BlockSplitWithTextNodeStrategy());
167
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new BlockReplaceNodesStrategy());
168
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
169
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new BlockMergeNodesStrategy());
170
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
171
+ })();
172
+
173
+ /**
174
+ * Convert the selected blocks to list strategy.
175
+ */
176
+ class ListTransformToListStrategy extends ActionHandleStrategy {
177
+ /**
178
+ * @inheritDoc
179
+ */
180
+ handleAction(action, target) {
181
+ const selectedBlocks = action.selectedBlocks;
182
+ const bulletList = target.parent.createList(action.listType);
183
+ const isSameList = selectedBlocks.every((block) => block.parent === target);
184
+ if (isSameList) {
185
+ // Select one or more list items belonging to the same list, and all items in this list should be updated
186
+ bulletList.apply(new AppendChildrenAction(target.children));
187
+ target.parent.apply(new InsertChildrenAfterAction(target, bulletList));
188
+ target.parent.apply(new RemoveChildrenAction(target));
189
+ selectedBlocks.forEach((block) => block.children.map((node) => node.apply(new SyncUpSelectionAction())));
190
+ }
191
+ else {
192
+ const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
193
+ bulletList.apply(new AppendChildrenAction(listItems));
194
+ target.parent.apply(new InsertChildrenAfterAction(target, bulletList));
195
+ action.selectedBlocks.forEach((block) => {
196
+ block.parent.apply(new RemoveChildrenAction(block));
197
+ });
198
+ if (target.children.length === 0) {
199
+ target.parent.apply(new RemoveChildrenAction(target));
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Convert the selected list block to paragraph strategy.
207
+ */
208
+ class ListTransformToParagraphStrategy extends ActionHandleStrategy {
209
+ /**
210
+ * @inheritDoc
211
+ */
212
+ handleAction(action, target) {
213
+ let isSelectedFirstBlock = false;
214
+ let isSelectedLastBlock = false;
215
+ const selectedBlocks = action.selectedBlocks;
216
+ const currentParagraph = selectedBlocks.map((block) => {
217
+ block.children.map((node) => node.apply(new SyncUpSelectionAction()));
218
+ if (block === target.children[0])
219
+ isSelectedFirstBlock = true;
220
+ if (block === target.children[target.children.length - 1])
221
+ isSelectedLastBlock = true;
222
+ return this.toParagraph(block);
223
+ });
224
+ if (isSelectedFirstBlock) {
225
+ target.parent.apply(new InsertChildrenBeforeAction(target, ...currentParagraph));
226
+ }
227
+ else if (isSelectedLastBlock) {
228
+ target.parent.apply(new InsertChildrenAfterAction(target, ...currentParagraph));
229
+ }
230
+ else {
231
+ const startIndex = target.children.indexOf(selectedBlocks[0]);
232
+ const lastIndex = target.children.indexOf(selectedBlocks[selectedBlocks.length - 1]);
233
+ const firstBulletList = target.parent.createList(target.type);
234
+ firstBulletList.apply(new AppendChildrenAction(target.children.slice(0, startIndex)));
235
+ const lastBulletList = target.parent.createList(target.type);
236
+ lastBulletList.apply(new AppendChildrenAction(target.children.slice(lastIndex + 1)));
237
+ target.parent.apply(new InsertChildrenBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
238
+ target.parent.apply(new RemoveChildrenAction(target));
239
+ }
240
+ selectedBlocks.map((block) => {
241
+ target.apply(new RemoveChildrenAction(block));
242
+ });
243
+ if (target.children.length === 0) {
244
+ target.parent.apply(new RemoveChildrenAction(target));
245
+ }
246
+ }
247
+ /**
248
+ * Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
249
+ *
250
+ * @param {RTEListItemBlock} block - The block that will be covered
251
+ * @returns {RTETextBlock} Returns a `RTETextBlock`.
252
+ */
253
+ toParagraph(block) {
254
+ const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
255
+ textBlock.apply(new AppendChildrenAction(block['children']));
256
+ textBlock['annotationMap'] = block['annotationMap'];
257
+ return textBlock;
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Insert image to list block strategy.
263
+ */
264
+ class ListInsertImageStrategy extends ActionHandleStrategy {
265
+ /**
266
+ * Insert image block at behind of the list item block.
267
+ *
268
+ * @param {InsertImageToBlockAction} action - The insert image action instance.
269
+ * @param {RTEListBlock} target - The list block.
270
+ */
271
+ handleAction(action, target) {
272
+ const imageBlock = action.imageBlockToBeInserted;
273
+ if (target.parent['type'] !== 'list-item') {
274
+ target.parent.apply(new InsertChildrenAfterAction(target, imageBlock));
275
+ }
276
+ else {
277
+ target.parent.apply(action);
278
+ }
279
+ }
280
+ }
281
+
282
+ /**
283
+ * List annotation
284
+ */
285
+ class ListAnnotation extends BlockAnnotation {
286
+ constructor() {
287
+ super(...arguments);
288
+ this.type = BlockAnnotationTypeEnum.LIST;
289
+ }
290
+ /**
291
+ * Get the default standalone styles for a list block.
292
+ *
293
+ * @returns {AnnotationStyle} The default styles.
294
+ */
295
+ static getDefaultStyles() {
296
+ return {
297
+ paddingLeft: '8px',
298
+ marginLeft: '16px',
299
+ };
300
+ }
301
+ /**
302
+ * @inheritDoc
303
+ */
304
+ renderStyle(options) {
305
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
306
+ return null;
307
+ return ListAnnotation.getDefaultStyles();
308
+ }
309
+ /**
310
+ * @inheritDoc
311
+ */
312
+ renderClass(options) {
313
+ if (options === null || options === void 0 ? void 0 : options.standalone)
314
+ return null;
315
+ return 'v-rte--list';
316
+ }
317
+ /**
318
+ * @inheritDoc
319
+ */
320
+ clone() {
321
+ return new ListAnnotation();
322
+ }
323
+ /**
324
+ * @inheritDoc
325
+ */
326
+ toJSON() {
327
+ return undefined;
328
+ }
329
+ }
330
+
331
+ /**
332
+ * List block
333
+ */
334
+ class RTEListBlock extends RTEBlock {
335
+ constructor(id, type, options) {
336
+ super(id);
337
+ this.type = 'bullet-list';
338
+ this.children = [];
339
+ this.type = type;
340
+ const { autoMatchFormat } = options || { autoMatchFormat: true };
341
+ if (autoMatchFormat) {
342
+ this.annotationMap.set(BlockAnnotationTypeEnum.LIST, new ListAnnotation());
343
+ }
344
+ }
345
+ /**
346
+ * Converts a VegaRTEListBlock object to an RTEListBlock
347
+ *
348
+ * @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
349
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
350
+ * @returns {RTEListBlock} Return an instance of `RTEListBlock`
351
+ */
352
+ static from(block, options = { autoMatchFormat: true }) {
353
+ const listBlock = new RTEListBlock(block.id, block.type, options);
354
+ const { annotations } = block;
355
+ if (annotations) {
356
+ Object.entries(annotations).forEach(([type, value]) => {
357
+ const item = this.createAnnotationEntity(type, value);
358
+ if (isNonNullable(item)) {
359
+ listBlock.annotationMap.set(...item);
360
+ }
361
+ });
362
+ }
363
+ listBlock.children = block.blocks.map((item) => {
364
+ const listItemBlock = RTEListItemBlock.from(item, options);
365
+ listItemBlock.parent = listBlock;
366
+ return listItemBlock;
367
+ });
368
+ return listBlock;
369
+ }
370
+ /**
371
+ * The function `createAnnotationEntity` creates a block annotation entity based on the provided type
372
+ * and value.
373
+ *
374
+ * @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
375
+ * the type of annotation entity to create.
376
+ * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
377
+ * that will be used to create the annotation entity. It can be of any type depending on the specific
378
+ * annotation being created.
379
+ * @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
380
+ * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
381
+ */
382
+ static createAnnotationEntity(type, value) {
383
+ switch (type) {
384
+ case 'customAttribute':
385
+ return CustomAttributeAnnotation.from(value);
386
+ case 'customClass':
387
+ return CustomClassAnnotation.from(value);
388
+ case 'customStyle':
389
+ return CustomStyleAnnotation.from(value);
390
+ }
391
+ }
392
+ /**
393
+ * @inheritDoc
394
+ */
395
+ toJSON() {
396
+ return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.children.map((block) => block.toJSON()) });
397
+ }
398
+ /**
399
+ * @inheritDoc
400
+ */
401
+ toHtml(options) {
402
+ const BlockTag = this.getBlockTag();
403
+ const attrStr = super.generateAttributeString(options);
404
+ return [
405
+ `<${BlockTag}${attrStr}>`,
406
+ this.children.map((block) => block.toHtml(options)).join(''),
407
+ `</${BlockTag}>`,
408
+ ].join('');
409
+ }
410
+ /**
411
+ * @inheritDoc
412
+ */
413
+ isNotEmpty() {
414
+ return this.children.length > 0;
415
+ }
416
+ /**
417
+ * @inheritDoc
418
+ */
419
+ getLastNode() {
420
+ return this.children[this.children.length - 1].getLastNode();
421
+ }
422
+ /**
423
+ * @inheritDoc
424
+ */
425
+ clone(parent) {
426
+ const clonedListBlock = new RTEListBlock(this.id, this.type);
427
+ clonedListBlock.children = this.children.map((item) => item.clone(clonedListBlock));
428
+ clonedListBlock.annotationMap = super.cloneAnnotations();
429
+ clonedListBlock.parent = parent;
430
+ return clonedListBlock;
431
+ }
432
+ /**
433
+ * Returns the block tag based on the type of the list block.
434
+ *
435
+ * @returns {RTEListBlockTagType} - The block tag for the list block, either 'ol' or 'ul'.
436
+ */
437
+ getBlockTag() {
438
+ return this.type === 'number-list' ? 'ol' : 'ul';
439
+ }
440
+ }
441
+ (() => {
442
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
443
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
444
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
445
+ })();
446
+
447
+ /**
448
+ * Transform the selected text blocks to a code block strategy.
449
+ */
450
+ class BlockTransformToCodeBlockStrategy extends ActionHandleStrategy {
451
+ /**
452
+ * Get the all select text and create a new code block.
453
+ *
454
+ * @param {TransformToCodeBlockAction} action - The action instance.
455
+ * @param {VegaRTEContent} target - The block top parent instance.
456
+ */
457
+ handleAction(action, target) {
458
+ const selectedBlocks = action.selectedBlocks;
459
+ const codeBlock = new RTECodeBlock(generateUUID(), this.getCodeContent(selectedBlocks), 'plainText');
460
+ target.apply(new InsertChildrenBeforeAction(selectedBlocks[0], codeBlock));
461
+ action.newCodeBlock = codeBlock;
462
+ this.removeSelectBlocks(selectedBlocks, target);
463
+ }
464
+ /**
465
+ * Get the selected text block text content.
466
+ *
467
+ * @param {RTEBlock[]} selectedBlocks - The selected blocks.
468
+ * @returns {string} - The selected text content.
469
+ */
470
+ getCodeContent(selectedBlocks) {
471
+ const selectedTextBlocks = selectedBlocks.filter((item) => item.type !== 'image' && item.type !== 'list-item');
472
+ return selectedTextBlocks
473
+ .map((block) => {
474
+ return block.children.map((node) => node.text).join('');
475
+ })
476
+ .join('\n');
477
+ }
478
+ /**
479
+ * Remove the selected blocks after append new code block.
480
+ *
481
+ * @param {RTEBlock[]} selectedBlocks - The selected blocks.
482
+ * @param {VegaRTEContent} target - The selected block top parent object.
483
+ */
484
+ removeSelectBlocks(selectedBlocks, target) {
485
+ for (let i = 0; i < selectedBlocks.length; i++) {
486
+ target.apply(new RemoveChildrenAction(selectedBlocks[i]));
487
+ }
488
+ }
489
+ }
490
+
491
+ /**
492
+ * Abstract class to define strategies for processing HTML elements
493
+ */
494
+ class ElementToDTOStrategy {
495
+ }
496
+ /**
497
+ * Class to represent the output of a strategy applied to HTML elements
498
+ */
499
+ class ElementToDTOStrategyOutput {
500
+ constructor(currentStrategy, currentElements) {
501
+ this.childrenOutput = [];
502
+ this.currentStrategy = currentStrategy;
503
+ this.currentElements = currentElements;
504
+ }
505
+ /**
506
+ * Set children output.
507
+ *
508
+ * @param {ElementToDTOStrategyOutput[]} childrenOutput - children outputs.
509
+ */
510
+ setChildrenOutput(childrenOutput) {
511
+ this.childrenOutput = childrenOutput;
512
+ }
513
+ /**
514
+ * Transform current output and children output to DTO
515
+ *
516
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
517
+ * @returns {Nullable<RTEContentBlock>} - DTO.
518
+ */
519
+ toDto(options = { autoMatchFormat: true, skipCustomAnnotations: true }) {
520
+ const currentBlock = this.currentStrategy.handle(this.currentElements, options);
521
+ if (this.childrenOutput.length > 0 && currentBlock) {
522
+ this.currentStrategy.appendChildBlocks(currentBlock, this.childrenOutput
523
+ .map((childOutput) => childOutput.toDto(options))
524
+ .filter(isNonNullable));
525
+ }
526
+ return currentBlock;
527
+ }
528
+ }
529
+
530
+ /**
531
+ * Manager for registering and retrieving strategies that convert HTML elements to DTOs.
532
+ */
533
+ class elementToDTOClassStrategyManager {
534
+ constructor() {
535
+ this.elementToBlockStrategies = [];
536
+ this.elementToNodeStrategies = [];
537
+ }
538
+ /**
539
+ * Registers a element to block strategy for converting HTML elements to DTOs. The new strategy is added to the beginning of the list to give it higher priority.
540
+ *
541
+ * @param {ElementToDTOStrategy} strategy - The strategy to register.
542
+ */
543
+ registerElementToBlockStrategy(strategy) {
544
+ if (!this.hasDuplicateStrategy(strategy, this.elementToBlockStrategies)) {
545
+ this.elementToBlockStrategies.unshift(strategy);
546
+ }
547
+ }
548
+ /**
549
+ * Registers an element to node strategy for converting HTML elements to DTOs. The new strategy is added to the beginning of the list to give it higher priority.
550
+ *
551
+ * @param {ElementToDTOStrategy} strategy - The strategy to register.
552
+ */
553
+ registerElementToNodeStrategy(strategy) {
554
+ if (!this.hasDuplicateStrategy(strategy, this.elementToNodeStrategies)) {
555
+ this.elementToNodeStrategies.unshift(strategy);
556
+ }
557
+ }
558
+ /**
559
+ * Retrieves all registered element to block strategies for converting HTML elements to DTOs.
560
+ *
561
+ * @returns {ElementToDTOStrategy[]} - A set of all registered element to block strategies.
562
+ */
563
+ getElementToBlockStrategies() {
564
+ return this.elementToBlockStrategies;
565
+ }
566
+ /**
567
+ * Retrieves all registered element to node strategies for converting HTML elements to DTOs.
568
+ *
569
+ * @returns {ElementToDTOStrategy[]} - A set of all registered element to node strategies.
570
+ */
571
+ getElementToNodeStrategies() {
572
+ return this.elementToNodeStrategies;
573
+ }
574
+ /**
575
+ * Checks if a strategy is already registered in the provided strategy list.
576
+ *
577
+ * @param {ElementToDTOStrategy} strategy - The strategy to check for duplicates.
578
+ * @param {ElementToDTOStrategy[]} strategyList - The list of strategies to check against.
579
+ * @returns {boolean} - True if the strategy is a duplicate, false otherwise.
580
+ */
581
+ hasDuplicateStrategy(strategy, strategyList) {
582
+ return strategyList.includes(strategy);
583
+ }
584
+ }
585
+ const ElementToDTOClassStrategyManager = new elementToDTOClassStrategyManager();
586
+
587
+ /** Element to DTO processor */
588
+ class ElementToDtoStrategyProcessor {
589
+ /**
590
+ * Transform process.
591
+ *
592
+ * @param {HTMLElement[]} elements - Current elements.
593
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
594
+ * @returns {ElementToDTOStrategyOutput[]} - outputs.
595
+ */
596
+ process(elements, options = { autoMatchFormat: true, skipCustomAnnotations: true }) {
597
+ const strategies = this.getElementToBlockStrategies();
598
+ const outputs = [];
599
+ for (let i = 0; i < elements.length; i++) {
600
+ if (this.isInvalidElement(elements[i], options))
601
+ continue;
602
+ let canHandledCount = 0;
603
+ for (const strategy of strategies) {
604
+ canHandledCount = strategy.canHandle(elements, i, options);
605
+ if (canHandledCount > 0) {
606
+ const handledElements = elements.slice(i, i + canHandledCount);
607
+ const output = new ElementToDTOStrategyOutput(strategy, handledElements);
608
+ if (canHandledCount === 1 && strategy.shouldProceedToElementChildren()) {
609
+ output.setChildrenOutput(this.process(Array.from(handledElements[0].childNodes), options));
610
+ }
611
+ outputs.push(output);
612
+ i += canHandledCount - 1;
613
+ break;
614
+ }
615
+ }
616
+ if (canHandledCount === 0 && i < elements.length) {
617
+ const elementChildren = Array.from(elements[i].childNodes);
618
+ const childrenOutputs = this.process(Array.from(elementChildren), options);
619
+ if (childrenOutputs.length > 0) {
620
+ outputs.push(...childrenOutputs);
621
+ }
622
+ }
623
+ }
624
+ return outputs;
625
+ }
626
+ /**
627
+ * Checks if the given element should be skipped during processing.
628
+ *
629
+ * Comment nodes are always skipped. META and STYLE elements are skipped only
630
+ * in auto-match mode; in raw-HTML mode (autoMatchFormat: false) they are passed
631
+ * through so downstream strategies can decide how to handle them.
632
+ *
633
+ * @param {HTMLElement} element - The element to check.
634
+ * @param {VegaRTETransformOptions} options - Transform options.
635
+ * @returns {boolean} True when the element should be skipped.
636
+ */
637
+ isInvalidElement(element, options) {
638
+ if (element.nodeType === Node.COMMENT_NODE)
639
+ return true;
640
+ if (options.autoMatchFormat === false)
641
+ return false;
642
+ return ['META', 'STYLE'].includes(element.nodeName);
643
+ }
644
+ /**
645
+ * Get the register element to block strategies.
646
+ *
647
+ * @returns {ElementToDTOStrategy[]} - The register element to block strategies.
648
+ */
649
+ getElementToBlockStrategies() {
650
+ return ElementToDTOClassStrategyManager.getElementToBlockStrategies();
651
+ }
652
+ }
653
+ const ElementToDtoStrategyProcessor$1 = new ElementToDtoStrategyProcessor();
654
+
655
+ /**
656
+ * Update the cursor position in the editor.
657
+ */
658
+ class UpdateCursorPositionStrategy extends ActionHandleStrategy {
659
+ /**
660
+ * @inheritDoc
661
+ */
662
+ handleAction(action, target) {
663
+ const { offset, nextFocusNode, immediatelyRun } = action;
664
+ const host = stateEntityRenderingRegistry.getDOMByEntity(target);
665
+ if (host) {
666
+ ChangeManager.notify(domNodeSubjectFactory.getSubject(host, VegaInternalUpdateRTECursorPosition), {
667
+ node: nextFocusNode,
668
+ offset,
669
+ updateDirectly: immediatelyRun,
670
+ });
671
+ }
672
+ }
673
+ }
674
+
675
+ /**
676
+ * Append new block array or node array to block or VegaRTEContent instance strategy.
677
+ */
678
+ class AppendChildrenStrategy extends ActionHandleStrategy {
679
+ /**
680
+ * @inheritDoc
681
+ */
682
+ handleAction(action, target) {
683
+ const newBlocks = action.entityToBeAppended;
684
+ if (target.children) {
685
+ newBlocks.forEach((block) => {
686
+ block.parent = target;
687
+ });
688
+ // This line is used to fix the typescript error `This expression is not callable`. https://github.com/microsoft/TypeScript/issues/44373
689
+ const arrayFixed = target.children;
690
+ target.children = arrayFixed.concat(newBlocks);
691
+ }
692
+ }
693
+ }
694
+
695
+ /**
696
+ * Insert children at the front of the block strategy.
697
+ */
698
+ class InsertChildrenBeforeStrategy extends ActionHandleStrategy {
699
+ /**
700
+ * @inheritDoc
701
+ */
702
+ handleAction(action, target) {
703
+ this.replaceElementWithElements(target, action.referChildren, [
704
+ ...action.childrenToBeInserted,
705
+ action.referChildren,
706
+ ]);
707
+ }
708
+ /**
709
+ * Replaces a specific block or node with an array of blocks or nodes within RTEContentBlock array.
710
+ *
711
+ * @param {RTEBlock | VegaRTEContent} target - The block or the VegaRTEContent instance.
712
+ * @param {RTEBlock | RTENode} referElement - Used as a reference element to identify the element that needs to be replaced in the array.
713
+ * @param {RTEBlock[] | RTENode[]} elements - An array of block or node objects that you want to replace the `referElement` with in the array.
714
+ */
715
+ replaceElementWithElements(target, referElement, elements) {
716
+ if (target.children) {
717
+ elements.forEach((block) => {
718
+ block.parent = target;
719
+ });
720
+ const arrayFixed = target.children;
721
+ target.children = arrayFixed.flatMap((block) => {
722
+ if (block === referElement) {
723
+ return elements;
724
+ }
725
+ else {
726
+ return block;
727
+ }
728
+ });
729
+ }
730
+ }
731
+ }
732
+
733
+ /**
734
+ * Insert children at the front of the block strategy.
735
+ */
736
+ class InsertChildrenAfterStrategy extends InsertChildrenBeforeStrategy {
737
+ /**
738
+ * @inheritDoc
739
+ */
740
+ handleAction(action, target) {
741
+ this.replaceElementWithElements(target, action.referChildren, [
742
+ action.referChildren,
743
+ ...action.childrenToBeInserted,
744
+ ]);
745
+ }
746
+ }
747
+
748
+ /**
749
+ * Annotation for image
750
+ */
751
+ class ImageAnnotation extends NodeAnnotation {
752
+ constructor(size, alt) {
753
+ super();
754
+ this.type = NodeAnnotationTypeEnum.IMAGE;
755
+ this.size = size;
756
+ this.alt = alt;
757
+ }
758
+ /**
759
+ * Generate the map item for the annotation
760
+ *
761
+ * @param {string} size - Image size
762
+ * @param {string} alt - Image alt
763
+ * @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
764
+ */
765
+ static from(size, alt) {
766
+ return [NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
767
+ }
768
+ /**
769
+ * Get the default standalone base styles for an image node.
770
+ *
771
+ * @returns {AnnotationStyle} The default styles.
772
+ */
773
+ static getDefaultStyles() {
774
+ return {
775
+ verticalAlign: 'bottom',
776
+ };
777
+ }
778
+ /**
779
+ * Generate the JSON representation of the annotation
780
+ *
781
+ * @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
782
+ */
783
+ toJSON() {
784
+ return isNonNullable(this.alt)
785
+ ? {
786
+ size: this.size,
787
+ alt: this.alt,
788
+ }
789
+ : {
790
+ size: this.size,
791
+ };
792
+ }
793
+ /**
794
+ * @inheritDoc
795
+ */
796
+ clone() {
797
+ return new ImageAnnotation(this.size, this.alt);
798
+ }
799
+ /**
800
+ * @inheritDoc
801
+ */
802
+ renderClass(options) {
803
+ if (options === null || options === void 0 ? void 0 : options.standalone)
804
+ return null;
805
+ return this.size ? `v-rte--image-size-${this.size}` : null;
806
+ }
807
+ /**
808
+ * @inheritDoc
809
+ */
810
+ renderStyle(options) {
811
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
812
+ return null;
813
+ const baseStyle = ImageAnnotation.getDefaultStyles();
814
+ switch (this.size) {
815
+ case 'sm': {
816
+ return Object.assign(Object.assign({}, baseStyle), { width: '25%' });
817
+ }
818
+ case 'md': {
819
+ return Object.assign(Object.assign({}, baseStyle), { width: '50%' });
820
+ }
821
+ case 'lg': {
822
+ return Object.assign(Object.assign({}, baseStyle), { width: '100%' });
823
+ }
824
+ }
825
+ }
826
+ }
827
+ ImageAnnotation.BASE_STYLES = { verticalAlign: 'bottom' };
828
+
829
+ /**
830
+ * Update the image node annotation map strategy.
831
+ */
832
+ class ImageSetAnnotationMapStrategy extends ActionHandleStrategy {
833
+ /**
834
+ * @inheritDoc
835
+ */
836
+ handleAction(action, target) {
837
+ const annotation = action.toAnnotation();
838
+ target.annotationMap.set(annotation.type, annotation);
839
+ }
840
+ }
841
+
842
+ /**
843
+ * The image node update property url strategy.
844
+ */
845
+ class ImageUpdateUrlStrategy extends ActionHandleStrategy {
846
+ /**
847
+ * @inheritDoc
848
+ */
849
+ handleAction(action, target) {
850
+ target.url = action.url;
851
+ }
852
+ }
853
+
854
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
855
+ var t = {};
856
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
857
+ t[p] = s[p];
858
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
859
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
860
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
861
+ t[p[i]] = s[p[i]];
862
+ }
863
+ return t;
864
+ };
865
+ /**
866
+ * Image node
867
+ */
868
+ class RTEImageNode extends RTEDecoratorNode {
869
+ constructor(id, url, parentBlock, annotationMap) {
870
+ super(id, annotationMap);
871
+ this.type = NodeTypeEnum.IMAGE;
872
+ this.url = url;
873
+ this.parent = parentBlock;
874
+ }
875
+ /**
876
+ * Converts a VegaRTEImageNode into an RTEImageNode by mapping nodes and creating annotations.
877
+ *
878
+ * @param {VegaRTEImageNode} node - The node to be converted.
879
+ * @param {RTEImageBlock} parentBlock - The parent block
880
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
881
+ * @returns {RTEImageNode} An instance of `RTEImageBlock`
882
+ */
883
+ static from(node, parentBlock, options = { autoMatchFormat: true }) {
884
+ const imageNode = new RTEImageNode(node.id, node.url, parentBlock);
885
+ const autoMatchFormat = !!options.autoMatchFormat;
886
+ const _a = Object.assign({}, node.annotations), { size } = _a, otherAnnotations = __rest(_a, ["size"]);
887
+ const annotations = Object.assign(Object.assign({}, otherAnnotations), { size: size !== null && size !== void 0 ? size : (autoMatchFormat ? 'md' : undefined) });
888
+ imageNode.annotationMap = new Map(Object.keys(annotations)
889
+ .map((type) => {
890
+ if (type === 'size' || type === 'alt') {
891
+ return ImageAnnotation.from(annotations.size, annotations.alt);
892
+ }
893
+ return this.createAnnotationEntity(type, annotations[type]);
894
+ })
895
+ .filter(isNonNullable));
896
+ return imageNode;
897
+ }
898
+ /**
899
+ * @inheritDoc
900
+ */
901
+ toJSON() {
902
+ const annotations = Array.from(this.annotationMap.values())
903
+ .filter((annotation) => annotation instanceof ImageAnnotation || annotation instanceof CommonAnnotation)
904
+ .reduce((record, annotation) => {
905
+ return Object.assign(Object.assign({}, record), annotation.toJSON());
906
+ }, {});
907
+ if (annotations.alt == '')
908
+ delete annotations.alt;
909
+ return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
910
+ }
911
+ /**
912
+ * @inheritDoc
913
+ */
914
+ clone(parent) {
915
+ return new RTEImageNode(this.id, this.url, parent, super.cloneAnnotations());
916
+ }
917
+ /**
918
+ * @inheritDoc
919
+ */
920
+ toHtml(options) {
921
+ const imageAnnotation = this.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE);
922
+ const attrStr = super.generateAttributeString(options, ...[
923
+ imageAnnotation && imageAnnotation.alt ? `alt="${imageAnnotation.alt}"` : null,
924
+ `src="${this.url}"`,
925
+ imageAnnotation && imageAnnotation.size ? `data-size="${imageAnnotation.size}"` : null,
926
+ ].filter(isNonNullable));
927
+ return `<img${attrStr}>`;
928
+ }
929
+ /**
930
+ * @inheritDoc
931
+ */
932
+ doAnnotationActionApply(action) {
933
+ const strategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTEImageNode.name);
934
+ if (strategy) {
935
+ strategy.execute(action, this);
936
+ }
937
+ }
938
+ /**
939
+ * @inheritDoc
940
+ */
941
+ doModifyActionApply(action) {
942
+ ActionHandleStrategyRegistry.executeTheStrategy(action, this);
943
+ }
944
+ }
945
+ (() => {
946
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_IMAGE_NODE_URL, RTEImageNode.name, new ImageUpdateUrlStrategy());
947
+ ActionHandleStrategyRegistry.register(AnnotationAction.name, RTEImageNode.name, new ImageSetAnnotationMapStrategy());
948
+ })();
949
+
950
+ /**
951
+ * Split the current image block with a special position strategy.
952
+ */
953
+ class BlockSplitWithImageNodeStrategy extends ActionHandleStrategy {
954
+ /**
955
+ * @inheritDoc
956
+ */
957
+ handleAction(action, target) {
958
+ action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode, target);
959
+ }
960
+ /**
961
+ * The image offset should be 0 or 1
962
+ * <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
963
+ *
964
+ * @param {RTEImageNode} imageNode The split point image node.
965
+ * @param {number} imageOffset The cursor point 0 | 1.
966
+ * @param {RTEImageBlock} target The image block.
967
+ * @returns {Nullable<RTEBlock>} The new block after split
968
+ */
969
+ splitImageNodes(imageNode, imageOffset, target) {
970
+ const nodesSplitIndex = target.children.indexOf(imageNode);
971
+ if (nodesSplitIndex > -1) {
972
+ const beforeNodes = target.children.slice(0, nodesSplitIndex + imageOffset);
973
+ const afterNodes = target.children.slice(nodesSplitIndex + imageOffset);
974
+ target.apply(new ReplaceChildNodesAction(beforeNodes));
975
+ const newBlock = this.cloneWithNodes(afterNodes, target);
976
+ target.parent.apply(new InsertChildrenAfterAction(target, newBlock));
977
+ return newBlock;
978
+ }
979
+ }
980
+ /**
981
+ * Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
982
+ *
983
+ * @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
984
+ * @param {RTEImageBlock} target The image block.
985
+ * @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
986
+ */
987
+ cloneWithNodes(nodes, target) {
988
+ const block = target.createNewImageBlock();
989
+ block.children = [];
990
+ block.apply(new AppendChildrenAction(nodes));
991
+ return block;
992
+ }
993
+ }
994
+
995
+ /**
996
+ * Break the current block after press enter, this action is similar with the SplitBlockWithNodeAction,
997
+ * The SplitBlockWithNodeAction split the current block to two same type blocks, but this action will create new paragraph or list item when break at start or end.
998
+ * The property `newBlock` use to store the new create block if need.
999
+ *
1000
+ * @example currentBlock.apply(new InsertNewParagraphAction(startContainerNode, startOffset))
1001
+ */
1002
+ class InsertNewParagraphAction extends ModifyContentAction {
1003
+ constructor(startContainerNode, startOffset) {
1004
+ super();
1005
+ this.type = ModifyContentActionType.INSERT_NEW_PARAGRAPH;
1006
+ this.startContainerNode = startContainerNode;
1007
+ this.startOffset = startOffset;
1008
+ }
1009
+ }
1010
+
1011
+ /**
1012
+ * The image block insert line break strategy.
1013
+ */
1014
+ class ImageInsertLineBreakStrategy extends ActionHandleStrategy {
1015
+ /**
1016
+ * The image block not support insert the line break node, so invoke the insert new paragraph logic directly.
1017
+ *
1018
+ * @param {LineBreakSingleBlockAction} action - The action instance.
1019
+ * @param {RTEImageBlock} target - The image block.
1020
+ */
1021
+ handleAction(action, target) {
1022
+ const insertNewParagraphAction = new InsertNewParagraphAction(action.startContainerNode, action.startOffset);
1023
+ target.apply(insertNewParagraphAction);
1024
+ const newBlock = insertNewParagraphAction.newBlock;
1025
+ if (newBlock) {
1026
+ action.lineBreakNode = newBlock.children[0];
1027
+ }
1028
+ }
1029
+ }
1030
+
1031
+ /**
1032
+ * Insert a line break node into multiple blocks selection at special position strategy.
1033
+ */
1034
+ class ImageInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
1035
+ /**
1036
+ * @inheritDoc
1037
+ */
1038
+ handleAction(action, target) {
1039
+ action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
1040
+ }
1041
+ /**
1042
+ * Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
1043
+ *
1044
+ * @param {RTEBlock[]} selectedBlocks - An array of RTEBlock objects that represent the blocks that have been selected for a specific action in the Rich Text Editor.
1045
+ * @param {RTEImageBlock} target - The image block.
1046
+ * @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
1047
+ */
1048
+ lineBreakMultipleBlocks(selectedBlocks, target) {
1049
+ const newParagraph = RTETextBlock.from({
1050
+ id: generateUUID(),
1051
+ type: 'paragraph',
1052
+ nodes: [{ id: generateUUID(), type: 'text', text: '\n' }],
1053
+ });
1054
+ target.parent.apply(new InsertChildrenAfterAction(target, newParagraph));
1055
+ const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
1056
+ if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
1057
+ afterNodes.push(new RTETextNode(generateUUID(), '\n', newParagraph));
1058
+ }
1059
+ newParagraph.apply(new AppendChildrenAction(afterNodes));
1060
+ return newParagraph['children'][0];
1061
+ }
1062
+ /**
1063
+ * Concat the child nodes of multiple RTEBlocks if both are not images.
1064
+ *
1065
+ * @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
1066
+ * @returns {RTENode[]} Array of connected block nodes
1067
+ */
1068
+ concatBlocksNodes(blocks) {
1069
+ const nodes = [];
1070
+ blocks.map((block) => {
1071
+ if (block.type !== 'image') {
1072
+ nodes.push(...block.children);
1073
+ block.parent.apply(new RemoveChildrenAction(block));
1074
+ }
1075
+ });
1076
+ return nodes;
1077
+ }
1078
+ }
1079
+
1080
+ /**
1081
+ * Insert a image node at the special position of image block.
1082
+ */
1083
+ class ImageBlockInsertImageStrategy extends ActionHandleStrategy {
1084
+ /**
1085
+ * @inheritDoc
1086
+ */
1087
+ handleAction(action, target) {
1088
+ const splitNode = action.splitPointNode;
1089
+ const startOffsetOfNode = action.startOffsetOfNode;
1090
+ const newImageBlock = action.imageBlockToBeInserted;
1091
+ const newImageNodes = newImageBlock.children;
1092
+ if (target.children.length < 1) {
1093
+ target.apply(new AppendChildrenAction(newImageNodes));
1094
+ }
1095
+ else if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
1096
+ target.parent.apply(new InsertChildrenAfterAction(target, newImageBlock));
1097
+ }
1098
+ else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
1099
+ target.parent.apply(new InsertChildrenBeforeAction(target, newImageBlock));
1100
+ }
1101
+ else {
1102
+ target.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
1103
+ target.parent.apply(new InsertChildrenAfterAction(target, newImageBlock));
1104
+ }
1105
+ }
1106
+ }
1107
+
1108
+ /**
1109
+ * Image block
1110
+ */
1111
+ class RTEImageBlock extends RTEBlock {
1112
+ constructor(id) {
1113
+ super(id);
1114
+ this.type = 'image';
1115
+ this.children = [];
1116
+ }
1117
+ /**
1118
+ * Converts a VegaRTEImageBlock object into an RTEImageBlock object by mapping nodes and creating annotations.
1119
+ *
1120
+ * @param {VegaRTEImageBlock} block - The block object to be converted.
1121
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
1122
+ * @returns {RTEImageBlock} An instance of `RTEImageBlock`
1123
+ */
1124
+ static from(block, options = { autoMatchFormat: true }) {
1125
+ const imageBlock = new RTEImageBlock(block.id);
1126
+ const { annotations } = block;
1127
+ imageBlock.children = block.nodes.map((image) => RTEImageNode.from(image, imageBlock, options));
1128
+ if (annotations) {
1129
+ super.convertAnnotationsToMap(imageBlock.annotationMap, annotations);
1130
+ }
1131
+ return imageBlock;
1132
+ }
1133
+ /**
1134
+ * @inheritDoc
1135
+ */
1136
+ toJSON() {
1137
+ return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.children.map((node) => node.toJSON()) });
1138
+ }
1139
+ /**
1140
+ * @inheritDoc
1141
+ */
1142
+ toHtml(options) {
1143
+ const attrStr = super.generateAttributeString(options);
1144
+ const children = this.children.map((node) => node.toHtml(options)).join('');
1145
+ return super.shouldRenderAsInternalWrapper()
1146
+ ? children
1147
+ : [`<div${attrStr}>`, children, `</div>`].join('');
1148
+ }
1149
+ /**
1150
+ * @inheritDoc
1151
+ */
1152
+ isNotEmpty() {
1153
+ return this.children.length > 0 && this.children.some((node) => node.url.length > 0);
1154
+ }
1155
+ /**
1156
+ * @inheritDoc
1157
+ */
1158
+ getLastNode() {
1159
+ return this.children[this.children.length - 1];
1160
+ }
1161
+ /**
1162
+ * Create a new image block.
1163
+ *
1164
+ * @returns {RTEImageBlock} - The empty image block.
1165
+ */
1166
+ createNewImageBlock() {
1167
+ return new RTEImageBlock(generateUUID());
1168
+ }
1169
+ /**
1170
+ * @inheritDoc
1171
+ */
1172
+ clone(parent) {
1173
+ const clonedBlock = new RTEImageBlock(this.id);
1174
+ clonedBlock.children = this.children.map((node) => node.clone(clonedBlock));
1175
+ clonedBlock.annotationMap = super.cloneAnnotations();
1176
+ clonedBlock.parent = parent;
1177
+ return clonedBlock;
1178
+ }
1179
+ }
1180
+ (() => {
1181
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEImageBlock.name, new BlockMergeNodesStrategy());
1182
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name, new BlockReplaceNodesStrategy());
1183
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name, new BlockSplitWithImageNodeStrategy());
1184
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertLineBreakStrategy());
1185
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name, new ImageInsertLineBreakWithBlocksStrategy());
1186
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name, new ImageBlockInsertImageStrategy());
1187
+ ActionHandleStrategyRegistry.register(HorizontalAlignmentAnnotationAction.name, RTEImageBlock.name, new BlockUpdateHorizontalAlignmentStrategy());
1188
+ })();
1189
+
1190
+ /**
1191
+ * HTML Block
1192
+ */
1193
+ class RTEHtmlBlock extends RTEBlock {
1194
+ constructor(id, htmlTag) {
1195
+ super(id);
1196
+ this.type = 'html-block';
1197
+ this.children = [];
1198
+ this.htmlTag = htmlTag;
1199
+ }
1200
+ /**
1201
+ * Converts a VegaRTEHtmlBlock to an RTEHtmlBlock.
1202
+ *
1203
+ * @param {VegaRTEHtmlBlock} block - The VegaRTEHtmlBlock to convert.
1204
+ * @param {VegaRTETransformOptions} [options] - Optional transformation options.
1205
+ * @returns {RTEHtmlBlock} The converted RTEHtmlBlock.
1206
+ */
1207
+ static from(block, options) {
1208
+ const htmlBlock = new RTEHtmlBlock(block.id, block.htmlTag);
1209
+ const { annotations } = block;
1210
+ if (annotations) {
1211
+ super.convertAnnotationsToMap(htmlBlock.annotationMap, annotations);
1212
+ }
1213
+ htmlBlock.children = this.generateBlockChildren(block.children, options, htmlBlock);
1214
+ return htmlBlock;
1215
+ }
1216
+ /**
1217
+ * @inheritDoc
1218
+ */
1219
+ clone(parent) {
1220
+ const clonedBlock = new RTEHtmlBlock(this.id, this.htmlTag);
1221
+ clonedBlock.children = this.children.map((child) => child.clone(clonedBlock));
1222
+ clonedBlock.annotationMap = super.cloneAnnotations();
1223
+ clonedBlock.parent = parent;
1224
+ return clonedBlock;
1225
+ }
1226
+ /**
1227
+ * @inheritDoc
1228
+ */
1229
+ getLastNode() {
1230
+ return this.children[this.children.length - 1].getLastNode();
1231
+ }
1232
+ /**
1233
+ * @inheritDoc
1234
+ */
1235
+ isNotEmpty() {
1236
+ // Any RTEHtmlBlock — whether void (hr, br), childless (canvas, iframe),
1237
+ // or with children — represents real user content. Only the default empty
1238
+ // text paragraph should make the editor report as empty.
1239
+ return true;
1240
+ }
1241
+ /**
1242
+ * @inheritDoc
1243
+ */
1244
+ toHtml(options) {
1245
+ const BlockTag = this.htmlTag;
1246
+ const attrStr = super.generateAttributeString(options);
1247
+ // Handle void/self-closing tags (hr, input, col, etc.)
1248
+ // Uses HTML5 syntax without self-closing slash for consistency with img and br tags
1249
+ if (HTML_VOID_TAGS.has(this.htmlTag)) {
1250
+ return `<${BlockTag}${attrStr}>`;
1251
+ }
1252
+ // Handle normal tags with children
1253
+ return [
1254
+ `<${BlockTag}${attrStr}>`,
1255
+ this.children.map((block) => block.toHtml(options)).join(''),
1256
+ `</${BlockTag}>`,
1257
+ ].join('');
1258
+ }
1259
+ /**
1260
+ * @inheritDoc
1261
+ */
1262
+ toJSON() {
1263
+ return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, htmlTag: this.htmlTag, children: this.children.map((child) => child.toJSON()) });
1264
+ }
1265
+ }
1266
+
1267
+ /**
1268
+ * Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
1269
+ *
1270
+ * @example firstBlock.apply(new MergeTwoBlocksNodesAction(secondBlock))
1271
+ */
1272
+ class MergeTwoBlocksNodesAction extends ModifyContentAction {
1273
+ constructor(blockNeedToBeMerged) {
1274
+ super();
1275
+ this.type = ModifyContentActionType.MERGE_TWO_BLOCKS_NODES;
1276
+ this.blockNeedToBeMerged = blockNeedToBeMerged;
1277
+ }
1278
+ }
1279
+
1280
+ /**
1281
+ * Block delete text or decorator node strategy.
1282
+ */
1283
+ class BlockDeleteTextOrDecoratorNodeStrategy extends BlockDeleteNodeContentStrategy {
1284
+ /**
1285
+ * @inheritDoc
1286
+ */
1287
+ handleAction(action, target) {
1288
+ const { startContainerNode } = action;
1289
+ if (!startContainerNode.isContentEditable()) {
1290
+ this.deleteDecoratorNodeContent(action, target);
1291
+ }
1292
+ else if (startContainerNode.isTextNode()) {
1293
+ this.deleteTextNodeContent(action, target);
1294
+ }
1295
+ const parent = target.parent;
1296
+ if (parent && target.isListItemBlock() && parent.children.length === 0) {
1297
+ parent.parent.apply(new RemoveChildrenAction(parent));
1298
+ }
1299
+ }
1300
+ /**
1301
+ * Handle the delete text logic when press delete key.
1302
+ *
1303
+ * @param {DeleteBlockContentAction} action - ModifyContentAction
1304
+ * @param {RTETextBlock} target - Current text block
1305
+ */
1306
+ deleteTextNodeContent(action, target) {
1307
+ const startContainerNode = action.startContainerNode;
1308
+ const startOffset = action.startOffset;
1309
+ if (startOffset !== 0 && !startContainerNode.isEmpty()) {
1310
+ const newText = startContainerNode.text.slice(0, startOffset - 1) +
1311
+ startContainerNode.text.slice(startOffset);
1312
+ startContainerNode.apply(new UpdateTextAction(newText));
1313
+ if (newText) {
1314
+ action.previousNode = startContainerNode;
1315
+ return;
1316
+ }
1317
+ else {
1318
+ const previousNode = this.getPreviousNode(startContainerNode);
1319
+ // Remove the last character will not delete paragraph, the paragraph will removed after press delete again
1320
+ if ((previousNode && previousNode.parent === target && previousNode['text'] === '\n') ||
1321
+ target.children.length === 1) {
1322
+ action.previousNode = startContainerNode;
1323
+ return;
1324
+ }
1325
+ else {
1326
+ target.apply(new RemoveChildrenAction(startContainerNode));
1327
+ action.previousNode = previousNode;
1328
+ return;
1329
+ }
1330
+ }
1331
+ }
1332
+ else {
1333
+ let previousNode = this.getPreviousNode(startContainerNode);
1334
+ let nextNode = null;
1335
+ const isCurrentNodeEmpty = startContainerNode.isEmpty();
1336
+ if (target.children.length && previousNode && previousNode.parent !== target) {
1337
+ if (isCurrentNodeEmpty) {
1338
+ target.apply(new RemoveChildrenAction(startContainerNode));
1339
+ }
1340
+ if (target.type === previousNode.parent.type) {
1341
+ previousNode.parent.apply(new MergeTwoBlocksNodesAction(target));
1342
+ }
1343
+ }
1344
+ else {
1345
+ if (this.isContentFirstNode(startContainerNode) && isCurrentNodeEmpty) {
1346
+ nextNode = this.getNextNode(startContainerNode);
1347
+ }
1348
+ /**
1349
+ * Remove line break
1350
+ *
1351
+ * @example caret at the first line
1352
+ * \n
1353
+ * test
1354
+ */
1355
+ if (isCurrentNodeEmpty) {
1356
+ target.apply(new RemoveChildrenAction(startContainerNode));
1357
+ }
1358
+ /**
1359
+ * Remove line break or non-editable node
1360
+ *
1361
+ * @example caret at the begin of second line
1362
+ * \n
1363
+ * test
1364
+ * @example caret at the end of non-editable node and start of the text node
1365
+ * <img/><span>test</span>
1366
+ */
1367
+ if (previousNode &&
1368
+ previousNode.isTextNode() &&
1369
+ (previousNode.isEmpty() ||
1370
+ (!previousNode.isContentEditable() && previousNode.parent === target))) {
1371
+ const shouldRemoveNode = previousNode;
1372
+ previousNode = this.getPreviousNode(previousNode);
1373
+ shouldRemoveNode.parent.apply(new RemoveChildrenAction(shouldRemoveNode));
1374
+ if (!previousNode && !isCurrentNodeEmpty) {
1375
+ nextNode = startContainerNode;
1376
+ }
1377
+ }
1378
+ }
1379
+ // Remove the paragraph block if the content is empty
1380
+ // TODO: Check whether need to remove below logic because already handled the same logic in remove node strategy
1381
+ if (target.children.length === 0) {
1382
+ target.parent.apply(new RemoveChildrenAction(target));
1383
+ }
1384
+ if (previousNode) {
1385
+ action.previousNode = previousNode;
1386
+ }
1387
+ else if (nextNode) {
1388
+ action.nextNode = nextNode;
1389
+ }
1390
+ }
1391
+ }
1392
+ /**
1393
+ * Delete decorator node content
1394
+ *
1395
+ * @param {DeleteBlockContentAction} action - The delete block content action
1396
+ * @param {RTEBlock} target - The target block
1397
+ */
1398
+ deleteDecoratorNodeContent(action, target) {
1399
+ const startContainerNode = action.startContainerNode, startOffset = action.startOffset;
1400
+ let previousNode = this.getPreviousNode(startContainerNode);
1401
+ let nextNode = null;
1402
+ if (startOffset !== 0) {
1403
+ const parentBlock = target;
1404
+ if (this.isContentFirstNode(startContainerNode)) {
1405
+ nextNode = this.getNextNode(startContainerNode);
1406
+ }
1407
+ if (parentBlock.children.length === 1) {
1408
+ parentBlock.parent.apply(new RemoveChildrenAction(parentBlock));
1409
+ }
1410
+ else {
1411
+ parentBlock.apply(new RemoveChildrenAction(startContainerNode));
1412
+ }
1413
+ }
1414
+ else {
1415
+ const shouldRemoveNode = previousNode;
1416
+ if (shouldRemoveNode && !shouldRemoveNode.isContentEditable()) {
1417
+ previousNode = this.getPreviousNode(shouldRemoveNode);
1418
+ shouldRemoveNode.parent.apply(new RemoveChildrenAction(shouldRemoveNode));
1419
+ if (!previousNode) {
1420
+ action.nextNode = startContainerNode;
1421
+ }
1422
+ }
1423
+ }
1424
+ if (previousNode) {
1425
+ action.previousNode = previousNode;
1426
+ }
1427
+ else if (nextNode) {
1428
+ action.nextNode = nextNode;
1429
+ }
1430
+ }
1431
+ }
1432
+
1433
+ /**
1434
+ * Insert new paragraph into current block at special position.
1435
+ */
1436
+ class BlockInsertNewParagraphStrategy extends ActionHandleStrategy {
1437
+ /**
1438
+ * @inheritDoc
1439
+ */
1440
+ handleAction(action, target) {
1441
+ const { startContainerNode } = action;
1442
+ action.newBlock = this.breakSingleBlock(startContainerNode, action.startOffset, target);
1443
+ }
1444
+ /**
1445
+ * breakSingleTextBlock
1446
+ *
1447
+ * @param {RTETextNode} splitNode -
1448
+ * @param {number} startOffsetOfNode -
1449
+ * @param {RTEBlock} target -
1450
+ * @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
1451
+ */
1452
+ breakSingleBlock(splitNode, startOffsetOfNode, target) {
1453
+ const newParagraph = this.getNewParagraph(splitNode);
1454
+ if (newParagraph) {
1455
+ if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
1456
+ target.parent.apply(new InsertChildrenAfterAction(target, newParagraph));
1457
+ }
1458
+ else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
1459
+ target.parent.apply(new InsertChildrenBeforeAction(target, newParagraph));
1460
+ }
1461
+ else {
1462
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1463
+ target.apply(splitBlockAction);
1464
+ return splitBlockAction.newBlock;
1465
+ }
1466
+ return newParagraph;
1467
+ }
1468
+ }
1469
+ /**
1470
+ * Create new Paragraph
1471
+ *
1472
+ * @param {RTENode} splitNode - The split node of the block.
1473
+ * @returns {Nullable<RTETextBlock>} - The new text block.
1474
+ */
1475
+ getNewParagraph(splitNode) {
1476
+ const newParagraph = this.createNewParagraph('');
1477
+ if (newParagraph) {
1478
+ let textNode = newParagraph.children[0];
1479
+ if (splitNode.isTextNode() && splitNode.isContentEditable()) {
1480
+ newParagraph.children = [];
1481
+ textNode = splitNode.cloneWithText('');
1482
+ // The link annotation don't need inherited
1483
+ textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
1484
+ newParagraph.apply(new AppendChildrenAction([textNode]));
1485
+ }
1486
+ return newParagraph;
1487
+ }
1488
+ }
1489
+ }
1490
+
1491
+ /**
1492
+ * Update the cursor position in the editor.
1493
+ *
1494
+ * @example richEditorRef.value.apply(new UpdateCursorPositionAction(nextFocusNode, [offset], [immediatelyRun]))
1495
+ */
1496
+ class UpdateCursorPositionAction extends ModifyContentAction {
1497
+ /**
1498
+ * Set the cursor position at end of the current node.
1499
+ *
1500
+ * @param {RTENode} nextFocusNode - The rich text editor needs focus node.
1501
+ * @param {number} offset - The cursor offset position.
1502
+ * @param {boolean} immediatelyRun - Whether to immediately set the cursor position after applying it. Usually the set action will trigger after the UI renders.
1503
+ */
1504
+ constructor(nextFocusNode, offset, immediatelyRun = false) {
1505
+ super();
1506
+ this.isFlushable = true;
1507
+ this.type = ModifyContentActionType.UPDATE_CURSOR_POSITION;
1508
+ this.immediatelyRun = false;
1509
+ this.nextFocusNode = nextFocusNode;
1510
+ this.offset = offset;
1511
+ this.immediatelyRun = immediatelyRun;
1512
+ // Don't flush changes if we want to immediately run the cursor update. Usually the current value is the latest value.
1513
+ if (this.immediatelyRun) {
1514
+ this.isFlushable = false;
1515
+ }
1516
+ }
1517
+ }
1518
+
1519
+ /**
1520
+ * Insert a new node in nearest position of parent block strategy.
1521
+ */
1522
+ class InsertNodeToNearestRootStrategy extends ActionHandleStrategy {
1523
+ /**
1524
+ * @inheritDoc
1525
+ */
1526
+ handleAction(action, target) {
1527
+ const { rteRange, nodeToBeInserted } = action;
1528
+ const { startNode, startOffset } = rteRange;
1529
+ if (startNode) {
1530
+ const parent = target;
1531
+ if (startNode.isContentEditable() && startNode.isTextNode()) {
1532
+ if (startNode.text === '\n' || !startNode.text || startOffset === 0) {
1533
+ parent.apply(new InsertChildrenBeforeAction(startNode, nodeToBeInserted));
1534
+ }
1535
+ else {
1536
+ const startText = startNode.text.substring(0, startOffset);
1537
+ const endText = startNode.text.substring(startOffset);
1538
+ const startTextNode = startNode.cloneWithText(startText);
1539
+ const endTextNode = startNode.cloneWithText(endText);
1540
+ const insertNodes = [startTextNode, nodeToBeInserted];
1541
+ if (endText) {
1542
+ insertNodes.push(endTextNode);
1543
+ }
1544
+ parent.apply(new InsertChildrenBeforeAction(startNode, ...insertNodes));
1545
+ parent.apply(new RemoveChildrenAction(startNode));
1546
+ }
1547
+ }
1548
+ else {
1549
+ if (startOffset !== 0) {
1550
+ parent.apply(new InsertChildrenAfterAction(startNode, nodeToBeInserted));
1551
+ }
1552
+ else {
1553
+ parent.apply(new InsertChildrenBeforeAction(startNode, nodeToBeInserted));
1554
+ }
1555
+ }
1556
+ this.updateCursorPosition(nodeToBeInserted);
1557
+ }
1558
+ }
1559
+ /**
1560
+ * Update the cursor position to end of the inserted node.
1561
+ *
1562
+ * @param {RTENode} node - node to find root content
1563
+ */
1564
+ updateCursorPosition(node) {
1565
+ const root = this.getRootContent(node.parent);
1566
+ if (root) {
1567
+ root.apply(new UpdateCursorPositionAction(node));
1568
+ }
1569
+ }
1570
+ }
1571
+
1572
+ /**
1573
+ * Strategy for inserting text into a decorator node. The decorator can not edit, so we insert the text as a new child.
1574
+ */
1575
+ class InsertTextToDecoratorNodeStrategy extends ActionHandleStrategy {
1576
+ /**
1577
+ * @inheritDoc
1578
+ */
1579
+ handleAction(action, target) {
1580
+ const { text, offset, decoratorNode } = action;
1581
+ const paragraph = this.createNewParagraph(text);
1582
+ if (paragraph) {
1583
+ const newTextNode = paragraph.children[0];
1584
+ if (offset !== 0) {
1585
+ target.apply(new InsertChildrenAfterAction(decoratorNode, newTextNode));
1586
+ }
1587
+ else {
1588
+ target.apply(new InsertChildrenBeforeAction(decoratorNode, newTextNode));
1589
+ }
1590
+ this.setTheCursorPosition(newTextNode);
1591
+ }
1592
+ }
1593
+ /**
1594
+ * Set the cursor position to the new text node.
1595
+ *
1596
+ * @param {RTENode} focusNode - The new text node to focus on.
1597
+ */
1598
+ setTheCursorPosition(focusNode) {
1599
+ const rootContent = this.getRootContent(focusNode.parent);
1600
+ if (rootContent) {
1601
+ rootContent.apply(new UpdateCursorPositionAction(focusNode));
1602
+ }
1603
+ }
1604
+ }
1605
+
1606
+ /**
1607
+ * Insert new paragraph into current list item block at special position.
1608
+ */
1609
+ class ListItemInsertNewParagraphStrategy extends ActionHandleStrategy {
1610
+ /**
1611
+ * @inheritDoc
1612
+ */
1613
+ handleAction(action, target) {
1614
+ action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset, target);
1615
+ }
1616
+ /**
1617
+ * Breaks a single list item block at a specific position.
1618
+ *
1619
+ * @param {RTETextNode} splitNode - The node that needs to be split within a list item block.
1620
+ * @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
1621
+ * @param {RTEListItemBlock} target - The list item block.
1622
+ * @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
1623
+ * position is at the end of the `splitNode`, or it returns the result of splitting the block at the
1624
+ * caret position if it is neither at the start nor at the end.
1625
+ */
1626
+ breakSingleListItemBlock(splitNode, startOffsetOfNode, target) {
1627
+ const newListItem = target.createNewListItem();
1628
+ const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
1629
+ newListItem.apply(new AppendChildrenAction([newBreakNode]));
1630
+ if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
1631
+ return this.breakListItemAtEnd(newListItem, target);
1632
+ }
1633
+ else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
1634
+ target.parent.apply(new InsertChildrenBeforeAction(target, newListItem));
1635
+ }
1636
+ else {
1637
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1638
+ target.apply(splitBlockAction);
1639
+ return splitBlockAction.newBlock;
1640
+ }
1641
+ return newListItem;
1642
+ }
1643
+ /**
1644
+ * Breaks a list item at the end and handles the insertion of a new list item or paragraph accordingly.
1645
+ *
1646
+ * @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
1647
+ * @param {RTEListItemBlock} target - The list item block.
1648
+ * @returns {RTEBlock} Returns a `RTEBlock`.
1649
+ */
1650
+ breakListItemAtEnd(newListItem, target) {
1651
+ const lastItem = target.parent.children[target.parent.children.length - 1];
1652
+ const currentItemIsEmpty = target.children.length === 1 && target.children[0].isEmpty();
1653
+ if (target === lastItem && currentItemIsEmpty) {
1654
+ const parentParent = target.parent.parent;
1655
+ if (parentParent['type'] !== 'list-item') {
1656
+ const newParagraph = RTETextBlock.from({
1657
+ id: generateUUID(),
1658
+ type: 'paragraph',
1659
+ nodes: [],
1660
+ });
1661
+ newParagraph.apply(new AppendChildrenAction(newListItem.children));
1662
+ parentParent.apply(new InsertChildrenAfterAction(target.parent, newParagraph));
1663
+ target.parent.apply(new RemoveChildrenAction(target));
1664
+ return newParagraph;
1665
+ }
1666
+ else {
1667
+ parentParent.parent.apply(new InsertChildrenAfterAction(parentParent, newListItem));
1668
+ target.parent.apply(new RemoveChildrenAction(target));
1669
+ }
1670
+ }
1671
+ else {
1672
+ target.parent.apply(new InsertChildrenAfterAction(target, newListItem));
1673
+ }
1674
+ return newListItem;
1675
+ }
1676
+ /**
1677
+ * Copy the inline style to new node
1678
+ *
1679
+ * @param {RTETextNode} needCopedNode - The node that needed to be copied to
1680
+ * @returns {RTETextNode} Returns a `RTETextNode`.
1681
+ */
1682
+ copyInlineStyleToNewNode(needCopedNode) {
1683
+ const textNode = needCopedNode.cloneWithText('');
1684
+ // The link annotation doesn't need to inherit
1685
+ textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
1686
+ return textNode;
1687
+ }
1688
+ }
1689
+
1690
+ /**
1691
+ * Delete the nest list block action
1692
+ *
1693
+ * @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
1694
+ */
1695
+ class RemoveNestListAction extends ModifyContentAction {
1696
+ constructor(childList) {
1697
+ super();
1698
+ this.type = ModifyContentActionType.DELETE_NEST_LIST;
1699
+ this.nestListBlockToBeRemoved = childList;
1700
+ }
1701
+ }
1702
+
1703
+ /**
1704
+ * List remove list item strategy.
1705
+ */
1706
+ class ListRemoveListItemStrategy extends RemoveChildrenStrategy {
1707
+ /**
1708
+ * Remove the list item, check the list item and remove self if the list item is empty.
1709
+ *
1710
+ * @param {RemoveChildrenAction} action - The remove action instance.
1711
+ * @param {RTEListBlock} target - The list block.
1712
+ */
1713
+ handleAction(action, target) {
1714
+ super.handleAction(action, target);
1715
+ const parent = target.parent;
1716
+ if (target.children.length === 0 && parent) {
1717
+ // The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
1718
+ if (parent['type'] === 'list-item') {
1719
+ parent.apply(new RemoveNestListAction(target));
1720
+ }
1721
+ else {
1722
+ parent.apply(new RemoveChildrenAction(target));
1723
+ }
1724
+ }
1725
+ }
1726
+ }
1727
+
1728
+ /**
1729
+ * Strategy to handle the paste content into function block.
1730
+ */
1731
+ class PasteContentStrategy extends ActionHandleStrategy {
1732
+ /**
1733
+ * @inheritDoc
1734
+ */
1735
+ handleAction(action, target) {
1736
+ if (target.parent) {
1737
+ const { blocksToBeInserted, startNode, startOffset } = action;
1738
+ let futureFocusBlock = target;
1739
+ if (startNode === target.children[0] && startOffset === 0) {
1740
+ target.parent.apply(new InsertChildrenBeforeAction(target, ...blocksToBeInserted));
1741
+ }
1742
+ else {
1743
+ const breakAction = new SplitBlockWithNodeAction(startNode, startOffset);
1744
+ target.apply(breakAction);
1745
+ target.parent.apply(new InsertChildrenAfterAction(target, ...blocksToBeInserted));
1746
+ futureFocusBlock = breakAction.newBlock;
1747
+ }
1748
+ action.futureFocusBlock = futureFocusBlock;
1749
+ }
1750
+ }
1751
+ }
1752
+
1753
+ /**
1754
+ * Manager class for registering DTO action strategies.
1755
+ */
1756
+ class RTEDTOActionStrategyManager {
1757
+ /**
1758
+ * Registers basic strategies for a given DTO class.
1759
+ *
1760
+ * @param {string} dtoClassName - The name of the RTE block class name.
1761
+ */
1762
+ registerBlockBasicStrategies(dtoClassName) {
1763
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILDREN, dtoClassName, dtoClassName === RTEListBlock.name
1764
+ ? new ListRemoveListItemStrategy()
1765
+ : new RemoveChildrenStrategy());
1766
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILDREN, dtoClassName, new AppendChildrenStrategy());
1767
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_CHILDREN_BEFORE, dtoClassName, new InsertChildrenBeforeStrategy());
1768
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_CHILDREN_AFTER, dtoClassName, new InsertChildrenAfterStrategy());
1769
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, dtoClassName, new BlockDeleteTextOrDecoratorNodeStrategy());
1770
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NEW_PARAGRAPH, dtoClassName, dtoClassName === RTEListItemBlock.name
1771
+ ? new ListItemInsertNewParagraphStrategy()
1772
+ : new BlockInsertNewParagraphStrategy());
1773
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_TEXT_TO_DECORATOR_NODE, dtoClassName, new InsertTextToDecoratorNodeStrategy());
1774
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODE_TO_NEAREST_ROOT, dtoClassName, new InsertNodeToNearestRootStrategy());
1775
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.PASTE_CONTENT, dtoClassName, new PasteContentStrategy());
1776
+ }
1777
+ }
1778
+ const RTEDTOActionStrategyManager$1 = new RTEDTOActionStrategyManager();
1779
+
1780
+ /**
1781
+ * Abstract class to define handler for generate the annotations
1782
+ */
1783
+ class AnnotationGeneratorStrategyAbstract {
1784
+ }
1785
+
1786
+ /** Handle bold annotation */
1787
+ class BoldAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1788
+ /**
1789
+ * @inheritDoc
1790
+ */
1791
+ canHandle(targetDto) {
1792
+ return targetDto.name === 'RTETextNode';
1793
+ }
1794
+ /**
1795
+ * Handle annotation.
1796
+ *
1797
+ * @param {HTMLElement} element - Current elements.
1798
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
1799
+ * @returns {VegaRTETextAnnotations} - Annotation.
1800
+ */
1801
+ handle(element, parentAnnotations = {}) {
1802
+ return this.isBold(element) || parentAnnotations.bold ? { bold: true } : {};
1803
+ }
1804
+ /**
1805
+ * Is bold element.
1806
+ *
1807
+ * @param {HTMLElement} element - current element.
1808
+ * @returns {boolean} - boolean.
1809
+ */
1810
+ isBold(element) {
1811
+ return (element.nodeName === 'STRONG' ||
1812
+ element.nodeName === 'B' ||
1813
+ element.style.fontWeight === BOLD_FONT_WEIGHT_KEYWORD ||
1814
+ element.style.fontWeight === BOLD_FONT_WEIGHT ||
1815
+ element.classList.contains('v-rte--bold'));
1816
+ }
1817
+ }
1818
+
1819
+ /** Handle custom attribute annotation */
1820
+ class CustomAttributeAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1821
+ /**
1822
+ * Can be handle.
1823
+ *
1824
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1825
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options for annotation generator.
1826
+ * @returns {boolean} - .
1827
+ */
1828
+ canHandle(targetDto, options) {
1829
+ return !options.skipCustomAnnotations && !!targetDto;
1830
+ }
1831
+ /**
1832
+ * Handle annotation.
1833
+ *
1834
+ * @param {HTMLElement} element - Current elements.
1835
+ * @returns {VegaRTETextAnnotations} - Annotation.
1836
+ */
1837
+ handle(element) {
1838
+ const attributes = this.getAttributes(element);
1839
+ return Object.keys(attributes).length > 0 ? { customAttribute: attributes } : {};
1840
+ }
1841
+ /**
1842
+ * Obtain the custom attributes of element, excluding 'style' and 'class'.
1843
+ *
1844
+ * @param {HTMLElement} element - current element.
1845
+ * @returns {Record<string, string>} - Record<string, string>.
1846
+ */
1847
+ getAttributes(element) {
1848
+ const attributeNames = element
1849
+ .getAttributeNames()
1850
+ .filter((attr) => attr !== 'style' && attr !== 'class' && this.isValidAttr(attr));
1851
+ return attributeNames.reduce((acc, item) => {
1852
+ acc[item] = element.getAttribute(item);
1853
+ return acc;
1854
+ }, {});
1855
+ }
1856
+ /**
1857
+ * Check if the attribute name is valid.
1858
+ *
1859
+ * @param {string} attr - Attribute name.
1860
+ * @returns {boolean} - True if valid, false otherwise.
1861
+ */
1862
+ isValidAttr(attr) {
1863
+ return /^[a-zA-Z_][\w-]*$/.test(attr);
1864
+ }
1865
+ }
1866
+
1867
+ /** Handle custom class annotation */
1868
+ class CustomClassAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1869
+ /**
1870
+ * Can be handle.
1871
+ *
1872
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1873
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options for annotation generator.
1874
+ * @returns {boolean} - .
1875
+ */
1876
+ canHandle(targetDto, options) {
1877
+ return !options.skipCustomAnnotations && !!targetDto;
1878
+ }
1879
+ /**
1880
+ * Handle annotation.
1881
+ *
1882
+ * @param {HTMLElement} element - Current elements.
1883
+ * @returns {VegaRTETextAnnotations} - Annotation.
1884
+ */
1885
+ handle(element) {
1886
+ const classes = this.getCustomClass(element);
1887
+ return classes.length > 0 ? { customClass: classes } : {};
1888
+ }
1889
+ /**
1890
+ * Get the custom class
1891
+ *
1892
+ * @param {HTMLElement} element - current element.
1893
+ * @returns {string[]} - the class after .
1894
+ */
1895
+ getCustomClass(element) {
1896
+ return element.classList
1897
+ .toString()
1898
+ .split(' ')
1899
+ .filter((item) => !item.includes('v-rte') && item !== '');
1900
+ }
1901
+ }
1902
+
1903
+ /** Handle custom style annotation */
1904
+ class CustomStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1905
+ /**
1906
+ * Can be handle.
1907
+ *
1908
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1909
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options for annotation generator.
1910
+ * @returns {boolean} - .
1911
+ */
1912
+ canHandle(targetDto, options) {
1913
+ return !options.skipCustomAnnotations && !!targetDto;
1914
+ }
1915
+ /**
1916
+ * Handle annotation.
1917
+ *
1918
+ * @param {HTMLElement} element - Current elements.
1919
+ * @returns {VegaRTETextAnnotations} - Annotation.
1920
+ */
1921
+ handle(element) {
1922
+ const styles = createStyleMapFromElement(element);
1923
+ return Object.keys(styles).length > 0 ? { customStyle: styles } : {};
1924
+ }
1925
+ }
1926
+
1927
+ /** Handle indent annotation */
1928
+ class IndentAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1929
+ /**
1930
+ * @inheritDoc
1931
+ */
1932
+ canHandle(targetDto) {
1933
+ return ['RTETextBlock', 'RTEListItemBlock', 'RTEListBlock'].includes(targetDto.name);
1934
+ }
1935
+ /**
1936
+ * Handle annotation.
1937
+ *
1938
+ * @param {HTMLElement} element - Current elements.
1939
+ * @returns {VegaRTEBlockAnnotations} - Annotation.
1940
+ */
1941
+ handle(element) {
1942
+ const indent = this.getIndent(element);
1943
+ return indent ? { indent: indent } : {};
1944
+ }
1945
+ /**
1946
+ * Get indent of current element.
1947
+ *
1948
+ * @param {HTMLElement} element - current element.
1949
+ * @returns {Nullable<number>} - Indent.
1950
+ */
1951
+ getIndent(element) {
1952
+ const style = element.style;
1953
+ let marginLeft;
1954
+ if (style.marginLeft) {
1955
+ marginLeft = style.marginLeft;
1956
+ }
1957
+ else if (style.margin) {
1958
+ const margins = style.margin.split(' ');
1959
+ switch (margins.length) {
1960
+ case 4:
1961
+ marginLeft = margins[3];
1962
+ break;
1963
+ case 2:
1964
+ case 3:
1965
+ marginLeft = margins[1];
1966
+ break;
1967
+ default:
1968
+ marginLeft = margins[0];
1969
+ break;
1970
+ }
1971
+ }
1972
+ else {
1973
+ return null;
1974
+ }
1975
+ const marginLeftNumber = Number(marginLeft.replace('px', ''));
1976
+ return marginLeftNumber && marginLeftNumber >= 0 ? Math.floor(marginLeftNumber / 16) : null;
1977
+ }
1978
+ }
1979
+
1980
+ /** Handle text align annotation */
1981
+ class TextAlignAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1982
+ /**
1983
+ * Can be handle.
1984
+ *
1985
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1986
+ * @returns {boolean} - .
1987
+ */
1988
+ canHandle(targetDto) {
1989
+ return ['RTETextBlock', 'RTEListItemBlock', 'RTEListBlock'].includes(targetDto.name);
1990
+ }
1991
+ /**
1992
+ * Handle annotation.
1993
+ *
1994
+ * @param {HTMLElement} element - Current elements.
1995
+ * @returns {VegaRTEBlockAnnotations} - Annotation.
1996
+ */
1997
+ handle(element) {
1998
+ const textAlign = this.getTextAlign(element);
1999
+ return textAlign ? { textAlign: textAlign } : {};
2000
+ }
2001
+ /**
2002
+ * Get text align of current element.
2003
+ *
2004
+ * @param {HTMLElement} element - current element.
2005
+ * @returns {Nullable<VegaRTEBlockAlignment>} - Text align.
2006
+ */
2007
+ getTextAlign(element) {
2008
+ const classList = element.classList;
2009
+ if (classList.contains(`v-rte--horizontal-alignment-left`)) {
2010
+ return 'left';
2011
+ }
2012
+ else if (classList.contains(`v-rte--horizontal-alignment-center`)) {
2013
+ return 'center';
2014
+ }
2015
+ else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
2016
+ return 'right';
2017
+ }
2018
+ else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
2019
+ return 'justify';
2020
+ }
2021
+ const style = element.style;
2022
+ switch (style.textAlign) {
2023
+ case 'center':
2024
+ return 'center';
2025
+ case 'right':
2026
+ return 'right';
2027
+ case 'justify':
2028
+ return 'justify';
2029
+ case 'left':
2030
+ return 'left';
2031
+ default:
2032
+ return null;
2033
+ }
2034
+ }
2035
+ }
2036
+
2037
+ /** Handle code annotation */
2038
+ class CodeAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2039
+ /**
2040
+ * @inheritDoc
2041
+ */
2042
+ canHandle(targetDto) {
2043
+ return targetDto.name === 'RTETextNode';
2044
+ }
2045
+ /**
2046
+ * Handle annotation.
2047
+ *
2048
+ * @param {HTMLElement} element - Current elements.
2049
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2050
+ * @returns {VegaRTETextAnnotations} - Annotation.
2051
+ */
2052
+ handle(element, parentAnnotations = {}) {
2053
+ return this.isCode(element) || parentAnnotations.code ? { code: true } : {};
2054
+ }
2055
+ /**
2056
+ * Is code element.
2057
+ *
2058
+ * @param {HTMLElement} element - current element.
2059
+ * @returns {boolean} - boolean.
2060
+ */
2061
+ isCode(element) {
2062
+ return (element.classList.contains('v-rte--code') ||
2063
+ element.nodeName === 'CODE' ||
2064
+ element.nodeName === 'PRE' ||
2065
+ element.style.fontFamily === 'monospace' ||
2066
+ element.style.fontFamily.replace(/["']/g, '') === 'Roboto Mono');
2067
+ }
2068
+ }
2069
+
2070
+ /** Handle color annotation */
2071
+ class ColorAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2072
+ /**
2073
+ * @inheritDoc
2074
+ */
2075
+ canHandle(targetDto) {
2076
+ return targetDto.name === 'RTETextNode';
2077
+ }
2078
+ /**
2079
+ * Handle annotation.
2080
+ *
2081
+ * @param {HTMLElement} element - Current elements.
2082
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2083
+ * @returns {VegaRTETextAnnotations} - Annotation.
2084
+ */
2085
+ handle(element, parentAnnotations = {}) {
2086
+ const color = this.getColor(element) || parentAnnotations.textColor;
2087
+ return color ? { textColor: color } : {};
2088
+ }
2089
+ /**
2090
+ * Get current color of element.
2091
+ *
2092
+ * @param {HTMLElement} element - current element.
2093
+ * @returns {Nullable<string>} - color.
2094
+ */
2095
+ getColor(element) {
2096
+ var _a;
2097
+ const color = element.style.color;
2098
+ const hexColor = (_a = rgbToHex(color)) === null || _a === void 0 ? void 0 : _a.toUpperCase();
2099
+ if (hexColor) {
2100
+ // We don't display default text color as inline style, because we defined it in the vega-rich-text-content.scss.
2101
+ const colorSchema = RTE_TEXT_COLORS.filter((item) => item.key !== RTE_DEFAULT_TEXT_COLOR.key).find((schema) => schema.light === hexColor || schema.dark === hexColor);
2102
+ if (colorSchema)
2103
+ return colorSchema.key;
2104
+ return null;
2105
+ }
2106
+ else {
2107
+ for (const color of RTE_TEXT_COLORS) {
2108
+ if (element.style.color.includes(color.key)) {
2109
+ return color.key;
2110
+ }
2111
+ }
2112
+ return null;
2113
+ }
2114
+ }
2115
+ }
2116
+
2117
+ /** Handle italic annotation */
2118
+ class ItalicAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2119
+ /**
2120
+ * @inheritDoc
2121
+ */
2122
+ canHandle(targetDto) {
2123
+ return targetDto.name === 'RTETextNode';
2124
+ }
2125
+ /**
2126
+ * Handle annotation.
2127
+ *
2128
+ * @param {HTMLElement} element - Current elements.
2129
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2130
+ * @returns {VegaRTETextAnnotations} - Annotation.
2131
+ */
2132
+ handle(element, parentAnnotations = {}) {
2133
+ return this.isItalic(element) || parentAnnotations.italic ? { italic: true } : {};
2134
+ }
2135
+ /**
2136
+ * Is italic element.
2137
+ *
2138
+ * @param {HTMLElement} element - current element.
2139
+ * @returns {boolean} - boolean.
2140
+ */
2141
+ isItalic(element) {
2142
+ return (element.nodeName === 'I' ||
2143
+ element.style.fontStyle === ITALIC_FONT_STYLE ||
2144
+ element.nodeName === 'EM' ||
2145
+ element.classList.contains('v-rte--italic'));
2146
+ }
2147
+ }
2148
+
2149
+ /** Handle text style annotation */
2150
+ class TextStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2151
+ /**
2152
+ * Can be handle.
2153
+ *
2154
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
2155
+ * @param {HtmlElementToAnnotationGenerateOptions} options - Options for annotation generator.
2156
+ * @returns {boolean} - .
2157
+ */
2158
+ canHandle(targetDto, options) {
2159
+ return !!options.autoMatchFormat && targetDto.name === 'RTETextBlock';
2160
+ }
2161
+ /**
2162
+ * Handle annotation.
2163
+ *
2164
+ * @param {HTMLElement} element - Current elements.
2165
+ * @returns {VegaRTETextBlockAnnotations} - Annotation.
2166
+ */
2167
+ handle(element) {
2168
+ const textStyle = this.getTextStyle(element);
2169
+ return textStyle ? { textStyle: textStyle } : {};
2170
+ }
2171
+ /**
2172
+ * Get the node type of element. The element type is determined in the following
2173
+ * order: "data-type" attribute, node name, font size and class name.
2174
+ *
2175
+ * @param {HTMLElement} element - element.
2176
+ * @returns {Nullable<VegaRTETextStyleType>} - node type.
2177
+ */
2178
+ getTextStyle(element) {
2179
+ const byDataType = this.getElementTypeByDataType(element);
2180
+ if (byDataType)
2181
+ return byDataType;
2182
+ const byNodeName = this.getElementTypeByNodeName(element);
2183
+ if (byNodeName)
2184
+ return byNodeName;
2185
+ const byFontSize = this.getElementTypeByFontSize(element);
2186
+ if (byFontSize)
2187
+ return byFontSize;
2188
+ const byClassName = this.getElementTypeByClassName(element);
2189
+ if (byClassName)
2190
+ return byClassName;
2191
+ return null;
2192
+ }
2193
+ /**
2194
+ * Get the element type by data-type attribute.
2195
+ *
2196
+ * @param {HTMLElement} element - element.
2197
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2198
+ */
2199
+ getElementTypeByDataType(element) {
2200
+ if (element.nodeType !== Node.TEXT_NODE && element.hasAttribute('data-type')) {
2201
+ return element.getAttribute('data-type');
2202
+ }
2203
+ return null;
2204
+ }
2205
+ /**
2206
+ * Get the element type by font size.
2207
+ *
2208
+ * @param {HTMLElement} element - element.
2209
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2210
+ */
2211
+ getElementTypeByFontSize(element) {
2212
+ var _a;
2213
+ switch ((_a = element.style) === null || _a === void 0 ? void 0 : _a.fontSize) {
2214
+ case '36px':
2215
+ return 'title';
2216
+ case '28px':
2217
+ return 'subtitle';
2218
+ case '22px':
2219
+ return 'heading-1';
2220
+ case '20px':
2221
+ return 'heading-2';
2222
+ case '18px':
2223
+ return 'heading-3';
2224
+ default:
2225
+ return null;
2226
+ }
2227
+ }
2228
+ /**
2229
+ * Get the element type by node name.
2230
+ *
2231
+ * @param {HTMLElement} element - element.
2232
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2233
+ */
2234
+ getElementTypeByNodeName(element) {
2235
+ switch (element.nodeName) {
2236
+ case 'P':
2237
+ return 'paragraph';
2238
+ case 'H1':
2239
+ return 'heading-1';
2240
+ case 'H2':
2241
+ return 'heading-2';
2242
+ case 'H3':
2243
+ return 'heading-3';
2244
+ case 'H4':
2245
+ return 'heading-4';
2246
+ case 'H5':
2247
+ return 'heading-5';
2248
+ case 'H6':
2249
+ return 'heading-6';
2250
+ default:
2251
+ return null;
2252
+ }
2253
+ }
2254
+ /**
2255
+ * Get the element type by class name.
2256
+ *
2257
+ * @param {HTMLElement} element - element.
2258
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2259
+ */
2260
+ getElementTypeByClassName(element) {
2261
+ if (element.className) {
2262
+ // Match class name with pattern "v-rte--text-style-{textStyle}" or "v-rte-{textStyle}".
2263
+ const match = /\bv-rte-(?:-text-style-)?(title|subtitle|heading-1|heading-2|heading-3|heading-4|heading-5|heading-6|paragraph)\b/.exec(element.className);
2264
+ if (match) {
2265
+ return match[1];
2266
+ }
2267
+ }
2268
+ return null;
2269
+ }
2270
+ }
2271
+
2272
+ /**
2273
+ * Predicate class provides static methods to check specific conditions on HTML elements.
2274
+ */
2275
+ class Predicate {
2276
+ /**
2277
+ * Checks if the given element is a title or subtitle.
2278
+ *
2279
+ * @param {HTMLElement} element The element to check.
2280
+ * @returns {boolean} True if the element is a title or subtitle, false otherwise.
2281
+ */
2282
+ static isTitleOrSubtitle(element) {
2283
+ if (element.nodeName === 'DIV') {
2284
+ const textBlockType = Predicate.textStyleHandler['getTextStyle'](element);
2285
+ return textBlockType === 'title' || textBlockType === 'subtitle';
2286
+ }
2287
+ return false;
2288
+ }
2289
+ /**
2290
+ * Check if the given element is a link element (anchor tag).
2291
+ *
2292
+ * @param {HTMLElement} element The element to check.
2293
+ * @returns {boolean} True if the element is a link element, false otherwise.
2294
+ */
2295
+ static isLinkElement(element) {
2296
+ return element.nodeName === 'A';
2297
+ }
2298
+ }
2299
+ Predicate.textStyleHandler = new TextStyleAnnotationHandler();
2300
+
2301
+ /** Handle link annotation */
2302
+ class LinkAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2303
+ constructor() {
2304
+ super(...arguments);
2305
+ this.handlers = [
2306
+ new CustomAttributeAnnotationHandler(),
2307
+ new CustomClassAnnotationHandler(),
2308
+ new CustomStyleAnnotationHandler(),
2309
+ ];
2310
+ }
2311
+ /**
2312
+ * Can be handle.
2313
+ *
2314
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
2315
+ * @returns {boolean} - .
2316
+ */
2317
+ canHandle(targetDto) {
2318
+ return targetDto.name === 'RTETextNode';
2319
+ }
2320
+ /**
2321
+ * Handle annotation.
2322
+ *
2323
+ * @param {HTMLElement} element - Current elements.
2324
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2325
+ * @returns {VegaRTETextAnnotations} - Annotation.
2326
+ */
2327
+ handle(element, parentAnnotations = {}) {
2328
+ if (parentAnnotations.link)
2329
+ return { link: parentAnnotations.link };
2330
+ return Predicate.isLinkElement(element) ? { link: this.generateLinkAnnotations(element) } : {};
2331
+ }
2332
+ /**
2333
+ * Generate link annotations.
2334
+ *
2335
+ * @param {HTMLElement} element - Current elements.
2336
+ * @returns {VegaRTELink} - link annotations.
2337
+ */
2338
+ generateLinkAnnotations(element) {
2339
+ const annotations = {
2340
+ href: element.getAttribute('href') || '',
2341
+ groupKey: generateUUID(),
2342
+ };
2343
+ this.handlers.forEach((handler) => {
2344
+ Object.assign(annotations, handler.handle(element));
2345
+ });
2346
+ return annotations;
2347
+ }
2348
+ }
2349
+
2350
+ /** Handle strike through annotation */
2351
+ class StrikeThroughAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2352
+ /**
2353
+ * @inheritDoc
2354
+ */
2355
+ canHandle(targetDto) {
2356
+ return targetDto.name === 'RTETextNode';
2357
+ }
2358
+ /**
2359
+ * Handle annotation.
2360
+ *
2361
+ * @param {HTMLElement} element - Current elements.
2362
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2363
+ * @returns {VegaRTETextAnnotations} - Annotation.
2364
+ */
2365
+ handle(element, parentAnnotations = {}) {
2366
+ return this.isStrikethrough(element) || parentAnnotations.strikethrough
2367
+ ? { strikethrough: true }
2368
+ : {};
2369
+ }
2370
+ /**
2371
+ * Is strikethrough element.
2372
+ *
2373
+ * @param {HTMLElement} element - current element.
2374
+ * @returns {boolean} - boolean.
2375
+ */
2376
+ isStrikethrough(element) {
2377
+ return (element.style.textDecoration.includes(STRIKETHROUGH_TEXT_DECORATION) ||
2378
+ element.nodeName === 'S' ||
2379
+ element.nodeName === 'DEL' ||
2380
+ element.classList.contains('v-rte--strikethrough'));
2381
+ }
2382
+ }
2383
+
2384
+ /** Handle underline annotation */
2385
+ class UnderlineAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2386
+ /**
2387
+ * @inheritDoc
2388
+ */
2389
+ canHandle(targetDto) {
2390
+ return targetDto.name === 'RTETextNode';
2391
+ }
2392
+ /**
2393
+ * Handle annotation.
2394
+ *
2395
+ * @param {HTMLElement} element - Current elements.
2396
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2397
+ * @returns {VegaRTETextAnnotations} - Annotation.
2398
+ */
2399
+ handle(element, parentAnnotations = {}) {
2400
+ return this.isUnderline(element) || parentAnnotations.underline ? { underline: true } : {};
2401
+ }
2402
+ /**
2403
+ * Is underline element.
2404
+ *
2405
+ * @param {HTMLElement} element - current element.
2406
+ * @returns {boolean} - boolean.
2407
+ */
2408
+ isUnderline(element) {
2409
+ return (element.style.textDecoration.includes(UNDERLINE_TEXT_DECORATION) ||
2410
+ element.nodeName === 'U' ||
2411
+ element.nodeName === 'INS' ||
2412
+ element.classList.contains('v-rte--underline'));
2413
+ }
2414
+ }
2415
+
2416
+ /** Handle image size annotation */
2417
+ class ImageSizeAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2418
+ /**
2419
+ * @inheritDoc
2420
+ */
2421
+ canHandle(targetDto) {
2422
+ return targetDto.name === 'RTEImageNode';
2423
+ }
2424
+ /**
2425
+ * Handle annotation.
2426
+ *
2427
+ * @param {HTMLElement} element - Current elements.
2428
+ * @returns {VegaRTEImageAnnotations} - Annotation.
2429
+ */
2430
+ handle(element) {
2431
+ const size = this.getImageSize(element);
2432
+ return size ? { size: size } : {};
2433
+ }
2434
+ /**
2435
+ * Determine the image display size based on the width of the current element.
2436
+ *
2437
+ * @param {HTMLElement} element - current element.
2438
+ * @returns {Nullable<VegaRichTextImageEditorSizeType>} -Image size, default 'md'.
2439
+ */
2440
+ getImageSize(element) {
2441
+ if (element.getAttribute('data-size')) {
2442
+ return element.getAttribute('data-size');
2443
+ }
2444
+ return null;
2445
+ }
2446
+ }
2447
+
2448
+ /** Handle image alt annotation */
2449
+ class ImageAltAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2450
+ /**
2451
+ * @inheritDoc
2452
+ */
2453
+ canHandle(targetDto) {
2454
+ return targetDto.name === 'RTEImageNode';
2455
+ }
2456
+ /**
2457
+ * Handle annotation.
2458
+ *
2459
+ * @param {HTMLElement} element - Current elements.
2460
+ * @returns {VegaRTEImageAnnotations} - Annotation.
2461
+ */
2462
+ handle(element) {
2463
+ return element.hasAttribute('alt') ? { alt: element.getAttribute('alt') } : {};
2464
+ }
2465
+ }
2466
+
2467
+ /**
2468
+ * Tags whose direct children are always phrasing (inline) content (P, H1-H6, LI).
2469
+ *
2470
+ * This is spec knowledge from the HTML Living Standard — these grouping-content
2471
+ * elements have a phrasing-content content model and cannot contain block-level
2472
+ * descendants. It cannot be derived from the strategy registry and must be
2473
+ * maintained alongside the HTML spec.
2474
+ *
2475
+ * @see https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
2476
+ */
2477
+ const BLOCK_TEXT_CONTAINER_TAGS = new Set([
2478
+ 'P',
2479
+ 'H1',
2480
+ 'H2',
2481
+ 'H3',
2482
+ 'H4',
2483
+ 'H5',
2484
+ 'H6',
2485
+ 'LI',
2486
+ ]);
2487
+ /**
2488
+ * Tags with dedicated element-to-DTO block strategies
2489
+ * (P, H1-H6, LI, UL, OL, IMG, CODE).
2490
+ *
2491
+ * HtmlBlockStrategy skips these to avoid double-processing or overriding their
2492
+ * specialized block semantics.
2493
+ *
2494
+ * Why hard-coded: strategies use heterogeneous matching (`tagName ===`,
2495
+ * `matchTextBlockType` via font-size/class, etc.) so there is no single
2496
+ * declarative contract to derive this set from. It must be kept in sync with
2497
+ * the strategies registered in `dto/setup.ts`.
2498
+ *
2499
+ * Intentionally independent of {@link BLOCK_TEXT_CONTAINER_TAGS} — the two
2500
+ * sets encode different concepts (app architecture vs. HTML spec) and must
2501
+ * be maintained separately.
2502
+ */
2503
+ const DEDICATED_STRATEGY_TAGS = new Set([
2504
+ 'P',
2505
+ 'H1',
2506
+ 'H2',
2507
+ 'H3',
2508
+ 'H4',
2509
+ 'H5',
2510
+ 'H6',
2511
+ 'LI',
2512
+ 'UL',
2513
+ 'OL',
2514
+ 'IMG',
2515
+ 'CODE',
2516
+ ]);
2517
+ /**
2518
+ * Tags that are always treated as phrasing (inline) content, even when they
2519
+ * also appear in {@link DEDICATED_STRATEGY_TAGS} (CODE).
2520
+ * A tag in this set overrides the dedicated-strategy skip in HtmlBlockStrategy.
2521
+ *
2522
+ * Mix of HTML5 spec phrasing-content elements (BR, CODE, A) and
2523
+ * RTE-internal custom elements (VEGA-RICH-TEXT-LINK-EDITOR).
2524
+ */
2525
+ const ALWAYS_INLINE_TAGS = new Set(['BR', 'VEGA-RICH-TEXT-LINK-EDITOR', 'CODE', 'A']);
2526
+ /**
2527
+ * Tags whose content model requires each child to be a distinct block-level
2528
+ * element (table model and definition list).
2529
+ *
2530
+ * TABLE expects CAPTION/THEAD/TBODY/TFOOT/TR; TR expects TH/TD;
2531
+ * THEAD/TBODY/TFOOT expect TR; DL expects DT/DD.
2532
+ *
2533
+ * Used by HtmlBlockStrategy to prevent text-only children (e.g. CAPTION,
2534
+ * TH, TD) from being treated as inline — they must become html-blocks so
2535
+ * the table structure round-trips correctly.
2536
+ *
2537
+ * Note: COLGROUP is intentionally excluded. Its only permitted child is the
2538
+ * void element COL, which can never produce text-node children, so the
2539
+ * text-only heuristic in HtmlBlockStrategy can never fire for a COLGROUP
2540
+ * parent.
2541
+ *
2542
+ * @see https://html.spec.whatwg.org/multipage/tables.html#the-table-element
2543
+ * @see https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element
2544
+ */
2545
+ const STRUCTURED_CONTAINER_TAGS = new Set([
2546
+ 'TABLE',
2547
+ 'THEAD',
2548
+ 'TBODY',
2549
+ 'TFOOT',
2550
+ 'TR',
2551
+ 'DL',
2552
+ ]);
2553
+ /**
2554
+ * Formatting phrasing-content elements that CAN remain inline even when empty.
2555
+ *
2556
+ * Any element NOT in this set (DIV, SECTION, ARTICLE, custom elements, etc.)
2557
+ * is treated as a block separator. Phrasing content is a closed, finite set
2558
+ * per the HTML Living Standard, making an allowlist safer than blocklisting
2559
+ * block containers (which is open-ended — custom elements default to block).
2560
+ *
2561
+ * Intentionally excludes:
2562
+ * - BR, CODE, A, VEGA-RICH-TEXT-LINK-EDITOR → handled by {@link ALWAYS_INLINE_TAGS}
2563
+ * - P, H1-H6, LI, UL, OL, IMG → handled by {@link DEDICATED_STRATEGY_TAGS}
2564
+ * - VIDEO, AUDIO, EMBED → embedded content that carries media even when empty;
2565
+ * must be treated as block-level, not as inline formatting artifacts
2566
+ *
2567
+ * @see https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
2568
+ */
2569
+ const PHRASING_CONTENT_TAGS = new Set([
2570
+ 'ABBR',
2571
+ 'B',
2572
+ 'BDI',
2573
+ 'BDO',
2574
+ 'CITE',
2575
+ 'DEL',
2576
+ 'DFN',
2577
+ 'EM',
2578
+ 'I',
2579
+ 'INS',
2580
+ 'KBD',
2581
+ 'MARK',
2582
+ 'METER',
2583
+ 'OUTPUT',
2584
+ 'PROGRESS',
2585
+ 'Q',
2586
+ 'S',
2587
+ 'SAMP',
2588
+ 'SMALL',
2589
+ 'SPAN',
2590
+ 'STRONG',
2591
+ 'SUB',
2592
+ 'SUP',
2593
+ 'TIME',
2594
+ 'U',
2595
+ 'VAR',
2596
+ ]);
2597
+ /**
2598
+ * Returns true when the element is a direct child of a block text container
2599
+ * (P, H1-H6, LI), meaning it must be treated as phrasing content regardless
2600
+ * of its own DOM structure.
2601
+ *
2602
+ * @param {HTMLElement} element - Element to test.
2603
+ * @returns {boolean} True if the element is inside a block text container.
2604
+ */
2605
+ function isInBlockTextContext(element) {
2606
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2607
+ return BLOCK_TEXT_CONTAINER_TAGS.has(element.parentElement.nodeName);
2608
+ }
2609
+
2610
+ /**
2611
+ * Handle inline html annotation
2612
+ */
2613
+ class InlineHtmlAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2614
+ constructor() {
2615
+ super(...arguments);
2616
+ this.customAttributeHandler = new CustomAttributeAnnotationHandler();
2617
+ this.customStyleAnnotationHandler = new CustomStyleAnnotationHandler();
2618
+ this.customClassAnnotationHandler = new CustomClassAnnotationHandler();
2619
+ }
2620
+ /**
2621
+ * @inheritDoc
2622
+ */
2623
+ canHandle(targetDto, options) {
2624
+ return targetDto.name === 'RTETextNode' && options.autoMatchFormat === false;
2625
+ }
2626
+ /**
2627
+ * @inheritDoc
2628
+ */
2629
+ handle(element, parentAnnotations) {
2630
+ // Skip block-level dedicated tags (P, H1-H6, LI, UL, OL, IMG).
2631
+ // Tags in ALWAYS_INLINE_TAGS (CODE, A) are exempt and still produce inlineHtml annotations.
2632
+ if (DEDICATED_STRATEGY_TAGS.has(element.nodeName) && !ALWAYS_INLINE_TAGS.has(element.nodeName)) {
2633
+ return {};
2634
+ }
2635
+ const inlineHtml = this.generateInlineHtmlAnnotation(element, Object.assign({}, parentAnnotations));
2636
+ if (inlineHtml) {
2637
+ return { inlineHtml: inlineHtml };
2638
+ }
2639
+ return {};
2640
+ }
2641
+ /**
2642
+ * Generate inline html annotation.
2643
+ *
2644
+ * @param {HTMLElement} child - Current element.
2645
+ * @param {VegaRTETextAnnotations} annotations - Current annotations.
2646
+ * @returns {Nullable<VegaInlineHtmlSchema>} - Inline html annotation.
2647
+ */
2648
+ generateInlineHtmlAnnotation(child, annotations) {
2649
+ let { inlineHtml } = annotations;
2650
+ const hasElementChildren = Array.from(child.childNodes).some((c) => c.nodeType === Node.ELEMENT_NODE);
2651
+ if (!RTETextNode.supportsHtmlTag(child.nodeName.toLowerCase()) || hasElementChildren) {
2652
+ const childInlineHtmlNode = Object.assign(Object.assign({ htmlTag: child.nodeName.toLowerCase() }, (hasElementChildren ? { groupId: generateUUID() } : {})), { customAttribute: this.customAttributeHandler.handle(child).customAttribute, customStyle: this.customStyleAnnotationHandler.handle(child).customStyle, customClass: this.customClassAnnotationHandler.handle(child).customClass });
2653
+ if (!inlineHtml) {
2654
+ inlineHtml = childInlineHtmlNode;
2655
+ }
2656
+ else {
2657
+ inlineHtml = this.appendToInlineHtmlChain(inlineHtml, childInlineHtmlNode, child.parentNode);
2658
+ }
2659
+ }
2660
+ return inlineHtml ? Object.assign({}, inlineHtml) : null;
2661
+ }
2662
+ /**
2663
+ * Immutably appends `toAppend` at the correct position in the chain — the
2664
+ * deepest node whose `child.htmlTag` still matches `parentNode.nodeName`.
2665
+ * Each level is reconstructed via spread so the original chain is never mutated.
2666
+ *
2667
+ * @param {VegaInlineHtmlSchema} node - Current chain node.
2668
+ * @param {VegaInlineHtmlSchema} toAppend - Node to append at the tail.
2669
+ * @param {ParentNode | null} parentNode - DOM parent of the element being processed.
2670
+ * @returns {VegaInlineHtmlSchema} A new chain with `toAppend` inserted.
2671
+ */
2672
+ appendToInlineHtmlChain(node, toAppend, parentNode) {
2673
+ if (node.child && parentNode && node.child.htmlTag === parentNode.nodeName.toLowerCase()) {
2674
+ return Object.assign(Object.assign({}, node), { child: this.appendToInlineHtmlChain(node.child, toAppend, parentNode) });
2675
+ }
2676
+ return Object.assign(Object.assign({}, node), { child: toAppend });
2677
+ }
2678
+ }
2679
+
2680
+ /** Html element to annotations generator */
2681
+ class HtmlElementToAnnotationGenerator {
2682
+ constructor() {
2683
+ this.handlers = [
2684
+ new TextAlignAnnotationHandler(),
2685
+ new IndentAnnotationHandler(),
2686
+ new BoldAnnotationHandler(),
2687
+ new ItalicAnnotationHandler(),
2688
+ new UnderlineAnnotationHandler(),
2689
+ new StrikeThroughAnnotationHandler(),
2690
+ new ColorAnnotationHandler(),
2691
+ new LinkAnnotationHandler(),
2692
+ new CodeAnnotationHandler(),
2693
+ new ImageSizeAnnotationHandler(),
2694
+ new ImageAltAnnotationHandler(),
2695
+ new CustomAttributeAnnotationHandler(),
2696
+ new CustomClassAnnotationHandler(),
2697
+ new CustomStyleAnnotationHandler(),
2698
+ new TextStyleAnnotationHandler(),
2699
+ new InlineHtmlAnnotationHandler(),
2700
+ ];
2701
+ }
2702
+ /**
2703
+ * Register a custom annotation handler.
2704
+ * Custom handlers are added to the beginning of the handlers array,
2705
+ * giving them higher priority than default handlers.
2706
+ *
2707
+ * @param {AnnotationGeneratorStrategyAbstract} handler - The annotation handler to register.
2708
+ */
2709
+ registerHandler(handler) {
2710
+ this.handlers.unshift(handler);
2711
+ }
2712
+ /**
2713
+ * The function generates annotations for a given target DTO and HTML element based on a set of
2714
+ * strategies.
2715
+ *
2716
+ * @typedef T class name of target DTO
2717
+ * @typedef V generated annotations type
2718
+ * @param {T} targetDto - Which DTO is the generated annotations to set.
2719
+ * @param {HTMLElement} element - Current html element.
2720
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options
2721
+ * @returns {V} Generated annotations.
2722
+ */
2723
+ generate(targetDto, element, options = { autoMatchFormat: true }) {
2724
+ if (options && options.filterInlineStyles) {
2725
+ RTEFilterStylesStrategyRegistry.executeTheStrategyRefillAction(targetDto.name, element);
2726
+ }
2727
+ // Guard against <a> wrapping block content (e.g. <a><video></a>), which is processed as an
2728
+ // html-block (targetDto !== RTETextNode) — link-only mode should not apply in that case.
2729
+ const isLinkElement = Predicate.isLinkElement(element) && targetDto.name === 'RTETextNode';
2730
+ const annotations = this.handlers
2731
+ .filter((handler) => !options.autoMatchFormat && isLinkElement ? handler instanceof LinkAnnotationHandler : true)
2732
+ .filter((handler) => element.nodeType !== Node.TEXT_NODE &&
2733
+ handler.canHandle(targetDto, {
2734
+ skipCustomAnnotations: options.skipCustomAnnotations || isLinkElement,
2735
+ autoMatchFormat: options.autoMatchFormat,
2736
+ }))
2737
+ .reduce((annotations, handler) => {
2738
+ const result = handler.handle(element, options.parentAnnotations);
2739
+ return Object.assign(Object.assign({}, annotations), result);
2740
+ }, {});
2741
+ this.removeTextStyleDefaultsFromCustomStyle(annotations);
2742
+ const strategies = RTEFilterStylesStrategyRegistry.getStrategies(targetDto.name);
2743
+ for (const strategy of strategies) {
2744
+ if (options.autoMatchFormat || strategy.alwaysFilter) {
2745
+ strategy.filterAnnotations(annotations);
2746
+ }
2747
+ }
2748
+ return annotations;
2749
+ }
2750
+ /**
2751
+ * Remove default text-style properties from customStyle.
2752
+ * This prevents repeated styling when switching between source edit and normal mode.
2753
+ *
2754
+ * Note: This method mutates the customStyle object inside `annotations` in place and returns the same reference.
2755
+ *
2756
+ * @param {V} annotations - The generated annotations.
2757
+ * @returns {V} The same annotations reference with customStyle cleaned up.
2758
+ */
2759
+ removeTextStyleDefaultsFromCustomStyle(annotations) {
2760
+ const textStyle = 'textStyle' in annotations ? annotations.textStyle : undefined;
2761
+ const customStyle = annotations.customStyle;
2762
+ if (!textStyle || !customStyle) {
2763
+ return annotations;
2764
+ }
2765
+ const defaultStyles = TextStyleAnnotation.getDefaultStyles(textStyle);
2766
+ if (!defaultStyles) {
2767
+ return annotations;
2768
+ }
2769
+ for (const key of Object.keys(defaultStyles)) {
2770
+ if (customStyle[key] === defaultStyles[key]) {
2771
+ delete customStyle[key];
2772
+ }
2773
+ }
2774
+ if (Object.keys(customStyle).length === 0) {
2775
+ delete annotations.customStyle;
2776
+ }
2777
+ return annotations;
2778
+ }
2779
+ }
2780
+ const htmlElementToAnnotationGenerator = new HtmlElementToAnnotationGenerator();
2781
+
2782
+ /** Abstract class for block html element to RTE block dto */
2783
+ class BlockToRTEBlockStrategyAbstract extends ElementToDTOStrategy {
2784
+ constructor() {
2785
+ super(...arguments);
2786
+ this.annotationHandler = new TextStyleAnnotationHandler();
2787
+ }
2788
+ /**
2789
+ * Generate child nodes of block element, this will inherit all annotations from parent to text node and
2790
+ * flat the child nodes.
2791
+ *
2792
+ * Example:
2793
+ * <li>
2794
+ * <u><i>text1</i></u>
2795
+ * <span></span>
2796
+ * <span style='font-weight: bold;'><span>text2</span></span>
2797
+ * text3
2798
+ * </li>
2799
+ * will tranform to:
2800
+ * <li>
2801
+ * <span>text1</span> // with underline and italic annotations
2802
+ * <span></span> // empty span
2803
+ * <span>text2</span> // with bold annotations
2804
+ * <span>text3</span> // no annotations
2805
+ * </li>
2806
+ *
2807
+ * @param {HTMLElement[]} elements - Child elements.
2808
+ * @param {VegaRTETextAnnotations} annotations - Parent annotations.
2809
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
2810
+ * @returns {VegaRTETextNode[]} - Text node DTO.
2811
+ */
2812
+ generateChildNodes(elements, annotations, options) {
2813
+ const childNodes = [];
2814
+ const disableAutoMatchFormat = !!(options && options.autoMatchFormat === false);
2815
+ const parentAnnotations = Object.assign({}, annotations);
2816
+ elements.forEach((child) => {
2817
+ const strategy = ElementToDTOClassStrategyManager.getElementToNodeStrategies().find((item) => item.canHandle([child], 0, options) > 0);
2818
+ let textNodeJson = null;
2819
+ if (strategy) {
2820
+ textNodeJson = strategy.handle([child], options, parentAnnotations);
2821
+ }
2822
+ if (textNodeJson) {
2823
+ childNodes.push(textNodeJson);
2824
+ }
2825
+ else if (isHTMLElement(child) && child.childNodes.length > 0) {
2826
+ const curAnnotations = htmlElementToAnnotationGenerator.generate(RTETextNode, child, Object.assign({ parentAnnotations: disableAutoMatchFormat
2827
+ ? {
2828
+ inlineHtml: parentAnnotations.inlineHtml,
2829
+ link: parentAnnotations.link,
2830
+ code: parentAnnotations.code,
2831
+ }
2832
+ : annotations }, options));
2833
+ childNodes.push(...this.generateChildNodes(Array.from(child.childNodes), curAnnotations, options));
2834
+ }
2835
+ });
2836
+ return childNodes;
2837
+ }
2838
+ /**
2839
+ * Get the node type of element. The element type is determined in the following
2840
+ * order: "data-type" attribute, node name, font size and class name.
2841
+ *
2842
+ * @param {HTMLElement} element - element.
2843
+ * @returns {VegaRTETextBlockType} - Block type.
2844
+ */
2845
+ matchTextBlockType(element) {
2846
+ var _a;
2847
+ return (_a = this.annotationHandler.handle(element).textStyle) !== null && _a !== void 0 ? _a : 'paragraph';
2848
+ }
2849
+ }
2850
+
2851
+ /**
2852
+ * Converting HTML block elements into RTE blocks.
2853
+ */
2854
+ class HtmlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2855
+ /**
2856
+ * @inheritDoc
2857
+ */
2858
+ canHandle(elementsArray, currentIndex, options) {
2859
+ const element = elementsArray[currentIndex];
2860
+ if (element.nodeType === Node.TEXT_NODE || this.isInlineTagWithoutBlockChildren(element, options)) {
2861
+ return 0;
2862
+ }
2863
+ // Skip dedicated-strategy tags unless all children are block-level embedded
2864
+ // elements (e.g. <p><video></p>), in which case fall back to html-block.
2865
+ if (DEDICATED_STRATEGY_TAGS.has(element.nodeName) && !this.shouldFallBackToHtmlBlock(element)) {
2866
+ return 0;
2867
+ }
2868
+ return !options.autoMatchFormat &&
2869
+ this.isCustomHtmlContainer(element) &&
2870
+ !Predicate.isTitleOrSubtitle(element)
2871
+ ? 1
2872
+ : 0;
2873
+ }
2874
+ /**
2875
+ * @inheritDoc
2876
+ */
2877
+ handle(elementsArray, options) {
2878
+ const element = elementsArray[0];
2879
+ return RTEHtmlBlock.from(this.generateHtmlBlock(element, options), options);
2880
+ }
2881
+ /**
2882
+ * @inheritDoc
2883
+ */
2884
+ appendChildBlocks(currentBlock, childBlocks) {
2885
+ currentBlock.children = childBlocks.map((block) => {
2886
+ block.parent = currentBlock;
2887
+ return block;
2888
+ });
2889
+ }
2890
+ /**
2891
+ * @inheritDoc
2892
+ */
2893
+ shouldProceedToElementChildren() {
2894
+ return true;
2895
+ }
2896
+ /**
2897
+ * Returns true for elements that should be treated as inline content even if they have no element children (e.g. <span>text</span>).
2898
+ * This includes any element in a block text context (P, H1-H6, LI) and any element with text-node children but no element-node children.
2899
+ *
2900
+ * In raw-HTML mode (autoMatchFormat: false), the text-only heuristic only
2901
+ * applies to elements whose parent is itself a text-only wrapper (e.g.
2902
+ * {@code <div><span>Title</span></div>}). Structural children of non-text
2903
+ * containers (TABLE → CAPTION, TR → TH/TD, etc.) skip this heuristic so
2904
+ * they reach {@link isCustomHtmlContainer} and become html-blocks.
2905
+ *
2906
+ * @param {HTMLElement} element - Element to check.
2907
+ * @param {VegaRTETransformOptions} options - Transform options.
2908
+ * @returns {boolean} True if the element should be treated as inline content.
2909
+ */
2910
+ isInlineTagWithoutBlockChildren(element, options) {
2911
+ if (isInBlockTextContext(element)) {
2912
+ // Empty elements that are not recognized inline elements should not
2913
+ // be forced inline — they may represent block-level embedded content
2914
+ // (e.g. <video src="...">, <audio>, <iframe src="...">).
2915
+ if (element.childNodes.length === 0 &&
2916
+ element.textContent === '' &&
2917
+ !ALWAYS_INLINE_TAGS.has(element.nodeName) &&
2918
+ !PHRASING_CONTENT_TAGS.has(element.nodeName)) {
2919
+ return false;
2920
+ }
2921
+ return true;
2922
+ }
2923
+ const childNodes = Array.from(element.childNodes);
2924
+ const isTextOnly = !childNodes.some((child) => child.nodeType === Node.ELEMENT_NODE) &&
2925
+ childNodes.some((child) => child.nodeType === Node.TEXT_NODE);
2926
+ if (!isTextOnly) {
2927
+ return false;
2928
+ }
2929
+ // In raw-HTML mode, a text-only element is inline only if:
2930
+ // 1. Its parent is not a structured container (TABLE, TR, …)
2931
+ // 2. The element itself is phrasing content (SPAN, EM, …)
2932
+ // Non-phrasing text-only elements (SUMMARY, FIGCAPTION, OPTION, SVG TEXT,
2933
+ // etc.) must fall through to become html-blocks.
2934
+ if (options.autoMatchFormat === false) {
2935
+ if (STRUCTURED_CONTAINER_TAGS.has(element.parentElement.nodeName))
2936
+ return false; // eslint-disable-line @typescript-eslint/no-non-null-assertion
2937
+ return PHRASING_CONTENT_TAGS.has(element.nodeName) || ALWAYS_INLINE_TAGS.has(element.nodeName);
2938
+ }
2939
+ return true;
2940
+ }
2941
+ /**
2942
+ * Returns true when a dedicated-strategy element should fall back to html-block
2943
+ * because all its children are non-text, non-inline, non-dedicated elements
2944
+ * — indicating purely block-level embedded content that the dedicated text-block
2945
+ * strategy cannot represent.
2946
+ *
2947
+ * @param {HTMLElement} element - The dedicated-strategy element to check.
2948
+ * @returns {boolean} True when the element should be treated as html-block.
2949
+ */
2950
+ shouldFallBackToHtmlBlock(element) {
2951
+ const childNodes = Array.from(element.childNodes);
2952
+ if (childNodes.length === 0)
2953
+ return false;
2954
+ // List items are structural children whose dedicated strategies manage
2955
+ // both block and inline children independently — never override them.
2956
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2957
+ const parentTag = element.parentElement.nodeName;
2958
+ if (parentTag === 'UL' || parentTag === 'OL')
2959
+ return false;
2960
+ return childNodes.every((child) => child.nodeType === Node.ELEMENT_NODE &&
2961
+ child.textContent === '' &&
2962
+ !ALWAYS_INLINE_TAGS.has(child.nodeName) &&
2963
+ !PHRASING_CONTENT_TAGS.has(child.nodeName));
2964
+ }
2965
+ /**
2966
+ * Returns true for elements that should be treated as html containers.
2967
+ * A DIV is only a valid container when its first child is not an IMG
2968
+ * (IMG children are handled by the image strategy instead).
2969
+ *
2970
+ * @param {HTMLElement} element - Element to check.
2971
+ * @returns {boolean} True if the element qualifies as a html container.
2972
+ */
2973
+ isCustomHtmlContainer(element) {
2974
+ if (element.nodeName !== 'DIV') {
2975
+ return true;
2976
+ }
2977
+ return element.childNodes.length > 0 && element.childNodes[0].nodeName !== 'IMG';
2978
+ }
2979
+ /**
2980
+ * Generate HTML block DTO from an HTML element.
2981
+ *
2982
+ * @param {HTMLElement} element - HTML element to convert.
2983
+ * @param {VegaRTETransformOptions} options - Options for transformation.
2984
+ * @returns {VegaRTEHtmlBlock} - HTML block DTO.
2985
+ */
2986
+ generateHtmlBlock(element, options) {
2987
+ return {
2988
+ id: generateUUID(),
2989
+ type: 'html-block',
2990
+ htmlTag: element.nodeName.toLowerCase(),
2991
+ annotations: htmlElementToAnnotationGenerator.generate(RTEHtmlBlock, element, options),
2992
+ children: [],
2993
+ };
2994
+ }
2995
+ }
2996
+
2997
+ /** Transform ul element to list block DTO */
2998
+ class UlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2999
+ /**
3000
+ * Can be handle.
3001
+ *
3002
+ * @param {HTMLElement[]} elementsArray - Current elements.
3003
+ * @param {number} currentIndex - Current element index.
3004
+ * @returns {number} - can be handled element count.
3005
+ */
3006
+ canHandle(elementsArray, currentIndex) {
3007
+ return elementsArray[currentIndex].tagName === 'UL' ? 1 : 0;
3008
+ }
3009
+ /**
3010
+ * Parse to a block.
3011
+ *
3012
+ * @param {HTMLElement[]} elementsArray - Current elements.
3013
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3014
+ * @returns {Nullable<RTEContentBlock>} - Bullet list block.
3015
+ */
3016
+ handle(elementsArray, options) {
3017
+ if (elementsArray[0].childNodes.length === 0)
3018
+ return null;
3019
+ return RTEListBlock.from({
3020
+ id: generateUUID(),
3021
+ type: 'bullet-list',
3022
+ blocks: [],
3023
+ annotations: htmlElementToAnnotationGenerator.generate(RTEListBlock, elementsArray[0], options),
3024
+ }, options);
3025
+ }
3026
+ /**
3027
+ * Append child list item blocks to current list block.
3028
+ *
3029
+ * @param {RTEListBlock} currentBlock - Current list block.
3030
+ * @param {RTEContentBlock[]} childBlocks - Current list item blocks.
3031
+ */
3032
+ appendChildBlocks(currentBlock, childBlocks) {
3033
+ currentBlock.children = childBlocks.filter((block) => block instanceof RTEListItemBlock);
3034
+ childBlocks.forEach((block) => (block.parent = currentBlock));
3035
+ }
3036
+ /**
3037
+ * Should continue process to child elements.
3038
+ *
3039
+ * @returns {boolean} - boolean.
3040
+ */
3041
+ shouldProceedToElementChildren() {
3042
+ return true;
3043
+ }
3044
+ }
3045
+
3046
+ /** Transform ol element to list block DTO */
3047
+ class OlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3048
+ /**
3049
+ * Can be handle.
3050
+ *
3051
+ * @param {HTMLElement[]} elementsArray - Current elements.
3052
+ * @param {number} currentIndex - Current element index.
3053
+ * @returns {number} - can be handled element count.
3054
+ */
3055
+ canHandle(elementsArray, currentIndex) {
3056
+ return elementsArray[currentIndex].tagName === 'OL' ? 1 : 0;
3057
+ }
3058
+ /**
3059
+ * Parse to a number list block.
3060
+ *
3061
+ * @param {HTMLElement[]} elementsArray - Current elements.
3062
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3063
+ * @returns {Nullable<RTEContentBlock>} - Number list block.
3064
+ */
3065
+ handle(elementsArray, options) {
3066
+ if (elementsArray[0].childNodes.length === 0)
3067
+ return null;
3068
+ return RTEListBlock.from({
3069
+ id: generateUUID(),
3070
+ type: 'number-list',
3071
+ blocks: [],
3072
+ annotations: htmlElementToAnnotationGenerator.generate(RTEListBlock, elementsArray[0], options),
3073
+ }, options);
3074
+ }
3075
+ /**
3076
+ * Append child list item blocks to current list block.
3077
+ *
3078
+ * @param {RTEListBlock} currentBlock - Current list block.
3079
+ * @param {RTEContentBlock[]} childBlocks - Current list item blocks.
3080
+ */
3081
+ appendChildBlocks(currentBlock, childBlocks) {
3082
+ currentBlock.children = childBlocks.filter((block) => block instanceof RTEListItemBlock);
3083
+ childBlocks.forEach((block) => (block.parent = currentBlock));
3084
+ }
3085
+ /**
3086
+ * Should continue process to child elements.
3087
+ *
3088
+ * @returns {boolean} - boolean.
3089
+ */
3090
+ shouldProceedToElementChildren() {
3091
+ return true;
3092
+ }
3093
+ }
3094
+
3095
+ /** Transform child element of UL element which are not LI element to list item block DTO */
3096
+ class ULNotLiChildToRTEListItemBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3097
+ /**
3098
+ * Can be handle.
3099
+ *
3100
+ * @param {HTMLElement[]} elementsArray - Current elements.
3101
+ * @param {number} currentIndex - Current element index.
3102
+ * @returns {number} - can be handled element count.
3103
+ */
3104
+ canHandle(elementsArray, currentIndex) {
3105
+ const element = elementsArray[currentIndex];
3106
+ const parent = element.parentElement;
3107
+ const isLiNode = element.nodeName !== 'LI';
3108
+ // while child is empty text node like newline or empty string, we should not covert it.
3109
+ const isEmptyNode = element.nodeType === Node.TEXT_NODE && element.textContent.trim() === '';
3110
+ // The node must be in list item.
3111
+ const isInList = isNonNullable(parent) && ['UL', 'OL'].includes(parent.nodeName);
3112
+ return isLiNode && !isEmptyNode && isInList ? 1 : 0;
3113
+ }
3114
+ /**
3115
+ * Parse to a list item block.
3116
+ *
3117
+ * @param {HTMLElement[]} elementsArray - Current elements.
3118
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3119
+ * @returns {Nullable<RTEContentBlock>} - List item block.
3120
+ */
3121
+ handle(elementsArray, options) {
3122
+ const nodes = this.generateChildNodes(elementsArray, {}, options);
3123
+ return RTEListItemBlock.from({
3124
+ id: generateUUID(),
3125
+ type: 'list-item',
3126
+ nodes: nodes,
3127
+ annotations: {},
3128
+ }, options);
3129
+ }
3130
+ /* istanbul ignore next */
3131
+ /**
3132
+ * Append child blocks.
3133
+ */
3134
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3135
+ appendChildBlocks() { }
3136
+ /**
3137
+ * Should continue process to child elements.
3138
+ *
3139
+ * @returns {boolean} - boolean.
3140
+ */
3141
+ shouldProceedToElementChildren() {
3142
+ return false;
3143
+ }
3144
+ }
3145
+
3146
+ /** Transform li element to list item block DTO */
3147
+ class LiToRTEListItemBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3148
+ /**
3149
+ * Can be handled.
3150
+ *
3151
+ * @param {HTMLElement[]} elementsArray - Current elements.
3152
+ * @param {number} currentIndex - Current element index.
3153
+ * @returns {number} - can be handled element count.
3154
+ */
3155
+ canHandle(elementsArray, currentIndex) {
3156
+ const parent = elementsArray[currentIndex].parentElement;
3157
+ if (!['UL', 'OL'].includes(parent.nodeName) &&
3158
+ elementsArray.some((element) => element.nodeName === 'LI')) {
3159
+ let count = 0;
3160
+ for (let i = currentIndex; i < elementsArray.length; i++) {
3161
+ if (elementsArray[i].nodeName === 'LI') {
3162
+ count++;
3163
+ }
3164
+ else {
3165
+ break;
3166
+ }
3167
+ }
3168
+ return count;
3169
+ }
3170
+ return elementsArray[currentIndex].tagName === 'LI' ? 1 : 0;
3171
+ }
3172
+ /**
3173
+ * Parse to a list item block.
3174
+ *
3175
+ * @param {HTMLElement[]} elementsArray - Current elements.
3176
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3177
+ * @returns {Nullable<RTEContentBlock>} - List item block.
3178
+ */
3179
+ handle(elementsArray, options) {
3180
+ const firstElement = elementsArray[0];
3181
+ const parent = firstElement.parentElement;
3182
+ if (!['UL', 'OL'].includes(parent.nodeName)) {
3183
+ return this.generateWithListBlock(elementsArray, options);
3184
+ }
3185
+ return RTEListItemBlock.from(this.generateListItemBlockDTO(firstElement, options), options);
3186
+ }
3187
+ /**
3188
+ * Append child list blocks to current list item block.
3189
+ *
3190
+ * @param {RTEListBlock} currentBlock - Current list item block.
3191
+ * @param {RTEListItemBlock[]} childBlocks - Current list blocks.
3192
+ */
3193
+ appendChildBlocks(currentBlock, childBlocks) {
3194
+ currentBlock.nestList = childBlocks.filter((block) => ['bullet-list', 'number-list'].includes(block.type));
3195
+ }
3196
+ /**
3197
+ * Should continue process to child elements.
3198
+ *
3199
+ * @returns {boolean} - boolean.
3200
+ */
3201
+ shouldProceedToElementChildren() {
3202
+ return true;
3203
+ }
3204
+ /**
3205
+ * Generate list block from a list of HTML elements.
3206
+ *
3207
+ * @param {HTMLElement[]} elements - List of HTML elements to convert.
3208
+ * @param {VegaRTETransformOptions} options - Options for transformation.
3209
+ * @returns {RTEListBlock} - List block DTO.
3210
+ */
3211
+ generateWithListBlock(elements, options) {
3212
+ return RTEListBlock.from({
3213
+ id: generateUUID(),
3214
+ type: 'bullet-list',
3215
+ blocks: elements.map((item) => {
3216
+ return this.generateListItemBlockDTO(item, options);
3217
+ }),
3218
+ }, options);
3219
+ }
3220
+ /**
3221
+ * Generate list item block DTO from an HTML element.
3222
+ *
3223
+ * @param {HTMLElement} element - HTML element to convert.
3224
+ * @param {VegaRTETransformOptions} options - Options for transformation.
3225
+ * @returns {VegaRTEListItemBlock} - List item block DTO.
3226
+ */
3227
+ generateListItemBlockDTO(element, options) {
3228
+ return {
3229
+ id: generateUUID(),
3230
+ type: 'list-item',
3231
+ annotations: htmlElementToAnnotationGenerator.generate(RTEListItemBlock, element, options),
3232
+ nodes: this.generateChildNodes(Array.from(element.childNodes.length ? element.childNodes : [element]).filter((item) => {
3233
+ return !['UL', 'OL'].includes(item.nodeName);
3234
+ }), htmlElementToAnnotationGenerator.generate(RTETextNode, element, Object.assign(Object.assign({}, options), { skipCustomAnnotations: true })), options),
3235
+ };
3236
+ }
3237
+ }
3238
+
3239
+ /** Transform other editor code element which has attribute data-language to RTE code block DTO */
3240
+ class JiraCodeToRTECodeBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3241
+ /**
3242
+ * Can be handle.
3243
+ *
3244
+ * @param {HTMLElement[]} elementsArray - Current elements.
3245
+ * @param {number} currentIndex - Current element index.
3246
+ * @returns {number} - can be handled element count.
3247
+ */
3248
+ canHandle(elementsArray, currentIndex) {
3249
+ return (elementsArray[currentIndex].tagName === 'PRE' ||
3250
+ elementsArray[currentIndex].tagName === 'CODE') &&
3251
+ elementsArray[currentIndex].hasAttribute('data-language')
3252
+ ? 1
3253
+ : 0;
3254
+ }
3255
+ /**
3256
+ * Parse to a code block.
3257
+ *
3258
+ * @param {HTMLElement[]} elementsArray - Current elements.
3259
+ * @returns {Nullable<RTECodeBlock>} - Code block.
3260
+ */
3261
+ handle(elementsArray) {
3262
+ const codeRef = elementsArray[0];
3263
+ if (codeRef) {
3264
+ const content = codeRef.textContent;
3265
+ const language = codeRef.dataset
3266
+ .language;
3267
+ return RTECodeBlock.from({
3268
+ id: generateUUID(),
3269
+ type: 'code-block',
3270
+ content,
3271
+ language,
3272
+ });
3273
+ }
3274
+ }
3275
+ /* istanbul ignore next */
3276
+ /**
3277
+ * Append child blocks.
3278
+ */
3279
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3280
+ appendChildBlocks() { }
3281
+ /**
3282
+ * Should continue process to child elements.
3283
+ *
3284
+ * @returns {boolean} - boolean.
3285
+ */
3286
+ shouldProceedToElementChildren() {
3287
+ return false;
3288
+ }
3289
+ }
3290
+
3291
+ /** Transform vega-code-block element to code block DTO */
3292
+ class VegaCodeBlockToRTECodeBlockStrategy extends JiraCodeToRTECodeBlockStrategy {
3293
+ /**
3294
+ * Can be handle.
3295
+ *
3296
+ * TODO: Update the browser clipboard data to fix the issue with nested vega-code-block elements.
3297
+ * In safari the html snippet will be like: <vega-code-block><p><span>paragraph</span></p><vega-code-block></vega-code-block></vega-code-block>
3298
+ * The vega-code-block nested inside the vega-code-block, so we need to check the child element.
3299
+ *
3300
+ * @param {HTMLElement[]} elementsArray - Current elements.
3301
+ * @param {number} currentIndex - Current element index.
3302
+ * @returns {number} - can be handled element count.
3303
+ */
3304
+ canHandle(elementsArray, currentIndex) {
3305
+ return (elementsArray[currentIndex].tagName === 'VEGA-CODE-BLOCK' &&
3306
+ !!elementsArray[currentIndex].querySelector('vega-code-block') === false) ||
3307
+ this.isCodeBlockContainer(elementsArray[currentIndex])
3308
+ ? 1
3309
+ : 0;
3310
+ }
3311
+ /**
3312
+ * Parse to a code block.
3313
+ *
3314
+ * @param {HTMLElement[]} elementsArray - Current elements.
3315
+ * @returns {Nullable<RTECodeBlock>} - Code block.
3316
+ */
3317
+ handle(elementsArray) {
3318
+ const codeBlockElement = this.isCodeBlockContainer(elementsArray[0])
3319
+ ? elementsArray[0].querySelector('vega-code-block')
3320
+ : elementsArray[0];
3321
+ const code = codeBlockElement.querySelector('code');
3322
+ if (code) {
3323
+ return super.handle([code]); // Call the parent method to handle the code element
3324
+ }
3325
+ else if (codeBlockElement.hasAttribute('data-content')) {
3326
+ // The code element in shadow dom could be empty in firefox.
3327
+ // eslint-disable-next-line no-restricted-globals
3328
+ const code = document.createElement('code');
3329
+ code.textContent = codeBlockElement.dataset.content;
3330
+ code.dataset.language = codeBlockElement.dataset.language;
3331
+ return super.handle([code]); // Call the parent method to handle the code element
3332
+ }
3333
+ }
3334
+ /* istanbul ignore next */
3335
+ /**
3336
+ * Append child blocks.
3337
+ */
3338
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3339
+ appendChildBlocks() { }
3340
+ /**
3341
+ * Should continue process to child elements.
3342
+ *
3343
+ * @returns {boolean} - boolean.
3344
+ */
3345
+ shouldProceedToElementChildren() {
3346
+ return false;
3347
+ }
3348
+ /**
3349
+ * Checks if the given element is a code block container.
3350
+ *
3351
+ * @param {HTMLElement} element - The element to check.
3352
+ * @returns {boolean} - Boolean result.
3353
+ */
3354
+ isCodeBlockContainer(element) {
3355
+ return (element.tagName === 'PRE' &&
3356
+ element.classList.contains('code-block-container') &&
3357
+ element.querySelectorAll('vega-code-block').length === 1);
3358
+ }
3359
+ }
3360
+
3361
+ /** Transform inline block element to text block DTO */
3362
+ class InlineBlockToRTETextBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3363
+ /**
3364
+ * Can be handle.
3365
+ *
3366
+ * @param {HTMLElement[]} elementsArray - Current elements.
3367
+ * @param {number} currentIndex - Current element index.
3368
+ * @returns {number} - can be handled element count.
3369
+ */
3370
+ canHandle(elementsArray, currentIndex) {
3371
+ return [
3372
+ 'heading-1',
3373
+ 'heading-2',
3374
+ 'heading-3',
3375
+ 'heading-4',
3376
+ 'heading-5',
3377
+ 'heading-6',
3378
+ 'title',
3379
+ 'subtitle',
3380
+ ].includes(super.matchTextBlockType(elementsArray[currentIndex]))
3381
+ ? 1
3382
+ : 0;
3383
+ }
3384
+ /**
3385
+ * Parse to a text block.
3386
+ *
3387
+ * @param {HTMLElement[]} elementsArray - Current elements.
3388
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3389
+ * @returns {Nullable<RTEContentBlock>} - Text block.
3390
+ */
3391
+ handle(elementsArray, options) {
3392
+ const nodes = this.generateChildNodes(Array.from(elementsArray[0].childNodes), {}, options);
3393
+ if (nodes.length === 0)
3394
+ return null;
3395
+ return RTETextBlock.from({
3396
+ id: generateUUID(),
3397
+ type: super.matchTextBlockType(elementsArray[0]),
3398
+ nodes: nodes,
3399
+ annotations: htmlElementToAnnotationGenerator.generate(RTETextBlock, elementsArray[0], options),
3400
+ }, options);
3401
+ }
3402
+ /* istanbul ignore next */
3403
+ /**
3404
+ * Append child blocks.
3405
+ */
3406
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3407
+ appendChildBlocks() { }
3408
+ /**
3409
+ * Should continue process to child elements.
3410
+ *
3411
+ * @returns {boolean} - boolean.
3412
+ */
3413
+ shouldProceedToElementChildren() {
3414
+ return false;
3415
+ }
3416
+ }
3417
+
3418
+ /** Abstract class for block html element to RTE block dto */
3419
+ class ElementToRTEImageBlockStrategyAbstract extends BlockToRTEBlockStrategyAbstract {
3420
+ /**
3421
+ * Create a RTE Image block according to the img element.
3422
+ *
3423
+ * @param {HTMLElement} element - current element.
3424
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3425
+ * @returns {RTEImageBlock} -RTE Image block.
3426
+ */
3427
+ createRTEImageBlock(element, options) {
3428
+ // RTEImageBlock is also wrapped by a div, should not as internal wrapper if the parent is a div.
3429
+ const isInternalWrapper = !(options && options.autoMatchFormat) &&
3430
+ !!(element.parentNode && element.parentNode.nodeName !== 'DIV');
3431
+ return RTEImageBlock.from({
3432
+ id: generateUUID(),
3433
+ type: 'image',
3434
+ nodes: [
3435
+ {
3436
+ id: generateUUID(),
3437
+ type: 'image',
3438
+ url: element.src,
3439
+ annotations: htmlElementToAnnotationGenerator.generate(RTEImageNode, element, options),
3440
+ },
3441
+ ],
3442
+ annotations: Object.assign(Object.assign({}, htmlElementToAnnotationGenerator.generate(RTEImageBlock, element.parentElement, options)), { internalWrapper: isInternalWrapper }),
3443
+ }, options);
3444
+ }
3445
+ }
3446
+
3447
+ /** Transform img element to image block DTO */
3448
+ class ImgToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbstract {
3449
+ /**
3450
+ * Can be handle.
3451
+ *
3452
+ * @param {HTMLElement[]} elementsArray - Current elements.
3453
+ * @param {number} currentIndex - Current element index.
3454
+ * @returns {number} - can be handled element count.
3455
+ */
3456
+ canHandle(elementsArray, currentIndex) {
3457
+ return elementsArray[currentIndex].tagName === 'IMG' ? 1 : 0;
3458
+ }
3459
+ /**
3460
+ * Parse to a image block.
3461
+ *
3462
+ * @param {HTMLElement[]} elementsArray - Current elements.
3463
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3464
+ * @returns {Nullable<RTEContentBlock>} - Image block.
3465
+ */
3466
+ handle(elementsArray, options) {
3467
+ const element = elementsArray[0];
3468
+ return this.createRTEImageBlock(element, options);
3469
+ }
3470
+ /* istanbul ignore next */
3471
+ /**
3472
+ * Append child blocks.
3473
+ */
3474
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3475
+ appendChildBlocks() { }
3476
+ /**
3477
+ * Should continue process to child elements.
3478
+ *
3479
+ * @returns {boolean} - boolean.
3480
+ */
3481
+ shouldProceedToElementChildren() {
3482
+ return false;
3483
+ }
3484
+ }
3485
+
3486
+ /** Transform vega-rich-text-image-editor element to image block DTO */
3487
+ class VegaImageToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbstract {
3488
+ /**
3489
+ * Can be handle.
3490
+ *
3491
+ * @param {HTMLElement[]} elementsArray - Current elements.
3492
+ * @param {number} currentIndex - Current element index.
3493
+ * @returns {number} - can be handled element count.
3494
+ */
3495
+ canHandle(elementsArray, currentIndex) {
3496
+ return elementsArray[currentIndex].tagName === 'VEGA-RICH-TEXT-IMAGE-EDITOR' ? 1 : 0;
3497
+ }
3498
+ /**
3499
+ * Parse to a image block.
3500
+ *
3501
+ * @param {HTMLElement[]} elementsArray - Current elements.
3502
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3503
+ * @returns {Nullable<RTEContentBlock>} - Image block.
3504
+ */
3505
+ handle(elementsArray, options) {
3506
+ const element = elementsArray[0];
3507
+ const image = element.querySelector('img');
3508
+ if (isNonNullable(image)) {
3509
+ return RTEImageBlock.from({
3510
+ id: generateUUID(),
3511
+ type: 'image',
3512
+ nodes: [
3513
+ {
3514
+ id: generateUUID(),
3515
+ type: 'image',
3516
+ url: image.src,
3517
+ annotations: htmlElementToAnnotationGenerator.generate(RTEImageNode, element, options),
3518
+ },
3519
+ ],
3520
+ annotations: htmlElementToAnnotationGenerator.generate(RTEImageBlock, element.parentElement, options),
3521
+ }, options);
3522
+ }
3523
+ }
3524
+ /* istanbul ignore next */
3525
+ /**
3526
+ * Append child blocks.
3527
+ */
3528
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3529
+ appendChildBlocks() { }
3530
+ /**
3531
+ * Should continue process to child elements.
3532
+ *
3533
+ * @returns {boolean} - boolean.
3534
+ */
3535
+ shouldProceedToElementChildren() {
3536
+ return false;
3537
+ }
3538
+ }
3539
+
3540
+ /** Transform img in span or other inline element to image block DTO */
3541
+ class SpanImageToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbstract {
3542
+ /**
3543
+ * Can be handle.
3544
+ *
3545
+ * @param {HTMLElement[]} elementsArray - Current elements.
3546
+ * @param {number} currentIndex - Current element index.
3547
+ * @returns {number} - can be handled element count.
3548
+ */
3549
+ canHandle(elementsArray, currentIndex) {
3550
+ const element = elementsArray[currentIndex];
3551
+ return element.nodeType === Node.ELEMENT_NODE &&
3552
+ element.textContent === '' &&
3553
+ element.querySelector('img')
3554
+ ? 1
3555
+ : 0;
3556
+ }
3557
+ /**
3558
+ * Parse to a image block.
3559
+ *
3560
+ * @param {HTMLElement[]} elementsArray - Current elements.
3561
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3562
+ * @returns {Nullable<RTEContentBlock>} - Image block.
3563
+ */
3564
+ handle(elementsArray, options) {
3565
+ const element = elementsArray[0].querySelector('img');
3566
+ return this.createRTEImageBlock(element, options);
3567
+ }
3568
+ /* istanbul ignore next */
3569
+ /**
3570
+ * Append child blocks.
3571
+ */
3572
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3573
+ appendChildBlocks() { }
3574
+ /**
3575
+ * Should continue process to child elements.
3576
+ *
3577
+ * @returns {boolean} - boolean.
3578
+ */
3579
+ shouldProceedToElementChildren() {
3580
+ return false;
3581
+ }
3582
+ }
3583
+
3584
+ /** Transform continue inline block elements to text block DTO */
3585
+ class ContinueInlineToRTETextBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3586
+ /**
3587
+ * @inheritDoc
3588
+ */
3589
+ canHandle(elementsArray, currentIndex, options) {
3590
+ let count = 0;
3591
+ for (let i = currentIndex; i < elementsArray.length; i++) {
3592
+ const element = elementsArray[i];
3593
+ if (this.isInlineCandidate(element, options)) {
3594
+ count++;
3595
+ }
3596
+ else {
3597
+ break;
3598
+ }
3599
+ }
3600
+ return count;
3601
+ }
3602
+ /**
3603
+ * Parse to a text block.
3604
+ *
3605
+ * @param {HTMLElement[]} elementsArray - Current elements.
3606
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3607
+ * @returns {Nullable<RTEContentBlock>} - Text block.
3608
+ */
3609
+ handle(elementsArray, options) {
3610
+ const parent = elementsArray[0].parentElement;
3611
+ const autoMatchFormat = options && options.autoMatchFormat;
3612
+ const nodes = this.generateChildNodes(elementsArray, autoMatchFormat
3613
+ ? htmlElementToAnnotationGenerator.generate(RTETextNode, parent, Object.assign(Object.assign({}, options), { skipCustomAnnotations: true }))
3614
+ : {}, options);
3615
+ const blockType = autoMatchFormat
3616
+ ? super.matchTextBlockType(parent)
3617
+ : this.matchTextBlockTypeByTagName(parent);
3618
+ const internalWrapper = !autoMatchFormat && !blockType;
3619
+ return RTETextBlock.from(Object.assign({ id: generateUUID(), type: blockType || 'paragraph', nodes: nodes }, (internalWrapper
3620
+ ? { annotations: { internalWrapper: internalWrapper } }
3621
+ : {
3622
+ annotations: htmlElementToAnnotationGenerator.generate(RTETextBlock, parent, options),
3623
+ })), options);
3624
+ }
3625
+ /* istanbul ignore next */
3626
+ /**
3627
+ * Append child blocks.
3628
+ */
3629
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3630
+ appendChildBlocks() { }
3631
+ /**
3632
+ * Should continue process to child elements.
3633
+ *
3634
+ * @returns {boolean} - boolean.
3635
+ */
3636
+ shouldProceedToElementChildren() {
3637
+ return false;
3638
+ }
3639
+ /**
3640
+ * Match the block type by tag name.
3641
+ *
3642
+ * @param {HTMLElement} element - Target element.
3643
+ * @returns {Nullable<VegaRTETextBlockType>} - Block type.
3644
+ */
3645
+ matchTextBlockTypeByTagName(element) {
3646
+ switch (element.nodeName) {
3647
+ case 'P':
3648
+ return 'paragraph';
3649
+ default:
3650
+ return null;
3651
+ }
3652
+ }
3653
+ /**
3654
+ * Check if the element is an inline candidate to be included in the text block.
3655
+ *
3656
+ * @param {HTMLElement} element - The element to check.
3657
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3658
+ * @returns {boolean} - Whether the element is an inline candidate.
3659
+ */
3660
+ isInlineCandidate(element, options) {
3661
+ if (element.nodeType === Node.TEXT_NODE)
3662
+ return true;
3663
+ if (ALWAYS_INLINE_TAGS.has(element.nodeName))
3664
+ return true;
3665
+ if (this.isDedicatedBlockTag(element.nodeName))
3666
+ return false;
3667
+ if (options.autoMatchFormat === false && isInBlockTextContext(element))
3668
+ return true;
3669
+ return this.isInlineLeafOrWrapper(element);
3670
+ }
3671
+ /**
3672
+ * Returns true when the tag has a dedicated block strategy (excludes inline annotation tags CODE and A).
3673
+ *
3674
+ * @param {string} nodeName - The node name to check.
3675
+ * @returns {boolean} - Whether the tag is a dedicated block tag.
3676
+ */
3677
+ isDedicatedBlockTag(nodeName) {
3678
+ return DEDICATED_STRATEGY_TAGS.has(nodeName) && !ALWAYS_INLINE_TAGS.has(nodeName);
3679
+ }
3680
+ /**
3681
+ * Returns true for empty elements, text-only elements, or elements whose entire
3682
+ * descendant tree contains no block-level elements (e.g. {@code <u><i><b>text</b></i></u>}).
3683
+ *
3684
+ * @param {HTMLElement} element - The element to check.
3685
+ * @returns {boolean} - Whether the element is an inline leaf or wrapper.
3686
+ */
3687
+ isInlineLeafOrWrapper(element) {
3688
+ if (element.childNodes.length === 0) {
3689
+ // An empty element is inline only if it is a known HTML phrasing-content
3690
+ // element (SPAN, EM, STRONG, …). Block containers (DIV, SECTION, …)
3691
+ // and unknown/custom elements default to block separators.
3692
+ return PHRASING_CONTENT_TAGS.has(element.nodeName);
3693
+ }
3694
+ if (this.isTextOnlyElement(element)) {
3695
+ return PHRASING_CONTENT_TAGS.has(element.nodeName) || ALWAYS_INLINE_TAGS.has(element.nodeName);
3696
+ }
3697
+ return this.hasOnlyInlineDescendants(element);
3698
+ }
3699
+ /**
3700
+ * Returns true when the element has text-node children but no element children.
3701
+ *
3702
+ * @param {HTMLElement} element - The element to check.
3703
+ * @returns {boolean} - Whether the element contains only text nodes.
3704
+ */
3705
+ isTextOnlyElement(element) {
3706
+ const childNodes = Array.from(element.childNodes);
3707
+ return (!childNodes.some((child) => child.nodeType === Node.ELEMENT_NODE) &&
3708
+ childNodes.some((child) => child.nodeType === Node.TEXT_NODE));
3709
+ }
3710
+ /**
3711
+ * Returns true if the element's subtree contains only inline formatting wrappers.
3712
+ * Instead of maintaining a hard coded tag allowlist, the check derives from:
3713
+ * 1. {@link DEDICATED_STRATEGY_TAGS} — rejects known block/media tags
3714
+ * 2. Void-element check — elements with no child nodes (INPUT, COL, HR, …)
3715
+ * are replaced/embedded content, not formatting wrappers
3716
+ *
3717
+ * @param {HTMLElement} element - Element to inspect.
3718
+ * @returns {boolean} True if the element has no block-level descendants.
3719
+ */
3720
+ hasOnlyInlineDescendants(element) {
3721
+ for (let i = 0; i < element.children.length; i++) {
3722
+ const child = element.children[i];
3723
+ if (this.isDedicatedBlockTag(child.nodeName))
3724
+ return false;
3725
+ // An empty element is not a formatting wrapper — it is likely a void/embedded
3726
+ // element (INPUT, HR, COL, empty SPAN) that acts as a block separator.
3727
+ if (!child.hasChildNodes())
3728
+ return false;
3729
+ if (!this.hasOnlyInlineDescendants(child))
3730
+ return false;
3731
+ }
3732
+ return true;
3733
+ }
3734
+ }
3735
+
3736
+ /**
3737
+ * Class to handle text node elements and convert them to text node DTOs
3738
+ */
3739
+ class ElementToTextNodeStrategy extends ElementToDTOStrategy {
3740
+ /**
3741
+ * @inheritDoc
3742
+ */
3743
+ shouldProceedToElementChildren() {
3744
+ return false;
3745
+ }
3746
+ /**
3747
+ * @inheritDoc
3748
+ */
3749
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3750
+ appendChildBlocks() { }
3751
+ /**
3752
+ * Generate text node DTO object
3753
+ *
3754
+ * @param {string} text - text content.
3755
+ * @param {VegaRTETextAnnotations} annotations - Current annotations.
3756
+ * @returns {VegaRTETextNode} - Text node DTO.
3757
+ */
3758
+ generateTextNode(text, annotations) {
3759
+ return {
3760
+ id: generateUUID(),
3761
+ type: 'text',
3762
+ text: text,
3763
+ annotations: annotations,
3764
+ };
3765
+ }
3766
+ }
3767
+
3768
+ /**
3769
+ * Class to handle plain text nodes and convert them to RTE text node DTOs
3770
+ */
3771
+ class PlainTextToTextNodeStrategy extends ElementToTextNodeStrategy {
3772
+ /**
3773
+ * @inheritDoc
3774
+ */
3775
+ canHandle(elementsArray, currentIndex) {
3776
+ const element = elementsArray[currentIndex];
3777
+ return element.nodeType === Node.TEXT_NODE ? 1 : 0;
3778
+ }
3779
+ /**
3780
+ * @inheritDoc
3781
+ */
3782
+ handle(elementsArray, options, parentTextAnnotations) {
3783
+ const parentAnnotations = Object.assign({}, parentTextAnnotations);
3784
+ const disableAutoMatchFormat = !!(options && options.autoMatchFormat === false);
3785
+ const child = elementsArray[0];
3786
+ const parentNodeName = child.parentNode.nodeName.toLowerCase();
3787
+ const plainText = disableAutoMatchFormat && !RTETextNode.supportsHtmlTag(parentNodeName);
3788
+ const textNode = this.generateTextNode(String(child.textContent), disableAutoMatchFormat
3789
+ ? cleanObject(Object.assign(Object.assign({}, (parentNodeName === 'span'
3790
+ ? parentAnnotations
3791
+ : {
3792
+ // text node could be wrapped in <a> tag, so we need to keep the parent link annotation
3793
+ link: parentAnnotations.link,
3794
+ code: parentNodeName === 'code' ? parentAnnotations.code : undefined,
3795
+ })), { inlineHtml: parentAnnotations.inlineHtml, plainText: plainText || undefined }))
3796
+ : parentAnnotations);
3797
+ return Object.assign({}, textNode);
3798
+ }
3799
+ }
3800
+
3801
+ /**
3802
+ * Class to handle inline html element to text node dto
3803
+ */
3804
+ class InlineElementToTextNodeStrategy extends ElementToTextNodeStrategy {
3805
+ /**
3806
+ * @inheritDoc
3807
+ */
3808
+ canHandle(elementsArray, currentIndex) {
3809
+ const element = elementsArray[currentIndex];
3810
+ return isHTMLElement(element) && (element.nodeName === 'BR' || element.childNodes.length === 0)
3811
+ ? 1
3812
+ : 0;
3813
+ }
3814
+ /**
3815
+ * @inheritDoc
3816
+ */
3817
+ handle(elementsArray, options, annotations) {
3818
+ const disableAutoMatchFormat = !!(options && options.autoMatchFormat === false);
3819
+ const parentAnnotations = Object.assign({}, annotations);
3820
+ const child = elementsArray[0];
3821
+ const curAnnotations = htmlElementToAnnotationGenerator.generate(RTETextNode, child, Object.assign({ parentAnnotations: disableAutoMatchFormat
3822
+ ? {
3823
+ inlineHtml: parentAnnotations.inlineHtml,
3824
+ link: parentAnnotations.link,
3825
+ code: parentAnnotations.code,
3826
+ }
3827
+ : annotations }, options));
3828
+ if (child.nodeName === 'BR') {
3829
+ return this.generateTextNode('\n', curAnnotations);
3830
+ }
3831
+ else if (child.childNodes.length === 0) {
3832
+ // For empty dom, there will be no internal iteration, we need to handle it directly here.
3833
+ // Example: <span></span>, <video src='...'></video>
3834
+ const emptyNodeAnnotations = disableAutoMatchFormat
3835
+ ? cleanObject(Object.assign(Object.assign({}, (RTETextNode.supportsHtmlTag(child.nodeName.toLowerCase()) ? curAnnotations : {})), { inlineHtml: curAnnotations.inlineHtml }))
3836
+ : curAnnotations;
3837
+ return Object.assign({}, this.generateTextNode('', emptyNodeAnnotations));
3838
+ }
3839
+ }
3840
+ }
3841
+
3842
+ /**
3843
+ * Filter styles strategy for image node, which defines the styles to be filtered and the conditions for filtering and refilling styles for image nodes.
3844
+ */
3845
+ class ImageFilterStylesStrategy extends RTEFilterStylesStrategy {
3846
+ constructor() {
3847
+ super(...arguments);
3848
+ this.stylesToBeFiltered = ImageAnnotation.getDefaultStyles();
3849
+ this.elementTagName = 'img';
3850
+ }
3851
+ /**
3852
+ * Used for the filterAnnotations method.
3853
+ *
3854
+ * @returns {boolean} Always `true` — image defaults are emitted as inline styles.
3855
+ */
3856
+ get alwaysFilter() {
3857
+ return true;
3858
+ }
3859
+ /**
3860
+ * @inheritDoc
3861
+ */
3862
+ canFilter(blockOrNodeInstance) {
3863
+ return Predicate$1.isImageNode(blockOrNodeInstance);
3864
+ }
3865
+ /**
3866
+ * @inheritDoc
3867
+ */
3868
+ canRefill(_blockOrNodeClassName, element) {
3869
+ return element.tagName.toLowerCase() === this.elementTagName;
3870
+ }
3871
+ /**
3872
+ * @inheritDoc
3873
+ */
3874
+ toCssText() {
3875
+ return this.buildCssTextForStyles(this.elementTagName, this.classNameToBeAdded);
3876
+ }
3877
+ }
3878
+
3879
+ /**
3880
+ * Filters the default ListAnnotation styles (paddingLeft, marginLeft) from
3881
+ * customStyle when parsing an RTEListBlock.
3882
+ */
3883
+ class ListBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
3884
+ constructor() {
3885
+ super(...arguments);
3886
+ this.stylesToBeFiltered = ListAnnotation.getDefaultStyles();
3887
+ this.elementTagName = 'ol,ul';
3888
+ }
3889
+ /**
3890
+ * @inheritDoc
3891
+ */
3892
+ canFilter(blockOrNodeInstance) {
3893
+ return Predicate$1.isListBlock(blockOrNodeInstance.constructor.name);
3894
+ }
3895
+ /**
3896
+ * @inheritDoc
3897
+ */
3898
+ canRefill(blockOrNodeClassName, element) {
3899
+ return Predicate$1.isListBlock(blockOrNodeClassName) && element.matches(this.elementTagName);
3900
+ }
3901
+ /**
3902
+ * @inheritDoc
3903
+ */
3904
+ toCssText() {
3905
+ const selector = this.elementTagName
3906
+ .split(',')
3907
+ .map((tag) => `.${RTEFilterStylesStrategy.RTE_CONTENT_CONTAINER_CLASS_NAME} ${tag.trim()}`)
3908
+ .join(', ');
3909
+ return `${selector} { ${this.convertStylesMapToCssText(this.stylesToBeFiltered)} }`;
3910
+ }
3911
+ }
3912
+
3913
+ /**
3914
+ * Filters the default paragraph styles from customStyle when parsing an
3915
+ * RTEListItemBlock. List-item blocks implicitly use paragraph styling,
3916
+ * so these inline defaults are redundant and should not be persisted.
3917
+ */
3918
+ class ListItemBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
3919
+ constructor() {
3920
+ super(...arguments);
3921
+ this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles('paragraph');
3922
+ this.elementTagName = 'li';
3923
+ this.headingOrTitleClassNamePattern = /^v-rte-(h[1-6]|title|subtitle)$/;
3924
+ }
3925
+ /**
3926
+ * Check the important font-size for list item block are default styles, and the block is a list item block.
3927
+ *
3928
+ * @inheritDoc
3929
+ */
3930
+ canFilter(blockOrNodeInstance) {
3931
+ const styles = blockOrNodeInstance.getStyles();
3932
+ const isDefaultStyles = !styles.fontSize ||
3933
+ this.isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance, ['fontSize', 'lineHeight']);
3934
+ return Predicate$1.isListItemBlock(blockOrNodeInstance.constructor.name) && isDefaultStyles;
3935
+ }
3936
+ /**
3937
+ * @inheritDoc
3938
+ */
3939
+ canRefill(blockOrNodeClassName, element) {
3940
+ return (Predicate$1.isListItemBlock(blockOrNodeClassName) &&
3941
+ element.matches(this.elementTagName) &&
3942
+ this.isElementNotHeadingOrTitle(element));
3943
+ }
3944
+ /**
3945
+ * @inheritDoc
3946
+ */
3947
+ toCssText() {
3948
+ return this.buildCssTextForStyles(this.elementTagName);
3949
+ }
3950
+ /**
3951
+ * Check the list item element does not have heading or title class names.
3952
+ *
3953
+ * @param {HTMLElement} element - The list item element to check.
3954
+ * @returns {boolean} - True if the element does not have heading or title class names, false otherwise.
3955
+ */
3956
+ isElementNotHeadingOrTitle(element) {
3957
+ const classNames = element.className.split(' ');
3958
+ return !classNames.some((className) => this.headingOrTitleClassNamePattern.test(className.trim()));
3959
+ }
3960
+ }
3961
+
3962
+ /**
3963
+ * Filters redundant `textAlign` from `customStyle` when parsing blocks that carry
3964
+ * a semantic `textAlign` annotation (RTETextBlock, RTEListBlock, RTEListItemBlock).
3965
+ *
3966
+ * During source-to-normal round-trips the `HorizontalAlignmentAnnotation` emits
3967
+ * `text-align` as an inline style (standalone mode), and `CustomStyleAnnotationHandler`
3968
+ * captures it into `customStyle`. This strategy removes the duplicate so the
3969
+ * semantic annotation is the single source of truth.
3970
+ */
3971
+ class AlignmentFilterStylesStrategy extends RTEFilterStylesStrategy {
3972
+ constructor() {
3973
+ super(...arguments);
3974
+ this.stylesToBeFiltered = {};
3975
+ }
3976
+ /**
3977
+ * @returns {boolean} Always `true` — alignment inline styles are always emitted
3978
+ * in standalone/source-edit mode, so the duplicate is always safe to remove.
3979
+ */
3980
+ get alwaysFilter() {
3981
+ return true;
3982
+ }
3983
+ /**
3984
+ * Removes `textAlign` from `customStyle` when it duplicates the value returned
3985
+ * by `HorizontalAlignmentAnnotation.getDefaultStyles(textAlign)`.
3986
+ *
3987
+ * @param {VegaRTEAnnotations} annotations - The annotations object (mutated in place).
3988
+ * @returns {VegaRTEAnnotations} The same annotations reference.
3989
+ */
3990
+ filterAnnotations(annotations) {
3991
+ const { textAlign, customStyle } = annotations;
3992
+ if (!textAlign || !customStyle) {
3993
+ return annotations;
3994
+ }
3995
+ this.stylesToBeFiltered = HorizontalAlignmentAnnotation.getDefaultStyles(textAlign);
3996
+ return super.filterAnnotations(annotations);
3997
+ }
3998
+ }
3999
+
4000
+ /**
4001
+ * The CodeFilterStylesStrategy is responsible for filtering code styles from text nodes that are annotated as code.
4002
+ */
4003
+ class CodeFilterStylesStrategy extends RTEFilterStylesStrategy {
4004
+ constructor() {
4005
+ super(...arguments);
4006
+ this.stylesToBeFiltered = CodeAnnotation.getDefaultStyles();
4007
+ this.elementTagName = 'code';
4008
+ }
4009
+ /**
4010
+ * Only strips code-default styles when the `code` annotation is present,
4011
+ * so that a user-applied `fontFamily: 'Roboto Mono'` without code is preserved.
4012
+ *
4013
+ * @param {VegaRTEAnnotations} annotations - The annotations object (mutated in place).
4014
+ * @returns {VegaRTEAnnotations} The same annotations reference.
4015
+ */
4016
+ filterAnnotations(annotations) {
4017
+ const { code, customStyle } = annotations;
4018
+ if (!code || !customStyle) {
4019
+ return annotations;
4020
+ }
4021
+ return super.filterAnnotations(annotations);
4022
+ }
4023
+ /**
4024
+ * Determines whether the dto instance is a code text node.
4025
+ *
4026
+ * @param {RTEBlock | RTENode} blockOrNodeInstance - The block or node instance to check.
4027
+ * @returns {boolean} - True if the instance is a code text node, false otherwise.
4028
+ */
4029
+ canFilter(blockOrNodeInstance) {
4030
+ return Predicate$1.isCodeNode(blockOrNodeInstance);
4031
+ }
4032
+ /**
4033
+ * Check if the node is a text node and it is a code node.
4034
+ *
4035
+ * @param {string} blockOrNodeClassName - The class name of the block or node instance to check.
4036
+ * @param {HTMLElement} element - The HTML element of the node instance.
4037
+ * @returns {boolean} True if the node is a text node it a code element.
4038
+ */
4039
+ canRefill(blockOrNodeClassName, element) {
4040
+ return Predicate$1.isTextNode(blockOrNodeClassName) && element.matches(this.elementTagName);
4041
+ }
4042
+ /**
4043
+ * The code style in title and heading no need to be bold in default.
4044
+ *
4045
+ * @returns {string} The CSS text string for code styles.
4046
+ */
4047
+ toCssText() {
4048
+ const selector = `.${RTEFilterStylesStrategy.RTE_CONTENT_CONTAINER_CLASS_NAME} ${this.elementTagName}`;
4049
+ return `${selector} { ${this.convertStylesMapToCssText(Object.assign(Object.assign({}, this.stylesToBeFiltered), { fontWeight: '500' }))} }`;
4050
+ }
4051
+ }
4052
+
4053
+ /**
4054
+ * Filters redundant inline text formatting styles from `customStyle` when
4055
+ * parsing an RTETextNode. These styles are already represented by semantic
4056
+ * annotations and should not be persisted as custom overrides after source
4057
+ * edit round-trips.
4058
+ */
4059
+ class TextFormatFilterStylesStrategy extends RTEFilterStylesStrategy {
4060
+ constructor() {
4061
+ super(...arguments);
4062
+ this.stylesToBeFiltered = {};
4063
+ }
4064
+ /**
4065
+ * @returns {boolean} Always `true` — this strategy runs regardless of `autoMatchFormat`.
4066
+ */
4067
+ get alwaysFilter() {
4068
+ return true;
4069
+ }
4070
+ /**
4071
+ * Filter redundant text format styles from `customStyle`.
4072
+ *
4073
+ * @param {VegaRTEAnnotations} annotations - The annotations to filter.
4074
+ * @returns {VegaRTEAnnotations} The same annotations reference with customStyle cleaned up.
4075
+ */
4076
+ filterAnnotations(annotations) {
4077
+ const textAnnotations = annotations;
4078
+ const customStyle = textAnnotations.customStyle;
4079
+ if (!customStyle) {
4080
+ return annotations;
4081
+ }
4082
+ // Only delete styles that match the default values(BOLD_FONT_WEIGHT) to avoid affecting normal-source conversion.
4083
+ if (textAnnotations.bold && customStyle.fontWeight === BOLD_FONT_WEIGHT) {
4084
+ delete customStyle.fontWeight;
4085
+ }
4086
+ if (textAnnotations.italic && customStyle.fontStyle === ITALIC_FONT_STYLE) {
4087
+ delete customStyle.fontStyle;
4088
+ }
4089
+ const normalizedTextDecoration = this.normalizeTextDecoration(customStyle.textDecoration);
4090
+ if (normalizedTextDecoration &&
4091
+ this.shouldRemoveTextDecoration(normalizedTextDecoration, textAnnotations)) {
4092
+ delete customStyle.textDecoration;
4093
+ }
4094
+ if (Object.keys(customStyle).length === 0) {
4095
+ delete textAnnotations.customStyle;
4096
+ }
4097
+ return annotations;
4098
+ }
4099
+ /**
4100
+ * Normalizes a `text-decoration` CSS value to a sorted, unique token string of
4101
+ * toolbar-only tokens (`underline`, `line-through`). Returns `undefined` if the
4102
+ * value contains any non-toolbar token (e.g. `wavy`, a color).
4103
+ *
4104
+ * @param {string | undefined} value - The raw `textDecoration` CSS value.
4105
+ * @returns {string | undefined} Normalized token string, or `undefined` if the value cannot be safely removed.
4106
+ */
4107
+ normalizeTextDecoration(value) {
4108
+ if (!value) {
4109
+ return undefined;
4110
+ }
4111
+ const tokens = value.trim().toLowerCase().split(/\s+/);
4112
+ if (tokens.some((token) => token !== UNDERLINE_TEXT_DECORATION && token !== STRIKETHROUGH_TEXT_DECORATION)) {
4113
+ return undefined;
4114
+ }
4115
+ return Array.from(new Set(tokens)).sort().join(' ');
4116
+ }
4117
+ /**
4118
+ * Determines whether the `textDecoration` custom style should be removed based on the
4119
+ * semantic annotations present. Removal happens only when the normalized value exactly
4120
+ * matches the set of `{underline, strikethrough}` annotations.
4121
+ *
4122
+ * @param {string} normalizedTextDecoration - The normalized `textDecoration` token string.
4123
+ * @param {VegaRTETextAnnotations} annotations - The text annotations to check against.
4124
+ * @returns {boolean} `true` if the `textDecoration` style is redundant and should be removed.
4125
+ */
4126
+ shouldRemoveTextDecoration(normalizedTextDecoration, annotations) {
4127
+ const expectedTokens = [];
4128
+ if (annotations.underline) {
4129
+ expectedTokens.push(UNDERLINE_TEXT_DECORATION);
4130
+ }
4131
+ if (annotations.strikethrough) {
4132
+ expectedTokens.push(STRIKETHROUGH_TEXT_DECORATION);
4133
+ }
4134
+ if (expectedTokens.length === 0) {
4135
+ return false;
4136
+ }
4137
+ return normalizedTextDecoration === expectedTokens.sort().join(' ');
4138
+ }
4139
+ }
4140
+
4141
+ /**
4142
+ *
4143
+ */
4144
+ class ParagraphFilterStylesStrategy extends RTEFilterStylesStrategy {
4145
+ constructor() {
4146
+ super(...arguments);
4147
+ this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles('paragraph');
4148
+ this.type = 'paragraph';
4149
+ this.elementTagName = 'p';
4150
+ }
4151
+ /**
4152
+ * Don't run the filterAnnotations for paragraph heading, title, subtitle, list heading item, list title item, list subtitle item.
4153
+ * Already handle it in html-element-to-annotation-generator.ts#removeTextStyleDefaultsFromCustomStyle
4154
+ *
4155
+ * @inheritDoc
4156
+ */
4157
+ filterAnnotations(annotations) {
4158
+ return annotations;
4159
+ }
4160
+ /**
4161
+ * Determines whether the dto instance is text block and has the same type as the strategy's configured type.
4162
+ *
4163
+ * @param {RTEBlock | RTENode} blockOrNodeInstance - The block or node instance to check.
4164
+ * @returns {boolean} - True if the instance is a text block with the same type as the strategy, false otherwise.
4165
+ */
4166
+ canFilter(blockOrNodeInstance) {
4167
+ return (Predicate$1.isTextBlock(blockOrNodeInstance.constructor.name) &&
4168
+ blockOrNodeInstance.type === this.type);
4169
+ }
4170
+ /**
4171
+ * @inheritDoc
4172
+ */
4173
+ canRefill(blockOrNodeClassName, element) {
4174
+ const selector = this.classNameToBeAdded
4175
+ ? `.${this.classNameToBeAdded}`
4176
+ : this.elementTagName;
4177
+ return Predicate$1.isTextBlock(blockOrNodeClassName) && element.matches(selector);
4178
+ }
4179
+ /**
4180
+ * @inheritDoc
4181
+ */
4182
+ toCssText() {
4183
+ return this.buildCssTextForStyles(this.elementTagName, this.classNameToBeAdded);
4184
+ }
4185
+ }
4186
+
4187
+ /**
4188
+ * The HeadingFilterStylesStrategy class is responsible for filtering and refilling styles for heading text blocks (h1 to h6) in the rich text editor.
4189
+ */
4190
+ class HeadingFilterStylesStrategy extends ParagraphFilterStylesStrategy {
4191
+ constructor(level) {
4192
+ super();
4193
+ this.type = 'heading-1';
4194
+ this.elementTagName = 'h1';
4195
+ this.type = `heading-${level}`;
4196
+ this.elementTagName = `h${level}`;
4197
+ this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles(this.type);
4198
+ }
4199
+ }
4200
+
4201
+ /**
4202
+ * The TitleFilterStylesStrategy class is responsible for filtering and refilling styles for title and subtitle text blocks in the rich text editor.
4203
+ */
4204
+ class TitleFilterStylesStrategy extends ParagraphFilterStylesStrategy {
4205
+ constructor(titleType) {
4206
+ super();
4207
+ this.type = 'title';
4208
+ this.elementTagName = 'div';
4209
+ this.classNameToBeAdded = 'v-rte-title';
4210
+ this.type = titleType;
4211
+ this.classNameToBeAdded = `v-rte-${titleType}`;
4212
+ this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles(this.type);
4213
+ }
4214
+ }
4215
+
4216
+ /**
4217
+ * The TitleHeadingNodeFilterStylesStrategy is responsible for filtering styles from text nodes that are children of title and heading blocks.
4218
+ * In title and heading blocks, the text nodes will have a default bold style.
4219
+ */
4220
+ class TitleHeadingNodeFilterStylesStrategy extends RTEFilterStylesStrategy {
4221
+ constructor() {
4222
+ super(...arguments);
4223
+ this.stylesToBeFiltered = TitleHeadingNodeFilterStylesStrategy.BOLD_STYLES;
4224
+ this.elementTagName = 'span';
4225
+ this.parentBlockTypes = [
4226
+ 'heading-1',
4227
+ 'heading-2',
4228
+ 'heading-3',
4229
+ 'heading-4',
4230
+ 'heading-5',
4231
+ 'heading-6',
4232
+ 'title',
4233
+ ];
4234
+ this.parentElementSelectors = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.v-rte-title'];
4235
+ this.toBeCheckedSelector = this.parentElementSelectors.join(',');
4236
+ }
4237
+ /**
4238
+ * Don't run filterAnnotations method, because already handle it in text format filter strategy.
4239
+ *
4240
+ * @inheritDoc
4241
+ */
4242
+ filterAnnotations(annotations) {
4243
+ return annotations;
4244
+ }
4245
+ /**
4246
+ * Determines whether the dto instance is text node and its parent block is a heading or title.
4247
+ *
4248
+ * @param {RTEBlock | RTENode} blockOrNodeInstance - The block or node instance to check.
4249
+ * @returns {boolean} - True if the instance is a text node and its parent block is a heading or title, false otherwise.
4250
+ */
4251
+ canFilter(blockOrNodeInstance) {
4252
+ return (Predicate$1.isTextNode(blockOrNodeInstance.constructor.name) &&
4253
+ this.parentBlockIsHeadingOrTitle(blockOrNodeInstance));
4254
+ }
4255
+ /**
4256
+ * Check if the node is a text node and its parent block is a heading or title.
4257
+ *
4258
+ * @param {string} blockOrNodeClassName - The class name of the block or node instance to check.
4259
+ * @param {HTMLElement} element - The HTML element of the node instance.
4260
+ * @returns {boolean} True if the node is a text node and its parent block is a heading or title, false otherwise.
4261
+ */
4262
+ canRefill(blockOrNodeClassName, element) {
4263
+ return (Predicate$1.isTextNode(blockOrNodeClassName) &&
4264
+ element.nodeName === 'SPAN' &&
4265
+ this.isHeadingOrTitleChild(element));
4266
+ }
4267
+ /**
4268
+ * @inheritDoc
4269
+ */
4270
+ toCssText() {
4271
+ const selectors = this.parentElementSelectors.map((key) => `.${TitleHeadingNodeFilterStylesStrategy.RTE_CONTENT_CONTAINER_CLASS_NAME} ${key}`);
4272
+ return `${selectors.join(',')} { ${this.convertStylesMapToCssText()} }`;
4273
+ }
4274
+ /**
4275
+ * Checks if the parent block of the given node instance is a heading or title.
4276
+ *
4277
+ * @param {RTENode | RTEBlock} blockOrNodeInstance - The node instance to check.
4278
+ * @returns {boolean} True if the parent block is a heading or title, false otherwise.
4279
+ */
4280
+ parentBlockIsHeadingOrTitle(blockOrNodeInstance) {
4281
+ const parentBlock = blockOrNodeInstance.parent;
4282
+ return parentBlock ? this.parentBlockTypes.includes(parentBlock.type) : false;
4283
+ }
4284
+ /**
4285
+ * Check if the element is a descendant of a heading or title element.
4286
+ * Traverses upward through the DOM, stopping at the block element or body element
4287
+ * to avoid unbounded traversal to the document root.
4288
+ *
4289
+ * <h1><span>bold text</span></h1>
4290
+ * <h1><a><span>link text</span></a></h1>
4291
+ * <h1><a><b><span>nested text</span></b></a></h1>
4292
+ *
4293
+ * @param {HTMLElement} element - The element to check.
4294
+ * @returns {boolean} True if the element is a descendant of a heading or title, false otherwise.
4295
+ */
4296
+ isHeadingOrTitleChild(element) {
4297
+ let current = element.parentElement;
4298
+ while (current) {
4299
+ if (current.matches(this.toBeCheckedSelector))
4300
+ return true;
4301
+ // Stop traversing upward if we reach a block element to prevent unbounded traversal to the document root. The title children will always be wrapped in a div, so we can safely stop at div as well.
4302
+ if (TitleHeadingNodeFilterStylesStrategy.NON_HEADING_TITLE_ELEMENT_TAGS.includes(current.tagName))
4303
+ return false;
4304
+ current = current.parentElement;
4305
+ }
4306
+ return false;
4307
+ }
4308
+ }
4309
+ TitleHeadingNodeFilterStylesStrategy.BOLD_STYLES = {
4310
+ fontWeight: '700',
4311
+ };
4312
+ TitleHeadingNodeFilterStylesStrategy.NON_HEADING_TITLE_ELEMENT_TAGS = [
4313
+ 'TD',
4314
+ 'TH',
4315
+ 'TR',
4316
+ 'TABLE',
4317
+ 'THEAD',
4318
+ 'TBODY',
4319
+ 'DIV',
4320
+ 'BODY',
4321
+ ];
4322
+
4323
+ /**
4324
+ * Filters the default heading styles from customStyle when parsing an RTEListItemBlock that is supposed to be a heading.
4325
+ */
4326
+ class ListHeadingItemBlockFilterStylesStrategy extends HeadingFilterStylesStrategy {
4327
+ constructor(level) {
4328
+ super(level);
4329
+ this.classNameToBeAdded = `v-rte-h${level}`;
4330
+ this.elementTagName = 'li';
4331
+ }
4332
+ /**
4333
+ * Check the important font-size and line-height for list item block are default styles, and the block is a list item block.
4334
+ *
4335
+ * @inheritDoc
4336
+ */
4337
+ canFilter(blockOrNodeInstance) {
4338
+ return (Predicate$1.isListItemBlock(blockOrNodeInstance.constructor.name) &&
4339
+ this.isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance, ['fontSize', 'lineHeight']));
4340
+ }
4341
+ /**
4342
+ * @inheritDoc
4343
+ */
4344
+ canRefill(blockOrNodeClassName, element) {
4345
+ return (Predicate$1.isListItemBlock(blockOrNodeClassName) &&
4346
+ element.matches(this.elementTagName) &&
4347
+ element.classList.contains(this.classNameToBeAdded));
4348
+ }
4349
+ }
4350
+
4351
+ /**
4352
+ * Filters the default title/subtitle styles from customStyle when parsing an RTEListItemBlock that is supposed to be a title/subtitle.
4353
+ */
4354
+ class ListTitleItemBlockFilterStylesStrategy extends TitleFilterStylesStrategy {
4355
+ constructor(type) {
4356
+ super(type);
4357
+ this.classNameToBeAdded = `v-rte-${type}`;
4358
+ this.elementTagName = 'li';
4359
+ }
4360
+ /**
4361
+ * Check the important font-size and line-height for list item block are default styles, and the block is a list item block.
4362
+ *
4363
+ * @inheritDoc
4364
+ */
4365
+ canFilter(blockOrNodeInstance) {
4366
+ return (Predicate$1.isListItemBlock(blockOrNodeInstance.constructor.name) &&
4367
+ this.isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance, ['fontSize', 'lineHeight']));
4368
+ }
4369
+ /**
4370
+ * @inheritDoc
4371
+ */
4372
+ canRefill(blockOrNodeClassName, element) {
4373
+ return (Predicate$1.isListItemBlock(blockOrNodeClassName) &&
4374
+ element.matches(this.elementTagName) &&
4375
+ element.classList.contains(this.classNameToBeAdded));
4376
+ }
4377
+ }
4378
+
4379
+ /**
4380
+ * Register and setup the default DTO classes and their basic action strategies.
4381
+ */
4382
+ // Register the default block DTOs
4383
+ RTEDTOClassManager.registerRTEDTOClass('paragraph', RTETextBlock);
4384
+ RTEDTOClassManager.registerRTEDTOClass('title', RTETextBlock);
4385
+ RTEDTOClassManager.registerRTEDTOClass('subtitle', RTETextBlock);
4386
+ RTEDTOClassManager.registerRTEDTOClass('heading-1', RTETextBlock);
4387
+ RTEDTOClassManager.registerRTEDTOClass('heading-2', RTETextBlock);
4388
+ RTEDTOClassManager.registerRTEDTOClass('heading-3', RTETextBlock);
4389
+ RTEDTOClassManager.registerRTEDTOClass('heading-4', RTETextBlock);
4390
+ RTEDTOClassManager.registerRTEDTOClass('heading-5', RTETextBlock);
4391
+ RTEDTOClassManager.registerRTEDTOClass('heading-6', RTETextBlock);
4392
+ RTEDTOClassManager.registerRTEDTOClass('heading-6', RTETextBlock);
4393
+ RTEDTOClassManager.registerRTEDTOClass('list-item', RTEListItemBlock);
4394
+ RTEDTOClassManager.registerRTEDTOClass('bullet-list', RTEListBlock);
4395
+ RTEDTOClassManager.registerRTEDTOClass('number-list', RTEListBlock);
4396
+ RTEDTOClassManager.registerRTEDTOClass('image', RTEImageBlock);
4397
+ RTEDTOClassManager.registerRTEDTOClass('code-block', RTECodeBlock);
4398
+ RTEDTOClassManager.registerRTEDTOClass('html-block', RTEHtmlBlock);
4399
+ // Register the default node DTOs
4400
+ RTEDTOClassManager.registerRTEDTOClass('text', RTETextNode);
4401
+ RTEDTOClassManager.registerRTEDTOClass('image', RTEImageNode);
4402
+ // Register basic strategies for default block DTOs
4403
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTETextBlock.name);
4404
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEListBlock.name);
4405
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEListItemBlock.name);
4406
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEImageBlock.name);
4407
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEHtmlBlock.name);
4408
+ // Register element to DTO strategies for default node DTOs, The order of registration matters, the later registered strategy has higher priority.
4409
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ContinueInlineToRTETextBlockStrategy());
4410
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new SpanImageToRTEImageBlockStrategy());
4411
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new VegaImageToRTEImageBlockStrategy());
4412
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ImgToRTEImageBlockStrategy());
4413
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new InlineBlockToRTETextBlockStrategy());
4414
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new LiToRTEListItemBlockStrategy());
4415
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ULNotLiChildToRTEListItemBlockStrategy());
4416
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new OlToRTEListBlockStrategy());
4417
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new UlToRTEListBlockStrategy());
4418
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new HtmlBlockStrategy());
4419
+ //!important: Code block strategies must be registered after HtmlBlockStrategy because registerElementToBlockStrategy uses unshift, giving later registrations higher priority.
4420
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new JiraCodeToRTECodeBlockStrategy());
4421
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new VegaCodeBlockToRTECodeBlockStrategy());
4422
+ ElementToDTOClassStrategyManager.registerElementToNodeStrategy(new InlineElementToTextNodeStrategy());
4423
+ ElementToDTOClassStrategyManager.registerElementToNodeStrategy(new PlainTextToTextNodeStrategy());
4424
+ // Register filter styles strategies (remove redundant default styles during HTML → DTO conversion)
4425
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new AlignmentFilterStylesStrategy());
4426
+ RTEFilterStylesStrategyRegistry.register(RTEListBlock.name, new AlignmentFilterStylesStrategy());
4427
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new AlignmentFilterStylesStrategy());
4428
+ RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new TextFormatFilterStylesStrategy());
4429
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new ParagraphFilterStylesStrategy());
4430
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(1));
4431
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(2));
4432
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(3));
4433
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(4));
4434
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(5));
4435
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(6));
4436
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new TitleFilterStylesStrategy('title'));
4437
+ RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new TitleFilterStylesStrategy('subtitle'));
4438
+ RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new TitleHeadingNodeFilterStylesStrategy());
4439
+ RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new CodeFilterStylesStrategy());
4440
+ RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new LinkFilterStylesStrategy());
4441
+ RTEFilterStylesStrategyRegistry.register(RTEImageNode.name, new ImageFilterStylesStrategy());
4442
+ RTEFilterStylesStrategyRegistry.register(RTECodeBlock.name, new CodeBlockFilterStylesStrategy());
4443
+ RTEFilterStylesStrategyRegistry.register(RTECodeBlockNode.name, new CodeBlockNodeFilterStylesStrategy());
4444
+ RTEFilterStylesStrategyRegistry.register(RTEListBlock.name, new ListBlockFilterStylesStrategy());
4445
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListItemBlockFilterStylesStrategy());
4446
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(1));
4447
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(2));
4448
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(3));
4449
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(4));
4450
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(5));
4451
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(6));
4452
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListTitleItemBlockFilterStylesStrategy('title'));
4453
+ RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListTitleItemBlockFilterStylesStrategy('subtitle'));
4454
+
4455
+ /**
4456
+ * StylePreservator handles CSP-compliant style management by temporarily converting
4457
+ * inline styles to data attributes during HTML parsing operations.
4458
+ *
4459
+ * @example
4460
+ * ```typescript
4461
+ * const context = StylePreservator.preserve('<div style="color: red;">Content</div>');
4462
+ * const safeHtml = context.getProcessedHtml();
4463
+ * context.restore(parsedElements);
4464
+ * ```
4465
+ */
4466
+ class StylePreservator {
4467
+ /**
4468
+ * Preserves inline styles by converting them to data attributes.
4469
+ *
4470
+ * @param {string} htmlString - The HTML string containing inline styles
4471
+ * @returns {StylePreservationContext} A context object for later style restoration
4472
+ */
4473
+ static preserve(htmlString) {
4474
+ const processedHtml = htmlString.replace(/\s+style=/g, ' data-style=');
4475
+ return new StylePreservationContext(processedHtml);
4476
+ }
4477
+ }
4478
+ /**
4479
+ * Context class that manages the lifecycle of preserved styles.
4480
+ */
4481
+ class StylePreservationContext {
4482
+ constructor(processedHtml) {
4483
+ this.processedHtml = processedHtml;
4484
+ }
4485
+ /**
4486
+ * Returns the HTML string with style attributes converted to data-style.
4487
+ *
4488
+ * @returns {string} The processed HTML string
4489
+ */
4490
+ getProcessedHtml() {
4491
+ return this.processedHtml;
4492
+ }
4493
+ /**
4494
+ * Restores data-style attributes back to style attributes.
4495
+ *
4496
+ * @param {HTMLElement[]} elements - Array of HTML elements to process
4497
+ * @returns {void}
4498
+ */
4499
+ restore(elements) {
4500
+ this.walkNodes(elements);
4501
+ }
4502
+ /**
4503
+ * Recursively walk through nodes and restore styles
4504
+ *
4505
+ * @param {HTMLElement[]} elements - list of nodes
4506
+ * @returns {void}
4507
+ */
4508
+ walkNodes(elements) {
4509
+ elements.forEach((element) => {
4510
+ if (isHTMLElement(element)) {
4511
+ // Restore data-style back to style
4512
+ const dataStyle = element.getAttribute('data-style');
4513
+ if (dataStyle) {
4514
+ element.style.cssText = dataStyle;
4515
+ element.removeAttribute('data-style');
4516
+ }
4517
+ // Recursively process child nodes
4518
+ if (element.children.length > 0) {
4519
+ this.walkNodes(Array.from(element.children));
4520
+ }
4521
+ }
4522
+ });
4523
+ }
4524
+ }
4525
+
4526
+ /**
4527
+ * Removes whitespace between tags, except preserves ALL whitespace between matching opening/closing tag pairs.
4528
+ *
4529
+ * This processor scans for patterns of `<tag>(whitespace)<tag>` and:
4530
+ * - If the first tag is an opening tag and the second tag is its matching closing tag (e.g., `<span> </span>`),
4531
+ * preserves ALL the whitespace between them (including spaces, tabs, newlines)
4532
+ * - Otherwise, removes all the whitespace between the tags
4533
+ *
4534
+ * Examples:
4535
+ * - `</p>\n\t<div>` → `</p><div>` (different tags: closing p, opening div - whitespace removed)
4536
+ * - `<div>\n\t<span>` → `<div><span>` (different tags: opening div, opening span - whitespace removed)
4537
+ * - `<span> </span>` → `<span> </span>` (matching tags: opening span, closing span - space preserved)
4538
+ * - `<span> </span>` → `<span> </span>` (matching tags - multiple spaces preserved)
4539
+ * - `<span>\n\t</span>` → `<span>\n\t</span>` (matching tags - \n\t preserved)
4540
+ * - `<code> </code>` → `<code> </code>` (matching tags - space preserved)
4541
+ * - `</div> <p>` → `</div><p>` (different tags: closing div, opening p - whitespace removed)
4542
+ */
4543
+ class RemoveWhitespaceBetweenTagsProcessor {
4544
+ /**
4545
+ * Process the HTML string to remove whitespace between non-matching tags.
4546
+ *
4547
+ * @param {string} html - The HTML string to process.
4548
+ * @returns {string} The processed HTML string.
4549
+ */
4550
+ process(html) {
4551
+ return html.replace(/(<[^>]+>)(\s+)(<[^>]+>)/g, (_match, tag1, whitespace, tag2) => {
4552
+ const openingTagName = this.extractOpeningTagName(tag1);
4553
+ const closingTagName = this.extractClosingTagName(tag2);
4554
+ // Preserve all whitespace if tags match (e.g., <span> </span>)
4555
+ if (openingTagName && closingTagName && openingTagName === closingTagName) {
4556
+ return `${tag1}${whitespace}${tag2}`;
4557
+ }
4558
+ // Remove whitespace for non-matching tags
4559
+ return `${tag1}${tag2}`;
4560
+ });
4561
+ }
4562
+ /**
4563
+ * Extracts the tag name from an opening HTML tag.
4564
+ *
4565
+ * Supports standard HTML tags (div, span, h1, etc.) and custom elements with hyphens (my-component).
4566
+ *
4567
+ * Examples:
4568
+ * - `<span>` → `span`
4569
+ * - `<div class="test">` → `div`
4570
+ * - `<my-component id="123">` → `my-component`
4571
+ * - `</span>` → `null` (not an opening tag)
4572
+ *
4573
+ * @param {string} tag - The tag string to extract from (e.g., '<span>', '<div class="test">').
4574
+ * @returns {string | null} The tag name or null if not an opening tag.
4575
+ * @private
4576
+ */
4577
+ extractOpeningTagName(tag) {
4578
+ // Pattern: <(tag name) where tag name starts with letter, followed by letters/numbers/hyphens
4579
+ const match = tag.match(/<(\w[\w-]*)/);
4580
+ return match ? match[1] : null;
4581
+ }
4582
+ /**
4583
+ * Extracts the tag name from a closing HTML tag.
4584
+ *
4585
+ * Supports standard HTML tags (div, span, h1, etc.) and custom elements with hyphens (my-component).
4586
+ *
4587
+ * Examples:
4588
+ * - `</span>` → `span`
4589
+ * - `</div>` → `div`
4590
+ * - `</my-component>` → `my-component`
4591
+ * - `<span>` → `null` (not a closing tag)
4592
+ *
4593
+ * @param {string} tag - The tag string to extract from (e.g., '</span>', '</div>').
4594
+ * @returns {string | null} The tag name or null if not a closing tag.
4595
+ * @private
4596
+ */
4597
+ extractClosingTagName(tag) {
4598
+ // Pattern: </(tag name) where tag name starts with letter, followed by letters/numbers/hyphens
4599
+ const match = tag.match(/<\/(\w[\w-]*)/);
4600
+ return match ? match[1] : null;
4601
+ }
4602
+ }
4603
+
4604
+ /**
4605
+ * Removes `\n` and `\t` characters after opening tags (before text content).
4606
+ *
4607
+ * Transforms patterns like `>[\n\t]+(text)` to `>(text)`.
4608
+ *
4609
+ * Examples:
4610
+ * - `<p>\n\tHello` → `<p>Hello`
4611
+ * - `<div>\n\n\tWorld` → `<div>World`
4612
+ */
4613
+ class RemoveWhitespaceAfterOpeningTagProcessor {
4614
+ /**
4615
+ * Process the HTML string to remove `\n` and `\t` after opening tags.
4616
+ *
4617
+ * @param {string} html - The HTML string to process.
4618
+ * @returns {string} The processed HTML string.
4619
+ */
4620
+ process(html) {
4621
+ // Pattern: `>[\n\t]+(text)` → `>(text)`
4622
+ return html.replace(/(>)[\n\t]+(?=.)/g, '$1');
4623
+ }
4624
+ }
4625
+
4626
+ /**
4627
+ * Removes `\n` and `\t` characters before closing tags (after text content).
4628
+ *
4629
+ * Transforms patterns like `(text)[\n\t]+<` to `(text)<`.
4630
+ *
4631
+ * Examples:
4632
+ * - `World\n\t</p>` → `World</p>`
4633
+ * - `Hello\n</div>` → `Hello</div>`
4634
+ */
4635
+ class RemoveWhitespaceBeforeClosingTagProcessor {
4636
+ /**
4637
+ * Process the HTML string to remove `\n` and `\t` before closing tags.
4638
+ *
4639
+ * @param {string} html - The HTML string to process.
4640
+ * @returns {string} The processed HTML string.
4641
+ */
4642
+ process(html) {
4643
+ // Pattern: `(text)[\n\t]+<` → `(text)<`
4644
+ return html.replace(/(.?)[\n\t]+(?=<)/g, '$1');
4645
+ }
4646
+ }
4647
+
4648
+ /**
4649
+ * Main HTML content cleaner that orchestrates multiple cleaning processors.
4650
+ *
4651
+ * This class implements a chain of responsibility pattern where each processor
4652
+ * handles a specific aspect of HTML cleaning. The processors are applied in sequence
4653
+ * and the entire chain is repeated until no more changes occur.
4654
+ *
4655
+ * Processors (in order):
4656
+ * 1. RemoveWhitespaceBetweenTagsProcessor - Removes whitespace between non-matching tags
4657
+ * 2. RemoveWhitespaceAfterOpeningTagProcessor - Removes \n and \t after opening tags
4658
+ * 3. RemoveWhitespaceBeforeClosingTagProcessor - Removes \n and \t before closing tags
4659
+ */
4660
+ class HTMLContentCleaner {
4661
+ constructor() {
4662
+ this.processors = [
4663
+ new RemoveWhitespaceBetweenTagsProcessor(),
4664
+ new RemoveWhitespaceAfterOpeningTagProcessor(),
4665
+ new RemoveWhitespaceBeforeClosingTagProcessor(),
4666
+ ];
4667
+ }
4668
+ /**
4669
+ * Cleans HTML by applying all processors in the chain repeatedly until no changes occur.
4670
+ *
4671
+ * The cleaning process:
4672
+ * 1. Applies each processor in sequence
4673
+ * 2. Compares the result with the input
4674
+ * 3. If changes were made, repeats the process
4675
+ * 4. Returns the final cleaned HTML
4676
+ *
4677
+ * Examples of transformations:
4678
+ * - `<p>\n\t <span>test</span>\n\t </p>` → `<p><span>test</span></p>`
4679
+ * - `<p>\n\tHello</p>` → `<p>Hello</p>`
4680
+ * - `<p>Hello\n\t</p>` → `<p>Hello</p>`
4681
+ * - `<span> </span>` → `<span> </span>` (preserved - matching tags)
4682
+ * - `<p>Hello World</p>` → `<p>Hello World</p>` (preserved - regular spaces)
4683
+ *
4684
+ * @param {string} html - The HTML string to clean.
4685
+ * @returns {string} The cleaned HTML string.
4686
+ */
4687
+ clean(html) {
4688
+ if (!html || html.trim().length === 0) {
4689
+ return html;
4690
+ }
4691
+ let result = html;
4692
+ let previousResult;
4693
+ // Keep processing until no more changes occur
4694
+ do {
4695
+ previousResult = result;
4696
+ // Apply each processor in the chain
4697
+ for (const processor of this.processors) {
4698
+ result = processor.process(result);
4699
+ }
4700
+ } while (result !== previousResult);
4701
+ return result;
4702
+ }
4703
+ }
4704
+
4705
+ /**
4706
+ * Class representing the content state of the rich text editor.
4707
+ */
4708
+ class VegaRTEContent {
4709
+ constructor(blocks) {
4710
+ blocks.forEach((block) => {
4711
+ block.parent = this;
4712
+ });
4713
+ this.children = blocks;
4714
+ }
4715
+ /**
4716
+ * Converts a JSON array of blocks to a class array of RTEContentBlock.
4717
+ *
4718
+ * @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
4719
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
4720
+ * @returns {VegaRTEContent} The converted array of RTEContentBlock.
4721
+ */
4722
+ static fromJSON(value, options = { autoMatchFormat: true }) {
4723
+ const blocks = value.map((block) => {
4724
+ const BlockClass = RTEDTOClassManager.getRTEBlockClass(block.type);
4725
+ if (BlockClass) {
4726
+ return BlockClass.from(block, options);
4727
+ }
4728
+ else {
4729
+ throw new Error(`[Vega] Unknown block type: ${block.type}`);
4730
+ }
4731
+ });
4732
+ return new VegaRTEContent(blocks);
4733
+ }
4734
+ /**
4735
+ * Create an empty content state
4736
+ *
4737
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
4738
+ * @returns {VegaRTEContent} An empty content state
4739
+ */
4740
+ static createEmptyContent(options = { autoMatchFormat: true }) {
4741
+ return VegaRTEContent.fromJSON([
4742
+ {
4743
+ id: generateUUID(),
4744
+ type: 'paragraph',
4745
+ annotations: {
4746
+ internalWrapper: !options.autoMatchFormat,
4747
+ },
4748
+ nodes: [
4749
+ {
4750
+ id: generateUUID(),
4751
+ annotations: { plainText: !options.autoMatchFormat },
4752
+ type: 'text',
4753
+ text: '',
4754
+ },
4755
+ ],
4756
+ },
4757
+ ], options);
4758
+ }
4759
+ /**
4760
+ * Converts HTML content to a VegaRTEContent instance.
4761
+ *
4762
+ * @param {string} html - The HTML string to convert.
4763
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
4764
+ * @returns {VegaRTEContent} The converted content state.
4765
+ */
4766
+ static fromHtml(html, options = { autoMatchFormat: true, skipCustomAnnotations: false }) {
4767
+ const cleaner = new HTMLContentCleaner();
4768
+ const formattedHtml = cleaner.clean(html);
4769
+ const context = StylePreservator.preserve(formattedHtml);
4770
+ const safeHtml = context.getProcessedHtml();
4771
+ const body = new DOMParser().parseFromString(safeHtml, 'text/html').body;
4772
+ const htmlElements = Array.from(body.childNodes);
4773
+ context.restore(htmlElements);
4774
+ const blocks = ElementToDtoStrategyProcessor$1.process(htmlElements, options)
4775
+ .filter(isNonNullable)
4776
+ .map((output) => output.toDto(options))
4777
+ .filter(isNonNullable);
4778
+ return new VegaRTEContent(blocks);
4779
+ }
4780
+ /**
4781
+ * Generates the content style file for the rich text editor based on the registered filter styles strategies.
4782
+ *
4783
+ * @param {VegaRTEGenerateStyleOptions} options - Options for generating the content style file.
4784
+ * @returns {string} The html template style text.
4785
+ */
4786
+ static generateContentStyles(options) {
4787
+ return RTEFilterStylesStrategyRegistry.generateAllStylesContent(options === null || options === void 0 ? void 0 : options.enableFontImports);
4788
+ }
4789
+ /**
4790
+ * Clones the content state.
4791
+ *
4792
+ * @param {boolean} deep - If true, performs a deep clone of the content state.
4793
+ * @returns {VegaRTEContent} The cloned content state.
4794
+ */
4795
+ clone(deep = false) {
4796
+ return deep
4797
+ ? new VegaRTEContent(this.children.map((block) => block.clone(this)))
4798
+ : new VegaRTEContent([...this.children]);
4799
+ }
4800
+ /**
4801
+ * Converts the content state to a JSON array of blocks.
4802
+ *
4803
+ * @returns {VegaRTEContentBlock[]} The JSON array of blocks.
4804
+ */
4805
+ toJSON() {
4806
+ return this.children.map((block) => block.toJSON());
4807
+ }
4808
+ /**
4809
+ * Converts the content state to HTML.
4810
+ *
4811
+ * @param {VegaRTETransformOptions} [options] - The conversion options.
4812
+ * @returns {string} The HTML representation of the content state.
4813
+ */
4814
+ toHtml(options) {
4815
+ if (options &&
4816
+ (isNonNullable(options.autoMatchFormat) || isNonNullable(options.skipCustomAnnotations))) {
4817
+ LogUtility.warn(`The 'options' parameter's properties 'autoMatchFormat' and 'skipCustomAnnotations' in toHtml method are deprecated and will be removed in the future.`);
4818
+ }
4819
+ if (this.isEmpty()) {
4820
+ return '';
4821
+ }
4822
+ return this.children
4823
+ .map((block) => block.toHtml({ filterInlineStyles: options === null || options === void 0 ? void 0 : options.filterInlineStyles }))
4824
+ .join('');
4825
+ }
4826
+ /**
4827
+ * Checks if the content state is empty.
4828
+ *
4829
+ * @returns {boolean} True if the content state is empty, false otherwise.
4830
+ */
4831
+ isEmpty() {
4832
+ if (this.children.length === 0) {
4833
+ return true;
4834
+ }
4835
+ if (this.children.length === 1) {
4836
+ const block = this.children[0];
4837
+ return !block.isNotEmpty();
4838
+ }
4839
+ return false;
4840
+ }
4841
+ /**
4842
+ * Internal method to add the block item, remove the block item
4843
+ *
4844
+ * @param {ModifyContentAction} action - Modify content action
4845
+ */
4846
+ apply(action) {
4847
+ ActionHandleStrategyRegistry.executeTheStrategy(action, this);
4848
+ // Check if the action has been executed and is flushable
4849
+ if (action['executedFlag'] && action.isFlushable) {
4850
+ const host = stateEntityRenderingRegistry.getDOMByEntity(this);
4851
+ if (host) {
4852
+ ChangeManager.notify(domNodeSubjectFactory.getSubject(host, VegaInternalRichTextEditorFlushChanges), {});
4853
+ }
4854
+ }
4855
+ }
4856
+ /**
4857
+ * Get the last node in the content.
4858
+ *
4859
+ * @returns {Nullable<RTENode>} The last node in the content or null if there are no nodes.
4860
+ */
4861
+ getLastNode() {
4862
+ if (this.children.length === 0) {
4863
+ return null;
4864
+ }
4865
+ const lastBlock = this.children[this.children.length - 1];
4866
+ return lastBlock.getLastNode();
4867
+ }
4868
+ /**
4869
+ * Convert text to list.
4870
+ *
4871
+ * @param {RTETextBlock} block - block
4872
+ * @returns {RTEListItemBlock} list item block dto.
4873
+ */
4874
+ toListItem(block) {
4875
+ block.children.map((node) => node.apply(new SyncUpSelectionAction()));
4876
+ const listItemBlock = new RTEListItemBlock(generateUUID());
4877
+ listItemBlock.apply(new AppendChildrenAction(block['children']));
4878
+ listItemBlock['annotationMap'] = block['annotationMap'];
4879
+ return listItemBlock;
4880
+ }
4881
+ /**
4882
+ * create list.
4883
+ *
4884
+ * @param {ListType} type - type
4885
+ * @returns {RTEListBlock} list block dto.
4886
+ */
4887
+ createList(type) {
4888
+ return new RTEListBlock(generateUUID(), type);
4889
+ }
4890
+ /**
4891
+ * Finds a node by its ID in the content.
4892
+ *
4893
+ * @param {string} id - The ID of the node to find.
4894
+ * @returns {Nullable<RTENode>} The found node or null if not found.
4895
+ */
4896
+ findNodeById(id) {
4897
+ return this.findNodeInBlocksById(id, this.children);
4898
+ }
4899
+ /**
4900
+ * Recursively searches for a node by its ID in the given blocks.
4901
+ *
4902
+ * @param {string} id - The ID of the node to find.
4903
+ * @param {RTEContentBlock[]} blocks - The blocks to search within.
4904
+ * @returns {Nullable<RTENode>} The found node or null if not found.
4905
+ */
4906
+ findNodeInBlocksById(id, blocks) {
4907
+ for (const block of blocks) {
4908
+ if ('children' in block) {
4909
+ for (const node of block.children) {
4910
+ if (node.id === id) {
4911
+ return node;
4912
+ }
4913
+ }
4914
+ }
4915
+ if (block instanceof RTEListItemBlock && block.nestList) {
4916
+ for (const cBlock of block.nestList) {
4917
+ const foundNode = this.findNodeInBlocksById(id, cBlock.children);
4918
+ if (foundNode) {
4919
+ return foundNode;
4920
+ }
4921
+ }
4922
+ }
4923
+ if (block instanceof RTEListBlock && block.children) {
4924
+ const foundNode = this.findNodeInBlocksById(id, block.children);
4925
+ if (foundNode) {
4926
+ return foundNode;
4927
+ }
4928
+ }
4929
+ }
4930
+ return null;
4931
+ }
4932
+ }
4933
+ (() => {
4934
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILDREN, VegaRTEContent.name, new RemoveChildrenStrategy());
4935
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILDREN, VegaRTEContent.name, new AppendChildrenStrategy());
4936
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_CHILDREN_BEFORE, VegaRTEContent.name, new InsertChildrenBeforeStrategy());
4937
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_CHILDREN_AFTER, VegaRTEContent.name, new InsertChildrenAfterStrategy());
4938
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_TO_CODE_BLOCK, VegaRTEContent.name, new BlockTransformToCodeBlockStrategy());
4939
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_CURSOR_POSITION, VegaRTEContent.name, new UpdateCursorPositionStrategy());
4940
+ })();
4941
+
4942
+ export { AnnotationGeneratorStrategyAbstract as A, BlockToRTEBlockStrategyAbstract as B, ElementToDTOClassStrategyManager as E, InsertNewParagraphAction as I, MergeTwoBlocksNodesAction as M, PasteContentStrategy as P, RTEDTOActionStrategyManager$1 as R, StylePreservator as S, UpdateCursorPositionAction as U, VegaRTEContent as V, ElementToDTOStrategy as a, RTEImageBlock as b, InsertChildrenBeforeStrategy as c, RTEListItemBlock as d, RTEListBlock as e, RTEImageNode as f, ImageAnnotation as g, htmlElementToAnnotationGenerator as h, ElementToDtoStrategyProcessor$1 as i };