@playcanvas/web-components 0.13.1 → 0.15.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@playcanvas/web-components",
4
- "version": "0.13.1",
4
+ "version": "0.15.0",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -785,6 +785,11 @@
785
785
  "description": "The UV channel the metalness map samples.",
786
786
  "value": { "type": "number", "default": "0" }
787
787
  },
788
+ {
789
+ "name": "name",
790
+ "description": "The name of the material - the label shown wherever materials surface by name, such as profilers, GPU captures and the assignments `pc-model.hierarchy()` reports.",
791
+ "value": { "type": "string" }
792
+ },
788
793
  {
789
794
  "name": "normal-map",
790
795
  "description": "The id of the `pc-asset` used as the normal map.",
@@ -1162,6 +1167,10 @@
1162
1167
  "name": "metalnessMapUv",
1163
1168
  "description": "Gets the UV channel the metalness map samples."
1164
1169
  },
1170
+ {
1171
+ "name": "name",
1172
+ "description": "Gets the name of the material - the label shown wherever materials surface by name, such\nas profilers, GPU captures and the assignments `pc-model.hierarchy()` reports. Purely a\nlabel: element references resolve through `id`."
1173
+ },
1165
1174
  {
1166
1175
  "name": "normalMap",
1167
1176
  "description": "Gets the id of the `pc-asset` used as the normal map."
@@ -1284,7 +1293,7 @@
1284
1293
  },
1285
1294
  {
1286
1295
  "name": "pc-model",
1287
- "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.",
1296
+ "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 - **hierarchy(): __** - Returns a snapshot of the instantiated node tree, or `null` while there is none (the\ncontainer asset has not loaded, or the element has left the document). One call grounds a\nsession — a browser console, a test, an agent — in the vocabulary `pc-node` binding\nresolves against: the instantiated names (HierarchyNode.name), paths, match\nindices, attached component types and the material assignments of render components\n(HierarchyNode.materials). `String(...)` of the result, or of any node in it,\nis the printable form.\n\nThe snapshot is plain data, computed afresh each call: it does not follow later changes\nto the hierarchy, and mutating it changes nothing.\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.",
1288
1297
  "doc-url": "",
1289
1298
  "attributes": [
1290
1299
  {
@@ -1422,6 +1431,11 @@
1422
1431
  "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.",
1423
1432
  "value": { "type": "string" }
1424
1433
  },
1434
+ {
1435
+ "name": "material-overrides",
1436
+ "description": "Overrides material assignments on the bound node's render component, as a JSON object from selector to `pc-material` id — for example `{\"name:CarPaint\": \"candy-red\", \"index:7\": \"smoked-glass\"}`. A `name:X` key selects every mesh instance whose baseline material is named `X`; an `index:N` key selects mesh instance `N` and wins over a name rule for the same instance. Assignments no rule matches keep their baseline materials, and removing the attribute restores all of them. Use `pc-model.hierarchy()` to discover the names and indices a node offers.",
1437
+ "value": { "type": "string" }
1438
+ },
1425
1439
  {
1426
1440
  "name": "name",
1427
1441
  "description": "The name of the node to bind, resolved within the nearest ancestor `pc-model` (or `pc-node`) once it has instantiated.",
@@ -1532,6 +1546,11 @@
1532
1546
  "description": "Gets which match to bind.",
1533
1547
  "type": "number | null"
1534
1548
  },
1549
+ {
1550
+ "name": "materialOverrides",
1551
+ "description": "Gets the material overrides.",
1552
+ "type": "MaterialOverrides | null"
1553
+ },
1535
1554
  {
1536
1555
  "name": "name",
1537
1556
  "description": "Gets the name of the node to bind.",
@@ -2694,6 +2713,353 @@
2694
2713
  ]
2695
2714
  }
2696
2715
  },
2716
+ {
2717
+ "name": "pc-joint",
2718
+ "description": "The JointComponentElement interface provides properties and methods for manipulating\n[`<pc-joint>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-joint/) elements.\nThe JointComponentElement interface also inherits the properties and methods of the\nHTMLElement interface.\n\nThe entity holding the joint is not itself constrained. Its world transform defines the joint\nframe — the anchor point and axes the constraint operates about — with the local X axis as the\nprimary axis: a hinge rotates about it, a slider translates along it and a ball joint twists\nabout it. The constrained bodies are referenced by `entity-a` and `entity-b`, both of which need\na rigid body component; leaving `entity-b` empty constrains `entity-a` to a fixed point in world\nspace. The underlying engine component is in alpha, so its API may change.\n\n---\n\n\n### **Events:**\n - **break** - Fired when the impulse on the joint exceeds `break-impulse` and the constraint breaks. A broken joint no longer constrains its bodies; calling `refreshFrames()` on the underlying component re-attaches it. Bubbles and is composed.\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.",
2719
+ "doc-url": "",
2720
+ "attributes": [
2721
+ {
2722
+ "name": "angular-damping",
2723
+ "description": "The spring damping of the joint per angular axis. Accepts 3 space-separated numbers.",
2724
+ "value": { "type": "string", "default": "1 1 1" }
2725
+ },
2726
+ {
2727
+ "name": "angular-equilibrium",
2728
+ "description": "The rest angle of the joint's angular springs. Accepts 3 space-separated numbers.",
2729
+ "value": { "type": "string", "default": "0 0 0" }
2730
+ },
2731
+ {
2732
+ "name": "angular-limits-x",
2733
+ "description": "The rotation limits of the joint about its X axis. Accepts 2 space-separated numbers.",
2734
+ "value": { "type": "string", "default": "0 0" }
2735
+ },
2736
+ {
2737
+ "name": "angular-limits-y",
2738
+ "description": "The rotation limits of the joint about its Y axis. Accepts 2 space-separated numbers.",
2739
+ "value": { "type": "string", "default": "0 0" }
2740
+ },
2741
+ {
2742
+ "name": "angular-limits-z",
2743
+ "description": "The rotation limits of the joint about its Z axis. Accepts 2 space-separated numbers.",
2744
+ "value": { "type": "string", "default": "0 0" }
2745
+ },
2746
+ {
2747
+ "name": "angular-motion-x",
2748
+ "description": "How the joint constrains rotation about its X axis.",
2749
+ "value": {
2750
+ "type": "'locked' | 'limited' | 'free'",
2751
+ "default": "locked"
2752
+ }
2753
+ },
2754
+ {
2755
+ "name": "angular-motion-y",
2756
+ "description": "How the joint constrains rotation about its Y axis.",
2757
+ "value": {
2758
+ "type": "'locked' | 'limited' | 'free'",
2759
+ "default": "locked"
2760
+ }
2761
+ },
2762
+ {
2763
+ "name": "angular-motion-z",
2764
+ "description": "How the joint constrains rotation about its Z axis.",
2765
+ "value": {
2766
+ "type": "'locked' | 'limited' | 'free'",
2767
+ "default": "locked"
2768
+ }
2769
+ },
2770
+ {
2771
+ "name": "angular-stiffness",
2772
+ "description": "The spring stiffness of the joint per angular axis. Accepts 3 space-separated numbers.",
2773
+ "value": { "type": "string", "default": "0 0 0" }
2774
+ },
2775
+ {
2776
+ "name": "break-impulse",
2777
+ "description": "The impulse above which the joint breaks.",
2778
+ "value": { "type": "number", "default": "Infinity" }
2779
+ },
2780
+ {
2781
+ "name": "enable-collision",
2782
+ "description": "Whether collision is enabled between the two constrained bodies.",
2783
+ "value": { "type": "boolean", "default": "false" }
2784
+ },
2785
+ {
2786
+ "name": "enable-limits",
2787
+ "description": "Whether the limits of the joint are enforced.",
2788
+ "value": { "type": "boolean", "default": "false" }
2789
+ },
2790
+ {
2791
+ "name": "enabled",
2792
+ "description": "The enabled state of the component.",
2793
+ "value": { "type": "boolean", "default": "true" }
2794
+ },
2795
+ {
2796
+ "name": "entity-a",
2797
+ "description": "The reference to the `<pc-entity>` providing the first constrained body.",
2798
+ "value": { "type": "string" }
2799
+ },
2800
+ {
2801
+ "name": "entity-b",
2802
+ "description": "The reference to the `<pc-entity>` providing the second constrained body.",
2803
+ "value": { "type": "string" }
2804
+ },
2805
+ {
2806
+ "name": "limits",
2807
+ "description": "The rotation or travel limits of the joint. Accepts 2 space-separated numbers.",
2808
+ "value": { "type": "string", "default": "-45 45" }
2809
+ },
2810
+ {
2811
+ "name": "linear-damping",
2812
+ "description": "The spring damping of the joint per linear axis. Accepts 3 space-separated numbers.",
2813
+ "value": { "type": "string", "default": "1 1 1" }
2814
+ },
2815
+ {
2816
+ "name": "linear-equilibrium",
2817
+ "description": "The rest point of the joint's linear springs. Accepts 3 space-separated numbers.",
2818
+ "value": { "type": "string", "default": "0 0 0" }
2819
+ },
2820
+ {
2821
+ "name": "linear-limits-x",
2822
+ "description": "The translation limits of the joint along its X axis. Accepts 2 space-separated numbers.",
2823
+ "value": { "type": "string", "default": "0 0" }
2824
+ },
2825
+ {
2826
+ "name": "linear-limits-y",
2827
+ "description": "The translation limits of the joint along its Y axis. Accepts 2 space-separated numbers.",
2828
+ "value": { "type": "string", "default": "0 0" }
2829
+ },
2830
+ {
2831
+ "name": "linear-limits-z",
2832
+ "description": "The translation limits of the joint along its Z axis. Accepts 2 space-separated numbers.",
2833
+ "value": { "type": "string", "default": "0 0" }
2834
+ },
2835
+ {
2836
+ "name": "linear-motion-x",
2837
+ "description": "How the joint constrains translation along its X axis.",
2838
+ "value": {
2839
+ "type": "'locked' | 'limited' | 'free'",
2840
+ "default": "locked"
2841
+ }
2842
+ },
2843
+ {
2844
+ "name": "linear-motion-y",
2845
+ "description": "How the joint constrains translation along its Y axis.",
2846
+ "value": {
2847
+ "type": "'locked' | 'limited' | 'free'",
2848
+ "default": "locked"
2849
+ }
2850
+ },
2851
+ {
2852
+ "name": "linear-motion-z",
2853
+ "description": "How the joint constrains translation along its Z axis.",
2854
+ "value": {
2855
+ "type": "'locked' | 'limited' | 'free'",
2856
+ "default": "locked"
2857
+ }
2858
+ },
2859
+ {
2860
+ "name": "linear-stiffness",
2861
+ "description": "The spring stiffness of the joint per linear axis. Accepts 3 space-separated numbers.",
2862
+ "value": { "type": "string", "default": "0 0 0" }
2863
+ },
2864
+ {
2865
+ "name": "max-motor-force",
2866
+ "description": "The maximum torque or force of the joint's motor.",
2867
+ "value": { "type": "number", "default": "0" }
2868
+ },
2869
+ {
2870
+ "name": "motor-speed",
2871
+ "description": "The target speed of the joint's motor.",
2872
+ "value": { "type": "number", "default": "0" }
2873
+ },
2874
+ {
2875
+ "name": "swing-limit-y",
2876
+ "description": "The maximum swing of the joint around the joint frame's Y axis.",
2877
+ "value": { "type": "number", "default": "45" }
2878
+ },
2879
+ {
2880
+ "name": "swing-limit-z",
2881
+ "description": "The maximum swing of the joint around the joint frame's Z axis.",
2882
+ "value": { "type": "number", "default": "45" }
2883
+ },
2884
+ {
2885
+ "name": "twist-limit",
2886
+ "description": "The maximum twist of the joint about its primary axis.",
2887
+ "value": { "type": "number", "default": "20" }
2888
+ },
2889
+ {
2890
+ "name": "type",
2891
+ "description": "The type of the joint.",
2892
+ "value": {
2893
+ "type": "'fixed' | 'ball' | 'hinge' | 'slider' | '6dof'",
2894
+ "default": "fixed"
2895
+ }
2896
+ }
2897
+ ],
2898
+ "events": [
2899
+ {
2900
+ "name": "break",
2901
+ "type": "CustomEvent",
2902
+ "description": "Fired when the impulse on the joint exceeds `break-impulse` and the constraint breaks. A broken joint no longer constrains its bodies; calling `refreshFrames()` on the underlying component re-attaches it. Bubbles and is composed."
2903
+ },
2904
+ {
2905
+ "name": "ready",
2906
+ "type": "CustomEvent",
2907
+ "description": "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."
2908
+ }
2909
+ ],
2910
+ "js": {
2911
+ "properties": [
2912
+ {
2913
+ "name": "angularDamping",
2914
+ "description": "Gets the spring damping of the joint per angular axis."
2915
+ },
2916
+ {
2917
+ "name": "angularEquilibrium",
2918
+ "description": "Gets the rest angle of the joint's angular springs."
2919
+ },
2920
+ {
2921
+ "name": "angularLimitsX",
2922
+ "description": "Gets the rotation limits of the joint about its X axis."
2923
+ },
2924
+ {
2925
+ "name": "angularLimitsY",
2926
+ "description": "Gets the rotation limits of the joint about its Y axis."
2927
+ },
2928
+ {
2929
+ "name": "angularLimitsZ",
2930
+ "description": "Gets the rotation limits of the joint about its Z axis."
2931
+ },
2932
+ {
2933
+ "name": "angularMotionX",
2934
+ "description": "Gets how the joint constrains rotation about its X axis."
2935
+ },
2936
+ {
2937
+ "name": "angularMotionY",
2938
+ "description": "Gets how the joint constrains rotation about its Y axis."
2939
+ },
2940
+ {
2941
+ "name": "angularMotionZ",
2942
+ "description": "Gets how the joint constrains rotation about its Z axis."
2943
+ },
2944
+ {
2945
+ "name": "angularStiffness",
2946
+ "description": "Gets the spring stiffness of the joint per angular axis."
2947
+ },
2948
+ {
2949
+ "name": "breakImpulse",
2950
+ "description": "Gets the impulse above which the joint breaks."
2951
+ },
2952
+ {
2953
+ "name": "closestApp",
2954
+ "description": "The nearest ancestor `<pc-app>` element, or `null` if this element has no `<pc-app>`\nancestor. The search starts at the parent, so an element never resolves to itself.",
2955
+ "type": "AppElement | null"
2956
+ },
2957
+ {
2958
+ "name": "closestEntity",
2959
+ "description": "The nearest ancestor element that fronts an entity — `<pc-entity>` or `<pc-node>` — or\n`null` if this element has no such ancestor. The search starts at the parent, so an element\nnever resolves to itself.",
2960
+ "type": "EntityBaseElement | null"
2961
+ },
2962
+ {
2963
+ "name": "component",
2964
+ "description": "Gets the underlying PlayCanvas joint component.",
2965
+ "type": "Component | null"
2966
+ },
2967
+ {
2968
+ "name": "enableCollision",
2969
+ "description": "Gets whether collision is enabled between the two constrained bodies."
2970
+ },
2971
+ {
2972
+ "name": "enabled",
2973
+ "description": "Gets the enabled state of the component."
2974
+ },
2975
+ {
2976
+ "name": "enableLimits",
2977
+ "description": "Gets whether the limits of the joint are enforced."
2978
+ },
2979
+ {
2980
+ "name": "entityA",
2981
+ "description": "Gets the reference to the `<pc-entity>` providing the first constrained body."
2982
+ },
2983
+ {
2984
+ "name": "entityB",
2985
+ "description": "Gets the reference to the `<pc-entity>` providing the second constrained body."
2986
+ },
2987
+ {
2988
+ "name": "limits",
2989
+ "description": "Gets the rotation or travel limits of the joint."
2990
+ },
2991
+ {
2992
+ "name": "linearDamping",
2993
+ "description": "Gets the spring damping of the joint per linear axis."
2994
+ },
2995
+ {
2996
+ "name": "linearEquilibrium",
2997
+ "description": "Gets the rest point of the joint's linear springs."
2998
+ },
2999
+ {
3000
+ "name": "linearLimitsX",
3001
+ "description": "Gets the translation limits of the joint along its X axis."
3002
+ },
3003
+ {
3004
+ "name": "linearLimitsY",
3005
+ "description": "Gets the translation limits of the joint along its Y axis."
3006
+ },
3007
+ {
3008
+ "name": "linearLimitsZ",
3009
+ "description": "Gets the translation limits of the joint along its Z axis."
3010
+ },
3011
+ {
3012
+ "name": "linearMotionX",
3013
+ "description": "Gets how the joint constrains translation along its X axis."
3014
+ },
3015
+ {
3016
+ "name": "linearMotionY",
3017
+ "description": "Gets how the joint constrains translation along its Y axis."
3018
+ },
3019
+ {
3020
+ "name": "linearMotionZ",
3021
+ "description": "Gets how the joint constrains translation along its Z axis."
3022
+ },
3023
+ {
3024
+ "name": "linearStiffness",
3025
+ "description": "Gets the spring stiffness of the joint per linear axis."
3026
+ },
3027
+ {
3028
+ "name": "maxMotorForce",
3029
+ "description": "Gets the maximum torque or force of the joint's motor."
3030
+ },
3031
+ {
3032
+ "name": "motorSpeed",
3033
+ "description": "Gets the target speed of the joint's motor."
3034
+ },
3035
+ {
3036
+ "name": "swingLimitY",
3037
+ "description": "Gets the maximum swing of the joint around the joint frame's Y axis."
3038
+ },
3039
+ {
3040
+ "name": "swingLimitZ",
3041
+ "description": "Gets the maximum swing of the joint around the joint frame's Z axis."
3042
+ },
3043
+ {
3044
+ "name": "twistLimit",
3045
+ "description": "Gets the maximum twist of the joint about its primary axis."
3046
+ },
3047
+ { "name": "type", "description": "Gets the type of the joint." }
3048
+ ],
3049
+ "events": [
3050
+ {
3051
+ "name": "break",
3052
+ "type": "CustomEvent",
3053
+ "description": "Fired when the impulse on the joint exceeds `break-impulse` and the constraint breaks. A broken joint no longer constrains its bodies; calling `refreshFrames()` on the underlying component re-attaches it. Bubbles and is composed."
3054
+ },
3055
+ {
3056
+ "name": "ready",
3057
+ "type": "CustomEvent",
3058
+ "description": "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."
3059
+ }
3060
+ ]
3061
+ }
3062
+ },
2697
3063
  {
2698
3064
  "name": "pc-layoutchild",
2699
3065
  "description": "The LayoutChildComponentElement interface provides properties and methods for manipulating\n[`<pc-layoutchild>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-layoutchild/) elements.\nThe LayoutChildComponentElement 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.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/web-components",
3
- "version": "0.13.1",
3
+ "version": "0.15.0",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://playcanvas.com",
6
6
  "description": "Web Components for the PlayCanvas Engine",
@@ -71,6 +71,7 @@
71
71
  "test:unit": "vitest run --project unit",
72
72
  "test:elements": "vitest run --project elements",
73
73
  "test:integration": "vitest run --project integration",
74
+ "test:examples": "vitest run --project examples",
74
75
  "publint": "publint",
75
76
  "type-check": "npm run type-check:src && npm run type-check:test",
76
77
  "type-check:src": "tsc --noEmit -p tsconfig.json",
@@ -96,11 +97,11 @@
96
97
  "custom-element-vs-code-integration": "1.5.0",
97
98
  "earcut": "3.2.3",
98
99
  "eslint": "9.39.5",
99
- "globals": "17.9.0",
100
+ "globals": "17.11.0",
100
101
  "jsdom": "30.0.1",
101
- "mediabunny": "1.53.0",
102
+ "mediabunny": "1.53.1",
102
103
  "opentype.js": "2.0.0",
103
- "playcanvas": "2.22.0-beta.12",
104
+ "playcanvas": "2.21.4",
104
105
  "prettier": "3.9.6",
105
106
  "publint": "0.3.23",
106
107
  "rollup": "4.62.4",
package/src/app.ts CHANGED
@@ -252,6 +252,24 @@ class AppElement extends AsyncElement {
252
252
  this._bar = new LoadingBar(this);
253
253
  }
254
254
 
255
+ // Upgrade the subtree before reading anything out of it. A subtree cloned from a
256
+ // <template> arrives entirely unupgraded - template content lives in an inert document,
257
+ // where custom element definitions are never looked up - and appending the clone upgrades
258
+ // its elements in tree order, this one before its descendants. The module query below would
259
+ // otherwise find plain HTMLElements with no _getLoadPromise to call, and the boot would die
260
+ // there, leaving the element permanently unready: no canvas, no entities, no application.
261
+ //
262
+ // Upgrading is the fix here rather than skipping whatever has not upgraded, because a
263
+ // <pc-module> is the one child that nothing else ever builds on its own behalf - skipping
264
+ // it would drop the wasm module the app asked for, silently and only for cloned apps.
265
+ // Upgrading runs each descendant's connectedCallback synchronously, a few lines earlier
266
+ // than the parser's path runs them but into the same state they see there: no application
267
+ // yet and _hierarchyReady false, so they defer to the sweeps below. A descendant that
268
+ // disconnects this element from there is caught by the generation check after the await,
269
+ // as any other disconnect is. An already-upgraded subtree - every other insertion path -
270
+ // is left completely untouched.
271
+ customElements.upgrade(this);
272
+
255
273
  // Get all pc-module elements that are direct children of the pc-app element
256
274
  const moduleElements = this.querySelectorAll<ModuleElement>(':scope > pc-module');
257
275
 
package/src/colors.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * The CSS color keywords, lowercase name to hex value. Read by `parseColor` to accept color
3
+ * names as attribute values.
4
+ * @internal
5
+ */
1
6
  export const CSS_COLORS: Record<string, string> = {
2
7
  aliceblue: '#f0f8ff',
3
8
  antiquewhite: '#faebd7',