@playcanvas/web-components 0.17.0 → 0.19.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 (117) hide show
  1. package/README.md +5 -3
  2. package/dist/app.d.cts +28 -3
  3. package/dist/app.d.ts +28 -3
  4. package/dist/asset.d.cts +13 -3
  5. package/dist/asset.d.ts +13 -3
  6. package/dist/components/anim-clip.d.cts +3 -1
  7. package/dist/components/anim-clip.d.ts +3 -1
  8. package/dist/components/anim-component.d.cts +5 -0
  9. package/dist/components/anim-component.d.ts +5 -0
  10. package/dist/components/audio-listener-component.d.cts +4 -0
  11. package/dist/components/audio-listener-component.d.ts +4 -0
  12. package/dist/components/button-component.d.cts +5 -0
  13. package/dist/components/button-component.d.ts +5 -0
  14. package/dist/components/camera-component.d.cts +35 -1
  15. package/dist/components/camera-component.d.ts +35 -1
  16. package/dist/components/collision-component.d.cts +4 -0
  17. package/dist/components/collision-component.d.ts +4 -0
  18. package/dist/components/element-component.d.cts +4 -0
  19. package/dist/components/element-component.d.ts +4 -0
  20. package/dist/components/gsplat-component.d.cts +4 -0
  21. package/dist/components/gsplat-component.d.ts +4 -0
  22. package/dist/components/joint-component.d.cts +12 -2
  23. package/dist/components/joint-component.d.ts +12 -2
  24. package/dist/components/layout-child-component.d.cts +4 -0
  25. package/dist/components/layout-child-component.d.ts +4 -0
  26. package/dist/components/layout-group-component.d.cts +4 -0
  27. package/dist/components/layout-group-component.d.ts +4 -0
  28. package/dist/components/light-component.d.cts +50 -1
  29. package/dist/components/light-component.d.ts +50 -1
  30. package/dist/components/particle-system-component.d.cts +4 -0
  31. package/dist/components/particle-system-component.d.ts +4 -0
  32. package/dist/components/render-component.d.cts +5 -0
  33. package/dist/components/render-component.d.ts +5 -0
  34. package/dist/components/rigid-body-component.d.cts +5 -0
  35. package/dist/components/rigid-body-component.d.ts +5 -0
  36. package/dist/components/screen-component.d.cts +4 -0
  37. package/dist/components/screen-component.d.ts +4 -0
  38. package/dist/components/script-component.d.cts +3 -0
  39. package/dist/components/script-component.d.ts +3 -0
  40. package/dist/components/script-instance.d.cts +4 -0
  41. package/dist/components/script-instance.d.ts +4 -0
  42. package/dist/components/scroll-view-component.d.cts +4 -0
  43. package/dist/components/scroll-view-component.d.ts +4 -0
  44. package/dist/components/scrollbar-component.d.cts +4 -0
  45. package/dist/components/scrollbar-component.d.ts +4 -0
  46. package/dist/components/sound-component.d.cts +4 -0
  47. package/dist/components/sound-component.d.ts +4 -0
  48. package/dist/components/sound-slot.d.cts +3 -0
  49. package/dist/components/sound-slot.d.ts +3 -0
  50. package/dist/custom-elements.json +338 -7
  51. package/dist/entity-base.d.cts +5 -4
  52. package/dist/entity-base.d.ts +5 -4
  53. package/dist/entity-owner.d.cts +2 -2
  54. package/dist/entity-owner.d.ts +2 -2
  55. package/dist/entity.d.cts +13 -2
  56. package/dist/entity.d.ts +13 -2
  57. package/dist/index.d.cts +4 -1
  58. package/dist/index.d.ts +4 -1
  59. package/dist/material.d.cts +18 -7
  60. package/dist/material.d.ts +18 -7
  61. package/dist/model.d.cts +11 -0
  62. package/dist/model.d.ts +11 -0
  63. package/dist/node.d.cts +12 -1
  64. package/dist/node.d.ts +12 -1
  65. package/dist/pwc.cjs +601 -206
  66. package/dist/pwc.cjs.map +1 -1
  67. package/dist/pwc.js +601 -206
  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 +602 -207
  74. package/dist/pwc.mjs.map +1 -1
  75. package/dist/scene.d.cts +19 -0
  76. package/dist/scene.d.ts +19 -0
  77. package/dist/sky.d.cts +4 -0
  78. package/dist/sky.d.ts +4 -0
  79. package/dist/vscode.html-custom-data.json +257 -62
  80. package/dist/wasm.d.cts +4 -0
  81. package/dist/wasm.d.ts +4 -0
  82. package/dist/web-types.json +169 -69
  83. package/package.json +3 -3
  84. package/src/app.ts +150 -71
  85. package/src/asset.ts +13 -4
  86. package/src/components/anim-clip.ts +3 -1
  87. package/src/components/anim-component.ts +5 -0
  88. package/src/components/audio-listener-component.ts +4 -0
  89. package/src/components/button-component.ts +5 -0
  90. package/src/components/camera-component.ts +63 -6
  91. package/src/components/collision-component.ts +4 -0
  92. package/src/components/element-component.ts +4 -0
  93. package/src/components/gsplat-component.ts +4 -0
  94. package/src/components/joint-component.ts +12 -2
  95. package/src/components/layout-child-component.ts +4 -0
  96. package/src/components/layout-group-component.ts +4 -0
  97. package/src/components/light-component.ts +108 -17
  98. package/src/components/particle-system-component.ts +4 -0
  99. package/src/components/render-component.ts +5 -0
  100. package/src/components/rigid-body-component.ts +5 -0
  101. package/src/components/screen-component.ts +4 -0
  102. package/src/components/script-component.ts +3 -0
  103. package/src/components/script-instance.ts +4 -0
  104. package/src/components/scroll-view-component.ts +4 -0
  105. package/src/components/scrollbar-component.ts +4 -0
  106. package/src/components/sound-component.ts +4 -0
  107. package/src/components/sound-slot.ts +3 -0
  108. package/src/entity-base.ts +28 -16
  109. package/src/entity-owner.ts +2 -2
  110. package/src/entity.ts +16 -4
  111. package/src/index.ts +12 -1
  112. package/src/material.ts +19 -8
  113. package/src/model.ts +14 -2
  114. package/src/node.ts +15 -3
  115. package/src/scene.ts +35 -1
  116. package/src/sky.ts +4 -0
  117. package/src/wasm.ts +4 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Reddit](https://img.shields.io/badge/Reddit-FF4500?style=flat&logo=reddit&logoColor=white&color=black)](https://www.reddit.com/r/PlayCanvas)
8
8
  [![X](https://img.shields.io/badge/X-000000?style=flat&logo=x&logoColor=white&color=black)](https://x.com/intent/follow?screen_name=playcanvas)
9
9
 
10
- | [User Manual](https://developer.playcanvas.com//user-manual/web-components) | [API Reference](https://api.playcanvas.com/web-components) | [Examples](https://playcanvas.github.io/web-components/examples) | [Blog](https://blog.playcanvas.com) | [Forum](https://forum.playcanvas.com) |
10
+ | [User Manual](https://developer.playcanvas.com/user-manual/web-components) | [API Reference](https://api.playcanvas.com/web-components) | [Examples](https://playcanvas.github.io/web-components/examples) | [Blog](https://blog.playcanvas.com) | [Forum](https://forum.playcanvas.com) |
11
11
 
12
12
  PlayCanvas Web Components are a set of custom HTML elements for building 3D interactive web apps. Using the declarative nature of HTML makes it both easy and fun to incorporate 3D into your website. Check out this simple example:
13
13
 
@@ -30,9 +30,11 @@ PlayCanvas Web Components are a set of custom HTML elements for building 3D inte
30
30
 
31
31
  ## Examples
32
32
 
33
- <img width="5120" height="2160" alt="examples" src="https://github.com/user-attachments/assets/92cf1156-c93f-46b5-8d05-e576967ceaf3" />
33
+ <a href="https://playcanvas.github.io/web-components/examples">
34
+ <img width="5120" height="2160" alt="PlayCanvas Web Components examples gallery showing interactive 3D demos" src="https://github.com/user-attachments/assets/92cf1156-c93f-46b5-8d05-e576967ceaf3" />
35
+ </a>
34
36
 
35
- See PlayCanvas Web Components in action here: https://playcanvas.github.io/web-components/examples
37
+ Explore the [PlayCanvas Web Components examples gallery](https://playcanvas.github.io/web-components/examples).
36
38
 
37
39
  ## Usage
38
40
 
package/dist/app.d.cts CHANGED
@@ -14,6 +14,10 @@ import type { EntityBaseElement } from './entity-base.cjs';
14
14
  * tracked live via a ResizeObserver — so the element can be embedded at any size, resized by
15
15
  * its container, or made fullscreen with ordinary CSS such as `width: 100vw; height: 100dvh`.
16
16
  *
17
+ * @elementSummary The `<pc-app>` element creates a PlayCanvas application and the canvas it renders
18
+ * into, and is the root of every scene. It holds the `<pc-asset>`, `<pc-material>`, `<pc-wasm>` and
19
+ * `<pc-scene>` elements, and the page's CSS sizes it, as it would a `<video>`.
20
+ *
17
21
  * @fires {ProgressEvent} progress - Fired while the application preloads its assets. `loaded` and
18
22
  * `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded.
19
23
  * Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does
@@ -59,10 +63,24 @@ declare class AppElement extends AsyncElement {
59
63
  */
60
64
  private _entityElements;
61
65
  private _picker;
62
- private _hasPointerListeners;
63
66
  private _hoveredEntity;
64
67
  private _pickToken;
65
68
  private _pointerHandlers;
69
+ /**
70
+ * The pick of each pointer's primary-button press, keyed by pointerId and kept while a click
71
+ * may still conclude it. The promise is stored rather than its result, so a release can
72
+ * await a press pick that has not resolved yet. Entries are removed by the matching
73
+ * pointerup or pointercancel, and only ever stored while some element listens for click -
74
+ * which is also what keeps those two canvas listeners attached.
75
+ */
76
+ private _downPicks;
77
+ /** Whether any element in the tree listens for click. Maintained by _syncCanvasListeners. */
78
+ private _clickListened;
79
+ /**
80
+ * The previous click's target, time and count, for chaining successive clicks into the
81
+ * click count that `detail` carries. `null` until a click has fired.
82
+ */
83
+ private _lastClick;
66
84
  private _app;
67
85
  private _loadProgress;
68
86
  /**
@@ -183,8 +201,15 @@ declare class AppElement extends AsyncElement {
183
201
  private _onPointerMove;
184
202
  private _onPointerDown;
185
203
  private _onPointerUp;
186
- private _onPointerListenerAdded;
187
- private _onPointerListenerRemoved;
204
+ /**
205
+ * Attaches exactly the canvas listeners the tree's current element listeners need, and
206
+ * detaches the rest. Recomputed whenever a listener connects or disconnects anywhere under
207
+ * this element: several synthesized types can need the same canvas listener (enter, leave
208
+ * and move all ride the move pick; click rides the down/up pair), so one type's removal
209
+ * must not detach a listener another type still uses. Re-attaching an attached listener is
210
+ * a no-op by EventTarget semantics, so no attach state is kept.
211
+ */
212
+ private _syncCanvasListeners;
188
213
  /**
189
214
  * Warns that a graphics option was written too late to have any effect. These options are read
190
215
  * once, when the element connects and creates its graphics device, so a later write updates
package/dist/app.d.ts CHANGED
@@ -14,6 +14,10 @@ import type { EntityBaseElement } from './entity-base.js';
14
14
  * tracked live via a ResizeObserver — so the element can be embedded at any size, resized by
15
15
  * its container, or made fullscreen with ordinary CSS such as `width: 100vw; height: 100dvh`.
16
16
  *
17
+ * @elementSummary The `<pc-app>` element creates a PlayCanvas application and the canvas it renders
18
+ * into, and is the root of every scene. It holds the `<pc-asset>`, `<pc-material>`, `<pc-wasm>` and
19
+ * `<pc-scene>` elements, and the page's CSS sizes it, as it would a `<video>`.
20
+ *
17
21
  * @fires {ProgressEvent} progress - Fired while the application preloads its assets. `loaded` and
18
22
  * `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded.
19
23
  * Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does
@@ -59,10 +63,24 @@ declare class AppElement extends AsyncElement {
59
63
  */
60
64
  private _entityElements;
61
65
  private _picker;
62
- private _hasPointerListeners;
63
66
  private _hoveredEntity;
64
67
  private _pickToken;
65
68
  private _pointerHandlers;
69
+ /**
70
+ * The pick of each pointer's primary-button press, keyed by pointerId and kept while a click
71
+ * may still conclude it. The promise is stored rather than its result, so a release can
72
+ * await a press pick that has not resolved yet. Entries are removed by the matching
73
+ * pointerup or pointercancel, and only ever stored while some element listens for click -
74
+ * which is also what keeps those two canvas listeners attached.
75
+ */
76
+ private _downPicks;
77
+ /** Whether any element in the tree listens for click. Maintained by _syncCanvasListeners. */
78
+ private _clickListened;
79
+ /**
80
+ * The previous click's target, time and count, for chaining successive clicks into the
81
+ * click count that `detail` carries. `null` until a click has fired.
82
+ */
83
+ private _lastClick;
66
84
  private _app;
67
85
  private _loadProgress;
68
86
  /**
@@ -183,8 +201,15 @@ declare class AppElement extends AsyncElement {
183
201
  private _onPointerMove;
184
202
  private _onPointerDown;
185
203
  private _onPointerUp;
186
- private _onPointerListenerAdded;
187
- private _onPointerListenerRemoved;
204
+ /**
205
+ * Attaches exactly the canvas listeners the tree's current element listeners need, and
206
+ * detaches the rest. Recomputed whenever a listener connects or disconnects anywhere under
207
+ * this element: several synthesized types can need the same canvas listener (enter, leave
208
+ * and move all ride the move pick; click rides the down/up pair), so one type's removal
209
+ * must not detach a listener another type still uses. Re-attaching an attached listener is
210
+ * a no-op by EventTarget semantics, so no attach state is kept.
211
+ */
212
+ private _syncCanvasListeners;
188
213
  /**
189
214
  * Warns that a graphics option was written too late to have any effect. These options are read
190
215
  * once, when the element connects and creates its graphics device, so a later write updates
package/dist/asset.d.cts CHANGED
@@ -1,8 +1,14 @@
1
1
  import { Asset } from 'playcanvas';
2
2
  import { AsyncElement } from './async-element.cjs';
3
- type AddressMode = 'repeat' | 'clamp' | 'mirror';
4
- type MinFilterMode = 'nearest' | 'linear' | 'nearest-mip-nearest' | 'linear-mip-nearest' | 'nearest-mip-linear' | 'linear-mip-linear';
5
- type MagFilterMode = 'nearest' | 'linear';
3
+ /** The addressing modes for a texture asset. */
4
+ export type AddressMode = 'repeat' | 'clamp' | 'mirror';
5
+ /** The minification filter modes for a texture asset. */
6
+ export type MinFilterMode = 'nearest' | 'linear' | 'nearest-mip-nearest' | 'linear-mip-nearest' | 'nearest-mip-linear' | 'linear-mip-linear';
7
+ /**
8
+ * The magnification filter modes for a texture asset. Magnification has no mip variants - the
9
+ * engine (and the GPU) only accepts these two.
10
+ */
11
+ export type MagFilterMode = 'nearest' | 'linear';
6
12
  /**
7
13
  * The AssetElement interface provides properties and methods for manipulating
8
14
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
@@ -31,6 +37,10 @@ type MagFilterMode = 'nearest' | 'linear';
31
37
  * Apart from `lazy` and the texture options, these attributes are read once when the asset is
32
38
  * created, so changing them later has no effect.
33
39
  *
40
+ * @elementSummary The `<pc-asset>` element declares an asset for the application to load — a model,
41
+ * texture, font, sound, script or JSON file — under an `id` that other elements reference. Must be
42
+ * a direct child of `<pc-app>`.
43
+ *
34
44
  * @attribute {string} id - The identifier used to reference the asset from other elements.
35
45
  * @attribute {string} src - The URL of the asset to load.
36
46
  * @attribute {string} type - The asset type. Inferred from the `src` file extension when omitted.
package/dist/asset.d.ts CHANGED
@@ -1,8 +1,14 @@
1
1
  import { Asset } from 'playcanvas';
2
2
  import { AsyncElement } from './async-element.js';
3
- type AddressMode = 'repeat' | 'clamp' | 'mirror';
4
- type MinFilterMode = 'nearest' | 'linear' | 'nearest-mip-nearest' | 'linear-mip-nearest' | 'nearest-mip-linear' | 'linear-mip-linear';
5
- type MagFilterMode = 'nearest' | 'linear';
3
+ /** The addressing modes for a texture asset. */
4
+ export type AddressMode = 'repeat' | 'clamp' | 'mirror';
5
+ /** The minification filter modes for a texture asset. */
6
+ export type MinFilterMode = 'nearest' | 'linear' | 'nearest-mip-nearest' | 'linear-mip-nearest' | 'nearest-mip-linear' | 'linear-mip-linear';
7
+ /**
8
+ * The magnification filter modes for a texture asset. Magnification has no mip variants - the
9
+ * engine (and the GPU) only accepts these two.
10
+ */
11
+ export type MagFilterMode = 'nearest' | 'linear';
6
12
  /**
7
13
  * The AssetElement interface provides properties and methods for manipulating
8
14
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
@@ -31,6 +37,10 @@ type MagFilterMode = 'nearest' | 'linear';
31
37
  * Apart from `lazy` and the texture options, these attributes are read once when the asset is
32
38
  * created, so changing them later has no effect.
33
39
  *
40
+ * @elementSummary The `<pc-asset>` element declares an asset for the application to load — a model,
41
+ * texture, font, sound, script or JSON file — under an `id` that other elements reference. Must be
42
+ * a direct child of `<pc-app>`.
43
+ *
34
44
  * @attribute {string} id - The identifier used to reference the asset from other elements.
35
45
  * @attribute {string} src - The URL of the asset to load.
36
46
  * @attribute {string} type - The asset type. Inferred from the `src` file extension when omitted.
@@ -13,7 +13,9 @@ import { AnimComponentElement } from './anim-component.cjs';
13
13
  * named; in a multi-track source the track named `name` is chosen, falling back to the first
14
14
  * with a warning. The element becomes ready once its resolved track is assigned.
15
15
  *
16
- * @category Components
16
+ * @elementSummary The `<pc-anim-clip>` element declares one named animation clip on its parent
17
+ * `<pc-anim>`, taken from the `asset` it names or, without one, from the enclosing `<pc-model>`'s
18
+ * own animations. Must be a direct child of `<pc-anim>`.
17
19
  */
18
20
  declare class AnimClipElement extends AsyncElement {
19
21
  /**
@@ -13,7 +13,9 @@ import { AnimComponentElement } from './anim-component.js';
13
13
  * named; in a multi-track source the track named `name` is chosen, falling back to the first
14
14
  * with a warning. The element becomes ready once its resolved track is assigned.
15
15
  *
16
- * @category Components
16
+ * @elementSummary The `<pc-anim-clip>` element declares one named animation clip on its parent
17
+ * `<pc-anim>`, taken from the `asset` it names or, without one, from the enclosing `<pc-model>`'s
18
+ * own animations. Must be a direct child of `<pc-anim>`.
17
19
  */
18
20
  declare class AnimClipElement extends AsyncElement {
19
21
  /**
@@ -27,6 +27,11 @@ type ContainerWithAnimations = ContainerResource & {
27
27
  *
28
28
  * Engine component: {@link AnimComponent} (`anim`).
29
29
  *
30
+ * @elementSummary The `<pc-anim>` element plays animation clips over its entity's hierarchy, taken
31
+ * from `<pc-anim-clip>` children or from the enclosing `<pc-model>`'s own animations. The first
32
+ * clip plays automatically, and the `clip` attribute switches between them. Must be a child of a
33
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
34
+ *
30
35
  * @category Components
31
36
  */
32
37
  declare class AnimComponentElement extends ComponentElement {
@@ -27,6 +27,11 @@ type ContainerWithAnimations = ContainerResource & {
27
27
  *
28
28
  * Engine component: {@link AnimComponent} (`anim`).
29
29
  *
30
+ * @elementSummary The `<pc-anim>` element plays animation clips over its entity's hierarchy, taken
31
+ * from `<pc-anim-clip>` children or from the enclosing `<pc-model>`'s own animations. The first
32
+ * clip plays automatically, and the `clip` attribute switches between them. Must be a child of a
33
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
34
+ *
30
35
  * @category Components
31
36
  */
32
37
  declare class AnimComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.cjs';
8
8
  *
9
9
  * Engine component: {@link AudioListenerComponent} (`audiolistener`).
10
10
  *
11
+ * @elementSummary The `<pc-audio-listener>` element makes its entity the point from which
12
+ * positional sounds are heard, typically the entity holding the `<pc-camera>`. Must be a child of a
13
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
11
15
  * @category Components
12
16
  */
13
17
  declare class AudioListenerComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.js';
8
8
  *
9
9
  * Engine component: {@link AudioListenerComponent} (`audiolistener`).
10
10
  *
11
+ * @elementSummary The `<pc-audio-listener>` element makes its entity the point from which
12
+ * positional sounds are heard, typically the entity holding the `<pc-camera>`. Must be a child of a
13
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
11
15
  * @category Components
12
16
  */
13
17
  declare class AudioListenerComponentElement extends ComponentElement {
@@ -9,6 +9,11 @@ import { ComponentElement } from './component.cjs';
9
9
  *
10
10
  * Engine component: {@link ButtonComponent} (`button`).
11
11
  *
12
+ * @elementSummary The `<pc-button>` element makes its entity respond to pointer input, tinting or
13
+ * swapping its image as the pointer hovers, presses and releases it. The entity also needs a
14
+ * `<pc-element>` with `use-input` set. Must be a child of a `<pc-entity>`, `<pc-model>` or
15
+ * `<pc-node>`.
16
+ *
12
17
  * @category Components
13
18
  */
14
19
  declare class ButtonComponentElement extends ComponentElement {
@@ -9,6 +9,11 @@ import { ComponentElement } from './component.js';
9
9
  *
10
10
  * Engine component: {@link ButtonComponent} (`button`).
11
11
  *
12
+ * @elementSummary The `<pc-button>` element makes its entity respond to pointer input, tinting or
13
+ * swapping its image as the pointer hovers, presses and releases it. The entity also needs a
14
+ * `<pc-element>` with `use-input` set. Must be a child of a `<pc-entity>`, `<pc-model>` or
15
+ * `<pc-node>`.
16
+ *
12
17
  * @category Components
13
18
  */
14
19
  declare class ButtonComponentElement extends ComponentElement {
@@ -9,11 +9,16 @@ import { ComponentElement } from './component.cjs';
9
9
  *
10
10
  * Engine component: {@link CameraComponent} (`camera`).
11
11
  *
12
+ * @elementSummary The `<pc-camera>` element renders the scene from its entity's transform, with
13
+ * attributes for the projection, field of view, clip planes, clear color and tonemapping. Must be a
14
+ * child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class CameraComponentElement extends ComponentElement {
15
19
  private _clearColor;
16
20
  private _clearColorBuffer;
21
+ private _clearDepth;
17
22
  private _clearDepthBuffer;
18
23
  private _clearStencilBuffer;
19
24
  private _cullFaces;
@@ -35,6 +40,7 @@ declare class CameraComponentElement extends ComponentElement {
35
40
  protected getInitialComponentData(): {
36
41
  clearColor: Color;
37
42
  clearColorBuffer: boolean;
43
+ clearDepth: number;
38
44
  clearDepthBuffer: boolean;
39
45
  clearStencilBuffer: boolean;
40
46
  cullFaces: boolean;
@@ -52,7 +58,25 @@ declare class CameraComponentElement extends ComponentElement {
52
58
  scissorRect: Vec4;
53
59
  toneMapping: number;
54
60
  };
55
- get xrAvailable(): boolean | null;
61
+ /**
62
+ * Whether immersive AR is available. Independent of {@link vrAvailable}: a device can offer
63
+ * either mode without the other.
64
+ * @returns Whether immersive AR is available.
65
+ */
66
+ get arAvailable(): boolean;
67
+ /**
68
+ * Whether immersive VR is available. Independent of {@link arAvailable}: a device can offer
69
+ * either mode without the other.
70
+ * @returns Whether immersive VR is available.
71
+ */
72
+ get vrAvailable(): boolean;
73
+ /**
74
+ * Whether one XR session type is available on this device.
75
+ *
76
+ * @param type - The XR session type to test.
77
+ * @returns Whether that type is available.
78
+ */
79
+ private _available;
56
80
  /**
57
81
  * Starts the camera in XR mode.
58
82
  * @param type - The type of XR mode to start.
@@ -88,6 +112,16 @@ declare class CameraComponentElement extends ComponentElement {
88
112
  * @returns The clear color buffer.
89
113
  */
90
114
  get clearColorBuffer(): boolean;
115
+ /**
116
+ * Sets the depth value the depth buffer is cleared to. Defaults to 1.
117
+ * @param value - The clear depth value.
118
+ */
119
+ set clearDepth(value: number);
120
+ /**
121
+ * Gets the depth value the depth buffer is cleared to.
122
+ * @returns The clear depth value.
123
+ */
124
+ get clearDepth(): number;
91
125
  /**
92
126
  * Sets the clear depth buffer of the camera.
93
127
  * @param value - The clear depth buffer.
@@ -9,11 +9,16 @@ import { ComponentElement } from './component.js';
9
9
  *
10
10
  * Engine component: {@link CameraComponent} (`camera`).
11
11
  *
12
+ * @elementSummary The `<pc-camera>` element renders the scene from its entity's transform, with
13
+ * attributes for the projection, field of view, clip planes, clear color and tonemapping. Must be a
14
+ * child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class CameraComponentElement extends ComponentElement {
15
19
  private _clearColor;
16
20
  private _clearColorBuffer;
21
+ private _clearDepth;
17
22
  private _clearDepthBuffer;
18
23
  private _clearStencilBuffer;
19
24
  private _cullFaces;
@@ -35,6 +40,7 @@ declare class CameraComponentElement extends ComponentElement {
35
40
  protected getInitialComponentData(): {
36
41
  clearColor: Color;
37
42
  clearColorBuffer: boolean;
43
+ clearDepth: number;
38
44
  clearDepthBuffer: boolean;
39
45
  clearStencilBuffer: boolean;
40
46
  cullFaces: boolean;
@@ -52,7 +58,25 @@ declare class CameraComponentElement extends ComponentElement {
52
58
  scissorRect: Vec4;
53
59
  toneMapping: number;
54
60
  };
55
- get xrAvailable(): boolean | null;
61
+ /**
62
+ * Whether immersive AR is available. Independent of {@link vrAvailable}: a device can offer
63
+ * either mode without the other.
64
+ * @returns Whether immersive AR is available.
65
+ */
66
+ get arAvailable(): boolean;
67
+ /**
68
+ * Whether immersive VR is available. Independent of {@link arAvailable}: a device can offer
69
+ * either mode without the other.
70
+ * @returns Whether immersive VR is available.
71
+ */
72
+ get vrAvailable(): boolean;
73
+ /**
74
+ * Whether one XR session type is available on this device.
75
+ *
76
+ * @param type - The XR session type to test.
77
+ * @returns Whether that type is available.
78
+ */
79
+ private _available;
56
80
  /**
57
81
  * Starts the camera in XR mode.
58
82
  * @param type - The type of XR mode to start.
@@ -88,6 +112,16 @@ declare class CameraComponentElement extends ComponentElement {
88
112
  * @returns The clear color buffer.
89
113
  */
90
114
  get clearColorBuffer(): boolean;
115
+ /**
116
+ * Sets the depth value the depth buffer is cleared to. Defaults to 1.
117
+ * @param value - The clear depth value.
118
+ */
119
+ set clearDepth(value: number);
120
+ /**
121
+ * Gets the depth value the depth buffer is cleared to.
122
+ * @returns The clear depth value.
123
+ */
124
+ get clearDepth(): number;
91
125
  /**
92
126
  * Sets the clear depth buffer of the camera.
93
127
  * @param value - The clear depth buffer.
@@ -15,6 +15,10 @@ import { ComponentElement } from './component.cjs';
15
15
  *
16
16
  * Engine component: {@link CollisionComponent} (`collision`).
17
17
  *
18
+ * @elementSummary The `<pc-collision>` element gives its entity a collision shape — a box, sphere,
19
+ * capsule, cone, cylinder or mesh — for the physics simulation to collide against. Pair it with a
20
+ * `<pc-rigid-body>`. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
21
+ *
18
22
  * @category Components
19
23
  */
20
24
  declare class CollisionComponentElement extends ComponentElement {
@@ -15,6 +15,10 @@ import { ComponentElement } from './component.js';
15
15
  *
16
16
  * Engine component: {@link CollisionComponent} (`collision`).
17
17
  *
18
+ * @elementSummary The `<pc-collision>` element gives its entity a collision shape — a box, sphere,
19
+ * capsule, cone, cylinder or mesh — for the physics simulation to collide against. Pair it with a
20
+ * `<pc-rigid-body>`. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
21
+ *
18
22
  * @category Components
19
23
  */
20
24
  declare class CollisionComponentElement extends ComponentElement {
@@ -14,6 +14,10 @@ import { ComponentElement } from './component.cjs';
14
14
  *
15
15
  * Engine component: {@link ElementComponent} (`element`).
16
16
  *
17
+ * @elementSummary The `<pc-element>` element gives its entity a 2D UI rectangle inside a
18
+ * `<pc-screen>` hierarchy, drawing an image, a line of text or nothing (`type="image"`, `"text"` or
19
+ * `"group"`). Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
20
+ *
17
21
  * @category Components
18
22
  */
19
23
  declare class ElementComponentElement extends ComponentElement {
@@ -14,6 +14,10 @@ import { ComponentElement } from './component.js';
14
14
  *
15
15
  * Engine component: {@link ElementComponent} (`element`).
16
16
  *
17
+ * @elementSummary The `<pc-element>` element gives its entity a 2D UI rectangle inside a
18
+ * `<pc-screen>` hierarchy, drawing an image, a line of text or nothing (`type="image"`, `"text"` or
19
+ * `"group"`). Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
20
+ *
17
21
  * @category Components
18
22
  */
19
23
  declare class ElementComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.cjs';
8
8
  *
9
9
  * Engine component: {@link GSplatComponent} (`gsplat`).
10
10
  *
11
+ * @elementSummary The `<pc-gsplat>` element renders the 3D Gaussian splats of a `gsplat` asset at
12
+ * its entity, with attributes for shadow casting and level of detail. Must be a child of a
13
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
11
15
  * @category Components
12
16
  */
13
17
  declare class GSplatComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.js';
8
8
  *
9
9
  * Engine component: {@link GSplatComponent} (`gsplat`).
10
10
  *
11
+ * @elementSummary The `<pc-gsplat>` element renders the 3D Gaussian splats of a `gsplat` asset at
12
+ * its entity, with attributes for shadow casting and level of detail. Must be a child of a
13
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
11
15
  * @category Components
12
16
  */
13
17
  declare class GSplatComponentElement extends ComponentElement {
@@ -1,8 +1,13 @@
1
1
  import type { JointComponent } from 'playcanvas';
2
2
  import { Vec2, Vec3 } from 'playcanvas';
3
3
  import { ComponentElement } from './component.cjs';
4
- type JointType = 'fixed' | 'ball' | 'hinge' | 'slider' | '6dof';
5
- type MotionMode = 'locked' | 'limited' | 'free';
4
+ /** The constraint types supported by the `<pc-joint>` element. */
5
+ export type JointType = 'fixed' | 'ball' | 'hinge' | 'slider' | '6dof';
6
+ /**
7
+ * The motion modes for a single joint axis: fully constrained (`locked`), constrained within
8
+ * limits (`limited`) or unconstrained (`free`).
9
+ */
10
+ export type MotionMode = 'locked' | 'limited' | 'free';
6
11
  /**
7
12
  * The JointComponentElement interface provides properties and methods for manipulating
8
13
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-joint/ | `<pc-joint>`} elements.
@@ -16,6 +21,11 @@ type MotionMode = 'locked' | 'limited' | 'free';
16
21
  * a rigid body component; leaving `entity-b` empty constrains `entity-a` to a fixed point in world
17
22
  * space. The underlying engine component is in alpha, so its API may change.
18
23
  *
24
+ * @elementSummary The `<pc-joint>` element constrains two rigid bodies to each other — a hinged
25
+ * door, a swinging chain, a sliding drawer. Its entity's transform is the joint frame, and
26
+ * `entity-a` and `entity-b` name the bodies. Must be a child of a `<pc-entity>`, `<pc-model>` or
27
+ * `<pc-node>`.
28
+ *
19
29
  * @fires {CustomEvent} break - Fired when the impulse on the joint exceeds `break-impulse` and the
20
30
  * constraint breaks. A broken joint no longer constrains its bodies; calling `refreshFrames()` on
21
31
  * the underlying component re-attaches it. Bubbles and is composed.
@@ -1,8 +1,13 @@
1
1
  import type { JointComponent } from 'playcanvas';
2
2
  import { Vec2, Vec3 } from 'playcanvas';
3
3
  import { ComponentElement } from './component.js';
4
- type JointType = 'fixed' | 'ball' | 'hinge' | 'slider' | '6dof';
5
- type MotionMode = 'locked' | 'limited' | 'free';
4
+ /** The constraint types supported by the `<pc-joint>` element. */
5
+ export type JointType = 'fixed' | 'ball' | 'hinge' | 'slider' | '6dof';
6
+ /**
7
+ * The motion modes for a single joint axis: fully constrained (`locked`), constrained within
8
+ * limits (`limited`) or unconstrained (`free`).
9
+ */
10
+ export type MotionMode = 'locked' | 'limited' | 'free';
6
11
  /**
7
12
  * The JointComponentElement interface provides properties and methods for manipulating
8
13
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-joint/ | `<pc-joint>`} elements.
@@ -16,6 +21,11 @@ type MotionMode = 'locked' | 'limited' | 'free';
16
21
  * a rigid body component; leaving `entity-b` empty constrains `entity-a` to a fixed point in world
17
22
  * space. The underlying engine component is in alpha, so its API may change.
18
23
  *
24
+ * @elementSummary The `<pc-joint>` element constrains two rigid bodies to each other — a hinged
25
+ * door, a swinging chain, a sliding drawer. Its entity's transform is the joint frame, and
26
+ * `entity-a` and `entity-b` name the bodies. Must be a child of a `<pc-entity>`, `<pc-model>` or
27
+ * `<pc-node>`.
28
+ *
19
29
  * @fires {CustomEvent} break - Fired when the impulse on the joint exceeds `break-impulse` and the
20
30
  * constraint breaks. A broken joint no longer constrains its bodies; calling `refreshFrames()` on
21
31
  * the underlying component re-attaches it. Bubbles and is composed.
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.cjs';
8
8
  *
9
9
  * Engine component: {@link LayoutChildComponent} (`layoutchild`).
10
10
  *
11
+ * @elementSummary The `<pc-layout-child>` element controls how its entity is sized by the
12
+ * `<pc-layout-group>` above it, through minimum and maximum sizes and fit proportions. Must be a
13
+ * child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
11
15
  * @category Components
12
16
  */
13
17
  declare class LayoutChildComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.js';
8
8
  *
9
9
  * Engine component: {@link LayoutChildComponent} (`layoutchild`).
10
10
  *
11
+ * @elementSummary The `<pc-layout-child>` element controls how its entity is sized by the
12
+ * `<pc-layout-group>` above it, through minimum and maximum sizes and fit proportions. Must be a
13
+ * child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
14
+ *
11
15
  * @category Components
12
16
  */
13
17
  declare class LayoutChildComponentElement extends ComponentElement {
@@ -9,6 +9,10 @@ import { ComponentElement } from './component.cjs';
9
9
  *
10
10
  * Engine component: {@link LayoutGroupComponent} (`layoutgroup`).
11
11
  *
12
+ * @elementSummary The `<pc-layout-group>` element arranges its entity's children in a row or
13
+ * column, with spacing, padding, alignment and fitting. Must be a child of a `<pc-entity>`,
14
+ * `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class LayoutGroupComponentElement extends ComponentElement {
@@ -9,6 +9,10 @@ import { ComponentElement } from './component.js';
9
9
  *
10
10
  * Engine component: {@link LayoutGroupComponent} (`layoutgroup`).
11
11
  *
12
+ * @elementSummary The `<pc-layout-group>` element arranges its entity's children in a row or
13
+ * column, with spacing, padding, alignment and fitting. Must be a child of a `<pc-entity>`,
14
+ * `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class LayoutGroupComponentElement extends ComponentElement {