@playcanvas/web-components 0.18.0 → 0.20.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/dist/app.d.cts +38 -3
- package/dist/app.d.ts +38 -3
- package/dist/components/anim-clip.d.cts +0 -2
- package/dist/components/anim-clip.d.ts +0 -2
- package/dist/components/button-component.d.cts +9 -5
- package/dist/components/button-component.d.ts +9 -5
- package/dist/components/joint-component.d.cts +24 -10
- package/dist/components/joint-component.d.ts +24 -10
- package/dist/components/script-component.d.cts +4 -2
- package/dist/components/script-component.d.ts +4 -2
- package/dist/components/script-instance.d.cts +14 -6
- package/dist/components/script-instance.d.ts +14 -6
- package/dist/components/scroll-view-component.d.cts +24 -12
- package/dist/components/scroll-view-component.d.ts +24 -12
- package/dist/components/scrollbar-component.d.cts +6 -3
- package/dist/components/scrollbar-component.d.ts +6 -3
- package/dist/custom-elements.json +93 -23
- package/dist/entity-base.d.cts +4 -3
- package/dist/entity-base.d.ts +4 -3
- package/dist/entity.d.cts +8 -2
- package/dist/entity.d.ts +8 -2
- package/dist/model.d.cts +6 -0
- package/dist/model.d.ts +6 -0
- package/dist/node.d.cts +6 -0
- package/dist/node.d.ts +6 -0
- package/dist/parse.d.cts +7 -2
- package/dist/parse.d.ts +7 -2
- package/dist/pwc.cjs +706 -289
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +706 -289
- 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 +706 -289
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.cts +17 -1
- package/dist/scene.d.ts +17 -1
- package/dist/vscode.html-custom-data.json +34 -14
- package/dist/web-types.json +78 -24
- package/package.json +3 -3
- package/src/app.ts +197 -87
- package/src/components/anim-clip.ts +0 -2
- package/src/components/button-component.ts +18 -10
- package/src/components/joint-component.ts +29 -15
- package/src/components/script-component.ts +25 -12
- package/src/components/script-instance.ts +14 -6
- package/src/components/scroll-view-component.ts +49 -29
- package/src/components/scrollbar-component.ts +13 -8
- package/src/entity-base.ts +27 -15
- package/src/entity.ts +11 -4
- package/src/model.ts +9 -2
- package/src/node.ts +9 -2
- package/src/parse.ts +213 -16
- package/src/scene.ts +33 -2
package/dist/app.d.cts
CHANGED
|
@@ -63,10 +63,30 @@ declare class AppElement extends AsyncElement {
|
|
|
63
63
|
*/
|
|
64
64
|
private _entityElements;
|
|
65
65
|
private _picker;
|
|
66
|
-
private _hasPointerListeners;
|
|
67
66
|
private _hoveredEntity;
|
|
68
67
|
private _pickToken;
|
|
69
68
|
private _pointerHandlers;
|
|
69
|
+
/**
|
|
70
|
+
* The pick of each pointer's primary-button press, keyed by pointerId and kept while a click
|
|
71
|
+
* may still conclude it. The promise is stored rather than its result, so a release can
|
|
72
|
+
* await a press pick that has not resolved yet. Entries are removed by the matching
|
|
73
|
+
* pointerup or pointercancel, and only ever stored while some element listens for click -
|
|
74
|
+
* which is also what keeps those two canvas listeners attached.
|
|
75
|
+
*/
|
|
76
|
+
private _downPicks;
|
|
77
|
+
/** Whether any element in the tree listens for click. Maintained by _syncCanvasListeners. */
|
|
78
|
+
private _clickListened;
|
|
79
|
+
/**
|
|
80
|
+
* The previous click's target, time and count, for chaining successive clicks into the
|
|
81
|
+
* click count that `detail` carries. `null` until a click has fired.
|
|
82
|
+
*/
|
|
83
|
+
private _lastClick;
|
|
84
|
+
/**
|
|
85
|
+
* Serializes dispatch of the discrete synthesized events (pointerdown, pointerup, click),
|
|
86
|
+
* whose picks resolve in GPU order, not canvas-event order. Replaced on teardown, so a pick
|
|
87
|
+
* that never resolves cannot stall the dispatches of a later boot.
|
|
88
|
+
*/
|
|
89
|
+
private _dispatchChain;
|
|
70
90
|
private _app;
|
|
71
91
|
private _loadProgress;
|
|
72
92
|
/**
|
|
@@ -185,10 +205,25 @@ declare class AppElement extends AsyncElement {
|
|
|
185
205
|
*/
|
|
186
206
|
private _pickNode;
|
|
187
207
|
private _onPointerMove;
|
|
208
|
+
/**
|
|
209
|
+
* Appends a dispatch step to {@link _dispatchChain}. Must be called synchronously from the
|
|
210
|
+
* canvas event handler - the order of appends is what carries canvas-event order. A step
|
|
211
|
+
* that rejects is reported and released, so the steps queued behind it still dispatch.
|
|
212
|
+
*
|
|
213
|
+
* @param step - The dispatch work to run once every earlier step has finished.
|
|
214
|
+
*/
|
|
215
|
+
private _chainDispatch;
|
|
188
216
|
private _onPointerDown;
|
|
189
217
|
private _onPointerUp;
|
|
190
|
-
|
|
191
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Attaches exactly the canvas listeners the tree's current element listeners need, and
|
|
220
|
+
* detaches the rest. Recomputed whenever a listener connects or disconnects anywhere under
|
|
221
|
+
* this element: several synthesized types can need the same canvas listener (enter, leave
|
|
222
|
+
* and move all ride the move pick; click rides the down/up pair), so one type's removal
|
|
223
|
+
* must not detach a listener another type still uses. Re-attaching an attached listener is
|
|
224
|
+
* a no-op by EventTarget semantics, so no attach state is kept.
|
|
225
|
+
*/
|
|
226
|
+
private _syncCanvasListeners;
|
|
192
227
|
/**
|
|
193
228
|
* Warns that a graphics option was written too late to have any effect. These options are read
|
|
194
229
|
* once, when the element connects and creates its graphics device, so a later write updates
|
package/dist/app.d.ts
CHANGED
|
@@ -63,10 +63,30 @@ declare class AppElement extends AsyncElement {
|
|
|
63
63
|
*/
|
|
64
64
|
private _entityElements;
|
|
65
65
|
private _picker;
|
|
66
|
-
private _hasPointerListeners;
|
|
67
66
|
private _hoveredEntity;
|
|
68
67
|
private _pickToken;
|
|
69
68
|
private _pointerHandlers;
|
|
69
|
+
/**
|
|
70
|
+
* The pick of each pointer's primary-button press, keyed by pointerId and kept while a click
|
|
71
|
+
* may still conclude it. The promise is stored rather than its result, so a release can
|
|
72
|
+
* await a press pick that has not resolved yet. Entries are removed by the matching
|
|
73
|
+
* pointerup or pointercancel, and only ever stored while some element listens for click -
|
|
74
|
+
* which is also what keeps those two canvas listeners attached.
|
|
75
|
+
*/
|
|
76
|
+
private _downPicks;
|
|
77
|
+
/** Whether any element in the tree listens for click. Maintained by _syncCanvasListeners. */
|
|
78
|
+
private _clickListened;
|
|
79
|
+
/**
|
|
80
|
+
* The previous click's target, time and count, for chaining successive clicks into the
|
|
81
|
+
* click count that `detail` carries. `null` until a click has fired.
|
|
82
|
+
*/
|
|
83
|
+
private _lastClick;
|
|
84
|
+
/**
|
|
85
|
+
* Serializes dispatch of the discrete synthesized events (pointerdown, pointerup, click),
|
|
86
|
+
* whose picks resolve in GPU order, not canvas-event order. Replaced on teardown, so a pick
|
|
87
|
+
* that never resolves cannot stall the dispatches of a later boot.
|
|
88
|
+
*/
|
|
89
|
+
private _dispatchChain;
|
|
70
90
|
private _app;
|
|
71
91
|
private _loadProgress;
|
|
72
92
|
/**
|
|
@@ -185,10 +205,25 @@ declare class AppElement extends AsyncElement {
|
|
|
185
205
|
*/
|
|
186
206
|
private _pickNode;
|
|
187
207
|
private _onPointerMove;
|
|
208
|
+
/**
|
|
209
|
+
* Appends a dispatch step to {@link _dispatchChain}. Must be called synchronously from the
|
|
210
|
+
* canvas event handler - the order of appends is what carries canvas-event order. A step
|
|
211
|
+
* that rejects is reported and released, so the steps queued behind it still dispatch.
|
|
212
|
+
*
|
|
213
|
+
* @param step - The dispatch work to run once every earlier step has finished.
|
|
214
|
+
*/
|
|
215
|
+
private _chainDispatch;
|
|
188
216
|
private _onPointerDown;
|
|
189
217
|
private _onPointerUp;
|
|
190
|
-
|
|
191
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Attaches exactly the canvas listeners the tree's current element listeners need, and
|
|
220
|
+
* detaches the rest. Recomputed whenever a listener connects or disconnects anywhere under
|
|
221
|
+
* this element: several synthesized types can need the same canvas listener (enter, leave
|
|
222
|
+
* and move all ride the move pick; click rides the down/up pair), so one type's removal
|
|
223
|
+
* must not detach a listener another type still uses. Re-attaching an attached listener is
|
|
224
|
+
* a no-op by EventTarget semantics, so no attach state is kept.
|
|
225
|
+
*/
|
|
226
|
+
private _syncCanvasListeners;
|
|
192
227
|
/**
|
|
193
228
|
* Warns that a graphics option was written too late to have any effect. These options are read
|
|
194
229
|
* once, when the element connects and creates its graphics device, so a later write updates
|
|
@@ -16,8 +16,6 @@ import { AnimComponentElement } from './anim-component.cjs';
|
|
|
16
16
|
* @elementSummary The `<pc-anim-clip>` element declares one named animation clip on its parent
|
|
17
17
|
* `<pc-anim>`, taken from the `asset` it names or, without one, from the enclosing `<pc-model>`'s
|
|
18
18
|
* own animations. Must be a direct child of `<pc-anim>`.
|
|
19
|
-
*
|
|
20
|
-
* @category Components
|
|
21
19
|
*/
|
|
22
20
|
declare class AnimClipElement extends AsyncElement {
|
|
23
21
|
/**
|
|
@@ -16,8 +16,6 @@ import { AnimComponentElement } from './anim-component.js';
|
|
|
16
16
|
* @elementSummary The `<pc-anim-clip>` element declares one named animation clip on its parent
|
|
17
17
|
* `<pc-anim>`, taken from the `asset` it names or, without one, from the enclosing `<pc-model>`'s
|
|
18
18
|
* own animations. Must be a direct child of `<pc-anim>`.
|
|
19
|
-
*
|
|
20
|
-
* @category Components
|
|
21
19
|
*/
|
|
22
20
|
declare class AnimClipElement extends AsyncElement {
|
|
23
21
|
/**
|
|
@@ -50,15 +50,19 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
50
50
|
*/
|
|
51
51
|
get active(): boolean;
|
|
52
52
|
/**
|
|
53
|
-
* Sets the reference (
|
|
54
|
-
* element is used for visual transitions.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
54
|
+
* selector) to the entity whose image element is used for visual transitions. An exact name
|
|
55
|
+
* resolves against the nearest enclosing entity first, then outward, then the document.
|
|
56
|
+
* Defaults to the button's own entity — inside a `<pc-model>`, that is the model's host
|
|
57
|
+
* entity, so supply an explicit reference to target a UI entity instead. A non-empty
|
|
58
|
+
* reference that does not resolve warns and is ignored.
|
|
57
59
|
* @param value - The image entity reference.
|
|
58
60
|
*/
|
|
59
61
|
set image(value: string);
|
|
60
62
|
/**
|
|
61
|
-
* Gets the reference
|
|
63
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
64
|
+
* selector) to the entity whose image element is used for visual transitions, or empty for
|
|
65
|
+
* the button's own entity.
|
|
62
66
|
* @returns The image entity reference.
|
|
63
67
|
*/
|
|
64
68
|
get image(): string;
|
|
@@ -50,15 +50,19 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
50
50
|
*/
|
|
51
51
|
get active(): boolean;
|
|
52
52
|
/**
|
|
53
|
-
* Sets the reference (
|
|
54
|
-
* element is used for visual transitions.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
54
|
+
* selector) to the entity whose image element is used for visual transitions. An exact name
|
|
55
|
+
* resolves against the nearest enclosing entity first, then outward, then the document.
|
|
56
|
+
* Defaults to the button's own entity — inside a `<pc-model>`, that is the model's host
|
|
57
|
+
* entity, so supply an explicit reference to target a UI entity instead. A non-empty
|
|
58
|
+
* reference that does not resolve warns and is ignored.
|
|
57
59
|
* @param value - The image entity reference.
|
|
58
60
|
*/
|
|
59
61
|
set image(value: string);
|
|
60
62
|
/**
|
|
61
|
-
* Gets the reference
|
|
63
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
64
|
+
* selector) to the entity whose image element is used for visual transitions, or empty for
|
|
65
|
+
* the button's own entity.
|
|
62
66
|
* @returns The image entity reference.
|
|
63
67
|
*/
|
|
64
68
|
get image(): string;
|
|
@@ -19,7 +19,12 @@ export type MotionMode = 'locked' | 'limited' | 'free';
|
|
|
19
19
|
* primary axis: a hinge rotates about it, a slider translates along it and a ball joint twists
|
|
20
20
|
* about it. The constrained bodies are referenced by `entity-a` and `entity-b`, both of which need
|
|
21
21
|
* a rigid body component; leaving `entity-b` empty constrains `entity-a` to a fixed point in world
|
|
22
|
-
* space.
|
|
22
|
+
* space. A reference can name any entity-fronting element — `<pc-entity>`, `<pc-model>` or
|
|
23
|
+
* `<pc-node>`, so a ragdoll can join a model's own skeleton nodes by name — and a name resolves
|
|
24
|
+
* against the nearest enclosing entity first, then outward through the entity hierarchy, then the
|
|
25
|
+
* document, while a `#` selector resolves document-wide. A `<template>` prefab with one
|
|
26
|
+
* entity-fronting root can therefore wire its joints by name and stay self-contained when cloned.
|
|
27
|
+
* The underlying engine component is in alpha, so its API may change.
|
|
23
28
|
*
|
|
24
29
|
* @elementSummary The `<pc-joint>` element constrains two rigid bodies to each other — a hinged
|
|
25
30
|
* door, a swinging chain, a sliding drawer. Its entity's transform is the joint frame, and
|
|
@@ -327,27 +332,36 @@ declare class JointComponentElement extends ComponentElement {
|
|
|
327
332
|
*/
|
|
328
333
|
get enableLimits(): boolean;
|
|
329
334
|
/**
|
|
330
|
-
* Sets the reference (
|
|
331
|
-
* the first constrained body.
|
|
332
|
-
*
|
|
335
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
336
|
+
* selector) to the element providing the first constrained body. An exact name resolves
|
|
337
|
+
* against the nearest enclosing entity first, then outward, then the document. The reference
|
|
338
|
+
* resolves when it is set, so an entity created later is picked up by setting the attribute
|
|
339
|
+
* again. A non-empty reference that does not resolve warns, naming which of the two causes it
|
|
340
|
+
* hit.
|
|
333
341
|
* @param value - The first body's entity reference.
|
|
334
342
|
*/
|
|
335
343
|
set entityA(value: string);
|
|
336
344
|
/**
|
|
337
|
-
* Gets the reference
|
|
345
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
346
|
+
* selector) to the element providing the first constrained body.
|
|
338
347
|
* @returns The first body's entity reference.
|
|
339
348
|
*/
|
|
340
349
|
get entityA(): string;
|
|
341
350
|
/**
|
|
342
|
-
* Sets the reference (
|
|
343
|
-
* the second constrained body, or empty to constrain the
|
|
344
|
-
*
|
|
345
|
-
*
|
|
351
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
352
|
+
* selector) to the element providing the second constrained body, or empty to constrain the
|
|
353
|
+
* first body to a fixed point in world space. An exact name resolves against the nearest
|
|
354
|
+
* enclosing entity first, then outward, then the document. The reference resolves when it is
|
|
355
|
+
* set, so an entity created later is picked up by setting the attribute again. A non-empty
|
|
356
|
+
* reference that does not resolve warns; an empty one is the documented world-space case and
|
|
357
|
+
* stays silent.
|
|
346
358
|
* @param value - The second body's entity reference.
|
|
347
359
|
*/
|
|
348
360
|
set entityB(value: string);
|
|
349
361
|
/**
|
|
350
|
-
* Gets the reference
|
|
362
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
363
|
+
* selector) to the element providing the second constrained body, or empty for the
|
|
364
|
+
* world-space case.
|
|
351
365
|
* @returns The second body's entity reference.
|
|
352
366
|
*/
|
|
353
367
|
get entityB(): string;
|
|
@@ -19,7 +19,12 @@ export type MotionMode = 'locked' | 'limited' | 'free';
|
|
|
19
19
|
* primary axis: a hinge rotates about it, a slider translates along it and a ball joint twists
|
|
20
20
|
* about it. The constrained bodies are referenced by `entity-a` and `entity-b`, both of which need
|
|
21
21
|
* a rigid body component; leaving `entity-b` empty constrains `entity-a` to a fixed point in world
|
|
22
|
-
* space.
|
|
22
|
+
* space. A reference can name any entity-fronting element — `<pc-entity>`, `<pc-model>` or
|
|
23
|
+
* `<pc-node>`, so a ragdoll can join a model's own skeleton nodes by name — and a name resolves
|
|
24
|
+
* against the nearest enclosing entity first, then outward through the entity hierarchy, then the
|
|
25
|
+
* document, while a `#` selector resolves document-wide. A `<template>` prefab with one
|
|
26
|
+
* entity-fronting root can therefore wire its joints by name and stay self-contained when cloned.
|
|
27
|
+
* The underlying engine component is in alpha, so its API may change.
|
|
23
28
|
*
|
|
24
29
|
* @elementSummary The `<pc-joint>` element constrains two rigid bodies to each other — a hinged
|
|
25
30
|
* door, a swinging chain, a sliding drawer. Its entity's transform is the joint frame, and
|
|
@@ -327,27 +332,36 @@ declare class JointComponentElement extends ComponentElement {
|
|
|
327
332
|
*/
|
|
328
333
|
get enableLimits(): boolean;
|
|
329
334
|
/**
|
|
330
|
-
* Sets the reference (
|
|
331
|
-
* the first constrained body.
|
|
332
|
-
*
|
|
335
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
336
|
+
* selector) to the element providing the first constrained body. An exact name resolves
|
|
337
|
+
* against the nearest enclosing entity first, then outward, then the document. The reference
|
|
338
|
+
* resolves when it is set, so an entity created later is picked up by setting the attribute
|
|
339
|
+
* again. A non-empty reference that does not resolve warns, naming which of the two causes it
|
|
340
|
+
* hit.
|
|
333
341
|
* @param value - The first body's entity reference.
|
|
334
342
|
*/
|
|
335
343
|
set entityA(value: string);
|
|
336
344
|
/**
|
|
337
|
-
* Gets the reference
|
|
345
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
346
|
+
* selector) to the element providing the first constrained body.
|
|
338
347
|
* @returns The first body's entity reference.
|
|
339
348
|
*/
|
|
340
349
|
get entityA(): string;
|
|
341
350
|
/**
|
|
342
|
-
* Sets the reference (
|
|
343
|
-
* the second constrained body, or empty to constrain the
|
|
344
|
-
*
|
|
345
|
-
*
|
|
351
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
352
|
+
* selector) to the element providing the second constrained body, or empty to constrain the
|
|
353
|
+
* first body to a fixed point in world space. An exact name resolves against the nearest
|
|
354
|
+
* enclosing entity first, then outward, then the document. The reference resolves when it is
|
|
355
|
+
* set, so an entity created later is picked up by setting the attribute again. A non-empty
|
|
356
|
+
* reference that does not resolve warns; an empty one is the documented world-space case and
|
|
357
|
+
* stays silent.
|
|
346
358
|
* @param value - The second body's entity reference.
|
|
347
359
|
*/
|
|
348
360
|
set entityB(value: string);
|
|
349
361
|
/**
|
|
350
|
-
* Gets the reference
|
|
362
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
363
|
+
* selector) to the element providing the second constrained body, or empty for the
|
|
364
|
+
* world-space case.
|
|
351
365
|
* @returns The second body's entity reference.
|
|
352
366
|
*/
|
|
353
367
|
get entityB(): string;
|
|
@@ -38,8 +38,10 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
38
38
|
/**
|
|
39
39
|
* Recursively converts raw attribute data into proper PlayCanvas types. Supported conversions:
|
|
40
40
|
* - "asset:id" → the Asset created by the `pc-asset` element with that id
|
|
41
|
-
* - "entity:ref" → the Entity backing a `pc-entity` element. The
|
|
42
|
-
*
|
|
41
|
+
* - "entity:ref" → the Entity backing a `pc-entity`, `pc-model` or `pc-node` element. The
|
|
42
|
+
* reference is a name, resolved against this element's nearest enclosing entity first,
|
|
43
|
+
* then outward, then the document — or a document-wide `#` selector (`entity:#id`). A bare
|
|
44
|
+
* value is always a name, never an id.
|
|
43
45
|
* - "vec2:1 2" → new Vec2(1, 2)
|
|
44
46
|
* - "vec3:1 2 3" → new Vec3(1, 2, 3)
|
|
45
47
|
* - "vec4:1 2 3 4" → new Vec4(1, 2, 3, 4)
|
|
@@ -38,8 +38,10 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
38
38
|
/**
|
|
39
39
|
* Recursively converts raw attribute data into proper PlayCanvas types. Supported conversions:
|
|
40
40
|
* - "asset:id" → the Asset created by the `pc-asset` element with that id
|
|
41
|
-
* - "entity:ref" → the Entity backing a `pc-entity` element. The
|
|
42
|
-
*
|
|
41
|
+
* - "entity:ref" → the Entity backing a `pc-entity`, `pc-model` or `pc-node` element. The
|
|
42
|
+
* reference is a name, resolved against this element's nearest enclosing entity first,
|
|
43
|
+
* then outward, then the document — or a document-wide `#` selector (`entity:#id`). A bare
|
|
44
|
+
* value is always a name, never an id.
|
|
43
45
|
* - "vec2:1 2" → new Vec2(1, 2)
|
|
44
46
|
* - "vec3:1 2 3" → new Vec3(1, 2, 3)
|
|
45
47
|
* - "vec4:1 2 3 4" → new Vec4(1, 2, 3, 4)
|
|
@@ -12,7 +12,9 @@ import { AsyncElement } from '../async-element.cjs';
|
|
|
12
12
|
* Values are parsed according to the type of the attribute's current value — initially the
|
|
13
13
|
* script's declared default (numbers, booleans, strings, Vec2/3/4, Color, Quat as Euler
|
|
14
14
|
* angles) — and the `asset:`/`entity:`/`vec2:`/`vec3:`/`vec4:`/`color:` prefixes may be used
|
|
15
|
-
* to be explicit.
|
|
15
|
+
* to be explicit. An `entity:` reference is an entity name — resolved against the nearest
|
|
16
|
+
* enclosing entity first, then outward, then the document — or a document-wide `#` selector
|
|
17
|
+
* (`entity:#id`); a bare value is always a name, never an element id.
|
|
16
18
|
* - **The `attributes` JSON attribute**: an object supporting nested structures and attribute
|
|
17
19
|
* names that collide with reserved HTML attribute names (e.g. `title`).
|
|
18
20
|
*
|
|
@@ -28,7 +30,8 @@ import { AsyncElement } from '../async-element.cjs';
|
|
|
28
30
|
*
|
|
29
31
|
* @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
|
|
30
32
|
* the entity of its parent `<pc-script>`. Its other attributes set script attributes of the same
|
|
31
|
-
* name, and `attributes` takes a JSON object instead.
|
|
33
|
+
* name, and `attributes` takes a JSON object instead. An `entity:` value is an entity name —
|
|
34
|
+
* write `entity:#id` for an element id. Must be a direct child of `<pc-script>`.
|
|
32
35
|
*
|
|
33
36
|
* @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
|
|
34
37
|
* `detail` carries the new `attributes` object. Bubbles.
|
|
@@ -43,14 +46,19 @@ declare class ScriptInstanceElement extends AsyncElement {
|
|
|
43
46
|
/**
|
|
44
47
|
* Sets the attributes of the script as an object. Values are converted with the same rules
|
|
45
48
|
* as the `attributes` attribute: `asset:`/`entity:` references and `vec2:`/`vec3:`/`vec4:`/
|
|
46
|
-
* `color:` prefixed strings are resolved
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
+
* `color:` prefixed strings are resolved (an entity name against the nearest enclosing
|
|
50
|
+
* entity first, then outward, then the document — or a document-wide `#` selector; a bare
|
|
51
|
+
* value is always a name, never an element id), and a plain numeric array is converted to
|
|
52
|
+
* the type of the attribute it targets when that attribute currently holds a Vec2, Vec3,
|
|
53
|
+
* Vec4 or Color.
|
|
49
54
|
* @param value - The attributes of the script.
|
|
50
55
|
*/
|
|
51
56
|
set scriptAttributes(value: Record<string, any>);
|
|
52
57
|
/**
|
|
53
|
-
* Gets the attributes of the script
|
|
58
|
+
* Gets the attributes of the script as an object whose `asset:`, `entity:`, `vec2:`, `vec3:`,
|
|
59
|
+
* `vec4:` and `color:` prefixed values are resolved when applied — an `entity:` value being
|
|
60
|
+
* an entity name (nearest enclosing entity first, then outward, then the document) or a
|
|
61
|
+
* document-wide `#` selector (`entity:#id`), never a bare element id.
|
|
54
62
|
* @returns The attributes of the script.
|
|
55
63
|
*/
|
|
56
64
|
get scriptAttributes(): Record<string, any>;
|
|
@@ -12,7 +12,9 @@ import { AsyncElement } from '../async-element.js';
|
|
|
12
12
|
* Values are parsed according to the type of the attribute's current value — initially the
|
|
13
13
|
* script's declared default (numbers, booleans, strings, Vec2/3/4, Color, Quat as Euler
|
|
14
14
|
* angles) — and the `asset:`/`entity:`/`vec2:`/`vec3:`/`vec4:`/`color:` prefixes may be used
|
|
15
|
-
* to be explicit.
|
|
15
|
+
* to be explicit. An `entity:` reference is an entity name — resolved against the nearest
|
|
16
|
+
* enclosing entity first, then outward, then the document — or a document-wide `#` selector
|
|
17
|
+
* (`entity:#id`); a bare value is always a name, never an element id.
|
|
16
18
|
* - **The `attributes` JSON attribute**: an object supporting nested structures and attribute
|
|
17
19
|
* names that collide with reserved HTML attribute names (e.g. `title`).
|
|
18
20
|
*
|
|
@@ -28,7 +30,8 @@ import { AsyncElement } from '../async-element.js';
|
|
|
28
30
|
*
|
|
29
31
|
* @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
|
|
30
32
|
* the entity of its parent `<pc-script>`. Its other attributes set script attributes of the same
|
|
31
|
-
* name, and `attributes` takes a JSON object instead.
|
|
33
|
+
* name, and `attributes` takes a JSON object instead. An `entity:` value is an entity name —
|
|
34
|
+
* write `entity:#id` for an element id. Must be a direct child of `<pc-script>`.
|
|
32
35
|
*
|
|
33
36
|
* @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
|
|
34
37
|
* `detail` carries the new `attributes` object. Bubbles.
|
|
@@ -43,14 +46,19 @@ declare class ScriptInstanceElement extends AsyncElement {
|
|
|
43
46
|
/**
|
|
44
47
|
* Sets the attributes of the script as an object. Values are converted with the same rules
|
|
45
48
|
* as the `attributes` attribute: `asset:`/`entity:` references and `vec2:`/`vec3:`/`vec4:`/
|
|
46
|
-
* `color:` prefixed strings are resolved
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
+
* `color:` prefixed strings are resolved (an entity name against the nearest enclosing
|
|
50
|
+
* entity first, then outward, then the document — or a document-wide `#` selector; a bare
|
|
51
|
+
* value is always a name, never an element id), and a plain numeric array is converted to
|
|
52
|
+
* the type of the attribute it targets when that attribute currently holds a Vec2, Vec3,
|
|
53
|
+
* Vec4 or Color.
|
|
49
54
|
* @param value - The attributes of the script.
|
|
50
55
|
*/
|
|
51
56
|
set scriptAttributes(value: Record<string, any>);
|
|
52
57
|
/**
|
|
53
|
-
* Gets the attributes of the script
|
|
58
|
+
* Gets the attributes of the script as an object whose `asset:`, `entity:`, `vec2:`, `vec3:`,
|
|
59
|
+
* `vec4:` and `color:` prefixed values are resolved when applied — an `entity:` value being
|
|
60
|
+
* an entity name (nearest enclosing entity first, then outward, then the document) or a
|
|
61
|
+
* document-wide `#` selector (`entity:#id`), never a bare element id.
|
|
54
62
|
* @returns The attributes of the script.
|
|
55
63
|
*/
|
|
56
64
|
get scriptAttributes(): Record<string, any>;
|
|
@@ -135,46 +135,58 @@ declare class ScrollViewComponentElement extends ComponentElement {
|
|
|
135
135
|
*/
|
|
136
136
|
get verticalScrollbarVisibility(): "always" | "when-required";
|
|
137
137
|
/**
|
|
138
|
-
* Sets the reference (
|
|
139
|
-
* viewport, which clips the content to the scroll view's
|
|
138
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
139
|
+
* selector) to the entity used as the viewport, which clips the content to the scroll view's
|
|
140
|
+
* bounds. An exact name resolves against the nearest enclosing entity first, then outward,
|
|
141
|
+
* then the document. A non-empty reference that does not resolve warns and is ignored.
|
|
140
142
|
* @param value - The viewport entity reference.
|
|
141
143
|
*/
|
|
142
144
|
set viewport(value: string);
|
|
143
145
|
/**
|
|
144
|
-
* Gets the reference
|
|
146
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
147
|
+
* selector) to the entity used as the viewport.
|
|
145
148
|
* @returns The viewport entity reference.
|
|
146
149
|
*/
|
|
147
150
|
get viewport(): string;
|
|
148
151
|
/**
|
|
149
|
-
* Sets the reference (
|
|
150
|
-
* content, which is moved as the scroll view is
|
|
152
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
153
|
+
* selector) to the entity used as the content, which is moved as the scroll view is
|
|
154
|
+
* scrolled. An exact name resolves against the nearest enclosing entity first, then outward,
|
|
155
|
+
* then the document. A non-empty reference that does not resolve warns and is ignored.
|
|
151
156
|
* @param value - The content entity reference.
|
|
152
157
|
*/
|
|
153
158
|
set content(value: string);
|
|
154
159
|
/**
|
|
155
|
-
* Gets the reference
|
|
160
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
161
|
+
* selector) to the entity used as the content.
|
|
156
162
|
* @returns The content entity reference.
|
|
157
163
|
*/
|
|
158
164
|
get content(): string;
|
|
159
165
|
/**
|
|
160
|
-
* Sets the reference (
|
|
161
|
-
* the horizontal `<pc-scrollbar>`.
|
|
166
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
167
|
+
* selector) to the entity containing the horizontal `<pc-scrollbar>`. An exact name resolves
|
|
168
|
+
* against the nearest enclosing entity first, then outward, then the document. A non-empty
|
|
169
|
+
* reference that does not resolve warns and is ignored.
|
|
162
170
|
* @param value - The horizontal scrollbar entity reference.
|
|
163
171
|
*/
|
|
164
172
|
set horizontalScrollbar(value: string);
|
|
165
173
|
/**
|
|
166
|
-
* Gets the reference
|
|
174
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
175
|
+
* selector) to the entity containing the horizontal scrollbar.
|
|
167
176
|
* @returns The horizontal scrollbar entity reference.
|
|
168
177
|
*/
|
|
169
178
|
get horizontalScrollbar(): string;
|
|
170
179
|
/**
|
|
171
|
-
* Sets the reference (
|
|
172
|
-
* the vertical `<pc-scrollbar>`.
|
|
180
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
181
|
+
* selector) to the entity containing the vertical `<pc-scrollbar>`. An exact name resolves
|
|
182
|
+
* against the nearest enclosing entity first, then outward, then the document. A non-empty
|
|
183
|
+
* reference that does not resolve warns and is ignored.
|
|
173
184
|
* @param value - The vertical scrollbar entity reference.
|
|
174
185
|
*/
|
|
175
186
|
set verticalScrollbar(value: string);
|
|
176
187
|
/**
|
|
177
|
-
* Gets the reference
|
|
188
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
189
|
+
* selector) to the entity containing the vertical scrollbar.
|
|
178
190
|
* @returns The vertical scrollbar entity reference.
|
|
179
191
|
*/
|
|
180
192
|
get verticalScrollbar(): string;
|
|
@@ -135,46 +135,58 @@ declare class ScrollViewComponentElement extends ComponentElement {
|
|
|
135
135
|
*/
|
|
136
136
|
get verticalScrollbarVisibility(): "always" | "when-required";
|
|
137
137
|
/**
|
|
138
|
-
* Sets the reference (
|
|
139
|
-
* viewport, which clips the content to the scroll view's
|
|
138
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
139
|
+
* selector) to the entity used as the viewport, which clips the content to the scroll view's
|
|
140
|
+
* bounds. An exact name resolves against the nearest enclosing entity first, then outward,
|
|
141
|
+
* then the document. A non-empty reference that does not resolve warns and is ignored.
|
|
140
142
|
* @param value - The viewport entity reference.
|
|
141
143
|
*/
|
|
142
144
|
set viewport(value: string);
|
|
143
145
|
/**
|
|
144
|
-
* Gets the reference
|
|
146
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
147
|
+
* selector) to the entity used as the viewport.
|
|
145
148
|
* @returns The viewport entity reference.
|
|
146
149
|
*/
|
|
147
150
|
get viewport(): string;
|
|
148
151
|
/**
|
|
149
|
-
* Sets the reference (
|
|
150
|
-
* content, which is moved as the scroll view is
|
|
152
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
153
|
+
* selector) to the entity used as the content, which is moved as the scroll view is
|
|
154
|
+
* scrolled. An exact name resolves against the nearest enclosing entity first, then outward,
|
|
155
|
+
* then the document. A non-empty reference that does not resolve warns and is ignored.
|
|
151
156
|
* @param value - The content entity reference.
|
|
152
157
|
*/
|
|
153
158
|
set content(value: string);
|
|
154
159
|
/**
|
|
155
|
-
* Gets the reference
|
|
160
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
161
|
+
* selector) to the entity used as the content.
|
|
156
162
|
* @returns The content entity reference.
|
|
157
163
|
*/
|
|
158
164
|
get content(): string;
|
|
159
165
|
/**
|
|
160
|
-
* Sets the reference (
|
|
161
|
-
* the horizontal `<pc-scrollbar>`.
|
|
166
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
167
|
+
* selector) to the entity containing the horizontal `<pc-scrollbar>`. An exact name resolves
|
|
168
|
+
* against the nearest enclosing entity first, then outward, then the document. A non-empty
|
|
169
|
+
* reference that does not resolve warns and is ignored.
|
|
162
170
|
* @param value - The horizontal scrollbar entity reference.
|
|
163
171
|
*/
|
|
164
172
|
set horizontalScrollbar(value: string);
|
|
165
173
|
/**
|
|
166
|
-
* Gets the reference
|
|
174
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
175
|
+
* selector) to the entity containing the horizontal scrollbar.
|
|
167
176
|
* @returns The horizontal scrollbar entity reference.
|
|
168
177
|
*/
|
|
169
178
|
get horizontalScrollbar(): string;
|
|
170
179
|
/**
|
|
171
|
-
* Sets the reference (
|
|
172
|
-
* the vertical `<pc-scrollbar>`.
|
|
180
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
181
|
+
* selector) to the entity containing the vertical `<pc-scrollbar>`. An exact name resolves
|
|
182
|
+
* against the nearest enclosing entity first, then outward, then the document. A non-empty
|
|
183
|
+
* reference that does not resolve warns and is ignored.
|
|
173
184
|
* @param value - The vertical scrollbar entity reference.
|
|
174
185
|
*/
|
|
175
186
|
set verticalScrollbar(value: string);
|
|
176
187
|
/**
|
|
177
|
-
* Gets the reference
|
|
188
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
189
|
+
* selector) to the entity containing the vertical scrollbar.
|
|
178
190
|
* @returns The vertical scrollbar entity reference.
|
|
179
191
|
*/
|
|
180
192
|
get verticalScrollbar(): string;
|
|
@@ -59,13 +59,16 @@ declare class ScrollbarComponentElement extends ComponentElement {
|
|
|
59
59
|
*/
|
|
60
60
|
get handleSize(): number;
|
|
61
61
|
/**
|
|
62
|
-
* Sets the reference (
|
|
63
|
-
* scrollbar handle.
|
|
62
|
+
* Sets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
63
|
+
* selector) to the entity used as the scrollbar handle. An exact name resolves against the
|
|
64
|
+
* nearest enclosing entity first, then outward, then the document. A non-empty reference that
|
|
65
|
+
* does not resolve warns and is ignored.
|
|
64
66
|
* @param value - The handle entity reference.
|
|
65
67
|
*/
|
|
66
68
|
set handle(value: string);
|
|
67
69
|
/**
|
|
68
|
-
* Gets the reference
|
|
70
|
+
* Gets the reference (a `pc-entity`, `pc-model` or `pc-node` name, or a document-wide `#`
|
|
71
|
+
* selector) to the entity used as the scrollbar handle.
|
|
69
72
|
* @returns The handle entity reference.
|
|
70
73
|
*/
|
|
71
74
|
get handle(): string;
|