@vonage/vivid 5.4.0 → 5.6.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/LICENSE.md +201 -0
- package/accordion/definition.cjs +5 -0
- package/accordion/definition.js +5 -0
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +14 -3
- package/alert/definition.cjs +4 -12
- package/alert/definition.js +5 -13
- package/alert/index.cjs +11 -11
- package/alert/index.js +33 -37
- package/audio-player/definition.cjs +4 -0
- package/audio-player/definition.js +4 -0
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +8 -2
- package/banner/definition.cjs +2 -4
- package/banner/definition.js +2 -4
- package/banner/index.cjs +2 -2
- package/banner/index.js +1 -1
- package/breadcrumb/definition.cjs +1 -0
- package/breadcrumb/definition.js +1 -0
- package/breadcrumb/index.cjs +1 -1
- package/breadcrumb/index.js +1 -0
- package/bundled/affix.js +1 -1
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/attribute-binding-behaviour.cjs +1 -1
- package/bundled/attribute-binding-behaviour.js +3 -1
- package/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +107 -84
- package/bundled/base-progress.cjs +1 -1
- package/bundled/base-progress.js +3 -0
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +14 -10
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +4 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +7 -7
- package/bundled/definition10.js +29 -19
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +73 -204
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +218 -36
- package/bundled/definition13.cjs +10 -1
- package/bundled/definition13.js +38 -14
- package/bundled/definition14.cjs +1 -5
- package/bundled/definition14.js +15 -24
- package/bundled/definition15.cjs +5 -30
- package/bundled/definition15.js +22 -73
- package/bundled/definition16.cjs +30 -19
- package/bundled/definition16.js +74 -97
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +86 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +125 -71
- package/bundled/definition19.cjs +16 -16
- package/bundled/definition19.js +132 -94
- package/bundled/definition2.cjs +8 -9
- package/bundled/definition2.js +89 -142
- package/bundled/definition22.cjs +1 -1
- package/bundled/definition22.js +1 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +2 -1
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +9 -3
- package/bundled/definition6.cjs +1 -1
- package/bundled/definition6.js +1 -0
- package/bundled/definition7.cjs +1 -1
- package/bundled/definition7.js +7 -4
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +1 -0
- package/bundled/definition9.cjs +6 -6
- package/bundled/definition9.js +545 -488
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +3 -1
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +11 -3
- package/bundled/host-semantics.js +4 -4
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +22 -4
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +149 -66
- package/bundled/mixins.cjs +4 -4
- package/bundled/mixins.js +11 -8
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +36 -56
- package/bundled/scrollIntoView.cjs +1 -1
- package/bundled/scrollIntoView.js +4 -1
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +16 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +4 -4
- package/bundled/vivid-element.js +529 -492
- package/calendar/definition.cjs +2 -0
- package/calendar/definition.js +2 -0
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +174 -144
- package/checkbox/definition.cjs +1 -0
- package/checkbox/definition.js +1 -0
- package/color-picker/definition.cjs +213 -112
- package/color-picker/definition.js +213 -112
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +417 -326
- package/combobox/definition.cjs +17 -6
- package/combobox/definition.js +17 -6
- package/combobox/index.cjs +14 -9
- package/combobox/index.js +54 -42
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +6976 -484
- package/data-grid/definition.cjs +105 -7
- package/data-grid/definition.js +105 -7
- package/data-grid/index.cjs +52 -38
- package/data-grid/index.js +313 -242
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +2 -0
- package/date-range-picker/definition.js +2 -0
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +7 -3
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +148 -0
- package/dial-pad/definition.js +148 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +202 -101
- package/dialog/definition.cjs +1 -0
- package/dialog/definition.js +1 -0
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -0
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/fab/definition.cjs +1 -0
- package/fab/definition.js +1 -0
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -0
- package/file-picker/definition.cjs +7 -2
- package/file-picker/definition.js +7 -2
- package/file-picker/index.cjs +6 -6
- package/file-picker/index.js +82 -73
- package/icon/definition.cjs +66 -41
- package/icon/definition.js +67 -42
- package/index.cjs +21 -0
- package/index.js +1 -1
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/data-grid/locale.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +38 -38
- package/lib/date-range-picker/date-range-picker.d.ts +20 -20
- package/lib/date-time-picker/date-time-picker.d.ts +40 -40
- package/lib/dial-pad/dial-pad.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -1
- package/lib/menu/menu.d.ts +4 -4
- package/lib/rich-text-editor/definition.d.ts +3 -2
- package/lib/rich-text-editor/locale.d.ts +29 -3
- package/lib/rich-text-editor/popover.d.ts +19 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +16 -45
- package/lib/rich-text-editor/rich-text-editor.template.d.ts +2 -2
- package/lib/rich-text-editor/rte/config.d.ts +18 -0
- package/lib/rich-text-editor/rte/document.d.ts +28 -0
- package/lib/rich-text-editor/rte/exports.d.ts +23 -0
- package/lib/rich-text-editor/rte/feature.d.ts +46 -0
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +33 -0
- package/lib/rich-text-editor/rte/features/internal/foreign-html.d.ts +11 -0
- package/lib/rich-text-editor/rte/features/internal/history.d.ts +10 -0
- package/lib/rich-text-editor/rte/features/internal/text-style.d.ts +18 -0
- package/lib/rich-text-editor/rte/html-parser.d.ts +24 -0
- package/lib/rich-text-editor/rte/html-serializer.d.ts +30 -0
- package/lib/rich-text-editor/rte/instance.d.ts +57 -0
- package/lib/rich-text-editor/rte/utils/default-textblock.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/impl.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/textblock-attrs.d.ts +29 -0
- package/lib/rich-text-editor/rte/utils/textblock-marks.d.ts +10 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +109 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +6 -5
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -1
- package/lib/time-picker/time-picker.d.ts +20 -20
- package/lib/toggletip/toggletip.d.ts +4 -4
- package/lib/tooltip/tooltip.d.ts +4 -4
- package/locales/de-DE.cjs +58 -7
- package/locales/de-DE.js +58 -7
- package/locales/en-GB.cjs +60 -9
- package/locales/en-GB.js +60 -9
- package/locales/en-US.cjs +60 -9
- package/locales/en-US.js +60 -9
- package/locales/ja-JP.cjs +59 -8
- package/locales/ja-JP.js +59 -8
- package/locales/zh-CN.cjs +58 -7
- package/locales/zh-CN.js +58 -7
- package/menu/definition.cjs +1 -0
- package/menu/definition.js +1 -0
- package/number-field/definition.cjs +5 -3
- package/number-field/definition.js +5 -3
- package/number-field/index.cjs +5 -3
- package/number-field/index.js +34 -32
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +76 -62
- package/pagination/definition.cjs +2 -0
- package/pagination/definition.js +2 -0
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +2 -0
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/definition.cjs +4 -0
- package/radio/definition.js +4 -0
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/definition.cjs +2 -1
- package/range-slider/definition.js +2 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +3 -1
- package/rich-text-editor/definition.cjs +17942 -1074
- package/rich-text-editor/definition.js +17926 -1079
- package/rich-text-editor/index.cjs +29 -130
- package/rich-text-editor/index.js +5565 -2474
- package/searchable-select/definition.cjs +6 -2
- package/searchable-select/definition.js +6 -2
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +14 -10
- package/select/definition.cjs +22 -4
- package/select/definition.js +22 -4
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/patterns/anchored.d.ts +8 -8
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/localized.d.ts +386 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
- package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
- package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
- package/shared/utils/promise.d.ts +7 -0
- package/simple-color-picker/definition.cjs +11 -6
- package/simple-color-picker/definition.js +11 -6
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +44 -39
- package/slider/definition.cjs +7 -1
- package/slider/definition.js +7 -1
- package/styles/core/all.css +5 -1
- package/styles/core/theme.css +5 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/definition.cjs +1 -0
- package/switch/definition.js +1 -0
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -0
- package/tabs/definition.cjs +2 -0
- package/tabs/definition.js +2 -0
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +2 -0
- package/tag/definition.cjs +34 -14
- package/tag/definition.js +34 -14
- package/tag/index.cjs +25 -12
- package/tag/index.js +64 -47
- package/tag-group/definition.cjs +1 -2
- package/tag-group/definition.js +1 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +11 -12
- package/text-area/definition.cjs +13 -7
- package/text-area/definition.js +13 -7
- package/text-area/index.cjs +6 -6
- package/text-area/index.js +20 -14
- package/text-field/definition.cjs +16 -6
- package/text-field/definition.js +16 -6
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +5 -1
- package/toggletip/definition.js +5 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +6 -3
- package/tooltip/definition.js +6 -3
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-view/definition.cjs +28 -6
- package/tree-view/definition.js +28 -6
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +28 -6
- package/unbundled/_commonjsHelpers.cjs +0 -26
- package/unbundled/_commonjsHelpers.js +1 -26
- package/unbundled/attribute-binding-behaviour.cjs +1 -0
- package/unbundled/attribute-binding-behaviour.js +1 -0
- package/unbundled/base-color-picker.cjs +45 -21
- package/unbundled/base-color-picker.js +45 -21
- package/unbundled/base-progress.cjs +3 -0
- package/unbundled/base-progress.js +3 -0
- package/unbundled/button.cjs +14 -10
- package/unbundled/button.js +14 -10
- package/unbundled/calendar-picker.template.cjs +3 -1
- package/unbundled/calendar-picker.template.js +3 -1
- package/unbundled/definition.cjs +1 -0
- package/unbundled/definition.js +1 -0
- package/unbundled/definition2.cjs +4 -1
- package/unbundled/definition2.js +4 -1
- package/unbundled/definition3.cjs +1 -0
- package/unbundled/definition3.js +1 -0
- package/unbundled/definition4.cjs +1 -0
- package/unbundled/definition4.js +1 -0
- package/unbundled/definition5.cjs +3 -2
- package/unbundled/definition5.js +4 -3
- package/unbundled/delegates-aria.cjs +1 -0
- package/unbundled/delegates-aria.js +1 -0
- package/unbundled/form-associated.cjs +4 -0
- package/unbundled/form-associated.js +4 -0
- package/unbundled/listbox.cjs +16 -1
- package/unbundled/listbox.js +16 -1
- package/unbundled/localized.cjs +36 -0
- package/unbundled/localized.js +37 -2
- package/unbundled/mixins.cjs +2 -0
- package/unbundled/mixins.js +2 -0
- package/unbundled/picker-field.template.cjs +3 -35
- package/unbundled/picker-field.template.js +3 -34
- package/unbundled/scrollIntoView.cjs +1 -0
- package/unbundled/scrollIntoView.js +1 -0
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +5 -1
- package/unbundled/time-selection-picker.template.js +5 -1
- package/unbundled/trapped-focus.cjs +37 -0
- package/unbundled/trapped-focus.js +34 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +54 -44
- package/video-player/definition.js +50 -40
- package/video-player/index.cjs +28 -28
- package/video-player/index.js +1448 -1442
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +6463 -6099
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +0 -4
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +0 -18
- package/lib/rich-text-editor/image-placeholder/definition.d.ts +0 -2
- package/lib/rich-text-editor/image-placeholder/image-placeholder.d.ts +0 -7
- package/lib/rich-text-editor/image-placeholder/image-placeholder.template.d.ts +0 -4
- package/lib/rich-text-editor/menubar/consts.d.ts +0 -18
- package/lib/rich-text-editor/menubar/definition.d.ts +0 -2
- package/lib/rich-text-editor/menubar/menubar.d.ts +0 -386
- package/lib/rich-text-editor/menubar/menubar.template.d.ts +0 -4
package/icon/definition.cjs
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
6
6
|
const visuallyHidden_definition = require('../visually-hidden/definition.cjs');
|
|
7
7
|
const fastElement = require('@microsoft/fast-element');
|
|
8
|
-
const ramda = require('ramda');
|
|
9
8
|
const fastWebUtilities = require('@microsoft/fast-web-utilities');
|
|
10
9
|
|
|
11
10
|
const styles = ":host{display:inline-block;vertical-align:sub}.control.connotation-accent{--_connotation-color-primary: var(--vvd-icon-accent-primary, var(--vvd-color-canvas-text))}.control.connotation-announcement{--_connotation-color-primary: var(--vvd-icon-announcement-primary, var(--vvd-color-announcement-500))}.control.connotation-cta{--_connotation-color-primary: var(--vvd-icon-cta-primary, var(--vvd-color-cta-500))}.control.connotation-success{--_connotation-color-primary: var(--vvd-icon-success-primary, var(--vvd-color-success-500))}.control.connotation-warning{--_connotation-color-primary: var(--vvd-icon-warning-primary, var(--vvd-color-warning-300))}.control.connotation-alert{--_connotation-color-primary: var(--vvd-icon-alert-primary, var(--vvd-color-alert-500))}.control.connotation-information{--_connotation-color-primary: var(--vvd-icon-information-primary, var(--vvd-color-information-500))}.control.size--6{--_icon-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2)) - (1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2)))) }.control.size--5{--_icon-block-size: calc(1px*(20 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--4{--_icon-block-size: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--3{--_icon-block-size: calc(1px*(28 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--2{--_icon-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--1{--_icon-block-size: calc(1px*(36 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-0{--_icon-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-1{--_icon-block-size: calc(1px*(44 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-2{--_icon-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-3{--_icon-block-size: calc(1px*(52 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-4{--_icon-block-size: calc(1px*(56 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-5{--_icon-block-size: calc(1px*(60 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control:not(.size--6,.size--5,.size--4,.size--3,.size--2,.size--1,.size-0,.size-1,.size-2,.size-3,.size-4,.size-5){--_icon-block-size: 1em}.control{display:flex;margin:unset;block-size:var(--_icon-block-size);color:currentColor;contain:strict;inline-size:var(--_icon-block-size)}.control[class*=connotation]{color:var(--_connotation-color-primary)}slot,svg,::slotted(:where(svg,img)){margin:auto;block-size:inherit;inline-size:inherit}";
|
|
@@ -45,13 +44,12 @@ const PLACEHOLDER_ICON = `<svg width="80%" height="80%" viewBox="0 0 64 64">
|
|
|
45
44
|
</svg>`;
|
|
46
45
|
|
|
47
46
|
var __defProp = Object.defineProperty;
|
|
48
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
49
47
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
50
|
-
var result =
|
|
48
|
+
var result = void 0 ;
|
|
51
49
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
52
50
|
if (decorator = decorators[i])
|
|
53
|
-
result = (
|
|
54
|
-
if (
|
|
51
|
+
result = (decorator(target, key, result) ) || result;
|
|
52
|
+
if (result) __defProp(target, key, result);
|
|
55
53
|
return result;
|
|
56
54
|
};
|
|
57
55
|
const PLACEHOLDER_DELAY = 500;
|
|
@@ -66,24 +64,46 @@ const extractSvg = (response) => {
|
|
|
66
64
|
assertIsValidResponse(response);
|
|
67
65
|
return response.text();
|
|
68
66
|
};
|
|
69
|
-
const loadSvg = (iconId, signal) => fetch(baseUrlTemplate(
|
|
70
|
-
|
|
71
|
-
}).then(extractSvg);
|
|
72
|
-
const resolveIcon = ramda.memoizeWith(
|
|
73
|
-
ramda.identity,
|
|
74
|
-
(iconId, signal) => iconId.trim() ? loadSvg(iconId, signal) : Promise.resolve("")
|
|
67
|
+
const loadSvg = (iconId, signal) => fetch(baseUrlTemplate(`${iconId}.svg`, ICONS_VERSION), { signal }).then(
|
|
68
|
+
extractSvg
|
|
75
69
|
);
|
|
70
|
+
const normalizeKey = (iconId) => (iconId ?? "").trim();
|
|
71
|
+
const iconCache = /* @__PURE__ */ new Map();
|
|
72
|
+
const resolveIcon = (iconId, signal) => {
|
|
73
|
+
const key = normalizeKey(iconId);
|
|
74
|
+
if (!key) return Promise.resolve("");
|
|
75
|
+
const cached = iconCache.get(key);
|
|
76
|
+
if (cached && !cached.signal?.aborted) {
|
|
77
|
+
return cached.promise;
|
|
78
|
+
}
|
|
79
|
+
const promise = loadSvg(key, signal).then((svg) => {
|
|
80
|
+
const entry = iconCache.get(key);
|
|
81
|
+
if (entry && entry.promise === promise && signal.aborted) {
|
|
82
|
+
iconCache.delete(key);
|
|
83
|
+
throw signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
84
|
+
}
|
|
85
|
+
return svg;
|
|
86
|
+
}).catch((err) => {
|
|
87
|
+
const entry = iconCache.get(key);
|
|
88
|
+
if (entry && entry.promise === promise) {
|
|
89
|
+
iconCache.delete(key);
|
|
90
|
+
}
|
|
91
|
+
throw err;
|
|
92
|
+
});
|
|
93
|
+
iconCache.set(key, { promise, signal });
|
|
94
|
+
return promise;
|
|
95
|
+
};
|
|
76
96
|
class Icon extends vividElement.VividElement {
|
|
77
97
|
constructor() {
|
|
78
98
|
super(...arguments);
|
|
79
99
|
this.iconLoaded = false;
|
|
100
|
+
this.#currentRequestId = 0;
|
|
80
101
|
this.#abortController = null;
|
|
81
102
|
}
|
|
82
|
-
|
|
83
|
-
return !this.name ? this._svg : baseUrlTemplate(`${this.name}.svg`, ICONS_VERSION);
|
|
84
|
-
}
|
|
103
|
+
#currentRequestId;
|
|
85
104
|
#abortController;
|
|
86
105
|
async nameChanged() {
|
|
106
|
+
const requestId = ++this.#currentRequestId;
|
|
87
107
|
if (this.#abortController) {
|
|
88
108
|
this.#abortController.abort();
|
|
89
109
|
}
|
|
@@ -91,44 +111,53 @@ class Icon extends vividElement.VividElement {
|
|
|
91
111
|
this._svg = void 0;
|
|
92
112
|
this.iconLoaded = false;
|
|
93
113
|
let timeout = setTimeout(() => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
114
|
+
/* v8 ignore else -- @preserve */
|
|
115
|
+
if (this.#currentRequestId === requestId) {
|
|
116
|
+
this._svg = PLACEHOLDER_ICON;
|
|
117
|
+
timeout = setTimeout(() => {
|
|
118
|
+
/* v8 ignore else -- @preserve */
|
|
119
|
+
if (this.#currentRequestId === requestId && this._svg === PLACEHOLDER_ICON) {
|
|
120
|
+
this._svg = void 0;
|
|
121
|
+
}
|
|
122
|
+
}, PLACEHOLDER_TIMEOUT);
|
|
123
|
+
}
|
|
100
124
|
}, PLACEHOLDER_DELAY);
|
|
101
|
-
|
|
102
|
-
this.
|
|
103
|
-
|
|
104
|
-
this
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
try {
|
|
126
|
+
const svg = await resolveIcon(this.name, this.#abortController.signal);
|
|
127
|
+
/* v8 ignore else -- @preserve */
|
|
128
|
+
if (this.#currentRequestId === requestId) {
|
|
129
|
+
this._svg = svg;
|
|
130
|
+
}
|
|
131
|
+
} catch {
|
|
132
|
+
if (this.#currentRequestId === requestId) {
|
|
133
|
+
this._svg = void 0;
|
|
134
|
+
}
|
|
135
|
+
} finally {
|
|
136
|
+
if (this.#currentRequestId === requestId) {
|
|
137
|
+
clearTimeout(timeout);
|
|
138
|
+
this.iconLoaded = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
109
141
|
}
|
|
110
142
|
}
|
|
111
143
|
__decorateClass([
|
|
112
144
|
fastElement.attr
|
|
113
|
-
], Icon.prototype, "connotation"
|
|
145
|
+
], Icon.prototype, "connotation");
|
|
114
146
|
__decorateClass([
|
|
115
147
|
fastElement.attr({ converter: numberConverter })
|
|
116
|
-
], Icon.prototype, "size"
|
|
148
|
+
], Icon.prototype, "size");
|
|
117
149
|
__decorateClass([
|
|
118
150
|
fastElement.observable
|
|
119
|
-
], Icon.prototype, "_svg"
|
|
151
|
+
], Icon.prototype, "_svg");
|
|
120
152
|
__decorateClass([
|
|
121
153
|
fastElement.observable
|
|
122
|
-
], Icon.prototype, "iconLoaded"
|
|
154
|
+
], Icon.prototype, "iconLoaded");
|
|
123
155
|
__decorateClass([
|
|
124
156
|
fastElement.attr
|
|
125
|
-
], Icon.prototype, "label"
|
|
157
|
+
], Icon.prototype, "label");
|
|
126
158
|
__decorateClass([
|
|
127
159
|
fastElement.attr
|
|
128
|
-
], Icon.prototype, "name"
|
|
129
|
-
__decorateClass([
|
|
130
|
-
fastElement.volatile
|
|
131
|
-
], Icon.prototype, "iconUrl", 1);
|
|
160
|
+
], Icon.prototype, "name");
|
|
132
161
|
|
|
133
162
|
const getClasses = ({ connotation, size }) => fastWebUtilities.classNames(
|
|
134
163
|
"control",
|
|
@@ -146,10 +175,6 @@ const iconTemplate = (context) => {
|
|
|
146
175
|
>
|
|
147
176
|
<slot>
|
|
148
177
|
${fastElement.when(
|
|
149
|
-
(x) => !x?.iconLoaded,
|
|
150
|
-
fastElement.html`<img alt="${(x) => x?.name}" src="${(x) => x?.iconUrl}" />`
|
|
151
|
-
)}
|
|
152
|
-
${fastElement.when(
|
|
153
178
|
(x) => x?.iconLoaded && x?._svg,
|
|
154
179
|
(x) => fastElement.html`${fastElement.html.partial(x._svg)}`
|
|
155
180
|
)}
|
package/icon/definition.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
2
2
|
import { VwcVisuallyHiddenElement as VisuallyHidden, visuallyHiddenDefinition } from '../visually-hidden/definition.js';
|
|
3
|
-
import { attr, observable,
|
|
4
|
-
import { memoizeWith, identity } from 'ramda';
|
|
3
|
+
import { attr, observable, when, html } from '@microsoft/fast-element';
|
|
5
4
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
6
5
|
|
|
7
6
|
const styles = ":host{display:inline-block;vertical-align:sub}.control.connotation-accent{--_connotation-color-primary: var(--vvd-icon-accent-primary, var(--vvd-color-canvas-text))}.control.connotation-announcement{--_connotation-color-primary: var(--vvd-icon-announcement-primary, var(--vvd-color-announcement-500))}.control.connotation-cta{--_connotation-color-primary: var(--vvd-icon-cta-primary, var(--vvd-color-cta-500))}.control.connotation-success{--_connotation-color-primary: var(--vvd-icon-success-primary, var(--vvd-color-success-500))}.control.connotation-warning{--_connotation-color-primary: var(--vvd-icon-warning-primary, var(--vvd-color-warning-300))}.control.connotation-alert{--_connotation-color-primary: var(--vvd-icon-alert-primary, var(--vvd-color-alert-500))}.control.connotation-information{--_connotation-color-primary: var(--vvd-icon-information-primary, var(--vvd-color-information-500))}.control.size--6{--_icon-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2)) - (1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2)))) }.control.size--5{--_icon-block-size: calc(1px*(20 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--4{--_icon-block-size: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--3{--_icon-block-size: calc(1px*(28 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--2{--_icon-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size--1{--_icon-block-size: calc(1px*(36 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-0{--_icon-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-1{--_icon-block-size: calc(1px*(44 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-2{--_icon-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-3{--_icon-block-size: calc(1px*(52 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-4{--_icon-block-size: calc(1px*(56 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control.size-5{--_icon-block-size: calc(1px*(60 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control:not(.size--6,.size--5,.size--4,.size--3,.size--2,.size--1,.size-0,.size-1,.size-2,.size-3,.size-4,.size-5){--_icon-block-size: 1em}.control{display:flex;margin:unset;block-size:var(--_icon-block-size);color:currentColor;contain:strict;inline-size:var(--_icon-block-size)}.control[class*=connotation]{color:var(--_connotation-color-primary)}slot,svg,::slotted(:where(svg,img)){margin:auto;block-size:inherit;inline-size:inherit}";
|
|
@@ -41,13 +40,12 @@ const PLACEHOLDER_ICON = `<svg width="80%" height="80%" viewBox="0 0 64 64">
|
|
|
41
40
|
</svg>`;
|
|
42
41
|
|
|
43
42
|
var __defProp = Object.defineProperty;
|
|
44
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
45
43
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
46
|
-
var result =
|
|
44
|
+
var result = void 0 ;
|
|
47
45
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
48
46
|
if (decorator = decorators[i])
|
|
49
|
-
result = (
|
|
50
|
-
if (
|
|
47
|
+
result = (decorator(target, key, result) ) || result;
|
|
48
|
+
if (result) __defProp(target, key, result);
|
|
51
49
|
return result;
|
|
52
50
|
};
|
|
53
51
|
const PLACEHOLDER_DELAY = 500;
|
|
@@ -62,24 +60,46 @@ const extractSvg = (response) => {
|
|
|
62
60
|
assertIsValidResponse(response);
|
|
63
61
|
return response.text();
|
|
64
62
|
};
|
|
65
|
-
const loadSvg = (iconId, signal) => fetch(baseUrlTemplate(
|
|
66
|
-
|
|
67
|
-
}).then(extractSvg);
|
|
68
|
-
const resolveIcon = memoizeWith(
|
|
69
|
-
identity,
|
|
70
|
-
(iconId, signal) => iconId.trim() ? loadSvg(iconId, signal) : Promise.resolve("")
|
|
63
|
+
const loadSvg = (iconId, signal) => fetch(baseUrlTemplate(`${iconId}.svg`, ICONS_VERSION), { signal }).then(
|
|
64
|
+
extractSvg
|
|
71
65
|
);
|
|
66
|
+
const normalizeKey = (iconId) => (iconId ?? "").trim();
|
|
67
|
+
const iconCache = /* @__PURE__ */ new Map();
|
|
68
|
+
const resolveIcon = (iconId, signal) => {
|
|
69
|
+
const key = normalizeKey(iconId);
|
|
70
|
+
if (!key) return Promise.resolve("");
|
|
71
|
+
const cached = iconCache.get(key);
|
|
72
|
+
if (cached && !cached.signal?.aborted) {
|
|
73
|
+
return cached.promise;
|
|
74
|
+
}
|
|
75
|
+
const promise = loadSvg(key, signal).then((svg) => {
|
|
76
|
+
const entry = iconCache.get(key);
|
|
77
|
+
if (entry && entry.promise === promise && signal.aborted) {
|
|
78
|
+
iconCache.delete(key);
|
|
79
|
+
throw signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
80
|
+
}
|
|
81
|
+
return svg;
|
|
82
|
+
}).catch((err) => {
|
|
83
|
+
const entry = iconCache.get(key);
|
|
84
|
+
if (entry && entry.promise === promise) {
|
|
85
|
+
iconCache.delete(key);
|
|
86
|
+
}
|
|
87
|
+
throw err;
|
|
88
|
+
});
|
|
89
|
+
iconCache.set(key, { promise, signal });
|
|
90
|
+
return promise;
|
|
91
|
+
};
|
|
72
92
|
class Icon extends VividElement {
|
|
73
93
|
constructor() {
|
|
74
94
|
super(...arguments);
|
|
75
95
|
this.iconLoaded = false;
|
|
96
|
+
this.#currentRequestId = 0;
|
|
76
97
|
this.#abortController = null;
|
|
77
98
|
}
|
|
78
|
-
|
|
79
|
-
return !this.name ? this._svg : baseUrlTemplate(`${this.name}.svg`, ICONS_VERSION);
|
|
80
|
-
}
|
|
99
|
+
#currentRequestId;
|
|
81
100
|
#abortController;
|
|
82
101
|
async nameChanged() {
|
|
102
|
+
const requestId = ++this.#currentRequestId;
|
|
83
103
|
if (this.#abortController) {
|
|
84
104
|
this.#abortController.abort();
|
|
85
105
|
}
|
|
@@ -87,44 +107,53 @@ class Icon extends VividElement {
|
|
|
87
107
|
this._svg = void 0;
|
|
88
108
|
this.iconLoaded = false;
|
|
89
109
|
let timeout = setTimeout(() => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
/* v8 ignore else -- @preserve */
|
|
111
|
+
if (this.#currentRequestId === requestId) {
|
|
112
|
+
this._svg = PLACEHOLDER_ICON;
|
|
113
|
+
timeout = setTimeout(() => {
|
|
114
|
+
/* v8 ignore else -- @preserve */
|
|
115
|
+
if (this.#currentRequestId === requestId && this._svg === PLACEHOLDER_ICON) {
|
|
116
|
+
this._svg = void 0;
|
|
117
|
+
}
|
|
118
|
+
}, PLACEHOLDER_TIMEOUT);
|
|
119
|
+
}
|
|
96
120
|
}, PLACEHOLDER_DELAY);
|
|
97
|
-
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
this
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
121
|
+
try {
|
|
122
|
+
const svg = await resolveIcon(this.name, this.#abortController.signal);
|
|
123
|
+
/* v8 ignore else -- @preserve */
|
|
124
|
+
if (this.#currentRequestId === requestId) {
|
|
125
|
+
this._svg = svg;
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
if (this.#currentRequestId === requestId) {
|
|
129
|
+
this._svg = void 0;
|
|
130
|
+
}
|
|
131
|
+
} finally {
|
|
132
|
+
if (this.#currentRequestId === requestId) {
|
|
133
|
+
clearTimeout(timeout);
|
|
134
|
+
this.iconLoaded = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
105
137
|
}
|
|
106
138
|
}
|
|
107
139
|
__decorateClass([
|
|
108
140
|
attr
|
|
109
|
-
], Icon.prototype, "connotation"
|
|
141
|
+
], Icon.prototype, "connotation");
|
|
110
142
|
__decorateClass([
|
|
111
143
|
attr({ converter: numberConverter })
|
|
112
|
-
], Icon.prototype, "size"
|
|
144
|
+
], Icon.prototype, "size");
|
|
113
145
|
__decorateClass([
|
|
114
146
|
observable
|
|
115
|
-
], Icon.prototype, "_svg"
|
|
147
|
+
], Icon.prototype, "_svg");
|
|
116
148
|
__decorateClass([
|
|
117
149
|
observable
|
|
118
|
-
], Icon.prototype, "iconLoaded"
|
|
150
|
+
], Icon.prototype, "iconLoaded");
|
|
119
151
|
__decorateClass([
|
|
120
152
|
attr
|
|
121
|
-
], Icon.prototype, "label"
|
|
153
|
+
], Icon.prototype, "label");
|
|
122
154
|
__decorateClass([
|
|
123
155
|
attr
|
|
124
|
-
], Icon.prototype, "name"
|
|
125
|
-
__decorateClass([
|
|
126
|
-
volatile
|
|
127
|
-
], Icon.prototype, "iconUrl", 1);
|
|
156
|
+
], Icon.prototype, "name");
|
|
128
157
|
|
|
129
158
|
const getClasses = ({ connotation, size }) => classNames(
|
|
130
159
|
"control",
|
|
@@ -142,10 +171,6 @@ const iconTemplate = (context) => {
|
|
|
142
171
|
>
|
|
143
172
|
<slot>
|
|
144
173
|
${when(
|
|
145
|
-
(x) => !x?.iconLoaded,
|
|
146
|
-
html`<img alt="${(x) => x?.name}" src="${(x) => x?.iconUrl}" />`
|
|
147
|
-
)}
|
|
148
|
-
${when(
|
|
149
174
|
(x) => x?.iconLoaded && x?._svg,
|
|
150
175
|
(x) => html`${html.partial(x._svg)}`
|
|
151
176
|
)}
|
package/index.cjs
CHANGED
|
@@ -228,6 +228,27 @@ exports.registerRadio = radio_definition.registerRadio;
|
|
|
228
228
|
exports.VwcRangeSliderElement = rangeSlider_definition.VwcRangeSliderElement;
|
|
229
229
|
exports.rangeSliderDefinition = rangeSlider_definition.rangeSliderDefinition;
|
|
230
230
|
exports.registerRangeSlider = rangeSlider_definition.registerRangeSlider;
|
|
231
|
+
exports.RteAlignmentFeature = richTextEditor_definition.RteAlignmentFeature;
|
|
232
|
+
exports.RteBase = richTextEditor_definition.RteBase;
|
|
233
|
+
exports.RteBoldFeature = richTextEditor_definition.RteBoldFeature;
|
|
234
|
+
exports.RteConfig = richTextEditor_definition.RteConfig;
|
|
235
|
+
exports.RteDropHandlerFeature = richTextEditor_definition.RteDropHandlerFeature;
|
|
236
|
+
exports.RteFileHandlerFeature = richTextEditor_definition.RteFileHandlerFeature;
|
|
237
|
+
exports.RteFontSizePickerFeature = richTextEditor_definition.RteFontSizePickerFeature;
|
|
238
|
+
exports.RteHardBreakFeature = richTextEditor_definition.RteHardBreakFeature;
|
|
239
|
+
exports.RteHtmlParser = richTextEditor_definition.RteHtmlParser;
|
|
240
|
+
exports.RteHtmlSerializer = richTextEditor_definition.RteHtmlSerializer;
|
|
241
|
+
exports.RteInlineImageFeature = richTextEditor_definition.RteInlineImageFeature;
|
|
242
|
+
exports.RteItalicFeature = richTextEditor_definition.RteItalicFeature;
|
|
243
|
+
exports.RteLinkFeature = richTextEditor_definition.RteLinkFeature;
|
|
244
|
+
exports.RteListFeature = richTextEditor_definition.RteListFeature;
|
|
245
|
+
exports.RteMonospaceFeature = richTextEditor_definition.RteMonospaceFeature;
|
|
246
|
+
exports.RtePlaceholderFeature = richTextEditor_definition.RtePlaceholderFeature;
|
|
247
|
+
exports.RteStrikethroughFeature = richTextEditor_definition.RteStrikethroughFeature;
|
|
248
|
+
exports.RteTextBlockPickerFeature = richTextEditor_definition.RteTextBlockPickerFeature;
|
|
249
|
+
exports.RteTextColorPickerFeature = richTextEditor_definition.RteTextColorPickerFeature;
|
|
250
|
+
exports.RteToolbarFeature = richTextEditor_definition.RteToolbarFeature;
|
|
251
|
+
exports.RteUnderlineFeature = richTextEditor_definition.RteUnderlineFeature;
|
|
231
252
|
exports.VwcRichTextEditorElement = richTextEditor_definition.VwcRichTextEditorElement;
|
|
232
253
|
exports.registerRichTextEditor = richTextEditor_definition.registerRichTextEditor;
|
|
233
254
|
exports.richTextEditorDefinition = richTextEditor_definition.richTextEditorDefinition;
|
package/index.js
CHANGED
|
@@ -47,7 +47,7 @@ export { VwcProgressElement, progressDefinition, registerProgress } from './prog
|
|
|
47
47
|
export { VwcRadioGroupElement, radioGroupDefinition, registerRadioGroup } from './radio-group/definition.js';
|
|
48
48
|
export { VwcRadioElement, radioDefinition, registerRadio } from './radio/definition.js';
|
|
49
49
|
export { VwcRangeSliderElement, rangeSliderDefinition, registerRangeSlider } from './range-slider/definition.js';
|
|
50
|
-
export { VwcRichTextEditorElement, registerRichTextEditor, richTextEditorDefinition } from './rich-text-editor/definition.js';
|
|
50
|
+
export { RteAlignmentFeature, RteBase, RteBoldFeature, RteConfig, RteDropHandlerFeature, RteFileHandlerFeature, RteFontSizePickerFeature, RteHardBreakFeature, RteHtmlParser, RteHtmlSerializer, RteInlineImageFeature, RteItalicFeature, RteLinkFeature, RteListFeature, RteMonospaceFeature, RtePlaceholderFeature, RteStrikethroughFeature, RteTextBlockPickerFeature, RteTextColorPickerFeature, RteToolbarFeature, RteUnderlineFeature, VwcRichTextEditorElement, registerRichTextEditor, richTextEditorDefinition } from './rich-text-editor/definition.js';
|
|
51
51
|
export { VwcSearchableSelectElement, registerSearchableSelect } from './searchable-select/definition.js';
|
|
52
52
|
export { VwcSelectElement, registerSelect, selectDefinition } from './select/definition.js';
|
|
53
53
|
export { VwcSelectableBoxElement, registerSelectableBox, selectableBoxDefinition } from './selectable-box/definition.js';
|