@playcanvas/web-components 0.1.10 → 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 (56) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +33 -273
  3. package/dist/app.d.ts +4 -1
  4. package/dist/asset.d.ts +3 -2
  5. package/dist/components/camera-component.d.ts +17 -3
  6. package/dist/components/collision-component.d.ts +4 -3
  7. package/dist/components/element-component.d.ts +84 -3
  8. package/dist/components/light-component.d.ts +4 -3
  9. package/dist/components/listener-component.d.ts +4 -3
  10. package/dist/components/render-component.d.ts +4 -3
  11. package/dist/components/rigidbody-component.d.ts +5 -4
  12. package/dist/components/screen-component.d.ts +4 -3
  13. package/dist/components/script-component.d.ts +4 -3
  14. package/dist/components/sound-component.d.ts +4 -3
  15. package/dist/components/sound-slot.d.ts +2 -2
  16. package/dist/components/splat-component.d.ts +36 -0
  17. package/dist/entity.d.ts +3 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/material.d.ts +3 -2
  20. package/dist/model.d.ts +6 -5
  21. package/dist/module.d.ts +3 -2
  22. package/dist/pwc.cjs +284 -87
  23. package/dist/pwc.cjs.map +1 -1
  24. package/dist/pwc.js +284 -87
  25. package/dist/pwc.js.map +1 -1
  26. package/dist/pwc.min.js +1 -1
  27. package/dist/pwc.min.js.map +1 -1
  28. package/dist/pwc.mjs +284 -87
  29. package/dist/pwc.mjs.map +1 -1
  30. package/dist/scene.d.ts +3 -2
  31. package/dist/sky.d.ts +64 -0
  32. package/package.json +23 -23
  33. package/src/app.ts +14 -10
  34. package/src/asset.ts +3 -2
  35. package/src/components/camera-component.ts +31 -3
  36. package/src/components/collision-component.ts +4 -3
  37. package/src/components/element-component.ts +84 -3
  38. package/src/components/light-component.ts +4 -3
  39. package/src/components/listener-component.ts +4 -3
  40. package/src/components/render-component.ts +4 -3
  41. package/src/components/rigidbody-component.ts +5 -4
  42. package/src/components/screen-component.ts +4 -3
  43. package/src/components/script-component.ts +4 -3
  44. package/src/components/sound-component.ts +4 -3
  45. package/src/components/sound-slot.ts +2 -2
  46. package/src/components/{gsplat-component.ts → splat-component.ts} +17 -8
  47. package/src/entity.ts +3 -2
  48. package/src/index.ts +2 -2
  49. package/src/material.ts +6 -5
  50. package/src/model.ts +8 -7
  51. package/src/module.ts +3 -2
  52. package/src/scene.ts +3 -2
  53. package/src/sky.ts +64 -0
  54. package/dist/components/gsplat-component.d.ts +0 -27
  55. package/dist/fog.d.ts +0 -28
  56. package/src/fog.ts +0 -121
package/dist/pwc.js CHANGED
@@ -17,11 +17,11 @@
17
17
  }
18
18
  get closestApp() {
19
19
  var _a;
20
- return (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.closest('pc-app');
20
+ return (_a = this.parentElement) === null || _a === undefined ? undefined : _a.closest('pc-app');
21
21
  }
22
22
  get closestEntity() {
23
23
  var _a;
24
- return (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.closest('pc-entity');
24
+ return (_a = this.parentElement) === null || _a === undefined ? undefined : _a.closest('pc-entity');
25
25
  }
26
26
  /**
27
27
  * Called when the element is fully initialized and ready.
@@ -42,8 +42,9 @@
42
42
 
43
43
  /**
44
44
  * The ModuleElement interface provides properties and methods for manipulating
45
- * `<pc-module>` elements. The ModuleElement interface also inherits the properties and
46
- * methods of the {@link HTMLElement} interface.
45
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-module/ | `<pc-module>`} elements.
46
+ * The ModuleElement interface also inherits the properties and methods of the
47
+ * {@link HTMLElement} interface.
47
48
  */
48
49
  class ModuleElement extends HTMLElement {
49
50
  /** @ignore */
@@ -81,7 +82,10 @@
81
82
  customElements.define('pc-module', ModuleElement);
82
83
 
83
84
  /**
84
- * The main application element.
85
+ * The AppElement interface provides properties and methods for manipulating
86
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-app/ | `<pc-app>`} elements.
87
+ * The AppElement interface also inherits the properties and methods of the
88
+ * {@link HTMLElement} interface.
85
89
  */
86
90
  class AppElement extends AsyncElement {
87
91
  /**
@@ -240,13 +244,14 @@
240
244
  // Get the currently hovered entity by walking up the hierarchy
241
245
  let newHoverEntity = null;
242
246
  if (selection.length > 0) {
243
- let node = selection[0].node;
244
- while (node && !newHoverEntity) {
245
- const entityElement = this.querySelector(`pc-entity[name="${node.name}"]`);
247
+ let currentNode = selection[0].node;
248
+ while (currentNode !== null) {
249
+ const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`);
246
250
  if (entityElement) {
247
251
  newHoverEntity = entityElement;
252
+ break;
248
253
  }
249
- node = node.parent;
254
+ currentNode = currentNode.parent;
250
255
  }
251
256
  }
252
257
  // Handle enter/leave events
@@ -277,14 +282,14 @@
277
282
  this._picker.prepare(camera, this.app.scene);
278
283
  const selection = this._picker.getSelection(x, y);
279
284
  if (selection.length > 0) {
280
- let node = selection[0].node;
281
- while (node) {
282
- const entityElement = this.querySelector(`pc-entity[name="${node.name}"]`);
285
+ let currentNode = selection[0].node;
286
+ while (currentNode !== null) {
287
+ const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`);
283
288
  if (entityElement && entityElement.hasListeners('pointerdown')) {
284
289
  entityElement.dispatchEvent(new PointerEvent('pointerdown', event));
285
290
  break;
286
291
  }
287
- node = node.parent;
292
+ currentNode = currentNode.parent;
288
293
  }
289
294
  }
290
295
  }
@@ -653,8 +658,9 @@
653
658
 
654
659
  /**
655
660
  * The EntityElement interface provides properties and methods for manipulating
656
- * `<pc-entity>` elements. The EntityElement interface also inherits the properties and
657
- * methods of the {@link HTMLElement} interface.
661
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
662
+ * The EntityElement interface also inherits the properties and methods of the
663
+ * {@link HTMLElement} interface.
658
664
  */
659
665
  class EntityElement extends AsyncElement {
660
666
  constructor() {
@@ -744,7 +750,7 @@
744
750
  if (!this.entity)
745
751
  return;
746
752
  const closestEntity = this.closestEntity;
747
- if (closestEntity === null || closestEntity === void 0 ? void 0 : closestEntity.entity) {
753
+ if (closestEntity === null || closestEntity === undefined ? undefined : closestEntity.entity) {
748
754
  closestEntity.entity.addChild(this.entity);
749
755
  }
750
756
  else {
@@ -966,7 +972,7 @@
966
972
  }
967
973
  hasListeners(type) {
968
974
  var _a;
969
- return Boolean((_a = this._listeners[type]) === null || _a === void 0 ? void 0 : _a.length);
975
+ return Boolean((_a = this._listeners[type]) === null || _a === undefined ? undefined : _a.length);
970
976
  }
971
977
  }
972
978
  customElements.define('pc-entity', EntityElement);
@@ -992,8 +998,9 @@
992
998
  ]);
993
999
  /**
994
1000
  * The AssetElement interface provides properties and methods for manipulating
995
- * `<pc-asset>` elements. The AssetElement interface also inherits the properties and
996
- * methods of the {@link HTMLElement} interface.
1001
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
1002
+ * The AssetElement interface also inherits the properties and methods of the
1003
+ * {@link HTMLElement} interface.
997
1004
  */
998
1005
  class AssetElement extends HTMLElement {
999
1006
  constructor() {
@@ -1015,7 +1022,7 @@
1015
1022
  // If no type is specified, try to infer it from the file extension.
1016
1023
  if (!type) {
1017
1024
  const ext = src.split('.').pop();
1018
- type = (_a = extToType.get(ext || '')) !== null && _a !== void 0 ? _a : null;
1025
+ type = (_a = extToType.get(ext || '')) !== null && _a !== undefined ? _a : null;
1019
1026
  }
1020
1027
  if (!type) {
1021
1028
  console.warn(`Unsupported asset type: ${src}`);
@@ -1049,7 +1056,7 @@
1049
1056
  }
1050
1057
  static get(id) {
1051
1058
  const assetElement = document.querySelector(`pc-asset[id="${id}"]`);
1052
- return assetElement === null || assetElement === void 0 ? void 0 : assetElement.asset;
1059
+ return assetElement === null || assetElement === undefined ? undefined : assetElement.asset;
1053
1060
  }
1054
1061
  static get observedAttributes() {
1055
1062
  return ['preload'];
@@ -1096,7 +1103,7 @@
1096
1103
  initComponent() { }
1097
1104
  async connectedCallback() {
1098
1105
  var _a;
1099
- await ((_a = this.closestApp) === null || _a === void 0 ? void 0 : _a.ready());
1106
+ await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
1100
1107
  await this.addComponent();
1101
1108
  this.initComponent();
1102
1109
  this._onReady();
@@ -1142,8 +1149,9 @@
1142
1149
 
1143
1150
  /**
1144
1151
  * The ListenerComponentElement interface provides properties and methods for manipulating
1145
- * `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
1146
- * and methods of the {@link HTMLElement} interface.
1152
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
1153
+ * The ListenerComponentElement interface also inherits the properties and methods of the
1154
+ * {@link HTMLElement} interface.
1147
1155
  *
1148
1156
  * @category Components
1149
1157
  */
@@ -1153,7 +1161,7 @@
1153
1161
  super('audiolistener');
1154
1162
  }
1155
1163
  /**
1156
- * Gets the audio listener component.
1164
+ * Gets the underlying PlayCanvas audio listener component.
1157
1165
  * @returns The audio listener component.
1158
1166
  */
1159
1167
  get component() {
@@ -1173,8 +1181,9 @@
1173
1181
  ]);
1174
1182
  /**
1175
1183
  * The CameraComponentElement interface provides properties and methods for manipulating
1176
- * `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
1177
- * methods of the {@link HTMLElement} interface.
1184
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
1185
+ * The CameraComponentElement interface also inherits the properties and methods of the
1186
+ * {@link HTMLElement} interface.
1178
1187
  *
1179
1188
  * @category Components
1180
1189
  */
@@ -1192,6 +1201,7 @@
1192
1201
  this._fov = 45;
1193
1202
  this._frustumCulling = true;
1194
1203
  this._gamma = 'srgb';
1204
+ this._horizontalFov = false;
1195
1205
  this._nearClip = 0.1;
1196
1206
  this._orthographic = false;
1197
1207
  this._orthoHeight = 10;
@@ -1212,6 +1222,7 @@
1212
1222
  fov: this._fov,
1213
1223
  frustumCulling: this._frustumCulling,
1214
1224
  gammaCorrection: this._gamma === 'srgb' ? playcanvas.GAMMA_SRGB : playcanvas.GAMMA_NONE,
1225
+ horizontalFov: this._horizontalFov,
1215
1226
  nearClip: this._nearClip,
1216
1227
  orthographic: this._orthographic,
1217
1228
  orthoHeight: this._orthoHeight,
@@ -1223,7 +1234,7 @@
1223
1234
  }
1224
1235
  get xrAvailable() {
1225
1236
  var _a;
1226
- const xrManager = (_a = this.component) === null || _a === void 0 ? void 0 : _a.system.app.xr;
1237
+ const xrManager = (_a = this.component) === null || _a === undefined ? undefined : _a.system.app.xr;
1227
1238
  return xrManager && xrManager.supported && xrManager.isAvailable(playcanvas.XRTYPE_VR);
1228
1239
  }
1229
1240
  startXr(type, space) {
@@ -1242,7 +1253,7 @@
1242
1253
  }
1243
1254
  }
1244
1255
  /**
1245
- * Gets the camera component.
1256
+ * Gets the underlying PlayCanvas camera component.
1246
1257
  * @returns The camera component.
1247
1258
  */
1248
1259
  get component() {
@@ -1418,6 +1429,24 @@
1418
1429
  get gamma() {
1419
1430
  return this._gamma;
1420
1431
  }
1432
+ /**
1433
+ * Sets whether the camera's field of view (fov) is horizontal or vertical. Defaults to false
1434
+ * (meaning it is vertical be default).
1435
+ * @param value - Whether the camera's field of view is horizontal.
1436
+ */
1437
+ set horizontalFov(value) {
1438
+ this._horizontalFov = value;
1439
+ if (this.component) {
1440
+ this.component.horizontalFov = value;
1441
+ }
1442
+ }
1443
+ /**
1444
+ * Gets whether the camera's field of view (fov) is horizontal or vertical.
1445
+ * @returns Whether the camera's field of view is horizontal.
1446
+ */
1447
+ get horizontalFov() {
1448
+ return this._horizontalFov;
1449
+ }
1421
1450
  /**
1422
1451
  * Sets the near clip distance of the camera.
1423
1452
  * @param value - The near clip distance.
@@ -1528,7 +1557,7 @@
1528
1557
  var _a;
1529
1558
  this._tonemap = value;
1530
1559
  if (this.component) {
1531
- this.component.toneMapping = (_a = tonemaps.get(value)) !== null && _a !== void 0 ? _a : playcanvas.TONEMAP_NONE;
1560
+ this.component.toneMapping = (_a = tonemaps.get(value)) !== null && _a !== undefined ? _a : playcanvas.TONEMAP_NONE;
1532
1561
  }
1533
1562
  }
1534
1563
  /**
@@ -1551,6 +1580,7 @@
1551
1580
  'fov',
1552
1581
  'frustum-culling',
1553
1582
  'gamma',
1583
+ 'horizontal-fov',
1554
1584
  'near-clip',
1555
1585
  'orthographic',
1556
1586
  'ortho-height',
@@ -1593,6 +1623,9 @@
1593
1623
  case 'gamma':
1594
1624
  this.gamma = newValue;
1595
1625
  break;
1626
+ case 'horizontal-fov':
1627
+ this.horizontalFov = this.hasAttribute('horizontal-fov');
1628
+ break;
1596
1629
  case 'near-clip':
1597
1630
  this.nearClip = parseFloat(newValue);
1598
1631
  break;
@@ -1621,8 +1654,9 @@
1621
1654
 
1622
1655
  /**
1623
1656
  * The CollisionComponentElement interface provides properties and methods for manipulating
1624
- * `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
1625
- * and methods of the {@link HTMLElement} interface.
1657
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
1658
+ * The CollisionComponentElement interface also inherits the properties and methods of the
1659
+ * {@link HTMLElement} interface.
1626
1660
  *
1627
1661
  * @category Components
1628
1662
  */
@@ -1652,7 +1686,7 @@
1652
1686
  };
1653
1687
  }
1654
1688
  /**
1655
- * Gets the collision component.
1689
+ * Gets the underlying PlayCanvas collision component.
1656
1690
  * @returns The collision component.
1657
1691
  */
1658
1692
  get component() {
@@ -1767,8 +1801,9 @@
1767
1801
 
1768
1802
  /**
1769
1803
  * The ElementComponentElement interface provides properties and methods for manipulating
1770
- * `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
1771
- * methods of the {@link HTMLElement} interface.
1804
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-element/ | `<pc-element>`} elements.
1805
+ * The ElementComponentElement interface also inherits the properties and methods of the
1806
+ * {@link HTMLElement} interface.
1772
1807
  *
1773
1808
  * @category Components
1774
1809
  */
@@ -1807,21 +1842,33 @@
1807
1842
  };
1808
1843
  }
1809
1844
  /**
1810
- * Gets the element component.
1845
+ * Gets the underlying PlayCanvas element component.
1811
1846
  * @returns The element component.
1812
1847
  */
1813
1848
  get component() {
1814
1849
  return super.component;
1815
1850
  }
1851
+ /**
1852
+ * Sets the anchor of the element component.
1853
+ * @param value - The anchor.
1854
+ */
1816
1855
  set anchor(value) {
1817
1856
  this._anchor = value;
1818
1857
  if (this.component) {
1819
1858
  this.component.anchor = value;
1820
1859
  }
1821
1860
  }
1861
+ /**
1862
+ * Gets the anchor of the element component.
1863
+ * @returns The anchor.
1864
+ */
1822
1865
  get anchor() {
1823
1866
  return this._anchor;
1824
1867
  }
1868
+ /**
1869
+ * Sets the id of the `pc-asset` to use for the font.
1870
+ * @param value - The asset ID.
1871
+ */
1825
1872
  set asset(value) {
1826
1873
  this._asset = value;
1827
1874
  const asset = AssetElement.get(value);
@@ -1829,60 +1876,112 @@
1829
1876
  this.component.fontAsset = asset.id;
1830
1877
  }
1831
1878
  }
1879
+ /**
1880
+ * Gets the id of the `pc-asset` to use for the font.
1881
+ * @returns The asset ID.
1882
+ */
1832
1883
  get asset() {
1833
1884
  return this._asset;
1834
1885
  }
1886
+ /**
1887
+ * Sets whether the element component should automatically adjust its width.
1888
+ * @param value - Whether to automatically adjust the width.
1889
+ */
1835
1890
  set autoWidth(value) {
1836
1891
  this._autoWidth = value;
1837
1892
  if (this.component) {
1838
1893
  this.component.autoWidth = value;
1839
1894
  }
1840
1895
  }
1896
+ /**
1897
+ * Gets whether the element component should automatically adjust its width.
1898
+ * @returns Whether to automatically adjust the width.
1899
+ */
1841
1900
  get autoWidth() {
1842
1901
  return this._autoWidth;
1843
1902
  }
1903
+ /**
1904
+ * Sets the color of the element component.
1905
+ * @param value - The color.
1906
+ */
1844
1907
  set color(value) {
1845
1908
  this._color = value;
1846
1909
  if (this.component) {
1847
1910
  this.component.color = value;
1848
1911
  }
1849
1912
  }
1913
+ /**
1914
+ * Gets the color of the element component.
1915
+ * @returns The color.
1916
+ */
1850
1917
  get color() {
1851
1918
  return this._color;
1852
1919
  }
1920
+ /**
1921
+ * Sets the font size of the element component.
1922
+ * @param value - The font size.
1923
+ */
1853
1924
  set fontSize(value) {
1854
1925
  this._fontSize = value;
1855
1926
  if (this.component) {
1856
1927
  this.component.fontSize = value;
1857
1928
  }
1858
1929
  }
1930
+ /**
1931
+ * Gets the font size of the element component.
1932
+ * @returns The font size.
1933
+ */
1859
1934
  get fontSize() {
1860
1935
  return this._fontSize;
1861
1936
  }
1937
+ /**
1938
+ * Sets the line height of the element component.
1939
+ * @param value - The line height.
1940
+ */
1862
1941
  set lineHeight(value) {
1863
1942
  this._lineHeight = value;
1864
1943
  if (this.component) {
1865
1944
  this.component.lineHeight = value;
1866
1945
  }
1867
1946
  }
1947
+ /**
1948
+ * Gets the line height of the element component.
1949
+ * @returns The line height.
1950
+ */
1868
1951
  get lineHeight() {
1869
1952
  return this._lineHeight;
1870
1953
  }
1954
+ /**
1955
+ * Sets the pivot of the element component.
1956
+ * @param value - The pivot.
1957
+ */
1871
1958
  set pivot(value) {
1872
1959
  this._pivot = value;
1873
1960
  if (this.component) {
1874
1961
  this.component.pivot = value;
1875
1962
  }
1876
1963
  }
1964
+ /**
1965
+ * Gets the pivot of the element component.
1966
+ * @returns The pivot.
1967
+ */
1877
1968
  get pivot() {
1878
1969
  return this._pivot;
1879
1970
  }
1971
+ /**
1972
+ * Sets the text of the element component.
1973
+ * @param value - The text.
1974
+ */
1880
1975
  set text(value) {
1881
1976
  this._text = value;
1882
1977
  if (this.component) {
1883
1978
  this.component.text = value;
1884
1979
  }
1885
1980
  }
1981
+ /**
1982
+ * Gets the text of the element component.
1983
+ * @returns The text.
1984
+ */
1886
1985
  get text() {
1887
1986
  return this._text;
1888
1987
  }
@@ -1903,21 +2002,37 @@
1903
2002
  get type() {
1904
2003
  return this._type;
1905
2004
  }
2005
+ /**
2006
+ * Sets the width of the element component.
2007
+ * @param value - The width.
2008
+ */
1906
2009
  set width(value) {
1907
2010
  this._width = value;
1908
2011
  if (this.component) {
1909
2012
  this.component.width = value;
1910
2013
  }
1911
2014
  }
2015
+ /**
2016
+ * Gets the width of the element component.
2017
+ * @returns The width.
2018
+ */
1912
2019
  get width() {
1913
2020
  return this._width;
1914
2021
  }
2022
+ /**
2023
+ * Sets whether the element component should wrap lines.
2024
+ * @param value - Whether to wrap lines.
2025
+ */
1915
2026
  set wrapLines(value) {
1916
2027
  this._wrapLines = value;
1917
2028
  if (this.component) {
1918
2029
  this.component.wrapLines = value;
1919
2030
  }
1920
2031
  }
2032
+ /**
2033
+ * Gets whether the element component should wrap lines.
2034
+ * @returns Whether to wrap lines.
2035
+ */
1921
2036
  get wrapLines() {
1922
2037
  return this._wrapLines;
1923
2038
  }
@@ -1979,13 +2094,14 @@
1979
2094
  customElements.define('pc-element', ElementComponentElement);
1980
2095
 
1981
2096
  /**
1982
- * The GSplatComponentElement interface provides properties and methods for manipulating
1983
- * `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
1984
- * methods of the {@link HTMLElement} interface.
2097
+ * The SplatComponentElement interface provides properties and methods for manipulating
2098
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
2099
+ * The SplatComponentElement interface also inherits the properties and methods of the
2100
+ * {@link HTMLElement} interface.
1985
2101
  *
1986
2102
  * @category Components
1987
2103
  */
1988
- class GSplatComponentElement extends ComponentElement {
2104
+ class SplatComponentElement extends ComponentElement {
1989
2105
  /** @ignore */
1990
2106
  constructor() {
1991
2107
  super('gsplat');
@@ -1997,12 +2113,16 @@
1997
2113
  };
1998
2114
  }
1999
2115
  /**
2000
- * Gets the gsplat component.
2001
- * @returns The gsplat component.
2116
+ * Gets the underlying PlayCanvas splat component.
2117
+ * @returns The splat component.
2002
2118
  */
2003
2119
  get component() {
2004
2120
  return super.component;
2005
2121
  }
2122
+ /**
2123
+ * Sets id of the `pc-asset` to use for the splat.
2124
+ * @param value - The asset ID.
2125
+ */
2006
2126
  set asset(value) {
2007
2127
  this._asset = value;
2008
2128
  const asset = AssetElement.get(value);
@@ -2010,6 +2130,10 @@
2010
2130
  this.component.asset = asset;
2011
2131
  }
2012
2132
  }
2133
+ /**
2134
+ * Gets the id of the `pc-asset` to use for the splat.
2135
+ * @returns The asset ID.
2136
+ */
2013
2137
  get asset() {
2014
2138
  return this._asset;
2015
2139
  }
@@ -2025,7 +2149,7 @@
2025
2149
  }
2026
2150
  }
2027
2151
  }
2028
- customElements.define('pc-splat', GSplatComponentElement);
2152
+ customElements.define('pc-splat', SplatComponentElement);
2029
2153
 
2030
2154
  const shadowTypes = new Map([
2031
2155
  ['pcf1-16f', playcanvas.SHADOW_PCF1_16F],
@@ -2040,8 +2164,9 @@
2040
2164
  ]);
2041
2165
  /**
2042
2166
  * The LightComponentElement interface provides properties and methods for manipulating
2043
- * `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
2044
- * methods of the {@link HTMLElement} interface.
2167
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-light/ | `<pc-light>`} elements.
2168
+ * The LightComponentElement interface also inherits the properties and methods of the
2169
+ * {@link HTMLElement} interface.
2045
2170
  *
2046
2171
  * @category Components
2047
2172
  */
@@ -2083,7 +2208,7 @@
2083
2208
  };
2084
2209
  }
2085
2210
  /**
2086
- * Gets the light component.
2211
+ * Gets the underlying PlayCanvas light component.
2087
2212
  * @returns The light component.
2088
2213
  */
2089
2214
  get component() {
@@ -2294,7 +2419,7 @@
2294
2419
  var _a;
2295
2420
  this._shadowType = value;
2296
2421
  if (this.component) {
2297
- this.component.shadowType = (_a = shadowTypes.get(value)) !== null && _a !== void 0 ? _a : playcanvas.SHADOW_PCF3_32F;
2422
+ this.component.shadowType = (_a = shadowTypes.get(value)) !== null && _a !== undefined ? _a : playcanvas.SHADOW_PCF3_32F;
2298
2423
  }
2299
2424
  }
2300
2425
  /**
@@ -2413,8 +2538,9 @@
2413
2538
 
2414
2539
  /**
2415
2540
  * The MaterialElement interface provides properties and methods for manipulating
2416
- * `<pc-material>` elements. The MaterialElement interface also inherits the properties and
2417
- * methods of the {@link HTMLElement} interface.
2541
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-material/ | `<pc-material>`} elements.
2542
+ * The MaterialElement interface also inherits the properties and methods of the
2543
+ * {@link HTMLElement} interface.
2418
2544
  */
2419
2545
  class MaterialElement extends HTMLElement {
2420
2546
  constructor() {
@@ -2500,7 +2626,7 @@
2500
2626
  }
2501
2627
  static get(id) {
2502
2628
  const materialElement = document.querySelector(`pc-material[id="${id}"]`);
2503
- return materialElement === null || materialElement === void 0 ? void 0 : materialElement.material;
2629
+ return materialElement === null || materialElement === undefined ? undefined : materialElement.material;
2504
2630
  }
2505
2631
  static get observedAttributes() {
2506
2632
  return ['diffuse', 'diffuse-map', 'metalness-map', 'normal-map', 'roughness-map'];
@@ -2529,8 +2655,9 @@
2529
2655
 
2530
2656
  /**
2531
2657
  * The RenderComponentElement interface provides properties and methods for manipulating
2532
- * `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
2533
- * methods of the {@link HTMLElement} interface.
2658
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-render/ | `<pc-render>`} elements.
2659
+ * The RenderComponentElement interface also inherits the properties and methods of the
2660
+ * {@link HTMLElement} interface.
2534
2661
  *
2535
2662
  * @category Components
2536
2663
  */
@@ -2552,7 +2679,7 @@
2552
2679
  };
2553
2680
  }
2554
2681
  /**
2555
- * Gets the render component.
2682
+ * Gets the underlying PlayCanvas render component.
2556
2683
  * @returns The render component.
2557
2684
  */
2558
2685
  get component() {
@@ -2651,8 +2778,9 @@
2651
2778
 
2652
2779
  /**
2653
2780
  * The RigidBodyComponentElement interface provides properties and methods for manipulating
2654
- * `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
2655
- * and methods of the {@link HTMLElement} interface.
2781
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
2782
+ * The RigidBodyComponentElement interface also inherits the properties and methods of the
2783
+ * {@link HTMLElement} interface.
2656
2784
  *
2657
2785
  * @category Components
2658
2786
  */
@@ -2711,8 +2839,8 @@
2711
2839
  };
2712
2840
  }
2713
2841
  /**
2714
- * Gets the collision component.
2715
- * @returns The collision component.
2842
+ * Gets the underlying PlayCanvas rigidbody component.
2843
+ * @returns The rigidbody component.
2716
2844
  */
2717
2845
  get component() {
2718
2846
  return super.component;
@@ -2838,8 +2966,9 @@
2838
2966
 
2839
2967
  /**
2840
2968
  * The ScreenComponentElement interface provides properties and methods for manipulating
2841
- * `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
2842
- * methods of the {@link HTMLElement} interface.
2969
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
2970
+ * The ScreenComponentElement interface also inherits the properties and methods of the
2971
+ * {@link HTMLElement} interface.
2843
2972
  *
2844
2973
  * @category Components
2845
2974
  */
@@ -2865,7 +2994,7 @@
2865
2994
  };
2866
2995
  }
2867
2996
  /**
2868
- * Gets the screen component.
2997
+ * Gets the underlying PlayCanvas screen component.
2869
2998
  * @returns The screen component.
2870
2999
  */
2871
3000
  get component() {
@@ -2964,8 +3093,9 @@
2964
3093
 
2965
3094
  /**
2966
3095
  * The ScriptComponentElement interface provides properties and methods for manipulating
2967
- * `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
2968
- * methods of the {@link HTMLElement} interface.
3096
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
3097
+ * The ScriptComponentElement interface also inherits the properties and methods of the
3098
+ * {@link HTMLElement} interface.
2969
3099
  *
2970
3100
  * @category Components
2971
3101
  */
@@ -3112,10 +3242,10 @@
3112
3242
  disconnectedCallback() {
3113
3243
  var _a;
3114
3244
  this.observer.disconnect();
3115
- (_a = super.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
3245
+ (_a = super.disconnectedCallback) === null || _a === undefined ? undefined : _a.call(this);
3116
3246
  }
3117
3247
  /**
3118
- * Gets the script component.
3248
+ * Gets the underlying PlayCanvas script component.
3119
3249
  * @returns The script component.
3120
3250
  */
3121
3251
  get component() {
@@ -3207,8 +3337,9 @@
3207
3337
 
3208
3338
  /**
3209
3339
  * The SoundComponentElement interface provides properties and methods for manipulating
3210
- * `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
3211
- * methods of the {@link HTMLElement} interface.
3340
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
3341
+ * The SoundComponentElement interface also inherits the properties and methods of the
3342
+ * {@link HTMLElement} interface.
3212
3343
  *
3213
3344
  * @category Components
3214
3345
  */
@@ -3236,7 +3367,7 @@
3236
3367
  };
3237
3368
  }
3238
3369
  /**
3239
- * Gets the sound component.
3370
+ * Gets the underlying PlayCanvas sound component.
3240
3371
  * @returns The sound component.
3241
3372
  */
3242
3373
  get component() {
@@ -3426,7 +3557,7 @@
3426
3557
  }
3427
3558
  async connectedCallback() {
3428
3559
  var _a;
3429
- await ((_a = this.soundElement) === null || _a === void 0 ? void 0 : _a.ready());
3560
+ await ((_a = this.soundElement) === null || _a === undefined ? undefined : _a.ready());
3430
3561
  const options = {
3431
3562
  autoPlay: this._autoPlay,
3432
3563
  loop: this._loop,
@@ -3455,21 +3586,21 @@
3455
3586
  return soundElement;
3456
3587
  }
3457
3588
  /**
3458
- * Sets the asset of the sound slot.
3589
+ * Sets the id of the `pc-asset` to use for the sound slot.
3459
3590
  * @param value - The asset.
3460
3591
  */
3461
3592
  set asset(value) {
3462
3593
  var _a;
3463
3594
  this._asset = value;
3464
3595
  if (this.soundSlot) {
3465
- const id = (_a = AssetElement.get(value)) === null || _a === void 0 ? void 0 : _a.id;
3596
+ const id = (_a = AssetElement.get(value)) === null || _a === undefined ? undefined : _a.id;
3466
3597
  if (id) {
3467
3598
  this.soundSlot.asset = id;
3468
3599
  }
3469
3600
  }
3470
3601
  }
3471
3602
  /**
3472
- * Gets the asset of the sound slot.
3603
+ * Gets the id of the `pc-asset` to use for the sound slot.
3473
3604
  * @returns The asset.
3474
3605
  */
3475
3606
  get asset() {
@@ -3647,8 +3778,9 @@
3647
3778
 
3648
3779
  /**
3649
3780
  * The ModelElement interface provides properties and methods for manipulating
3650
- * `<pc-model>` elements. The ModelElement interface also inherits the properties and
3651
- * methods of the {@link HTMLElement} interface.
3781
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-model/ | `<pc-model>`} elements.
3782
+ * The ModelElement interface also inherits the properties and methods of the
3783
+ * {@link HTMLElement} interface.
3652
3784
  */
3653
3785
  class ModelElement extends AsyncElement {
3654
3786
  constructor() {
@@ -3689,8 +3821,8 @@
3689
3821
  async _loadModel() {
3690
3822
  var _a;
3691
3823
  this._unloadModel();
3692
- const appElement = await ((_a = this.closestApp) === null || _a === void 0 ? void 0 : _a.ready());
3693
- const app = appElement === null || appElement === void 0 ? void 0 : appElement.app;
3824
+ const appElement = await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
3825
+ const app = appElement === null || appElement === undefined ? undefined : appElement.app;
3694
3826
  const asset = AssetElement.get(this._asset);
3695
3827
  if (!asset) {
3696
3828
  return;
@@ -3707,11 +3839,11 @@
3707
3839
  }
3708
3840
  _unloadModel() {
3709
3841
  var _a;
3710
- (_a = this._entity) === null || _a === void 0 ? void 0 : _a.destroy();
3842
+ (_a = this._entity) === null || _a === undefined ? undefined : _a.destroy();
3711
3843
  this._entity = null;
3712
3844
  }
3713
3845
  /**
3714
- * Sets the asset ID of the model.
3846
+ * Sets the id of the `pc-asset` to use for the model.
3715
3847
  * @param value - The asset ID.
3716
3848
  */
3717
3849
  set asset(value) {
@@ -3721,8 +3853,8 @@
3721
3853
  }
3722
3854
  }
3723
3855
  /**
3724
- * Gets the source URL of the model.
3725
- * @returns The source URL of the model.
3856
+ * Gets the id of the `pc-asset` to use for the model.
3857
+ * @returns The asset ID.
3726
3858
  */
3727
3859
  get asset() {
3728
3860
  return this._asset;
@@ -3742,8 +3874,9 @@
3742
3874
 
3743
3875
  /**
3744
3876
  * The SceneElement interface provides properties and methods for manipulating
3745
- * `<pc-scene>` elements. The SceneElement interface also inherits the properties and
3746
- * methods of the {@link HTMLElement} interface.
3877
+ * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
3878
+ * The SceneElement interface also inherits the properties and methods of the
3879
+ * {@link HTMLElement} interface.
3747
3880
  */
3748
3881
  class SceneElement extends AsyncElement {
3749
3882
  constructor() {
@@ -3775,7 +3908,7 @@
3775
3908
  }
3776
3909
  async connectedCallback() {
3777
3910
  var _a;
3778
- await ((_a = this.closestApp) === null || _a === void 0 ? void 0 : _a.ready());
3911
+ await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
3779
3912
  this.scene = this.closestApp.app.scene;
3780
3913
  this.updateSceneSettings();
3781
3914
  this._onReady();
@@ -3949,8 +4082,8 @@
3949
4082
  }
3950
4083
  async _loadSkybox() {
3951
4084
  var _a;
3952
- const appElement = await ((_a = this.closestApp) === null || _a === void 0 ? void 0 : _a.ready());
3953
- const app = appElement === null || appElement === void 0 ? void 0 : appElement.app;
4085
+ const appElement = await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
4086
+ const app = appElement === null || appElement === undefined ? undefined : appElement.app;
3954
4087
  if (!app) {
3955
4088
  return;
3956
4089
  }
@@ -3973,74 +4106,134 @@
3973
4106
  var _a, _b;
3974
4107
  if (!this._scene)
3975
4108
  return;
3976
- (_a = this._scene.skybox) === null || _a === void 0 ? void 0 : _a.destroy();
4109
+ (_a = this._scene.skybox) === null || _a === undefined ? undefined : _a.destroy();
3977
4110
  // @ts-ignore
3978
4111
  this._scene.skybox = null;
3979
- (_b = this._scene.envAtlas) === null || _b === void 0 ? void 0 : _b.destroy();
4112
+ (_b = this._scene.envAtlas) === null || _b === undefined ? undefined : _b.destroy();
3980
4113
  // @ts-ignore
3981
4114
  this._scene.envAtlas = null;
3982
4115
  this._scene = null;
3983
4116
  }
4117
+ /**
4118
+ * Sets the id of the `pc-asset` to use for the skybox.
4119
+ * @param value - The asset ID.
4120
+ */
3984
4121
  set asset(value) {
3985
4122
  this._asset = value;
3986
4123
  if (this.isConnected) {
3987
4124
  this._loadSkybox();
3988
4125
  }
3989
4126
  }
4127
+ /**
4128
+ * Gets the id of the `pc-asset` to use for the skybox.
4129
+ * @returns The asset ID.
4130
+ */
3990
4131
  get asset() {
3991
4132
  return this._asset;
3992
4133
  }
4134
+ /**
4135
+ * Sets the center of the skybox.
4136
+ * @param value - The center.
4137
+ */
3993
4138
  set center(value) {
3994
4139
  this._center = value;
3995
4140
  if (this._scene) {
3996
4141
  this._scene.sky.center = this._center;
3997
4142
  }
3998
4143
  }
4144
+ /**
4145
+ * Gets the center of the skybox.
4146
+ * @returns The center.
4147
+ */
3999
4148
  get center() {
4000
4149
  return this._center;
4001
4150
  }
4151
+ /**
4152
+ * Sets the intensity of the skybox.
4153
+ * @param value - The intensity.
4154
+ */
4002
4155
  set intensity(value) {
4003
4156
  this._intensity = value;
4004
4157
  if (this._scene) {
4005
4158
  this._scene.skyboxIntensity = this._intensity;
4006
4159
  }
4007
4160
  }
4161
+ /**
4162
+ * Gets the intensity of the skybox.
4163
+ * @returns The intensity.
4164
+ */
4008
4165
  get intensity() {
4009
4166
  return this._intensity;
4010
4167
  }
4168
+ /**
4169
+ * Sets the mip level of the skybox.
4170
+ * @param value - The mip level.
4171
+ */
4011
4172
  set level(value) {
4012
4173
  this._level = value;
4013
4174
  if (this._scene) {
4014
4175
  this._scene.skyboxMip = this._level;
4015
4176
  }
4016
4177
  }
4178
+ /**
4179
+ * Gets the mip level of the skybox.
4180
+ * @returns The mip level.
4181
+ */
4017
4182
  get level() {
4018
4183
  return this._level;
4019
4184
  }
4185
+ /**
4186
+ * Sets whether the skybox is used as a light source.
4187
+ * @param value - Whether to use lighting.
4188
+ */
4020
4189
  set lighting(value) {
4021
4190
  this._lighting = value;
4022
4191
  }
4192
+ /**
4193
+ * Gets whether the skybox is used as a light source.
4194
+ * @returns Whether to use lighting.
4195
+ */
4023
4196
  get lighting() {
4024
4197
  return this._lighting;
4025
4198
  }
4199
+ /**
4200
+ * Sets the Euler rotation of the skybox.
4201
+ * @param value - The rotation.
4202
+ */
4026
4203
  set rotation(value) {
4027
4204
  this._rotation = value;
4028
4205
  if (this._scene) {
4029
4206
  this._scene.skyboxRotation = new playcanvas.Quat().setFromEulerAngles(value);
4030
4207
  }
4031
4208
  }
4209
+ /**
4210
+ * Gets the Euler rotation of the skybox.
4211
+ * @returns The rotation.
4212
+ */
4032
4213
  get rotation() {
4033
4214
  return this._rotation;
4034
4215
  }
4216
+ /**
4217
+ * Sets the scale of the skybox.
4218
+ * @param value - The scale.
4219
+ */
4035
4220
  set scale(value) {
4036
4221
  this._scale = value;
4037
4222
  if (this._scene) {
4038
4223
  this._scene.sky.node.setLocalScale(this._scale);
4039
4224
  }
4040
4225
  }
4226
+ /**
4227
+ * Gets the scale of the skybox.
4228
+ * @returns The scale.
4229
+ */
4041
4230
  get scale() {
4042
4231
  return this._scale;
4043
4232
  }
4233
+ /**
4234
+ * Sets the type of the skybox.
4235
+ * @param value - The type.
4236
+ */
4044
4237
  set type(value) {
4045
4238
  this._type = value;
4046
4239
  if (this._scene) {
@@ -4051,6 +4244,10 @@
4051
4244
  }
4052
4245
  }
4053
4246
  }
4247
+ /**
4248
+ * Gets the type of the skybox.
4249
+ * @returns The type.
4250
+ */
4054
4251
  get type() {
4055
4252
  return this._type;
4056
4253
  }
@@ -4096,7 +4293,6 @@
4096
4293
  exports.ComponentElement = ComponentElement;
4097
4294
  exports.ElementComponentElement = ElementComponentElement;
4098
4295
  exports.EntityElement = EntityElement;
4099
- exports.GSplatComponentElement = GSplatComponentElement;
4100
4296
  exports.LightComponentElement = LightComponentElement;
4101
4297
  exports.ListenerComponentElement = ListenerComponentElement;
4102
4298
  exports.MaterialElement = MaterialElement;
@@ -4111,6 +4307,7 @@
4111
4307
  exports.SkyElement = SkyElement;
4112
4308
  exports.SoundComponentElement = SoundComponentElement;
4113
4309
  exports.SoundSlotElement = SoundSlotElement;
4310
+ exports.SplatComponentElement = SplatComponentElement;
4114
4311
 
4115
4312
  }));
4116
4313
  //# sourceMappingURL=pwc.js.map