@m3e/progress-indicator 1.0.0-rc.1

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 ADDED
@@ -0,0 +1,683 @@
1
+ /**
2
+ * @license MIT
3
+ * Copyright (c) 2025 matraic
4
+ * See LICENSE file in the project root for full license text.
5
+ */
6
+ import { LitElement, css, html } from 'lit';
7
+ import { AttachInternals, Role, DesignToken, safeStyleMap } from '@m3e/core';
8
+
9
+ /******************************************************************************
10
+ Copyright (c) Microsoft Corporation.
11
+
12
+ Permission to use, copy, modify, and/or distribute this software for any
13
+ purpose with or without fee is hereby granted.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
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
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
40
+ if (kind === "m") throw new TypeError("Private method is not writable");
41
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
42
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
43
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
44
+ }
45
+
46
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
47
+ var e = new Error(message);
48
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
49
+ };
50
+
51
+ /**
52
+ * @license
53
+ * Copyright 2017 Google LLC
54
+ * SPDX-License-Identifier: BSD-3-Clause
55
+ */
56
+ const t$1=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
57
+
58
+ /**
59
+ * @license
60
+ * Copyright 2019 Google LLC
61
+ * SPDX-License-Identifier: BSD-3-Clause
62
+ */
63
+ const t=globalThis,e$1=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$1&&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$1)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$1?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
64
+
65
+ /**
66
+ * @license
67
+ * Copyright 2017 Google LLC
68
+ * SPDX-License-Identifier: BSD-3-Clause
69
+ */const{is:i,defineProperty:e,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(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");
70
+
71
+ /**
72
+ * @license
73
+ * Copyright 2017 Google LLC
74
+ * SPDX-License-Identifier: BSD-3-Clause
75
+ */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)}
76
+
77
+ /** A base implementation for an element used to convey progress. This class must be inherited. */
78
+ class ProgressElementIndicatorBase extends AttachInternals(Role(LitElement, "progressbar"), true) {
79
+ constructor() {
80
+ super(...arguments);
81
+ /**
82
+ * A fractional value, between 0 and `max`, indicating progress.
83
+ * @default 0
84
+ */
85
+ this.value = 0;
86
+ /**
87
+ * The maximum progress value.
88
+ * @default 100
89
+ */
90
+ this.max = 100;
91
+ }
92
+ /** @inheritdoc */
93
+ connectedCallback() {
94
+ super.connectedCallback();
95
+ this.ariaValueMin = "0";
96
+ }
97
+ /** @inheritdoc */
98
+ update(changedProperties) {
99
+ super.update(changedProperties);
100
+ if (changedProperties.has("value")) {
101
+ this.ariaValueNow = `${this.value}`;
102
+ }
103
+ if (changedProperties.has("max")) {
104
+ this.ariaValueMax = `${this.max}`;
105
+ }
106
+ }
107
+ }
108
+ /** The styles of the element. */
109
+ ProgressElementIndicatorBase.styles = css `
110
+ @media (forced-colors: active) {
111
+ :host {
112
+ --m3e-progress-indicator-color: CanvasText;
113
+ --m3e-progress-indicator-track-color: Canvas;
114
+ }
115
+ }
116
+ `;
117
+ __decorate([
118
+ n({ type: Number, reflect: true })
119
+ ], ProgressElementIndicatorBase.prototype, "value", void 0);
120
+ __decorate([
121
+ n({ type: Number })
122
+ ], ProgressElementIndicatorBase.prototype, "max", void 0);
123
+
124
+ /**
125
+ * Adapted from Angular Material Progress Spinner
126
+ * Source: https://github.com/angular/components/tree/main/src/material/progress-spinner
127
+ *
128
+ * @license MIT
129
+ * Copyright (c) 2025 Google LLC
130
+ * See LICENSE file in the project root for full license text.
131
+ */
132
+ var _M3eCircularProgressIndicatorElement_diameter, _M3eCircularProgressIndicatorElement_strokeWidth;
133
+ const DEFAULT_DIAMETER = 40;
134
+ const DEFAULT_STROKE_WIDTH = 10;
135
+ /**
136
+ * A circular indicator of progress and activity.
137
+ *
138
+ * @description
139
+ * The `m3e-circular-progress-indicator` component displays a circular progress spinner for
140
+ * tracking the completion of a task or process. It supports determinate and indeterminate
141
+ * modes, and can be customized with CSS custom properties for diameter, stroke width, and
142
+ * color. The component is accessible, animates smoothly, and adapts to various use cases including
143
+ * loading and activity indication.
144
+ *
145
+ * @example
146
+ * The following example illustrates a determinate circular progress indicator.
147
+ * ```html
148
+ * <m3e-circular-progress-indicator value="30"></m3e-circular-progress-indicator>
149
+ * ```
150
+ * @example
151
+ * The next example illustrates an indeterminate circular progress indicator using the `indeterminate` attribute.
152
+ * ```html
153
+ * <m3e-circular-progress-indicator indeterminate></m3e-circular-progress-indicator>
154
+ * ```
155
+ *
156
+ * @tag m3e-circular-progress-indicator
157
+ *
158
+ * @slot - Renders the content inside the progress indicator.
159
+ *
160
+ * @attr diameter - The diameter, in pixels, of the progress spinner.
161
+ * @attr indeterminate - Whether to show something is happening without conveying progress.
162
+ * @attr max - The maximum progress value.
163
+ * @attr stroke-width - The stroke width, in pixels, of the progress spinner.
164
+ * @attr value - A fractional value, between 0 and `max`, indicating progress.
165
+ *
166
+ * @cssprop --m3e-progress-indicator-track-color - Track color of the progress bar (background/buffer).
167
+ * @cssprop --m3e-progress-indicator-color - Color of the progress indicator (foreground).
168
+ */
169
+ let M3eCircularProgressIndicatorElement = class M3eCircularProgressIndicatorElement extends ProgressElementIndicatorBase {
170
+ constructor() {
171
+ super(...arguments);
172
+ /** @private */ _M3eCircularProgressIndicatorElement_diameter.set(this, DEFAULT_DIAMETER);
173
+ /** @private */ _M3eCircularProgressIndicatorElement_strokeWidth.set(this, DEFAULT_STROKE_WIDTH);
174
+ /**
175
+ * Whether to show something is happening without conveying progress.
176
+ * @default false
177
+ */
178
+ this.indeterminate = false;
179
+ }
180
+ /**
181
+ * The diameter, in pixels, of the progress spinner.
182
+ * @default 40
183
+ */
184
+ get diameter() {
185
+ return __classPrivateFieldGet(this, _M3eCircularProgressIndicatorElement_diameter, "f");
186
+ }
187
+ set diameter(value) {
188
+ __classPrivateFieldSet(this, _M3eCircularProgressIndicatorElement_diameter, value, "f");
189
+ this.style.setProperty("--_diameter", `${value}`);
190
+ }
191
+ /**
192
+ * The stroke width, in pixels, of the progress spinner.
193
+ * @default 10
194
+ */
195
+ get strokeWidth() {
196
+ return __classPrivateFieldGet(this, _M3eCircularProgressIndicatorElement_strokeWidth, "f");
197
+ }
198
+ set strokeWidth(value) {
199
+ __classPrivateFieldSet(this, _M3eCircularProgressIndicatorElement_strokeWidth, value, "f");
200
+ this.style.setProperty("--_stroke-width", `${value}`);
201
+ }
202
+ /** @inheritdoc */
203
+ render() {
204
+ return html `<div class="progress" aria-hidden="true">
205
+ ${this.indeterminate
206
+ ? html `<div class="spinner">
207
+ <div class="left"><div class="circle"></div></div>
208
+ <div class="right"><div class="circle"></div></div>
209
+ </div>`
210
+ : html `<svg viewBox="0 0 4800 4800">
211
+ <circle class="track" pathLength="100"></circle>
212
+ <circle
213
+ class="active-track"
214
+ pathLength="100"
215
+ stroke-dashoffset="${(1 - this.value / this.max) * 100}"
216
+ ></circle>
217
+ </svg>`}
218
+ </div>
219
+ <div class="content"><slot></slot></div>`;
220
+ }
221
+ };
222
+ _M3eCircularProgressIndicatorElement_diameter = new WeakMap();
223
+ _M3eCircularProgressIndicatorElement_strokeWidth = new WeakMap();
224
+ /** The styles of the element. */
225
+ M3eCircularProgressIndicatorElement.styles = [
226
+ ProgressElementIndicatorBase.styles,
227
+ css `
228
+ :host {
229
+ display: inline-flex;
230
+ vertical-align: middle;
231
+ width: var(--_diameter);
232
+ height: var(--_diameter);
233
+ position: relative;
234
+ align-items: center;
235
+ justify-content: center;
236
+ contain: strict;
237
+
238
+ --_arc-duration: 1333ms;
239
+ --_cycle-duration: calc(4 * var(--_arc-duration));
240
+ --_linear-rotate-duration: calc(var(--_arc-duration) * 360 / 306);
241
+ --_indeterminate-easing: cubic-bezier(0.4, 0, 0.2, 1);
242
+ --_container-padding: 0px;
243
+ --_diameter: ${DEFAULT_DIAMETER}px;
244
+ --_stroke-width: ${DEFAULT_STROKE_WIDTH};
245
+ }
246
+ svg {
247
+ transform: rotate(-90deg);
248
+ }
249
+ circle {
250
+ cx: 50%;
251
+ cy: 50%;
252
+ r: calc(50% * (1 - var(--_stroke-width) / 100));
253
+ stroke-width: calc(var(--_stroke-width) * 1%);
254
+ stroke-dasharray: 100;
255
+ fill: transparent;
256
+ }
257
+ .active-track {
258
+ transition: stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);
259
+ stroke: var(--m3e-progress-indicator-color, ${DesignToken.color.primary});
260
+ }
261
+ .track {
262
+ stroke: var(--m3e-progress-indicator-track-color, ${DesignToken.color.secondaryContainer});
263
+ }
264
+ .progress {
265
+ flex: 1;
266
+ align-self: stretch;
267
+ margin: var(--_container-padding);
268
+ pointer-events: none;
269
+ }
270
+ .progress,
271
+ .spinner,
272
+ .left,
273
+ .right,
274
+ .content,
275
+ .circle {
276
+ position: absolute;
277
+ inset: 0;
278
+ }
279
+
280
+ .content {
281
+ width: 100%;
282
+ height: 100%;
283
+ display: flex;
284
+ align-items: center;
285
+ justify-content: center;
286
+ }
287
+ :host([indeterminate]) {
288
+ content-visibility: auto;
289
+ }
290
+ :host([indeterminate]) .progress {
291
+ animation: linear infinite linear-rotate;
292
+ animation-duration: var(--_linear-rotate-duration);
293
+ }
294
+ .spinner {
295
+ animation: infinite both rotate-arc;
296
+ animation-duration: var(--_cycle-duration);
297
+ animation-timing-function: var(--_indeterminate-easing);
298
+ }
299
+ .left {
300
+ overflow: hidden;
301
+ inset: 0 50% 0 0;
302
+ }
303
+ .right {
304
+ overflow: hidden;
305
+ inset: 0 0 0 50%;
306
+ }
307
+ .circle {
308
+ box-sizing: border-box;
309
+ border-radius: 50%;
310
+ border: solid calc(calc(var(--_stroke-width) / 100) * calc(var(--_diameter) - 2 * var(--_container-padding)));
311
+ border-color: var(--m3e-progress-indicator-color, ${DesignToken.color.primary})
312
+ var(--m3e-progress-indicator-color, ${DesignToken.color.primary}) transparent transparent;
313
+ animation: expand-arc;
314
+ animation-iteration-count: infinite;
315
+ animation-fill-mode: both;
316
+ animation-duration: var(--_arc-duration), var(--_cycle-duration);
317
+ animation-timing-function: var(--_indeterminate-easing);
318
+ }
319
+ .left .circle {
320
+ rotate: 135deg;
321
+ inset: 0 -100% 0 0;
322
+ }
323
+ .right .circle {
324
+ rotate: 100deg;
325
+ inset: 0 0 0 -100%;
326
+ animation-delay: calc(-0.5 * var(--_arc-duration)), 0ms;
327
+ }
328
+ @keyframes expand-arc {
329
+ 0% {
330
+ transform: rotate(265deg);
331
+ }
332
+ 50% {
333
+ transform: rotate(130deg);
334
+ }
335
+ 100% {
336
+ transform: rotate(265deg);
337
+ }
338
+ }
339
+ @keyframes rotate-arc {
340
+ 12.5% {
341
+ transform: rotate(135deg);
342
+ }
343
+ 25% {
344
+ transform: rotate(270deg);
345
+ }
346
+ 37.5% {
347
+ transform: rotate(405deg);
348
+ }
349
+ 50% {
350
+ transform: rotate(540deg);
351
+ }
352
+ 62.5% {
353
+ transform: rotate(675deg);
354
+ }
355
+ 75% {
356
+ transform: rotate(810deg);
357
+ }
358
+ 87.5% {
359
+ transform: rotate(945deg);
360
+ }
361
+ 100% {
362
+ transform: rotate(1080deg);
363
+ }
364
+ }
365
+ @keyframes linear-rotate {
366
+ to {
367
+ transform: rotate(360deg);
368
+ }
369
+ }
370
+ @media (forced-colors: active) {
371
+ circle {
372
+ fill: Canvas;
373
+ }
374
+ .circle {
375
+ border-color: var(--m3e-progress-indicator-color, ${DesignToken.color.primary})
376
+ var(--m3e-progress-indicator-color, ${DesignToken.color.primary}) Canvas Canvas;
377
+ }
378
+ }
379
+ `,
380
+ ];
381
+ __decorate([
382
+ n({ type: Boolean, reflect: true })
383
+ ], M3eCircularProgressIndicatorElement.prototype, "indeterminate", void 0);
384
+ __decorate([
385
+ n({ type: Number })
386
+ ], M3eCircularProgressIndicatorElement.prototype, "diameter", null);
387
+ __decorate([
388
+ n({ attribute: "stroke-width", type: Number })
389
+ ], M3eCircularProgressIndicatorElement.prototype, "strokeWidth", null);
390
+ M3eCircularProgressIndicatorElement = __decorate([
391
+ t$1("m3e-circular-progress-indicator")
392
+ ], M3eCircularProgressIndicatorElement);
393
+
394
+ /**
395
+ * Adapted from Angular Material Progress Bar
396
+ * Source: https://github.com/angular/components/blob/main/src/material/progress-bar/progress-bar.ts
397
+ *
398
+ * @license MIT
399
+ * Copyright (c) 2025 Google LLC
400
+ * See LICENSE file in the project root for full license text.
401
+ */
402
+ var _M3eLinearProgressIndicatorElement_patternId, _M3eLinearProgressIndicatorElement_patternFill;
403
+ var M3eLinearProgressIndicatorElement_1;
404
+ /**
405
+ * @summary
406
+ * A horizontal bar for indicating progress and activity.
407
+ *
408
+ * @description
409
+ * The `m3e-linear-progress-indicator` component displays a horizontal progress bar for tracking
410
+ * the completion of a task or process. It supports `determinate`, `indeterminate`, `buffer`,
411
+ * and `query` modes, and can be customized with CSS custom properties for thickness, shape, and color.
412
+ * The component is accessible, animates smoothly, and adapts to various use cases including loading,
413
+ * buffering, and activity indication.
414
+ *
415
+ * @example
416
+ * The following example illustrates a determinate linear progress indicator.
417
+ * ```html
418
+ * <m3e-linear-progress-indicator value="30"></m3e-linear-progress-indicator>
419
+ * ```
420
+ * @example
421
+ * The next example illustrates an indeterminate linear progress indicator using the `mode` attribute.
422
+ * ```html
423
+ * <m3e-linear-progress-indicator mode="indeterminate"></m3e-linear-progress-indicator>
424
+ * ```
425
+ *
426
+ * @tag m3e-linear-progress-indicator
427
+ *
428
+ * @attr buffer-value - A fractional value, between 0 and `max`, indicating buffer progress.
429
+ * @attr max - The maximum progress value.
430
+ * @attr mode - The mode of the progress bar.
431
+ * @attr value - A fractional value, between 0 and `max`, indicating progress.
432
+ *
433
+ * @cssprop --m3e-linear-progress-indicator-thickness - Thickness (height) of the progress bar.
434
+ * @cssprop --m3e-linear-progress-indicator-shape - Border radius of the progress bar.
435
+ * @cssprop --m3e-progress-indicator-track-color - Track color of the progress bar (background/buffer).
436
+ * @cssprop --m3e-progress-indicator-color - Color of the progress indicator (foreground).
437
+ */
438
+ let M3eLinearProgressIndicatorElement = M3eLinearProgressIndicatorElement_1 = class M3eLinearProgressIndicatorElement extends ProgressElementIndicatorBase {
439
+ constructor() {
440
+ super(...arguments);
441
+ /** @private */ _M3eLinearProgressIndicatorElement_patternId.set(this, `m3e-progress-pattern-${M3eLinearProgressIndicatorElement_1.__nextPatternId++}`);
442
+ /** @private */ _M3eLinearProgressIndicatorElement_patternFill.set(this, "");
443
+ /**
444
+ * The mode of the progress bar.
445
+ * @default "determinate"
446
+ */
447
+ this.mode = "determinate";
448
+ /**
449
+ * A fractional value, between 0 and `max`, indicating buffer progress.
450
+ * @default 0
451
+ */
452
+ this.bufferValue = 0;
453
+ }
454
+ /** @inheritdoc */
455
+ connectedCallback() {
456
+ super.connectedCallback();
457
+ // Prefix the SVG reference with the current path, otherwise they will not work
458
+ // in Safari if the page has a <base> tag.
459
+ const location = document?.location ?? null;
460
+ const path = location ? (location.pathname + location.search).split("#")[0] : "";
461
+ __classPrivateFieldSet(this, _M3eLinearProgressIndicatorElement_patternFill, `url(${path}#${__classPrivateFieldGet(this, _M3eLinearProgressIndicatorElement_patternId, "f")})`, "f");
462
+ }
463
+ /** @inheritdoc */
464
+ render() {
465
+ return html `<div class="progress" aria-hidden="true">
466
+ <div
467
+ class="wrapper"
468
+ style=${safeStyleMap({
469
+ "--_value": `${this.value}`,
470
+ "--_buffer-value": `${this.bufferValue}`,
471
+ "--_max": `${this.max}`,
472
+ })}
473
+ >
474
+ <svg width="100%" height="4" class="background element">
475
+ <defs>
476
+ <pattern id="${__classPrivateFieldGet(this, _M3eLinearProgressIndicatorElement_patternId, "f")}" x="4" y="0" width="8" height="4" patternUnits="userSpaceOnUse">
477
+ <circle cx="2" cy="2" r="2" />
478
+ </pattern>
479
+ </defs>
480
+ <rect fill="${__classPrivateFieldGet(this, _M3eLinearProgressIndicatorElement_patternFill, "f")}" width="100%" height="100%" />
481
+ </svg>
482
+ <div class="buffer element"></div>
483
+ <div class="primary fill element"></div>
484
+ <div class="secondary fill element"></div>
485
+ </div>
486
+ </div>`;
487
+ }
488
+ };
489
+ _M3eLinearProgressIndicatorElement_patternId = new WeakMap();
490
+ _M3eLinearProgressIndicatorElement_patternFill = new WeakMap();
491
+ /** The styles of the element. */
492
+ M3eLinearProgressIndicatorElement.styles = [
493
+ ProgressElementIndicatorBase.styles,
494
+ css `
495
+ :host {
496
+ display: block;
497
+ height: var(--m3e-linear-progress-indicator-thickness, 0.25rem);
498
+ overflow: hidden;
499
+ position: relative;
500
+ transform: opacity var(--_piece-animation-duration) linear;
501
+ border-radius: var(--m3e-linear-progress-indicator-shape, ${DesignToken.shape.corner.extraSmall});
502
+
503
+ --_piece-animation-duration: 250ms;
504
+ --_full-animation-duration: 2000ms;
505
+ }
506
+ :host([mode="indeterminate"]),
507
+ :host([mode="query"]) {
508
+ content-visibility: auto;
509
+ }
510
+ .progress {
511
+ pointer-events: none;
512
+ }
513
+ .progress,
514
+ .wrapper {
515
+ height: 100%;
516
+ }
517
+ .element,
518
+ .fill::after {
519
+ position: absolute;
520
+ height: 100%;
521
+ width: 100%;
522
+ }
523
+ .background {
524
+ width: calc(100% + 0.625rem);
525
+ fill: var(--m3e-progress-indicator-track-color, ${DesignToken.color.secondaryContainer});
526
+ }
527
+ .buffer {
528
+ transform-origin: top left;
529
+ transition: transform var(--_piece-animation-duration) ease;
530
+ background-color: var(--m3e-progress-indicator-track-color, ${DesignToken.color.secondaryContainer});
531
+ }
532
+ .primary {
533
+ transform: scale3d(calc(var(--_value, 0) / var(--_max)), 1, 1);
534
+ }
535
+ .secondary {
536
+ display: none;
537
+ }
538
+ .fill {
539
+ animation: none;
540
+ transform-origin: top left;
541
+ transition: transform var(--_piece-animation-duration) ease;
542
+ }
543
+ .fill::after {
544
+ animation: none;
545
+ content: "";
546
+ display: inline-block;
547
+ left: 0;
548
+ background-color: var(--m3e-progress-indicator-color, ${DesignToken.color.primary});
549
+ }
550
+ :host([mode="query"]) {
551
+ transform: rotateZ(180deg);
552
+ }
553
+ :host([mode="indeterminate"]) .fill,
554
+ :host([mode="query"]) .fill {
555
+ transition: none;
556
+ }
557
+ :host([mode="indeterminate"]) .primary,
558
+ :host([mode="query"]) .primary {
559
+ backface-visibility: hidden;
560
+ animation: primary-indeterminate-translate var(--_full-animation-duration) infinite linear;
561
+ left: -145.166611%;
562
+ }
563
+ :host([mode="indeterminate"]) .primary.fill::after,
564
+ :host([mode="query"]) .primary.fill::after {
565
+ backface-visibility: hidden;
566
+ animation: primary-indeterminate-scale var(--_full-animation-duration) infinite linear;
567
+ }
568
+ :host([mode="indeterminate"]) .secondary,
569
+ :host([mode="query"]) .secondary {
570
+ display: block;
571
+ backface-visibility: hidden;
572
+ animation: secondary-indeterminate-translate var(--_full-animation-duration) infinite linear;
573
+ left: -54.888891%;
574
+ }
575
+ :host([mode="indeterminate"]) .secondary.fill::after,
576
+ :host([mode="query"]) .secondary.fill::after {
577
+ backface-visibility: hidden;
578
+ animation: secondary-indeterminate-scale var(--_full-animation-duration) infinite linear;
579
+ }
580
+ :host([mode="determinate"]) .background,
581
+ :host([mode="indeterminate"]) .background,
582
+ :host([mode="query"]) .background {
583
+ fill: transparent !important;
584
+ }
585
+ :host([mode="buffer"]) .buffer {
586
+ transform: scale3d(calc(var(--_buffer-value, 0) / var(--_max)), 1, 1);
587
+ }
588
+ :host([mode="buffer"]) .background {
589
+ display: block;
590
+ backface-visibility: hidden;
591
+ animation: background-scroll var(--_piece-animation-duration) infinite linear;
592
+ }
593
+ @keyframes primary-indeterminate-translate {
594
+ 0% {
595
+ transform: translateX(0);
596
+ }
597
+ 20% {
598
+ animation-timing-function: cubic-bezier(0.5, 0, 0.701732, 0.495819);
599
+ transform: translateX(0);
600
+ }
601
+ 59.15% {
602
+ animation-timing-function: cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);
603
+ transform: translateX(83.67142%);
604
+ }
605
+ 100% {
606
+ transform: translateX(200.611057%);
607
+ }
608
+ }
609
+ @keyframes primary-indeterminate-scale {
610
+ 0% {
611
+ transform: scaleX(0.08);
612
+ }
613
+ 36.65% {
614
+ animation-timing-function: cubic-bezier(0.334731, 0.12482, 0.785844, 1);
615
+ transform: scaleX(0.08);
616
+ }
617
+ 69.15% {
618
+ animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);
619
+ transform: scaleX(0.661479);
620
+ }
621
+ 100% {
622
+ transform: scaleX(0.08);
623
+ }
624
+ }
625
+ @keyframes secondary-indeterminate-translate {
626
+ 0% {
627
+ animation-timing-function: cubic-bezier(0.15, 0, 0.515058, 0.409685);
628
+ transform: translateX(0);
629
+ }
630
+ 25% {
631
+ animation-timing-function: cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);
632
+ transform: translateX(37.651913%);
633
+ }
634
+ 48.35% {
635
+ animation-timing-function: cubic-bezier(0.4, 0.627035, 0.6, 0.902026);
636
+ transform: translateX(84.386165%);
637
+ }
638
+ 100% {
639
+ transform: translateX(160.277782%);
640
+ }
641
+ }
642
+ @keyframes secondary-indeterminate-scale {
643
+ 0% {
644
+ animation-timing-function: cubic-bezier(0.15, 0, 0.515058, 0.409685);
645
+ transform: scaleX(0.08);
646
+ }
647
+ 19.15% {
648
+ animation-timing-function: cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);
649
+ transform: scaleX(0.457104);
650
+ }
651
+ 44.15% {
652
+ animation-timing-function: cubic-bezier(0.4, 0.627035, 0.6, 0.902026);
653
+ transform: scaleX(0.72796);
654
+ }
655
+ 100% {
656
+ transform: scaleX(0.08);
657
+ }
658
+ }
659
+ @keyframes background-scroll {
660
+ to {
661
+ transform: translateX(calc(calc(0px - 0.25rem) * 2));
662
+ }
663
+ }
664
+ @media (forced-colors: active) {
665
+ .background {
666
+ fill: GrayText;
667
+ }
668
+ }
669
+ `,
670
+ ];
671
+ /** @private */ M3eLinearProgressIndicatorElement.__nextPatternId = 0;
672
+ __decorate([
673
+ n({ reflect: true })
674
+ ], M3eLinearProgressIndicatorElement.prototype, "mode", void 0);
675
+ __decorate([
676
+ n({ attribute: "buffer-value", type: Number, reflect: true })
677
+ ], M3eLinearProgressIndicatorElement.prototype, "bufferValue", void 0);
678
+ M3eLinearProgressIndicatorElement = M3eLinearProgressIndicatorElement_1 = __decorate([
679
+ t$1("m3e-linear-progress-indicator")
680
+ ], M3eLinearProgressIndicatorElement);
681
+
682
+ export { M3eCircularProgressIndicatorElement, M3eLinearProgressIndicatorElement, ProgressElementIndicatorBase };
683
+ //# sourceMappingURL=index.js.map