@playcanvas/web-components 0.1.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.
@@ -0,0 +1,86 @@
1
+ import { RigidBodyComponent, Vec3 } from 'playcanvas';
2
+ import { ComponentElement } from './component';
3
+ /**
4
+ * Represents a rigidbody component in the PlayCanvas engine.
5
+ *
6
+ * @category Components
7
+ */
8
+ declare class RigidBodyComponentElement extends ComponentElement {
9
+ /**
10
+ * The angular damping of the rigidbody.
11
+ */
12
+ private _angularDamping;
13
+ /**
14
+ * The angular factor of the rigidbody.
15
+ */
16
+ private _angularFactor;
17
+ /**
18
+ * The friction of the rigidbody.
19
+ */
20
+ private _friction;
21
+ /**
22
+ * The linear damping of the rigidbody.
23
+ */
24
+ private _linearDamping;
25
+ /**
26
+ * The linear factor of the rigidbody.
27
+ */
28
+ private _linearFactor;
29
+ /**
30
+ * The mass of the rigidbody.
31
+ */
32
+ private _mass;
33
+ /**
34
+ * The restitution of the rigidbody.
35
+ */
36
+ private _restitution;
37
+ /**
38
+ * The rolling friction of the rigidbody.
39
+ */
40
+ private _rollingFriction;
41
+ /**
42
+ * The type of the rigidbody.
43
+ */
44
+ private _type;
45
+ /**
46
+ * Creates a new RigidBodyComponentElement.
47
+ */
48
+ constructor();
49
+ getInitialComponentData(): {
50
+ angularDamping: number;
51
+ angularFactor: Vec3;
52
+ friction: number;
53
+ linearDamping: number;
54
+ linearFactor: Vec3;
55
+ mass: number;
56
+ restitution: number;
57
+ rollingFriction: number;
58
+ type: string;
59
+ };
60
+ /**
61
+ * Gets the collision component.
62
+ * @returns The collision component.
63
+ */
64
+ get component(): RigidBodyComponent | null;
65
+ set angularDamping(value: number);
66
+ get angularDamping(): number;
67
+ set angularFactor(value: Vec3);
68
+ get angularFactor(): Vec3;
69
+ set friction(value: number);
70
+ get friction(): number;
71
+ set linearDamping(value: number);
72
+ get linearDamping(): number;
73
+ set linearFactor(value: Vec3);
74
+ get linearFactor(): Vec3;
75
+ set mass(value: number);
76
+ get mass(): number;
77
+ set restitution(value: number);
78
+ get restitution(): number;
79
+ set rollingFriction(value: number);
80
+ get rollingFriction(): number;
81
+ set type(value: string);
82
+ get type(): string;
83
+ static get observedAttributes(): string[];
84
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
85
+ }
86
+ export { RigidBodyComponentElement };
@@ -0,0 +1,16 @@
1
+ import { ScriptComponent } from 'playcanvas';
2
+ import { ComponentElement } from './component';
3
+ /**
4
+ * Represents a script component in the PlayCanvas engine.
5
+ *
6
+ * @category Components
7
+ */
8
+ declare class ScriptComponentElement extends ComponentElement {
9
+ constructor();
10
+ /**
11
+ * Gets the script component.
12
+ * @returns The script component.
13
+ */
14
+ get component(): ScriptComponent | null;
15
+ }
16
+ export { ScriptComponentElement };
@@ -0,0 +1,35 @@
1
+ import { ScriptComponentElement } from './script-component';
2
+ /**
3
+ * Represents a script in the PlayCanvas engine.
4
+ */
5
+ declare class ScriptElement extends HTMLElement {
6
+ private _attributes;
7
+ private _enabled;
8
+ private _name;
9
+ private _script;
10
+ connectedCallback(): Promise<void>;
11
+ disconnectedCallback(): void;
12
+ refreshAttributes(): void;
13
+ protected get scriptsElement(): ScriptComponentElement | null;
14
+ set scriptAttributes(value: string);
15
+ get scriptAttributes(): string;
16
+ set enabled(value: boolean);
17
+ /**
18
+ * Gets the enabled state of the script.
19
+ * @returns The enabled state of the script.
20
+ */
21
+ get enabled(): boolean;
22
+ /**
23
+ * Sets the name of the script to create.
24
+ * @param value - The name.
25
+ */
26
+ set name(value: string);
27
+ /**
28
+ * Gets the name of the script.
29
+ * @returns The name.
30
+ */
31
+ get name(): string;
32
+ static get observedAttributes(): string[];
33
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
34
+ }
35
+ export { ScriptElement };
@@ -0,0 +1,56 @@
1
+ import { SoundComponent } from 'playcanvas';
2
+ import { ComponentElement } from './component';
3
+ /**
4
+ * Represents a sound component in the PlayCanvas engine.
5
+ *
6
+ * @category Components
7
+ */
8
+ declare class SoundComponentElement extends ComponentElement {
9
+ private _pitch;
10
+ private _positional;
11
+ private _volume;
12
+ constructor();
13
+ getInitialComponentData(): {
14
+ pitch: number;
15
+ positional: boolean;
16
+ volume: number;
17
+ };
18
+ /**
19
+ * Gets the sound component.
20
+ * @returns The sound component.
21
+ */
22
+ get component(): SoundComponent | null;
23
+ /**
24
+ * Sets the pitch of the sound.
25
+ * @param value - The pitch.
26
+ */
27
+ set pitch(value: number);
28
+ /**
29
+ * Gets the pitch of the sound.
30
+ * @returns The pitch.
31
+ */
32
+ get pitch(): number;
33
+ /**
34
+ * Sets the positional flag of the sound.
35
+ * @param value - The positional flag.
36
+ */
37
+ set positional(value: boolean);
38
+ /**
39
+ * Gets the positional flag of the sound.
40
+ * @returns The positional flag.
41
+ */
42
+ get positional(): boolean;
43
+ /**
44
+ * Sets the volume of the sound.
45
+ * @param value - The volume.
46
+ */
47
+ set volume(value: number);
48
+ /**
49
+ * Gets the volume of the sound.
50
+ * @returns The volume.
51
+ */
52
+ get volume(): number;
53
+ static get observedAttributes(): string[];
54
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
55
+ }
56
+ export { SoundComponentElement };
@@ -0,0 +1,117 @@
1
+ import { SoundSlot } from 'playcanvas';
2
+ import { SoundComponentElement } from './sound-component';
3
+ /**
4
+ * Represents a sound slot in the PlayCanvas engine.
5
+ */
6
+ declare class SoundSlotElement extends HTMLElement {
7
+ private _asset;
8
+ private _autoPlay;
9
+ private _duration;
10
+ private _loop;
11
+ private _name;
12
+ private _overlap;
13
+ private _pitch;
14
+ private _startTime;
15
+ private _volume;
16
+ /**
17
+ * The sound slot.
18
+ */
19
+ soundSlot: SoundSlot | null;
20
+ getAsset(): import("playcanvas").Asset | null;
21
+ connectedCallback(): Promise<void>;
22
+ disconnectedCallback(): void;
23
+ protected get soundElement(): SoundComponentElement | null;
24
+ /**
25
+ * Sets the asset of the sound slot.
26
+ * @param value - The asset.
27
+ */
28
+ set asset(value: string);
29
+ /**
30
+ * Gets the asset of the sound slot.
31
+ * @returns The asset.
32
+ */
33
+ get asset(): string;
34
+ /**
35
+ * Sets the auto play flag of the sound slot.
36
+ * @param value - The auto play flag.
37
+ */
38
+ set autoPlay(value: boolean);
39
+ /**
40
+ * Gets the auto play flag of the sound slot.
41
+ * @returns The auto play flag.
42
+ */
43
+ get autoPlay(): boolean;
44
+ /**
45
+ * Sets the duration of the sound slot.
46
+ * @param value - The duration.
47
+ */
48
+ set duration(value: number);
49
+ /**
50
+ * Gets the duration of the sound slot.
51
+ * @returns The duration.
52
+ */
53
+ get duration(): number;
54
+ /**
55
+ * Sets the loop flag of the sound slot.
56
+ * @param value - The loop flag.
57
+ */
58
+ set loop(value: boolean);
59
+ /**
60
+ * Gets the loop flag of the sound slot.
61
+ * @returns The loop flag.
62
+ */
63
+ get loop(): boolean;
64
+ /**
65
+ * Sets the name of the sound slot.
66
+ * @param value - The name.
67
+ */
68
+ set name(value: string);
69
+ /**
70
+ * Gets the name of the sound slot.
71
+ * @returns The name.
72
+ */
73
+ get name(): string;
74
+ /**
75
+ * Sets the overlap flag of the sound slot.
76
+ * @param value - The overlap flag.
77
+ */
78
+ set overlap(value: boolean);
79
+ /**
80
+ * Gets the overlap flag of the sound slot.
81
+ * @returns The overlap flag.
82
+ */
83
+ get overlap(): boolean;
84
+ /**
85
+ * Sets the pitch of the sound slot.
86
+ * @param value - The pitch.
87
+ */
88
+ set pitch(value: number);
89
+ /**
90
+ * Gets the pitch of the sound slot.
91
+ * @returns The pitch.
92
+ */
93
+ get pitch(): number;
94
+ /**
95
+ * Sets the start time of the sound slot.
96
+ * @param value - The start time.
97
+ */
98
+ set startTime(value: number);
99
+ /**
100
+ * Gets the start time of the sound slot.
101
+ * @returns The start time.
102
+ */
103
+ get startTime(): number;
104
+ /**
105
+ * Sets the volume of the sound slot.
106
+ * @param value - The volume.
107
+ */
108
+ set volume(value: number);
109
+ /**
110
+ * Gets the volume of the sound slot.
111
+ * @returns The volume.
112
+ */
113
+ get volume(): number;
114
+ static get observedAttributes(): string[];
115
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
116
+ }
117
+ export { SoundSlotElement };
@@ -0,0 +1,99 @@
1
+ import { Entity, Vec3 } from 'playcanvas';
2
+ /**
3
+ * Represents an entity in the PlayCanvas engine.
4
+ */
5
+ declare class EntityElement extends HTMLElement {
6
+ /**
7
+ * Whether the entity is enabled.
8
+ */
9
+ private _enabled;
10
+ /**
11
+ * The name of the entity.
12
+ */
13
+ private _name;
14
+ /**
15
+ * The position of the entity.
16
+ */
17
+ private _position;
18
+ /**
19
+ * The rotation of the entity.
20
+ */
21
+ private _rotation;
22
+ /**
23
+ * The scale of the entity.
24
+ */
25
+ private _scale;
26
+ /**
27
+ * The tags of the entity.
28
+ */
29
+ private _tags;
30
+ /**
31
+ * The PlayCanvas entity instance.
32
+ */
33
+ entity: Entity | null;
34
+ connectedCallback(): Promise<void>;
35
+ disconnectedCallback(): void;
36
+ /**
37
+ * Sets the enabled state of the entity.
38
+ * @param value - Whether the entity is enabled.
39
+ */
40
+ set enabled(value: boolean);
41
+ /**
42
+ * Gets the enabled state of the entity.
43
+ * @returns Whether the entity is enabled.
44
+ */
45
+ get enabled(): boolean;
46
+ /**
47
+ * Sets the name of the entity.
48
+ * @param value - The name of the entity.
49
+ */
50
+ set name(value: string);
51
+ /**
52
+ * Gets the name of the entity.
53
+ * @returns The name of the entity.
54
+ */
55
+ get name(): string;
56
+ /**
57
+ * Sets the position of the entity.
58
+ * @param value - The position of the entity.
59
+ */
60
+ set position(value: Vec3);
61
+ /**
62
+ * Gets the position of the entity.
63
+ * @returns The position of the entity.
64
+ */
65
+ get position(): Vec3;
66
+ /**
67
+ * Sets the rotation of the entity.
68
+ * @param value - The rotation of the entity.
69
+ */
70
+ set rotation(value: Vec3);
71
+ /**
72
+ * Gets the rotation of the entity.
73
+ * @returns The rotation of the entity.
74
+ */
75
+ get rotation(): Vec3;
76
+ /**
77
+ * Sets the scale of the entity.
78
+ * @param value - The scale of the entity.
79
+ */
80
+ set scale(value: Vec3);
81
+ /**
82
+ * Gets the scale of the entity.
83
+ * @returns The scale of the entity.
84
+ */
85
+ get scale(): Vec3;
86
+ /**
87
+ * Sets the tags of the entity.
88
+ * @param value - The tags of the entity.
89
+ */
90
+ set tags(value: string[]);
91
+ /**
92
+ * Gets the tags of the entity.
93
+ * @returns The tags of the entity.
94
+ */
95
+ get tags(): string[];
96
+ static get observedAttributes(): string[];
97
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
98
+ }
99
+ export { EntityElement };
@@ -0,0 +1,21 @@
1
+ import { ModuleElement } from './module';
2
+ import { AppElement } from './app';
3
+ import { EntityElement } from './entity';
4
+ import { AssetElement } from './asset';
5
+ import { ListenerComponentElement } from './components/listener-component';
6
+ import { CameraComponentElement } from './components/camera-component';
7
+ import { CollisionComponentElement } from './components/collision-component';
8
+ import { ComponentElement } from './components/component';
9
+ import { ElementComponentElement } from './components/element-component';
10
+ import { GSplatComponentElement } from './components/gsplat-component';
11
+ import { LightComponentElement } from './components/light-component';
12
+ import { RenderComponentElement } from './components/render-component';
13
+ import { RigidBodyComponentElement } from './components/rigidbody-component';
14
+ import { ScriptComponentElement } from './components/script-component';
15
+ import { ScriptElement } from './components/script';
16
+ import { SoundComponentElement } from './components/sound-component';
17
+ import { SoundSlotElement } from './components/sound-slot';
18
+ import { ModelElement } from './model';
19
+ import { SceneElement } from './scene';
20
+ import { SkyElement } from './sky';
21
+ export { ModuleElement, AppElement, EntityElement, AssetElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, GSplatComponentElement, LightComponentElement, ListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScriptComponentElement, ScriptElement, SoundComponentElement, SoundSlotElement, ModelElement, SceneElement, SkyElement };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Represents a model in the PlayCanvas engine.
3
+ */
4
+ declare class ModelElement extends HTMLElement {
5
+ private _asset;
6
+ connectedCallback(): Promise<void>;
7
+ getAsset(): import("playcanvas").Asset | null;
8
+ _loadModel(): void;
9
+ /**
10
+ * Sets the asset ID of the model.
11
+ * @param value - The asset ID.
12
+ */
13
+ set asset(value: string);
14
+ /**
15
+ * Gets the source URL of the model.
16
+ * @returns The source URL of the model.
17
+ */
18
+ get asset(): string;
19
+ static get observedAttributes(): string[];
20
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
21
+ }
22
+ export { ModelElement };
@@ -0,0 +1,7 @@
1
+ declare class ModuleElement extends HTMLElement {
2
+ private loadPromise;
3
+ constructor();
4
+ private loadModule;
5
+ getLoadPromise(): Promise<void>;
6
+ }
7
+ export { ModuleElement };