@moni-labs/moni-ui 0.4.0 → 0.4.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 +49 -0
- package/custom-elements.json +36 -0
- package/dist/browser/moni-ui.iife.min.js +7118 -0
- package/dist/browser/moni-ui.iife.min.js.br +0 -0
- package/dist/browser/moni-ui.iife.min.js.gz +0 -0
- package/dist/browser/moni-ui.iife.min.js.map +1 -0
- package/dist/browser/moni-ui.min.css +1 -0
- package/dist/browser/moni-ui.min.css.br +0 -0
- package/dist/browser/moni-ui.min.css.gz +0 -0
- package/dist/browser/moni-ui.min.css.map +1 -0
- package/dist/browser/moni-ui.min.js +16903 -0
- package/dist/browser/moni-ui.min.js.br +0 -0
- package/dist/browser/moni-ui.min.js.gz +0 -0
- package/dist/browser/moni-ui.min.js.map +1 -0
- package/dist/browser.d.ts +7 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +6 -0
- package/dist/cdn/chunks/base-BIpe3L86.js +1 -0
- package/dist/cdn/chunks/class-map-DBljv-_e.js +1 -0
- package/dist/cdn/chunks/decorate-DxX3e27g.js +738 -0
- package/dist/cdn/chunks/directive-BSZPiF1A.js +1 -0
- package/dist/cdn/chunks/event-emitter-CGhsijUg.js +1 -0
- package/dist/cdn/chunks/gsap-DWxn8li7.js +1 -0
- package/dist/cdn/chunks/if-defined-CuEAJKpp.js +1 -0
- package/dist/cdn/chunks/live-B7Rjg1kt.js +1 -0
- package/dist/cdn/chunks/query-SWT-tzvq.js +1 -0
- package/dist/cdn/chunks/query-assigned-elements-BBHe1xEY.js +1 -0
- package/dist/cdn/components/moni-app-bar.js +118 -0
- package/dist/cdn/components/moni-badge.js +69 -0
- package/dist/cdn/components/moni-bottom-sheet.js +143 -0
- package/dist/cdn/components/moni-button-group.js +56 -0
- package/dist/cdn/components/moni-button-segment.js +272 -0
- package/dist/cdn/components/moni-button.js +602 -0
- package/dist/cdn/components/moni-card.js +143 -0
- package/dist/cdn/components/moni-carousel.js +311 -0
- package/dist/cdn/components/moni-checkbox.js +137 -0
- package/dist/cdn/components/moni-chip.js +218 -0
- package/dist/cdn/components/moni-color-field.js +54 -0
- package/dist/cdn/components/moni-context-menu.js +24 -0
- package/dist/cdn/components/moni-dialog.js +191 -0
- package/dist/cdn/components/moni-divider.js +32 -0
- package/dist/cdn/components/moni-expansion.js +50 -0
- package/dist/cdn/components/moni-fab-menu.js +57 -0
- package/dist/cdn/components/moni-fab.js +103 -0
- package/dist/cdn/components/moni-file-field.js +45 -0
- package/dist/cdn/components/moni-icon.js +55 -0
- package/dist/cdn/components/moni-list-item.js +144 -0
- package/dist/cdn/components/moni-list.js +16 -0
- package/dist/cdn/components/moni-loading-indicator.js +134 -0
- package/dist/cdn/components/moni-menu-item.js +45 -0
- package/dist/cdn/components/moni-menu.js +165 -0
- package/dist/cdn/components/moni-morph-modal.js +157 -0
- package/dist/cdn/components/moni-nav-item.js +153 -0
- package/dist/cdn/components/moni-nav.js +161 -0
- package/dist/cdn/components/moni-progress.js +420 -0
- package/dist/cdn/components/moni-radio.js +154 -0
- package/dist/cdn/components/moni-ripple.js +55 -0
- package/dist/cdn/components/moni-segmented-button.js +32 -0
- package/dist/cdn/components/moni-select-option.js +47 -0
- package/dist/cdn/components/moni-select.js +503 -0
- package/dist/cdn/components/moni-shape.js +99 -0
- package/dist/cdn/components/moni-side-sheet.js +234 -0
- package/dist/cdn/components/moni-slider.js +252 -0
- package/dist/cdn/components/moni-snackbar.js +91 -0
- package/dist/cdn/components/moni-split-button.js +110 -0
- package/dist/cdn/components/moni-step.js +111 -0
- package/dist/cdn/components/moni-stepper.js +25 -0
- package/dist/cdn/components/moni-switch.js +169 -0
- package/dist/cdn/components/moni-tab.js +93 -0
- package/dist/cdn/components/moni-tabs.js +38 -0
- package/dist/cdn/components/moni-text-field.js +83 -0
- package/dist/cdn/components/moni-textarea.js +46 -0
- package/dist/cdn/components/moni-time-picker.js +496 -0
- package/dist/cdn/components/moni-toolbar.js +71 -0
- package/dist/cdn/components/moni-tooltip.js +161 -0
- package/dist/cdn/components/moni-typography.js +117 -0
- package/dist/cdn/importmap.json +102 -0
- package/dist/cdn/moni-ui.min.css +1 -0
- package/package.json +8 -1
- package/src/browser.ts +6 -0
- package/src/types/css.d.ts +4 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import{d as e,i as t,m as n,o as r,r as i,s as a,t as o}from"../chunks/decorate-DxX3e27g.js";var s=class extends t{constructor(...e){super(...e),this.placement=`top`,this.variant=`rail`,this.modal=!1,this.open=!0,this.layout=`auto`,this._propagateToItems=()=>{this.querySelectorAll(`moni-nav-item`).forEach(e=>{e.setAttribute(`placement`,this.placement),e.setAttribute(`variant`,this.variant),e.setAttribute(`layout`,this.layout)})}}connectedCallback(){super.connectedCallback(),this._onKeydown=this._onKeydown.bind(this),document.addEventListener(`keydown`,this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`keydown`,this._onKeydown)}_onKeydown(e){e.key===`Escape`&&this.modal&&this.open&&(this.open=!1)}_closeModal(){this.modal&&(this.open=!1)}updated(e){(e.has(`placement`)||e.has(`variant`)||e.has(`layout`)||e.has(`modal`)||e.has(`open`))&&this._propagateToItems()}static{this.styles=[i,n`
|
|
2
|
+
:host {
|
|
3
|
+
/* Block so the host establishes a layout context for fixed
|
|
4
|
+
descendants. The inner <nav> still handles all positioning. */
|
|
5
|
+
display: block;
|
|
6
|
+
font-family: var(--font);
|
|
7
|
+
inline-size: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
nav {
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: 0.5rem;
|
|
13
|
+
padding: 0 1rem;
|
|
14
|
+
background-color: var(--surface-container);
|
|
15
|
+
color: var(--on-surface);
|
|
16
|
+
align-items: center;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([placement='top']) nav,
|
|
21
|
+
:host([placement='bottom']) nav {
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
justify-content: space-around;
|
|
24
|
+
inline-size: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([placement='bottom']) nav {
|
|
28
|
+
position: fixed;
|
|
29
|
+
inset-block-end: 0;
|
|
30
|
+
inset-inline: 0;
|
|
31
|
+
z-index: 100;
|
|
32
|
+
background-color: var(--surface-container);
|
|
33
|
+
min-block-size: 4rem; /* 64dp flexible nav bar */
|
|
34
|
+
padding-block-end: env(safe-area-inset-bottom, 0px);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([placement='top']) nav {
|
|
38
|
+
position: sticky;
|
|
39
|
+
inset-block-start: 0;
|
|
40
|
+
z-index: 100;
|
|
41
|
+
background-color: var(--surface-container);
|
|
42
|
+
min-block-size: 4rem; /* 64dp flexible nav bar */
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([placement='left']) nav,
|
|
46
|
+
:host([placement='right']) nav {
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
block-size: 100dvh;
|
|
49
|
+
padding-block: 1rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host([placement='left'][variant='rail']) nav,
|
|
53
|
+
:host([placement='right'][variant='rail']) nav {
|
|
54
|
+
min-inline-size: 6rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([placement='left'][variant='drawer']) nav,
|
|
58
|
+
:host([placement='right'][variant='drawer']) nav {
|
|
59
|
+
min-inline-size: 16rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([placement='left']) nav {
|
|
63
|
+
position: fixed;
|
|
64
|
+
inset-inline-start: 0;
|
|
65
|
+
inset-block: 0;
|
|
66
|
+
z-index: 100;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:host([placement='right']) nav {
|
|
70
|
+
position: fixed;
|
|
71
|
+
inset-inline-end: 0;
|
|
72
|
+
inset-block: 0;
|
|
73
|
+
z-index: 100;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Modal drawer scrim/backdrop */
|
|
77
|
+
.scrim {
|
|
78
|
+
display: none;
|
|
79
|
+
position: fixed;
|
|
80
|
+
inset: 0;
|
|
81
|
+
z-index: 99;
|
|
82
|
+
background-color: var(--scrim);
|
|
83
|
+
opacity: 0;
|
|
84
|
+
transition: opacity var(--speed2);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([variant='drawer'][modal]) .scrim {
|
|
88
|
+
display: block;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host([variant='drawer'][modal][open]) .scrim {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Modal drawer closed state slides off-screen */
|
|
96
|
+
:host([placement='left'][variant='drawer'][modal]:not([open])) nav {
|
|
97
|
+
transform: translateX(-100%);
|
|
98
|
+
}
|
|
99
|
+
:host([placement='right'][variant='drawer'][modal]:not([open])) nav {
|
|
100
|
+
transform: translateX(100%);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:host([variant='drawer'][modal]) nav {
|
|
104
|
+
transition: transform var(--speed3) cubic-bezier(0.2, 0, 0, 1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Nav items inside horizontal placements stretch to fill. */
|
|
108
|
+
:host([placement='top']) ::slotted(moni-nav-item),
|
|
109
|
+
:host([placement='bottom']) ::slotted(moni-nav-item) {
|
|
110
|
+
flex: 1;
|
|
111
|
+
min-inline-size: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Slots header/footer in vertical nav */
|
|
115
|
+
:host([placement='left']) ::slotted([slot='header']),
|
|
116
|
+
:host([placement='right']) ::slotted([slot='header']) {
|
|
117
|
+
padding-block: 1rem;
|
|
118
|
+
inline-size: 100%;
|
|
119
|
+
}
|
|
120
|
+
:host([placement='left']) ::slotted([slot='footer']),
|
|
121
|
+
:host([placement='right']) ::slotted([slot='footer']) {
|
|
122
|
+
margin-block-start: auto;
|
|
123
|
+
padding-block: 1rem;
|
|
124
|
+
inline-size: 100%;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@media only screen and (max-width: 600px) {
|
|
128
|
+
nav {
|
|
129
|
+
position: fixed !important;
|
|
130
|
+
inset-block-end: 0 !important;
|
|
131
|
+
inset-inline: 0 !important;
|
|
132
|
+
z-index: 100 !important;
|
|
133
|
+
background-color: var(--surface-container) !important;
|
|
134
|
+
min-block-size: 4rem !important;
|
|
135
|
+
padding-block-end: env(safe-area-inset-bottom, 0px) !important;
|
|
136
|
+
flex-direction: row !important;
|
|
137
|
+
justify-content: space-around !important;
|
|
138
|
+
block-size: auto !important;
|
|
139
|
+
inline-size: 100% !important;
|
|
140
|
+
}
|
|
141
|
+
::slotted(moni-nav-item) {
|
|
142
|
+
flex: 1 !important;
|
|
143
|
+
min-inline-size: 0 !important;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`]}render(){let t=this.variant===`drawer`&&this.modal,n=[this.placement,this.variant===`drawer`?`max`:``].filter(Boolean).join(` `),r=t?e`<div
|
|
147
|
+
class="scrim"
|
|
148
|
+
part="scrim"
|
|
149
|
+
@click=${this._closeModal}
|
|
150
|
+
aria-hidden="true"
|
|
151
|
+
></div>`:``;return e`${r}<nav
|
|
152
|
+
class=${n}
|
|
153
|
+
part="nav"
|
|
154
|
+
role=${t?`dialog`:void 0}
|
|
155
|
+
aria-modal=${t?`true`:void 0}
|
|
156
|
+
aria-expanded=${t?this.open?`true`:`false`:void 0}
|
|
157
|
+
>
|
|
158
|
+
<slot name="header"></slot>
|
|
159
|
+
<slot @slotchange=${this._propagateToItems}></slot>
|
|
160
|
+
<slot name="footer"></slot>
|
|
161
|
+
</nav>`}};o([r({reflect:!0})],s.prototype,`placement`,void 0),o([r({reflect:!0})],s.prototype,`variant`,void 0),o([r({type:Boolean,reflect:!0})],s.prototype,`modal`,void 0),o([r({type:Boolean,reflect:!0})],s.prototype,`open`,void 0),o([r({reflect:!0})],s.prototype,`layout`,void 0),s=o([a(`moni-nav`)],s);
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import{a as e,c as t,d as n,i as r,m as i,o as a,p as o,r as s,s as c,t as l}from"../chunks/decorate-DxX3e27g.js";var u=class extends r{constructor(...e){super(...e),this.value=0,this.max=100,this.variant=`linear`,this.size=`medium`,this.indeterminate=!1,this.mode=`determinate`,this.bufferValue=0,this.stopIndicator=!1,this.waveTransition=!1,this.label=`Progress`,this._percentage=0,this._reduceMotion=!1,this._handleMotionPreference=e=>{this._reduceMotion=e.matches}}connectedCallback(){super.connectedCallback(),!(typeof window>`u`||!window.matchMedia)&&(this._motionQuery=window.matchMedia(`(prefers-reduced-motion: reduce)`),this._reduceMotion=this._motionQuery.matches,this._motionQuery.addEventListener(`change`,this._handleMotionPreference))}disconnectedCallback(){this._motionQuery?.removeEventListener(`change`,this._handleMotionPreference),this._motionQuery=void 0,super.disconnectedCallback()}willUpdate(e){if(e.has(`value`)||e.has(`max`)){let e=Number.isFinite(this.max)&&this.max>0?this.max:100,t=Number.isFinite(this.value)?this.value:0;this._percentage=Math.min(100,Math.max(0,t/e*100))}e.has(`variant`)&&![`linear`,`circular`,`wavy`,`circular-wavy`].includes(this.variant)&&(this.variant=`linear`),e.has(`mode`)&&![`determinate`,`buffer`].includes(this.mode)&&(this.mode=`determinate`)}get _isCircular(){return this.variant===`circular`||this.variant===`circular-wavy`}get _isWavy(){return this.variant===`wavy`||this.variant===`circular-wavy`}get _isBuffer(){return!this.indeterminate&&this.mode===`buffer`}get _bufferPercentage(){let e=Number.isFinite(this.max)&&this.max>0?this.max:100,t=Number.isFinite(this.bufferValue)?this.bufferValue:0;return Math.max(this._percentage,Math.min(100,Math.max(0,t/e*100)))}_aria(){return{role:`progressbar`,label:this.label,valueNow:this.indeterminate?t:this.value,valueText:this.indeterminate?`Loading`:`${Math.round(this._percentage)}%`}}_renderLinear(){let e=this._aria(),r=this._percentage>0,i=r&&this._percentage<=2,a=r?this._percentage:0,s=this._isBuffer&&this._bufferPercentage>a,c=`M-40 7 C-35 7 -35 4 -30 4 S-25 7 -20 7 S-15 10 -10 10 S-5 7 0 7 C5 7 5 4 10 4 S15 7 20 7 S25 10 30 10 S35 7 40 7 C45 7 45 4 50 4 S55 7 60 7 S65 10 70 10 S75 7 80 7`,l=`M-40 7 C-35 7 -35 7 -30 7 S-25 7 -20 7 S-15 7 -10 7 S-5 7 0 7 C5 7 5 7 10 7 S15 7 20 7 S25 7 30 7 S35 7 40 7 C45 7 45 7 50 7 S55 7 60 7 S65 7 70 7 S75 7 80 7`;return n`
|
|
2
|
+
<div
|
|
3
|
+
class="linear progress-linear ${this._isWavy?`wavy progress-wavy`:`flat`} ${this.indeterminate?`indeterminate`:this._isBuffer?`buffer`:`determinate`}"
|
|
4
|
+
part="progress"
|
|
5
|
+
role=${e.role}
|
|
6
|
+
aria-label=${e.label}
|
|
7
|
+
aria-valuemin="0"
|
|
8
|
+
aria-valuemax=${this.max}
|
|
9
|
+
aria-valuenow=${e.valueNow}
|
|
10
|
+
aria-valuetext=${e.valueText}
|
|
11
|
+
style="--_progress: ${this._percentage}%; --_p: ${this._percentage}; --_active-end: ${r?`max(var(--_thickness), ${this._percentage}%)`:`0px`}; --_buffer-start: ${a}%; --_buffer-end: ${this._bufferPercentage}%; --_buffer-gap-start: ${r?`var(--_gap)`:`0px`};"
|
|
12
|
+
>
|
|
13
|
+
${this._isWavy?n`<svg class="wave-svg" aria-hidden="true">
|
|
14
|
+
<defs>
|
|
15
|
+
<pattern id="progress-wave" width="40" height="14" patternUnits="userSpaceOnUse">
|
|
16
|
+
<path d=${c}>
|
|
17
|
+
${this.waveTransition&&!this._reduceMotion?o`<animate attributeName="d" values="${c};${l};${l};${c};${c}" keyTimes="0;0.25;0.5;0.75;1" dur="2s" calcMode="spline" keySplines="0.2 0 0 1;0 0 1 1;0.2 0 0 1;0 0 1 1" repeatCount="indefinite"></animate>`:t}
|
|
18
|
+
</path>
|
|
19
|
+
</pattern>
|
|
20
|
+
${this.indeterminate?o`
|
|
21
|
+
<mask id="wave-active-mask">
|
|
22
|
+
<rect width="100%" height="14" fill="black"></rect>
|
|
23
|
+
<rect class="mask-window primary-window" width="8%" height="14" rx="7" fill="white"></rect>
|
|
24
|
+
<rect class="mask-window secondary-window" width="8%" height="14" rx="7" fill="white"></rect>
|
|
25
|
+
</mask>
|
|
26
|
+
<mask id="wave-track-mask">
|
|
27
|
+
<rect width="100%" height="14" fill="white"></rect>
|
|
28
|
+
<rect class="mask-window inverse-window primary-window" width="8%" height="14" rx="7" fill="black"></rect>
|
|
29
|
+
<rect class="mask-window inverse-window secondary-window" width="8%" height="14" rx="7" fill="black"></rect>
|
|
30
|
+
</mask>`:t}
|
|
31
|
+
</defs>
|
|
32
|
+
${this.indeterminate?o`<rect class="indeterminate-track" x="0" y="5" width="100%" height="4" rx="2" mask="url(#wave-track-mask)"></rect>
|
|
33
|
+
<rect class="wave-surface" x="0" y="0" width="100%" height="14" mask="url(#wave-active-mask)" part="indicator"></rect>`:o`<rect class="wave-window active ${i?`initial`:``}" part="indicator" x="0" y="0" width="${this._percentage}%" height="14" rx="7" ry="7"></rect>
|
|
34
|
+
${i?o`<circle class="initial-dot" cx="7" cy="7" r="2"></circle>`:t}`}
|
|
35
|
+
</svg>`:this.indeterminate?n`<svg class="flat-indeterminate-svg" aria-hidden="true">
|
|
36
|
+
<defs>
|
|
37
|
+
<mask id="flat-active-mask">
|
|
38
|
+
<rect width="100%" height="100%" fill="black"></rect>
|
|
39
|
+
<rect class="mask-window primary-window" width="8%" height="100%" rx="7" fill="white"></rect>
|
|
40
|
+
<rect class="mask-window secondary-window" width="8%" height="100%" rx="7" fill="white"></rect>
|
|
41
|
+
</mask>
|
|
42
|
+
<mask id="flat-track-mask">
|
|
43
|
+
<rect width="100%" height="100%" fill="white"></rect>
|
|
44
|
+
<rect class="mask-window inverse-window primary-window" width="8%" height="100%" rx="7" fill="black"></rect>
|
|
45
|
+
<rect class="mask-window inverse-window secondary-window" width="8%" height="100%" rx="7" fill="black"></rect>
|
|
46
|
+
</mask>
|
|
47
|
+
</defs>
|
|
48
|
+
<rect class="flat-track-surface" width="100%" height="100%" rx="7" mask="url(#flat-track-mask)"></rect>
|
|
49
|
+
<rect class="flat-active-surface" width="100%" height="100%" mask="url(#flat-active-mask)" part="indicator"></rect>
|
|
50
|
+
</svg>`:n`<span class="active" part="indicator"></span>`}
|
|
51
|
+
${s?n`<span class="buffer-segment" part="buffer"></span>`:t}
|
|
52
|
+
<span class="track track-before" part="track"></span>
|
|
53
|
+
<span class="track track-after" part="track"></span>
|
|
54
|
+
${this.stopIndicator?n`<span class="stop" part="stop-indicator"></span>`:t}
|
|
55
|
+
</div>
|
|
56
|
+
`}_circularPath(e=0,t=100,n=1.6,r=0){let i=Math.max(0,t-e),a=Math.max(2,Math.ceil(i/100*120)),o=[];for(let t=0;t<=a;t++){let s=e+t/a*i,c=s/100*Math.PI*2-Math.PI/2,l=19+Math.sin((s/100*8+r)*Math.PI*2)*n,u=26+Math.cos(c)*l,d=26+Math.sin(c)*l;o.push(`${t===0?`M`:`L`}${u.toFixed(2)} ${d.toFixed(2)}`)}return o.join(` `)}_circularWaveFrames(e){let t=this.waveTransition?[1.6,0,0,1.6,1.6]:[1.6,1.6,1.6,1.6,1.6];return[0,.25,.5,.75,1].map((n,r)=>this._circularPath(0,e,t[r],n)).join(`;`)}_circularGapPercentage(){let{size:e,thickness:t}={small:{size:40,thickness:4},medium:{size:44,thickness:8},large:{size:48,thickness:4},xlarge:{size:52,thickness:8}}[this.size],n=19/52*e,r=Math.PI*2*n;return(4+t)/r*100}_renderCircular(){let e=this._aria(),r=this._circularGapPercentage(),i=r/2,a=this._percentage<=0,s=this._percentage>=100,c=this._isBuffer?this._bufferPercentage:this._percentage,l=c>=100,u=s?100:Math.max(0,this._percentage-i),d=a?0:Math.min(100,this._percentage+i),f=l?100-r:Math.max(d,c-i),p=this._isBuffer&&c>this._percentage&&f>d,m=p?c:this._percentage,h=m<=0,g=h?0:Math.min(100,m+i),_=h?100:Math.max(g,100-r),v=h?100:Math.max(0,100-r-g),y=h?1:Math.min(1,v/r),b=m<100,x=this._circularPath(),S=this._circularWaveFrames(100),C=this._circularPath(0,u),w=this._circularPath(0,Math.max(.01,u),0),T=this._circularWaveFrames(s?100:u),E=p?this._circularPath(d,f,0):``,D=b?this._circularPath(g,_,0):``;return n`
|
|
57
|
+
<div
|
|
58
|
+
class="circular progress-circular ${this._isWavy?`wavy`:`flat`} ${this.indeterminate?`indeterminate`:this._isBuffer?`buffer`:`determinate`}"
|
|
59
|
+
part="progress"
|
|
60
|
+
role=${e.role}
|
|
61
|
+
aria-label=${e.label}
|
|
62
|
+
aria-valuemin="0"
|
|
63
|
+
aria-valuemax=${this.max}
|
|
64
|
+
aria-valuenow=${e.valueNow}
|
|
65
|
+
aria-valuetext=${e.valueText}
|
|
66
|
+
style="--_progress: ${this._percentage}; --_p: ${this._percentage};"
|
|
67
|
+
>
|
|
68
|
+
<svg part="svg" viewBox="0 0 52 52" aria-hidden="true">
|
|
69
|
+
${this.indeterminate&&this._isWavy?o`<defs>
|
|
70
|
+
<mask id="circular-wavy-track-mask" maskUnits="userSpaceOnUse" x="0" y="0" width="52" height="52">
|
|
71
|
+
<circle class="window-mask" cx="26" cy="26" r="19" pathLength="100" transform="rotate(-90 26 26)" stroke="white" stroke-dasharray="56 44" stroke-dashoffset="-28">
|
|
72
|
+
${this._reduceMotion?t:o`
|
|
73
|
+
<animate attributeName="stroke-dasharray" values="56 44;0 100;56 44" keyTimes="0;0.5;1" dur="3.2s" calcMode="spline" keySplines="0.25 0.1 0.25 1;0.25 0.1 0.25 1" repeatCount="indefinite"></animate>
|
|
74
|
+
<animate attributeName="stroke-dashoffset" values="-28;-102;-128" keyTimes="0;0.5;1" dur="3.2s" calcMode="spline" keySplines="0.25 0.1 0.25 1;0.25 0.1 0.25 1" repeatCount="indefinite"></animate>
|
|
75
|
+
`}
|
|
76
|
+
</circle>
|
|
77
|
+
</mask>
|
|
78
|
+
<mask id="circular-wavy-active-mask" maskUnits="userSpaceOnUse" x="0" y="0" width="52" height="52">
|
|
79
|
+
<circle class="window-mask" cx="26" cy="26" r="19" pathLength="100" transform="rotate(-90 26 26)" stroke="white" stroke-dasharray="12 88" stroke-dashoffset="0">
|
|
80
|
+
${this._reduceMotion?t:o`
|
|
81
|
+
<animate attributeName="stroke-dasharray" values="12 88;68 32;12 88" keyTimes="0;0.5;1" dur="3.2s" calcMode="spline" keySplines="0.25 0.1 0.25 1;0.25 0.1 0.25 1" repeatCount="indefinite"></animate>
|
|
82
|
+
<animate attributeName="stroke-dashoffset" values="0;-18;-100" keyTimes="0;0.5;1" dur="3.2s" calcMode="spline" keySplines="0.25 0.1 0.25 1;0.25 0.1 0.25 1" repeatCount="indefinite"></animate>
|
|
83
|
+
`}
|
|
84
|
+
</circle>
|
|
85
|
+
</mask>
|
|
86
|
+
</defs>`:t}
|
|
87
|
+
${this.indeterminate?o`<circle class="track" part="track" cx="26" cy="26" r="19" pathLength="100" mask=${this._isWavy?`url(#circular-wavy-track-mask)`:t}></circle>`:b?o`<path class="track" part="track" d=${D} style="opacity: ${y}"></path>`:t}
|
|
88
|
+
${p?o`<path class="buffer-segment" part="buffer" d=${E}></path>`:t}
|
|
89
|
+
${this._isWavy?this.indeterminate?o`<path class="active" part="indicator" d=${x} pathLength="100" mask="url(#circular-wavy-active-mask)">
|
|
90
|
+
${this._reduceMotion?t:o`<animate
|
|
91
|
+
attributeName="d"
|
|
92
|
+
values=${S}
|
|
93
|
+
keyTimes="0;0.25;0.5;0.75;1"
|
|
94
|
+
dur="1s"
|
|
95
|
+
calcMode="linear"
|
|
96
|
+
repeatCount="indefinite"
|
|
97
|
+
></animate>`}
|
|
98
|
+
</path>`:a?t:o`<path class="active" part="indicator" d=${s?x:C}>
|
|
99
|
+
${this._reduceMotion?t:o`<animate
|
|
100
|
+
attributeName="d"
|
|
101
|
+
values=${T}
|
|
102
|
+
keyTimes="0;0.25;0.5;0.75;1"
|
|
103
|
+
dur="1s"
|
|
104
|
+
calcMode="linear"
|
|
105
|
+
repeatCount="indefinite"
|
|
106
|
+
></animate>`}
|
|
107
|
+
</path>`:s?o`<circle class="active" part="indicator" cx="26" cy="26" r="19"></circle>`:a?t:o`<path class="active" part="indicator" d=${w}></path>`}
|
|
108
|
+
</svg>
|
|
109
|
+
</div>
|
|
110
|
+
`}render(){return this._isCircular?this._renderCircular():this._renderLinear()}static{this.styles=[s,i`
|
|
111
|
+
@keyframes linear-indeterminate-primary {
|
|
112
|
+
0% { inset-inline-start: -145.167%; inline-size: 8%; }
|
|
113
|
+
20% { inset-inline-start: -113.333%; inline-size: 48%; }
|
|
114
|
+
60% { inset-inline-start: 56.333%; inline-size: 78%; }
|
|
115
|
+
100% { inset-inline-start: 100%; inline-size: 8%; }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@keyframes linear-indeterminate-secondary {
|
|
119
|
+
0% { inset-inline-start: -54.888%; inline-size: 8%; }
|
|
120
|
+
20% { inset-inline-start: -20%; inline-size: 48%; }
|
|
121
|
+
60% { inset-inline-start: 60%; inline-size: 78%; }
|
|
122
|
+
100% { inset-inline-start: 160%; inline-size: 8%; }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@keyframes circular-rotate { to { transform: rotate(360deg); } }
|
|
126
|
+
@keyframes circular-grow {
|
|
127
|
+
0% { stroke-dasharray: 12 88; stroke-dashoffset: 0; }
|
|
128
|
+
50% { stroke-dasharray: 68 32; stroke-dashoffset: -18; }
|
|
129
|
+
100% { stroke-dasharray: 12 88; stroke-dashoffset: -100; }
|
|
130
|
+
}
|
|
131
|
+
@keyframes circular-track-grow {
|
|
132
|
+
0% {
|
|
133
|
+
stroke-dasharray: 60 40;
|
|
134
|
+
stroke-dashoffset: -26;
|
|
135
|
+
}
|
|
136
|
+
50% {
|
|
137
|
+
stroke-dasharray: 4 96;
|
|
138
|
+
stroke-dashoffset: -100;
|
|
139
|
+
}
|
|
140
|
+
100% {
|
|
141
|
+
stroke-dasharray: 60 40;
|
|
142
|
+
stroke-dashoffset: -126;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@keyframes wave-phase {
|
|
147
|
+
to { transform: translateX(40px); }
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@keyframes buffer-dots {
|
|
151
|
+
to { mask-position: calc(var(--_thickness) * -2) 0; }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@keyframes circular-buffer-dots {
|
|
155
|
+
to { stroke-dashoffset: calc(var(--_thickness) * 2); }
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@keyframes wavy-indeterminate-primary {
|
|
159
|
+
0% { transform: translateX(-145.167%); width: 8%; }
|
|
160
|
+
20% { transform: translateX(-113.333%); width: 48%; }
|
|
161
|
+
60% { transform: translateX(56.333%); width: 78%; }
|
|
162
|
+
100% { transform: translateX(100%); width: 8%; }
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@keyframes wavy-indeterminate-secondary {
|
|
166
|
+
0% { transform: translateX(-54.888%); width: 8%; }
|
|
167
|
+
20% { transform: translateX(-20%); width: 48%; }
|
|
168
|
+
60% { transform: translateX(60%); width: 78%; }
|
|
169
|
+
100% { transform: translateX(160%); width: 8%; }
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
:host {
|
|
173
|
+
--_active-color: var(--moni-progress-active, var(--primary));
|
|
174
|
+
--_track-color: var(--moni-progress-track, var(--secondary-container, var(--active)));
|
|
175
|
+
--_gap: 4px;
|
|
176
|
+
--_stop: 4px;
|
|
177
|
+
--_thickness: 4px;
|
|
178
|
+
--_linear-height: 4px;
|
|
179
|
+
--_circular-size: 40px;
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
inline-size: 100%;
|
|
182
|
+
color: var(--_active-color);
|
|
183
|
+
contain: layout style;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
:host([size='medium']) {
|
|
187
|
+
--_thickness: 8px;
|
|
188
|
+
--_linear-height: 8px;
|
|
189
|
+
--_circular-size: 44px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host([size='large']) {
|
|
193
|
+
--_thickness: 4px;
|
|
194
|
+
--_linear-height: 10px;
|
|
195
|
+
--_circular-size: 48px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
:host([size='xlarge']) {
|
|
199
|
+
--_thickness: 8px;
|
|
200
|
+
--_linear-height: 14px;
|
|
201
|
+
--_circular-size: 52px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:host([variant='circular']),
|
|
205
|
+
:host([variant='circular-wavy']) {
|
|
206
|
+
inline-size: var(--_circular-size);
|
|
207
|
+
block-size: var(--_circular-size);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.linear {
|
|
211
|
+
position: relative;
|
|
212
|
+
inline-size: 100%;
|
|
213
|
+
block-size: var(--_linear-height);
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.linear > span {
|
|
218
|
+
position: absolute;
|
|
219
|
+
inset-block-start: 50%;
|
|
220
|
+
transform: translateY(-50%);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.linear > .active {
|
|
224
|
+
inset-inline-start: 0;
|
|
225
|
+
inline-size: var(--_active-end);
|
|
226
|
+
block-size: var(--_thickness);
|
|
227
|
+
background: var(--_active-color);
|
|
228
|
+
border-radius: 999px;
|
|
229
|
+
transition: inline-size 300ms cubic-bezier(0.2, 0, 0, 1);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.linear .track {
|
|
233
|
+
inset-inline-start: min(100%, calc(var(--_active-end) + var(--_gap)));
|
|
234
|
+
inset-inline-end: 0;
|
|
235
|
+
block-size: 4px;
|
|
236
|
+
background: var(--_track-color);
|
|
237
|
+
border-radius: 999px;
|
|
238
|
+
transition: inset-inline-start 300ms cubic-bezier(0.2, 0, 0, 1);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.linear .buffer-segment {
|
|
242
|
+
inset-inline-start: min(100%, calc(var(--_buffer-start) + var(--_buffer-gap-start)));
|
|
243
|
+
inset-inline-end: max(0%, calc(100% - var(--_buffer-end)));
|
|
244
|
+
block-size: var(--_thickness);
|
|
245
|
+
background: var(--_track-color);
|
|
246
|
+
border-radius: 999px;
|
|
247
|
+
transition: inset-inline-start 300ms cubic-bezier(0.2, 0, 0, 1), inset-inline-end 300ms cubic-bezier(0.2, 0, 0, 1);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.linear.buffer .track-after {
|
|
251
|
+
inset-inline-start: min(100%, calc(var(--_buffer-end) + var(--_gap)));
|
|
252
|
+
background-color: var(--_track-color);
|
|
253
|
+
mask-image: radial-gradient(circle, #000 0, #000 calc(var(--_thickness) / 2), transparent calc(var(--_thickness) / 2));
|
|
254
|
+
mask-size: calc(var(--_thickness) * 2) 100%;
|
|
255
|
+
mask-repeat: repeat;
|
|
256
|
+
animation: buffer-dots 250ms linear infinite;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.linear .track-before {
|
|
260
|
+
display: none;
|
|
261
|
+
inset-inline-start: 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.linear .stop {
|
|
265
|
+
inset-inline-end: 0;
|
|
266
|
+
inline-size: var(--_stop);
|
|
267
|
+
block-size: var(--_stop);
|
|
268
|
+
background: var(--_active-color);
|
|
269
|
+
border-radius: 50%;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.linear.wavy {
|
|
273
|
+
block-size: calc(var(--_thickness) + 6px);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.wave-svg {
|
|
277
|
+
position: absolute;
|
|
278
|
+
inset-inline: 0;
|
|
279
|
+
inset-block-start: 50%;
|
|
280
|
+
inline-size: 100%;
|
|
281
|
+
block-size: 14px;
|
|
282
|
+
transform: translateY(-50%);
|
|
283
|
+
overflow: hidden;
|
|
284
|
+
z-index: 1;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.wave-svg pattern path {
|
|
288
|
+
fill: none;
|
|
289
|
+
stroke: var(--_active-color);
|
|
290
|
+
stroke-width: var(--_thickness);
|
|
291
|
+
stroke-linecap: round;
|
|
292
|
+
/* BeerCSS uses a one-second translation embedded in wavy.svg. */
|
|
293
|
+
animation: wave-phase 1s linear infinite;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.wave-window {
|
|
297
|
+
fill: url(#progress-wave);
|
|
298
|
+
width: var(--_active-end);
|
|
299
|
+
transition: width 300ms cubic-bezier(0.2, 0, 0, 1);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.wave-window.initial { visibility: hidden; }
|
|
303
|
+
.initial-dot {
|
|
304
|
+
fill: var(--_active-color);
|
|
305
|
+
r: calc(var(--_thickness) / 2);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.wave-surface { fill: url(#progress-wave); }
|
|
309
|
+
.indeterminate-track {
|
|
310
|
+
fill: var(--_track-color);
|
|
311
|
+
y: calc(7px - var(--_thickness) / 2);
|
|
312
|
+
height: var(--_thickness);
|
|
313
|
+
}
|
|
314
|
+
.mask-window { transform-box: view-box; }
|
|
315
|
+
.inverse-window {
|
|
316
|
+
stroke: black;
|
|
317
|
+
stroke-width: calc(var(--_gap) * 2);
|
|
318
|
+
}
|
|
319
|
+
.primary-window {
|
|
320
|
+
animation: wavy-indeterminate-primary 2.1s linear infinite;
|
|
321
|
+
}
|
|
322
|
+
.secondary-window {
|
|
323
|
+
animation: wavy-indeterminate-secondary 2.1s linear 1.15s infinite backwards;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.flat-indeterminate-svg {
|
|
327
|
+
position: absolute;
|
|
328
|
+
inset: 0;
|
|
329
|
+
inline-size: 100%;
|
|
330
|
+
block-size: 100%;
|
|
331
|
+
overflow: hidden;
|
|
332
|
+
z-index: 1;
|
|
333
|
+
}
|
|
334
|
+
.flat-track-surface { fill: var(--_track-color); }
|
|
335
|
+
.flat-active-surface { fill: var(--_active-color); }
|
|
336
|
+
|
|
337
|
+
.linear.flat.indeterminate > .track { display: none; }
|
|
338
|
+
.linear.wavy.indeterminate > .track { display: none; }
|
|
339
|
+
.linear.indeterminate .stop { display: none; }
|
|
340
|
+
|
|
341
|
+
.linear.indeterminate::after { display: none; }
|
|
342
|
+
|
|
343
|
+
.circular,
|
|
344
|
+
.circular svg {
|
|
345
|
+
inline-size: var(--_circular-size);
|
|
346
|
+
block-size: var(--_circular-size);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.circular svg { overflow: visible; }
|
|
350
|
+
.circular :is(circle, path) {
|
|
351
|
+
fill: none;
|
|
352
|
+
stroke-linecap: round;
|
|
353
|
+
stroke-width: var(--_thickness);
|
|
354
|
+
vector-effect: non-scaling-stroke;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.circular .window-mask {
|
|
358
|
+
stroke-width: 12;
|
|
359
|
+
stroke-linecap: round;
|
|
360
|
+
vector-effect: none;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.circular .track {
|
|
364
|
+
stroke: var(--_track-color);
|
|
365
|
+
transition: opacity 300ms cubic-bezier(0.2, 0, 0, 1);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.circular .buffer-segment {
|
|
369
|
+
stroke: var(--_track-color);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.circular.buffer .track {
|
|
373
|
+
stroke-dasharray: 0.01px calc(var(--_thickness) * 2);
|
|
374
|
+
animation: circular-buffer-dots 250ms linear infinite;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.circular .active {
|
|
378
|
+
stroke: var(--_active-color);
|
|
379
|
+
stroke-dashoffset: 0;
|
|
380
|
+
transition: stroke-dasharray 300ms cubic-bezier(0.2, 0, 0, 1);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.circular.indeterminate .track { display: none; }
|
|
384
|
+
.circular.indeterminate svg { animation: circular-rotate 1s linear infinite; }
|
|
385
|
+
.circular.indeterminate .active {
|
|
386
|
+
animation: circular-grow 3.2s ease infinite;
|
|
387
|
+
transition: none;
|
|
388
|
+
}
|
|
389
|
+
.circular.wavy.indeterminate .active {
|
|
390
|
+
animation: none;
|
|
391
|
+
}
|
|
392
|
+
.circular.wavy.indeterminate .track {
|
|
393
|
+
display: block;
|
|
394
|
+
animation: none;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
@media (prefers-reduced-motion: reduce) {
|
|
398
|
+
.linear .active,
|
|
399
|
+
.linear .track,
|
|
400
|
+
.circular .active { transition: none; }
|
|
401
|
+
.linear.flat.indeterminate > .active {
|
|
402
|
+
animation: none;
|
|
403
|
+
inset-inline-start: 0;
|
|
404
|
+
inline-size: 40%;
|
|
405
|
+
}
|
|
406
|
+
.linear.indeterminate::after { display: none; }
|
|
407
|
+
.mask-window { animation: none; }
|
|
408
|
+
.primary-window { transform: translateX(0); width: 40%; }
|
|
409
|
+
.secondary-window { visibility: hidden; }
|
|
410
|
+
.wave-svg pattern path { animation: none; }
|
|
411
|
+
.circular.indeterminate svg,
|
|
412
|
+
.circular.indeterminate .active { animation: none; }
|
|
413
|
+
.circular.wavy.indeterminate .track { animation: none; }
|
|
414
|
+
.circular.indeterminate .active { stroke-dasharray: 28 72 !important; }
|
|
415
|
+
.circular.wavy.indeterminate .track {
|
|
416
|
+
stroke-dasharray: 44 56 !important;
|
|
417
|
+
stroke-dashoffset: -42 !important;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
`]}};l([a({type:Number,reflect:!0})],u.prototype,`value`,void 0),l([a({type:Number,reflect:!0})],u.prototype,`max`,void 0),l([a({reflect:!0})],u.prototype,`variant`,void 0),l([a({reflect:!0})],u.prototype,`size`,void 0),l([a({type:Boolean,reflect:!0})],u.prototype,`indeterminate`,void 0),l([a({reflect:!0})],u.prototype,`mode`,void 0),l([a({type:Number,reflect:!0,attribute:`buffer-value`})],u.prototype,`bufferValue`,void 0),l([a({type:Boolean,reflect:!0,attribute:`stop-indicator`})],u.prototype,`stopIndicator`,void 0),l([a({type:Boolean,reflect:!0,attribute:`wave-transition`})],u.prototype,`waveTransition`,void 0),l([a({attribute:`aria-label`})],u.prototype,`label`,void 0),l([e()],u.prototype,`_percentage`,void 0),l([e()],u.prototype,`_reduceMotion`,void 0),u=l([c(`moni-progress`)],u);
|