@playcanvas/web-components 0.16.0 → 0.18.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.
Files changed (126) hide show
  1. package/README.md +5 -3
  2. package/dist/app.d.cts +18 -13
  3. package/dist/app.d.ts +18 -13
  4. package/dist/asset.d.cts +13 -3
  5. package/dist/asset.d.ts +13 -3
  6. package/dist/async-element.d.cts +13 -13
  7. package/dist/async-element.d.ts +13 -13
  8. package/dist/components/anim-clip.d.cts +4 -0
  9. package/dist/components/anim-clip.d.ts +4 -0
  10. package/dist/components/anim-component.d.cts +38 -5
  11. package/dist/components/anim-component.d.ts +38 -5
  12. package/dist/components/audio-listener-component.d.cts +26 -0
  13. package/dist/components/audio-listener-component.d.ts +26 -0
  14. package/dist/components/button-component.d.cts +10 -1
  15. package/dist/components/button-component.d.ts +10 -1
  16. package/dist/components/camera-component.d.cts +37 -1
  17. package/dist/components/camera-component.d.ts +37 -1
  18. package/dist/components/collision-component.d.cts +9 -1
  19. package/dist/components/collision-component.d.ts +9 -1
  20. package/dist/components/component.d.cts +3 -2
  21. package/dist/components/component.d.ts +3 -2
  22. package/dist/components/element-component.d.cts +11 -0
  23. package/dist/components/element-component.d.ts +11 -0
  24. package/dist/components/gsplat-component.d.cts +6 -0
  25. package/dist/components/gsplat-component.d.ts +6 -0
  26. package/dist/components/joint-component.d.cts +14 -2
  27. package/dist/components/joint-component.d.ts +14 -2
  28. package/dist/components/{layoutchild-component.d.cts → layout-child-component.d.cts} +7 -1
  29. package/dist/components/{layoutchild-component.d.ts → layout-child-component.d.ts} +7 -1
  30. package/dist/components/{layoutgroup-component.d.cts → layout-group-component.d.cts} +7 -1
  31. package/dist/components/{layoutgroup-component.d.ts → layout-group-component.d.ts} +7 -1
  32. package/dist/components/light-component.d.cts +52 -1
  33. package/dist/components/light-component.d.ts +52 -1
  34. package/dist/components/{particlesystem-component.d.cts → particle-system-component.d.cts} +7 -1
  35. package/dist/components/{particlesystem-component.d.ts → particle-system-component.d.ts} +7 -1
  36. package/dist/components/render-component.d.cts +7 -0
  37. package/dist/components/render-component.d.ts +7 -0
  38. package/dist/components/{rigidbody-component.d.cts → rigid-body-component.d.cts} +8 -1
  39. package/dist/components/{rigidbody-component.d.ts → rigid-body-component.d.ts} +8 -1
  40. package/dist/components/screen-component.d.cts +6 -0
  41. package/dist/components/screen-component.d.ts +6 -0
  42. package/dist/components/script-component.d.cts +26 -12
  43. package/dist/components/script-component.d.ts +26 -12
  44. package/dist/components/{script.d.cts → script-instance.d.cts} +11 -7
  45. package/dist/components/{script.d.ts → script-instance.d.ts} +11 -7
  46. package/dist/components/{scrollview-component.d.cts → scroll-view-component.d.cts} +7 -1
  47. package/dist/components/{scrollview-component.d.ts → scroll-view-component.d.ts} +7 -1
  48. package/dist/components/scrollbar-component.d.cts +6 -0
  49. package/dist/components/scrollbar-component.d.ts +6 -0
  50. package/dist/components/sound-component.d.cts +7 -1
  51. package/dist/components/sound-component.d.ts +7 -1
  52. package/dist/components/sound-slot.d.cts +5 -2
  53. package/dist/components/sound-slot.d.ts +5 -2
  54. package/dist/custom-elements.json +1852 -974
  55. package/dist/entity-base.d.cts +7 -6
  56. package/dist/entity-base.d.ts +7 -6
  57. package/dist/entity-owner.d.cts +118 -0
  58. package/dist/entity-owner.d.ts +118 -0
  59. package/dist/entity.d.cts +14 -102
  60. package/dist/entity.d.ts +14 -102
  61. package/dist/index.d.cts +26 -22
  62. package/dist/index.d.ts +26 -22
  63. package/dist/material.d.cts +18 -7
  64. package/dist/material.d.ts +18 -7
  65. package/dist/model.d.cts +72 -24
  66. package/dist/model.d.ts +72 -24
  67. package/dist/node.d.cts +6 -1
  68. package/dist/node.d.ts +6 -1
  69. package/dist/pwc.cjs +807 -293
  70. package/dist/pwc.cjs.map +1 -1
  71. package/dist/pwc.js +807 -293
  72. package/dist/pwc.js.map +1 -1
  73. package/dist/pwc.min.js +1 -1
  74. package/dist/pwc.min.js.map +1 -1
  75. package/dist/pwc.min.mjs +1 -1
  76. package/dist/pwc.min.mjs.map +1 -1
  77. package/dist/pwc.mjs +805 -292
  78. package/dist/pwc.mjs.map +1 -1
  79. package/dist/scene.d.cts +3 -0
  80. package/dist/scene.d.ts +3 -0
  81. package/dist/sky.d.cts +4 -0
  82. package/dist/sky.d.ts +4 -0
  83. package/dist/vscode.html-custom-data.json +351 -121
  84. package/dist/{module.d.cts → wasm.d.cts} +10 -6
  85. package/dist/{module.d.ts → wasm.d.ts} +10 -6
  86. package/dist/web-types.json +465 -291
  87. package/package.json +7 -7
  88. package/src/app.ts +49 -35
  89. package/src/asset.ts +13 -4
  90. package/src/async-element.ts +14 -14
  91. package/src/components/anim-clip.ts +4 -0
  92. package/src/components/anim-component.ts +89 -14
  93. package/src/components/audio-listener-component.ts +36 -0
  94. package/src/components/button-component.ts +10 -1
  95. package/src/components/camera-component.ts +65 -6
  96. package/src/components/collision-component.ts +9 -1
  97. package/src/components/component.ts +4 -3
  98. package/src/components/element-component.ts +11 -0
  99. package/src/components/gsplat-component.ts +6 -0
  100. package/src/components/joint-component.ts +14 -2
  101. package/src/components/{layoutchild-component.ts → layout-child-component.ts} +8 -2
  102. package/src/components/{layoutgroup-component.ts → layout-group-component.ts} +8 -2
  103. package/src/components/light-component.ts +110 -17
  104. package/src/components/{particlesystem-component.ts → particle-system-component.ts} +8 -2
  105. package/src/components/render-component.ts +7 -0
  106. package/src/components/{rigidbody-component.ts → rigid-body-component.ts} +9 -2
  107. package/src/components/screen-component.ts +6 -0
  108. package/src/components/script-component.ts +66 -42
  109. package/src/components/{script.ts → script-instance.ts} +18 -14
  110. package/src/components/{scrollview-component.ts → scroll-view-component.ts} +8 -2
  111. package/src/components/scrollbar-component.ts +6 -0
  112. package/src/components/sound-component.ts +8 -2
  113. package/src/components/sound-slot.ts +7 -4
  114. package/src/entity-base.ts +8 -7
  115. package/src/entity-owner.ts +298 -0
  116. package/src/entity.ts +21 -271
  117. package/src/index.ts +38 -25
  118. package/src/material.ts +19 -8
  119. package/src/model.ts +164 -72
  120. package/src/node.ts +15 -6
  121. package/src/scene.ts +3 -0
  122. package/src/sky.ts +4 -0
  123. package/src/{module.ts → wasm.ts} +12 -8
  124. package/dist/components/listener-component.d.cts +0 -20
  125. package/dist/components/listener-component.d.ts +0 -20
  126. package/src/components/listener-component.ts +0 -30
@@ -2,10 +2,16 @@ 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-particles/ | `<pc-particles>`} elements.
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
+ *
11
+ * @elementSummary The `<pc-particle-system>` element emits particles from its entity, with
12
+ * attributes for the emitter's shape, rate, lifetime, textures and blending. Must be a child of a
13
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
9
15
  * @category Components
10
16
  */
11
17
  declare class ParticleSystemComponentElement extends ComponentElement {
@@ -10,6 +10,13 @@ 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
+ *
15
+ * @elementSummary The `<pc-render>` element renders one of the engine's built-in primitives at its
16
+ * entity — box, sphere, capsule, cone, cylinder or plane — shaded by the `<pc-material>` its
17
+ * `material` attribute names. For glTF content, use `<pc-model>` instead. Must be a child of a
18
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
19
+ *
13
20
  * @category Components
14
21
  */
15
22
  declare class RenderComponentElement extends ComponentElement {
@@ -10,6 +10,13 @@ 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
+ *
15
+ * @elementSummary The `<pc-render>` element renders one of the engine's built-in primitives at its
16
+ * entity — box, sphere, capsule, cone, cylinder or plane — shaded by the `<pc-material>` its
17
+ * `material` attribute names. For glTF content, use `<pc-model>` instead. Must be a child of a
18
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
19
+ *
13
20
  * @category Components
14
21
  */
15
22
  declare class RenderComponentElement extends ComponentElement {
@@ -3,10 +3,17 @@ 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-rigidbody/ | `<pc-rigidbody>`} elements.
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
+ *
12
+ * @elementSummary The `<pc-rigid-body>` element hands its entity to the physics simulation, with
13
+ * attributes for its type, mass, friction and restitution. It needs a sibling `<pc-collision>` for
14
+ * its shape, and `Ammo` loaded through `<pc-wasm>`. Must be a child of a `<pc-entity>`,
15
+ * `<pc-model>` or `<pc-node>`.
16
+ *
10
17
  * @category Components
11
18
  */
12
19
  declare class RigidBodyComponentElement extends ComponentElement {
@@ -3,10 +3,17 @@ 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-rigidbody/ | `<pc-rigidbody>`} elements.
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
+ *
12
+ * @elementSummary The `<pc-rigid-body>` element hands its entity to the physics simulation, with
13
+ * attributes for its type, mass, friction and restitution. It needs a sibling `<pc-collision>` for
14
+ * its shape, and `Ammo` loaded through `<pc-wasm>`. Must be a child of a `<pc-entity>`,
15
+ * `<pc-model>` or `<pc-node>`.
16
+ *
10
17
  * @category Components
11
18
  */
12
19
  declare class RigidBodyComponentElement extends ComponentElement {
@@ -7,6 +7,12 @@ 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
+ *
12
+ * @elementSummary The `<pc-screen>` element gives its entity a 2D space — in screen space or in the
13
+ * world — that a hierarchy of `<pc-element>` descendants lays out inside. Must be a child of a
14
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
10
16
  * @category Components
11
17
  */
12
18
  declare class ScreenComponentElement extends ComponentElement {
@@ -7,6 +7,12 @@ 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
+ *
12
+ * @elementSummary The `<pc-screen>` element gives its entity a 2D space — in screen space or in the
13
+ * world — that a hierarchy of `<pc-element>` descendants lays out inside. Must be a child of a
14
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
10
16
  * @category Components
11
17
  */
12
18
  declare class ScreenComponentElement extends ComponentElement {
@@ -18,10 +18,15 @@ 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-scripts/ | `<pc-scripts>`} elements.
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
+ *
27
+ * @elementSummary The `<pc-script>` element holds the `<pc-script-instance>` children that attach
28
+ * scripts to its entity. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
29
+ *
25
30
  * @category Components
26
31
  */
27
32
  declare class ScriptComponentElement extends ComponentElement {
@@ -84,24 +89,24 @@ declare class ScriptComponentElement extends ComponentElement {
84
89
  */
85
90
  private applyAttributes;
86
91
  /**
87
- * Returns the camelCase keys of the per-property attributes present on a `pc-script`
92
+ * Returns the camelCase keys of the per-property attributes present on a `pc-script-instance`
88
93
  * element.
89
- * @param scriptElement - The `pc-script` element.
94
+ * @param scriptElement - The `pc-script-instance` element.
90
95
  * @returns The camelCase keys.
91
96
  */
92
97
  private inlineKeys;
93
98
  /**
94
- * Resolves the script instance owned by a `pc-script` element. Returns `null` when the
99
+ * Resolves the script instance owned by a `pc-script-instance` element. Returns `null` when the
95
100
  * element has no created script, or when its name resolves to a script created by a
96
101
  * different element (e.g. a duplicate-named sibling).
97
- * @param scriptElement - The `pc-script` element.
102
+ * @param scriptElement - The `pc-script-instance` element.
98
103
  * @returns The owned script, or `null`.
99
104
  */
100
105
  private scriptFor;
101
106
  private handleScriptAttributesChange;
102
107
  private handleScriptEnableChange;
103
108
  /**
104
- * Handles a runtime `name` change on a child `pc-script`, swapping the engine script instance
109
+ * Handles a runtime `name` change on a child `pc-script-instance`, swapping the engine script instance
105
110
  * to match. Without this the element would keep pointing at the old-name instance: the old
106
111
  * script would go on running while every subsequent update (attribute changes, enable
107
112
  * changes, destruction on removal) resolved the new name and silently no-opped.
@@ -112,28 +117,37 @@ declare class ScriptComponentElement extends ComponentElement {
112
117
  */
113
118
  private handleScriptNameChange;
114
119
  /**
115
- * Creates the script instance for a `pc-script` element. The instance is created disabled,
120
+ * Creates the script instance for a `pc-script-instance` element. The instance is created disabled,
116
121
  * the element's converted attributes are merged over the instance's defaults (which is what
117
122
  * allows plain numeric arrays to be typed against those defaults), and only then is the
118
123
  * 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.
124
+ * @param scriptElement - The `pc-script-instance` element to create the script instance for.
120
125
  * @returns The created script, or `null`.
121
126
  */
122
127
  private createScript;
123
128
  /**
124
- * Applies the per-property attributes present on a `pc-script` element any attribute that
129
+ * Applies a `pc-script-instance` element's declared state to a script instance: the `attributes` JSON
130
+ * first with per-property-shadowed keys stripped, then the per-property attributes — each
131
+ * property is written exactly once and individual attributes win — and finally the declared
132
+ * enabled state, so `initialize()` runs with every attribute in place.
133
+ * @param script - The script instance.
134
+ * @param scriptElement - The `pc-script-instance` element holding the declared state.
135
+ */
136
+ private applyDeclaredState;
137
+ /**
138
+ * Applies the per-property attributes present on a `pc-script-instance` element — any attribute that
125
139
  * is not part of the element's own API or a reserved HTML attribute name. These are applied
126
140
  * after the `attributes` JSON, so an individual attribute always takes precedence over the
127
141
  * blob.
128
142
  * @param script - The script to apply the attributes to.
129
- * @param scriptElement - The `pc-script` element holding the attributes.
143
+ * @param scriptElement - The `pc-script-instance` element holding the attributes.
130
144
  */
131
145
  private applyInlineAttributes;
132
146
  /**
133
- * Applies a single per-property attribute change to the script of a `pc-script` element.
147
+ * Applies a single per-property attribute change to the script of a `pc-script-instance` element.
134
148
  * When the attribute has been removed, the value from the `attributes` JSON (if any) takes
135
149
  * effect again.
136
- * @param scriptElement - The `pc-script` element whose attribute changed.
150
+ * @param scriptElement - The `pc-script-instance` element whose attribute changed.
137
151
  * @param attributeName - The name of the changed attribute.
138
152
  */
139
153
  private applyScriptProperty;
@@ -18,10 +18,15 @@ 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-scripts/ | `<pc-scripts>`} elements.
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
+ *
27
+ * @elementSummary The `<pc-script>` element holds the `<pc-script-instance>` children that attach
28
+ * scripts to its entity. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
29
+ *
25
30
  * @category Components
26
31
  */
27
32
  declare class ScriptComponentElement extends ComponentElement {
@@ -84,24 +89,24 @@ declare class ScriptComponentElement extends ComponentElement {
84
89
  */
85
90
  private applyAttributes;
86
91
  /**
87
- * Returns the camelCase keys of the per-property attributes present on a `pc-script`
92
+ * Returns the camelCase keys of the per-property attributes present on a `pc-script-instance`
88
93
  * element.
89
- * @param scriptElement - The `pc-script` element.
94
+ * @param scriptElement - The `pc-script-instance` element.
90
95
  * @returns The camelCase keys.
91
96
  */
92
97
  private inlineKeys;
93
98
  /**
94
- * Resolves the script instance owned by a `pc-script` element. Returns `null` when the
99
+ * Resolves the script instance owned by a `pc-script-instance` element. Returns `null` when the
95
100
  * element has no created script, or when its name resolves to a script created by a
96
101
  * different element (e.g. a duplicate-named sibling).
97
- * @param scriptElement - The `pc-script` element.
102
+ * @param scriptElement - The `pc-script-instance` element.
98
103
  * @returns The owned script, or `null`.
99
104
  */
100
105
  private scriptFor;
101
106
  private handleScriptAttributesChange;
102
107
  private handleScriptEnableChange;
103
108
  /**
104
- * Handles a runtime `name` change on a child `pc-script`, swapping the engine script instance
109
+ * Handles a runtime `name` change on a child `pc-script-instance`, swapping the engine script instance
105
110
  * to match. Without this the element would keep pointing at the old-name instance: the old
106
111
  * script would go on running while every subsequent update (attribute changes, enable
107
112
  * changes, destruction on removal) resolved the new name and silently no-opped.
@@ -112,28 +117,37 @@ declare class ScriptComponentElement extends ComponentElement {
112
117
  */
113
118
  private handleScriptNameChange;
114
119
  /**
115
- * Creates the script instance for a `pc-script` element. The instance is created disabled,
120
+ * Creates the script instance for a `pc-script-instance` element. The instance is created disabled,
116
121
  * the element's converted attributes are merged over the instance's defaults (which is what
117
122
  * allows plain numeric arrays to be typed against those defaults), and only then is the
118
123
  * 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.
124
+ * @param scriptElement - The `pc-script-instance` element to create the script instance for.
120
125
  * @returns The created script, or `null`.
121
126
  */
122
127
  private createScript;
123
128
  /**
124
- * Applies the per-property attributes present on a `pc-script` element any attribute that
129
+ * Applies a `pc-script-instance` element's declared state to a script instance: the `attributes` JSON
130
+ * first with per-property-shadowed keys stripped, then the per-property attributes — each
131
+ * property is written exactly once and individual attributes win — and finally the declared
132
+ * enabled state, so `initialize()` runs with every attribute in place.
133
+ * @param script - The script instance.
134
+ * @param scriptElement - The `pc-script-instance` element holding the declared state.
135
+ */
136
+ private applyDeclaredState;
137
+ /**
138
+ * Applies the per-property attributes present on a `pc-script-instance` element — any attribute that
125
139
  * is not part of the element's own API or a reserved HTML attribute name. These are applied
126
140
  * after the `attributes` JSON, so an individual attribute always takes precedence over the
127
141
  * blob.
128
142
  * @param script - The script to apply the attributes to.
129
- * @param scriptElement - The `pc-script` element holding the attributes.
143
+ * @param scriptElement - The `pc-script-instance` element holding the attributes.
130
144
  */
131
145
  private applyInlineAttributes;
132
146
  /**
133
- * Applies a single per-property attribute change to the script of a `pc-script` element.
147
+ * Applies a single per-property attribute change to the script of a `pc-script-instance` element.
134
148
  * When the attribute has been removed, the value from the `attributes` JSON (if any) takes
135
149
  * effect again.
136
- * @param scriptElement - The `pc-script` element whose attribute changed.
150
+ * @param scriptElement - The `pc-script-instance` element whose attribute changed.
137
151
  * @param attributeName - The name of the changed attribute.
138
152
  */
139
153
  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 ScriptElement interface provides properties and methods for manipulating
5
- * `<pc-script>` elements. The ScriptElement interface also inherits the properties and
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,11 @@ 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-scripts>` element.
27
+ * `<pc-script>` element.
28
+ *
29
+ * @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
30
+ * 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. Must be a direct child of `<pc-script>`.
28
32
  *
29
33
  * @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
30
34
  * `detail` carries the new `attributes` object. Bubbles.
@@ -33,7 +37,7 @@ import { AsyncElement } from '../async-element.cjs';
33
37
  * @fires {CustomEvent} scriptnamechange - Fired when the script is renamed on a live element. The
34
38
  * `detail` carries `oldName` and `newName`. Bubbles.
35
39
  */
36
- declare class ScriptElement extends AsyncElement {
40
+ declare class ScriptInstanceElement extends AsyncElement {
37
41
  private _attributes;
38
42
  private _enabled;
39
43
  /**
@@ -62,11 +66,11 @@ declare class ScriptElement extends AsyncElement {
62
66
  get enabled(): boolean;
63
67
  /**
64
68
  * Sets the name of the script to create. The `name` attribute is the single source of truth
65
- * (it is what the parent `<pc-scripts>` element reads when creating the instance), so the
69
+ * (it is what the parent `<pc-script>` element reads when creating the instance), so the
66
70
  * property writes through to it — assigning before insertion works as expected:
67
71
  *
68
72
  * ```js
69
- * const script = document.createElement('pc-script');
73
+ * const script = document.createElement('pc-script-instance');
70
74
  * script.name = 'rotate';
71
75
  * scriptsElement.appendChild(script);
72
76
  * await script.ready();
@@ -91,4 +95,4 @@ declare class ScriptElement extends AsyncElement {
91
95
  static get observedAttributes(): string[];
92
96
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
93
97
  }
94
- export { ScriptElement };
98
+ 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 ScriptElement interface provides properties and methods for manipulating
5
- * `<pc-script>` elements. The ScriptElement interface also inherits the properties and
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,11 @@ 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-scripts>` element.
27
+ * `<pc-script>` element.
28
+ *
29
+ * @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
30
+ * 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. Must be a direct child of `<pc-script>`.
28
32
  *
29
33
  * @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
30
34
  * `detail` carries the new `attributes` object. Bubbles.
@@ -33,7 +37,7 @@ import { AsyncElement } from '../async-element.js';
33
37
  * @fires {CustomEvent} scriptnamechange - Fired when the script is renamed on a live element. The
34
38
  * `detail` carries `oldName` and `newName`. Bubbles.
35
39
  */
36
- declare class ScriptElement extends AsyncElement {
40
+ declare class ScriptInstanceElement extends AsyncElement {
37
41
  private _attributes;
38
42
  private _enabled;
39
43
  /**
@@ -62,11 +66,11 @@ declare class ScriptElement extends AsyncElement {
62
66
  get enabled(): boolean;
63
67
  /**
64
68
  * Sets the name of the script to create. The `name` attribute is the single source of truth
65
- * (it is what the parent `<pc-scripts>` element reads when creating the instance), so the
69
+ * (it is what the parent `<pc-script>` element reads when creating the instance), so the
66
70
  * property writes through to it — assigning before insertion works as expected:
67
71
  *
68
72
  * ```js
69
- * const script = document.createElement('pc-script');
73
+ * const script = document.createElement('pc-script-instance');
70
74
  * script.name = 'rotate';
71
75
  * scriptsElement.appendChild(script);
72
76
  * await script.ready();
@@ -91,4 +95,4 @@ declare class ScriptElement extends AsyncElement {
91
95
  static get observedAttributes(): string[];
92
96
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
93
97
  }
94
- export { ScriptElement };
98
+ export { ScriptInstanceElement };
@@ -3,10 +3,16 @@ 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-scrollview/ | `<pc-scrollview>`} elements.
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
+ *
12
+ * @elementSummary The `<pc-scroll-view>` element scrolls a larger content entity within a clipped
13
+ * viewport at its entity, optionally driven by the `<pc-scrollbar>` elements it references. Must be
14
+ * a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
10
16
  * @category Components
11
17
  */
12
18
  declare class ScrollViewComponentElement extends ComponentElement {
@@ -3,10 +3,16 @@ 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-scrollview/ | `<pc-scrollview>`} elements.
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
+ *
12
+ * @elementSummary The `<pc-scroll-view>` element scrolls a larger content entity within a clipped
13
+ * viewport at its entity, optionally driven by the `<pc-scrollbar>` elements it references. Must be
14
+ * a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
10
16
  * @category Components
11
17
  */
12
18
  declare class ScrollViewComponentElement extends ComponentElement {
@@ -6,6 +6,12 @@ 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
+ *
11
+ * @elementSummary The `<pc-scrollbar>` element gives its entity a draggable handle reporting a
12
+ * position from 0 to 1, which a `<pc-scroll-view>` references to scroll its content. Must be a
13
+ * child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
9
15
  * @category Components
10
16
  */
11
17
  declare class ScrollbarComponentElement extends ComponentElement {
@@ -6,6 +6,12 @@ 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
+ *
11
+ * @elementSummary The `<pc-scrollbar>` element gives its entity a draggable handle reporting a
12
+ * position from 0 to 1, which a `<pc-scroll-view>` references to scroll its content. Must be a
13
+ * child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
9
15
  * @category Components
10
16
  */
11
17
  declare class ScrollbarComponentElement extends ComponentElement {
@@ -2,10 +2,16 @@ 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-sounds/ | `<pc-sounds>`} elements.
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
+ *
11
+ * @elementSummary The `<pc-sound>` element holds the `<pc-sound-slot>` children that play sounds at
12
+ * its entity, along with the positional audio settings they share. Must be a child of a
13
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
9
15
  * @category Components
10
16
  */
11
17
  declare class SoundComponentElement extends ComponentElement {
@@ -2,10 +2,16 @@ 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-sounds/ | `<pc-sounds>`} elements.
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
+ *
11
+ * @elementSummary The `<pc-sound>` element holds the `<pc-sound-slot>` children that play sounds at
12
+ * its entity, along with the positional audio settings they share. Must be a child of a
13
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
9
15
  * @category Components
10
16
  */
11
17
  declare class SoundComponentElement extends ComponentElement {
@@ -3,8 +3,11 @@ 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
+ *
9
+ * @elementSummary The `<pc-sound-slot>` element declares one named sound on its parent `<pc-sound>`
10
+ * — its asset, volume, pitch, looping and autoplay. Must be a direct child of `<pc-sound>`.
8
11
  */
9
12
  declare class SoundSlotElement extends AsyncElement {
10
13
  private _asset;
@@ -17,7 +20,7 @@ declare class SoundSlotElement extends AsyncElement {
17
20
  private _startTime;
18
21
  private _volume;
19
22
  /**
20
- * The `<pc-sounds>` this slot was added to, captured at connect time.
23
+ * The `<pc-sound>` this slot was added to, captured at connect time.
21
24
  *
22
25
  * `disconnectedCallback` cannot rediscover it: by the time the element is disconnected its
23
26
  * `parentElement` is already `null`, so a lookup would both fail to find the component and
@@ -3,8 +3,11 @@ 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
+ *
9
+ * @elementSummary The `<pc-sound-slot>` element declares one named sound on its parent `<pc-sound>`
10
+ * — its asset, volume, pitch, looping and autoplay. Must be a direct child of `<pc-sound>`.
8
11
  */
9
12
  declare class SoundSlotElement extends AsyncElement {
10
13
  private _asset;
@@ -17,7 +20,7 @@ declare class SoundSlotElement extends AsyncElement {
17
20
  private _startTime;
18
21
  private _volume;
19
22
  /**
20
- * The `<pc-sounds>` this slot was added to, captured at connect time.
23
+ * The `<pc-sound>` this slot was added to, captured at connect time.
21
24
  *
22
25
  * `disconnectedCallback` cannot rediscover it: by the time the element is disconnected its
23
26
  * `parentElement` is already `null`, so a lookup would both fail to find the component and