@playcanvas/web-components 0.11.1 → 0.13.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/README.md +1 -1
- package/dist/app.d.cts +246 -0
- package/dist/app.d.ts +38 -13
- package/dist/asset.d.cts +218 -0
- package/dist/asset.d.ts +145 -6
- package/dist/async-element.d.cts +103 -0
- package/dist/async-element.d.ts +11 -8
- package/dist/colors.d.cts +1 -0
- package/dist/components/button-component.d.cts +186 -0
- package/dist/components/button-component.d.ts +1 -1
- package/dist/components/camera-component.d.cts +253 -0
- package/dist/components/camera-component.d.ts +1 -1
- package/dist/components/collision-component.d.cts +73 -0
- package/dist/components/collision-component.d.ts +17 -1
- package/dist/components/component.d.cts +82 -0
- package/dist/components/component.d.ts +20 -1
- package/dist/components/element-component.d.cts +316 -0
- package/dist/components/element-component.d.ts +1 -1
- package/dist/components/gsplat-component.d.cts +108 -0
- package/dist/components/gsplat-component.d.ts +1 -1
- package/dist/components/layoutchild-component.d.cts +110 -0
- package/dist/components/layoutchild-component.d.ts +1 -1
- package/dist/components/layoutgroup-component.d.cts +136 -0
- package/dist/components/layoutgroup-component.d.ts +1 -1
- package/dist/components/light-component.d.cts +264 -0
- package/dist/components/light-component.d.ts +1 -1
- package/dist/components/listener-component.d.cts +20 -0
- package/dist/components/listener-component.d.ts +1 -1
- package/dist/components/particlesystem-component.d.cts +52 -0
- package/dist/components/particlesystem-component.d.ts +1 -1
- package/dist/components/render-component.d.cts +76 -0
- package/dist/components/render-component.d.ts +1 -1
- package/dist/components/rigidbody-component.d.cts +88 -0
- package/dist/components/rigidbody-component.d.ts +1 -1
- package/dist/components/screen-component.d.cts +70 -0
- package/dist/components/screen-component.d.ts +1 -1
- package/dist/components/script-component.d.cts +163 -0
- package/dist/components/script-component.d.ts +1 -1
- package/dist/components/script.d.cts +94 -0
- package/dist/components/script.d.ts +1 -1
- package/dist/components/scrollbar-component.d.cts +69 -0
- package/dist/components/scrollbar-component.d.ts +1 -1
- package/dist/components/scrollview-component.d.cts +178 -0
- package/dist/components/scrollview-component.d.ts +1 -1
- package/dist/components/sound-component.d.cts +108 -0
- package/dist/components/sound-component.d.ts +1 -1
- package/dist/components/sound-slot.d.cts +134 -0
- package/dist/components/sound-slot.d.ts +2 -2
- package/dist/custom-elements.json +1127 -179
- package/dist/entity-base.d.cts +67 -0
- package/dist/entity-base.d.ts +67 -0
- package/dist/entity.d.cts +131 -0
- package/dist/entity.d.ts +3 -38
- package/dist/index.d.cts +79 -0
- package/dist/index.d.ts +35 -32
- package/dist/loading-bar.d.cts +35 -0
- package/dist/material.d.cts +1011 -0
- package/dist/material.d.ts +2 -1
- package/dist/model.d.cts +72 -0
- package/dist/model.d.ts +27 -5
- package/dist/module.d.cts +29 -0
- package/dist/module.d.ts +16 -10
- package/dist/node.d.cts +253 -0
- package/dist/node.d.ts +253 -0
- package/dist/parse.d.cts +147 -0
- package/dist/pwc.cjs +1496 -200
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +1497 -201
- 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.min.mjs +1 -1
- package/dist/pwc.min.mjs.map +1 -1
- package/dist/pwc.mjs +1496 -202
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.cts +117 -0
- package/dist/scene.d.ts +1 -1
- package/dist/sky.d.cts +121 -0
- package/dist/sky.d.ts +1 -1
- package/dist/vscode.html-custom-data.json +127 -5
- package/dist/web-types.json +399 -59
- package/package.json +16 -7
- package/src/app.ts +137 -45
- package/src/asset.ts +439 -9
- package/src/async-element.ts +11 -8
- package/src/components/collision-component.ts +35 -0
- package/src/components/component.ts +93 -3
- package/src/entity-base.ts +136 -0
- package/src/entity.ts +23 -117
- package/src/index.ts +5 -0
- package/src/loading-bar.ts +2 -2
- package/src/material.ts +2 -2
- package/src/model.ts +79 -11
- package/src/module.ts +39 -20
- package/src/node.ts +715 -0
- package/src/sky.ts +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { CameraComponent } from 'playcanvas';
|
|
2
|
+
import { Color, Vec4 } from 'playcanvas';
|
|
3
|
+
import { ComponentElement } from './component.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
7
|
+
* The CameraComponentElement interface also inherits the properties and methods of the
|
|
8
|
+
* {@link HTMLElement} interface.
|
|
9
|
+
*
|
|
10
|
+
* @category Components
|
|
11
|
+
*/
|
|
12
|
+
declare class CameraComponentElement extends ComponentElement {
|
|
13
|
+
private _clearColor;
|
|
14
|
+
private _clearColorBuffer;
|
|
15
|
+
private _clearDepthBuffer;
|
|
16
|
+
private _clearStencilBuffer;
|
|
17
|
+
private _cullFaces;
|
|
18
|
+
private _farClip;
|
|
19
|
+
private _flipFaces;
|
|
20
|
+
private _fov;
|
|
21
|
+
private _frustumCulling;
|
|
22
|
+
private _gamma;
|
|
23
|
+
private _horizontalFov;
|
|
24
|
+
private _nearClip;
|
|
25
|
+
private _projection;
|
|
26
|
+
private _orthoHeight;
|
|
27
|
+
private _priority;
|
|
28
|
+
private _rect;
|
|
29
|
+
private _scissorRect;
|
|
30
|
+
private _tonemap;
|
|
31
|
+
/** @ignore */
|
|
32
|
+
constructor();
|
|
33
|
+
protected getInitialComponentData(): {
|
|
34
|
+
clearColor: Color;
|
|
35
|
+
clearColorBuffer: boolean;
|
|
36
|
+
clearDepthBuffer: boolean;
|
|
37
|
+
clearStencilBuffer: boolean;
|
|
38
|
+
cullFaces: boolean;
|
|
39
|
+
farClip: number;
|
|
40
|
+
flipFaces: boolean;
|
|
41
|
+
fov: number;
|
|
42
|
+
frustumCulling: boolean;
|
|
43
|
+
gammaCorrection: 0 | 1;
|
|
44
|
+
horizontalFov: boolean;
|
|
45
|
+
nearClip: number;
|
|
46
|
+
projection: number;
|
|
47
|
+
orthoHeight: number;
|
|
48
|
+
priority: number;
|
|
49
|
+
rect: Vec4;
|
|
50
|
+
scissorRect: Vec4;
|
|
51
|
+
toneMapping: number;
|
|
52
|
+
};
|
|
53
|
+
get xrAvailable(): boolean | null;
|
|
54
|
+
/**
|
|
55
|
+
* Starts the camera in XR mode.
|
|
56
|
+
* @param type - The type of XR mode to start.
|
|
57
|
+
* @param space - The space to start the camera in.
|
|
58
|
+
*/
|
|
59
|
+
startXr(type: 'immersive-ar' | 'immersive-vr', space: 'bounded-floor' | 'local' | 'local-floor' | 'unbounded' | 'viewer'): void;
|
|
60
|
+
/**
|
|
61
|
+
* Ends the camera's XR mode.
|
|
62
|
+
*/
|
|
63
|
+
endXr(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the underlying PlayCanvas camera component.
|
|
66
|
+
* @returns The camera component.
|
|
67
|
+
*/
|
|
68
|
+
get component(): CameraComponent;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the clear color of the camera.
|
|
71
|
+
* @param value - The clear color.
|
|
72
|
+
*/
|
|
73
|
+
set clearColor(value: Color);
|
|
74
|
+
/**
|
|
75
|
+
* Gets the clear color of the camera.
|
|
76
|
+
* @returns The clear color.
|
|
77
|
+
*/
|
|
78
|
+
get clearColor(): Color;
|
|
79
|
+
/**
|
|
80
|
+
* Sets the clear color buffer of the camera.
|
|
81
|
+
* @param value - The clear color buffer.
|
|
82
|
+
*/
|
|
83
|
+
set clearColorBuffer(value: boolean);
|
|
84
|
+
/**
|
|
85
|
+
* Gets the clear color buffer of the camera.
|
|
86
|
+
* @returns The clear color buffer.
|
|
87
|
+
*/
|
|
88
|
+
get clearColorBuffer(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the clear depth buffer of the camera.
|
|
91
|
+
* @param value - The clear depth buffer.
|
|
92
|
+
*/
|
|
93
|
+
set clearDepthBuffer(value: boolean);
|
|
94
|
+
/**
|
|
95
|
+
* Gets the clear depth buffer of the camera.
|
|
96
|
+
* @returns The clear depth buffer.
|
|
97
|
+
*/
|
|
98
|
+
get clearDepthBuffer(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Sets the clear stencil buffer of the camera.
|
|
101
|
+
* @param value - The clear stencil buffer.
|
|
102
|
+
*/
|
|
103
|
+
set clearStencilBuffer(value: boolean);
|
|
104
|
+
/**
|
|
105
|
+
* Gets the clear stencil buffer of the camera.
|
|
106
|
+
* @returns The clear stencil buffer.
|
|
107
|
+
*/
|
|
108
|
+
get clearStencilBuffer(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the cull faces of the camera.
|
|
111
|
+
* @param value - The cull faces.
|
|
112
|
+
*/
|
|
113
|
+
set cullFaces(value: boolean);
|
|
114
|
+
/**
|
|
115
|
+
* Gets the cull faces of the camera.
|
|
116
|
+
* @returns The cull faces.
|
|
117
|
+
*/
|
|
118
|
+
get cullFaces(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Sets the far clip distance of the camera.
|
|
121
|
+
* @param value - The far clip distance.
|
|
122
|
+
*/
|
|
123
|
+
set farClip(value: number);
|
|
124
|
+
/**
|
|
125
|
+
* Gets the far clip distance of the camera.
|
|
126
|
+
* @returns The far clip distance.
|
|
127
|
+
*/
|
|
128
|
+
get farClip(): number;
|
|
129
|
+
/**
|
|
130
|
+
* Sets the flip faces of the camera.
|
|
131
|
+
* @param value - The flip faces.
|
|
132
|
+
*/
|
|
133
|
+
set flipFaces(value: boolean);
|
|
134
|
+
/**
|
|
135
|
+
* Gets the flip faces of the camera.
|
|
136
|
+
* @returns The flip faces.
|
|
137
|
+
*/
|
|
138
|
+
get flipFaces(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Sets the field of view of the camera.
|
|
141
|
+
* @param value - The field of view.
|
|
142
|
+
*/
|
|
143
|
+
set fov(value: number);
|
|
144
|
+
/**
|
|
145
|
+
* Gets the field of view of the camera.
|
|
146
|
+
* @returns The field of view.
|
|
147
|
+
*/
|
|
148
|
+
get fov(): number;
|
|
149
|
+
/**
|
|
150
|
+
* Sets the frustum culling of the camera.
|
|
151
|
+
* @param value - The frustum culling.
|
|
152
|
+
*/
|
|
153
|
+
set frustumCulling(value: boolean);
|
|
154
|
+
/**
|
|
155
|
+
* Gets the frustum culling of the camera.
|
|
156
|
+
* @returns The frustum culling.
|
|
157
|
+
*/
|
|
158
|
+
get frustumCulling(): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Sets the gamma correction of the camera.
|
|
161
|
+
* @param value - The gamma correction.
|
|
162
|
+
*/
|
|
163
|
+
set gamma(value: 'linear' | 'srgb');
|
|
164
|
+
/**
|
|
165
|
+
* Gets the gamma correction of the camera.
|
|
166
|
+
* @returns The gamma correction.
|
|
167
|
+
*/
|
|
168
|
+
get gamma(): 'linear' | 'srgb';
|
|
169
|
+
/**
|
|
170
|
+
* Sets whether the camera's field of view (fov) is horizontal or vertical. Defaults to false
|
|
171
|
+
* (meaning it is vertical be default).
|
|
172
|
+
* @param value - Whether the camera's field of view is horizontal.
|
|
173
|
+
*/
|
|
174
|
+
set horizontalFov(value: boolean);
|
|
175
|
+
/**
|
|
176
|
+
* Gets whether the camera's field of view (fov) is horizontal or vertical.
|
|
177
|
+
* @returns Whether the camera's field of view is horizontal.
|
|
178
|
+
*/
|
|
179
|
+
get horizontalFov(): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Sets the near clip distance of the camera.
|
|
182
|
+
* @param value - The near clip distance.
|
|
183
|
+
*/
|
|
184
|
+
set nearClip(value: number);
|
|
185
|
+
/**
|
|
186
|
+
* Gets the near clip distance of the camera.
|
|
187
|
+
* @returns The near clip distance.
|
|
188
|
+
*/
|
|
189
|
+
get nearClip(): number;
|
|
190
|
+
/**
|
|
191
|
+
* Sets the orthographic height of the camera.
|
|
192
|
+
* @param value - The orthographic height.
|
|
193
|
+
*/
|
|
194
|
+
set orthoHeight(value: number);
|
|
195
|
+
/**
|
|
196
|
+
* Gets the orthographic height of the camera.
|
|
197
|
+
* @returns The orthographic height.
|
|
198
|
+
*/
|
|
199
|
+
get orthoHeight(): number;
|
|
200
|
+
/**
|
|
201
|
+
* Sets the priority of the camera.
|
|
202
|
+
* @param value - The priority.
|
|
203
|
+
*/
|
|
204
|
+
set priority(value: number);
|
|
205
|
+
/**
|
|
206
|
+
* Gets the priority of the camera.
|
|
207
|
+
* @returns The priority.
|
|
208
|
+
*/
|
|
209
|
+
get priority(): number;
|
|
210
|
+
/**
|
|
211
|
+
* Sets the projection of the camera. Use `orthoHeight` to size an orthographic projection.
|
|
212
|
+
* @param value - The projection ('perspective' or 'orthographic').
|
|
213
|
+
*/
|
|
214
|
+
set projection(value: 'perspective' | 'orthographic');
|
|
215
|
+
/**
|
|
216
|
+
* Gets the projection of the camera.
|
|
217
|
+
* @returns The projection.
|
|
218
|
+
*/
|
|
219
|
+
get projection(): "perspective" | "orthographic";
|
|
220
|
+
/**
|
|
221
|
+
* Sets the rect of the camera.
|
|
222
|
+
* @param value - The rect.
|
|
223
|
+
*/
|
|
224
|
+
set rect(value: Vec4);
|
|
225
|
+
/**
|
|
226
|
+
* Gets the rect of the camera.
|
|
227
|
+
* @returns The rect.
|
|
228
|
+
*/
|
|
229
|
+
get rect(): Vec4;
|
|
230
|
+
/**
|
|
231
|
+
* Sets the scissor rect of the camera.
|
|
232
|
+
* @param value - The scissor rect.
|
|
233
|
+
*/
|
|
234
|
+
set scissorRect(value: Vec4);
|
|
235
|
+
/**
|
|
236
|
+
* Gets the scissor rect of the camera.
|
|
237
|
+
* @returns The scissor rect.
|
|
238
|
+
*/
|
|
239
|
+
get scissorRect(): Vec4;
|
|
240
|
+
/**
|
|
241
|
+
* Sets the tone mapping of the camera.
|
|
242
|
+
* @param value - The tone mapping.
|
|
243
|
+
*/
|
|
244
|
+
set tonemap(value: 'none' | 'linear' | 'filmic' | 'hejl' | 'aces' | 'aces2' | 'neutral');
|
|
245
|
+
/**
|
|
246
|
+
* Gets the tone mapping of the camera.
|
|
247
|
+
* @returns The tone mapping.
|
|
248
|
+
*/
|
|
249
|
+
get tonemap(): 'none' | 'linear' | 'filmic' | 'hejl' | 'aces' | 'aces2' | 'neutral';
|
|
250
|
+
static get observedAttributes(): string[];
|
|
251
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
252
|
+
}
|
|
253
|
+
export { CameraComponentElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CameraComponent } from 'playcanvas';
|
|
2
2
|
import { Color, Vec4 } from 'playcanvas';
|
|
3
|
-
import { ComponentElement } from './component';
|
|
3
|
+
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
6
6
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { CollisionComponent } from 'playcanvas';
|
|
2
|
+
import { Quat, Vec3 } from 'playcanvas';
|
|
3
|
+
import { ComponentElement } from './component.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
7
|
+
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
8
|
+
* {@link HTMLElement} interface.
|
|
9
|
+
*
|
|
10
|
+
* For `type="mesh"`, the collision geometry defaults to the host entity's own render component
|
|
11
|
+
* (its render asset) — a collider matching the visible mesh, which is what a mesh collider on a
|
|
12
|
+
* glTF node means. The default resolves each time the component applies, so a `pc-node` that
|
|
13
|
+
* retargets or rebinds picks up the new node's geometry. An entity with no asset-backed render
|
|
14
|
+
* component warns, and the collider has no shape.
|
|
15
|
+
*
|
|
16
|
+
* @category Components
|
|
17
|
+
*/
|
|
18
|
+
declare class CollisionComponentElement extends ComponentElement {
|
|
19
|
+
private _angularOffset;
|
|
20
|
+
private _axis;
|
|
21
|
+
private _convexHull;
|
|
22
|
+
private _halfExtents;
|
|
23
|
+
private _height;
|
|
24
|
+
private _linearOffset;
|
|
25
|
+
private _radius;
|
|
26
|
+
private _type;
|
|
27
|
+
/** @ignore */
|
|
28
|
+
constructor();
|
|
29
|
+
protected getInitialComponentData(): {
|
|
30
|
+
axis: number;
|
|
31
|
+
angularOffset: Quat;
|
|
32
|
+
convexHull: boolean;
|
|
33
|
+
halfExtents: Vec3;
|
|
34
|
+
height: number;
|
|
35
|
+
linearOffset: Vec3;
|
|
36
|
+
radius: number;
|
|
37
|
+
type: "box" | "capsule" | "compound" | "cone" | "cylinder" | "mesh" | "sphere";
|
|
38
|
+
};
|
|
39
|
+
protected initComponent(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Defaults a mesh collider's geometry to the host entity's own render component. The
|
|
42
|
+
* engine's mesh collider only works with explicitly supplied geometry, and the element has
|
|
43
|
+
* no attribute to supply it - so the host's visible geometry, the meaning a mesh collider
|
|
44
|
+
* on a glTF node carries, fills the gap. Runs on every application (so a rebound `pc-node`
|
|
45
|
+
* recomputes it) and on a runtime switch to `type="mesh"`; an explicitly assigned
|
|
46
|
+
* `renderAsset` is never overwritten.
|
|
47
|
+
*/
|
|
48
|
+
private _applyMeshGeometryDefault;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the underlying PlayCanvas collision component.
|
|
51
|
+
* @returns The collision component.
|
|
52
|
+
*/
|
|
53
|
+
get component(): CollisionComponent;
|
|
54
|
+
set angularOffset(value: Quat);
|
|
55
|
+
get angularOffset(): Quat;
|
|
56
|
+
set axis(value: number);
|
|
57
|
+
get axis(): number;
|
|
58
|
+
set convexHull(value: boolean);
|
|
59
|
+
get convexHull(): boolean;
|
|
60
|
+
set halfExtents(value: Vec3);
|
|
61
|
+
get halfExtents(): Vec3;
|
|
62
|
+
set height(value: number);
|
|
63
|
+
get height(): number;
|
|
64
|
+
set linearOffset(value: Vec3);
|
|
65
|
+
get linearOffset(): Vec3;
|
|
66
|
+
set radius(value: number);
|
|
67
|
+
get radius(): number;
|
|
68
|
+
set type(value: 'box' | 'capsule' | 'compound' | 'cone' | 'cylinder' | 'mesh' | 'sphere');
|
|
69
|
+
get type(): "box" | "capsule" | "compound" | "cone" | "cylinder" | "mesh" | "sphere";
|
|
70
|
+
static get observedAttributes(): string[];
|
|
71
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
72
|
+
}
|
|
73
|
+
export { CollisionComponentElement };
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { CollisionComponent } from 'playcanvas';
|
|
2
2
|
import { Quat, Vec3 } from 'playcanvas';
|
|
3
|
-
import { ComponentElement } from './component';
|
|
3
|
+
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
6
6
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
7
7
|
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* For `type="mesh"`, the collision geometry defaults to the host entity's own render component
|
|
11
|
+
* (its render asset) — a collider matching the visible mesh, which is what a mesh collider on a
|
|
12
|
+
* glTF node means. The default resolves each time the component applies, so a `pc-node` that
|
|
13
|
+
* retargets or rebinds picks up the new node's geometry. An entity with no asset-backed render
|
|
14
|
+
* component warns, and the collider has no shape.
|
|
15
|
+
*
|
|
10
16
|
* @category Components
|
|
11
17
|
*/
|
|
12
18
|
declare class CollisionComponentElement extends ComponentElement {
|
|
@@ -30,6 +36,16 @@ declare class CollisionComponentElement extends ComponentElement {
|
|
|
30
36
|
radius: number;
|
|
31
37
|
type: "box" | "capsule" | "compound" | "cone" | "cylinder" | "mesh" | "sphere";
|
|
32
38
|
};
|
|
39
|
+
protected initComponent(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Defaults a mesh collider's geometry to the host entity's own render component. The
|
|
42
|
+
* engine's mesh collider only works with explicitly supplied geometry, and the element has
|
|
43
|
+
* no attribute to supply it - so the host's visible geometry, the meaning a mesh collider
|
|
44
|
+
* on a glTF node carries, fills the gap. Runs on every application (so a rebound `pc-node`
|
|
45
|
+
* recomputes it) and on a runtime switch to `type="mesh"`; an explicitly assigned
|
|
46
|
+
* `renderAsset` is never overwritten.
|
|
47
|
+
*/
|
|
48
|
+
private _applyMeshGeometryDefault;
|
|
33
49
|
/**
|
|
34
50
|
* Gets the underlying PlayCanvas collision component.
|
|
35
51
|
* @returns The collision component.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Component } from 'playcanvas';
|
|
2
|
+
import { AsyncElement } from '../async-element.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a component in the PlayCanvas engine.
|
|
5
|
+
*
|
|
6
|
+
* @category Components
|
|
7
|
+
*/
|
|
8
|
+
declare class ComponentElement extends AsyncElement {
|
|
9
|
+
private _componentName;
|
|
10
|
+
private _enabled;
|
|
11
|
+
private _component;
|
|
12
|
+
private _appElement;
|
|
13
|
+
/**
|
|
14
|
+
* The element hosting this component, held so the host's readiness cycles can be observed
|
|
15
|
+
* even after `closestEntity` would no longer resolve (during teardown).
|
|
16
|
+
*/
|
|
17
|
+
private _hostElement;
|
|
18
|
+
/**
|
|
19
|
+
* The listener re-applying this component when the host's readiness cycles. Held for
|
|
20
|
+
* removal on disconnect.
|
|
21
|
+
*/
|
|
22
|
+
private _hostReadyListener;
|
|
23
|
+
/**
|
|
24
|
+
* Incremented on every connect and disconnect. connectedCallback captures the value on entry
|
|
25
|
+
* and abandons itself wherever it resumes from an await if the value has moved on — so a
|
|
26
|
+
* callback whose element was removed cannot act on a torn-down tree, and one whose element
|
|
27
|
+
* was removed and re-inserted (which runs a callback of its own) cannot add the component a
|
|
28
|
+
* second time.
|
|
29
|
+
*/
|
|
30
|
+
private _connectionGeneration;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new ComponentElement instance.
|
|
33
|
+
*
|
|
34
|
+
* @param componentName - The name of the component.
|
|
35
|
+
* @ignore
|
|
36
|
+
*/
|
|
37
|
+
constructor(componentName: string);
|
|
38
|
+
/**
|
|
39
|
+
* Returns the data the component is created with. Overridden by subclasses to supply the
|
|
40
|
+
* initial values of their cached properties.
|
|
41
|
+
*
|
|
42
|
+
* @returns The initial component data.
|
|
43
|
+
*/
|
|
44
|
+
protected getInitialComponentData(): {};
|
|
45
|
+
/**
|
|
46
|
+
* Creates the component on the host's current entity, removing it first from a previous
|
|
47
|
+
* entity that is still alive (a retargeted `<pc-node>` moves its decorations with it). When
|
|
48
|
+
* the entity already has a component of this type — a glTF node arriving with its authored
|
|
49
|
+
* `render` component, say — warns and leaves `component` null. The element-level warning is
|
|
50
|
+
* load-bearing: the engine's own duplicate-addComponent warning is Debug-stripped from
|
|
51
|
+
* production builds, which would otherwise leave a silent null.
|
|
52
|
+
*/
|
|
53
|
+
private _applyComponent;
|
|
54
|
+
private _addComponent;
|
|
55
|
+
/**
|
|
56
|
+
* Configures the newly added component. Overridden by subclasses whose setup goes beyond
|
|
57
|
+
* the initial data — child-element handling, asset resolution and the like.
|
|
58
|
+
*/
|
|
59
|
+
protected initComponent(): void;
|
|
60
|
+
connectedCallback(): Promise<void>;
|
|
61
|
+
disconnectedCallback(): void;
|
|
62
|
+
/**
|
|
63
|
+
* The PlayCanvas component instance. `null` until the element is ready, and also for an
|
|
64
|
+
* element that is not a descendant of a `<pc-entity>` — await {@link whenReady} or the
|
|
65
|
+
* element's `ready()` promise before accessing it.
|
|
66
|
+
* @returns The component instance, or `null`.
|
|
67
|
+
*/
|
|
68
|
+
get component(): Component | null;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the enabled state of the component.
|
|
71
|
+
* @param value - The enabled state of the component.
|
|
72
|
+
*/
|
|
73
|
+
set enabled(value: boolean);
|
|
74
|
+
/**
|
|
75
|
+
* Gets the enabled state of the component.
|
|
76
|
+
* @returns The enabled state of the component.
|
|
77
|
+
*/
|
|
78
|
+
get enabled(): boolean;
|
|
79
|
+
static get observedAttributes(): string[];
|
|
80
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
81
|
+
}
|
|
82
|
+
export { ComponentElement };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from 'playcanvas';
|
|
2
|
-
import { AsyncElement } from '../async-element';
|
|
2
|
+
import { AsyncElement } from '../async-element.js';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a component in the PlayCanvas engine.
|
|
5
5
|
*
|
|
@@ -10,6 +10,16 @@ declare class ComponentElement extends AsyncElement {
|
|
|
10
10
|
private _enabled;
|
|
11
11
|
private _component;
|
|
12
12
|
private _appElement;
|
|
13
|
+
/**
|
|
14
|
+
* The element hosting this component, held so the host's readiness cycles can be observed
|
|
15
|
+
* even after `closestEntity` would no longer resolve (during teardown).
|
|
16
|
+
*/
|
|
17
|
+
private _hostElement;
|
|
18
|
+
/**
|
|
19
|
+
* The listener re-applying this component when the host's readiness cycles. Held for
|
|
20
|
+
* removal on disconnect.
|
|
21
|
+
*/
|
|
22
|
+
private _hostReadyListener;
|
|
13
23
|
/**
|
|
14
24
|
* Incremented on every connect and disconnect. connectedCallback captures the value on entry
|
|
15
25
|
* and abandons itself wherever it resumes from an await if the value has moved on — so a
|
|
@@ -32,6 +42,15 @@ declare class ComponentElement extends AsyncElement {
|
|
|
32
42
|
* @returns The initial component data.
|
|
33
43
|
*/
|
|
34
44
|
protected getInitialComponentData(): {};
|
|
45
|
+
/**
|
|
46
|
+
* Creates the component on the host's current entity, removing it first from a previous
|
|
47
|
+
* entity that is still alive (a retargeted `<pc-node>` moves its decorations with it). When
|
|
48
|
+
* the entity already has a component of this type — a glTF node arriving with its authored
|
|
49
|
+
* `render` component, say — warns and leaves `component` null. The element-level warning is
|
|
50
|
+
* load-bearing: the engine's own duplicate-addComponent warning is Debug-stripped from
|
|
51
|
+
* production builds, which would otherwise leave a silent null.
|
|
52
|
+
*/
|
|
53
|
+
private _applyComponent;
|
|
35
54
|
private _addComponent;
|
|
36
55
|
/**
|
|
37
56
|
* Configures the newly added component. Overridden by subclasses whose setup goes beyond
|