@vonage/vivid 5.1.0 → 5.2.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/audio-player/definition.cjs +37 -4
- package/audio-player/definition.js +37 -4
- package/audio-player/index.cjs +25 -25
- package/audio-player/index.js +86 -62
- package/bundled/definition13.cjs +2 -2
- package/bundled/definition13.js +4 -4
- package/bundled/definition19.cjs +18 -15
- package/bundled/definition19.js +85 -77
- package/bundled/definition6.cjs +6 -6
- package/bundled/definition6.js +34 -31
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +2 -1
- package/bundled/picker-field.template.cjs +18 -13
- package/bundled/picker-field.template.js +44 -36
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.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 +17 -7
- package/combobox/definition.cjs +12 -5
- package/combobox/definition.js +12 -5
- package/combobox/index.cjs +15 -11
- package/combobox/index.js +83 -76
- package/custom-elements.json +95 -3
- package/dial-pad/definition.cjs +51 -1
- package/dial-pad/definition.js +52 -2
- package/dial-pad/index.cjs +21 -18
- package/dial-pad/index.js +123 -92
- package/file-picker/definition.cjs +14 -5
- package/file-picker/definition.js +15 -6
- package/file-picker/index.cjs +12 -9
- package/file-picker/index.js +102 -92
- package/lib/audio-player/audio-player.d.ts +4 -0
- package/lib/combobox/combobox.d.ts +483 -66
- package/lib/date-picker/date-picker.d.ts +839 -827
- package/lib/date-range-picker/date-range-picker.d.ts +580 -574
- package/lib/date-time-picker/date-time-picker.d.ts +863 -851
- package/lib/dial-pad/dial-pad.template.d.ts +1 -1
- package/lib/dial-pad/locale.d.ts +1 -0
- package/lib/file-picker/file-picker.d.ts +483 -66
- package/lib/menu/menu.d.ts +1 -0
- package/lib/number-field/number-field.d.ts +1 -0
- package/lib/searchable-select/searchable-select.d.ts +505 -88
- package/lib/select/select.d.ts +470 -53
- package/lib/text-area/text-area.d.ts +1 -0
- package/lib/text-field/text-field.d.ts +1 -0
- package/lib/time-picker/time-picker.d.ts +551 -545
- package/locales/de-DE.cjs +2 -1
- package/locales/de-DE.js +2 -1
- package/locales/en-GB.cjs +2 -1
- package/locales/en-GB.js +2 -1
- package/locales/en-US.cjs +2 -1
- package/locales/en-US.js +2 -1
- package/locales/ja-JP.cjs +2 -1
- package/locales/ja-JP.js +2 -1
- package/locales/zh-CN.cjs +2 -1
- package/locales/zh-CN.js +2 -1
- package/menu/definition.cjs +6 -2
- package/menu/definition.js +7 -3
- package/number-field/definition.cjs +2 -2
- package/number-field/definition.js +3 -3
- package/number-field/index.cjs +9 -9
- package/number-field/index.js +28 -27
- package/package.json +1 -1
- package/searchable-select/definition.cjs +27 -18
- package/searchable-select/definition.js +28 -19
- package/searchable-select/index.cjs +28 -25
- package/searchable-select/index.js +150 -141
- package/select/definition.cjs +14 -6
- package/select/definition.js +14 -6
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/form-elements/with-contextual-help.d.ts +1 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +442 -439
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +442 -439
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +584 -578
- package/shared/picker-field/mixins/single-date-picker.d.ts +696 -687
- package/shared/picker-field/mixins/single-value-picker.d.ts +441 -438
- package/shared/picker-field/mixins/time-selection-picker.d.ts +562 -556
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +551 -545
- package/shared/picker-field/picker-field.d.ts +483 -66
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -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/text-area/definition.cjs +1 -1
- package/text-area/definition.js +1 -1
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/definition.cjs +1 -1
- package/text-field/definition.js +1 -1
- package/unbundled/picker-field.template.cjs +11 -3
- package/unbundled/picker-field.template.js +11 -3
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/unbundled/with-contextual-help.cjs +11 -0
- package/unbundled/with-contextual-help.js +11 -0
- package/vivid.api.json +30 -0
|
@@ -119,15 +119,43 @@ class AudioPlayer extends localized.Localized(vividElement.VividElement) {
|
|
|
119
119
|
}
|
|
120
120
|
srcChanged() {
|
|
121
121
|
if (this.src === void 0) {
|
|
122
|
-
this
|
|
122
|
+
this.setSrc("");
|
|
123
123
|
} else {
|
|
124
|
-
this
|
|
124
|
+
this.setSrc(this.src);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
revokeSrc() {
|
|
128
|
+
const src = this.getCurrentSrc();
|
|
129
|
+
if (src && src.startsWith("blob:")) {
|
|
130
|
+
URL.revokeObjectURL(src);
|
|
125
131
|
}
|
|
132
|
+
}
|
|
133
|
+
getCurrentSrc() {
|
|
134
|
+
return this.#playerEl.currentSrc || this.#playerEl.src || "";
|
|
135
|
+
}
|
|
136
|
+
canPlayType(type) {
|
|
137
|
+
return this.#playerEl.canPlayType(type) !== "";
|
|
138
|
+
}
|
|
139
|
+
setSrc(url, blob) {
|
|
140
|
+
const prevSrc = this.getCurrentSrc();
|
|
141
|
+
this.revokeSrc();
|
|
126
142
|
this.#audioBuffer = void 0;
|
|
127
143
|
if (this.#fetchAbortController) {
|
|
128
144
|
this.#fetchAbortController.abort();
|
|
145
|
+
this.#fetchAbortController = void 0;
|
|
146
|
+
}
|
|
147
|
+
const newSrc = blob && (this.canPlayType(blob.type) || !url) ? URL.createObjectURL(blob) : url;
|
|
148
|
+
if (prevSrc) {
|
|
149
|
+
this.#playerEl.removeAttribute("src");
|
|
150
|
+
}
|
|
151
|
+
if (newSrc || url) {
|
|
152
|
+
try {
|
|
153
|
+
this.#playerEl.src = newSrc;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.log("Falling back to original URL due to error:", error);
|
|
156
|
+
this.#playerEl.src = url;
|
|
157
|
+
}
|
|
129
158
|
}
|
|
130
|
-
this.#fetchAbortController = void 0;
|
|
131
159
|
}
|
|
132
160
|
get playbackRate() {
|
|
133
161
|
fastElement.Observable.track(this, "playbackRate");
|
|
@@ -151,13 +179,18 @@ class AudioPlayer extends localized.Localized(vividElement.VividElement) {
|
|
|
151
179
|
const signal = this.#fetchAbortController.signal;
|
|
152
180
|
try {
|
|
153
181
|
const response = await fetch(this.src, { signal });
|
|
154
|
-
const
|
|
182
|
+
const blob = await response.blob();
|
|
183
|
+
this.setSrc(this.src, blob);
|
|
184
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
155
185
|
const audioContext = new window.AudioContext();
|
|
156
186
|
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
|
|
157
187
|
audioContext.close();
|
|
158
188
|
this.#audioBuffer = audioBuffer;
|
|
159
189
|
fastElement.Observable.notify(this, "duration");
|
|
160
190
|
} catch (e) {
|
|
191
|
+
if (e instanceof Error && e.name !== "AbortError") {
|
|
192
|
+
console.error("Error loading audio:", e);
|
|
193
|
+
}
|
|
161
194
|
} finally {
|
|
162
195
|
this.#fetchAbortController = void 0;
|
|
163
196
|
}
|
|
@@ -115,15 +115,43 @@ class AudioPlayer extends Localized(VividElement) {
|
|
|
115
115
|
}
|
|
116
116
|
srcChanged() {
|
|
117
117
|
if (this.src === void 0) {
|
|
118
|
-
this
|
|
118
|
+
this.setSrc("");
|
|
119
119
|
} else {
|
|
120
|
-
this
|
|
120
|
+
this.setSrc(this.src);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
revokeSrc() {
|
|
124
|
+
const src = this.getCurrentSrc();
|
|
125
|
+
if (src && src.startsWith("blob:")) {
|
|
126
|
+
URL.revokeObjectURL(src);
|
|
121
127
|
}
|
|
128
|
+
}
|
|
129
|
+
getCurrentSrc() {
|
|
130
|
+
return this.#playerEl.currentSrc || this.#playerEl.src || "";
|
|
131
|
+
}
|
|
132
|
+
canPlayType(type) {
|
|
133
|
+
return this.#playerEl.canPlayType(type) !== "";
|
|
134
|
+
}
|
|
135
|
+
setSrc(url, blob) {
|
|
136
|
+
const prevSrc = this.getCurrentSrc();
|
|
137
|
+
this.revokeSrc();
|
|
122
138
|
this.#audioBuffer = void 0;
|
|
123
139
|
if (this.#fetchAbortController) {
|
|
124
140
|
this.#fetchAbortController.abort();
|
|
141
|
+
this.#fetchAbortController = void 0;
|
|
142
|
+
}
|
|
143
|
+
const newSrc = blob && (this.canPlayType(blob.type) || !url) ? URL.createObjectURL(blob) : url;
|
|
144
|
+
if (prevSrc) {
|
|
145
|
+
this.#playerEl.removeAttribute("src");
|
|
146
|
+
}
|
|
147
|
+
if (newSrc || url) {
|
|
148
|
+
try {
|
|
149
|
+
this.#playerEl.src = newSrc;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.log("Falling back to original URL due to error:", error);
|
|
152
|
+
this.#playerEl.src = url;
|
|
153
|
+
}
|
|
125
154
|
}
|
|
126
|
-
this.#fetchAbortController = void 0;
|
|
127
155
|
}
|
|
128
156
|
get playbackRate() {
|
|
129
157
|
Observable.track(this, "playbackRate");
|
|
@@ -147,13 +175,18 @@ class AudioPlayer extends Localized(VividElement) {
|
|
|
147
175
|
const signal = this.#fetchAbortController.signal;
|
|
148
176
|
try {
|
|
149
177
|
const response = await fetch(this.src, { signal });
|
|
150
|
-
const
|
|
178
|
+
const blob = await response.blob();
|
|
179
|
+
this.setSrc(this.src, blob);
|
|
180
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
151
181
|
const audioContext = new window.AudioContext();
|
|
152
182
|
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
|
|
153
183
|
audioContext.close();
|
|
154
184
|
this.#audioBuffer = audioBuffer;
|
|
155
185
|
Observable.notify(this, "duration");
|
|
156
186
|
} catch (e) {
|
|
187
|
+
if (e instanceof Error && e.name !== "AbortError") {
|
|
188
|
+
console.error("Error loading audio:", e);
|
|
189
|
+
}
|
|
157
190
|
} finally {
|
|
158
191
|
this.#fetchAbortController = void 0;
|
|
159
192
|
}
|
package/audio-player/index.cjs
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";const u=require("../bundled/definition3.cjs"),h=require("../bundled/definition5.cjs"),y=require("../bundled/definition6.cjs"),
|
|
1
|
+
"use strict";const u=require("../bundled/definition3.cjs"),h=require("../bundled/definition5.cjs"),y=require("../bundled/definition6.cjs"),r=require("../bundled/vivid-element.cjs"),m=require("../bundled/definition7.cjs"),c=require("../bundled/enums.cjs"),f=require("../bundled/localized.cjs"),g=require("../bundled/playbackRates.cjs"),v=require("../bundled/repeat.cjs"),B=require("../bundled/class-names.cjs"),d=require("../bundled/when.cjs"),$=':host{display:block}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:8px;inline-size:100%;user-select:none}.base.disabled{color:var(--vvd-color-neutral-300)}.base .slider{flex:1;grid-area:slider}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback-button{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:"slider" "controls";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:"slider slider" "controls playback";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}';var w=Object.defineProperty,o=(i,e,t,s)=>{for(var a=void 0,l=i.length-1,p;l>=0;l--)(p=i[l])&&(a=p(e,t,a)||a);return a&&w(e,t,a),a};const k={FORWARD:1,BACKWARD:-1};function b(i){if(!i||Number.isNaN(i))return"0:00";const e=Math.floor(i/60),t=Math.floor(i%60);return e+":"+(t<10?"0"+t:t)}const A=!0,L=!1,T={toView(i){return i},fromView(i){return Object.values(c.MediaSkipBy).includes(i)?i:void 0}};class n extends f.Localized(r.VividElement){constructor(){super(),this.playButtonAriaLabel=null,this.pauseButtonAriaLabel=null,this.sliderAriaLabel=null,this.skipForwardButtonAriaLabel=null,this.skipBackwardButtonAriaLabel=null,this.disabled=!1,this.notime=!1,this.playbackRates=null,this.#t=new Audio,this.#n=!1,this.durationFallback=!1,this.#l=e=>{if(e===this.paused){this.#o();return}this.paused?(this.#r(),this.#t.play()):this.#t.pause(),this.#o()},this.#r=()=>{r.Observable.notify(this,"currentTime");const e=this.duration,t=this.currentTime,s=Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>=0,a=s?t/e*100:0;this.#e&&(this.#n=!0,this.#e.value=a.toString(),this.#n=!1),s&&a===100&&this.pause()},this.#s=()=>{r.Observable.notify(this,"duration"),(!Number.isFinite(this.#t.duration)||this.#t.duration<=0)&&this.durationFallback&&this.#p()},this.#u=()=>{!this.paused&&this.#e.isDragging&&(this.pause(),this.#d=window.setInterval(()=>{this.#e.isDragging||(clearInterval(this.#d),this.play())},0)),!this.#n&&this.#t&&(this.currentTime=this.duration*Number(this.#e.value)/100)},this.#o=()=>{r.Observable.notify(this,"paused")}}srcChanged(){this.src===void 0?this.setSrc(""):this.setSrc(this.src)}revokeSrc(){const e=this.getCurrentSrc();e&&e.startsWith("blob:")&&URL.revokeObjectURL(e)}getCurrentSrc(){return this.#t.currentSrc||this.#t.src||""}canPlayType(e){return this.#t.canPlayType(e)!==""}setSrc(e,t){const s=this.getCurrentSrc();this.revokeSrc(),this.#i=void 0,this.#a&&(this.#a.abort(),this.#a=void 0);const a=t&&(this.canPlayType(t.type)||!e)?URL.createObjectURL(t):e;if(s&&this.#t.removeAttribute("src"),a||e)try{this.#t.src=a}catch(l){console.log("Falling back to original URL due to error:",l),this.#t.src=e}}get playbackRate(){return r.Observable.track(this,"playbackRate"),this.#t.playbackRate}set playbackRate(e){this.#t.playbackRate=e,r.Observable.notify(this,"playbackRate")}get paused(){return r.Observable.track(this,"paused"),this.#t.paused}set paused(e){}#i;#a;async#p(){if(this.#i||!this.src)return;this.#a=new AbortController;const e=this.#a.signal;try{const s=await(await fetch(this.src,{signal:e})).blob();this.setSrc(this.src,s);const a=await s.arrayBuffer(),l=new window.AudioContext,p=await l.decodeAudioData(a);l.close(),this.#i=p,r.Observable.notify(this,"duration")}catch(t){t instanceof Error&&t.name!=="AbortError"&&console.error("Error loading audio:",t)}finally{this.#a=void 0}}get duration(){r.Observable.track(this,"duration");const e=this.#t.duration;return Number.isFinite(e)&&e>0?e:this.#i&&this.#i.duration>0?this.#i.duration:e}set duration(e){}get currentTime(){return r.Observable.track(this,"currentTime"),this.#t.currentTime}set currentTime(e){this.#t.currentTime=e}get#e(){return this.shadowRoot.querySelector(".slider")}#t;#n;connectedCallback(){super.connectedCallback(),this.#t.addEventListener("timeupdate",this.#r),this.#t.addEventListener("loadedmetadata",this.#s),this.#t.addEventListener("durationchange",this.#s),this.#c(),this.#o(),this.#r()}disconnectedCallback(){super.disconnectedCallback(),this.#c(!1),this.pause(),this.#t.removeEventListener("timeupdate",this.#r),this.#t.removeEventListener("loadedmetadata",this.#s),this.#t.removeEventListener("durationchange",this.#s)}play(){this.#l(L)}pause(){this.#l(A)}#c(e=!0){const t=e?"addEventListener":"removeEventListener";this.#e&&this.#e[t]("change",this.#u)}#l;#r;#s;#d;#u;#o;skip(e){const t=this.currentTime,s=parseInt(this.skipBy)*e,a=t+s;this.currentTime=Math.max(0,Math.min(this.duration,a))}}o([r.attr({attribute:"play-button-aria-label"})],n.prototype,"playButtonAriaLabel");o([r.attr({attribute:"pause-button-aria-label"})],n.prototype,"pauseButtonAriaLabel");o([r.attr({attribute:"slider-aria-label"})],n.prototype,"sliderAriaLabel");o([r.attr({attribute:"skip-forward-aria-label"})],n.prototype,"skipForwardButtonAriaLabel");o([r.attr({attribute:"skip-backward-aria-label"})],n.prototype,"skipBackwardButtonAriaLabel");o([r.attr],n.prototype,"connotation");o([r.attr],n.prototype,"src");o([r.attr({mode:"boolean"})],n.prototype,"disabled");o([r.attr({mode:"boolean"})],n.prototype,"notime");o([r.attr({attribute:"skip-by",converter:T})],n.prototype,"skipBy");o([r.attr({attribute:"playback-rates"})],n.prototype,"playbackRates");o([r.attr({mode:"boolean",attribute:"duration-fallback"})],n.prototype,"durationFallback");const S=({notime:i,disabled:e,duration:t,skipBy:s,playbackRates:a})=>B.classNames(["disabled",!!e||!t],["two-lines",!i&&(!!Number(s)||!!a)],["playback",!!a]),R=(i,{parent:e})=>i===e.playbackRate;function C(i){const e=i.tagFor(u.Button);return r.html`<${e} class="pause" @click="${t=>t.paused?t.play():t.pause()}"
|
|
2
2
|
icon="${t=>t.paused?"play-solid":"pause-solid"}"
|
|
3
3
|
aria-label="${t=>t.paused?t.playButtonAriaLabel||t.locale.audioPlayer.playButtonLabel:t.pauseButtonAriaLabel||t.locale.audioPlayer.pauseButtonLabel}"
|
|
4
4
|
size='condensed'
|
|
5
5
|
connotation="${t=>t.connotation}"
|
|
6
6
|
?disabled="${t=>t.disabled||!t.duration}"
|
|
7
|
-
></${e}>`}function
|
|
7
|
+
></${e}>`}function F(i){const e=i.tagFor(u.Button);return r.html`
|
|
8
8
|
<${e} class="skip backward"
|
|
9
9
|
@click="${t=>t.skip(k.BACKWARD)}"
|
|
10
|
-
icon="${t=>t.skipBy==
|
|
10
|
+
icon="${t=>t.skipBy==c.MediaSkipBy.Five?"5-sec-backward-line":t.skipBy==c.MediaSkipBy.Thirty?"30-sec-backward-line":"10-sec-backward-line"}"
|
|
11
11
|
size='condensed'
|
|
12
12
|
aria-label="${t=>t.skipBackwardButtonAriaLabel||t.locale.audioPlayer.skipBackwardButton}"
|
|
13
13
|
connotation="${t=>t.connotation}"
|
|
14
14
|
?disabled="${t=>t.disabled||!t.duration}"
|
|
15
15
|
></${e}>
|
|
16
|
-
`}function P(
|
|
16
|
+
`}function P(i){const e=i.tagFor(u.Button);return r.html`
|
|
17
17
|
<${e} class="skip forward"
|
|
18
18
|
@click="${t=>t.skip(k.FORWARD)}"
|
|
19
|
-
icon="${t=>t.skipBy==
|
|
19
|
+
icon="${t=>t.skipBy==c.MediaSkipBy.Five?"5-sec-forward-line":t.skipBy==c.MediaSkipBy.Thirty?"30-sec-forward-line":"10-sec-forward-line"}"
|
|
20
20
|
size='condensed'
|
|
21
21
|
aria-label="${t=>t.skipForwardButtonAriaLabel||t.locale.audioPlayer.skipForwardButton}"
|
|
22
22
|
connotation="${t=>t.connotation}"
|
|
23
23
|
?disabled="${t=>t.disabled||!t.duration}"
|
|
24
24
|
></${e}>
|
|
25
|
-
`}function
|
|
25
|
+
`}function E(i){const e=i.tagFor(h.Slider);return r.html`
|
|
26
26
|
<${e}
|
|
27
27
|
class="slider"
|
|
28
28
|
aria-label="${t=>t.sliderAriaLabel||t.locale.audioPlayer.sliderLabel}"
|
|
29
29
|
max="100"
|
|
30
|
-
aria-valuetext="${t=>
|
|
30
|
+
aria-valuetext="${t=>b(t.currentTime)}"
|
|
31
31
|
connotation="${t=>t.connotation}"
|
|
32
32
|
?disabled="${t=>t.disabled||!t.duration}"
|
|
33
33
|
internal-part>
|
|
34
|
-
</${e}>`}function
|
|
35
|
-
<span class="current-time">${
|
|
36
|
-
${
|
|
34
|
+
</${e}>`}function O(){return r.html` <div class="time-stamp">
|
|
35
|
+
<span class="current-time">${i=>b(i.currentTime)}</span>
|
|
36
|
+
${d.when(i=>i.duration&&i.duration!==1/0,r.html`
|
|
37
37
|
<span>/</span>
|
|
38
|
-
<span class="total-time">${
|
|
38
|
+
<span class="total-time">${i=>b(i.duration)}</span>
|
|
39
39
|
`)}
|
|
40
|
-
</div>`}function M(
|
|
41
|
-
<div class="base ${
|
|
40
|
+
</div>`}function M(i,e){return e.parent.playbackRate=i,!0}const z=i=>{const e=i.tagFor(y.Menu),t=i.tagFor(u.Button),s=i.tagFor(m.MenuItem);return r.html` <div class="wrapper">
|
|
41
|
+
<div class="base ${S}">
|
|
42
42
|
<div class="controls">
|
|
43
|
-
${
|
|
44
|
-
${C(
|
|
45
|
-
${
|
|
46
|
-
${
|
|
43
|
+
${d.when(a=>a.skipBy&&a.skipBy!=c.MediaSkipBy.Zero,F(i))}
|
|
44
|
+
${C(i)}
|
|
45
|
+
${d.when(a=>a.skipBy&&a.skipBy!=c.MediaSkipBy.Zero,P(i))}
|
|
46
|
+
${d.when(a=>!a.notime,O())}
|
|
47
47
|
</div>
|
|
48
|
-
${
|
|
49
|
-
${
|
|
48
|
+
${E(i)}
|
|
49
|
+
${d.when(a=>!!a.playbackRates,r.html`
|
|
50
50
|
<${e} class="playback-rates" placement="top-start" auto-dismiss id="playback-menu" position-strategy="absolute">
|
|
51
51
|
<${t} id="playback-open-button"
|
|
52
52
|
class="playback-button"
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
icon="playback-speed-line"
|
|
55
55
|
aria-label="play back rates"
|
|
56
56
|
size='condensed'
|
|
57
|
-
connotation="${
|
|
58
|
-
?disabled="${
|
|
57
|
+
connotation="${a=>a.connotation}"
|
|
58
|
+
?disabled="${a=>a.disabled||!a.duration}"
|
|
59
59
|
></${t}>
|
|
60
60
|
|
|
61
|
-
${v.repeat(
|
|
61
|
+
${v.repeat(a=>g.getPlaybackRatesArray(a.playbackRates),r.html`<${s} @click="${M}"
|
|
62
62
|
control-type="radio"
|
|
63
63
|
class="playback-rate"
|
|
64
|
-
text="${
|
|
64
|
+
text="${a=>a}"
|
|
65
65
|
check-appearance="tick-only"
|
|
66
|
-
?checked="${R}"></${
|
|
66
|
+
?checked="${R}"></${s}>`)}
|
|
67
67
|
</${e}>`)}
|
|
68
68
|
</div>
|
|
69
|
-
</div>`},D=
|
|
69
|
+
</div>`},D=r.defineVividComponent("audio-player",n,z,[u.buttonDefinition,h.sliderDefinition,y.menuDefinition,m.menuItemDefinition],{styles:$}),I=r.createRegisterFunction(D);I();
|
package/audio-player/index.js
CHANGED
|
@@ -1,62 +1,83 @@
|
|
|
1
1
|
import { B as b, b as f } from "../bundled/definition3.js";
|
|
2
2
|
import { S as k, s as g } from "../bundled/definition5.js";
|
|
3
3
|
import { M as v, m as B } from "../bundled/definition6.js";
|
|
4
|
-
import { V as $, O as l, a as n, h as
|
|
5
|
-
import { M as
|
|
6
|
-
import { M as
|
|
7
|
-
import { L as
|
|
8
|
-
import { g as
|
|
9
|
-
import { r as
|
|
10
|
-
import { c as
|
|
4
|
+
import { V as $, O as l, a as n, h as c, c as w, d as A } from "../bundled/vivid-element.js";
|
|
5
|
+
import { M as L, m as T } from "../bundled/definition7.js";
|
|
6
|
+
import { M as u } from "../bundled/enums.js";
|
|
7
|
+
import { L as S } from "../bundled/localized.js";
|
|
8
|
+
import { g as R } from "../bundled/playbackRates.js";
|
|
9
|
+
import { r as C } from "../bundled/repeat.js";
|
|
10
|
+
import { c as F } from "../bundled/class-names.js";
|
|
11
11
|
import { w as p } from "../bundled/when.js";
|
|
12
|
-
const
|
|
13
|
-
var
|
|
14
|
-
for (var i = void 0,
|
|
15
|
-
(
|
|
16
|
-
return i &&
|
|
12
|
+
const P = ':host{display:block}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:8px;inline-size:100%;user-select:none}.base.disabled{color:var(--vvd-color-neutral-300)}.base .slider{flex:1;grid-area:slider}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback-button{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:"slider" "controls";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:"slider slider" "controls playback";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}';
|
|
13
|
+
var E = Object.defineProperty, o = (a, e, t, r) => {
|
|
14
|
+
for (var i = void 0, d = a.length - 1, h; d >= 0; d--)
|
|
15
|
+
(h = a[d]) && (i = h(e, t, i) || i);
|
|
16
|
+
return i && E(e, t, i), i;
|
|
17
17
|
};
|
|
18
18
|
const y = {
|
|
19
19
|
FORWARD: 1,
|
|
20
20
|
BACKWARD: -1
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function m(a) {
|
|
23
23
|
if (!a || Number.isNaN(a))
|
|
24
24
|
return "0:00";
|
|
25
25
|
const e = Math.floor(a / 60), t = Math.floor(a % 60);
|
|
26
26
|
return e + ":" + (t < 10 ? "0" + t : t);
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const D = !0, I = !1, z = {
|
|
29
29
|
toView(a) {
|
|
30
30
|
return a;
|
|
31
31
|
},
|
|
32
32
|
fromView(a) {
|
|
33
|
-
return Object.values(
|
|
33
|
+
return Object.values(u).includes(a) ? a : void 0;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
class s extends
|
|
36
|
+
class s extends S($) {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(), this.playButtonAriaLabel = null, this.pauseButtonAriaLabel = null, this.sliderAriaLabel = null, this.skipForwardButtonAriaLabel = null, this.skipBackwardButtonAriaLabel = null, this.disabled = !1, this.notime = !1, this.playbackRates = null, this.#t = new Audio(), this.#n = !1, this.durationFallback = !1, this.#l = (e) => {
|
|
39
39
|
if (e === this.paused) {
|
|
40
40
|
this.#o();
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
this.paused ? (this.#
|
|
44
|
-
}, this.#
|
|
43
|
+
this.paused ? (this.#r(), this.#t.play()) : this.#t.pause(), this.#o();
|
|
44
|
+
}, this.#r = () => {
|
|
45
45
|
l.notify(this, "currentTime");
|
|
46
46
|
const e = this.duration, t = this.currentTime, r = Number.isFinite(e) && e > 0 && Number.isFinite(t) && t >= 0, i = r ? t / e * 100 : 0;
|
|
47
47
|
this.#e && (this.#n = !0, this.#e.value = i.toString(), this.#n = !1), r && i === 100 && this.pause();
|
|
48
|
-
}, this.#
|
|
48
|
+
}, this.#s = () => {
|
|
49
49
|
l.notify(this, "duration"), (!Number.isFinite(this.#t.duration) || this.#t.duration <= 0) && this.durationFallback && this.#p();
|
|
50
50
|
}, this.#u = () => {
|
|
51
|
-
!this.paused && this.#e.isDragging && (this.pause(), this.#
|
|
52
|
-
this.#e.isDragging || (clearInterval(this.#
|
|
51
|
+
!this.paused && this.#e.isDragging && (this.pause(), this.#d = window.setInterval(() => {
|
|
52
|
+
this.#e.isDragging || (clearInterval(this.#d), this.play());
|
|
53
53
|
}, 0)), !this.#n && this.#t && (this.currentTime = this.duration * Number(this.#e.value) / 100);
|
|
54
54
|
}, this.#o = () => {
|
|
55
55
|
l.notify(this, "paused");
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
srcChanged() {
|
|
59
|
-
this.src === void 0 ? this
|
|
59
|
+
this.src === void 0 ? this.setSrc("") : this.setSrc(this.src);
|
|
60
|
+
}
|
|
61
|
+
revokeSrc() {
|
|
62
|
+
const e = this.getCurrentSrc();
|
|
63
|
+
e && e.startsWith("blob:") && URL.revokeObjectURL(e);
|
|
64
|
+
}
|
|
65
|
+
getCurrentSrc() {
|
|
66
|
+
return this.#t.currentSrc || this.#t.src || "";
|
|
67
|
+
}
|
|
68
|
+
canPlayType(e) {
|
|
69
|
+
return this.#t.canPlayType(e) !== "";
|
|
70
|
+
}
|
|
71
|
+
setSrc(e, t) {
|
|
72
|
+
const r = this.getCurrentSrc();
|
|
73
|
+
this.revokeSrc(), this.#a = void 0, this.#i && (this.#i.abort(), this.#i = void 0);
|
|
74
|
+
const i = t && (this.canPlayType(t.type) || !e) ? URL.createObjectURL(t) : e;
|
|
75
|
+
if (r && this.#t.removeAttribute("src"), i || e)
|
|
76
|
+
try {
|
|
77
|
+
this.#t.src = i;
|
|
78
|
+
} catch (d) {
|
|
79
|
+
console.log("Falling back to original URL due to error:", d), this.#t.src = e;
|
|
80
|
+
}
|
|
60
81
|
}
|
|
61
82
|
get playbackRate() {
|
|
62
83
|
return l.track(this, "playbackRate"), this.#t.playbackRate;
|
|
@@ -76,9 +97,12 @@ class s extends F($) {
|
|
|
76
97
|
this.#i = new AbortController();
|
|
77
98
|
const e = this.#i.signal;
|
|
78
99
|
try {
|
|
79
|
-
const r = await (await fetch(this.src, { signal: e })).
|
|
80
|
-
|
|
81
|
-
|
|
100
|
+
const r = await (await fetch(this.src, { signal: e })).blob();
|
|
101
|
+
this.setSrc(this.src, r);
|
|
102
|
+
const i = await r.arrayBuffer(), d = new window.AudioContext(), h = await d.decodeAudioData(i);
|
|
103
|
+
d.close(), this.#a = h, l.notify(this, "duration");
|
|
104
|
+
} catch (t) {
|
|
105
|
+
t instanceof Error && t.name !== "AbortError" && console.error("Error loading audio:", t);
|
|
82
106
|
} finally {
|
|
83
107
|
this.#i = void 0;
|
|
84
108
|
}
|
|
@@ -102,25 +126,25 @@ class s extends F($) {
|
|
|
102
126
|
#t;
|
|
103
127
|
#n;
|
|
104
128
|
connectedCallback() {
|
|
105
|
-
super.connectedCallback(), this.#t.addEventListener("timeupdate", this.#
|
|
129
|
+
super.connectedCallback(), this.#t.addEventListener("timeupdate", this.#r), this.#t.addEventListener("loadedmetadata", this.#s), this.#t.addEventListener("durationchange", this.#s), this.#c(), this.#o(), this.#r();
|
|
106
130
|
}
|
|
107
131
|
disconnectedCallback() {
|
|
108
|
-
super.disconnectedCallback(), this.#
|
|
132
|
+
super.disconnectedCallback(), this.#c(!1), this.pause(), this.#t.removeEventListener("timeupdate", this.#r), this.#t.removeEventListener("loadedmetadata", this.#s), this.#t.removeEventListener("durationchange", this.#s);
|
|
109
133
|
}
|
|
110
134
|
play() {
|
|
111
135
|
this.#l(I);
|
|
112
136
|
}
|
|
113
137
|
pause() {
|
|
114
|
-
this.#l(
|
|
138
|
+
this.#l(D);
|
|
115
139
|
}
|
|
116
|
-
#
|
|
140
|
+
#c(e = !0) {
|
|
117
141
|
const t = e ? "addEventListener" : "removeEventListener";
|
|
118
142
|
this.#e && this.#e[t]("change", this.#u);
|
|
119
143
|
}
|
|
120
144
|
#l;
|
|
121
|
-
#s;
|
|
122
145
|
#r;
|
|
123
|
-
#
|
|
146
|
+
#s;
|
|
147
|
+
#d;
|
|
124
148
|
#u;
|
|
125
149
|
#o;
|
|
126
150
|
/**
|
|
@@ -180,7 +204,7 @@ const M = ({
|
|
|
180
204
|
duration: t,
|
|
181
205
|
skipBy: r,
|
|
182
206
|
playbackRates: i
|
|
183
|
-
}) =>
|
|
207
|
+
}) => F(
|
|
184
208
|
["disabled", !!e || !t],
|
|
185
209
|
[
|
|
186
210
|
"two-lines",
|
|
@@ -190,7 +214,7 @@ const M = ({
|
|
|
190
214
|
), N = (a, { parent: e }) => a === e.playbackRate;
|
|
191
215
|
function O(a) {
|
|
192
216
|
const e = a.tagFor(b);
|
|
193
|
-
return
|
|
217
|
+
return c`<${e} class="pause" @click="${(t) => t.paused ? t.play() : t.pause()}"
|
|
194
218
|
icon="${(t) => t.paused ? "play-solid" : "pause-solid"}"
|
|
195
219
|
aria-label="${(t) => t.paused ? t.playButtonAriaLabel || t.locale.audioPlayer.playButtonLabel : t.pauseButtonAriaLabel || t.locale.audioPlayer.pauseButtonLabel}"
|
|
196
220
|
size='condensed'
|
|
@@ -198,12 +222,12 @@ function O(a) {
|
|
|
198
222
|
?disabled="${(t) => t.disabled || !t.duration}"
|
|
199
223
|
></${e}>`;
|
|
200
224
|
}
|
|
201
|
-
function
|
|
225
|
+
function U(a) {
|
|
202
226
|
const e = a.tagFor(b);
|
|
203
|
-
return
|
|
227
|
+
return c`
|
|
204
228
|
<${e} class="skip backward"
|
|
205
229
|
@click="${(t) => t.skip(y.BACKWARD)}"
|
|
206
|
-
icon="${(t) => t.skipBy ==
|
|
230
|
+
icon="${(t) => t.skipBy == u.Five ? "5-sec-backward-line" : t.skipBy == u.Thirty ? "30-sec-backward-line" : "10-sec-backward-line"}"
|
|
207
231
|
size='condensed'
|
|
208
232
|
aria-label="${(t) => t.skipBackwardButtonAriaLabel || t.locale.audioPlayer.skipBackwardButton}"
|
|
209
233
|
connotation="${(t) => t.connotation}"
|
|
@@ -211,12 +235,12 @@ function V(a) {
|
|
|
211
235
|
></${e}>
|
|
212
236
|
`;
|
|
213
237
|
}
|
|
214
|
-
function
|
|
238
|
+
function V(a) {
|
|
215
239
|
const e = a.tagFor(b);
|
|
216
|
-
return
|
|
240
|
+
return c`
|
|
217
241
|
<${e} class="skip forward"
|
|
218
242
|
@click="${(t) => t.skip(y.FORWARD)}"
|
|
219
|
-
icon="${(t) => t.skipBy ==
|
|
243
|
+
icon="${(t) => t.skipBy == u.Five ? "5-sec-forward-line" : t.skipBy == u.Thirty ? "30-sec-forward-line" : "10-sec-forward-line"}"
|
|
220
244
|
size='condensed'
|
|
221
245
|
aria-label="${(t) => t.skipForwardButtonAriaLabel || t.locale.audioPlayer.skipForwardButton}"
|
|
222
246
|
connotation="${(t) => t.connotation}"
|
|
@@ -224,54 +248,54 @@ function _(a) {
|
|
|
224
248
|
></${e}>
|
|
225
249
|
`;
|
|
226
250
|
}
|
|
227
|
-
function
|
|
251
|
+
function _(a) {
|
|
228
252
|
const e = a.tagFor(k);
|
|
229
|
-
return
|
|
253
|
+
return c`
|
|
230
254
|
<${e}
|
|
231
255
|
class="slider"
|
|
232
256
|
aria-label="${(t) => t.sliderAriaLabel || t.locale.audioPlayer.sliderLabel}"
|
|
233
257
|
max="100"
|
|
234
|
-
aria-valuetext="${(t) =>
|
|
258
|
+
aria-valuetext="${(t) => m(t.currentTime)}"
|
|
235
259
|
connotation="${(t) => t.connotation}"
|
|
236
260
|
?disabled="${(t) => t.disabled || !t.duration}"
|
|
237
261
|
internal-part>
|
|
238
262
|
</${e}>`;
|
|
239
263
|
}
|
|
240
264
|
function j() {
|
|
241
|
-
return
|
|
242
|
-
<span class="current-time">${(a) =>
|
|
265
|
+
return c` <div class="time-stamp">
|
|
266
|
+
<span class="current-time">${(a) => m(a.currentTime)}</span>
|
|
243
267
|
${p(
|
|
244
268
|
(a) => a.duration && a.duration !== 1 / 0,
|
|
245
|
-
|
|
269
|
+
c`
|
|
246
270
|
<span>/</span>
|
|
247
|
-
<span class="total-time">${(a) =>
|
|
271
|
+
<span class="total-time">${(a) => m(a.duration)}</span>
|
|
248
272
|
`
|
|
249
273
|
)}
|
|
250
274
|
</div>`;
|
|
251
275
|
}
|
|
252
|
-
function
|
|
276
|
+
function W(a, e) {
|
|
253
277
|
return e.parent.playbackRate = a, !0;
|
|
254
278
|
}
|
|
255
|
-
const
|
|
256
|
-
const e = a.tagFor(v), t = a.tagFor(b), r = a.tagFor(
|
|
257
|
-
return
|
|
279
|
+
const K = (a) => {
|
|
280
|
+
const e = a.tagFor(v), t = a.tagFor(b), r = a.tagFor(L);
|
|
281
|
+
return c` <div class="wrapper">
|
|
258
282
|
<div class="base ${M}">
|
|
259
283
|
<div class="controls">
|
|
260
284
|
${p(
|
|
261
|
-
(i) => i.skipBy && i.skipBy !=
|
|
262
|
-
|
|
285
|
+
(i) => i.skipBy && i.skipBy != u.Zero,
|
|
286
|
+
U(a)
|
|
263
287
|
)}
|
|
264
288
|
${O(a)}
|
|
265
289
|
${p(
|
|
266
|
-
(i) => i.skipBy && i.skipBy !=
|
|
267
|
-
|
|
290
|
+
(i) => i.skipBy && i.skipBy != u.Zero,
|
|
291
|
+
V(a)
|
|
268
292
|
)}
|
|
269
293
|
${p((i) => !i.notime, j())}
|
|
270
294
|
</div>
|
|
271
|
-
${
|
|
295
|
+
${_(a)}
|
|
272
296
|
${p(
|
|
273
297
|
(i) => !!i.playbackRates,
|
|
274
|
-
|
|
298
|
+
c`
|
|
275
299
|
<${e} class="playback-rates" placement="top-start" auto-dismiss id="playback-menu" position-strategy="absolute">
|
|
276
300
|
<${t} id="playback-open-button"
|
|
277
301
|
class="playback-button"
|
|
@@ -283,9 +307,9 @@ const U = (a) => {
|
|
|
283
307
|
?disabled="${(i) => i.disabled || !i.duration}"
|
|
284
308
|
></${t}>
|
|
285
309
|
|
|
286
|
-
${
|
|
287
|
-
(i) =>
|
|
288
|
-
|
|
310
|
+
${C(
|
|
311
|
+
(i) => R(i.playbackRates),
|
|
312
|
+
c`<${r} @click="${W}"
|
|
289
313
|
control-type="radio"
|
|
290
314
|
class="playback-rate"
|
|
291
315
|
text="${(i) => i}"
|
|
@@ -299,10 +323,10 @@ const U = (a) => {
|
|
|
299
323
|
}, Z = A(
|
|
300
324
|
"audio-player",
|
|
301
325
|
s,
|
|
302
|
-
|
|
303
|
-
[f, g, B,
|
|
326
|
+
K,
|
|
327
|
+
[f, g, B, T],
|
|
304
328
|
{
|
|
305
|
-
styles:
|
|
329
|
+
styles: P
|
|
306
330
|
}
|
|
307
331
|
), q = w(
|
|
308
332
|
Z
|
package/bundled/definition13.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";const T=require("./definition2.cjs"),t=require("./vivid-element.cjs"),d=require("./mixins.cjs"),_=require("./definition12.cjs"),q=require("./definition11.cjs"),x=require("./delegates-aria.cjs"),k=require("./form-associated.cjs"),E=require("./
|
|
1
|
+
"use strict";const T=require("./definition2.cjs"),t=require("./vivid-element.cjs"),d=require("./mixins.cjs"),_=require("./definition12.cjs"),q=require("./definition11.cjs"),x=require("./delegates-aria.cjs"),k=require("./form-associated.cjs"),E=require("./char-count.cjs"),M=require("./with-contextual-help.cjs"),H=require("./with-error-text.cjs"),F=require("./with-success-text.cjs"),L=require("./form-element.cjs"),v=require("./affix.cjs"),w=require("./text-field.cjs"),D=require("./class-names.cjs"),m=require("./when.cjs"),c=require("./slotted.cjs"),S=require("./ref.cjs");var N=Object.defineProperty,i=(n,a,e,h)=>{for(var l=void 0,s=n.length-1,r;s>=0;s--)(r=n[s])&&(l=r(a,e,l)||l);return l&&N(a,e,l),l};const O={text:"text"},A="_vvd-3-text-field-safari-workaround",y=t.ElementStyles.create([`
|
|
2
2
|
.${A}::placeholder {
|
|
3
3
|
opacity: 1 !important;
|
|
4
4
|
-webkit-text-fill-color: var(--_low-ink-color) !important;
|
|
5
5
|
}
|
|
6
|
-
`]),B=n=>{const a=n.getRootNode();y.isAttachedTo(a)||y.addStylesTo(a)};class o extends
|
|
6
|
+
`]),B=n=>{const a=n.getRootNode();y.isAttachedTo(a)||y.addStylesTo(a)};class o extends M.WithContextualHelp(d.WithLightDOMFeedback(E.WithCharCount(H.WithErrorText(F.WithSuccessText(L.FormElement(v.AffixIcon(x.DelegatesAria(k.FormAssociated(t.VividElement))))))))){constructor(){super(...arguments),this.proxy=document.createElement("input"),this.type=O.text,this.#e=d.generateRandomId()}readOnlyChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.readOnly=this.readOnly,this.validate())}autofocusChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.autofocus=this.autofocus,this.validate())}placeholderChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.placeholder=this.placeholder)}typeChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.type=this.type,this.validate())}listChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.setAttribute("list",this.list),this.validate())}maxlengthChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.maxLength=this.maxlength,this.validate())}minlengthChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.minLength=this.minlength,this.validate())}patternChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.pattern=this.pattern,this.validate())}sizeChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.size=this.size)}spellcheckChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.spellcheck=this.spellcheck)}valueChanged(a,e){super.valueChanged(a,e),this._updateControlValueIfNeeded(),this.charCount&&this.maxlength&&this._updateCharCountRemaining()}_updateControlValueIfNeeded(){this.control&&this.control.value!==this.value&&(this.control.value=this.value)}select(){this.control.select()}handleTextInput(){this.value=this.control.value}handleChange(){this.$emit("change")}validate(){super.validate(this.control)}connectedCallback(){super.connectedCallback(),this.proxy.setAttribute("type",this.type),this.validate(),this.autofocus&&t.DOM.queueUpdate(()=>{this.focus()}),this._updateControlValueIfNeeded(),B(this),this._renderCharCountRemaining()}focus(){this.control?.focus()}#e;get _uniqueId(){return this.id||this.#e}}i([t.attr({attribute:"readonly",mode:"boolean"})],o.prototype,"readOnly");i([t.attr({mode:"boolean"})],o.prototype,"autofocus");i([t.attr],o.prototype,"placeholder");i([t.attr],o.prototype,"type");i([t.attr],o.prototype,"list");i([t.attr({converter:t.nullableNumberConverter})],o.prototype,"maxlength");i([t.attr({converter:t.nullableNumberConverter})],o.prototype,"minlength");i([t.attr],o.prototype,"pattern");i([t.attr({converter:t.nullableNumberConverter})],o.prototype,"size");i([t.attr({mode:"boolean"})],o.prototype,"spellcheck");i([t.attr],o.prototype,"appearance");i([t.attr],o.prototype,"shape");i([t.attr],o.prototype,"autoComplete");i([t.attr()],o.prototype,"scale");i([t.attr({attribute:"inputmode"})],o.prototype,"inputMode");i([t.observable],o.prototype,"actionItemsSlottedContent");i([t.observable],o.prototype,"leadingActionItemsSlottedContent");const g=n=>`vvd-text-field-control-${n}`,W=({errorValidationMessage:n,disabled:a,value:e,readOnly:h,placeholder:l,appearance:s,shape:r,label:C,successText:$,actionItemsSlottedContent:I,leadingActionItemsSlottedContent:p,icon:u,scale:f})=>D.classNames(["error",!!n],["disabled",a],["has-value",!!e],["readonly",h],["placeholder",!!l],[`appearance-${s}`,!!s],[`shape-${r}`,!!r],["no-label",!C],["has-icon",!!u],["success",!!$],["action-items",!!I?.length],["leading-action-items",!!p?.length],["no-leading",!(p?.length||u)],[`size-${f}`,!!f]),z=n=>{const a=v.affixIconTemplateFactory(n);return t.html`
|
|
7
7
|
<div class="base ${W}">
|
|
8
8
|
<div
|
|
9
9
|
class="label-suffix"
|
package/bundled/definition13.js
CHANGED
|
@@ -5,8 +5,8 @@ import { v as W } from "./definition12.js";
|
|
|
5
5
|
import { c as S } from "./definition11.js";
|
|
6
6
|
import { D as w, d as O } from "./delegates-aria.js";
|
|
7
7
|
import { F as B } from "./form-associated.js";
|
|
8
|
-
import { W as A } from "./
|
|
9
|
-
import { W as N } from "./
|
|
8
|
+
import { W as A } from "./char-count.js";
|
|
9
|
+
import { W as N } from "./with-contextual-help.js";
|
|
10
10
|
import { W as z } from "./with-error-text.js";
|
|
11
11
|
import { W as V } from "./with-success-text.js";
|
|
12
12
|
import { F as q } from "./form-element.js";
|
|
@@ -37,9 +37,9 @@ const K = {
|
|
|
37
37
|
const s = i.getRootNode();
|
|
38
38
|
v.isAttachedTo(s) || v.addStylesTo(s);
|
|
39
39
|
};
|
|
40
|
-
class t extends
|
|
40
|
+
class t extends N(
|
|
41
41
|
L(
|
|
42
|
-
|
|
42
|
+
A(
|
|
43
43
|
z(
|
|
44
44
|
V(
|
|
45
45
|
q(R(w(B(_))))
|