@playcanvas/web-components 0.12.0 → 0.13.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 (95) hide show
  1. package/README.md +1 -1
  2. package/dist/app.d.cts +281 -0
  3. package/dist/app.d.ts +61 -3
  4. package/dist/asset.d.cts +224 -0
  5. package/dist/asset.d.ts +8 -2
  6. package/dist/async-element.d.cts +103 -0
  7. package/dist/async-element.d.ts +6 -4
  8. package/dist/colors.d.cts +1 -0
  9. package/dist/components/button-component.d.cts +186 -0
  10. package/dist/components/button-component.d.ts +1 -1
  11. package/dist/components/camera-component.d.cts +253 -0
  12. package/dist/components/camera-component.d.ts +1 -1
  13. package/dist/components/collision-component.d.cts +73 -0
  14. package/dist/components/collision-component.d.ts +1 -1
  15. package/dist/components/component.d.cts +82 -0
  16. package/dist/components/component.d.ts +1 -1
  17. package/dist/components/element-component.d.cts +316 -0
  18. package/dist/components/element-component.d.ts +1 -1
  19. package/dist/components/gsplat-component.d.cts +108 -0
  20. package/dist/components/gsplat-component.d.ts +1 -1
  21. package/dist/components/layoutchild-component.d.cts +110 -0
  22. package/dist/components/layoutchild-component.d.ts +1 -1
  23. package/dist/components/layoutgroup-component.d.cts +136 -0
  24. package/dist/components/layoutgroup-component.d.ts +1 -1
  25. package/dist/components/light-component.d.cts +264 -0
  26. package/dist/components/light-component.d.ts +1 -1
  27. package/dist/components/listener-component.d.cts +20 -0
  28. package/dist/components/listener-component.d.ts +1 -1
  29. package/dist/components/particlesystem-component.d.cts +52 -0
  30. package/dist/components/particlesystem-component.d.ts +1 -1
  31. package/dist/components/render-component.d.cts +76 -0
  32. package/dist/components/render-component.d.ts +1 -1
  33. package/dist/components/rigidbody-component.d.cts +88 -0
  34. package/dist/components/rigidbody-component.d.ts +1 -1
  35. package/dist/components/screen-component.d.cts +70 -0
  36. package/dist/components/screen-component.d.ts +1 -1
  37. package/dist/components/script-component.d.cts +163 -0
  38. package/dist/components/script-component.d.ts +1 -1
  39. package/dist/components/script.d.cts +94 -0
  40. package/dist/components/script.d.ts +1 -1
  41. package/dist/components/scrollbar-component.d.cts +69 -0
  42. package/dist/components/scrollbar-component.d.ts +1 -1
  43. package/dist/components/scrollview-component.d.cts +178 -0
  44. package/dist/components/scrollview-component.d.ts +1 -1
  45. package/dist/components/sound-component.d.cts +108 -0
  46. package/dist/components/sound-component.d.ts +1 -1
  47. package/dist/components/sound-slot.d.cts +134 -0
  48. package/dist/components/sound-slot.d.ts +2 -2
  49. package/dist/custom-elements.json +80 -22
  50. package/dist/entity-base.d.cts +67 -0
  51. package/dist/entity-base.d.ts +2 -2
  52. package/dist/entity.d.cts +131 -0
  53. package/dist/entity.d.ts +1 -1
  54. package/dist/index.d.cts +79 -0
  55. package/dist/index.d.ts +33 -33
  56. package/dist/loading-bar.d.cts +35 -0
  57. package/dist/material.d.cts +1011 -0
  58. package/dist/model.d.cts +72 -0
  59. package/dist/model.d.ts +1 -1
  60. package/dist/module.d.cts +29 -0
  61. package/dist/module.d.ts +16 -10
  62. package/dist/node.d.cts +253 -0
  63. package/dist/node.d.ts +1 -1
  64. package/dist/parse.d.cts +147 -0
  65. package/dist/pwc.cjs +285 -92
  66. package/dist/pwc.cjs.map +1 -1
  67. package/dist/pwc.js +286 -93
  68. package/dist/pwc.js.map +1 -1
  69. package/dist/pwc.min.js +1 -1
  70. package/dist/pwc.min.js.map +1 -1
  71. package/dist/pwc.min.mjs +1 -1
  72. package/dist/pwc.min.mjs.map +1 -1
  73. package/dist/pwc.mjs +286 -93
  74. package/dist/pwc.mjs.map +1 -1
  75. package/dist/scene.d.cts +117 -0
  76. package/dist/scene.d.ts +1 -1
  77. package/dist/sky.d.cts +121 -0
  78. package/dist/sky.d.ts +1 -1
  79. package/dist/vscode.html-custom-data.json +3 -3
  80. package/dist/web-types.json +42 -6
  81. package/package.json +16 -7
  82. package/src/app.ts +211 -49
  83. package/src/asset.ts +34 -2
  84. package/src/async-element.ts +4 -2
  85. package/src/components/button-component.ts +7 -7
  86. package/src/components/element-component.ts +7 -7
  87. package/src/components/gsplat-component.ts +3 -3
  88. package/src/components/particlesystem-component.ts +7 -8
  89. package/src/components/script-component.ts +2 -2
  90. package/src/components/sound-slot.ts +2 -2
  91. package/src/loading-bar.ts +2 -2
  92. package/src/material.ts +2 -2
  93. package/src/model.ts +2 -5
  94. package/src/module.ts +39 -20
  95. package/src/sky.ts +2 -3
@@ -0,0 +1,117 @@
1
+ import type { Scene } from 'playcanvas';
2
+ import { Color, Vec3 } from 'playcanvas';
3
+ import { AsyncElement } from './async-element.cjs';
4
+ /**
5
+ * The SceneElement interface provides properties and methods for manipulating
6
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
7
+ * The SceneElement interface also inherits the properties and methods of the
8
+ * {@link HTMLElement} interface.
9
+ */
10
+ declare class SceneElement extends AsyncElement {
11
+ /**
12
+ * The fog type of the scene.
13
+ */
14
+ private _fog;
15
+ /**
16
+ * The color of the fog.
17
+ */
18
+ private _fogColor;
19
+ /**
20
+ * The density of the fog.
21
+ */
22
+ private _fogDensity;
23
+ /**
24
+ * The start distance of the fog.
25
+ */
26
+ private _fogStart;
27
+ /**
28
+ * The end distance of the fog.
29
+ */
30
+ private _fogEnd;
31
+ /**
32
+ * The gravity of the scene.
33
+ */
34
+ private _gravity;
35
+ private _scene;
36
+ /**
37
+ * The PlayCanvas scene instance. `null` until the element is ready — await
38
+ * {@link whenReady} or the element's `ready()` promise before accessing it.
39
+ * @returns The scene instance, or `null`.
40
+ */
41
+ get scene(): Scene | null;
42
+ connectedCallback(): Promise<void>;
43
+ disconnectedCallback(): void;
44
+ private _updateSceneSettings;
45
+ /**
46
+ * Applies gravity to the rigid body system. Resolved through `closestApp` rather than
47
+ * `parentElement` so that a `<pc-scene>` nested inside a wrapper element behaves the same as
48
+ * a direct child, matching how `connectedCallback` resolves the application.
49
+ *
50
+ * @param value - The gravity to apply.
51
+ */
52
+ private _applyGravity;
53
+ /**
54
+ * Sets the fog type of the scene. Can be `none`, `linear`, `exp` or `exp2`. Defaults to
55
+ * `none`.
56
+ * @param value - The fog type.
57
+ */
58
+ set fog(value: "linear" | "none" | "exp" | "exp2");
59
+ /**
60
+ * Gets the fog type of the scene.
61
+ * @returns The fog type.
62
+ */
63
+ get fog(): "linear" | "none" | "exp" | "exp2";
64
+ /**
65
+ * Sets the fog color of the scene.
66
+ * @param value - The fog color.
67
+ */
68
+ set fogColor(value: Color);
69
+ /**
70
+ * Gets the fog color of the scene.
71
+ * @returns The fog color.
72
+ */
73
+ get fogColor(): Color;
74
+ /**
75
+ * Sets the fog density of the scene.
76
+ * @param value - The fog density.
77
+ */
78
+ set fogDensity(value: number);
79
+ /**
80
+ * Gets the fog density of the scene.
81
+ * @returns The fog density.
82
+ */
83
+ get fogDensity(): number;
84
+ /**
85
+ * Sets the fog start distance of the scene.
86
+ * @param value - The fog start distance.
87
+ */
88
+ set fogStart(value: number);
89
+ /**
90
+ * Gets the fog start distance of the scene.
91
+ * @returns The fog start distance.
92
+ */
93
+ get fogStart(): number;
94
+ /**
95
+ * Sets the fog end distance of the scene.
96
+ * @param value - The fog end distance.
97
+ */
98
+ set fogEnd(value: number);
99
+ /**
100
+ * Gets the fog end distance of the scene.
101
+ * @returns The fog end distance.
102
+ */
103
+ get fogEnd(): number;
104
+ /**
105
+ * Sets the gravity of the scene.
106
+ * @param value - The gravity.
107
+ */
108
+ set gravity(value: Vec3);
109
+ /**
110
+ * Gets the gravity of the scene.
111
+ * @returns The gravity.
112
+ */
113
+ get gravity(): Vec3;
114
+ static get observedAttributes(): string[];
115
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
116
+ }
117
+ export { SceneElement };
package/dist/scene.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Scene } from 'playcanvas';
2
2
  import { Color, Vec3 } from 'playcanvas';
3
- import { AsyncElement } from './async-element';
3
+ import { AsyncElement } from './async-element.js';
4
4
  /**
5
5
  * The SceneElement interface provides properties and methods for manipulating
6
6
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
package/dist/sky.d.cts ADDED
@@ -0,0 +1,121 @@
1
+ import { Vec3 } from 'playcanvas';
2
+ import { AsyncElement } from './async-element.cjs';
3
+ /**
4
+ * The SkyElement interface provides properties and methods for manipulating
5
+ * `<pc-sky>` elements. The SkyElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
7
+ */
8
+ declare class SkyElement extends AsyncElement {
9
+ private _asset;
10
+ private _center;
11
+ private _intensity;
12
+ private _rotation;
13
+ private _mipLevel;
14
+ private _lighting;
15
+ private _scale;
16
+ private _type;
17
+ private _scene;
18
+ private _appElement;
19
+ /**
20
+ * Incremented on every new load and on disconnect, and captured by a load when it starts. A
21
+ * load that resumes from an await or a load callback abandons itself if the value has moved
22
+ * on, so a superseded load cannot generate a skybox for a scene it no longer configures.
23
+ */
24
+ private _loadGeneration;
25
+ /**
26
+ * The pending asset-load subscription of the current load, if it is waiting for its asset.
27
+ * Held so that whatever supersedes the load can detach the handler from the asset, rather
28
+ * than leave it registered until the asset loads (or forever, if it never does).
29
+ */
30
+ private _loadHandle;
31
+ connectedCallback(): void;
32
+ disconnectedCallback(): void;
33
+ private _detachLoadHandler;
34
+ private _generateSkybox;
35
+ private _loadSkybox;
36
+ private _unloadSkybox;
37
+ /**
38
+ * Sets the id of the `pc-asset` to use for the skybox.
39
+ * @param value - The asset ID.
40
+ */
41
+ set asset(value: string);
42
+ /**
43
+ * Gets the id of the `pc-asset` to use for the skybox.
44
+ * @returns The asset ID.
45
+ */
46
+ get asset(): string;
47
+ /**
48
+ * Sets the center of the skybox.
49
+ * @param value - The center.
50
+ */
51
+ set center(value: Vec3);
52
+ /**
53
+ * Gets the center of the skybox.
54
+ * @returns The center.
55
+ */
56
+ get center(): Vec3;
57
+ /**
58
+ * Sets the intensity of the skybox.
59
+ * @param value - The intensity.
60
+ */
61
+ set intensity(value: number);
62
+ /**
63
+ * Gets the intensity of the skybox.
64
+ * @returns The intensity.
65
+ */
66
+ get intensity(): number;
67
+ /**
68
+ * Sets whether the skybox is used as a light source.
69
+ * @param value - Whether to use lighting.
70
+ */
71
+ set lighting(value: boolean);
72
+ /**
73
+ * Gets whether the skybox is used as a light source.
74
+ * @returns Whether to use lighting.
75
+ */
76
+ get lighting(): boolean;
77
+ /**
78
+ * Sets the mip level of the skybox, where 0 is the sharpest. Raising it selects a blurrier mip,
79
+ * which is how a skybox is softened without blurring the texture itself.
80
+ * @param value - The mip level.
81
+ */
82
+ set mipLevel(value: number);
83
+ /**
84
+ * Gets the mip level of the skybox.
85
+ * @returns The mip level.
86
+ */
87
+ get mipLevel(): number;
88
+ /**
89
+ * Sets the Euler rotation of the skybox.
90
+ * @param value - The rotation.
91
+ */
92
+ set rotation(value: Vec3);
93
+ /**
94
+ * Gets the Euler rotation of the skybox.
95
+ * @returns The rotation.
96
+ */
97
+ get rotation(): Vec3;
98
+ /**
99
+ * Sets the scale of the skybox.
100
+ * @param value - The scale.
101
+ */
102
+ set scale(value: Vec3);
103
+ /**
104
+ * Gets the scale of the skybox.
105
+ * @returns The scale.
106
+ */
107
+ get scale(): Vec3;
108
+ /**
109
+ * Sets the type of the skybox.
110
+ * @param value - The type.
111
+ */
112
+ set type(value: 'box' | 'dome' | 'infinite' | 'none');
113
+ /**
114
+ * Gets the type of the skybox.
115
+ * @returns The type.
116
+ */
117
+ get type(): "box" | "dome" | "infinite" | "none";
118
+ static get observedAttributes(): string[];
119
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
120
+ }
121
+ export { SkyElement };
package/dist/sky.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Vec3 } from 'playcanvas';
2
- import { AsyncElement } from './async-element';
2
+ import { AsyncElement } from './async-element.js';
3
3
  /**
4
4
  * The SkyElement interface provides properties and methods for manipulating
5
5
  * `<pc-sky>` elements. The SkyElement interface also inherits the properties and
@@ -4,7 +4,7 @@
4
4
  "tags": [
5
5
  {
6
6
  "name": "pc-app",
7
- "description": "The AppElement interface provides properties and methods for manipulating\n[`<pc-app>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/) elements.\nThe AppElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **progress** - Fired while the application preloads its assets. `loaded` and `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded. Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does not bubble.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **elementFromEntity(entity: _Entity_): __** - Returns the `<pc-entity>` or `<pc-node>` element whose backing entity is `entity`, or\n`null` if the entity is not fronted by an element of this application - for example, an\nunbound node inside a model's instantiated hierarchy, or an entity created through the\nengine API.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
7
+ "description": "The AppElement interface provides properties and methods for manipulating\n[`<pc-app>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/) elements.\nThe AppElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element is sized like a replaced element such as `<video>`: a block-level box that the\npage's CSS controls, 300x150 by default. The application's canvas always fills the element,\nand the drawing buffer resolution follows the element's size (capped by `max-pixel-ratio`),\ntracked live via a ResizeObserver — so the element can be embedded at any size, resized by\nits container, or made fullscreen with ordinary CSS such as `width: 100vw; height: 100dvh`.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the application cannot boot because no graphics device could be created (for example, a browser with WebGL disabled). `message` names the requested backends and `error` holds the underlying failure. The element never becomes ready and `app` stays `null` — listen for this event to show a fallback UI. Removing the element and re-inserting it retries the boot with its current attributes. Does not bubble.\n- **progress** - Fired while the application preloads its assets. `loaded` and `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded. Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does not bubble.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **elementFromEntity(entity: _Entity_): __** - Returns the `<pc-entity>` or `<pc-node>` element whose backing entity is `entity`, or\n`null` if the entity is not fronted by an element of this application - for example, an\nunbound node inside a model's instantiated hierarchy, or an entity created through the\nengine API.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
8
8
  "attributes": [
9
9
  {
10
10
  "name": "alpha",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  {
52
52
  "name": "pc-asset",
53
- "description": "The AssetElement interface provides properties and methods for manipulating\n[`<pc-asset>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/) elements.\nThe AssetElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element becomes ready once the containing application has started and the asset is in the\nstate declared by the markup: loaded for preloaded assets (even if loading failed — check the\nasset's `resource`), or registered and awaiting a load for `lazy` assets. Elements inserted\nwhile the application is running are created and registered on insertion, and begin loading\nimmediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed\nelsewhere, or with an unsupported asset type, never become ready.\n\nFor `texture` and `textureatlas` assets, the texture options (`address-u`, `address-v`,\n`min-filter`, `mag-filter`, `anisotropy`, `mipmaps`, `srgb`, `flip-y`) apply when the texture is\ncreated and — like `lazy` — are observed: changing one updates a texture that has already\nloaded, and removing one restores the engine default. Changing `srgb` or `mipmaps` on a loaded\ntexture recreates the underlying GPU resource, so prefer declaring those up front. Each option\noverrides the matching key in the `data` JSON; options left unset write nothing, leaving the\nengine's per-format defaults in force.\n\nApart from `lazy` and the texture options, these attributes are read once when the asset is\ncreated, so changing them later has no effect.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the asset fails to load, with the engine's error in `message`. Does not bubble. The element still becomes ready — readiness means the load settled, not that it succeeded.\n- **load** - Fired each time the asset finishes loading, including a `lazy` asset loaded later and any subsequent reloads. Does not bubble — listen on this element, or use a capture-phase listener on an ancestor to observe every asset.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **get(id: _string_): __** - Returns the Asset created by the `<pc-asset>` element with the given `id`, or\n`undefined` if there is no such element or its asset has not been created yet.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
53
+ "description": "The AssetElement interface provides properties and methods for manipulating\n[`<pc-asset>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/) elements.\nThe AssetElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element becomes ready once the containing application has started and the asset is in the\nstate declared by the markup: loaded for preloaded assets (even if loading failed — check the\nasset's `resource`), or registered and awaiting a load for `lazy` assets. Elements inserted\nwhile the application is running are created and registered on insertion, and begin loading\nimmediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed\nelsewhere, or with an unsupported asset type, never become ready.\n\nA `lazy` asset loads on first use: the first time any element resolves it by `id` — a model,\na material map, a sky, a script `asset:` reference — or when the `lazy` attribute is removed,\nwhichever comes first. Until then it stays registered and unloaded.\n\nFor `texture` and `textureatlas` assets, the texture options (`address-u`, `address-v`,\n`min-filter`, `mag-filter`, `anisotropy`, `mipmaps`, `srgb`, `flip-y`) apply when the texture is\ncreated and — like `lazy` — are observed: changing one updates a texture that has already\nloaded, and removing one restores the engine default. Changing `srgb` or `mipmaps` on a loaded\ntexture recreates the underlying GPU resource, so prefer declaring those up front. Each option\noverrides the matching key in the `data` JSON; options left unset write nothing, leaving the\nengine's per-format defaults in force.\n\nApart from `lazy` and the texture options, these attributes are read once when the asset is\ncreated, so changing them later has no effect.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the asset fails to load, with the engine's error in `message`. Does not bubble. The element still becomes ready — readiness means the load settled, not that it succeeded.\n- **load** - Fired each time the asset finishes loading, including a `lazy` asset loaded later and any subsequent reloads. Does not bubble — listen on this element, or use a capture-phase listener on an ancestor to observe every asset.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **get(id: _string_): __** - Returns the Asset created by the `<pc-asset>` element with the given `id`, or\n`undefined` if there is no such element or its asset has not been created yet.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
54
54
  "attributes": [
55
55
  {
56
56
  "name": "address-u",
@@ -710,7 +710,7 @@
710
710
  },
711
711
  {
712
712
  "name": "pc-module",
713
- "description": "The ModuleElement interface provides properties and methods for manipulating\n[`<pc-module>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/) elements.\nThe ModuleElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nNote that these attributes are read once when the element is created, so changing them later\nhas no effect.\n\n---\n",
713
+ "description": "The ModuleElement interface provides properties and methods for manipulating\n[`<pc-module>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/)\nelements. The ModuleElement interface also inherits the properties and methods of the\nAsyncElement interface.\n\nThe attributes are read once, when the module starts loading - on the element's first\nconnection, or earlier if a containing `<pc-app>` boots first and collects it - so changing\nthem later has no effect. The element becomes ready once the module has loaded. WebAssembly\nmodules configure engine-global state that never unloads, so readiness is not re-armed by\nremoving the element, and a re-inserted element does not load again.\n\nA `<pc-module>` without a `name` warns and never becomes ready; a containing `<pc-app>` still\nboots.\n\n---\n\n\n### **Events:**\n - **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
714
714
  "attributes": [
715
715
  {
716
716
  "name": "fallback",
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@playcanvas/web-components",
4
- "version": "0.12.0",
4
+ "version": "0.13.1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "pc-app",
11
- "description": "The AppElement interface provides properties and methods for manipulating\n[`<pc-app>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/) elements.\nThe AppElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **progress** - Fired while the application preloads its assets. `loaded` and `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded. Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does not bubble.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **elementFromEntity(entity: _Entity_): __** - Returns the `<pc-entity>` or `<pc-node>` element whose backing entity is `entity`, or\n`null` if the entity is not fronted by an element of this application - for example, an\nunbound node inside a model's instantiated hierarchy, or an entity created through the\nengine API.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
11
+ "description": "The AppElement interface provides properties and methods for manipulating\n[`<pc-app>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/) elements.\nThe AppElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element is sized like a replaced element such as `<video>`: a block-level box that the\npage's CSS controls, 300x150 by default. The application's canvas always fills the element,\nand the drawing buffer resolution follows the element's size (capped by `max-pixel-ratio`),\ntracked live via a ResizeObserver — so the element can be embedded at any size, resized by\nits container, or made fullscreen with ordinary CSS such as `width: 100vw; height: 100dvh`.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the application cannot boot because no graphics device could be created (for example, a browser with WebGL disabled). `message` names the requested backends and `error` holds the underlying failure. The element never becomes ready and `app` stays `null` — listen for this event to show a fallback UI. Removing the element and re-inserting it retries the boot with its current attributes. Does not bubble.\n- **progress** - Fired while the application preloads its assets. `loaded` and `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded. Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does not bubble.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **elementFromEntity(entity: _Entity_): __** - Returns the `<pc-entity>` or `<pc-node>` element whose backing entity is `entity`, or\n`null` if the entity is not fronted by an element of this application - for example, an\nunbound node inside a model's instantiated hierarchy, or an entity created through the\nengine API.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
12
12
  "doc-url": "",
13
13
  "attributes": [
14
14
  {
@@ -51,6 +51,11 @@
51
51
  }
52
52
  ],
53
53
  "events": [
54
+ {
55
+ "name": "error",
56
+ "type": "ErrorEvent",
57
+ "description": "Fired when the application cannot boot because no graphics device could be created (for example, a browser with WebGL disabled). `message` names the requested backends and `error` holds the underlying failure. The element never becomes ready and `app` stays `null` — listen for this event to show a fallback UI. Removing the element and re-inserting it retries the boot with its current attributes. Does not bubble."
58
+ },
54
59
  {
55
60
  "name": "progress",
56
61
  "type": "ProgressEvent",
@@ -114,6 +119,11 @@
114
119
  }
115
120
  ],
116
121
  "events": [
122
+ {
123
+ "name": "error",
124
+ "type": "ErrorEvent",
125
+ "description": "Fired when the application cannot boot because no graphics device could be created (for example, a browser with WebGL disabled). `message` names the requested backends and `error` holds the underlying failure. The element never becomes ready and `app` stays `null` — listen for this event to show a fallback UI. Removing the element and re-inserting it retries the boot with its current attributes. Does not bubble."
126
+ },
117
127
  {
118
128
  "name": "progress",
119
129
  "type": "ProgressEvent",
@@ -129,7 +139,7 @@
129
139
  },
130
140
  {
131
141
  "name": "pc-asset",
132
- "description": "The AssetElement interface provides properties and methods for manipulating\n[`<pc-asset>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/) elements.\nThe AssetElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element becomes ready once the containing application has started and the asset is in the\nstate declared by the markup: loaded for preloaded assets (even if loading failed — check the\nasset's `resource`), or registered and awaiting a load for `lazy` assets. Elements inserted\nwhile the application is running are created and registered on insertion, and begin loading\nimmediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed\nelsewhere, or with an unsupported asset type, never become ready.\n\nFor `texture` and `textureatlas` assets, the texture options (`address-u`, `address-v`,\n`min-filter`, `mag-filter`, `anisotropy`, `mipmaps`, `srgb`, `flip-y`) apply when the texture is\ncreated and — like `lazy` — are observed: changing one updates a texture that has already\nloaded, and removing one restores the engine default. Changing `srgb` or `mipmaps` on a loaded\ntexture recreates the underlying GPU resource, so prefer declaring those up front. Each option\noverrides the matching key in the `data` JSON; options left unset write nothing, leaving the\nengine's per-format defaults in force.\n\nApart from `lazy` and the texture options, these attributes are read once when the asset is\ncreated, so changing them later has no effect.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the asset fails to load, with the engine's error in `message`. Does not bubble. The element still becomes ready — readiness means the load settled, not that it succeeded.\n- **load** - Fired each time the asset finishes loading, including a `lazy` asset loaded later and any subsequent reloads. Does not bubble — listen on this element, or use a capture-phase listener on an ancestor to observe every asset.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **get(id: _string_): __** - Returns the Asset created by the `<pc-asset>` element with the given `id`, or\n`undefined` if there is no such element or its asset has not been created yet.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
142
+ "description": "The AssetElement interface provides properties and methods for manipulating\n[`<pc-asset>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/) elements.\nThe AssetElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element becomes ready once the containing application has started and the asset is in the\nstate declared by the markup: loaded for preloaded assets (even if loading failed — check the\nasset's `resource`), or registered and awaiting a load for `lazy` assets. Elements inserted\nwhile the application is running are created and registered on insertion, and begin loading\nimmediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed\nelsewhere, or with an unsupported asset type, never become ready.\n\nA `lazy` asset loads on first use: the first time any element resolves it by `id` — a model,\na material map, a sky, a script `asset:` reference — or when the `lazy` attribute is removed,\nwhichever comes first. Until then it stays registered and unloaded.\n\nFor `texture` and `textureatlas` assets, the texture options (`address-u`, `address-v`,\n`min-filter`, `mag-filter`, `anisotropy`, `mipmaps`, `srgb`, `flip-y`) apply when the texture is\ncreated and — like `lazy` — are observed: changing one updates a texture that has already\nloaded, and removing one restores the engine default. Changing `srgb` or `mipmaps` on a loaded\ntexture recreates the underlying GPU resource, so prefer declaring those up front. Each option\noverrides the matching key in the `data` JSON; options left unset write nothing, leaving the\nengine's per-format defaults in force.\n\nApart from `lazy` and the texture options, these attributes are read once when the asset is\ncreated, so changing them later has no effect.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the asset fails to load, with the engine's error in `message`. Does not bubble. The element still becomes ready — readiness means the load settled, not that it succeeded.\n- **load** - Fired each time the asset finishes loading, including a `lazy` asset loaded later and any subsequent reloads. Does not bubble — listen on this element, or use a capture-phase listener on an ancestor to observe every asset.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **get(id: _string_): __** - Returns the Asset created by the `<pc-asset>` element with the given `id`, or\n`undefined` if there is no such element or its asset has not been created yet.\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
133
143
  "doc-url": "",
134
144
  "attributes": [
135
145
  {
@@ -1344,7 +1354,7 @@
1344
1354
  },
1345
1355
  {
1346
1356
  "name": "pc-module",
1347
- "description": "The ModuleElement interface provides properties and methods for manipulating\n[`<pc-module>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/) elements.\nThe ModuleElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nNote that these attributes are read once when the element is created, so changing them later\nhas no effect.\n\n---\n",
1357
+ "description": "The ModuleElement interface provides properties and methods for manipulating\n[`<pc-module>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/)\nelements. The ModuleElement interface also inherits the properties and methods of the\nAsyncElement interface.\n\nThe attributes are read once, when the module starts loading - on the element's first\nconnection, or earlier if a containing `<pc-app>` boots first and collects it - so changing\nthem later has no effect. The element becomes ready once the module has loaded. WebAssembly\nmodules configure engine-global state that never unloads, so readiness is not re-armed by\nremoving the element, and a re-inserted element does not load again.\n\nA `<pc-module>` without a `name` warns and never becomes ready; a containing `<pc-app>` still\nboots.\n\n---\n\n\n### **Events:**\n - **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
1348
1358
  "doc-url": "",
1349
1359
  "attributes": [
1350
1360
  {
@@ -1368,8 +1378,34 @@
1368
1378
  "value": { "type": "string" }
1369
1379
  }
1370
1380
  ],
1371
- "events": [],
1372
- "js": { "properties": [], "events": [] }
1381
+ "events": [
1382
+ {
1383
+ "name": "ready",
1384
+ "type": "CustomEvent",
1385
+ "description": "Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed."
1386
+ }
1387
+ ],
1388
+ "js": {
1389
+ "properties": [
1390
+ {
1391
+ "name": "closestApp",
1392
+ "description": "The nearest ancestor `<pc-app>` element, or `null` if this element has no `<pc-app>`\nancestor. The search starts at the parent, so an element never resolves to itself.",
1393
+ "type": "AppElement | null"
1394
+ },
1395
+ {
1396
+ "name": "closestEntity",
1397
+ "description": "The nearest ancestor element that fronts an entity — `<pc-entity>` or `<pc-node>` — or\n`null` if this element has no such ancestor. The search starts at the parent, so an element\nnever resolves to itself.",
1398
+ "type": "EntityBaseElement | null"
1399
+ }
1400
+ ],
1401
+ "events": [
1402
+ {
1403
+ "name": "ready",
1404
+ "type": "CustomEvent",
1405
+ "description": "Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed."
1406
+ }
1407
+ ]
1408
+ }
1373
1409
  },
1374
1410
  {
1375
1411
  "name": "pc-node",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/web-components",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://playcanvas.com",
6
6
  "description": "Web Components for the PlayCanvas Engine",
@@ -32,14 +32,23 @@
32
32
  "web-types": "dist/web-types.json",
33
33
  "exports": {
34
34
  ".": {
35
- "types": "./dist/index.d.ts",
36
- "import": "./dist/pwc.mjs",
37
- "require": "./dist/pwc.cjs"
35
+ "import": {
36
+ "types": "./dist/index.d.ts",
37
+ "default": "./dist/pwc.mjs"
38
+ },
39
+ "require": {
40
+ "types": "./dist/index.d.cts",
41
+ "default": "./dist/pwc.cjs"
42
+ }
38
43
  },
39
44
  "./dist/*": "./dist/*",
40
45
  "./package.json": "./package.json"
41
46
  },
42
47
  "type": "module",
48
+ "sideEffects": true,
49
+ "engines": {
50
+ "node": ">=18.3.0"
51
+ },
43
52
  "files": [
44
53
  "dist",
45
54
  "src"
@@ -47,7 +56,7 @@
47
56
  "scripts": {
48
57
  "prebuild": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
49
58
  "build": "rollup -c",
50
- "postbuild": "npm run cem",
59
+ "postbuild": "node utils/fix-declarations.mjs && npm run cem",
51
60
  "cem": "cem analyze && node utils/cem/validate.mjs",
52
61
  "dev": "concurrently \"npm run watch\" \"npm run serve\"",
53
62
  "docs": "typedoc",
@@ -89,9 +98,9 @@
89
98
  "eslint": "9.39.5",
90
99
  "globals": "17.9.0",
91
100
  "jsdom": "30.0.1",
92
- "mediabunny": "1.52.3",
101
+ "mediabunny": "1.53.0",
93
102
  "opentype.js": "2.0.0",
94
- "playcanvas": "2.22.0-beta.10",
103
+ "playcanvas": "2.22.0-beta.12",
95
104
  "prettier": "3.9.6",
96
105
  "publint": "0.3.23",
97
106
  "rollup": "4.62.4",