@playcanvas/web-components 0.17.0 → 0.18.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.
Files changed (117) hide show
  1. package/README.md +5 -3
  2. package/dist/app.d.cts +4 -0
  3. package/dist/app.d.ts +4 -0
  4. package/dist/asset.d.cts +13 -3
  5. package/dist/asset.d.ts +13 -3
  6. package/dist/components/anim-clip.d.cts +4 -0
  7. package/dist/components/anim-clip.d.ts +4 -0
  8. package/dist/components/anim-component.d.cts +5 -0
  9. package/dist/components/anim-component.d.ts +5 -0
  10. package/dist/components/audio-listener-component.d.cts +4 -0
  11. package/dist/components/audio-listener-component.d.ts +4 -0
  12. package/dist/components/button-component.d.cts +5 -0
  13. package/dist/components/button-component.d.ts +5 -0
  14. package/dist/components/camera-component.d.cts +35 -1
  15. package/dist/components/camera-component.d.ts +35 -1
  16. package/dist/components/collision-component.d.cts +4 -0
  17. package/dist/components/collision-component.d.ts +4 -0
  18. package/dist/components/element-component.d.cts +4 -0
  19. package/dist/components/element-component.d.ts +4 -0
  20. package/dist/components/gsplat-component.d.cts +4 -0
  21. package/dist/components/gsplat-component.d.ts +4 -0
  22. package/dist/components/joint-component.d.cts +12 -2
  23. package/dist/components/joint-component.d.ts +12 -2
  24. package/dist/components/layout-child-component.d.cts +4 -0
  25. package/dist/components/layout-child-component.d.ts +4 -0
  26. package/dist/components/layout-group-component.d.cts +4 -0
  27. package/dist/components/layout-group-component.d.ts +4 -0
  28. package/dist/components/light-component.d.cts +50 -1
  29. package/dist/components/light-component.d.ts +50 -1
  30. package/dist/components/particle-system-component.d.cts +4 -0
  31. package/dist/components/particle-system-component.d.ts +4 -0
  32. package/dist/components/render-component.d.cts +5 -0
  33. package/dist/components/render-component.d.ts +5 -0
  34. package/dist/components/rigid-body-component.d.cts +5 -0
  35. package/dist/components/rigid-body-component.d.ts +5 -0
  36. package/dist/components/screen-component.d.cts +4 -0
  37. package/dist/components/screen-component.d.ts +4 -0
  38. package/dist/components/script-component.d.cts +3 -0
  39. package/dist/components/script-component.d.ts +3 -0
  40. package/dist/components/script-instance.d.cts +4 -0
  41. package/dist/components/script-instance.d.ts +4 -0
  42. package/dist/components/scroll-view-component.d.cts +4 -0
  43. package/dist/components/scroll-view-component.d.ts +4 -0
  44. package/dist/components/scrollbar-component.d.cts +4 -0
  45. package/dist/components/scrollbar-component.d.ts +4 -0
  46. package/dist/components/sound-component.d.cts +4 -0
  47. package/dist/components/sound-component.d.ts +4 -0
  48. package/dist/components/sound-slot.d.cts +3 -0
  49. package/dist/components/sound-slot.d.ts +3 -0
  50. package/dist/custom-elements.json +268 -7
  51. package/dist/entity-base.d.cts +1 -1
  52. package/dist/entity-base.d.ts +1 -1
  53. package/dist/entity-owner.d.cts +2 -2
  54. package/dist/entity-owner.d.ts +2 -2
  55. package/dist/entity.d.cts +6 -1
  56. package/dist/entity.d.ts +6 -1
  57. package/dist/index.d.cts +4 -1
  58. package/dist/index.d.ts +4 -1
  59. package/dist/material.d.cts +18 -7
  60. package/dist/material.d.ts +18 -7
  61. package/dist/model.d.cts +5 -0
  62. package/dist/model.d.ts +5 -0
  63. package/dist/node.d.cts +6 -1
  64. package/dist/node.d.ts +6 -1
  65. package/dist/pwc.cjs +284 -28
  66. package/dist/pwc.cjs.map +1 -1
  67. package/dist/pwc.js +284 -28
  68. package/dist/pwc.js.map +1 -1
  69. package/dist/pwc.min.js +1 -1
  70. package/dist/pwc.min.js.map +1 -1
  71. package/dist/pwc.min.mjs +1 -1
  72. package/dist/pwc.min.mjs.map +1 -1
  73. package/dist/pwc.mjs +285 -29
  74. package/dist/pwc.mjs.map +1 -1
  75. package/dist/scene.d.cts +3 -0
  76. package/dist/scene.d.ts +3 -0
  77. package/dist/sky.d.cts +4 -0
  78. package/dist/sky.d.ts +4 -0
  79. package/dist/vscode.html-custom-data.json +237 -62
  80. package/dist/wasm.d.cts +4 -0
  81. package/dist/wasm.d.ts +4 -0
  82. package/dist/web-types.json +115 -69
  83. package/package.json +1 -1
  84. package/src/app.ts +4 -0
  85. package/src/asset.ts +13 -4
  86. package/src/components/anim-clip.ts +4 -0
  87. package/src/components/anim-component.ts +5 -0
  88. package/src/components/audio-listener-component.ts +4 -0
  89. package/src/components/button-component.ts +5 -0
  90. package/src/components/camera-component.ts +63 -6
  91. package/src/components/collision-component.ts +4 -0
  92. package/src/components/element-component.ts +4 -0
  93. package/src/components/gsplat-component.ts +4 -0
  94. package/src/components/joint-component.ts +12 -2
  95. package/src/components/layout-child-component.ts +4 -0
  96. package/src/components/layout-group-component.ts +4 -0
  97. package/src/components/light-component.ts +108 -17
  98. package/src/components/particle-system-component.ts +4 -0
  99. package/src/components/render-component.ts +5 -0
  100. package/src/components/rigid-body-component.ts +5 -0
  101. package/src/components/screen-component.ts +4 -0
  102. package/src/components/script-component.ts +3 -0
  103. package/src/components/script-instance.ts +4 -0
  104. package/src/components/scroll-view-component.ts +4 -0
  105. package/src/components/scrollbar-component.ts +4 -0
  106. package/src/components/sound-component.ts +4 -0
  107. package/src/components/sound-slot.ts +3 -0
  108. package/src/entity-base.ts +2 -2
  109. package/src/entity-owner.ts +2 -2
  110. package/src/entity.ts +6 -1
  111. package/src/index.ts +12 -1
  112. package/src/material.ts +19 -8
  113. package/src/model.ts +5 -0
  114. package/src/node.ts +6 -1
  115. package/src/scene.ts +3 -0
  116. package/src/sky.ts +4 -0
  117. package/src/wasm.ts +4 -0
package/dist/entity.d.cts CHANGED
@@ -7,9 +7,14 @@ import { EntityOwnerElement } from './entity-owner.cjs';
7
7
  *
8
8
  * The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
9
9
  * intersects this entity's geometry. They are only generated while the entity has a listener for
10
- * them, registered either with {@link addEventListener} or with the matching inline `onpointer*`
10
+ * them, registered either with {@link EventTarget.addEventListener} or with the matching inline `onpointer*`
11
11
  * attribute.
12
12
  *
13
+ * @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
14
+ * scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
15
+ * `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
16
+ * `<pc-model>` or a `<pc-node>` to parent it there.
17
+ *
13
18
  * @attribute {boolean} enabled - The enabled state of the entity.
14
19
  * @attribute {string} name - The name of the entity.
15
20
  * @attribute {string} position - The position of the entity.
package/dist/entity.d.ts CHANGED
@@ -7,9 +7,14 @@ import { EntityOwnerElement } from './entity-owner.js';
7
7
  *
8
8
  * The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
9
9
  * intersects this entity's geometry. They are only generated while the entity has a listener for
10
- * them, registered either with {@link addEventListener} or with the matching inline `onpointer*`
10
+ * them, registered either with {@link EventTarget.addEventListener} or with the matching inline `onpointer*`
11
11
  * attribute.
12
12
  *
13
+ * @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
14
+ * scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
15
+ * `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
16
+ * `<pc-model>` or a `<pc-node>` to parent it there.
17
+ *
13
18
  * @attribute {boolean} enabled - The enabled state of the entity.
14
19
  * @attribute {string} name - The name of the entity.
15
20
  * @attribute {string} position - The position of the entity.
package/dist/index.d.cts CHANGED
@@ -84,6 +84,9 @@ declare global {
84
84
  }
85
85
  }
86
86
  export { AsyncElement, WasmElement, AppElement, EntityElement, AssetElement, AnimComponentElement, AnimClipElement, ButtonComponentElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, JointComponentElement, LayoutChildComponentElement, LayoutGroupComponentElement, ParticleSystemComponentElement, LightComponentElement, AudioListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScreenComponentElement, ScrollbarComponentElement, ScrollViewComponentElement, ScriptComponentElement, ScriptInstanceElement, SoundComponentElement, SoundSlotElement, GSplatComponentElement, EntityBaseElement, EntityOwnerElement, MaterialElement, ModelElement, NodeElement, SceneElement, SkyElement, whenReady };
87
+ export type { AddressMode, MagFilterMode, MinFilterMode } from './asset.cjs';
87
88
  export type { AsyncElementTagName } from './async-element.cjs';
89
+ export type { JointType, MotionMode } from './components/joint-component.cjs';
90
+ export type { BlendType, ColorChannel, CullMode, FresnelModel, OccludeSpecular, OpacityDither, ScalarChannel } from './material.cjs';
88
91
  export type { HierarchyMaterial, HierarchyNode } from './model.cjs';
89
- export type { MaterialOverrides } from './node.cjs';
92
+ export type { MaterialOverrides, NodeBindingState } from './node.cjs';
package/dist/index.d.ts CHANGED
@@ -84,6 +84,9 @@ declare global {
84
84
  }
85
85
  }
86
86
  export { AsyncElement, WasmElement, AppElement, EntityElement, AssetElement, AnimComponentElement, AnimClipElement, ButtonComponentElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, JointComponentElement, LayoutChildComponentElement, LayoutGroupComponentElement, ParticleSystemComponentElement, LightComponentElement, AudioListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScreenComponentElement, ScrollbarComponentElement, ScrollViewComponentElement, ScriptComponentElement, ScriptInstanceElement, SoundComponentElement, SoundSlotElement, GSplatComponentElement, EntityBaseElement, EntityOwnerElement, MaterialElement, ModelElement, NodeElement, SceneElement, SkyElement, whenReady };
87
+ export type { AddressMode, MagFilterMode, MinFilterMode } from './asset.js';
87
88
  export type { AsyncElementTagName } from './async-element.js';
89
+ export type { JointType, MotionMode } from './components/joint-component.js';
90
+ export type { BlendType, ColorChannel, CullMode, FresnelModel, OccludeSpecular, OpacityDither, ScalarChannel } from './material.js';
88
91
  export type { HierarchyMaterial, HierarchyNode } from './model.js';
89
- export type { MaterialOverrides } from './node.js';
92
+ export type { MaterialOverrides, NodeBindingState } from './node.js';
@@ -1,11 +1,18 @@
1
1
  import { Color, StandardMaterial, Vec2 } from 'playcanvas';
2
- type BlendType = 'none' | 'normal' | 'additive' | 'additive-alpha' | 'premultiplied' | 'multiplicative' | 'multiplicative-2x' | 'screen' | 'min' | 'max' | 'subtractive';
3
- type CullMode = 'none' | 'back' | 'front' | 'front-and-back';
4
- type FresnelModel = 'none' | 'schlick';
5
- type OccludeSpecular = 'none' | 'ao' | 'gloss-dependent';
6
- type OpacityDither = 'none' | 'bayer8' | 'bluenoise' | 'ignnoise';
7
- type ColorChannel = 'r' | 'g' | 'b' | 'a' | 'rgb';
8
- type ScalarChannel = 'r' | 'g' | 'b' | 'a';
2
+ /** The blend modes for a material. */
3
+ export type BlendType = 'none' | 'normal' | 'additive' | 'additive-alpha' | 'premultiplied' | 'multiplicative' | 'multiplicative-2x' | 'screen' | 'min' | 'max' | 'subtractive';
4
+ /** The face culling modes for a material. */
5
+ export type CullMode = 'none' | 'back' | 'front' | 'front-and-back';
6
+ /** The Fresnel models for a material. */
7
+ export type FresnelModel = 'none' | 'schlick';
8
+ /** The specular occlusion modes for a material. */
9
+ export type OccludeSpecular = 'none' | 'ao' | 'gloss-dependent';
10
+ /** The opacity dithering modes for a material. */
11
+ export type OpacityDither = 'none' | 'bayer8' | 'bluenoise' | 'ignnoise';
12
+ /** The texture channels a color map can sample. */
13
+ export type ColorChannel = 'r' | 'g' | 'b' | 'a' | 'rgb';
14
+ /** The texture channels a scalar map can sample. */
15
+ export type ScalarChannel = 'r' | 'g' | 'b' | 'a';
9
16
  /**
10
17
  * The MaterialElement interface provides properties and methods for manipulating
11
18
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/ | `<pc-material>`} elements.
@@ -30,6 +37,10 @@ type ScalarChannel = 'r' | 'g' | 'b' | 'a';
30
37
  * The two aliases are documented here rather than on an accessor, because they resolve to the
31
38
  * `gloss` properties and would otherwise inherit gloss's description - which reads inverted.
32
39
  *
40
+ * @elementSummary The `<pc-material>` element defines a physically based material, which
41
+ * `<pc-render>` elements apply by naming its `id`. It is metal/rough by default, with `metalness`
42
+ * starting at 0. Must be a direct child of `<pc-app>`.
43
+ *
33
44
  * @attribute {number} roughness - The roughness of the material, from 0 (shiny) to 1 (rough). An
34
45
  * alias for `gloss` that also inverts it, so do not combine it with the `gloss` attributes.
35
46
  * @attribute {string} roughness-map - The id of the `pc-asset` to use as the roughness map. An
@@ -1,11 +1,18 @@
1
1
  import { Color, StandardMaterial, Vec2 } from 'playcanvas';
2
- type BlendType = 'none' | 'normal' | 'additive' | 'additive-alpha' | 'premultiplied' | 'multiplicative' | 'multiplicative-2x' | 'screen' | 'min' | 'max' | 'subtractive';
3
- type CullMode = 'none' | 'back' | 'front' | 'front-and-back';
4
- type FresnelModel = 'none' | 'schlick';
5
- type OccludeSpecular = 'none' | 'ao' | 'gloss-dependent';
6
- type OpacityDither = 'none' | 'bayer8' | 'bluenoise' | 'ignnoise';
7
- type ColorChannel = 'r' | 'g' | 'b' | 'a' | 'rgb';
8
- type ScalarChannel = 'r' | 'g' | 'b' | 'a';
2
+ /** The blend modes for a material. */
3
+ export type BlendType = 'none' | 'normal' | 'additive' | 'additive-alpha' | 'premultiplied' | 'multiplicative' | 'multiplicative-2x' | 'screen' | 'min' | 'max' | 'subtractive';
4
+ /** The face culling modes for a material. */
5
+ export type CullMode = 'none' | 'back' | 'front' | 'front-and-back';
6
+ /** The Fresnel models for a material. */
7
+ export type FresnelModel = 'none' | 'schlick';
8
+ /** The specular occlusion modes for a material. */
9
+ export type OccludeSpecular = 'none' | 'ao' | 'gloss-dependent';
10
+ /** The opacity dithering modes for a material. */
11
+ export type OpacityDither = 'none' | 'bayer8' | 'bluenoise' | 'ignnoise';
12
+ /** The texture channels a color map can sample. */
13
+ export type ColorChannel = 'r' | 'g' | 'b' | 'a' | 'rgb';
14
+ /** The texture channels a scalar map can sample. */
15
+ export type ScalarChannel = 'r' | 'g' | 'b' | 'a';
9
16
  /**
10
17
  * The MaterialElement interface provides properties and methods for manipulating
11
18
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/ | `<pc-material>`} elements.
@@ -30,6 +37,10 @@ type ScalarChannel = 'r' | 'g' | 'b' | 'a';
30
37
  * The two aliases are documented here rather than on an accessor, because they resolve to the
31
38
  * `gloss` properties and would otherwise inherit gloss's description - which reads inverted.
32
39
  *
40
+ * @elementSummary The `<pc-material>` element defines a physically based material, which
41
+ * `<pc-render>` elements apply by naming its `id`. It is metal/rough by default, with `metalness`
42
+ * starting at 0. Must be a direct child of `<pc-app>`.
43
+ *
33
44
  * @attribute {number} roughness - The roughness of the material, from 0 (shiny) to 1 (rough). An
34
45
  * alias for `gloss` that also inverts it, so do not combine it with the `gloss` attributes.
35
46
  * @attribute {string} roughness-map - The id of the `pc-asset` to use as the roughness map. An
package/dist/model.d.cts CHANGED
@@ -79,6 +79,11 @@ type HierarchyNode = {
79
79
  * intersects the model's geometry, exactly as for `<pc-entity>` — a hit on a content node that no
80
80
  * `pc-node` fronts resolves to this element.
81
81
  *
82
+ * @elementSummary The `<pc-model>` element instantiates a 3D model from a container asset
83
+ * (typically a GLB) beneath an entity of its own, so the element's transform and tags place the
84
+ * instance in the scene. Its `<pc-node>` children override what the asset authored. Place it in the
85
+ * `<pc-scene>`, or nest it under a `<pc-entity>`, another `<pc-model>` or a `<pc-node>`.
86
+ *
82
87
  * @attribute {boolean} enabled - The enabled state of the model.
83
88
  * @attribute {string} name - The name of the model.
84
89
  * @attribute {string} position - The position of the model.
package/dist/model.d.ts CHANGED
@@ -79,6 +79,11 @@ type HierarchyNode = {
79
79
  * intersects the model's geometry, exactly as for `<pc-entity>` — a hit on a content node that no
80
80
  * `pc-node` fronts resolves to this element.
81
81
  *
82
+ * @elementSummary The `<pc-model>` element instantiates a 3D model from a container asset
83
+ * (typically a GLB) beneath an entity of its own, so the element's transform and tags place the
84
+ * instance in the scene. Its `<pc-node>` children override what the asset authored. Place it in the
85
+ * `<pc-scene>`, or nest it under a `<pc-entity>`, another `<pc-model>` or a `<pc-node>`.
86
+ *
82
87
  * @attribute {boolean} enabled - The enabled state of the model.
83
88
  * @attribute {string} name - The name of the model.
84
89
  * @attribute {string} position - The position of the model.
package/dist/node.d.cts CHANGED
@@ -6,7 +6,7 @@ import { EntityBaseElement } from './entity-base.cjs';
6
6
  * `missing`/`ambiguous`/`duplicate` when resolution failed — each accompanied by a warning
7
7
  * naming the cause.
8
8
  */
9
- type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
9
+ export type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
10
10
  /**
11
11
  * A sparse mapping from selector to `pc-material` id, as carried by the `material-overrides`
12
12
  * attribute and `materialOverrides` property. A `name:X` key selects every mesh instance of the
@@ -38,6 +38,11 @@ type MaterialOverrides = Readonly<Record<string, string>>;
38
38
  * The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
39
39
  * intersects the bound node's geometry, exactly as for `<pc-entity>`.
40
40
  *
41
+ * @elementSummary The `<pc-node>` element binds to a node inside the hierarchy a `<pc-model>`
42
+ * instantiated and declares overrides against it: a transform, an enabled state, tags, components
43
+ * to add, or content to attach. Its `name` is a lookup, never a rename. Must be a descendant of
44
+ * `<pc-model>`.
45
+ *
41
46
  * @attribute {string} name - The name of the node to bind, resolved within the nearest ancestor
42
47
  * `pc-model` (or `pc-node`) once it has instantiated.
43
48
  * @attribute {number} index - Which match to bind when `name` matches more than one node,
package/dist/node.d.ts CHANGED
@@ -6,7 +6,7 @@ import { EntityBaseElement } from './entity-base.js';
6
6
  * `missing`/`ambiguous`/`duplicate` when resolution failed — each accompanied by a warning
7
7
  * naming the cause.
8
8
  */
9
- type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
9
+ export type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
10
10
  /**
11
11
  * A sparse mapping from selector to `pc-material` id, as carried by the `material-overrides`
12
12
  * attribute and `materialOverrides` property. A `name:X` key selects every mesh instance of the
@@ -38,6 +38,11 @@ type MaterialOverrides = Readonly<Record<string, string>>;
38
38
  * The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
39
39
  * intersects the bound node's geometry, exactly as for `<pc-entity>`.
40
40
  *
41
+ * @elementSummary The `<pc-node>` element binds to a node inside the hierarchy a `<pc-model>`
42
+ * instantiated and declares overrides against it: a transform, an enabled state, tags, components
43
+ * to add, or content to attach. Its `name` is a lookup, never a rename. Must be a descendant of
44
+ * `<pc-model>`.
45
+ *
41
46
  * @attribute {string} name - The name of the node to bind, resolved within the nearest ancestor
42
47
  * `pc-model` (or `pc-node`) once it has instantiated.
43
48
  * @attribute {number} index - Which match to bind when `name` matches more than one node,