@playcanvas/web-components 0.10.0 → 0.11.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.
package/dist/scene.d.ts CHANGED
@@ -33,13 +33,21 @@ declare class SceneElement extends AsyncElement {
33
33
  private _gravity;
34
34
  private _scene;
35
35
  /**
36
- * The PlayCanvas scene instance. Available once the element is ready — await
36
+ * The PlayCanvas scene instance. `null` until the element is ready — await
37
37
  * {@link whenReady} or the element's `ready()` promise before accessing it.
38
- * @returns The scene instance.
38
+ * @returns The scene instance, or `null`.
39
39
  */
40
- get scene(): Scene;
40
+ get scene(): Scene | null;
41
41
  connectedCallback(): Promise<void>;
42
42
  updateSceneSettings(): void;
43
+ /**
44
+ * Applies gravity to the rigid body system. Resolved through `closestApp` rather than
45
+ * `parentElement` so that a `<pc-scene>` nested inside a wrapper element behaves the same as
46
+ * a direct child, matching how `connectedCallback` resolves the application.
47
+ *
48
+ * @param value - The gravity to apply.
49
+ */
50
+ private _applyGravity;
43
51
  /**
44
52
  * Sets the fog type of the scene. Can be `none`, `linear`, `exp` or `exp2`. Defaults to
45
53
  * `none`.
package/dist/sky.d.ts CHANGED
@@ -10,7 +10,7 @@ declare class SkyElement extends AsyncElement {
10
10
  private _center;
11
11
  private _intensity;
12
12
  private _rotation;
13
- private _level;
13
+ private _mipLevel;
14
14
  private _lighting;
15
15
  private _scale;
16
16
  private _type;
@@ -51,16 +51,6 @@ declare class SkyElement extends AsyncElement {
51
51
  * @returns The intensity.
52
52
  */
53
53
  get intensity(): number;
54
- /**
55
- * Sets the mip level of the skybox.
56
- * @param value - The mip level.
57
- */
58
- set level(value: number);
59
- /**
60
- * Gets the mip level of the skybox.
61
- * @returns The mip level.
62
- */
63
- get level(): number;
64
54
  /**
65
55
  * Sets whether the skybox is used as a light source.
66
56
  * @param value - Whether to use lighting.
@@ -71,6 +61,17 @@ declare class SkyElement extends AsyncElement {
71
61
  * @returns Whether to use lighting.
72
62
  */
73
63
  get lighting(): boolean;
64
+ /**
65
+ * Sets the mip level of the skybox, where 0 is the sharpest. Raising it selects a blurrier mip,
66
+ * which is how a skybox is softened without blurring the texture itself.
67
+ * @param value - The mip level.
68
+ */
69
+ set mipLevel(value: number);
70
+ /**
71
+ * Gets the mip level of the skybox.
72
+ * @returns The mip level.
73
+ */
74
+ get mipLevel(): number;
74
75
  /**
75
76
  * Sets the Euler rotation of the skybox.
76
77
  * @param value - The rotation.
@@ -4,12 +4,16 @@
4
4
  "tags": [
5
5
  {
6
6
  "name": "pc-app",
7
- "description": "The AppElement interface provides properties and methods for manipulating\n[`<pc-app>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/) elements.\nThe AppElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **ready** - Fired once the element is fully initialized. Bubbles and is composed.\n\n### **Methods:**\n \n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.",
7
+ "description": "The AppElement interface provides properties and methods for manipulating\n[`<pc-app>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/) elements.\nThe AppElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **progress** - Fired while the application preloads its assets. `loaded` and `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded. Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does not bubble.\n- **ready** - Fired once the element is fully initialized. Bubbles and is composed.\n\n### **Methods:**\n - **elementFromEntity(entity: _Entity_): __** - Returns the `<pc-entity>` element whose backing entity is `entity`, or `null` if the\nentity was not created by an element of this application - for example, a node inside a\nmodel's instantiated hierarchy, or an entity created through the engine API.\n\n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.",
8
8
  "attributes": [
9
- { "name": "alpha", "description": "The alpha flag.", "values": [] },
9
+ {
10
+ "name": "alpha",
11
+ "description": "Whether the frame buffer has an alpha channel.",
12
+ "values": []
13
+ },
10
14
  {
11
15
  "name": "antialias",
12
- "description": "The antialias flag.",
16
+ "description": "Whether the frame buffer is anti-aliased.",
13
17
  "values": []
14
18
  },
15
19
  {
@@ -21,19 +25,32 @@
21
25
  { "name": "null" }
22
26
  ]
23
27
  },
24
- { "name": "depth", "description": "The depth flag.", "values": [] },
25
28
  {
26
- "name": "high-resolution",
27
- "description": "The high resolution flag.",
29
+ "name": "depth-buffer",
30
+ "description": "Whether the frame buffer has a depth buffer.",
31
+ "values": []
32
+ },
33
+ {
34
+ "name": "loading-bar",
35
+ "description": "Whether the application shows its built-in loading bar while it boots and preloads its assets.",
36
+ "values": []
37
+ },
38
+ {
39
+ "name": "max-pixel-ratio",
40
+ "description": "The cap on the pixel ratio the application renders at.",
28
41
  "values": []
29
42
  },
30
- { "name": "stencil", "description": "The stencil flag.", "values": [] }
43
+ {
44
+ "name": "stencil-buffer",
45
+ "description": "Whether the frame buffer has a stencil buffer.",
46
+ "values": []
47
+ }
31
48
  ],
32
49
  "references": []
33
50
  },
34
51
  {
35
52
  "name": "pc-asset",
36
- "description": "The AssetElement interface provides properties and methods for manipulating\n[`<pc-asset>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/) elements.\nThe AssetElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element becomes ready once the containing application has started and the asset is in the\nstate declared by the markup: loaded for preloaded assets (even if loading failed — check the\nasset's `resource`), or registered and awaiting a load for `lazy` assets. Elements inserted\nwhile the application is running are created and registered on insertion, and begin loading\nimmediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed\nelsewhere, or with an unsupported asset type, never become ready.\n\nApart from `lazy`, these attributes are read once when the asset is created, so changing them\nlater has no effect.\n\n---\n\n\n### **Events:**\n - **ready** - Fired once the element is fully initialized. Bubbles and is composed.\n\n### **Methods:**\n \n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.",
53
+ "description": "The AssetElement interface provides properties and methods for manipulating\n[`<pc-asset>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/) elements.\nThe AssetElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element becomes ready once the containing application has started and the asset is in the\nstate declared by the markup: loaded for preloaded assets (even if loading failed — check the\nasset's `resource`), or registered and awaiting a load for `lazy` assets. Elements inserted\nwhile the application is running are created and registered on insertion, and begin loading\nimmediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed\nelsewhere, or with an unsupported asset type, never become ready.\n\nApart from `lazy`, these attributes are read once when the asset is created, so changing them\nlater has no effect.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the asset fails to load, with the engine's error in `message`. Does not bubble. The element still becomes ready — readiness means the load settled, not that it succeeded.\n- **load** - Fired each time the asset finishes loading, including a `lazy` asset loaded later and any subsequent reloads. Does not bubble — listen on this element, or use a capture-phase listener on an ancestor to observe every asset.\n- **ready** - Fired once the element is fully initialized. Bubbles and is composed.\n\n### **Methods:**\n \n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.",
37
54
  "attributes": [
38
55
  {
39
56
  "name": "atlas",
@@ -151,7 +168,7 @@
151
168
  },
152
169
  {
153
170
  "name": "pc-material",
154
- "description": "The MaterialElement interface provides properties and methods for manipulating\n[`<pc-material>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/) elements.\nThe MaterialElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nA `pc-material` must be a direct child of `pc-app` — elements placed elsewhere log a warning\nand never create a material. Elements inserted while the application is already running are\ncreated on insertion.\n\nThe element is metal/rough by default: unlike a bare `StandardMaterial` it enables the metalness\nworkflow, which is what the `metalness-*` attributes assume and what glTF means by PBR. The\n`roughness` and `roughness-map` attributes are aliases for `gloss` and `gloss-map` that\nadditionally invert the gloss channel; do not mix the two families on one element.\n\nThe two aliases are documented here rather than on an accessor, because they resolve to the\n`gloss` properties and would otherwise inherit gloss's description - which reads inverted.\n\n---\n\n\n### **Methods:**\n - **setMap(id: _string_, slot: _TextureSlot_)** - Points a texture slot at the resource of a `pc-asset`, waiting for the asset to load when it\nhas not already. An empty id clears the slot.",
171
+ "description": "The MaterialElement interface provides properties and methods for manipulating\n[`<pc-material>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/) elements.\nThe MaterialElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nA `pc-material` must be a direct child of `pc-app` — elements placed elsewhere log a warning\nand never create a material. Elements inserted while the application is already running are\ncreated on insertion.\n\nThe element is metal/rough by default: unlike a bare `StandardMaterial` it enables the metalness\nworkflow, which is what the `metalness-*` attributes assume and what glTF means by PBR. It also\ndefaults `metalness` to 0 rather than the engine's 1, because those two defaults have to be\nchosen together - the engine's 1 is unreachable under its own `useMetalness` of false, and with\nthe workflow on it would make every material fully metallic, so `<pc-material diffuse=\"crimson\">`\nwould render as dark tinted reflections of an environment that may not exist rather than as a\ncrimson surface. `metalness=\"1\"` remains one attribute away.\n\nThe `roughness` and `roughness-map` attributes are aliases for `gloss` and `gloss-map` that\nadditionally invert the gloss channel; do not mix the two families on one element.\n\nThe two aliases are documented here rather than on an accessor, because they resolve to the\n`gloss` properties and would otherwise inherit gloss's description - which reads inverted.\n\n---\n\n\n### **Methods:**\n - **setMap(id: _string_, slot: _TextureSlot_)** - Points a texture slot at the resource of a `pc-asset`, waiting for the asset to load when it\nhas not already. An empty id clears the slot.",
155
172
  "attributes": [
156
173
  {
157
174
  "name": "alpha-test",
@@ -725,13 +742,13 @@
725
742
  "values": []
726
743
  },
727
744
  {
728
- "name": "level",
729
- "description": "The mip level of the skybox.",
745
+ "name": "lighting",
746
+ "description": "Whether the skybox is used as a light source.",
730
747
  "values": []
731
748
  },
732
749
  {
733
- "name": "lighting",
734
- "description": "Whether the skybox is used as a light source.",
750
+ "name": "mip-level",
751
+ "description": "The mip level of the skybox.",
735
752
  "values": []
736
753
  },
737
754
  {
@@ -913,16 +930,16 @@
913
930
  "description": "The orthographic height of the camera.",
914
931
  "values": []
915
932
  },
916
- {
917
- "name": "orthographic",
918
- "description": "The orthographic projection of the camera.",
919
- "values": []
920
- },
921
933
  {
922
934
  "name": "priority",
923
935
  "description": "The priority of the camera.",
924
936
  "values": []
925
937
  },
938
+ {
939
+ "name": "projection",
940
+ "description": "The projection of the camera.",
941
+ "values": [{ "name": "perspective" }, { "name": "orthographic" }]
942
+ },
926
943
  {
927
944
  "name": "rect",
928
945
  "description": "The rect of the camera. Accepts 4 space-separated numbers.",
@@ -1523,7 +1540,6 @@
1523
1540
  "name": "pc-screen",
1524
1541
  "description": "The ScreenComponentElement interface provides properties and methods for manipulating\n[`<pc-screen>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-screen/) elements.\nThe ScreenComponentElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **ready** - Fired once the element is fully initialized. Bubbles and is composed.\n\n### **Methods:**\n \n- **ready(): __** - Returns a promise that resolves with this element when it's ready. This is the low-level\nprimitive underlying whenReady, which is the recommended way to wait for elements.",
1525
1542
  "attributes": [
1526
- { "name": "blend", "values": [] },
1527
1543
  {
1528
1544
  "name": "enabled",
1529
1545
  "description": "The enabled state of the component.",
@@ -1540,7 +1556,16 @@
1540
1556
  "description": "Accepts 2 space-separated numbers.",
1541
1557
  "values": []
1542
1558
  },
1543
- { "name": "scale-blend", "values": [] },
1559
+ {
1560
+ "name": "scale-blend",
1561
+ "description": "How the screen's resolutions are weighted against each other.",
1562
+ "values": []
1563
+ },
1564
+ {
1565
+ "name": "scale-mode",
1566
+ "description": "How the screen scales its contents.",
1567
+ "values": [{ "name": "none" }, { "name": "blend" }]
1568
+ },
1544
1569
  { "name": "screen-space", "values": [] }
1545
1570
  ],
1546
1571
  "references": []
@@ -1633,7 +1658,7 @@
1633
1658
  { "name": "friction", "description": "The friction.", "values": [] },
1634
1659
  {
1635
1660
  "name": "horizontal",
1636
- "description": "Whether horizontal scrolling is enabled.",
1661
+ "description": "Whether scrolling along the horizontal axis is enabled.",
1637
1662
  "values": []
1638
1663
  },
1639
1664
  {
@@ -1667,7 +1692,7 @@
1667
1692
  },
1668
1693
  {
1669
1694
  "name": "vertical",
1670
- "description": "Whether vertical scrolling is enabled.",
1695
+ "description": "Whether scrolling along the vertical axis is enabled.",
1671
1696
  "values": []
1672
1697
  },
1673
1698
  {