@matter-server/dashboard 0.2.0-alpha.0-00000000-000000000 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/dist/web/js/commission-node-dialog-DEZ3EqYO.js +0 -78
- package/dist/web/js/commission-node-existing-OK1ybPFI.js +0 -50
- package/dist/web/js/commission-node-thread-DLmclivF.js +0 -75
- package/dist/web/js/commission-node-wifi-C8ho-UYb.js +0 -88
- package/dist/web/js/dialog-box-BPz-oO3d.js +0 -52
- package/dist/web/js/fire_event-BERTqZpV.js +0 -169
- package/dist/web/js/matter-dashboard-app-BazvuIIi.js +0 -16068
- package/dist/web/js/node-binding-dialog-Cw6QEmL3.js +0 -443
- package/dist/web/js/outlined-text-field-Sqd4JHxo.js +0 -2086
- package/dist/web/js/prevent_default-D4GG_QeD.js +0 -814
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matter-server/dashboard",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Dashboard for OHF Matter Server",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/matter-js/matterjs-server/issues"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@lit/context": "^1.1.6",
|
|
39
39
|
"@material/web": "^2.4.1",
|
|
40
|
-
"@matter-server/ws-client": "0.2.0
|
|
40
|
+
"@matter-server/ws-client": "0.2.0",
|
|
41
41
|
"@mdi/js": "^7.4.47",
|
|
42
42
|
"lit": "^3.3.1",
|
|
43
43
|
"tslib": "^2.8.1"
|
|
@@ -51,4 +51,4 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { r, n, t, i, b } from './matter-dashboard-app-BazvuIIi.js';
|
|
2
|
-
import { p as preventDefault } from './prevent_default-D4GG_QeD.js';
|
|
3
|
-
import './main.js';
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10
|
-
if (kind && result) __defProp(target, key, result);
|
|
11
|
-
return result;
|
|
12
|
-
};
|
|
13
|
-
let ComissionNodeDialog = class extends i {
|
|
14
|
-
render() {
|
|
15
|
-
return b`
|
|
16
|
-
<md-dialog open @cancel=${preventDefault} @closed=${this._handleClosed}>
|
|
17
|
-
<div slot="headline">Commission node</div>
|
|
18
|
-
<div slot="content" @node-commissioned=${this._nodeCommissioned}>
|
|
19
|
-
${!this._mode ? b`<md-list>
|
|
20
|
-
<md-list-item
|
|
21
|
-
type="button"
|
|
22
|
-
.disabled=${!this.client.serverInfo.bluetooth_enabled}
|
|
23
|
-
@click=${this._commissionWifi}
|
|
24
|
-
>Commission new WiFi device</md-list-item
|
|
25
|
-
>
|
|
26
|
-
<md-list-item
|
|
27
|
-
type="button"
|
|
28
|
-
.disabled=${!this.client.serverInfo.bluetooth_enabled}
|
|
29
|
-
@click=${this._commissionThread}
|
|
30
|
-
>Commission new Thread device</md-list-item
|
|
31
|
-
>
|
|
32
|
-
<md-list-item type="button" @click=${this._commissionExisting}
|
|
33
|
-
>Commission existing device</md-list-item
|
|
34
|
-
>
|
|
35
|
-
</md-list>` : this._mode === "wifi" ? b`<commission-node-wifi></commission-node-wifi>` : this._mode === "thread" ? b`<commission-node-thread></commission-node-thread>` : b`<commission-node-existing></commission-node-existing>`}
|
|
36
|
-
</div>
|
|
37
|
-
<div slot="actions">
|
|
38
|
-
<md-text-button @click=${this._close}>Cancel</md-text-button>
|
|
39
|
-
</div>
|
|
40
|
-
</md-dialog>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
_commissionWifi() {
|
|
44
|
-
if (!this.client.serverInfo.bluetooth_enabled) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
import('./commission-node-wifi-C8ho-UYb.js');
|
|
48
|
-
this._mode = "wifi";
|
|
49
|
-
}
|
|
50
|
-
_commissionThread() {
|
|
51
|
-
if (!this.client.serverInfo.bluetooth_enabled) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
import('./commission-node-thread-DLmclivF.js');
|
|
55
|
-
this._mode = "thread";
|
|
56
|
-
}
|
|
57
|
-
_commissionExisting() {
|
|
58
|
-
import('./commission-node-existing-OK1ybPFI.js');
|
|
59
|
-
this._mode = "existing";
|
|
60
|
-
}
|
|
61
|
-
_nodeCommissioned(ev) {
|
|
62
|
-
window.location.href = `#node/${ev.detail.node_id}`;
|
|
63
|
-
this._close();
|
|
64
|
-
}
|
|
65
|
-
_close() {
|
|
66
|
-
this.shadowRoot.querySelector("md-dialog").close();
|
|
67
|
-
}
|
|
68
|
-
_handleClosed() {
|
|
69
|
-
this.parentNode.removeChild(this);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
__decorateClass([n({
|
|
73
|
-
attribute: false
|
|
74
|
-
})], ComissionNodeDialog.prototype, "client", 2);
|
|
75
|
-
__decorateClass([r()], ComissionNodeDialog.prototype, "_mode", 2);
|
|
76
|
-
ComissionNodeDialog = __decorateClass([t("commission-node-dialog")], ComissionNodeDialog);
|
|
77
|
-
|
|
78
|
-
export { ComissionNodeDialog };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { r, c, n, d as clientContext, e, t, i, A, b } from './matter-dashboard-app-BazvuIIi.js';
|
|
2
|
-
import { f as fireEvent } from './fire_event-BERTqZpV.js';
|
|
3
|
-
import './outlined-text-field-Sqd4JHxo.js';
|
|
4
|
-
import './main.js';
|
|
5
|
-
import './prevent_default-D4GG_QeD.js';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
-
if (kind && result) __defProp(target, key, result);
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
let CommissionNodeExisting = class extends i {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this._loading = false;
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
return b`<md-outlined-text-field label="Share code" .disabled="${this._loading}"> </md-outlined-text-field>
|
|
22
|
-
<br />
|
|
23
|
-
<br />
|
|
24
|
-
<md-outlined-button @click=${this._commissionNode} .disabled="${this._loading}"
|
|
25
|
-
>Commission</md-outlined-button
|
|
26
|
-
>${this._loading ? b`<md-circular-progress indeterminate></md-circular-progress>` : A}`;
|
|
27
|
-
}
|
|
28
|
-
async _commissionNode() {
|
|
29
|
-
this._loading = true;
|
|
30
|
-
try {
|
|
31
|
-
const node = await this.client.commissionWithCode(this._pairingCodeField.value, true);
|
|
32
|
-
fireEvent(this, "node-commissioned", node);
|
|
33
|
-
} catch (err) {
|
|
34
|
-
alert(`Error commissioning node: ${err.message}`);
|
|
35
|
-
} finally {
|
|
36
|
-
this._loading = false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
__decorateClass([c({
|
|
41
|
-
context: clientContext,
|
|
42
|
-
subscribe: true
|
|
43
|
-
}), n({
|
|
44
|
-
attribute: false
|
|
45
|
-
})], CommissionNodeExisting.prototype, "client", 2);
|
|
46
|
-
__decorateClass([r()], CommissionNodeExisting.prototype, "_loading", 2);
|
|
47
|
-
__decorateClass([e("md-outlined-text-field[label='Share code']")], CommissionNodeExisting.prototype, "_pairingCodeField", 2);
|
|
48
|
-
CommissionNodeExisting = __decorateClass([t("commission-node-existing")], CommissionNodeExisting);
|
|
49
|
-
|
|
50
|
-
export { CommissionNodeExisting };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { r, c, n, d as clientContext, e, t, i, A, b } from './matter-dashboard-app-BazvuIIi.js';
|
|
2
|
-
import { f as fireEvent } from './fire_event-BERTqZpV.js';
|
|
3
|
-
import './outlined-text-field-Sqd4JHxo.js';
|
|
4
|
-
import './main.js';
|
|
5
|
-
import './prevent_default-D4GG_QeD.js';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
-
if (kind && result) __defProp(target, key, result);
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
let CommissionNodeThread = class extends i {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this._loading = false;
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
if (!this.client.serverInfo.thread_credentials_set) {
|
|
22
|
-
return b`<md-outlined-text-field label="Thread dataset" .disabled="${this._loading}">
|
|
23
|
-
</md-outlined-text-field>
|
|
24
|
-
<br />
|
|
25
|
-
<br />
|
|
26
|
-
<md-outlined-button @click=${this._setThreadDataset} .disabled="${this._loading}"
|
|
27
|
-
>Set Thread Dataset</md-outlined-button
|
|
28
|
-
>${this._loading ? b`<md-circular-progress indeterminate></md-circular-progress>` : A}`;
|
|
29
|
-
}
|
|
30
|
-
return b`<md-outlined-text-field label="Pairing code" .disabled="${this._loading}"> </md-outlined-text-field>
|
|
31
|
-
<br />
|
|
32
|
-
<br />
|
|
33
|
-
<md-outlined-button @click=${this._commissionNode} .disabled="${this._loading}"
|
|
34
|
-
>Commission</md-outlined-button
|
|
35
|
-
>${this._loading ? b`<md-circular-progress indeterminate></md-circular-progress>` : A}`;
|
|
36
|
-
}
|
|
37
|
-
async _setThreadDataset() {
|
|
38
|
-
const dataset = this._datasetField.value;
|
|
39
|
-
if (!dataset) {
|
|
40
|
-
alert("Dataset is required");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this._loading = true;
|
|
44
|
-
try {
|
|
45
|
-
await this.client.setThreadOperationalDataset(dataset);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
alert(`Error setting Thread dataset: ${err.message}`);
|
|
48
|
-
} finally {
|
|
49
|
-
this._loading = false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async _commissionNode() {
|
|
53
|
-
this._loading = true;
|
|
54
|
-
try {
|
|
55
|
-
const node = await this.client.commissionWithCode(this._pairingCodeField.value, false);
|
|
56
|
-
fireEvent(this, "node-commissioned", node);
|
|
57
|
-
} catch (err) {
|
|
58
|
-
alert(`Error commissioning node: ${err.message}`);
|
|
59
|
-
} finally {
|
|
60
|
-
this._loading = false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
__decorateClass([c({
|
|
65
|
-
context: clientContext,
|
|
66
|
-
subscribe: true
|
|
67
|
-
}), n({
|
|
68
|
-
attribute: false
|
|
69
|
-
})], CommissionNodeThread.prototype, "client", 2);
|
|
70
|
-
__decorateClass([r()], CommissionNodeThread.prototype, "_loading", 2);
|
|
71
|
-
__decorateClass([e("md-outlined-text-field[label='Thread dataset']")], CommissionNodeThread.prototype, "_datasetField", 2);
|
|
72
|
-
__decorateClass([e("md-outlined-text-field[label='Pairing code']")], CommissionNodeThread.prototype, "_pairingCodeField", 2);
|
|
73
|
-
CommissionNodeThread = __decorateClass([t("commission-node-thread")], CommissionNodeThread);
|
|
74
|
-
|
|
75
|
-
export { CommissionNodeThread };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { r, c, n, d as clientContext, e, t, i, A, b } from './matter-dashboard-app-BazvuIIi.js';
|
|
2
|
-
import { f as fireEvent } from './fire_event-BERTqZpV.js';
|
|
3
|
-
import './outlined-text-field-Sqd4JHxo.js';
|
|
4
|
-
import './main.js';
|
|
5
|
-
import './prevent_default-D4GG_QeD.js';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
-
if (kind && result) __defProp(target, key, result);
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
let CommissionNodeWifi = class extends i {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this._loading = false;
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
if (!this.client.serverInfo.wifi_credentials_set) {
|
|
22
|
-
return b`<md-outlined-text-field label="SSID" .disabled="${this._loading}"> </md-outlined-text-field>
|
|
23
|
-
<md-outlined-text-field label="Password" type="password" .disabled="${this._loading}">
|
|
24
|
-
</md-outlined-text-field>
|
|
25
|
-
<br />
|
|
26
|
-
<br />
|
|
27
|
-
<md-outlined-button @click=${this._setWifiCredentials} .disabled="${this._loading}"
|
|
28
|
-
>Set WiFi Credentials</md-outlined-button
|
|
29
|
-
>${this._loading ? b`<md-circular-progress indeterminate .visible="${this._loading}"></md-circular-progress>` : A}`;
|
|
30
|
-
}
|
|
31
|
-
return b`<md-outlined-text-field label="Pairing code" .disabled="${this._loading}"> </md-outlined-text-field>
|
|
32
|
-
<br />
|
|
33
|
-
<br />
|
|
34
|
-
<md-outlined-button @click=${this._commissionNode} .disabled="${this._loading}"
|
|
35
|
-
>Commission</md-outlined-button
|
|
36
|
-
>${this._loading ? b`<md-circular-progress indeterminate></md-circular-progress>` : A}`;
|
|
37
|
-
}
|
|
38
|
-
_setWifiCredentials() {
|
|
39
|
-
const ssid = this._ssidField.value;
|
|
40
|
-
if (!ssid) {
|
|
41
|
-
alert("SSID is required");
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const password = this._passwordField.value;
|
|
45
|
-
if (!password) {
|
|
46
|
-
alert("Password is required");
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this._loading = true;
|
|
50
|
-
try {
|
|
51
|
-
this.client.setWifiCredentials(ssid, password);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
alert(`Error setting WiFi credentials:
|
|
54
|
-
${err.message}`);
|
|
55
|
-
} finally {
|
|
56
|
-
this._loading = false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async _commissionNode() {
|
|
60
|
-
try {
|
|
61
|
-
if (!this._pairingCodeField.value) {
|
|
62
|
-
alert("Pairing code is required");
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this._loading = true;
|
|
66
|
-
const node = await this.client.commissionWithCode(this._pairingCodeField.value, false);
|
|
67
|
-
fireEvent(this, "node-commissioned", node);
|
|
68
|
-
} catch (err) {
|
|
69
|
-
alert(`Error commissioning node:
|
|
70
|
-
${err.message}`);
|
|
71
|
-
} finally {
|
|
72
|
-
this._loading = false;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
__decorateClass([c({
|
|
77
|
-
context: clientContext,
|
|
78
|
-
subscribe: true
|
|
79
|
-
}), n({
|
|
80
|
-
attribute: false
|
|
81
|
-
})], CommissionNodeWifi.prototype, "client", 2);
|
|
82
|
-
__decorateClass([r()], CommissionNodeWifi.prototype, "_loading", 2);
|
|
83
|
-
__decorateClass([e("md-outlined-text-field[label='SSID']")], CommissionNodeWifi.prototype, "_ssidField", 2);
|
|
84
|
-
__decorateClass([e("md-outlined-text-field[label='Password']")], CommissionNodeWifi.prototype, "_passwordField", 2);
|
|
85
|
-
__decorateClass([e("md-outlined-text-field[label='Pairing code']")], CommissionNodeWifi.prototype, "_pairingCodeField", 2);
|
|
86
|
-
CommissionNodeWifi = __decorateClass([t("commission-node-wifi")], CommissionNodeWifi);
|
|
87
|
-
|
|
88
|
-
export { CommissionNodeWifi };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { n, t, i, b } from './matter-dashboard-app-BazvuIIi.js';
|
|
2
|
-
import { p as preventDefault } from './prevent_default-D4GG_QeD.js';
|
|
3
|
-
import './main.js';
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10
|
-
if (kind && result) __defProp(target, key, result);
|
|
11
|
-
return result;
|
|
12
|
-
};
|
|
13
|
-
let DialogBox = class extends i {
|
|
14
|
-
render() {
|
|
15
|
-
const params = this.params;
|
|
16
|
-
return b`
|
|
17
|
-
<md-dialog open @cancel=${preventDefault} @closed=${this._handleClosed}>
|
|
18
|
-
${params.title ? b`<div slot="headline">${params.title}</div>` : ""}
|
|
19
|
-
${params.text ? b`<div slot="content">${params.text}</div>` : ""}
|
|
20
|
-
<div slot="actions">
|
|
21
|
-
${this.type === "prompt" ? b`
|
|
22
|
-
<md-text-button @click=${this._cancel}> ${params.cancelText || "Cancel"} </md-text-button>
|
|
23
|
-
` : ""}
|
|
24
|
-
<md-text-button @click=${this._confirm}> ${params.confirmText || "OK"} </md-text-button>
|
|
25
|
-
</div>
|
|
26
|
-
</md-dialog>
|
|
27
|
-
`;
|
|
28
|
-
}
|
|
29
|
-
_cancel() {
|
|
30
|
-
this._setResult(false);
|
|
31
|
-
}
|
|
32
|
-
_confirm() {
|
|
33
|
-
this._setResult(true);
|
|
34
|
-
}
|
|
35
|
-
_setResult(result) {
|
|
36
|
-
this.dialogResult(result);
|
|
37
|
-
this.shadowRoot.querySelector("md-dialog").close();
|
|
38
|
-
}
|
|
39
|
-
_handleClosed() {
|
|
40
|
-
this.parentElement.removeChild(this);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
__decorateClass([n({
|
|
44
|
-
attribute: false
|
|
45
|
-
})], DialogBox.prototype, "params", 2);
|
|
46
|
-
__decorateClass([n({
|
|
47
|
-
attribute: false
|
|
48
|
-
})], DialogBox.prototype, "dialogResult", 2);
|
|
49
|
-
__decorateClass([n()], DialogBox.prototype, "type", 2);
|
|
50
|
-
DialogBox = __decorateClass([t("dialox-box")], DialogBox);
|
|
51
|
-
|
|
52
|
-
export { DialogBox };
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { m as mixinDelegatesAria, i, _ as __decorate, n, f as e, A, b, a as i$1, t } from './matter-dashboard-app-BazvuIIi.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright 2023 Google LLC
|
|
6
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
*/
|
|
8
|
-
// Separate variable needed for closure.
|
|
9
|
-
const progressBaseClass = mixinDelegatesAria(i);
|
|
10
|
-
/**
|
|
11
|
-
* A progress component.
|
|
12
|
-
*/
|
|
13
|
-
class Progress extends progressBaseClass {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
/**
|
|
17
|
-
* Progress to display, a fraction between 0 and `max`.
|
|
18
|
-
*/
|
|
19
|
-
this.value = 0;
|
|
20
|
-
/**
|
|
21
|
-
* Maximum progress to display, defaults to 1.
|
|
22
|
-
*/
|
|
23
|
-
this.max = 1;
|
|
24
|
-
/**
|
|
25
|
-
* Whether or not to display indeterminate progress, which gives no indication
|
|
26
|
-
* to how long an activity will take.
|
|
27
|
-
*/
|
|
28
|
-
this.indeterminate = false;
|
|
29
|
-
/**
|
|
30
|
-
* Whether or not to render indeterminate mode using 4 colors instead of one.
|
|
31
|
-
*/
|
|
32
|
-
this.fourColor = false;
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
// Needed for closure conformance
|
|
36
|
-
const {
|
|
37
|
-
ariaLabel
|
|
38
|
-
} = this;
|
|
39
|
-
return b`
|
|
40
|
-
<div
|
|
41
|
-
class="progress ${e(this.getRenderClasses())}"
|
|
42
|
-
role="progressbar"
|
|
43
|
-
aria-label="${ariaLabel || A}"
|
|
44
|
-
aria-valuemin="0"
|
|
45
|
-
aria-valuemax=${this.max}
|
|
46
|
-
aria-valuenow=${this.indeterminate ? A : this.value}
|
|
47
|
-
>${this.renderIndicator()}</div
|
|
48
|
-
>
|
|
49
|
-
`;
|
|
50
|
-
}
|
|
51
|
-
getRenderClasses() {
|
|
52
|
-
return {
|
|
53
|
-
'indeterminate': this.indeterminate,
|
|
54
|
-
'four-color': this.fourColor
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
__decorate([n({
|
|
59
|
-
type: Number
|
|
60
|
-
})], Progress.prototype, "value", void 0);
|
|
61
|
-
__decorate([n({
|
|
62
|
-
type: Number
|
|
63
|
-
})], Progress.prototype, "max", void 0);
|
|
64
|
-
__decorate([n({
|
|
65
|
-
type: Boolean
|
|
66
|
-
})], Progress.prototype, "indeterminate", void 0);
|
|
67
|
-
__decorate([n({
|
|
68
|
-
type: Boolean,
|
|
69
|
-
attribute: 'four-color'
|
|
70
|
-
})], Progress.prototype, "fourColor", void 0);
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @license
|
|
74
|
-
* Copyright 2023 Google LLC
|
|
75
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
76
|
-
*/
|
|
77
|
-
/**
|
|
78
|
-
* A circular progress component.
|
|
79
|
-
*/
|
|
80
|
-
class CircularProgress extends Progress {
|
|
81
|
-
renderIndicator() {
|
|
82
|
-
if (this.indeterminate) {
|
|
83
|
-
return this.renderIndeterminateContainer();
|
|
84
|
-
}
|
|
85
|
-
return this.renderDeterminateContainer();
|
|
86
|
-
}
|
|
87
|
-
// Determinate mode is rendered with an svg so the progress arc can be
|
|
88
|
-
// easily animated via stroke-dashoffset.
|
|
89
|
-
renderDeterminateContainer() {
|
|
90
|
-
const dashOffset = (1 - this.value / this.max) * 100;
|
|
91
|
-
// note, dash-array/offset are relative to Setting `pathLength` but
|
|
92
|
-
// Chrome seems to render this inaccurately and using a large viewbox helps.
|
|
93
|
-
return b`
|
|
94
|
-
<svg viewBox="0 0 4800 4800">
|
|
95
|
-
<circle class="track" pathLength="100"></circle>
|
|
96
|
-
<circle
|
|
97
|
-
class="active-track"
|
|
98
|
-
pathLength="100"
|
|
99
|
-
stroke-dashoffset=${dashOffset}></circle>
|
|
100
|
-
</svg>
|
|
101
|
-
`;
|
|
102
|
-
}
|
|
103
|
-
// Indeterminate mode rendered with 2 bordered-divs. The borders are
|
|
104
|
-
// clipped into half circles by their containers. The divs are then carefully
|
|
105
|
-
// animated to produce changes to the spinner arc size.
|
|
106
|
-
// This approach has 4.5x the FPS of rendering via svg on Chrome 111.
|
|
107
|
-
// See https://lit.dev/playground/#gist=febb773565272f75408ab06a0eb49746.
|
|
108
|
-
renderIndeterminateContainer() {
|
|
109
|
-
return b` <div class="spinner">
|
|
110
|
-
<div class="left">
|
|
111
|
-
<div class="circle"></div>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="right">
|
|
114
|
-
<div class="circle"></div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>`;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @license
|
|
122
|
-
* Copyright 2024 Google LLC
|
|
123
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
124
|
-
*/
|
|
125
|
-
// Generated stylesheet for ./progress/internal/circular-progress-styles.css.
|
|
126
|
-
const styles = i$1`:host{--_active-indicator-color: var(--md-circular-progress-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_active-indicator-width: var(--md-circular-progress-active-indicator-width, 10);--_four-color-active-indicator-four-color: var(--md-circular-progress-four-color-active-indicator-four-color, var(--md-sys-color-tertiary-container, #ffd8e4));--_four-color-active-indicator-one-color: var(--md-circular-progress-four-color-active-indicator-one-color, var(--md-sys-color-primary, #6750a4));--_four-color-active-indicator-three-color: var(--md-circular-progress-four-color-active-indicator-three-color, var(--md-sys-color-tertiary, #7d5260));--_four-color-active-indicator-two-color: var(--md-circular-progress-four-color-active-indicator-two-color, var(--md-sys-color-primary-container, #eaddff));--_size: var(--md-circular-progress-size, 48px);display:inline-flex;vertical-align:middle;width:var(--_size);height:var(--_size);position:relative;align-items:center;justify-content:center;contain:strict;content-visibility:auto}.progress{flex:1;align-self:stretch;margin:4px}.progress,.spinner,.left,.right,.circle,svg,.track,.active-track{position:absolute;inset:0}svg{transform:rotate(-90deg)}circle{cx:50%;cy:50%;r:calc(50%*(1 - var(--_active-indicator-width)/100));stroke-width:calc(var(--_active-indicator-width)*1%);stroke-dasharray:100;fill:rgba(0,0,0,0)}.active-track{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);stroke:var(--_active-indicator-color)}.track{stroke:rgba(0,0,0,0)}.progress.indeterminate{animation:linear infinite linear-rotate;animation-duration:1568.2352941176ms}.spinner{animation:infinite both rotate-arc;animation-duration:5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.left{overflow:hidden;inset:0 50% 0 0}.right{overflow:hidden;inset:0 0 0 50%}.circle{box-sizing:border-box;border-radius:50%;border:solid calc(var(--_active-indicator-width)/100*(var(--_size) - 8px));border-color:var(--_active-indicator-color) var(--_active-indicator-color) rgba(0,0,0,0) rgba(0,0,0,0);animation:expand-arc;animation-iteration-count:infinite;animation-fill-mode:both;animation-duration:1333ms,5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.four-color .circle{animation-name:expand-arc,four-color}.left .circle{rotate:135deg;inset:0 -100% 0 0}.right .circle{rotate:100deg;inset:0 0 0 -100%;animation-delay:-666.5ms,0ms}@media(forced-colors: active){.active-track{stroke:CanvasText}.circle{border-color:CanvasText CanvasText Canvas Canvas}}@keyframes expand-arc{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes rotate-arc{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes linear-rotate{to{transform:rotate(360deg)}}@keyframes four-color{0%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}15%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}25%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}40%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}50%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}65%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}75%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}90%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}100%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}}
|
|
127
|
-
`;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @license
|
|
131
|
-
* Copyright 2023 Google LLC
|
|
132
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
133
|
-
*/
|
|
134
|
-
/**
|
|
135
|
-
* @summary Circular progress indicators display progress by animating along an
|
|
136
|
-
* invisible circular track in a clockwise direction. They can be applied
|
|
137
|
-
* directly to a surface, such as a button or card.
|
|
138
|
-
*
|
|
139
|
-
* @description
|
|
140
|
-
* Progress indicators inform users about the status of ongoing processes.
|
|
141
|
-
* - Determinate indicators display how long a process will take.
|
|
142
|
-
* - Indeterminate indicators express an unspecified amount of wait time.
|
|
143
|
-
*
|
|
144
|
-
* @final
|
|
145
|
-
* @suppress {visibility}
|
|
146
|
-
*/
|
|
147
|
-
let MdCircularProgress = class MdCircularProgress extends CircularProgress {};
|
|
148
|
-
MdCircularProgress.styles = [styles];
|
|
149
|
-
MdCircularProgress = __decorate([t('md-circular-progress')], MdCircularProgress);
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @license
|
|
153
|
-
* Copyright 2025-2026 Open Home Foundation
|
|
154
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
155
|
-
*/
|
|
156
|
-
const fireEvent = (node, type, detail, options) => {
|
|
157
|
-
options = options || {};
|
|
158
|
-
detail = detail === null || detail === void 0 ? {} : detail;
|
|
159
|
-
const event = new Event(type, {
|
|
160
|
-
bubbles: options.bubbles === void 0 ? true : options.bubbles,
|
|
161
|
-
cancelable: Boolean(options.cancelable),
|
|
162
|
-
composed: options.composed === void 0 ? true : options.composed
|
|
163
|
-
});
|
|
164
|
-
event.detail = detail;
|
|
165
|
-
node.dispatchEvent(event);
|
|
166
|
-
return event;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
export { fireEvent as f };
|