@playcanvas/web-components 0.1.7 → 0.1.9

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 (55) hide show
  1. package/dist/app.d.ts +10 -1
  2. package/dist/asset.d.ts +3 -1
  3. package/dist/async-element.d.ts +2 -1
  4. package/dist/components/camera-component.d.ts +4 -4
  5. package/dist/components/collision-component.d.ts +4 -4
  6. package/dist/components/component.d.ts +3 -1
  7. package/dist/components/element-component.d.ts +4 -1
  8. package/dist/components/gsplat-component.d.ts +4 -1
  9. package/dist/components/light-component.d.ts +16 -4
  10. package/dist/components/listener-component.d.ts +4 -1
  11. package/dist/components/render-component.d.ts +4 -1
  12. package/dist/components/rigidbody-component.d.ts +4 -4
  13. package/dist/components/screen-component.d.ts +4 -1
  14. package/dist/components/script-component.d.ts +4 -1
  15. package/dist/components/script.d.ts +3 -1
  16. package/dist/components/sound-component.d.ts +4 -1
  17. package/dist/components/sound-slot.d.ts +3 -1
  18. package/dist/entity.d.ts +7 -3
  19. package/dist/material.d.ts +3 -1
  20. package/dist/model.d.ts +3 -1
  21. package/dist/module.d.ts +6 -0
  22. package/dist/pwc.cjs +195 -75
  23. package/dist/pwc.cjs.map +1 -1
  24. package/dist/pwc.js +195 -75
  25. package/dist/pwc.js.map +1 -1
  26. package/dist/pwc.min.js +1 -1
  27. package/dist/pwc.min.js.map +1 -1
  28. package/dist/pwc.mjs +196 -76
  29. package/dist/pwc.mjs.map +1 -1
  30. package/dist/scene.d.ts +3 -1
  31. package/dist/sky.d.ts +4 -2
  32. package/package.json +15 -13
  33. package/src/app.ts +28 -1
  34. package/src/asset.ts +3 -1
  35. package/src/async-element.ts +2 -1
  36. package/src/components/camera-component.ts +4 -4
  37. package/src/components/collision-component.ts +4 -4
  38. package/src/components/component.ts +3 -1
  39. package/src/components/element-component.ts +4 -2
  40. package/src/components/gsplat-component.ts +4 -1
  41. package/src/components/light-component.ts +30 -4
  42. package/src/components/listener-component.ts +4 -1
  43. package/src/components/render-component.ts +4 -1
  44. package/src/components/rigidbody-component.ts +4 -4
  45. package/src/components/screen-component.ts +4 -1
  46. package/src/components/script-component.ts +15 -1
  47. package/src/components/script.ts +3 -1
  48. package/src/components/sound-component.ts +4 -1
  49. package/src/components/sound-slot.ts +3 -1
  50. package/src/entity.ts +59 -27
  51. package/src/material.ts +3 -1
  52. package/src/model.ts +3 -1
  53. package/src/module.ts +6 -0
  54. package/src/scene.ts +13 -11
  55. package/src/sky.ts +5 -2
package/dist/app.d.ts CHANGED
@@ -13,12 +13,15 @@ declare class AppElement extends AsyncElement {
13
13
  private _depth;
14
14
  private _stencil;
15
15
  private _highResolution;
16
+ private _hierarchyReady;
16
17
  /**
17
18
  * The PlayCanvas application instance.
18
19
  */
19
20
  app: Application | null;
20
21
  /**
21
- * Creates a new AppElement.
22
+ * Creates a new AppElement instance.
23
+ *
24
+ * @ignore
22
25
  */
23
26
  constructor();
24
27
  connectedCallback(): Promise<void>;
@@ -54,6 +57,12 @@ declare class AppElement extends AsyncElement {
54
57
  * @returns The depth flag.
55
58
  */
56
59
  get depth(): boolean;
60
+ /**
61
+ * Gets the hierarchy ready flag.
62
+ * @returns The hierarchy ready flag.
63
+ * @ignore
64
+ */
65
+ get hierarchyReady(): boolean;
57
66
  /**
58
67
  * Sets the high resolution flag. When true, the application will render at the device's
59
68
  * physical resolution. When false, the application will render at CSS resolution.
package/dist/asset.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Asset } from 'playcanvas';
2
2
  /**
3
- * Loads an asset into the PlayCanvas engine.
3
+ * The AssetElement interface provides properties and methods for manipulating
4
+ * `<pc-asset>` elements. The AssetElement interface also inherits the properties and
5
+ * methods of the {@link HTMLElement} interface.
4
6
  */
5
7
  declare class AssetElement extends HTMLElement {
6
8
  private _preload;
@@ -1,11 +1,12 @@
1
1
  import { AppElement } from './app';
2
2
  import { EntityElement } from './entity';
3
3
  /**
4
- * Base class for all PlayCanvas web components that initialize asynchronously.
4
+ * Base class for all PlayCanvas Web Components that initialize asynchronously.
5
5
  */
6
6
  declare class AsyncElement extends HTMLElement {
7
7
  private _readyPromise;
8
8
  private _readyResolve;
9
+ /** @ignore */
9
10
  constructor();
10
11
  get closestApp(): AppElement;
11
12
  get closestEntity(): EntityElement;
@@ -1,7 +1,9 @@
1
1
  import { CameraComponent, Color, Vec4 } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a camera component in the PlayCanvas engine.
4
+ * The CameraComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -21,9 +23,7 @@ declare class CameraComponentElement extends ComponentElement {
21
23
  private _priority;
22
24
  private _rect;
23
25
  private _scissorRect;
24
- /**
25
- * Creates a new CameraComponentElement.
26
- */
26
+ /** @ignore */
27
27
  constructor();
28
28
  getInitialComponentData(): {
29
29
  clearColor: Color;
@@ -1,7 +1,9 @@
1
1
  import { CollisionComponent, Quat, Vec3 } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a collision component in the PlayCanvas engine.
4
+ * The CollisionComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
6
+ * and methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -14,9 +16,7 @@ declare class CollisionComponentElement extends ComponentElement {
14
16
  private _linearOffset;
15
17
  private _radius;
16
18
  private _type;
17
- /**
18
- * Creates a new CollisionComponentElement.
19
- */
19
+ /** @ignore */
20
20
  constructor();
21
21
  getInitialComponentData(): {
22
22
  axis: number;
@@ -10,8 +10,10 @@ declare class ComponentElement extends AsyncElement {
10
10
  private _enabled;
11
11
  private _component;
12
12
  /**
13
- * Constructor for the ComponentElement.
13
+ * Creates a new ComponentElement instance.
14
+ *
14
15
  * @param componentName - The name of the component.
16
+ * @ignore
15
17
  */
16
18
  constructor(componentName: string);
17
19
  getInitialComponentData(): {};
@@ -1,7 +1,9 @@
1
1
  import { Color, ElementComponent, Vec2, Vec4 } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents an element component in the PlayCanvas engine.
4
+ * The ElementComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -17,6 +19,7 @@ declare class ElementComponentElement extends ComponentElement {
17
19
  private _type;
18
20
  private _width;
19
21
  private _wrapLines;
22
+ /** @ignore */
20
23
  constructor();
21
24
  initComponent(): void;
22
25
  getInitialComponentData(): {
@@ -1,12 +1,15 @@
1
1
  import { GSplatComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a gsplat component in the PlayCanvas engine.
4
+ * The GSplatComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
8
10
  declare class GSplatComponentElement extends ComponentElement {
9
11
  private _asset;
12
+ /** @ignore */
10
13
  constructor();
11
14
  getInitialComponentData(): {
12
15
  asset: import("playcanvas").Asset | null | undefined;
@@ -1,7 +1,9 @@
1
1
  import { Color, LightComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a light component in the PlayCanvas engine.
4
+ * The LightComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -15,10 +17,9 @@ declare class LightComponentElement extends ComponentElement {
15
17
  private _range;
16
18
  private _shadowBias;
17
19
  private _shadowDistance;
20
+ private _shadowResolution;
18
21
  private _type;
19
- /**
20
- * Creates a new LightComponentElement.
21
- */
22
+ /** @ignore */
22
23
  constructor();
23
24
  getInitialComponentData(): {
24
25
  castShadows: boolean;
@@ -30,6 +31,7 @@ declare class LightComponentElement extends ComponentElement {
30
31
  range: number;
31
32
  shadowBias: number;
32
33
  shadowDistance: number;
34
+ shadowResolution: number;
33
35
  type: string;
34
36
  };
35
37
  /**
@@ -127,6 +129,16 @@ declare class LightComponentElement extends ComponentElement {
127
129
  * @returns The shadow distance.
128
130
  */
129
131
  get shadowDistance(): number;
132
+ /**
133
+ * Sets the shadow resolution of the light.
134
+ * @param value - The shadow resolution.
135
+ */
136
+ set shadowResolution(value: number);
137
+ /**
138
+ * Gets the shadow resolution of the light.
139
+ * @returns The shadow resolution.
140
+ */
141
+ get shadowResolution(): number;
130
142
  /**
131
143
  * Sets the type of the light.
132
144
  * @param value - The type.
@@ -1,11 +1,14 @@
1
1
  import { AudioListenerComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a audio listener component in the PlayCanvas engine.
4
+ * The ListenerComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
6
+ * and methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
8
10
  declare class ListenerComponentElement extends ComponentElement {
11
+ /** @ignore */
9
12
  constructor();
10
13
  /**
11
14
  * Gets the audio listener component.
@@ -1,7 +1,9 @@
1
1
  import { RenderComponent, StandardMaterial } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a render component in the PlayCanvas engine.
4
+ * The RenderComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -10,6 +12,7 @@ declare class RenderComponentElement extends ComponentElement {
10
12
  private _material;
11
13
  private _receiveShadows;
12
14
  private _type;
15
+ /** @ignore */
13
16
  constructor();
14
17
  getInitialComponentData(): {
15
18
  type: "box" | "asset" | "capsule" | "cone" | "cylinder" | "plane" | "sphere";
@@ -1,7 +1,9 @@
1
1
  import { RigidBodyComponent, Vec3 } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a rigidbody component in the PlayCanvas engine.
4
+ * The RigidBodyComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
6
+ * and methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -42,9 +44,7 @@ declare class RigidBodyComponentElement extends ComponentElement {
42
44
  * The type of the rigidbody.
43
45
  */
44
46
  private _type;
45
- /**
46
- * Creates a new RigidBodyComponentElement.
47
- */
47
+ /** @ignore */
48
48
  constructor();
49
49
  getInitialComponentData(): {
50
50
  angularDamping: number;
@@ -1,7 +1,9 @@
1
1
  import { ScreenComponent, Vec2 } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a screen component in the PlayCanvas engine.
4
+ * The ScreenComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -12,6 +14,7 @@ declare class ScreenComponentElement extends ComponentElement {
12
14
  private _priority;
13
15
  private _blend;
14
16
  private _scaleBlend;
17
+ /** @ignore */
15
18
  constructor();
16
19
  getInitialComponentData(): {
17
20
  priority: number;
@@ -17,12 +17,15 @@ declare global {
17
17
  }
18
18
  }
19
19
  /**
20
- * Represents a script component in the PlayCanvas engine.
20
+ * The ScriptComponentElement interface provides properties and methods for manipulating
21
+ * `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
22
+ * methods of the {@link HTMLElement} interface.
21
23
  *
22
24
  * @category Components
23
25
  */
24
26
  declare class ScriptComponentElement extends ComponentElement {
25
27
  private observer;
28
+ /** @ignore */
26
29
  constructor();
27
30
  initComponent(): void;
28
31
  private applyAttributes;
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Represents a script in the PlayCanvas engine.
2
+ * The ScriptElement interface provides properties and methods for manipulating
3
+ * `<pc-script>` elements. The ScriptElement interface also inherits the properties and
4
+ * methods of the {@link HTMLElement} interface.
3
5
  */
4
6
  declare class ScriptElement extends HTMLElement {
5
7
  private _attributes;
@@ -1,7 +1,9 @@
1
1
  import { SoundComponent } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
- * Represents a sound component in the PlayCanvas engine.
4
+ * The SoundComponentElement interface provides properties and methods for manipulating
5
+ * `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  *
6
8
  * @category Components
7
9
  */
@@ -13,6 +15,7 @@ declare class SoundComponentElement extends ComponentElement {
13
15
  private _refDistance;
14
16
  private _rollOffFactor;
15
17
  private _volume;
18
+ /** @ignore */
16
19
  constructor();
17
20
  getInitialComponentData(): {
18
21
  distanceModel: "exponential" | "inverse" | "linear";
@@ -2,7 +2,9 @@ import { SoundSlot } from 'playcanvas';
2
2
  import { AsyncElement } from '../async-element';
3
3
  import { SoundComponentElement } from './sound-component';
4
4
  /**
5
- * Represents a sound slot in the PlayCanvas engine.
5
+ * The SoundSlotElement interface provides properties and methods for manipulating
6
+ * `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
7
+ * methods of the {@link AsyncElement} interface.
6
8
  */
7
9
  declare class SoundSlotElement extends AsyncElement {
8
10
  private _asset;
package/dist/entity.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { Entity, Vec3 } from 'playcanvas';
1
+ import { Application, Entity, Vec3 } from 'playcanvas';
2
2
  import { AsyncElement } from './async-element';
3
3
  /**
4
- * Represents an entity in the PlayCanvas engine.
4
+ * The EntityElement interface provides properties and methods for manipulating
5
+ * `<pc-entity>` elements. The EntityElement interface also inherits the properties and
6
+ * methods of the {@link HTMLElement} interface.
5
7
  */
6
8
  declare class EntityElement extends AsyncElement {
7
9
  /**
@@ -32,7 +34,9 @@ declare class EntityElement extends AsyncElement {
32
34
  * The PlayCanvas entity instance.
33
35
  */
34
36
  entity: Entity | null;
35
- connectedCallback(): Promise<void>;
37
+ createEntity(app: Application): void;
38
+ buildHierarchy(app: Application): void;
39
+ connectedCallback(): void;
36
40
  disconnectedCallback(): void;
37
41
  /**
38
42
  * Sets the enabled state of the entity.
@@ -1,6 +1,8 @@
1
1
  import { Color, StandardMaterial } from 'playcanvas';
2
2
  /**
3
- * Represents a material in the PlayCanvas engine.
3
+ * The MaterialElement interface provides properties and methods for manipulating
4
+ * `<pc-material>` elements. The MaterialElement interface also inherits the properties and
5
+ * methods of the {@link HTMLElement} interface.
4
6
  */
5
7
  declare class MaterialElement extends HTMLElement {
6
8
  private _diffuse;
package/dist/model.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { AsyncElement } from './async-element';
2
2
  /**
3
- * Represents a model in the PlayCanvas engine.
3
+ * The ModelElement interface provides properties and methods for manipulating
4
+ * `<pc-model>` elements. The ModelElement interface also inherits the properties and
5
+ * methods of the {@link HTMLElement} interface.
4
6
  */
5
7
  declare class ModelElement extends AsyncElement {
6
8
  private _asset;
package/dist/module.d.ts CHANGED
@@ -1,5 +1,11 @@
1
+ /**
2
+ * The ModuleElement interface provides properties and methods for manipulating
3
+ * `<pc-module>` elements. The ModuleElement interface also inherits the properties and
4
+ * methods of the {@link HTMLElement} interface.
5
+ */
1
6
  declare class ModuleElement extends HTMLElement {
2
7
  private loadPromise;
8
+ /** @ignore */
3
9
  constructor();
4
10
  private loadModule;
5
11
  getLoadPromise(): Promise<void>;