@m3e/progress-indicator 1.0.0-rc.1 → 1.0.0-rc.2
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/README.md +1 -2
- package/dist/custom-elements.json +2621 -3
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +3 -3
- package/cem.config.mjs +0 -16
- package/demo/index.html +0 -53
- package/dist/src/CircularProgressIndicatorElement.d.ts +0 -74
- package/dist/src/CircularProgressIndicatorElement.d.ts.map +0 -1
- package/dist/src/LinearProgressIndicatorElement.d.ts +0 -71
- package/dist/src/LinearProgressIndicatorElement.d.ts.map +0 -1
- package/dist/src/LinearProgressMode.d.ts +0 -3
- package/dist/src/LinearProgressMode.d.ts.map +0 -1
- package/dist/src/ProgressElementIndicatorBase.d.ts +0 -23
- package/dist/src/ProgressElementIndicatorBase.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.d.ts.map +0 -1
- package/eslint.config.mjs +0 -13
- package/rollup.config.js +0 -32
- package/src/CircularProgressIndicatorElement.ts +0 -271
- package/src/LinearProgressIndicatorElement.ts +0 -294
- package/src/LinearProgressMode.ts +0 -2
- package/src/ProgressElementIndicatorBase.ts +0 -47
- package/src/index.ts +0 -4
- package/tsconfig.json +0 -9
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
2
|
-
declare const ProgressElementIndicatorBase_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").AttachInternalsMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor & typeof LitElement;
|
|
3
|
-
/** A base implementation for an element used to convey progress. This class must be inherited. */
|
|
4
|
-
export declare abstract class ProgressElementIndicatorBase extends ProgressElementIndicatorBase_base {
|
|
5
|
-
/** The styles of the element. */
|
|
6
|
-
static styles: CSSResultGroup;
|
|
7
|
-
/**
|
|
8
|
-
* A fractional value, between 0 and `max`, indicating progress.
|
|
9
|
-
* @default 0
|
|
10
|
-
*/
|
|
11
|
-
value: number;
|
|
12
|
-
/**
|
|
13
|
-
* The maximum progress value.
|
|
14
|
-
* @default 100
|
|
15
|
-
*/
|
|
16
|
-
max: number;
|
|
17
|
-
/** @inheritdoc */
|
|
18
|
-
connectedCallback(): void;
|
|
19
|
-
/** @inheritdoc */
|
|
20
|
-
protected update(changedProperties: PropertyValues<this>): void;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=ProgressElementIndicatorBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressElementIndicatorBase.d.ts","sourceRoot":"","sources":["../../src/ProgressElementIndicatorBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;;AAKtE,kGAAkG;AAClG,8BAAsB,4BAA6B,SAAQ,iCAAsD;IAC/G,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CAOpC;IAEF;;;OAGG;IACwC,KAAK,SAAK;IAErD;;;OAGG;IACyB,GAAG,SAAO;IAEtC,kBAAkB;IACT,iBAAiB,IAAI,IAAI;IAKlC,kBAAkB;cACC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;CAUzE"}
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC"}
|
package/eslint.config.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import eslint from "@eslint/js";
|
|
2
|
-
import tseslint from "typescript-eslint";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { dirname } from "path";
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended, {
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parserOptions: {
|
|
9
|
-
project: true,
|
|
10
|
-
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
package/rollup.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import terser from "@rollup/plugin-terser";
|
|
3
|
-
import typescript from "@rollup/plugin-typescript";
|
|
4
|
-
|
|
5
|
-
const banner = `/**
|
|
6
|
-
* @license MIT
|
|
7
|
-
* Copyright (c) 2025 matraic
|
|
8
|
-
* See LICENSE file in the project root for full license text.
|
|
9
|
-
*/`;
|
|
10
|
-
|
|
11
|
-
export default [
|
|
12
|
-
{
|
|
13
|
-
input: "src/index.ts",
|
|
14
|
-
output: [
|
|
15
|
-
{
|
|
16
|
-
file: "dist/index.js",
|
|
17
|
-
format: "esm",
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
banner: banner,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
file: "dist/index.min.js",
|
|
23
|
-
format: "esm",
|
|
24
|
-
sourcemap: true,
|
|
25
|
-
banner: banner,
|
|
26
|
-
plugins: [terser({ mangle: true })],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
external: ["@m3e/core", "lit"],
|
|
30
|
-
plugins: [resolve(), typescript()],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from Angular Material Progress Spinner
|
|
3
|
-
* Source: https://github.com/angular/components/tree/main/src/material/progress-spinner
|
|
4
|
-
*
|
|
5
|
-
* @license MIT
|
|
6
|
-
* Copyright (c) 2025 Google LLC
|
|
7
|
-
* See LICENSE file in the project root for full license text.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { css, CSSResultGroup, html } from "lit";
|
|
11
|
-
import { customElement, property } from "lit/decorators.js";
|
|
12
|
-
|
|
13
|
-
import { ProgressElementIndicatorBase } from "./ProgressElementIndicatorBase";
|
|
14
|
-
import { DesignToken } from "@m3e/core";
|
|
15
|
-
|
|
16
|
-
const DEFAULT_DIAMETER = 40;
|
|
17
|
-
const DEFAULT_STROKE_WIDTH = 10;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A circular indicator of progress and activity.
|
|
21
|
-
*
|
|
22
|
-
* @description
|
|
23
|
-
* The `m3e-circular-progress-indicator` component displays a circular progress spinner for
|
|
24
|
-
* tracking the completion of a task or process. It supports determinate and indeterminate
|
|
25
|
-
* modes, and can be customized with CSS custom properties for diameter, stroke width, and
|
|
26
|
-
* color. The component is accessible, animates smoothly, and adapts to various use cases including
|
|
27
|
-
* loading and activity indication.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* The following example illustrates a determinate circular progress indicator.
|
|
31
|
-
* ```html
|
|
32
|
-
* <m3e-circular-progress-indicator value="30"></m3e-circular-progress-indicator>
|
|
33
|
-
* ```
|
|
34
|
-
* @example
|
|
35
|
-
* The next example illustrates an indeterminate circular progress indicator using the `indeterminate` attribute.
|
|
36
|
-
* ```html
|
|
37
|
-
* <m3e-circular-progress-indicator indeterminate></m3e-circular-progress-indicator>
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @tag m3e-circular-progress-indicator
|
|
41
|
-
*
|
|
42
|
-
* @slot - Renders the content inside the progress indicator.
|
|
43
|
-
*
|
|
44
|
-
* @attr diameter - The diameter, in pixels, of the progress spinner.
|
|
45
|
-
* @attr indeterminate - Whether to show something is happening without conveying progress.
|
|
46
|
-
* @attr max - The maximum progress value.
|
|
47
|
-
* @attr stroke-width - The stroke width, in pixels, of the progress spinner.
|
|
48
|
-
* @attr value - A fractional value, between 0 and `max`, indicating progress.
|
|
49
|
-
*
|
|
50
|
-
* @cssprop --m3e-progress-indicator-track-color - Track color of the progress bar (background/buffer).
|
|
51
|
-
* @cssprop --m3e-progress-indicator-color - Color of the progress indicator (foreground).
|
|
52
|
-
*/
|
|
53
|
-
@customElement("m3e-circular-progress-indicator")
|
|
54
|
-
export class M3eCircularProgressIndicatorElement extends ProgressElementIndicatorBase {
|
|
55
|
-
/** The styles of the element. */
|
|
56
|
-
static override styles: CSSResultGroup = [
|
|
57
|
-
ProgressElementIndicatorBase.styles,
|
|
58
|
-
css`
|
|
59
|
-
:host {
|
|
60
|
-
display: inline-flex;
|
|
61
|
-
vertical-align: middle;
|
|
62
|
-
width: var(--_diameter);
|
|
63
|
-
height: var(--_diameter);
|
|
64
|
-
position: relative;
|
|
65
|
-
align-items: center;
|
|
66
|
-
justify-content: center;
|
|
67
|
-
contain: strict;
|
|
68
|
-
|
|
69
|
-
--_arc-duration: 1333ms;
|
|
70
|
-
--_cycle-duration: calc(4 * var(--_arc-duration));
|
|
71
|
-
--_linear-rotate-duration: calc(var(--_arc-duration) * 360 / 306);
|
|
72
|
-
--_indeterminate-easing: cubic-bezier(0.4, 0, 0.2, 1);
|
|
73
|
-
--_container-padding: 0px;
|
|
74
|
-
--_diameter: ${DEFAULT_DIAMETER}px;
|
|
75
|
-
--_stroke-width: ${DEFAULT_STROKE_WIDTH};
|
|
76
|
-
}
|
|
77
|
-
svg {
|
|
78
|
-
transform: rotate(-90deg);
|
|
79
|
-
}
|
|
80
|
-
circle {
|
|
81
|
-
cx: 50%;
|
|
82
|
-
cy: 50%;
|
|
83
|
-
r: calc(50% * (1 - var(--_stroke-width) / 100));
|
|
84
|
-
stroke-width: calc(var(--_stroke-width) * 1%);
|
|
85
|
-
stroke-dasharray: 100;
|
|
86
|
-
fill: transparent;
|
|
87
|
-
}
|
|
88
|
-
.active-track {
|
|
89
|
-
transition: stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);
|
|
90
|
-
stroke: var(--m3e-progress-indicator-color, ${DesignToken.color.primary});
|
|
91
|
-
}
|
|
92
|
-
.track {
|
|
93
|
-
stroke: var(--m3e-progress-indicator-track-color, ${DesignToken.color.secondaryContainer});
|
|
94
|
-
}
|
|
95
|
-
.progress {
|
|
96
|
-
flex: 1;
|
|
97
|
-
align-self: stretch;
|
|
98
|
-
margin: var(--_container-padding);
|
|
99
|
-
pointer-events: none;
|
|
100
|
-
}
|
|
101
|
-
.progress,
|
|
102
|
-
.spinner,
|
|
103
|
-
.left,
|
|
104
|
-
.right,
|
|
105
|
-
.content,
|
|
106
|
-
.circle {
|
|
107
|
-
position: absolute;
|
|
108
|
-
inset: 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.content {
|
|
112
|
-
width: 100%;
|
|
113
|
-
height: 100%;
|
|
114
|
-
display: flex;
|
|
115
|
-
align-items: center;
|
|
116
|
-
justify-content: center;
|
|
117
|
-
}
|
|
118
|
-
:host([indeterminate]) {
|
|
119
|
-
content-visibility: auto;
|
|
120
|
-
}
|
|
121
|
-
:host([indeterminate]) .progress {
|
|
122
|
-
animation: linear infinite linear-rotate;
|
|
123
|
-
animation-duration: var(--_linear-rotate-duration);
|
|
124
|
-
}
|
|
125
|
-
.spinner {
|
|
126
|
-
animation: infinite both rotate-arc;
|
|
127
|
-
animation-duration: var(--_cycle-duration);
|
|
128
|
-
animation-timing-function: var(--_indeterminate-easing);
|
|
129
|
-
}
|
|
130
|
-
.left {
|
|
131
|
-
overflow: hidden;
|
|
132
|
-
inset: 0 50% 0 0;
|
|
133
|
-
}
|
|
134
|
-
.right {
|
|
135
|
-
overflow: hidden;
|
|
136
|
-
inset: 0 0 0 50%;
|
|
137
|
-
}
|
|
138
|
-
.circle {
|
|
139
|
-
box-sizing: border-box;
|
|
140
|
-
border-radius: 50%;
|
|
141
|
-
border: solid calc(calc(var(--_stroke-width) / 100) * calc(var(--_diameter) - 2 * var(--_container-padding)));
|
|
142
|
-
border-color: var(--m3e-progress-indicator-color, ${DesignToken.color.primary})
|
|
143
|
-
var(--m3e-progress-indicator-color, ${DesignToken.color.primary}) transparent transparent;
|
|
144
|
-
animation: expand-arc;
|
|
145
|
-
animation-iteration-count: infinite;
|
|
146
|
-
animation-fill-mode: both;
|
|
147
|
-
animation-duration: var(--_arc-duration), var(--_cycle-duration);
|
|
148
|
-
animation-timing-function: var(--_indeterminate-easing);
|
|
149
|
-
}
|
|
150
|
-
.left .circle {
|
|
151
|
-
rotate: 135deg;
|
|
152
|
-
inset: 0 -100% 0 0;
|
|
153
|
-
}
|
|
154
|
-
.right .circle {
|
|
155
|
-
rotate: 100deg;
|
|
156
|
-
inset: 0 0 0 -100%;
|
|
157
|
-
animation-delay: calc(-0.5 * var(--_arc-duration)), 0ms;
|
|
158
|
-
}
|
|
159
|
-
@keyframes expand-arc {
|
|
160
|
-
0% {
|
|
161
|
-
transform: rotate(265deg);
|
|
162
|
-
}
|
|
163
|
-
50% {
|
|
164
|
-
transform: rotate(130deg);
|
|
165
|
-
}
|
|
166
|
-
100% {
|
|
167
|
-
transform: rotate(265deg);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
@keyframes rotate-arc {
|
|
171
|
-
12.5% {
|
|
172
|
-
transform: rotate(135deg);
|
|
173
|
-
}
|
|
174
|
-
25% {
|
|
175
|
-
transform: rotate(270deg);
|
|
176
|
-
}
|
|
177
|
-
37.5% {
|
|
178
|
-
transform: rotate(405deg);
|
|
179
|
-
}
|
|
180
|
-
50% {
|
|
181
|
-
transform: rotate(540deg);
|
|
182
|
-
}
|
|
183
|
-
62.5% {
|
|
184
|
-
transform: rotate(675deg);
|
|
185
|
-
}
|
|
186
|
-
75% {
|
|
187
|
-
transform: rotate(810deg);
|
|
188
|
-
}
|
|
189
|
-
87.5% {
|
|
190
|
-
transform: rotate(945deg);
|
|
191
|
-
}
|
|
192
|
-
100% {
|
|
193
|
-
transform: rotate(1080deg);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
@keyframes linear-rotate {
|
|
197
|
-
to {
|
|
198
|
-
transform: rotate(360deg);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
@media (forced-colors: active) {
|
|
202
|
-
circle {
|
|
203
|
-
fill: Canvas;
|
|
204
|
-
}
|
|
205
|
-
.circle {
|
|
206
|
-
border-color: var(--m3e-progress-indicator-color, ${DesignToken.color.primary})
|
|
207
|
-
var(--m3e-progress-indicator-color, ${DesignToken.color.primary}) Canvas Canvas;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
`,
|
|
211
|
-
];
|
|
212
|
-
|
|
213
|
-
/** @private */ #diameter = DEFAULT_DIAMETER;
|
|
214
|
-
/** @private */ #strokeWidth = DEFAULT_STROKE_WIDTH;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Whether to show something is happening without conveying progress.
|
|
218
|
-
* @default false
|
|
219
|
-
*/
|
|
220
|
-
@property({ type: Boolean, reflect: true }) indeterminate = false;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* The diameter, in pixels, of the progress spinner.
|
|
224
|
-
* @default 40
|
|
225
|
-
*/
|
|
226
|
-
@property({ type: Number }) get diameter(): number {
|
|
227
|
-
return this.#diameter;
|
|
228
|
-
}
|
|
229
|
-
set diameter(value: number) {
|
|
230
|
-
this.#diameter = value;
|
|
231
|
-
this.style.setProperty("--_diameter", `${value}`);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* The stroke width, in pixels, of the progress spinner.
|
|
236
|
-
* @default 10
|
|
237
|
-
*/
|
|
238
|
-
@property({ attribute: "stroke-width", type: Number }) get strokeWidth(): number {
|
|
239
|
-
return this.#strokeWidth;
|
|
240
|
-
}
|
|
241
|
-
set strokeWidth(value: number) {
|
|
242
|
-
this.#strokeWidth = value;
|
|
243
|
-
this.style.setProperty("--_stroke-width", `${value}`);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/** @inheritdoc */
|
|
247
|
-
protected override render(): unknown {
|
|
248
|
-
return html`<div class="progress" aria-hidden="true">
|
|
249
|
-
${this.indeterminate
|
|
250
|
-
? html`<div class="spinner">
|
|
251
|
-
<div class="left"><div class="circle"></div></div>
|
|
252
|
-
<div class="right"><div class="circle"></div></div>
|
|
253
|
-
</div>`
|
|
254
|
-
: html`<svg viewBox="0 0 4800 4800">
|
|
255
|
-
<circle class="track" pathLength="100"></circle>
|
|
256
|
-
<circle
|
|
257
|
-
class="active-track"
|
|
258
|
-
pathLength="100"
|
|
259
|
-
stroke-dashoffset="${(1 - this.value / this.max) * 100}"
|
|
260
|
-
></circle>
|
|
261
|
-
</svg>`}
|
|
262
|
-
</div>
|
|
263
|
-
<div class="content"><slot></slot></div>`;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
declare global {
|
|
268
|
-
interface HTMLElementTagNameMap {
|
|
269
|
-
"m3e-circular-progress-indicator": M3eCircularProgressIndicatorElement;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from Angular Material Progress Bar
|
|
3
|
-
* Source: https://github.com/angular/components/blob/main/src/material/progress-bar/progress-bar.ts
|
|
4
|
-
*
|
|
5
|
-
* @license MIT
|
|
6
|
-
* Copyright (c) 2025 Google LLC
|
|
7
|
-
* See LICENSE file in the project root for full license text.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { css, CSSResultGroup, html } from "lit";
|
|
11
|
-
import { customElement, property } from "lit/decorators.js";
|
|
12
|
-
|
|
13
|
-
import { DesignToken, safeStyleMap } from "@m3e/core";
|
|
14
|
-
|
|
15
|
-
import { LinearProgressMode } from "./LinearProgressMode";
|
|
16
|
-
import { ProgressElementIndicatorBase } from "./ProgressElementIndicatorBase";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @summary
|
|
20
|
-
* A horizontal bar for indicating progress and activity.
|
|
21
|
-
*
|
|
22
|
-
* @description
|
|
23
|
-
* The `m3e-linear-progress-indicator` component displays a horizontal progress bar for tracking
|
|
24
|
-
* the completion of a task or process. It supports `determinate`, `indeterminate`, `buffer`,
|
|
25
|
-
* and `query` modes, and can be customized with CSS custom properties for thickness, shape, and color.
|
|
26
|
-
* The component is accessible, animates smoothly, and adapts to various use cases including loading,
|
|
27
|
-
* buffering, and activity indication.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* The following example illustrates a determinate linear progress indicator.
|
|
31
|
-
* ```html
|
|
32
|
-
* <m3e-linear-progress-indicator value="30"></m3e-linear-progress-indicator>
|
|
33
|
-
* ```
|
|
34
|
-
* @example
|
|
35
|
-
* The next example illustrates an indeterminate linear progress indicator using the `mode` attribute.
|
|
36
|
-
* ```html
|
|
37
|
-
* <m3e-linear-progress-indicator mode="indeterminate"></m3e-linear-progress-indicator>
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @tag m3e-linear-progress-indicator
|
|
41
|
-
*
|
|
42
|
-
* @attr buffer-value - A fractional value, between 0 and `max`, indicating buffer progress.
|
|
43
|
-
* @attr max - The maximum progress value.
|
|
44
|
-
* @attr mode - The mode of the progress bar.
|
|
45
|
-
* @attr value - A fractional value, between 0 and `max`, indicating progress.
|
|
46
|
-
*
|
|
47
|
-
* @cssprop --m3e-linear-progress-indicator-thickness - Thickness (height) of the progress bar.
|
|
48
|
-
* @cssprop --m3e-linear-progress-indicator-shape - Border radius of the progress bar.
|
|
49
|
-
* @cssprop --m3e-progress-indicator-track-color - Track color of the progress bar (background/buffer).
|
|
50
|
-
* @cssprop --m3e-progress-indicator-color - Color of the progress indicator (foreground).
|
|
51
|
-
*/
|
|
52
|
-
@customElement("m3e-linear-progress-indicator")
|
|
53
|
-
export class M3eLinearProgressIndicatorElement extends ProgressElementIndicatorBase {
|
|
54
|
-
/** The styles of the element. */
|
|
55
|
-
static override styles: CSSResultGroup = [
|
|
56
|
-
ProgressElementIndicatorBase.styles,
|
|
57
|
-
css`
|
|
58
|
-
:host {
|
|
59
|
-
display: block;
|
|
60
|
-
height: var(--m3e-linear-progress-indicator-thickness, 0.25rem);
|
|
61
|
-
overflow: hidden;
|
|
62
|
-
position: relative;
|
|
63
|
-
transform: opacity var(--_piece-animation-duration) linear;
|
|
64
|
-
border-radius: var(--m3e-linear-progress-indicator-shape, ${DesignToken.shape.corner.extraSmall});
|
|
65
|
-
|
|
66
|
-
--_piece-animation-duration: 250ms;
|
|
67
|
-
--_full-animation-duration: 2000ms;
|
|
68
|
-
}
|
|
69
|
-
:host([mode="indeterminate"]),
|
|
70
|
-
:host([mode="query"]) {
|
|
71
|
-
content-visibility: auto;
|
|
72
|
-
}
|
|
73
|
-
.progress {
|
|
74
|
-
pointer-events: none;
|
|
75
|
-
}
|
|
76
|
-
.progress,
|
|
77
|
-
.wrapper {
|
|
78
|
-
height: 100%;
|
|
79
|
-
}
|
|
80
|
-
.element,
|
|
81
|
-
.fill::after {
|
|
82
|
-
position: absolute;
|
|
83
|
-
height: 100%;
|
|
84
|
-
width: 100%;
|
|
85
|
-
}
|
|
86
|
-
.background {
|
|
87
|
-
width: calc(100% + 0.625rem);
|
|
88
|
-
fill: var(--m3e-progress-indicator-track-color, ${DesignToken.color.secondaryContainer});
|
|
89
|
-
}
|
|
90
|
-
.buffer {
|
|
91
|
-
transform-origin: top left;
|
|
92
|
-
transition: transform var(--_piece-animation-duration) ease;
|
|
93
|
-
background-color: var(--m3e-progress-indicator-track-color, ${DesignToken.color.secondaryContainer});
|
|
94
|
-
}
|
|
95
|
-
.primary {
|
|
96
|
-
transform: scale3d(calc(var(--_value, 0) / var(--_max)), 1, 1);
|
|
97
|
-
}
|
|
98
|
-
.secondary {
|
|
99
|
-
display: none;
|
|
100
|
-
}
|
|
101
|
-
.fill {
|
|
102
|
-
animation: none;
|
|
103
|
-
transform-origin: top left;
|
|
104
|
-
transition: transform var(--_piece-animation-duration) ease;
|
|
105
|
-
}
|
|
106
|
-
.fill::after {
|
|
107
|
-
animation: none;
|
|
108
|
-
content: "";
|
|
109
|
-
display: inline-block;
|
|
110
|
-
left: 0;
|
|
111
|
-
background-color: var(--m3e-progress-indicator-color, ${DesignToken.color.primary});
|
|
112
|
-
}
|
|
113
|
-
:host([mode="query"]) {
|
|
114
|
-
transform: rotateZ(180deg);
|
|
115
|
-
}
|
|
116
|
-
:host([mode="indeterminate"]) .fill,
|
|
117
|
-
:host([mode="query"]) .fill {
|
|
118
|
-
transition: none;
|
|
119
|
-
}
|
|
120
|
-
:host([mode="indeterminate"]) .primary,
|
|
121
|
-
:host([mode="query"]) .primary {
|
|
122
|
-
backface-visibility: hidden;
|
|
123
|
-
animation: primary-indeterminate-translate var(--_full-animation-duration) infinite linear;
|
|
124
|
-
left: -145.166611%;
|
|
125
|
-
}
|
|
126
|
-
:host([mode="indeterminate"]) .primary.fill::after,
|
|
127
|
-
:host([mode="query"]) .primary.fill::after {
|
|
128
|
-
backface-visibility: hidden;
|
|
129
|
-
animation: primary-indeterminate-scale var(--_full-animation-duration) infinite linear;
|
|
130
|
-
}
|
|
131
|
-
:host([mode="indeterminate"]) .secondary,
|
|
132
|
-
:host([mode="query"]) .secondary {
|
|
133
|
-
display: block;
|
|
134
|
-
backface-visibility: hidden;
|
|
135
|
-
animation: secondary-indeterminate-translate var(--_full-animation-duration) infinite linear;
|
|
136
|
-
left: -54.888891%;
|
|
137
|
-
}
|
|
138
|
-
:host([mode="indeterminate"]) .secondary.fill::after,
|
|
139
|
-
:host([mode="query"]) .secondary.fill::after {
|
|
140
|
-
backface-visibility: hidden;
|
|
141
|
-
animation: secondary-indeterminate-scale var(--_full-animation-duration) infinite linear;
|
|
142
|
-
}
|
|
143
|
-
:host([mode="determinate"]) .background,
|
|
144
|
-
:host([mode="indeterminate"]) .background,
|
|
145
|
-
:host([mode="query"]) .background {
|
|
146
|
-
fill: transparent !important;
|
|
147
|
-
}
|
|
148
|
-
:host([mode="buffer"]) .buffer {
|
|
149
|
-
transform: scale3d(calc(var(--_buffer-value, 0) / var(--_max)), 1, 1);
|
|
150
|
-
}
|
|
151
|
-
:host([mode="buffer"]) .background {
|
|
152
|
-
display: block;
|
|
153
|
-
backface-visibility: hidden;
|
|
154
|
-
animation: background-scroll var(--_piece-animation-duration) infinite linear;
|
|
155
|
-
}
|
|
156
|
-
@keyframes primary-indeterminate-translate {
|
|
157
|
-
0% {
|
|
158
|
-
transform: translateX(0);
|
|
159
|
-
}
|
|
160
|
-
20% {
|
|
161
|
-
animation-timing-function: cubic-bezier(0.5, 0, 0.701732, 0.495819);
|
|
162
|
-
transform: translateX(0);
|
|
163
|
-
}
|
|
164
|
-
59.15% {
|
|
165
|
-
animation-timing-function: cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);
|
|
166
|
-
transform: translateX(83.67142%);
|
|
167
|
-
}
|
|
168
|
-
100% {
|
|
169
|
-
transform: translateX(200.611057%);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
@keyframes primary-indeterminate-scale {
|
|
173
|
-
0% {
|
|
174
|
-
transform: scaleX(0.08);
|
|
175
|
-
}
|
|
176
|
-
36.65% {
|
|
177
|
-
animation-timing-function: cubic-bezier(0.334731, 0.12482, 0.785844, 1);
|
|
178
|
-
transform: scaleX(0.08);
|
|
179
|
-
}
|
|
180
|
-
69.15% {
|
|
181
|
-
animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);
|
|
182
|
-
transform: scaleX(0.661479);
|
|
183
|
-
}
|
|
184
|
-
100% {
|
|
185
|
-
transform: scaleX(0.08);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
@keyframes secondary-indeterminate-translate {
|
|
189
|
-
0% {
|
|
190
|
-
animation-timing-function: cubic-bezier(0.15, 0, 0.515058, 0.409685);
|
|
191
|
-
transform: translateX(0);
|
|
192
|
-
}
|
|
193
|
-
25% {
|
|
194
|
-
animation-timing-function: cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);
|
|
195
|
-
transform: translateX(37.651913%);
|
|
196
|
-
}
|
|
197
|
-
48.35% {
|
|
198
|
-
animation-timing-function: cubic-bezier(0.4, 0.627035, 0.6, 0.902026);
|
|
199
|
-
transform: translateX(84.386165%);
|
|
200
|
-
}
|
|
201
|
-
100% {
|
|
202
|
-
transform: translateX(160.277782%);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
@keyframes secondary-indeterminate-scale {
|
|
206
|
-
0% {
|
|
207
|
-
animation-timing-function: cubic-bezier(0.15, 0, 0.515058, 0.409685);
|
|
208
|
-
transform: scaleX(0.08);
|
|
209
|
-
}
|
|
210
|
-
19.15% {
|
|
211
|
-
animation-timing-function: cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);
|
|
212
|
-
transform: scaleX(0.457104);
|
|
213
|
-
}
|
|
214
|
-
44.15% {
|
|
215
|
-
animation-timing-function: cubic-bezier(0.4, 0.627035, 0.6, 0.902026);
|
|
216
|
-
transform: scaleX(0.72796);
|
|
217
|
-
}
|
|
218
|
-
100% {
|
|
219
|
-
transform: scaleX(0.08);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
@keyframes background-scroll {
|
|
223
|
-
to {
|
|
224
|
-
transform: translateX(calc(calc(0px - 0.25rem) * 2));
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
@media (forced-colors: active) {
|
|
228
|
-
.background {
|
|
229
|
-
fill: GrayText;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
`,
|
|
233
|
-
];
|
|
234
|
-
|
|
235
|
-
/** @private */ private static __nextPatternId = 0;
|
|
236
|
-
/** @private */ #patternId = `m3e-progress-pattern-${M3eLinearProgressIndicatorElement.__nextPatternId++}`;
|
|
237
|
-
/** @private */ #patternFill = "";
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* The mode of the progress bar.
|
|
241
|
-
* @default "determinate"
|
|
242
|
-
*/
|
|
243
|
-
@property({ reflect: true }) mode: LinearProgressMode = "determinate";
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* A fractional value, between 0 and `max`, indicating buffer progress.
|
|
247
|
-
* @default 0
|
|
248
|
-
*/
|
|
249
|
-
@property({ attribute: "buffer-value", type: Number, reflect: true }) bufferValue = 0;
|
|
250
|
-
|
|
251
|
-
/** @inheritdoc */
|
|
252
|
-
override connectedCallback(): void {
|
|
253
|
-
super.connectedCallback();
|
|
254
|
-
|
|
255
|
-
// Prefix the SVG reference with the current path, otherwise they will not work
|
|
256
|
-
// in Safari if the page has a <base> tag.
|
|
257
|
-
|
|
258
|
-
const location = document?.location ?? null;
|
|
259
|
-
const path = location ? (location.pathname + location.search).split("#")[0] : "";
|
|
260
|
-
this.#patternFill = `url(${path}#${this.#patternId})`;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/** @inheritdoc */
|
|
264
|
-
protected override render(): unknown {
|
|
265
|
-
return html`<div class="progress" aria-hidden="true">
|
|
266
|
-
<div
|
|
267
|
-
class="wrapper"
|
|
268
|
-
style=${safeStyleMap({
|
|
269
|
-
"--_value": `${this.value}`,
|
|
270
|
-
"--_buffer-value": `${this.bufferValue}`,
|
|
271
|
-
"--_max": `${this.max}`,
|
|
272
|
-
})}
|
|
273
|
-
>
|
|
274
|
-
<svg width="100%" height="4" class="background element">
|
|
275
|
-
<defs>
|
|
276
|
-
<pattern id="${this.#patternId}" x="4" y="0" width="8" height="4" patternUnits="userSpaceOnUse">
|
|
277
|
-
<circle cx="2" cy="2" r="2" />
|
|
278
|
-
</pattern>
|
|
279
|
-
</defs>
|
|
280
|
-
<rect fill="${this.#patternFill}" width="100%" height="100%" />
|
|
281
|
-
</svg>
|
|
282
|
-
<div class="buffer element"></div>
|
|
283
|
-
<div class="primary fill element"></div>
|
|
284
|
-
<div class="secondary fill element"></div>
|
|
285
|
-
</div>
|
|
286
|
-
</div>`;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
declare global {
|
|
291
|
-
interface HTMLElementTagNameMap {
|
|
292
|
-
"m3e-linear-progress-indicator": M3eLinearProgressIndicatorElement;
|
|
293
|
-
}
|
|
294
|
-
}
|