@playcanvas/web-components 0.16.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 (126) hide show
  1. package/README.md +5 -3
  2. package/dist/app.d.cts +18 -13
  3. package/dist/app.d.ts +18 -13
  4. package/dist/asset.d.cts +13 -3
  5. package/dist/asset.d.ts +13 -3
  6. package/dist/async-element.d.cts +13 -13
  7. package/dist/async-element.d.ts +13 -13
  8. package/dist/components/anim-clip.d.cts +4 -0
  9. package/dist/components/anim-clip.d.ts +4 -0
  10. package/dist/components/anim-component.d.cts +38 -5
  11. package/dist/components/anim-component.d.ts +38 -5
  12. package/dist/components/audio-listener-component.d.cts +26 -0
  13. package/dist/components/audio-listener-component.d.ts +26 -0
  14. package/dist/components/button-component.d.cts +10 -1
  15. package/dist/components/button-component.d.ts +10 -1
  16. package/dist/components/camera-component.d.cts +37 -1
  17. package/dist/components/camera-component.d.ts +37 -1
  18. package/dist/components/collision-component.d.cts +9 -1
  19. package/dist/components/collision-component.d.ts +9 -1
  20. package/dist/components/component.d.cts +3 -2
  21. package/dist/components/component.d.ts +3 -2
  22. package/dist/components/element-component.d.cts +11 -0
  23. package/dist/components/element-component.d.ts +11 -0
  24. package/dist/components/gsplat-component.d.cts +6 -0
  25. package/dist/components/gsplat-component.d.ts +6 -0
  26. package/dist/components/joint-component.d.cts +14 -2
  27. package/dist/components/joint-component.d.ts +14 -2
  28. package/dist/components/{layoutchild-component.d.cts → layout-child-component.d.cts} +7 -1
  29. package/dist/components/{layoutchild-component.d.ts → layout-child-component.d.ts} +7 -1
  30. package/dist/components/{layoutgroup-component.d.cts → layout-group-component.d.cts} +7 -1
  31. package/dist/components/{layoutgroup-component.d.ts → layout-group-component.d.ts} +7 -1
  32. package/dist/components/light-component.d.cts +52 -1
  33. package/dist/components/light-component.d.ts +52 -1
  34. package/dist/components/{particlesystem-component.d.cts → particle-system-component.d.cts} +7 -1
  35. package/dist/components/{particlesystem-component.d.ts → particle-system-component.d.ts} +7 -1
  36. package/dist/components/render-component.d.cts +7 -0
  37. package/dist/components/render-component.d.ts +7 -0
  38. package/dist/components/{rigidbody-component.d.cts → rigid-body-component.d.cts} +8 -1
  39. package/dist/components/{rigidbody-component.d.ts → rigid-body-component.d.ts} +8 -1
  40. package/dist/components/screen-component.d.cts +6 -0
  41. package/dist/components/screen-component.d.ts +6 -0
  42. package/dist/components/script-component.d.cts +26 -12
  43. package/dist/components/script-component.d.ts +26 -12
  44. package/dist/components/{script.d.cts → script-instance.d.cts} +11 -7
  45. package/dist/components/{script.d.ts → script-instance.d.ts} +11 -7
  46. package/dist/components/{scrollview-component.d.cts → scroll-view-component.d.cts} +7 -1
  47. package/dist/components/{scrollview-component.d.ts → scroll-view-component.d.ts} +7 -1
  48. package/dist/components/scrollbar-component.d.cts +6 -0
  49. package/dist/components/scrollbar-component.d.ts +6 -0
  50. package/dist/components/sound-component.d.cts +7 -1
  51. package/dist/components/sound-component.d.ts +7 -1
  52. package/dist/components/sound-slot.d.cts +5 -2
  53. package/dist/components/sound-slot.d.ts +5 -2
  54. package/dist/custom-elements.json +1852 -974
  55. package/dist/entity-base.d.cts +7 -6
  56. package/dist/entity-base.d.ts +7 -6
  57. package/dist/entity-owner.d.cts +118 -0
  58. package/dist/entity-owner.d.ts +118 -0
  59. package/dist/entity.d.cts +14 -102
  60. package/dist/entity.d.ts +14 -102
  61. package/dist/index.d.cts +26 -22
  62. package/dist/index.d.ts +26 -22
  63. package/dist/material.d.cts +18 -7
  64. package/dist/material.d.ts +18 -7
  65. package/dist/model.d.cts +72 -24
  66. package/dist/model.d.ts +72 -24
  67. package/dist/node.d.cts +6 -1
  68. package/dist/node.d.ts +6 -1
  69. package/dist/pwc.cjs +807 -293
  70. package/dist/pwc.cjs.map +1 -1
  71. package/dist/pwc.js +807 -293
  72. package/dist/pwc.js.map +1 -1
  73. package/dist/pwc.min.js +1 -1
  74. package/dist/pwc.min.js.map +1 -1
  75. package/dist/pwc.min.mjs +1 -1
  76. package/dist/pwc.min.mjs.map +1 -1
  77. package/dist/pwc.mjs +805 -292
  78. package/dist/pwc.mjs.map +1 -1
  79. package/dist/scene.d.cts +3 -0
  80. package/dist/scene.d.ts +3 -0
  81. package/dist/sky.d.cts +4 -0
  82. package/dist/sky.d.ts +4 -0
  83. package/dist/vscode.html-custom-data.json +351 -121
  84. package/dist/{module.d.cts → wasm.d.cts} +10 -6
  85. package/dist/{module.d.ts → wasm.d.ts} +10 -6
  86. package/dist/web-types.json +465 -291
  87. package/package.json +7 -7
  88. package/src/app.ts +49 -35
  89. package/src/asset.ts +13 -4
  90. package/src/async-element.ts +14 -14
  91. package/src/components/anim-clip.ts +4 -0
  92. package/src/components/anim-component.ts +89 -14
  93. package/src/components/audio-listener-component.ts +36 -0
  94. package/src/components/button-component.ts +10 -1
  95. package/src/components/camera-component.ts +65 -6
  96. package/src/components/collision-component.ts +9 -1
  97. package/src/components/component.ts +4 -3
  98. package/src/components/element-component.ts +11 -0
  99. package/src/components/gsplat-component.ts +6 -0
  100. package/src/components/joint-component.ts +14 -2
  101. package/src/components/{layoutchild-component.ts → layout-child-component.ts} +8 -2
  102. package/src/components/{layoutgroup-component.ts → layout-group-component.ts} +8 -2
  103. package/src/components/light-component.ts +110 -17
  104. package/src/components/{particlesystem-component.ts → particle-system-component.ts} +8 -2
  105. package/src/components/render-component.ts +7 -0
  106. package/src/components/{rigidbody-component.ts → rigid-body-component.ts} +9 -2
  107. package/src/components/screen-component.ts +6 -0
  108. package/src/components/script-component.ts +66 -42
  109. package/src/components/{script.ts → script-instance.ts} +18 -14
  110. package/src/components/{scrollview-component.ts → scroll-view-component.ts} +8 -2
  111. package/src/components/scrollbar-component.ts +6 -0
  112. package/src/components/sound-component.ts +8 -2
  113. package/src/components/sound-slot.ts +7 -4
  114. package/src/entity-base.ts +8 -7
  115. package/src/entity-owner.ts +298 -0
  116. package/src/entity.ts +21 -271
  117. package/src/index.ts +38 -25
  118. package/src/material.ts +19 -8
  119. package/src/model.ts +164 -72
  120. package/src/node.ts +15 -6
  121. package/src/scene.ts +3 -0
  122. package/src/sky.ts +4 -0
  123. package/src/{module.ts → wasm.ts} +12 -8
  124. package/dist/components/listener-component.d.cts +0 -20
  125. package/dist/components/listener-component.d.ts +0 -20
  126. package/src/components/listener-component.ts +0 -30
@@ -2,11 +2,12 @@ import type { Entity } from 'playcanvas';
2
2
  import type { AppElement } from './app.cjs';
3
3
  import { AsyncElement } from './async-element.cjs';
4
4
  /**
5
- * The base class for elements that front an engine {@link Entity}: `<pc-entity>`, which creates
6
- * one, and `<pc-node>`, which binds to one inside a model's instantiated hierarchy. It carries
7
- * what both need — the `entity` contract, registration with the owning application (which joins
8
- * picked scene nodes back to elements by identity, never by name), and the pointer listener
9
- * bookkeeping that lets the application lazily attach its canvas handlers.
5
+ * The base class for elements that front an engine {@link Entity}: `<pc-entity>` and
6
+ * `<pc-model>`, which create one, and `<pc-node>`, which binds to one inside a model's
7
+ * instantiated hierarchy. It carries what all of them need — the `entity` contract, registration
8
+ * with the owning application (which joins picked scene nodes back to elements by identity,
9
+ * never by name), and the pointer listener bookkeeping that lets the application lazily attach
10
+ * its canvas handlers.
10
11
  */
11
12
  declare class EntityBaseElement extends AsyncElement {
12
13
  protected _entity: Entity | null;
@@ -47,7 +48,7 @@ declare class EntityBaseElement extends AsyncElement {
47
48
  * Tracks whether an inline `onpointer*` attribute is present. The browser itself compiles and
48
49
  * runs these attributes — they are standard `GlobalEventHandlers`, so setting one replaces
49
50
  * the previous handler and removing it removes the handler, exactly like `onclick` on any
50
- * HTML element. But because they bypass {@link addEventListener}, the connect/disconnect
51
+ * HTML element. But because they bypass {@link EventTarget.addEventListener}, the connect/disconnect
51
52
  * bookkeeping that lets the application lazily attach its canvas pointer handlers must be
52
53
  * kept in sync here.
53
54
  *
@@ -2,11 +2,12 @@ import type { Entity } from 'playcanvas';
2
2
  import type { AppElement } from './app.js';
3
3
  import { AsyncElement } from './async-element.js';
4
4
  /**
5
- * The base class for elements that front an engine {@link Entity}: `<pc-entity>`, which creates
6
- * one, and `<pc-node>`, which binds to one inside a model's instantiated hierarchy. It carries
7
- * what both need — the `entity` contract, registration with the owning application (which joins
8
- * picked scene nodes back to elements by identity, never by name), and the pointer listener
9
- * bookkeeping that lets the application lazily attach its canvas handlers.
5
+ * The base class for elements that front an engine {@link Entity}: `<pc-entity>` and
6
+ * `<pc-model>`, which create one, and `<pc-node>`, which binds to one inside a model's
7
+ * instantiated hierarchy. It carries what all of them need — the `entity` contract, registration
8
+ * with the owning application (which joins picked scene nodes back to elements by identity,
9
+ * never by name), and the pointer listener bookkeeping that lets the application lazily attach
10
+ * its canvas handlers.
10
11
  */
11
12
  declare class EntityBaseElement extends AsyncElement {
12
13
  protected _entity: Entity | null;
@@ -47,7 +48,7 @@ declare class EntityBaseElement extends AsyncElement {
47
48
  * Tracks whether an inline `onpointer*` attribute is present. The browser itself compiles and
48
49
  * runs these attributes — they are standard `GlobalEventHandlers`, so setting one replaces
49
50
  * the previous handler and removing it removes the handler, exactly like `onclick` on any
50
- * HTML element. But because they bypass {@link addEventListener}, the connect/disconnect
51
+ * HTML element. But because they bypass {@link EventTarget.addEventListener}, the connect/disconnect
51
52
  * bookkeeping that lets the application lazily attach its canvas pointer handlers must be
52
53
  * kept in sync here.
53
54
  *
@@ -0,0 +1,118 @@
1
+ import { Entity, Vec3 } from 'playcanvas';
2
+ import { EntityBaseElement } from './entity-base.cjs';
3
+ /**
4
+ * The base class for elements that create and own their backing entity: `<pc-entity>` and
5
+ * `<pc-model>`, whose host entity carries the same authored properties. It carries the cached
6
+ * property state, entity creation and parenting, and the reset that follows the entity's
7
+ * destruction. `<pc-node>` sits outside this class: it borrows an entity a model instantiated,
8
+ * and its properties are nullable overrides rather than owned values.
9
+ */
10
+ declare class EntityOwnerElement extends EntityBaseElement {
11
+ /**
12
+ * Whether the entity is enabled.
13
+ */
14
+ private _enabled;
15
+ /**
16
+ * The name of the entity.
17
+ */
18
+ private _name;
19
+ /**
20
+ * The position of the entity.
21
+ */
22
+ private _position;
23
+ /**
24
+ * The rotation of the entity.
25
+ */
26
+ private _rotation;
27
+ /**
28
+ * The scale of the entity.
29
+ */
30
+ private _scale;
31
+ /**
32
+ * The tags of the entity.
33
+ */
34
+ private _tags;
35
+ /**
36
+ * Whether the hierarchy has been built for this entity — set once `_buildHierarchy` has
37
+ * parented it. Read by subclasses that gate work on the entity being in the scene graph.
38
+ */
39
+ protected _built: boolean;
40
+ /**
41
+ * Handles the destruction of the backing entity. Resets the element so a later re-insertion
42
+ * starts clean: `_built` must be cleared alongside `_entity`, or _buildHierarchy would bail
43
+ * and a re-created entity would never be parented. Readiness is re-armed for the same
44
+ * reason — with the entity gone, a resolved ready promise would resume its awaiters against
45
+ * a null `entity`.
46
+ *
47
+ * @param entity - The entity that was destroyed.
48
+ */
49
+ protected _onEntityDestroy(entity: Entity): void;
50
+ /**
51
+ * Called by `_buildHierarchy` once the backing entity has been parented — exactly once
52
+ * per build cycle. The default announces readiness, which is what a parented `<pc-entity>`
53
+ * means; `<pc-model>` overrides it to start loading content instead, because its readiness
54
+ * tracks the content settling rather than the host entering the scene graph.
55
+ */
56
+ protected _onBuilt(): void;
57
+ /**
58
+ * Sets the enabled state of the entity.
59
+ * @param value - Whether the entity is enabled.
60
+ */
61
+ set enabled(value: boolean);
62
+ /**
63
+ * Gets the enabled state of the entity.
64
+ * @returns Whether the entity is enabled.
65
+ */
66
+ get enabled(): boolean;
67
+ /**
68
+ * Sets the name of the entity.
69
+ * @param value - The name of the entity.
70
+ */
71
+ set name(value: string);
72
+ /**
73
+ * Gets the name of the entity.
74
+ * @returns The name of the entity.
75
+ */
76
+ get name(): string;
77
+ /**
78
+ * Sets the position of the entity.
79
+ * @param value - The position of the entity.
80
+ */
81
+ set position(value: Vec3);
82
+ /**
83
+ * Gets the position of the entity.
84
+ * @returns The position of the entity.
85
+ */
86
+ get position(): Vec3;
87
+ /**
88
+ * Sets the rotation of the entity.
89
+ * @param value - The rotation of the entity.
90
+ */
91
+ set rotation(value: Vec3);
92
+ /**
93
+ * Gets the rotation of the entity.
94
+ * @returns The rotation of the entity.
95
+ */
96
+ get rotation(): Vec3;
97
+ /**
98
+ * Sets the scale of the entity.
99
+ * @param value - The scale of the entity.
100
+ */
101
+ set scale(value: Vec3);
102
+ /**
103
+ * Gets the scale of the entity.
104
+ * @returns The scale of the entity.
105
+ */
106
+ get scale(): Vec3;
107
+ /**
108
+ * Sets the tags of the entity.
109
+ * @param value - The tags of the entity.
110
+ */
111
+ set tags(value: string[]);
112
+ /**
113
+ * Gets the tags of the entity.
114
+ * @returns The tags of the entity.
115
+ */
116
+ get tags(): string[];
117
+ }
118
+ export { EntityOwnerElement };
@@ -0,0 +1,118 @@
1
+ import { Entity, Vec3 } from 'playcanvas';
2
+ import { EntityBaseElement } from './entity-base.js';
3
+ /**
4
+ * The base class for elements that create and own their backing entity: `<pc-entity>` and
5
+ * `<pc-model>`, whose host entity carries the same authored properties. It carries the cached
6
+ * property state, entity creation and parenting, and the reset that follows the entity's
7
+ * destruction. `<pc-node>` sits outside this class: it borrows an entity a model instantiated,
8
+ * and its properties are nullable overrides rather than owned values.
9
+ */
10
+ declare class EntityOwnerElement extends EntityBaseElement {
11
+ /**
12
+ * Whether the entity is enabled.
13
+ */
14
+ private _enabled;
15
+ /**
16
+ * The name of the entity.
17
+ */
18
+ private _name;
19
+ /**
20
+ * The position of the entity.
21
+ */
22
+ private _position;
23
+ /**
24
+ * The rotation of the entity.
25
+ */
26
+ private _rotation;
27
+ /**
28
+ * The scale of the entity.
29
+ */
30
+ private _scale;
31
+ /**
32
+ * The tags of the entity.
33
+ */
34
+ private _tags;
35
+ /**
36
+ * Whether the hierarchy has been built for this entity — set once `_buildHierarchy` has
37
+ * parented it. Read by subclasses that gate work on the entity being in the scene graph.
38
+ */
39
+ protected _built: boolean;
40
+ /**
41
+ * Handles the destruction of the backing entity. Resets the element so a later re-insertion
42
+ * starts clean: `_built` must be cleared alongside `_entity`, or _buildHierarchy would bail
43
+ * and a re-created entity would never be parented. Readiness is re-armed for the same
44
+ * reason — with the entity gone, a resolved ready promise would resume its awaiters against
45
+ * a null `entity`.
46
+ *
47
+ * @param entity - The entity that was destroyed.
48
+ */
49
+ protected _onEntityDestroy(entity: Entity): void;
50
+ /**
51
+ * Called by `_buildHierarchy` once the backing entity has been parented — exactly once
52
+ * per build cycle. The default announces readiness, which is what a parented `<pc-entity>`
53
+ * means; `<pc-model>` overrides it to start loading content instead, because its readiness
54
+ * tracks the content settling rather than the host entering the scene graph.
55
+ */
56
+ protected _onBuilt(): void;
57
+ /**
58
+ * Sets the enabled state of the entity.
59
+ * @param value - Whether the entity is enabled.
60
+ */
61
+ set enabled(value: boolean);
62
+ /**
63
+ * Gets the enabled state of the entity.
64
+ * @returns Whether the entity is enabled.
65
+ */
66
+ get enabled(): boolean;
67
+ /**
68
+ * Sets the name of the entity.
69
+ * @param value - The name of the entity.
70
+ */
71
+ set name(value: string);
72
+ /**
73
+ * Gets the name of the entity.
74
+ * @returns The name of the entity.
75
+ */
76
+ get name(): string;
77
+ /**
78
+ * Sets the position of the entity.
79
+ * @param value - The position of the entity.
80
+ */
81
+ set position(value: Vec3);
82
+ /**
83
+ * Gets the position of the entity.
84
+ * @returns The position of the entity.
85
+ */
86
+ get position(): Vec3;
87
+ /**
88
+ * Sets the rotation of the entity.
89
+ * @param value - The rotation of the entity.
90
+ */
91
+ set rotation(value: Vec3);
92
+ /**
93
+ * Gets the rotation of the entity.
94
+ * @returns The rotation of the entity.
95
+ */
96
+ get rotation(): Vec3;
97
+ /**
98
+ * Sets the scale of the entity.
99
+ * @param value - The scale of the entity.
100
+ */
101
+ set scale(value: Vec3);
102
+ /**
103
+ * Gets the scale of the entity.
104
+ * @returns The scale of the entity.
105
+ */
106
+ get scale(): Vec3;
107
+ /**
108
+ * Sets the tags of the entity.
109
+ * @param value - The tags of the entity.
110
+ */
111
+ set tags(value: string[]);
112
+ /**
113
+ * Gets the tags of the entity.
114
+ * @returns The tags of the entity.
115
+ */
116
+ get tags(): string[];
117
+ }
118
+ export { EntityOwnerElement };
package/dist/entity.d.cts CHANGED
@@ -1,5 +1,4 @@
1
- import { Vec3 } from 'playcanvas';
2
- import { EntityBaseElement } from './entity-base.cjs';
1
+ import { EntityOwnerElement } from './entity-owner.cjs';
3
2
  /**
4
3
  * The EntityElement interface provides properties and methods for manipulating
5
4
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
@@ -8,9 +7,20 @@ import { EntityBaseElement } from './entity-base.cjs';
8
7
  *
9
8
  * The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
10
9
  * intersects this entity's geometry. They are only generated while the entity has a listener for
11
- * them, registered either with {@link addEventListener} or with the matching inline `onpointer*`
10
+ * them, registered either with {@link EventTarget.addEventListener} or with the matching inline `onpointer*`
12
11
  * attribute.
13
12
  *
13
+ * @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
14
+ * scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
15
+ * `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
16
+ * `<pc-model>` or a `<pc-node>` to parent it there.
17
+ *
18
+ * @attribute {boolean} enabled - The enabled state of the entity.
19
+ * @attribute {string} name - The name of the entity.
20
+ * @attribute {string} position - The position of the entity.
21
+ * @attribute {string} rotation - The rotation of the entity.
22
+ * @attribute {string} scale - The scale of the entity.
23
+ * @attribute {string} tags - The tags of the entity.
14
24
  * @attribute {string} onpointerenter - Script to run when the pointer moves onto the entity.
15
25
  * @attribute {string} onpointerleave - Script to run when the pointer moves off the entity.
16
26
  * @attribute {string} onpointermove - Script to run when the pointer moves over the entity.
@@ -24,107 +34,9 @@ import { EntityBaseElement } from './entity-base.cjs';
24
34
  * @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the entity.
25
35
  * @fires {PointerEvent} pointerup - Fired when a pointer button is released over the entity.
26
36
  */
27
- declare class EntityElement extends EntityBaseElement {
28
- /**
29
- * Whether the entity is enabled.
30
- */
31
- private _enabled;
32
- /**
33
- * The name of the entity.
34
- */
35
- private _name;
36
- /**
37
- * The position of the entity.
38
- */
39
- private _position;
40
- /**
41
- * The rotation of the entity.
42
- */
43
- private _rotation;
44
- /**
45
- * The scale of the entity.
46
- */
47
- private _scale;
48
- /**
49
- * The tags of the entity.
50
- */
51
- private _tags;
52
- /**
53
- * Whether the hierarchy has been built for this entity.
54
- */
55
- private _built;
56
- /**
57
- * Handles the destruction of the backing entity. Resets the element so a later re-insertion
58
- * starts clean: `_built` must be cleared alongside `_entity`, or _buildHierarchy would bail
59
- * and a re-created entity would never be parented. Readiness is re-armed for the same
60
- * reason — with the entity gone, a resolved ready promise would resume its awaiters against
61
- * a null `entity`.
62
- *
63
- * @param entity - The entity that was destroyed.
64
- */
65
- private _onEntityDestroy;
37
+ declare class EntityElement extends EntityOwnerElement {
66
38
  connectedCallback(): void;
67
39
  disconnectedCallback(): void;
68
- /**
69
- * Sets the enabled state of the entity.
70
- * @param value - Whether the entity is enabled.
71
- */
72
- set enabled(value: boolean);
73
- /**
74
- * Gets the enabled state of the entity.
75
- * @returns Whether the entity is enabled.
76
- */
77
- get enabled(): boolean;
78
- /**
79
- * Sets the name of the entity.
80
- * @param value - The name of the entity.
81
- */
82
- set name(value: string);
83
- /**
84
- * Gets the name of the entity.
85
- * @returns The name of the entity.
86
- */
87
- get name(): string;
88
- /**
89
- * Sets the position of the entity.
90
- * @param value - The position of the entity.
91
- */
92
- set position(value: Vec3);
93
- /**
94
- * Gets the position of the entity.
95
- * @returns The position of the entity.
96
- */
97
- get position(): Vec3;
98
- /**
99
- * Sets the rotation of the entity.
100
- * @param value - The rotation of the entity.
101
- */
102
- set rotation(value: Vec3);
103
- /**
104
- * Gets the rotation of the entity.
105
- * @returns The rotation of the entity.
106
- */
107
- get rotation(): Vec3;
108
- /**
109
- * Sets the scale of the entity.
110
- * @param value - The scale of the entity.
111
- */
112
- set scale(value: Vec3);
113
- /**
114
- * Gets the scale of the entity.
115
- * @returns The scale of the entity.
116
- */
117
- get scale(): Vec3;
118
- /**
119
- * Sets the tags of the entity.
120
- * @param value - The tags of the entity.
121
- */
122
- set tags(value: string[]);
123
- /**
124
- * Gets the tags of the entity.
125
- * @returns The tags of the entity.
126
- */
127
- get tags(): string[];
128
40
  static get observedAttributes(): string[];
129
41
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
130
42
  }
package/dist/entity.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { Vec3 } from 'playcanvas';
2
- import { EntityBaseElement } from './entity-base.js';
1
+ import { EntityOwnerElement } from './entity-owner.js';
3
2
  /**
4
3
  * The EntityElement interface provides properties and methods for manipulating
5
4
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
@@ -8,9 +7,20 @@ import { EntityBaseElement } from './entity-base.js';
8
7
  *
9
8
  * The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
10
9
  * intersects this entity's geometry. They are only generated while the entity has a listener for
11
- * them, registered either with {@link addEventListener} or with the matching inline `onpointer*`
10
+ * them, registered either with {@link EventTarget.addEventListener} or with the matching inline `onpointer*`
12
11
  * attribute.
13
12
  *
13
+ * @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
14
+ * scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
15
+ * `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
16
+ * `<pc-model>` or a `<pc-node>` to parent it there.
17
+ *
18
+ * @attribute {boolean} enabled - The enabled state of the entity.
19
+ * @attribute {string} name - The name of the entity.
20
+ * @attribute {string} position - The position of the entity.
21
+ * @attribute {string} rotation - The rotation of the entity.
22
+ * @attribute {string} scale - The scale of the entity.
23
+ * @attribute {string} tags - The tags of the entity.
14
24
  * @attribute {string} onpointerenter - Script to run when the pointer moves onto the entity.
15
25
  * @attribute {string} onpointerleave - Script to run when the pointer moves off the entity.
16
26
  * @attribute {string} onpointermove - Script to run when the pointer moves over the entity.
@@ -24,107 +34,9 @@ import { EntityBaseElement } from './entity-base.js';
24
34
  * @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the entity.
25
35
  * @fires {PointerEvent} pointerup - Fired when a pointer button is released over the entity.
26
36
  */
27
- declare class EntityElement extends EntityBaseElement {
28
- /**
29
- * Whether the entity is enabled.
30
- */
31
- private _enabled;
32
- /**
33
- * The name of the entity.
34
- */
35
- private _name;
36
- /**
37
- * The position of the entity.
38
- */
39
- private _position;
40
- /**
41
- * The rotation of the entity.
42
- */
43
- private _rotation;
44
- /**
45
- * The scale of the entity.
46
- */
47
- private _scale;
48
- /**
49
- * The tags of the entity.
50
- */
51
- private _tags;
52
- /**
53
- * Whether the hierarchy has been built for this entity.
54
- */
55
- private _built;
56
- /**
57
- * Handles the destruction of the backing entity. Resets the element so a later re-insertion
58
- * starts clean: `_built` must be cleared alongside `_entity`, or _buildHierarchy would bail
59
- * and a re-created entity would never be parented. Readiness is re-armed for the same
60
- * reason — with the entity gone, a resolved ready promise would resume its awaiters against
61
- * a null `entity`.
62
- *
63
- * @param entity - The entity that was destroyed.
64
- */
65
- private _onEntityDestroy;
37
+ declare class EntityElement extends EntityOwnerElement {
66
38
  connectedCallback(): void;
67
39
  disconnectedCallback(): void;
68
- /**
69
- * Sets the enabled state of the entity.
70
- * @param value - Whether the entity is enabled.
71
- */
72
- set enabled(value: boolean);
73
- /**
74
- * Gets the enabled state of the entity.
75
- * @returns Whether the entity is enabled.
76
- */
77
- get enabled(): boolean;
78
- /**
79
- * Sets the name of the entity.
80
- * @param value - The name of the entity.
81
- */
82
- set name(value: string);
83
- /**
84
- * Gets the name of the entity.
85
- * @returns The name of the entity.
86
- */
87
- get name(): string;
88
- /**
89
- * Sets the position of the entity.
90
- * @param value - The position of the entity.
91
- */
92
- set position(value: Vec3);
93
- /**
94
- * Gets the position of the entity.
95
- * @returns The position of the entity.
96
- */
97
- get position(): Vec3;
98
- /**
99
- * Sets the rotation of the entity.
100
- * @param value - The rotation of the entity.
101
- */
102
- set rotation(value: Vec3);
103
- /**
104
- * Gets the rotation of the entity.
105
- * @returns The rotation of the entity.
106
- */
107
- get rotation(): Vec3;
108
- /**
109
- * Sets the scale of the entity.
110
- * @param value - The scale of the entity.
111
- */
112
- set scale(value: Vec3);
113
- /**
114
- * Gets the scale of the entity.
115
- * @returns The scale of the entity.
116
- */
117
- get scale(): Vec3;
118
- /**
119
- * Sets the tags of the entity.
120
- * @param value - The tags of the entity.
121
- */
122
- set tags(value: string[]);
123
- /**
124
- * Gets the tags of the entity.
125
- * @returns The tags of the entity.
126
- */
127
- get tags(): string[];
128
40
  static get observedAttributes(): string[];
129
41
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
130
42
  }
package/dist/index.d.cts CHANGED
@@ -7,36 +7,37 @@
7
7
  * @module EngineWebComponents
8
8
  */
9
9
  import { AsyncElement, whenReady } from './async-element.cjs';
10
- import { ModuleElement } from './module.cjs';
10
+ import { WasmElement } from './wasm.cjs';
11
11
  import { AppElement } from './app.cjs';
12
12
  import { EntityElement } from './entity.cjs';
13
+ import { ModelElement } from './model.cjs';
13
14
  import { AssetElement } from './asset.cjs';
14
15
  import { AnimComponentElement } from './components/anim-component.cjs';
15
16
  import { AnimClipElement } from './components/anim-clip.cjs';
16
- import { ListenerComponentElement } from './components/listener-component.cjs';
17
+ import { AudioListenerComponentElement } from './components/audio-listener-component.cjs';
17
18
  import { ButtonComponentElement } from './components/button-component.cjs';
18
19
  import { CameraComponentElement } from './components/camera-component.cjs';
19
20
  import { CollisionComponentElement } from './components/collision-component.cjs';
20
21
  import { ComponentElement } from './components/component.cjs';
21
22
  import { ElementComponentElement } from './components/element-component.cjs';
22
23
  import { JointComponentElement } from './components/joint-component.cjs';
23
- import { LayoutChildComponentElement } from './components/layoutchild-component.cjs';
24
- import { LayoutGroupComponentElement } from './components/layoutgroup-component.cjs';
24
+ import { LayoutChildComponentElement } from './components/layout-child-component.cjs';
25
+ import { LayoutGroupComponentElement } from './components/layout-group-component.cjs';
25
26
  import { LightComponentElement } from './components/light-component.cjs';
26
- import { ParticleSystemComponentElement } from './components/particlesystem-component.cjs';
27
+ import { ParticleSystemComponentElement } from './components/particle-system-component.cjs';
27
28
  import { RenderComponentElement } from './components/render-component.cjs';
28
- import { RigidBodyComponentElement } from './components/rigidbody-component.cjs';
29
+ import { RigidBodyComponentElement } from './components/rigid-body-component.cjs';
29
30
  import { ScreenComponentElement } from './components/screen-component.cjs';
30
31
  import { ScrollbarComponentElement } from './components/scrollbar-component.cjs';
31
- import { ScrollViewComponentElement } from './components/scrollview-component.cjs';
32
+ import { ScrollViewComponentElement } from './components/scroll-view-component.cjs';
32
33
  import { ScriptComponentElement } from './components/script-component.cjs';
33
- import { ScriptElement } from './components/script.cjs';
34
+ import { ScriptInstanceElement } from './components/script-instance.cjs';
34
35
  import { SoundComponentElement } from './components/sound-component.cjs';
35
36
  import { SoundSlotElement } from './components/sound-slot.cjs';
36
37
  import { GSplatComponentElement } from './components/gsplat-component.cjs';
37
38
  import { EntityBaseElement } from './entity-base.cjs';
39
+ import { EntityOwnerElement } from './entity-owner.cjs';
38
40
  import { MaterialElement } from './material.cjs';
39
- import { ModelElement } from './model.cjs';
40
41
  import { NodeElement } from './node.cjs';
41
42
  import { SceneElement } from './scene.cjs';
42
43
  import { SkyElement } from './sky.cjs';
@@ -60,29 +61,32 @@ declare global {
60
61
  'pc-entity': EntityElement;
61
62
  'pc-gsplat': GSplatComponentElement;
62
63
  'pc-joint': JointComponentElement;
63
- 'pc-layoutchild': LayoutChildComponentElement;
64
- 'pc-layoutgroup': LayoutGroupComponentElement;
64
+ 'pc-layout-child': LayoutChildComponentElement;
65
+ 'pc-layout-group': LayoutGroupComponentElement;
65
66
  'pc-light': LightComponentElement;
66
- 'pc-listener': ListenerComponentElement;
67
+ 'pc-audio-listener': AudioListenerComponentElement;
67
68
  'pc-material': MaterialElement;
68
69
  'pc-model': ModelElement;
69
- 'pc-module': ModuleElement;
70
+ 'pc-wasm': WasmElement;
70
71
  'pc-node': NodeElement;
71
- 'pc-particles': ParticleSystemComponentElement;
72
+ 'pc-particle-system': ParticleSystemComponentElement;
72
73
  'pc-render': RenderComponentElement;
73
- 'pc-rigidbody': RigidBodyComponentElement;
74
+ 'pc-rigid-body': RigidBodyComponentElement;
74
75
  'pc-scene': SceneElement;
75
76
  'pc-screen': ScreenComponentElement;
76
- 'pc-script': ScriptElement;
77
- 'pc-scripts': ScriptComponentElement;
77
+ 'pc-script-instance': ScriptInstanceElement;
78
+ 'pc-script': ScriptComponentElement;
78
79
  'pc-scrollbar': ScrollbarComponentElement;
79
- 'pc-scrollview': ScrollViewComponentElement;
80
+ 'pc-scroll-view': ScrollViewComponentElement;
80
81
  'pc-sky': SkyElement;
81
- 'pc-sound': SoundSlotElement;
82
- 'pc-sounds': SoundComponentElement;
82
+ 'pc-sound-slot': SoundSlotElement;
83
+ 'pc-sound': SoundComponentElement;
83
84
  }
84
85
  }
85
- export { AsyncElement, ModuleElement, AppElement, EntityElement, AssetElement, AnimComponentElement, AnimClipElement, ButtonComponentElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, JointComponentElement, LayoutChildComponentElement, LayoutGroupComponentElement, ParticleSystemComponentElement, LightComponentElement, ListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScreenComponentElement, ScrollbarComponentElement, ScrollViewComponentElement, ScriptComponentElement, ScriptElement, SoundComponentElement, SoundSlotElement, GSplatComponentElement, EntityBaseElement, MaterialElement, ModelElement, NodeElement, SceneElement, SkyElement, whenReady };
86
+ export { AsyncElement, WasmElement, AppElement, EntityElement, AssetElement, AnimComponentElement, AnimClipElement, ButtonComponentElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, JointComponentElement, LayoutChildComponentElement, LayoutGroupComponentElement, ParticleSystemComponentElement, LightComponentElement, AudioListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScreenComponentElement, ScrollbarComponentElement, ScrollViewComponentElement, ScriptComponentElement, ScriptInstanceElement, SoundComponentElement, SoundSlotElement, GSplatComponentElement, EntityBaseElement, EntityOwnerElement, MaterialElement, ModelElement, NodeElement, SceneElement, SkyElement, whenReady };
87
+ export type { AddressMode, MagFilterMode, MinFilterMode } from './asset.cjs';
86
88
  export type { AsyncElementTagName } from './async-element.cjs';
89
+ export type { JointType, MotionMode } from './components/joint-component.cjs';
90
+ export type { BlendType, ColorChannel, CullMode, FresnelModel, OccludeSpecular, OpacityDither, ScalarChannel } from './material.cjs';
87
91
  export type { HierarchyMaterial, HierarchyNode } from './model.cjs';
88
- export type { MaterialOverrides } from './node.cjs';
92
+ export type { MaterialOverrides, NodeBindingState } from './node.cjs';