@vonage/vivid 5.29.0 → 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/definition19.cjs +2 -2
- package/bundled/definition19.js +10 -25
- package/bundled/definition21.cjs +1 -1
- package/bundled/definition21.js +1 -1
- 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/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 +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 +869 -739
- 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/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/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/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/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 +7 -7
- package/rich-text-editor/index.js +2081 -2021
- 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/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/definition61.cjs +21 -2
- package/unbundled/definition61.js +21 -2
- package/unbundled/definition63.cjs +126 -23
- package/unbundled/definition63.js +126 -23
- 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/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 +629 -1219
- package/visually-hidden/definition.js +1 -2
- package/vivid.api.json +2 -2
package/unbundled/decorate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
2
2
|
function __decorate(decorators, target, key, desc) {
|
|
3
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -10,7 +10,7 @@ const require_host_semantics = require("./host-semantics.cjs");
|
|
|
10
10
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
11
11
|
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
12
12
|
//#region src/lib/menu-item/menu-item.scss?inline
|
|
13
|
-
var menu_item_default = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.base{--_menu-item-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);box-sizing:border-box;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);border-radius:8px;align-items:center;inline-size:100%;display:flex}.base:not(.two-lines){min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));padding-block:8px;padding-inline:var(--_menu-item-padding-inline);gap:12px}.base.two-lines{min-block-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)));padding-block:12px;padding-inline:var(--_menu-item-padding-inline);gap:16px}.base{user-select:none}.base:not(.disabled){cursor:pointer}:host(:not([role=presentation]):focus-visible) .base{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}.icon{font-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);flex-shrink:0;line-height:1}.action,.decorative{place-content:center;display:flex}.action{color:var(--_appearance-color-text)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[checked],[disabled])) .action{color:var(--vvd-color-neutral-500)}.base:not(.disabled) .decorative{color:var(--vvd-color-neutral-600)}.base.disabled .decorative{color:var(--vvd-color-neutral-200)}.base.has-meta .decorative{order:1}.chevron{order:3}.text{flex-direction:column;gap:4px;margin-inline-end:auto;display:flex;overflow:hidden}.text-primary,.text-secondary{font:var(--vvd-typography-base);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp,1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp,1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}:host([internal-part]) .text-primary{font:var(--_text-primary-custom-size,var--vvd-typography-base)}";
|
|
13
|
+
var menu_item_default = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.base{--_menu-item-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);box-sizing:border-box;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);border-radius:8px;align-items:center;inline-size:100%;display:flex}.base:not(.two-lines){min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));padding-block:8px;padding-inline:var(--_menu-item-padding-inline);gap:12px}.base.two-lines{min-block-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)));padding-block:12px;padding-inline:var(--_menu-item-padding-inline);gap:16px}.base{user-select:none}.base:not(.disabled){cursor:pointer}:host(:not([role=presentation]):focus-visible) .base{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}.icon{font-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);flex-shrink:0;line-height:1}.action,.decorative{place-content:center;display:flex}.action{color:var(--_appearance-color-text)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[checked],[disabled])) .action{color:var(--vvd-color-neutral-500)}.base:not(.disabled) .decorative{color:var(--vvd-color-neutral-600)}.base.disabled .decorative{color:var(--vvd-color-neutral-200)}.base.has-meta .decorative{order:1}.chevron{order:3}.text{flex-direction:column;gap:4px;margin-inline-end:auto;display:flex;overflow:hidden}.text-primary,.text-secondary{font:var(--vvd-typography-base);word-break:break-all;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp,1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp,1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}:host([internal-part]) .text-primary{font:var(--_text-primary-custom-size,var--vvd-typography-base)}";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/lib/menu-item/menu-item-role.ts
|
|
16
16
|
var MenuItemRole = {
|
|
@@ -10,7 +10,7 @@ import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js
|
|
|
10
10
|
import { DOM, Updates, attr, elements, html, observable, slotted, when } from "@microsoft/fast-element";
|
|
11
11
|
import { classNames, keyEnter, keySpace } from "@microsoft/fast-web-utilities";
|
|
12
12
|
//#region src/lib/menu-item/menu-item.scss?inline
|
|
13
|
-
var menu_item_default = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.base{--_menu-item-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);box-sizing:border-box;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);border-radius:8px;align-items:center;inline-size:100%;display:flex}.base:not(.two-lines){min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));padding-block:8px;padding-inline:var(--_menu-item-padding-inline);gap:12px}.base.two-lines{min-block-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)));padding-block:12px;padding-inline:var(--_menu-item-padding-inline);gap:16px}.base{user-select:none}.base:not(.disabled){cursor:pointer}:host(:not([role=presentation]):focus-visible) .base{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}.icon{font-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);flex-shrink:0;line-height:1}.action,.decorative{place-content:center;display:flex}.action{color:var(--_appearance-color-text)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[checked],[disabled])) .action{color:var(--vvd-color-neutral-500)}.base:not(.disabled) .decorative{color:var(--vvd-color-neutral-600)}.base.disabled .decorative{color:var(--vvd-color-neutral-200)}.base.has-meta .decorative{order:1}.chevron{order:3}.text{flex-direction:column;gap:4px;margin-inline-end:auto;display:flex;overflow:hidden}.text-primary,.text-secondary{font:var(--vvd-typography-base);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp,1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp,1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}:host([internal-part]) .text-primary{font:var(--_text-primary-custom-size,var--vvd-typography-base)}";
|
|
13
|
+
var menu_item_default = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.base{--_menu-item-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);box-sizing:border-box;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);border-radius:8px;align-items:center;inline-size:100%;display:flex}.base:not(.two-lines){min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));padding-block:8px;padding-inline:var(--_menu-item-padding-inline);gap:12px}.base.two-lines{min-block-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)));padding-block:12px;padding-inline:var(--_menu-item-padding-inline);gap:16px}.base{user-select:none}.base:not(.disabled){cursor:pointer}:host(:not([role=presentation]):focus-visible) .base{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}.icon{font-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);flex-shrink:0;line-height:1}.action,.decorative{place-content:center;display:flex}.action{color:var(--_appearance-color-text)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[checked],[disabled])) .action{color:var(--vvd-color-neutral-500)}.base:not(.disabled) .decorative{color:var(--vvd-color-neutral-600)}.base.disabled .decorative{color:var(--vvd-color-neutral-200)}.base.has-meta .decorative{order:1}.chevron{order:3}.text{flex-direction:column;gap:4px;margin-inline-end:auto;display:flex;overflow:hidden}.text-primary,.text-secondary{font:var(--vvd-typography-base);word-break:break-all;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp,1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp,1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}:host([internal-part]) .text-primary{font:var(--_text-primary-custom-size,var--vvd-typography-base)}";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/lib/menu-item/menu-item-role.ts
|
|
16
16
|
var MenuItemRole = {
|
|
@@ -8,7 +8,7 @@ const require_definition = require("./definition60.cjs");
|
|
|
8
8
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
9
9
|
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
10
10
|
//#region src/lib/radio-group/radio-group.scss?inline
|
|
11
|
-
var radio_group_default = ".base{--_low-ink-color:var(--vvd-color-neutral-600);flex-direction:column;gap:8px;display:flex}.positioning-region{flex-wrap:wrap;gap:8px;display:flex}.positioning-region.vertical{flex-direction:column}fieldset{border:none;margin:0;padding:0;display:block}legend{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);margin-block-end:8px;padding:0}";
|
|
11
|
+
var radio_group_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}.base{--_low-ink-color:var(--vvd-color-neutral-600);flex-direction:column;gap:8px;display:flex}.positioning-region{flex-wrap:wrap;gap:8px;display:flex}.positioning-region.vertical{flex-direction:column}fieldset{border:none;margin:0;padding:0;display:block}legend{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);margin-block-end:8px;padding:0}";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/lib/radio-group/radio-group.ts
|
|
14
14
|
/**
|
|
@@ -16,6 +16,7 @@ var radio_group_default = ".base{--_low-ink-color:var(--vvd-color-neutral-600);f
|
|
|
16
16
|
* @component radio-group
|
|
17
17
|
* @slot - Default slot.
|
|
18
18
|
* @slot helper-text - Describes how to use the Radio Group. Alternative to the `helper-text` attribute.
|
|
19
|
+
* @slot contextual-help - Slot for the contextual-help component, displayed next to the label.
|
|
19
20
|
* @event {CustomEvent<undefined>} change - Fires a custom 'change' event when the value changes
|
|
20
21
|
* @vueModel modelValue value change `event.currentTarget.value`
|
|
21
22
|
*/
|
|
@@ -76,6 +77,7 @@ var RadioGroup = class extends require_mixins.WithFeedback(require_vivid_element
|
|
|
76
77
|
this.moveToRadioByIndex(group, index);
|
|
77
78
|
};
|
|
78
79
|
this.keydownHandler = (e) => {
|
|
80
|
+
if (!this.slottedRadioButtons.includes(e.target)) return true;
|
|
79
81
|
switch (e.key) {
|
|
80
82
|
case _microsoft_fast_web_utilities.keyEnter:
|
|
81
83
|
this.checkFocusedRadio(e.target);
|
|
@@ -93,6 +95,10 @@ var RadioGroup = class extends require_mixins.WithFeedback(require_vivid_element
|
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
97
|
/** @internal */
|
|
98
|
+
get _hasContextualHelp() {
|
|
99
|
+
return (this._contextualHelpSlottedContent?.length ?? 0) > 0;
|
|
100
|
+
}
|
|
101
|
+
/** @internal */
|
|
96
102
|
requiredChanged() {
|
|
97
103
|
this.slottedRadioButtons.forEach((radio) => {
|
|
98
104
|
if (this.required) radio.required = true;
|
|
@@ -183,6 +189,7 @@ var RadioGroup = class extends require_mixins.WithFeedback(require_vivid_element
|
|
|
183
189
|
}
|
|
184
190
|
/** @internal */
|
|
185
191
|
focusInHandler(e) {
|
|
192
|
+
if (!this.slottedRadioButtons.includes(e.target)) return;
|
|
186
193
|
this.#setTabRovingTarget(e.target);
|
|
187
194
|
}
|
|
188
195
|
#setTabRovingTarget(radio) {
|
|
@@ -194,6 +201,7 @@ var RadioGroup = class extends require_mixins.WithFeedback(require_vivid_element
|
|
|
194
201
|
}
|
|
195
202
|
};
|
|
196
203
|
require_decorate.__decorate([_microsoft_fast_element.attr], RadioGroup.prototype, "label", void 0);
|
|
204
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], RadioGroup.prototype, "_contextualHelpSlottedContent", void 0);
|
|
197
205
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
198
206
|
attribute: "required",
|
|
199
207
|
mode: "boolean"
|
|
@@ -234,7 +242,18 @@ var RadioGroupTemplate = (context) => {
|
|
|
234
242
|
})}
|
|
235
243
|
class="control positioning-region ${(x) => x.orientation === _microsoft_fast_web_utilities.Orientation.horizontal ? "horizontal" : "vertical"}"
|
|
236
244
|
>
|
|
237
|
-
|
|
245
|
+
<legend
|
|
246
|
+
class="label-wrapper"
|
|
247
|
+
?hidden="${(x) => !x.label && !x._hasContextualHelp}"
|
|
248
|
+
>
|
|
249
|
+
${(0, _microsoft_fast_element.when)((x) => x.label, _microsoft_fast_element.html`<span id="label" class="label"
|
|
250
|
+
>${(x) => x.label}</span
|
|
251
|
+
>`)}
|
|
252
|
+
<slot
|
|
253
|
+
name="contextual-help"
|
|
254
|
+
${(0, _microsoft_fast_element.slotted)("_contextualHelpSlottedContent")}
|
|
255
|
+
></slot>
|
|
256
|
+
</legend>
|
|
238
257
|
<slot
|
|
239
258
|
${(0, _microsoft_fast_element.slotted)({
|
|
240
259
|
property: "slottedRadioButtons",
|
|
@@ -8,7 +8,7 @@ import { r as Radio, t as radioDefinition } from "./definition60.js";
|
|
|
8
8
|
import { attr, elements, html, observable, slotted, when } from "@microsoft/fast-element";
|
|
9
9
|
import { Orientation, keyArrowDown, keyArrowUp, keyEnter } from "@microsoft/fast-web-utilities";
|
|
10
10
|
//#region src/lib/radio-group/radio-group.scss?inline
|
|
11
|
-
var radio_group_default = ".base{--_low-ink-color:var(--vvd-color-neutral-600);flex-direction:column;gap:8px;display:flex}.positioning-region{flex-wrap:wrap;gap:8px;display:flex}.positioning-region.vertical{flex-direction:column}fieldset{border:none;margin:0;padding:0;display:block}legend{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);margin-block-end:8px;padding:0}";
|
|
11
|
+
var radio_group_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}.base{--_low-ink-color:var(--vvd-color-neutral-600);flex-direction:column;gap:8px;display:flex}.positioning-region{flex-wrap:wrap;gap:8px;display:flex}.positioning-region.vertical{flex-direction:column}fieldset{border:none;margin:0;padding:0;display:block}legend{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);margin-block-end:8px;padding:0}";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/lib/radio-group/radio-group.ts
|
|
14
14
|
/**
|
|
@@ -16,6 +16,7 @@ var radio_group_default = ".base{--_low-ink-color:var(--vvd-color-neutral-600);f
|
|
|
16
16
|
* @component radio-group
|
|
17
17
|
* @slot - Default slot.
|
|
18
18
|
* @slot helper-text - Describes how to use the Radio Group. Alternative to the `helper-text` attribute.
|
|
19
|
+
* @slot contextual-help - Slot for the contextual-help component, displayed next to the label.
|
|
19
20
|
* @event {CustomEvent<undefined>} change - Fires a custom 'change' event when the value changes
|
|
20
21
|
* @vueModel modelValue value change `event.currentTarget.value`
|
|
21
22
|
*/
|
|
@@ -76,6 +77,7 @@ var RadioGroup = class extends WithFeedback(VividElement) {
|
|
|
76
77
|
this.moveToRadioByIndex(group, index);
|
|
77
78
|
};
|
|
78
79
|
this.keydownHandler = (e) => {
|
|
80
|
+
if (!this.slottedRadioButtons.includes(e.target)) return true;
|
|
79
81
|
switch (e.key) {
|
|
80
82
|
case keyEnter:
|
|
81
83
|
this.checkFocusedRadio(e.target);
|
|
@@ -93,6 +95,10 @@ var RadioGroup = class extends WithFeedback(VividElement) {
|
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
97
|
/** @internal */
|
|
98
|
+
get _hasContextualHelp() {
|
|
99
|
+
return (this._contextualHelpSlottedContent?.length ?? 0) > 0;
|
|
100
|
+
}
|
|
101
|
+
/** @internal */
|
|
96
102
|
requiredChanged() {
|
|
97
103
|
this.slottedRadioButtons.forEach((radio) => {
|
|
98
104
|
if (this.required) radio.required = true;
|
|
@@ -183,6 +189,7 @@ var RadioGroup = class extends WithFeedback(VividElement) {
|
|
|
183
189
|
}
|
|
184
190
|
/** @internal */
|
|
185
191
|
focusInHandler(e) {
|
|
192
|
+
if (!this.slottedRadioButtons.includes(e.target)) return;
|
|
186
193
|
this.#setTabRovingTarget(e.target);
|
|
187
194
|
}
|
|
188
195
|
#setTabRovingTarget(radio) {
|
|
@@ -194,6 +201,7 @@ var RadioGroup = class extends WithFeedback(VividElement) {
|
|
|
194
201
|
}
|
|
195
202
|
};
|
|
196
203
|
__decorate([attr], RadioGroup.prototype, "label", void 0);
|
|
204
|
+
__decorate([observable], RadioGroup.prototype, "_contextualHelpSlottedContent", void 0);
|
|
197
205
|
__decorate([attr({
|
|
198
206
|
attribute: "required",
|
|
199
207
|
mode: "boolean"
|
|
@@ -234,7 +242,18 @@ var RadioGroupTemplate = (context) => {
|
|
|
234
242
|
})}
|
|
235
243
|
class="control positioning-region ${(x) => x.orientation === Orientation.horizontal ? "horizontal" : "vertical"}"
|
|
236
244
|
>
|
|
237
|
-
|
|
245
|
+
<legend
|
|
246
|
+
class="label-wrapper"
|
|
247
|
+
?hidden="${(x) => !x.label && !x._hasContextualHelp}"
|
|
248
|
+
>
|
|
249
|
+
${when((x) => x.label, html`<span id="label" class="label"
|
|
250
|
+
>${(x) => x.label}</span
|
|
251
|
+
>`)}
|
|
252
|
+
<slot
|
|
253
|
+
name="contextual-help"
|
|
254
|
+
${slotted("_contextualHelpSlottedContent")}
|
|
255
|
+
></slot>
|
|
256
|
+
</legend>
|
|
238
257
|
<slot
|
|
239
258
|
${slotted({
|
|
240
259
|
property: "slottedRadioButtons",
|
|
@@ -466,6 +466,26 @@ var sanitizeLinkHref = (url) => {
|
|
|
466
466
|
...domPurifyConfig
|
|
467
467
|
}).querySelector("a").getAttribute("href") ?? "";
|
|
468
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
|
+
};
|
|
469
489
|
/**
|
|
470
490
|
* Sanitize potentially dangerous URLs, like "javascript:", in image src attributes.
|
|
471
491
|
* Returns empty string if the URL is unsafe.
|
|
@@ -914,6 +934,54 @@ var RteConfigImpl = class {
|
|
|
914
934
|
}
|
|
915
935
|
};
|
|
916
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
|
|
917
985
|
//#region src/lib/rich-text-editor/rte/utils/ui.ts
|
|
918
986
|
var isPropBinding = (prop) => typeof prop === "function";
|
|
919
987
|
var on = (event, prop, handler) => [
|
|
@@ -1415,6 +1483,10 @@ var RteBaseImpl = class extends require_slottable_request.RteFeatureImpl {
|
|
|
1415
1483
|
text: { group: "inline" }
|
|
1416
1484
|
} })];
|
|
1417
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
|
+
}
|
|
1418
1490
|
getFeatures() {
|
|
1419
1491
|
return [
|
|
1420
1492
|
this,
|
|
@@ -1669,8 +1741,11 @@ var RteFontSizePickerFeatureImpl = class extends require_slottable_request.RteFe
|
|
|
1669
1741
|
tag: "span[style*='font-size']",
|
|
1670
1742
|
getAttrs: (node) => {
|
|
1671
1743
|
const size = node.getAttribute("style").match(/font-size:\s*([^;]+)/)?.[1]?.trim();
|
|
1672
|
-
if (size) return
|
|
1673
|
-
|
|
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 };
|
|
1674
1749
|
}
|
|
1675
1750
|
}],
|
|
1676
1751
|
toDOM: (mark) => {
|
|
@@ -1947,6 +2022,36 @@ var RteMonospaceFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
|
1947
2022
|
};
|
|
1948
2023
|
var RteMonospaceFeature = require_slottable_request.featureFacade(RteMonospaceFeatureImpl);
|
|
1949
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
|
|
1950
2055
|
//#region src/lib/rich-text-editor/rte/features/text-color-picker.ts
|
|
1951
2056
|
function markApplies(doc, ranges, type) {
|
|
1952
2057
|
for (let i = 0; i < ranges.length; i++) {
|
|
@@ -1980,18 +2085,19 @@ var RteTextColorPickerFeatureImpl = class extends require_slottable_request.RteF
|
|
|
1980
2085
|
return [this.contribution({ markName: "textColor" })];
|
|
1981
2086
|
}
|
|
1982
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
|
+
};
|
|
1983
2093
|
return [this.contribution({ marks: { textColor: {
|
|
1984
2094
|
attrs: { color: { validate: "string" } },
|
|
1985
2095
|
parseDOM: [{
|
|
1986
2096
|
tag: "span[data-text-color]",
|
|
1987
|
-
getAttrs: (dom) =>
|
|
1988
|
-
return { color: dom.getAttribute("data-text-color") };
|
|
1989
|
-
}
|
|
2097
|
+
getAttrs: (dom) => parseColor(dom.getAttribute("data-text-color"))
|
|
1990
2098
|
}, {
|
|
1991
2099
|
style: "color",
|
|
1992
|
-
getAttrs: (value) =>
|
|
1993
|
-
return { color: value };
|
|
1994
|
-
}
|
|
2100
|
+
getAttrs: (value) => parseColor(value)
|
|
1995
2101
|
}],
|
|
1996
2102
|
toDOM(node) {
|
|
1997
2103
|
const { color } = node.attrs;
|
|
@@ -2080,7 +2186,14 @@ var RteTextColorPickerFeatureImpl = class extends require_slottable_request.RteF
|
|
|
2080
2186
|
};
|
|
2081
2187
|
}
|
|
2082
2188
|
};
|
|
2083
|
-
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 });
|
|
2084
2197
|
//#endregion
|
|
2085
2198
|
//#region src/lib/rich-text-editor/rte/features/list.style.scss?inline
|
|
2086
2199
|
var list_style_default = ".rich-text ul,.rich-text ol{padding-inline-start:1.5em}.rich-text li{list-style-position:inside}";
|
|
@@ -2610,14 +2723,6 @@ var RteLinkFeatureImpl = class extends require_slottable_request.RteFeatureImpl
|
|
|
2610
2723
|
if (from === to) return "";
|
|
2611
2724
|
return state.doc.textBetween(from, to, " ");
|
|
2612
2725
|
};
|
|
2613
|
-
const isValidUrl = (url) => {
|
|
2614
|
-
try {
|
|
2615
|
-
new URL(url);
|
|
2616
|
-
return true;
|
|
2617
|
-
} catch {
|
|
2618
|
-
return false;
|
|
2619
|
-
}
|
|
2620
|
-
};
|
|
2621
2726
|
return [this.contribution({
|
|
2622
2727
|
section: "insert",
|
|
2623
2728
|
render: (ctx) => {
|
|
@@ -2642,13 +2747,11 @@ var RteLinkFeatureImpl = class extends require_slottable_request.RteFeatureImpl
|
|
|
2642
2747
|
updateValidation();
|
|
2643
2748
|
}
|
|
2644
2749
|
});
|
|
2750
|
+
const isApplyDisabled = () => !(textField.value.length && isValidLinkHref(urlField.value));
|
|
2645
2751
|
const applyButton = createButton(ctx, {
|
|
2646
2752
|
label: () => ctx.rte.getLocale().richTextEditor.apply,
|
|
2647
2753
|
variant: "popover-primary",
|
|
2648
|
-
disabled:
|
|
2649
|
-
const link = this.getCurrentLink(ctx.view.state);
|
|
2650
|
-
return !(link && link.text.length && isValidUrl(link.href));
|
|
2651
|
-
},
|
|
2754
|
+
disabled: isApplyDisabled,
|
|
2652
2755
|
onClick: () => {
|
|
2653
2756
|
const { state, dispatch } = ctx.view;
|
|
2654
2757
|
this.insertLink(rte, urlField.value, textField.value)(state, dispatch);
|
|
@@ -2656,7 +2759,7 @@ var RteLinkFeatureImpl = class extends require_slottable_request.RteFeatureImpl
|
|
|
2656
2759
|
}
|
|
2657
2760
|
});
|
|
2658
2761
|
const updateValidation = () => {
|
|
2659
|
-
applyButton.querySelector("[data-vvd-component=\"button\"]").disabled =
|
|
2762
|
+
applyButton.querySelector("[data-vvd-component=\"button\"]").disabled = isApplyDisabled();
|
|
2660
2763
|
};
|
|
2661
2764
|
const menu = createMenu(ctx, {
|
|
2662
2765
|
label: () => ctx.rte.getLocale().richTextEditor.hyperlink,
|
|
@@ -2877,7 +2980,7 @@ var RteInlineImageFeatureImpl = class extends require_slottable_request.RteFeatu
|
|
|
2877
2980
|
return {
|
|
2878
2981
|
imageUrl,
|
|
2879
2982
|
alt: dom.getAttribute("alt") || "",
|
|
2880
|
-
size: dom.style.maxWidth || null,
|
|
2983
|
+
size: this.config.parseSizeFromHtml ? this.config.parseSizeFromHtml(dom) : dom.style.maxWidth || null,
|
|
2881
2984
|
naturalWidth: parseDimension(dom.getAttribute("width")),
|
|
2882
2985
|
naturalHeight: parseDimension(dom.getAttribute("height"))
|
|
2883
2986
|
};
|
|
@@ -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) => [
|
|
@@ -1413,6 +1481,10 @@ var RteBaseImpl = class extends RteFeatureImpl {
|
|
|
1413
1481
|
text: { group: "inline" }
|
|
1414
1482
|
} })];
|
|
1415
1483
|
}
|
|
1484
|
+
getPlugins(_rte) {
|
|
1485
|
+
if (!this.config?.singleBlock) return [];
|
|
1486
|
+
return [this.contribution(new Plugin({ props: { transformPasted: (slice, view) => flattenSliceToInline(slice, view.state.schema) } }))];
|
|
1487
|
+
}
|
|
1416
1488
|
getFeatures() {
|
|
1417
1489
|
return [
|
|
1418
1490
|
this,
|
|
@@ -1667,8 +1739,11 @@ var RteFontSizePickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
1667
1739
|
tag: "span[style*='font-size']",
|
|
1668
1740
|
getAttrs: (node) => {
|
|
1669
1741
|
const size = node.getAttribute("style").match(/font-size:\s*([^;]+)/)?.[1]?.trim();
|
|
1670
|
-
if (size) return
|
|
1671
|
-
|
|
1742
|
+
if (!size) return false;
|
|
1743
|
+
const parsedSize = this.config?.parseSizeFromHtml ? this.config.parseSizeFromHtml(size) : size;
|
|
1744
|
+
if (parsedSize === null) return false;
|
|
1745
|
+
if (this.config?.restrictToOptions && !this.fontSizes.some((fs) => fs.size === parsedSize)) return false;
|
|
1746
|
+
return { size: parsedSize };
|
|
1672
1747
|
}
|
|
1673
1748
|
}],
|
|
1674
1749
|
toDOM: (mark) => {
|
|
@@ -1945,6 +2020,36 @@ var RteMonospaceFeatureImpl = class extends RteTextStyleFeatureImpl {
|
|
|
1945
2020
|
};
|
|
1946
2021
|
var RteMonospaceFeature = featureFacade(RteMonospaceFeatureImpl);
|
|
1947
2022
|
//#endregion
|
|
2023
|
+
//#region src/lib/rich-text-editor/rte/utils/color.ts
|
|
2024
|
+
/**
|
|
2025
|
+
* Normalizes a CSS color into its canonical CSSOM serialization, so that colors
|
|
2026
|
+
* written in different notations can be compared:
|
|
2027
|
+
*
|
|
2028
|
+
* ```ts
|
|
2029
|
+
* normalizeCssColor('#000'); // -> 'rgb(0, 0, 0)'
|
|
2030
|
+
* normalizeCssColor('rgb(0 0 0 / 50%)'); // -> 'rgba(0, 0, 0, 0.5)'
|
|
2031
|
+
* normalizeCssColor('not-a-color'); // -> null
|
|
2032
|
+
* ```
|
|
2033
|
+
*
|
|
2034
|
+
* Only the notation is canonicalized – nothing is resolved against the document.
|
|
2035
|
+
* Values the CSSOM keeps as-is are returned as-is, which means equal colors do not
|
|
2036
|
+
* necessarily normalize to the same string:
|
|
2037
|
+
*
|
|
2038
|
+
* ```ts
|
|
2039
|
+
* normalizeCssColor('BLACK'); // -> 'black', not 'rgb(0, 0, 0)'
|
|
2040
|
+
* normalizeCssColor('var(--brand)'); // -> 'var(--brand)', never the resolved color
|
|
2041
|
+
* normalizeCssColor('color-mix(in srgb, red, blue)'); // -> 'color-mix(in srgb, red, blue)'
|
|
2042
|
+
* normalizeCssColor('inherit'); // -> 'inherit'
|
|
2043
|
+
* ```
|
|
2044
|
+
*
|
|
2045
|
+
* The exact behavior is browser dependent.
|
|
2046
|
+
*/
|
|
2047
|
+
var normalizeCssColor = (color) => {
|
|
2048
|
+
const probe = document.createElement("div");
|
|
2049
|
+
probe.style.color = color;
|
|
2050
|
+
return probe.style.color || null;
|
|
2051
|
+
};
|
|
2052
|
+
//#endregion
|
|
1948
2053
|
//#region src/lib/rich-text-editor/rte/features/text-color-picker.ts
|
|
1949
2054
|
function markApplies(doc, ranges, type) {
|
|
1950
2055
|
for (let i = 0; i < ranges.length; i++) {
|
|
@@ -1978,18 +2083,19 @@ var RteTextColorPickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
1978
2083
|
return [this.contribution({ markName: "textColor" })];
|
|
1979
2084
|
}
|
|
1980
2085
|
getSchema() {
|
|
2086
|
+
const parseColor = (color) => {
|
|
2087
|
+
const parsedColor = this.config?.parseColorFromHtml ? this.config.parseColorFromHtml(color) : color;
|
|
2088
|
+
if (parsedColor === null) return false;
|
|
2089
|
+
return { color: parsedColor };
|
|
2090
|
+
};
|
|
1981
2091
|
return [this.contribution({ marks: { textColor: {
|
|
1982
2092
|
attrs: { color: { validate: "string" } },
|
|
1983
2093
|
parseDOM: [{
|
|
1984
2094
|
tag: "span[data-text-color]",
|
|
1985
|
-
getAttrs: (dom) =>
|
|
1986
|
-
return { color: dom.getAttribute("data-text-color") };
|
|
1987
|
-
}
|
|
2095
|
+
getAttrs: (dom) => parseColor(dom.getAttribute("data-text-color"))
|
|
1988
2096
|
}, {
|
|
1989
2097
|
style: "color",
|
|
1990
|
-
getAttrs: (value) =>
|
|
1991
|
-
return { color: value };
|
|
1992
|
-
}
|
|
2098
|
+
getAttrs: (value) => parseColor(value)
|
|
1993
2099
|
}],
|
|
1994
2100
|
toDOM(node) {
|
|
1995
2101
|
const { color } = node.attrs;
|
|
@@ -2078,7 +2184,14 @@ var RteTextColorPickerFeatureImpl = class extends RteFeatureImpl {
|
|
|
2078
2184
|
};
|
|
2079
2185
|
}
|
|
2080
2186
|
};
|
|
2081
|
-
var RteTextColorPickerFeature = featureFacade(RteTextColorPickerFeatureImpl)
|
|
2187
|
+
var RteTextColorPickerFeature = Object.assign(featureFacade(RteTextColorPickerFeatureImpl), {
|
|
2188
|
+
/**
|
|
2189
|
+
* Normalizes a CSS color into its canonical CSSOM serialization, so that
|
|
2190
|
+
* colors written in different notations can be compared. Nothing is resolved
|
|
2191
|
+
* against the document, so values such as `var(--brand)` or `inherit` are
|
|
2192
|
+
* returned unchanged. Returns `null` if the value is not a valid CSS color.
|
|
2193
|
+
*/
|
|
2194
|
+
normalizeCssColor });
|
|
2082
2195
|
//#endregion
|
|
2083
2196
|
//#region src/lib/rich-text-editor/rte/features/list.style.scss?inline
|
|
2084
2197
|
var list_style_default = ".rich-text ul,.rich-text ol{padding-inline-start:1.5em}.rich-text li{list-style-position:inside}";
|
|
@@ -2608,14 +2721,6 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2608
2721
|
if (from === to) return "";
|
|
2609
2722
|
return state.doc.textBetween(from, to, " ");
|
|
2610
2723
|
};
|
|
2611
|
-
const isValidUrl = (url) => {
|
|
2612
|
-
try {
|
|
2613
|
-
new URL(url);
|
|
2614
|
-
return true;
|
|
2615
|
-
} catch {
|
|
2616
|
-
return false;
|
|
2617
|
-
}
|
|
2618
|
-
};
|
|
2619
2724
|
return [this.contribution({
|
|
2620
2725
|
section: "insert",
|
|
2621
2726
|
render: (ctx) => {
|
|
@@ -2640,13 +2745,11 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2640
2745
|
updateValidation();
|
|
2641
2746
|
}
|
|
2642
2747
|
});
|
|
2748
|
+
const isApplyDisabled = () => !(textField.value.length && isValidLinkHref(urlField.value));
|
|
2643
2749
|
const applyButton = createButton(ctx, {
|
|
2644
2750
|
label: () => ctx.rte.getLocale().richTextEditor.apply,
|
|
2645
2751
|
variant: "popover-primary",
|
|
2646
|
-
disabled:
|
|
2647
|
-
const link = this.getCurrentLink(ctx.view.state);
|
|
2648
|
-
return !(link && link.text.length && isValidUrl(link.href));
|
|
2649
|
-
},
|
|
2752
|
+
disabled: isApplyDisabled,
|
|
2650
2753
|
onClick: () => {
|
|
2651
2754
|
const { state, dispatch } = ctx.view;
|
|
2652
2755
|
this.insertLink(rte, urlField.value, textField.value)(state, dispatch);
|
|
@@ -2654,7 +2757,7 @@ var RteLinkFeatureImpl = class extends RteFeatureImpl {
|
|
|
2654
2757
|
}
|
|
2655
2758
|
});
|
|
2656
2759
|
const updateValidation = () => {
|
|
2657
|
-
applyButton.querySelector("[data-vvd-component=\"button\"]").disabled =
|
|
2760
|
+
applyButton.querySelector("[data-vvd-component=\"button\"]").disabled = isApplyDisabled();
|
|
2658
2761
|
};
|
|
2659
2762
|
const menu = createMenu(ctx, {
|
|
2660
2763
|
label: () => ctx.rte.getLocale().richTextEditor.hyperlink,
|
|
@@ -2875,7 +2978,7 @@ var RteInlineImageFeatureImpl = class extends RteFeatureImpl {
|
|
|
2875
2978
|
return {
|
|
2876
2979
|
imageUrl,
|
|
2877
2980
|
alt: dom.getAttribute("alt") || "",
|
|
2878
|
-
size: dom.style.maxWidth || null,
|
|
2981
|
+
size: this.config.parseSizeFromHtml ? this.config.parseSizeFromHtml(dom) : dom.style.maxWidth || null,
|
|
2879
2982
|
naturalWidth: parseDimension(dom.getAttribute("width")),
|
|
2880
2983
|
naturalHeight: parseDimension(dom.getAttribute("height"))
|
|
2881
2984
|
};
|
|
@@ -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 = () => {
|