@vonage/vivid 5.21.0 → 5.22.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/index.cjs +1 -1
- package/accordion/index.js +2 -2
- package/alert/index.cjs +1 -1
- package/alert/index.js +1 -1
- package/audio-player/index.cjs +3 -5
- package/audio-player/index.js +30 -32
- package/avatar/index.cjs +1 -1
- package/avatar/index.js +1 -1
- package/banner/index.cjs +1 -1
- package/banner/index.js +1 -1
- package/bundled/affix.cjs +4 -4
- package/bundled/affix.js +4 -4
- package/bundled/base-color-picker.cjs +2 -2
- package/bundled/base-color-picker.js +2 -2
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +1 -1
- package/bundled/definition10.cjs +1 -1
- package/bundled/definition10.js +1 -1
- package/bundled/definition13.cjs +1 -1
- package/bundled/definition13.js +1 -1
- package/bundled/definition15.cjs +1 -1
- package/bundled/definition15.js +2 -2
- package/bundled/definition16.cjs +2 -2
- package/bundled/definition16.js +2 -2
- package/bundled/definition17.cjs +1 -1
- package/bundled/definition17.js +1 -1
- package/bundled/definition18.cjs +2 -2
- package/bundled/definition18.js +14 -5
- package/bundled/definition19.cjs +1 -1
- package/bundled/definition19.js +1 -1
- package/bundled/definition20.cjs +1 -1
- package/bundled/definition20.js +1 -1
- package/bundled/definition21.cjs +1 -1
- package/bundled/definition21.js +2 -2
- package/bundled/definition24.cjs +1 -1
- package/bundled/definition24.js +1 -1
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +3 -3
- package/bundled/definition4.cjs +1 -1
- package/bundled/definition4.js +1 -1
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +1 -1
- package/bundled/definition6.cjs +1 -1
- package/bundled/definition6.js +1 -1
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +12 -6
- package/bundled/definition9.cjs +1 -1
- package/bundled/definition9.js +1 -1
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +2 -2
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +5 -5
- package/bundled/numberConverter.cjs +1 -1
- package/bundled/numberConverter.js +1 -1
- package/bundled/slider.template.cjs +1 -1
- package/bundled/slider.template.js +1 -1
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/bundled/with-contextual-help.cjs +1 -1
- package/bundled/with-contextual-help.js +1 -1
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +3 -3
- package/color-picker/index.cjs +20 -20
- package/color-picker/index.js +22 -22
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +6 -6
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +1 -1
- package/custom-elements.json +2880 -2838
- package/data-grid/index.cjs +2 -2
- package/data-grid/index.js +12 -10
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +2 -2
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -1
- package/header/index.cjs +1 -1
- package/header/index.js +1 -1
- package/lib/audio-player/audio-player.d.ts +0 -1
- package/lib/calendar/helpers/calendar.keyboard-interactions.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +16 -16
- package/lib/color-picker/color-picker.d.ts +16 -16
- package/lib/combobox/combobox.d.ts +21 -21
- package/lib/date-picker/date-picker.d.ts +26 -26
- package/lib/date-range-picker/date-range-picker.d.ts +14 -14
- package/lib/date-time-picker/date-time-picker.d.ts +24 -24
- package/lib/dial-pad/dial-pad.d.ts +1 -1
- package/lib/file-picker/file-picker.d.ts +21 -21
- package/lib/menu/menu.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +22 -22
- package/lib/popup/popup.d.ts +2 -1
- package/lib/radio/radio.d.ts +16 -16
- package/lib/range-slider/range-slider.d.ts +10 -10
- package/lib/rich-text-editor/popover.d.ts +1 -1
- package/lib/rich-text-editor/rte/exports.d.ts +1 -0
- package/lib/rich-text-editor/rte/feature.d.ts +5 -5
- package/lib/rich-text-editor/rte/features/drop-handler.d.ts +1 -2
- package/lib/rich-text-editor/rte/features/internal/core.d.ts +8 -0
- package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/instance.d.ts +1 -0
- package/lib/rich-text-editor/rte/public-interface.d.ts +3 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +1 -1
- package/lib/searchable-select/searchable-select.d.ts +21 -21
- package/lib/select/select.d.ts +22 -22
- package/lib/simple-color-picker/simple-color-picker.d.ts +5 -5
- package/lib/slider/slider.d.ts +5 -5
- package/lib/switch/switch.d.ts +5 -5
- package/lib/table/table-body.template.d.ts +1 -2
- package/lib/table/table-cell.template.d.ts +1 -2
- package/lib/table/table-head.template.d.ts +1 -2
- package/lib/table/table-row.template.d.ts +1 -2
- package/lib/table/table.template.d.ts +1 -2
- package/lib/text-area/text-area.d.ts +21 -21
- package/lib/text-field/text-field.d.ts +22 -22
- package/lib/time-picker/time-picker.d.ts +12 -12
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/package.json +8 -6
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +9 -2
- package/popover/index.cjs +1 -1
- package/popover/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +21 -19
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/index.cjs +4 -3
- package/rich-text-editor/index.js +55 -27
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +6 -1
- package/shared/color-picker/base-color-picker.d.ts +5 -5
- package/shared/feedback/mixins.d.ts +1 -1
- package/shared/foundation/button/button.d.ts +5 -5
- package/shared/foundation/form-associated/form-associated.d.ts +10 -10
- package/shared/foundation/listbox/listbox.d.ts +1 -1
- package/shared/patterns/form-elements/form-element.d.ts +5 -5
- package/shared/patterns/form-elements/with-contextual-help.d.ts +5 -5
- package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
- package/shared/picker-field/mixins/calendar-picker.d.ts +6 -6
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +6 -6
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +8 -8
- package/shared/picker-field/mixins/single-date-picker.d.ts +6 -6
- package/shared/picker-field/mixins/single-value-picker.d.ts +6 -6
- package/shared/picker-field/mixins/time-selection-picker.d.ts +6 -6
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +12 -12
- package/shared/picker-field/picker-field.d.ts +21 -21
- package/shared/utils/slottable-request.d.ts +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/table/index.cjs +5 -5
- package/table/index.js +5 -5
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +2 -2
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +0 -2
- package/unbundled/affix.cjs +4 -4
- package/unbundled/affix.js +4 -4
- package/unbundled/base-color-picker.cjs +3 -3
- package/unbundled/base-color-picker.js +3 -3
- package/unbundled/button.cjs +5 -5
- package/unbundled/button.js +5 -5
- package/unbundled/definition10.cjs +15 -4
- package/unbundled/definition10.js +15 -4
- package/unbundled/definition11.cjs +3 -3
- package/unbundled/definition11.js +3 -3
- package/unbundled/definition12.cjs +1 -1
- package/unbundled/definition12.js +1 -1
- package/unbundled/definition13.cjs +2 -2
- package/unbundled/definition13.js +2 -2
- package/unbundled/definition14.cjs +73 -76
- package/unbundled/definition14.js +73 -76
- package/unbundled/definition15.cjs +1 -1
- package/unbundled/definition15.js +1 -1
- package/unbundled/definition17.cjs +1 -1
- package/unbundled/definition17.js +1 -1
- package/unbundled/definition19.cjs +2 -1
- package/unbundled/definition19.js +2 -1
- package/unbundled/definition2.cjs +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition21.cjs +3 -3
- package/unbundled/definition21.js +3 -3
- package/unbundled/definition23.cjs +2 -2
- package/unbundled/definition23.js +2 -2
- package/unbundled/definition24.cjs +1 -1
- package/unbundled/definition24.js +1 -1
- package/unbundled/definition27.cjs +1 -1
- package/unbundled/definition27.js +1 -1
- package/unbundled/definition28.cjs +23 -23
- package/unbundled/definition28.js +23 -23
- package/unbundled/definition29.cjs +1 -1
- package/unbundled/definition29.js +1 -1
- package/unbundled/definition3.cjs +2 -2
- package/unbundled/definition3.js +2 -2
- package/unbundled/definition30.cjs +7 -7
- package/unbundled/definition30.js +7 -7
- package/unbundled/definition32.cjs +1 -1
- package/unbundled/definition32.js +1 -1
- package/unbundled/definition34.cjs +9 -8
- package/unbundled/definition34.js +9 -8
- package/unbundled/definition35.cjs +1 -1
- package/unbundled/definition35.js +1 -1
- package/unbundled/definition39.cjs +2 -2
- package/unbundled/definition39.js +2 -2
- package/unbundled/definition40.cjs +1 -1
- package/unbundled/definition40.js +1 -1
- package/unbundled/definition44.cjs +1 -1
- package/unbundled/definition44.js +1 -1
- package/unbundled/definition48.cjs +1 -1
- package/unbundled/definition48.js +1 -1
- package/unbundled/definition49.cjs +1 -1
- package/unbundled/definition49.js +1 -1
- package/unbundled/definition5.cjs +1 -1
- package/unbundled/definition5.js +1 -1
- package/unbundled/definition53.cjs +10 -3
- package/unbundled/definition53.js +10 -3
- package/unbundled/definition55.cjs +1 -1
- package/unbundled/definition55.js +1 -1
- package/unbundled/definition56.cjs +1 -1
- package/unbundled/definition56.js +1 -1
- package/unbundled/definition57.cjs +4 -5
- package/unbundled/definition57.js +4 -5
- package/unbundled/definition58.cjs +20 -19
- package/unbundled/definition58.js +20 -19
- package/unbundled/definition59.cjs +1 -1
- package/unbundled/definition59.js +1 -1
- package/unbundled/definition60.cjs +47 -9
- package/unbundled/definition60.js +47 -9
- package/unbundled/definition61.cjs +12 -6
- package/unbundled/definition61.js +12 -6
- package/unbundled/definition64.cjs +4 -1
- package/unbundled/definition64.js +4 -1
- package/unbundled/definition65.cjs +2 -1
- package/unbundled/definition65.js +2 -1
- package/unbundled/definition69.cjs +3 -2
- package/unbundled/definition69.js +3 -2
- package/unbundled/definition7.cjs +1 -1
- package/unbundled/definition7.js +1 -1
- package/unbundled/definition71.cjs +1 -1
- package/unbundled/definition71.js +1 -1
- package/unbundled/definition72.cjs +5 -5
- package/unbundled/definition72.js +5 -5
- package/unbundled/definition73.cjs +2 -2
- package/unbundled/definition73.js +2 -2
- package/unbundled/definition75.cjs +1 -1
- package/unbundled/definition75.js +1 -1
- package/unbundled/definition78.cjs +1 -1
- package/unbundled/definition78.js +1 -1
- package/unbundled/definition79.cjs +0 -2
- package/unbundled/definition79.js +0 -2
- package/unbundled/definition80.cjs +1 -1
- package/unbundled/definition80.js +1 -1
- package/unbundled/definition9.cjs +1 -1
- package/unbundled/definition9.js +1 -1
- package/unbundled/form-associated.cjs +2 -2
- package/unbundled/form-associated.js +2 -2
- package/unbundled/listbox.cjs +7 -7
- package/unbundled/listbox.js +7 -7
- package/unbundled/numberConverter.cjs +1 -1
- package/unbundled/numberConverter.js +1 -1
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/slottable-request.cjs +5 -5
- package/unbundled/slottable-request.js +5 -5
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/unbundled/with-contextual-help.cjs +4 -1
- package/unbundled/with-contextual-help.js +4 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +60 -18
package/tree-view/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../bundled/vivid-element.cjs`),t=require(`../bundled/slotted.cjs`),n=require(`../bundled/ref.cjs`),r=require(`../bundled/decorate.cjs`),i=require(`../bundled/class-names.cjs`),a=require(`../bundled/dom.cjs`),o=require(`../bundled/key-codes.cjs`),s=require(`../bundled/definition4.cjs`),c=require(`../bundled/host-semantics.cjs`);var l=`.control{flex-direction:column;gap:4px;display:flex;position:relative}`;function u(e,t){return a.t(e)?Array.from(e.querySelectorAll(t)).filter(e=>{if(e.parentElement instanceof s.r){if(e.parentElement.expanded)return!0}else return!0;return!1}):[]}var d=class extends c.t(e.t){constructor(...e){super(...e),this.currentFocused=null,this.handleFocus=e=>{if(this.slottedTreeItems.length>0){if(e.target===this){this.currentFocused!==null&&s.r.focusItem(this.currentFocused);return}this.contains(e.target)&&(this.setAttribute(`tabindex`,`-1`),this.currentFocused=e.target)}},this.handleBlur=e=>{e.target instanceof HTMLElement&&(e.relatedTarget===null||!this.contains(e.relatedTarget))&&this.setAttribute(`tabindex`,`0`)},this.handleKeyDown=e=>{if(this.slottedTreeItems.length<1)return!0;if(!e.defaultPrevented){let t=this.getVisibleNodes();switch(e.key){case o.s:t.length&&s.r.focusItem(t[0]);return;case`End`:t.length&&s.r.focusItem(t[t.length-1]);return;case o.n:if(e.target&&this.isFocusableElement(e.target)){let t=e.target;t instanceof s.r&&t.childItemLength()>0&&t.expanded?t.expanded=!1:t instanceof s.r&&t.parentElement instanceof s.r&&s.r.focusItem(t.parentElement)}return!1;case o.r:if(e.target&&this.isFocusableElement(e.target)){let t=e.target;t instanceof s.r&&t.childItemLength()>0&&!t.expanded?t.expanded=!0:t instanceof s.r&&t.childItemLength()>0&&this.focusNextNode(1,e.target)}return;case o.t:e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(1,e.target);return;case o.i:e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(-1,e.target);return;case o.a:this.handleClick(e);return}}return!0},this.handleSelectedChange=e=>{if(!e.defaultPrevented){if(!(e.target instanceof Element)||!s.i(e.target))return!0;let t=e.target;t.selected?(this.currentSelected&&this.currentSelected!==t&&(this.currentSelected.selected=!1),this.currentSelected=t):!t.selected&&this.currentSelected===t&&(this.currentSelected=null)
|
|
1
|
+
const e=require(`../bundled/vivid-element.cjs`),t=require(`../bundled/slotted.cjs`),n=require(`../bundled/ref.cjs`),r=require(`../bundled/decorate.cjs`),i=require(`../bundled/class-names.cjs`),a=require(`../bundled/dom.cjs`),o=require(`../bundled/key-codes.cjs`),s=require(`../bundled/definition4.cjs`),c=require(`../bundled/host-semantics.cjs`);var l=`.control{flex-direction:column;gap:4px;display:flex;position:relative}`;function u(e,t){return a.t(e)?Array.from(e.querySelectorAll(t)).filter(e=>{if(e.parentElement instanceof s.r){if(e.parentElement.expanded)return!0}else return!0;return!1}):[]}var d=class extends c.t(e.t){constructor(...e){super(...e),this.currentFocused=null,this.handleFocus=e=>{if(this.slottedTreeItems.length>0){if(e.target===this){this.currentFocused!==null&&s.r.focusItem(this.currentFocused);return}this.contains(e.target)&&(this.setAttribute(`tabindex`,`-1`),this.currentFocused=e.target)}},this.handleBlur=e=>{e.target instanceof HTMLElement&&(e.relatedTarget===null||!this.contains(e.relatedTarget))&&this.setAttribute(`tabindex`,`0`)},this.handleKeyDown=e=>{if(this.slottedTreeItems.length<1)return!0;if(!e.defaultPrevented){let t=this.getVisibleNodes();switch(e.key){case o.s:t.length&&s.r.focusItem(t[0]);return;case`End`:t.length&&s.r.focusItem(t[t.length-1]);return;case o.n:if(e.target&&this.isFocusableElement(e.target)){let t=e.target;t instanceof s.r&&t.childItemLength()>0&&t.expanded?t.expanded=!1:t instanceof s.r&&t.parentElement instanceof s.r&&s.r.focusItem(t.parentElement)}return!1;case o.r:if(e.target&&this.isFocusableElement(e.target)){let t=e.target;t instanceof s.r&&t.childItemLength()>0&&!t.expanded?t.expanded=!0:t instanceof s.r&&t.childItemLength()>0&&this.focusNextNode(1,e.target)}return;case o.t:e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(1,e.target);return;case o.i:e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(-1,e.target);return;case o.a:this.handleClick(e);return}}return!0},this.handleSelectedChange=e=>{if(!e.defaultPrevented){if(!(e.target instanceof Element)||!s.i(e.target))return!0;let t=e.target;t.selected?(this.currentSelected&&this.currentSelected!==t&&(this.currentSelected.selected=!1),this.currentSelected=t):!t.selected&&this.currentSelected===t&&(this.currentSelected=null)}},this.setItems=()=>{let e=this.treeView.querySelector(`[selected]`);this.currentSelected=e,(this.currentFocused===null||!this.contains(this.currentFocused))&&(this.currentFocused=this.getValidFocusableItem()),this.nested=this.checkForNestedItems(),this.getVisibleNodes().forEach(e=>{s.i(e)&&(e.nested=this.nested)})},this.isFocusableElement=e=>s.i(e),this.isSelectedElement=e=>e.selected}slottedTreeItemsChanged(){this.$fastController.isConnected&&this.setItems()}connectedCallback(){super.connectedCallback(),this.setAttribute(`tabindex`,`0`),e.M.enqueue(()=>{this.setItems()})}handleClick(e){if(!e.defaultPrevented){if(!(e.target instanceof Element)||!s.i(e.target))return!0;let t=e.target;t.disabled||(t.selected=!t.selected)}}focusNextNode(e,t){let n=this.getVisibleNodes();if(n){let r=n[n.indexOf(t)+e];a.t(r)&&s.r.focusItem(r)}}getValidFocusableItem(){let e=this.getVisibleNodes(),t=e.findIndex(this.isSelectedElement);return t===-1&&(t=e.findIndex(this.isFocusableElement)),t===-1?null:e[t]}checkForNestedItems(){return this.slottedTreeItems.some(e=>s.i(e)&&e.querySelector(`[data-vvd-component='tree-item']`))}getVisibleNodes(){return u(this,`[data-vvd-component='tree-item']`)}};r.t([e.m({attribute:`render-collapsed-nodes`})],d.prototype,`renderCollapsedNodes`,void 0),r.t([e.A],d.prototype,`currentSelected`,void 0),r.t([e.A],d.prototype,`slottedTreeItems`,void 0);var f=e.p` <template
|
|
2
2
|
${n.t(`treeView`)}
|
|
3
3
|
${c.n({role:`tree`})}
|
|
4
4
|
@keydown="${(e,t)=>e.handleKeyDown(t.event)}"
|
package/tree-view/index.js
CHANGED
|
@@ -84,7 +84,6 @@ var T = class extends S(a) {
|
|
|
84
84
|
let t = e.target;
|
|
85
85
|
/* v8 ignore else -- @preserve */
|
|
86
86
|
t.selected ? (this.currentSelected && this.currentSelected !== t && (this.currentSelected.selected = !1), this.currentSelected = t) : !t.selected && this.currentSelected === t && (this.currentSelected = null);
|
|
87
|
-
return;
|
|
88
87
|
}
|
|
89
88
|
}, this.setItems = () => {
|
|
90
89
|
let e = this.treeView.querySelector("[selected]");
|
|
@@ -107,7 +106,6 @@ var T = class extends S(a) {
|
|
|
107
106
|
if (!(e.target instanceof Element) || !v(e.target)) return !0;
|
|
108
107
|
let t = e.target;
|
|
109
108
|
t.disabled || (t.selected = !t.selected);
|
|
110
|
-
return;
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
focusNextNode(e, t) {
|
package/unbundled/affix.cjs
CHANGED
|
@@ -59,14 +59,14 @@ var affixIconTemplateFactory = (context) => {
|
|
|
59
59
|
${(0, _microsoft_fast_element.slotted)("iconSlottedContent")}
|
|
60
60
|
></slot>`;
|
|
61
61
|
if (!icon && slottedState) return null;
|
|
62
|
-
const iconTemplate = _microsoft_fast_element.html`<${iconTag} :name="${() => icon}" :label="${() => announcement
|
|
62
|
+
const iconTemplate = _microsoft_fast_element.html`<${iconTag} :name="${() => icon}" :label="${() => announcement.label || void 0}"></${iconTag}>`;
|
|
63
63
|
const wrapperTag = _microsoft_fast_element.html.partial(slottedState ? "span" : "slot");
|
|
64
64
|
return _microsoft_fast_element.html`<${wrapperTag}
|
|
65
65
|
class="${() => slottedState ? "icon" : void 0}"
|
|
66
66
|
:name="${() => slottedState ? void 0 : "icon"}"
|
|
67
|
-
aria-hidden="${() => announcement
|
|
68
|
-
:role="${() => announcement
|
|
69
|
-
:ariaLive="${() => announcement
|
|
67
|
+
aria-hidden="${() => announcement.label ? false : ariaHidden}"
|
|
68
|
+
:role="${() => announcement.announceOnUpdate ? "status" : void 0}"
|
|
69
|
+
:ariaLive="${() => announcement.announceOnUpdate ? "polite" : void 0}"
|
|
70
70
|
>
|
|
71
71
|
${iconTemplate}
|
|
72
72
|
</${wrapperTag}>`;
|
package/unbundled/affix.js
CHANGED
|
@@ -58,14 +58,14 @@ var affixIconTemplateFactory = (context) => {
|
|
|
58
58
|
${slotted("iconSlottedContent")}
|
|
59
59
|
></slot>`;
|
|
60
60
|
if (!icon && slottedState) return null;
|
|
61
|
-
const iconTemplate = html`<${iconTag} :name="${() => icon}" :label="${() => announcement
|
|
61
|
+
const iconTemplate = html`<${iconTag} :name="${() => icon}" :label="${() => announcement.label || void 0}"></${iconTag}>`;
|
|
62
62
|
const wrapperTag = html.partial(slottedState ? "span" : "slot");
|
|
63
63
|
return html`<${wrapperTag}
|
|
64
64
|
class="${() => slottedState ? "icon" : void 0}"
|
|
65
65
|
:name="${() => slottedState ? void 0 : "icon"}"
|
|
66
|
-
aria-hidden="${() => announcement
|
|
67
|
-
:role="${() => announcement
|
|
68
|
-
:ariaLive="${() => announcement
|
|
66
|
+
aria-hidden="${() => announcement.label ? false : ariaHidden}"
|
|
67
|
+
:role="${() => announcement.announceOnUpdate ? "status" : void 0}"
|
|
68
|
+
:ariaLive="${() => announcement.announceOnUpdate ? "polite" : void 0}"
|
|
69
69
|
>
|
|
70
70
|
${iconTemplate}
|
|
71
71
|
</${wrapperTag}>`;
|
|
@@ -211,15 +211,15 @@ var BaseColorPicker = (Base) => {
|
|
|
211
211
|
*/
|
|
212
212
|
_renderColorSwatch(iconTag, tooltipTag) {
|
|
213
213
|
return _microsoft_fast_element.html`
|
|
214
|
-
<${tooltipTag} placement="top"
|
|
215
|
-
text="${(x) => x.label ?? x.value}"
|
|
214
|
+
<${tooltipTag} placement="top"
|
|
215
|
+
text="${(x) => x.label ?? x.value}"
|
|
216
216
|
exportparts="vvd-theme-alternate">
|
|
217
217
|
<button
|
|
218
218
|
slot="anchor"
|
|
219
219
|
class="swatch ${(x, c) => (0, _microsoft_fast_web_utilities.classNames)(c.parent.value === x.value ? "selected" : "", c.parent._applyContrastClass(x.value) ? "contrast" : "")}"
|
|
220
220
|
role="gridcell"
|
|
221
221
|
style="--swatch-color: ${(x) => x.value};"
|
|
222
|
-
tabindex="${(
|
|
222
|
+
tabindex="${(_x, c) => c.index === 0 ? "0" : "-1"}"
|
|
223
223
|
aria-label="${(x, c) => c.parent.locale.baseColorPicker.colorSwatchLabel(x.value, x.label, c.parent.value === x.value)}"
|
|
224
224
|
@click="${(x, c) => c.parent._handleSwatchSelection(x.value)}"
|
|
225
225
|
@keydown="${(x, c) => c.parent._handleCellKeydown(c.event, x.value, c.index)}"
|
|
@@ -210,15 +210,15 @@ var BaseColorPicker = (Base) => {
|
|
|
210
210
|
*/
|
|
211
211
|
_renderColorSwatch(iconTag, tooltipTag) {
|
|
212
212
|
return html`
|
|
213
|
-
<${tooltipTag} placement="top"
|
|
214
|
-
text="${(x) => x.label ?? x.value}"
|
|
213
|
+
<${tooltipTag} placement="top"
|
|
214
|
+
text="${(x) => x.label ?? x.value}"
|
|
215
215
|
exportparts="vvd-theme-alternate">
|
|
216
216
|
<button
|
|
217
217
|
slot="anchor"
|
|
218
218
|
class="swatch ${(x, c) => classNames(c.parent.value === x.value ? "selected" : "", c.parent._applyContrastClass(x.value) ? "contrast" : "")}"
|
|
219
219
|
role="gridcell"
|
|
220
220
|
style="--swatch-color: ${(x) => x.value};"
|
|
221
|
-
tabindex="${(
|
|
221
|
+
tabindex="${(_x, c) => c.index === 0 ? "0" : "-1"}"
|
|
222
222
|
aria-label="${(x, c) => c.parent.locale.baseColorPicker.colorSwatchLabel(x.value, x.label, c.parent.value === x.value)}"
|
|
223
223
|
@click="${(x, c) => c.parent._handleSwatchSelection(x.value)}"
|
|
224
224
|
@keydown="${(x, c) => c.parent._handleCellKeydown(c.event, x.value, c.index)}"
|
package/unbundled/button.cjs
CHANGED
|
@@ -34,7 +34,7 @@ var VividFoundationButton = class extends require_delegates_aria.DelegatesAria(r
|
|
|
34
34
|
this.handleUnsupportedDelegatesFocus = () => {
|
|
35
35
|
/* v8 ignore else -- @preserve */
|
|
36
36
|
if (this.$fastController.definition.shadowOptions) {
|
|
37
|
-
if (window.ShadowRoot && !window.ShadowRoot.prototype
|
|
37
|
+
if (window.ShadowRoot && !Object.prototype.hasOwnProperty.call(window.ShadowRoot.prototype, "delegatesFocus") && this.$fastController.definition.shadowOptions.delegatesFocus) Object.defineProperty(this, "focus", {
|
|
38
38
|
value: () => {
|
|
39
39
|
this.control.focus();
|
|
40
40
|
},
|
|
@@ -66,10 +66,10 @@ var VividFoundationButton = class extends require_delegates_aria.DelegatesAria(r
|
|
|
66
66
|
typeChanged(previous, next) {
|
|
67
67
|
/* v8 ignore if -- @preserve */
|
|
68
68
|
if (this.proxy instanceof HTMLInputElement) this.proxy.type = this.type;
|
|
69
|
-
next === "submit"
|
|
70
|
-
previous === "submit"
|
|
71
|
-
next === "reset"
|
|
72
|
-
previous === "reset"
|
|
69
|
+
if (next === "submit") this.addEventListener("click", this.handleSubmission);
|
|
70
|
+
if (previous === "submit") this.removeEventListener("click", this.handleSubmission);
|
|
71
|
+
if (next === "reset") this.addEventListener("click", this.handleFormReset);
|
|
72
|
+
if (previous === "reset") this.removeEventListener("click", this.handleFormReset);
|
|
73
73
|
}
|
|
74
74
|
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
75
75
|
validate() {
|
package/unbundled/button.js
CHANGED
|
@@ -33,7 +33,7 @@ var VividFoundationButton = class extends DelegatesAria(FormAssociated(VividElem
|
|
|
33
33
|
this.handleUnsupportedDelegatesFocus = () => {
|
|
34
34
|
/* v8 ignore else -- @preserve */
|
|
35
35
|
if (this.$fastController.definition.shadowOptions) {
|
|
36
|
-
if (window.ShadowRoot && !window.ShadowRoot.prototype
|
|
36
|
+
if (window.ShadowRoot && !Object.prototype.hasOwnProperty.call(window.ShadowRoot.prototype, "delegatesFocus") && this.$fastController.definition.shadowOptions.delegatesFocus) Object.defineProperty(this, "focus", {
|
|
37
37
|
value: () => {
|
|
38
38
|
this.control.focus();
|
|
39
39
|
},
|
|
@@ -65,10 +65,10 @@ var VividFoundationButton = class extends DelegatesAria(FormAssociated(VividElem
|
|
|
65
65
|
typeChanged(previous, next) {
|
|
66
66
|
/* v8 ignore if -- @preserve */
|
|
67
67
|
if (this.proxy instanceof HTMLInputElement) this.proxy.type = this.type;
|
|
68
|
-
next === "submit"
|
|
69
|
-
previous === "submit"
|
|
70
|
-
next === "reset"
|
|
71
|
-
previous === "reset"
|
|
68
|
+
if (next === "submit") this.addEventListener("click", this.handleSubmission);
|
|
69
|
+
if (previous === "submit") this.removeEventListener("click", this.handleSubmission);
|
|
70
|
+
if (next === "reset") this.addEventListener("click", this.handleFormReset);
|
|
71
|
+
if (previous === "reset") this.removeEventListener("click", this.handleFormReset);
|
|
72
72
|
}
|
|
73
73
|
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
74
74
|
validate() {
|
|
@@ -44,6 +44,7 @@ var Popup = class extends require_vivid_element.VividElement {
|
|
|
44
44
|
this.alternate = false;
|
|
45
45
|
this.placementStrategy = PlacementStrategy.Flip;
|
|
46
46
|
this.animationFrame = false;
|
|
47
|
+
this.shiftCrossAxis = false;
|
|
47
48
|
this.strategy = "fixed";
|
|
48
49
|
this.offset = null;
|
|
49
50
|
this.#autoUpdateCallback = () => {
|
|
@@ -55,14 +56,14 @@ var Popup = class extends require_vivid_element.VividElement {
|
|
|
55
56
|
let middleware = [
|
|
56
57
|
(0, _floating_ui_dom.inline)(),
|
|
57
58
|
placementStrategyMiddlewares[this.placementStrategy],
|
|
59
|
+
(0, _floating_ui_dom.shift)({ crossAxis: this.shiftCrossAxis }),
|
|
58
60
|
(0, _floating_ui_dom.hide)(),
|
|
59
61
|
(0, _floating_ui_dom.size)({ apply({ availableWidth, availableHeight, elements }) {
|
|
60
62
|
Object.assign(elements.floating.style, {
|
|
61
63
|
maxWidth: `${availableWidth}px`,
|
|
62
64
|
maxHeight: `${availableHeight}px`
|
|
63
65
|
});
|
|
64
|
-
} })
|
|
65
|
-
(0, _floating_ui_dom.shift)()
|
|
66
|
+
} })
|
|
66
67
|
];
|
|
67
68
|
let offsetValue = this.offset ?? 0;
|
|
68
69
|
if (this.arrow) {
|
|
@@ -90,6 +91,12 @@ var Popup = class extends require_vivid_element.VividElement {
|
|
|
90
91
|
/**
|
|
91
92
|
* @internal
|
|
92
93
|
*/
|
|
94
|
+
shiftCrossAxisChanged() {
|
|
95
|
+
this.#updateAutoUpdate();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
93
100
|
anchorChanged() {
|
|
94
101
|
this.#updateAutoUpdate();
|
|
95
102
|
}
|
|
@@ -112,7 +119,7 @@ var Popup = class extends require_vivid_element.VividElement {
|
|
|
112
119
|
this.#cleanup?.();
|
|
113
120
|
if (!this.isConnected) return;
|
|
114
121
|
if (this.open && this.controlEl) this.controlEl.classList.add("open");
|
|
115
|
-
if (this.anchorEl && this.open && this.popupEl) this.#cleanup = (0, _floating_ui_dom.autoUpdate)(this.anchorEl, this.popupEl, this.#autoUpdateCallback, { animationFrame: this.animationFrame });
|
|
122
|
+
if (this.anchorEl && this.open && this.popupEl) this.#cleanup = (0, _floating_ui_dom.autoUpdate)(this.anchorEl, this.popupEl, () => void this.#autoUpdateCallback(), { animationFrame: this.animationFrame });
|
|
116
123
|
}
|
|
117
124
|
#togglePopover() {
|
|
118
125
|
if (this.popupEl && this.strategy === "fixed") if (this.open) this.popupEl.showPopover();
|
|
@@ -182,6 +189,10 @@ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
|
182
189
|
mode: "boolean",
|
|
183
190
|
attribute: "animation-frame"
|
|
184
191
|
})], Popup.prototype, "animationFrame", void 0);
|
|
192
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
193
|
+
mode: "boolean",
|
|
194
|
+
attribute: "shift-cross-axis"
|
|
195
|
+
})], Popup.prototype, "shiftCrossAxis", void 0);
|
|
185
196
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "fromView" })], Popup.prototype, "strategy", void 0);
|
|
186
197
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
187
198
|
attribute: "offset",
|
|
@@ -193,7 +204,7 @@ require_decorate.__decorate([_microsoft_fast_element.observable], Popup.prototyp
|
|
|
193
204
|
var popup_default = ":host{display:var(--_popup-display,inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;--scrollbar-track-color:transparent;--scrollbar-thumb-color:color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%);scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.popup-wrapper ::-webkit-scrollbar{width:4px}.popup-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.popup-wrapper ::-webkit-scrollbar-thumb{background-color:var(--scrollbar-fallback-track-color,var(--scrollbar-thumb-color));border:0;border-radius:4px}.popup-wrapper{z-index:var(--_popup-z-index,10);border:none;border-radius:8px;inline-size:max-content;min-inline-size:fit-content;margin:0;padding:0;overflow:visible}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{color:var(--vvd-color-canvas-text);display:grid}.dismissible .popup-content{grid-template-columns:1fr auto;align-content:start}.arrow{z-index:-1;background:var(--vvd-color-surface-4dp);width:8px;height:8px;position:absolute;transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
194
205
|
//#endregion
|
|
195
206
|
//#region src/lib/popup/popup.template.ts
|
|
196
|
-
var getClasses = ({ open, dismissible, alternate }) => (0, _microsoft_fast_web_utilities.classNames)("control", ["open",
|
|
207
|
+
var getClasses = ({ open, dismissible, alternate }) => (0, _microsoft_fast_web_utilities.classNames)("control", ["open", open], ["dismissible", dismissible], ["alternate", alternate]);
|
|
197
208
|
function handlePopover(x) {
|
|
198
209
|
return x.strategy && x.strategy === "fixed" ? "manual" : null;
|
|
199
210
|
}
|
|
@@ -43,6 +43,7 @@ var Popup = class extends VividElement {
|
|
|
43
43
|
this.alternate = false;
|
|
44
44
|
this.placementStrategy = PlacementStrategy.Flip;
|
|
45
45
|
this.animationFrame = false;
|
|
46
|
+
this.shiftCrossAxis = false;
|
|
46
47
|
this.strategy = "fixed";
|
|
47
48
|
this.offset = null;
|
|
48
49
|
this.#autoUpdateCallback = () => {
|
|
@@ -54,14 +55,14 @@ var Popup = class extends VividElement {
|
|
|
54
55
|
let middleware = [
|
|
55
56
|
inline(),
|
|
56
57
|
placementStrategyMiddlewares[this.placementStrategy],
|
|
58
|
+
shift({ crossAxis: this.shiftCrossAxis }),
|
|
57
59
|
hide(),
|
|
58
60
|
size({ apply({ availableWidth, availableHeight, elements }) {
|
|
59
61
|
Object.assign(elements.floating.style, {
|
|
60
62
|
maxWidth: `${availableWidth}px`,
|
|
61
63
|
maxHeight: `${availableHeight}px`
|
|
62
64
|
});
|
|
63
|
-
} })
|
|
64
|
-
shift()
|
|
65
|
+
} })
|
|
65
66
|
];
|
|
66
67
|
let offsetValue = this.offset ?? 0;
|
|
67
68
|
if (this.arrow) {
|
|
@@ -89,6 +90,12 @@ var Popup = class extends VividElement {
|
|
|
89
90
|
/**
|
|
90
91
|
* @internal
|
|
91
92
|
*/
|
|
93
|
+
shiftCrossAxisChanged() {
|
|
94
|
+
this.#updateAutoUpdate();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
92
99
|
anchorChanged() {
|
|
93
100
|
this.#updateAutoUpdate();
|
|
94
101
|
}
|
|
@@ -111,7 +118,7 @@ var Popup = class extends VividElement {
|
|
|
111
118
|
this.#cleanup?.();
|
|
112
119
|
if (!this.isConnected) return;
|
|
113
120
|
if (this.open && this.controlEl) this.controlEl.classList.add("open");
|
|
114
|
-
if (this.anchorEl && this.open && this.popupEl) this.#cleanup = autoUpdate(this.anchorEl, this.popupEl, this.#autoUpdateCallback, { animationFrame: this.animationFrame });
|
|
121
|
+
if (this.anchorEl && this.open && this.popupEl) this.#cleanup = autoUpdate(this.anchorEl, this.popupEl, () => void this.#autoUpdateCallback(), { animationFrame: this.animationFrame });
|
|
115
122
|
}
|
|
116
123
|
#togglePopover() {
|
|
117
124
|
if (this.popupEl && this.strategy === "fixed") if (this.open) this.popupEl.showPopover();
|
|
@@ -181,6 +188,10 @@ __decorate([attr({
|
|
|
181
188
|
mode: "boolean",
|
|
182
189
|
attribute: "animation-frame"
|
|
183
190
|
})], Popup.prototype, "animationFrame", void 0);
|
|
191
|
+
__decorate([attr({
|
|
192
|
+
mode: "boolean",
|
|
193
|
+
attribute: "shift-cross-axis"
|
|
194
|
+
})], Popup.prototype, "shiftCrossAxis", void 0);
|
|
184
195
|
__decorate([attr({ mode: "fromView" })], Popup.prototype, "strategy", void 0);
|
|
185
196
|
__decorate([attr({
|
|
186
197
|
attribute: "offset",
|
|
@@ -192,7 +203,7 @@ __decorate([observable], Popup.prototype, "anchor", void 0);
|
|
|
192
203
|
var popup_default = ":host{display:var(--_popup-display,inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;--scrollbar-track-color:transparent;--scrollbar-thumb-color:color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%);scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.popup-wrapper ::-webkit-scrollbar{width:4px}.popup-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.popup-wrapper ::-webkit-scrollbar-thumb{background-color:var(--scrollbar-fallback-track-color,var(--scrollbar-thumb-color));border:0;border-radius:4px}.popup-wrapper{z-index:var(--_popup-z-index,10);border:none;border-radius:8px;inline-size:max-content;min-inline-size:fit-content;margin:0;padding:0;overflow:visible}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{color:var(--vvd-color-canvas-text);display:grid}.dismissible .popup-content{grid-template-columns:1fr auto;align-content:start}.arrow{z-index:-1;background:var(--vvd-color-surface-4dp);width:8px;height:8px;position:absolute;transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
193
204
|
//#endregion
|
|
194
205
|
//#region src/lib/popup/popup.template.ts
|
|
195
|
-
var getClasses = ({ open, dismissible, alternate }) => classNames("control", ["open",
|
|
206
|
+
var getClasses = ({ open, dismissible, alternate }) => classNames("control", ["open", open], ["dismissible", dismissible], ["alternate", alternate]);
|
|
196
207
|
function handlePopover(x) {
|
|
197
208
|
return x.strategy && x.strategy === "fixed" ? "manual" : null;
|
|
198
209
|
}
|
|
@@ -266,7 +266,7 @@ var Slider = class extends require_localized.Localized(require_delegates_aria.De
|
|
|
266
266
|
* @public
|
|
267
267
|
*/
|
|
268
268
|
increment() {
|
|
269
|
-
const newVal = this.direction !== _microsoft_fast_web_utilities.Direction.rtl && this.orientation !== _microsoft_fast_web_utilities.Orientation.vertical ? Number(this.value) +
|
|
269
|
+
const newVal = this.direction !== _microsoft_fast_web_utilities.Direction.rtl && this.orientation !== _microsoft_fast_web_utilities.Orientation.vertical ? Number(this.value) + this.step : Number(this.value) - this.step;
|
|
270
270
|
this.value = this.#roundToNearestStep(newVal).toString();
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
@@ -275,7 +275,7 @@ var Slider = class extends require_localized.Localized(require_delegates_aria.De
|
|
|
275
275
|
* @public
|
|
276
276
|
*/
|
|
277
277
|
decrement() {
|
|
278
|
-
const newVal = this.direction !== _microsoft_fast_web_utilities.Direction.rtl && this.orientation !== _microsoft_fast_web_utilities.Orientation.vertical ? Number(this.value) -
|
|
278
|
+
const newVal = this.direction !== _microsoft_fast_web_utilities.Direction.rtl && this.orientation !== _microsoft_fast_web_utilities.Orientation.vertical ? Number(this.value) - this.step : Number(this.value) + this.step;
|
|
279
279
|
this.value = this.#roundToNearestStep(newVal).toString();
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
@@ -297,7 +297,7 @@ var Slider = class extends require_localized.Localized(require_delegates_aria.De
|
|
|
297
297
|
* are not whole numbers
|
|
298
298
|
*/
|
|
299
299
|
updateStepMultiplier() {
|
|
300
|
-
const stepString = this.step
|
|
300
|
+
const stepString = String(this.step);
|
|
301
301
|
const decimalPlacesOfStep = this.step % 1 ? stepString.length - stepString.indexOf(".") - 1 : 0;
|
|
302
302
|
this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
|
|
303
303
|
}
|
|
@@ -265,7 +265,7 @@ var Slider = class extends Localized(DelegatesAria(FormAssociated(VividElement))
|
|
|
265
265
|
* @public
|
|
266
266
|
*/
|
|
267
267
|
increment() {
|
|
268
|
-
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? Number(this.value) +
|
|
268
|
+
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? Number(this.value) + this.step : Number(this.value) - this.step;
|
|
269
269
|
this.value = this.#roundToNearestStep(newVal).toString();
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
@@ -274,7 +274,7 @@ var Slider = class extends Localized(DelegatesAria(FormAssociated(VividElement))
|
|
|
274
274
|
* @public
|
|
275
275
|
*/
|
|
276
276
|
decrement() {
|
|
277
|
-
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? Number(this.value) -
|
|
277
|
+
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? Number(this.value) - this.step : Number(this.value) + this.step;
|
|
278
278
|
this.value = this.#roundToNearestStep(newVal).toString();
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
@@ -296,7 +296,7 @@ var Slider = class extends Localized(DelegatesAria(FormAssociated(VividElement))
|
|
|
296
296
|
* are not whole numbers
|
|
297
297
|
*/
|
|
298
298
|
updateStepMultiplier() {
|
|
299
|
-
const stepString = this.step
|
|
299
|
+
const stepString = String(this.step);
|
|
300
300
|
const decimalPlacesOfStep = this.step % 1 ? stepString.length - stepString.indexOf(".") - 1 : 0;
|
|
301
301
|
this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
|
|
302
302
|
}
|
|
@@ -227,7 +227,7 @@ var getIndicatorIcon = (x) => {
|
|
|
227
227
|
if (x.checkedAppearance === "tick-only") return x.checked ? "check-line" : "";
|
|
228
228
|
return `${x.controlType === "checkbox" ? "checkbox" : "radio"}-${x.checked ? "checked" : "unchecked"}-2-line`;
|
|
229
229
|
};
|
|
230
|
-
var getClasses = ({ connotation, disabled, checked, controlType, text, textSecondary, icon, metaSlottedContent, checkTrailing }) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${connotation}`, Boolean(connotation)], ["disabled",
|
|
230
|
+
var getClasses = ({ connotation, disabled, checked, controlType, text, textSecondary, icon, metaSlottedContent, checkTrailing }) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${connotation}`, Boolean(connotation)], ["disabled", disabled], ["selected", Boolean(controlType && checked)], ["trailing", Boolean(controlType && (checkTrailing || Boolean(icon)))], ["item-checkbox", controlType === "checkbox"], ["item-radio", controlType === "radio"], ["two-lines", Boolean(text?.length) && Boolean(textSecondary?.length)], ["has-meta", Boolean(metaSlottedContent?.length)]);
|
|
231
231
|
function checkIndicator(context) {
|
|
232
232
|
const iconTag = context.tagFor(require_definition.Icon);
|
|
233
233
|
return _microsoft_fast_element.html`${(0, _microsoft_fast_element.when)((x) => Boolean(x.controlType), _microsoft_fast_element.html`<span class="action"><${iconTag} class="icon" name="${(x) => getIndicatorIcon(x)}"></${iconTag}></span>`)}`;
|
|
@@ -226,7 +226,7 @@ var getIndicatorIcon = (x) => {
|
|
|
226
226
|
if (x.checkedAppearance === "tick-only") return x.checked ? "check-line" : "";
|
|
227
227
|
return `${x.controlType === "checkbox" ? "checkbox" : "radio"}-${x.checked ? "checked" : "unchecked"}-2-line`;
|
|
228
228
|
};
|
|
229
|
-
var getClasses = ({ connotation, disabled, checked, controlType, text, textSecondary, icon, metaSlottedContent, checkTrailing }) => classNames("base", [`connotation-${connotation}`, Boolean(connotation)], ["disabled",
|
|
229
|
+
var getClasses = ({ connotation, disabled, checked, controlType, text, textSecondary, icon, metaSlottedContent, checkTrailing }) => classNames("base", [`connotation-${connotation}`, Boolean(connotation)], ["disabled", disabled], ["selected", Boolean(controlType && checked)], ["trailing", Boolean(controlType && (checkTrailing || Boolean(icon)))], ["item-checkbox", controlType === "checkbox"], ["item-radio", controlType === "radio"], ["two-lines", Boolean(text?.length) && Boolean(textSecondary?.length)], ["has-meta", Boolean(metaSlottedContent?.length)]);
|
|
230
230
|
function checkIndicator(context) {
|
|
231
231
|
const iconTag = context.tagFor(Icon);
|
|
232
232
|
return html`${when((x) => Boolean(x.controlType), html`<span class="action"><${iconTag} class="icon" name="${(x) => getIndicatorIcon(x)}"></${iconTag}></span>`)}`;
|
|
@@ -54,7 +54,7 @@ var Menu = class extends require_anchored.Anchored(require_delegates_aria.Delega
|
|
|
54
54
|
};
|
|
55
55
|
this.handleExpandedChanged = (e) => {
|
|
56
56
|
const changedItem = e.target;
|
|
57
|
-
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded
|
|
57
|
+
if (this.expandedItem !== null && changedItem === this.expandedItem && !changedItem.expanded) this.expandedItem = null;
|
|
58
58
|
if (changedItem.expanded) this.expandedItem = changedItem;
|
|
59
59
|
};
|
|
60
60
|
this.removeItemListeners = () => {
|
|
@@ -179,7 +179,7 @@ var Menu = class extends require_anchored.Anchored(require_delegates_aria.Delega
|
|
|
179
179
|
}
|
|
180
180
|
openChanged(_, newValue) {
|
|
181
181
|
if (newValue) this._popupEl?.show().then(() => this.focus());
|
|
182
|
-
newValue ?
|
|
182
|
+
this.$emit(newValue ? "open" : "close", void 0, { bubbles: false });
|
|
183
183
|
if (this._anchorEl) this.#updateAnchor(this._anchorEl);
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
@@ -53,7 +53,7 @@ var Menu = class extends Anchored(DelegatesAria(VividElement)) {
|
|
|
53
53
|
};
|
|
54
54
|
this.handleExpandedChanged = (e) => {
|
|
55
55
|
const changedItem = e.target;
|
|
56
|
-
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded
|
|
56
|
+
if (this.expandedItem !== null && changedItem === this.expandedItem && !changedItem.expanded) this.expandedItem = null;
|
|
57
57
|
if (changedItem.expanded) this.expandedItem = changedItem;
|
|
58
58
|
};
|
|
59
59
|
this.removeItemListeners = () => {
|
|
@@ -178,7 +178,7 @@ var Menu = class extends Anchored(DelegatesAria(VividElement)) {
|
|
|
178
178
|
}
|
|
179
179
|
openChanged(_, newValue) {
|
|
180
180
|
if (newValue) this._popupEl?.show().then(() => this.focus());
|
|
181
|
-
newValue ?
|
|
181
|
+
this.$emit(newValue ? "open" : "close", void 0, { bubbles: false });
|
|
182
182
|
if (this._anchorEl) this.#updateAnchor(this._anchorEl);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
@@ -22,7 +22,7 @@ function formatTime(time) {
|
|
|
22
22
|
if (!time || Number.isNaN(time)) return "0:00";
|
|
23
23
|
const min = Math.floor(time / 60);
|
|
24
24
|
const sec = Math.floor(time % 60);
|
|
25
|
-
return min
|
|
25
|
+
return `${min}:${sec < 10 ? `0${sec}` : sec}`;
|
|
26
26
|
}
|
|
27
27
|
var PAUSE = true;
|
|
28
28
|
var PLAY = false;
|
|
@@ -44,6 +44,75 @@ var validSkipByConverter = {
|
|
|
44
44
|
* @event {CustomEvent<undefined>} pause - Fires when the audio playback is paused.
|
|
45
45
|
*/
|
|
46
46
|
var AudioPlayer = class extends require_localized.Localized(require_vivid_element.VividElement) {
|
|
47
|
+
constructor(..._args) {
|
|
48
|
+
super(..._args);
|
|
49
|
+
this.playButtonAriaLabel = null;
|
|
50
|
+
this.pauseButtonAriaLabel = null;
|
|
51
|
+
this.sliderAriaLabel = null;
|
|
52
|
+
this.skipForwardButtonAriaLabel = null;
|
|
53
|
+
this.skipBackwardButtonAriaLabel = null;
|
|
54
|
+
this.disabled = false;
|
|
55
|
+
this.notime = false;
|
|
56
|
+
this.playbackRates = null;
|
|
57
|
+
this.#playerEl = new Audio();
|
|
58
|
+
this.#isProgrammaticSliderUpdate = false;
|
|
59
|
+
this.durationFallback = false;
|
|
60
|
+
this.#onPlay = () => {
|
|
61
|
+
if (!this.#sliderEl?.isDragging) this.$emit("play", void 0, { bubbles: false });
|
|
62
|
+
};
|
|
63
|
+
this.#onPause = () => {
|
|
64
|
+
if (!this.#sliderEl?.isDragging) this.$emit("pause", void 0, { bubbles: false });
|
|
65
|
+
};
|
|
66
|
+
this.#pausedChanged = (pausing) => {
|
|
67
|
+
if (pausing === this.paused) {
|
|
68
|
+
this.#setPausedState();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!this.paused) this.#playerEl.pause();
|
|
72
|
+
else {
|
|
73
|
+
this.#updateProgress();
|
|
74
|
+
this.#playerEl.play();
|
|
75
|
+
}
|
|
76
|
+
this.#setPausedState();
|
|
77
|
+
};
|
|
78
|
+
this.#updateProgress = () => {
|
|
79
|
+
_microsoft_fast_element.Observable.notify(this, "currentTime");
|
|
80
|
+
const duration = this.duration;
|
|
81
|
+
const currentTime = this.currentTime;
|
|
82
|
+
const isValid = Number.isFinite(duration) && duration > 0 && Number.isFinite(currentTime) && currentTime >= 0;
|
|
83
|
+
const percent = isValid ? currentTime / duration * 100 : 0;
|
|
84
|
+
/* v8 ignore else -- @preserve */
|
|
85
|
+
if (this.#sliderEl) {
|
|
86
|
+
this.#isProgrammaticSliderUpdate = true;
|
|
87
|
+
this.#sliderEl.value = percent.toString();
|
|
88
|
+
this.#isProgrammaticSliderUpdate = false;
|
|
89
|
+
}
|
|
90
|
+
if (isValid && percent === 100) this.pause();
|
|
91
|
+
};
|
|
92
|
+
this.#updateTotalTime = () => {
|
|
93
|
+
_microsoft_fast_element.Observable.notify(this, "duration");
|
|
94
|
+
if (!Number.isFinite(this.#playerEl.duration) || this.#playerEl.duration <= 0) {
|
|
95
|
+
if (this.durationFallback) this.#fetchAndCacheAudioBuffer();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.#updateCurrentTimeOnSliderChange = () => {
|
|
99
|
+
if (!this.paused && this.#sliderEl.isDragging) {
|
|
100
|
+
this.pause();
|
|
101
|
+
this.#dragInterval = window.setInterval(() => {
|
|
102
|
+
/* v8 ignore else -- @preserve */
|
|
103
|
+
if (!this.#sliderEl.isDragging || !this.isConnected) {
|
|
104
|
+
clearInterval(this.#dragInterval);
|
|
105
|
+
if (this.isConnected) this.play();
|
|
106
|
+
}
|
|
107
|
+
}, 0);
|
|
108
|
+
}
|
|
109
|
+
if (this.#isProgrammaticSliderUpdate) return;
|
|
110
|
+
this.currentTime = this.duration * Number(this.#sliderEl.value) / 100;
|
|
111
|
+
};
|
|
112
|
+
this.#setPausedState = () => {
|
|
113
|
+
_microsoft_fast_element.Observable.notify(this, "paused");
|
|
114
|
+
};
|
|
115
|
+
}
|
|
47
116
|
/**
|
|
48
117
|
* @internal
|
|
49
118
|
*/
|
|
@@ -133,76 +202,6 @@ var AudioPlayer = class extends require_localized.Localized(require_vivid_elemen
|
|
|
133
202
|
}
|
|
134
203
|
#playerEl;
|
|
135
204
|
#isProgrammaticSliderUpdate;
|
|
136
|
-
constructor() {
|
|
137
|
-
super();
|
|
138
|
-
this.playButtonAriaLabel = null;
|
|
139
|
-
this.pauseButtonAriaLabel = null;
|
|
140
|
-
this.sliderAriaLabel = null;
|
|
141
|
-
this.skipForwardButtonAriaLabel = null;
|
|
142
|
-
this.skipBackwardButtonAriaLabel = null;
|
|
143
|
-
this.disabled = false;
|
|
144
|
-
this.notime = false;
|
|
145
|
-
this.playbackRates = null;
|
|
146
|
-
this.#playerEl = new Audio();
|
|
147
|
-
this.#isProgrammaticSliderUpdate = false;
|
|
148
|
-
this.durationFallback = false;
|
|
149
|
-
this.#onPlay = () => {
|
|
150
|
-
if (!this.#sliderEl?.isDragging) this.$emit("play", void 0, { bubbles: false });
|
|
151
|
-
};
|
|
152
|
-
this.#onPause = () => {
|
|
153
|
-
if (!this.#sliderEl?.isDragging) this.$emit("pause", void 0, { bubbles: false });
|
|
154
|
-
};
|
|
155
|
-
this.#pausedChanged = (pausing) => {
|
|
156
|
-
if (pausing === this.paused) {
|
|
157
|
-
this.#setPausedState();
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (!this.paused) this.#playerEl.pause();
|
|
161
|
-
else {
|
|
162
|
-
this.#updateProgress();
|
|
163
|
-
this.#playerEl.play();
|
|
164
|
-
}
|
|
165
|
-
this.#setPausedState();
|
|
166
|
-
};
|
|
167
|
-
this.#updateProgress = () => {
|
|
168
|
-
_microsoft_fast_element.Observable.notify(this, "currentTime");
|
|
169
|
-
const duration = this.duration;
|
|
170
|
-
const currentTime = this.currentTime;
|
|
171
|
-
const isValid = Number.isFinite(duration) && duration > 0 && Number.isFinite(currentTime) && currentTime >= 0;
|
|
172
|
-
const percent = isValid ? currentTime / duration * 100 : 0;
|
|
173
|
-
/* v8 ignore else -- @preserve */
|
|
174
|
-
if (this.#sliderEl) {
|
|
175
|
-
this.#isProgrammaticSliderUpdate = true;
|
|
176
|
-
this.#sliderEl.value = percent.toString();
|
|
177
|
-
this.#isProgrammaticSliderUpdate = false;
|
|
178
|
-
}
|
|
179
|
-
if (isValid && percent === 100) this.pause();
|
|
180
|
-
};
|
|
181
|
-
this.#updateTotalTime = () => {
|
|
182
|
-
_microsoft_fast_element.Observable.notify(this, "duration");
|
|
183
|
-
if (!Number.isFinite(this.#playerEl.duration) || this.#playerEl.duration <= 0) {
|
|
184
|
-
if (this.durationFallback) this.#fetchAndCacheAudioBuffer();
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
this.#updateCurrentTimeOnSliderChange = () => {
|
|
188
|
-
if (!this.paused && this.#sliderEl.isDragging) {
|
|
189
|
-
this.pause();
|
|
190
|
-
this.#dragInterval = window.setInterval(() => {
|
|
191
|
-
/* v8 ignore else -- @preserve */
|
|
192
|
-
if (!this.#sliderEl.isDragging || !this.isConnected) {
|
|
193
|
-
clearInterval(this.#dragInterval);
|
|
194
|
-
if (this.isConnected) this.play();
|
|
195
|
-
}
|
|
196
|
-
}, 0);
|
|
197
|
-
}
|
|
198
|
-
if (this.#isProgrammaticSliderUpdate) return;
|
|
199
|
-
/* v8 ignore else -- @preserve */
|
|
200
|
-
if (this.#playerEl) this.currentTime = this.duration * Number(this.#sliderEl.value) / 100;
|
|
201
|
-
};
|
|
202
|
-
this.#setPausedState = () => {
|
|
203
|
-
_microsoft_fast_element.Observable.notify(this, "paused");
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
205
|
connectedCallback() {
|
|
207
206
|
super.connectedCallback();
|
|
208
207
|
this.#playerEl.addEventListener("timeupdate", this.#updateProgress);
|
|
@@ -275,7 +274,7 @@ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
|
275
274
|
})], AudioPlayer.prototype, "durationFallback", void 0);
|
|
276
275
|
//#endregion
|
|
277
276
|
//#region src/lib/audio-player/audio-player.template.ts
|
|
278
|
-
var getClasses = ({ notime, disabled, duration, skipBy, playbackRates }) => (0, _microsoft_fast_web_utilities.classNames)(["disabled",
|
|
277
|
+
var getClasses = ({ notime, disabled, duration, skipBy, playbackRates }) => (0, _microsoft_fast_web_utilities.classNames)(["disabled", disabled || !duration], ["two-lines", !notime && (Boolean(Number(skipBy)) || Boolean(playbackRates))], ["playback", Boolean(playbackRates)]);
|
|
279
278
|
var isMenuItemChekced = (playbackRate, { parent }) => {
|
|
280
279
|
return playbackRate === parent.playbackRate;
|
|
281
280
|
};
|
|
@@ -330,12 +329,10 @@ function renderSlider(context) {
|
|
|
330
329
|
}
|
|
331
330
|
function renderTimestamp() {
|
|
332
331
|
return _microsoft_fast_element.html` <div class="time-stamp">
|
|
333
|
-
<span class="current-time"
|
|
334
|
-
>${(x) => formatTime(x.currentTime || 0)}</span
|
|
335
|
-
>
|
|
332
|
+
<span class="current-time">${(x) => formatTime(x.currentTime || 0)}</span>
|
|
336
333
|
${(0, _microsoft_fast_element.when)((x) => x.duration && x.duration !== Infinity, _microsoft_fast_element.html`
|
|
337
334
|
<span>/</span>
|
|
338
|
-
<span class="total-time">${(x) => formatTime(x
|
|
335
|
+
<span class="total-time">${(x) => formatTime(x.duration)}</span>
|
|
339
336
|
`)}
|
|
340
337
|
</div>`;
|
|
341
338
|
}
|