@vonage/vivid 5.15.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 (340) 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 +2 -7
  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 +48 -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 +1 -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 +37 -720
  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 -95
  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/select/select.d.ts +2 -2
  164. package/lib/table/table-head.d.ts +1 -0
  165. package/lib/tabs/tabs.d.ts +0 -1
  166. package/lib/text-field/text-field.d.ts +0 -1
  167. package/locales/de-DE.cjs +95 -95
  168. package/locales/de-DE.js +95 -95
  169. package/locales/en-GB.cjs +1 -1
  170. package/locales/en-GB.js +1 -1
  171. package/locales/en-US.cjs +95 -95
  172. package/locales/en-US.js +95 -95
  173. package/locales/ja-JP.cjs +94 -94
  174. package/locales/ja-JP.js +94 -94
  175. package/locales/zh-CN.cjs +94 -94
  176. package/locales/zh-CN.js +94 -94
  177. package/menu/definition.cjs +2 -3
  178. package/menu/definition.js +2 -3
  179. package/menu-item/definition.cjs +1 -1
  180. package/menu-item/definition.js +1 -1
  181. package/nav-disclosure/definition.cjs +1 -1
  182. package/nav-disclosure/definition.js +1 -1
  183. package/nav-disclosure/index.cjs +1 -1
  184. package/nav-disclosure/index.js +1 -1
  185. package/nav-item/definition.cjs +1 -1
  186. package/nav-item/definition.js +1 -1
  187. package/nav-item/index.cjs +1 -1
  188. package/nav-item/index.js +1 -1
  189. package/number-field/definition.cjs +2 -2
  190. package/number-field/definition.js +2 -2
  191. package/number-field/index.cjs +1 -1
  192. package/number-field/index.js +1 -1
  193. package/package.json +20 -18
  194. package/pagination/definition.cjs +1 -3
  195. package/pagination/definition.js +3 -5
  196. package/pagination/index.cjs +3 -3
  197. package/pagination/index.js +4 -6
  198. package/popover/definition.cjs +1 -8
  199. package/popover/definition.js +1 -8
  200. package/popover/index.cjs +1 -1
  201. package/popover/index.js +6 -17
  202. package/popup/definition.cjs +1 -1
  203. package/popup/definition.js +1 -1
  204. package/radio/definition.cjs +1 -5
  205. package/radio/definition.js +1 -5
  206. package/radio-group/definition.js +2 -2
  207. package/range-slider/definition.cjs +1 -1
  208. package/range-slider/definition.js +2 -2
  209. package/range-slider/index.cjs +1 -1
  210. package/range-slider/index.js +1 -1
  211. package/rich-text-editor/definition.cjs +128 -43
  212. package/rich-text-editor/definition.js +128 -43
  213. package/rich-text-editor/index.cjs +12 -12
  214. package/rich-text-editor/index.js +1577 -1532
  215. package/rich-text-view/definition.js +1 -1
  216. package/searchable-select/definition.cjs +2 -5
  217. package/searchable-select/definition.js +2 -5
  218. package/searchable-select/index.cjs +1 -1
  219. package/searchable-select/index.js +2 -6
  220. package/select/definition.cjs +4 -14
  221. package/select/definition.js +5 -15
  222. package/selectable-box/definition.cjs +1 -1
  223. package/selectable-box/definition.js +2 -2
  224. package/selectable-box/index.cjs +1 -1
  225. package/selectable-box/index.js +1 -1
  226. package/side-drawer/definition.cjs +1 -1
  227. package/side-drawer/definition.js +2 -2
  228. package/side-drawer/index.cjs +1 -1
  229. package/side-drawer/index.js +2 -5
  230. package/simple-color-picker/definition.cjs +18 -9
  231. package/simple-color-picker/definition.js +19 -10
  232. package/simple-color-picker/index.cjs +5 -5
  233. package/simple-color-picker/index.js +23 -23
  234. package/slider/definition.cjs +1 -6
  235. package/slider/definition.js +3 -8
  236. package/split-button/definition.cjs +1 -1
  237. package/split-button/definition.js +2 -2
  238. package/split-button/index.cjs +1 -1
  239. package/split-button/index.js +1 -1
  240. package/status/definition.cjs +9 -3
  241. package/status/definition.js +11 -5
  242. package/status/index.cjs +10 -7
  243. package/status/index.js +46 -39
  244. package/styles/core/all.css +6 -5
  245. package/styles/core/theme.css +6 -5
  246. package/styles/core/typography.css +1 -2
  247. package/styles/tokens/theme-dark.css +17 -21
  248. package/styles/tokens/theme-light.css +17 -21
  249. package/styles/tokens/vivid-2-compat.css +1 -2
  250. package/switch/definition.cjs +1 -2
  251. package/switch/definition.js +2 -3
  252. package/switch/index.cjs +1 -1
  253. package/switch/index.js +1 -2
  254. package/tab/definition.cjs +1 -1
  255. package/tab/definition.js +2 -2
  256. package/tab-panel/definition.js +1 -1
  257. package/table/definition.cjs +17 -11
  258. package/table/definition.js +19 -13
  259. package/table/index.cjs +18 -14
  260. package/table/index.js +55 -48
  261. package/tabs/definition.cjs +0 -2
  262. package/tabs/definition.js +2 -4
  263. package/tabs/index.cjs +1 -1
  264. package/tabs/index.js +0 -2
  265. package/tag/definition.cjs +1 -1
  266. package/tag/definition.js +2 -2
  267. package/tag/index.cjs +1 -1
  268. package/tag/index.js +1 -1
  269. package/tag-group/definition.js +1 -1
  270. package/text-area/definition.cjs +1 -7
  271. package/text-area/definition.js +2 -8
  272. package/text-area/index.cjs +1 -1
  273. package/text-area/index.js +1 -7
  274. package/text-field/definition.cjs +0 -10
  275. package/text-field/definition.js +1 -11
  276. package/time-picker/definition.cjs +1 -1
  277. package/time-picker/definition.js +2 -2
  278. package/toggletip/definition.cjs +0 -2
  279. package/toggletip/definition.js +1 -3
  280. package/tooltip/definition.cjs +0 -1
  281. package/tooltip/definition.js +1 -2
  282. package/tree-view/definition.cjs +0 -16
  283. package/tree-view/definition.js +1 -17
  284. package/tree-view/index.cjs +1 -1
  285. package/tree-view/index.js +0 -16
  286. package/unbundled/_commonjsHelpers.cjs +6 -2
  287. package/unbundled/_commonjsHelpers.js +6 -2
  288. package/unbundled/anchored.js +1 -1
  289. package/unbundled/attribute-binding-behaviour.cjs +0 -1
  290. package/unbundled/attribute-binding-behaviour.js +0 -1
  291. package/unbundled/base-color-picker.cjs +0 -3
  292. package/unbundled/base-color-picker.js +0 -3
  293. package/unbundled/base-progress.cjs +0 -3
  294. package/unbundled/base-progress.js +0 -3
  295. package/unbundled/button.cjs +1 -10
  296. package/unbundled/button.js +1 -10
  297. package/unbundled/calendar-picker.template.cjs +2 -4
  298. package/unbundled/calendar-picker.template.js +2 -4
  299. package/unbundled/data-grid.options.js +1 -1
  300. package/unbundled/definition.cjs +349 -170
  301. package/unbundled/definition.js +348 -170
  302. package/unbundled/definition2.cjs +169 -351
  303. package/unbundled/definition2.js +169 -350
  304. package/unbundled/definition3.cjs +1 -2
  305. package/unbundled/definition3.js +1 -2
  306. package/unbundled/definition4.cjs +1 -2
  307. package/unbundled/definition4.js +3 -4
  308. package/unbundled/definition5.cjs +1 -1
  309. package/unbundled/definition5.js +2 -2
  310. package/unbundled/delegates-aria.cjs +1 -1
  311. package/unbundled/delegates-aria.js +1 -1
  312. package/unbundled/enums.js +1 -1
  313. package/unbundled/form-associated.cjs +4 -5
  314. package/unbundled/form-associated.js +4 -5
  315. package/unbundled/host-semantics.cjs +1 -0
  316. package/unbundled/host-semantics.js +2 -1
  317. package/unbundled/key-codes.js +1 -1
  318. package/unbundled/listbox.cjs +6 -14
  319. package/unbundled/listbox.js +6 -14
  320. package/unbundled/mixins.cjs +0 -2
  321. package/unbundled/mixins.js +2 -4
  322. package/unbundled/picker-field.template.cjs +1 -2
  323. package/unbundled/picker-field.template.js +1 -2
  324. package/unbundled/scrollIntoView.cjs +0 -1
  325. package/unbundled/scrollIntoView.js +0 -1
  326. package/unbundled/slider.template.js +1 -1
  327. package/unbundled/slottable-request.cjs +2 -2
  328. package/unbundled/slottable-request.js +2 -2
  329. package/unbundled/text-field.cjs +1 -1
  330. package/unbundled/text-field.js +1 -1
  331. package/unbundled/time-selection-picker.template.cjs +1 -4
  332. package/unbundled/time-selection-picker.template.js +1 -4
  333. package/unbundled/vivid-element.cjs +2 -1
  334. package/unbundled/vivid-element.js +2 -1
  335. package/video-player/definition.cjs +7953 -7720
  336. package/video-player/definition.js +7955 -7722
  337. package/video-player/index.cjs +38 -54
  338. package/video-player/index.js +12785 -12735
  339. package/visually-hidden/definition.js +1 -1
  340. package/vivid.api.json +16 -341
@@ -11,9 +11,9 @@ 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');
@@ -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
 
@@ -11592,7 +11681,6 @@ const sanitizeLinkHref = (url) => {
11592
11681
  RETURN_DOM: true,
11593
11682
  ...domPurifyConfig
11594
11683
  }).querySelector("a");
11595
- /* v8 ignore next -- since href is already validated it's probably always present @preserve */
11596
11684
  return sanitizedAnchor.getAttribute("href") ?? "";
11597
11685
  };
11598
11686
  const sanitizeImageSrc = (url) => {
@@ -12760,7 +12848,7 @@ class RteHardBreakFeatureImpl extends slottableRequest.RteFeatureImpl {
12760
12848
  }
12761
12849
  const RteHardBreakFeature = slottableRequest.featureFacade(RteHardBreakFeatureImpl);
12762
12850
 
12763
- const mixedFontSize = Symbol("mixedFontSize");
12851
+ const mixedFontSize = /* @__PURE__ */ Symbol("mixedFontSize");
12764
12852
  class RteFontSizePickerFeatureImpl extends slottableRequest.RteFeatureImpl {
12765
12853
  constructor(config) {
12766
12854
  super();
@@ -13420,7 +13508,7 @@ function markApplies(doc, ranges, type) {
13420
13508
  }
13421
13509
  return false;
13422
13510
  }
13423
- const mixedColor = Symbol("mixedColor");
13511
+ const mixedColor = /* @__PURE__ */ Symbol("mixedColor");
13424
13512
  class RteTextColorPickerFeatureImpl extends slottableRequest.RteFeatureImpl {
13425
13513
  constructor(config) {
13426
13514
  super();
@@ -14316,7 +14404,7 @@ class RteLinkFeatureImpl extends slottableRequest.RteFeatureImpl {
14316
14404
  try {
14317
14405
  new URL(url);
14318
14406
  return true;
14319
- } catch (e) {
14407
+ } catch {
14320
14408
  return false;
14321
14409
  }
14322
14410
  };
@@ -14655,7 +14743,6 @@ class RteInlineImageFeatureImpl extends slottableRequest.RteFeatureImpl {
14655
14743
  new Plugin({
14656
14744
  props: {
14657
14745
  nodeViews: {
14658
- // eslint-disable-next-line @typescript-eslint/naming-convention
14659
14746
  inlineImage: (node, view, getPos) => new InlineImageView(node, view, getPos, this.config)
14660
14747
  }
14661
14748
  },
@@ -15326,7 +15413,6 @@ class RteSuggestFeatureImpl extends slottableRequest.RteFeatureImpl {
15326
15413
  loadingDecoration: loadingDecoration(false)
15327
15414
  };
15328
15415
  case "navigate": {
15329
- /* v8 ignore next 3 -- defensive: navigate is only dispatched after results are loaded @preserve */
15330
15416
  if (!prevState.suggestions?.items.length) {
15331
15417
  return prevState;
15332
15418
  }
@@ -15524,7 +15610,6 @@ class RteSuggestFeatureImpl extends slottableRequest.RteFeatureImpl {
15524
15610
  return false;
15525
15611
  }
15526
15612
  const suggestion = suggestState.suggestions.items[suggestState.suggestions.selectedIndex];
15527
- /* v8 ignore next 3 -- defensive: view is always passed by keymap @preserve */
15528
15613
  if (view) {
15529
15614
  this.selectSuggestion(view, suggestState, suggestion);
15530
15615
  }