@playcanvas/web-components 0.15.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.
Files changed (108) hide show
  1. package/dist/app.d.cts +14 -13
  2. package/dist/app.d.ts +14 -13
  3. package/dist/async-element.d.cts +13 -13
  4. package/dist/async-element.d.ts +13 -13
  5. package/dist/components/anim-clip.d.cts +127 -0
  6. package/dist/components/anim-clip.d.ts +127 -0
  7. package/dist/components/anim-component.d.cts +235 -0
  8. package/dist/components/anim-component.d.ts +235 -0
  9. package/dist/components/{listener-component.d.cts → audio-listener-component.d.cts} +7 -5
  10. package/dist/components/{listener-component.d.ts → audio-listener-component.d.ts} +7 -5
  11. package/dist/components/button-component.d.cts +5 -1
  12. package/dist/components/button-component.d.ts +5 -1
  13. package/dist/components/camera-component.d.cts +2 -0
  14. package/dist/components/camera-component.d.ts +2 -0
  15. package/dist/components/collision-component.d.cts +5 -1
  16. package/dist/components/collision-component.d.ts +5 -1
  17. package/dist/components/component.d.cts +3 -2
  18. package/dist/components/component.d.ts +3 -2
  19. package/dist/components/element-component.d.cts +7 -0
  20. package/dist/components/element-component.d.ts +7 -0
  21. package/dist/components/gsplat-component.d.cts +2 -0
  22. package/dist/components/gsplat-component.d.ts +2 -0
  23. package/dist/components/joint-component.d.cts +2 -0
  24. package/dist/components/joint-component.d.ts +2 -0
  25. package/dist/components/{layoutchild-component.d.cts → layout-child-component.d.cts} +3 -1
  26. package/dist/components/{layoutchild-component.d.ts → layout-child-component.d.ts} +3 -1
  27. package/dist/components/{layoutgroup-component.d.cts → layout-group-component.d.cts} +3 -1
  28. package/dist/components/{layoutgroup-component.d.ts → layout-group-component.d.ts} +3 -1
  29. package/dist/components/light-component.d.cts +2 -0
  30. package/dist/components/light-component.d.ts +2 -0
  31. package/dist/components/{particlesystem-component.d.cts → particle-system-component.d.cts} +3 -1
  32. package/dist/components/{particlesystem-component.d.ts → particle-system-component.d.ts} +3 -1
  33. package/dist/components/render-component.d.cts +2 -0
  34. package/dist/components/render-component.d.ts +2 -0
  35. package/dist/components/{rigidbody-component.d.cts → rigid-body-component.d.cts} +3 -1
  36. package/dist/components/{rigidbody-component.d.ts → rigid-body-component.d.ts} +3 -1
  37. package/dist/components/screen-component.d.cts +2 -0
  38. package/dist/components/screen-component.d.ts +2 -0
  39. package/dist/components/script-component.d.cts +23 -12
  40. package/dist/components/script-component.d.ts +23 -12
  41. package/dist/components/{script.d.cts → script-instance.d.cts} +7 -7
  42. package/dist/components/{script.d.ts → script-instance.d.ts} +7 -7
  43. package/dist/components/{scrollview-component.d.cts → scroll-view-component.d.cts} +3 -1
  44. package/dist/components/{scrollview-component.d.ts → scroll-view-component.d.ts} +3 -1
  45. package/dist/components/scrollbar-component.d.cts +2 -0
  46. package/dist/components/scrollbar-component.d.ts +2 -0
  47. package/dist/components/sound-component.d.cts +3 -1
  48. package/dist/components/sound-component.d.ts +3 -1
  49. package/dist/components/sound-slot.d.cts +2 -2
  50. package/dist/components/sound-slot.d.ts +2 -2
  51. package/dist/custom-elements.json +3154 -2005
  52. package/dist/entity-base.d.cts +6 -5
  53. package/dist/entity-base.d.ts +6 -5
  54. package/dist/entity-owner.d.cts +118 -0
  55. package/dist/entity-owner.d.ts +118 -0
  56. package/dist/entity.d.cts +8 -101
  57. package/dist/entity.d.ts +8 -101
  58. package/dist/index.d.cts +26 -21
  59. package/dist/index.d.ts +26 -21
  60. package/dist/model.d.cts +67 -24
  61. package/dist/model.d.ts +67 -24
  62. package/dist/pwc.cjs +1766 -619
  63. package/dist/pwc.cjs.map +1 -1
  64. package/dist/pwc.js +1766 -619
  65. package/dist/pwc.js.map +1 -1
  66. package/dist/pwc.min.js +1 -1
  67. package/dist/pwc.min.js.map +1 -1
  68. package/dist/pwc.min.mjs +1 -1
  69. package/dist/pwc.min.mjs.map +1 -1
  70. package/dist/pwc.mjs +1762 -618
  71. package/dist/pwc.mjs.map +1 -1
  72. package/dist/vscode.html-custom-data.json +203 -89
  73. package/dist/{module.d.cts → wasm.d.cts} +6 -6
  74. package/dist/{module.d.ts → wasm.d.ts} +6 -6
  75. package/dist/web-types.json +556 -273
  76. package/package.json +7 -7
  77. package/src/app.ts +45 -35
  78. package/src/async-element.ts +14 -14
  79. package/src/components/anim-clip.ts +395 -0
  80. package/src/components/anim-component.ts +719 -0
  81. package/src/components/{listener-component.ts → audio-listener-component.ts} +8 -6
  82. package/src/components/button-component.ts +5 -1
  83. package/src/components/camera-component.ts +2 -0
  84. package/src/components/collision-component.ts +5 -1
  85. package/src/components/component.ts +4 -3
  86. package/src/components/element-component.ts +7 -0
  87. package/src/components/gsplat-component.ts +2 -0
  88. package/src/components/joint-component.ts +2 -0
  89. package/src/components/{layoutchild-component.ts → layout-child-component.ts} +4 -2
  90. package/src/components/{layoutgroup-component.ts → layout-group-component.ts} +4 -2
  91. package/src/components/light-component.ts +2 -0
  92. package/src/components/{particlesystem-component.ts → particle-system-component.ts} +4 -2
  93. package/src/components/render-component.ts +2 -0
  94. package/src/components/{rigidbody-component.ts → rigid-body-component.ts} +4 -2
  95. package/src/components/screen-component.ts +2 -0
  96. package/src/components/script-component.ts +63 -42
  97. package/src/components/{script.ts → script-instance.ts} +14 -14
  98. package/src/components/{scrollview-component.ts → scroll-view-component.ts} +4 -2
  99. package/src/components/scrollbar-component.ts +2 -0
  100. package/src/components/sound-component.ts +4 -2
  101. package/src/components/sound-slot.ts +4 -4
  102. package/src/entity-base.ts +6 -5
  103. package/src/entity-owner.ts +298 -0
  104. package/src/entity.ts +15 -270
  105. package/src/index.ts +32 -24
  106. package/src/model.ts +159 -79
  107. package/src/node.ts +9 -5
  108. package/src/{module.ts → wasm.ts} +8 -8
@@ -0,0 +1,235 @@
1
+ import type { AnimComponent, Asset, ContainerResource } from 'playcanvas';
2
+ import { ComponentElement } from './component.cjs';
3
+ /**
4
+ * A container resource with the `animations` sub-assets the engine documents but does not type:
5
+ * one `Asset` of type `animation` per glTF animation, each holding an `AnimTrack` resource.
6
+ */
7
+ type ContainerWithAnimations = ContainerResource & {
8
+ animations: Asset[];
9
+ };
10
+ /**
11
+ * The AnimComponentElement interface provides properties and methods for manipulating
12
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-anim/ | `<pc-anim>`} elements.
13
+ * The AnimComponentElement interface also inherits the properties and methods of the
14
+ * {@link HTMLElement} interface.
15
+ *
16
+ * The element drives animation clips over the host entity's hierarchy. Clips come from
17
+ * `<pc-anim-clip>` children — or, when the element is a direct child of a `<pc-model>` and
18
+ * declares no clips, every animation of that model's container asset is assigned, named by track
19
+ * name, in container order. The first clip plays automatically (opt out with `activate="false"`);
20
+ * switch clips declaratively through the `clip` attribute, or imperatively through {@link play}
21
+ * and {@link transition}. Tracks bind to scene nodes by name, so any hierarchy whose node names
22
+ * match a clip's curves can be animated — a model's skeleton is simply the common case.
23
+ *
24
+ * The engine reports no clip completion: a non-looping clip holds its last pose silently. Poll
25
+ * the underlying {@link AnimComponent} (via {@link component}) for playback state beyond what
26
+ * this element exposes.
27
+ *
28
+ * Engine component: {@link AnimComponent} (`anim`).
29
+ *
30
+ * @category Components
31
+ */
32
+ declare class AnimComponentElement extends ComponentElement {
33
+ /**
34
+ * Whether playback starts automatically once a clip is assigned.
35
+ */
36
+ private _activate;
37
+ /**
38
+ * The clip elements whose states are currently assigned, by clip name. The single writer of
39
+ * a state: a later clip child re-using an adopted name is rejected as a duplicate.
40
+ */
41
+ private _assignedClips;
42
+ /**
43
+ * Whether the current clip set was auto-assigned from the enclosing model rather than
44
+ * declared by clip children.
45
+ */
46
+ private _autoAssigned;
47
+ /**
48
+ * The name of the active clip.
49
+ */
50
+ private _clip;
51
+ /**
52
+ * The binding root this element last assigned through {@link _applyRootBone}, distinguishing
53
+ * its own writes from a `rootBone` assigned through the engine API — which is left alone.
54
+ */
55
+ private _managedRootBone;
56
+ /**
57
+ * The element the model-readiness listener is attached to, held so disconnection can detach
58
+ * it after `closestEntity` no longer resolves.
59
+ */
60
+ private _modelListenerTarget;
61
+ /**
62
+ * Incremented whenever the clip source changes, and captured by an auto-assign pass on
63
+ * entry — a pass resuming from an await abandons itself if the value has moved on, so a
64
+ * superseded pass cannot assign clips alongside declared children or a newer pass.
65
+ */
66
+ private _sourceGeneration;
67
+ /**
68
+ * The playback speed multiplier applied across all clips.
69
+ */
70
+ private _speed;
71
+ /**
72
+ * The cross-fade duration of declarative clip switches, in seconds.
73
+ */
74
+ private _transitionTime;
75
+ /**
76
+ * The unknown clip name already warned about, so a repeated selection of the same missing
77
+ * name complains once.
78
+ */
79
+ private _warnedClip;
80
+ /**
81
+ * Rebinds when a model that is not this component's host announces readiness — a sibling or
82
+ * deeper model whose content changed under the assigned clips. The engine resolves each
83
+ * curve once, at the first tick after assignment, and never retries — and its mesh-instance
84
+ * broadcast fires before an instantiated hierarchy is parented, so a model that loads after
85
+ * the clips were assigned would otherwise stay silently unbound. The host model's own cycles
86
+ * are excluded: those re-enter through {@link initComponent}, which refreshes the whole clip
87
+ * set against the new container.
88
+ */
89
+ private _onModelReady;
90
+ /**
91
+ * The model whose host entity scopes this component's curve binding: the parent `pc-model`,
92
+ * or the sole `pc-model` among the parent's direct children (the arrangement where clips
93
+ * live in a library asset beside the skeleton). `null` when there is no such model, or more
94
+ * than one — an ambiguous skeleton is left to the engine's name-based resolution.
95
+ */
96
+ private _skeletonSource;
97
+ /**
98
+ * Keeps the component's binding root pointing at the skeleton source's host entity. The host
99
+ * wraps the instantiated content, so left at its default — the component's own entity — the
100
+ * engine binder mis-resolves curves that target the asset's root node: its fallback treats
101
+ * the graph as the asset root once the root is no longer a direct child.
102
+ *
103
+ * Authoritative in both directions for values this element assigned: a source appearing pins
104
+ * its host, and a source dissolving (the model gone, or a second model making the skeleton
105
+ * ambiguous) clears the pin rather than leaving it on a stale host. A root assigned through
106
+ * the engine API is never overwritten — the user's choice outranks the managed default.
107
+ * Writes are skipped while unchanged, because the engine setter itself triggers a rebind.
108
+ */
109
+ private _applyRootBone;
110
+ /** @ignore */
111
+ constructor();
112
+ protected getInitialComponentData(): {
113
+ activate: boolean;
114
+ speed: number;
115
+ };
116
+ protected initComponent(): void;
117
+ disconnectedCallback(): void;
118
+ /**
119
+ * The clip children in DOM order. Read afresh each pass — the DOM is the single source of
120
+ * truth for the declared clip set.
121
+ */
122
+ private _clipElements;
123
+ /**
124
+ * Assigns a clip's state. Until the clip's real track resolves, the engine's own placeholder
125
+ * track stands in — it keeps the layer playable, so `activate` can start playback and the
126
+ * declared `clip` selection can apply before any asset has loaded.
127
+ */
128
+ private _assignClip;
129
+ /**
130
+ * Validates a clip child and, when valid, assigns its state and starts its track resolution.
131
+ *
132
+ * @param clip - The clip element.
133
+ * @returns Whether the clip was adopted.
134
+ */
135
+ private _adoptClip;
136
+ /**
137
+ * Assigns the current clip set: the declared clip children when there are any, otherwise the
138
+ * enclosing model's clips. Runs against a fresh component after a host cycle, so the
139
+ * adoption bookkeeping rebuilds from scratch.
140
+ */
141
+ private _applyClips;
142
+ /**
143
+ * Assigns every clip of the enclosing model's container, named by track name, in container
144
+ * order. Names the engine cannot host — dotted (reserved for blend tree paths) or already
145
+ * taken — are skipped with a warning naming each.
146
+ */
147
+ private _kickAutoAssign;
148
+ /**
149
+ * Applies the active-clip selection: the declared `clip` when it names an assigned state,
150
+ * else a captured pre-rebuild state when it survived, else the engine's default (the first
151
+ * assigned clip). A restore also reinstates the playhead and both playing flags exactly as
152
+ * captured — the reassignment that preceded it set both to the `activate` outcome, which is
153
+ * not necessarily the state the rebuild interrupted.
154
+ */
155
+ private _applySelection;
156
+ private _warnUnknownClip;
157
+ /**
158
+ * Resumes playback, optionally switching to a named clip first (a hard cut). A name that
159
+ * matches no clip leaves the selection unchanged.
160
+ *
161
+ * @param name - The name of the clip to play. Resumes the current clip when omitted.
162
+ */
163
+ play(name?: string): void;
164
+ /**
165
+ * Pauses playback, preserving the playhead — {@link play} resumes from where it stopped.
166
+ */
167
+ pause(): void;
168
+ /**
169
+ * Cross-fades to a named clip and ensures playback is running. A name that matches no clip
170
+ * leaves the selection unchanged.
171
+ *
172
+ * @param name - The name of the clip to fade to.
173
+ * @param time - The fade duration in seconds. Defaults to the `transition-time` attribute.
174
+ */
175
+ transition(name: string, time?: number): void;
176
+ /**
177
+ * Gets the underlying PlayCanvas anim component.
178
+ * @returns The anim component.
179
+ */
180
+ get component(): AnimComponent;
181
+ /**
182
+ * Gets the names of the assigned clips.
183
+ * @returns The clip names, in assignment order.
184
+ */
185
+ get clips(): string[];
186
+ /**
187
+ * Sets whether playback starts automatically once a clip is assigned. Defaults to `true`.
188
+ * Applies when clips are assigned — it does not stop a clip that is already playing.
189
+ * @param value - Whether playback starts automatically.
190
+ */
191
+ set activate(value: boolean);
192
+ /**
193
+ * Gets whether playback starts automatically once a clip is assigned.
194
+ * @returns Whether playback starts automatically.
195
+ */
196
+ get activate(): boolean;
197
+ /**
198
+ * Sets the name of the active clip. Changing it switches playback, cross-fading over
199
+ * `transition-time` seconds (a hard cut at 0). An empty value leaves the current clip
200
+ * playing; a name that matches no clip warns and leaves the selection unchanged.
201
+ * @param value - The name of the active clip.
202
+ */
203
+ set clip(value: string);
204
+ /**
205
+ * Gets the name of the active clip.
206
+ * @returns The name of the active clip.
207
+ */
208
+ get clip(): string;
209
+ /**
210
+ * Sets the playback speed multiplier applied across all clips, where 0 freezes playback.
211
+ * Defaults to 1.
212
+ * @param value - The playback speed multiplier.
213
+ */
214
+ set speed(value: number);
215
+ /**
216
+ * Gets the playback speed multiplier applied across all clips.
217
+ * @returns The playback speed multiplier.
218
+ */
219
+ get speed(): number;
220
+ /**
221
+ * Sets the cross-fade duration of clip switches made through the `clip` attribute, in
222
+ * seconds. Defaults to 0 (a hard cut).
223
+ * @param value - The cross-fade duration in seconds.
224
+ */
225
+ set transitionTime(value: number);
226
+ /**
227
+ * Gets the cross-fade duration of clip switches made through the `clip` attribute.
228
+ * @returns The cross-fade duration in seconds.
229
+ */
230
+ get transitionTime(): number;
231
+ static get observedAttributes(): string[];
232
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
233
+ }
234
+ export { AnimComponentElement };
235
+ export type { ContainerWithAnimations };
@@ -0,0 +1,235 @@
1
+ import type { AnimComponent, Asset, ContainerResource } from 'playcanvas';
2
+ import { ComponentElement } from './component.js';
3
+ /**
4
+ * A container resource with the `animations` sub-assets the engine documents but does not type:
5
+ * one `Asset` of type `animation` per glTF animation, each holding an `AnimTrack` resource.
6
+ */
7
+ type ContainerWithAnimations = ContainerResource & {
8
+ animations: Asset[];
9
+ };
10
+ /**
11
+ * The AnimComponentElement interface provides properties and methods for manipulating
12
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-anim/ | `<pc-anim>`} elements.
13
+ * The AnimComponentElement interface also inherits the properties and methods of the
14
+ * {@link HTMLElement} interface.
15
+ *
16
+ * The element drives animation clips over the host entity's hierarchy. Clips come from
17
+ * `<pc-anim-clip>` children — or, when the element is a direct child of a `<pc-model>` and
18
+ * declares no clips, every animation of that model's container asset is assigned, named by track
19
+ * name, in container order. The first clip plays automatically (opt out with `activate="false"`);
20
+ * switch clips declaratively through the `clip` attribute, or imperatively through {@link play}
21
+ * and {@link transition}. Tracks bind to scene nodes by name, so any hierarchy whose node names
22
+ * match a clip's curves can be animated — a model's skeleton is simply the common case.
23
+ *
24
+ * The engine reports no clip completion: a non-looping clip holds its last pose silently. Poll
25
+ * the underlying {@link AnimComponent} (via {@link component}) for playback state beyond what
26
+ * this element exposes.
27
+ *
28
+ * Engine component: {@link AnimComponent} (`anim`).
29
+ *
30
+ * @category Components
31
+ */
32
+ declare class AnimComponentElement extends ComponentElement {
33
+ /**
34
+ * Whether playback starts automatically once a clip is assigned.
35
+ */
36
+ private _activate;
37
+ /**
38
+ * The clip elements whose states are currently assigned, by clip name. The single writer of
39
+ * a state: a later clip child re-using an adopted name is rejected as a duplicate.
40
+ */
41
+ private _assignedClips;
42
+ /**
43
+ * Whether the current clip set was auto-assigned from the enclosing model rather than
44
+ * declared by clip children.
45
+ */
46
+ private _autoAssigned;
47
+ /**
48
+ * The name of the active clip.
49
+ */
50
+ private _clip;
51
+ /**
52
+ * The binding root this element last assigned through {@link _applyRootBone}, distinguishing
53
+ * its own writes from a `rootBone` assigned through the engine API — which is left alone.
54
+ */
55
+ private _managedRootBone;
56
+ /**
57
+ * The element the model-readiness listener is attached to, held so disconnection can detach
58
+ * it after `closestEntity` no longer resolves.
59
+ */
60
+ private _modelListenerTarget;
61
+ /**
62
+ * Incremented whenever the clip source changes, and captured by an auto-assign pass on
63
+ * entry — a pass resuming from an await abandons itself if the value has moved on, so a
64
+ * superseded pass cannot assign clips alongside declared children or a newer pass.
65
+ */
66
+ private _sourceGeneration;
67
+ /**
68
+ * The playback speed multiplier applied across all clips.
69
+ */
70
+ private _speed;
71
+ /**
72
+ * The cross-fade duration of declarative clip switches, in seconds.
73
+ */
74
+ private _transitionTime;
75
+ /**
76
+ * The unknown clip name already warned about, so a repeated selection of the same missing
77
+ * name complains once.
78
+ */
79
+ private _warnedClip;
80
+ /**
81
+ * Rebinds when a model that is not this component's host announces readiness — a sibling or
82
+ * deeper model whose content changed under the assigned clips. The engine resolves each
83
+ * curve once, at the first tick after assignment, and never retries — and its mesh-instance
84
+ * broadcast fires before an instantiated hierarchy is parented, so a model that loads after
85
+ * the clips were assigned would otherwise stay silently unbound. The host model's own cycles
86
+ * are excluded: those re-enter through {@link initComponent}, which refreshes the whole clip
87
+ * set against the new container.
88
+ */
89
+ private _onModelReady;
90
+ /**
91
+ * The model whose host entity scopes this component's curve binding: the parent `pc-model`,
92
+ * or the sole `pc-model` among the parent's direct children (the arrangement where clips
93
+ * live in a library asset beside the skeleton). `null` when there is no such model, or more
94
+ * than one — an ambiguous skeleton is left to the engine's name-based resolution.
95
+ */
96
+ private _skeletonSource;
97
+ /**
98
+ * Keeps the component's binding root pointing at the skeleton source's host entity. The host
99
+ * wraps the instantiated content, so left at its default — the component's own entity — the
100
+ * engine binder mis-resolves curves that target the asset's root node: its fallback treats
101
+ * the graph as the asset root once the root is no longer a direct child.
102
+ *
103
+ * Authoritative in both directions for values this element assigned: a source appearing pins
104
+ * its host, and a source dissolving (the model gone, or a second model making the skeleton
105
+ * ambiguous) clears the pin rather than leaving it on a stale host. A root assigned through
106
+ * the engine API is never overwritten — the user's choice outranks the managed default.
107
+ * Writes are skipped while unchanged, because the engine setter itself triggers a rebind.
108
+ */
109
+ private _applyRootBone;
110
+ /** @ignore */
111
+ constructor();
112
+ protected getInitialComponentData(): {
113
+ activate: boolean;
114
+ speed: number;
115
+ };
116
+ protected initComponent(): void;
117
+ disconnectedCallback(): void;
118
+ /**
119
+ * The clip children in DOM order. Read afresh each pass — the DOM is the single source of
120
+ * truth for the declared clip set.
121
+ */
122
+ private _clipElements;
123
+ /**
124
+ * Assigns a clip's state. Until the clip's real track resolves, the engine's own placeholder
125
+ * track stands in — it keeps the layer playable, so `activate` can start playback and the
126
+ * declared `clip` selection can apply before any asset has loaded.
127
+ */
128
+ private _assignClip;
129
+ /**
130
+ * Validates a clip child and, when valid, assigns its state and starts its track resolution.
131
+ *
132
+ * @param clip - The clip element.
133
+ * @returns Whether the clip was adopted.
134
+ */
135
+ private _adoptClip;
136
+ /**
137
+ * Assigns the current clip set: the declared clip children when there are any, otherwise the
138
+ * enclosing model's clips. Runs against a fresh component after a host cycle, so the
139
+ * adoption bookkeeping rebuilds from scratch.
140
+ */
141
+ private _applyClips;
142
+ /**
143
+ * Assigns every clip of the enclosing model's container, named by track name, in container
144
+ * order. Names the engine cannot host — dotted (reserved for blend tree paths) or already
145
+ * taken — are skipped with a warning naming each.
146
+ */
147
+ private _kickAutoAssign;
148
+ /**
149
+ * Applies the active-clip selection: the declared `clip` when it names an assigned state,
150
+ * else a captured pre-rebuild state when it survived, else the engine's default (the first
151
+ * assigned clip). A restore also reinstates the playhead and both playing flags exactly as
152
+ * captured — the reassignment that preceded it set both to the `activate` outcome, which is
153
+ * not necessarily the state the rebuild interrupted.
154
+ */
155
+ private _applySelection;
156
+ private _warnUnknownClip;
157
+ /**
158
+ * Resumes playback, optionally switching to a named clip first (a hard cut). A name that
159
+ * matches no clip leaves the selection unchanged.
160
+ *
161
+ * @param name - The name of the clip to play. Resumes the current clip when omitted.
162
+ */
163
+ play(name?: string): void;
164
+ /**
165
+ * Pauses playback, preserving the playhead — {@link play} resumes from where it stopped.
166
+ */
167
+ pause(): void;
168
+ /**
169
+ * Cross-fades to a named clip and ensures playback is running. A name that matches no clip
170
+ * leaves the selection unchanged.
171
+ *
172
+ * @param name - The name of the clip to fade to.
173
+ * @param time - The fade duration in seconds. Defaults to the `transition-time` attribute.
174
+ */
175
+ transition(name: string, time?: number): void;
176
+ /**
177
+ * Gets the underlying PlayCanvas anim component.
178
+ * @returns The anim component.
179
+ */
180
+ get component(): AnimComponent;
181
+ /**
182
+ * Gets the names of the assigned clips.
183
+ * @returns The clip names, in assignment order.
184
+ */
185
+ get clips(): string[];
186
+ /**
187
+ * Sets whether playback starts automatically once a clip is assigned. Defaults to `true`.
188
+ * Applies when clips are assigned — it does not stop a clip that is already playing.
189
+ * @param value - Whether playback starts automatically.
190
+ */
191
+ set activate(value: boolean);
192
+ /**
193
+ * Gets whether playback starts automatically once a clip is assigned.
194
+ * @returns Whether playback starts automatically.
195
+ */
196
+ get activate(): boolean;
197
+ /**
198
+ * Sets the name of the active clip. Changing it switches playback, cross-fading over
199
+ * `transition-time` seconds (a hard cut at 0). An empty value leaves the current clip
200
+ * playing; a name that matches no clip warns and leaves the selection unchanged.
201
+ * @param value - The name of the active clip.
202
+ */
203
+ set clip(value: string);
204
+ /**
205
+ * Gets the name of the active clip.
206
+ * @returns The name of the active clip.
207
+ */
208
+ get clip(): string;
209
+ /**
210
+ * Sets the playback speed multiplier applied across all clips, where 0 freezes playback.
211
+ * Defaults to 1.
212
+ * @param value - The playback speed multiplier.
213
+ */
214
+ set speed(value: number);
215
+ /**
216
+ * Gets the playback speed multiplier applied across all clips.
217
+ * @returns The playback speed multiplier.
218
+ */
219
+ get speed(): number;
220
+ /**
221
+ * Sets the cross-fade duration of clip switches made through the `clip` attribute, in
222
+ * seconds. Defaults to 0 (a hard cut).
223
+ * @param value - The cross-fade duration in seconds.
224
+ */
225
+ set transitionTime(value: number);
226
+ /**
227
+ * Gets the cross-fade duration of clip switches made through the `clip` attribute.
228
+ * @returns The cross-fade duration in seconds.
229
+ */
230
+ get transitionTime(): number;
231
+ static get observedAttributes(): string[];
232
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
233
+ }
234
+ export { AnimComponentElement };
235
+ export type { ContainerWithAnimations };
@@ -1,14 +1,16 @@
1
1
  import type { AudioListenerComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component.cjs';
3
3
  /**
4
- * The ListenerComponentElement interface provides properties and methods for manipulating
5
- * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
6
- * The ListenerComponentElement interface also inherits the properties and methods of the
4
+ * The AudioListenerComponentElement interface provides properties and methods for manipulating
5
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-audio-listener/ | `<pc-audio-listener>`} elements.
6
+ * The AudioListenerComponentElement interface also inherits the properties and methods of the
7
7
  * {@link HTMLElement} interface.
8
8
  *
9
+ * Engine component: {@link AudioListenerComponent} (`audiolistener`).
10
+ *
9
11
  * @category Components
10
12
  */
11
- declare class ListenerComponentElement extends ComponentElement {
13
+ declare class AudioListenerComponentElement extends ComponentElement {
12
14
  /** @ignore */
13
15
  constructor();
14
16
  /**
@@ -17,4 +19,4 @@ declare class ListenerComponentElement extends ComponentElement {
17
19
  */
18
20
  get component(): AudioListenerComponent;
19
21
  }
20
- export { ListenerComponentElement };
22
+ export { AudioListenerComponentElement };
@@ -1,14 +1,16 @@
1
1
  import type { AudioListenerComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component.js';
3
3
  /**
4
- * The ListenerComponentElement interface provides properties and methods for manipulating
5
- * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
6
- * The ListenerComponentElement interface also inherits the properties and methods of the
4
+ * The AudioListenerComponentElement interface provides properties and methods for manipulating
5
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-audio-listener/ | `<pc-audio-listener>`} elements.
6
+ * The AudioListenerComponentElement interface also inherits the properties and methods of the
7
7
  * {@link HTMLElement} interface.
8
8
  *
9
+ * Engine component: {@link AudioListenerComponent} (`audiolistener`).
10
+ *
9
11
  * @category Components
10
12
  */
11
- declare class ListenerComponentElement extends ComponentElement {
13
+ declare class AudioListenerComponentElement extends ComponentElement {
12
14
  /** @ignore */
13
15
  constructor();
14
16
  /**
@@ -17,4 +19,4 @@ declare class ListenerComponentElement extends ComponentElement {
17
19
  */
18
20
  get component(): AudioListenerComponent;
19
21
  }
20
- export { ListenerComponentElement };
22
+ export { AudioListenerComponentElement };
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.cjs';
7
7
  * The ButtonComponentElement interface also inherits the properties and methods of the
8
8
  * {@link HTMLElement} interface.
9
9
  *
10
+ * Engine component: {@link ButtonComponent} (`button`).
11
+ *
10
12
  * @category Components
11
13
  */
12
14
  declare class ButtonComponentElement extends ComponentElement {
@@ -44,7 +46,9 @@ declare class ButtonComponentElement extends ComponentElement {
44
46
  get active(): boolean;
45
47
  /**
46
48
  * Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` whose image
47
- * element is used for visual transitions. Defaults to the button's own entity.
49
+ * element is used for visual transitions. Defaults to the button's own entity — inside a
50
+ * `<pc-model>`, that is the model's host entity, so supply an explicit reference to target a
51
+ * UI entity instead.
48
52
  * @param value - The image entity reference.
49
53
  */
50
54
  set image(value: string);
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.js';
7
7
  * The ButtonComponentElement interface also inherits the properties and methods of the
8
8
  * {@link HTMLElement} interface.
9
9
  *
10
+ * Engine component: {@link ButtonComponent} (`button`).
11
+ *
10
12
  * @category Components
11
13
  */
12
14
  declare class ButtonComponentElement extends ComponentElement {
@@ -44,7 +46,9 @@ declare class ButtonComponentElement extends ComponentElement {
44
46
  get active(): boolean;
45
47
  /**
46
48
  * Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` whose image
47
- * element is used for visual transitions. Defaults to the button's own entity.
49
+ * element is used for visual transitions. Defaults to the button's own entity — inside a
50
+ * `<pc-model>`, that is the model's host entity, so supply an explicit reference to target a
51
+ * UI entity instead.
48
52
  * @param value - The image entity reference.
49
53
  */
50
54
  set image(value: string);
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.cjs';
7
7
  * The CameraComponentElement interface also inherits the properties and methods of the
8
8
  * {@link HTMLElement} interface.
9
9
  *
10
+ * Engine component: {@link CameraComponent} (`camera`).
11
+ *
10
12
  * @category Components
11
13
  */
12
14
  declare class CameraComponentElement extends ComponentElement {
@@ -7,6 +7,8 @@ import { ComponentElement } from './component.js';
7
7
  * The CameraComponentElement interface also inherits the properties and methods of the
8
8
  * {@link HTMLElement} interface.
9
9
  *
10
+ * Engine component: {@link CameraComponent} (`camera`).
11
+ *
10
12
  * @category Components
11
13
  */
12
14
  declare class CameraComponentElement extends ComponentElement {
@@ -13,6 +13,8 @@ import { ComponentElement } from './component.cjs';
13
13
  * retargets or rebinds picks up the new node's geometry. An entity with no asset-backed render
14
14
  * component warns, and the collider has no shape.
15
15
  *
16
+ * Engine component: {@link CollisionComponent} (`collision`).
17
+ *
16
18
  * @category Components
17
19
  */
18
20
  declare class CollisionComponentElement extends ComponentElement {
@@ -43,7 +45,9 @@ declare class CollisionComponentElement extends ComponentElement {
43
45
  * no attribute to supply it - so the host's visible geometry, the meaning a mesh collider
44
46
  * on a glTF node carries, fills the gap. Runs on every application (so a rebound `pc-node`
45
47
  * recomputes it) and on a runtime switch to `type="mesh"`; an explicitly assigned
46
- * `renderAsset` is never overwritten.
48
+ * `renderAsset` is never overwritten. A `pc-model` host entity never carries a render
49
+ * component (the instantiated content beneath it does), so a mesh collider that should take
50
+ * an asset's geometry belongs on a bound `pc-node`.
47
51
  */
48
52
  private _applyMeshGeometryDefault;
49
53
  /**
@@ -13,6 +13,8 @@ import { ComponentElement } from './component.js';
13
13
  * retargets or rebinds picks up the new node's geometry. An entity with no asset-backed render
14
14
  * component warns, and the collider has no shape.
15
15
  *
16
+ * Engine component: {@link CollisionComponent} (`collision`).
17
+ *
16
18
  * @category Components
17
19
  */
18
20
  declare class CollisionComponentElement extends ComponentElement {
@@ -43,7 +45,9 @@ declare class CollisionComponentElement extends ComponentElement {
43
45
  * no attribute to supply it - so the host's visible geometry, the meaning a mesh collider
44
46
  * on a glTF node carries, fills the gap. Runs on every application (so a rebound `pc-node`
45
47
  * recomputes it) and on a runtime switch to `type="mesh"`; an explicitly assigned
46
- * `renderAsset` is never overwritten.
48
+ * `renderAsset` is never overwritten. A `pc-model` host entity never carries a render
49
+ * component (the instantiated content beneath it does), so a mesh collider that should take
50
+ * an asset's geometry belongs on a bound `pc-node`.
47
51
  */
48
52
  private _applyMeshGeometryDefault;
49
53
  /**
@@ -61,8 +61,9 @@ declare class ComponentElement extends AsyncElement {
61
61
  disconnectedCallback(): void;
62
62
  /**
63
63
  * The PlayCanvas component instance. `null` until the element is ready, and also for an
64
- * element that is not a descendant of a `<pc-entity>` — await {@link whenReady} or the
65
- * element's `ready()` promise before accessing it.
64
+ * element that is not a descendant of an entity-fronting element (`<pc-entity>`,
65
+ * `<pc-model>` or `<pc-node>`) — await {@link whenReady} or the element's `ready()` promise
66
+ * before accessing it.
66
67
  * @returns The component instance, or `null`.
67
68
  */
68
69
  get component(): Component | null;
@@ -61,8 +61,9 @@ declare class ComponentElement extends AsyncElement {
61
61
  disconnectedCallback(): void;
62
62
  /**
63
63
  * The PlayCanvas component instance. `null` until the element is ready, and also for an
64
- * element that is not a descendant of a `<pc-entity>` — await {@link whenReady} or the
65
- * element's `ready()` promise before accessing it.
64
+ * element that is not a descendant of an entity-fronting element (`<pc-entity>`,
65
+ * `<pc-model>` or `<pc-node>`) — await {@link whenReady} or the element's `ready()` promise
66
+ * before accessing it.
66
67
  * @returns The component instance, or `null`.
67
68
  */
68
69
  get component(): Component | null;
@@ -7,6 +7,13 @@ import { ComponentElement } from './component.cjs';
7
7
  * The ElementComponentElement interface also inherits the properties and methods of the
8
8
  * {@link HTMLElement} interface.
9
9
  *
10
+ * Despite the name, this is not a base class or a generic wrapper: it is the engine's 2D UI
11
+ * component, which gives its host entity a rectangle in a `<pc-screen>` hierarchy that draws
12
+ * either an image, a line of text or nothing (`type="image"`, `"text"` or `"group"`). The tag
13
+ * spells the engine component it adds, as every component element does.
14
+ *
15
+ * Engine component: {@link ElementComponent} (`element`).
16
+ *
10
17
  * @category Components
11
18
  */
12
19
  declare class ElementComponentElement extends ComponentElement {