@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
package/dist/material.d.ts
CHANGED
|
@@ -160,7 +160,8 @@ declare class MaterialElement extends HTMLElement {
|
|
|
160
160
|
private _setMap;
|
|
161
161
|
/**
|
|
162
162
|
* @param slot - The material property to write.
|
|
163
|
-
* @param texture - The loaded texture
|
|
163
|
+
* @param texture - The loaded texture, applied with its sampler state untouched - anisotropy
|
|
164
|
+
* and friends belong to the `pc-asset`'s texture options.
|
|
164
165
|
*/
|
|
165
166
|
private _applyMap;
|
|
166
167
|
/**
|
package/dist/model.d.cts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Entity } from 'playcanvas';
|
|
2
|
+
import { AsyncElement } from './async-element.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* The ModelElement interface provides properties and methods for manipulating
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-model/ | `<pc-model>`} elements.
|
|
6
|
+
* The ModelElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
8
|
+
*
|
|
9
|
+
* The element becomes ready once its container asset has loaded and the instantiated hierarchy has
|
|
10
|
+
* been added to the scene — `entity` is non-null by then. A failed load also settles readiness,
|
|
11
|
+
* with `entity` remaining `null`: readiness means the load settled, not that it succeeded — listen
|
|
12
|
+
* for `error`, or check `entity`, to tell the outcomes apart. Changing `asset` re-arms readiness
|
|
13
|
+
* and instantiates anew, so a `ready()` obtained after the change resolves against the new
|
|
14
|
+
* hierarchy. A `pc-model` outside a `pc-app`, or referencing an unknown asset id, warns and never
|
|
15
|
+
* becomes ready.
|
|
16
|
+
*
|
|
17
|
+
* @fires {Event} load - Fired each time a container asset finishes instantiating, including
|
|
18
|
+
* re-instantiation after `asset` changes. Does not bubble — listen on this element, or use a
|
|
19
|
+
* capture-phase listener on an ancestor.
|
|
20
|
+
* @fires {ErrorEvent} error - Fired when the container asset fails to load, with the engine's
|
|
21
|
+
* error in `message`. Does not bubble. The element still becomes ready — readiness means the load
|
|
22
|
+
* settled, not that it succeeded.
|
|
23
|
+
*/
|
|
24
|
+
declare class ModelElement extends AsyncElement {
|
|
25
|
+
private _asset;
|
|
26
|
+
private _entity;
|
|
27
|
+
/**
|
|
28
|
+
* Incremented on every new load and on disconnect, and captured by a load when it starts. A
|
|
29
|
+
* load that resumes from an await or a load callback abandons itself if the value has moved
|
|
30
|
+
* on, so a superseded load can neither instantiate a second entity nor parent one that has
|
|
31
|
+
* since been destroyed.
|
|
32
|
+
*/
|
|
33
|
+
private _loadGeneration;
|
|
34
|
+
/**
|
|
35
|
+
* The pending asset subscriptions of the current load, if it is waiting for its asset. Held
|
|
36
|
+
* so that whatever supersedes the load can detach the handlers from the asset, rather than
|
|
37
|
+
* leave them registered until the asset settles (or forever, if it never does).
|
|
38
|
+
*/
|
|
39
|
+
private _loadHandle;
|
|
40
|
+
private _errorHandle;
|
|
41
|
+
/**
|
|
42
|
+
* The root entity of the instantiated model. `null` until the container asset has loaded
|
|
43
|
+
* and been instantiated, and again once the element has been removed from the document.
|
|
44
|
+
* @returns The model's root entity, or `null`.
|
|
45
|
+
*/
|
|
46
|
+
get entity(): Entity | null;
|
|
47
|
+
connectedCallback(): void;
|
|
48
|
+
disconnectedCallback(): void;
|
|
49
|
+
private _detachLoadHandlers;
|
|
50
|
+
/**
|
|
51
|
+
* Resolves readiness and dispatches the `load` event. Called once the instantiated hierarchy
|
|
52
|
+
* has been parented — readiness means "in the scene graph", matching `pc-entity`, so a ready
|
|
53
|
+
* model's entity always has world transforms.
|
|
54
|
+
*/
|
|
55
|
+
private _announceLoad;
|
|
56
|
+
private _instantiate;
|
|
57
|
+
private _loadModel;
|
|
58
|
+
private _unloadModel;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the id of the `pc-asset` to use for the model.
|
|
61
|
+
* @param value - The asset ID.
|
|
62
|
+
*/
|
|
63
|
+
set asset(value: string);
|
|
64
|
+
/**
|
|
65
|
+
* Gets the id of the `pc-asset` to use for the model.
|
|
66
|
+
* @returns The asset ID.
|
|
67
|
+
*/
|
|
68
|
+
get asset(): string;
|
|
69
|
+
static get observedAttributes(): string[];
|
|
70
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
71
|
+
}
|
|
72
|
+
export { ModelElement };
|
package/dist/model.d.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import type { Entity } from 'playcanvas';
|
|
2
|
-
import { AsyncElement } from './async-element';
|
|
2
|
+
import { AsyncElement } from './async-element.js';
|
|
3
3
|
/**
|
|
4
4
|
* The ModelElement interface provides properties and methods for manipulating
|
|
5
5
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-model/ | `<pc-model>`} elements.
|
|
6
6
|
* The ModelElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
|
+
*
|
|
9
|
+
* The element becomes ready once its container asset has loaded and the instantiated hierarchy has
|
|
10
|
+
* been added to the scene — `entity` is non-null by then. A failed load also settles readiness,
|
|
11
|
+
* with `entity` remaining `null`: readiness means the load settled, not that it succeeded — listen
|
|
12
|
+
* for `error`, or check `entity`, to tell the outcomes apart. Changing `asset` re-arms readiness
|
|
13
|
+
* and instantiates anew, so a `ready()` obtained after the change resolves against the new
|
|
14
|
+
* hierarchy. A `pc-model` outside a `pc-app`, or referencing an unknown asset id, warns and never
|
|
15
|
+
* becomes ready.
|
|
16
|
+
*
|
|
17
|
+
* @fires {Event} load - Fired each time a container asset finishes instantiating, including
|
|
18
|
+
* re-instantiation after `asset` changes. Does not bubble — listen on this element, or use a
|
|
19
|
+
* capture-phase listener on an ancestor.
|
|
20
|
+
* @fires {ErrorEvent} error - Fired when the container asset fails to load, with the engine's
|
|
21
|
+
* error in `message`. Does not bubble. The element still becomes ready — readiness means the load
|
|
22
|
+
* settled, not that it succeeded.
|
|
8
23
|
*/
|
|
9
24
|
declare class ModelElement extends AsyncElement {
|
|
10
25
|
private _asset;
|
|
@@ -17,11 +32,12 @@ declare class ModelElement extends AsyncElement {
|
|
|
17
32
|
*/
|
|
18
33
|
private _loadGeneration;
|
|
19
34
|
/**
|
|
20
|
-
* The pending asset
|
|
21
|
-
*
|
|
22
|
-
*
|
|
35
|
+
* The pending asset subscriptions of the current load, if it is waiting for its asset. Held
|
|
36
|
+
* so that whatever supersedes the load can detach the handlers from the asset, rather than
|
|
37
|
+
* leave them registered until the asset settles (or forever, if it never does).
|
|
23
38
|
*/
|
|
24
39
|
private _loadHandle;
|
|
40
|
+
private _errorHandle;
|
|
25
41
|
/**
|
|
26
42
|
* The root entity of the instantiated model. `null` until the container asset has loaded
|
|
27
43
|
* and been instantiated, and again once the element has been removed from the document.
|
|
@@ -30,7 +46,13 @@ declare class ModelElement extends AsyncElement {
|
|
|
30
46
|
get entity(): Entity | null;
|
|
31
47
|
connectedCallback(): void;
|
|
32
48
|
disconnectedCallback(): void;
|
|
33
|
-
private
|
|
49
|
+
private _detachLoadHandlers;
|
|
50
|
+
/**
|
|
51
|
+
* Resolves readiness and dispatches the `load` event. Called once the instantiated hierarchy
|
|
52
|
+
* has been parented — readiness means "in the scene graph", matching `pc-entity`, so a ready
|
|
53
|
+
* model's entity always has world transforms.
|
|
54
|
+
*/
|
|
55
|
+
private _announceLoad;
|
|
34
56
|
private _instantiate;
|
|
35
57
|
private _loadModel;
|
|
36
58
|
private _unloadModel;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AsyncElement } from './async-element.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* The ModuleElement interface provides properties and methods for manipulating
|
|
4
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/ | `<pc-module>`}
|
|
5
|
+
* elements. The ModuleElement interface also inherits the properties and methods of the
|
|
6
|
+
* {@link AsyncElement} interface.
|
|
7
|
+
*
|
|
8
|
+
* The attributes are read once, when the module starts loading - on the element's first
|
|
9
|
+
* connection, or earlier if a containing `<pc-app>` boots first and collects it - so changing
|
|
10
|
+
* them later has no effect. The element becomes ready once the module has loaded. WebAssembly
|
|
11
|
+
* modules configure engine-global state that never unloads, so readiness is not re-armed by
|
|
12
|
+
* removing the element, and a re-inserted element does not load again.
|
|
13
|
+
*
|
|
14
|
+
* A `<pc-module>` without a `name` warns and never becomes ready; a containing `<pc-app>` still
|
|
15
|
+
* boots.
|
|
16
|
+
*
|
|
17
|
+
* @attribute {string} name - The name of the WebAssembly module to configure, e.g. `Basis` or
|
|
18
|
+
* `Ammo`.
|
|
19
|
+
* @attribute {string} glue - The URL of the module's glue script.
|
|
20
|
+
* @attribute {string} wasm - The URL of the module's WebAssembly binary.
|
|
21
|
+
* @attribute {string} fallback - The URL of the module's asm.js fallback script, used when
|
|
22
|
+
* WebAssembly is unavailable.
|
|
23
|
+
*/
|
|
24
|
+
declare class ModuleElement extends AsyncElement {
|
|
25
|
+
private _loadPromise;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
private _loadModule;
|
|
28
|
+
}
|
|
29
|
+
export { ModuleElement };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { AsyncElement } from './async-element.js';
|
|
1
2
|
/**
|
|
2
3
|
* The ModuleElement interface provides properties and methods for manipulating
|
|
3
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/ | `<pc-module>`}
|
|
4
|
-
* The ModuleElement interface also inherits the properties and methods of the
|
|
5
|
-
* {@link
|
|
4
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/ | `<pc-module>`}
|
|
5
|
+
* elements. The ModuleElement interface also inherits the properties and methods of the
|
|
6
|
+
* {@link AsyncElement} interface.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* The attributes are read once, when the module starts loading - on the element's first
|
|
9
|
+
* connection, or earlier if a containing `<pc-app>` boots first and collects it - so changing
|
|
10
|
+
* them later has no effect. The element becomes ready once the module has loaded. WebAssembly
|
|
11
|
+
* modules configure engine-global state that never unloads, so readiness is not re-armed by
|
|
12
|
+
* removing the element, and a re-inserted element does not load again.
|
|
13
|
+
*
|
|
14
|
+
* A `<pc-module>` without a `name` warns and never becomes ready; a containing `<pc-app>` still
|
|
15
|
+
* boots.
|
|
9
16
|
*
|
|
10
17
|
* @attribute {string} name - The name of the WebAssembly module to configure, e.g. `Basis` or
|
|
11
18
|
* `Ammo`.
|
|
@@ -14,10 +21,9 @@
|
|
|
14
21
|
* @attribute {string} fallback - The URL of the module's asm.js fallback script, used when
|
|
15
22
|
* WebAssembly is unavailable.
|
|
16
23
|
*/
|
|
17
|
-
declare class ModuleElement extends
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private loadModule;
|
|
24
|
+
declare class ModuleElement extends AsyncElement {
|
|
25
|
+
private _loadPromise;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
private _loadModule;
|
|
22
28
|
}
|
|
23
29
|
export { ModuleElement };
|
package/dist/node.d.cts
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { Vec3 } from 'playcanvas';
|
|
2
|
+
import { EntityBaseElement } from './entity-base.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* The binding states a `<pc-node>` element moves through. `pending` while the host has not yet
|
|
5
|
+
* instantiated (or no `name` is assigned), `bound` once a node has been resolved and decorated,
|
|
6
|
+
* `missing`/`ambiguous`/`duplicate` when resolution failed — each accompanied by a warning
|
|
7
|
+
* naming the cause.
|
|
8
|
+
*/
|
|
9
|
+
type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
|
|
10
|
+
/**
|
|
11
|
+
* The NodeElement interface provides properties and methods for manipulating
|
|
12
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-node/ | `<pc-node>`}
|
|
13
|
+
* elements. The NodeElement interface also inherits the properties and methods of the
|
|
14
|
+
* {@link HTMLElement} interface.
|
|
15
|
+
*
|
|
16
|
+
* A `pc-node` is an override element: where `pc-entity` creates an entity, `pc-node` binds to a
|
|
17
|
+
* node a `pc-model` loaded and declares overrides against the authored asset — components to
|
|
18
|
+
* add, properties to change, content to attach. Attributes present apply as overrides; attributes
|
|
19
|
+
* absent leave authored values untouched, and removing an attribute (or assigning `null` to the
|
|
20
|
+
* matching property) restores the authored value.
|
|
21
|
+
*
|
|
22
|
+
* `name` selects among the host model's nodes (first match in depth-first order), nesting a
|
|
23
|
+
* `pc-node` inside another scopes the search to that subtree, and `index` picks among identically
|
|
24
|
+
* named matches. When `name` matches more than one node and no `index` is given, the element
|
|
25
|
+
* warns and binds nothing.
|
|
26
|
+
*
|
|
27
|
+
* The element becomes ready once bound, and never while unresolved — a missing or ambiguous
|
|
28
|
+
* name warns and records the failure in `state`, readiness stays unresolved, and descendants
|
|
29
|
+
* wait with it.
|
|
30
|
+
*
|
|
31
|
+
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
32
|
+
* intersects the bound node's geometry, exactly as for `<pc-entity>`.
|
|
33
|
+
*
|
|
34
|
+
* @attribute {string} name - The name of the node to bind, resolved within the nearest ancestor
|
|
35
|
+
* `pc-model` (or `pc-node`) once it has instantiated.
|
|
36
|
+
* @attribute {number} index - Which match to bind when `name` matches more than one node,
|
|
37
|
+
* 0-based in depth-first order. Optional for a unique match; required for an ambiguous one.
|
|
38
|
+
* @attribute {boolean} enabled - Overrides the node's enabled state.
|
|
39
|
+
* @attribute {string} position - Overrides the node's local position, as an "x y z" triple.
|
|
40
|
+
* @attribute {string} rotation - Overrides the node's local rotation (Euler angles), as an
|
|
41
|
+
* "x y z" triple.
|
|
42
|
+
* @attribute {string} scale - Overrides the node's local scale, as an "x y z" triple.
|
|
43
|
+
* @attribute {string} tags - Overrides the node's tags, separated by spaces or commas.
|
|
44
|
+
* @attribute {string} onpointerenter - Script to run when the pointer moves onto the node.
|
|
45
|
+
* @attribute {string} onpointerleave - Script to run when the pointer moves off the node.
|
|
46
|
+
* @attribute {string} onpointermove - Script to run when the pointer moves over the node.
|
|
47
|
+
* @attribute {string} onpointerdown - Script to run when a pointer button is pressed over the
|
|
48
|
+
* node.
|
|
49
|
+
* @attribute {string} onpointerup - Script to run when a pointer button is released over the
|
|
50
|
+
* node.
|
|
51
|
+
* @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the node.
|
|
52
|
+
* @fires {PointerEvent} pointerleave - Fired when the pointer moves off the node.
|
|
53
|
+
* @fires {PointerEvent} pointermove - Fired when the pointer moves over the node.
|
|
54
|
+
* @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the node.
|
|
55
|
+
* @fires {PointerEvent} pointerup - Fired when a pointer button is released over the node.
|
|
56
|
+
*/
|
|
57
|
+
declare class NodeElement extends EntityBaseElement {
|
|
58
|
+
private _name;
|
|
59
|
+
private _index;
|
|
60
|
+
private _state;
|
|
61
|
+
private _path;
|
|
62
|
+
/**
|
|
63
|
+
* The element whose entity roots this element's search: the nearest ancestor `pc-node`, or
|
|
64
|
+
* failing that the nearest ancestor `pc-model`. Resolved on connection.
|
|
65
|
+
*/
|
|
66
|
+
private _host;
|
|
67
|
+
/**
|
|
68
|
+
* The listener following the host's binding cycles. Both host kinds announce each cycle
|
|
69
|
+
* with a `ready` event — `pc-model` on every instantiation, `pc-node` on every bind.
|
|
70
|
+
*/
|
|
71
|
+
private _hostListener;
|
|
72
|
+
/**
|
|
73
|
+
* The subscription to the bound entity's destruction, detached on unbind so a retargeted
|
|
74
|
+
* element cannot be reset by the eventual death of a node it no longer fronts.
|
|
75
|
+
*/
|
|
76
|
+
private _destroyHandle;
|
|
77
|
+
/** The authored values displaced by this element's overrides, captured per property. */
|
|
78
|
+
private _authored;
|
|
79
|
+
private _enabled;
|
|
80
|
+
private _position;
|
|
81
|
+
private _rotation;
|
|
82
|
+
private _scale;
|
|
83
|
+
private _tags;
|
|
84
|
+
/**
|
|
85
|
+
* The binding state: `pending` until the host instantiates and `name` resolves, `bound`
|
|
86
|
+
* once decorated, `missing`/`ambiguous`/`duplicate` when resolution failed (each also
|
|
87
|
+
* warns). Useful for asserting a document's bindings programmatically.
|
|
88
|
+
* @returns The binding state.
|
|
89
|
+
*/
|
|
90
|
+
get state(): NodeBindingState;
|
|
91
|
+
/**
|
|
92
|
+
* The path of the bound node below the search root, `/`-separated, or `null` while not
|
|
93
|
+
* bound.
|
|
94
|
+
* @returns The bound node's path, or `null`.
|
|
95
|
+
*/
|
|
96
|
+
get path(): string | null;
|
|
97
|
+
connectedCallback(): void;
|
|
98
|
+
disconnectedCallback(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Re-resolves the binding against the host's current hierarchy: on connection, on a `name`
|
|
101
|
+
* or `index` change, and on every host cycle (a model [re]instantiating, an enclosing
|
|
102
|
+
* `pc-node` [re]binding). When re-resolution yields the entity already bound, the binding
|
|
103
|
+
* is retained untouched — a redundant edit must not flicker overrides through a revert.
|
|
104
|
+
*/
|
|
105
|
+
private _rebind;
|
|
106
|
+
/**
|
|
107
|
+
* Resolves `name` (and `index`) to an entity under `hostEntity`, warning and recording the
|
|
108
|
+
* failure state when it cannot.
|
|
109
|
+
*
|
|
110
|
+
* @param hostEntity - The root of the search.
|
|
111
|
+
* @returns The resolved entity, or `null`.
|
|
112
|
+
*/
|
|
113
|
+
private _resolve;
|
|
114
|
+
/**
|
|
115
|
+
* Binds `target`: registers it (making it a pick target), hooks its destruction, applies
|
|
116
|
+
* this element's overrides, announces readiness and builds the deferred child subtree.
|
|
117
|
+
*
|
|
118
|
+
* @param target - The entity to bind.
|
|
119
|
+
* @param hostEntity - The search root, for the path.
|
|
120
|
+
*/
|
|
121
|
+
private _bind;
|
|
122
|
+
/**
|
|
123
|
+
* Dissolves the current binding, restoring every authored value this element's overrides
|
|
124
|
+
* displaced and removing the decorations this binding hosts: attachment entities are
|
|
125
|
+
* destroyed (re-created against the next binding) and component decorations are removed
|
|
126
|
+
* from the abandoned node. Both sweeps are scoped by `closestEntity`, so a still-bound
|
|
127
|
+
* nested `pc-node` keeps its own decorations. Safe to call in any state.
|
|
128
|
+
*/
|
|
129
|
+
private _unbind;
|
|
130
|
+
/**
|
|
131
|
+
* Handles the destruction of the bound entity - its model unloading, reloading, or a script
|
|
132
|
+
* destroying it. There is nothing to revert on a destroyed entity; the element returns to
|
|
133
|
+
* pending and the host's next cycle re-resolves it.
|
|
134
|
+
*/
|
|
135
|
+
private _onEntityDestroy;
|
|
136
|
+
/**
|
|
137
|
+
* Creates and parents the entities of child `pc-entity` elements - the attachment points.
|
|
138
|
+
* Mirrors the runtime-insertion path in EntityElement.connectedCallback: children were
|
|
139
|
+
* deferred while this host was unresolved (or reset when a previous binding dissolved), and
|
|
140
|
+
* build here once it binds.
|
|
141
|
+
*/
|
|
142
|
+
private _buildChildren;
|
|
143
|
+
/**
|
|
144
|
+
* Applies every override that is explicitly set, capturing the authored value it displaces.
|
|
145
|
+
*/
|
|
146
|
+
private _applyOverrides;
|
|
147
|
+
/**
|
|
148
|
+
* Restores every authored value this element's overrides displaced. The override values
|
|
149
|
+
* themselves are kept - they re-apply on the next binding.
|
|
150
|
+
*/
|
|
151
|
+
private _revertOverrides;
|
|
152
|
+
/**
|
|
153
|
+
* Renders the path of `node` below `root`, for the `path` property and the resolution
|
|
154
|
+
* warnings.
|
|
155
|
+
*
|
|
156
|
+
* @param node - The node to describe.
|
|
157
|
+
* @param root - The search root.
|
|
158
|
+
* @returns The `/`-separated path.
|
|
159
|
+
*/
|
|
160
|
+
private _pathOf;
|
|
161
|
+
/**
|
|
162
|
+
* Describes the search root for warnings: the model's asset id, or the enclosing node's
|
|
163
|
+
* name.
|
|
164
|
+
* @returns The description.
|
|
165
|
+
*/
|
|
166
|
+
private _describeHost;
|
|
167
|
+
/**
|
|
168
|
+
* Finds the node name nearest to the missing `name`, for the miss warning. The names are
|
|
169
|
+
* already in hand from resolution, so the suggestion is nearly free.
|
|
170
|
+
*
|
|
171
|
+
* @param hostEntity - The root of the search.
|
|
172
|
+
* @returns The closest name within an edit distance of 2, or `null`.
|
|
173
|
+
*/
|
|
174
|
+
private _closestName;
|
|
175
|
+
/**
|
|
176
|
+
* Sets the name of the node to bind. A change retargets: the current binding's overrides
|
|
177
|
+
* revert and the new name resolves afresh. `name` on a `pc-node` is never a rename of the
|
|
178
|
+
* authored node - it is only ever a reference.
|
|
179
|
+
* @param value - The node name.
|
|
180
|
+
*/
|
|
181
|
+
set name(value: string);
|
|
182
|
+
/**
|
|
183
|
+
* Gets the name of the node to bind.
|
|
184
|
+
* @returns The node name.
|
|
185
|
+
*/
|
|
186
|
+
get name(): string;
|
|
187
|
+
/**
|
|
188
|
+
* Sets which match to bind when `name` matches more than one node, 0-based in depth-first
|
|
189
|
+
* order. A change retargets, like `name`. `null` means unset - required when the name is
|
|
190
|
+
* ambiguous, optional otherwise.
|
|
191
|
+
* @param value - The match index, or `null`.
|
|
192
|
+
*/
|
|
193
|
+
set index(value: number | null);
|
|
194
|
+
/**
|
|
195
|
+
* Gets which match to bind.
|
|
196
|
+
* @returns The match index, or `null` when unset.
|
|
197
|
+
*/
|
|
198
|
+
get index(): number | null;
|
|
199
|
+
/**
|
|
200
|
+
* Sets the enabled override. `null` clears it, restoring the authored state.
|
|
201
|
+
* @param value - The enabled state, or `null`.
|
|
202
|
+
*/
|
|
203
|
+
set enabled(value: boolean | null);
|
|
204
|
+
/**
|
|
205
|
+
* Gets the enabled override.
|
|
206
|
+
* @returns The enabled state, or `null` while no override is set.
|
|
207
|
+
*/
|
|
208
|
+
get enabled(): boolean | null;
|
|
209
|
+
/**
|
|
210
|
+
* Sets the local position override. `null` clears it, restoring the authored position.
|
|
211
|
+
* @param value - The position, or `null`.
|
|
212
|
+
*/
|
|
213
|
+
set position(value: Vec3 | null);
|
|
214
|
+
/**
|
|
215
|
+
* Gets the local position override.
|
|
216
|
+
* @returns The position, or `null` while no override is set.
|
|
217
|
+
*/
|
|
218
|
+
get position(): Vec3 | null;
|
|
219
|
+
/**
|
|
220
|
+
* Sets the local rotation override, as Euler angles in degrees. `null` clears it, restoring
|
|
221
|
+
* the authored rotation.
|
|
222
|
+
* @param value - The rotation, or `null`.
|
|
223
|
+
*/
|
|
224
|
+
set rotation(value: Vec3 | null);
|
|
225
|
+
/**
|
|
226
|
+
* Gets the local rotation override.
|
|
227
|
+
* @returns The rotation, or `null` while no override is set.
|
|
228
|
+
*/
|
|
229
|
+
get rotation(): Vec3 | null;
|
|
230
|
+
/**
|
|
231
|
+
* Sets the local scale override. `null` clears it, restoring the authored scale.
|
|
232
|
+
* @param value - The scale, or `null`.
|
|
233
|
+
*/
|
|
234
|
+
set scale(value: Vec3 | null);
|
|
235
|
+
/**
|
|
236
|
+
* Gets the local scale override.
|
|
237
|
+
* @returns The scale, or `null` while no override is set.
|
|
238
|
+
*/
|
|
239
|
+
get scale(): Vec3 | null;
|
|
240
|
+
/**
|
|
241
|
+
* Sets the tags override. `null` clears it, restoring the authored tags.
|
|
242
|
+
* @param value - The tags, or `null`.
|
|
243
|
+
*/
|
|
244
|
+
set tags(value: string[] | null);
|
|
245
|
+
/**
|
|
246
|
+
* Gets the tags override.
|
|
247
|
+
* @returns The tags, or `null` while no override is set.
|
|
248
|
+
*/
|
|
249
|
+
get tags(): string[] | null;
|
|
250
|
+
static get observedAttributes(): string[];
|
|
251
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
252
|
+
}
|
|
253
|
+
export { NodeElement };
|