@playcanvas/web-components 0.3.0 → 0.6.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/LICENSE +21 -21
- package/README.md +84 -84
- package/dist/components/gsplat-component.d.ts +79 -0
- package/dist/components/light-component.d.ts +48 -0
- package/dist/index.d.ts +2 -2
- package/dist/pwc.cjs +324 -203
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +324 -203
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.mjs +325 -204
- package/dist/pwc.mjs.map +1 -1
- package/package.json +76 -66
- package/src/app.ts +612 -606
- package/src/asset.ts +159 -159
- package/src/async-element.ts +46 -46
- package/src/colors.ts +150 -150
- package/src/components/camera-component.ts +557 -557
- package/src/components/collision-component.ts +183 -183
- package/src/components/component.ts +97 -97
- package/src/components/element-component.ts +367 -367
- package/src/components/gsplat-component.ts +161 -0
- package/src/components/light-component.ts +570 -466
- package/src/components/listener-component.ts +30 -30
- package/src/components/particlesystem-component.ts +155 -155
- package/src/components/render-component.ts +147 -147
- package/src/components/rigidbody-component.ts +227 -227
- package/src/components/screen-component.ts +157 -157
- package/src/components/script-component.ts +270 -270
- package/src/components/script.ts +90 -90
- package/src/components/sound-component.ts +230 -230
- package/src/components/sound-slot.ts +288 -288
- package/src/entity.ts +360 -360
- package/src/index.ts +63 -63
- package/src/material.ts +141 -141
- package/src/model.ts +111 -111
- package/src/module.ts +43 -43
- package/src/scene.ts +217 -217
- package/src/sky.ts +293 -293
- package/src/utils.ts +71 -71
- package/dist/components/splat-component.d.ts +0 -61
- package/src/components/splat-component.ts +0 -133
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
import { CollisionComponent, Quat, Vec3 } from 'playcanvas';
|
|
2
|
-
|
|
3
|
-
import { ComponentElement } from './component';
|
|
4
|
-
import { parseQuat, parseVec3 } from '../utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
8
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
9
|
-
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
10
|
-
* {@link HTMLElement} interface.
|
|
11
|
-
*
|
|
12
|
-
* @category Components
|
|
13
|
-
*/
|
|
14
|
-
class CollisionComponentElement extends ComponentElement {
|
|
15
|
-
private _angularOffset: Quat = new Quat();
|
|
16
|
-
|
|
17
|
-
private _axis: number = 1;
|
|
18
|
-
|
|
19
|
-
private _convexHull: boolean = false;
|
|
20
|
-
|
|
21
|
-
private _halfExtents: Vec3 = new Vec3(0.5, 0.5, 0.5);
|
|
22
|
-
|
|
23
|
-
private _height: number = 2;
|
|
24
|
-
|
|
25
|
-
private _linearOffset: Vec3 = new Vec3();
|
|
26
|
-
|
|
27
|
-
private _radius: number = 0.5;
|
|
28
|
-
|
|
29
|
-
private _type: string = 'box';
|
|
30
|
-
|
|
31
|
-
/** @ignore */
|
|
32
|
-
constructor() {
|
|
33
|
-
super('collision');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getInitialComponentData() {
|
|
37
|
-
return {
|
|
38
|
-
axis: this._axis,
|
|
39
|
-
angularOffset: this._angularOffset,
|
|
40
|
-
convexHull: this._convexHull,
|
|
41
|
-
halfExtents: this._halfExtents,
|
|
42
|
-
height: this._height,
|
|
43
|
-
linearOffset: this._linearOffset,
|
|
44
|
-
radius: this._radius,
|
|
45
|
-
type: this._type
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Gets the underlying PlayCanvas collision component.
|
|
51
|
-
* @returns The collision component.
|
|
52
|
-
*/
|
|
53
|
-
get component(): CollisionComponent | null {
|
|
54
|
-
return super.component as CollisionComponent | null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
set angularOffset(value: Quat) {
|
|
58
|
-
this._angularOffset = value;
|
|
59
|
-
if (this.component) {
|
|
60
|
-
this.component.angularOffset = value;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
get angularOffset() {
|
|
65
|
-
return this._angularOffset;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
set axis(value: number) {
|
|
69
|
-
this._axis = value;
|
|
70
|
-
if (this.component) {
|
|
71
|
-
this.component.axis = value;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get axis() {
|
|
76
|
-
return this._axis;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
set convexHull(value: boolean) {
|
|
80
|
-
this._convexHull = value;
|
|
81
|
-
if (this.component) {
|
|
82
|
-
this.component.convexHull = value;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get convexHull() {
|
|
87
|
-
return this._convexHull;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
set halfExtents(value: Vec3) {
|
|
91
|
-
this._halfExtents = value;
|
|
92
|
-
if (this.component) {
|
|
93
|
-
this.component.halfExtents = value;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
get halfExtents() {
|
|
98
|
-
return this._halfExtents;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
set height(value: number) {
|
|
102
|
-
this._height = value;
|
|
103
|
-
if (this.component) {
|
|
104
|
-
this.component.height = value;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
get height() {
|
|
109
|
-
return this._height;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
set linearOffset(value: Vec3) {
|
|
113
|
-
this._linearOffset = value;
|
|
114
|
-
if (this.component) {
|
|
115
|
-
this.component.linearOffset = value;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get linearOffset() {
|
|
120
|
-
return this._linearOffset;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
set radius(value: number) {
|
|
124
|
-
this._radius = value;
|
|
125
|
-
if (this.component) {
|
|
126
|
-
this.component.radius = value;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
get radius() {
|
|
131
|
-
return this._radius;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
set type(value: string) {
|
|
135
|
-
this._type = value;
|
|
136
|
-
if (this.component) {
|
|
137
|
-
this.component.type = value;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
get type() {
|
|
142
|
-
return this._type;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
static get observedAttributes() {
|
|
146
|
-
return [...super.observedAttributes, 'angular-offset', 'axis', 'convex-hull', 'half-extents', 'height', 'linear-offset', 'radius', 'type'];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
150
|
-
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
151
|
-
|
|
152
|
-
switch (name) {
|
|
153
|
-
case 'angular-offset':
|
|
154
|
-
this.angularOffset = parseQuat(newValue);
|
|
155
|
-
break;
|
|
156
|
-
case 'axis':
|
|
157
|
-
this.axis = parseInt(newValue, 10);
|
|
158
|
-
break;
|
|
159
|
-
case 'convex-hull':
|
|
160
|
-
this.convexHull = this.hasAttribute('convex-hull');
|
|
161
|
-
break;
|
|
162
|
-
case 'half-extents':
|
|
163
|
-
this.halfExtents = parseVec3(newValue);
|
|
164
|
-
break;
|
|
165
|
-
case 'height':
|
|
166
|
-
this.height = parseFloat(newValue);
|
|
167
|
-
break;
|
|
168
|
-
case 'linear-offset':
|
|
169
|
-
this.linearOffset = parseVec3(newValue);
|
|
170
|
-
break;
|
|
171
|
-
case 'radius':
|
|
172
|
-
this.radius = parseFloat(newValue);
|
|
173
|
-
break;
|
|
174
|
-
case 'type':
|
|
175
|
-
this.type = newValue;
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
customElements.define('pc-collision', CollisionComponentElement);
|
|
182
|
-
|
|
183
|
-
export { CollisionComponentElement };
|
|
1
|
+
import { CollisionComponent, Quat, Vec3 } from 'playcanvas';
|
|
2
|
+
|
|
3
|
+
import { ComponentElement } from './component';
|
|
4
|
+
import { parseQuat, parseVec3 } from '../utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
9
|
+
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
11
|
+
*
|
|
12
|
+
* @category Components
|
|
13
|
+
*/
|
|
14
|
+
class CollisionComponentElement extends ComponentElement {
|
|
15
|
+
private _angularOffset: Quat = new Quat();
|
|
16
|
+
|
|
17
|
+
private _axis: number = 1;
|
|
18
|
+
|
|
19
|
+
private _convexHull: boolean = false;
|
|
20
|
+
|
|
21
|
+
private _halfExtents: Vec3 = new Vec3(0.5, 0.5, 0.5);
|
|
22
|
+
|
|
23
|
+
private _height: number = 2;
|
|
24
|
+
|
|
25
|
+
private _linearOffset: Vec3 = new Vec3();
|
|
26
|
+
|
|
27
|
+
private _radius: number = 0.5;
|
|
28
|
+
|
|
29
|
+
private _type: string = 'box';
|
|
30
|
+
|
|
31
|
+
/** @ignore */
|
|
32
|
+
constructor() {
|
|
33
|
+
super('collision');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getInitialComponentData() {
|
|
37
|
+
return {
|
|
38
|
+
axis: this._axis,
|
|
39
|
+
angularOffset: this._angularOffset,
|
|
40
|
+
convexHull: this._convexHull,
|
|
41
|
+
halfExtents: this._halfExtents,
|
|
42
|
+
height: this._height,
|
|
43
|
+
linearOffset: this._linearOffset,
|
|
44
|
+
radius: this._radius,
|
|
45
|
+
type: this._type
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Gets the underlying PlayCanvas collision component.
|
|
51
|
+
* @returns The collision component.
|
|
52
|
+
*/
|
|
53
|
+
get component(): CollisionComponent | null {
|
|
54
|
+
return super.component as CollisionComponent | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
set angularOffset(value: Quat) {
|
|
58
|
+
this._angularOffset = value;
|
|
59
|
+
if (this.component) {
|
|
60
|
+
this.component.angularOffset = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get angularOffset() {
|
|
65
|
+
return this._angularOffset;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
set axis(value: number) {
|
|
69
|
+
this._axis = value;
|
|
70
|
+
if (this.component) {
|
|
71
|
+
this.component.axis = value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get axis() {
|
|
76
|
+
return this._axis;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set convexHull(value: boolean) {
|
|
80
|
+
this._convexHull = value;
|
|
81
|
+
if (this.component) {
|
|
82
|
+
this.component.convexHull = value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get convexHull() {
|
|
87
|
+
return this._convexHull;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
set halfExtents(value: Vec3) {
|
|
91
|
+
this._halfExtents = value;
|
|
92
|
+
if (this.component) {
|
|
93
|
+
this.component.halfExtents = value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
get halfExtents() {
|
|
98
|
+
return this._halfExtents;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
set height(value: number) {
|
|
102
|
+
this._height = value;
|
|
103
|
+
if (this.component) {
|
|
104
|
+
this.component.height = value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
get height() {
|
|
109
|
+
return this._height;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
set linearOffset(value: Vec3) {
|
|
113
|
+
this._linearOffset = value;
|
|
114
|
+
if (this.component) {
|
|
115
|
+
this.component.linearOffset = value;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get linearOffset() {
|
|
120
|
+
return this._linearOffset;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
set radius(value: number) {
|
|
124
|
+
this._radius = value;
|
|
125
|
+
if (this.component) {
|
|
126
|
+
this.component.radius = value;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
get radius() {
|
|
131
|
+
return this._radius;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
set type(value: string) {
|
|
135
|
+
this._type = value;
|
|
136
|
+
if (this.component) {
|
|
137
|
+
this.component.type = value;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get type() {
|
|
142
|
+
return this._type;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static get observedAttributes() {
|
|
146
|
+
return [...super.observedAttributes, 'angular-offset', 'axis', 'convex-hull', 'half-extents', 'height', 'linear-offset', 'radius', 'type'];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
150
|
+
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
151
|
+
|
|
152
|
+
switch (name) {
|
|
153
|
+
case 'angular-offset':
|
|
154
|
+
this.angularOffset = parseQuat(newValue);
|
|
155
|
+
break;
|
|
156
|
+
case 'axis':
|
|
157
|
+
this.axis = parseInt(newValue, 10);
|
|
158
|
+
break;
|
|
159
|
+
case 'convex-hull':
|
|
160
|
+
this.convexHull = this.hasAttribute('convex-hull');
|
|
161
|
+
break;
|
|
162
|
+
case 'half-extents':
|
|
163
|
+
this.halfExtents = parseVec3(newValue);
|
|
164
|
+
break;
|
|
165
|
+
case 'height':
|
|
166
|
+
this.height = parseFloat(newValue);
|
|
167
|
+
break;
|
|
168
|
+
case 'linear-offset':
|
|
169
|
+
this.linearOffset = parseVec3(newValue);
|
|
170
|
+
break;
|
|
171
|
+
case 'radius':
|
|
172
|
+
this.radius = parseFloat(newValue);
|
|
173
|
+
break;
|
|
174
|
+
case 'type':
|
|
175
|
+
this.type = newValue;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
customElements.define('pc-collision', CollisionComponentElement);
|
|
182
|
+
|
|
183
|
+
export { CollisionComponentElement };
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { Component } from 'playcanvas';
|
|
2
|
-
|
|
3
|
-
import { AsyncElement } from '../async-element';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents a component in the PlayCanvas engine.
|
|
7
|
-
*
|
|
8
|
-
* @category Components
|
|
9
|
-
*/
|
|
10
|
-
class ComponentElement extends AsyncElement {
|
|
11
|
-
private _componentName: string;
|
|
12
|
-
|
|
13
|
-
private _enabled = true;
|
|
14
|
-
|
|
15
|
-
private _component: Component | null = null;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new ComponentElement instance.
|
|
19
|
-
*
|
|
20
|
-
* @param componentName - The name of the component.
|
|
21
|
-
* @ignore
|
|
22
|
-
*/
|
|
23
|
-
constructor(componentName: string) {
|
|
24
|
-
super();
|
|
25
|
-
|
|
26
|
-
this._componentName = componentName;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Method to be overridden by subclasses to provide initial component data
|
|
30
|
-
getInitialComponentData() {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async addComponent() {
|
|
35
|
-
const entityElement = this.closestEntity;
|
|
36
|
-
if (entityElement) {
|
|
37
|
-
await entityElement.ready();
|
|
38
|
-
// Add the component to the entity
|
|
39
|
-
const data = this.getInitialComponentData();
|
|
40
|
-
this._component = entityElement.entity!.addComponent(this._componentName, data);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
initComponent() {}
|
|
45
|
-
|
|
46
|
-
async connectedCallback() {
|
|
47
|
-
await this.closestApp?.ready();
|
|
48
|
-
await this.addComponent();
|
|
49
|
-
this.initComponent();
|
|
50
|
-
this._onReady();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
disconnectedCallback() {
|
|
54
|
-
// Remove the component when the element is disconnected
|
|
55
|
-
if (this.component && this.component.entity) {
|
|
56
|
-
this._component!.entity.removeComponent(this._componentName);
|
|
57
|
-
this._component = null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get component(): Component | null {
|
|
62
|
-
return this._component;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Sets the enabled state of the component.
|
|
67
|
-
* @param value - The enabled state of the component.
|
|
68
|
-
*/
|
|
69
|
-
set enabled(value: boolean) {
|
|
70
|
-
this._enabled = value;
|
|
71
|
-
if (this.component) {
|
|
72
|
-
this.component.enabled = value;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Gets the enabled state of the component.
|
|
78
|
-
* @returns The enabled state of the component.
|
|
79
|
-
*/
|
|
80
|
-
get enabled() {
|
|
81
|
-
return this._enabled;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
static get observedAttributes() {
|
|
85
|
-
return ['enabled'];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
89
|
-
switch (name) {
|
|
90
|
-
case 'enabled':
|
|
91
|
-
this.enabled = newValue !== 'false';
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export { ComponentElement };
|
|
1
|
+
import { Component } from 'playcanvas';
|
|
2
|
+
|
|
3
|
+
import { AsyncElement } from '../async-element';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a component in the PlayCanvas engine.
|
|
7
|
+
*
|
|
8
|
+
* @category Components
|
|
9
|
+
*/
|
|
10
|
+
class ComponentElement extends AsyncElement {
|
|
11
|
+
private _componentName: string;
|
|
12
|
+
|
|
13
|
+
private _enabled = true;
|
|
14
|
+
|
|
15
|
+
private _component: Component | null = null;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new ComponentElement instance.
|
|
19
|
+
*
|
|
20
|
+
* @param componentName - The name of the component.
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
constructor(componentName: string) {
|
|
24
|
+
super();
|
|
25
|
+
|
|
26
|
+
this._componentName = componentName;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Method to be overridden by subclasses to provide initial component data
|
|
30
|
+
getInitialComponentData() {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async addComponent() {
|
|
35
|
+
const entityElement = this.closestEntity;
|
|
36
|
+
if (entityElement) {
|
|
37
|
+
await entityElement.ready();
|
|
38
|
+
// Add the component to the entity
|
|
39
|
+
const data = this.getInitialComponentData();
|
|
40
|
+
this._component = entityElement.entity!.addComponent(this._componentName, data);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
initComponent() {}
|
|
45
|
+
|
|
46
|
+
async connectedCallback() {
|
|
47
|
+
await this.closestApp?.ready();
|
|
48
|
+
await this.addComponent();
|
|
49
|
+
this.initComponent();
|
|
50
|
+
this._onReady();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
// Remove the component when the element is disconnected
|
|
55
|
+
if (this.component && this.component.entity) {
|
|
56
|
+
this._component!.entity.removeComponent(this._componentName);
|
|
57
|
+
this._component = null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get component(): Component | null {
|
|
62
|
+
return this._component;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Sets the enabled state of the component.
|
|
67
|
+
* @param value - The enabled state of the component.
|
|
68
|
+
*/
|
|
69
|
+
set enabled(value: boolean) {
|
|
70
|
+
this._enabled = value;
|
|
71
|
+
if (this.component) {
|
|
72
|
+
this.component.enabled = value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Gets the enabled state of the component.
|
|
78
|
+
* @returns The enabled state of the component.
|
|
79
|
+
*/
|
|
80
|
+
get enabled() {
|
|
81
|
+
return this._enabled;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static get observedAttributes() {
|
|
85
|
+
return ['enabled'];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
89
|
+
switch (name) {
|
|
90
|
+
case 'enabled':
|
|
91
|
+
this.enabled = newValue !== 'false';
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { ComponentElement };
|