@playcanvas/web-components 0.16.0 → 0.17.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 +14 -13
- package/dist/app.d.ts +14 -13
- package/dist/async-element.d.cts +13 -13
- package/dist/async-element.d.ts +13 -13
- package/dist/components/anim-component.d.cts +33 -5
- package/dist/components/anim-component.d.ts +33 -5
- package/dist/components/{listener-component.d.cts → audio-listener-component.d.cts} +7 -5
- package/dist/components/{listener-component.d.ts → audio-listener-component.d.ts} +7 -5
- package/dist/components/button-component.d.cts +5 -1
- package/dist/components/button-component.d.ts +5 -1
- package/dist/components/camera-component.d.cts +2 -0
- package/dist/components/camera-component.d.ts +2 -0
- package/dist/components/collision-component.d.cts +5 -1
- package/dist/components/collision-component.d.ts +5 -1
- package/dist/components/component.d.cts +3 -2
- package/dist/components/component.d.ts +3 -2
- package/dist/components/element-component.d.cts +7 -0
- package/dist/components/element-component.d.ts +7 -0
- package/dist/components/gsplat-component.d.cts +2 -0
- package/dist/components/gsplat-component.d.ts +2 -0
- package/dist/components/joint-component.d.cts +2 -0
- package/dist/components/joint-component.d.ts +2 -0
- package/dist/components/{layoutchild-component.d.cts → layout-child-component.d.cts} +3 -1
- package/dist/components/{layoutchild-component.d.ts → layout-child-component.d.ts} +3 -1
- package/dist/components/{layoutgroup-component.d.cts → layout-group-component.d.cts} +3 -1
- package/dist/components/{layoutgroup-component.d.ts → layout-group-component.d.ts} +3 -1
- package/dist/components/light-component.d.cts +2 -0
- package/dist/components/light-component.d.ts +2 -0
- package/dist/components/{particlesystem-component.d.cts → particle-system-component.d.cts} +3 -1
- package/dist/components/{particlesystem-component.d.ts → particle-system-component.d.ts} +3 -1
- package/dist/components/render-component.d.cts +2 -0
- package/dist/components/render-component.d.ts +2 -0
- package/dist/components/{rigidbody-component.d.cts → rigid-body-component.d.cts} +3 -1
- package/dist/components/{rigidbody-component.d.ts → rigid-body-component.d.ts} +3 -1
- package/dist/components/screen-component.d.cts +2 -0
- package/dist/components/screen-component.d.ts +2 -0
- package/dist/components/script-component.d.cts +23 -12
- package/dist/components/script-component.d.ts +23 -12
- package/dist/components/{script.d.cts → script-instance.d.cts} +7 -7
- package/dist/components/{script.d.ts → script-instance.d.ts} +7 -7
- package/dist/components/{scrollview-component.d.cts → scroll-view-component.d.cts} +3 -1
- package/dist/components/{scrollview-component.d.ts → scroll-view-component.d.ts} +3 -1
- package/dist/components/scrollbar-component.d.cts +2 -0
- package/dist/components/scrollbar-component.d.ts +2 -0
- package/dist/components/sound-component.d.cts +3 -1
- package/dist/components/sound-component.d.ts +3 -1
- package/dist/components/sound-slot.d.cts +2 -2
- package/dist/components/sound-slot.d.ts +2 -2
- package/dist/custom-elements.json +1603 -986
- package/dist/entity-base.d.cts +6 -5
- package/dist/entity-base.d.ts +6 -5
- package/dist/entity-owner.d.cts +118 -0
- package/dist/entity-owner.d.ts +118 -0
- package/dist/entity.d.cts +8 -101
- package/dist/entity.d.ts +8 -101
- package/dist/index.d.cts +22 -21
- package/dist/index.d.ts +22 -21
- package/dist/model.d.cts +67 -24
- package/dist/model.d.ts +67 -24
- package/dist/pwc.cjs +526 -268
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +526 -268
- 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 +523 -266
- package/dist/pwc.mjs.map +1 -1
- package/dist/vscode.html-custom-data.json +145 -90
- package/dist/{module.d.cts → wasm.d.cts} +6 -6
- package/dist/{module.d.ts → wasm.d.ts} +6 -6
- package/dist/web-types.json +378 -250
- package/package.json +7 -7
- package/src/app.ts +45 -35
- package/src/async-element.ts +14 -14
- package/src/components/anim-component.ts +84 -14
- package/src/components/{listener-component.ts → audio-listener-component.ts} +8 -6
- package/src/components/button-component.ts +5 -1
- package/src/components/camera-component.ts +2 -0
- package/src/components/collision-component.ts +5 -1
- package/src/components/component.ts +4 -3
- package/src/components/element-component.ts +7 -0
- package/src/components/gsplat-component.ts +2 -0
- package/src/components/joint-component.ts +2 -0
- package/src/components/{layoutchild-component.ts → layout-child-component.ts} +4 -2
- package/src/components/{layoutgroup-component.ts → layout-group-component.ts} +4 -2
- package/src/components/light-component.ts +2 -0
- package/src/components/{particlesystem-component.ts → particle-system-component.ts} +4 -2
- package/src/components/render-component.ts +2 -0
- package/src/components/{rigidbody-component.ts → rigid-body-component.ts} +4 -2
- package/src/components/screen-component.ts +2 -0
- package/src/components/script-component.ts +63 -42
- package/src/components/{script.ts → script-instance.ts} +14 -14
- package/src/components/{scrollview-component.ts → scroll-view-component.ts} +4 -2
- package/src/components/scrollbar-component.ts +2 -0
- package/src/components/sound-component.ts +4 -2
- package/src/components/sound-slot.ts +4 -4
- package/src/entity-base.ts +6 -5
- package/src/entity-owner.ts +298 -0
- package/src/entity.ts +15 -270
- package/src/index.ts +26 -24
- package/src/model.ts +159 -72
- package/src/node.ts +9 -5
- package/src/{module.ts → wasm.ts} +8 -8
|
@@ -3,10 +3,12 @@ import { Vec2, Vec4 } from 'playcanvas';
|
|
|
3
3
|
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The LayoutGroupComponentElement interface provides properties and methods for manipulating
|
|
6
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-layout-group/ | `<pc-layout-group>`} elements.
|
|
7
7
|
* The LayoutGroupComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link LayoutGroupComponent} (`layoutgroup`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class LayoutGroupComponentElement extends ComponentElement {
|
|
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.cjs';
|
|
|
7
7
|
* The LightComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link LightComponent} (`light`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class LightComponentElement extends ComponentElement {
|
|
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.js';
|
|
|
7
7
|
* The LightComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link LightComponent} (`light`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class LightComponentElement extends ComponentElement {
|
|
@@ -2,10 +2,12 @@ import type { ParticleSystemComponent } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component.cjs';
|
|
3
3
|
/**
|
|
4
4
|
* The ParticleSystemComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-particle-system/ | `<pc-particle-system>`} elements.
|
|
6
6
|
* The ParticleSystemComponentElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
8
|
*
|
|
9
|
+
* Engine component: {@link ParticleSystemComponent} (`particlesystem`).
|
|
10
|
+
*
|
|
9
11
|
* @category Components
|
|
10
12
|
*/
|
|
11
13
|
declare class ParticleSystemComponentElement extends ComponentElement {
|
|
@@ -2,10 +2,12 @@ import type { ParticleSystemComponent } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component.js';
|
|
3
3
|
/**
|
|
4
4
|
* The ParticleSystemComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-particle-system/ | `<pc-particle-system>`} elements.
|
|
6
6
|
* The ParticleSystemComponentElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
8
|
*
|
|
9
|
+
* Engine component: {@link ParticleSystemComponent} (`particlesystem`).
|
|
10
|
+
*
|
|
9
11
|
* @category Components
|
|
10
12
|
*/
|
|
11
13
|
declare class ParticleSystemComponentElement extends ComponentElement {
|
|
@@ -10,6 +10,8 @@ import { ComponentElement } from './component.cjs';
|
|
|
10
10
|
* to `box`). It does not cover the engine's `asset` render type, since there is no way to supply
|
|
11
11
|
* a render asset here — use `pc-model` for glTF content instead.
|
|
12
12
|
*
|
|
13
|
+
* Engine component: {@link RenderComponent} (`render`).
|
|
14
|
+
*
|
|
13
15
|
* @category Components
|
|
14
16
|
*/
|
|
15
17
|
declare class RenderComponentElement extends ComponentElement {
|
|
@@ -10,6 +10,8 @@ import { ComponentElement } from './component.js';
|
|
|
10
10
|
* to `box`). It does not cover the engine's `asset` render type, since there is no way to supply
|
|
11
11
|
* a render asset here — use `pc-model` for glTF content instead.
|
|
12
12
|
*
|
|
13
|
+
* Engine component: {@link RenderComponent} (`render`).
|
|
14
|
+
*
|
|
13
15
|
* @category Components
|
|
14
16
|
*/
|
|
15
17
|
declare class RenderComponentElement extends ComponentElement {
|
|
@@ -3,10 +3,12 @@ import { Vec3 } from 'playcanvas';
|
|
|
3
3
|
import { ComponentElement } from './component.cjs';
|
|
4
4
|
/**
|
|
5
5
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
6
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-rigid-body/ | `<pc-rigid-body>`} elements.
|
|
7
7
|
* The RigidBodyComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link RigidBodyComponent} (`rigidbody`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class RigidBodyComponentElement extends ComponentElement {
|
|
@@ -3,10 +3,12 @@ import { Vec3 } from 'playcanvas';
|
|
|
3
3
|
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
6
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-rigid-body/ | `<pc-rigid-body>`} elements.
|
|
7
7
|
* The RigidBodyComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link RigidBodyComponent} (`rigidbody`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class RigidBodyComponentElement extends ComponentElement {
|
|
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.cjs';
|
|
|
7
7
|
* The ScreenComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link ScreenComponent} (`screen`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class ScreenComponentElement extends ComponentElement {
|
|
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.js';
|
|
|
7
7
|
* The ScreenComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link ScreenComponent} (`screen`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class ScreenComponentElement extends ComponentElement {
|
|
@@ -18,10 +18,12 @@ export type ScriptNameChangeEvent = {
|
|
|
18
18
|
} & CustomEvent;
|
|
19
19
|
/**
|
|
20
20
|
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
21
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
21
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-script/ | `<pc-script>`} elements.
|
|
22
22
|
* The ScriptComponentElement interface also inherits the properties and methods of the
|
|
23
23
|
* {@link HTMLElement} interface.
|
|
24
24
|
*
|
|
25
|
+
* Engine component: {@link ScriptComponent} (`script`).
|
|
26
|
+
*
|
|
25
27
|
* @category Components
|
|
26
28
|
*/
|
|
27
29
|
declare class ScriptComponentElement extends ComponentElement {
|
|
@@ -84,24 +86,24 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
84
86
|
*/
|
|
85
87
|
private applyAttributes;
|
|
86
88
|
/**
|
|
87
|
-
* Returns the camelCase keys of the per-property attributes present on a `pc-script`
|
|
89
|
+
* Returns the camelCase keys of the per-property attributes present on a `pc-script-instance`
|
|
88
90
|
* element.
|
|
89
|
-
* @param scriptElement - The `pc-script` element.
|
|
91
|
+
* @param scriptElement - The `pc-script-instance` element.
|
|
90
92
|
* @returns The camelCase keys.
|
|
91
93
|
*/
|
|
92
94
|
private inlineKeys;
|
|
93
95
|
/**
|
|
94
|
-
* Resolves the script instance owned by a `pc-script` element. Returns `null` when the
|
|
96
|
+
* Resolves the script instance owned by a `pc-script-instance` element. Returns `null` when the
|
|
95
97
|
* element has no created script, or when its name resolves to a script created by a
|
|
96
98
|
* different element (e.g. a duplicate-named sibling).
|
|
97
|
-
* @param scriptElement - The `pc-script` element.
|
|
99
|
+
* @param scriptElement - The `pc-script-instance` element.
|
|
98
100
|
* @returns The owned script, or `null`.
|
|
99
101
|
*/
|
|
100
102
|
private scriptFor;
|
|
101
103
|
private handleScriptAttributesChange;
|
|
102
104
|
private handleScriptEnableChange;
|
|
103
105
|
/**
|
|
104
|
-
* Handles a runtime `name` change on a child `pc-script`, swapping the engine script instance
|
|
106
|
+
* Handles a runtime `name` change on a child `pc-script-instance`, swapping the engine script instance
|
|
105
107
|
* to match. Without this the element would keep pointing at the old-name instance: the old
|
|
106
108
|
* script would go on running while every subsequent update (attribute changes, enable
|
|
107
109
|
* changes, destruction on removal) resolved the new name and silently no-opped.
|
|
@@ -112,28 +114,37 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
112
114
|
*/
|
|
113
115
|
private handleScriptNameChange;
|
|
114
116
|
/**
|
|
115
|
-
* Creates the script instance for a `pc-script` element. The instance is created disabled,
|
|
117
|
+
* Creates the script instance for a `pc-script-instance` element. The instance is created disabled,
|
|
116
118
|
* the element's converted attributes are merged over the instance's defaults (which is what
|
|
117
119
|
* allows plain numeric arrays to be typed against those defaults), and only then is the
|
|
118
120
|
* declared enabled state applied — so `initialize()` runs with every attribute in place.
|
|
119
|
-
* @param scriptElement - The `pc-script` element to create the script instance for.
|
|
121
|
+
* @param scriptElement - The `pc-script-instance` element to create the script instance for.
|
|
120
122
|
* @returns The created script, or `null`.
|
|
121
123
|
*/
|
|
122
124
|
private createScript;
|
|
123
125
|
/**
|
|
124
|
-
* Applies
|
|
126
|
+
* Applies a `pc-script-instance` element's declared state to a script instance: the `attributes` JSON
|
|
127
|
+
* first with per-property-shadowed keys stripped, then the per-property attributes — each
|
|
128
|
+
* property is written exactly once and individual attributes win — and finally the declared
|
|
129
|
+
* enabled state, so `initialize()` runs with every attribute in place.
|
|
130
|
+
* @param script - The script instance.
|
|
131
|
+
* @param scriptElement - The `pc-script-instance` element holding the declared state.
|
|
132
|
+
*/
|
|
133
|
+
private applyDeclaredState;
|
|
134
|
+
/**
|
|
135
|
+
* Applies the per-property attributes present on a `pc-script-instance` element — any attribute that
|
|
125
136
|
* is not part of the element's own API or a reserved HTML attribute name. These are applied
|
|
126
137
|
* after the `attributes` JSON, so an individual attribute always takes precedence over the
|
|
127
138
|
* blob.
|
|
128
139
|
* @param script - The script to apply the attributes to.
|
|
129
|
-
* @param scriptElement - The `pc-script` element holding the attributes.
|
|
140
|
+
* @param scriptElement - The `pc-script-instance` element holding the attributes.
|
|
130
141
|
*/
|
|
131
142
|
private applyInlineAttributes;
|
|
132
143
|
/**
|
|
133
|
-
* Applies a single per-property attribute change to the script of a `pc-script` element.
|
|
144
|
+
* Applies a single per-property attribute change to the script of a `pc-script-instance` element.
|
|
134
145
|
* When the attribute has been removed, the value from the `attributes` JSON (if any) takes
|
|
135
146
|
* effect again.
|
|
136
|
-
* @param scriptElement - The `pc-script` element whose attribute changed.
|
|
147
|
+
* @param scriptElement - The `pc-script-instance` element whose attribute changed.
|
|
137
148
|
* @param attributeName - The name of the changed attribute.
|
|
138
149
|
*/
|
|
139
150
|
private applyScriptProperty;
|
|
@@ -18,10 +18,12 @@ export type ScriptNameChangeEvent = {
|
|
|
18
18
|
} & CustomEvent;
|
|
19
19
|
/**
|
|
20
20
|
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
21
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
21
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-script/ | `<pc-script>`} elements.
|
|
22
22
|
* The ScriptComponentElement interface also inherits the properties and methods of the
|
|
23
23
|
* {@link HTMLElement} interface.
|
|
24
24
|
*
|
|
25
|
+
* Engine component: {@link ScriptComponent} (`script`).
|
|
26
|
+
*
|
|
25
27
|
* @category Components
|
|
26
28
|
*/
|
|
27
29
|
declare class ScriptComponentElement extends ComponentElement {
|
|
@@ -84,24 +86,24 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
84
86
|
*/
|
|
85
87
|
private applyAttributes;
|
|
86
88
|
/**
|
|
87
|
-
* Returns the camelCase keys of the per-property attributes present on a `pc-script`
|
|
89
|
+
* Returns the camelCase keys of the per-property attributes present on a `pc-script-instance`
|
|
88
90
|
* element.
|
|
89
|
-
* @param scriptElement - The `pc-script` element.
|
|
91
|
+
* @param scriptElement - The `pc-script-instance` element.
|
|
90
92
|
* @returns The camelCase keys.
|
|
91
93
|
*/
|
|
92
94
|
private inlineKeys;
|
|
93
95
|
/**
|
|
94
|
-
* Resolves the script instance owned by a `pc-script` element. Returns `null` when the
|
|
96
|
+
* Resolves the script instance owned by a `pc-script-instance` element. Returns `null` when the
|
|
95
97
|
* element has no created script, or when its name resolves to a script created by a
|
|
96
98
|
* different element (e.g. a duplicate-named sibling).
|
|
97
|
-
* @param scriptElement - The `pc-script` element.
|
|
99
|
+
* @param scriptElement - The `pc-script-instance` element.
|
|
98
100
|
* @returns The owned script, or `null`.
|
|
99
101
|
*/
|
|
100
102
|
private scriptFor;
|
|
101
103
|
private handleScriptAttributesChange;
|
|
102
104
|
private handleScriptEnableChange;
|
|
103
105
|
/**
|
|
104
|
-
* Handles a runtime `name` change on a child `pc-script`, swapping the engine script instance
|
|
106
|
+
* Handles a runtime `name` change on a child `pc-script-instance`, swapping the engine script instance
|
|
105
107
|
* to match. Without this the element would keep pointing at the old-name instance: the old
|
|
106
108
|
* script would go on running while every subsequent update (attribute changes, enable
|
|
107
109
|
* changes, destruction on removal) resolved the new name and silently no-opped.
|
|
@@ -112,28 +114,37 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
112
114
|
*/
|
|
113
115
|
private handleScriptNameChange;
|
|
114
116
|
/**
|
|
115
|
-
* Creates the script instance for a `pc-script` element. The instance is created disabled,
|
|
117
|
+
* Creates the script instance for a `pc-script-instance` element. The instance is created disabled,
|
|
116
118
|
* the element's converted attributes are merged over the instance's defaults (which is what
|
|
117
119
|
* allows plain numeric arrays to be typed against those defaults), and only then is the
|
|
118
120
|
* declared enabled state applied — so `initialize()` runs with every attribute in place.
|
|
119
|
-
* @param scriptElement - The `pc-script` element to create the script instance for.
|
|
121
|
+
* @param scriptElement - The `pc-script-instance` element to create the script instance for.
|
|
120
122
|
* @returns The created script, or `null`.
|
|
121
123
|
*/
|
|
122
124
|
private createScript;
|
|
123
125
|
/**
|
|
124
|
-
* Applies
|
|
126
|
+
* Applies a `pc-script-instance` element's declared state to a script instance: the `attributes` JSON
|
|
127
|
+
* first with per-property-shadowed keys stripped, then the per-property attributes — each
|
|
128
|
+
* property is written exactly once and individual attributes win — and finally the declared
|
|
129
|
+
* enabled state, so `initialize()` runs with every attribute in place.
|
|
130
|
+
* @param script - The script instance.
|
|
131
|
+
* @param scriptElement - The `pc-script-instance` element holding the declared state.
|
|
132
|
+
*/
|
|
133
|
+
private applyDeclaredState;
|
|
134
|
+
/**
|
|
135
|
+
* Applies the per-property attributes present on a `pc-script-instance` element — any attribute that
|
|
125
136
|
* is not part of the element's own API or a reserved HTML attribute name. These are applied
|
|
126
137
|
* after the `attributes` JSON, so an individual attribute always takes precedence over the
|
|
127
138
|
* blob.
|
|
128
139
|
* @param script - The script to apply the attributes to.
|
|
129
|
-
* @param scriptElement - The `pc-script` element holding the attributes.
|
|
140
|
+
* @param scriptElement - The `pc-script-instance` element holding the attributes.
|
|
130
141
|
*/
|
|
131
142
|
private applyInlineAttributes;
|
|
132
143
|
/**
|
|
133
|
-
* Applies a single per-property attribute change to the script of a `pc-script` element.
|
|
144
|
+
* Applies a single per-property attribute change to the script of a `pc-script-instance` element.
|
|
134
145
|
* When the attribute has been removed, the value from the `attributes` JSON (if any) takes
|
|
135
146
|
* effect again.
|
|
136
|
-
* @param scriptElement - The `pc-script` element whose attribute changed.
|
|
147
|
+
* @param scriptElement - The `pc-script-instance` element whose attribute changed.
|
|
137
148
|
* @param attributeName - The name of the changed attribute.
|
|
138
149
|
*/
|
|
139
150
|
private applyScriptProperty;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Script } from 'playcanvas';
|
|
2
2
|
import { AsyncElement } from '../async-element.cjs';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
5
|
-
* `<pc-script>` elements. The
|
|
4
|
+
* The ScriptInstanceElement interface provides properties and methods for manipulating
|
|
5
|
+
* `<pc-script-instance>` elements. The ScriptInstanceElement interface also inherits the properties and
|
|
6
6
|
* methods of the {@link AsyncElement} interface.
|
|
7
7
|
*
|
|
8
8
|
* Script attributes can be supplied through two channels:
|
|
@@ -24,7 +24,7 @@ import { AsyncElement } from '../async-element.cjs';
|
|
|
24
24
|
* new-name one, re-applying both attribute channels to it.
|
|
25
25
|
*
|
|
26
26
|
* The element becomes ready once its script instance has been created by the parent
|
|
27
|
-
* `<pc-
|
|
27
|
+
* `<pc-script>` element.
|
|
28
28
|
*
|
|
29
29
|
* @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
|
|
30
30
|
* `detail` carries the new `attributes` object. Bubbles.
|
|
@@ -33,7 +33,7 @@ import { AsyncElement } from '../async-element.cjs';
|
|
|
33
33
|
* @fires {CustomEvent} scriptnamechange - Fired when the script is renamed on a live element. The
|
|
34
34
|
* `detail` carries `oldName` and `newName`. Bubbles.
|
|
35
35
|
*/
|
|
36
|
-
declare class
|
|
36
|
+
declare class ScriptInstanceElement extends AsyncElement {
|
|
37
37
|
private _attributes;
|
|
38
38
|
private _enabled;
|
|
39
39
|
/**
|
|
@@ -62,11 +62,11 @@ declare class ScriptElement extends AsyncElement {
|
|
|
62
62
|
get enabled(): boolean;
|
|
63
63
|
/**
|
|
64
64
|
* Sets the name of the script to create. The `name` attribute is the single source of truth
|
|
65
|
-
* (it is what the parent `<pc-
|
|
65
|
+
* (it is what the parent `<pc-script>` element reads when creating the instance), so the
|
|
66
66
|
* property writes through to it — assigning before insertion works as expected:
|
|
67
67
|
*
|
|
68
68
|
* ```js
|
|
69
|
-
* const script = document.createElement('pc-script');
|
|
69
|
+
* const script = document.createElement('pc-script-instance');
|
|
70
70
|
* script.name = 'rotate';
|
|
71
71
|
* scriptsElement.appendChild(script);
|
|
72
72
|
* await script.ready();
|
|
@@ -91,4 +91,4 @@ declare class ScriptElement extends AsyncElement {
|
|
|
91
91
|
static get observedAttributes(): string[];
|
|
92
92
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
93
93
|
}
|
|
94
|
-
export {
|
|
94
|
+
export { ScriptInstanceElement };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Script } from 'playcanvas';
|
|
2
2
|
import { AsyncElement } from '../async-element.js';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
5
|
-
* `<pc-script>` elements. The
|
|
4
|
+
* The ScriptInstanceElement interface provides properties and methods for manipulating
|
|
5
|
+
* `<pc-script-instance>` elements. The ScriptInstanceElement interface also inherits the properties and
|
|
6
6
|
* methods of the {@link AsyncElement} interface.
|
|
7
7
|
*
|
|
8
8
|
* Script attributes can be supplied through two channels:
|
|
@@ -24,7 +24,7 @@ import { AsyncElement } from '../async-element.js';
|
|
|
24
24
|
* new-name one, re-applying both attribute channels to it.
|
|
25
25
|
*
|
|
26
26
|
* The element becomes ready once its script instance has been created by the parent
|
|
27
|
-
* `<pc-
|
|
27
|
+
* `<pc-script>` element.
|
|
28
28
|
*
|
|
29
29
|
* @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
|
|
30
30
|
* `detail` carries the new `attributes` object. Bubbles.
|
|
@@ -33,7 +33,7 @@ import { AsyncElement } from '../async-element.js';
|
|
|
33
33
|
* @fires {CustomEvent} scriptnamechange - Fired when the script is renamed on a live element. The
|
|
34
34
|
* `detail` carries `oldName` and `newName`. Bubbles.
|
|
35
35
|
*/
|
|
36
|
-
declare class
|
|
36
|
+
declare class ScriptInstanceElement extends AsyncElement {
|
|
37
37
|
private _attributes;
|
|
38
38
|
private _enabled;
|
|
39
39
|
/**
|
|
@@ -62,11 +62,11 @@ declare class ScriptElement extends AsyncElement {
|
|
|
62
62
|
get enabled(): boolean;
|
|
63
63
|
/**
|
|
64
64
|
* Sets the name of the script to create. The `name` attribute is the single source of truth
|
|
65
|
-
* (it is what the parent `<pc-
|
|
65
|
+
* (it is what the parent `<pc-script>` element reads when creating the instance), so the
|
|
66
66
|
* property writes through to it — assigning before insertion works as expected:
|
|
67
67
|
*
|
|
68
68
|
* ```js
|
|
69
|
-
* const script = document.createElement('pc-script');
|
|
69
|
+
* const script = document.createElement('pc-script-instance');
|
|
70
70
|
* script.name = 'rotate';
|
|
71
71
|
* scriptsElement.appendChild(script);
|
|
72
72
|
* await script.ready();
|
|
@@ -91,4 +91,4 @@ declare class ScriptElement extends AsyncElement {
|
|
|
91
91
|
static get observedAttributes(): string[];
|
|
92
92
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
93
93
|
}
|
|
94
|
-
export {
|
|
94
|
+
export { ScriptInstanceElement };
|
|
@@ -3,10 +3,12 @@ import { Vec2 } from 'playcanvas';
|
|
|
3
3
|
import { ComponentElement } from './component.cjs';
|
|
4
4
|
/**
|
|
5
5
|
* The ScrollViewComponentElement interface provides properties and methods for manipulating
|
|
6
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scroll-view/ | `<pc-scroll-view>`} elements.
|
|
7
7
|
* The ScrollViewComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link ScrollViewComponent} (`scrollview`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class ScrollViewComponentElement extends ComponentElement {
|
|
@@ -3,10 +3,12 @@ import { Vec2 } from 'playcanvas';
|
|
|
3
3
|
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The ScrollViewComponentElement interface provides properties and methods for manipulating
|
|
6
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scroll-view/ | `<pc-scroll-view>`} elements.
|
|
7
7
|
* The ScrollViewComponentElement interface also inherits the properties and methods of the
|
|
8
8
|
* {@link HTMLElement} interface.
|
|
9
9
|
*
|
|
10
|
+
* Engine component: {@link ScrollViewComponent} (`scrollview`).
|
|
11
|
+
*
|
|
10
12
|
* @category Components
|
|
11
13
|
*/
|
|
12
14
|
declare class ScrollViewComponentElement extends ComponentElement {
|
|
@@ -6,6 +6,8 @@ import { ComponentElement } from './component.cjs';
|
|
|
6
6
|
* The ScrollbarComponentElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
8
|
*
|
|
9
|
+
* Engine component: {@link ScrollbarComponent} (`scrollbar`).
|
|
10
|
+
*
|
|
9
11
|
* @category Components
|
|
10
12
|
*/
|
|
11
13
|
declare class ScrollbarComponentElement extends ComponentElement {
|
|
@@ -6,6 +6,8 @@ import { ComponentElement } from './component.js';
|
|
|
6
6
|
* The ScrollbarComponentElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
8
|
*
|
|
9
|
+
* Engine component: {@link ScrollbarComponent} (`scrollbar`).
|
|
10
|
+
*
|
|
9
11
|
* @category Components
|
|
10
12
|
*/
|
|
11
13
|
declare class ScrollbarComponentElement extends ComponentElement {
|
|
@@ -2,10 +2,12 @@ import type { SoundComponent } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component.cjs';
|
|
3
3
|
/**
|
|
4
4
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-sound/ | `<pc-sound>`} elements.
|
|
6
6
|
* The SoundComponentElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
8
|
*
|
|
9
|
+
* Engine component: {@link SoundComponent} (`sound`).
|
|
10
|
+
*
|
|
9
11
|
* @category Components
|
|
10
12
|
*/
|
|
11
13
|
declare class SoundComponentElement extends ComponentElement {
|
|
@@ -2,10 +2,12 @@ import type { SoundComponent } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component.js';
|
|
3
3
|
/**
|
|
4
4
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-sound/ | `<pc-sound>`} elements.
|
|
6
6
|
* The SoundComponentElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
8
|
*
|
|
9
|
+
* Engine component: {@link SoundComponent} (`sound`).
|
|
10
|
+
*
|
|
9
11
|
* @category Components
|
|
10
12
|
*/
|
|
11
13
|
declare class SoundComponentElement extends ComponentElement {
|
|
@@ -3,7 +3,7 @@ import { AsyncElement } from '../async-element.cjs';
|
|
|
3
3
|
import { SoundComponentElement } from './sound-component.cjs';
|
|
4
4
|
/**
|
|
5
5
|
* The SoundSlotElement interface provides properties and methods for manipulating
|
|
6
|
-
* `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
|
|
6
|
+
* `<pc-sound-slot>` elements. The SoundSlotElement interface also inherits the properties and
|
|
7
7
|
* methods of the {@link AsyncElement} interface.
|
|
8
8
|
*/
|
|
9
9
|
declare class SoundSlotElement extends AsyncElement {
|
|
@@ -17,7 +17,7 @@ declare class SoundSlotElement extends AsyncElement {
|
|
|
17
17
|
private _startTime;
|
|
18
18
|
private _volume;
|
|
19
19
|
/**
|
|
20
|
-
* The `<pc-
|
|
20
|
+
* The `<pc-sound>` this slot was added to, captured at connect time.
|
|
21
21
|
*
|
|
22
22
|
* `disconnectedCallback` cannot rediscover it: by the time the element is disconnected its
|
|
23
23
|
* `parentElement` is already `null`, so a lookup would both fail to find the component and
|
|
@@ -3,7 +3,7 @@ import { AsyncElement } from '../async-element.js';
|
|
|
3
3
|
import { SoundComponentElement } from './sound-component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The SoundSlotElement interface provides properties and methods for manipulating
|
|
6
|
-
* `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
|
|
6
|
+
* `<pc-sound-slot>` elements. The SoundSlotElement interface also inherits the properties and
|
|
7
7
|
* methods of the {@link AsyncElement} interface.
|
|
8
8
|
*/
|
|
9
9
|
declare class SoundSlotElement extends AsyncElement {
|
|
@@ -17,7 +17,7 @@ declare class SoundSlotElement extends AsyncElement {
|
|
|
17
17
|
private _startTime;
|
|
18
18
|
private _volume;
|
|
19
19
|
/**
|
|
20
|
-
* The `<pc-
|
|
20
|
+
* The `<pc-sound>` this slot was added to, captured at connect time.
|
|
21
21
|
*
|
|
22
22
|
* `disconnectedCallback` cannot rediscover it: by the time the element is disconnected its
|
|
23
23
|
* `parentElement` is already `null`, so a lookup would both fail to find the component and
|