@vonage/vivid 5.29.0 → 5.31.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/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 +2 -5
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -5
- package/bundled/option.cjs +1 -1
- package/bundled/option.js +1 -5
- 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/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- 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 +42 -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 +2 -4
- 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 +4824 -4718
- 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/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/rich-text-editor/rte/feature.d.ts +0 -1
- package/lib/rich-text-editor/rte/features/base.d.ts +11 -1
- package/lib/rich-text-editor/rte/features/bold.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +7 -1
- package/lib/rich-text-editor/rte/features/hard-break.d.ts +4 -0
- package/lib/rich-text-editor/rte/features/inline-image.d.ts +5 -0
- package/lib/rich-text-editor/rte/features/italic.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/link.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/list.d.ts +6 -0
- package/lib/rich-text-editor/rte/features/monospace.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/strikethrough.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +7 -1
- package/lib/rich-text-editor/rte/features/underline.d.ts +5 -1
- package/lib/rich-text-editor/rte/public-interface.d.ts +1 -1
- 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/listbox/definition.js +1 -2
- package/listbox/index.cjs +1 -1
- package/listbox/index.js +3 -7
- package/locales/en-US.js +1 -2
- 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 +1 -1
- package/number-field/index.js +1 -1
- package/package.json +18 -18
- 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 +7 -7
- package/rich-text-editor/index.js +2123 -2047
- 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/foundation/vivid-element/vivid-element.browser-spec.d.ts +1 -0
- package/shared/foundation/vivid-element/vivid-element.d.ts +8 -8
- 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/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/definition2.cjs +4 -4
- package/unbundled/definition2.js +4 -4
- package/unbundled/definition55.cjs +1 -1
- package/unbundled/definition55.js +1 -1
- package/unbundled/definition61.cjs +21 -2
- package/unbundled/definition61.js +21 -2
- package/unbundled/definition63.cjs +191 -61
- package/unbundled/definition63.js +191 -61
- 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/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/vivid-element.cjs +54 -1
- package/unbundled/vivid-element.js +55 -2
- package/video-player/definition.js +1 -2
- package/video-player/index.cjs +18 -18
- package/video-player/index.js +629 -1219
- package/visually-hidden/definition.js +1 -2
- package/vivid.api.json +13 -13
|
@@ -464,6 +464,26 @@ var sanitizeLinkHref = (url) => {
|
|
|
464
464
|
...domPurifyConfig
|
|
465
465
|
}).querySelector("a").getAttribute("href") ?? "";
|
|
466
466
|
};
|
|
467
|
+
/** Whether a URL is safe to use as an anchor href. */
|
|
468
|
+
var isSafeLinkHref = (url) => sanitizeLinkHref(url) !== "";
|
|
469
|
+
var RELATIVE_HREF_REGEXP = /^(?:[/?#]|\.{1,2}\/)/;
|
|
470
|
+
/**
|
|
471
|
+
* Whether a URL is acceptable as a link href: safe, and either an absolute URL
|
|
472
|
+
* or relative to the current document. Relative hrefs are supported, so this is
|
|
473
|
+
* deliberately weaker than requiring a scheme, but a bare word like "invalid"
|
|
474
|
+
* is still rejected.
|
|
475
|
+
*/
|
|
476
|
+
var isValidLinkHref = (url) => {
|
|
477
|
+
const href = url.trim();
|
|
478
|
+
if (!href || !isSafeLinkHref(href)) return false;
|
|
479
|
+
if (RELATIVE_HREF_REGEXP.test(href)) return true;
|
|
480
|
+
try {
|
|
481
|
+
new URL(href);
|
|
482
|
+
return true;
|
|
483
|
+
} catch {
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
};
|
|
467
487
|
/**
|
|
468
488
|
* Sanitize potentially dangerous URLs, like "javascript:", in image src attributes.
|
|
469
489
|
* Returns empty string if the URL is unsafe.
|
|
@@ -912,6 +932,54 @@ var RteConfigImpl = class {
|
|
|
912
932
|
}
|
|
913
933
|
};
|
|
914
934
|
//#endregion
|
|
935
|
+
//#region src/lib/rich-text-editor/rte/utils/flatten-slice.ts
|
|
936
|
+
/**
|
|
937
|
+
* Splits a fragment into lines of inline content, collapsing all block structure.
|
|
938
|
+
* Each textblock becomes one line; container blocks (e.g. lists) are recursed into.
|
|
939
|
+
* Block nodes which are neither textblocks nor containers have no inline content
|
|
940
|
+
* to contribute and are dropped.
|
|
941
|
+
*/
|
|
942
|
+
var linesOfInlineContent = (fragment) => {
|
|
943
|
+
const lines = [];
|
|
944
|
+
let inlineRun;
|
|
945
|
+
fragment.forEach((node) => {
|
|
946
|
+
if (node.isInline) {
|
|
947
|
+
if (!inlineRun) {
|
|
948
|
+
inlineRun = [];
|
|
949
|
+
lines.push(inlineRun);
|
|
950
|
+
}
|
|
951
|
+
inlineRun.push(node);
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
inlineRun = void 0;
|
|
955
|
+
if (node.isTextblock) {
|
|
956
|
+
const inlineChildren = [];
|
|
957
|
+
node.content.forEach((child) => inlineChildren.push(child));
|
|
958
|
+
lines.push(inlineChildren);
|
|
959
|
+
} else lines.push(...linesOfInlineContent(node.content));
|
|
960
|
+
});
|
|
961
|
+
return lines;
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* Collapses a slice spanning multiple blocks into a single run of inline content,
|
|
965
|
+
* so that it can be inserted into a document which only permits one block.
|
|
966
|
+
*
|
|
967
|
+
* Lines are joined with a hardBreak where the schema has one, preserving the
|
|
968
|
+
* visual line structure. Without hardBreak the schema offers no way to mark a
|
|
969
|
+
* line boundary, so lines are concatenated directly.
|
|
970
|
+
*
|
|
971
|
+
* Slices that already hold a single line are returned unchanged, to keep the
|
|
972
|
+
* original open depths and let ProseMirror insert them as it normally would.
|
|
973
|
+
*/
|
|
974
|
+
var flattenSliceToInline = (slice, schema) => {
|
|
975
|
+
const lines = linesOfInlineContent(slice.content);
|
|
976
|
+
if (lines.length <= 1) return slice;
|
|
977
|
+
const hardBreak = schema.nodes.hardBreak;
|
|
978
|
+
const separator = hardBreak ? [hardBreak.create()] : [];
|
|
979
|
+
const inline = lines.flatMap((line, index) => index === 0 ? line : [...separator, ...line]);
|
|
980
|
+
return new Slice(Fragment.fromArray(inline), 0, 0);
|
|
981
|
+
};
|
|
982
|
+
//#endregion
|
|
915
983
|
//#region src/lib/rich-text-editor/rte/utils/ui.ts
|
|
916
984
|
var isPropBinding = (prop) => typeof prop === "function";
|
|
917
985
|
var on = (event, prop, handler) => [
|
|
@@ -1401,6 +1469,14 @@ var RteInputRulesFeatureImpl = class extends RteFeatureImpl {
|
|
|
1401
1469
|
};
|
|
1402
1470
|
//#endregion
|
|
1403
1471
|
//#region src/lib/rich-text-editor/rte/features/base.ts
|
|
1472
|
+
var nodeNames$3 = {
|
|
1473
|
+
doc: "doc",
|
|
1474
|
+
text: "text",
|
|
1475
|
+
paragraph: "paragraph",
|
|
1476
|
+
heading1: "heading1",
|
|
1477
|
+
heading2: "heading2",
|
|
1478
|
+
heading3: "heading3"
|
|
1479
|
+
};
|
|
1404
1480
|
var RteBaseImpl = class extends RteFeatureImpl {
|
|
1405
1481
|
constructor(config) {
|
|
1406
1482
|
super();
|
|
@@ -1409,10 +1485,14 @@ var RteBaseImpl = class extends RteFeatureImpl {
|
|
|
1409
1485
|
}
|
|
1410
1486
|
getSchema() {
|
|
1411
1487
|
return [this.contribution({ nodes: {
|
|
1412
|
-
doc: { content: this.config?.singleBlock ? "block" : "block+" },
|
|
1413
|
-
text: { group: "inline" }
|
|
1488
|
+
[nodeNames$3.doc]: { content: this.config?.singleBlock ? "block" : "block+" },
|
|
1489
|
+
[nodeNames$3.text]: { group: "inline" }
|
|
1414
1490
|
} })];
|
|
1415
1491
|
}
|
|
1492
|
+
getPlugins(_rte) {
|
|
1493
|
+
if (!this.config?.singleBlock) return [];
|
|
1494
|
+
return [this.contribution(new Plugin({ props: { transformPasted: (slice, view) => flattenSliceToInline(slice, view.state.schema) } }))];
|
|
1495
|
+
}
|
|
1416
1496
|
getFeatures() {
|
|
1417
1497
|
return [
|
|
1418
1498
|
this,
|
|
@@ -1453,7 +1533,7 @@ var RteBaseImpl = class extends RteFeatureImpl {
|
|
|
1453
1533
|
};
|
|
1454
1534
|
}
|
|
1455
1535
|
};
|
|
1456
|
-
var RteBase = featureFacade(RteBaseImpl);
|
|
1536
|
+
var RteBase = Object.assign(featureFacade(RteBaseImpl), { nodes: nodeNames$3 });
|
|
1457
1537
|
//#endregion
|
|
1458
1538
|
//#region src/lib/rich-text-editor/rte/features/text-block-picker.ts
|
|
1459
1539
|
var RteTextBlockPickerFeatureImpl = class extends RteFeatureImpl {
|
|
@@ -1610,13 +1690,14 @@ var RtePlaceholderFeatureImpl = class extends RteFeatureImpl {
|
|
|
1610
1690
|
var RtePlaceholderFeature = featureFacade(RtePlaceholderFeatureImpl);
|
|
1611
1691
|
//#endregion
|
|
1612
1692
|
//#region src/lib/rich-text-editor/rte/features/hard-break.ts
|
|
1693
|
+
var nodeNames$2 = { hardBreak: "hardBreak" };
|
|
1613
1694
|
var RteHardBreakFeatureImpl = class extends RteFeatureImpl {
|
|
1614
1695
|
constructor(..._args) {
|
|
1615
1696
|
super(..._args);
|
|
1616
1697
|
this.name = "RteHardBreakFeature";
|
|
1617
1698
|
}
|
|
1618
1699
|
getSchema() {
|
|
1619
|
-
return [this.contribution({ nodes: { hardBreak: {
|
|
1700
|
+
return [this.contribution({ nodes: { [nodeNames$2.hardBreak]: {
|
|
1620
1701
|
inline: true,
|
|
1621
1702
|
group: "inline",
|
|
1622
1703
|
selectable: false,
|
|
@@ -1638,10 +1719,11 @@ var RteHardBreakFeatureImpl = class extends RteFeatureImpl {
|
|
|
1638
1719
|
return [this.contribution(keymap(keyBindings), contributionPriority.high)];
|
|
1639
1720
|
}
|
|
1640
1721
|
};
|
|
1641
|
-
var RteHardBreakFeature = featureFacade(RteHardBreakFeatureImpl);
|
|
1722
|
+
var RteHardBreakFeature = Object.assign(featureFacade(RteHardBreakFeatureImpl), { nodes: nodeNames$2 });
|
|
1642
1723
|
//#endregion
|
|
1643
1724
|
//#region src/lib/rich-text-editor/rte/features/font-size-picker.ts
|
|
1644
1725
|
var mixedFontSize = Symbol("mixedFontSize");
|
|
1726
|
+
var markNames$7 = { fontSize: "fontSize" };
|
|
1645
1727
|
var RteFontSizePickerFeatureImpl = class extends RteFeatureImpl {
|
|
1646
1728
|
constructor(config) {
|
|
1647
1729
|
super();
|
|
@@ -1655,20 +1737,23 @@ var RteFontSizePickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
1655
1737
|
}
|
|
1656
1738
|
getTextblockMarks() {
|
|
1657
1739
|
if (this.config?.onBlocks) return this.config.onBlocks.map((block) => this.contribution({
|
|
1658
|
-
markName:
|
|
1740
|
+
markName: markNames$7.fontSize,
|
|
1659
1741
|
onNodeName: block.node
|
|
1660
1742
|
}));
|
|
1661
|
-
return [this.contribution({ markName:
|
|
1743
|
+
return [this.contribution({ markName: markNames$7.fontSize })];
|
|
1662
1744
|
}
|
|
1663
1745
|
getSchema() {
|
|
1664
|
-
|
|
1746
|
+
const markSpec = {
|
|
1665
1747
|
attrs: { size: { validate: "string" } },
|
|
1666
1748
|
parseDOM: [{
|
|
1667
1749
|
tag: "span[style*='font-size']",
|
|
1668
1750
|
getAttrs: (node) => {
|
|
1669
1751
|
const size = node.getAttribute("style").match(/font-size:\s*([^;]+)/)?.[1]?.trim();
|
|
1670
|
-
if (size) return
|
|
1671
|
-
|
|
1752
|
+
if (!size) return false;
|
|
1753
|
+
const parsedSize = this.config?.parseSizeFromHtml ? this.config.parseSizeFromHtml(size) : size;
|
|
1754
|
+
if (parsedSize === null) return false;
|
|
1755
|
+
if (this.config?.restrictToOptions && !this.fontSizes.some((fs) => fs.size === parsedSize)) return false;
|
|
1756
|
+
return { size: parsedSize };
|
|
1672
1757
|
}
|
|
1673
1758
|
}],
|
|
1674
1759
|
toDOM: (mark) => {
|
|
@@ -1689,7 +1774,8 @@ var RteFontSizePickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
1689
1774
|
}
|
|
1690
1775
|
return null;
|
|
1691
1776
|
}
|
|
1692
|
-
}
|
|
1777
|
+
};
|
|
1778
|
+
return [this.contribution({ marks: { [markNames$7.fontSize]: markSpec } })];
|
|
1693
1779
|
}
|
|
1694
1780
|
getPlugins() {
|
|
1695
1781
|
return [this.contribution(keymap({
|
|
@@ -1774,7 +1860,7 @@ var RteFontSizePickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
1774
1860
|
};
|
|
1775
1861
|
}
|
|
1776
1862
|
};
|
|
1777
|
-
var RteFontSizePickerFeature = featureFacade(RteFontSizePickerFeatureImpl);
|
|
1863
|
+
var RteFontSizePickerFeature = Object.assign(featureFacade(RteFontSizePickerFeatureImpl), { marks: markNames$7 });
|
|
1778
1864
|
//#endregion
|
|
1779
1865
|
//#region src/lib/rich-text-editor/rte/features/internal/text-style.ts
|
|
1780
1866
|
var RteTextStyleFeatureImpl = class extends RteFeatureImpl {
|
|
@@ -1792,14 +1878,15 @@ var RteTextStyleFeatureImpl = class extends RteFeatureImpl {
|
|
|
1792
1878
|
};
|
|
1793
1879
|
//#endregion
|
|
1794
1880
|
//#region src/lib/rich-text-editor/rte/features/bold.ts
|
|
1881
|
+
var markNames$6 = { bold: "bold" };
|
|
1795
1882
|
var RteBoldFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
1796
1883
|
constructor(..._args) {
|
|
1797
1884
|
super(..._args);
|
|
1798
1885
|
this.name = "RteBoldFeature";
|
|
1799
|
-
this.markName =
|
|
1886
|
+
this.markName = markNames$6.bold;
|
|
1800
1887
|
}
|
|
1801
1888
|
getSchema() {
|
|
1802
|
-
return [this.contribution({ marks: { bold: marks.strong } })];
|
|
1889
|
+
return [this.contribution({ marks: { [markNames$6.bold]: marks.strong } })];
|
|
1803
1890
|
}
|
|
1804
1891
|
getPlugins(rte) {
|
|
1805
1892
|
return [this.contribution(keymap({ "Mod-b": toggleMark(rte.schema.marks.bold) }))];
|
|
@@ -1815,17 +1902,18 @@ var RteBoldFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
|
1815
1902
|
}, 1)];
|
|
1816
1903
|
}
|
|
1817
1904
|
};
|
|
1818
|
-
var RteBoldFeature = featureFacade(RteBoldFeatureImpl);
|
|
1905
|
+
var RteBoldFeature = Object.assign(featureFacade(RteBoldFeatureImpl), { marks: markNames$6 });
|
|
1819
1906
|
//#endregion
|
|
1820
1907
|
//#region src/lib/rich-text-editor/rte/features/italic.ts
|
|
1908
|
+
var markNames$5 = { italic: "italic" };
|
|
1821
1909
|
var RteItalicFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
1822
1910
|
constructor(..._args) {
|
|
1823
1911
|
super(..._args);
|
|
1824
1912
|
this.name = "RteItalicFeature";
|
|
1825
|
-
this.markName =
|
|
1913
|
+
this.markName = markNames$5.italic;
|
|
1826
1914
|
}
|
|
1827
1915
|
getSchema() {
|
|
1828
|
-
return [this.contribution({ marks: { italic: marks.em } })];
|
|
1916
|
+
return [this.contribution({ marks: { [markNames$5.italic]: marks.em } })];
|
|
1829
1917
|
}
|
|
1830
1918
|
getPlugins(rte) {
|
|
1831
1919
|
return [this.contribution(keymap({ "Mod-i": toggleMark(rte.schema.marks.italic) }))];
|
|
@@ -1841,17 +1929,18 @@ var RteItalicFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
|
1841
1929
|
}, 2)];
|
|
1842
1930
|
}
|
|
1843
1931
|
};
|
|
1844
|
-
var RteItalicFeature = featureFacade(RteItalicFeatureImpl);
|
|
1932
|
+
var RteItalicFeature = Object.assign(featureFacade(RteItalicFeatureImpl), { marks: markNames$5 });
|
|
1845
1933
|
//#endregion
|
|
1846
1934
|
//#region src/lib/rich-text-editor/rte/features/underline.ts
|
|
1935
|
+
var markNames$4 = { underline: "underline" };
|
|
1847
1936
|
var RteUnderlineFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
1848
1937
|
constructor(..._args) {
|
|
1849
1938
|
super(..._args);
|
|
1850
1939
|
this.name = "RteUnderlineFeature";
|
|
1851
|
-
this.markName =
|
|
1940
|
+
this.markName = markNames$4.underline;
|
|
1852
1941
|
}
|
|
1853
1942
|
getSchema() {
|
|
1854
|
-
return [this.contribution({ marks: { underline: {
|
|
1943
|
+
return [this.contribution({ marks: { [markNames$4.underline]: {
|
|
1855
1944
|
parseDOM: [{ tag: "u" }],
|
|
1856
1945
|
toDOM() {
|
|
1857
1946
|
return ["u", 0];
|
|
@@ -1872,17 +1961,18 @@ var RteUnderlineFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
|
1872
1961
|
}, 3)];
|
|
1873
1962
|
}
|
|
1874
1963
|
};
|
|
1875
|
-
var RteUnderlineFeature = featureFacade(RteUnderlineFeatureImpl);
|
|
1964
|
+
var RteUnderlineFeature = Object.assign(featureFacade(RteUnderlineFeatureImpl), { marks: markNames$4 });
|
|
1876
1965
|
//#endregion
|
|
1877
1966
|
//#region src/lib/rich-text-editor/rte/features/strikethrough.ts
|
|
1967
|
+
var markNames$3 = { strikethrough: "strikethrough" };
|
|
1878
1968
|
var RteStrikethroughFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
1879
1969
|
constructor(..._args) {
|
|
1880
1970
|
super(..._args);
|
|
1881
1971
|
this.name = "RteStrikethroughFeature";
|
|
1882
|
-
this.markName =
|
|
1972
|
+
this.markName = markNames$3.strikethrough;
|
|
1883
1973
|
}
|
|
1884
1974
|
getSchema() {
|
|
1885
|
-
return [this.contribution({ marks: { strikethrough: {
|
|
1975
|
+
return [this.contribution({ marks: { [markNames$3.strikethrough]: {
|
|
1886
1976
|
parseDOM: [{ tag: "s" }, { tag: "del" }],
|
|
1887
1977
|
toDOM() {
|
|
1888
1978
|
return ["s", 0];
|
|
@@ -1906,23 +1996,24 @@ var RteStrikethroughFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
|
1906
1996
|
}, 4)];
|
|
1907
1997
|
}
|
|
1908
1998
|
};
|
|
1909
|
-
var RteStrikethroughFeature = featureFacade(RteStrikethroughFeatureImpl);
|
|
1999
|
+
var RteStrikethroughFeature = Object.assign(featureFacade(RteStrikethroughFeatureImpl), { marks: markNames$3 });
|
|
1910
2000
|
//#endregion
|
|
1911
2001
|
//#region src/lib/rich-text-editor/rte/features/monospace.style.scss?inline
|
|
1912
2002
|
var monospace_style_default = "tt{font:var(--vvd-typography-base-code);font-variant-ligatures:unset;font-feature-settings:unset;font-size:unset;font-weight:unset;line-height:unset}";
|
|
1913
2003
|
//#endregion
|
|
1914
2004
|
//#region src/lib/rich-text-editor/rte/features/monospace.ts
|
|
2005
|
+
var markNames$2 = { monospace: "monospace" };
|
|
1915
2006
|
var RteMonospaceFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
1916
2007
|
constructor(..._args) {
|
|
1917
2008
|
super(..._args);
|
|
1918
2009
|
this.name = "RteMonospaceFeature";
|
|
1919
|
-
this.markName =
|
|
2010
|
+
this.markName = markNames$2.monospace;
|
|
1920
2011
|
}
|
|
1921
2012
|
getStyles() {
|
|
1922
2013
|
return [this.contribution(monospace_style_default)];
|
|
1923
2014
|
}
|
|
1924
2015
|
getSchema() {
|
|
1925
|
-
return [this.contribution({ marks: { monospace: {
|
|
2016
|
+
return [this.contribution({ marks: { [markNames$2.monospace]: {
|
|
1926
2017
|
parseDOM: [{ tag: "tt" }, { tag: "code" }],
|
|
1927
2018
|
toDOM() {
|
|
1928
2019
|
return ["tt", 0];
|
|
@@ -1943,7 +2034,37 @@ var RteMonospaceFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
|
1943
2034
|
}, 5)];
|
|
1944
2035
|
}
|
|
1945
2036
|
};
|
|
1946
|
-
var RteMonospaceFeature = featureFacade(RteMonospaceFeatureImpl);
|
|
2037
|
+
var RteMonospaceFeature = Object.assign(featureFacade(RteMonospaceFeatureImpl), { marks: markNames$2 });
|
|
2038
|
+
//#endregion
|
|
2039
|
+
//#region src/lib/rich-text-editor/rte/utils/color.ts
|
|
2040
|
+
/**
|
|
2041
|
+
* Normalizes a CSS color into its canonical CSSOM serialization, so that colors
|
|
2042
|
+
* written in different notations can be compared:
|
|
2043
|
+
*
|
|
2044
|
+
* ```ts
|
|
2045
|
+
* normalizeCssColor('#000'); // -> 'rgb(0, 0, 0)'
|
|
2046
|
+
* normalizeCssColor('rgb(0 0 0 / 50%)'); // -> 'rgba(0, 0, 0, 0.5)'
|
|
2047
|
+
* normalizeCssColor('not-a-color'); // -> null
|
|
2048
|
+
* ```
|
|
2049
|
+
*
|
|
2050
|
+
* Only the notation is canonicalized – nothing is resolved against the document.
|
|
2051
|
+
* Values the CSSOM keeps as-is are returned as-is, which means equal colors do not
|
|
2052
|
+
* necessarily normalize to the same string:
|
|
2053
|
+
*
|
|
2054
|
+
* ```ts
|
|
2055
|
+
* normalizeCssColor('BLACK'); // -> 'black', not 'rgb(0, 0, 0)'
|
|
2056
|
+
* normalizeCssColor('var(--brand)'); // -> 'var(--brand)', never the resolved color
|
|
2057
|
+
* normalizeCssColor('color-mix(in srgb, red, blue)'); // -> 'color-mix(in srgb, red, blue)'
|
|
2058
|
+
* normalizeCssColor('inherit'); // -> 'inherit'
|
|
2059
|
+
* ```
|
|
2060
|
+
*
|
|
2061
|
+
* The exact behavior is browser dependent.
|
|
2062
|
+
*/
|
|
2063
|
+
var normalizeCssColor = (color) => {
|
|
2064
|
+
const probe = document.createElement("div");
|
|
2065
|
+
probe.style.color = color;
|
|
2066
|
+
return probe.style.color || null;
|
|
2067
|
+
};
|
|
1947
2068
|
//#endregion
|
|
1948
2069
|
//#region src/lib/rich-text-editor/rte/features/text-color-picker.ts
|
|
1949
2070
|
function markApplies(doc, ranges, type) {
|
|
@@ -1960,6 +2081,7 @@ function markApplies(doc, ranges, type) {
|
|
|
1960
2081
|
return false;
|
|
1961
2082
|
}
|
|
1962
2083
|
var mixedColor = Symbol("mixedColor");
|
|
2084
|
+
var markNames$1 = { textColor: "textColor" };
|
|
1963
2085
|
var RteTextColorPickerFeatureImpl = class extends RteFeatureImpl {
|
|
1964
2086
|
constructor(config) {
|
|
1965
2087
|
super();
|
|
@@ -1972,24 +2094,25 @@ var RteTextColorPickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
1972
2094
|
}
|
|
1973
2095
|
getTextblockMarks() {
|
|
1974
2096
|
if (this.config?.onBlocks) return this.config.onBlocks.map((block) => this.contribution({
|
|
1975
|
-
markName:
|
|
2097
|
+
markName: markNames$1.textColor,
|
|
1976
2098
|
onNodeName: block.node
|
|
1977
2099
|
}));
|
|
1978
|
-
return [this.contribution({ markName:
|
|
2100
|
+
return [this.contribution({ markName: markNames$1.textColor })];
|
|
1979
2101
|
}
|
|
1980
2102
|
getSchema() {
|
|
1981
|
-
|
|
2103
|
+
const parseColor = (color) => {
|
|
2104
|
+
const parsedColor = this.config?.parseColorFromHtml ? this.config.parseColorFromHtml(color) : color;
|
|
2105
|
+
if (parsedColor === null) return false;
|
|
2106
|
+
return { color: parsedColor };
|
|
2107
|
+
};
|
|
2108
|
+
return [this.contribution({ marks: { [markNames$1.textColor]: {
|
|
1982
2109
|
attrs: { color: { validate: "string" } },
|
|
1983
2110
|
parseDOM: [{
|
|
1984
2111
|
tag: "span[data-text-color]",
|
|
1985
|
-
getAttrs: (dom) =>
|
|
1986
|
-
return { color: dom.getAttribute("data-text-color") };
|
|
1987
|
-
}
|
|
2112
|
+
getAttrs: (dom) => parseColor(dom.getAttribute("data-text-color"))
|
|
1988
2113
|
}, {
|
|
1989
2114
|
style: "color",
|
|
1990
|
-
getAttrs: (value) =>
|
|
1991
|
-
return { color: value };
|
|
1992
|
-
}
|
|
2115
|
+
getAttrs: (value) => parseColor(value)
|
|
1993
2116
|
}],
|
|
1994
2117
|
toDOM(node) {
|
|
1995
2118
|
const { color } = node.attrs;
|
|
@@ -2078,7 +2201,16 @@ var RteTextColorPickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
2078
2201
|
};
|
|
2079
2202
|
}
|
|
2080
2203
|
};
|
|
2081
|
-
var RteTextColorPickerFeature = featureFacade(RteTextColorPickerFeatureImpl)
|
|
2204
|
+
var RteTextColorPickerFeature = Object.assign(featureFacade(RteTextColorPickerFeatureImpl), {
|
|
2205
|
+
marks: markNames$1,
|
|
2206
|
+
/**
|
|
2207
|
+
* Normalizes a CSS color into its canonical CSSOM serialization, so that
|
|
2208
|
+
* colors written in different notations can be compared. Nothing is resolved
|
|
2209
|
+
* against the document, so values such as `var(--brand)` or `inherit` are
|
|
2210
|
+
* returned unchanged. Returns `null` if the value is not a valid CSS color.
|
|
2211
|
+
*/
|
|
2212
|
+
normalizeCssColor
|
|
2213
|
+
});
|
|
2082
2214
|
//#endregion
|
|
2083
2215
|
//#region src/lib/rich-text-editor/rte/features/list.style.scss?inline
|
|
2084
2216
|
var list_style_default = ".rich-text ul,.rich-text ol{padding-inline-start:1.5em}.rich-text li{list-style-position:inside}";
|
|
@@ -2165,6 +2297,11 @@ var sinkLi = (listType, $li, tr) => {
|
|
|
2165
2297
|
var sinkNode = (rte, listType, $node, tr) => {
|
|
2166
2298
|
tr.step(new ReplaceAroundStep($node.before(), $node.after(), $node.start(), $node.end(), new Slice(Fragment.from(listType.create(null, [rte.schema.nodes.listItem.create(rte.textblockAttrs.extractFromNode($node.parent))])), 0, 0), 2));
|
|
2167
2299
|
};
|
|
2300
|
+
var nodeNames$1 = {
|
|
2301
|
+
listItem: "listItem",
|
|
2302
|
+
bulletList: "bulletList",
|
|
2303
|
+
numberedList: "numberedList"
|
|
2304
|
+
};
|
|
2168
2305
|
var RteListFeatureImpl = class extends RteFeatureImpl {
|
|
2169
2306
|
constructor(config) {
|
|
2170
2307
|
super();
|
|
@@ -2177,7 +2314,7 @@ var RteListFeatureImpl = class extends RteFeatureImpl {
|
|
|
2177
2314
|
}
|
|
2178
2315
|
getSchema(textblockAttrs) {
|
|
2179
2316
|
return [this.contribution({ nodes: {
|
|
2180
|
-
listItem: {
|
|
2317
|
+
[nodeNames$1.listItem]: {
|
|
2181
2318
|
content: "inline*",
|
|
2182
2319
|
attrs: textblockAttrs.attrs,
|
|
2183
2320
|
defining: true,
|
|
@@ -2193,7 +2330,7 @@ var RteListFeatureImpl = class extends RteFeatureImpl {
|
|
|
2193
2330
|
];
|
|
2194
2331
|
}
|
|
2195
2332
|
},
|
|
2196
|
-
...this.config.bulletList ? { bulletList: {
|
|
2333
|
+
...this.config.bulletList ? { [nodeNames$1.bulletList]: {
|
|
2197
2334
|
group: "block list",
|
|
2198
2335
|
content: "(listItem | list)+",
|
|
2199
2336
|
parseDOM: [{ tag: "ul" }],
|
|
@@ -2201,7 +2338,7 @@ var RteListFeatureImpl = class extends RteFeatureImpl {
|
|
|
2201
2338
|
return ["ul", 0];
|
|
2202
2339
|
}
|
|
2203
2340
|
} } : {},
|
|
2204
|
-
...this.config.numberedList ? { numberedList: {
|
|
2341
|
+
...this.config.numberedList ? { [nodeNames$1.numberedList]: {
|
|
2205
2342
|
group: "block list",
|
|
2206
2343
|
content: "(listItem | list)+",
|
|
2207
2344
|
parseDOM: [{ tag: "ol" }],
|
|
@@ -2331,7 +2468,7 @@ var RteListFeatureImpl = class extends RteFeatureImpl {
|
|
|
2331
2468
|
else return false;
|
|
2332
2469
|
}
|
|
2333
2470
|
};
|
|
2334
|
-
var RteListFeature = featureFacade(RteListFeatureImpl);
|
|
2471
|
+
var RteListFeature = Object.assign(featureFacade(RteListFeatureImpl), { nodes: nodeNames$1 });
|
|
2335
2472
|
//#endregion
|
|
2336
2473
|
//#region src/lib/rich-text-editor/rte/features/alignment.ts
|
|
2337
2474
|
var alignments = [
|
|
@@ -2458,6 +2595,7 @@ function convertToLink(state, matchedText, start, end) {
|
|
|
2458
2595
|
if (trailingChars) tr.replaceWith(linkEnd, end, state.schema.text(trailingChars));
|
|
2459
2596
|
return tr;
|
|
2460
2597
|
}
|
|
2598
|
+
var markNames = { link: "link" };
|
|
2461
2599
|
var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
2462
2600
|
constructor(..._args) {
|
|
2463
2601
|
super(..._args);
|
|
@@ -2474,7 +2612,7 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2474
2612
|
return [this.contribution(link_style_default)];
|
|
2475
2613
|
}
|
|
2476
2614
|
getSchema() {
|
|
2477
|
-
return [this.contribution({ marks: { link: {
|
|
2615
|
+
return [this.contribution({ marks: { [markNames.link]: {
|
|
2478
2616
|
attrs: { href: { validate: "string" } },
|
|
2479
2617
|
inclusive: false,
|
|
2480
2618
|
parseDOM: [{
|
|
@@ -2494,7 +2632,7 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2494
2632
|
} } }, contributionPriority.high)];
|
|
2495
2633
|
}
|
|
2496
2634
|
getTextblockMarks() {
|
|
2497
|
-
return [this.contribution({ markName:
|
|
2635
|
+
return [this.contribution({ markName: markNames.link })];
|
|
2498
2636
|
}
|
|
2499
2637
|
getInputRules() {
|
|
2500
2638
|
const linkRegex = new RegExp(`${linkPattern}$`);
|
|
@@ -2608,14 +2746,6 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2608
2746
|
if (from === to) return "";
|
|
2609
2747
|
return state.doc.textBetween(from, to, " ");
|
|
2610
2748
|
};
|
|
2611
|
-
const isValidUrl = (url) => {
|
|
2612
|
-
try {
|
|
2613
|
-
new URL(url);
|
|
2614
|
-
return true;
|
|
2615
|
-
} catch {
|
|
2616
|
-
return false;
|
|
2617
|
-
}
|
|
2618
|
-
};
|
|
2619
2749
|
return [this.contribution({
|
|
2620
2750
|
section: "insert",
|
|
2621
2751
|
render: (ctx) => {
|
|
@@ -2640,13 +2770,11 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2640
2770
|
updateValidation();
|
|
2641
2771
|
}
|
|
2642
2772
|
});
|
|
2773
|
+
const isApplyDisabled = () => !(textField.value.length && isValidLinkHref(urlField.value));
|
|
2643
2774
|
const applyButton = createButton(ctx, {
|
|
2644
2775
|
label: () => ctx.rte.getLocale().richTextEditor.apply,
|
|
2645
2776
|
variant: "popover-primary",
|
|
2646
|
-
disabled:
|
|
2647
|
-
const link = this.getCurrentLink(ctx.view.state);
|
|
2648
|
-
return !(link && link.text.length && isValidUrl(link.href));
|
|
2649
|
-
},
|
|
2777
|
+
disabled: isApplyDisabled,
|
|
2650
2778
|
onClick: () => {
|
|
2651
2779
|
const { state, dispatch } = ctx.view;
|
|
2652
2780
|
this.insertLink(rte, urlField.value, textField.value)(state, dispatch);
|
|
@@ -2654,7 +2782,7 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2654
2782
|
}
|
|
2655
2783
|
});
|
|
2656
2784
|
const updateValidation = () => {
|
|
2657
|
-
applyButton.querySelector("[data-vvd-component=\"button\"]").disabled =
|
|
2785
|
+
applyButton.querySelector("[data-vvd-component=\"button\"]").disabled = isApplyDisabled();
|
|
2658
2786
|
};
|
|
2659
2787
|
const menu = createMenu(ctx, {
|
|
2660
2788
|
label: () => ctx.rte.getLocale().richTextEditor.hyperlink,
|
|
@@ -2737,7 +2865,7 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2737
2865
|
};
|
|
2738
2866
|
}
|
|
2739
2867
|
};
|
|
2740
|
-
var RteLinkFeature = featureFacade(RteLinkFeatureImpl);
|
|
2868
|
+
var RteLinkFeature = Object.assign(featureFacade(RteLinkFeatureImpl), { marks: markNames });
|
|
2741
2869
|
//#endregion
|
|
2742
2870
|
//#region src/lib/rich-text-editor/rte/features/inline-image.style.scss?inline
|
|
2743
2871
|
var inline_image_style_default = ".inline-image-wrapper{vertical-align:text-bottom;display:inline-block}.inline-image{block-size:auto;display:block}.inline-image-popover{align-items:center;gap:4px;padding:8px;display:flex}.inline-image-placeholder{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);font-feature-settings:normal;font-variant-ligatures:normal;overflow-wrap:normal;pointer-events:none;white-space:normal}";
|
|
@@ -2828,6 +2956,7 @@ var InlineImageView = class {
|
|
|
2828
2956
|
this.setContent(null);
|
|
2829
2957
|
}
|
|
2830
2958
|
};
|
|
2959
|
+
var nodeNames = { inlineImage: "inlineImage" };
|
|
2831
2960
|
var RteInlineImageFeatureImpl = class extends RteFeatureImpl {
|
|
2832
2961
|
constructor(config = {}) {
|
|
2833
2962
|
super();
|
|
@@ -2838,7 +2967,7 @@ var RteInlineImageFeatureImpl = class extends RteFeatureImpl {
|
|
|
2838
2967
|
return [this.contribution(inline_image_style_default)];
|
|
2839
2968
|
}
|
|
2840
2969
|
getSchema() {
|
|
2841
|
-
|
|
2970
|
+
const inlineImage = {
|
|
2842
2971
|
inline: true,
|
|
2843
2972
|
group: "inline",
|
|
2844
2973
|
selectable: true,
|
|
@@ -2875,7 +3004,7 @@ var RteInlineImageFeatureImpl = class extends RteFeatureImpl {
|
|
|
2875
3004
|
return {
|
|
2876
3005
|
imageUrl,
|
|
2877
3006
|
alt: dom.getAttribute("alt") || "",
|
|
2878
|
-
size: dom.style.maxWidth || null,
|
|
3007
|
+
size: this.config.parseSizeFromHtml ? this.config.parseSizeFromHtml(dom) : dom.style.maxWidth || null,
|
|
2879
3008
|
naturalWidth: parseDimension(dom.getAttribute("width")),
|
|
2880
3009
|
naturalHeight: parseDimension(dom.getAttribute("height"))
|
|
2881
3010
|
};
|
|
@@ -2896,7 +3025,8 @@ var RteInlineImageFeatureImpl = class extends RteFeatureImpl {
|
|
|
2896
3025
|
if (naturalHeight) attrs.height = naturalHeight;
|
|
2897
3026
|
return ["img", attrs];
|
|
2898
3027
|
}
|
|
2899
|
-
}
|
|
3028
|
+
};
|
|
3029
|
+
return [this.contribution({ nodes: { [nodeNames.inlineImage]: inlineImage } })];
|
|
2900
3030
|
}
|
|
2901
3031
|
getPlugins(rte) {
|
|
2902
3032
|
let popover;
|
|
@@ -3001,7 +3131,7 @@ var RteInlineImageFeatureImpl = class extends RteFeatureImpl {
|
|
|
3001
3131
|
return null;
|
|
3002
3132
|
}
|
|
3003
3133
|
};
|
|
3004
|
-
var RteInlineImageFeature = featureFacade(RteInlineImageFeatureImpl);
|
|
3134
|
+
var RteInlineImageFeature = Object.assign(featureFacade(RteInlineImageFeatureImpl), { nodes: nodeNames });
|
|
3005
3135
|
//#endregion
|
|
3006
3136
|
//#region src/shared/utils/promise.ts
|
|
3007
3137
|
var resolvePromise = async (promise) => {
|
|
@@ -48,6 +48,7 @@ var Switch = class extends require_delegates_aria.DelegatesAria(require_form_ass
|
|
|
48
48
|
this.proxy = document.createElement("input");
|
|
49
49
|
this.initialValue = "on";
|
|
50
50
|
this.keypressHandler = (e) => {
|
|
51
|
+
if (this.readOnly || this.disabled) return;
|
|
51
52
|
if (e.key === _microsoft_fast_web_utilities.keySpace || e.key === _microsoft_fast_web_utilities.keyEnter) this.checked = !this.checked;
|
|
52
53
|
};
|
|
53
54
|
this.clickHandler = () => {
|
|
@@ -48,6 +48,7 @@ var Switch = class extends DelegatesAria(CheckableFormAssociated(VividElement))
|
|
|
48
48
|
this.proxy = document.createElement("input");
|
|
49
49
|
this.initialValue = "on";
|
|
50
50
|
this.keypressHandler = (e) => {
|
|
51
|
+
if (this.readOnly || this.disabled) return;
|
|
51
52
|
if (e.key === keySpace || e.key === keyEnter) this.checked = !this.checked;
|
|
52
53
|
};
|
|
53
54
|
this.clickHandler = () => {
|
|
@@ -79,7 +79,8 @@ var TabTemplate = (context) => {
|
|
|
79
79
|
<div
|
|
80
80
|
class="${(x) => (0, _microsoft_fast_web_utilities.classNames)("base", `connotation-${x.active ? tabConnotation.parse(x.connotation) : "accent"}`, "appearance-ghost", "with-idle", "with-hover", "with-active", "with-disabled", [`shape-${x.shape}`, Boolean(x.shape)], ["disabled", x.disabled], ["selected", x.active], ["icon-trailing", x.iconTrailing], ["removable", x.removable])}"
|
|
81
81
|
>
|
|
82
|
-
${(x) => affixIconTemplate(x.icon, require_affix.IconWrapper.Slot)}
|
|
82
|
+
${(x) => affixIconTemplate(x.icon, require_affix.IconWrapper.Slot)}
|
|
83
|
+
${(x) => x.label ? _microsoft_fast_element.html`<span>${x.label}</span>` : null}
|
|
83
84
|
${(x) => x.removable ? renderDismissButton(context) : null}
|
|
84
85
|
</div>
|
|
85
86
|
</template>
|
|
@@ -79,7 +79,8 @@ var TabTemplate = (context) => {
|
|
|
79
79
|
<div
|
|
80
80
|
class="${(x) => classNames("base", `connotation-${x.active ? tabConnotation.parse(x.connotation) : "accent"}`, "appearance-ghost", "with-idle", "with-hover", "with-active", "with-disabled", [`shape-${x.shape}`, Boolean(x.shape)], ["disabled", x.disabled], ["selected", x.active], ["icon-trailing", x.iconTrailing], ["removable", x.removable])}"
|
|
81
81
|
>
|
|
82
|
-
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
|
|
82
|
+
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
|
|
83
|
+
${(x) => x.label ? html`<span>${x.label}</span>` : null}
|
|
83
84
|
${(x) => x.removable ? renderDismissButton(context) : null}
|
|
84
85
|
</div>
|
|
85
86
|
</template>
|
package/unbundled/text-field.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/lib/text-field/text-field.scss?inline
|
|
2
|
-
var text_field_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}:host{display:inline-block}.base{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_text-field-border-radius:8px;--_text-field-pill-border-radius:24px;grid-template-columns:min-content 1fr max-content;align-items:center;gap:4px;width:100%;display:inline-grid}.base.size-condensed{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_text-field-border-radius:4px}.base{user-select:none}.base:not(.disabled){--_low-ink-color:var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color:var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){font:var(--vvd-typography-base);grid-area:1/1/auto/4;box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.label-wrapper{grid-area:1/1/auto/4}.char-count+.label-wrapper{grid-column:1/3}.fieldset{background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;align-items:center;padding-block:0;transition:color .2s,background-color .2s;display:flex;position:relative}.fieldset:after{border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";pointer-events:none;inline-size:100%;transition:box-shadow .2s;display:block;position:absolute}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){font:inherit;text-align:inherit;outline:#0000;box-sizing:border-box!important;border-radius:inherit!important;width:100%!important;margin:initial!important;appearance:none!important;block-size:100%!important;color:inherit!important;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;background-color:#0000!important;border:0!important}.control:not(slot,:focus),.control::slotted(input:not(:focus)){text-overflow:ellipsis!important}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control::slotted(input:autofill),.control:not(slot):autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);line-height:1;position:absolute;inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .wrapper:focus-within:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;z-index:1;border-radius:inherit;content:\"\";pointer-events:none;display:block;position:absolute;inset:0}}:host([internal-part]) .fieldset{font:var(--vvd-typography-heading-4);background-color:#0000;line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}";
|
|
2
|
+
var text_field_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}:host{display:inline-block}.base{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_text-field-border-radius:8px;--_text-field-pill-border-radius:24px;grid-template-columns:min-content 1fr max-content;align-items:center;gap:4px;width:100%;display:inline-grid}.base.size-condensed{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_text-field-border-radius:4px}.base{user-select:none}.base:not(.disabled){--_low-ink-color:var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color:var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){font:var(--vvd-typography-base);grid-area:1/1/auto/4;box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.label-wrapper{grid-area:1/1/auto/4}.char-count+.label-wrapper{grid-column:1/3}.fieldset{background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);max-inline-size:var(--text-field-input-inline-size,auto);grid-column:1/4;align-items:center;padding-block:0;transition:color .2s,background-color .2s;display:flex;position:relative}.fieldset:after{border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";pointer-events:none;inline-size:100%;transition:box-shadow .2s;display:block;position:absolute}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){font:inherit;text-align:inherit;outline:#0000;box-sizing:border-box!important;border-radius:inherit!important;width:100%!important;margin:initial!important;appearance:none!important;block-size:100%!important;color:inherit!important;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;background-color:#0000!important;border:0!important}.control:not(slot,:focus),.control::slotted(input:not(:focus)){text-overflow:ellipsis!important}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control::slotted(input:autofill),.control:not(slot):autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);line-height:1;position:absolute;inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .wrapper:focus-within:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;z-index:1;border-radius:inherit;content:\"\";pointer-events:none;display:block;position:absolute;inset:0}}:host([internal-part]) .fieldset{font:var(--vvd-typography-heading-4);background-color:#0000;line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}";
|
|
3
3
|
//#endregion
|
|
4
4
|
Object.defineProperty(exports, "text_field_default", {
|
|
5
5
|
enumerable: true,
|