@globalpayments/vega 2.32.0 → 2.34.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 (904) hide show
  1. package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
  2. package/dist/cjs/{app-globals-19032674.js → app-globals-4e819773.js} +31 -22
  3. package/dist/cjs/block-annotation.abstract-4d88b939.js +875 -0
  4. package/dist/cjs/{breakpoints-7e2dff90.js → breakpoints-17d6c4c7.js} +2 -13
  5. package/dist/cjs/breakpoints-ebde4837.js +14 -0
  6. package/dist/cjs/{change-manager-a297e4d2.js → change-manager-bda1d107.js} +1 -1
  7. package/dist/cjs/{chevron-down-ca2fa88e.js → chevron-down-9847bf78.js} +0 -5
  8. package/dist/cjs/chevron-up-21465cf7.js +7 -0
  9. package/dist/cjs/{child-nodes-event-prevent-slimmer-88ed23c2.js → child-nodes-event-prevent-slimmer-e1a6e5ad.js} +3 -3
  10. package/dist/cjs/{child-nodes-notify-observer-slimmer-79f2f5a7.js → child-nodes-notify-observer-slimmer-03a3f79e.js} +5 -5
  11. package/dist/cjs/{component-73a88c4e.js → component-63af66ea.js} +1 -1
  12. package/dist/cjs/{component-global-style-slimmer-6749808c.js → component-global-style-slimmer-6b64a26c.js} +1 -1
  13. package/dist/cjs/{component-usage-runtime-metrics-1ee24991.js → component-usage-runtime-metrics-019d3c00.js} +2 -2
  14. package/dist/cjs/content-state-3a2724f6.js +2184 -0
  15. package/dist/cjs/{create-public-api-runtime-metrics-slimmer-5cc88124.js → create-public-api-runtime-metrics-slimmer-8c6a8fb7.js} +3 -3
  16. package/dist/cjs/{date-0a6bb035.js → date-ffe382a4.js} +1 -1
  17. package/dist/cjs/{deprecated-property-slimmer-fc729fd9.js → deprecated-property-slimmer-f36e3779.js} +2 -2
  18. package/dist/cjs/{design-token-92906579.js → design-token-908e3f69.js} +5 -5
  19. package/dist/cjs/{vega-event-id-81270f6a.js → dom-node-subject-observer-factory-093462f1.js} +170 -0
  20. package/dist/cjs/{dynamic-slimmer-f31fdfd7.js → dynamic-slimmer-dc30600a.js} +1 -1
  21. package/dist/cjs/{element-appender-slimmer-415d261a.js → element-appender-slimmer-0dd70e61.js} +17 -10
  22. package/dist/cjs/{event-emit-slimmer-83278943.js → event-emit-slimmer-a46bb411.js} +5 -5
  23. package/dist/cjs/{feature-flag-controller-f9d3ce38.js → feature-flag-controller-e97b5f29.js} +3 -3
  24. package/dist/cjs/{form-field-controller-slimmer-2a982ead.js → form-field-controller-slimmer-9aeabcdc.js} +16 -17
  25. package/dist/cjs/{index-09acd3c9.js → global-slimmer-registry-dd2691b8.js} +296 -274
  26. package/dist/cjs/{icon-manager-3787af39.js → icon-manager-36dcfb65.js} +2 -2
  27. package/dist/cjs/index-8b247c17.js +325 -0
  28. package/dist/cjs/index.cjs.js +37 -30
  29. package/dist/cjs/{inject-keyboard-manager-e79a1ade.js → inject-keyboard-manager-af37c861.js} +1 -1
  30. package/dist/cjs/{internal-icon-manager-2ff58050.js → internal-icon-manager-2282a62f.js} +1 -1
  31. package/dist/cjs/{internal-vega-event-manager-5fe83465.js → internal-vega-event-manager-d7643ec6.js} +72 -68
  32. package/dist/cjs/{internal-vega-z-index-manager-f03ddb37.js → internal-vega-z-index-manager-e24e4309.js} +1 -1
  33. package/dist/cjs/{keyboard-manager-34b78600.js → keyboard-manager-5afbc8f1.js} +1 -1
  34. package/dist/cjs/{keyboard-manager-slimmer-8e2d4b5d.js → keyboard-manager-slimmer-9be2a880.js} +2 -2
  35. package/dist/cjs/loader.cjs.js +28 -23
  36. package/dist/cjs/{mutation-observer-slimmer-895b3d3e.js → mutation-observer-slimmer-98bbbdf0.js} +1 -1
  37. package/dist/cjs/{vega-skeleton-loader-controller-4a1eedcd.js → node.abstract-f8075f84.js} +234 -840
  38. package/dist/cjs/{page-resize-observer-slimmer-a8cf1874.js → page-resize-observer-slimmer-e54fa9d4.js} +2 -2
  39. package/dist/cjs/{remote-invocation-registry-32aaf6c2.js → remote-invocation-registry-71a45468.js} +4 -4
  40. package/dist/cjs/{required-field-rule-9a57b1a0.js → required-field-rule-7f9945fa.js} +2 -1
  41. package/dist/cjs/{responsive-format-facade-ad2f67bf.js → responsive-format-facade-74079f1b.js} +3 -3
  42. package/dist/cjs/{state-background-color-formatter-418b84e6.js → state-background-color-formatter-d32a1098.js} +2 -2
  43. package/dist/cjs/{static-subject-title-471e1793.js → static-subject-title-d66b88fb.js} +2 -0
  44. package/dist/cjs/{string-input-formatter-slimmer-79272527.js → string-input-formatter-slimmer-297765c0.js} +2 -2
  45. package/dist/cjs/{style-formatter-68f3a5f8.js → style-formatter-5deb065f.js} +2 -2
  46. package/dist/cjs/{sub-state-notify-slimmer-13f1892b.js → sub-state-notify-slimmer-73201c53.js} +6 -7
  47. package/dist/cjs/{sub-state-observer-slimmer-6c0b635d.js → sub-state-observer-slimmer-10c0d402.js} +6 -7
  48. package/dist/cjs/{synchronize-task-queue-8977cf10.js → synchronize-task-queue-1ee80e94.js} +10 -1
  49. package/dist/cjs/text-color-toolbar-button-slimmer-b1c9f40e.js +210 -0
  50. package/dist/cjs/text-node-0d12da5a.js +1077 -0
  51. package/dist/cjs/{translation-42c1b2c8.js → translation-f6b7ee84.js} +4 -4
  52. package/dist/cjs/{translation-slimmer-32aa13e7.js → translation-slimmer-90f9f71f.js} +2 -2
  53. package/dist/cjs/trash-can-46a5e19a.js +7 -0
  54. package/dist/cjs/{type-guard-a07b353b.js → type-guard-4ba85fdc.js} +18 -18
  55. package/dist/cjs/{ui-08f33116.js → ui-b5906704.js} +20 -1
  56. package/dist/cjs/vega-accordion.cjs.entry.js +46 -47
  57. package/dist/cjs/vega-app-footer.cjs.entry.js +12 -13
  58. package/dist/cjs/vega-app-header-button.cjs.entry.js +48 -48
  59. package/dist/cjs/vega-backdrop.cjs.entry.js +8 -9
  60. package/dist/cjs/vega-banner.cjs.entry.js +36 -38
  61. package/dist/cjs/vega-bar-chart.cjs.entry.js +5 -6
  62. package/dist/cjs/vega-box.cjs.entry.js +15 -15
  63. package/dist/cjs/vega-breadcrumb.cjs.entry.js +34 -36
  64. package/dist/cjs/vega-button-circle.cjs.entry.js +29 -30
  65. package/dist/cjs/vega-button-group_2.cjs.entry.js +32 -34
  66. package/dist/cjs/vega-button-link.cjs.entry.js +33 -28
  67. package/dist/cjs/vega-button.cjs.entry.js +30 -31
  68. package/dist/cjs/vega-calendar_3.cjs.entry.js +139 -140
  69. package/dist/cjs/vega-card.cjs.entry.js +13 -13
  70. package/dist/cjs/vega-carousel.cjs.entry.js +27 -29
  71. package/dist/cjs/vega-checkbox_2.cjs.entry.js +49 -50
  72. package/dist/cjs/vega-chip.cjs.entry.js +39 -40
  73. package/dist/cjs/vega-color-picker.cjs.entry.js +29 -31
  74. package/dist/cjs/vega-combo-box.cjs.entry.js +52 -53
  75. package/dist/cjs/vega-counter-badge.cjs.entry.js +9 -10
  76. package/dist/cjs/vega-date-picker_2.cjs.entry.js +149 -96
  77. package/dist/cjs/{vega-dialog-controller-dce8cdaf.js → vega-dialog-controller-aaf1f43e.js} +2 -2
  78. package/dist/cjs/vega-dialog_2.cjs.entry.js +50 -51
  79. package/dist/cjs/vega-divider.cjs.entry.js +13 -13
  80. package/dist/cjs/vega-dropdown_5.cjs.entry.js +133 -134
  81. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  82. package/dist/cjs/vega-field-error.cjs.entry.js +8 -9
  83. package/dist/cjs/vega-field-label.cjs.entry.js +20 -23
  84. package/dist/cjs/vega-file-uploader.cjs.entry.js +76 -81
  85. package/dist/cjs/vega-flex.cjs.entry.js +18 -17
  86. package/dist/cjs/vega-font.cjs.entry.js +16 -16
  87. package/dist/cjs/vega-form.cjs.entry.js +41 -42
  88. package/dist/cjs/vega-grid.cjs.entry.js +13 -13
  89. package/dist/cjs/vega-hint.cjs.entry.js +6 -7
  90. package/dist/cjs/vega-icon.cjs.entry.js +18 -18
  91. package/dist/cjs/vega-image-uploader.cjs.entry.js +57 -58
  92. package/dist/cjs/vega-input-credit-card.cjs.entry.js +42 -43
  93. package/dist/cjs/vega-input-numeric.cjs.entry.js +35 -36
  94. package/dist/cjs/vega-input-phone-number.cjs.entry.js +51 -52
  95. package/dist/cjs/vega-input-range.cjs.entry.js +44 -45
  96. package/dist/cjs/vega-input-select.cjs.entry.js +71 -71
  97. package/dist/cjs/vega-input.cjs.entry.js +50 -52
  98. package/dist/cjs/{vega-internal-event-id-79be9bc5.js → vega-internal-event-id-85b68849.js} +12 -0
  99. package/dist/cjs/vega-item-toggle.cjs.entry.js +19 -22
  100. package/dist/cjs/vega-left-nav_5.cjs.entry.js +107 -107
  101. package/dist/cjs/vega-line-chart.cjs.entry.js +6 -7
  102. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +18 -18
  103. package/dist/cjs/vega-page-notification_2.cjs.entry.js +18 -21
  104. package/dist/cjs/vega-pagination.cjs.entry.js +53 -55
  105. package/dist/cjs/vega-pie-chart.cjs.entry.js +6 -7
  106. package/dist/cjs/vega-popover_2.cjs.entry.js +72 -37
  107. package/dist/cjs/vega-progress-tracker.cjs.entry.js +27 -30
  108. package/dist/cjs/vega-radio_2.cjs.entry.js +53 -54
  109. package/dist/cjs/vega-rich-text-content.cjs.entry.js +179 -0
  110. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +4894 -0
  111. package/dist/cjs/vega-section-title.cjs.entry.js +14 -15
  112. package/dist/cjs/vega-segment-control.cjs.entry.js +24 -26
  113. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +53 -54
  114. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +64 -65
  115. package/dist/cjs/vega-sidenav_3.cjs.entry.js +48 -50
  116. package/dist/cjs/vega-signature-capture.cjs.entry.js +44 -46
  117. package/dist/cjs/vega-skeleton.cjs.entry.js +25 -26
  118. package/dist/cjs/vega-slot-container.cjs.entry.js +5 -6
  119. package/dist/cjs/vega-stepper.cjs.entry.js +38 -39
  120. package/dist/cjs/vega-tab-group_2.cjs.entry.js +58 -59
  121. package/dist/cjs/vega-table_8.cjs.entry.js +183 -183
  122. package/dist/cjs/vega-text.cjs.entry.js +10 -10
  123. package/dist/cjs/vega-textarea.cjs.entry.js +39 -40
  124. package/dist/cjs/vega-time-picker_2.cjs.entry.js +88 -89
  125. package/dist/cjs/vega-toggle-switch.cjs.entry.js +25 -27
  126. package/dist/cjs/vega-tooltip_2.cjs.entry.js +22 -22
  127. package/dist/cjs/vega.cjs.js +28 -23
  128. package/dist/collection/collection-manifest.json +18 -0
  129. package/dist/collection/components/vega-button-link/vega-button-link.js +34 -1
  130. package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.js +6 -4
  131. package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-input-renderer-base.abstract.js +55 -0
  132. package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-range-input-renderer.js +5 -9
  133. package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-renderer.js +3 -1
  134. package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-single-input-renderer.js +5 -9
  135. package/dist/collection/components/vega-date-picker/vega-date-picker.css +14 -0
  136. package/dist/collection/components/vega-date-picker/vega-date-picker.js +27 -0
  137. package/dist/collection/components/vega-file-uploader/vega-file-uploader.js +2 -2
  138. package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +42 -4
  139. package/dist/collection/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-state-controller.js +38 -0
  140. package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +59 -0
  141. package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +132 -0
  142. package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.js +124 -0
  143. package/dist/collection/components/vega-rich-text-editor/assets/align-center.js +3 -0
  144. package/dist/collection/components/vega-rich-text-editor/assets/align-justify.js +3 -0
  145. package/dist/collection/components/vega-rich-text-editor/assets/align-left.js +3 -0
  146. package/dist/collection/components/vega-rich-text-editor/assets/align-right.js +3 -0
  147. package/dist/collection/components/vega-rich-text-editor/assets/bold.js +3 -0
  148. package/dist/collection/components/vega-rich-text-editor/assets/code-simple.js +3 -0
  149. package/dist/collection/components/vega-rich-text-editor/assets/image.js +3 -0
  150. package/dist/collection/components/vega-rich-text-editor/assets/indent.js +3 -0
  151. package/dist/collection/components/vega-rich-text-editor/assets/italic.js +3 -0
  152. package/dist/collection/components/vega-rich-text-editor/assets/link.js +3 -0
  153. package/dist/collection/components/vega-rich-text-editor/assets/list-ol.js +3 -0
  154. package/dist/collection/components/vega-rich-text-editor/assets/list-ul.js +3 -0
  155. package/dist/collection/components/vega-rich-text-editor/assets/outdent.js +3 -0
  156. package/dist/collection/components/vega-rich-text-editor/assets/strikethrough.js +3 -0
  157. package/dist/collection/components/vega-rich-text-editor/assets/text-size.js +3 -0
  158. package/dist/collection/components/vega-rich-text-editor/assets/text-slash.js +3 -0
  159. package/dist/collection/components/vega-rich-text-editor/assets/text.js +3 -0
  160. package/dist/collection/components/vega-rich-text-editor/assets/underline.js +3 -0
  161. package/dist/collection/components/vega-rich-text-editor/constants/constant.js +33 -0
  162. package/dist/collection/components/vega-rich-text-editor/dto/actions/annotation-action.abstract.js +5 -0
  163. package/dist/collection/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.js +9 -0
  164. package/dist/collection/components/vega-rich-text-editor/dto/actions/bold-annotation-action.js +20 -0
  165. package/dist/collection/components/vega-rich-text-editor/dto/actions/break-single-block-action.js +16 -0
  166. package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.js +12 -0
  167. package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-formatting-annotation-action.js +19 -0
  168. package/dist/collection/components/vega-rich-text-editor/dto/actions/code-annotation-action.js +20 -0
  169. package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-block-content-action.js +14 -0
  170. package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-node-annotation-action.js +19 -0
  171. package/dist/collection/components/vega-rich-text-editor/dto/actions/horizontal-alignment-annotation-action.js +20 -0
  172. package/dist/collection/components/vega-rich-text-editor/dto/actions/image-annotation-action.js +21 -0
  173. package/dist/collection/components/vega-rich-text-editor/dto/actions/indent-annotation-action.js +20 -0
  174. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.js +14 -0
  175. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.js +14 -0
  176. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-image-to-block-action.js +16 -0
  177. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.js +14 -0
  178. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.js +14 -0
  179. package/dist/collection/components/vega-rich-text-editor/dto/actions/italic-annotation-action.js +20 -0
  180. package/dist/collection/components/vega-rich-text-editor/dto/actions/line-break-multiple-block-action.js +13 -0
  181. package/dist/collection/components/vega-rich-text-editor/dto/actions/line-break-single-block-action.js +14 -0
  182. package/dist/collection/components/vega-rich-text-editor/dto/actions/link-annotation-action.js +26 -0
  183. package/dist/collection/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.js +21 -0
  184. package/dist/collection/components/vega-rich-text-editor/dto/actions/merge-two-blocks-nodes-action.js +13 -0
  185. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +32 -0
  186. package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-child-action.js +14 -0
  187. package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-nest-list-action.js +13 -0
  188. package/dist/collection/components/vega-rich-text-editor/dto/actions/replace-child-nodes-action.js +13 -0
  189. package/dist/collection/components/vega-rich-text-editor/dto/actions/replace-nest-list-action.js +13 -0
  190. package/dist/collection/components/vega-rich-text-editor/dto/actions/replace-selected-text-action.js +15 -0
  191. package/dist/collection/components/vega-rich-text-editor/dto/actions/selection-change-action.js +20 -0
  192. package/dist/collection/components/vega-rich-text-editor/dto/actions/split-block-with-node-action.js +15 -0
  193. package/dist/collection/components/vega-rich-text-editor/dto/actions/splittable-action.abstract.js +13 -0
  194. package/dist/collection/components/vega-rich-text-editor/dto/actions/strikethrough-annotation-action.js +20 -0
  195. package/dist/collection/components/vega-rich-text-editor/dto/actions/sync-up-selection-action.js +18 -0
  196. package/dist/collection/components/vega-rich-text-editor/dto/actions/text-color-annotation-action.js +20 -0
  197. package/dist/collection/components/vega-rich-text-editor/dto/actions/text-style-annotation-action.js +21 -0
  198. package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-list-action.js +13 -0
  199. package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-paragraph-action.js +12 -0
  200. package/dist/collection/components/vega-rich-text-editor/dto/actions/underline-annotation-action.js +20 -0
  201. package/dist/collection/components/vega-rich-text-editor/dto/actions/update-text-action.js +14 -0
  202. package/dist/collection/components/vega-rich-text-editor/dto/annotations/annotation.abstract.js +11 -0
  203. package/dist/collection/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.js +12 -0
  204. package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +48 -0
  205. package/dist/collection/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.js +19 -0
  206. package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +55 -0
  207. package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +90 -0
  208. package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +66 -0
  209. package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +78 -0
  210. package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +47 -0
  211. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +62 -0
  212. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +102 -0
  213. package/dist/collection/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.js +18 -0
  214. package/dist/collection/components/vega-rich-text-editor/dto/annotations/selection-range-annotation.js +11 -0
  215. package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +57 -0
  216. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +85 -0
  217. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +105 -0
  218. package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +57 -0
  219. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +354 -0
  220. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +260 -0
  221. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +189 -0
  222. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +236 -0
  223. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +424 -0
  224. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +135 -0
  225. package/dist/collection/components/vega-rich-text-editor/dto/helper/block-base-operator.js +47 -0
  226. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +103 -0
  227. package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +103 -0
  228. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +297 -0
  229. package/dist/collection/components/vega-rich-text-editor/dto/range.js +178 -0
  230. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/focus-controller.js +73 -0
  231. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.js +135 -0
  232. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.js +74 -0
  233. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.js +47 -0
  234. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.js +39 -0
  235. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.js +50 -0
  236. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.js +41 -0
  237. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.js +57 -0
  238. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.js +56 -0
  239. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.js +77 -0
  240. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.js +44 -0
  241. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +191 -0
  242. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +108 -0
  243. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +100 -0
  244. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +90 -0
  245. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +91 -0
  246. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +93 -0
  247. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.js +117 -0
  248. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/rich-text-content-controller.js +15 -0
  249. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +294 -0
  250. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.js +38 -0
  251. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/text-node-color-controller.js +51 -0
  252. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/text-node-rendering-registry.js +26 -0
  253. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +201 -0
  254. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +91 -0
  255. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +97 -0
  256. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +51 -0
  257. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +70 -0
  258. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +70 -0
  259. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +68 -0
  260. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +46 -0
  261. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +47 -0
  262. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.js +47 -0
  263. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +77 -0
  264. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.js +47 -0
  265. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.js +47 -0
  266. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.js +47 -0
  267. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +72 -0
  268. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +49 -0
  269. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +46 -0
  270. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +97 -0
  271. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +45 -0
  272. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +52 -0
  273. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +129 -0
  274. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +128 -0
  275. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.js +62 -0
  276. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +52 -0
  277. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +126 -0
  278. package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-actions.test.js +38 -0
  279. package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +134 -0
  280. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/image-block.test.js +90 -0
  281. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-block.test.js +224 -0
  282. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-item.test.js +228 -0
  283. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/text-block.test.js +173 -0
  284. package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +172 -0
  285. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +93 -0
  286. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +433 -0
  287. package/dist/collection/components/vega-rich-text-editor/test/dto/range.test.js +53 -0
  288. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/slimmers/renderers/vega-rich-text-editor-toolbar-button-renderer.js +57 -0
  289. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.css +50 -0
  290. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.js +246 -0
  291. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +264 -0
  292. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +676 -0
  293. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/slimmers/renderers/vega-rich-text-image-editor-renderer.js +133 -0
  294. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/vega-rich-text-image-editor.css +13 -0
  295. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/vega-rich-text-image-editor.js +165 -0
  296. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.js +144 -0
  297. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.css +11 -0
  298. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.js +247 -0
  299. package/dist/collection/constants/ui.js +1 -0
  300. package/dist/collection/global/scripts/before-vega-load.js +9 -1
  301. package/dist/collection/helpers/change-manager/subject/static-subject/static-subject-title.js +1 -0
  302. package/dist/collection/helpers/common/index.js +27 -0
  303. package/dist/collection/helpers/common/test/wait-for-vega-handler.test.js +1 -1
  304. package/dist/collection/helpers/dialog/test/vega-dialog-controller.test.js +1 -1
  305. package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +5 -1
  306. package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +1 -0
  307. package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +6 -0
  308. package/dist/collection/helpers/event-manager/test/vega-event-manager.test.js +1 -1
  309. package/dist/collection/helpers/feature-control/feature-flag-controller.js +1 -1
  310. package/dist/collection/helpers/feature-control/tests/feature-flag-controller.test.js +1 -1
  311. package/dist/collection/helpers/icon/test/icon-manager-controller.test.js +1 -1
  312. package/dist/collection/helpers/loading-indicator/tests/vega-loader-controller.test.js +1 -1
  313. package/dist/collection/helpers/notify/tests/vega-notify-controller.test.js +1 -1
  314. package/dist/collection/helpers/public-api.js +1 -0
  315. package/dist/collection/helpers/queue/synchronize-task-queue.js +10 -1
  316. package/dist/collection/helpers/queue/test/synchronize-task-queue.test.js +28 -0
  317. package/dist/collection/helpers/skeleton-loader/tests/vega-skeleton-loader-controller.test.js +1 -1
  318. package/dist/collection/helpers/slimmers/component-usage-runtime-metrics.js +1 -1
  319. package/dist/collection/helpers/slimmers/dark-mode-state-controller-slimmer.js +46 -0
  320. package/dist/collection/helpers/slimmers/element-appender-slimmer.js +10 -3
  321. package/dist/collection/helpers/slimmers/runtime-metrics/public-api-runtime-metrics-slimmer-base.js +1 -1
  322. package/dist/collection/helpers/slimmers/runtime-metrics/test/public-api-runtime-metrics-slimmer-base.test.js +1 -1
  323. package/dist/collection/helpers/slimmers/test/component-usage-runtime-metrics.test.js +1 -1
  324. package/dist/collection/helpers/slimmers/test/dark-mode-state-controller.test.js +65 -0
  325. package/dist/collection/helpers/theme/controllers/dark-mode-style-controller.js +45 -3
  326. package/dist/collection/helpers/theme/tests/theme-manager-controller.test.js +2 -2
  327. package/dist/collection/helpers/theme/theme-manager.js +3 -0
  328. package/dist/collection/helpers/validator/rules/{file-uploader-required-rule.js → object-array-required-rule.js} +3 -3
  329. package/dist/collection/helpers/validator/rules/required-field-rule.js +2 -1
  330. package/dist/collection/helpers/validator/rules/rich-text-editor-required-rule.js +57 -0
  331. package/dist/collection/helpers/validator/test/rules/object-array-required-rule.test.js +7 -0
  332. package/dist/collection/helpers/validator/test/rules/required-field-rule.test.js +11 -0
  333. package/dist/collection/helpers/validator/test/rules/rich-text-editor-required-rule.test.js +317 -0
  334. package/dist/collection/helpers/zindex/test/vega-z-index-manager.test.js +1 -1
  335. package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +164 -0
  336. package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +233 -0
  337. package/dist/collection/polyfill/test-polyfill/unit/index.js +1 -0
  338. package/dist/collection/polyfill/test-polyfill/unit/methods.js +9 -0
  339. package/dist/collection/polyfill/test-polyfill/unit/range.js +15 -0
  340. package/dist/collection/polyfill/test-polyfill/unit/shadow-selection.js +17 -0
  341. package/dist/collection/utils/spec-utils.js +2 -1
  342. package/dist/collection/utils/test/ui.test.js +6 -1
  343. package/dist/collection/utils/ui.js +18 -0
  344. package/dist/collection/value-model-adapters/angular-ng-model-accessor-adapter.js +1 -0
  345. package/dist/collection/value-model-adapters/vue-component-v-model-adaptor.js +1 -0
  346. package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
  347. package/dist/esm/{app-globals-5084ae11.js → app-globals-9971ccfd.js} +22 -13
  348. package/dist/esm/block-annotation.abstract-b0554e2b.js +868 -0
  349. package/dist/esm/{breakpoints-36a3ed69.js → breakpoints-91116111.js} +2 -12
  350. package/dist/esm/breakpoints-d9faf11c.js +12 -0
  351. package/dist/esm/{change-manager-6a7eb88c.js → change-manager-8f5b72c2.js} +1 -1
  352. package/dist/esm/chevron-down-4a75d28e.js +5 -0
  353. package/dist/esm/chevron-up-b1989751.js +5 -0
  354. package/dist/esm/{child-nodes-event-prevent-slimmer-01953033.js → child-nodes-event-prevent-slimmer-8ceabe63.js} +3 -3
  355. package/dist/esm/{child-nodes-notify-observer-slimmer-3d52b843.js → child-nodes-notify-observer-slimmer-afc15e00.js} +4 -4
  356. package/dist/esm/{component-cae24190.js → component-051a594c.js} +1 -1
  357. package/dist/esm/{component-global-style-slimmer-000e0c11.js → component-global-style-slimmer-631f956f.js} +1 -1
  358. package/dist/esm/{component-usage-runtime-metrics-b3f6ac79.js → component-usage-runtime-metrics-21813c36.js} +2 -2
  359. package/dist/esm/content-state-acf55eb0.js +2164 -0
  360. package/dist/esm/{create-public-api-runtime-metrics-slimmer-cc1164bb.js → create-public-api-runtime-metrics-slimmer-14cb4599.js} +3 -3
  361. package/dist/esm/{date-732bc749.js → date-655c0af8.js} +1 -1
  362. package/dist/esm/{deprecated-property-slimmer-43d184b3.js → deprecated-property-slimmer-9ea5019c.js} +2 -2
  363. package/dist/esm/{design-token-2a527af3.js → design-token-20fdba82.js} +6 -6
  364. package/dist/esm/dom-node-subject-observer-factory-80358591.js +269 -0
  365. package/dist/esm/{dynamic-slimmer-90b8af32.js → dynamic-slimmer-85746483.js} +1 -1
  366. package/dist/esm/{element-appender-slimmer-48d826b2.js → element-appender-slimmer-4dfa326d.js} +17 -10
  367. package/dist/esm/{event-emit-slimmer-493e6b9d.js → event-emit-slimmer-c03cf145.js} +5 -5
  368. package/dist/esm/{feature-flag-controller-f72c004e.js → feature-flag-controller-dfde0cfa.js} +3 -3
  369. package/dist/esm/{form-field-controller-slimmer-88492678.js → form-field-controller-slimmer-de5fe574.js} +11 -12
  370. package/dist/esm/{index-187f71d1.js → global-slimmer-registry-6887a59f.js} +284 -275
  371. package/dist/esm/{icon-manager-1ee2c968.js → icon-manager-3cef32e7.js} +2 -2
  372. package/dist/esm/index-44c794b4.js +323 -0
  373. package/dist/esm/index.js +29 -23
  374. package/dist/esm/{inject-keyboard-manager-8a82e8c9.js → inject-keyboard-manager-45309420.js} +1 -1
  375. package/dist/esm/{internal-icon-manager-7004584d.js → internal-icon-manager-7fc7535a.js} +1 -1
  376. package/dist/esm/{internal-vega-event-manager-48ac30f1.js → internal-vega-event-manager-3a3815d3.js} +6 -2
  377. package/dist/esm/{internal-vega-z-index-manager-7d2b54c3.js → internal-vega-z-index-manager-89e8b6f5.js} +1 -1
  378. package/dist/esm/{keyboard-manager-d1f9ddc1.js → keyboard-manager-2c06eafe.js} +1 -1
  379. package/dist/esm/{keyboard-manager-slimmer-8723f20f.js → keyboard-manager-slimmer-fd177285.js} +2 -2
  380. package/dist/esm/{legend-input-processor-0cef3ebe.js → legend-input-processor-15939912.js} +1 -1
  381. package/dist/esm/loader.js +28 -23
  382. package/dist/esm/{mutation-observer-slimmer-6cef9549.js → mutation-observer-slimmer-ca2cb2e8.js} +1 -1
  383. package/dist/esm/{vega-skeleton-loader-controller-1911558d.js → node.abstract-93746055.js} +226 -833
  384. package/dist/esm/{page-resize-observer-slimmer-994c1e1b.js → page-resize-observer-slimmer-8589ebc8.js} +2 -2
  385. package/dist/esm/{remote-invocation-registry-1682b34e.js → remote-invocation-registry-2ec6936d.js} +2 -2
  386. package/dist/esm/{required-field-rule-5da360cc.js → required-field-rule-368b31fa.js} +2 -1
  387. package/dist/esm/{responsive-format-facade-3dc84e41.js → responsive-format-facade-559ec469.js} +3 -3
  388. package/dist/esm/{state-background-color-formatter-0540d006.js → state-background-color-formatter-16031a43.js} +2 -2
  389. package/dist/esm/{static-subject-title-500cf2a3.js → static-subject-title-e06a3840.js} +2 -1
  390. package/dist/esm/{string-input-formatter-slimmer-fc23bc9f.js → string-input-formatter-slimmer-c9fb1fa1.js} +2 -2
  391. package/dist/esm/{style-formatter-ccb2da0d.js → style-formatter-51845b6d.js} +2 -2
  392. package/dist/esm/{sub-state-notify-slimmer-21b1c646.js → sub-state-notify-slimmer-6e97a58a.js} +5 -6
  393. package/dist/esm/{sub-state-observer-slimmer-8c80d874.js → sub-state-observer-slimmer-0968ce04.js} +5 -6
  394. package/dist/esm/{synchronize-task-queue-8f5fbbd9.js → synchronize-task-queue-ac8acc3b.js} +10 -1
  395. package/dist/esm/text-color-toolbar-button-slimmer-d0255b98.js +207 -0
  396. package/dist/esm/text-node-6f7d736c.js +1055 -0
  397. package/dist/esm/{translation-4eb3cf85.js → translation-b3fe8e74.js} +4 -4
  398. package/dist/esm/{translation-slimmer-9d07a0ff.js → translation-slimmer-860cd766.js} +2 -2
  399. package/dist/esm/trash-can-8819a939.js +5 -0
  400. package/dist/esm/{type-guard-63caf78b.js → type-guard-158f6d7a.js} +20 -20
  401. package/dist/esm/{typography-a8fc4764.js → typography-396de03f.js} +1 -1
  402. package/dist/esm/{ui-0132dbb5.js → ui-5600b48f.js} +20 -2
  403. package/dist/esm/vega-accordion.entry.js +22 -23
  404. package/dist/esm/vega-app-footer.entry.js +3 -4
  405. package/dist/esm/vega-app-header-button.entry.js +26 -26
  406. package/dist/esm/vega-backdrop.entry.js +4 -5
  407. package/dist/esm/vega-banner.entry.js +15 -17
  408. package/dist/esm/vega-bar-chart.entry.js +5 -6
  409. package/dist/esm/vega-box.entry.js +13 -13
  410. package/dist/esm/vega-breadcrumb.entry.js +13 -15
  411. package/dist/esm/vega-button-circle.entry.js +21 -22
  412. package/dist/esm/vega-button-group_2.entry.js +16 -18
  413. package/dist/esm/vega-button-link.entry.js +21 -16
  414. package/dist/esm/vega-button.entry.js +20 -21
  415. package/dist/esm/vega-calendar_3.entry.js +29 -30
  416. package/dist/esm/vega-card.entry.js +11 -11
  417. package/dist/esm/vega-carousel.entry.js +17 -19
  418. package/dist/esm/vega-checkbox_2.entry.js +24 -25
  419. package/dist/esm/vega-chip.entry.js +21 -22
  420. package/dist/esm/vega-color-picker.entry.js +19 -21
  421. package/dist/esm/vega-combo-box.entry.js +27 -28
  422. package/dist/esm/vega-counter-badge.entry.js +3 -4
  423. package/dist/esm/vega-date-picker_2.entry.js +128 -75
  424. package/dist/esm/{vega-dialog-controller-8b343a17.js → vega-dialog-controller-5b23f68c.js} +2 -2
  425. package/dist/esm/vega-dialog_2.entry.js +24 -25
  426. package/dist/esm/vega-divider.entry.js +11 -11
  427. package/dist/esm/vega-dropdown_5.entry.js +33 -34
  428. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  429. package/dist/esm/vega-field-error.entry.js +5 -6
  430. package/dist/esm/vega-field-label.entry.js +9 -12
  431. package/dist/esm/vega-file-uploader.entry.js +27 -32
  432. package/dist/esm/vega-flex.entry.js +16 -15
  433. package/dist/esm/vega-font.entry.js +12 -12
  434. package/dist/esm/vega-form.entry.js +23 -24
  435. package/dist/esm/vega-grid.entry.js +11 -11
  436. package/dist/esm/vega-hint.entry.js +3 -4
  437. package/dist/esm/vega-icon.entry.js +14 -14
  438. package/dist/esm/vega-image-uploader.entry.js +28 -29
  439. package/dist/esm/vega-input-credit-card.entry.js +25 -26
  440. package/dist/esm/vega-input-numeric.entry.js +26 -27
  441. package/dist/esm/vega-input-phone-number.entry.js +25 -26
  442. package/dist/esm/vega-input-range.entry.js +23 -24
  443. package/dist/esm/vega-input-select.entry.js +31 -31
  444. package/dist/esm/vega-input.entry.js +23 -25
  445. package/dist/esm/{vega-internal-event-id-770faa12.js → vega-internal-event-id-4af5c6e9.js} +7 -1
  446. package/dist/esm/vega-item-toggle.entry.js +10 -13
  447. package/dist/esm/vega-left-nav_5.entry.js +32 -32
  448. package/dist/esm/vega-line-chart.entry.js +6 -7
  449. package/dist/esm/vega-loader-wrapper_2.entry.js +10 -10
  450. package/dist/esm/vega-page-notification_2.entry.js +6 -9
  451. package/dist/esm/vega-pagination.entry.js +17 -19
  452. package/dist/esm/vega-pie-chart.entry.js +5 -6
  453. package/dist/esm/vega-popover_2.entry.js +59 -24
  454. package/dist/esm/vega-progress-tracker.entry.js +10 -13
  455. package/dist/esm/vega-radio_2.entry.js +26 -27
  456. package/dist/esm/vega-rich-text-content.entry.js +175 -0
  457. package/dist/esm/vega-rich-text-editor_4.entry.js +4887 -0
  458. package/dist/esm/vega-section-title.entry.js +3 -4
  459. package/dist/esm/vega-segment-control.entry.js +12 -14
  460. package/dist/esm/vega-selection-chip_2.entry.js +28 -29
  461. package/dist/esm/vega-selection-tile_2.entry.js +26 -27
  462. package/dist/esm/vega-sidenav_3.entry.js +23 -25
  463. package/dist/esm/vega-signature-capture.entry.js +27 -29
  464. package/dist/esm/vega-skeleton.entry.js +3 -4
  465. package/dist/esm/vega-slot-container.entry.js +2 -3
  466. package/dist/esm/vega-stepper.entry.js +22 -23
  467. package/dist/esm/vega-tab-group_2.entry.js +18 -19
  468. package/dist/esm/vega-table_8.entry.js +33 -33
  469. package/dist/esm/vega-text.entry.js +6 -6
  470. package/dist/esm/vega-textarea.entry.js +23 -24
  471. package/dist/esm/vega-time-picker_2.entry.js +31 -32
  472. package/dist/esm/vega-toggle-switch.entry.js +18 -20
  473. package/dist/esm/vega-tooltip_2.entry.js +16 -16
  474. package/dist/esm/vega.js +28 -23
  475. package/dist/esm/{y-axis-input-processor-a4d6aa50.js → y-axis-input-processor-a26a57e5.js} +1 -1
  476. package/dist/types/components/vega-button-link/types.d.ts +1 -0
  477. package/dist/types/components/vega-button-link/vega-button-link.d.ts +8 -0
  478. package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +1 -0
  479. package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-input-renderer-base.abstract.d.ts +17 -0
  480. package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-range-input-renderer.d.ts +2 -4
  481. package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-single-input-renderer.d.ts +2 -4
  482. package/dist/types/components/vega-date-picker/vega-date-picker.d.ts +6 -0
  483. package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +19 -0
  484. package/dist/types/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-state-controller.d.ts +11 -0
  485. package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +20 -0
  486. package/dist/types/components/vega-rich-text-content/vega-rich-text-content.d.ts +44 -0
  487. package/dist/types/components/vega-rich-text-editor/assets/align-center.d.ts +3 -0
  488. package/dist/types/components/vega-rich-text-editor/assets/align-justify.d.ts +3 -0
  489. package/dist/types/components/vega-rich-text-editor/assets/align-left.d.ts +3 -0
  490. package/dist/types/components/vega-rich-text-editor/assets/align-right.d.ts +3 -0
  491. package/dist/types/components/vega-rich-text-editor/assets/bold.d.ts +3 -0
  492. package/dist/types/components/vega-rich-text-editor/assets/code-simple.d.ts +3 -0
  493. package/dist/types/components/vega-rich-text-editor/assets/image.d.ts +3 -0
  494. package/dist/types/components/vega-rich-text-editor/assets/indent.d.ts +3 -0
  495. package/dist/types/components/vega-rich-text-editor/assets/italic.d.ts +3 -0
  496. package/dist/types/components/vega-rich-text-editor/assets/link.d.ts +3 -0
  497. package/dist/types/components/vega-rich-text-editor/assets/list-ol.d.ts +3 -0
  498. package/dist/types/components/vega-rich-text-editor/assets/list-ul.d.ts +3 -0
  499. package/dist/types/components/vega-rich-text-editor/assets/outdent.d.ts +3 -0
  500. package/dist/types/components/vega-rich-text-editor/assets/strikethrough.d.ts +3 -0
  501. package/dist/types/components/vega-rich-text-editor/assets/text-size.d.ts +3 -0
  502. package/dist/types/components/vega-rich-text-editor/assets/text-slash.d.ts +3 -0
  503. package/dist/types/components/vega-rich-text-editor/assets/text.d.ts +3 -0
  504. package/dist/types/components/vega-rich-text-editor/assets/underline.d.ts +3 -0
  505. package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +3 -0
  506. package/dist/types/components/vega-rich-text-editor/dto/actions/annotation-action.abstract.d.ts +12 -0
  507. package/dist/types/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.d.ts +9 -0
  508. package/dist/types/components/vega-rich-text-editor/dto/actions/bold-annotation-action.d.ts +16 -0
  509. package/dist/types/components/vega-rich-text-editor/dto/actions/break-single-block-action.d.ts +18 -0
  510. package/dist/types/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.d.ts +9 -0
  511. package/dist/types/components/vega-rich-text-editor/dto/actions/clear-formatting-annotation-action.d.ts +14 -0
  512. package/dist/types/components/vega-rich-text-editor/dto/actions/code-annotation-action.d.ts +16 -0
  513. package/dist/types/components/vega-rich-text-editor/dto/actions/delete-block-content-action.d.ts +16 -0
  514. package/dist/types/components/vega-rich-text-editor/dto/actions/delete-node-annotation-action.d.ts +18 -0
  515. package/dist/types/components/vega-rich-text-editor/dto/actions/horizontal-alignment-annotation-action.d.ts +17 -0
  516. package/dist/types/components/vega-rich-text-editor/dto/actions/image-annotation-action.d.ts +18 -0
  517. package/dist/types/components/vega-rich-text-editor/dto/actions/indent-annotation-action.d.ts +16 -0
  518. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.d.ts +13 -0
  519. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.d.ts +13 -0
  520. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-image-to-block-action.d.ts +16 -0
  521. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.d.ts +13 -0
  522. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.d.ts +13 -0
  523. package/dist/types/components/vega-rich-text-editor/dto/actions/italic-annotation-action.d.ts +16 -0
  524. package/dist/types/components/vega-rich-text-editor/dto/actions/line-break-multiple-block-action.d.ts +15 -0
  525. package/dist/types/components/vega-rich-text-editor/dto/actions/line-break-single-block-action.d.ts +15 -0
  526. package/dist/types/components/vega-rich-text-editor/dto/actions/link-annotation-action.d.ts +24 -0
  527. package/dist/types/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.d.ts +18 -0
  528. package/dist/types/components/vega-rich-text-editor/dto/actions/merge-two-blocks-nodes-action.d.ts +12 -0
  529. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +30 -0
  530. package/dist/types/components/vega-rich-text-editor/dto/actions/remove-child-action.d.ts +14 -0
  531. package/dist/types/components/vega-rich-text-editor/dto/actions/remove-nest-list-action.d.ts +12 -0
  532. package/dist/types/components/vega-rich-text-editor/dto/actions/replace-child-nodes-action.d.ts +12 -0
  533. package/dist/types/components/vega-rich-text-editor/dto/actions/replace-nest-list-action.d.ts +12 -0
  534. package/dist/types/components/vega-rich-text-editor/dto/actions/replace-selected-text-action.d.ts +13 -0
  535. package/dist/types/components/vega-rich-text-editor/dto/actions/selection-change-action.d.ts +16 -0
  536. package/dist/types/components/vega-rich-text-editor/dto/actions/split-block-with-node-action.d.ts +17 -0
  537. package/dist/types/components/vega-rich-text-editor/dto/actions/splittable-action.abstract.d.ts +10 -0
  538. package/dist/types/components/vega-rich-text-editor/dto/actions/strikethrough-annotation-action.d.ts +16 -0
  539. package/dist/types/components/vega-rich-text-editor/dto/actions/sync-up-selection-action.d.ts +16 -0
  540. package/dist/types/components/vega-rich-text-editor/dto/actions/text-color-annotation-action.d.ts +16 -0
  541. package/dist/types/components/vega-rich-text-editor/dto/actions/text-style-annotation-action.d.ts +18 -0
  542. package/dist/types/components/vega-rich-text-editor/dto/actions/transform-list-action.d.ts +13 -0
  543. package/dist/types/components/vega-rich-text-editor/dto/actions/transform-paragraph-action.d.ts +11 -0
  544. package/dist/types/components/vega-rich-text-editor/dto/actions/underline-annotation-action.d.ts +16 -0
  545. package/dist/types/components/vega-rich-text-editor/dto/actions/update-text-action.d.ts +11 -0
  546. package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +13 -0
  547. package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +22 -0
  548. package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +37 -0
  549. package/dist/types/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.d.ts +9 -0
  550. package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +43 -0
  551. package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +50 -0
  552. package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +41 -0
  553. package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +44 -0
  554. package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +37 -0
  555. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +44 -0
  556. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +16 -0
  557. package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +28 -0
  558. package/dist/types/components/vega-rich-text-editor/dto/annotations/selection-range-annotation.d.ts +9 -0
  559. package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +43 -0
  560. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +50 -0
  561. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +44 -0
  562. package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +43 -0
  563. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +175 -0
  564. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +49 -0
  565. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +30 -0
  566. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +33 -0
  567. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +63 -0
  568. package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +58 -0
  569. package/dist/types/components/vega-rich-text-editor/dto/helper/block-base-operator.d.ts +24 -0
  570. package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +19 -0
  571. package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +65 -0
  572. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +33 -0
  573. package/dist/types/components/vega-rich-text-editor/dto/range.d.ts +102 -0
  574. package/dist/types/components/vega-rich-text-editor/interface.d.ts +175 -0
  575. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/focus-controller.d.ts +33 -0
  576. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.d.ts +67 -0
  577. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.d.ts +29 -0
  578. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.d.ts +37 -0
  579. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.d.ts +35 -0
  580. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.d.ts +37 -0
  581. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.d.ts +36 -0
  582. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.d.ts +39 -0
  583. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.d.ts +39 -0
  584. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.d.ts +46 -0
  585. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.d.ts +37 -0
  586. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +78 -0
  587. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +33 -0
  588. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.d.ts +53 -0
  589. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.d.ts +22 -0
  590. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +44 -0
  591. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.d.ts +25 -0
  592. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.d.ts +39 -0
  593. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/rich-text-content-controller.d.ts +13 -0
  594. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +123 -0
  595. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.d.ts +33 -0
  596. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/text-node-color-controller.d.ts +22 -0
  597. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/text-node-rendering-registry.d.ts +22 -0
  598. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +70 -0
  599. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/value-controller.d.ts +38 -0
  600. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +21 -0
  601. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.d.ts +9 -0
  602. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +16 -0
  603. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.d.ts +19 -0
  604. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.d.ts +19 -0
  605. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.d.ts +9 -0
  606. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.d.ts +9 -0
  607. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.d.ts +9 -0
  608. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +19 -0
  609. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.d.ts +9 -0
  610. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.d.ts +9 -0
  611. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.d.ts +9 -0
  612. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +19 -0
  613. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.d.ts +9 -0
  614. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.d.ts +9 -0
  615. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.d.ts +16 -0
  616. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.d.ts +9 -0
  617. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.d.ts +9 -0
  618. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.d.ts +28 -0
  619. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +21 -0
  620. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.d.ts +49 -0
  621. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.d.ts +9 -0
  622. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +53 -0
  623. package/dist/types/components/vega-rich-text-editor/test/dto/annotations.test.d.ts +1 -0
  624. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/image-block.test.d.ts +1 -0
  625. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/list-block.test.d.ts +1 -0
  626. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/list-item.test.d.ts +1 -0
  627. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/text-block.test.d.ts +1 -0
  628. package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +1 -0
  629. package/dist/types/components/vega-rich-text-editor/test/dto/nodes/image-node.test.d.ts +1 -0
  630. package/dist/types/components/vega-rich-text-editor/test/dto/nodes/text-node.test.d.ts +1 -0
  631. package/dist/types/components/vega-rich-text-editor/test/dto/range.test.d.ts +1 -0
  632. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/slimmers/renderers/vega-rich-text-editor-toolbar-button-renderer.d.ts +11 -0
  633. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.d.ts +62 -0
  634. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +186 -0
  635. package/dist/types/components/vega-rich-text-editor/vega-rich-text-image-editor/slimmers/renderers/vega-rich-text-image-editor-renderer.d.ts +20 -0
  636. package/dist/types/components/vega-rich-text-editor/vega-rich-text-image-editor/types.d.ts +15 -0
  637. package/dist/types/components/vega-rich-text-editor/vega-rich-text-image-editor/vega-rich-text-image-editor.d.ts +46 -0
  638. package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.d.ts +29 -0
  639. package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/types.d.ts +15 -0
  640. package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.d.ts +64 -0
  641. package/dist/types/components.d.ts +399 -0
  642. package/dist/types/constants/ui.d.ts +1 -1
  643. package/dist/types/helpers/change-manager/subject/static-subject/static-subject-title.d.ts +2 -1
  644. package/dist/types/helpers/common/index.d.ts +8 -0
  645. package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +1 -0
  646. package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +6 -0
  647. package/dist/types/helpers/public-api.d.ts +1 -0
  648. package/dist/types/helpers/queue/synchronize-task-queue.d.ts +7 -0
  649. package/dist/types/helpers/slimmers/dark-mode-state-controller-slimmer.d.ts +21 -0
  650. package/dist/types/helpers/slimmers/element-appender-slimmer.d.ts +2 -0
  651. package/dist/types/helpers/slimmers/test/dark-mode-state-controller.test.d.ts +1 -0
  652. package/dist/types/helpers/theme/controllers/dark-mode-style-controller.d.ts +20 -0
  653. package/dist/types/helpers/validator/rules/form-field-validation-rule.d.ts +7 -1
  654. package/dist/types/helpers/validator/rules/{file-uploader-required-rule.d.ts → object-array-required-rule.d.ts} +3 -3
  655. package/dist/types/helpers/validator/rules/rich-text-editor-required-rule.d.ts +39 -0
  656. package/dist/types/helpers/validator/test/rules/object-array-required-rule.test.d.ts +1 -0
  657. package/dist/types/helpers/validator/test/rules/rich-text-editor-required-rule.test.d.ts +1 -0
  658. package/dist/types/polyfill/shadow-selection/shadow-selection-polyfill.d.ts +64 -0
  659. package/dist/types/polyfill/shadow-selection/test/shadow-selection-polyfill.test.d.ts +0 -0
  660. package/dist/types/polyfill/test-polyfill/unit/index.d.ts +1 -0
  661. package/dist/types/polyfill/test-polyfill/unit/range.d.ts +7 -0
  662. package/dist/types/polyfill/test-polyfill/unit/shadow-selection.d.ts +0 -0
  663. package/dist/types/types/components.type.d.ts +16 -0
  664. package/dist/types/utils/ui.d.ts +7 -0
  665. package/dist/vega/index.esm.js +1 -1
  666. package/dist/vega/p-034e6348.entry.js +1 -0
  667. package/dist/vega/p-0cd2b50f.entry.js +1 -0
  668. package/dist/vega/{p-5453f591.js → p-0e0c47ad.js} +1 -1
  669. package/dist/vega/p-109a00cf.entry.js +1 -0
  670. package/dist/vega/p-112455b1.js +1 -0
  671. package/dist/vega/{p-bdb94242.js → p-11a19ca0.js} +1 -1
  672. package/dist/vega/{p-a04632d0.js → p-11cb477b.js} +1 -1
  673. package/dist/vega/p-1564cc4d.entry.js +1 -0
  674. package/dist/vega/p-18886765.entry.js +1 -0
  675. package/dist/vega/p-1995e98e.js +1 -0
  676. package/dist/vega/p-19b26168.entry.js +1 -0
  677. package/dist/vega/{p-b62f0454.js → p-1ec4b319.js} +1 -1
  678. package/dist/vega/p-1ec763ab.js +1 -0
  679. package/dist/vega/p-1fb56e14.js +1 -0
  680. package/dist/vega/p-21992602.entry.js +1 -0
  681. package/dist/vega/p-22563151.entry.js +1 -0
  682. package/dist/vega/p-23795da1.entry.js +1 -0
  683. package/dist/vega/p-29277e41.entry.js +1 -0
  684. package/dist/vega/{p-9b797118.js → p-296cc56b.js} +1 -1
  685. package/dist/vega/p-2a7e9422.entry.js +1 -0
  686. package/dist/vega/p-2ca6d977.entry.js +1 -0
  687. package/dist/vega/p-2e419309.entry.js +1 -0
  688. package/dist/vega/p-2fc3af2f.js +1 -0
  689. package/dist/vega/p-3039bef8.js +1 -0
  690. package/dist/vega/{p-e2acbc60.js → p-3152031c.js} +1 -1
  691. package/dist/vega/p-315667f1.js +1 -0
  692. package/dist/vega/p-34939c97.entry.js +1 -0
  693. package/dist/vega/{p-a46329bb.js → p-368d0060.js} +1 -1
  694. package/dist/vega/p-3897bb2d.entry.js +1 -0
  695. package/dist/vega/{p-69e63d21.entry.js → p-390c5236.entry.js} +1 -1
  696. package/dist/vega/{p-af7a3154.js → p-3953c705.js} +1 -1
  697. package/dist/vega/{p-30860766.js → p-39836361.js} +1 -1
  698. package/dist/vega/{p-a190c86a.js → p-3b4bde3e.js} +1 -1
  699. package/dist/vega/p-3ce31dc3.js +1 -0
  700. package/dist/vega/{p-04215e74.js → p-3f1b542a.js} +1 -1
  701. package/dist/vega/{p-2d0d575f.js → p-443ad3b3.js} +1 -1
  702. package/dist/vega/p-452e284a.js +1 -0
  703. package/dist/vega/p-49f4a666.js +1 -0
  704. package/dist/vega/p-4bcd6612.js +1 -0
  705. package/dist/vega/p-4c41dd64.js +1 -0
  706. package/dist/vega/p-55beac7f.entry.js +1 -0
  707. package/dist/vega/p-57405834.entry.js +1 -0
  708. package/dist/vega/p-589e6041.entry.js +1 -0
  709. package/dist/vega/{p-6a334573.js → p-59bdf9b8.js} +1 -1
  710. package/dist/vega/p-5e95402a.entry.js +1 -0
  711. package/dist/vega/p-5eee21b4.entry.js +1 -0
  712. package/dist/vega/p-5f377954.js +1 -1
  713. package/dist/vega/p-613ddaab.js +1 -0
  714. package/dist/vega/{p-2d5a9f66.js → p-62774231.js} +1 -1
  715. package/dist/vega/p-62cea2e7.entry.js +1 -0
  716. package/dist/vega/p-65b79fd7.js +1 -0
  717. package/dist/vega/p-6741e2b9.entry.js +1 -0
  718. package/dist/vega/p-6a084fe1.entry.js +1 -0
  719. package/dist/vega/{p-760283d1.entry.js → p-6b286226.entry.js} +1 -1
  720. package/dist/vega/p-6b722905.entry.js +1 -0
  721. package/dist/vega/p-6e4b2752.entry.js +1 -0
  722. package/dist/vega/{p-47c87634.js → p-70151c27.js} +1 -1
  723. package/dist/vega/p-7209d03b.js +1 -0
  724. package/dist/vega/p-728b029a.entry.js +1 -0
  725. package/dist/vega/p-76fc408e.entry.js +1 -0
  726. package/dist/vega/p-7a40e033.js +1 -0
  727. package/dist/vega/p-7a9f453e.entry.js +1 -0
  728. package/dist/vega/p-80ccd894.entry.js +1 -0
  729. package/dist/vega/{p-ed237efc.js → p-81ead59a.js} +1 -1
  730. package/dist/vega/{p-987fbbd0.js → p-843a0c1c.js} +1 -1
  731. package/dist/vega/p-84c597c8.entry.js +1 -0
  732. package/dist/vega/p-8b78c6a3.entry.js +1 -0
  733. package/dist/vega/p-8be45a45.entry.js +1 -0
  734. package/dist/vega/p-8c26227e.js +1 -0
  735. package/dist/vega/p-8d7b45f7.entry.js +1 -0
  736. package/dist/vega/p-8e17b9dd.entry.js +1 -0
  737. package/dist/vega/p-8f93242a.js +1 -0
  738. package/dist/vega/p-925a2137.js +1 -0
  739. package/dist/vega/p-92f88033.entry.js +1 -0
  740. package/dist/vega/p-94de7a02.entry.js +1 -0
  741. package/dist/vega/p-9968e71d.entry.js +1 -0
  742. package/dist/vega/p-9c1eeff2.js +2 -0
  743. package/dist/vega/p-9d1b9e70.entry.js +1 -0
  744. package/dist/vega/p-a5ffe912.js +1 -0
  745. package/dist/vega/p-a6104aa7.js +1 -0
  746. package/dist/vega/p-a6169ad6.entry.js +1 -0
  747. package/dist/vega/{p-6a8f1251.js → p-a6a7d0c9.js} +1 -1
  748. package/dist/vega/p-a8bf559a.js +1 -0
  749. package/dist/vega/p-aacf6920.js +1 -0
  750. package/dist/vega/p-acf7f903.js +1 -0
  751. package/dist/vega/p-afec17ad.entry.js +1 -0
  752. package/dist/vega/p-b1f65b13.js +1 -0
  753. package/dist/vega/p-b3f9cc3a.entry.js +13 -0
  754. package/dist/vega/p-b693c1ac.entry.js +1 -0
  755. package/dist/vega/p-b6af0fc1.entry.js +1 -0
  756. package/dist/vega/p-b9e2add4.entry.js +1 -0
  757. package/dist/vega/p-bd894860.entry.js +1 -0
  758. package/dist/vega/p-c0d6a587.entry.js +1 -0
  759. package/dist/vega/p-c1d97d12.entry.js +1 -0
  760. package/dist/vega/p-c26e6820.entry.js +1 -0
  761. package/dist/vega/p-c34487e1.entry.js +1 -0
  762. package/dist/vega/p-c532b132.entry.js +1 -0
  763. package/dist/vega/p-ca2fb711.js +1 -0
  764. package/dist/vega/p-cebf93f1.entry.js +1 -0
  765. package/dist/vega/p-cfdc148a.entry.js +1 -0
  766. package/dist/vega/p-d0351d71.entry.js +1 -0
  767. package/dist/vega/p-d057999f.js +1 -0
  768. package/dist/vega/{p-c7d70786.js → p-d171cf44.js} +1 -1
  769. package/dist/vega/p-d2ab6096.entry.js +1 -0
  770. package/dist/vega/p-d302f052.entry.js +1 -0
  771. package/dist/vega/p-d35643c5.entry.js +1 -0
  772. package/dist/vega/p-d400a1d9.entry.js +1 -0
  773. package/dist/vega/p-d6732a72.entry.js +1 -0
  774. package/dist/vega/p-d720b06a.entry.js +1 -0
  775. package/dist/vega/{p-c59042c0.js → p-d884c644.js} +1 -1
  776. package/dist/vega/p-d987e404.entry.js +1 -0
  777. package/dist/vega/p-d9b86108.entry.js +1 -0
  778. package/dist/vega/p-e0b25eaf.js +1 -0
  779. package/dist/vega/{p-9f3b1d77.js → p-e1e1fcf0.js} +1 -1
  780. package/dist/vega/p-e27e115d.entry.js +1 -0
  781. package/dist/vega/p-e43c2a27.js +1 -0
  782. package/dist/vega/p-e65c8ac7.entry.js +1 -0
  783. package/dist/vega/p-e79057cc.js +1 -0
  784. package/dist/vega/p-e89e9769.entry.js +1 -0
  785. package/dist/vega/{p-781fd6e0.js → p-eac38d87.js} +1 -1
  786. package/dist/vega/p-ecd64c7f.entry.js +1 -0
  787. package/dist/vega/p-ed45b3b6.js +1 -0
  788. package/dist/vega/p-f357cf46.js +1 -0
  789. package/dist/vega/p-f5b2e72a.entry.js +1 -0
  790. package/dist/vega/p-f6af3749.js +1 -0
  791. package/dist/vega/p-f763e2eb.js +1 -0
  792. package/dist/vega/p-fc622a75.js +1 -0
  793. package/dist/vega/vega.esm.js +1 -1
  794. package/package.json +3 -4
  795. package/dist/cjs/dom-node-subject-observer-factory-2e41340d.js +0 -141
  796. package/dist/cjs/global-slimmer-registry-b3bce7e0.js +0 -297
  797. package/dist/cjs/index-40a1cd3a.js +0 -15
  798. package/dist/cjs/index-5792390b.js +0 -1024
  799. package/dist/cjs/observer-f49483e8.js +0 -32
  800. package/dist/collection/helpers/validator/test/rules/file-uploader-required-rule.test.js +0 -7
  801. package/dist/esm/chevron-down-4303bddb.js +0 -9
  802. package/dist/esm/dom-node-subject-observer-factory-9461cd67.js +0 -138
  803. package/dist/esm/global-slimmer-registry-17c4efd4.js +0 -283
  804. package/dist/esm/index-0830dd1d.js +0 -13
  805. package/dist/esm/index-0863eec6.js +0 -1019
  806. package/dist/esm/observer-3959f9dd.js +0 -30
  807. package/dist/esm/vega-event-id-0f8fc134.js +0 -103
  808. package/dist/vega/p-00d1904d.entry.js +0 -1
  809. package/dist/vega/p-039abd28.entry.js +0 -1
  810. package/dist/vega/p-051fd45b.entry.js +0 -1
  811. package/dist/vega/p-07a8cf89.entry.js +0 -1
  812. package/dist/vega/p-0916da7a.entry.js +0 -1
  813. package/dist/vega/p-0e59c3b7.entry.js +0 -1
  814. package/dist/vega/p-0fe89d42.js +0 -1
  815. package/dist/vega/p-0fecf145.js +0 -1
  816. package/dist/vega/p-105d0265.entry.js +0 -1
  817. package/dist/vega/p-11786565.entry.js +0 -1
  818. package/dist/vega/p-12aa4bd2.entry.js +0 -1
  819. package/dist/vega/p-13d34a23.entry.js +0 -1
  820. package/dist/vega/p-14fc5aed.entry.js +0 -1
  821. package/dist/vega/p-1545a693.entry.js +0 -1
  822. package/dist/vega/p-16bb355d.js +0 -1
  823. package/dist/vega/p-16bfb3cb.entry.js +0 -1
  824. package/dist/vega/p-1c298d5a.js +0 -2
  825. package/dist/vega/p-24d76337.entry.js +0 -1
  826. package/dist/vega/p-2b5ab7f9.entry.js +0 -1
  827. package/dist/vega/p-3154fb6b.entry.js +0 -1
  828. package/dist/vega/p-32f651f7.js +0 -1
  829. package/dist/vega/p-331a62d5.js +0 -1
  830. package/dist/vega/p-3e591b2f.entry.js +0 -1
  831. package/dist/vega/p-4022f395.entry.js +0 -1
  832. package/dist/vega/p-4163c2c2.js +0 -1
  833. package/dist/vega/p-47e665ba.entry.js +0 -1
  834. package/dist/vega/p-4963e445.entry.js +0 -1
  835. package/dist/vega/p-4d25df7d.js +0 -1
  836. package/dist/vega/p-51200fe0.entry.js +0 -1
  837. package/dist/vega/p-535f0758.js +0 -1
  838. package/dist/vega/p-5440344e.js +0 -1
  839. package/dist/vega/p-590870e4.js +0 -1
  840. package/dist/vega/p-5915634b.js +0 -1
  841. package/dist/vega/p-5dd6ff09.entry.js +0 -1
  842. package/dist/vega/p-5fbac513.js +0 -1
  843. package/dist/vega/p-5fe479a1.js +0 -1
  844. package/dist/vega/p-61f6167c.js +0 -1
  845. package/dist/vega/p-6556932e.entry.js +0 -1
  846. package/dist/vega/p-66ffdfdf.entry.js +0 -1
  847. package/dist/vega/p-68ad953c.js +0 -1
  848. package/dist/vega/p-6c6d86da.js +0 -1
  849. package/dist/vega/p-6ca02241.entry.js +0 -13
  850. package/dist/vega/p-6e1ab235.js +0 -1
  851. package/dist/vega/p-7002cde3.entry.js +0 -1
  852. package/dist/vega/p-71939bf8.entry.js +0 -1
  853. package/dist/vega/p-7372cd79.entry.js +0 -1
  854. package/dist/vega/p-7df3aa44.entry.js +0 -1
  855. package/dist/vega/p-810ba5c3.entry.js +0 -1
  856. package/dist/vega/p-83569225.entry.js +0 -1
  857. package/dist/vega/p-84118b6d.entry.js +0 -1
  858. package/dist/vega/p-848825ff.entry.js +0 -1
  859. package/dist/vega/p-84fa8466.js +0 -1
  860. package/dist/vega/p-87640a4d.entry.js +0 -1
  861. package/dist/vega/p-8a091eb7.js +0 -1
  862. package/dist/vega/p-8b084bf9.entry.js +0 -1
  863. package/dist/vega/p-8bd327a8.js +0 -1
  864. package/dist/vega/p-8d23c56b.entry.js +0 -1
  865. package/dist/vega/p-943e89b4.js +0 -1
  866. package/dist/vega/p-94861e39.entry.js +0 -1
  867. package/dist/vega/p-9ba085c1.entry.js +0 -1
  868. package/dist/vega/p-9e9ec748.js +0 -1
  869. package/dist/vega/p-9fbdeada.js +0 -1
  870. package/dist/vega/p-a00122bb.entry.js +0 -1
  871. package/dist/vega/p-a2b4b6c3.entry.js +0 -1
  872. package/dist/vega/p-a7fdb16a.js +0 -1
  873. package/dist/vega/p-acc14aa2.js +0 -1
  874. package/dist/vega/p-ae5751fb.entry.js +0 -1
  875. package/dist/vega/p-af086582.entry.js +0 -1
  876. package/dist/vega/p-b3e754da.entry.js +0 -1
  877. package/dist/vega/p-b4e92130.entry.js +0 -1
  878. package/dist/vega/p-b5990090.js +0 -1
  879. package/dist/vega/p-b5a6f6b9.entry.js +0 -1
  880. package/dist/vega/p-b8e42c11.entry.js +0 -1
  881. package/dist/vega/p-bb6f8b70.entry.js +0 -1
  882. package/dist/vega/p-c1dfdc13.js +0 -1
  883. package/dist/vega/p-c94ddc57.entry.js +0 -1
  884. package/dist/vega/p-d642c011.entry.js +0 -1
  885. package/dist/vega/p-da106a4d.entry.js +0 -1
  886. package/dist/vega/p-db94558e.entry.js +0 -1
  887. package/dist/vega/p-dba59bd7.entry.js +0 -1
  888. package/dist/vega/p-e5cd92f0.entry.js +0 -1
  889. package/dist/vega/p-e5e0394a.entry.js +0 -1
  890. package/dist/vega/p-e74a6d22.entry.js +0 -1
  891. package/dist/vega/p-e828ee94.entry.js +0 -1
  892. package/dist/vega/p-ea285b12.entry.js +0 -1
  893. package/dist/vega/p-ead482e6.entry.js +0 -1
  894. package/dist/vega/p-ec157238.js +0 -1
  895. package/dist/vega/p-eddcb385.entry.js +0 -1
  896. package/dist/vega/p-f2685ec5.entry.js +0 -1
  897. package/dist/vega/p-f404aa83.js +0 -1
  898. package/dist/vega/p-f46c930f.js +0 -1
  899. package/dist/vega/p-f556c3cd.entry.js +0 -1
  900. package/dist/vega/p-f64fb740.entry.js +0 -1
  901. package/dist/vega/p-f7728ead.entry.js +0 -1
  902. package/dist/vega/p-faea1620.js +0 -1
  903. package/dist/vega/p-ffb832b8.entry.js +0 -1
  904. /package/dist/types/{helpers/validator/test/rules/file-uploader-required-rule.test.d.ts → components/vega-rich-text-editor/test/dto/annotation-actions.test.d.ts} +0 -0
@@ -0,0 +1,2164 @@
1
+ import { h } from './global-slimmer-registry-6887a59f.js';
2
+ import { B as BlockAnnotation, e as BlockAnnotationTypeEnum } from './block-annotation.abstract-b0554e2b.js';
3
+ import { C as ChangeManager } from './change-manager-8f5b72c2.js';
4
+ import { d as domNodeSubjectFactory, D as DomNodeSubjectObserverFactory, V as VegaChange } from './dom-node-subject-observer-factory-80358591.js';
5
+ import { M as ModifyContentAction, b as ModifyContentActionType, s as stateEntityRenderingRegistry, N as NodeAnnotation, a as NodeAnnotationTypeEnum, R as RTENode, c as NodeTypeEnum, I as InternalAnnotationTypeEnum } from './node.abstract-93746055.js';
6
+ import { V as VegaInternalRichTextEditorFlushChanges } from './vega-internal-event-id-4af5c6e9.js';
7
+ import { i as isNonNullable } from './type-guard-158f6d7a.js';
8
+ import { Z as ZERO_WIDTH_SPACE, A as AnnotationAction, T as TextSplittableAction, B as BoldAnnotation, R as RTETextNode, L as LinkAnnotationAction, D as DeleteNodeAnnotationAction, a as LinkGroupAnnotationAction, U as UpdateTextAction, S as SyncUpSelectionAction } from './text-node-6f7d736c.js';
9
+ import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-14cb4599.js';
10
+
11
+ /**
12
+ * Annotation to make block with horizontal alignment
13
+ */
14
+ class HorizontalAlignmentAnnotation extends BlockAnnotation {
15
+ constructor(textAlign) {
16
+ super();
17
+ this.type = BlockAnnotationTypeEnum.ALIGNMENT;
18
+ this.textAlign = textAlign;
19
+ }
20
+ /**
21
+ * Generate the map item for the annotation
22
+ *
23
+ * @param {VegaRTEBlockAlignment} textAlign - Text alignment
24
+ * @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
25
+ */
26
+ static from(textAlign) {
27
+ return [BlockAnnotationTypeEnum.ALIGNMENT, new HorizontalAlignmentAnnotation(textAlign)];
28
+ }
29
+ /**
30
+ * Generate the map item for the annotation by html element
31
+ *
32
+ * @param {HTMLElement} node - An html element.
33
+ * @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
34
+ */
35
+ static fromHTML(node) {
36
+ const alignment = this.getTextAlign(node);
37
+ return alignment ? this.from(alignment) : null;
38
+ }
39
+ /**
40
+ * Get the text alignment of an HTML element.
41
+ *
42
+ * @param {HTMLElement} node - An HTMLElement.
43
+ * @returns {Nullable<VegaRTEBlockAlignment>} text alignment.
44
+ */
45
+ static getTextAlign(node) {
46
+ const classList = node.classList;
47
+ if (classList.contains(`v-rte--horizontal-alignment-left`)) {
48
+ return 'left';
49
+ }
50
+ else if (classList.contains(`v-rte--horizontal-alignment-center`)) {
51
+ return 'center';
52
+ }
53
+ else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
54
+ return 'right';
55
+ }
56
+ else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
57
+ return 'justify';
58
+ }
59
+ const style = node.style;
60
+ switch (style.textAlign) {
61
+ case 'center':
62
+ return 'center';
63
+ case 'right':
64
+ return 'right';
65
+ case 'justify':
66
+ return 'justify';
67
+ case 'left':
68
+ return 'left';
69
+ default:
70
+ return null;
71
+ }
72
+ }
73
+ /**
74
+ * Generate the JSON item of the annotation
75
+ *
76
+ * @returns {Record<string, unknown>} JSON representation of the annotation
77
+ */
78
+ toJSON() {
79
+ return {
80
+ textAlign: this.textAlign,
81
+ };
82
+ }
83
+ /**
84
+ * Generate the class for the annotation
85
+ *
86
+ * @returns {string} - Annotation class
87
+ */
88
+ renderClass() {
89
+ return `v-rte--horizontal-alignment-${this.textAlign}`;
90
+ }
91
+ /**
92
+ * Generate the style for the annotation
93
+ *
94
+ * @returns {Nullable<AnnotationStyle>} - Annotation style
95
+ */
96
+ render() {
97
+ return null;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Annotation for block indentation
103
+ */
104
+ class IndentAnnotation extends BlockAnnotation {
105
+ constructor(indent) {
106
+ super();
107
+ this.type = BlockAnnotationTypeEnum.INDENT;
108
+ this.indent = Math.max(0, indent);
109
+ }
110
+ /**
111
+ * Generate the map item for the annotation
112
+ *
113
+ * @param {number} indent - Text alignment
114
+ * @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
115
+ */
116
+ static from(indent) {
117
+ return [BlockAnnotationTypeEnum.INDENT, new IndentAnnotation(indent)];
118
+ }
119
+ /**
120
+ * Generate the map item for the annotation by html element
121
+ *
122
+ * @param {HTMLElement} node - An html element.
123
+ * @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
124
+ */
125
+ static fromHTML(node) {
126
+ const marginLeft = this.getMarginLeft(node);
127
+ return marginLeft && marginLeft >= 0 ? this.from(Math.floor(marginLeft / 16)) : null;
128
+ }
129
+ /**
130
+ * Retrieves the left margin value of an HTML element.
131
+ *
132
+ * @param {HTMLElement} node - An html element.
133
+ * @returns {number} margin left.
134
+ */
135
+ static getMarginLeft(node) {
136
+ const style = node.style;
137
+ let marginLeft;
138
+ if (style.marginLeft) {
139
+ marginLeft = style.marginLeft;
140
+ }
141
+ else if (style.margin) {
142
+ const margins = style.margin.split(' ');
143
+ switch (margins.length) {
144
+ case 4:
145
+ marginLeft = margins[3];
146
+ break;
147
+ case 2:
148
+ case 3:
149
+ marginLeft = margins[1];
150
+ break;
151
+ default:
152
+ marginLeft = margins[0];
153
+ break;
154
+ }
155
+ }
156
+ else {
157
+ return null;
158
+ }
159
+ return Number(marginLeft.replace('px', ''));
160
+ }
161
+ /**
162
+ * Generate the JSON item of the annotation
163
+ *
164
+ * @returns {Record<string, unknown>} JSON representation of the annotation
165
+ */
166
+ toJSON() {
167
+ return this.indent > 0 ? { indent: this.indent } : null;
168
+ }
169
+ /**
170
+ * Generate the style for the annotation
171
+ *
172
+ * @returns {Nullable<AnnotationStyle>} - Annotation style
173
+ */
174
+ render() {
175
+ return this.indent > 0 ? { 'margin-left': `${this.indent * 16}px` } : null;
176
+ }
177
+ }
178
+
179
+ /** The class contains some common method to modify the blocks property */
180
+ class BlockBaseOperator {
181
+ /**
182
+ * Replaces a specific block with an array of blocks within a RTEContentBlock array.
183
+ *
184
+ * @param {RTEBlock} referBlock - Used as a reference block to identify the block that needs to be replaced in the `blocks` array.
185
+ * @param {RTEBlock[]} blocks - An array of RTEBlock objects that you want to replace the `referBlock` with in the `blocks` array.
186
+ */
187
+ replaceBlockWithBlocks(referBlock, blocks) {
188
+ if (this.blocks) {
189
+ blocks.forEach((block) => {
190
+ block.parent = this;
191
+ });
192
+ this.blocks = this.blocks.flatMap((block) => {
193
+ if (block === referBlock) {
194
+ return blocks;
195
+ }
196
+ else {
197
+ return block;
198
+ }
199
+ });
200
+ }
201
+ }
202
+ /**
203
+ * Appends new blocks to an array and sets their parent property to a specific type.
204
+ *
205
+ * @param {RTEBlock[]} newBlocks - An array of `RTEBlock` objects that are being passed to the `appendChildBlocks` method.
206
+ */
207
+ appendChildBlocks(newBlocks) {
208
+ if (this.blocks) {
209
+ newBlocks.forEach((block) => {
210
+ block.parent = this;
211
+ });
212
+ this.blocks = this.blocks.concat(newBlocks);
213
+ }
214
+ }
215
+ /**
216
+ * Removes a specified RTEBlock from an array of blocks.
217
+ *
218
+ * @param {RTEBlock} blockToBeRemoved - The block that needs to be removed from the `blocks` array.
219
+ */
220
+ removeChildBlock(blockToBeRemoved) {
221
+ if (this.blocks) {
222
+ this.blocks = this.blocks.filter((block) => block !== blockToBeRemoved);
223
+ }
224
+ }
225
+ }
226
+
227
+ /** Append blocks or nodes to a block */
228
+ class AppendChildNodesAction extends ModifyContentAction {
229
+ constructor(childNodes) {
230
+ super();
231
+ this.type = ModifyContentActionType.APPEND_CHILD_NODES;
232
+ this.entityToBeAppended = childNodes;
233
+ }
234
+ }
235
+
236
+ /**
237
+ * Delete child node or child block from the current list action
238
+ *
239
+ * @example needRemovedNode.parentBlock.apply(new RemoveChildAction(needRemovedNode))
240
+ * @example needRemovedBlock.parent.apply(new RemoveChildAction(needRemovedBlock))
241
+ */
242
+ class RemoveChildAction extends ModifyContentAction {
243
+ constructor(childNode) {
244
+ super();
245
+ this.type = ModifyContentActionType.DELETE_CHILD;
246
+ this.entityToBeRemoved = childNode;
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Text style annotation
252
+ */
253
+ class TextStyleAnnotation extends BlockAnnotation {
254
+ constructor(textStyle) {
255
+ super();
256
+ this.type = BlockAnnotationTypeEnum.TEXT_STYLE;
257
+ this.textStyle = textStyle;
258
+ }
259
+ /**
260
+ * Generate the map item for the annotations
261
+ *
262
+ * @param {VegaRTETextStyleType} textStyle - the text style type
263
+ * @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
264
+ */
265
+ static from(textStyle) {
266
+ return [BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
267
+ }
268
+ /**
269
+ * Generate the map item for the annotation by html element
270
+ *
271
+ * @param {HTMLElement} node - An html element.
272
+ * @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
273
+ */
274
+ static fromHTML(node) {
275
+ return this.from(this.getTextStyle(node));
276
+ }
277
+ /**
278
+ * Get the type of block.
279
+ *
280
+ * @param {HTMLElement} node - An HTMLElement.
281
+ * @returns {VegaRTETextStyleType} text style type.
282
+ */
283
+ static getTextStyle(node) {
284
+ if (node.nodeType !== Node.TEXT_NODE && node.hasAttribute('data-type')) {
285
+ return node.getAttribute('data-type');
286
+ }
287
+ switch (node.style.fontSize) {
288
+ case '36px':
289
+ return 'title';
290
+ case '28px':
291
+ return 'subtitle';
292
+ case '22px':
293
+ return 'heading-1';
294
+ case '20px':
295
+ return 'heading-2';
296
+ case '18px':
297
+ return 'heading-3';
298
+ }
299
+ switch (node.nodeName) {
300
+ case 'H1':
301
+ return 'heading-1';
302
+ case 'H2':
303
+ return 'heading-2';
304
+ case 'H3':
305
+ return 'heading-3';
306
+ default:
307
+ return 'paragraph';
308
+ }
309
+ }
310
+ /**
311
+ * Generate the JSON representation of the annotation
312
+ *
313
+ * @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
314
+ */
315
+ toJSON() {
316
+ return { textStyle: this.textStyle };
317
+ }
318
+ /**
319
+ * Render the styles by block type
320
+ *
321
+ * @returns {AnnotationStyle} the styles to apply
322
+ */
323
+ render() {
324
+ const paragraphStyle = {
325
+ fontFamily: 'Inter',
326
+ fontSize: '16px',
327
+ lineHeight: '22px',
328
+ fontWeight: '500',
329
+ };
330
+ switch (this.textStyle) {
331
+ case 'paragraph': {
332
+ return paragraphStyle;
333
+ }
334
+ case 'title': {
335
+ return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
336
+ }
337
+ case 'subtitle': {
338
+ return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
339
+ }
340
+ case 'heading-1': {
341
+ return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
342
+ }
343
+ case 'heading-2': {
344
+ return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
345
+ }
346
+ case 'heading-3': {
347
+ return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
348
+ }
349
+ }
350
+ }
351
+ }
352
+
353
+ /**
354
+ * Abstract class for block
355
+ */
356
+ class RTEBlock extends BlockBaseOperator {
357
+ constructor(id) {
358
+ super();
359
+ this.annotationMap = new Map();
360
+ this.id = id;
361
+ }
362
+ /**
363
+ * The function `createAnnotationEntity` creates a block annotation entity based on the provided type
364
+ * and value.
365
+ *
366
+ * @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
367
+ * the type of annotation entity to create.
368
+ * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
369
+ * that will be used to create the annotation entity. It can be of any type depending on the specific
370
+ * annotation being created.
371
+ * @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
372
+ * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
373
+ */
374
+ static createAnnotationEntity(type, value) {
375
+ switch (type) {
376
+ case 'textAlign':
377
+ return HorizontalAlignmentAnnotation.from(value);
378
+ case 'indent':
379
+ return IndentAnnotation.from(value);
380
+ }
381
+ }
382
+ /**
383
+ * Create annotations for block element.
384
+ *
385
+ * @param {string} type - Annotations type.
386
+ * @param {HTMLElement} node - current node.
387
+ * @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} - result.
388
+ */
389
+ static createAnnotationEntityFromHTML(type, node) {
390
+ switch (type) {
391
+ case 'ALIGNMENT':
392
+ return HorizontalAlignmentAnnotation.fromHTML(node);
393
+ case 'TEXT_STYLE':
394
+ return TextStyleAnnotation.fromHTML(node);
395
+ case 'INDENT':
396
+ return IndentAnnotation.fromHTML(node);
397
+ }
398
+ }
399
+ /**
400
+ * Class to JSON object
401
+ *
402
+ * @returns {VegaRTEBlockBase} - JSON object
403
+ */
404
+ toJSON() {
405
+ const annotations = Array.from(this.annotationMap.values())
406
+ .filter((annotation) => annotation instanceof BlockAnnotation)
407
+ .reduce((record, annotation) => {
408
+ return Object.assign(Object.assign({}, record), annotation.toJSON());
409
+ }, {});
410
+ return Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {}));
411
+ }
412
+ /**
413
+ * Get annotation by type
414
+ *
415
+ * @param {keyof typeof BlockAnnotationTypeEnum} type - Annotation type
416
+ * @returns {Nullable<BlockAnnotation> | Nullable<LinkGroupAnnotation>} - Annotation
417
+ */
418
+ getAnnotationByType(type) {
419
+ return this.annotationMap.get(type);
420
+ }
421
+ /**
422
+ * Apply action to block
423
+ *
424
+ * @param {AnnotationAction} action - Annotation action
425
+ */
426
+ apply(action) {
427
+ this.doApply(action);
428
+ if (action.isFlushable) {
429
+ const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
430
+ if (domNode) {
431
+ const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
432
+ if (nodeSubject) {
433
+ ChangeManager.notify(nodeSubject, {});
434
+ }
435
+ }
436
+ }
437
+ }
438
+ /**
439
+ * Apply action to block
440
+ *
441
+ * @param {AnnotationAction|ModifyContentAction} action - Annotation action
442
+ */
443
+ doApply(action) {
444
+ if (action instanceof ModifyContentAction) {
445
+ this.doModifyActionApply(action);
446
+ }
447
+ else {
448
+ this.applyAnnotationAction(action);
449
+ }
450
+ }
451
+ /**
452
+ * Apply annotation action to block
453
+ *
454
+ * @param {AnnotationAction} action - Annotation action
455
+ */
456
+ applyAnnotationAction(action) {
457
+ const annotation = action.toAnnotation();
458
+ this.annotationMap.set(annotation.type, annotation);
459
+ typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
460
+ }
461
+ /**
462
+ * Get styles from annotations
463
+ *
464
+ * @returns {AnnotationStyle} - Annotation style
465
+ */
466
+ getStyles() {
467
+ return Array.from(this.annotationMap.values())
468
+ .filter((annotation) => annotation instanceof BlockAnnotation)
469
+ .map((annotation) => annotation.render())
470
+ .filter(isNonNullable)
471
+ .reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
472
+ }
473
+ /**
474
+ * Get classes from annotations
475
+ *
476
+ * @returns {AnnotationStyle} - Annotation style
477
+ */
478
+ getClasses() {
479
+ return Array.from(this.annotationMap.values())
480
+ .map((annotation) => { var _a; return (_a = annotation.renderClass) === null || _a === void 0 ? void 0 : _a.call(annotation); })
481
+ .filter(isNonNullable)
482
+ .reduce((pre, cur) => [pre, cur].join(' '), '');
483
+ }
484
+ /**
485
+ * Appends a list of RTENode objects to the current node's child nodes and sets the parent block of each node to the current node.
486
+ *
487
+ * @param {RTENode[]} nodesToBeAppended - An array of `RTENode` objects that you want to append to the current block.
488
+ */
489
+ appendChildNodes(nodesToBeAppended) {
490
+ nodesToBeAppended.forEach((node) => {
491
+ node.parentBlock = this;
492
+ });
493
+ this['nodes'] = this['nodes'].concat(nodesToBeAppended);
494
+ }
495
+ /**
496
+ * Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
497
+ *
498
+ * @param {RTEBlock} secondBlock - A block of content in a rich text editor, such as a paragraph, heading, image, etc.
499
+ */
500
+ mergeTwoBlocksNodes(secondBlock) {
501
+ if (this.type === secondBlock.type || (this.type !== 'image' && secondBlock.type !== 'image')) {
502
+ let shouldMergeNodes = secondBlock['nodes'];
503
+ if (this.type !== 'image') {
504
+ shouldMergeNodes = secondBlock['nodes'].filter((node) => node['text'] && node['text'] !== ZERO_WIDTH_SPACE);
505
+ }
506
+ this.apply(new AppendChildNodesAction(shouldMergeNodes));
507
+ secondBlock.parent.apply(new RemoveChildAction(secondBlock));
508
+ }
509
+ }
510
+ /**
511
+ * Concat the child nodes of multiple RTEBlocks if both are not images.
512
+ *
513
+ * @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
514
+ * @returns {RTENode[]} Array of connected block nodes
515
+ */
516
+ concatBlocksNodes(blocks) {
517
+ const nodes = [];
518
+ blocks.map((block) => {
519
+ if (block.type !== 'image') {
520
+ nodes.push(...block['nodes']);
521
+ block.parent.apply(new RemoveChildAction(block));
522
+ }
523
+ });
524
+ return nodes;
525
+ }
526
+ /**
527
+ * Returns the previous node relative to the current node in a rich text editor structure.
528
+ *
529
+ * @param {RTENode} currentNode - An object of type `RTENode`.
530
+ * @returns {Nullable<RTENode>} the previous block last node
531
+ */
532
+ getPreviousNode(currentNode) {
533
+ const currentBlock = currentNode.parentBlock;
534
+ const currentIndex = currentBlock['nodes'].indexOf(currentNode);
535
+ if (currentIndex > 0) {
536
+ return currentBlock['nodes'][currentIndex - 1];
537
+ }
538
+ else if (currentBlock.parent) {
539
+ const previousBlock = this.getPreviousBlock(currentBlock);
540
+ if (previousBlock) {
541
+ return this.getBlockLastNode(previousBlock);
542
+ }
543
+ }
544
+ }
545
+ /**
546
+ * Returns the next node relative to the current node in a rich text editor structure.
547
+ *
548
+ * @param {RTENode} currentNode - An object of type `RTENode`.
549
+ * @returns {Nullable<RTENode>} the next block first node
550
+ */
551
+ getNextNode(currentNode) {
552
+ const currentBlock = currentNode.parentBlock;
553
+ const currentIndex = currentBlock['nodes'].indexOf(currentNode);
554
+ if (currentBlock['nodes'][currentIndex + 1]) {
555
+ return currentBlock['nodes'][currentIndex + 1];
556
+ }
557
+ else if (currentBlock.parent) {
558
+ const nextBlock = this.getNextBlock(currentBlock);
559
+ if (nextBlock) {
560
+ return this.getBlockFirstNode(nextBlock);
561
+ }
562
+ }
563
+ }
564
+ /**
565
+ * Determines if a given node is the first node within the current state.
566
+ *
567
+ * @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
568
+ * @returns {boolean} True or false;
569
+ */
570
+ isContentFirstNode(currentNode) {
571
+ const currentBlock = currentNode.parentBlock;
572
+ const currentIndex = currentBlock['nodes'].indexOf(currentNode);
573
+ const parent = currentBlock.parent;
574
+ if (currentBlock.type === 'list-item') {
575
+ const listParent = parent.parent;
576
+ return (currentIndex === 0 &&
577
+ Array.isArray(parent.blocks) &&
578
+ parent.blocks[0] === currentBlock &&
579
+ listParent['type'] !== 'list-item' &&
580
+ Array.isArray(listParent.blocks) &&
581
+ listParent.blocks[0] === parent);
582
+ }
583
+ else {
584
+ return currentIndex === 0 && Array.isArray(parent.blocks) && parent.blocks[0] === currentBlock;
585
+ }
586
+ }
587
+ /**
588
+ * Returns the last node within a given RTE block, handling different block types accordingly.
589
+ *
590
+ * @param {RTEBlock} currentBlock - Returns the last node within that block.
591
+ * @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
592
+ */
593
+ getBlockLastNode(currentBlock) {
594
+ if (currentBlock.type === 'list-item') {
595
+ if (currentBlock['children'] && currentBlock['children'].length > 0) {
596
+ return this.getBlockLastNode(currentBlock['children'][currentBlock['children'].length - 1]);
597
+ }
598
+ else {
599
+ return currentBlock['nodes'][currentBlock['nodes'].length - 1];
600
+ }
601
+ }
602
+ else if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
603
+ if (currentBlock.blocks) {
604
+ const lastListItem = currentBlock.blocks[currentBlock.blocks.length - 1];
605
+ return this.getBlockLastNode(lastListItem);
606
+ }
607
+ }
608
+ else {
609
+ if (currentBlock['nodes']) {
610
+ return currentBlock['nodes'][currentBlock['nodes'].length - 1];
611
+ }
612
+ }
613
+ }
614
+ /**
615
+ * Returns the first node within a given RTE block, handling different block types accordingly.
616
+ *
617
+ * @param {RTEBlock} currentBlock - Returns the first node within that block.
618
+ * @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
619
+ */
620
+ getBlockFirstNode(currentBlock) {
621
+ if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
622
+ if (currentBlock.blocks) {
623
+ const firstListItem = currentBlock.blocks[0];
624
+ return this.getBlockFirstNode(firstListItem);
625
+ }
626
+ }
627
+ else {
628
+ if (currentBlock['nodes']) {
629
+ return currentBlock['nodes'][0];
630
+ }
631
+ }
632
+ }
633
+ /**
634
+ * TODO: The getPreviousBlock add nest list support
635
+ * This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
636
+ *
637
+ * @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
638
+ * @returns {Nullable<RTEBlock>} The previous block if existing
639
+ */
640
+ getPreviousBlock(currentBlock) {
641
+ if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
642
+ const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
643
+ if (currentBlockIndex > 0) {
644
+ return currentBlock.parent.blocks[currentBlockIndex - 1];
645
+ }
646
+ else if ((currentBlock.parent['type'] === 'number-list' ||
647
+ currentBlock.parent['type'] === 'bullet-list') &&
648
+ currentBlockIndex === 0) {
649
+ return this.getPreviousBlock(currentBlock.parent);
650
+ }
651
+ }
652
+ }
653
+ /**
654
+ * This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
655
+ *
656
+ * @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
657
+ * @returns {Nullable<RTEBlock>} The next block if existing
658
+ */
659
+ getNextBlock(currentBlock) {
660
+ if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
661
+ const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
662
+ if (currentBlock.parent.blocks[currentBlockIndex + 1]) {
663
+ return currentBlock.parent.blocks[currentBlockIndex + 1];
664
+ }
665
+ else if (currentBlock.type === 'list-item' &&
666
+ currentBlock.parent.blocks.length === currentBlockIndex + 1) {
667
+ return this.getNextBlock(currentBlock.parent);
668
+ }
669
+ }
670
+ }
671
+ /**
672
+ * Replaces a specific node with an array of nodes within a RTENode array.
673
+ *
674
+ * @param {RTENode} referNode - Used as a reference node to identify the node that needs to be replaced in the `nodes` array.
675
+ * @param {RTENode[]} nodes - An array of RTENode objects that you want to replace the `referNode` with in the `nodes` array.
676
+ */
677
+ replaceNodeWithNodes(referNode, nodes) {
678
+ if (this['nodes']) {
679
+ nodes.forEach((node) => {
680
+ node.parentBlock = this;
681
+ });
682
+ this['nodes'] = this['nodes'].flatMap((node) => {
683
+ if (node === referNode) {
684
+ return nodes;
685
+ }
686
+ else {
687
+ return node;
688
+ }
689
+ });
690
+ }
691
+ }
692
+ }
693
+
694
+ /**
695
+ * Annotation for image
696
+ */
697
+ class ImageAnnotation extends NodeAnnotation {
698
+ constructor(size = 'md', alt) {
699
+ super();
700
+ this.type = NodeAnnotationTypeEnum.IMAGE;
701
+ this.size = size;
702
+ this.alt = alt;
703
+ }
704
+ /**
705
+ * Generate the map item for the annotation
706
+ *
707
+ * @param {string} size - Image size
708
+ * @param {string} alt - Image alt
709
+ * @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
710
+ */
711
+ static from(size, alt) {
712
+ return [NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
713
+ }
714
+ /**
715
+ * Generate the map item for the annotation
716
+ *
717
+ * @param {VegaRichTextImageEditorSizeType} size - size.
718
+ * @param {string} alt - alt.
719
+ * @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
720
+ */
721
+ static fromHTML(size, alt) {
722
+ return this.from(size || 'md', alt);
723
+ }
724
+ /**
725
+ * Generate the JSON representation of the annotation
726
+ *
727
+ * @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
728
+ */
729
+ toJSON() {
730
+ return isNonNullable(this.alt)
731
+ ? {
732
+ size: this.size,
733
+ alt: this.alt,
734
+ }
735
+ : {
736
+ size: this.size,
737
+ };
738
+ }
739
+ /**
740
+ * Generate the style for the image
741
+ *
742
+ * @returns {Nullable<AnnotationStyle>} image style
743
+ */
744
+ render() {
745
+ switch (this.size) {
746
+ case 'sm': {
747
+ return { width: '25%' };
748
+ }
749
+ case 'md': {
750
+ return { width: '50%' };
751
+ }
752
+ case 'lg': {
753
+ return { width: '100%' };
754
+ }
755
+ }
756
+ }
757
+ }
758
+
759
+ /**
760
+ * Action to add an image annotation to the editor
761
+ */
762
+ class ImageAnnotationAction extends AnnotationAction {
763
+ constructor(size, alt) {
764
+ super();
765
+ this.isFlushable = true;
766
+ this.size = size;
767
+ this.alt = alt;
768
+ }
769
+ /**
770
+ * Converts the action to an annotation
771
+ *
772
+ * @returns {ImageAnnotation} The annotation
773
+ */
774
+ toAnnotation() {
775
+ return new ImageAnnotation(this.size, this.alt);
776
+ }
777
+ }
778
+
779
+ class RTEImageNode extends RTENode {
780
+ constructor(id, url, parentBlock, annotationMap) {
781
+ super(id, annotationMap);
782
+ this.type = NodeTypeEnum.IMAGE;
783
+ this.url = url;
784
+ this.parentBlock = parentBlock;
785
+ }
786
+ static from(image, parentBlock) {
787
+ const imageNode = new RTEImageNode(image.id, image.url, parentBlock);
788
+ let annotations;
789
+ if (!image.annotations || Object.keys(image.annotations).length === 0) {
790
+ annotations = { size: 'md' };
791
+ }
792
+ else {
793
+ annotations = image.annotations;
794
+ }
795
+ imageNode.annotationMap = new Map(Object.keys(annotations)
796
+ .map(() => ImageAnnotation.from(annotations.size, annotations.alt))
797
+ .filter(isNonNullable));
798
+ return imageNode;
799
+ }
800
+ static fromHTML(node, parentBlock) {
801
+ const src = node.nodeName === 'IMG'
802
+ ? node.src
803
+ : node.querySelector('img').src;
804
+ const size = node.size;
805
+ const imageNode = new RTEImageNode(generateUUID(), src, parentBlock);
806
+ imageNode.annotationMap = new Map([ImageAnnotation.fromHTML(size, node.alt)]);
807
+ return imageNode;
808
+ }
809
+ toJSON() {
810
+ const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
811
+ const annotations = {};
812
+ if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.size) {
813
+ annotations.size = imageAnnotation.size;
814
+ }
815
+ if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt) {
816
+ annotations.alt = imageAnnotation.alt;
817
+ }
818
+ return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
819
+ }
820
+ render({ editable } = {}) {
821
+ const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
822
+ const size = imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.size;
823
+ const alt = imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt;
824
+ const handleChange = ({ detail, }) => {
825
+ switch (detail.action) {
826
+ case 'edit': {
827
+ const size = detail.payload.size;
828
+ const alt = detail.payload.alt;
829
+ this.apply(new ImageAnnotationAction(size, alt));
830
+ break;
831
+ }
832
+ /*
833
+ * The below method is e2e-test covered in
834
+ * @see{module:vega-rich-text-editor-image-click-delete-button}
835
+ */
836
+ /* istanbul ignore next */
837
+ case 'delete': {
838
+ const event = new InputEvent('beforeinput', {
839
+ inputType: 'deleteContentBackward',
840
+ bubbles: true,
841
+ });
842
+ setTimeout(() => {
843
+ stateEntityRenderingRegistry.getDOMByEntity(this).dispatchEvent(event);
844
+ }, 50);
845
+ break;
846
+ }
847
+ }
848
+ };
849
+ return editable ? (h("vega-rich-text-image-editor", { style: this.getStyles(), size: size, alt: alt, ref: (ref) => {
850
+ DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, handleChange);
851
+ } }, this.renderImage(editable, alt))) : (this.renderImage(editable, alt));
852
+ }
853
+ doAnnotationActionApply(action) {
854
+ const annotation = action.toAnnotation();
855
+ this.annotationMap.set(annotation.type, annotation);
856
+ }
857
+ // placeholder method
858
+ /* istanbul ignore next */
859
+ doModifyActionApply(action) {
860
+ }
861
+ registerRef(ref) {
862
+ if (ref) {
863
+ stateEntityRenderingRegistry.register(ref, this);
864
+ }
865
+ }
866
+ renderImage(editable, alt) {
867
+ return (h("img", { style: editable ? { width: '100%' } : this.getStyles(), alt: alt, src: this.url, ref: this.registerRef.bind(this) }));
868
+ }
869
+ }
870
+
871
+ /**
872
+ * Clear the current block nodes and append new nodes
873
+ *
874
+ * @example block.apply(new ReplaceChildNodesAction(newNodes))
875
+ */
876
+ class ReplaceChildNodesAction extends ModifyContentAction {
877
+ constructor(newChildNodes) {
878
+ super();
879
+ this.type = ModifyContentActionType.REPLACE_CHILD_NODES;
880
+ this.newChildNodes = newChildNodes;
881
+ }
882
+ }
883
+
884
+ /**
885
+ * Insert a new block after a existing block
886
+ *
887
+ * @example currentBlock.parent.apply(new InsertBlocksAfterAction(currentBlock, newBlock, ...))
888
+ */
889
+ class InsertBlocksAfterAction extends ModifyContentAction {
890
+ constructor(referBlock, ...blocksToBeInserted) {
891
+ super();
892
+ this.type = ModifyContentActionType.INSERT_BLOCKS_AFTER;
893
+ this.referBlock = referBlock;
894
+ this.blocksToBeInserted = blocksToBeInserted;
895
+ }
896
+ }
897
+
898
+ /**
899
+ * Split the block with a split point node.
900
+ * The property `newBlock` use to store the new create block if need.
901
+ *
902
+ * @example block.apply(new SplitBlockWithNodeAction(node, offset))
903
+ */
904
+ class SplitBlockWithNodeAction extends ModifyContentAction {
905
+ constructor(splitPointNode, startOffsetOfNode) {
906
+ super();
907
+ this.type = ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
908
+ this.splitPointNode = splitPointNode;
909
+ this.startOffsetOfNode = startOffsetOfNode;
910
+ }
911
+ }
912
+
913
+ /**
914
+ * Action to change the text style of a block
915
+ */
916
+ class TextStyleAnnotationAction extends AnnotationAction {
917
+ constructor(textStyle, bold) {
918
+ super();
919
+ this.isFlushable = true;
920
+ this.textStyle = textStyle;
921
+ this.bold = bold;
922
+ }
923
+ /**
924
+ * Converts the action to a block annotation
925
+ *
926
+ * @returns {BlockAnnotation} the block annotation
927
+ */
928
+ toAnnotation() {
929
+ return new TextStyleAnnotation(this.textStyle);
930
+ }
931
+ }
932
+
933
+ /**
934
+ * Action to toggle bold annotation
935
+ */
936
+ class BoldAnnotationAction extends TextSplittableAction {
937
+ constructor(bold) {
938
+ super();
939
+ this.isFlushable = true;
940
+ this.bold = bold;
941
+ }
942
+ /**
943
+ * Converts the action to an annotation
944
+ *
945
+ * @returns {BoldAnnotation} the annotation
946
+ */
947
+ toAnnotation() {
948
+ return new BoldAnnotation(this.bold);
949
+ }
950
+ }
951
+
952
+ /**
953
+ * Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
954
+ *
955
+ * @example firstBlock.apply(new MergeTwoBlocksNodesAction(secondBlock))
956
+ */
957
+ class MergeTwoBlocksNodesAction extends ModifyContentAction {
958
+ constructor(blockNeedToBeMerged) {
959
+ super();
960
+ this.type = ModifyContentActionType.MERGE_TWO_BLOCKS_NODES;
961
+ this.blockNeedToBeMerged = blockNeedToBeMerged;
962
+ }
963
+ }
964
+
965
+ /**
966
+ * Insert a new block before a existing block
967
+ *
968
+ * @example currentBlock.parent.apply(new InsertBlocksBeforeAction(currentBlock, newBlock, ...))
969
+ */
970
+ class InsertBlocksBeforeAction extends ModifyContentAction {
971
+ constructor(referBlock, ...blocksToBeInserted) {
972
+ super();
973
+ this.type = ModifyContentActionType.INSERT_BLOCKS_BEFORE;
974
+ this.referBlock = referBlock;
975
+ this.blocksToBeInserted = blocksToBeInserted;
976
+ }
977
+ }
978
+
979
+ /**
980
+ * Text block
981
+ */
982
+ class RTETextBlock extends RTEBlock {
983
+ constructor(id, type) {
984
+ super(id);
985
+ this.nodes = [];
986
+ this.type = type;
987
+ if (RTETextBlock.isAcceptableTextStyle(type)) {
988
+ super.annotationMap = new Map([TextStyleAnnotation.from(type)]);
989
+ }
990
+ else {
991
+ super.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
992
+ }
993
+ }
994
+ static from(block) {
995
+ const textBlock = new RTETextBlock(block.id, block.type);
996
+ const { annotations } = block;
997
+ textBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, textBlock));
998
+ if (annotations) {
999
+ Object.entries(annotations).forEach(([type, value]) => {
1000
+ const item = this.createAnnotationEntity(type, value);
1001
+ if (isNonNullable(item)) {
1002
+ textBlock.annotationMap.set(...item);
1003
+ }
1004
+ });
1005
+ }
1006
+ return textBlock;
1007
+ }
1008
+ static fromHTML(node, blockType) {
1009
+ const textBlock = new RTETextBlock(generateUUID(), blockType);
1010
+ textBlock.nodes = Array.from(node.childNodes).map((item) => RTETextNode.fromHTML(item, textBlock));
1011
+ Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
1012
+ const item = this.createAnnotationEntityFromHTML(type, node);
1013
+ if (isNonNullable(item)) {
1014
+ textBlock.annotationMap.set(...item);
1015
+ }
1016
+ });
1017
+ return textBlock;
1018
+ }
1019
+ /**
1020
+ * The function `createAnnotationEntity` creates a block annotation entity based on the provided type
1021
+ * and value.
1022
+ *
1023
+ * @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
1024
+ * the type of annotation entity to create.
1025
+ * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
1026
+ * that will be used to create the annotation entity. It can be of any type depending on the specific
1027
+ * annotation being created.
1028
+ * @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
1029
+ * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
1030
+ */
1031
+ static createAnnotationEntity(type, value) {
1032
+ if (type === 'textStyle') {
1033
+ return TextStyleAnnotation.from(value);
1034
+ }
1035
+ else {
1036
+ return super.createAnnotationEntity(type, value);
1037
+ }
1038
+ }
1039
+ static isAcceptableTextStyle(type) {
1040
+ return ['title', 'subtitle', 'paragraph', 'heading-1', 'heading-2', 'heading-3'].includes(type);
1041
+ }
1042
+ mergeNodes(action) {
1043
+ this.nodes = this.nodes.reduce((prev, cur) => {
1044
+ const lastNode = prev.at(-1);
1045
+ if (action instanceof LinkAnnotationAction && action.needMergeNode) {
1046
+ const lastNodeLinkAnnotation = lastNode === null || lastNode === void 0 ? void 0 : lastNode.getAnnotationByType(NodeAnnotationTypeEnum.LINK);
1047
+ const curNodeLinkAnnotation = cur.getAnnotationByType(NodeAnnotationTypeEnum.LINK);
1048
+ if (lastNodeLinkAnnotation &&
1049
+ curNodeLinkAnnotation &&
1050
+ lastNodeLinkAnnotation.toEqual(curNodeLinkAnnotation)) {
1051
+ return prev;
1052
+ }
1053
+ }
1054
+ // TODO: handle other cases like merge bold nodes
1055
+ return [...prev, cur];
1056
+ }, []);
1057
+ }
1058
+ toJSON() {
1059
+ return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.nodes.map((node) => node.toJSON()) });
1060
+ }
1061
+ cloneWithNodes(nodes) {
1062
+ const block = new RTETextBlock(generateUUID(), this.type);
1063
+ block.nodes = [];
1064
+ block.apply(new AppendChildNodesAction(nodes));
1065
+ return block;
1066
+ }
1067
+ isNotEmpty() {
1068
+ return this.nodes.length > 0 && this.nodes.some((node) => !node.isEmpty());
1069
+ }
1070
+ getLastNode() {
1071
+ return this.nodes[this.nodes.length - 1];
1072
+ }
1073
+ render(renderContext, children) {
1074
+ const BlockTag = this.getBlockTagByType(this.type);
1075
+ return (h(BlockTag, { ref: this.registerRef.bind(this), style: this.getStyles(), class: super.getClasses() },
1076
+ this.renderNodes(renderContext),
1077
+ children));
1078
+ }
1079
+ registerRef(ref) {
1080
+ if (ref) {
1081
+ stateEntityRenderingRegistry.register(ref, this);
1082
+ }
1083
+ }
1084
+ renderNodes(renderConfig = {}) {
1085
+ const linkGroupAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
1086
+ return linkGroupAnnotation
1087
+ ? linkGroupAnnotation.renderNodes(this.nodes, renderConfig)
1088
+ : this.nodes.map((node) => node.render());
1089
+ }
1090
+ doAnnotationActionApply(action) {
1091
+ if (action instanceof TextStyleAnnotationAction) {
1092
+ if (this.type !== 'list-item') {
1093
+ this.type = action.textStyle;
1094
+ }
1095
+ if (action.bold) {
1096
+ this.nodes.forEach((node) => {
1097
+ const boldAnnotationAction = new BoldAnnotationAction(true);
1098
+ boldAnnotationAction.doSplit = false;
1099
+ node.apply(boldAnnotationAction);
1100
+ });
1101
+ }
1102
+ else {
1103
+ this.nodes.forEach((node) => {
1104
+ node.apply(new DeleteNodeAnnotationAction(NodeAnnotationTypeEnum.BOLD));
1105
+ });
1106
+ }
1107
+ return;
1108
+ }
1109
+ if (action instanceof LinkGroupAnnotationAction) {
1110
+ const linkGroupAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
1111
+ if (linkGroupAnnotation) {
1112
+ const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
1113
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
1114
+ this.annotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
1115
+ }
1116
+ return;
1117
+ }
1118
+ }
1119
+ /**
1120
+ * Apply a modify action to block
1121
+ *
1122
+ * @param {ModifyContentAction} action - Modify action
1123
+ */
1124
+ doModifyActionApply(action) {
1125
+ switch (action.type) {
1126
+ case ModifyContentActionType.DELETE_CHILD:
1127
+ this.removeChildNode(action);
1128
+ break;
1129
+ case ModifyContentActionType.APPEND_CHILD_NODES:
1130
+ this.appendChildNodes(action.entityToBeAppended);
1131
+ break;
1132
+ case ModifyContentActionType.CLEAR_CHILD_NODES:
1133
+ this.nodes = [];
1134
+ break;
1135
+ case ModifyContentActionType.SPLIT_BLOCK_WITH_NODE:
1136
+ action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode);
1137
+ break;
1138
+ case ModifyContentActionType.REPLACE_CHILD_NODES:
1139
+ this.nodes = [];
1140
+ this.appendChildNodes(action.newChildNodes);
1141
+ break;
1142
+ case ModifyContentActionType.MERGE_TWO_BLOCKS_NODES:
1143
+ this.mergeTwoBlocksNodes(action.blockNeedToBeMerged);
1144
+ break;
1145
+ case ModifyContentActionType.BREAK_SINGLE_BLOCK:
1146
+ action.newBlock = this.breakSingleTextBlock(action.startContainerNode, action.startOffset);
1147
+ break;
1148
+ case ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK:
1149
+ action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset);
1150
+ break;
1151
+ case ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS:
1152
+ action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks);
1153
+ break;
1154
+ case ModifyContentActionType.TRANSFORM_LIST_BLOCK:
1155
+ this.convertParagraphToList(action);
1156
+ break;
1157
+ case ModifyContentActionType.DELETE_BLOCK_CONTENT:
1158
+ this.deleteNodeContent(action);
1159
+ break;
1160
+ case ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
1161
+ this.insertImage(action);
1162
+ break;
1163
+ case ModifyContentActionType.INSERT_NODES_BEFORE:
1164
+ this.replaceNodeWithNodes(action.referNode, [
1165
+ ...action.nodesToBeInserted,
1166
+ action.referNode,
1167
+ ]);
1168
+ break;
1169
+ }
1170
+ }
1171
+ splitTextNodeBlock(splitNode, startOffsetOfNode) {
1172
+ if (splitNode) {
1173
+ const beforeText = splitNode.text.slice(0, startOffsetOfNode);
1174
+ const afterText = splitNode.text.slice(startOffsetOfNode);
1175
+ const nodesSplitIndex = this.nodes.indexOf(splitNode);
1176
+ if (nodesSplitIndex > -1) {
1177
+ const beforeNodes = this.nodes.slice(0, nodesSplitIndex);
1178
+ const afterNodes = this.nodes.slice(nodesSplitIndex + 1);
1179
+ if (beforeText) {
1180
+ beforeNodes.push(splitNode.cloneWithText(beforeText));
1181
+ }
1182
+ if (afterText) {
1183
+ afterNodes.unshift(splitNode.cloneWithText(afterText));
1184
+ }
1185
+ this.apply(new ReplaceChildNodesAction(beforeNodes));
1186
+ const newBlock = this.cloneWithNodes(afterNodes);
1187
+ this.parent.apply(new InsertBlocksAfterAction(this, newBlock));
1188
+ return newBlock;
1189
+ }
1190
+ }
1191
+ }
1192
+ isCaretPositionAtStart(node, startOffset) {
1193
+ return node === this.nodes[0] && startOffset === 0;
1194
+ }
1195
+ isCaretPositionAtEnd(node, startOffset) {
1196
+ const lastNode = this.nodes[this.nodes.length - 1];
1197
+ return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
1198
+ }
1199
+ lineBreakSingleBlock(splitNode, startOffsetOfNode) {
1200
+ if (splitNode) {
1201
+ const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
1202
+ const beforeText = splitNode.text.slice(0, startOffsetOfNode);
1203
+ const afterText = splitNode.text.slice(startOffsetOfNode);
1204
+ const nodesSplitIndex = this.nodes.indexOf(splitNode);
1205
+ if (nodesSplitIndex > -1) {
1206
+ const beforeNodes = this.nodes.slice(0, nodesSplitIndex);
1207
+ const afterNodes = this.nodes.slice(nodesSplitIndex + 1);
1208
+ if (beforeText) {
1209
+ beforeNodes.push(splitNode.cloneWithText(beforeText));
1210
+ }
1211
+ if (afterText) {
1212
+ afterNodes.unshift(splitNode.cloneWithText(afterText));
1213
+ }
1214
+ this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes);
1215
+ }
1216
+ return lineBreakNode;
1217
+ }
1218
+ }
1219
+ lineBreakMultipleBlocks(selectedBlocks) {
1220
+ const beforeNodes = this['nodes'];
1221
+ const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
1222
+ const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
1223
+ this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes);
1224
+ return lineBreakNode;
1225
+ }
1226
+ deleteNodeContent(action) {
1227
+ const startContainerNode = action.startContainerNode;
1228
+ const startOffset = action.startOffset;
1229
+ if (startOffset !== 0 && !startContainerNode.isEmpty()) {
1230
+ const newText = startContainerNode.text.slice(0, startOffset - 1) +
1231
+ startContainerNode.text.slice(startOffset);
1232
+ startContainerNode.apply(new UpdateTextAction(newText));
1233
+ if (newText) {
1234
+ action.previousNode = startContainerNode;
1235
+ return;
1236
+ }
1237
+ else {
1238
+ const previousNode = this.getPreviousNode(startContainerNode);
1239
+ // Remove the last character will not delete paragraph, the paragraph will removed after press delete again
1240
+ if ((previousNode && previousNode.parentBlock === this && previousNode['text'] === '\n') ||
1241
+ this.nodes.length === 1) {
1242
+ action.previousNode = startContainerNode;
1243
+ return;
1244
+ }
1245
+ else {
1246
+ this.apply(new RemoveChildAction(startContainerNode));
1247
+ action.previousNode = previousNode;
1248
+ return;
1249
+ }
1250
+ }
1251
+ }
1252
+ else {
1253
+ let previousNode = this.getPreviousNode(startContainerNode);
1254
+ let nextNode = null;
1255
+ if (this.nodes.length && previousNode && previousNode.parentBlock !== this) {
1256
+ if (startContainerNode.isEmpty()) {
1257
+ this.apply(new RemoveChildAction(startContainerNode));
1258
+ }
1259
+ previousNode.parentBlock.apply(new MergeTwoBlocksNodesAction(this));
1260
+ }
1261
+ else {
1262
+ if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
1263
+ nextNode = this.getNextNode(startContainerNode);
1264
+ }
1265
+ /**
1266
+ * Remove line break
1267
+ * @example caret at the first line
1268
+ * \n
1269
+ * test
1270
+ */
1271
+ if (startContainerNode.isEmpty()) {
1272
+ this.apply(new RemoveChildAction(startContainerNode));
1273
+ }
1274
+ /**
1275
+ * Remove line break
1276
+ * @example caret at the begin of second line
1277
+ * \n
1278
+ * test
1279
+ */
1280
+ if (previousNode instanceof RTETextNode && previousNode.isEmpty()) {
1281
+ const shouldRemoveNode = previousNode;
1282
+ previousNode = this.getPreviousNode(previousNode);
1283
+ shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
1284
+ if (!previousNode) {
1285
+ nextNode = startContainerNode;
1286
+ }
1287
+ }
1288
+ }
1289
+ //Remove the paragraph block if the content is empty
1290
+ if (this.nodes.length === 0) {
1291
+ this.parent.apply(new RemoveChildAction(this));
1292
+ }
1293
+ if (previousNode) {
1294
+ action.previousNode = previousNode;
1295
+ }
1296
+ else if (nextNode) {
1297
+ action.nextNode = nextNode;
1298
+ }
1299
+ }
1300
+ }
1301
+ removeChildNode(action) {
1302
+ this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
1303
+ if (this.nodes.length === 0) {
1304
+ this.parent.apply(new RemoveChildAction(this));
1305
+ }
1306
+ }
1307
+ mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes) {
1308
+ if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
1309
+ afterNodes.push(new RTETextNode(generateUUID(), '\n', this, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
1310
+ }
1311
+ this.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
1312
+ }
1313
+ getBlockTagByType(type) {
1314
+ switch (type) {
1315
+ case 'title':
1316
+ case 'subtitle':
1317
+ return `div`;
1318
+ case 'heading-1':
1319
+ return `h1`;
1320
+ case 'heading-2':
1321
+ return `h2`;
1322
+ case 'heading-3':
1323
+ return `h3`;
1324
+ case 'paragraph':
1325
+ return 'p';
1326
+ case 'list-item':
1327
+ return 'li';
1328
+ }
1329
+ }
1330
+ breakSingleTextBlock(splitNode, startOffsetOfNode) {
1331
+ const newParagraph = this.copyInlineStyleToNewParagraph(splitNode);
1332
+ if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
1333
+ this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
1334
+ }
1335
+ else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
1336
+ this.parent.apply(new InsertBlocksBeforeAction(this, newParagraph));
1337
+ }
1338
+ else {
1339
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1340
+ this.apply(splitBlockAction);
1341
+ return splitBlockAction.newBlock;
1342
+ }
1343
+ return newParagraph;
1344
+ }
1345
+ convertParagraphToList(action) {
1346
+ const bulletList = this.parent.createList(action.listType);
1347
+ const listItems = action.selectedBlocks.map((node) => this.parent.toListItem(node));
1348
+ bulletList.apply(new AppendChildNodesAction(listItems));
1349
+ this.parent.apply(new InsertBlocksAfterAction(action.selectedBlocks[0], bulletList));
1350
+ action.selectedBlocks.forEach((node) => {
1351
+ node.parent.apply(new RemoveChildAction(node));
1352
+ });
1353
+ }
1354
+ insertImage(action) {
1355
+ const splitNode = action.splitPointNode;
1356
+ const startOffsetOfNode = action.startOffsetOfNode;
1357
+ const newImageBlock = action.imageBlockToBeInserted;
1358
+ if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
1359
+ this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
1360
+ }
1361
+ else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
1362
+ this.parent.apply(new InsertBlocksBeforeAction(this, newImageBlock));
1363
+ }
1364
+ else {
1365
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1366
+ this.apply(splitBlockAction);
1367
+ this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
1368
+ }
1369
+ }
1370
+ copyInlineStyleToNewParagraph(needCopedNode) {
1371
+ const textNode = needCopedNode.cloneWithText('');
1372
+ // The link annotation don't need inherited
1373
+ textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
1374
+ const newParagraph = new RTETextBlock(generateUUID(), 'paragraph');
1375
+ newParagraph.apply(new AppendChildNodesAction([textNode]));
1376
+ return newParagraph;
1377
+ }
1378
+ }
1379
+
1380
+ /**
1381
+ * Image block
1382
+ */
1383
+ class RTEImageBlock extends RTEBlock {
1384
+ constructor(id) {
1385
+ super(id);
1386
+ this.type = 'image';
1387
+ this.nodes = [];
1388
+ }
1389
+ static from(block) {
1390
+ const imageBlock = new RTEImageBlock(block.id);
1391
+ const { annotations } = block;
1392
+ imageBlock.nodes = block.nodes.map((image) => RTEImageNode.from(image, imageBlock));
1393
+ if (annotations) {
1394
+ Object.entries(annotations).forEach(([type, value]) => {
1395
+ const item = this.createAnnotationEntity(type, value);
1396
+ if (isNonNullable(item)) {
1397
+ imageBlock.annotationMap.set(...item);
1398
+ }
1399
+ });
1400
+ }
1401
+ return imageBlock;
1402
+ }
1403
+ static fromHTML(node) {
1404
+ const nodes = node.nodeName === 'IMG' ? [node] : Array.from(node.children);
1405
+ const imageBlock = new RTEImageBlock(generateUUID());
1406
+ imageBlock.nodes = nodes.map((item) => RTEImageNode.fromHTML(item, imageBlock));
1407
+ Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
1408
+ const item = this.createAnnotationEntityFromHTML(type, node);
1409
+ if (isNonNullable(item)) {
1410
+ imageBlock.annotationMap.set(...item);
1411
+ }
1412
+ });
1413
+ return imageBlock;
1414
+ }
1415
+ toJSON() {
1416
+ return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
1417
+ }
1418
+ isNotEmpty() {
1419
+ return this.nodes.length > 0 && this.nodes.some((node) => node.url.length > 0);
1420
+ }
1421
+ getLastNode() {
1422
+ return this.nodes[this.nodes.length - 1];
1423
+ }
1424
+ render(renderContext) {
1425
+ return (h("div", { style: Object.assign({}, this.getStyles()), ref: this.registerRef.bind(this), class: super.getClasses() }, this.nodes.map((node) => {
1426
+ return node.render(renderContext);
1427
+ })));
1428
+ }
1429
+ /**
1430
+ * Apply modify action to block
1431
+ *
1432
+ * @param {ModifyContentAction} action - Modify action
1433
+ */
1434
+ doModifyActionApply(action) {
1435
+ switch (action.type) {
1436
+ case ModifyContentActionType.DELETE_CHILD:
1437
+ this.removeChildNode(action);
1438
+ break;
1439
+ case ModifyContentActionType.CLEAR_CHILD_NODES:
1440
+ this.nodes = [];
1441
+ break;
1442
+ case ModifyContentActionType.APPEND_CHILD_NODES:
1443
+ this.appendChildNodes(action.entityToBeAppended);
1444
+ break;
1445
+ case ModifyContentActionType.REPLACE_CHILD_NODES:
1446
+ this.nodes = [];
1447
+ this.appendChildNodes(action.newChildNodes);
1448
+ break;
1449
+ case ModifyContentActionType.SPLIT_BLOCK_WITH_NODE:
1450
+ action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode);
1451
+ break;
1452
+ case ModifyContentActionType.MERGE_TWO_BLOCKS_NODES:
1453
+ this.mergeTwoBlocksNodes(action.blockNeedToBeMerged);
1454
+ break;
1455
+ case ModifyContentActionType.BREAK_SINGLE_BLOCK:
1456
+ action.newBlock = this.breakSingleBlock(action.startContainerNode, action.startOffset);
1457
+ break;
1458
+ case ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK:
1459
+ action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset);
1460
+ break;
1461
+ case ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS:
1462
+ action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks);
1463
+ break;
1464
+ case ModifyContentActionType.DELETE_BLOCK_CONTENT:
1465
+ this.deleteNodeContent(action);
1466
+ break;
1467
+ case ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
1468
+ this.insertImage(action);
1469
+ break;
1470
+ case ModifyContentActionType.INSERT_NODES_AFTER:
1471
+ this.replaceNodeWithNodes(action.referNode, [
1472
+ action.referNode,
1473
+ ...action.nodesToBeInserted,
1474
+ ]);
1475
+ break;
1476
+ case ModifyContentActionType.INSERT_NODES_BEFORE:
1477
+ this.replaceNodeWithNodes(action.referNode, [
1478
+ ...action.nodesToBeInserted,
1479
+ action.referNode,
1480
+ ]);
1481
+ break;
1482
+ }
1483
+ }
1484
+ registerRef(ref) {
1485
+ if (ref) {
1486
+ stateEntityRenderingRegistry.register(ref, this);
1487
+ }
1488
+ }
1489
+ removeChildNode(action) {
1490
+ this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
1491
+ if (this.nodes.length === 0) {
1492
+ this.parent.apply(new RemoveChildAction(this));
1493
+ }
1494
+ }
1495
+ /**
1496
+ * The image offset should be 0 or 1
1497
+ * <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
1498
+ *
1499
+ * @param {RTEImageNode} imageNode The split point image node
1500
+ * @param {number} imageOffset The cursor point 0 | 1
1501
+ */
1502
+ splitImageNodes(imageNode, imageOffset) {
1503
+ const nodesSplitIndex = this.nodes.indexOf(imageNode);
1504
+ if (nodesSplitIndex > -1) {
1505
+ const beforeNodes = this.nodes.slice(0, nodesSplitIndex + imageOffset);
1506
+ const afterNodes = this.nodes.slice(nodesSplitIndex + imageOffset);
1507
+ this.apply(new ReplaceChildNodesAction(beforeNodes));
1508
+ const newBlock = this.cloneWithNodes(afterNodes);
1509
+ this.parent.apply(new InsertBlocksAfterAction(this, newBlock));
1510
+ return newBlock;
1511
+ }
1512
+ }
1513
+ cloneWithNodes(nodes) {
1514
+ const block = new RTEImageBlock(generateUUID());
1515
+ block.nodes = [];
1516
+ block.apply(new AppendChildNodesAction(nodes));
1517
+ return block;
1518
+ }
1519
+ breakSingleBlock(splitNode, startOffsetOfNode) {
1520
+ const newParagraph = RTETextBlock.from({
1521
+ id: generateUUID(),
1522
+ type: 'paragraph',
1523
+ nodes: [{ id: generateUUID(), type: 'text', text: '' }],
1524
+ });
1525
+ if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
1526
+ this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
1527
+ }
1528
+ else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
1529
+ this.parent.apply(new InsertBlocksBeforeAction(this, newParagraph));
1530
+ }
1531
+ else {
1532
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1533
+ this.apply(splitBlockAction);
1534
+ return splitBlockAction.newBlock;
1535
+ }
1536
+ return newParagraph;
1537
+ }
1538
+ lineBreakSingleBlock(splitNode, startOffset) {
1539
+ const newParagraph = this.breakSingleBlock(splitNode, startOffset);
1540
+ if (newParagraph) {
1541
+ return newParagraph['nodes'][0];
1542
+ }
1543
+ }
1544
+ isCaretPositionAtStart(node, startOffset) {
1545
+ return node === this.nodes[0] && startOffset === 0;
1546
+ }
1547
+ isCaretPositionAtEnd(node, startOffset) {
1548
+ const lastNode = this.nodes[this.nodes.length - 1];
1549
+ return node === lastNode && startOffset === 1;
1550
+ }
1551
+ lineBreakMultipleBlocks(selectedBlocks) {
1552
+ const newParagraph = RTETextBlock.from({
1553
+ id: generateUUID(),
1554
+ type: 'paragraph',
1555
+ nodes: [{ id: generateUUID(), type: 'text', text: '\n' }],
1556
+ });
1557
+ this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
1558
+ const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
1559
+ if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
1560
+ afterNodes.push(new RTETextNode(generateUUID(), '\n', newParagraph));
1561
+ }
1562
+ newParagraph.apply(new AppendChildNodesAction(afterNodes));
1563
+ return newParagraph['nodes'][0];
1564
+ }
1565
+ deleteNodeContent(action) {
1566
+ const startContainerNode = action
1567
+ .startContainerNode, startOffset = action.startOffset;
1568
+ let previousNode = this.getPreviousNode(startContainerNode);
1569
+ let nextNode = null;
1570
+ if (startOffset === 1) {
1571
+ const parentBlock = startContainerNode.parentBlock;
1572
+ if (this.isContentFirstNode(startContainerNode)) {
1573
+ nextNode = this.getNextNode(startContainerNode);
1574
+ }
1575
+ if (parentBlock.nodes.length === 1) {
1576
+ parentBlock.parent.apply(new RemoveChildAction(parentBlock));
1577
+ }
1578
+ else {
1579
+ startContainerNode.parentBlock.apply(new RemoveChildAction(startContainerNode));
1580
+ }
1581
+ }
1582
+ else {
1583
+ const shouldRemoveNode = previousNode;
1584
+ if (shouldRemoveNode && shouldRemoveNode instanceof RTEImageNode) {
1585
+ previousNode = this.getPreviousNode(shouldRemoveNode);
1586
+ shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
1587
+ if (!previousNode) {
1588
+ action.nextNode = startContainerNode;
1589
+ }
1590
+ }
1591
+ }
1592
+ if (previousNode) {
1593
+ action.previousNode = previousNode;
1594
+ }
1595
+ else if (nextNode) {
1596
+ action.nextNode = nextNode;
1597
+ }
1598
+ }
1599
+ /**
1600
+ * Image will always create new image block
1601
+ *
1602
+ * @param {InsertImageToBlockAction} action insert image to current block
1603
+ */
1604
+ insertImage(action) {
1605
+ const splitNode = action.splitPointNode;
1606
+ const startOffsetOfNode = action.startOffsetOfNode;
1607
+ const newImageNodes = action.imageBlockToBeInserted.nodes;
1608
+ const newImageBlock = action.imageBlockToBeInserted;
1609
+ if (this.nodes.length < 1) {
1610
+ this.apply(new AppendChildNodesAction(newImageNodes));
1611
+ }
1612
+ else if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
1613
+ this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
1614
+ }
1615
+ else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
1616
+ this.parent.apply(new InsertBlocksBeforeAction(this, newImageBlock));
1617
+ }
1618
+ else {
1619
+ this.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
1620
+ this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
1621
+ }
1622
+ }
1623
+ }
1624
+
1625
+ class RTEListItemBlock extends RTETextBlock {
1626
+ constructor(id, children) {
1627
+ super(id, 'list-item');
1628
+ this.children = [];
1629
+ this.children = children;
1630
+ }
1631
+ static from(block) {
1632
+ const listItemBlock = new RTEListItemBlock(block.id);
1633
+ listItemBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock));
1634
+ if (block.children) {
1635
+ listItemBlock.children = block.children.map((child) => {
1636
+ const listBlock = RTEListBlock.from(child);
1637
+ listBlock.parent = listItemBlock;
1638
+ return listBlock;
1639
+ });
1640
+ }
1641
+ const { annotations } = block;
1642
+ if (annotations) {
1643
+ Object.entries(annotations).forEach(([type, value]) => {
1644
+ const item = this.createAnnotationEntity(type, value);
1645
+ if (isNonNullable(item)) {
1646
+ listItemBlock.annotationMap.set(...item);
1647
+ }
1648
+ });
1649
+ }
1650
+ return listItemBlock;
1651
+ }
1652
+ static fromHTML(node) {
1653
+ const listItem = new RTEListItemBlock(generateUUID());
1654
+ listItem.nodes = Array.from(node.childNodes)
1655
+ .map((item) => {
1656
+ if (!['UL', 'OL'].includes(item.nodeName)) {
1657
+ return RTETextNode.fromHTML(item, listItem);
1658
+ }
1659
+ })
1660
+ .filter(Boolean);
1661
+ listItem.children = Array.from(node.childNodes)
1662
+ .map((item) => {
1663
+ if (['UL', 'OL'].includes(item.nodeName)) {
1664
+ const listBlock = RTEListBlock.fromHTML(item);
1665
+ listBlock && (listBlock.parent = listItem);
1666
+ return listBlock;
1667
+ }
1668
+ })
1669
+ .filter(Boolean);
1670
+ Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
1671
+ const item = this.createAnnotationEntityFromHTML(type, node);
1672
+ if (isNonNullable(item)) {
1673
+ listItem.annotationMap.set(...item);
1674
+ }
1675
+ });
1676
+ return listItem;
1677
+ }
1678
+ toJSON() {
1679
+ var _a;
1680
+ return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
1681
+ }
1682
+ cloneWithNodes(nodes) {
1683
+ const block = new RTEListItemBlock(generateUUID());
1684
+ block.nodes = [];
1685
+ block.apply(new AppendChildNodesAction(nodes));
1686
+ return block;
1687
+ }
1688
+ isNotEmpty() {
1689
+ if (this.children) {
1690
+ return super.isNotEmpty() || this.children.some((block) => block.isNotEmpty());
1691
+ }
1692
+ else {
1693
+ return super.isNotEmpty();
1694
+ }
1695
+ }
1696
+ getLastNode() {
1697
+ if (this.children && this.children.length > 0) {
1698
+ const childListBlock = this.children[this.children.length - 1];
1699
+ return childListBlock.getLastNode();
1700
+ }
1701
+ return super.getLastNode();
1702
+ }
1703
+ render(renderContext) {
1704
+ return super.render(renderContext, this.renderChildren(renderContext));
1705
+ }
1706
+ /**
1707
+ * Apply a modify action to block
1708
+ *
1709
+ * @param {ModifyContentAction} action - Modify action
1710
+ */
1711
+ doModifyActionApply(action) {
1712
+ switch (action.type) {
1713
+ case ModifyContentActionType.DELETE_CHILD:
1714
+ this.removeListChildNode(action);
1715
+ break;
1716
+ case ModifyContentActionType.DELETE_NEST_LIST:
1717
+ this.removeNestList(action);
1718
+ break;
1719
+ case ModifyContentActionType.APPEND_CHILD_NODES:
1720
+ this.appendChildNodes(action.entityToBeAppended);
1721
+ break;
1722
+ case ModifyContentActionType.CLEAR_CHILD_NODES:
1723
+ this.nodes = [];
1724
+ break;
1725
+ case ModifyContentActionType.SPLIT_BLOCK_WITH_NODE:
1726
+ this.splitListItemBlock(action);
1727
+ break;
1728
+ case ModifyContentActionType.REPLACE_CHILD_NODES:
1729
+ this.nodes = [];
1730
+ this.appendChildNodes(action.newChildNodes);
1731
+ break;
1732
+ case ModifyContentActionType.REPLACE_NEST_LIST:
1733
+ this.replaceNestList(action.newList);
1734
+ break;
1735
+ case ModifyContentActionType.MERGE_TWO_BLOCKS_NODES:
1736
+ this.mergeTwoBlocksNodes(action.blockNeedToBeMerged);
1737
+ break;
1738
+ case ModifyContentActionType.BREAK_SINGLE_BLOCK:
1739
+ action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset);
1740
+ break;
1741
+ case ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK:
1742
+ action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset);
1743
+ break;
1744
+ case ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS:
1745
+ action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks);
1746
+ break;
1747
+ case ModifyContentActionType.DELETE_BLOCK_CONTENT:
1748
+ this.deleteListNodeContent(action);
1749
+ break;
1750
+ case ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
1751
+ this.parent.apply(action);
1752
+ break;
1753
+ case ModifyContentActionType.INSERT_NODES_BEFORE:
1754
+ this.replaceNodeWithNodes(action.referNode, [
1755
+ ...action.nodesToBeInserted,
1756
+ action.referNode,
1757
+ ]);
1758
+ break;
1759
+ }
1760
+ }
1761
+ renderChildren(renderContext) {
1762
+ var _a;
1763
+ return (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.render(renderContext));
1764
+ }
1765
+ removeListChildNode(action) {
1766
+ this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
1767
+ if (this.nodes.length === 0 && (!this.children || !this.children.length)) {
1768
+ this.parent.apply(new RemoveChildAction(this));
1769
+ }
1770
+ }
1771
+ removeNestList(action) {
1772
+ if (this.children) {
1773
+ if (this.children.length > 1) {
1774
+ this.children = this.children.filter((child) => child !== action.nestListBlockToBeRemoved);
1775
+ }
1776
+ else {
1777
+ this.children = undefined;
1778
+ }
1779
+ }
1780
+ }
1781
+ replaceNestList(newList) {
1782
+ newList.forEach((listBlock) => {
1783
+ listBlock.parent = this;
1784
+ });
1785
+ this.children = newList;
1786
+ }
1787
+ splitListItemBlock(action) {
1788
+ action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode);
1789
+ }
1790
+ breakSingleListItemBlock(splitNode, startOffsetOfNode) {
1791
+ const newListItem = new RTEListItemBlock(generateUUID());
1792
+ const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
1793
+ newListItem.apply(new AppendChildNodesAction([newBreakNode]));
1794
+ if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
1795
+ return this.breakListItemAtEnd(newListItem);
1796
+ }
1797
+ else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
1798
+ this.parent.apply(new InsertBlocksBeforeAction(this, newListItem));
1799
+ }
1800
+ else {
1801
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1802
+ this.apply(splitBlockAction);
1803
+ return splitBlockAction.newBlock;
1804
+ }
1805
+ return newListItem;
1806
+ }
1807
+ breakListItemAtEnd(newListItem) {
1808
+ const lastItem = this.parent.blocks[this.parent.blocks.length - 1];
1809
+ const currentItemIsEmpty = this.nodes.length === 1 && this.nodes[0].isEmpty();
1810
+ if (this === lastItem && currentItemIsEmpty) {
1811
+ const parentParent = this.parent.parent;
1812
+ if (parentParent['type'] !== 'list-item') {
1813
+ const newParagraph = RTETextBlock.from({
1814
+ id: generateUUID(),
1815
+ type: 'paragraph',
1816
+ nodes: [],
1817
+ });
1818
+ newParagraph.apply(new AppendChildNodesAction(newListItem.nodes));
1819
+ parentParent.apply(new InsertBlocksAfterAction(this.parent, newParagraph));
1820
+ this.parent.apply(new RemoveChildAction(this));
1821
+ return newParagraph;
1822
+ }
1823
+ else {
1824
+ parentParent.parent.apply(new InsertBlocksAfterAction(parentParent, newListItem));
1825
+ this.parent.apply(new RemoveChildAction(this));
1826
+ }
1827
+ }
1828
+ else {
1829
+ this.parent.apply(new InsertBlocksAfterAction(this, newListItem));
1830
+ }
1831
+ return newListItem;
1832
+ }
1833
+ deleteListNodeContent(action) {
1834
+ const startContainerNode = action.startContainerNode;
1835
+ const listBlock = startContainerNode.parentBlock.parent;
1836
+ this.deleteNodeContent(action);
1837
+ if (listBlock.blocks.length === 0) {
1838
+ listBlock.parent.apply(new RemoveChildAction(listBlock));
1839
+ }
1840
+ }
1841
+ copyInlineStyleToNewNode(needCopedNode) {
1842
+ const textNode = needCopedNode.cloneWithText('');
1843
+ // The link annotation don't need inherited
1844
+ textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
1845
+ return textNode;
1846
+ }
1847
+ }
1848
+
1849
+ /**
1850
+ * Delete the nest list block action
1851
+ *
1852
+ * @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
1853
+ */
1854
+ class RemoveNestListAction extends ModifyContentAction {
1855
+ constructor(childList) {
1856
+ super();
1857
+ this.type = ModifyContentActionType.DELETE_NEST_LIST;
1858
+ this.nestListBlockToBeRemoved = childList;
1859
+ }
1860
+ }
1861
+
1862
+ class RTEListBlock extends RTEBlock {
1863
+ constructor(id, type) {
1864
+ super(id);
1865
+ this.type = 'bullet-list';
1866
+ this.blocks = [];
1867
+ this.type = type;
1868
+ }
1869
+ static from(block) {
1870
+ const listBlock = new RTEListBlock(block.id, block.type);
1871
+ listBlock.blocks = block.blocks.map((item) => {
1872
+ const listItemBlock = RTEListItemBlock.from(item);
1873
+ listItemBlock.parent = listBlock;
1874
+ return listItemBlock;
1875
+ });
1876
+ return listBlock;
1877
+ }
1878
+ static fromHTML(node) {
1879
+ const listBlock = new RTEListBlock(generateUUID(), node.nodeName === 'UL' ? 'bullet-list' : 'number-list');
1880
+ listBlock.blocks = Array.from(node.children)
1881
+ .map((item) => {
1882
+ const listItemBlock = RTEListItemBlock.fromHTML(item);
1883
+ listItemBlock && (listItemBlock.parent = listBlock);
1884
+ return listItemBlock;
1885
+ })
1886
+ .filter(Boolean);
1887
+ Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
1888
+ const item = this.createAnnotationEntityFromHTML(type, node);
1889
+ if (isNonNullable(item)) {
1890
+ listBlock.annotationMap.set(...item);
1891
+ }
1892
+ });
1893
+ return listBlock;
1894
+ }
1895
+ toJSON() {
1896
+ return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
1897
+ }
1898
+ isNotEmpty() {
1899
+ return (this.blocks.length > 0 &&
1900
+ this.blocks.some((listItemBlock) => listItemBlock.isNotEmpty()));
1901
+ }
1902
+ getLastNode() {
1903
+ return this.blocks[this.blocks.length - 1].getLastNode();
1904
+ }
1905
+ render(renderContext) {
1906
+ const BlockTag = this.type === 'number-list' ? 'ol' : 'ul';
1907
+ return (h(BlockTag, { ref: this.registerRef.bind(this) }, this.blocks.map((block) => block.render(renderContext))));
1908
+ }
1909
+ /**
1910
+ * Apply a modify action to block
1911
+ *
1912
+ * @param {ModifyContentAction} action - Modify action
1913
+ */
1914
+ doModifyActionApply(action) {
1915
+ switch (action.type) {
1916
+ case ModifyContentActionType.DELETE_CHILD:
1917
+ this.removeListItemBlock(action.entityToBeRemoved);
1918
+ break;
1919
+ case ModifyContentActionType.INSERT_BLOCKS_AFTER:
1920
+ this.replaceBlockWithBlocks(action.referBlock, [
1921
+ action.referBlock,
1922
+ ...action.blocksToBeInserted,
1923
+ ]);
1924
+ break;
1925
+ case ModifyContentActionType.INSERT_BLOCKS_BEFORE:
1926
+ this.replaceBlockWithBlocks(action.referBlock, [
1927
+ ...action.blocksToBeInserted,
1928
+ action.referBlock,
1929
+ ]);
1930
+ break;
1931
+ case ModifyContentActionType.APPEND_CHILD_NODES:
1932
+ this.appendChildBlocks(action.entityToBeAppended);
1933
+ break;
1934
+ case ModifyContentActionType.TRANSFORM_LIST_BLOCK:
1935
+ this.convertToList(action);
1936
+ break;
1937
+ case ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK:
1938
+ this.convertToParagraph(action);
1939
+ break;
1940
+ case ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
1941
+ this.insertImage(action);
1942
+ break;
1943
+ }
1944
+ }
1945
+ toParagraph(block) {
1946
+ const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
1947
+ textBlock.apply(new AppendChildNodesAction(block['nodes']));
1948
+ textBlock['annotationMap'] = block['annotationMap'];
1949
+ return textBlock;
1950
+ }
1951
+ registerRef(ref) {
1952
+ if (ref) {
1953
+ stateEntityRenderingRegistry.register(ref, this);
1954
+ }
1955
+ }
1956
+ convertToList(action) {
1957
+ const selectedBlocks = action.selectedBlocks;
1958
+ const bulletList = this.parent.createList(action.listType);
1959
+ const isSameList = selectedBlocks.every((block) => block.parent === this);
1960
+ if (isSameList) {
1961
+ // Select one or more list items belonging to the same list, and all items in this list should be updated
1962
+ bulletList.apply(new AppendChildNodesAction(this.blocks));
1963
+ this.parent.apply(new InsertBlocksAfterAction(this, bulletList));
1964
+ this.parent.apply(new RemoveChildAction(this));
1965
+ selectedBlocks.forEach((block) => block.nodes.map((node) => node.apply(new SyncUpSelectionAction())));
1966
+ }
1967
+ else {
1968
+ const listItems = action.selectedBlocks.map((block) => this.parent.toListItem(block));
1969
+ bulletList.apply(new AppendChildNodesAction(listItems));
1970
+ this.parent.apply(new InsertBlocksAfterAction(this, bulletList));
1971
+ action.selectedBlocks.forEach((block) => {
1972
+ block.parent.apply(new RemoveChildAction(block));
1973
+ });
1974
+ if (this.blocks.length === 0) {
1975
+ this.parent.apply(new RemoveChildAction(this));
1976
+ }
1977
+ }
1978
+ }
1979
+ convertToParagraph(action) {
1980
+ let isSelectedFirstBlock = false;
1981
+ let isSelectedLastBlock = false;
1982
+ const selectedBlocks = action.selectedBlocks;
1983
+ const currentParagraph = selectedBlocks.map((block) => {
1984
+ block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
1985
+ if (block === this.blocks[0])
1986
+ isSelectedFirstBlock = true;
1987
+ if (block === this.blocks[this.blocks.length - 1])
1988
+ isSelectedLastBlock = true;
1989
+ return this.toParagraph(block);
1990
+ });
1991
+ if (isSelectedFirstBlock) {
1992
+ this.parent.apply(new InsertBlocksBeforeAction(this, ...currentParagraph));
1993
+ }
1994
+ else if (isSelectedLastBlock) {
1995
+ this.parent.apply(new InsertBlocksAfterAction(this, ...currentParagraph));
1996
+ }
1997
+ else {
1998
+ const startIndex = this.blocks.indexOf(selectedBlocks[0]);
1999
+ const lastIndex = this.blocks.indexOf(selectedBlocks[selectedBlocks.length - 1]);
2000
+ const firstBulletList = this.parent.createList(this.type);
2001
+ firstBulletList.apply(new AppendChildNodesAction(this.blocks.slice(0, startIndex)));
2002
+ const lastBulletList = this.parent.createList(this.type);
2003
+ lastBulletList.apply(new AppendChildNodesAction(this.blocks.slice(lastIndex + 1)));
2004
+ this.parent.apply(new InsertBlocksBeforeAction(this, firstBulletList, ...currentParagraph, lastBulletList));
2005
+ this.parent.apply(new RemoveChildAction(this));
2006
+ }
2007
+ selectedBlocks.map((block) => {
2008
+ this.apply(new RemoveChildAction(block));
2009
+ });
2010
+ if (this.blocks.length === 0) {
2011
+ this.parent.apply(new RemoveChildAction(this));
2012
+ }
2013
+ }
2014
+ insertImage(action) {
2015
+ const imageBlock = action.imageBlockToBeInserted;
2016
+ if (this.parent['type'] !== 'list-item') {
2017
+ this.parent.apply(new InsertBlocksAfterAction(this, imageBlock));
2018
+ }
2019
+ else {
2020
+ this.parent.apply(action);
2021
+ }
2022
+ }
2023
+ removeListItemBlock(blockToBeRemoved) {
2024
+ super.removeChildBlock(blockToBeRemoved);
2025
+ if (this.blocks.length === 0 && this.parent) {
2026
+ // The parent is a list item mean the current block is a nest list, so we need use RemoveNestListAction to remove the item
2027
+ if (this.parent instanceof RTEListItemBlock) {
2028
+ this.parent.apply(new RemoveNestListAction(this));
2029
+ }
2030
+ else {
2031
+ this.parent.apply(new RemoveChildAction(this));
2032
+ }
2033
+ }
2034
+ }
2035
+ }
2036
+
2037
+ /**
2038
+ * Class representing the content state of the rich text editor.
2039
+ */
2040
+ class VegaRTEContent extends BlockBaseOperator {
2041
+ constructor(blocks) {
2042
+ super();
2043
+ blocks.forEach((block) => {
2044
+ block.parent = this;
2045
+ });
2046
+ this.blocks = blocks;
2047
+ }
2048
+ /**
2049
+ * Converts a JSON array of blocks to a class array of RTEContentBlock.
2050
+ *
2051
+ * @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
2052
+ * @returns {RTEContentBlock[]} The converted array of RTEContentBlock.
2053
+ */
2054
+ static fromJSON(value) {
2055
+ const blocks = value.map((block) => {
2056
+ switch (block.type) {
2057
+ case 'paragraph':
2058
+ case 'title':
2059
+ case 'subtitle':
2060
+ case 'heading-1':
2061
+ case 'heading-2':
2062
+ case 'heading-3': {
2063
+ return RTETextBlock.from(block);
2064
+ }
2065
+ case 'image':
2066
+ return RTEImageBlock.from(block);
2067
+ case 'bullet-list':
2068
+ case 'number-list':
2069
+ return RTEListBlock.from(block);
2070
+ default: {
2071
+ throw new Error(`[Vega] Unknown block type: ${block.type}`);
2072
+ }
2073
+ }
2074
+ });
2075
+ return new VegaRTEContent(blocks);
2076
+ }
2077
+ /**
2078
+ * Create an empty content state
2079
+ *
2080
+ * @returns {VegaRTEContent} An empty content state
2081
+ */
2082
+ static createEmptyContent() {
2083
+ return VegaRTEContent.fromJSON([
2084
+ {
2085
+ id: generateUUID(),
2086
+ type: 'paragraph',
2087
+ nodes: [
2088
+ {
2089
+ id: generateUUID(),
2090
+ type: 'text',
2091
+ text: '',
2092
+ },
2093
+ ],
2094
+ },
2095
+ ]);
2096
+ }
2097
+ /**
2098
+ * Clones the content state.
2099
+ *
2100
+ * @returns {VegaRTEContent} The cloned content state.
2101
+ */
2102
+ clone() {
2103
+ return new VegaRTEContent([...this.blocks]);
2104
+ }
2105
+ /**
2106
+ * Converts the content state to a JSON array of blocks.
2107
+ *
2108
+ * @returns {VegaRTEContentBlock[]} The JSON array of blocks.
2109
+ */
2110
+ toJSON() {
2111
+ return this.blocks.map((block) => block.toJSON());
2112
+ }
2113
+ /**
2114
+ * Internal method to add the block item, remove the block item
2115
+ *
2116
+ * @param {ModifyContentAction} action - Modify content action
2117
+ */
2118
+ apply(action) {
2119
+ switch (action.type) {
2120
+ case ModifyContentActionType.DELETE_CHILD:
2121
+ this.removeChildBlock(action.entityToBeRemoved);
2122
+ break;
2123
+ case ModifyContentActionType.APPEND_CHILD_NODES:
2124
+ this.appendChildBlocks(action.entityToBeAppended);
2125
+ break;
2126
+ case ModifyContentActionType.INSERT_BLOCKS_AFTER:
2127
+ this.replaceBlockWithBlocks(action.referBlock, [
2128
+ action.referBlock,
2129
+ ...action.blocksToBeInserted,
2130
+ ]);
2131
+ break;
2132
+ case ModifyContentActionType.INSERT_BLOCKS_BEFORE:
2133
+ this.replaceBlockWithBlocks(action.referBlock, [
2134
+ ...action.blocksToBeInserted,
2135
+ action.referBlock,
2136
+ ]);
2137
+ break;
2138
+ }
2139
+ }
2140
+ /**
2141
+ * Convert text to list.
2142
+ *
2143
+ * @param {RTETextBlock} block - block
2144
+ * @returns {RTEListItemBlock} list item block dto.
2145
+ */
2146
+ toListItem(block) {
2147
+ block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
2148
+ const listItemBlock = new RTEListItemBlock(generateUUID());
2149
+ listItemBlock.apply(new AppendChildNodesAction(block['nodes']));
2150
+ listItemBlock['annotationMap'] = block['annotationMap'];
2151
+ return listItemBlock;
2152
+ }
2153
+ /**
2154
+ * create list.
2155
+ *
2156
+ * @param {ListType} type - type
2157
+ * @returns {RTEListBlock} list block dto.
2158
+ */
2159
+ createList(type) {
2160
+ return new RTEListBlock(generateUUID(), type);
2161
+ }
2162
+ }
2163
+
2164
+ export { AppendChildNodesAction as A, BoldAnnotationAction as B, HorizontalAlignmentAnnotation as H, IndentAnnotation as I, MergeTwoBlocksNodesAction as M, RTETextBlock as R, SplitBlockWithNodeAction as S, TextStyleAnnotationAction as T, VegaRTEContent as V, TextStyleAnnotation as a, RTEImageNode as b, RTEListItemBlock as c, RemoveChildAction as d, InsertBlocksBeforeAction as e, ReplaceChildNodesAction as f, RTEImageBlock as g, RTEListBlock as h, InsertBlocksAfterAction as i, ImageAnnotationAction as j };