@m3e/switch 1.0.6 → 1.1.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/dist/index.js CHANGED
@@ -19,26 +19,24 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
19
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
20
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
21
  PERFORMANCE OF THIS SOFTWARE.
22
- ***************************************************************************** */
23
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
24
-
25
-
26
- function __decorate(decorators, target, key, desc) {
27
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30
- return c > 3 && r && Object.defineProperty(target, key, r), r;
31
- }
32
-
33
- function __classPrivateFieldGet(receiver, state, kind, f) {
34
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
35
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
36
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
37
- }
38
-
39
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
40
- var e = new Error(message);
41
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
22
+ ***************************************************************************** */
23
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
24
+
25
+ function __decorate(decorators, target, key, desc) {
26
+ var c = arguments.length,
27
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
28
+ d;
29
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31
+ }
32
+ function __classPrivateFieldGet(receiver, state, kind, f) {
33
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
34
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
35
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
36
+ }
37
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
38
+ var e = new Error(message);
39
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
42
40
  };
43
41
 
44
42
  /**
@@ -46,503 +44,506 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
46
44
  * Copyright 2017 Google LLC
47
45
  * SPDX-License-Identifier: BSD-3-Clause
48
46
  */
49
- const t$1=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
47
+ const t$1 = t => (e, o) => {
48
+ void 0 !== o ? o.addInitializer(() => {
49
+ customElements.define(t, e);
50
+ }) : customElements.define(t, e);
51
+ };
50
52
 
51
53
  /**
52
54
  * @license
53
55
  * Copyright 2019 Google LLC
54
56
  * SPDX-License-Identifier: BSD-3-Clause
55
57
  */
56
- const t=globalThis,e$3=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$3&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s),S=(s,o)=>{if(e$3)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$3?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
58
+ const t = globalThis,
59
+ e$3 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
60
+ s = Symbol(),
61
+ o$2 = new WeakMap();
62
+ let n$2 = class n {
63
+ constructor(t, e, o) {
64
+ if (this._$cssResult$ = true, o !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
65
+ this.cssText = t, this.t = e;
66
+ }
67
+ get styleSheet() {
68
+ let t = this.o;
69
+ const s = this.t;
70
+ if (e$3 && void 0 === t) {
71
+ const e = void 0 !== s && 1 === s.length;
72
+ e && (t = o$2.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$2.set(s, t));
73
+ }
74
+ return t;
75
+ }
76
+ toString() {
77
+ return this.cssText;
78
+ }
79
+ };
80
+ const r$2 = t => new n$2("string" == typeof t ? t : t + "", void 0, s),
81
+ S = (s, o) => {
82
+ if (e$3) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
83
+ const o = document.createElement("style"),
84
+ n = t.litNonce;
85
+ void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
86
+ }
87
+ },
88
+ c$1 = e$3 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
89
+ let e = "";
90
+ for (const s of t.cssRules) e += s.cssText;
91
+ return r$2(e);
92
+ })(t) : t;
57
93
 
58
94
  /**
59
95
  * @license
60
96
  * Copyright 2017 Google LLC
61
97
  * SPDX-License-Identifier: BSD-3-Clause
62
- */const{is:i,defineProperty:e$2,getOwnPropertyDescriptor:h,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f=(t,s)=>!i(t,s),b={attribute:true,type:String,converter:u,reflect:false,useDefault:false,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$2(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d("elementProperties")]=new Map,y[d("finalized")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.1");
98
+ */
99
+ const {
100
+ is: i,
101
+ defineProperty: e$2,
102
+ getOwnPropertyDescriptor: h,
103
+ getOwnPropertyNames: r$1,
104
+ getOwnPropertySymbols: o$1,
105
+ getPrototypeOf: n$1
106
+ } = Object,
107
+ a = globalThis,
108
+ c = a.trustedTypes,
109
+ l = c ? c.emptyScript : "",
110
+ p = a.reactiveElementPolyfillSupport,
111
+ d = (t, s) => t,
112
+ u = {
113
+ toAttribute(t, s) {
114
+ switch (s) {
115
+ case Boolean:
116
+ t = t ? l : null;
117
+ break;
118
+ case Object:
119
+ case Array:
120
+ t = null == t ? t : JSON.stringify(t);
121
+ }
122
+ return t;
123
+ },
124
+ fromAttribute(t, s) {
125
+ let i = t;
126
+ switch (s) {
127
+ case Boolean:
128
+ i = null !== t;
129
+ break;
130
+ case Number:
131
+ i = null === t ? null : Number(t);
132
+ break;
133
+ case Object:
134
+ case Array:
135
+ try {
136
+ i = JSON.parse(t);
137
+ } catch (t) {
138
+ i = null;
139
+ }
140
+ }
141
+ return i;
142
+ }
143
+ },
144
+ f = (t, s) => !i(t, s),
145
+ b = {
146
+ attribute: true,
147
+ type: String,
148
+ converter: u,
149
+ reflect: false,
150
+ useDefault: false,
151
+ hasChanged: f
152
+ };
153
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= new WeakMap();
154
+ class y extends HTMLElement {
155
+ static addInitializer(t) {
156
+ this._$Ei(), (this.l ??= []).push(t);
157
+ }
158
+ static get observedAttributes() {
159
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
160
+ }
161
+ static createProperty(t, s = b) {
162
+ if (s.state && (s.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = true), this.elementProperties.set(t, s), !s.noAccessor) {
163
+ const i = Symbol(),
164
+ h = this.getPropertyDescriptor(t, i, s);
165
+ void 0 !== h && e$2(this.prototype, t, h);
166
+ }
167
+ }
168
+ static getPropertyDescriptor(t, s, i) {
169
+ const {
170
+ get: e,
171
+ set: r
172
+ } = h(this.prototype, t) ?? {
173
+ get() {
174
+ return this[s];
175
+ },
176
+ set(t) {
177
+ this[s] = t;
178
+ }
179
+ };
180
+ return {
181
+ get: e,
182
+ set(s) {
183
+ const h = e?.call(this);
184
+ r?.call(this, s), this.requestUpdate(t, h, i);
185
+ },
186
+ configurable: true,
187
+ enumerable: true
188
+ };
189
+ }
190
+ static getPropertyOptions(t) {
191
+ return this.elementProperties.get(t) ?? b;
192
+ }
193
+ static _$Ei() {
194
+ if (this.hasOwnProperty(d("elementProperties"))) return;
195
+ const t = n$1(this);
196
+ t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
197
+ }
198
+ static finalize() {
199
+ if (this.hasOwnProperty(d("finalized"))) return;
200
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
201
+ const t = this.properties,
202
+ s = [...r$1(t), ...o$1(t)];
203
+ for (const i of s) this.createProperty(i, t[i]);
204
+ }
205
+ const t = this[Symbol.metadata];
206
+ if (null !== t) {
207
+ const s = litPropertyMetadata.get(t);
208
+ if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
209
+ }
210
+ this._$Eh = new Map();
211
+ for (const [t, s] of this.elementProperties) {
212
+ const i = this._$Eu(t, s);
213
+ void 0 !== i && this._$Eh.set(i, t);
214
+ }
215
+ this.elementStyles = this.finalizeStyles(this.styles);
216
+ }
217
+ static finalizeStyles(s) {
218
+ const i = [];
219
+ if (Array.isArray(s)) {
220
+ const e = new Set(s.flat(1 / 0).reverse());
221
+ for (const s of e) i.unshift(c$1(s));
222
+ } else void 0 !== s && i.push(c$1(s));
223
+ return i;
224
+ }
225
+ static _$Eu(t, s) {
226
+ const i = s.attribute;
227
+ return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
228
+ }
229
+ constructor() {
230
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
231
+ }
232
+ _$Ev() {
233
+ this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
234
+ }
235
+ addController(t) {
236
+ (this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
237
+ }
238
+ removeController(t) {
239
+ this._$EO?.delete(t);
240
+ }
241
+ _$E_() {
242
+ const t = new Map(),
243
+ s = this.constructor.elementProperties;
244
+ for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
245
+ t.size > 0 && (this._$Ep = t);
246
+ }
247
+ createRenderRoot() {
248
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
249
+ return S(t, this.constructor.elementStyles), t;
250
+ }
251
+ connectedCallback() {
252
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
253
+ }
254
+ enableUpdating(t) {}
255
+ disconnectedCallback() {
256
+ this._$EO?.forEach(t => t.hostDisconnected?.());
257
+ }
258
+ attributeChangedCallback(t, s, i) {
259
+ this._$AK(t, i);
260
+ }
261
+ _$ET(t, s) {
262
+ const i = this.constructor.elementProperties.get(t),
263
+ e = this.constructor._$Eu(t, i);
264
+ if (void 0 !== e && true === i.reflect) {
265
+ const h = (void 0 !== i.converter?.toAttribute ? i.converter : u).toAttribute(s, i.type);
266
+ this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
267
+ }
268
+ }
269
+ _$AK(t, s) {
270
+ const i = this.constructor,
271
+ e = i._$Eh.get(t);
272
+ if (void 0 !== e && this._$Em !== e) {
273
+ const t = i.getPropertyOptions(e),
274
+ h = "function" == typeof t.converter ? {
275
+ fromAttribute: t.converter
276
+ } : void 0 !== t.converter?.fromAttribute ? t.converter : u;
277
+ this._$Em = e;
278
+ const r = h.fromAttribute(s, t.type);
279
+ this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
280
+ }
281
+ }
282
+ requestUpdate(t, s, i) {
283
+ if (void 0 !== t) {
284
+ const e = this.constructor,
285
+ h = this[t];
286
+ if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
287
+ this.C(t, s, i);
288
+ }
289
+ false === this.isUpdatePending && (this._$ES = this._$EP());
290
+ }
291
+ C(t, s, {
292
+ useDefault: i,
293
+ reflect: e,
294
+ wrapped: h
295
+ }, r) {
296
+ i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), true !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), true === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
297
+ }
298
+ async _$EP() {
299
+ this.isUpdatePending = true;
300
+ try {
301
+ await this._$ES;
302
+ } catch (t) {
303
+ Promise.reject(t);
304
+ }
305
+ const t = this.scheduleUpdate();
306
+ return null != t && (await t), !this.isUpdatePending;
307
+ }
308
+ scheduleUpdate() {
309
+ return this.performUpdate();
310
+ }
311
+ performUpdate() {
312
+ if (!this.isUpdatePending) return;
313
+ if (!this.hasUpdated) {
314
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
315
+ for (const [t, s] of this._$Ep) this[t] = s;
316
+ this._$Ep = void 0;
317
+ }
318
+ const t = this.constructor.elementProperties;
319
+ if (t.size > 0) for (const [s, i] of t) {
320
+ const {
321
+ wrapped: t
322
+ } = i,
323
+ e = this[s];
324
+ true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
325
+ }
326
+ }
327
+ let t = false;
328
+ const s = this._$AL;
329
+ try {
330
+ t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
331
+ } catch (s) {
332
+ throw t = false, this._$EM(), s;
333
+ }
334
+ t && this._$AE(s);
335
+ }
336
+ willUpdate(t) {}
337
+ _$AE(t) {
338
+ this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
339
+ }
340
+ _$EM() {
341
+ this._$AL = new Map(), this.isUpdatePending = false;
342
+ }
343
+ get updateComplete() {
344
+ return this.getUpdateComplete();
345
+ }
346
+ getUpdateComplete() {
347
+ return this._$ES;
348
+ }
349
+ shouldUpdate(t) {
350
+ return true;
351
+ }
352
+ update(t) {
353
+ this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
354
+ }
355
+ updated(t) {}
356
+ firstUpdated(t) {}
357
+ }
358
+ y.elementStyles = [], y.shadowRootOptions = {
359
+ mode: "open"
360
+ }, y[d("elementProperties")] = new Map(), y[d("finalized")] = new Map(), p?.({
361
+ ReactiveElement: y
362
+ }), (a.reactiveElementVersions ??= []).push("2.1.1");
63
363
 
64
364
  /**
65
365
  * @license
66
366
  * Copyright 2017 Google LLC
67
367
  * SPDX-License-Identifier: BSD-3-Clause
68
- */const o={attribute:true,type:String,converter:u,reflect:false,hasChanged:f},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
368
+ */
369
+ const o = {
370
+ attribute: true,
371
+ type: String,
372
+ converter: u,
373
+ reflect: false,
374
+ hasChanged: f
375
+ },
376
+ r = (t = o, e, r) => {
377
+ const {
378
+ kind: n,
379
+ metadata: i
380
+ } = r;
381
+ let s = globalThis.litPropertyMetadata.get(i);
382
+ if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map()), "setter" === n && ((t = Object.create(t)).wrapped = true), s.set(r.name, t), "accessor" === n) {
383
+ const {
384
+ name: o
385
+ } = r;
386
+ return {
387
+ set(r) {
388
+ const n = e.get.call(this);
389
+ e.set.call(this, r), this.requestUpdate(o, n, t);
390
+ },
391
+ init(e) {
392
+ return void 0 !== e && this.C(o, void 0, t, e), e;
393
+ }
394
+ };
395
+ }
396
+ if ("setter" === n) {
397
+ const {
398
+ name: o
399
+ } = r;
400
+ return function (r) {
401
+ const n = this[o];
402
+ e.call(this, r), this.requestUpdate(o, n, t);
403
+ };
404
+ }
405
+ throw Error("Unsupported decorator location: " + n);
406
+ };
407
+ function n(t) {
408
+ return (e, o) => "object" == typeof o ? r(t, e, o) : ((t, e, o) => {
409
+ const r = e.hasOwnProperty(o);
410
+ return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
411
+ })(t, e, o);
412
+ }
69
413
 
70
414
  /**
71
415
  * @license
72
416
  * Copyright 2017 Google LLC
73
417
  * SPDX-License-Identifier: BSD-3-Clause
74
418
  */
75
- const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
419
+ const e$1 = (e, t, c) => (c.configurable = true, c.enumerable = true, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
76
420
 
77
421
  /**
78
422
  * @license
79
423
  * Copyright 2017 Google LLC
80
424
  * SPDX-License-Identifier: BSD-3-Clause
81
- */function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
425
+ */
426
+ function e(e, r) {
427
+ return (n, s, i) => {
428
+ const o = t => t.renderRoot?.querySelector(e) ?? null;
429
+ return e$1(n, s, {
430
+ get() {
431
+ return o(this);
432
+ }
433
+ });
434
+ };
435
+ }
82
436
 
83
437
  /**
84
438
  * Component design tokens that control `M3eSwitchElement`.
85
439
  * @internal
86
440
  */
87
441
  const SwitchToken = {
88
- selectedIconColor: unsafeCSS(`var(--m3e-switch-selected-icon-color, ${DesignToken.color.onPrimaryContainer})`),
89
- selectedIconSize: unsafeCSS("var(--m3e-switch-selected-icon-size, 1rem)"),
90
- unselectedIconColor: unsafeCSS(`var(--m3e-switch-unselected-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
91
- unselectedIconSize: unsafeCSS("var(--m3e-switch-unselected-icon-size, 1rem)"),
92
- trackHeight: unsafeCSS("var(--m3e-switch-track-height, 2rem)"),
93
- trackWidth: unsafeCSS("var(--m3e-switch-track-width, 3.25rem)"),
94
- trackOutlineColor: unsafeCSS(`var(--m3e-switch-track-outline-color, ${DesignToken.color.outline})`),
95
- trackOutlineWidth: unsafeCSS("var(--m3e-switch-track-outline-width, 0.125rem)"),
96
- trackShape: unsafeCSS(`var(--m3e-switch-track-shape, ${DesignToken.shape.corner.full})`),
97
- selectedTrackColor: unsafeCSS(`var(--m3e-switch-selected-track-color, ${DesignToken.color.primary})`),
98
- unselectedTrackColor: unsafeCSS(`var(--m3e-switch-unselected-track-color, ${DesignToken.color.surfaceContainerHighest})`),
99
- unselectedHandleHeight: unsafeCSS("var(--m3e-switch-unselected-handle-height, 1rem)"),
100
- unselectedHandleWidth: unsafeCSS("var(--m3e-switch-unselected-handle-width, 1rem)"),
101
- withIconHandleHeight: unsafeCSS("var(--m3e-switch-with-icon-handle-height, 1.5rem)"),
102
- withIconHandleWidth: unsafeCSS("var(--m3e-switch-with-icon-handle-width, 1.5rem)"),
103
- selectedHandleHeight: unsafeCSS("var(--m3e-switch-selected-handle-height, 1.5rem)"),
104
- selectedHandleWidth: unsafeCSS("var(--m3e-switch-selected-handle-width, 1.5rem)"),
105
- pressedHandleHeight: unsafeCSS("var(--m3e-switch-pressed-handle-height, 1.75rem)"),
106
- pressedHandleWidth: unsafeCSS("var(--m3e-switch-pressed-handle-width, 1.75rem)"),
107
- handleShape: unsafeCSS(`var(--m3e-switch-handle-shape, ${DesignToken.shape.corner.full})`),
108
- selectedHandleColor: unsafeCSS(`var(--m3e-switch-selected-handle-color, ${DesignToken.color.onPrimary})`),
109
- unselectedHandleColor: unsafeCSS(`var(--m3e-switch-unselected-handle-color, ${DesignToken.color.outline})`),
110
- stateLayerSize: unsafeCSS("var(--m3e-switch-state-layer-size, 2.5rem)"),
111
- stateLayerShape: unsafeCSS(`var(--m3e-switch-state-layer-shape, ${DesignToken.shape.corner.full})`),
112
- disabledSelectedIconColor: unsafeCSS(`var(--m3e-switch-disabled-selected-icon-color, ${DesignToken.color.onSurface})`),
113
- disabledSelectedIconOpacity: unsafeCSS("var(--m3e-switch-disabled-selected-icon-opacity, 38%)"),
114
- disabledUnselectedIconColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
115
- disabledUnselectedIconOpacity: unsafeCSS("var(--m3e-switch-disabled-unselected-icon-opacity, 38%)"),
116
- disabledTrackOpacity: unsafeCSS("var(--m3e-switch-disabled-track-opacity, 12%)"),
117
- disabledSelectedTrackColor: unsafeCSS(`var(--m3e-switch-disabled-selected-track-color, ${DesignToken.color.onSurface})`),
118
- disabledUnselectedTrackColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-track-color, ${DesignToken.color.surfaceContainerHighest})`),
119
- disabledUnselectedTrackOutlineColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-track-outline-color, ${DesignToken.color.onSurface})`),
120
- disabledUnselectedHandleOpacity: unsafeCSS("var(--m3e-switch-disabled-unselected-handle-opacity, 38%)"),
121
- disabledSelectedHandleOpacity: unsafeCSS("var(--m3e-switch-disabled-selected-handle-opacity, 100%)"),
122
- disabledSelectedHandleColor: unsafeCSS(`var(--m3e-switch-disabled-selected-handle-color, ${DesignToken.color.surface})`),
123
- disabledUnselectedHandleColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-handle-color, ${DesignToken.color.onSurface})`),
124
- selectedHoverIconColor: unsafeCSS(`var(--m3e-switch-selected-hover-icon-color, ${DesignToken.color.onPrimaryContainer})`),
125
- unselectedHoverIconColor: unsafeCSS(`var(--m3e-switch-unselected-hover-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
126
- selectedHoverTrackColor: unsafeCSS(`var(--m3e-switch-selected-hover-track-color, ${DesignToken.color.primary})`),
127
- selectedHoverStateLayerColor: unsafeCSS(`var(--m3e-switch-selected-hover-state-layer-color, ${DesignToken.color.primary})`),
128
- selectedHoverStateLayerOpacity: unsafeCSS("var(--m3e-switch-selected-hover-state-layer-opacity, 8%)"),
129
- unselectedHoverTrackColor: unsafeCSS(`var(--m3e-switch-unselected-hover-track-color, ${DesignToken.color.surfaceContainerHighest})`),
130
- unselectedHoverTrackOutlineColor: unsafeCSS(`var(--m3e-switch-unselected-hover-track-outline-color, ${DesignToken.color.outline})`),
131
- unselectedHoverStateLayerColor: unsafeCSS(`var(--m3e-switch-unselected-hover-state-layer-color, ${DesignToken.color.onSurface})`),
132
- unselectedHoverStateLayerOpacity: unsafeCSS("var(--m3e-switch-unselected-hover-state-layer-opacity, 8%)"),
133
- selectedHoverHandleColor: unsafeCSS(`var(--m3e-switch-selected-hover-handle-color, ${DesignToken.color.surfaceContainerHighest})`),
134
- unselectedHoverHandleColor: unsafeCSS(`var(--m3e-switch-unselected-hover-handle-color, ${DesignToken.color.onSurfaceVariant})`),
135
- selectedFocusIconColor: unsafeCSS(`var(--m3e-switch-selected-focus-icon-color, ${DesignToken.color.onPrimaryContainer})`),
136
- unselectedFocusIconColor: unsafeCSS(`var(--m3e-switch-unselected-focus-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
137
- selectedFocusTrackColor: unsafeCSS(`var(--m3e-switch-selected-focus-track-color, ${DesignToken.color.primary})`),
138
- selectedFocusStateLayerColor: unsafeCSS(`var(--m3e-switch-selected-focus-state-layer-color, ${DesignToken.color.primary})`),
139
- selectedFocusStateLayerOpacity: unsafeCSS("var(--m3e-switch-selected-focus-state-layer-opacity, 10%)"),
140
- unselectedFocusTrackColor: unsafeCSS(`var(--m3e-switch-unselected-focus-track-color, ${DesignToken.color.surfaceContainerHighest})`),
141
- unselectedFocusTrackOutlineColor: unsafeCSS(`var(--m3e-switch-unselected-focus-track-outline-color, ${DesignToken.color.outline})`),
142
- unselectedFocusStateLayerColor: unsafeCSS(`var(--m3e-switch-unselected-focus-state-layer-color, ${DesignToken.color.onSurface})`),
143
- unselectedFocusStateLayerOpacity: unsafeCSS("var(--m3e-switch-unselected-focus-state-layer-opacity, 10%)"),
144
- selectedFocusHandleColor: unsafeCSS(`var(--m3e-switch-selected-focus-handle-color, ${DesignToken.color.primaryContainer})`),
145
- unselectedFocusHandleColor: unsafeCSS(`var(--m3e-switch-unselected-focus-handle-color, ${DesignToken.color.onSurfaceVariant})`),
146
- selectedPressedIconColor: unsafeCSS(`var(--m3e-switch-selected-pressed-icon-color, ${DesignToken.color.onPrimaryContainer})`),
147
- unselectedPressedIconColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
148
- selectedPressedTrackColor: unsafeCSS(`var(--m3e-switch-selected-pressed-track-color, ${DesignToken.color.primary})`),
149
- selectedPressedStateLayerColor: unsafeCSS(`var(--m3e-switch-selected-pressed-state-layer-color, ${DesignToken.color.primary})`),
150
- selectedPressedStateLayerOpacity: unsafeCSS("var(--m3e-switch-selected-pressed-state-layer-opacity, 10%)"),
151
- unselectedPressedTrackColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-track-color, ${DesignToken.color.surfaceContainerHighest})`),
152
- unselectedPressedTrackOutlineColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-track-outline-color, ${DesignToken.color.outline})`),
153
- unselectedPressedStateLayerColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-state-layer-color, ${DesignToken.color.onSurface})`),
154
- unselectedPressedStateLayerOpacity: unsafeCSS("var(--m3e-switch-unselected-pressed-state-layer-opacity, 10%)"),
155
- selectedPressedHandleColor: unsafeCSS(`var(--m3e-switch-selected-pressed-handle-color, ${DesignToken.color.primaryContainer})`),
156
- unselectedPressedHandleColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-handle-color, ${DesignToken.color.onSurfaceVariant})`),
442
+ selectedIconColor: unsafeCSS(`var(--m3e-switch-selected-icon-color, ${DesignToken.color.onPrimaryContainer})`),
443
+ selectedIconSize: unsafeCSS("var(--m3e-switch-selected-icon-size, 1rem)"),
444
+ unselectedIconColor: unsafeCSS(`var(--m3e-switch-unselected-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
445
+ unselectedIconSize: unsafeCSS("var(--m3e-switch-unselected-icon-size, 1rem)"),
446
+ trackHeight: unsafeCSS("var(--m3e-switch-track-height, 2rem)"),
447
+ trackWidth: unsafeCSS("var(--m3e-switch-track-width, 3.25rem)"),
448
+ trackOutlineColor: unsafeCSS(`var(--m3e-switch-track-outline-color, ${DesignToken.color.outline})`),
449
+ trackOutlineWidth: unsafeCSS("var(--m3e-switch-track-outline-width, 0.125rem)"),
450
+ trackShape: unsafeCSS(`var(--m3e-switch-track-shape, ${DesignToken.shape.corner.full})`),
451
+ selectedTrackColor: unsafeCSS(`var(--m3e-switch-selected-track-color, ${DesignToken.color.primary})`),
452
+ unselectedTrackColor: unsafeCSS(`var(--m3e-switch-unselected-track-color, ${DesignToken.color.surfaceContainerHighest})`),
453
+ unselectedHandleHeight: unsafeCSS("var(--m3e-switch-unselected-handle-height, 1rem)"),
454
+ unselectedHandleWidth: unsafeCSS("var(--m3e-switch-unselected-handle-width, 1rem)"),
455
+ withIconHandleHeight: unsafeCSS("var(--m3e-switch-with-icon-handle-height, 1.5rem)"),
456
+ withIconHandleWidth: unsafeCSS("var(--m3e-switch-with-icon-handle-width, 1.5rem)"),
457
+ selectedHandleHeight: unsafeCSS("var(--m3e-switch-selected-handle-height, 1.5rem)"),
458
+ selectedHandleWidth: unsafeCSS("var(--m3e-switch-selected-handle-width, 1.5rem)"),
459
+ pressedHandleHeight: unsafeCSS("var(--m3e-switch-pressed-handle-height, 1.75rem)"),
460
+ pressedHandleWidth: unsafeCSS("var(--m3e-switch-pressed-handle-width, 1.75rem)"),
461
+ handleShape: unsafeCSS(`var(--m3e-switch-handle-shape, ${DesignToken.shape.corner.full})`),
462
+ selectedHandleColor: unsafeCSS(`var(--m3e-switch-selected-handle-color, ${DesignToken.color.onPrimary})`),
463
+ unselectedHandleColor: unsafeCSS(`var(--m3e-switch-unselected-handle-color, ${DesignToken.color.outline})`),
464
+ stateLayerSize: unsafeCSS("var(--m3e-switch-state-layer-size, 2.5rem)"),
465
+ stateLayerShape: unsafeCSS(`var(--m3e-switch-state-layer-shape, ${DesignToken.shape.corner.full})`),
466
+ disabledSelectedIconColor: unsafeCSS(`var(--m3e-switch-disabled-selected-icon-color, ${DesignToken.color.onSurface})`),
467
+ disabledSelectedIconOpacity: unsafeCSS("var(--m3e-switch-disabled-selected-icon-opacity, 38%)"),
468
+ disabledUnselectedIconColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
469
+ disabledUnselectedIconOpacity: unsafeCSS("var(--m3e-switch-disabled-unselected-icon-opacity, 38%)"),
470
+ disabledTrackOpacity: unsafeCSS("var(--m3e-switch-disabled-track-opacity, 12%)"),
471
+ disabledSelectedTrackColor: unsafeCSS(`var(--m3e-switch-disabled-selected-track-color, ${DesignToken.color.onSurface})`),
472
+ disabledUnselectedTrackColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-track-color, ${DesignToken.color.surfaceContainerHighest})`),
473
+ disabledUnselectedTrackOutlineColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-track-outline-color, ${DesignToken.color.onSurface})`),
474
+ disabledUnselectedHandleOpacity: unsafeCSS("var(--m3e-switch-disabled-unselected-handle-opacity, 38%)"),
475
+ disabledSelectedHandleOpacity: unsafeCSS("var(--m3e-switch-disabled-selected-handle-opacity, 100%)"),
476
+ disabledSelectedHandleColor: unsafeCSS(`var(--m3e-switch-disabled-selected-handle-color, ${DesignToken.color.surface})`),
477
+ disabledUnselectedHandleColor: unsafeCSS(`var(--m3e-switch-disabled-unselected-handle-color, ${DesignToken.color.onSurface})`),
478
+ selectedHoverIconColor: unsafeCSS(`var(--m3e-switch-selected-hover-icon-color, ${DesignToken.color.onPrimaryContainer})`),
479
+ unselectedHoverIconColor: unsafeCSS(`var(--m3e-switch-unselected-hover-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
480
+ selectedHoverTrackColor: unsafeCSS(`var(--m3e-switch-selected-hover-track-color, ${DesignToken.color.primary})`),
481
+ selectedHoverStateLayerColor: unsafeCSS(`var(--m3e-switch-selected-hover-state-layer-color, ${DesignToken.color.primary})`),
482
+ selectedHoverStateLayerOpacity: unsafeCSS("var(--m3e-switch-selected-hover-state-layer-opacity, 8%)"),
483
+ unselectedHoverTrackColor: unsafeCSS(`var(--m3e-switch-unselected-hover-track-color, ${DesignToken.color.surfaceContainerHighest})`),
484
+ unselectedHoverTrackOutlineColor: unsafeCSS(`var(--m3e-switch-unselected-hover-track-outline-color, ${DesignToken.color.outline})`),
485
+ unselectedHoverStateLayerColor: unsafeCSS(`var(--m3e-switch-unselected-hover-state-layer-color, ${DesignToken.color.onSurface})`),
486
+ unselectedHoverStateLayerOpacity: unsafeCSS("var(--m3e-switch-unselected-hover-state-layer-opacity, 8%)"),
487
+ selectedHoverHandleColor: unsafeCSS(`var(--m3e-switch-selected-hover-handle-color, ${DesignToken.color.surfaceContainerHighest})`),
488
+ unselectedHoverHandleColor: unsafeCSS(`var(--m3e-switch-unselected-hover-handle-color, ${DesignToken.color.onSurfaceVariant})`),
489
+ selectedFocusIconColor: unsafeCSS(`var(--m3e-switch-selected-focus-icon-color, ${DesignToken.color.onPrimaryContainer})`),
490
+ unselectedFocusIconColor: unsafeCSS(`var(--m3e-switch-unselected-focus-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
491
+ selectedFocusTrackColor: unsafeCSS(`var(--m3e-switch-selected-focus-track-color, ${DesignToken.color.primary})`),
492
+ selectedFocusStateLayerColor: unsafeCSS(`var(--m3e-switch-selected-focus-state-layer-color, ${DesignToken.color.primary})`),
493
+ selectedFocusStateLayerOpacity: unsafeCSS("var(--m3e-switch-selected-focus-state-layer-opacity, 10%)"),
494
+ unselectedFocusTrackColor: unsafeCSS(`var(--m3e-switch-unselected-focus-track-color, ${DesignToken.color.surfaceContainerHighest})`),
495
+ unselectedFocusTrackOutlineColor: unsafeCSS(`var(--m3e-switch-unselected-focus-track-outline-color, ${DesignToken.color.outline})`),
496
+ unselectedFocusStateLayerColor: unsafeCSS(`var(--m3e-switch-unselected-focus-state-layer-color, ${DesignToken.color.onSurface})`),
497
+ unselectedFocusStateLayerOpacity: unsafeCSS("var(--m3e-switch-unselected-focus-state-layer-opacity, 10%)"),
498
+ selectedFocusHandleColor: unsafeCSS(`var(--m3e-switch-selected-focus-handle-color, ${DesignToken.color.primaryContainer})`),
499
+ unselectedFocusHandleColor: unsafeCSS(`var(--m3e-switch-unselected-focus-handle-color, ${DesignToken.color.onSurfaceVariant})`),
500
+ selectedPressedIconColor: unsafeCSS(`var(--m3e-switch-selected-pressed-icon-color, ${DesignToken.color.onPrimaryContainer})`),
501
+ unselectedPressedIconColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-icon-color, ${DesignToken.color.surfaceContainerHighest})`),
502
+ selectedPressedTrackColor: unsafeCSS(`var(--m3e-switch-selected-pressed-track-color, ${DesignToken.color.primary})`),
503
+ selectedPressedStateLayerColor: unsafeCSS(`var(--m3e-switch-selected-pressed-state-layer-color, ${DesignToken.color.primary})`),
504
+ selectedPressedStateLayerOpacity: unsafeCSS("var(--m3e-switch-selected-pressed-state-layer-opacity, 10%)"),
505
+ unselectedPressedTrackColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-track-color, ${DesignToken.color.surfaceContainerHighest})`),
506
+ unselectedPressedTrackOutlineColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-track-outline-color, ${DesignToken.color.outline})`),
507
+ unselectedPressedStateLayerColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-state-layer-color, ${DesignToken.color.onSurface})`),
508
+ unselectedPressedStateLayerOpacity: unsafeCSS("var(--m3e-switch-unselected-pressed-state-layer-opacity, 10%)"),
509
+ selectedPressedHandleColor: unsafeCSS(`var(--m3e-switch-selected-pressed-handle-color, ${DesignToken.color.primaryContainer})`),
510
+ unselectedPressedHandleColor: unsafeCSS(`var(--m3e-switch-unselected-pressed-handle-color, ${DesignToken.color.onSurfaceVariant})`)
157
511
  };
158
512
 
159
513
  /**
160
514
  * Handle styles for `M3eSwitchElement`.
161
515
  * @internal
162
516
  */
163
- const SwitchHandleStyle = css `
164
- .handle {
165
- position: relative;
166
- display: flex;
167
- align-items: center;
168
- justify-content: center;
169
- pointer-events: none;
170
- transform-origin: center center;
171
- border-radius: ${SwitchToken.handleShape};
172
- transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard},
173
- transform var(--_switch-handle-effect),
174
- width ${DesignToken.motion.spring.fastEffects},
175
- height ${DesignToken.motion.spring.fastEffects}`)};
176
- }
177
- .track:not(.pressed) .handle {
178
- --_switch-handle-effect: ${DesignToken.motion.spring.fastSpatial};
179
- }
180
- .track.pressed .handle {
181
- --_switch-handle-effect: ${DesignToken.motion.spring.fastEffects};
182
- }
183
- :host(:not([aria-disabled="true"]):not([checked])[icons="both"]) .track:not(.pressed) .handle {
184
- width: ${SwitchToken.withIconHandleWidth};
185
- height: ${SwitchToken.withIconHandleHeight};
186
- }
187
- :host(:not([checked]):not([icons="both"])) .track:not(.pressed) .handle,
188
- :host([aria-disabled="true"]:not([checked])) .handle {
189
- width: ${SwitchToken.unselectedHandleWidth};
190
- height: ${SwitchToken.unselectedHandleHeight};
191
- }
192
- :host([checked]) .track:not(.pressed) .handle {
193
- width: ${SwitchToken.selectedHandleWidth};
194
- height: ${SwitchToken.selectedHandleHeight};
195
- }
196
- .track.pressed .handle {
197
- width: ${SwitchToken.pressedHandleWidth};
198
- height: ${SwitchToken.pressedHandleHeight};
199
- }
200
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .handle {
201
- background-color: ${SwitchToken.unselectedHandleColor};
202
- }
203
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .handle {
204
- background-color: ${SwitchToken.unselectedHoverHandleColor};
205
- }
206
- :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .handle {
207
- background-color: ${SwitchToken.unselectedFocusHandleColor};
208
- }
209
- :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .handle {
210
- background-color: ${SwitchToken.unselectedPressedHandleColor};
211
- }
212
- :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .handle {
213
- background-color: ${SwitchToken.selectedHandleColor};
214
- }
215
- :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .handle {
216
- background-color: ${SwitchToken.selectedHoverHandleColor};
217
- }
218
- :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .handle {
219
- background-color: ${SwitchToken.selectedFocusHandleColor};
220
- }
221
- :host(:not([aria-disabled="true"])[checked]) .track.pressed .handle {
222
- background-color: ${SwitchToken.selectedPressedHandleColor};
223
- }
224
- :host([aria-disabled="true"]:not([checked])) .handle {
225
- background-color: color-mix(
226
- in srgb,
227
- ${SwitchToken.disabledUnselectedHandleColor} ${SwitchToken.disabledUnselectedHandleOpacity},
228
- transparent
229
- );
230
- }
231
- :host([aria-disabled="true"][checked]) .handle {
232
- background-color: color-mix(
233
- in srgb,
234
- ${SwitchToken.disabledSelectedHandleColor} ${SwitchToken.disabledSelectedHandleOpacity},
235
- transparent
236
- );
237
- }
238
- :host([checked]) .track:not(.pressed) .handle {
239
- transform: translateX(
240
- calc(${SwitchToken.trackWidth} - ${SwitchToken.selectedHandleWidth} - ${SwitchToken.trackOutlineWidth})
241
- );
242
- }
243
- :host([checked]) .track.pressed .handle {
244
- transform: translateX(
245
- calc(${SwitchToken.trackWidth} - ${SwitchToken.pressedHandleWidth} - ${SwitchToken.trackOutlineWidth})
246
- );
247
- }
248
- :host(:not([checked]):not([icons="both"])) .track:not(.pressed) .handle,
249
- :host([aria-disabled="true"]:not([checked])) .handle {
250
- transform: translateX(
251
- calc(
252
- ${SwitchToken.trackOutlineWidth} + calc(${SwitchToken.pressedHandleWidth} - ${SwitchToken.withIconHandleWidth})
253
- )
254
- );
255
- }
256
- :host(:not([aria-disabled="true"]):not([checked])[icons="both"]) .track:not(.pressed) .handle {
257
- transform: translateX(${SwitchToken.trackOutlineWidth});
258
- }
259
- @media (forced-colors: active) {
260
- .handle {
261
- transition: ${unsafeCSS(`transform var(--_switch-handle-effect),
262
- width ${DesignToken.motion.spring.fastEffects},
263
- height ${DesignToken.motion.spring.fastEffects}`)};
264
- }
265
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .handle,
266
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .handle,
267
- :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .handle,
268
- :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .handle {
269
- background-color: ButtonText;
270
- }
271
- :host([aria-disabled="true"]:not([checked])) .handle {
272
- background-color: GrayText;
273
- }
274
- :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .handle,
275
- :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .handle,
276
- :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .handle,
277
- :host(:not([aria-disabled="true"])[checked]) .track.pressed .handle {
278
- background-color: Canvas;
279
- }
280
- :host([aria-disabled="true"][checked]) .handle {
281
- background-color: Canvas;
282
- }
283
- }
284
- @media (prefers-reduced-motion) {
285
- .handle {
286
- transition: none;
287
- }
288
- }
289
- `;
517
+ const SwitchHandleStyle = css`.handle { position: relative; display: flex; align-items: center; justify-content: center; pointer-events: none; transform-origin: center center; border-radius: ${SwitchToken.handleShape}; transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard},
518
+ transform var(--_switch-handle-effect),
519
+ width ${DesignToken.motion.spring.fastEffects},
520
+ height ${DesignToken.motion.spring.fastEffects}`)}; } .track:not(.pressed) .handle { --_switch-handle-effect: ${DesignToken.motion.spring.fastSpatial}; } .track.pressed .handle { --_switch-handle-effect: ${DesignToken.motion.spring.fastEffects}; } :host(:not([aria-disabled="true"]):not([checked])[icons="both"]) .track:not(.pressed) .handle { width: ${SwitchToken.withIconHandleWidth}; height: ${SwitchToken.withIconHandleHeight}; } :host(:not([checked]):not([icons="both"])) .track:not(.pressed) .handle, :host([aria-disabled="true"]:not([checked])) .handle { width: ${SwitchToken.unselectedHandleWidth}; height: ${SwitchToken.unselectedHandleHeight}; } :host([checked]) .track:not(.pressed) .handle { width: ${SwitchToken.selectedHandleWidth}; height: ${SwitchToken.selectedHandleHeight}; } .track.pressed .handle { width: ${SwitchToken.pressedHandleWidth}; height: ${SwitchToken.pressedHandleHeight}; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .handle { background-color: ${SwitchToken.unselectedHandleColor}; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .handle { background-color: ${SwitchToken.unselectedHoverHandleColor}; } :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .handle { background-color: ${SwitchToken.unselectedFocusHandleColor}; } :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .handle { background-color: ${SwitchToken.unselectedPressedHandleColor}; } :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .handle { background-color: ${SwitchToken.selectedHandleColor}; } :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .handle { background-color: ${SwitchToken.selectedHoverHandleColor}; } :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .handle { background-color: ${SwitchToken.selectedFocusHandleColor}; } :host(:not([aria-disabled="true"])[checked]) .track.pressed .handle { background-color: ${SwitchToken.selectedPressedHandleColor}; } :host([aria-disabled="true"]:not([checked])) .handle { background-color: color-mix( in srgb, ${SwitchToken.disabledUnselectedHandleColor} ${SwitchToken.disabledUnselectedHandleOpacity}, transparent ); } :host([aria-disabled="true"][checked]) .handle { background-color: color-mix( in srgb, ${SwitchToken.disabledSelectedHandleColor} ${SwitchToken.disabledSelectedHandleOpacity}, transparent ); } :host(:not(:dir(rtl))[checked]) .track:not(.pressed) .handle { transform: translateX( calc(${SwitchToken.trackWidth} - ${SwitchToken.selectedHandleWidth} - ${SwitchToken.trackOutlineWidth}) ); } :host(:dir(rtl)[checked]) .track:not(.pressed) .handle { transform: translateX( calc( 0px - calc(${SwitchToken.trackWidth} - ${SwitchToken.selectedHandleWidth} - ${SwitchToken.trackOutlineWidth}) ) ); } :host(:not(:dir(rtl))[checked]) .track.pressed .handle { transform: translateX( calc(${SwitchToken.trackWidth} - ${SwitchToken.pressedHandleWidth} - ${SwitchToken.trackOutlineWidth}) ); } :host(:dir(rtl)[checked]) .track.pressed .handle { transform: translateX( calc(0px - calc(${SwitchToken.trackWidth} - ${SwitchToken.pressedHandleWidth} - ${SwitchToken.trackOutlineWidth})) ); } :host(:not(:dir(rtl)):not([checked]):not([icons="both"])) .track:not(.pressed) .handle, :host(:not(:dir(rtl))[aria-disabled="true"]:not([checked])) .handle { transform: translateX( calc( ${SwitchToken.trackOutlineWidth} + calc(${SwitchToken.pressedHandleWidth} - ${SwitchToken.withIconHandleWidth}) ) ); } :host(:dir(rtl):not([checked]):not([icons="both"])) .track:not(.pressed) .handle, :host(:dir(rtl)[aria-disabled="true"]:not([checked])) .handle { transform: translateX( calc( 0px - calc( ${SwitchToken.trackOutlineWidth} + calc(${SwitchToken.pressedHandleWidth} - ${SwitchToken.withIconHandleWidth}) ) ) ); } :host(:not(:dir(rtl)):not([aria-disabled="true"]):not([checked])[icons="both"]) .track:not(.pressed) .handle { transform: translateX(${SwitchToken.trackOutlineWidth}); } :host(:dir(rtl):not([aria-disabled="true"]):not([checked])[icons="both"]) .track:not(.pressed) .handle { transform: translateX(calc(0px - ${SwitchToken.trackOutlineWidth})); } @media (forced-colors: active) { .handle { transition: ${unsafeCSS(`transform var(--_switch-handle-effect),
521
+ width ${DesignToken.motion.spring.fastEffects},
522
+ height ${DesignToken.motion.spring.fastEffects}`)}; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .handle, :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .handle, :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .handle, :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .handle { background-color: ButtonText; } :host([aria-disabled="true"]:not([checked])) .handle { background-color: GrayText; } :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .handle, :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .handle, :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .handle, :host(:not([aria-disabled="true"])[checked]) .track.pressed .handle { background-color: Canvas; } :host([aria-disabled="true"][checked]) .handle { background-color: Canvas; } } @media (prefers-reduced-motion) { .handle { transition: none; } }`;
290
523
 
291
524
  /**
292
525
  * Icon styles for `M3eSwitchElement`.
293
526
  * @internal
294
527
  */
295
- const SwitchIconStyle = css `
296
- :host([icons="none"]) .icon,
297
- :host([icons="selected"]:not([checked])) .icon,
298
- :host([aria-disabled="true"]:not([checked])) .icon {
299
- display: none;
300
- }
301
- .icon {
302
- width: 1em;
303
- transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)};
304
- }
305
- :host(:not([checked])) .icon {
306
- font-size: ${SwitchToken.unselectedIconSize};
307
- }
308
- :host([checked]) .icon {
309
- font-size: ${SwitchToken.selectedIconSize};
310
- }
311
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .icon {
312
- color: ${SwitchToken.unselectedIconColor};
313
- }
314
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .icon {
315
- color: ${SwitchToken.unselectedHoverIconColor};
316
- }
317
- :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .icon {
318
- color: ${SwitchToken.unselectedFocusIconColor};
319
- }
320
- :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .icon {
321
- color: ${SwitchToken.unselectedPressedIconColor};
322
- }
323
- :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .icon {
324
- color: ${SwitchToken.selectedIconColor};
325
- }
326
- :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .icon {
327
- color: ${SwitchToken.selectedHoverIconColor};
328
- }
329
- :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .icon {
330
- color: ${SwitchToken.selectedFocusIconColor};
331
- }
332
- :host(:not([aria-disabled="true"])[checked]) .track.pressed .icon {
333
- color: ${SwitchToken.selectedPressedIconColor};
334
- }
335
- :host([aria-disabled="true"]:not([checked])) .icon {
336
- color: color-mix(
337
- in srgb,
338
- ${SwitchToken.disabledUnselectedIconColor} ${SwitchToken.disabledUnselectedIconOpacity},
339
- transparent
340
- );
341
- }
342
- :host([aria-disabled="true"][checked]) .icon {
343
- color: color-mix(
344
- in srgb,
345
- ${SwitchToken.disabledSelectedIconColor} ${SwitchToken.disabledSelectedIconOpacity},
346
- transparent
347
- );
348
- }
349
- @media (forced-colors: active) {
350
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .icon,
351
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .icon,
352
- :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .icon,
353
- :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .icon {
354
- color: Canvas;
355
- }
356
- :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .icon,
357
- :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .icon,
358
- :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .icon,
359
- :host(:not([aria-disabled="true"])[checked]) .track.pressed .icon {
360
- color: CanvasText;
361
- }
362
- :host([aria-disabled="true"]:not([checked])) .icon {
363
- color: Canvas;
364
- }
365
- :host([aria-disabled="true"][checked]) .icon {
366
- color: GrayText;
367
- }
368
- }
369
- @media (prefers-reduced-motion) {
370
- .icon {
371
- transition: none;
372
- }
373
- }
374
- `;
528
+ const SwitchIconStyle = css`:host([icons="none"]) .icon, :host([icons="selected"]:not([checked])) .icon, :host([aria-disabled="true"]:not([checked])) .icon { display: none; } .icon { width: 1em; transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } :host(:not([checked])) .icon { font-size: ${SwitchToken.unselectedIconSize}; } :host([checked]) .icon { font-size: ${SwitchToken.selectedIconSize}; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .icon { color: ${SwitchToken.unselectedIconColor}; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .icon { color: ${SwitchToken.unselectedHoverIconColor}; } :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .icon { color: ${SwitchToken.unselectedFocusIconColor}; } :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .icon { color: ${SwitchToken.unselectedPressedIconColor}; } :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .icon { color: ${SwitchToken.selectedIconColor}; } :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .icon { color: ${SwitchToken.selectedHoverIconColor}; } :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .icon { color: ${SwitchToken.selectedFocusIconColor}; } :host(:not([aria-disabled="true"])[checked]) .track.pressed .icon { color: ${SwitchToken.selectedPressedIconColor}; } :host([aria-disabled="true"]:not([checked])) .icon { color: color-mix( in srgb, ${SwitchToken.disabledUnselectedIconColor} ${SwitchToken.disabledUnselectedIconOpacity}, transparent ); } :host([aria-disabled="true"][checked]) .icon { color: color-mix( in srgb, ${SwitchToken.disabledSelectedIconColor} ${SwitchToken.disabledSelectedIconOpacity}, transparent ); } @media (forced-colors: active) { :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) .icon, :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) .icon, :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) .icon, :host(:not([aria-disabled="true"]):not([checked])) .track.pressed .icon { color: Canvas; } :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) .icon, :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) .icon, :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) .icon, :host(:not([aria-disabled="true"])[checked]) .track.pressed .icon { color: CanvasText; } :host([aria-disabled="true"]:not([checked])) .icon { color: Canvas; } :host([aria-disabled="true"][checked]) .icon { color: GrayText; } } @media (prefers-reduced-motion) { .icon { transition: none; } }`;
375
529
 
376
530
  /**
377
531
  * State layer styles for `M3eSwitchElement`.
378
532
  * @internal
379
533
  */
380
- const SwitchStateLayerStyle = css `
381
- .state-layer {
382
- width: ${SwitchToken.stateLayerSize};
383
- height: ${SwitchToken.stateLayerSize};
384
- border-radius: ${SwitchToken.stateLayerShape};
385
- }
386
- :host(:not([checked])[icons="both"]) .track:not(.pressed) .state-layer {
387
- left: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.withIconHandleWidth}) / 2));
388
- top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.withIconHandleHeight}) / 2));
389
- }
390
- :host(:not([checked]):not([icons="both"])) .track:not(.pressed) .state-layer {
391
- left: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.unselectedHandleWidth}) / 2));
392
- top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.unselectedHandleHeight}) / 2));
393
- }
394
- :host([checked]) .track:not(.pressed) .state-layer {
395
- left: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.selectedHandleWidth}) / 2));
396
- top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.selectedHandleHeight}) / 2));
397
- }
398
- .track.pressed .state-layer {
399
- left: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.pressedHandleWidth}) / 2));
400
- top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.pressedHandleWidth}) / 2));
401
- }
402
- :host(:not([checked])) .state-layer {
403
- --m3e-state-layer-hover-color: ${SwitchToken.unselectedHoverStateLayerColor};
404
- --m3e-state-layer-hover-opacity: ${SwitchToken.unselectedHoverStateLayerOpacity};
405
- --m3e-state-layer-focus-color: ${SwitchToken.unselectedFocusStateLayerColor};
406
- --m3e-state-layer-focus-opacity: ${SwitchToken.unselectedFocusStateLayerOpacity};
407
- }
408
- :host([checked]) .state-layer {
409
- --m3e-state-layer-hover-color: ${SwitchToken.selectedHoverStateLayerColor};
410
- --m3e-state-layer-hover-opacity: ${SwitchToken.selectedHoverStateLayerOpacity};
411
- --m3e-state-layer-focus-color: ${SwitchToken.selectedFocusStateLayerColor};
412
- --m3e-state-layer-focus-opacity: ${SwitchToken.selectedFocusStateLayerOpacity};
413
- }
414
- `;
534
+ const SwitchStateLayerStyle = css`.state-layer { width: ${SwitchToken.stateLayerSize}; height: ${SwitchToken.stateLayerSize}; border-radius: ${SwitchToken.stateLayerShape}; } :host(:not([checked])[icons="both"]) .track:not(.pressed) .state-layer { inset-inline-start: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.withIconHandleWidth}) / 2)); top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.withIconHandleHeight}) / 2)); } :host(:not([checked]):not([icons="both"])) .track:not(.pressed) .state-layer { inset-inline-start: calc( 0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.unselectedHandleWidth}) / 2) ); top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.unselectedHandleHeight}) / 2)); } :host([checked]) .track:not(.pressed) .state-layer { inset-inline-start: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.selectedHandleWidth}) / 2)); top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.selectedHandleHeight}) / 2)); } .track.pressed .state-layer { inset-inline-start: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.pressedHandleWidth}) / 2)); top: calc(0px - calc(calc(${SwitchToken.stateLayerSize} - ${SwitchToken.pressedHandleWidth}) / 2)); } :host(:not([checked])) .state-layer { --m3e-state-layer-hover-color: ${SwitchToken.unselectedHoverStateLayerColor}; --m3e-state-layer-hover-opacity: ${SwitchToken.unselectedHoverStateLayerOpacity}; --m3e-state-layer-focus-color: ${SwitchToken.unselectedFocusStateLayerColor}; --m3e-state-layer-focus-opacity: ${SwitchToken.unselectedFocusStateLayerOpacity}; } :host([checked]) .state-layer { --m3e-state-layer-hover-color: ${SwitchToken.selectedHoverStateLayerColor}; --m3e-state-layer-hover-opacity: ${SwitchToken.selectedHoverStateLayerOpacity}; --m3e-state-layer-focus-color: ${SwitchToken.selectedFocusStateLayerColor}; --m3e-state-layer-focus-opacity: ${SwitchToken.selectedFocusStateLayerOpacity}; }`;
415
535
 
416
536
  /**
417
537
  * Baseline styles for `M3eSwitchElement`.
418
538
  * @internal
419
539
  */
420
- const SwitchStyle = css `
421
- :host {
422
- display: inline-block;
423
- position: relative;
424
- outline: none;
425
- height: fit-content;
426
- width: fit-content;
427
- user-select: none;
428
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
429
- }
430
- :host(:not([aria-disabled="true"])) {
431
- cursor: pointer;
432
- }
433
- .focus-ring {
434
- border-radius: ${SwitchToken.trackShape};
435
- }
436
- .touch {
437
- position: absolute;
438
- height: 3rem;
439
- left: 0;
440
- right: 0;
441
- }
442
- .base {
443
- display: flex;
444
- align-items: center;
445
- justify-content: center;
446
- }
447
- `;
540
+ const SwitchStyle = css`:host { display: inline-block; position: relative; outline: none; height: fit-content; width: fit-content; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not([aria-disabled="true"])) { cursor: pointer; } .focus-ring { border-radius: ${SwitchToken.trackShape}; } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .base { display: flex; align-items: center; justify-content: center; }`;
448
541
 
449
542
  /**
450
543
  * Track styles for `M3eSwitchElement`.
451
544
  * @internal
452
545
  */
453
- const SwitchTrackStyle = css `
454
- .track {
455
- display: flex;
456
- align-items: center;
457
- position: relative;
458
- box-sizing: border-box;
459
- border-radius: ${SwitchToken.trackShape};
460
- width: ${SwitchToken.trackWidth};
461
- height: ${SwitchToken.trackHeight};
462
- transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)};
463
- }
464
- :host(:not([checked])) .track {
465
- border-width: ${SwitchToken.trackOutlineWidth};
466
- border-style: solid;
467
- }
468
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) {
469
- border-color: ${SwitchToken.trackOutlineColor};
470
- background-color: ${SwitchToken.unselectedTrackColor};
471
- }
472
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) {
473
- border-color: ${SwitchToken.unselectedHoverTrackOutlineColor};
474
- background-color: ${SwitchToken.unselectedHoverTrackColor};
475
- }
476
- :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) {
477
- border-color: ${SwitchToken.unselectedFocusTrackOutlineColor};
478
- background-color: ${SwitchToken.unselectedFocusTrackColor};
479
- }
480
- :host(:not([aria-disabled="true"]):not([checked])) .track.pressed {
481
- border-color: ${SwitchToken.unselectedPressedTrackOutlineColor};
482
- background-color: ${SwitchToken.unselectedPressedTrackColor};
483
- }
484
- :host([aria-disabled="true"]:not([checked])) .track {
485
- border-color: color-mix(
486
- in srgb,
487
- ${SwitchToken.disabledUnselectedTrackOutlineColor} ${SwitchToken.disabledTrackOpacity},
488
- transparent
489
- );
490
- background-color: color-mix(
491
- in srgb,
492
- ${SwitchToken.disabledUnselectedTrackColor} ${SwitchToken.disabledTrackOpacity},
493
- transparent
494
- );
495
- }
496
- :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) {
497
- background-color: ${SwitchToken.selectedTrackColor};
498
- }
499
- :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) {
500
- background-color: ${SwitchToken.selectedHoverTrackColor};
501
- }
502
- :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) {
503
- background-color: ${SwitchToken.selectedFocusTrackColor};
504
- }
505
- :host(:not([aria-disabled="true"])[checked]) .track.pressed {
506
- background-color: ${SwitchToken.selectedPressedTrackColor};
507
- }
508
- :host([aria-disabled="true"][checked]) .track {
509
- background-color: color-mix(
510
- in srgb,
511
- ${SwitchToken.disabledSelectedTrackColor} ${SwitchToken.disabledTrackOpacity},
512
- transparent
513
- );
514
- }
515
- @media (forced-colors: active) {
516
- .track {
517
- transition: none;
518
- }
519
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed),
520
- :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed),
521
- :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed),
522
- :host(:not([aria-disabled="true"]):not([checked])) .track.pressed {
523
- border-color: ButtonText;
524
- background-color: Canvas;
525
- }
526
- :host([aria-disabled="true"]:not([checked])) .track {
527
- border-color: GrayText;
528
- background-color: Canvas;
529
- }
530
- :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed),
531
- :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed),
532
- :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed),
533
- :host(:not([aria-disabled="true"])[checked]) .track.pressed {
534
- background-color: ButtonText;
535
- }
536
- :host([aria-disabled="true"][checked]) .track {
537
- background-color: GrayText;
538
- }
539
- }
540
- @media (prefers-reduced-motion) {
541
- .track {
542
- transition: none;
543
- }
544
- }
545
- `;
546
+ const SwitchTrackStyle = css`.track { display: flex; align-items: center; position: relative; box-sizing: border-box; border-radius: ${SwitchToken.trackShape}; width: ${SwitchToken.trackWidth}; height: ${SwitchToken.trackHeight}; transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } :host(:not([checked])) .track { border-width: ${SwitchToken.trackOutlineWidth}; border-style: solid; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed) { border-color: ${SwitchToken.trackOutlineColor}; background-color: ${SwitchToken.unselectedTrackColor}; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed) { border-color: ${SwitchToken.unselectedHoverTrackOutlineColor}; background-color: ${SwitchToken.unselectedHoverTrackColor}; } :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed) { border-color: ${SwitchToken.unselectedFocusTrackOutlineColor}; background-color: ${SwitchToken.unselectedFocusTrackColor}; } :host(:not([aria-disabled="true"]):not([checked])) .track.pressed { border-color: ${SwitchToken.unselectedPressedTrackOutlineColor}; background-color: ${SwitchToken.unselectedPressedTrackColor}; } :host([aria-disabled="true"]:not([checked])) .track { border-color: color-mix( in srgb, ${SwitchToken.disabledUnselectedTrackOutlineColor} ${SwitchToken.disabledTrackOpacity}, transparent ); background-color: color-mix( in srgb, ${SwitchToken.disabledUnselectedTrackColor} ${SwitchToken.disabledTrackOpacity}, transparent ); } :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed) { background-color: ${SwitchToken.selectedTrackColor}; } :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed) { background-color: ${SwitchToken.selectedHoverTrackColor}; } :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed) { background-color: ${SwitchToken.selectedFocusTrackColor}; } :host(:not([aria-disabled="true"])[checked]) .track.pressed { background-color: ${SwitchToken.selectedPressedTrackColor}; } :host([aria-disabled="true"][checked]) .track { background-color: color-mix( in srgb, ${SwitchToken.disabledSelectedTrackColor} ${SwitchToken.disabledTrackOpacity}, transparent ); } @media (forced-colors: active) { .track { transition: none; } :host(:not([aria-disabled="true"]):not([checked]):not(:focus):not(:hover)) .track:not(.pressed), :host(:not([aria-disabled="true"]):not([checked]):not(:focus):hover) .track:not(.pressed), :host(:not([aria-disabled="true"]):not([checked]):focus) .track:not(.pressed), :host(:not([aria-disabled="true"]):not([checked])) .track.pressed { border-color: ButtonText; background-color: Canvas; } :host([aria-disabled="true"]:not([checked])) .track { border-color: GrayText; background-color: Canvas; } :host(:not([aria-disabled="true"])[checked]:not(:focus):not(:hover)) .track:not(.pressed), :host(:not([aria-disabled="true"])[checked]:not(:focus):hover) .track:not(.pressed), :host(:not([aria-disabled="true"])[checked]:focus) .track:not(.pressed), :host(:not([aria-disabled="true"])[checked]) .track.pressed { background-color: ButtonText; } :host([aria-disabled="true"][checked]) .track { background-color: GrayText; } } @media (prefers-reduced-motion) { .track { transition: none; } }`;
546
547
 
547
548
  var _M3eSwitchElement_instances, _M3eSwitchElement_clickHandler, _M3eSwitchElement_hoverController, _M3eSwitchElement_pressedController, _M3eSwitchElement_renderIcon, _M3eSwitchElement_handleClick;
548
549
  /**
@@ -653,127 +654,103 @@ var _M3eSwitchElement_instances, _M3eSwitchElement_clickHandler, _M3eSwitchEleme
653
654
  * @cssprop --m3e-switch-unselected-pressed-handle-color - Handle color when unselected and pressed.
654
655
  */
655
656
  let M3eSwitchElement = class M3eSwitchElement extends Labelled(Dirty(Touched(ConstraintValidation(Checked(FormAssociated(KeyboardClick(Focusable(Disabled(AttachInternals(Role(LitElement, "switch"))))))))))) {
656
- constructor() {
657
- super();
658
- _M3eSwitchElement_instances.add(this);
659
- /** @private */ _M3eSwitchElement_clickHandler.set(this, (e) => __classPrivateFieldGet(this, _M3eSwitchElement_instances, "m", _M3eSwitchElement_handleClick).call(this, e));
660
- /** @private */ _M3eSwitchElement_hoverController.set(this, new HoverController(this, {
661
- target: null,
662
- callback: (hovering) => {
663
- if (this.disabled)
664
- return;
665
- if (hovering) {
666
- this._stateLayer?.show("hover");
667
- }
668
- else {
669
- this._stateLayer?.hide("hover");
670
- }
671
- },
672
- }));
673
- /** @private */ _M3eSwitchElement_pressedController.set(this, new PressedController(this, {
674
- target: null,
675
- callback: (pressed) => this._track?.classList.toggle("pressed", pressed && !this.disabled),
676
- }));
677
- /**
678
- * The icons to present.
679
- * @default "none"
680
- */
681
- this.icons = "none";
682
- /**
683
- * A string representing the value of the switch.
684
- * @default "on"
685
- */
686
- this.value = "on";
687
- new PressedController(this, {
688
- isPressedKey: (key) => key === " ",
689
- callback: (pressed) => this._track?.classList.toggle("pressed", pressed && !this.disabled),
690
- });
691
- }
692
- /** @inheritdoc @private */
693
- get [(_M3eSwitchElement_clickHandler = new WeakMap(), _M3eSwitchElement_hoverController = new WeakMap(), _M3eSwitchElement_pressedController = new WeakMap(), _M3eSwitchElement_instances = new WeakSet(), formValue)]() {
694
- return !this.checked ? null : this.value;
695
- }
696
- /** @inheritdoc */
697
- connectedCallback() {
698
- super.connectedCallback();
699
- this.addEventListener("click", __classPrivateFieldGet(this, _M3eSwitchElement_clickHandler, "f"));
700
- for (const label of this.labels) {
701
- __classPrivateFieldGet(this, _M3eSwitchElement_hoverController, "f").observe(label);
702
- __classPrivateFieldGet(this, _M3eSwitchElement_pressedController, "f").observe(label);
703
- }
704
- }
705
- /** @inheritdoc */
706
- disconnectedCallback() {
707
- super.disconnectedCallback();
708
- this.removeEventListener("click", __classPrivateFieldGet(this, _M3eSwitchElement_clickHandler, "f"));
709
- for (const label of this.labels) {
710
- __classPrivateFieldGet(this, _M3eSwitchElement_hoverController, "f").unobserve(label);
711
- __classPrivateFieldGet(this, _M3eSwitchElement_pressedController, "f").unobserve(label);
657
+ constructor() {
658
+ super();
659
+ _M3eSwitchElement_instances.add(this);
660
+ /** @private */
661
+ _M3eSwitchElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eSwitchElement_instances, "m", _M3eSwitchElement_handleClick).call(this, e));
662
+ /** @private */
663
+ _M3eSwitchElement_hoverController.set(this, new HoverController(this, {
664
+ target: null,
665
+ callback: hovering => {
666
+ if (this.disabled) return;
667
+ if (hovering) {
668
+ this._stateLayer?.show("hover");
669
+ } else {
670
+ this._stateLayer?.hide("hover");
712
671
  }
672
+ }
673
+ }));
674
+ /** @private */
675
+ _M3eSwitchElement_pressedController.set(this, new PressedController(this, {
676
+ target: null,
677
+ callback: pressed => this._track?.classList.toggle("pressed", pressed && !this.disabled)
678
+ }));
679
+ /**
680
+ * The icons to present.
681
+ * @default "none"
682
+ */
683
+ this.icons = "none";
684
+ /**
685
+ * A string representing the value of the switch.
686
+ * @default "on"
687
+ */
688
+ this.value = "on";
689
+ new PressedController(this, {
690
+ isPressedKey: key => key === " ",
691
+ callback: pressed => this._track?.classList.toggle("pressed", pressed && !this.disabled)
692
+ });
693
+ }
694
+ /** @inheritdoc @private */
695
+ get [(_M3eSwitchElement_clickHandler = new WeakMap(), _M3eSwitchElement_hoverController = new WeakMap(), _M3eSwitchElement_pressedController = new WeakMap(), _M3eSwitchElement_instances = new WeakSet(), formValue)]() {
696
+ return !this.checked ? null : this.value;
697
+ }
698
+ /** @inheritdoc */
699
+ connectedCallback() {
700
+ super.connectedCallback();
701
+ this.addEventListener("click", __classPrivateFieldGet(this, _M3eSwitchElement_clickHandler, "f"));
702
+ for (const label of this.labels) {
703
+ __classPrivateFieldGet(this, _M3eSwitchElement_hoverController, "f").observe(label);
704
+ __classPrivateFieldGet(this, _M3eSwitchElement_pressedController, "f").observe(label);
713
705
  }
714
- /** @inheritdoc */
715
- firstUpdated(_changedProperties) {
716
- super.firstUpdated(_changedProperties);
717
- [this._focusRing, this._stateLayer].forEach((x) => x?.attach(this));
718
- }
719
- /** @inheritdoc */
720
- render() {
721
- return html `<m3e-focus-ring class="focus-ring"></m3e-focus-ring>
722
- <div class="track" aria-hidden="true">
723
- <div class="touch" aria-hidden="true"></div>
724
- <div class="handle">
725
- <m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer>
726
- <div class="base">${__classPrivateFieldGet(this, _M3eSwitchElement_instances, "m", _M3eSwitchElement_renderIcon).call(this)}</div>
727
- </div>
728
- </div>`;
706
+ }
707
+ /** @inheritdoc */
708
+ disconnectedCallback() {
709
+ super.disconnectedCallback();
710
+ this.removeEventListener("click", __classPrivateFieldGet(this, _M3eSwitchElement_clickHandler, "f"));
711
+ for (const label of this.labels) {
712
+ __classPrivateFieldGet(this, _M3eSwitchElement_hoverController, "f").unobserve(label);
713
+ __classPrivateFieldGet(this, _M3eSwitchElement_pressedController, "f").unobserve(label);
729
714
  }
715
+ }
716
+ /** @inheritdoc */
717
+ firstUpdated(_changedProperties) {
718
+ super.firstUpdated(_changedProperties);
719
+ [this._focusRing, this._stateLayer].forEach(x => x?.attach(this));
720
+ }
721
+ /** @inheritdoc */
722
+ render() {
723
+ return html`<m3e-focus-ring class="focus-ring"></m3e-focus-ring><div class="track" aria-hidden="true"><div class="touch" aria-hidden="true"></div><div class="handle"><m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><div class="base">${__classPrivateFieldGet(this, _M3eSwitchElement_instances, "m", _M3eSwitchElement_renderIcon).call(this)}</div></div></div>`;
724
+ }
730
725
  };
731
726
  _M3eSwitchElement_renderIcon = function _M3eSwitchElement_renderIcon() {
732
- return this.checked
733
- ? html `<svg class="icon" viewBox="0 0 24 24" aria-hidden="true">
734
- <path fill="currentColor" d="M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z"></path>
735
- </svg>`
736
- : html `<svg class="icon" viewBox="0 -960 960 960" fill="currentColor">
737
- <path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z" />
738
- </svg>`;
727
+ return this.checked ? html`<svg class="icon" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z"></path></svg>` : html`<svg class="icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>`;
739
728
  };
740
729
  _M3eSwitchElement_handleClick = function _M3eSwitchElement_handleClick(e) {
741
- if (e.defaultPrevented)
742
- return;
730
+ if (e.defaultPrevented) return;
731
+ this.checked = !this.checked;
732
+ if (this.dispatchEvent(new Event("input", {
733
+ bubbles: true,
734
+ composed: true,
735
+ cancelable: true
736
+ }))) {
737
+ this.dispatchEvent(new Event("change", {
738
+ bubbles: true
739
+ }));
740
+ } else {
743
741
  this.checked = !this.checked;
744
- if (this.dispatchEvent(new Event("input", { bubbles: true, composed: true, cancelable: true }))) {
745
- this.dispatchEvent(new Event("change", { bubbles: true }));
746
- }
747
- else {
748
- this.checked = !this.checked;
749
- }
742
+ }
750
743
  };
751
744
  /** The styles of the element. */
752
- M3eSwitchElement.styles = [
753
- SwitchStyle,
754
- SwitchStateLayerStyle,
755
- SwitchTrackStyle,
756
- SwitchHandleStyle,
757
- SwitchIconStyle,
758
- ];
759
- __decorate([
760
- e(".track")
761
- ], M3eSwitchElement.prototype, "_track", void 0);
762
- __decorate([
763
- e(".focus-ring")
764
- ], M3eSwitchElement.prototype, "_focusRing", void 0);
765
- __decorate([
766
- e(".state-layer")
767
- ], M3eSwitchElement.prototype, "_stateLayer", void 0);
768
- __decorate([
769
- n({ reflect: true })
770
- ], M3eSwitchElement.prototype, "icons", void 0);
771
- __decorate([
772
- n()
773
- ], M3eSwitchElement.prototype, "value", void 0);
774
- M3eSwitchElement = __decorate([
775
- t$1("m3e-switch")
776
- ], M3eSwitchElement);
745
+ M3eSwitchElement.styles = [SwitchStyle, SwitchStateLayerStyle, SwitchTrackStyle, SwitchHandleStyle, SwitchIconStyle];
746
+ __decorate([e(".track")], M3eSwitchElement.prototype, "_track", void 0);
747
+ __decorate([e(".focus-ring")], M3eSwitchElement.prototype, "_focusRing", void 0);
748
+ __decorate([e(".state-layer")], M3eSwitchElement.prototype, "_stateLayer", void 0);
749
+ __decorate([n({
750
+ reflect: true
751
+ })], M3eSwitchElement.prototype, "icons", void 0);
752
+ __decorate([n()], M3eSwitchElement.prototype, "value", void 0);
753
+ M3eSwitchElement = __decorate([t$1("m3e-switch")], M3eSwitchElement);
777
754
 
778
755
  export { M3eSwitchElement };
779
756
  //# sourceMappingURL=index.js.map