@playcanvas/web-components 0.10.0 → 0.10.1
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/app.d.ts +52 -7
- package/dist/asset.d.ts +9 -0
- package/dist/async-element.d.ts +12 -2
- package/dist/components/component.d.ts +5 -4
- package/dist/custom-elements.json +583 -110
- package/dist/entity.d.ts +5 -4
- package/dist/loading-bar.d.ts +35 -0
- package/dist/material.d.ts +8 -2
- package/dist/pwc.cjs +385 -105
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +385 -105
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.min.mjs +1 -1
- package/dist/pwc.min.mjs.map +1 -1
- package/dist/pwc.mjs +385 -105
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +11 -3
- package/dist/vscode.html-custom-data.json +8 -3
- package/dist/web-types.json +322 -78
- package/package.json +1 -1
- package/src/app.ts +172 -73
- package/src/asset.ts +25 -0
- package/src/async-element.ts +14 -4
- package/src/components/component.ts +6 -5
- package/src/entity.ts +34 -18
- package/src/loading-bar.ts +122 -0
- package/src/material.ts +10 -4
- package/src/scene.ts +49 -19
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.
|
|
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`.
|
|
@@ -4,7 +4,7 @@
|
|
|
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 \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
9
|
{ "name": "alpha", "description": "The alpha flag.", "values": [] },
|
|
10
10
|
{
|
|
@@ -27,13 +27,18 @@
|
|
|
27
27
|
"description": "The high resolution flag.",
|
|
28
28
|
"values": []
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
"name": "loading-bar",
|
|
32
|
+
"description": "Whether the application shows its built-in loading bar while it boots and preloads its assets.",
|
|
33
|
+
"values": []
|
|
34
|
+
},
|
|
30
35
|
{ "name": "stencil", "description": "The stencil flag.", "values": [] }
|
|
31
36
|
],
|
|
32
37
|
"references": []
|
|
33
38
|
},
|
|
34
39
|
{
|
|
35
40
|
"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.",
|
|
41
|
+
"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
42
|
"attributes": [
|
|
38
43
|
{
|
|
39
44
|
"name": "atlas",
|
|
@@ -151,7 +156,7 @@
|
|
|
151
156
|
},
|
|
152
157
|
{
|
|
153
158
|
"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.
|
|
159
|
+
"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
160
|
"attributes": [
|
|
156
161
|
{
|
|
157
162
|
"name": "alpha-test",
|