@vonage/vivid 5.14.0 → 5.15.1

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 (345) hide show
  1. package/README.md +1 -1
  2. package/accordion/definition.cjs +0 -5
  3. package/accordion/definition.js +0 -5
  4. package/accordion/index.cjs +1 -1
  5. package/accordion/index.js +3 -14
  6. package/accordion-item/definition.cjs +1 -1
  7. package/accordion-item/definition.js +1 -1
  8. package/alert/definition.cjs +2 -2
  9. package/alert/definition.js +2 -2
  10. package/alert/index.cjs +1 -1
  11. package/alert/index.js +1 -1
  12. package/audio-player/definition.cjs +2 -6
  13. package/audio-player/definition.js +2 -6
  14. package/audio-player/index.cjs +1 -1
  15. package/audio-player/index.js +2 -8
  16. package/banner/definition.cjs +1 -1
  17. package/banner/definition.js +1 -1
  18. package/breadcrumb/definition.cjs +0 -1
  19. package/breadcrumb/definition.js +0 -1
  20. package/breadcrumb/index.cjs +1 -1
  21. package/breadcrumb/index.js +0 -1
  22. package/breadcrumb-item/definition.cjs +1 -1
  23. package/breadcrumb-item/definition.js +1 -1
  24. package/breadcrumb-item/index.cjs +1 -1
  25. package/breadcrumb-item/index.js +1 -1
  26. package/bundled/attribute-binding-behaviour.cjs +1 -1
  27. package/bundled/attribute-binding-behaviour.js +1 -3
  28. package/bundled/base-color-picker.cjs +1 -1
  29. package/bundled/base-color-picker.js +4 -9
  30. package/bundled/base-progress.cjs +1 -1
  31. package/bundled/base-progress.js +0 -3
  32. package/bundled/button.cjs +1 -1
  33. package/bundled/button.js +1 -10
  34. package/bundled/calendar-picker.template.cjs +1 -1
  35. package/bundled/calendar-picker.template.js +90 -42
  36. package/bundled/children.js +1 -1
  37. package/bundled/definition.cjs +1 -1
  38. package/bundled/definition.js +1 -1
  39. package/bundled/definition10.cjs +1 -1
  40. package/bundled/definition10.js +0 -10
  41. package/bundled/definition11.cjs +1 -1
  42. package/bundled/definition11.js +0 -1
  43. package/bundled/definition12.cjs +2 -2
  44. package/bundled/definition12.js +1 -2
  45. package/bundled/definition13.cjs +1 -1
  46. package/bundled/definition13.js +1 -1
  47. package/bundled/definition17.cjs +1 -1
  48. package/bundled/definition17.js +1 -4
  49. package/bundled/definition18.cjs +1 -1
  50. package/bundled/definition18.js +6 -18
  51. package/bundled/definition19.cjs +2 -2
  52. package/bundled/definition19.js +8 -24
  53. package/bundled/definition2.cjs +5 -5
  54. package/bundled/definition2.js +26 -27
  55. package/bundled/definition20.cjs +1 -1
  56. package/bundled/definition20.js +1 -1
  57. package/bundled/definition22.cjs +5 -5
  58. package/bundled/definition22.js +2 -3
  59. package/bundled/definition3.cjs +1 -1
  60. package/bundled/definition3.js +1 -2
  61. package/bundled/definition5.cjs +1 -1
  62. package/bundled/definition5.js +1 -6
  63. package/bundled/definition6.cjs +1 -1
  64. package/bundled/definition6.js +1 -2
  65. package/bundled/definition7.cjs +1 -1
  66. package/bundled/definition7.js +2 -5
  67. package/bundled/definition8.cjs +1 -1
  68. package/bundled/definition8.js +2 -13
  69. package/bundled/definition9.js +9 -9
  70. package/bundled/delegates-aria.cjs +1 -1
  71. package/bundled/delegates-aria.js +1 -3
  72. package/bundled/floating-ui.dom.cjs +1 -1
  73. package/bundled/floating-ui.dom.js +491 -487
  74. package/bundled/form-associated.cjs +1 -1
  75. package/bundled/form-associated.js +9 -18
  76. package/bundled/key-codes.cjs +1 -1
  77. package/bundled/listbox.cjs +1 -1
  78. package/bundled/listbox.js +10 -27
  79. package/bundled/localized.cjs +1 -1
  80. package/bundled/localized.js +49 -48
  81. package/bundled/mixins.cjs +2 -2
  82. package/bundled/mixins.js +1 -4
  83. package/bundled/normalize.js +2 -2
  84. package/bundled/picker-field.template.cjs +1 -1
  85. package/bundled/picker-field.template.js +0 -1
  86. package/bundled/scrollIntoView.cjs +1 -1
  87. package/bundled/scrollIntoView.js +1 -4
  88. package/bundled/slider.template.cjs +1 -1
  89. package/bundled/slider.template.js +1 -1
  90. package/bundled/slottable-request.js +2 -1
  91. package/bundled/text-field.cjs +1 -1
  92. package/bundled/text-field.js +1 -1
  93. package/bundled/time-selection-picker.template.cjs +2 -2
  94. package/bundled/time-selection-picker.template.js +3 -6
  95. package/bundled/vivid-element.cjs +3 -3
  96. package/bundled/vivid-element.js +302 -293
  97. package/button/definition.cjs +1 -1
  98. package/button/definition.js +1 -1
  99. package/calendar/definition.cjs +0 -2
  100. package/calendar/definition.js +1 -3
  101. package/calendar/index.cjs +1 -1
  102. package/calendar/index.js +6 -8
  103. package/card/definition.cjs +1 -1
  104. package/card/definition.js +1 -1
  105. package/card/index.cjs +1 -1
  106. package/card/index.js +1 -1
  107. package/checkbox/definition.cjs +1 -2
  108. package/checkbox/definition.js +1 -2
  109. package/color-picker/definition.cjs +1 -6
  110. package/color-picker/definition.js +1 -6
  111. package/color-picker/index.cjs +1 -1
  112. package/color-picker/index.js +2 -7
  113. package/combobox/definition.cjs +2 -8
  114. package/combobox/definition.js +2 -8
  115. package/combobox/index.cjs +1 -1
  116. package/combobox/index.js +2 -9
  117. package/contextual-help/definition.cjs +1 -1
  118. package/contextual-help/definition.js +1 -1
  119. package/custom-elements.json +636 -1045
  120. package/data-grid/definition.cjs +72 -85
  121. package/data-grid/definition.js +75 -88
  122. package/data-grid/index.cjs +2 -2
  123. package/data-grid/index.js +7 -39
  124. package/date-picker/definition.cjs +1 -1
  125. package/date-picker/definition.js +1 -1
  126. package/date-range-picker/definition.cjs +1 -3
  127. package/date-range-picker/definition.js +1 -3
  128. package/date-range-picker/index.cjs +1 -1
  129. package/date-range-picker/index.js +1 -5
  130. package/date-time-picker/definition.cjs +1 -1
  131. package/date-time-picker/definition.js +1 -1
  132. package/dial-pad/definition.cjs +2 -11
  133. package/dial-pad/definition.js +3 -12
  134. package/dial-pad/index.cjs +1 -1
  135. package/dial-pad/index.js +14 -38
  136. package/dialog/definition.cjs +2 -3
  137. package/dialog/definition.js +2 -3
  138. package/dialog/index.cjs +1 -1
  139. package/dialog/index.js +1 -2
  140. package/empty-state/definition.js +1 -1
  141. package/fab/definition.cjs +1 -2
  142. package/fab/definition.js +1 -2
  143. package/fab/index.cjs +1 -1
  144. package/fab/index.js +1 -2
  145. package/file-picker/definition.cjs +2 -5
  146. package/file-picker/definition.js +3 -6
  147. package/file-picker/index.cjs +1 -1
  148. package/file-picker/index.js +1 -4
  149. package/icon/definition.cjs +7 -5
  150. package/icon/definition.js +7 -5
  151. package/index.cjs +95 -94
  152. package/index.js +18 -18
  153. package/layout/definition.cjs +1 -1
  154. package/layout/definition.js +1 -1
  155. package/layout/index.cjs +1 -1
  156. package/layout/index.js +1 -1
  157. package/lib/card/card.d.ts +0 -2
  158. package/lib/combobox/combobox.d.ts +1 -1
  159. package/lib/icon/icon.d.ts +0 -1
  160. package/lib/menu/menu.d.ts +0 -1
  161. package/lib/menu-item/menu-item.d.ts +0 -1
  162. package/lib/pagination/pagination.d.ts +0 -3
  163. package/lib/rich-text-editor/rte/exports.d.ts +1 -0
  164. package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +16 -0
  165. package/lib/rich-text-editor/rte/instance.d.ts +2 -1
  166. package/lib/select/select.d.ts +2 -2
  167. package/lib/table/table-head.d.ts +1 -0
  168. package/lib/tabs/tabs.d.ts +0 -1
  169. package/lib/text-field/text-field.d.ts +0 -1
  170. package/locales/de-DE.cjs +95 -95
  171. package/locales/de-DE.js +95 -95
  172. package/locales/en-GB.cjs +1 -1
  173. package/locales/en-GB.js +1 -1
  174. package/locales/en-US.cjs +95 -95
  175. package/locales/en-US.js +95 -95
  176. package/locales/ja-JP.cjs +94 -94
  177. package/locales/ja-JP.js +94 -94
  178. package/locales/zh-CN.cjs +94 -94
  179. package/locales/zh-CN.js +94 -94
  180. package/menu/definition.cjs +2 -3
  181. package/menu/definition.js +2 -3
  182. package/menu-item/definition.cjs +1 -1
  183. package/menu-item/definition.js +1 -1
  184. package/nav-disclosure/definition.cjs +1 -1
  185. package/nav-disclosure/definition.js +1 -1
  186. package/nav-disclosure/index.cjs +1 -1
  187. package/nav-disclosure/index.js +1 -1
  188. package/nav-item/definition.cjs +1 -1
  189. package/nav-item/definition.js +1 -1
  190. package/nav-item/index.cjs +1 -1
  191. package/nav-item/index.js +1 -1
  192. package/number-field/definition.cjs +2 -2
  193. package/number-field/definition.js +2 -2
  194. package/number-field/index.cjs +1 -1
  195. package/number-field/index.js +1 -1
  196. package/package.json +19 -17
  197. package/pagination/definition.cjs +1 -3
  198. package/pagination/definition.js +3 -5
  199. package/pagination/index.cjs +3 -3
  200. package/pagination/index.js +4 -6
  201. package/popover/definition.cjs +1 -8
  202. package/popover/definition.js +1 -8
  203. package/popover/index.cjs +1 -1
  204. package/popover/index.js +6 -17
  205. package/popup/definition.cjs +1 -1
  206. package/popup/definition.js +1 -1
  207. package/radio/definition.cjs +1 -5
  208. package/radio/definition.js +1 -5
  209. package/radio-group/definition.js +2 -2
  210. package/range-slider/definition.cjs +1 -1
  211. package/range-slider/definition.js +2 -2
  212. package/range-slider/index.cjs +1 -1
  213. package/range-slider/index.js +1 -1
  214. package/rich-text-editor/definition.cjs +177 -63
  215. package/rich-text-editor/definition.js +177 -64
  216. package/rich-text-editor/index.cjs +12 -12
  217. package/rich-text-editor/index.js +1651 -1586
  218. package/rich-text-view/definition.js +1 -1
  219. package/searchable-select/definition.cjs +2 -5
  220. package/searchable-select/definition.js +2 -5
  221. package/searchable-select/index.cjs +1 -1
  222. package/searchable-select/index.js +2 -6
  223. package/select/definition.cjs +4 -14
  224. package/select/definition.js +5 -15
  225. package/selectable-box/definition.cjs +1 -1
  226. package/selectable-box/definition.js +2 -2
  227. package/selectable-box/index.cjs +1 -1
  228. package/selectable-box/index.js +1 -1
  229. package/side-drawer/definition.cjs +1 -1
  230. package/side-drawer/definition.js +2 -2
  231. package/side-drawer/index.cjs +1 -1
  232. package/side-drawer/index.js +2 -5
  233. package/simple-color-picker/definition.cjs +18 -9
  234. package/simple-color-picker/definition.js +19 -10
  235. package/simple-color-picker/index.cjs +5 -5
  236. package/simple-color-picker/index.js +23 -23
  237. package/slider/definition.cjs +1 -6
  238. package/slider/definition.js +3 -8
  239. package/split-button/definition.cjs +1 -1
  240. package/split-button/definition.js +2 -2
  241. package/split-button/index.cjs +1 -1
  242. package/split-button/index.js +1 -1
  243. package/status/definition.cjs +9 -3
  244. package/status/definition.js +11 -5
  245. package/status/index.cjs +10 -7
  246. package/status/index.js +46 -39
  247. package/styles/core/all.css +6 -5
  248. package/styles/core/theme.css +6 -5
  249. package/styles/core/typography.css +1 -2
  250. package/styles/tokens/theme-dark.css +17 -21
  251. package/styles/tokens/theme-light.css +17 -21
  252. package/styles/tokens/vivid-2-compat.css +1 -2
  253. package/switch/definition.cjs +1 -2
  254. package/switch/definition.js +2 -3
  255. package/switch/index.cjs +1 -1
  256. package/switch/index.js +1 -2
  257. package/tab/definition.cjs +1 -1
  258. package/tab/definition.js +2 -2
  259. package/tab-panel/definition.js +1 -1
  260. package/table/definition.cjs +17 -11
  261. package/table/definition.js +19 -13
  262. package/table/index.cjs +18 -14
  263. package/table/index.js +55 -48
  264. package/tabs/definition.cjs +0 -2
  265. package/tabs/definition.js +2 -4
  266. package/tabs/index.cjs +1 -1
  267. package/tabs/index.js +0 -2
  268. package/tag/definition.cjs +1 -1
  269. package/tag/definition.js +2 -2
  270. package/tag/index.cjs +1 -1
  271. package/tag/index.js +1 -1
  272. package/tag-group/definition.js +1 -1
  273. package/text-area/definition.cjs +1 -7
  274. package/text-area/definition.js +2 -8
  275. package/text-area/index.cjs +1 -1
  276. package/text-area/index.js +1 -7
  277. package/text-field/definition.cjs +0 -10
  278. package/text-field/definition.js +1 -11
  279. package/time-picker/definition.cjs +1 -1
  280. package/time-picker/definition.js +2 -2
  281. package/toggletip/definition.cjs +0 -2
  282. package/toggletip/definition.js +1 -3
  283. package/tooltip/definition.cjs +0 -1
  284. package/tooltip/definition.js +1 -2
  285. package/tree-view/definition.cjs +0 -16
  286. package/tree-view/definition.js +1 -17
  287. package/tree-view/index.cjs +1 -1
  288. package/tree-view/index.js +0 -16
  289. package/unbundled/_commonjsHelpers.cjs +6 -2
  290. package/unbundled/_commonjsHelpers.js +6 -2
  291. package/unbundled/anchored.js +1 -1
  292. package/unbundled/attribute-binding-behaviour.cjs +0 -1
  293. package/unbundled/attribute-binding-behaviour.js +0 -1
  294. package/unbundled/base-color-picker.cjs +2 -5
  295. package/unbundled/base-color-picker.js +2 -5
  296. package/unbundled/base-progress.cjs +0 -3
  297. package/unbundled/base-progress.js +0 -3
  298. package/unbundled/button.cjs +1 -10
  299. package/unbundled/button.js +1 -10
  300. package/unbundled/calendar-picker.template.cjs +2 -4
  301. package/unbundled/calendar-picker.template.js +2 -4
  302. package/unbundled/data-grid.options.js +1 -1
  303. package/unbundled/definition.cjs +349 -170
  304. package/unbundled/definition.js +348 -170
  305. package/unbundled/definition2.cjs +169 -351
  306. package/unbundled/definition2.js +169 -350
  307. package/unbundled/definition3.cjs +1 -2
  308. package/unbundled/definition3.js +1 -2
  309. package/unbundled/definition4.cjs +1 -2
  310. package/unbundled/definition4.js +3 -4
  311. package/unbundled/definition5.cjs +1 -1
  312. package/unbundled/definition5.js +2 -2
  313. package/unbundled/delegates-aria.cjs +1 -1
  314. package/unbundled/delegates-aria.js +1 -1
  315. package/unbundled/enums.js +1 -1
  316. package/unbundled/form-associated.cjs +4 -5
  317. package/unbundled/form-associated.js +4 -5
  318. package/unbundled/host-semantics.cjs +1 -0
  319. package/unbundled/host-semantics.js +2 -1
  320. package/unbundled/key-codes.js +1 -1
  321. package/unbundled/listbox.cjs +6 -14
  322. package/unbundled/listbox.js +6 -14
  323. package/unbundled/localized.cjs +1 -0
  324. package/unbundled/localized.js +1 -0
  325. package/unbundled/mixins.cjs +0 -2
  326. package/unbundled/mixins.js +2 -4
  327. package/unbundled/picker-field.template.cjs +1 -2
  328. package/unbundled/picker-field.template.js +1 -2
  329. package/unbundled/scrollIntoView.cjs +0 -1
  330. package/unbundled/scrollIntoView.js +0 -1
  331. package/unbundled/slider.template.js +1 -1
  332. package/unbundled/slottable-request.cjs +3 -2
  333. package/unbundled/slottable-request.js +3 -2
  334. package/unbundled/text-field.cjs +1 -1
  335. package/unbundled/text-field.js +1 -1
  336. package/unbundled/time-selection-picker.template.cjs +1 -4
  337. package/unbundled/time-selection-picker.template.js +1 -4
  338. package/unbundled/vivid-element.cjs +2 -1
  339. package/unbundled/vivid-element.js +2 -1
  340. package/video-player/definition.cjs +7953 -7720
  341. package/video-player/definition.js +7955 -7722
  342. package/video-player/index.cjs +38 -54
  343. package/video-player/index.js +12785 -12735
  344. package/visually-hidden/definition.js +1 -1
  345. package/vivid.api.json +48 -341
@@ -11,16 +11,16 @@ const divider_definition = require('../divider/definition.cjs');
11
11
  const select_definition = require('../select/definition.cjs');
12
12
  const option_definition = require('../unbundled/definition3.cjs');
13
13
  const menu_definition = require('../menu/definition.cjs');
14
- const menuItem_definition = require('../unbundled/definition2.cjs');
14
+ const menuItem_definition = require('../unbundled/definition.cjs');
15
15
  const progressRing_definition = require('../progress-ring/definition.cjs');
16
- const button_definition = require('../unbundled/definition.cjs');
16
+ const button_definition = require('../unbundled/definition2.cjs');
17
17
  const tooltip_definition = require('../tooltip/definition.cjs');
18
18
  const textField_definition = require('../text-field/definition.cjs');
19
19
  const divider = require('../unbundled/divider.cjs');
20
20
  const DOMPurify = require('dompurify');
21
21
  const mixins = require('../unbundled/mixins.cjs');
22
22
 
23
- const styles = ":host{display:block}.rte{display:flex;flex-direction:column;block-size:100%}.editor{display:contents}.editor-viewport{position:relative;overflow:hidden;flex:1;contain:layout}.editor-scroll-area{--editor-padding-block: 8px;--editor-padding-inline: 16px;display:flex;flex-direction:column;background-color:var(--vvd-color-canvas);block-size:100%;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);overflow-y:auto;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.editor-scroll-area{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.editor-scroll-area ::-webkit-scrollbar{width:4px}.editor-scroll-area ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.editor-scroll-area ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.popovers--disabled>*{display:none!important}";
23
+ const styles = ":host{display:flex;flex-direction:column}.rte{display:flex;flex-direction:column;block-size:100%;min-block-size:0}.editor{display:contents}.editor-viewport{position:relative;display:flex;overflow:hidden;flex:1;flex-direction:column;contain:layout;min-block-size:0}.editor-scroll-area{--editor-padding-inline: var( --rich-text-editor-padding-inline, 16px );--editor-padding-block: var( --rich-text-editor-padding-block, 8px );display:flex;flex:1;flex-direction:column;background-color:var(--vvd-color-canvas);color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);min-block-size:0;overflow-y:auto;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.editor-scroll-area{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.editor-scroll-area ::-webkit-scrollbar{width:4px}.editor-scroll-area ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.editor-scroll-area ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.popovers--disabled>*{display:none!important}";
24
24
 
25
25
  // Recovery values encode a range index and an offset. They are
26
26
  // represented as numbers, because tons of them will be created when
@@ -1899,6 +1899,27 @@ class Transform {
1899
1899
  return this.steps.length > 0;
1900
1900
  }
1901
1901
  /**
1902
+ Return a single range, in post-transform document positions,
1903
+ that covers all content changed by this transform. Returns null
1904
+ if no replacements are made. Note that this will ignore changes
1905
+ that add/remove marks without replacing the underlying content.
1906
+ */
1907
+ changedRange() {
1908
+ let from = 1e9, to = -1e9;
1909
+ for (let i = 0; i < this.mapping.maps.length; i++) {
1910
+ let map = this.mapping.maps[i];
1911
+ if (i) {
1912
+ from = map.map(from, 1);
1913
+ to = map.map(to, -1);
1914
+ }
1915
+ map.forEach((_f, _t, fromB, toB) => {
1916
+ from = Math.min(from, fromB);
1917
+ to = Math.max(to, toB);
1918
+ });
1919
+ }
1920
+ return from == 1e9 ? null : { from, to };
1921
+ }
1922
+ /**
1902
1923
  @internal
1903
1924
  */
1904
1925
  addStep(step, doc) {
@@ -3473,17 +3494,20 @@ function findOffsetInNode(node, coords) {
3473
3494
  }
3474
3495
  function findOffsetInText(node, coords) {
3475
3496
  let len = node.nodeValue.length;
3476
- let range = document.createRange();
3497
+ let range = document.createRange(), result;
3477
3498
  for (let i = 0; i < len; i++) {
3478
3499
  range.setEnd(node, i + 1);
3479
3500
  range.setStart(node, i);
3480
3501
  let rect = singleRect(range, 1);
3481
3502
  if (rect.top == rect.bottom)
3482
3503
  continue;
3483
- if (inRect(coords, rect))
3484
- return { node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0) };
3504
+ if (inRect(coords, rect)) {
3505
+ result = { node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0) };
3506
+ break;
3507
+ }
3485
3508
  }
3486
- return { node, offset: 0 };
3509
+ range.detach();
3510
+ return result || { node, offset: 0 };
3487
3511
  }
3488
3512
  function inRect(coords, rect) {
3489
3513
  return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 &&
@@ -4479,15 +4503,15 @@ class NodeViewDesc extends ViewDesc {
4479
4503
  let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);
4480
4504
  iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
4481
4505
  if (widget.spec.marks)
4482
- updater.syncToMarks(widget.spec.marks, inline, view);
4506
+ updater.syncToMarks(widget.spec.marks, inline, view, i);
4483
4507
  else if (widget.type.side >= 0 && !insideNode)
4484
- updater.syncToMarks(i == this.node.childCount ? slottableRequest.Mark.none : this.node.child(i).marks, inline, view);
4508
+ updater.syncToMarks(i == this.node.childCount ? slottableRequest.Mark.none : this.node.child(i).marks, inline, view, i);
4485
4509
  // If the next node is a desc matching this widget, reuse it,
4486
4510
  // otherwise insert the widget as a new view desc.
4487
4511
  updater.placeWidget(widget, view, off);
4488
4512
  }, (child, outerDeco, innerDeco, i) => {
4489
4513
  // Make sure the wrapping mark descs match the node's marks.
4490
- updater.syncToMarks(child.marks, inline, view);
4514
+ updater.syncToMarks(child.marks, inline, view, i);
4491
4515
  // Try several strategies for drawing this node
4492
4516
  let compIndex;
4493
4517
  if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ;
@@ -4503,7 +4527,7 @@ class NodeViewDesc extends ViewDesc {
4503
4527
  off += child.nodeSize;
4504
4528
  });
4505
4529
  // Drop all remaining descs after the current position.
4506
- updater.syncToMarks([], inline, view);
4530
+ updater.syncToMarks([], inline, view, 0);
4507
4531
  if (this.node.isTextblock)
4508
4532
  updater.addTextblockHacks();
4509
4533
  updater.destroyRest();
@@ -4893,7 +4917,7 @@ class ViewTreeUpdater {
4893
4917
  }
4894
4918
  // Sync the current stack of mark descs with the given array of
4895
4919
  // marks, reusing existing mark descs when possible.
4896
- syncToMarks(marks, inline, view) {
4920
+ syncToMarks(marks, inline, view, parentIndex) {
4897
4921
  let keep = 0, depth = this.stack.length >> 1;
4898
4922
  let maxKeep = Math.min(depth, marks.length);
4899
4923
  while (keep < maxKeep &&
@@ -4909,8 +4933,10 @@ class ViewTreeUpdater {
4909
4933
  }
4910
4934
  while (depth < marks.length) {
4911
4935
  this.stack.push(this.top, this.index + 1);
4912
- let found = -1;
4913
- for (let i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {
4936
+ let found = -1, scanTo = this.top.children.length;
4937
+ if (parentIndex < this.preMatch.index)
4938
+ scanTo = Math.min(this.index + 3, scanTo);
4939
+ for (let i = this.index; i < scanTo; i++) {
4914
4940
  let next = this.top.children[i];
4915
4941
  if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {
4916
4942
  found = i;
@@ -5106,9 +5132,7 @@ class ViewTreeUpdater {
5106
5132
  }
5107
5133
  // Iterate from the end of the fragment and array of descs to find
5108
5134
  // directly matching ones, in order to avoid overeagerly reusing those
5109
- // for other nodes. Returns the fragment index of the first node that
5110
- // is part of the sequence of matched nodes at the end of the
5111
- // fragment.
5135
+ // for other nodes.
5112
5136
  function preMatch(frag, parentDesc) {
5113
5137
  let curDesc = parentDesc, descI = curDesc.children.length;
5114
5138
  let fI = frag.childCount, matched = new Map, matches = [];
@@ -5131,7 +5155,6 @@ function preMatch(frag, parentDesc) {
5131
5155
  break outer;
5132
5156
  }
5133
5157
  else {
5134
- // FIXME
5135
5158
  descI = curDesc.parent.children.indexOf(curDesc);
5136
5159
  curDesc = curDesc.parent;
5137
5160
  }
@@ -6178,6 +6201,7 @@ class InputState {
6178
6201
  this.compositionNodes = [];
6179
6202
  this.compositionEndedAt = -2e8;
6180
6203
  this.compositionID = 1;
6204
+ this.badSafariComposition = false;
6181
6205
  // Set to a composition ID when there are pending changes at compositionend
6182
6206
  this.compositionPendingChanges = 0;
6183
6207
  this.domChangeCount = 0;
@@ -6576,7 +6600,8 @@ editHandlers.compositionstart = editHandlers.compositionupdate = view => {
6576
6600
  let { state } = view, $pos = state.selection.$to;
6577
6601
  if (state.selection instanceof TextSelection &&
6578
6602
  (state.storedMarks ||
6579
- (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)))) {
6603
+ (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)) ||
6604
+ chrome && windows$1 && selectionBeforeUneditable(view))) { // Issue #1500
6580
6605
  // Need to wrap the cursor in mark nodes different from the ones in the DOM context
6581
6606
  view.markCursor = view.state.storedMarks || $pos.marks();
6582
6607
  endComposition(view, true);
@@ -6610,13 +6635,22 @@ editHandlers.compositionstart = editHandlers.compositionupdate = view => {
6610
6635
  }
6611
6636
  scheduleComposeEnd(view, timeoutComposition);
6612
6637
  };
6638
+ function selectionBeforeUneditable(view) {
6639
+ let { focusNode, focusOffset } = view.domSelectionRange();
6640
+ if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length)
6641
+ return false;
6642
+ let next = focusNode.childNodes[focusOffset];
6643
+ return next.nodeType == 1 && next.contentEditable == "false";
6644
+ }
6613
6645
  editHandlers.compositionend = (view, event) => {
6614
6646
  if (view.composing) {
6615
6647
  view.input.composing = false;
6616
6648
  view.input.compositionEndedAt = event.timeStamp;
6617
6649
  view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
6618
6650
  view.input.compositionNode = null;
6619
- if (view.input.compositionPendingChanges)
6651
+ if (view.input.badSafariComposition)
6652
+ view.domObserver.forceFlush();
6653
+ else if (view.input.compositionPendingChanges)
6620
6654
  Promise.resolve().then(() => view.domObserver.flush());
6621
6655
  view.input.compositionID++;
6622
6656
  scheduleComposeEnd(view, 20);
@@ -6837,10 +6871,15 @@ handlers.dragend = view => {
6837
6871
  }, 50);
6838
6872
  };
6839
6873
  editHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();
6840
- editHandlers.drop = (view, _event) => {
6841
- let event = _event;
6842
- let dragging = view.dragging;
6843
- view.dragging = null;
6874
+ editHandlers.drop = (view, event) => {
6875
+ try {
6876
+ handleDrop(view, event, view.dragging);
6877
+ }
6878
+ finally {
6879
+ view.dragging = null;
6880
+ }
6881
+ };
6882
+ function handleDrop(view, event, dragging) {
6844
6883
  if (!event.dataTransfer)
6845
6884
  return;
6846
6885
  let eventPos = view.posAtCoords(eventCoords(event));
@@ -6894,7 +6933,7 @@ editHandlers.drop = (view, _event) => {
6894
6933
  }
6895
6934
  view.focus();
6896
6935
  view.dispatch(tr.setMeta("uiEvent", "drop"));
6897
- };
6936
+ }
6898
6937
  handlers.focus = view => {
6899
6938
  view.input.lastFocus = Date.now();
6900
6939
  if (!view.focused) {
@@ -7674,15 +7713,24 @@ class DOMObserver {
7674
7713
  new window.MutationObserver(mutations => {
7675
7714
  for (let i = 0; i < mutations.length; i++)
7676
7715
  this.queue.push(mutations[i]);
7677
- // IE11 will sometimes (on backspacing out a single character
7678
- // text node after a BR node) call the observer callback
7679
- // before actually updating the DOM, which will cause
7680
- // ProseMirror to miss the change (see #930)
7681
7716
  if (ie$1 && ie_version <= 11 && mutations.some(m => m.type == "childList" && m.removedNodes.length ||
7682
- m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length))
7717
+ m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length)) {
7718
+ // IE11 will sometimes (on backspacing out a single character
7719
+ // text node after a BR node) call the observer callback
7720
+ // before actually updating the DOM, which will cause
7721
+ // ProseMirror to miss the change (see #930)
7683
7722
  this.flushSoon();
7684
- else
7723
+ }
7724
+ else if (safari && view.composing && mutations.some(m => m.type == "childList" && m.target.nodeName == "TR")) {
7725
+ // Safari does weird stuff when finishing a composition in a
7726
+ // table cell, which tends to involve inserting inappropriate
7727
+ // nodes in the table row.
7728
+ view.input.badSafariComposition = true;
7729
+ this.flushSoon();
7730
+ }
7731
+ else {
7685
7732
  this.flush();
7733
+ }
7686
7734
  });
7687
7735
  if (useCharData) {
7688
7736
  this.onCharData = e => {
@@ -7802,7 +7850,17 @@ class DOMObserver {
7802
7850
  }
7803
7851
  }
7804
7852
  }
7805
- if (gecko && added.length) {
7853
+ if (added.some(n => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
7854
+ // Browsers sometimes insert a bogus break node if you
7855
+ // backspace out the last bit of text before an inline-flex node (#1552)
7856
+ for (let node of added)
7857
+ if (node.nodeName == "BR" && node.parentNode) {
7858
+ let after = node.nextSibling;
7859
+ if (after && after.nodeType == 1 && after.contentEditable == "false")
7860
+ node.parentNode.removeChild(node);
7861
+ }
7862
+ }
7863
+ else if (gecko && added.length) {
7806
7864
  let brs = added.filter(n => n.nodeName == "BR");
7807
7865
  if (brs.length == 2) {
7808
7866
  let [a, b] = brs;
@@ -7838,6 +7896,10 @@ class DOMObserver {
7838
7896
  view.docView.markDirty(from, to);
7839
7897
  checkCSS(view);
7840
7898
  }
7899
+ if (view.input.badSafariComposition) {
7900
+ view.input.badSafariComposition = false;
7901
+ fixUpBadSafariComposition(view, added);
7902
+ }
7841
7903
  this.handleDOMChange(from, to, typeOver, added);
7842
7904
  if (view.docView && view.docView.dirty)
7843
7905
  view.updateState(view.state);
@@ -7961,6 +8023,37 @@ function blockParent(view, node) {
7961
8023
  }
7962
8024
  return null;
7963
8025
  }
8026
+ // Kludge for a Safari bug where, on ending a composition in an
8027
+ // otherwise empty table cell, it randomly moves the composed text
8028
+ // into the table row around that cell, greatly confusing everything
8029
+ // (#188).
8030
+ function fixUpBadSafariComposition(view, addedNodes) {
8031
+ var _a;
8032
+ let { focusNode, focusOffset } = view.domSelectionRange();
8033
+ for (let node of addedNodes) {
8034
+ if (((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName) == "TR") {
8035
+ let nextCell = node.nextSibling;
8036
+ while (nextCell && (nextCell.nodeName != "TD" && nextCell.nodeName != "TH"))
8037
+ nextCell = nextCell.nextSibling;
8038
+ if (nextCell) {
8039
+ let parent = nextCell;
8040
+ for (;;) {
8041
+ let first = parent.firstChild;
8042
+ if (!first || first.nodeType != 1 || first.contentEditable == "false" ||
8043
+ /^(BR|IMG)$/.test(first.nodeName))
8044
+ break;
8045
+ parent = first;
8046
+ }
8047
+ parent.insertBefore(node, parent.firstChild);
8048
+ if (focusNode == node)
8049
+ view.domSelection().collapse(node, focusOffset);
8050
+ }
8051
+ else {
8052
+ node.parentNode.removeChild(node);
8053
+ }
8054
+ }
8055
+ }
8056
+ }
7964
8057
 
7965
8058
  // Note that all referencing and parsing is done with the
7966
8059
  // start-of-operation selection and document, since that's the one
@@ -8524,7 +8617,7 @@ class EditorView {
8524
8617
  this.docView.destroy();
8525
8618
  this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);
8526
8619
  }
8527
- if (chromeKludge && !this.trackWrites)
8620
+ if (chromeKludge && (!this.trackWrites || !this.dom.contains(this.trackWrites)))
8528
8621
  forceSelUpdate = true;
8529
8622
  }
8530
8623
  // Work around for an issue where an update arriving right between
@@ -8975,11 +9068,9 @@ const convertToView = (doc, ctx) => {
8975
9068
  const attrsA = a.attrs;
8976
9069
  const attrsB = b.attrs;
8977
9070
  if (attrsA === attrsB) return true;
8978
- /* v8 ignore next -- not currently reachable since all attrs are required @preserve */
8979
9071
  if (!attrsA || !attrsB) return false;
8980
9072
  const keysA = Object.keys(attrsA);
8981
9073
  const keysB = Object.keys(attrsB);
8982
- /* v8 ignore next -- not currently reachable since all attrs are required @preserve */
8983
9074
  if (keysA.length !== keysB.length) return false;
8984
9075
  for (const key of keysA) {
8985
9076
  if (attrsA[key] !== attrsB[key]) return false;
@@ -10351,10 +10442,8 @@ function drawGapCursor(state) {
10351
10442
  function defaultTextblockForMatch(match) {
10352
10443
  for (let i = 0; i < match.edgeCount; i++) {
10353
10444
  const { type } = match.edge(i);
10354
- /* v8 ignore if -- @preserve It's currently not possible to exercise this code in our RTE */
10355
10445
  if (type.isTextblock && !type.hasRequiredAttrs()) return type;
10356
10446
  }
10357
- /* v8 ignore next 1 -- @preserve*/
10358
10447
  throw new Error("No default textblock found.");
10359
10448
  }
10360
10449
 
@@ -11504,6 +11593,22 @@ class RteCoreImpl extends slottableRequest.RteFeatureImpl {
11504
11593
  ];
11505
11594
  }
11506
11595
  getPlugins(rte) {
11596
+ const enterKeyChainCommands = chainCommands(
11597
+ newlineInCode,
11598
+ createParagraphNear,
11599
+ liftEmptyBlock,
11600
+ splitBlockAs((node, atEnd, $from) => {
11601
+ if (!atEnd) {
11602
+ return { type: node.type, attrs: node.attrs };
11603
+ }
11604
+ return {
11605
+ type: defaultTextblockForMatch(
11606
+ $from.node($from.depth - 1).contentMatchAt($from.indexAfter($from.depth - 1))
11607
+ ),
11608
+ attrs: rte.textblockAttrs.extractFromNode(node)
11609
+ };
11610
+ })
11611
+ );
11507
11612
  return [
11508
11613
  this.contribution(this.disabled.plugin),
11509
11614
  this.contribution(
@@ -11540,22 +11645,8 @@ class RteCoreImpl extends slottableRequest.RteFeatureImpl {
11540
11645
  this.contribution(
11541
11646
  keymap({
11542
11647
  ...baseKeymap,
11543
- Enter: chainCommands(
11544
- newlineInCode,
11545
- createParagraphNear,
11546
- liftEmptyBlock,
11547
- splitBlockAs((node, atEnd, $from) => {
11548
- if (!atEnd) {
11549
- return { type: node.type, attrs: node.attrs };
11550
- }
11551
- return {
11552
- type: defaultTextblockForMatch(
11553
- $from.node($from.depth - 1).contentMatchAt($from.indexAfter($from.depth - 1))
11554
- ),
11555
- attrs: rte.textblockAttrs.extractFromNode(node)
11556
- };
11557
- })
11558
- )
11648
+ Enter: enterKeyChainCommands,
11649
+ "Shift-Enter": enterKeyChainCommands
11559
11650
  })
11560
11651
  ),
11561
11652
  this.contribution(dropCursor()),
@@ -11590,7 +11681,6 @@ const sanitizeLinkHref = (url) => {
11590
11681
  RETURN_DOM: true,
11591
11682
  ...domPurifyConfig
11592
11683
  }).querySelector("a");
11593
- /* v8 ignore next -- since href is already validated it's probably always present @preserve */
11594
11684
  return sanitizedAnchor.getAttribute("href") ?? "";
11595
11685
  };
11596
11686
  const sanitizeImageSrc = (url) => {
@@ -11769,7 +11859,7 @@ class RteInstance {
11769
11859
  this.feature = (Feature, featureId) => {
11770
11860
  return this[slottableRequest.impl].getPublicInterface(Feature, featureId);
11771
11861
  };
11772
- this[slottableRequest.impl] = new RteInstanceImpl(config, options);
11862
+ this[slottableRequest.impl] = new RteInstanceImpl(this, config, options);
11773
11863
  }
11774
11864
  /**
11775
11865
  * Returns the current document state.
@@ -11825,7 +11915,7 @@ class RteInstance {
11825
11915
  }
11826
11916
  }
11827
11917
  class RteInstanceImpl {
11828
- constructor(configFacade, options) {
11918
+ constructor(instanceFacade, configFacade, options) {
11829
11919
  this.options = options;
11830
11920
  this.view = null;
11831
11921
  this.dispatchTransaction = (tr) => {
@@ -11837,6 +11927,7 @@ class RteInstanceImpl {
11837
11927
  }
11838
11928
  return this.state;
11839
11929
  };
11930
+ this.facade = instanceFacade;
11840
11931
  const config = configFacade[slottableRequest.impl];
11841
11932
  this.config = config;
11842
11933
  this.schema = config.schema;
@@ -12752,12 +12843,12 @@ class RteHardBreakFeatureImpl extends slottableRequest.RteFeatureImpl {
12752
12843
  const keyBindings = {
12753
12844
  "Shift-Enter": forceBreak
12754
12845
  };
12755
- return [this.contribution(keymap(keyBindings))];
12846
+ return [this.contribution(keymap(keyBindings), slottableRequest.contributionPriority.high)];
12756
12847
  }
12757
12848
  }
12758
12849
  const RteHardBreakFeature = slottableRequest.featureFacade(RteHardBreakFeatureImpl);
12759
12850
 
12760
- const mixedFontSize = Symbol("mixedFontSize");
12851
+ const mixedFontSize = /* @__PURE__ */ Symbol("mixedFontSize");
12761
12852
  class RteFontSizePickerFeatureImpl extends slottableRequest.RteFeatureImpl {
12762
12853
  constructor(config) {
12763
12854
  super();
@@ -13417,7 +13508,7 @@ function markApplies(doc, ranges, type) {
13417
13508
  }
13418
13509
  return false;
13419
13510
  }
13420
- const mixedColor = Symbol("mixedColor");
13511
+ const mixedColor = /* @__PURE__ */ Symbol("mixedColor");
13421
13512
  class RteTextColorPickerFeatureImpl extends slottableRequest.RteFeatureImpl {
13422
13513
  constructor(config) {
13423
13514
  super();
@@ -14313,7 +14404,7 @@ class RteLinkFeatureImpl extends slottableRequest.RteFeatureImpl {
14313
14404
  try {
14314
14405
  new URL(url);
14315
14406
  return true;
14316
- } catch (e) {
14407
+ } catch {
14317
14408
  return false;
14318
14409
  }
14319
14410
  };
@@ -14652,7 +14743,6 @@ class RteInlineImageFeatureImpl extends slottableRequest.RteFeatureImpl {
14652
14743
  new Plugin({
14653
14744
  props: {
14654
14745
  nodeViews: {
14655
- // eslint-disable-next-line @typescript-eslint/naming-convention
14656
14746
  inlineImage: (node, view, getPos) => new InlineImageView(node, view, getPos, this.config)
14657
14747
  }
14658
14748
  },
@@ -15179,6 +15269,31 @@ class RteInputRuleFeatureImpl extends slottableRequest.RteFeatureImpl {
15179
15269
  }
15180
15270
  const RteInputRuleFeature = slottableRequest.featureFacade(RteInputRuleFeatureImpl);
15181
15271
 
15272
+ function toCommand(handler, rteInstance) {
15273
+ if (handler.length === 0) {
15274
+ return (_state, _dispatch) => handler();
15275
+ }
15276
+ return (_state, _dispatch) => handler(rteInstance);
15277
+ }
15278
+ class RteKeyboardShortcutsFeatureImpl extends slottableRequest.RteFeatureImpl {
15279
+ constructor(featureId, options) {
15280
+ super();
15281
+ this.featureId = featureId;
15282
+ this.options = options;
15283
+ this.name = `RteKeyboardShortcutsFeature[${featureId}]`;
15284
+ }
15285
+ getPlugins(rte) {
15286
+ const bindings = {};
15287
+ for (const [key, handler] of Object.entries(this.options.shortcuts)) {
15288
+ bindings[key] = toCommand(handler, rte.facade);
15289
+ }
15290
+ return [this.contribution(keymap(bindings), slottableRequest.contributionPriority.high)];
15291
+ }
15292
+ }
15293
+ const RteKeyboardShortcutsFeature = slottableRequest.featureFacade(
15294
+ RteKeyboardShortcutsFeatureImpl
15295
+ );
15296
+
15182
15297
  const suggestCss = ".suggest-popover{display:flex;flex-direction:column;padding:4px;gap:2px;max-block-size:408px;max-inline-size:248px;min-inline-size:128px}.suggest-loading-widget{display:inline-flex;align-items:center;margin-inline-start:2px;vertical-align:middle;white-space:normal}.suggest-empty-message{display:flex;align-items:center;justify-content:center;color:var(--vvd-color-neutral-300);font:var(--vvd-typography-base);min-block-size:40px;text-align:center}.suggest-item--visible-focus{box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}";
15183
15298
 
15184
15299
  const isPopoverOpen = (state) => Boolean(state?.suggestions && !state.dismissed);
@@ -15298,7 +15413,6 @@ class RteSuggestFeatureImpl extends slottableRequest.RteFeatureImpl {
15298
15413
  loadingDecoration: loadingDecoration(false)
15299
15414
  };
15300
15415
  case "navigate": {
15301
- /* v8 ignore next 3 -- defensive: navigate is only dispatched after results are loaded @preserve */
15302
15416
  if (!prevState.suggestions?.items.length) {
15303
15417
  return prevState;
15304
15418
  }
@@ -15496,7 +15610,6 @@ class RteSuggestFeatureImpl extends slottableRequest.RteFeatureImpl {
15496
15610
  return false;
15497
15611
  }
15498
15612
  const suggestion = suggestState.suggestions.items[suggestState.suggestions.selectedIndex];
15499
- /* v8 ignore next 3 -- defensive: view is always passed by keymap @preserve */
15500
15613
  if (view) {
15501
15614
  this.selectSuggestion(view, suggestState, suggestion);
15502
15615
  }
@@ -15564,6 +15677,7 @@ exports.RteHtmlSerializer = RteHtmlSerializer;
15564
15677
  exports.RteInlineImageFeature = RteInlineImageFeature;
15565
15678
  exports.RteInputRuleFeature = RteInputRuleFeature;
15566
15679
  exports.RteItalicFeature = RteItalicFeature;
15680
+ exports.RteKeyboardShortcutsFeature = RteKeyboardShortcutsFeature;
15567
15681
  exports.RteLinkFeature = RteLinkFeature;
15568
15682
  exports.RteListFeature = RteListFeature;
15569
15683
  exports.RteMonospaceFeature = RteMonospaceFeature;