@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
@@ -9,14 +9,21 @@ import { ComponentElement } from './component.js';
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.
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.cjs';
8
8
  *
9
9
  * Engine component: {@link ParticleSystemComponent} (`particlesystem`).
10
10
  *
11
+ * @elementSummary The `<pc-particle-system>` element emits particles from its entity, with
12
+ * attributes for the emitter's shape, rate, lifetime, textures and blending. 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 ParticleSystemComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.js';
8
8
  *
9
9
  * Engine component: {@link ParticleSystemComponent} (`particlesystem`).
10
10
  *
11
+ * @elementSummary The `<pc-particle-system>` element emits particles from its entity, with
12
+ * attributes for the emitter's shape, rate, lifetime, textures and blending. 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 ParticleSystemComponentElement extends ComponentElement {
@@ -12,6 +12,11 @@ import { ComponentElement } from './component.cjs';
12
12
  *
13
13
  * Engine component: {@link RenderComponent} (`render`).
14
14
  *
15
+ * @elementSummary The `<pc-render>` element renders one of the engine's built-in primitives at its
16
+ * entity — box, sphere, capsule, cone, cylinder or plane — shaded by the `<pc-material>` its
17
+ * `material` attribute names. For glTF content, use `<pc-model>` instead. Must be a child of a
18
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
19
+ *
15
20
  * @category Components
16
21
  */
17
22
  declare class RenderComponentElement extends ComponentElement {
@@ -12,6 +12,11 @@ import { ComponentElement } from './component.js';
12
12
  *
13
13
  * Engine component: {@link RenderComponent} (`render`).
14
14
  *
15
+ * @elementSummary The `<pc-render>` element renders one of the engine's built-in primitives at its
16
+ * entity — box, sphere, capsule, cone, cylinder or plane — shaded by the `<pc-material>` its
17
+ * `material` attribute names. For glTF content, use `<pc-model>` instead. Must be a child of a
18
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
19
+ *
15
20
  * @category Components
16
21
  */
17
22
  declare class RenderComponentElement extends ComponentElement {
@@ -9,6 +9,11 @@ import { ComponentElement } from './component.cjs';
9
9
  *
10
10
  * Engine component: {@link RigidBodyComponent} (`rigidbody`).
11
11
  *
12
+ * @elementSummary The `<pc-rigid-body>` element hands its entity to the physics simulation, with
13
+ * attributes for its type, mass, friction and restitution. It needs a sibling `<pc-collision>` for
14
+ * its shape, and `Ammo` loaded through `<pc-wasm>`. Must be a child of a `<pc-entity>`,
15
+ * `<pc-model>` or `<pc-node>`.
16
+ *
12
17
  * @category Components
13
18
  */
14
19
  declare class RigidBodyComponentElement extends ComponentElement {
@@ -9,6 +9,11 @@ import { ComponentElement } from './component.js';
9
9
  *
10
10
  * Engine component: {@link RigidBodyComponent} (`rigidbody`).
11
11
  *
12
+ * @elementSummary The `<pc-rigid-body>` element hands its entity to the physics simulation, with
13
+ * attributes for its type, mass, friction and restitution. It needs a sibling `<pc-collision>` for
14
+ * its shape, and `Ammo` loaded through `<pc-wasm>`. Must be a child of a `<pc-entity>`,
15
+ * `<pc-model>` or `<pc-node>`.
16
+ *
12
17
  * @category Components
13
18
  */
14
19
  declare class RigidBodyComponentElement extends ComponentElement {
@@ -9,6 +9,10 @@ import { ComponentElement } from './component.cjs';
9
9
  *
10
10
  * Engine component: {@link ScreenComponent} (`screen`).
11
11
  *
12
+ * @elementSummary The `<pc-screen>` element gives its entity a 2D space — in screen space or in the
13
+ * world — that a hierarchy of `<pc-element>` descendants lays out inside. Must be a child of a
14
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class ScreenComponentElement extends ComponentElement {
@@ -9,6 +9,10 @@ import { ComponentElement } from './component.js';
9
9
  *
10
10
  * Engine component: {@link ScreenComponent} (`screen`).
11
11
  *
12
+ * @elementSummary The `<pc-screen>` element gives its entity a 2D space — in screen space or in the
13
+ * world — that a hierarchy of `<pc-element>` descendants lays out inside. Must be a child of a
14
+ * `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class ScreenComponentElement extends ComponentElement {
@@ -24,6 +24,9 @@ export type ScriptNameChangeEvent = {
24
24
  *
25
25
  * Engine component: {@link ScriptComponent} (`script`).
26
26
  *
27
+ * @elementSummary The `<pc-script>` element holds the `<pc-script-instance>` children that attach
28
+ * scripts to its entity. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
29
+ *
27
30
  * @category Components
28
31
  */
29
32
  declare class ScriptComponentElement extends ComponentElement {
@@ -24,6 +24,9 @@ export type ScriptNameChangeEvent = {
24
24
  *
25
25
  * Engine component: {@link ScriptComponent} (`script`).
26
26
  *
27
+ * @elementSummary The `<pc-script>` element holds the `<pc-script-instance>` children that attach
28
+ * scripts to its entity. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
29
+ *
27
30
  * @category Components
28
31
  */
29
32
  declare class ScriptComponentElement extends ComponentElement {
@@ -26,6 +26,10 @@ import { AsyncElement } from '../async-element.cjs';
26
26
  * The element becomes ready once its script instance has been created by the parent
27
27
  * `<pc-script>` element.
28
28
  *
29
+ * @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
30
+ * the entity of its parent `<pc-script>`. Its other attributes set script attributes of the same
31
+ * name, and `attributes` takes a JSON object instead. Must be a direct child of `<pc-script>`.
32
+ *
29
33
  * @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
30
34
  * `detail` carries the new `attributes` object. Bubbles.
31
35
  * @fires {CustomEvent} scriptenablechange - Fired when the script's enabled state changes. The
@@ -26,6 +26,10 @@ import { AsyncElement } from '../async-element.js';
26
26
  * The element becomes ready once its script instance has been created by the parent
27
27
  * `<pc-script>` element.
28
28
  *
29
+ * @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
30
+ * the entity of its parent `<pc-script>`. Its other attributes set script attributes of the same
31
+ * name, and `attributes` takes a JSON object instead. Must be a direct child of `<pc-script>`.
32
+ *
29
33
  * @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
30
34
  * `detail` carries the new `attributes` object. Bubbles.
31
35
  * @fires {CustomEvent} scriptenablechange - Fired when the script's enabled state changes. The
@@ -9,6 +9,10 @@ import { ComponentElement } from './component.cjs';
9
9
  *
10
10
  * Engine component: {@link ScrollViewComponent} (`scrollview`).
11
11
  *
12
+ * @elementSummary The `<pc-scroll-view>` element scrolls a larger content entity within a clipped
13
+ * viewport at its entity, optionally driven by the `<pc-scrollbar>` elements it references. Must be
14
+ * a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class ScrollViewComponentElement extends ComponentElement {
@@ -9,6 +9,10 @@ import { ComponentElement } from './component.js';
9
9
  *
10
10
  * Engine component: {@link ScrollViewComponent} (`scrollview`).
11
11
  *
12
+ * @elementSummary The `<pc-scroll-view>` element scrolls a larger content entity within a clipped
13
+ * viewport at its entity, optionally driven by the `<pc-scrollbar>` elements it references. Must be
14
+ * a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
15
+ *
12
16
  * @category Components
13
17
  */
14
18
  declare class ScrollViewComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.cjs';
8
8
  *
9
9
  * Engine component: {@link ScrollbarComponent} (`scrollbar`).
10
10
  *
11
+ * @elementSummary The `<pc-scrollbar>` element gives its entity a draggable handle reporting a
12
+ * position from 0 to 1, which a `<pc-scroll-view>` references to scroll its content. 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 ScrollbarComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.js';
8
8
  *
9
9
  * Engine component: {@link ScrollbarComponent} (`scrollbar`).
10
10
  *
11
+ * @elementSummary The `<pc-scrollbar>` element gives its entity a draggable handle reporting a
12
+ * position from 0 to 1, which a `<pc-scroll-view>` references to scroll its content. 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 ScrollbarComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.cjs';
8
8
  *
9
9
  * Engine component: {@link SoundComponent} (`sound`).
10
10
  *
11
+ * @elementSummary The `<pc-sound>` element holds the `<pc-sound-slot>` children that play sounds at
12
+ * its entity, along with the positional audio settings they share. 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 SoundComponentElement extends ComponentElement {
@@ -8,6 +8,10 @@ import { ComponentElement } from './component.js';
8
8
  *
9
9
  * Engine component: {@link SoundComponent} (`sound`).
10
10
  *
11
+ * @elementSummary The `<pc-sound>` element holds the `<pc-sound-slot>` children that play sounds at
12
+ * its entity, along with the positional audio settings they share. 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 SoundComponentElement extends ComponentElement {
@@ -5,6 +5,9 @@ import { SoundComponentElement } from './sound-component.cjs';
5
5
  * The SoundSlotElement interface provides properties and methods for manipulating
6
6
  * `<pc-sound-slot>` elements. The SoundSlotElement interface also inherits the properties and
7
7
  * methods of the {@link AsyncElement} interface.
8
+ *
9
+ * @elementSummary The `<pc-sound-slot>` element declares one named sound on its parent `<pc-sound>`
10
+ * — its asset, volume, pitch, looping and autoplay. Must be a direct child of `<pc-sound>`.
8
11
  */
9
12
  declare class SoundSlotElement extends AsyncElement {
10
13
  private _asset;
@@ -5,6 +5,9 @@ import { SoundComponentElement } from './sound-component.js';
5
5
  * The SoundSlotElement interface provides properties and methods for manipulating
6
6
  * `<pc-sound-slot>` elements. The SoundSlotElement interface also inherits the properties and
7
7
  * methods of the {@link AsyncElement} interface.
8
+ *
9
+ * @elementSummary The `<pc-sound-slot>` element declares one named sound on its parent `<pc-sound>`
10
+ * — its asset, volume, pitch, looping and autoplay. Must be a direct child of `<pc-sound>`.
8
11
  */
9
12
  declare class SoundSlotElement extends AsyncElement {
10
13
  private _asset;