@playcanvas/web-components 0.1.11 → 0.1.12

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 (55) hide show
  1. package/README.md +31 -303
  2. package/dist/app.d.ts +4 -1
  3. package/dist/asset.d.ts +3 -2
  4. package/dist/components/camera-component.d.ts +4 -3
  5. package/dist/components/collision-component.d.ts +4 -3
  6. package/dist/components/element-component.d.ts +84 -3
  7. package/dist/components/light-component.d.ts +4 -3
  8. package/dist/components/listener-component.d.ts +4 -3
  9. package/dist/components/render-component.d.ts +4 -3
  10. package/dist/components/rigidbody-component.d.ts +5 -4
  11. package/dist/components/screen-component.d.ts +4 -3
  12. package/dist/components/script-component.d.ts +4 -3
  13. package/dist/components/sound-component.d.ts +4 -3
  14. package/dist/components/sound-slot.d.ts +2 -2
  15. package/dist/components/splat-component.d.ts +36 -0
  16. package/dist/entity.d.ts +3 -2
  17. package/dist/index.d.ts +2 -2
  18. package/dist/material.d.ts +3 -2
  19. package/dist/model.d.ts +6 -5
  20. package/dist/module.d.ts +3 -2
  21. package/dist/pwc.cjs +238 -65
  22. package/dist/pwc.cjs.map +1 -1
  23. package/dist/pwc.js +238 -65
  24. package/dist/pwc.js.map +1 -1
  25. package/dist/pwc.min.js +1 -1
  26. package/dist/pwc.min.js.map +1 -1
  27. package/dist/pwc.mjs +238 -65
  28. package/dist/pwc.mjs.map +1 -1
  29. package/dist/scene.d.ts +3 -2
  30. package/dist/sky.d.ts +64 -0
  31. package/package.json +23 -23
  32. package/src/app.ts +14 -10
  33. package/src/asset.ts +3 -2
  34. package/src/components/camera-component.ts +4 -3
  35. package/src/components/collision-component.ts +4 -3
  36. package/src/components/element-component.ts +84 -3
  37. package/src/components/light-component.ts +4 -3
  38. package/src/components/listener-component.ts +4 -3
  39. package/src/components/render-component.ts +4 -3
  40. package/src/components/rigidbody-component.ts +5 -4
  41. package/src/components/screen-component.ts +4 -3
  42. package/src/components/script-component.ts +4 -3
  43. package/src/components/sound-component.ts +4 -3
  44. package/src/components/sound-slot.ts +2 -2
  45. package/src/components/{gsplat-component.ts → splat-component.ts} +17 -8
  46. package/src/entity.ts +3 -2
  47. package/src/index.ts +2 -2
  48. package/src/material.ts +6 -5
  49. package/src/model.ts +8 -7
  50. package/src/module.ts +3 -2
  51. package/src/scene.ts +3 -2
  52. package/src/sky.ts +64 -0
  53. package/dist/components/gsplat-component.d.ts +0 -27
  54. package/dist/fog.d.ts +0 -28
  55. package/src/fog.ts +0 -121
package/src/app.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Application, CameraComponent, FILLMODE_FILL_WINDOW, Keyboard, Mouse, Picker, RESOLUTION_AUTO } from 'playcanvas';
1
+ import { Application, CameraComponent, FILLMODE_FILL_WINDOW, GraphNode, Keyboard, Mouse, Picker, RESOLUTION_AUTO } from 'playcanvas';
2
2
 
3
3
  import { AssetElement } from './asset';
4
4
  import { AsyncElement } from './async-element';
@@ -7,7 +7,10 @@ import { MaterialElement } from './material';
7
7
  import { ModuleElement } from './module';
8
8
 
9
9
  /**
10
- * The main application element.
10
+ * The AppElement interface provides properties and methods for manipulating
11
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-app/ | `<pc-app>`} elements.
12
+ * The AppElement interface also inherits the properties and methods of the
13
+ * {@link HTMLElement} interface.
11
14
  */
12
15
  class AppElement extends AsyncElement {
13
16
  /**
@@ -206,13 +209,14 @@ class AppElement extends AsyncElement {
206
209
  // Get the currently hovered entity by walking up the hierarchy
207
210
  let newHoverEntity = null;
208
211
  if (selection.length > 0) {
209
- let node = selection[0].node;
210
- while (node && !newHoverEntity) {
211
- const entityElement = this.querySelector(`pc-entity[name="${node.name}"]`) as EntityElement;
212
+ let currentNode: GraphNode | null = selection[0].node;
213
+ while (currentNode !== null) {
214
+ const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`) as EntityElement;
212
215
  if (entityElement) {
213
216
  newHoverEntity = entityElement;
217
+ break;
214
218
  }
215
- node = node.parent;
219
+ currentNode = currentNode.parent;
216
220
  }
217
221
  }
218
222
 
@@ -249,14 +253,14 @@ class AppElement extends AsyncElement {
249
253
  const selection = this._picker.getSelection(x, y);
250
254
 
251
255
  if (selection.length > 0) {
252
- let node = selection[0].node;
253
- while (node) {
254
- const entityElement = this.querySelector(`pc-entity[name="${node.name}"]`) as EntityElement;
256
+ let currentNode: GraphNode | null = selection[0].node;
257
+ while (currentNode !== null) {
258
+ const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`) as EntityElement;
255
259
  if (entityElement && entityElement.hasListeners('pointerdown')) {
256
260
  entityElement.dispatchEvent(new PointerEvent('pointerdown', event));
257
261
  break;
258
262
  }
259
- node = node.parent;
263
+ currentNode = currentNode.parent;
260
264
  }
261
265
  }
262
266
  }
package/src/asset.ts CHANGED
@@ -22,8 +22,9 @@ const extToType = new Map([
22
22
 
23
23
  /**
24
24
  * The AssetElement interface provides properties and methods for manipulating
25
- * `<pc-asset>` elements. The AssetElement interface also inherits the properties and
26
- * methods of the {@link HTMLElement} interface.
25
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
26
+ * The AssetElement interface also inherits the properties and methods of the
27
+ * {@link HTMLElement} interface.
27
28
  */
28
29
  class AssetElement extends HTMLElement {
29
30
  private _preload: boolean = false;
@@ -15,8 +15,9 @@ const tonemaps = new Map([
15
15
 
16
16
  /**
17
17
  * The CameraComponentElement interface provides properties and methods for manipulating
18
- * `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
19
- * methods of the {@link HTMLElement} interface.
18
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
19
+ * The CameraComponentElement interface also inherits the properties and methods of the
20
+ * {@link HTMLElement} interface.
20
21
  *
21
22
  * @category Components
22
23
  */
@@ -107,7 +108,7 @@ class CameraComponentElement extends ComponentElement {
107
108
  }
108
109
 
109
110
  /**
110
- * Gets the camera component.
111
+ * Gets the underlying PlayCanvas camera component.
111
112
  * @returns The camera component.
112
113
  */
113
114
  get component(): CameraComponent | null {
@@ -5,8 +5,9 @@ import { parseQuat, parseVec3 } from '../utils';
5
5
 
6
6
  /**
7
7
  * The CollisionComponentElement interface provides properties and methods for manipulating
8
- * `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
9
- * and methods of the {@link HTMLElement} interface.
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
9
+ * The CollisionComponentElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  *
11
12
  * @category Components
12
13
  */
@@ -46,7 +47,7 @@ class CollisionComponentElement extends ComponentElement {
46
47
  }
47
48
 
48
49
  /**
49
- * Gets the collision component.
50
+ * Gets the underlying PlayCanvas collision component.
50
51
  * @returns The collision component.
51
52
  */
52
53
  get component(): CollisionComponent | null {
@@ -6,8 +6,9 @@ import { parseColor, parseVec2, parseVec4 } from '../utils';
6
6
 
7
7
  /**
8
8
  * The ElementComponentElement interface provides properties and methods for manipulating
9
- * `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
10
- * methods of the {@link HTMLElement} interface.
9
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-element/ | `<pc-element>`} elements.
10
+ * The ElementComponentElement interface also inherits the properties and methods of the
11
+ * {@link HTMLElement} interface.
11
12
  *
12
13
  * @category Components
13
14
  */
@@ -60,13 +61,17 @@ class ElementComponentElement extends ComponentElement {
60
61
  }
61
62
 
62
63
  /**
63
- * Gets the element component.
64
+ * Gets the underlying PlayCanvas element component.
64
65
  * @returns The element component.
65
66
  */
66
67
  get component(): ElementComponent | null {
67
68
  return super.component as ElementComponent | null;
68
69
  }
69
70
 
71
+ /**
72
+ * Sets the anchor of the element component.
73
+ * @param value - The anchor.
74
+ */
70
75
  set anchor(value: Vec4) {
71
76
  this._anchor = value;
72
77
  if (this.component) {
@@ -74,10 +79,18 @@ class ElementComponentElement extends ComponentElement {
74
79
  }
75
80
  }
76
81
 
82
+ /**
83
+ * Gets the anchor of the element component.
84
+ * @returns The anchor.
85
+ */
77
86
  get anchor() {
78
87
  return this._anchor;
79
88
  }
80
89
 
90
+ /**
91
+ * Sets the id of the `pc-asset` to use for the font.
92
+ * @param value - The asset ID.
93
+ */
81
94
  set asset(value: string) {
82
95
  this._asset = value;
83
96
  const asset = AssetElement.get(value);
@@ -86,10 +99,18 @@ class ElementComponentElement extends ComponentElement {
86
99
  }
87
100
  }
88
101
 
102
+ /**
103
+ * Gets the id of the `pc-asset` to use for the font.
104
+ * @returns The asset ID.
105
+ */
89
106
  get asset() {
90
107
  return this._asset;
91
108
  }
92
109
 
110
+ /**
111
+ * Sets whether the element component should automatically adjust its width.
112
+ * @param value - Whether to automatically adjust the width.
113
+ */
93
114
  set autoWidth(value: boolean) {
94
115
  this._autoWidth = value;
95
116
  if (this.component) {
@@ -97,10 +118,18 @@ class ElementComponentElement extends ComponentElement {
97
118
  }
98
119
  }
99
120
 
121
+ /**
122
+ * Gets whether the element component should automatically adjust its width.
123
+ * @returns Whether to automatically adjust the width.
124
+ */
100
125
  get autoWidth() {
101
126
  return this._autoWidth;
102
127
  }
103
128
 
129
+ /**
130
+ * Sets the color of the element component.
131
+ * @param value - The color.
132
+ */
104
133
  set color(value: Color) {
105
134
  this._color = value;
106
135
  if (this.component) {
@@ -108,10 +137,18 @@ class ElementComponentElement extends ComponentElement {
108
137
  }
109
138
  }
110
139
 
140
+ /**
141
+ * Gets the color of the element component.
142
+ * @returns The color.
143
+ */
111
144
  get color() {
112
145
  return this._color;
113
146
  }
114
147
 
148
+ /**
149
+ * Sets the font size of the element component.
150
+ * @param value - The font size.
151
+ */
115
152
  set fontSize(value: number) {
116
153
  this._fontSize = value;
117
154
  if (this.component) {
@@ -119,10 +156,18 @@ class ElementComponentElement extends ComponentElement {
119
156
  }
120
157
  }
121
158
 
159
+ /**
160
+ * Gets the font size of the element component.
161
+ * @returns The font size.
162
+ */
122
163
  get fontSize() {
123
164
  return this._fontSize;
124
165
  }
125
166
 
167
+ /**
168
+ * Sets the line height of the element component.
169
+ * @param value - The line height.
170
+ */
126
171
  set lineHeight(value: number) {
127
172
  this._lineHeight = value;
128
173
  if (this.component) {
@@ -130,10 +175,18 @@ class ElementComponentElement extends ComponentElement {
130
175
  }
131
176
  }
132
177
 
178
+ /**
179
+ * Gets the line height of the element component.
180
+ * @returns The line height.
181
+ */
133
182
  get lineHeight() {
134
183
  return this._lineHeight;
135
184
  }
136
185
 
186
+ /**
187
+ * Sets the pivot of the element component.
188
+ * @param value - The pivot.
189
+ */
137
190
  set pivot(value: Vec2) {
138
191
  this._pivot = value;
139
192
  if (this.component) {
@@ -141,10 +194,18 @@ class ElementComponentElement extends ComponentElement {
141
194
  }
142
195
  }
143
196
 
197
+ /**
198
+ * Gets the pivot of the element component.
199
+ * @returns The pivot.
200
+ */
144
201
  get pivot() {
145
202
  return this._pivot;
146
203
  }
147
204
 
205
+ /**
206
+ * Sets the text of the element component.
207
+ * @param value - The text.
208
+ */
148
209
  set text(value: string) {
149
210
  this._text = value;
150
211
  if (this.component) {
@@ -152,6 +213,10 @@ class ElementComponentElement extends ComponentElement {
152
213
  }
153
214
  }
154
215
 
216
+ /**
217
+ * Gets the text of the element component.
218
+ * @returns The text.
219
+ */
155
220
  get text() {
156
221
  return this._text;
157
222
  }
@@ -175,6 +240,10 @@ class ElementComponentElement extends ComponentElement {
175
240
  return this._type;
176
241
  }
177
242
 
243
+ /**
244
+ * Sets the width of the element component.
245
+ * @param value - The width.
246
+ */
178
247
  set width(value: number) {
179
248
  this._width = value;
180
249
  if (this.component) {
@@ -182,10 +251,18 @@ class ElementComponentElement extends ComponentElement {
182
251
  }
183
252
  }
184
253
 
254
+ /**
255
+ * Gets the width of the element component.
256
+ * @returns The width.
257
+ */
185
258
  get width() {
186
259
  return this._width;
187
260
  }
188
261
 
262
+ /**
263
+ * Sets whether the element component should wrap lines.
264
+ * @param value - Whether to wrap lines.
265
+ */
189
266
  set wrapLines(value: boolean) {
190
267
  this._wrapLines = value;
191
268
  if (this.component) {
@@ -193,6 +270,10 @@ class ElementComponentElement extends ComponentElement {
193
270
  }
194
271
  }
195
272
 
273
+ /**
274
+ * Gets whether the element component should wrap lines.
275
+ * @returns Whether to wrap lines.
276
+ */
196
277
  get wrapLines() {
197
278
  return this._wrapLines;
198
279
  }
@@ -17,8 +17,9 @@ const shadowTypes = new Map([
17
17
 
18
18
  /**
19
19
  * The LightComponentElement interface provides properties and methods for manipulating
20
- * `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
21
- * methods of the {@link HTMLElement} interface.
20
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-light/ | `<pc-light>`} elements.
21
+ * The LightComponentElement interface also inherits the properties and methods of the
22
+ * {@link HTMLElement} interface.
22
23
  *
23
24
  * @category Components
24
25
  */
@@ -76,7 +77,7 @@ class LightComponentElement extends ComponentElement {
76
77
  }
77
78
 
78
79
  /**
79
- * Gets the light component.
80
+ * Gets the underlying PlayCanvas light component.
80
81
  * @returns The light component.
81
82
  */
82
83
  get component(): LightComponent | null {
@@ -4,8 +4,9 @@ import { ComponentElement } from './component';
4
4
 
5
5
  /**
6
6
  * The ListenerComponentElement interface provides properties and methods for manipulating
7
- * `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
8
- * and methods of the {@link HTMLElement} interface.
7
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
8
+ * The ListenerComponentElement interface also inherits the properties and methods of the
9
+ * {@link HTMLElement} interface.
9
10
  *
10
11
  * @category Components
11
12
  */
@@ -16,7 +17,7 @@ class ListenerComponentElement extends ComponentElement {
16
17
  }
17
18
 
18
19
  /**
19
- * Gets the audio listener component.
20
+ * Gets the underlying PlayCanvas audio listener component.
20
21
  * @returns The audio listener component.
21
22
  */
22
23
  get component(): AudioListenerComponent | null {
@@ -5,8 +5,9 @@ import { MaterialElement } from '../material';
5
5
 
6
6
  /**
7
7
  * The RenderComponentElement interface provides properties and methods for manipulating
8
- * `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
9
- * methods of the {@link HTMLElement} interface.
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-render/ | `<pc-render>`} elements.
9
+ * The RenderComponentElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  *
11
12
  * @category Components
12
13
  */
@@ -34,7 +35,7 @@ class RenderComponentElement extends ComponentElement {
34
35
  }
35
36
 
36
37
  /**
37
- * Gets the render component.
38
+ * Gets the underlying PlayCanvas render component.
38
39
  * @returns The render component.
39
40
  */
40
41
  get component(): RenderComponent | null {
@@ -5,8 +5,9 @@ import { parseVec3 } from '../utils';
5
5
 
6
6
  /**
7
7
  * The RigidBodyComponentElement interface provides properties and methods for manipulating
8
- * `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
9
- * and methods of the {@link HTMLElement} interface.
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
9
+ * The RigidBodyComponentElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  *
11
12
  * @category Components
12
13
  */
@@ -76,8 +77,8 @@ class RigidBodyComponentElement extends ComponentElement {
76
77
  }
77
78
 
78
79
  /**
79
- * Gets the collision component.
80
- * @returns The collision component.
80
+ * Gets the underlying PlayCanvas rigidbody component.
81
+ * @returns The rigidbody component.
81
82
  */
82
83
  get component(): RigidBodyComponent | null {
83
84
  return super.component as RigidBodyComponent | null;
@@ -5,8 +5,9 @@ import { parseVec2 } from '../utils';
5
5
 
6
6
  /**
7
7
  * The ScreenComponentElement interface provides properties and methods for manipulating
8
- * `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
9
- * methods of the {@link HTMLElement} interface.
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
9
+ * The ScreenComponentElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  *
11
12
  * @category Components
12
13
  */
@@ -40,7 +41,7 @@ class ScreenComponentElement extends ComponentElement {
40
41
  }
41
42
 
42
43
  /**
43
- * Gets the screen component.
44
+ * Gets the underlying PlayCanvas screen component.
44
45
  * @returns The screen component.
45
46
  */
46
47
  get component(): ScreenComponent | null {
@@ -23,8 +23,9 @@ declare global {
23
23
 
24
24
  /**
25
25
  * The ScriptComponentElement interface provides properties and methods for manipulating
26
- * `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
27
- * methods of the {@link HTMLElement} interface.
26
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
27
+ * The ScriptComponentElement interface also inherits the properties and methods of the
28
+ * {@link HTMLElement} interface.
28
29
  *
29
30
  * @category Components
30
31
  */
@@ -189,7 +190,7 @@ class ScriptComponentElement extends ComponentElement {
189
190
  }
190
191
 
191
192
  /**
192
- * Gets the script component.
193
+ * Gets the underlying PlayCanvas script component.
193
194
  * @returns The script component.
194
195
  */
195
196
  get component(): ScriptComponent | null {
@@ -4,8 +4,9 @@ import { ComponentElement } from './component';
4
4
 
5
5
  /**
6
6
  * The SoundComponentElement interface provides properties and methods for manipulating
7
- * `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
8
- * methods of the {@link HTMLElement} interface.
7
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
8
+ * The SoundComponentElement interface also inherits the properties and methods of the
9
+ * {@link HTMLElement} interface.
9
10
  *
10
11
  * @category Components
11
12
  */
@@ -42,7 +43,7 @@ class SoundComponentElement extends ComponentElement {
42
43
  }
43
44
 
44
45
  /**
45
- * Gets the sound component.
46
+ * Gets the underlying PlayCanvas sound component.
46
47
  * @returns The sound component.
47
48
  */
48
49
  get component(): SoundComponent | null {
@@ -71,7 +71,7 @@ class SoundSlotElement extends AsyncElement {
71
71
  }
72
72
 
73
73
  /**
74
- * Sets the asset of the sound slot.
74
+ * Sets the id of the `pc-asset` to use for the sound slot.
75
75
  * @param value - The asset.
76
76
  */
77
77
  set asset(value: string) {
@@ -85,7 +85,7 @@ class SoundSlotElement extends AsyncElement {
85
85
  }
86
86
 
87
87
  /**
88
- * Gets the asset of the sound slot.
88
+ * Gets the id of the `pc-asset` to use for the sound slot.
89
89
  * @returns The asset.
90
90
  */
91
91
  get asset() {
@@ -4,13 +4,14 @@ import { ComponentElement } from './component';
4
4
  import { AssetElement } from '../asset';
5
5
 
6
6
  /**
7
- * The GSplatComponentElement interface provides properties and methods for manipulating
8
- * `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
9
- * methods of the {@link HTMLElement} interface.
7
+ * The SplatComponentElement interface provides properties and methods for manipulating
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
9
+ * The SplatComponentElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  *
11
12
  * @category Components
12
13
  */
13
- class GSplatComponentElement extends ComponentElement {
14
+ class SplatComponentElement extends ComponentElement {
14
15
  private _asset: string = '';
15
16
 
16
17
  /** @ignore */
@@ -25,13 +26,17 @@ class GSplatComponentElement extends ComponentElement {
25
26
  }
26
27
 
27
28
  /**
28
- * Gets the gsplat component.
29
- * @returns The gsplat component.
29
+ * Gets the underlying PlayCanvas splat component.
30
+ * @returns The splat component.
30
31
  */
31
32
  get component(): GSplatComponent | null {
32
33
  return super.component as GSplatComponent | null;
33
34
  }
34
35
 
36
+ /**
37
+ * Sets id of the `pc-asset` to use for the splat.
38
+ * @param value - The asset ID.
39
+ */
35
40
  set asset(value: string) {
36
41
  this._asset = value;
37
42
  const asset = AssetElement.get(value);
@@ -40,6 +45,10 @@ class GSplatComponentElement extends ComponentElement {
40
45
  }
41
46
  }
42
47
 
48
+ /**
49
+ * Gets the id of the `pc-asset` to use for the splat.
50
+ * @returns The asset ID.
51
+ */
43
52
  get asset() {
44
53
  return this._asset;
45
54
  }
@@ -59,6 +68,6 @@ class GSplatComponentElement extends ComponentElement {
59
68
  }
60
69
  }
61
70
 
62
- customElements.define('pc-splat', GSplatComponentElement);
71
+ customElements.define('pc-splat', SplatComponentElement);
63
72
 
64
- export { GSplatComponentElement };
73
+ export { SplatComponentElement };
package/src/entity.ts CHANGED
@@ -5,8 +5,9 @@ import { parseVec3 } from './utils';
5
5
 
6
6
  /**
7
7
  * The EntityElement interface provides properties and methods for manipulating
8
- * `<pc-entity>` elements. The EntityElement interface also inherits the properties and
9
- * methods of the {@link HTMLElement} interface.
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
9
+ * The EntityElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  */
11
12
  class EntityElement extends AsyncElement {
12
13
  /**
package/src/index.ts CHANGED
@@ -20,7 +20,7 @@ import { CameraComponentElement } from './components/camera-component';
20
20
  import { CollisionComponentElement } from './components/collision-component';
21
21
  import { ComponentElement } from './components/component';
22
22
  import { ElementComponentElement } from './components/element-component';
23
- import { GSplatComponentElement } from './components/gsplat-component';
23
+ import { SplatComponentElement } from './components/splat-component';
24
24
  import { LightComponentElement } from './components/light-component';
25
25
  import { RenderComponentElement } from './components/render-component';
26
26
  import { RigidBodyComponentElement } from './components/rigidbody-component';
@@ -44,7 +44,7 @@ export {
44
44
  CollisionComponentElement,
45
45
  ComponentElement,
46
46
  ElementComponentElement,
47
- GSplatComponentElement,
47
+ SplatComponentElement,
48
48
  LightComponentElement,
49
49
  ListenerComponentElement,
50
50
  RenderComponentElement,
package/src/material.ts CHANGED
@@ -1,12 +1,13 @@
1
- import { Color, StandardMaterial } from 'playcanvas';
1
+ import { Color, StandardMaterial, Texture } from 'playcanvas';
2
2
 
3
3
  import { AssetElement } from './asset';
4
4
  import { parseColor } from './utils';
5
5
 
6
6
  /**
7
7
  * The MaterialElement interface provides properties and methods for manipulating
8
- * `<pc-material>` elements. The MaterialElement interface also inherits the properties and
9
- * methods of the {@link HTMLElement} interface.
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-material/ | `<pc-material>`} elements.
9
+ * The MaterialElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  */
11
12
  class MaterialElement extends HTMLElement {
12
13
  private _diffuse = new Color(1, 1, 1);
@@ -45,11 +46,11 @@ class MaterialElement extends HTMLElement {
45
46
  const asset = AssetElement.get(map);
46
47
  if (asset) {
47
48
  if (asset.loaded) {
48
- this.material[property] = asset.resource;
49
+ this.material[property] = asset.resource as Texture;
49
50
  this.material[property]!.anisotropy = 4;
50
51
  } else {
51
52
  asset.once('load', () => {
52
- this.material![property] = asset.resource;
53
+ this.material![property] = asset.resource as Texture;
53
54
  this.material![property]!.anisotropy = 4;
54
55
  this.material!.update();
55
56
  });
package/src/model.ts CHANGED
@@ -5,8 +5,9 @@ import { AsyncElement } from './async-element';
5
5
 
6
6
  /**
7
7
  * The ModelElement interface provides properties and methods for manipulating
8
- * `<pc-model>` elements. The ModelElement interface also inherits the properties and
9
- * methods of the {@link HTMLElement} interface.
8
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-model/ | `<pc-model>`} elements.
9
+ * The ModelElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
10
11
  */
11
12
  class ModelElement extends AsyncElement {
12
13
  private _asset: string = '';
@@ -59,10 +60,10 @@ class ModelElement extends AsyncElement {
59
60
  }
60
61
 
61
62
  if (asset.loaded) {
62
- this._instantiate(asset.resource);
63
+ this._instantiate(asset.resource as ContainerResource);
63
64
  } else {
64
65
  asset.once('load', () => {
65
- this._instantiate(asset.resource);
66
+ this._instantiate(asset.resource as ContainerResource);
66
67
  });
67
68
  app!.assets.load(asset);
68
69
  }
@@ -74,7 +75,7 @@ class ModelElement extends AsyncElement {
74
75
  }
75
76
 
76
77
  /**
77
- * Sets the asset ID of the model.
78
+ * Sets the id of the `pc-asset` to use for the model.
78
79
  * @param value - The asset ID.
79
80
  */
80
81
  set asset(value: string) {
@@ -85,8 +86,8 @@ class ModelElement extends AsyncElement {
85
86
  }
86
87
 
87
88
  /**
88
- * Gets the source URL of the model.
89
- * @returns The source URL of the model.
89
+ * Gets the id of the `pc-asset` to use for the model.
90
+ * @returns The asset ID.
90
91
  */
91
92
  get asset(): string {
92
93
  return this._asset;