@playcanvas/web-components 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +5 -3
  2. package/dist/app.d.cts +4 -0
  3. package/dist/app.d.ts +4 -0
  4. package/dist/asset.d.cts +13 -3
  5. package/dist/asset.d.ts +13 -3
  6. package/dist/components/anim-clip.d.cts +4 -0
  7. package/dist/components/anim-clip.d.ts +4 -0
  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 +268 -7
  51. package/dist/entity-base.d.cts +1 -1
  52. package/dist/entity-base.d.ts +1 -1
  53. package/dist/entity-owner.d.cts +2 -2
  54. package/dist/entity-owner.d.ts +2 -2
  55. package/dist/entity.d.cts +6 -1
  56. package/dist/entity.d.ts +6 -1
  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 +5 -0
  62. package/dist/model.d.ts +5 -0
  63. package/dist/node.d.cts +6 -1
  64. package/dist/node.d.ts +6 -1
  65. package/dist/pwc.cjs +284 -28
  66. package/dist/pwc.cjs.map +1 -1
  67. package/dist/pwc.js +284 -28
  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 +285 -29
  74. package/dist/pwc.mjs.map +1 -1
  75. package/dist/scene.d.cts +3 -0
  76. package/dist/scene.d.ts +3 -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 +237 -62
  80. package/dist/wasm.d.cts +4 -0
  81. package/dist/wasm.d.ts +4 -0
  82. package/dist/web-types.json +115 -69
  83. package/package.json +1 -1
  84. package/src/app.ts +4 -0
  85. package/src/asset.ts +13 -4
  86. package/src/components/anim-clip.ts +4 -0
  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 +2 -2
  109. package/src/entity-owner.ts +2 -2
  110. package/src/entity.ts +6 -1
  111. package/src/index.ts +12 -1
  112. package/src/material.ts +19 -8
  113. package/src/model.ts +5 -0
  114. package/src/node.ts +6 -1
  115. package/src/scene.ts +3 -0
  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
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
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,6 +13,10 @@ 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
+ * @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>`.
19
+ *
16
20
  * @category Components
17
21
  */
18
22
  declare class AnimClipElement extends AsyncElement {
@@ -13,6 +13,10 @@ 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
+ * @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>`.
19
+ *
16
20
  * @category Components
17
21
  */
18
22
  declare class AnimClipElement extends AsyncElement {
@@ -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 {
@@ -9,14 +9,21 @@ import { ComponentElement } from './component.cjs';
9
9
  *
10
10
  * Engine component: {@link LightComponent} (`light`).
11
11
  *
12
+ * @elementSummary The `<pc-light>` element lights the scene from its entity — as a directional,
13
+ * omni or spot light — with attributes for color, intensity, range and shadows. Must be a child of
14
+ * a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class LightComponentElement extends ComponentElement {
19
+ private _cascadeBlend;
20
+ private _cascadeDistribution;
15
21
  private _castShadows;
16
22
  private _color;
17
23
  private _innerConeAngle;
18
24
  private _intensity;
19
25
  private _normalOffsetBias;
26
+ private _numCascades;
20
27
  private _outerConeAngle;
21
28
  private _range;
22
29
  private _shadowBias;
@@ -34,11 +41,14 @@ declare class LightComponentElement extends ComponentElement {
34
41
  /** @ignore */
35
42
  constructor();
36
43
  protected getInitialComponentData(): {
44
+ cascadeBlend: number;
45
+ cascadeDistribution: number;
37
46
  castShadows: boolean;
38
47
  color: Color;
39
48
  innerConeAngle: number;
40
49
  intensity: number;
41
50
  normalOffsetBias: number;
51
+ numCascades: number;
42
52
  outerConeAngle: number;
43
53
  penumbraFalloff: number;
44
54
  penumbraSize: number;
@@ -49,7 +59,7 @@ declare class LightComponentElement extends ComponentElement {
49
59
  shadowIntensity: number;
50
60
  shadowResolution: number;
51
61
  shadowSamples: number;
52
- shadowType: number | undefined;
62
+ shadowType: number;
53
63
  type: "directional" | "omni" | "spot";
54
64
  vsmBias: number;
55
65
  vsmBlurSize: number;
@@ -59,6 +69,33 @@ declare class LightComponentElement extends ComponentElement {
59
69
  * @returns The light component.
60
70
  */
61
71
  get component(): LightComponent;
72
+ /**
73
+ * Sets the fraction of each shadow cascade that is blended into the next one, from 0 (no
74
+ * blending) to 1, which applies only to `directional` lights with `num-cascades` greater than
75
+ * 1. Defaults to 0.
76
+ * @param value - The cascade blend factor.
77
+ */
78
+ set cascadeBlend(value: number);
79
+ /**
80
+ * Gets the cascade blend factor of the light, from 0 (no blending) to 1, which applies only to
81
+ * `directional` lights with `num-cascades` greater than 1.
82
+ * @returns The cascade blend factor.
83
+ */
84
+ get cascadeBlend(): number;
85
+ /**
86
+ * Sets the distribution of the camera frustum split between shadow cascades, from 0 (linear
87
+ * split) to 1 (logarithmic split, concentrating shadow resolution near the camera), which
88
+ * applies only to `directional` lights with `num-cascades` greater than 1. Defaults to 0.5.
89
+ * @param value - The cascade distribution.
90
+ */
91
+ set cascadeDistribution(value: number);
92
+ /**
93
+ * Gets the cascade distribution of the light, from 0 (linear split) to 1 (logarithmic split,
94
+ * concentrating shadow resolution near the camera), which applies only to `directional` lights
95
+ * with `num-cascades` greater than 1.
96
+ * @returns The cascade distribution.
97
+ */
98
+ get cascadeDistribution(): number;
62
99
  /**
63
100
  * Sets the cast shadows flag of the light.
64
101
  * @param value - The cast shadows flag.
@@ -109,6 +146,18 @@ declare class LightComponentElement extends ComponentElement {
109
146
  * @returns The normal offset bias.
110
147
  */
111
148
  get normalOffsetBias(): number;
149
+ /**
150
+ * Sets the number of shadow cascades of the light, an integer from 1 (no cascades) to 4, which
151
+ * applies only to `directional` lights. Defaults to 1.
152
+ * @param value - The number of shadow cascades.
153
+ */
154
+ set numCascades(value: number);
155
+ /**
156
+ * Gets the number of shadow cascades of the light, an integer from 1 (no cascades) to 4, which
157
+ * applies only to `directional` lights.
158
+ * @returns The number of shadow cascades.
159
+ */
160
+ get numCascades(): number;
112
161
  /**
113
162
  * Sets the outer cone angle of the light.
114
163
  * @param value - The outer cone angle.