@vonage/vivid 5.28.1 → 5.30.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 (239) hide show
  1. package/accordion/definition.js +1 -2
  2. package/accordion-item/definition.js +1 -2
  3. package/action-group/definition.js +1 -2
  4. package/alert/definition.js +1 -2
  5. package/audio-player/definition.js +1 -2
  6. package/audio-player/index.cjs +1 -1
  7. package/audio-player/index.js +1 -5
  8. package/avatar/definition.js +1 -2
  9. package/badge/definition.js +1 -2
  10. package/banner/definition.js +1 -2
  11. package/banner/index.cjs +1 -1
  12. package/banner/index.js +1 -1
  13. package/breadcrumb/definition.js +1 -2
  14. package/bundled/char-count.cjs +1 -1
  15. package/bundled/char-count.js +1 -1
  16. package/bundled/decorate.js +1 -1
  17. package/bundled/definition12.cjs +2 -1
  18. package/bundled/definition12.js +2 -1
  19. package/bundled/definition16.cjs +1 -1
  20. package/bundled/definition16.js +2 -5
  21. package/bundled/definition17.cjs +1 -1
  22. package/bundled/definition17.js +1 -1
  23. package/bundled/definition18.cjs +1 -1
  24. package/bundled/definition18.js +1 -1
  25. package/bundled/definition19.cjs +2 -2
  26. package/bundled/definition19.js +10 -25
  27. package/bundled/definition21.cjs +1 -1
  28. package/bundled/definition21.js +1 -1
  29. package/bundled/definition25.cjs +4 -4
  30. package/bundled/definition25.js +4 -4
  31. package/bundled/definition5.cjs +1 -1
  32. package/bundled/definition5.js +3 -6
  33. package/bundled/listbox.cjs +1 -1
  34. package/bundled/listbox.js +1 -5
  35. package/bundled/numberConverter.cjs +1 -1
  36. package/bundled/numberConverter.js +1 -1
  37. package/bundled/option.cjs +1 -1
  38. package/bundled/option.js +1 -5
  39. package/bundled/picker-field.template.cjs +5 -3
  40. package/bundled/picker-field.template.js +20 -17
  41. package/bundled/repeat.cjs +1 -1
  42. package/bundled/repeat.js +1 -5
  43. package/bundled/single-value-picker.cjs +1 -1
  44. package/bundled/single-value-picker.js +5 -15
  45. package/bundled/slottable-request.cjs +2 -2
  46. package/bundled/slottable-request.js +31 -34
  47. package/bundled/time-selection-picker.template.cjs +1 -1
  48. package/bundled/time-selection-picker.template.js +1 -1
  49. package/bundled/vivid-element.cjs +2 -2
  50. package/bundled/vivid-element.js +16 -38
  51. package/button/definition.js +1 -2
  52. package/calendar/definition.js +1 -2
  53. package/card/definition.js +1 -2
  54. package/checkbox/definition.js +1 -2
  55. package/color-picker/definition.js +1 -2
  56. package/color-picker/index.cjs +1 -1
  57. package/color-picker/index.js +3 -5
  58. package/combobox/definition.js +1 -2
  59. package/combobox/index.cjs +1 -1
  60. package/combobox/index.js +1 -5
  61. package/contextual-help/definition.js +1 -2
  62. package/country/definition.js +1 -2
  63. package/country-group/definition.js +1 -2
  64. package/country-group/index.cjs +1 -1
  65. package/country-group/index.js +1 -5
  66. package/custom-elements.json +521 -217
  67. package/data-grid/definition.js +1 -2
  68. package/data-grid/index.cjs +2 -2
  69. package/data-grid/index.js +16 -44
  70. package/date-picker/definition.js +1 -2
  71. package/date-range-picker/definition.js +1 -2
  72. package/date-range-picker/index.cjs +1 -1
  73. package/date-range-picker/index.js +7 -18
  74. package/date-time-picker/definition.js +1 -2
  75. package/dial-pad/definition.js +1 -2
  76. package/dial-pad/index.cjs +1 -1
  77. package/dial-pad/index.js +1 -5
  78. package/dialog/definition.js +1 -2
  79. package/elevation/definition.js +1 -2
  80. package/empty-state/definition.js +1 -2
  81. package/empty-state/index.cjs +2 -2
  82. package/empty-state/index.js +3 -3
  83. package/fab/definition.js +1 -2
  84. package/fab/index.cjs +1 -1
  85. package/fab/index.js +2 -5
  86. package/file-picker/definition.js +1 -2
  87. package/file-picker/index.js +1 -0
  88. package/flag/definition.js +1 -2
  89. package/form-field/definition.js +1 -2
  90. package/header/definition.js +1 -2
  91. package/kbd-key/definition.js +1 -2
  92. package/kbd-shortcut/definition.js +1 -2
  93. package/layout/definition.js +1 -2
  94. package/lib/date-picker/date-picker.d.ts +4 -0
  95. package/lib/date-range-picker/date-range-picker.d.ts +2 -0
  96. package/lib/date-time-picker/date-time-picker.d.ts +4 -0
  97. package/lib/empty-state/definition.d.ts +1 -1
  98. package/lib/empty-state/empty-state.d.ts +3 -1
  99. package/lib/number-field/definition.d.ts +1 -1
  100. package/lib/number-field/number-field.d.ts +3 -1
  101. package/lib/rich-text-editor/rte/features/base.d.ts +2 -1
  102. package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +2 -0
  103. package/lib/rich-text-editor/rte/features/inline-image.d.ts +1 -0
  104. package/lib/rich-text-editor/rte/features/suggest.d.ts +7 -1
  105. package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +3 -0
  106. package/lib/rich-text-editor/rte/utils/color.d.ts +1 -0
  107. package/lib/rich-text-editor/rte/utils/flatten-slice.d.ts +2 -0
  108. package/lib/rich-text-editor/rte/utils/sanitization.d.ts +2 -0
  109. package/lib/time-picker/time-picker.d.ts +2 -0
  110. package/listbox/definition.js +1 -2
  111. package/listbox/index.cjs +1 -1
  112. package/listbox/index.js +4 -8
  113. package/locales/de-DE.cjs +1 -1
  114. package/locales/de-DE.js +1 -1
  115. package/locales/en-GB.cjs +1 -1
  116. package/locales/en-GB.js +1 -1
  117. package/locales/en-US.js +1 -2
  118. package/locales/ja-JP.cjs +1 -1
  119. package/locales/ja-JP.js +1 -1
  120. package/locales/zh-CN.cjs +1 -1
  121. package/locales/zh-CN.js +1 -1
  122. package/menu/definition.js +1 -2
  123. package/menu-item/definition.js +1 -2
  124. package/nav/definition.js +1 -2
  125. package/nav-disclosure/definition.js +1 -2
  126. package/nav-item/definition.js +1 -2
  127. package/note/definition.js +1 -2
  128. package/number-field/definition.js +1 -2
  129. package/number-field/index.cjs +16 -14
  130. package/number-field/index.js +49 -31
  131. package/package.json +21 -21
  132. package/pagination/definition.js +1 -2
  133. package/pagination/index.cjs +1 -1
  134. package/pagination/index.js +2 -13
  135. package/platform-switch/definition.js +1 -2
  136. package/platform-switch/index.cjs +1 -1
  137. package/platform-switch/index.js +1 -7
  138. package/popover/definition.js +1 -2
  139. package/popover/index.js +1 -0
  140. package/popup/definition.js +1 -2
  141. package/progress/definition.js +1 -2
  142. package/progress-ring/definition.js +1 -2
  143. package/radio/definition.js +1 -2
  144. package/radio-group/definition.js +1 -2
  145. package/radio-group/index.cjs +13 -2
  146. package/radio-group/index.js +21 -14
  147. package/range-slider/definition.js +1 -2
  148. package/rich-text-editor/definition.js +1 -2
  149. package/rich-text-editor/index.cjs +14 -14
  150. package/rich-text-editor/index.js +2099 -2010
  151. package/rich-text-view/definition.js +1 -2
  152. package/searchable-select/definition.js +1 -2
  153. package/searchable-select/index.cjs +1 -1
  154. package/searchable-select/index.js +4 -24
  155. package/select/definition.js +1 -2
  156. package/selectable-box/definition.js +1 -2
  157. package/selectable-box/index.cjs +1 -1
  158. package/selectable-box/index.js +2 -5
  159. package/shared/picker-field/mixins/calendar-picker.d.ts +1 -0
  160. package/shared/picker-field/mixins/calendar-picker.template.d.ts +1 -0
  161. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1 -0
  162. package/shared/picker-field/mixins/single-date-picker.d.ts +1 -0
  163. package/shared/picker-field/mixins/single-value-picker.d.ts +1 -0
  164. package/shared/picker-field/mixins/time-selection-picker.d.ts +1 -0
  165. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -0
  166. package/shared/picker-field/picker-field.d.ts +38 -31
  167. package/side-drawer/definition.js +1 -2
  168. package/side-drawer/index.cjs +1 -1
  169. package/side-drawer/index.js +2 -5
  170. package/simple-color-picker/definition.js +1 -2
  171. package/split-button/definition.js +1 -2
  172. package/split-button/index.cjs +1 -1
  173. package/split-button/index.js +4 -10
  174. package/status/definition.js +1 -2
  175. package/styles/fonts/spezia-variable.css +33 -21
  176. package/switch/definition.js +1 -2
  177. package/switch/index.cjs +1 -1
  178. package/switch/index.js +1 -1
  179. package/tab/definition.js +1 -2
  180. package/tab-panel/definition.js +1 -2
  181. package/table/definition.js +1 -2
  182. package/tabs/definition.js +1 -2
  183. package/tabs/index.cjs +1 -1
  184. package/tabs/index.js +1 -1
  185. package/tag/definition.js +1 -2
  186. package/tag/index.cjs +1 -1
  187. package/tag/index.js +2 -2
  188. package/tag-group/definition.js +1 -2
  189. package/text-area/definition.js +1 -2
  190. package/text-field/definition.js +1 -2
  191. package/toggletip/definition.js +1 -2
  192. package/tooltip/definition.js +1 -2
  193. package/tree-item/definition.js +1 -2
  194. package/tree-view/definition.js +1 -2
  195. package/unbundled/decorate.cjs +1 -1
  196. package/unbundled/decorate.js +1 -1
  197. package/unbundled/definition11.cjs +1 -1
  198. package/unbundled/definition11.js +1 -1
  199. package/unbundled/definition16.cjs +1 -1
  200. package/unbundled/definition16.js +1 -1
  201. package/unbundled/definition2.cjs +4 -4
  202. package/unbundled/definition2.js +4 -4
  203. package/unbundled/definition28.cjs +5 -1
  204. package/unbundled/definition28.js +5 -1
  205. package/unbundled/definition29.cjs +1 -1
  206. package/unbundled/definition29.js +1 -1
  207. package/unbundled/definition30.cjs +1 -1
  208. package/unbundled/definition30.js +1 -1
  209. package/unbundled/definition42.cjs +3 -2
  210. package/unbundled/definition42.js +3 -2
  211. package/unbundled/definition50.cjs +1 -1
  212. package/unbundled/definition50.js +1 -1
  213. package/unbundled/definition55.cjs +41 -8
  214. package/unbundled/definition55.js +41 -8
  215. package/unbundled/definition6.cjs +1 -1
  216. package/unbundled/definition6.js +1 -1
  217. package/unbundled/definition61.cjs +21 -2
  218. package/unbundled/definition61.js +21 -2
  219. package/unbundled/definition63.cjs +169 -42
  220. package/unbundled/definition63.js +164 -37
  221. package/unbundled/definition72.cjs +1 -0
  222. package/unbundled/definition72.js +1 -0
  223. package/unbundled/definition74.cjs +2 -1
  224. package/unbundled/definition74.js +2 -1
  225. package/unbundled/definition76.cjs +1 -1
  226. package/unbundled/definition76.js +1 -1
  227. package/unbundled/en-US.cjs +1 -1
  228. package/unbundled/en-US.js +1 -1
  229. package/unbundled/numberConverter.cjs +1 -1
  230. package/unbundled/numberConverter.js +1 -1
  231. package/unbundled/picker-field.template.cjs +6 -1
  232. package/unbundled/picker-field.template.js +6 -1
  233. package/unbundled/vivid-element.cjs +1 -1
  234. package/unbundled/vivid-element.js +1 -1
  235. package/video-player/definition.js +1 -2
  236. package/video-player/index.cjs +18 -18
  237. package/video-player/index.js +630 -1220
  238. package/visually-hidden/definition.js +1 -2
  239. package/vivid.api.json +159 -4
@@ -14,9 +14,11 @@ const require_definition$5 = require("./definition26.cjs");
14
14
  const require_definition$6 = require("./definition27.cjs");
15
15
  const require_option = require("./option.cjs");
16
16
  const require_definition$7 = require("./definition29.cjs");
17
- const require_definition$8 = require("./definition36.cjs");
17
+ const require_optgroup = require("./optgroup.cjs");
18
+ const require_definition$8 = require("./definition30.cjs");
19
+ const require_definition$9 = require("./definition36.cjs");
18
20
  const require_slottable_request = require("./slottable-request.cjs");
19
- const require_definition$9 = require("./definition64.cjs");
21
+ const require_definition$10 = require("./definition64.cjs");
20
22
  let _microsoft_fast_element = require("@microsoft/fast-element");
21
23
  let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
22
24
  let prosemirror_model = require("prosemirror-model");
@@ -464,6 +466,26 @@ var sanitizeLinkHref = (url) => {
464
466
  ...domPurifyConfig
465
467
  }).querySelector("a").getAttribute("href") ?? "";
466
468
  };
469
+ /** Whether a URL is safe to use as an anchor href. */
470
+ var isSafeLinkHref = (url) => sanitizeLinkHref(url) !== "";
471
+ var RELATIVE_HREF_REGEXP = /^(?:[/?#]|\.{1,2}\/)/;
472
+ /**
473
+ * Whether a URL is acceptable as a link href: safe, and either an absolute URL
474
+ * or relative to the current document. Relative hrefs are supported, so this is
475
+ * deliberately weaker than requiring a scheme, but a bare word like "invalid"
476
+ * is still rejected.
477
+ */
478
+ var isValidLinkHref = (url) => {
479
+ const href = url.trim();
480
+ if (!href || !isSafeLinkHref(href)) return false;
481
+ if (RELATIVE_HREF_REGEXP.test(href)) return true;
482
+ try {
483
+ new URL(href);
484
+ return true;
485
+ } catch {
486
+ return false;
487
+ }
488
+ };
467
489
  /**
468
490
  * Sanitize potentially dangerous URLs, like "javascript:", in image src attributes.
469
491
  * Returns empty string if the URL is unsafe.
@@ -912,6 +934,54 @@ var RteConfigImpl = class {
912
934
  }
913
935
  };
914
936
  //#endregion
937
+ //#region src/lib/rich-text-editor/rte/utils/flatten-slice.ts
938
+ /**
939
+ * Splits a fragment into lines of inline content, collapsing all block structure.
940
+ * Each textblock becomes one line; container blocks (e.g. lists) are recursed into.
941
+ * Block nodes which are neither textblocks nor containers have no inline content
942
+ * to contribute and are dropped.
943
+ */
944
+ var linesOfInlineContent = (fragment) => {
945
+ const lines = [];
946
+ let inlineRun;
947
+ fragment.forEach((node) => {
948
+ if (node.isInline) {
949
+ if (!inlineRun) {
950
+ inlineRun = [];
951
+ lines.push(inlineRun);
952
+ }
953
+ inlineRun.push(node);
954
+ return;
955
+ }
956
+ inlineRun = void 0;
957
+ if (node.isTextblock) {
958
+ const inlineChildren = [];
959
+ node.content.forEach((child) => inlineChildren.push(child));
960
+ lines.push(inlineChildren);
961
+ } else lines.push(...linesOfInlineContent(node.content));
962
+ });
963
+ return lines;
964
+ };
965
+ /**
966
+ * Collapses a slice spanning multiple blocks into a single run of inline content,
967
+ * so that it can be inserted into a document which only permits one block.
968
+ *
969
+ * Lines are joined with a hardBreak where the schema has one, preserving the
970
+ * visual line structure. Without hardBreak the schema offers no way to mark a
971
+ * line boundary, so lines are concatenated directly.
972
+ *
973
+ * Slices that already hold a single line are returned unchanged, to keep the
974
+ * original open depths and let ProseMirror insert them as it normally would.
975
+ */
976
+ var flattenSliceToInline = (slice, schema) => {
977
+ const lines = linesOfInlineContent(slice.content);
978
+ if (lines.length <= 1) return slice;
979
+ const hardBreak = schema.nodes.hardBreak;
980
+ const separator = hardBreak ? [hardBreak.create()] : [];
981
+ const inline = lines.flatMap((line, index) => index === 0 ? line : [...separator, ...line]);
982
+ return new prosemirror_model.Slice(prosemirror_model.Fragment.fromArray(inline), 0, 0);
983
+ };
984
+ //#endregion
915
985
  //#region src/lib/rich-text-editor/rte/utils/ui.ts
916
986
  var isPropBinding = (prop) => typeof prop === "function";
917
987
  var on = (event, prop, handler) => [
@@ -1095,7 +1165,7 @@ var createOption = (ctx, props) => {
1095
1165
  };
1096
1166
  var createSelect = (ctx, props) => {
1097
1167
  const disabled = () => Boolean(ctx.evalProp(ctx.props.disabled));
1098
- const select = ctx.rte.createComponent(require_definition$9.Select);
1168
+ const select = ctx.rte.createComponent(require_definition$10.Select);
1099
1169
  select.setAttribute("data-class", "ui-select");
1100
1170
  ctx.bindToEl(select, {
1101
1171
  placeholder: " ",
@@ -1413,6 +1483,10 @@ var RteBaseImpl = class extends require_slottable_request.RteFeatureImpl {
1413
1483
  text: { group: "inline" }
1414
1484
  } })];
1415
1485
  }
1486
+ getPlugins(_rte) {
1487
+ if (!this.config?.singleBlock) return [];
1488
+ return [this.contribution(new prosemirror_state.Plugin({ props: { transformPasted: (slice, view) => flattenSliceToInline(slice, view.state.schema) } }))];
1489
+ }
1416
1490
  getFeatures() {
1417
1491
  return [
1418
1492
  this,
@@ -1667,8 +1741,11 @@ var RteFontSizePickerFeatureImpl = class extends require_slottable_request.RteFe
1667
1741
  tag: "span[style*='font-size']",
1668
1742
  getAttrs: (node) => {
1669
1743
  const size = node.getAttribute("style").match(/font-size:\s*([^;]+)/)?.[1]?.trim();
1670
- if (size) return { size };
1671
- return false;
1744
+ if (!size) return false;
1745
+ const parsedSize = this.config?.parseSizeFromHtml ? this.config.parseSizeFromHtml(size) : size;
1746
+ if (parsedSize === null) return false;
1747
+ if (this.config?.restrictToOptions && !this.fontSizes.some((fs) => fs.size === parsedSize)) return false;
1748
+ return { size: parsedSize };
1672
1749
  }
1673
1750
  }],
1674
1751
  toDOM: (mark) => {
@@ -1945,6 +2022,36 @@ var RteMonospaceFeatureImpl = class extends RteTextStyleFeatureImpl {
1945
2022
  };
1946
2023
  var RteMonospaceFeature = require_slottable_request.featureFacade(RteMonospaceFeatureImpl);
1947
2024
  //#endregion
2025
+ //#region src/lib/rich-text-editor/rte/utils/color.ts
2026
+ /**
2027
+ * Normalizes a CSS color into its canonical CSSOM serialization, so that colors
2028
+ * written in different notations can be compared:
2029
+ *
2030
+ * ```ts
2031
+ * normalizeCssColor('#000'); // -> 'rgb(0, 0, 0)'
2032
+ * normalizeCssColor('rgb(0 0 0 / 50%)'); // -> 'rgba(0, 0, 0, 0.5)'
2033
+ * normalizeCssColor('not-a-color'); // -> null
2034
+ * ```
2035
+ *
2036
+ * Only the notation is canonicalized – nothing is resolved against the document.
2037
+ * Values the CSSOM keeps as-is are returned as-is, which means equal colors do not
2038
+ * necessarily normalize to the same string:
2039
+ *
2040
+ * ```ts
2041
+ * normalizeCssColor('BLACK'); // -> 'black', not 'rgb(0, 0, 0)'
2042
+ * normalizeCssColor('var(--brand)'); // -> 'var(--brand)', never the resolved color
2043
+ * normalizeCssColor('color-mix(in srgb, red, blue)'); // -> 'color-mix(in srgb, red, blue)'
2044
+ * normalizeCssColor('inherit'); // -> 'inherit'
2045
+ * ```
2046
+ *
2047
+ * The exact behavior is browser dependent.
2048
+ */
2049
+ var normalizeCssColor = (color) => {
2050
+ const probe = document.createElement("div");
2051
+ probe.style.color = color;
2052
+ return probe.style.color || null;
2053
+ };
2054
+ //#endregion
1948
2055
  //#region src/lib/rich-text-editor/rte/features/text-color-picker.ts
1949
2056
  function markApplies(doc, ranges, type) {
1950
2057
  for (let i = 0; i < ranges.length; i++) {
@@ -1978,18 +2085,19 @@ var RteTextColorPickerFeatureImpl = class extends require_slottable_request.RteF
1978
2085
  return [this.contribution({ markName: "textColor" })];
1979
2086
  }
1980
2087
  getSchema() {
2088
+ const parseColor = (color) => {
2089
+ const parsedColor = this.config?.parseColorFromHtml ? this.config.parseColorFromHtml(color) : color;
2090
+ if (parsedColor === null) return false;
2091
+ return { color: parsedColor };
2092
+ };
1981
2093
  return [this.contribution({ marks: { textColor: {
1982
2094
  attrs: { color: { validate: "string" } },
1983
2095
  parseDOM: [{
1984
2096
  tag: "span[data-text-color]",
1985
- getAttrs: (dom) => {
1986
- return { color: dom.getAttribute("data-text-color") };
1987
- }
2097
+ getAttrs: (dom) => parseColor(dom.getAttribute("data-text-color"))
1988
2098
  }, {
1989
2099
  style: "color",
1990
- getAttrs: (value) => {
1991
- return { color: value };
1992
- }
2100
+ getAttrs: (value) => parseColor(value)
1993
2101
  }],
1994
2102
  toDOM(node) {
1995
2103
  const { color } = node.attrs;
@@ -2078,7 +2186,14 @@ var RteTextColorPickerFeatureImpl = class extends require_slottable_request.RteF
2078
2186
  };
2079
2187
  }
2080
2188
  };
2081
- var RteTextColorPickerFeature = require_slottable_request.featureFacade(RteTextColorPickerFeatureImpl);
2189
+ var RteTextColorPickerFeature = Object.assign(require_slottable_request.featureFacade(RteTextColorPickerFeatureImpl), {
2190
+ /**
2191
+ * Normalizes a CSS color into its canonical CSSOM serialization, so that
2192
+ * colors written in different notations can be compared. Nothing is resolved
2193
+ * against the document, so values such as `var(--brand)` or `inherit` are
2194
+ * returned unchanged. Returns `null` if the value is not a valid CSS color.
2195
+ */
2196
+ normalizeCssColor });
2082
2197
  //#endregion
2083
2198
  //#region src/lib/rich-text-editor/rte/features/list.style.scss?inline
2084
2199
  var list_style_default = ".rich-text ul,.rich-text ol{padding-inline-start:1.5em}.rich-text li{list-style-position:inside}";
@@ -2608,14 +2723,6 @@ var RteLinkFeatureImpl = class extends require_slottable_request.RteFeatureImpl
2608
2723
  if (from === to) return "";
2609
2724
  return state.doc.textBetween(from, to, " ");
2610
2725
  };
2611
- const isValidUrl = (url) => {
2612
- try {
2613
- new URL(url);
2614
- return true;
2615
- } catch {
2616
- return false;
2617
- }
2618
- };
2619
2726
  return [this.contribution({
2620
2727
  section: "insert",
2621
2728
  render: (ctx) => {
@@ -2640,13 +2747,11 @@ var RteLinkFeatureImpl = class extends require_slottable_request.RteFeatureImpl
2640
2747
  updateValidation();
2641
2748
  }
2642
2749
  });
2750
+ const isApplyDisabled = () => !(textField.value.length && isValidLinkHref(urlField.value));
2643
2751
  const applyButton = createButton(ctx, {
2644
2752
  label: () => ctx.rte.getLocale().richTextEditor.apply,
2645
2753
  variant: "popover-primary",
2646
- disabled: () => {
2647
- const link = this.getCurrentLink(ctx.view.state);
2648
- return !(link && link.text.length && isValidUrl(link.href));
2649
- },
2754
+ disabled: isApplyDisabled,
2650
2755
  onClick: () => {
2651
2756
  const { state, dispatch } = ctx.view;
2652
2757
  this.insertLink(rte, urlField.value, textField.value)(state, dispatch);
@@ -2654,7 +2759,7 @@ var RteLinkFeatureImpl = class extends require_slottable_request.RteFeatureImpl
2654
2759
  }
2655
2760
  });
2656
2761
  const updateValidation = () => {
2657
- applyButton.querySelector("[data-vvd-component=\"button\"]").disabled = !(textField.value.length && isValidUrl(urlField.value));
2762
+ applyButton.querySelector("[data-vvd-component=\"button\"]").disabled = isApplyDisabled();
2658
2763
  };
2659
2764
  const menu = createMenu(ctx, {
2660
2765
  label: () => ctx.rte.getLocale().richTextEditor.hyperlink,
@@ -2875,7 +2980,7 @@ var RteInlineImageFeatureImpl = class extends require_slottable_request.RteFeatu
2875
2980
  return {
2876
2981
  imageUrl,
2877
2982
  alt: dom.getAttribute("alt") || "",
2878
- size: dom.style.maxWidth || null,
2983
+ size: this.config.parseSizeFromHtml ? this.config.parseSizeFromHtml(dom) : dom.style.maxWidth || null,
2879
2984
  naturalWidth: parseDimension(dom.getAttribute("width")),
2880
2985
  naturalHeight: parseDimension(dom.getAttribute("height"))
2881
2986
  };
@@ -3382,6 +3487,7 @@ var RteKeyboardShortcutsFeature = require_slottable_request.featureFacade(RteKey
3382
3487
  var suggest_style_default = ".suggest-popover{flex-direction:column;gap:2px;max-block-size:408px;min-inline-size:128px;max-inline-size:248px;padding:4px;display:flex}.suggest-loading-widget{vertical-align:middle;white-space:normal;align-items:center;margin-inline-start:2px;display:inline-flex}.suggest-empty-message{color:var(--vvd-color-neutral-300);font:var(--vvd-typography-base);text-align:center;justify-content:center;align-items:center;min-block-size:40px;display:flex}";
3383
3488
  //#endregion
3384
3489
  //#region src/lib/rich-text-editor/rte/features/suggest.ts
3490
+ var isSuggestionGroup = (entry) => "suggestions" in entry;
3385
3491
  var isPopoverOpen = (state) => Boolean(state?.suggestions && !state.dismissed);
3386
3492
  var popoverShowsResults = (state) => isPopoverOpen(state) && state.suggestions.items.length > 0;
3387
3493
  function findMatch(state, regex) {
@@ -3420,7 +3526,7 @@ var RteSuggestFeatureImpl = class extends require_slottable_request.RteFeatureIm
3420
3526
  dispatch({
3421
3527
  type: "load",
3422
3528
  generation: gen,
3423
- suggestions
3529
+ entries: suggestions
3424
3530
  });
3425
3531
  }
3426
3532
  constructor(featureId, options) {
@@ -3462,16 +3568,20 @@ var RteSuggestFeatureImpl = class extends require_slottable_request.RteFeatureIm
3462
3568
  };
3463
3569
  const action = tr.getMeta(this.pluginKey);
3464
3570
  if (prevState && action) switch (action.type) {
3465
- case "load": return {
3466
- ...prevState,
3467
- suggestions: {
3468
- generation: action.generation,
3469
- items: action.suggestions,
3470
- selectedIndex: 0,
3471
- visibleFocus: false
3472
- },
3473
- loadingDecoration: loadingDecoration(false)
3474
- };
3571
+ case "load": {
3572
+ const entries = action.entries.filter((entry) => !isSuggestionGroup(entry) || entry.suggestions.length > 0);
3573
+ return {
3574
+ ...prevState,
3575
+ suggestions: {
3576
+ generation: action.generation,
3577
+ entries,
3578
+ items: entries.flatMap((entry) => isSuggestionGroup(entry) ? entry.suggestions : [entry]),
3579
+ selectedIndex: 0,
3580
+ visibleFocus: false
3581
+ },
3582
+ loadingDecoration: loadingDecoration(false)
3583
+ };
3584
+ }
3475
3585
  case "navigate": {
3476
3586
  /* v8 ignore next 3 -- defensive: navigate is only dispatched after results are loaded @preserve */
3477
3587
  if (!prevState.suggestions?.items.length) return prevState;
@@ -3560,15 +3670,17 @@ var RteSuggestFeatureImpl = class extends require_slottable_request.RteFeatureIm
3560
3670
  }));
3561
3671
  return;
3562
3672
  }
3563
- for (const [index, suggestion] of suggestions.items.entries()) {
3673
+ const createOption = (suggestion, index, scrollTarget) => {
3564
3674
  const item = rte.createComponent(require_option.ListboxOption);
3565
3675
  item.text = suggestion.text;
3566
3676
  item.textSecondary = suggestion.textSecondary;
3677
+ item.icon = suggestion.icon;
3567
3678
  if (index === suggestions.selectedIndex) {
3568
3679
  item.selected = true;
3569
3680
  if (suggestions.visibleFocus) item._highlighted = true;
3681
+ const target = scrollTarget ?? item;
3570
3682
  queueMicrotask(() => {
3571
- item.scrollIntoView({ block: "nearest" });
3683
+ target.scrollIntoView({ block: "nearest" });
3572
3684
  });
3573
3685
  }
3574
3686
  item.addEventListener("click", (e) => {
@@ -3576,7 +3688,21 @@ var RteSuggestFeatureImpl = class extends require_slottable_request.RteFeatureIm
3576
3688
  e.stopPropagation();
3577
3689
  this.selectSuggestion(view, suggestState, suggestion);
3578
3690
  });
3579
- content.appendChild(item);
3691
+ return item;
3692
+ };
3693
+ let index = 0;
3694
+ for (const entry of suggestions.entries) {
3695
+ if (!isSuggestionGroup(entry)) {
3696
+ content.appendChild(createOption(entry, index++));
3697
+ continue;
3698
+ }
3699
+ const group = rte.createComponent(require_optgroup.Optgroup);
3700
+ const label = document.createElement("span");
3701
+ label.slot = "label";
3702
+ label.textContent = entry.label;
3703
+ group.appendChild(label);
3704
+ for (const [i, suggestion] of entry.suggestions.entries()) group.appendChild(createOption(suggestion, index++, i === 0 ? group : void 0));
3705
+ content.appendChild(group);
3580
3706
  }
3581
3707
  };
3582
3708
  return {
@@ -3671,9 +3797,10 @@ var RteCharacterCountFeature = require_slottable_request.featureFacade(RteCharac
3671
3797
  //#endregion
3672
3798
  //#region src/lib/rich-text-editor/definition.ts
3673
3799
  var richTextEditorDefinition = require_vivid_element.defineVividComponent("rich-text-editor", RichTextEditor, RichTextEditorTemplate, [
3674
- require_definition$8.dividerDefinition,
3675
- require_definition$9.selectDefinition,
3800
+ require_definition$9.dividerDefinition,
3801
+ require_definition$10.selectDefinition,
3676
3802
  require_definition$7.listboxOptionDefinition,
3803
+ require_definition$8.optgroupDefinition,
3677
3804
  require_definition$1.buttonDefinition,
3678
3805
  require_definition$6.tooltipDefinition,
3679
3806
  require_definition$4.menuDefinition,