@playcanvas/web-components 0.11.0 → 0.11.1

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 (78) hide show
  1. package/README.md +1 -1
  2. package/dist/app.d.ts +18 -38
  3. package/dist/asset.d.ts +8 -7
  4. package/dist/async-element.d.ts +21 -5
  5. package/dist/components/button-component.d.ts +3 -7
  6. package/dist/components/camera-component.d.ts +3 -7
  7. package/dist/components/collision-component.d.ts +3 -7
  8. package/dist/components/component.d.ts +22 -4
  9. package/dist/components/element-component.d.ts +4 -8
  10. package/dist/components/gsplat-component.d.ts +2 -7
  11. package/dist/components/layoutchild-component.d.ts +2 -7
  12. package/dist/components/layoutgroup-component.d.ts +3 -7
  13. package/dist/components/light-component.d.ts +3 -7
  14. package/dist/components/listener-component.d.ts +1 -6
  15. package/dist/components/particlesystem-component.d.ts +2 -7
  16. package/dist/components/render-component.d.ts +2 -7
  17. package/dist/components/rigidbody-component.d.ts +3 -7
  18. package/dist/components/screen-component.d.ts +3 -7
  19. package/dist/components/script-component.d.ts +8 -20
  20. package/dist/components/script.d.ts +2 -22
  21. package/dist/components/scrollbar-component.d.ts +2 -7
  22. package/dist/components/scrollview-component.d.ts +3 -7
  23. package/dist/components/sound-component.d.ts +2 -7
  24. package/dist/components/sound-slot.d.ts +8 -6
  25. package/dist/custom-elements.json +5049 -10696
  26. package/dist/entity.d.ts +5 -11
  27. package/dist/index.d.ts +37 -0
  28. package/dist/material.d.ts +12 -12
  29. package/dist/model.d.ts +21 -5
  30. package/dist/module.d.ts +0 -6
  31. package/dist/parse.d.ts +2 -1
  32. package/dist/pwc.cjs +496 -136
  33. package/dist/pwc.cjs.map +1 -1
  34. package/dist/pwc.js +496 -136
  35. package/dist/pwc.js.map +1 -1
  36. package/dist/pwc.min.js +1 -1
  37. package/dist/pwc.min.js.map +1 -1
  38. package/dist/pwc.min.mjs +1 -1
  39. package/dist/pwc.min.mjs.map +1 -1
  40. package/dist/pwc.mjs +496 -136
  41. package/dist/pwc.mjs.map +1 -1
  42. package/dist/scene.d.ts +4 -7
  43. package/dist/sky.d.ts +13 -5
  44. package/dist/vscode.html-custom-data.json +26 -26
  45. package/dist/web-types.json +545 -536
  46. package/package.json +8 -7
  47. package/src/app.ts +142 -70
  48. package/src/asset.ts +34 -28
  49. package/src/async-element.ts +34 -8
  50. package/src/components/button-component.ts +5 -9
  51. package/src/components/camera-component.ts +24 -10
  52. package/src/components/collision-component.ts +26 -15
  53. package/src/components/component.ts +58 -8
  54. package/src/components/element-component.ts +26 -30
  55. package/src/components/gsplat-component.ts +4 -9
  56. package/src/components/layoutchild-component.ts +4 -9
  57. package/src/components/layoutgroup-component.ts +14 -9
  58. package/src/components/light-component.ts +42 -12
  59. package/src/components/listener-component.ts +1 -7
  60. package/src/components/particlesystem-component.ts +7 -15
  61. package/src/components/render-component.ts +5 -10
  62. package/src/components/rigidbody-component.ts +23 -16
  63. package/src/components/screen-component.ts +5 -9
  64. package/src/components/script-component.ts +108 -46
  65. package/src/components/script.ts +38 -33
  66. package/src/components/scrollbar-component.ts +6 -16
  67. package/src/components/scrollview-component.ts +16 -11
  68. package/src/components/sound-component.ts +10 -15
  69. package/src/components/sound-slot.ts +30 -20
  70. package/src/entity.ts +42 -19
  71. package/src/index.ts +45 -1
  72. package/src/loading-bar.ts +8 -8
  73. package/src/material.ts +63 -37
  74. package/src/model.ts +69 -14
  75. package/src/module.ts +8 -7
  76. package/src/parse.ts +62 -17
  77. package/src/scene.ts +12 -9
  78. package/src/sky.ts +50 -9
package/README.md CHANGED
@@ -30,7 +30,7 @@ PlayCanvas Web Components are a set of custom HTML elements for building 3D inte
30
30
 
31
31
  ## Examples
32
32
 
33
- [![image](https://github.com/user-attachments/assets/25ac8dd3-abc9-4d65-8950-3d72ed1f7152)](https://playcanvas.github.io/web-components/examples)
33
+ <img width="3840" height="2160" alt="image" src="https://github.com/user-attachments/assets/e113cd2a-300d-4713-a1f4-ada647a8f04c" />
34
34
 
35
35
  See PlayCanvas Web Components in action here: https://playcanvas.github.io/web-components/examples
36
36
 
package/dist/app.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { AppBase, Entity } from 'playcanvas';
1
+ import type { Entity } from 'playcanvas';
2
+ import { AppBase } from 'playcanvas';
2
3
  import { AsyncElement } from './async-element';
3
- import { EntityElement } from './entity';
4
+ import type { EntityElement } from './entity';
4
5
  /**
5
6
  * The AppElement interface provides properties and methods for manipulating
6
7
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/ | `<pc-app>`} elements.
@@ -31,7 +32,13 @@ declare class AppElement extends AsyncElement {
31
32
  */
32
33
  private _optionsLocked;
33
34
  private _bar;
34
- private _hierarchyReady;
35
+ /**
36
+ * Incremented on every connect and disconnect. Boot captures the value on entry and abandons
37
+ * itself wherever it resumes from an await if the value has moved on — so a boot whose
38
+ * element was removed cannot complete against a torn-down element, and a boot whose element
39
+ * was removed and re-inserted (which starts a boot of its own) cannot race the newer one.
40
+ */
41
+ private _bootGeneration;
35
42
  /**
36
43
  * The elements backing this application's entities, keyed by the entity itself. Registered
37
44
  * by EntityElement at creation and removed when an entity is destroyed, this joins engine
@@ -68,25 +75,9 @@ declare class AppElement extends AsyncElement {
68
75
  constructor();
69
76
  connectedCallback(): Promise<void>;
70
77
  disconnectedCallback(): void;
71
- _onWindowResize(): void;
72
- _pickerCreate(): void;
73
- _pickerDestroy(): void;
74
- /**
75
- * Registers the element that created an entity. Called by EntityElement when it creates its
76
- * entity.
77
- *
78
- * @param entity - The entity.
79
- * @param element - The element that created it.
80
- * @ignore
81
- */
82
- _registerEntityElement(entity: Entity, element: EntityElement): void;
83
- /**
84
- * Removes the registration for a destroyed entity. Called by EntityElement.
85
- *
86
- * @param entity - The entity.
87
- * @ignore
88
- */
89
- _unregisterEntityElement(entity: Entity): void;
78
+ private _onWindowResize;
79
+ private _pickerCreate;
80
+ private _pickerDestroy;
90
81
  /**
91
82
  * Returns the `<pc-entity>` element whose backing entity is `entity`, or `null` if the
92
83
  * entity was not created by an element of this application - for example, a node inside a
@@ -128,11 +119,11 @@ declare class AppElement extends AsyncElement {
128
119
  * @returns The graph node under the pointer, or `null` if nothing was hit.
129
120
  */
130
121
  private _pickNode;
131
- _onPointerMove(event: PointerEvent): Promise<void>;
132
- _onPointerDown(event: PointerEvent): Promise<void>;
133
- _onPointerUp(event: PointerEvent): Promise<void>;
134
- _onPointerListenerAdded(type: string): void;
135
- _onPointerListenerRemoved(type: string): void;
122
+ private _onPointerMove;
123
+ private _onPointerDown;
124
+ private _onPointerUp;
125
+ private _onPointerListenerAdded;
126
+ private _onPointerListenerRemoved;
136
127
  /**
137
128
  * Warns that a graphics option was written too late to have any effect. These options are read
138
129
  * once, when the element connects and creates its graphics device, so a later write updates
@@ -184,12 +175,6 @@ declare class AppElement extends AsyncElement {
184
175
  * @returns The depth buffer flag.
185
176
  */
186
177
  get depthBuffer(): boolean;
187
- /**
188
- * Gets the hierarchy ready flag.
189
- * @returns The hierarchy ready flag.
190
- * @ignore
191
- */
192
- get hierarchyReady(): boolean;
193
178
  /**
194
179
  * Sets whether the application shows its built-in loading bar while it boots and preloads its
195
180
  * assets. Enabled by default; setting `false` removes the bar immediately, while setting
@@ -233,9 +218,4 @@ declare class AppElement extends AsyncElement {
233
218
  static get observedAttributes(): string[];
234
219
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
235
220
  }
236
- declare global {
237
- interface HTMLElementTagNameMap {
238
- 'pc-app': AppElement;
239
- }
240
- }
241
221
  export { AppElement };
package/dist/asset.d.ts CHANGED
@@ -46,7 +46,6 @@ declare class AssetElement extends AsyncElement {
46
46
  disconnectedCallback(): void;
47
47
  private _onAssetLoad;
48
48
  private _onAssetError;
49
- createAsset(): void;
50
49
  /**
51
50
  * Builds the `data` object for the asset from an optional inline `data` attribute (JSON) and,
52
51
  * for sprites, from the convenience attributes (`atlas`, `frame-keys`, `pixels-per-unit`,
@@ -55,7 +54,7 @@ declare class AssetElement extends AsyncElement {
55
54
  * @returns The asset data, or `undefined`.
56
55
  */
57
56
  private _buildData;
58
- destroyAsset(): void;
57
+ private _destroyAsset;
59
58
  /**
60
59
  * Sets whether the asset should be loaded lazily.
61
60
  * @param value - The lazy loading flag.
@@ -66,13 +65,15 @@ declare class AssetElement extends AsyncElement {
66
65
  * @returns The lazy loading flag.
67
66
  */
68
67
  get lazy(): boolean;
68
+ /**
69
+ * Returns the {@link Asset} created by the `<pc-asset>` element with the given `id`, or
70
+ * `undefined` if there is no such element or its asset has not been created yet.
71
+ *
72
+ * @param id - The `id` of the `<pc-asset>` element.
73
+ * @returns The asset, or `undefined`.
74
+ */
69
75
  static get(id: string): Asset | null | undefined;
70
76
  static get observedAttributes(): string[];
71
77
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
72
78
  }
73
- declare global {
74
- interface HTMLElementTagNameMap {
75
- 'pc-asset': AssetElement;
76
- }
77
- }
78
79
  export { AssetElement };
@@ -1,14 +1,16 @@
1
- import { AppElement } from './app';
2
- import { EntityElement } from './entity';
1
+ import type { AppElement } from './app';
2
+ import type { EntityElement } from './entity';
3
3
  /**
4
4
  * Base class for all PlayCanvas Web Components that initialize asynchronously.
5
5
  *
6
- * @fires {CustomEvent} ready - Fired once the element is fully initialized. Bubbles and is
7
- * composed.
6
+ * @fires {CustomEvent} ready - Fired when the element is fully initialized once per readiness
7
+ * cycle, so an element that is torn down and re-initialized (for example by removing and
8
+ * re-inserting it) fires it again. Bubbles and is composed.
8
9
  */
9
10
  declare class AsyncElement extends HTMLElement {
10
11
  private _readyPromise;
11
12
  private _readyResolve;
13
+ private _readyResolved;
12
14
  /** @ignore */
13
15
  constructor();
14
16
  /**
@@ -26,12 +28,26 @@ declare class AsyncElement extends HTMLElement {
26
28
  /**
27
29
  * Called when the element is fully initialized and ready. Subclasses should call this when
28
30
  * they're ready. Resolves the ready promise and dispatches a bubbling, composed `ready`
29
- * event.
31
+ * event. Signals at most once per readiness cycle: a repeat call before {@link _resetReady}
32
+ * has re-armed the promise does nothing.
30
33
  */
31
34
  protected _onReady(): void;
35
+ /**
36
+ * Returns the ready promise to its pending state. Subclasses should call this when the
37
+ * resource their readiness announced is torn down (typically from `disconnectedCallback`),
38
+ * so that a later re-initialization can signal readiness again. Does nothing while the
39
+ * promise is still pending — an in-flight waiter carries over to the next readiness cycle
40
+ * rather than being stranded on a promise nothing will ever resolve.
41
+ */
42
+ protected _resetReady(): void;
32
43
  /**
33
44
  * Returns a promise that resolves with this element when it's ready. This is the low-level
34
45
  * primitive underlying {@link whenReady}, which is the recommended way to wait for elements.
46
+ *
47
+ * Readiness tracks the element's current lifecycle: once a ready element is torn down (for
48
+ * example by removing it from the document), this returns a fresh promise that resolves when
49
+ * the element is next ready. A promise obtained earlier stays resolved — call this again
50
+ * after re-inserting an element rather than reusing a promise from before its removal.
35
51
  * @returns A promise that resolves with this element when it's ready.
36
52
  */
37
53
  ready(): Promise<this>;
@@ -1,4 +1,5 @@
1
- import { ButtonComponent, Color, Vec4 } from 'playcanvas';
1
+ import type { ButtonComponent } from 'playcanvas';
2
+ import { Color, Vec4 } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The ButtonComponentElement interface provides properties and methods for manipulating
@@ -25,7 +26,7 @@ declare class ButtonComponentElement extends ComponentElement {
25
26
  private _inactiveSpriteFrame;
26
27
  /** @ignore */
27
28
  constructor();
28
- getInitialComponentData(): Record<string, any>;
29
+ protected getInitialComponentData(): Record<string, any>;
29
30
  /**
30
31
  * Gets the underlying PlayCanvas button component.
31
32
  * @returns The button component.
@@ -182,9 +183,4 @@ declare class ButtonComponentElement extends ComponentElement {
182
183
  static get observedAttributes(): string[];
183
184
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
184
185
  }
185
- declare global {
186
- interface HTMLElementTagNameMap {
187
- 'pc-button': ButtonComponentElement;
188
- }
189
- }
190
186
  export { ButtonComponentElement };
@@ -1,4 +1,5 @@
1
- import { CameraComponent, Color, Vec4 } from 'playcanvas';
1
+ import type { CameraComponent } from 'playcanvas';
2
+ import { Color, Vec4 } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The CameraComponentElement interface provides properties and methods for manipulating
@@ -29,7 +30,7 @@ declare class CameraComponentElement extends ComponentElement {
29
30
  private _tonemap;
30
31
  /** @ignore */
31
32
  constructor();
32
- getInitialComponentData(): {
33
+ protected getInitialComponentData(): {
33
34
  clearColor: Color;
34
35
  clearColorBuffer: boolean;
35
36
  clearDepthBuffer: boolean;
@@ -249,9 +250,4 @@ declare class CameraComponentElement extends ComponentElement {
249
250
  static get observedAttributes(): string[];
250
251
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
251
252
  }
252
- declare global {
253
- interface HTMLElementTagNameMap {
254
- 'pc-camera': CameraComponentElement;
255
- }
256
- }
257
253
  export { CameraComponentElement };
@@ -1,4 +1,5 @@
1
- import { CollisionComponent, Quat, Vec3 } from 'playcanvas';
1
+ import type { CollisionComponent } from 'playcanvas';
2
+ import { Quat, Vec3 } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The CollisionComponentElement interface provides properties and methods for manipulating
@@ -19,7 +20,7 @@ declare class CollisionComponentElement extends ComponentElement {
19
20
  private _type;
20
21
  /** @ignore */
21
22
  constructor();
22
- getInitialComponentData(): {
23
+ protected getInitialComponentData(): {
23
24
  axis: number;
24
25
  angularOffset: Quat;
25
26
  convexHull: boolean;
@@ -53,9 +54,4 @@ declare class CollisionComponentElement extends ComponentElement {
53
54
  static get observedAttributes(): string[];
54
55
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
55
56
  }
56
- declare global {
57
- interface HTMLElementTagNameMap {
58
- 'pc-collision': CollisionComponentElement;
59
- }
60
- }
61
57
  export { CollisionComponentElement };
@@ -1,4 +1,4 @@
1
- import { Component } from 'playcanvas';
1
+ import type { Component } from 'playcanvas';
2
2
  import { AsyncElement } from '../async-element';
3
3
  /**
4
4
  * Represents a component in the PlayCanvas engine.
@@ -10,6 +10,14 @@ declare class ComponentElement extends AsyncElement {
10
10
  private _enabled;
11
11
  private _component;
12
12
  private _appElement;
13
+ /**
14
+ * Incremented on every connect and disconnect. connectedCallback captures the value on entry
15
+ * and abandons itself wherever it resumes from an await if the value has moved on — so a
16
+ * callback whose element was removed cannot act on a torn-down tree, and one whose element
17
+ * was removed and re-inserted (which runs a callback of its own) cannot add the component a
18
+ * second time.
19
+ */
20
+ private _connectionGeneration;
13
21
  /**
14
22
  * Creates a new ComponentElement instance.
15
23
  *
@@ -17,9 +25,19 @@ declare class ComponentElement extends AsyncElement {
17
25
  * @ignore
18
26
  */
19
27
  constructor(componentName: string);
20
- getInitialComponentData(): {};
21
- addComponent(): Promise<void>;
22
- initComponent(): void;
28
+ /**
29
+ * Returns the data the component is created with. Overridden by subclasses to supply the
30
+ * initial values of their cached properties.
31
+ *
32
+ * @returns The initial component data.
33
+ */
34
+ protected getInitialComponentData(): {};
35
+ private _addComponent;
36
+ /**
37
+ * Configures the newly added component. Overridden by subclasses whose setup goes beyond
38
+ * the initial data — child-element handling, asset resolution and the like.
39
+ */
40
+ protected initComponent(): void;
23
41
  connectedCallback(): Promise<void>;
24
42
  disconnectedCallback(): void;
25
43
  /**
@@ -1,4 +1,5 @@
1
- import { Color, ElementComponent, Vec2, Vec4 } from 'playcanvas';
1
+ import type { ElementComponent } from 'playcanvas';
2
+ import { Color, Vec2, Vec4 } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The ElementComponentElement interface provides properties and methods for manipulating
@@ -37,8 +38,8 @@ declare class ElementComponentElement extends ComponentElement {
37
38
  private _wrapLines;
38
39
  /** @ignore */
39
40
  constructor();
40
- initComponent(): void;
41
- getInitialComponentData(): Record<string, any>;
41
+ protected initComponent(): void;
42
+ protected getInitialComponentData(): Record<string, any>;
42
43
  /**
43
44
  * Gets the underlying PlayCanvas element component.
44
45
  * @returns The element component.
@@ -312,9 +313,4 @@ declare class ElementComponentElement extends ComponentElement {
312
313
  static get observedAttributes(): string[];
313
314
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
314
315
  }
315
- declare global {
316
- interface HTMLElementTagNameMap {
317
- 'pc-element': ElementComponentElement;
318
- }
319
- }
320
316
  export { ElementComponentElement };
@@ -1,4 +1,4 @@
1
- import { GSplatComponent } from 'playcanvas';
1
+ import type { GSplatComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
4
  * The GSplatComponentElement interface provides properties and methods for manipulating
@@ -17,7 +17,7 @@ declare class GSplatComponentElement extends ComponentElement {
17
17
  private _lodRangeMax;
18
18
  /** @ignore */
19
19
  constructor();
20
- getInitialComponentData(): {
20
+ protected getInitialComponentData(): {
21
21
  asset: import("playcanvas").Asset | null | undefined;
22
22
  castShadows: boolean;
23
23
  lodBaseDistance: number;
@@ -105,9 +105,4 @@ declare class GSplatComponentElement extends ComponentElement {
105
105
  static get observedAttributes(): string[];
106
106
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
107
107
  }
108
- declare global {
109
- interface HTMLElementTagNameMap {
110
- 'pc-gsplat': GSplatComponentElement;
111
- }
112
- }
113
108
  export { GSplatComponentElement };
@@ -1,4 +1,4 @@
1
- import { LayoutChildComponent } from 'playcanvas';
1
+ import type { LayoutChildComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
4
  * The LayoutChildComponentElement interface provides properties and methods for manipulating
@@ -18,7 +18,7 @@ declare class LayoutChildComponentElement extends ComponentElement {
18
18
  private _excludeFromLayout;
19
19
  /** @ignore */
20
20
  constructor();
21
- getInitialComponentData(): {
21
+ protected getInitialComponentData(): {
22
22
  minWidth: number;
23
23
  minHeight: number;
24
24
  maxWidth: number | null;
@@ -107,9 +107,4 @@ declare class LayoutChildComponentElement extends ComponentElement {
107
107
  static get observedAttributes(): string[];
108
108
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
109
109
  }
110
- declare global {
111
- interface HTMLElementTagNameMap {
112
- 'pc-layoutchild': LayoutChildComponentElement;
113
- }
114
- }
115
110
  export { LayoutChildComponentElement };
@@ -1,4 +1,5 @@
1
- import { LayoutGroupComponent, Vec2, Vec4 } from 'playcanvas';
1
+ import type { LayoutGroupComponent } from 'playcanvas';
2
+ import { Vec2, Vec4 } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The LayoutGroupComponentElement interface provides properties and methods for manipulating
@@ -20,7 +21,7 @@ declare class LayoutGroupComponentElement extends ComponentElement {
20
21
  private _wrap;
21
22
  /** @ignore */
22
23
  constructor();
23
- getInitialComponentData(): {
24
+ protected getInitialComponentData(): {
24
25
  orientation: number | undefined;
25
26
  reverseX: boolean;
26
27
  reverseY: boolean;
@@ -132,9 +133,4 @@ declare class LayoutGroupComponentElement extends ComponentElement {
132
133
  static get observedAttributes(): string[];
133
134
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
134
135
  }
135
- declare global {
136
- interface HTMLElementTagNameMap {
137
- 'pc-layoutgroup': LayoutGroupComponentElement;
138
- }
139
- }
140
136
  export { LayoutGroupComponentElement };
@@ -1,4 +1,5 @@
1
- import { Color, LightComponent } from 'playcanvas';
1
+ import type { LightComponent } from 'playcanvas';
2
+ import { Color } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The LightComponentElement interface provides properties and methods for manipulating
@@ -30,7 +31,7 @@ declare class LightComponentElement extends ComponentElement {
30
31
  private _shadowBlockerSamples;
31
32
  /** @ignore */
32
33
  constructor();
33
- getInitialComponentData(): {
34
+ protected getInitialComponentData(): {
34
35
  castShadows: boolean;
35
36
  color: Color;
36
37
  innerConeAngle: number;
@@ -260,9 +261,4 @@ declare class LightComponentElement extends ComponentElement {
260
261
  static get observedAttributes(): string[];
261
262
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
262
263
  }
263
- declare global {
264
- interface HTMLElementTagNameMap {
265
- 'pc-light': LightComponentElement;
266
- }
267
- }
268
264
  export { LightComponentElement };
@@ -1,4 +1,4 @@
1
- import { AudioListenerComponent } from 'playcanvas';
1
+ import type { AudioListenerComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
4
  * The ListenerComponentElement interface provides properties and methods for manipulating
@@ -17,9 +17,4 @@ declare class ListenerComponentElement extends ComponentElement {
17
17
  */
18
18
  get component(): AudioListenerComponent;
19
19
  }
20
- declare global {
21
- interface HTMLElementTagNameMap {
22
- 'pc-listener': ListenerComponentElement;
23
- }
24
- }
25
20
  export { ListenerComponentElement };
@@ -1,4 +1,4 @@
1
- import { ParticleSystemComponent } from 'playcanvas';
1
+ import type { ParticleSystemComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
4
  * The ParticleSystemComponentElement interface provides properties and methods for manipulating
@@ -12,7 +12,7 @@ declare class ParticleSystemComponentElement extends ComponentElement {
12
12
  private _asset;
13
13
  /** @ignore */
14
14
  constructor();
15
- getInitialComponentData(): object;
15
+ protected getInitialComponentData(): object;
16
16
  /**
17
17
  * Gets the underlying PlayCanvas particle system component.
18
18
  * @returns The particle system component.
@@ -49,9 +49,4 @@ declare class ParticleSystemComponentElement extends ComponentElement {
49
49
  static get observedAttributes(): string[];
50
50
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
51
51
  }
52
- declare global {
53
- interface HTMLElementTagNameMap {
54
- 'pc-particles': ParticleSystemComponentElement;
55
- }
56
- }
57
52
  export { ParticleSystemComponentElement };
@@ -1,4 +1,4 @@
1
- import { RenderComponent, StandardMaterial } from 'playcanvas';
1
+ import type { RenderComponent, StandardMaterial } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
4
  * The RenderComponentElement interface provides properties and methods for manipulating
@@ -19,7 +19,7 @@ declare class RenderComponentElement extends ComponentElement {
19
19
  private _type;
20
20
  /** @ignore */
21
21
  constructor();
22
- getInitialComponentData(): {
22
+ protected getInitialComponentData(): {
23
23
  type: "box" | "capsule" | "cone" | "cylinder" | "sphere" | "plane";
24
24
  castShadows: boolean;
25
25
  material: StandardMaterial | null | undefined;
@@ -73,9 +73,4 @@ declare class RenderComponentElement extends ComponentElement {
73
73
  static get observedAttributes(): string[];
74
74
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
75
75
  }
76
- declare global {
77
- interface HTMLElementTagNameMap {
78
- 'pc-render': RenderComponentElement;
79
- }
80
- }
81
76
  export { RenderComponentElement };
@@ -1,4 +1,5 @@
1
- import { RigidBodyComponent, Vec3 } from 'playcanvas';
1
+ import type { RigidBodyComponent } from 'playcanvas';
2
+ import { Vec3 } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The RigidBodyComponentElement interface provides properties and methods for manipulating
@@ -47,7 +48,7 @@ declare class RigidBodyComponentElement extends ComponentElement {
47
48
  private _type;
48
49
  /** @ignore */
49
50
  constructor();
50
- getInitialComponentData(): {
51
+ protected getInitialComponentData(): {
51
52
  angularDamping: number;
52
53
  angularFactor: Vec3;
53
54
  friction: number;
@@ -84,9 +85,4 @@ declare class RigidBodyComponentElement extends ComponentElement {
84
85
  static get observedAttributes(): string[];
85
86
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
86
87
  }
87
- declare global {
88
- interface HTMLElementTagNameMap {
89
- 'pc-rigidbody': RigidBodyComponentElement;
90
- }
91
- }
92
88
  export { RigidBodyComponentElement };
@@ -1,4 +1,5 @@
1
- import { ScreenComponent, Vec2 } from 'playcanvas';
1
+ import type { ScreenComponent } from 'playcanvas';
2
+ import { Vec2 } from 'playcanvas';
2
3
  import { ComponentElement } from './component';
3
4
  /**
4
5
  * The ScreenComponentElement interface provides properties and methods for manipulating
@@ -17,7 +18,7 @@ declare class ScreenComponentElement extends ComponentElement {
17
18
  private _scaleBlend;
18
19
  /** @ignore */
19
20
  constructor();
20
- getInitialComponentData(): {
21
+ protected getInitialComponentData(): {
21
22
  priority: number;
22
23
  referenceResolution: Vec2;
23
24
  resolution: Vec2;
@@ -66,9 +67,4 @@ declare class ScreenComponentElement extends ComponentElement {
66
67
  static get observedAttributes(): string[];
67
68
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
68
69
  }
69
- declare global {
70
- interface HTMLElementTagNameMap {
71
- 'pc-screen': ScreenComponentElement;
72
- }
73
- }
74
70
  export { ScreenComponentElement };
@@ -1,28 +1,21 @@
1
- import { ScriptComponent } from 'playcanvas';
1
+ import type { ScriptComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
- interface ScriptAttributesChangeEvent extends CustomEvent {
3
+ export type ScriptAttributesChangeEvent = {
4
4
  detail: {
5
5
  attributes: Record<string, any>;
6
6
  };
7
- }
8
- interface ScriptEnableChangeEvent extends CustomEvent {
7
+ } & CustomEvent;
8
+ export type ScriptEnableChangeEvent = {
9
9
  detail: {
10
10
  enabled: boolean;
11
11
  };
12
- }
13
- interface ScriptNameChangeEvent extends CustomEvent {
12
+ } & CustomEvent;
13
+ export type ScriptNameChangeEvent = {
14
14
  detail: {
15
15
  oldName: string;
16
16
  newName: string;
17
17
  };
18
- }
19
- declare global {
20
- interface HTMLElementEventMap {
21
- 'scriptattributeschange': ScriptAttributesChangeEvent;
22
- 'scriptenablechange': ScriptEnableChangeEvent;
23
- 'scriptnamechange': ScriptNameChangeEvent;
24
- }
25
- }
18
+ } & CustomEvent;
26
19
  /**
27
20
  * The ScriptComponentElement interface provides properties and methods for manipulating
28
21
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
@@ -36,7 +29,7 @@ declare class ScriptComponentElement extends ComponentElement {
36
29
  /** @ignore */
37
30
  constructor();
38
31
  connectedCallback(): Promise<void>;
39
- initComponent(): void;
32
+ protected initComponent(): void;
40
33
  /**
41
34
  * Recursively converts raw attribute data into proper PlayCanvas types. Supported conversions:
42
35
  * - "asset:id" → the Asset created by the `pc-asset` element with that id
@@ -167,9 +160,4 @@ declare class ScriptComponentElement extends ComponentElement {
167
160
  */
168
161
  get component(): ScriptComponent;
169
162
  }
170
- declare global {
171
- interface HTMLElementTagNameMap {
172
- 'pc-scripts': ScriptComponentElement;
173
- }
174
- }
175
163
  export { ScriptComponentElement };
@@ -1,4 +1,4 @@
1
- import { Script } from 'playcanvas';
1
+ import type { Script } from 'playcanvas';
2
2
  import { AsyncElement } from '../async-element';
3
3
  /**
4
4
  * The ScriptElement interface provides properties and methods for manipulating
@@ -36,17 +36,6 @@ import { AsyncElement } from '../async-element';
36
36
  declare class ScriptElement extends AsyncElement {
37
37
  private _attributes;
38
38
  private _enabled;
39
- /**
40
- * Whether readiness has been signalled. Creation can happen more than once over an
41
- * element's life (a runtime `name` change recreates the instance), but `ready` is a
42
- * one-shot signal, so only the first successful creation fires it.
43
- */
44
- private _readySignalled;
45
- /**
46
- * The Script instance created for this element by its parent `<pc-scripts>` element.
47
- * @ignore
48
- */
49
- _script: Script | null;
50
39
  /**
51
40
  * Sets the attributes of the script as an object. Values are converted with the same rules
52
41
  * as the `attributes` attribute: `asset:`/`entity:` references and `vec2:`/`vec3:`/`vec4:`/
@@ -98,17 +87,8 @@ declare class ScriptElement extends AsyncElement {
98
87
  */
99
88
  get script(): Script | null;
100
89
  connectedCallback(): void;
101
- /**
102
- * Called by the parent `<pc-scripts>` element when the script instance has been created.
103
- * @ignore
104
- */
105
- _onScriptCreated(): void;
90
+ disconnectedCallback(): void;
106
91
  static get observedAttributes(): string[];
107
92
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
108
93
  }
109
- declare global {
110
- interface HTMLElementTagNameMap {
111
- 'pc-script': ScriptElement;
112
- }
113
- }
114
94
  export { ScriptElement };