@playcanvas/web-components 0.11.1 → 0.12.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/app.d.ts +13 -11
- package/dist/asset.d.ts +144 -5
- package/dist/async-element.d.ts +6 -5
- package/dist/components/collision-component.d.ts +16 -0
- package/dist/components/component.d.ts +19 -0
- package/dist/custom-elements.json +1054 -164
- package/dist/entity-base.d.ts +67 -0
- package/dist/entity.d.ts +3 -38
- package/dist/index.d.ts +4 -1
- package/dist/material.d.ts +2 -1
- package/dist/model.d.ts +26 -4
- package/dist/node.d.ts +253 -0
- package/dist/pwc.cjs +1364 -168
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +1364 -168
- 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 +1364 -170
- package/dist/pwc.mjs.map +1 -1
- package/dist/vscode.html-custom-data.json +126 -4
- package/dist/web-types.json +360 -56
- package/package.json +2 -2
- package/src/app.ts +27 -24
- package/src/asset.ts +439 -9
- package/src/async-element.ts +7 -6
- package/src/components/collision-component.ts +35 -0
- package/src/components/component.ts +93 -3
- package/src/entity-base.ts +136 -0
- package/src/entity.ts +23 -117
- package/src/index.ts +5 -0
- package/src/material.ts +2 -2
- package/src/model.ts +79 -11
- package/src/node.ts +715 -0
- package/src/sky.ts +0 -1
|
@@ -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 - **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 when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **elementFromEntity(entity: _Entity_): __** - Returns the `<pc-entity>` element whose backing entity is `entity`, or
|
|
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 when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **elementFromEntity(entity: _Entity_): __** - Returns the `<pc-entity>` or `<pc-node>` element whose backing entity is `entity`, or\n`null` if the entity is not fronted by an element of this application - for example, an\nunbound node inside a model's instantiated hierarchy, or an entity created through the\nengine API.\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
8
8
|
"attributes": [
|
|
9
9
|
{
|
|
10
10
|
"name": "alpha",
|
|
@@ -50,8 +50,31 @@
|
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"name": "pc-asset",
|
|
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
|
|
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\nFor `texture` and `textureatlas` assets, the texture options (`address-u`, `address-v`,\n`min-filter`, `mag-filter`, `anisotropy`, `mipmaps`, `srgb`, `flip-y`) apply when the texture is\ncreated and — like `lazy` — are observed: changing one updates a texture that has already\nloaded, and removing one restores the engine default. Changing `srgb` or `mipmaps` on a loaded\ntexture recreates the underlying GPU resource, so prefer declaring those up front. Each option\noverrides the matching key in the `data` JSON; options left unset write nothing, leaving the\nengine's per-format defaults in force.\n\nApart from `lazy` and the texture options, these attributes are read once when the asset is\ncreated, so changing them later 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 when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\n - **get(id: _string_): __** - Returns the Asset created by the `<pc-asset>` element with the given `id`, or\n`undefined` if there is no such element or its asset has not been created yet.\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
54
54
|
"attributes": [
|
|
55
|
+
{
|
|
56
|
+
"name": "address-u",
|
|
57
|
+
"description": "The texture's horizontal (U) address mode.",
|
|
58
|
+
"values": [
|
|
59
|
+
{ "name": "repeat" },
|
|
60
|
+
{ "name": "clamp" },
|
|
61
|
+
{ "name": "mirror" }
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "address-v",
|
|
66
|
+
"description": "The texture's vertical (V) address mode.",
|
|
67
|
+
"values": [
|
|
68
|
+
{ "name": "repeat" },
|
|
69
|
+
{ "name": "clamp" },
|
|
70
|
+
{ "name": "mirror" }
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "anisotropy",
|
|
75
|
+
"description": "The texture's maximum anisotropic filtering level.",
|
|
76
|
+
"values": []
|
|
77
|
+
},
|
|
55
78
|
{
|
|
56
79
|
"name": "atlas",
|
|
57
80
|
"description": "For a `sprite` asset, the `id` of the texture atlas asset it uses. The atlas must be declared before the sprite.",
|
|
@@ -62,6 +85,11 @@
|
|
|
62
85
|
"description": "Additional asset data, as a JSON object.",
|
|
63
86
|
"values": []
|
|
64
87
|
},
|
|
88
|
+
{
|
|
89
|
+
"name": "flip-y",
|
|
90
|
+
"description": "Whether the texture's image data is flipped vertically at upload.",
|
|
91
|
+
"values": []
|
|
92
|
+
},
|
|
65
93
|
{
|
|
66
94
|
"name": "frame-keys",
|
|
67
95
|
"description": "For a `sprite` asset, the atlas frame keys it uses, separated by spaces or commas.",
|
|
@@ -77,6 +105,28 @@
|
|
|
77
105
|
"description": "Whether the asset should be loaded lazily.",
|
|
78
106
|
"values": []
|
|
79
107
|
},
|
|
108
|
+
{
|
|
109
|
+
"name": "mag-filter",
|
|
110
|
+
"description": "The texture's magnification filter.",
|
|
111
|
+
"values": [{ "name": "nearest" }, { "name": "linear" }]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "min-filter",
|
|
115
|
+
"description": "The texture's minification filter.",
|
|
116
|
+
"values": [
|
|
117
|
+
{ "name": "nearest" },
|
|
118
|
+
{ "name": "linear" },
|
|
119
|
+
{ "name": "nearest-mip-nearest" },
|
|
120
|
+
{ "name": "linear-mip-nearest" },
|
|
121
|
+
{ "name": "nearest-mip-linear" },
|
|
122
|
+
{ "name": "linear-mip-linear" }
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "mipmaps",
|
|
127
|
+
"description": "Whether the texture generates and uses mipmaps.",
|
|
128
|
+
"values": []
|
|
129
|
+
},
|
|
80
130
|
{
|
|
81
131
|
"name": "pixels-per-unit",
|
|
82
132
|
"description": "For a `sprite` asset, the number of pixels per world unit.",
|
|
@@ -96,6 +146,11 @@
|
|
|
96
146
|
"description": "The URL of the asset to load.",
|
|
97
147
|
"values": []
|
|
98
148
|
},
|
|
149
|
+
{
|
|
150
|
+
"name": "srgb",
|
|
151
|
+
"description": "Whether the texture holds sRGB (gamma-encoded) color data.",
|
|
152
|
+
"values": []
|
|
153
|
+
},
|
|
99
154
|
{
|
|
100
155
|
"name": "type",
|
|
101
156
|
"description": "The asset type. Inferred from the `src` file extension when omitted.",
|
|
@@ -643,7 +698,7 @@
|
|
|
643
698
|
},
|
|
644
699
|
{
|
|
645
700
|
"name": "pc-model",
|
|
646
|
-
"description": "The ModelElement interface provides properties and methods for manipulating\n[`<pc-model>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-model/) elements.\nThe ModelElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
701
|
+
"description": "The ModelElement interface provides properties and methods for manipulating\n[`<pc-model>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-model/) elements.\nThe ModelElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe element becomes ready once its container asset has loaded and the instantiated hierarchy has\nbeen added to the scene — `entity` is non-null by then. A failed load also settles readiness,\nwith `entity` remaining `null`: readiness means the load settled, not that it succeeded — listen\nfor `error`, or check `entity`, to tell the outcomes apart. Changing `asset` re-arms readiness\nand instantiates anew, so a `ready()` obtained after the change resolves against the new\nhierarchy. A `pc-model` outside a `pc-app`, or referencing an unknown asset id, warns and never\nbecomes ready.\n\n---\n\n\n### **Events:**\n - **error** - Fired when the container 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 a container asset finishes instantiating, including re-instantiation after `asset` changes. Does not bubble — listen on this element, or use a capture-phase listener on an ancestor.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
647
702
|
"attributes": [
|
|
648
703
|
{
|
|
649
704
|
"name": "asset",
|
|
@@ -680,6 +735,73 @@
|
|
|
680
735
|
],
|
|
681
736
|
"references": []
|
|
682
737
|
},
|
|
738
|
+
{
|
|
739
|
+
"name": "pc-node",
|
|
740
|
+
"description": "The NodeElement interface provides properties and methods for manipulating\n[`<pc-node>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-node/)\nelements. The NodeElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nA `pc-node` is an override element: where `pc-entity` creates an entity, `pc-node` binds to a\nnode a `pc-model` loaded and declares overrides against the authored asset — components to\nadd, properties to change, content to attach. Attributes present apply as overrides; attributes\nabsent leave authored values untouched, and removing an attribute (or assigning `null` to the\nmatching property) restores the authored value.\n\n`name` selects among the host model's nodes (first match in depth-first order), nesting a\n`pc-node` inside another scopes the search to that subtree, and `index` picks among identically\nnamed matches. When `name` matches more than one node and no `index` is given, the element\nwarns and binds nothing.\n\nThe element becomes ready once bound, and never while unresolved — a missing or ambiguous\nname warns and records the failure in `state`, readiness stays unresolved, and descendants\nwait with it.\n\nThe pointer events below are dispatched by the containing `<pc-app>` element when the pointer\nintersects the bound node's geometry, exactly as for `<pc-entity>`.\n\n---\n\n\n### **Events:**\n - **pointerdown** - Fired when a pointer button is pressed over the node.\n- **pointerenter** - Fired when the pointer moves onto the node.\n- **pointerleave** - Fired when the pointer moves off the node.\n- **pointermove** - Fired when the pointer moves over the node.\n- **pointerup** - Fired when a pointer button is released over the node.\n- **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
741
|
+
"attributes": [
|
|
742
|
+
{
|
|
743
|
+
"name": "enabled",
|
|
744
|
+
"description": "Overrides the node's enabled state.",
|
|
745
|
+
"values": []
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
"name": "index",
|
|
749
|
+
"description": "Which match to bind when `name` matches more than one node, 0-based in depth-first order. Optional for a unique match; required for an ambiguous one.",
|
|
750
|
+
"values": []
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
"name": "name",
|
|
754
|
+
"description": "The name of the node to bind, resolved within the nearest ancestor `pc-model` (or `pc-node`) once it has instantiated.",
|
|
755
|
+
"values": []
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"name": "onpointerdown",
|
|
759
|
+
"description": "Script to run when a pointer button is pressed over the node.",
|
|
760
|
+
"values": []
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
"name": "onpointerenter",
|
|
764
|
+
"description": "Script to run when the pointer moves onto the node.",
|
|
765
|
+
"values": []
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
"name": "onpointerleave",
|
|
769
|
+
"description": "Script to run when the pointer moves off the node.",
|
|
770
|
+
"values": []
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"name": "onpointermove",
|
|
774
|
+
"description": "Script to run when the pointer moves over the node.",
|
|
775
|
+
"values": []
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
"name": "onpointerup",
|
|
779
|
+
"description": "Script to run when a pointer button is released over the node.",
|
|
780
|
+
"values": []
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
"name": "position",
|
|
784
|
+
"description": "Overrides the node's local position, as an \"x y z\" triple.",
|
|
785
|
+
"values": []
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"name": "rotation",
|
|
789
|
+
"description": "Overrides the node's local rotation (Euler angles), as an \"x y z\" triple.",
|
|
790
|
+
"values": []
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"name": "scale",
|
|
794
|
+
"description": "Overrides the node's local scale, as an \"x y z\" triple.",
|
|
795
|
+
"values": []
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"name": "tags",
|
|
799
|
+
"description": "Overrides the node's tags, separated by spaces or commas.",
|
|
800
|
+
"values": []
|
|
801
|
+
}
|
|
802
|
+
],
|
|
803
|
+
"references": []
|
|
804
|
+
},
|
|
683
805
|
{
|
|
684
806
|
"name": "pc-scene",
|
|
685
807
|
"description": "The SceneElement interface provides properties and methods for manipulating\n[`<pc-scene>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/) elements.\nThe SceneElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
@@ -968,7 +1090,7 @@
|
|
|
968
1090
|
},
|
|
969
1091
|
{
|
|
970
1092
|
"name": "pc-collision",
|
|
971
|
-
"description": "The CollisionComponentElement interface provides properties and methods for manipulating\n[`<pc-collision>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/) elements.\nThe CollisionComponentElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\n---\n\n\n### **Events:**\n - **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
1093
|
+
"description": "The CollisionComponentElement interface provides properties and methods for manipulating\n[`<pc-collision>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/) elements.\nThe CollisionComponentElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nFor `type=\"mesh\"`, the collision geometry defaults to the host entity's own render component\n(its render asset) — a collider matching the visible mesh, which is what a mesh collider on a\nglTF node means. The default resolves each time the component applies, so a `pc-node` that\nretargets or rebinds picks up the new node's geometry. An entity with no asset-backed render\ncomponent warns, and the collider has no shape.\n\n---\n\n\n### **Events:**\n - **ready** - Fired when the element is fully initialized — once per readiness cycle, so an element that is torn down and re-initialized (for example by removing and re-inserting it) fires it again. Bubbles and is composed.\n\n### **Methods:**\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.\n\nReadiness tracks the element's current lifecycle: once a ready element is torn down (for\nexample by removing it from the document), this returns a fresh promise that resolves when\nthe element is next ready. A promise obtained earlier stays resolved — call this again\nafter re-inserting an element rather than reusing a promise from before its removal.",
|
|
972
1094
|
"attributes": [
|
|
973
1095
|
{
|
|
974
1096
|
"name": "angular-offset",
|