@playcanvas/web-components 0.10.1 → 0.11.1
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.ts +102 -51
- package/dist/asset.d.ts +8 -7
- package/dist/async-element.d.ts +21 -5
- package/dist/components/button-component.d.ts +3 -7
- package/dist/components/camera-component.d.ts +16 -20
- package/dist/components/collision-component.d.ts +3 -7
- package/dist/components/component.d.ts +22 -4
- package/dist/components/element-component.d.ts +4 -8
- package/dist/components/gsplat-component.d.ts +2 -7
- package/dist/components/layoutchild-component.d.ts +2 -7
- package/dist/components/layoutgroup-component.d.ts +3 -7
- package/dist/components/light-component.d.ts +3 -7
- package/dist/components/listener-component.d.ts +1 -6
- package/dist/components/particlesystem-component.d.ts +2 -7
- package/dist/components/render-component.d.ts +2 -7
- package/dist/components/rigidbody-component.d.ts +3 -7
- package/dist/components/screen-component.d.ts +28 -11
- package/dist/components/script-component.d.ts +8 -20
- package/dist/components/script.d.ts +2 -22
- package/dist/components/scrollbar-component.d.ts +2 -7
- package/dist/components/scrollview-component.d.ts +9 -11
- package/dist/components/sound-component.d.ts +2 -7
- package/dist/components/sound-slot.d.ts +8 -6
- package/dist/custom-elements.json +5191 -10695
- package/dist/entity.d.ts +16 -9
- package/dist/index.d.ts +37 -0
- package/dist/material.d.ts +12 -12
- package/dist/model.d.ts +21 -5
- package/dist/module.d.ts +0 -6
- package/dist/parse.d.ts +6 -3
- package/dist/pwc.cjs +799 -287
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +799 -287
- 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 +800 -288
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +4 -7
- package/dist/sky.d.ts +25 -16
- package/dist/vscode.html-custom-data.json +65 -45
- package/dist/web-types.json +585 -557
- package/package.json +8 -7
- package/src/app.ts +326 -144
- package/src/asset.ts +34 -28
- package/src/async-element.ts +34 -8
- package/src/components/button-component.ts +5 -9
- package/src/components/camera-component.ts +55 -36
- package/src/components/collision-component.ts +26 -15
- package/src/components/component.ts +58 -8
- package/src/components/element-component.ts +26 -30
- package/src/components/gsplat-component.ts +4 -9
- package/src/components/layoutchild-component.ts +4 -9
- package/src/components/layoutgroup-component.ts +14 -9
- package/src/components/light-component.ts +42 -12
- package/src/components/listener-component.ts +1 -7
- package/src/components/particlesystem-component.ts +7 -15
- package/src/components/render-component.ts +5 -10
- package/src/components/rigidbody-component.ts +23 -16
- package/src/components/screen-component.ts +46 -20
- package/src/components/script-component.ts +108 -46
- package/src/components/script.ts +38 -33
- package/src/components/scrollbar-component.ts +6 -16
- package/src/components/scrollview-component.ts +22 -15
- package/src/components/sound-component.ts +10 -15
- package/src/components/sound-slot.ts +30 -20
- package/src/entity.ts +75 -34
- package/src/index.ts +45 -1
- package/src/loading-bar.ts +8 -8
- package/src/material.ts +63 -37
- package/src/model.ts +69 -14
- package/src/module.ts +8 -7
- package/src/parse.ts +67 -20
- package/src/scene.ts +12 -9
- package/src/sky.ts +76 -34
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ PlayCanvas Web Components are a set of custom HTML elements for building 3D inte
|
|
|
30
30
|
|
|
31
31
|
## Examples
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
<img width="3840" height="2160" alt="image" src="https://github.com/user-attachments/assets/e113cd2a-300d-4713-a1f4-ada647a8f04c" />
|
|
34
34
|
|
|
35
35
|
See PlayCanvas Web Components in action here: https://playcanvas.github.io/web-components/examples
|
|
36
36
|
|
package/dist/app.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Entity } from 'playcanvas';
|
|
1
2
|
import { AppBase } from 'playcanvas';
|
|
2
3
|
import { AsyncElement } from './async-element';
|
|
4
|
+
import type { EntityElement } from './entity';
|
|
3
5
|
/**
|
|
4
6
|
* The AppElement interface provides properties and methods for manipulating
|
|
5
7
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/ | `<pc-app>`} elements.
|
|
@@ -19,12 +21,30 @@ declare class AppElement extends AsyncElement {
|
|
|
19
21
|
private _alpha;
|
|
20
22
|
private _backend;
|
|
21
23
|
private _antialias;
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private
|
|
24
|
+
private _depthBuffer;
|
|
25
|
+
private _stencilBuffer;
|
|
26
|
+
private _maxPixelRatio;
|
|
25
27
|
private _loadingBar;
|
|
28
|
+
/**
|
|
29
|
+
* Set once the graphics options above have been handed to `createGraphicsDevice`, after which
|
|
30
|
+
* writing any of them changes nothing. Guards the warning in {@link _warnIfBooted}, and is
|
|
31
|
+
* cleared on disconnect so a re-connected element boots from its current attributes.
|
|
32
|
+
*/
|
|
33
|
+
private _optionsLocked;
|
|
26
34
|
private _bar;
|
|
27
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Incremented on every connect and disconnect. Boot captures the value on entry and abandons
|
|
37
|
+
* itself wherever it resumes from an await if the value has moved on — so a boot whose
|
|
38
|
+
* element was removed cannot complete against a torn-down element, and a boot whose element
|
|
39
|
+
* was removed and re-inserted (which starts a boot of its own) cannot race the newer one.
|
|
40
|
+
*/
|
|
41
|
+
private _bootGeneration;
|
|
42
|
+
/**
|
|
43
|
+
* The elements backing this application's entities, keyed by the entity itself. Registered
|
|
44
|
+
* by EntityElement at creation and removed when an entity is destroyed, this joins engine
|
|
45
|
+
* scene nodes back to their owning elements by identity - never by name.
|
|
46
|
+
*/
|
|
47
|
+
private _entityElements;
|
|
28
48
|
private _picker;
|
|
29
49
|
private _hasPointerListeners;
|
|
30
50
|
private _hoveredEntity;
|
|
@@ -55,9 +75,37 @@ declare class AppElement extends AsyncElement {
|
|
|
55
75
|
constructor();
|
|
56
76
|
connectedCallback(): Promise<void>;
|
|
57
77
|
disconnectedCallback(): void;
|
|
58
|
-
_onWindowResize
|
|
59
|
-
_pickerCreate
|
|
60
|
-
_pickerDestroy
|
|
78
|
+
private _onWindowResize;
|
|
79
|
+
private _pickerCreate;
|
|
80
|
+
private _pickerDestroy;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the `<pc-entity>` element whose backing entity is `entity`, or `null` if the
|
|
83
|
+
* entity was not created by an element of this application - for example, a node inside a
|
|
84
|
+
* model's instantiated hierarchy, or an entity created through the engine API.
|
|
85
|
+
*
|
|
86
|
+
* @param entity - The entity to look up.
|
|
87
|
+
* @returns The element backing the entity, or `null`.
|
|
88
|
+
*/
|
|
89
|
+
elementFromEntity(entity: Entity): EntityElement | null;
|
|
90
|
+
/**
|
|
91
|
+
* Resolves the element that owns a picked node: the nearest node up the parent chain -
|
|
92
|
+
* starting with the node itself - that was created by a `<pc-entity>` of this application.
|
|
93
|
+
* A hit inside a model's instantiated hierarchy therefore resolves to the element hosting
|
|
94
|
+
* the model.
|
|
95
|
+
*
|
|
96
|
+
* @param node - The picked node, or `null`.
|
|
97
|
+
* @returns The owning element, or `null`.
|
|
98
|
+
*/
|
|
99
|
+
private _elementFromNode;
|
|
100
|
+
/**
|
|
101
|
+
* Like {@link _elementFromNode}, but skips elements without a listener for `type`, so a hit
|
|
102
|
+
* on an unlistened child still reaches a listening ancestor.
|
|
103
|
+
*
|
|
104
|
+
* @param node - The picked node, or `null`.
|
|
105
|
+
* @param type - The pointer event type a listener is required for.
|
|
106
|
+
* @returns The nearest listening element, or `null`.
|
|
107
|
+
*/
|
|
108
|
+
private _elementWithListener;
|
|
61
109
|
private _getPickerCoordinates;
|
|
62
110
|
/**
|
|
63
111
|
* Picks the scene under the pointer and returns the graph node that was hit, or `null`.
|
|
@@ -71,34 +119,43 @@ declare class AppElement extends AsyncElement {
|
|
|
71
119
|
* @returns The graph node under the pointer, or `null` if nothing was hit.
|
|
72
120
|
*/
|
|
73
121
|
private _pickNode;
|
|
74
|
-
_onPointerMove
|
|
75
|
-
_onPointerDown
|
|
76
|
-
_onPointerUp
|
|
77
|
-
_onPointerListenerAdded
|
|
78
|
-
_onPointerListenerRemoved
|
|
122
|
+
private _onPointerMove;
|
|
123
|
+
private _onPointerDown;
|
|
124
|
+
private _onPointerUp;
|
|
125
|
+
private _onPointerListenerAdded;
|
|
126
|
+
private _onPointerListenerRemoved;
|
|
127
|
+
/**
|
|
128
|
+
* Warns that a graphics option was written too late to have any effect. These options are read
|
|
129
|
+
* once, when the element connects and creates its graphics device, so a later write updates
|
|
130
|
+
* only the element's own property - silently, without this.
|
|
131
|
+
*
|
|
132
|
+
* @param name - The name of the option, as its attribute.
|
|
133
|
+
*/
|
|
134
|
+
private _warnIfBooted;
|
|
79
135
|
/**
|
|
80
|
-
* Sets the alpha
|
|
136
|
+
* Sets whether the frame buffer has an alpha channel, which is what lets the page show through
|
|
137
|
+
* wherever the scene has not drawn. Read only when the application boots.
|
|
81
138
|
* @param value - The alpha flag.
|
|
82
139
|
*/
|
|
83
140
|
set alpha(value: boolean);
|
|
84
141
|
/**
|
|
85
|
-
* Gets the alpha
|
|
142
|
+
* Gets whether the frame buffer has an alpha channel.
|
|
86
143
|
* @returns The alpha flag.
|
|
87
144
|
*/
|
|
88
145
|
get alpha(): boolean;
|
|
89
146
|
/**
|
|
90
|
-
* Sets the
|
|
147
|
+
* Sets whether the frame buffer is anti-aliased. Read only when the application boots.
|
|
91
148
|
* @param value - The antialias flag.
|
|
92
149
|
*/
|
|
93
150
|
set antialias(value: boolean);
|
|
94
151
|
/**
|
|
95
|
-
* Gets the
|
|
152
|
+
* Gets whether the frame buffer is anti-aliased.
|
|
96
153
|
* @returns The antialias flag.
|
|
97
154
|
*/
|
|
98
155
|
get antialias(): boolean;
|
|
99
156
|
/**
|
|
100
157
|
* Sets the graphics backend. Defaults to 'webgpu', which falls back to 'webgl2' if WebGPU
|
|
101
|
-
* is not supported by the browser.
|
|
158
|
+
* is not supported by the browser. Read only when the application boots.
|
|
102
159
|
* @param value - The graphics backend ('webgpu', 'webgl2', or 'null').
|
|
103
160
|
*/
|
|
104
161
|
set backend(value: 'webgpu' | 'webgl2' | 'null');
|
|
@@ -108,32 +165,16 @@ declare class AppElement extends AsyncElement {
|
|
|
108
165
|
*/
|
|
109
166
|
get backend(): "webgpu" | "webgl2" | "null";
|
|
110
167
|
/**
|
|
111
|
-
* Sets the depth
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
set depth(value: boolean);
|
|
115
|
-
/**
|
|
116
|
-
* Gets the depth flag.
|
|
117
|
-
* @returns The depth flag.
|
|
118
|
-
*/
|
|
119
|
-
get depth(): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Gets the hierarchy ready flag.
|
|
122
|
-
* @returns The hierarchy ready flag.
|
|
123
|
-
* @ignore
|
|
124
|
-
*/
|
|
125
|
-
get hierarchyReady(): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Sets the high resolution flag. When true, the application will render at the device's
|
|
128
|
-
* physical resolution. When false, the application will render at CSS resolution.
|
|
129
|
-
* @param value - The high resolution flag.
|
|
168
|
+
* Sets whether the frame buffer has a depth buffer, which the renderer needs to resolve which
|
|
169
|
+
* surface is nearest the camera. Read only when the application boots.
|
|
170
|
+
* @param value - The depth buffer flag.
|
|
130
171
|
*/
|
|
131
|
-
set
|
|
172
|
+
set depthBuffer(value: boolean);
|
|
132
173
|
/**
|
|
133
|
-
* Gets the
|
|
134
|
-
* @returns The
|
|
174
|
+
* Gets whether the frame buffer has a depth buffer.
|
|
175
|
+
* @returns The depth buffer flag.
|
|
135
176
|
*/
|
|
136
|
-
get
|
|
177
|
+
get depthBuffer(): boolean;
|
|
137
178
|
/**
|
|
138
179
|
* Sets whether the application shows its built-in loading bar while it boots and preloads its
|
|
139
180
|
* assets. Enabled by default; setting `false` removes the bar immediately, while setting
|
|
@@ -150,21 +191,31 @@ declare class AppElement extends AsyncElement {
|
|
|
150
191
|
*/
|
|
151
192
|
get loadingBar(): boolean;
|
|
152
193
|
/**
|
|
153
|
-
* Sets the
|
|
154
|
-
*
|
|
194
|
+
* Sets the cap on the pixel ratio the application renders at. The canvas is sized by the
|
|
195
|
+
* smaller of this value and the display's own device pixel ratio, so the default of `Infinity`
|
|
196
|
+
* renders at full physical resolution, `1` renders at CSS resolution, and an intermediate
|
|
197
|
+
* value such as `2` keeps a dense display sharp without paying for every one of its pixels.
|
|
198
|
+
* Must be greater than 0. Unlike the other graphics options, this applies immediately.
|
|
199
|
+
* @param value - The maximum pixel ratio.
|
|
200
|
+
*/
|
|
201
|
+
set maxPixelRatio(value: number);
|
|
202
|
+
/**
|
|
203
|
+
* Gets the cap on the pixel ratio the application renders at.
|
|
204
|
+
* @returns The maximum pixel ratio.
|
|
155
205
|
*/
|
|
156
|
-
|
|
206
|
+
get maxPixelRatio(): number;
|
|
157
207
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
208
|
+
* Sets whether the frame buffer has a stencil buffer, which stencil-based effects and UI
|
|
209
|
+
* masking need. Read only when the application boots.
|
|
210
|
+
* @param value - The stencil buffer flag.
|
|
160
211
|
*/
|
|
161
|
-
|
|
212
|
+
set stencilBuffer(value: boolean);
|
|
213
|
+
/**
|
|
214
|
+
* Gets whether the frame buffer has a stencil buffer.
|
|
215
|
+
* @returns The stencil buffer flag.
|
|
216
|
+
*/
|
|
217
|
+
get stencilBuffer(): boolean;
|
|
162
218
|
static get observedAttributes(): string[];
|
|
163
219
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
164
220
|
}
|
|
165
|
-
declare global {
|
|
166
|
-
interface HTMLElementTagNameMap {
|
|
167
|
-
'pc-app': AppElement;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
221
|
export { AppElement };
|
package/dist/asset.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ declare class AssetElement extends AsyncElement {
|
|
|
46
46
|
disconnectedCallback(): void;
|
|
47
47
|
private _onAssetLoad;
|
|
48
48
|
private _onAssetError;
|
|
49
|
-
createAsset(): void;
|
|
50
49
|
/**
|
|
51
50
|
* Builds the `data` object for the asset from an optional inline `data` attribute (JSON) and,
|
|
52
51
|
* for sprites, from the convenience attributes (`atlas`, `frame-keys`, `pixels-per-unit`,
|
|
@@ -55,7 +54,7 @@ declare class AssetElement extends AsyncElement {
|
|
|
55
54
|
* @returns The asset data, or `undefined`.
|
|
56
55
|
*/
|
|
57
56
|
private _buildData;
|
|
58
|
-
|
|
57
|
+
private _destroyAsset;
|
|
59
58
|
/**
|
|
60
59
|
* Sets whether the asset should be loaded lazily.
|
|
61
60
|
* @param value - The lazy loading flag.
|
|
@@ -66,13 +65,15 @@ declare class AssetElement extends AsyncElement {
|
|
|
66
65
|
* @returns The lazy loading flag.
|
|
67
66
|
*/
|
|
68
67
|
get lazy(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the {@link Asset} created by the `<pc-asset>` element with the given `id`, or
|
|
70
|
+
* `undefined` if there is no such element or its asset has not been created yet.
|
|
71
|
+
*
|
|
72
|
+
* @param id - The `id` of the `<pc-asset>` element.
|
|
73
|
+
* @returns The asset, or `undefined`.
|
|
74
|
+
*/
|
|
69
75
|
static get(id: string): Asset | null | undefined;
|
|
70
76
|
static get observedAttributes(): string[];
|
|
71
77
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
72
78
|
}
|
|
73
|
-
declare global {
|
|
74
|
-
interface HTMLElementTagNameMap {
|
|
75
|
-
'pc-asset': AssetElement;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
79
|
export { AssetElement };
|
package/dist/async-element.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { AppElement } from './app';
|
|
2
|
-
import { EntityElement } from './entity';
|
|
1
|
+
import type { AppElement } from './app';
|
|
2
|
+
import type { EntityElement } from './entity';
|
|
3
3
|
/**
|
|
4
4
|
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
5
5
|
*
|
|
6
|
-
* @fires {CustomEvent} ready - Fired
|
|
7
|
-
*
|
|
6
|
+
* @fires {CustomEvent} ready - Fired when the element is fully initialized — once per readiness
|
|
7
|
+
* cycle, so an element that is torn down and re-initialized (for example by removing and
|
|
8
|
+
* re-inserting it) fires it again. Bubbles and is composed.
|
|
8
9
|
*/
|
|
9
10
|
declare class AsyncElement extends HTMLElement {
|
|
10
11
|
private _readyPromise;
|
|
11
12
|
private _readyResolve;
|
|
13
|
+
private _readyResolved;
|
|
12
14
|
/** @ignore */
|
|
13
15
|
constructor();
|
|
14
16
|
/**
|
|
@@ -26,12 +28,26 @@ declare class AsyncElement extends HTMLElement {
|
|
|
26
28
|
/**
|
|
27
29
|
* Called when the element is fully initialized and ready. Subclasses should call this when
|
|
28
30
|
* they're ready. Resolves the ready promise and dispatches a bubbling, composed `ready`
|
|
29
|
-
* event.
|
|
31
|
+
* event. Signals at most once per readiness cycle: a repeat call before {@link _resetReady}
|
|
32
|
+
* has re-armed the promise does nothing.
|
|
30
33
|
*/
|
|
31
34
|
protected _onReady(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the ready promise to its pending state. Subclasses should call this when the
|
|
37
|
+
* resource their readiness announced is torn down (typically from `disconnectedCallback`),
|
|
38
|
+
* so that a later re-initialization can signal readiness again. Does nothing while the
|
|
39
|
+
* promise is still pending — an in-flight waiter carries over to the next readiness cycle
|
|
40
|
+
* rather than being stranded on a promise nothing will ever resolve.
|
|
41
|
+
*/
|
|
42
|
+
protected _resetReady(): void;
|
|
32
43
|
/**
|
|
33
44
|
* Returns a promise that resolves with this element when it's ready. This is the low-level
|
|
34
45
|
* primitive underlying {@link whenReady}, which is the recommended way to wait for elements.
|
|
46
|
+
*
|
|
47
|
+
* Readiness tracks the element's current lifecycle: once a ready element is torn down (for
|
|
48
|
+
* example by removing it from the document), this returns a fresh promise that resolves when
|
|
49
|
+
* the element is next ready. A promise obtained earlier stays resolved — call this again
|
|
50
|
+
* after re-inserting an element rather than reusing a promise from before its removal.
|
|
35
51
|
* @returns A promise that resolves with this element when it's ready.
|
|
36
52
|
*/
|
|
37
53
|
ready(): Promise<this>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ButtonComponent
|
|
1
|
+
import type { ButtonComponent } from 'playcanvas';
|
|
2
|
+
import { Color, Vec4 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The ButtonComponentElement interface provides properties and methods for manipulating
|
|
@@ -25,7 +26,7 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
25
26
|
private _inactiveSpriteFrame;
|
|
26
27
|
/** @ignore */
|
|
27
28
|
constructor();
|
|
28
|
-
getInitialComponentData(): Record<string, any>;
|
|
29
|
+
protected getInitialComponentData(): Record<string, any>;
|
|
29
30
|
/**
|
|
30
31
|
* Gets the underlying PlayCanvas button component.
|
|
31
32
|
* @returns The button component.
|
|
@@ -182,9 +183,4 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
182
183
|
static get observedAttributes(): string[];
|
|
183
184
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
184
185
|
}
|
|
185
|
-
declare global {
|
|
186
|
-
interface HTMLElementTagNameMap {
|
|
187
|
-
'pc-button': ButtonComponentElement;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
186
|
export { ButtonComponentElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CameraComponent
|
|
1
|
+
import type { CameraComponent } from 'playcanvas';
|
|
2
|
+
import { Color, Vec4 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
@@ -21,7 +22,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
21
22
|
private _gamma;
|
|
22
23
|
private _horizontalFov;
|
|
23
24
|
private _nearClip;
|
|
24
|
-
private
|
|
25
|
+
private _projection;
|
|
25
26
|
private _orthoHeight;
|
|
26
27
|
private _priority;
|
|
27
28
|
private _rect;
|
|
@@ -29,7 +30,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
29
30
|
private _tonemap;
|
|
30
31
|
/** @ignore */
|
|
31
32
|
constructor();
|
|
32
|
-
getInitialComponentData(): {
|
|
33
|
+
protected getInitialComponentData(): {
|
|
33
34
|
clearColor: Color;
|
|
34
35
|
clearColorBuffer: boolean;
|
|
35
36
|
clearDepthBuffer: boolean;
|
|
@@ -42,12 +43,12 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
42
43
|
gammaCorrection: 0 | 1;
|
|
43
44
|
horizontalFov: boolean;
|
|
44
45
|
nearClip: number;
|
|
45
|
-
projection:
|
|
46
|
+
projection: number;
|
|
46
47
|
orthoHeight: number;
|
|
47
48
|
priority: number;
|
|
48
49
|
rect: Vec4;
|
|
49
50
|
scissorRect: Vec4;
|
|
50
|
-
toneMapping: number
|
|
51
|
+
toneMapping: number;
|
|
51
52
|
};
|
|
52
53
|
get xrAvailable(): boolean | null;
|
|
53
54
|
/**
|
|
@@ -186,16 +187,6 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
186
187
|
* @returns The near clip distance.
|
|
187
188
|
*/
|
|
188
189
|
get nearClip(): number;
|
|
189
|
-
/**
|
|
190
|
-
* Sets the orthographic projection of the camera.
|
|
191
|
-
* @param value - The orthographic projection.
|
|
192
|
-
*/
|
|
193
|
-
set orthographic(value: boolean);
|
|
194
|
-
/**
|
|
195
|
-
* Gets the orthographic projection of the camera.
|
|
196
|
-
* @returns The orthographic projection.
|
|
197
|
-
*/
|
|
198
|
-
get orthographic(): boolean;
|
|
199
190
|
/**
|
|
200
191
|
* Sets the orthographic height of the camera.
|
|
201
192
|
* @param value - The orthographic height.
|
|
@@ -216,6 +207,16 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
216
207
|
* @returns The priority.
|
|
217
208
|
*/
|
|
218
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";
|
|
219
220
|
/**
|
|
220
221
|
* Sets the rect of the camera.
|
|
221
222
|
* @param value - The rect.
|
|
@@ -249,9 +250,4 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
249
250
|
static get observedAttributes(): string[];
|
|
250
251
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
251
252
|
}
|
|
252
|
-
declare global {
|
|
253
|
-
interface HTMLElementTagNameMap {
|
|
254
|
-
'pc-camera': CameraComponentElement;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
253
|
export { CameraComponentElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CollisionComponent
|
|
1
|
+
import type { CollisionComponent } from 'playcanvas';
|
|
2
|
+
import { Quat, Vec3 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
@@ -19,7 +20,7 @@ declare class CollisionComponentElement extends ComponentElement {
|
|
|
19
20
|
private _type;
|
|
20
21
|
/** @ignore */
|
|
21
22
|
constructor();
|
|
22
|
-
getInitialComponentData(): {
|
|
23
|
+
protected getInitialComponentData(): {
|
|
23
24
|
axis: number;
|
|
24
25
|
angularOffset: Quat;
|
|
25
26
|
convexHull: boolean;
|
|
@@ -53,9 +54,4 @@ declare class CollisionComponentElement extends ComponentElement {
|
|
|
53
54
|
static get observedAttributes(): string[];
|
|
54
55
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
55
56
|
}
|
|
56
|
-
declare global {
|
|
57
|
-
interface HTMLElementTagNameMap {
|
|
58
|
-
'pc-collision': CollisionComponentElement;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
57
|
export { CollisionComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from 'playcanvas';
|
|
1
|
+
import type { Component } from 'playcanvas';
|
|
2
2
|
import { AsyncElement } from '../async-element';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a component in the PlayCanvas engine.
|
|
@@ -10,6 +10,14 @@ declare class ComponentElement extends AsyncElement {
|
|
|
10
10
|
private _enabled;
|
|
11
11
|
private _component;
|
|
12
12
|
private _appElement;
|
|
13
|
+
/**
|
|
14
|
+
* Incremented on every connect and disconnect. connectedCallback captures the value on entry
|
|
15
|
+
* and abandons itself wherever it resumes from an await if the value has moved on — so a
|
|
16
|
+
* callback whose element was removed cannot act on a torn-down tree, and one whose element
|
|
17
|
+
* was removed and re-inserted (which runs a callback of its own) cannot add the component a
|
|
18
|
+
* second time.
|
|
19
|
+
*/
|
|
20
|
+
private _connectionGeneration;
|
|
13
21
|
/**
|
|
14
22
|
* Creates a new ComponentElement instance.
|
|
15
23
|
*
|
|
@@ -17,9 +25,19 @@ declare class ComponentElement extends AsyncElement {
|
|
|
17
25
|
* @ignore
|
|
18
26
|
*/
|
|
19
27
|
constructor(componentName: string);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Returns the data the component is created with. Overridden by subclasses to supply the
|
|
30
|
+
* initial values of their cached properties.
|
|
31
|
+
*
|
|
32
|
+
* @returns The initial component data.
|
|
33
|
+
*/
|
|
34
|
+
protected getInitialComponentData(): {};
|
|
35
|
+
private _addComponent;
|
|
36
|
+
/**
|
|
37
|
+
* Configures the newly added component. Overridden by subclasses whose setup goes beyond
|
|
38
|
+
* the initial data — child-element handling, asset resolution and the like.
|
|
39
|
+
*/
|
|
40
|
+
protected initComponent(): void;
|
|
23
41
|
connectedCallback(): Promise<void>;
|
|
24
42
|
disconnectedCallback(): void;
|
|
25
43
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ElementComponent } from 'playcanvas';
|
|
2
|
+
import { Color, Vec2, Vec4 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
@@ -37,8 +38,8 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
37
38
|
private _wrapLines;
|
|
38
39
|
/** @ignore */
|
|
39
40
|
constructor();
|
|
40
|
-
initComponent(): void;
|
|
41
|
-
getInitialComponentData(): Record<string, any>;
|
|
41
|
+
protected initComponent(): void;
|
|
42
|
+
protected getInitialComponentData(): Record<string, any>;
|
|
42
43
|
/**
|
|
43
44
|
* Gets the underlying PlayCanvas element component.
|
|
44
45
|
* @returns The element component.
|
|
@@ -312,9 +313,4 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
312
313
|
static get observedAttributes(): string[];
|
|
313
314
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
314
315
|
}
|
|
315
|
-
declare global {
|
|
316
|
-
interface HTMLElementTagNameMap {
|
|
317
|
-
'pc-element': ElementComponentElement;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
316
|
export { ElementComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GSplatComponent } from 'playcanvas';
|
|
1
|
+
import type { GSplatComponent } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The GSplatComponentElement interface provides properties and methods for manipulating
|
|
@@ -17,7 +17,7 @@ declare class GSplatComponentElement extends ComponentElement {
|
|
|
17
17
|
private _lodRangeMax;
|
|
18
18
|
/** @ignore */
|
|
19
19
|
constructor();
|
|
20
|
-
getInitialComponentData(): {
|
|
20
|
+
protected getInitialComponentData(): {
|
|
21
21
|
asset: import("playcanvas").Asset | null | undefined;
|
|
22
22
|
castShadows: boolean;
|
|
23
23
|
lodBaseDistance: number;
|
|
@@ -105,9 +105,4 @@ declare class GSplatComponentElement extends ComponentElement {
|
|
|
105
105
|
static get observedAttributes(): string[];
|
|
106
106
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
107
107
|
}
|
|
108
|
-
declare global {
|
|
109
|
-
interface HTMLElementTagNameMap {
|
|
110
|
-
'pc-gsplat': GSplatComponentElement;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
108
|
export { GSplatComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayoutChildComponent } from 'playcanvas';
|
|
1
|
+
import type { LayoutChildComponent } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The LayoutChildComponentElement interface provides properties and methods for manipulating
|
|
@@ -18,7 +18,7 @@ declare class LayoutChildComponentElement extends ComponentElement {
|
|
|
18
18
|
private _excludeFromLayout;
|
|
19
19
|
/** @ignore */
|
|
20
20
|
constructor();
|
|
21
|
-
getInitialComponentData(): {
|
|
21
|
+
protected getInitialComponentData(): {
|
|
22
22
|
minWidth: number;
|
|
23
23
|
minHeight: number;
|
|
24
24
|
maxWidth: number | null;
|
|
@@ -107,9 +107,4 @@ declare class LayoutChildComponentElement extends ComponentElement {
|
|
|
107
107
|
static get observedAttributes(): string[];
|
|
108
108
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
109
109
|
}
|
|
110
|
-
declare global {
|
|
111
|
-
interface HTMLElementTagNameMap {
|
|
112
|
-
'pc-layoutchild': LayoutChildComponentElement;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
110
|
export { LayoutChildComponentElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { LayoutGroupComponent
|
|
1
|
+
import type { LayoutGroupComponent } from 'playcanvas';
|
|
2
|
+
import { Vec2, Vec4 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The LayoutGroupComponentElement interface provides properties and methods for manipulating
|
|
@@ -20,7 +21,7 @@ declare class LayoutGroupComponentElement extends ComponentElement {
|
|
|
20
21
|
private _wrap;
|
|
21
22
|
/** @ignore */
|
|
22
23
|
constructor();
|
|
23
|
-
getInitialComponentData(): {
|
|
24
|
+
protected getInitialComponentData(): {
|
|
24
25
|
orientation: number | undefined;
|
|
25
26
|
reverseX: boolean;
|
|
26
27
|
reverseY: boolean;
|
|
@@ -132,9 +133,4 @@ declare class LayoutGroupComponentElement extends ComponentElement {
|
|
|
132
133
|
static get observedAttributes(): string[];
|
|
133
134
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
134
135
|
}
|
|
135
|
-
declare global {
|
|
136
|
-
interface HTMLElementTagNameMap {
|
|
137
|
-
'pc-layoutgroup': LayoutGroupComponentElement;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
136
|
export { LayoutGroupComponentElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LightComponent } from 'playcanvas';
|
|
2
|
+
import { Color } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The LightComponentElement interface provides properties and methods for manipulating
|
|
@@ -30,7 +31,7 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
30
31
|
private _shadowBlockerSamples;
|
|
31
32
|
/** @ignore */
|
|
32
33
|
constructor();
|
|
33
|
-
getInitialComponentData(): {
|
|
34
|
+
protected getInitialComponentData(): {
|
|
34
35
|
castShadows: boolean;
|
|
35
36
|
color: Color;
|
|
36
37
|
innerConeAngle: number;
|
|
@@ -260,9 +261,4 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
260
261
|
static get observedAttributes(): string[];
|
|
261
262
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
262
263
|
}
|
|
263
|
-
declare global {
|
|
264
|
-
interface HTMLElementTagNameMap {
|
|
265
|
-
'pc-light': LightComponentElement;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
264
|
export { LightComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AudioListenerComponent } from 'playcanvas';
|
|
1
|
+
import type { AudioListenerComponent } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
@@ -17,9 +17,4 @@ declare class ListenerComponentElement extends ComponentElement {
|
|
|
17
17
|
*/
|
|
18
18
|
get component(): AudioListenerComponent;
|
|
19
19
|
}
|
|
20
|
-
declare global {
|
|
21
|
-
interface HTMLElementTagNameMap {
|
|
22
|
-
'pc-listener': ListenerComponentElement;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
20
|
export { ListenerComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParticleSystemComponent } from 'playcanvas';
|
|
1
|
+
import type { ParticleSystemComponent } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The ParticleSystemComponentElement interface provides properties and methods for manipulating
|
|
@@ -12,7 +12,7 @@ declare class ParticleSystemComponentElement extends ComponentElement {
|
|
|
12
12
|
private _asset;
|
|
13
13
|
/** @ignore */
|
|
14
14
|
constructor();
|
|
15
|
-
getInitialComponentData(): object;
|
|
15
|
+
protected getInitialComponentData(): object;
|
|
16
16
|
/**
|
|
17
17
|
* Gets the underlying PlayCanvas particle system component.
|
|
18
18
|
* @returns The particle system component.
|
|
@@ -49,9 +49,4 @@ declare class ParticleSystemComponentElement extends ComponentElement {
|
|
|
49
49
|
static get observedAttributes(): string[];
|
|
50
50
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
51
51
|
}
|
|
52
|
-
declare global {
|
|
53
|
-
interface HTMLElementTagNameMap {
|
|
54
|
-
'pc-particles': ParticleSystemComponentElement;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
52
|
export { ParticleSystemComponentElement };
|