@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.
- package/accordion/definition.js +1 -2
- package/accordion-item/definition.js +1 -2
- package/action-group/definition.js +1 -2
- package/alert/definition.js +1 -2
- package/audio-player/definition.js +1 -2
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +1 -5
- package/avatar/definition.js +1 -2
- package/badge/definition.js +1 -2
- package/banner/definition.js +1 -2
- package/banner/index.cjs +1 -1
- package/banner/index.js +1 -1
- package/breadcrumb/definition.js +1 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/decorate.js +1 -1
- package/bundled/definition12.cjs +2 -1
- package/bundled/definition12.js +2 -1
- package/bundled/definition16.cjs +1 -1
- package/bundled/definition16.js +2 -5
- package/bundled/definition17.cjs +1 -1
- package/bundled/definition17.js +1 -1
- package/bundled/definition18.cjs +1 -1
- package/bundled/definition18.js +1 -1
- package/bundled/definition19.cjs +2 -2
- package/bundled/definition19.js +10 -25
- package/bundled/definition21.cjs +1 -1
- package/bundled/definition21.js +1 -1
- package/bundled/definition25.cjs +4 -4
- package/bundled/definition25.js +4 -4
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +3 -6
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -5
- package/bundled/numberConverter.cjs +1 -1
- package/bundled/numberConverter.js +1 -1
- package/bundled/option.cjs +1 -1
- package/bundled/option.js +1 -5
- package/bundled/picker-field.template.cjs +5 -3
- package/bundled/picker-field.template.js +20 -17
- package/bundled/repeat.cjs +1 -1
- package/bundled/repeat.js +1 -5
- package/bundled/single-value-picker.cjs +1 -1
- package/bundled/single-value-picker.js +5 -15
- package/bundled/slottable-request.cjs +2 -2
- package/bundled/slottable-request.js +31 -34
- package/bundled/time-selection-picker.template.cjs +1 -1
- package/bundled/time-selection-picker.template.js +1 -1
- package/bundled/vivid-element.cjs +2 -2
- package/bundled/vivid-element.js +16 -38
- package/button/definition.js +1 -2
- package/calendar/definition.js +1 -2
- package/card/definition.js +1 -2
- package/checkbox/definition.js +1 -2
- package/color-picker/definition.js +1 -2
- package/color-picker/index.cjs +1 -1
- package/color-picker/index.js +3 -5
- package/combobox/definition.js +1 -2
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +1 -5
- package/contextual-help/definition.js +1 -2
- package/country/definition.js +1 -2
- package/country-group/definition.js +1 -2
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +1 -5
- package/custom-elements.json +521 -217
- package/data-grid/definition.js +1 -2
- package/data-grid/index.cjs +2 -2
- package/data-grid/index.js +16 -44
- package/date-picker/definition.js +1 -2
- package/date-range-picker/definition.js +1 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +7 -18
- package/date-time-picker/definition.js +1 -2
- package/dial-pad/definition.js +1 -2
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +1 -5
- package/dialog/definition.js +1 -2
- package/elevation/definition.js +1 -2
- package/empty-state/definition.js +1 -2
- package/empty-state/index.cjs +2 -2
- package/empty-state/index.js +3 -3
- package/fab/definition.js +1 -2
- package/fab/index.cjs +1 -1
- package/fab/index.js +2 -5
- package/file-picker/definition.js +1 -2
- package/file-picker/index.js +1 -0
- package/flag/definition.js +1 -2
- package/form-field/definition.js +1 -2
- package/header/definition.js +1 -2
- package/kbd-key/definition.js +1 -2
- package/kbd-shortcut/definition.js +1 -2
- package/layout/definition.js +1 -2
- package/lib/date-picker/date-picker.d.ts +4 -0
- package/lib/date-range-picker/date-range-picker.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +4 -0
- package/lib/empty-state/definition.d.ts +1 -1
- package/lib/empty-state/empty-state.d.ts +3 -1
- package/lib/number-field/definition.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +3 -1
- package/lib/rich-text-editor/rte/features/base.d.ts +2 -1
- package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +2 -0
- package/lib/rich-text-editor/rte/features/inline-image.d.ts +1 -0
- package/lib/rich-text-editor/rte/features/suggest.d.ts +7 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +3 -0
- package/lib/rich-text-editor/rte/utils/color.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/flatten-slice.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/sanitization.d.ts +2 -0
- package/lib/time-picker/time-picker.d.ts +2 -0
- package/listbox/definition.js +1 -2
- package/listbox/index.cjs +1 -1
- package/listbox/index.js +4 -8
- package/locales/de-DE.cjs +1 -1
- package/locales/de-DE.js +1 -1
- package/locales/en-GB.cjs +1 -1
- package/locales/en-GB.js +1 -1
- package/locales/en-US.js +1 -2
- package/locales/ja-JP.cjs +1 -1
- package/locales/ja-JP.js +1 -1
- package/locales/zh-CN.cjs +1 -1
- package/locales/zh-CN.js +1 -1
- package/menu/definition.js +1 -2
- package/menu-item/definition.js +1 -2
- package/nav/definition.js +1 -2
- package/nav-disclosure/definition.js +1 -2
- package/nav-item/definition.js +1 -2
- package/note/definition.js +1 -2
- package/number-field/definition.js +1 -2
- package/number-field/index.cjs +16 -14
- package/number-field/index.js +49 -31
- package/package.json +21 -21
- package/pagination/definition.js +1 -2
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +2 -13
- package/platform-switch/definition.js +1 -2
- package/platform-switch/index.cjs +1 -1
- package/platform-switch/index.js +1 -7
- package/popover/definition.js +1 -2
- package/popover/index.js +1 -0
- package/popup/definition.js +1 -2
- package/progress/definition.js +1 -2
- package/progress-ring/definition.js +1 -2
- package/radio/definition.js +1 -2
- package/radio-group/definition.js +1 -2
- package/radio-group/index.cjs +13 -2
- package/radio-group/index.js +21 -14
- package/range-slider/definition.js +1 -2
- package/rich-text-editor/definition.js +1 -2
- package/rich-text-editor/index.cjs +14 -14
- package/rich-text-editor/index.js +2099 -2010
- package/rich-text-view/definition.js +1 -2
- package/searchable-select/definition.js +1 -2
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +4 -24
- package/select/definition.js +1 -2
- package/selectable-box/definition.js +1 -2
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +2 -5
- package/shared/picker-field/mixins/calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +1 -0
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -0
- package/shared/picker-field/picker-field.d.ts +38 -31
- package/side-drawer/definition.js +1 -2
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +2 -5
- package/simple-color-picker/definition.js +1 -2
- package/split-button/definition.js +1 -2
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +4 -10
- package/status/definition.js +1 -2
- package/styles/fonts/spezia-variable.css +33 -21
- package/switch/definition.js +1 -2
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/definition.js +1 -2
- package/tab-panel/definition.js +1 -2
- package/table/definition.js +1 -2
- package/tabs/definition.js +1 -2
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/definition.js +1 -2
- package/tag/index.cjs +1 -1
- package/tag/index.js +2 -2
- package/tag-group/definition.js +1 -2
- package/text-area/definition.js +1 -2
- package/text-field/definition.js +1 -2
- package/toggletip/definition.js +1 -2
- package/tooltip/definition.js +1 -2
- package/tree-item/definition.js +1 -2
- package/tree-view/definition.js +1 -2
- package/unbundled/decorate.cjs +1 -1
- package/unbundled/decorate.js +1 -1
- package/unbundled/definition11.cjs +1 -1
- package/unbundled/definition11.js +1 -1
- package/unbundled/definition16.cjs +1 -1
- package/unbundled/definition16.js +1 -1
- package/unbundled/definition2.cjs +4 -4
- package/unbundled/definition2.js +4 -4
- package/unbundled/definition28.cjs +5 -1
- package/unbundled/definition28.js +5 -1
- package/unbundled/definition29.cjs +1 -1
- package/unbundled/definition29.js +1 -1
- package/unbundled/definition30.cjs +1 -1
- package/unbundled/definition30.js +1 -1
- package/unbundled/definition42.cjs +3 -2
- package/unbundled/definition42.js +3 -2
- package/unbundled/definition50.cjs +1 -1
- package/unbundled/definition50.js +1 -1
- package/unbundled/definition55.cjs +41 -8
- package/unbundled/definition55.js +41 -8
- package/unbundled/definition6.cjs +1 -1
- package/unbundled/definition6.js +1 -1
- package/unbundled/definition61.cjs +21 -2
- package/unbundled/definition61.js +21 -2
- package/unbundled/definition63.cjs +169 -42
- package/unbundled/definition63.js +164 -37
- package/unbundled/definition72.cjs +1 -0
- package/unbundled/definition72.js +1 -0
- package/unbundled/definition74.cjs +2 -1
- package/unbundled/definition74.js +2 -1
- package/unbundled/definition76.cjs +1 -1
- package/unbundled/definition76.js +1 -1
- package/unbundled/en-US.cjs +1 -1
- package/unbundled/en-US.js +1 -1
- package/unbundled/numberConverter.cjs +1 -1
- package/unbundled/numberConverter.js +1 -1
- package/unbundled/picker-field.template.cjs +6 -1
- package/unbundled/picker-field.template.js +6 -1
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.js +1 -2
- package/video-player/index.cjs +18 -18
- package/video-player/index.js +630 -1220
- package/visually-hidden/definition.js +1 -2
- 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
|
|
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$
|
|
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$
|
|
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
|
|
1671
|
-
|
|
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 =
|
|
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":
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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$
|
|
3675
|
-
require_definition$
|
|
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,
|