@playcanvas/web-components 0.10.1 → 0.11.1
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/README.md +1 -1
- package/dist/app.d.ts +102 -51
- package/dist/asset.d.ts +8 -7
- package/dist/async-element.d.ts +21 -5
- package/dist/components/button-component.d.ts +3 -7
- package/dist/components/camera-component.d.ts +16 -20
- package/dist/components/collision-component.d.ts +3 -7
- package/dist/components/component.d.ts +22 -4
- package/dist/components/element-component.d.ts +4 -8
- package/dist/components/gsplat-component.d.ts +2 -7
- package/dist/components/layoutchild-component.d.ts +2 -7
- package/dist/components/layoutgroup-component.d.ts +3 -7
- package/dist/components/light-component.d.ts +3 -7
- package/dist/components/listener-component.d.ts +1 -6
- package/dist/components/particlesystem-component.d.ts +2 -7
- package/dist/components/render-component.d.ts +2 -7
- package/dist/components/rigidbody-component.d.ts +3 -7
- package/dist/components/screen-component.d.ts +28 -11
- package/dist/components/script-component.d.ts +8 -20
- package/dist/components/script.d.ts +2 -22
- package/dist/components/scrollbar-component.d.ts +2 -7
- package/dist/components/scrollview-component.d.ts +9 -11
- package/dist/components/sound-component.d.ts +2 -7
- package/dist/components/sound-slot.d.ts +8 -6
- package/dist/custom-elements.json +5191 -10695
- package/dist/entity.d.ts +16 -9
- package/dist/index.d.ts +37 -0
- package/dist/material.d.ts +12 -12
- package/dist/model.d.ts +21 -5
- package/dist/module.d.ts +0 -6
- package/dist/parse.d.ts +6 -3
- package/dist/pwc.cjs +799 -287
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +799 -287
- 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 +800 -288
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +4 -7
- package/dist/sky.d.ts +25 -16
- package/dist/vscode.html-custom-data.json +65 -45
- package/dist/web-types.json +585 -557
- package/package.json +8 -7
- package/src/app.ts +326 -144
- package/src/asset.ts +34 -28
- package/src/async-element.ts +34 -8
- package/src/components/button-component.ts +5 -9
- package/src/components/camera-component.ts +55 -36
- package/src/components/collision-component.ts +26 -15
- package/src/components/component.ts +58 -8
- package/src/components/element-component.ts +26 -30
- package/src/components/gsplat-component.ts +4 -9
- package/src/components/layoutchild-component.ts +4 -9
- package/src/components/layoutgroup-component.ts +14 -9
- package/src/components/light-component.ts +42 -12
- package/src/components/listener-component.ts +1 -7
- package/src/components/particlesystem-component.ts +7 -15
- package/src/components/render-component.ts +5 -10
- package/src/components/rigidbody-component.ts +23 -16
- package/src/components/screen-component.ts +46 -20
- package/src/components/script-component.ts +108 -46
- package/src/components/script.ts +38 -33
- package/src/components/scrollbar-component.ts +6 -16
- package/src/components/scrollview-component.ts +22 -15
- package/src/components/sound-component.ts +10 -15
- package/src/components/sound-slot.ts +30 -20
- package/src/entity.ts +75 -34
- package/src/index.ts +45 -1
- package/src/loading-bar.ts +8 -8
- package/src/material.ts +63 -37
- package/src/model.ts +69 -14
- package/src/module.ts +8 -7
- package/src/parse.ts +67 -20
- package/src/scene.ts +12 -9
- package/src/sky.ts +76 -34
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RenderComponent, StandardMaterial } from 'playcanvas';
|
|
1
|
+
import type { RenderComponent, StandardMaterial } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
@@ -19,7 +19,7 @@ declare class RenderComponentElement extends ComponentElement {
|
|
|
19
19
|
private _type;
|
|
20
20
|
/** @ignore */
|
|
21
21
|
constructor();
|
|
22
|
-
getInitialComponentData(): {
|
|
22
|
+
protected getInitialComponentData(): {
|
|
23
23
|
type: "box" | "capsule" | "cone" | "cylinder" | "sphere" | "plane";
|
|
24
24
|
castShadows: boolean;
|
|
25
25
|
material: StandardMaterial | null | undefined;
|
|
@@ -73,9 +73,4 @@ declare class RenderComponentElement extends ComponentElement {
|
|
|
73
73
|
static get observedAttributes(): string[];
|
|
74
74
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
75
75
|
}
|
|
76
|
-
declare global {
|
|
77
|
-
interface HTMLElementTagNameMap {
|
|
78
|
-
'pc-render': RenderComponentElement;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
76
|
export { RenderComponentElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { RigidBodyComponent
|
|
1
|
+
import type { RigidBodyComponent } from 'playcanvas';
|
|
2
|
+
import { Vec3 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
@@ -47,7 +48,7 @@ declare class RigidBodyComponentElement extends ComponentElement {
|
|
|
47
48
|
private _type;
|
|
48
49
|
/** @ignore */
|
|
49
50
|
constructor();
|
|
50
|
-
getInitialComponentData(): {
|
|
51
|
+
protected getInitialComponentData(): {
|
|
51
52
|
angularDamping: number;
|
|
52
53
|
angularFactor: Vec3;
|
|
53
54
|
friction: number;
|
|
@@ -84,9 +85,4 @@ declare class RigidBodyComponentElement extends ComponentElement {
|
|
|
84
85
|
static get observedAttributes(): string[];
|
|
85
86
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
86
87
|
}
|
|
87
|
-
declare global {
|
|
88
|
-
interface HTMLElementTagNameMap {
|
|
89
|
-
'pc-rigidbody': RigidBodyComponentElement;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
88
|
export { RigidBodyComponentElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ScreenComponent
|
|
1
|
+
import type { ScreenComponent } from 'playcanvas';
|
|
2
|
+
import { Vec2 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
@@ -13,16 +14,16 @@ declare class ScreenComponentElement extends ComponentElement {
|
|
|
13
14
|
private _resolution;
|
|
14
15
|
private _referenceResolution;
|
|
15
16
|
private _priority;
|
|
16
|
-
private
|
|
17
|
+
private _scaleMode;
|
|
17
18
|
private _scaleBlend;
|
|
18
19
|
/** @ignore */
|
|
19
20
|
constructor();
|
|
20
|
-
getInitialComponentData(): {
|
|
21
|
+
protected getInitialComponentData(): {
|
|
21
22
|
priority: number;
|
|
22
23
|
referenceResolution: Vec2;
|
|
23
24
|
resolution: Vec2;
|
|
24
25
|
scaleBlend: number;
|
|
25
|
-
scaleMode:
|
|
26
|
+
scaleMode: string;
|
|
26
27
|
screenSpace: boolean;
|
|
27
28
|
};
|
|
28
29
|
/**
|
|
@@ -36,18 +37,34 @@ declare class ScreenComponentElement extends ComponentElement {
|
|
|
36
37
|
get referenceResolution(): Vec2;
|
|
37
38
|
set resolution(value: Vec2);
|
|
38
39
|
get resolution(): Vec2;
|
|
40
|
+
/**
|
|
41
|
+
* Sets how the screen's `resolution` and `referenceResolution` are weighted against each other
|
|
42
|
+
* when `scaleMode` is `blend`, from 0 (follow the resolution) to 1 (follow the reference
|
|
43
|
+
* resolution). Ignored while `scaleMode` is `none`.
|
|
44
|
+
* @param value - The scale blend factor.
|
|
45
|
+
*/
|
|
39
46
|
set scaleBlend(value: number);
|
|
47
|
+
/**
|
|
48
|
+
* Gets how the screen's resolutions are weighted against each other.
|
|
49
|
+
* @returns The scale blend factor.
|
|
50
|
+
*/
|
|
40
51
|
get scaleBlend(): number;
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Sets how the screen scales its contents. `none` renders at `resolution` and ignores
|
|
54
|
+
* `referenceResolution`; `blend` scales between the two, weighted by `scaleBlend`, which is what
|
|
55
|
+
* keeps a UI laid out at one resolution usable at another. Requires `screenSpace` - the engine
|
|
56
|
+
* forces `none` on a world-space screen, which does not support scaling.
|
|
57
|
+
* @param value - The scale mode ('none' or 'blend').
|
|
58
|
+
*/
|
|
59
|
+
set scaleMode(value: 'none' | 'blend');
|
|
60
|
+
/**
|
|
61
|
+
* Gets how the screen scales its contents.
|
|
62
|
+
* @returns The scale mode.
|
|
63
|
+
*/
|
|
64
|
+
get scaleMode(): "none" | "blend";
|
|
43
65
|
set screenSpace(value: boolean);
|
|
44
66
|
get screenSpace(): boolean;
|
|
45
67
|
static get observedAttributes(): string[];
|
|
46
68
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
47
69
|
}
|
|
48
|
-
declare global {
|
|
49
|
-
interface HTMLElementTagNameMap {
|
|
50
|
-
'pc-screen': ScreenComponentElement;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
70
|
export { ScreenComponentElement };
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import { ScriptComponent } from 'playcanvas';
|
|
1
|
+
import type { ScriptComponent } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
|
-
|
|
3
|
+
export type ScriptAttributesChangeEvent = {
|
|
4
4
|
detail: {
|
|
5
5
|
attributes: Record<string, any>;
|
|
6
6
|
};
|
|
7
|
-
}
|
|
8
|
-
|
|
7
|
+
} & CustomEvent;
|
|
8
|
+
export type ScriptEnableChangeEvent = {
|
|
9
9
|
detail: {
|
|
10
10
|
enabled: boolean;
|
|
11
11
|
};
|
|
12
|
-
}
|
|
13
|
-
|
|
12
|
+
} & CustomEvent;
|
|
13
|
+
export type ScriptNameChangeEvent = {
|
|
14
14
|
detail: {
|
|
15
15
|
oldName: string;
|
|
16
16
|
newName: string;
|
|
17
17
|
};
|
|
18
|
-
}
|
|
19
|
-
declare global {
|
|
20
|
-
interface HTMLElementEventMap {
|
|
21
|
-
'scriptattributeschange': ScriptAttributesChangeEvent;
|
|
22
|
-
'scriptenablechange': ScriptEnableChangeEvent;
|
|
23
|
-
'scriptnamechange': ScriptNameChangeEvent;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
18
|
+
} & CustomEvent;
|
|
26
19
|
/**
|
|
27
20
|
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
28
21
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
|
|
@@ -36,7 +29,7 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
36
29
|
/** @ignore */
|
|
37
30
|
constructor();
|
|
38
31
|
connectedCallback(): Promise<void>;
|
|
39
|
-
initComponent(): void;
|
|
32
|
+
protected initComponent(): void;
|
|
40
33
|
/**
|
|
41
34
|
* Recursively converts raw attribute data into proper PlayCanvas types. Supported conversions:
|
|
42
35
|
* - "asset:id" → the Asset created by the `pc-asset` element with that id
|
|
@@ -167,9 +160,4 @@ declare class ScriptComponentElement extends ComponentElement {
|
|
|
167
160
|
*/
|
|
168
161
|
get component(): ScriptComponent;
|
|
169
162
|
}
|
|
170
|
-
declare global {
|
|
171
|
-
interface HTMLElementTagNameMap {
|
|
172
|
-
'pc-scripts': ScriptComponentElement;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
163
|
export { ScriptComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Script } from 'playcanvas';
|
|
1
|
+
import type { Script } from 'playcanvas';
|
|
2
2
|
import { AsyncElement } from '../async-element';
|
|
3
3
|
/**
|
|
4
4
|
* The ScriptElement interface provides properties and methods for manipulating
|
|
@@ -36,17 +36,6 @@ import { AsyncElement } from '../async-element';
|
|
|
36
36
|
declare class ScriptElement extends AsyncElement {
|
|
37
37
|
private _attributes;
|
|
38
38
|
private _enabled;
|
|
39
|
-
/**
|
|
40
|
-
* Whether readiness has been signalled. Creation can happen more than once over an
|
|
41
|
-
* element's life (a runtime `name` change recreates the instance), but `ready` is a
|
|
42
|
-
* one-shot signal, so only the first successful creation fires it.
|
|
43
|
-
*/
|
|
44
|
-
private _readySignalled;
|
|
45
|
-
/**
|
|
46
|
-
* The Script instance created for this element by its parent `<pc-scripts>` element.
|
|
47
|
-
* @ignore
|
|
48
|
-
*/
|
|
49
|
-
_script: Script | null;
|
|
50
39
|
/**
|
|
51
40
|
* Sets the attributes of the script as an object. Values are converted with the same rules
|
|
52
41
|
* as the `attributes` attribute: `asset:`/`entity:` references and `vec2:`/`vec3:`/`vec4:`/
|
|
@@ -98,17 +87,8 @@ declare class ScriptElement extends AsyncElement {
|
|
|
98
87
|
*/
|
|
99
88
|
get script(): Script | null;
|
|
100
89
|
connectedCallback(): void;
|
|
101
|
-
|
|
102
|
-
* Called by the parent `<pc-scripts>` element when the script instance has been created.
|
|
103
|
-
* @ignore
|
|
104
|
-
*/
|
|
105
|
-
_onScriptCreated(): void;
|
|
90
|
+
disconnectedCallback(): void;
|
|
106
91
|
static get observedAttributes(): string[];
|
|
107
92
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
108
93
|
}
|
|
109
|
-
declare global {
|
|
110
|
-
interface HTMLElementTagNameMap {
|
|
111
|
-
'pc-script': ScriptElement;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
94
|
export { ScriptElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScrollbarComponent } from 'playcanvas';
|
|
1
|
+
import type { ScrollbarComponent } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The ScrollbarComponentElement interface provides properties and methods for manipulating
|
|
@@ -15,7 +15,7 @@ declare class ScrollbarComponentElement extends ComponentElement {
|
|
|
15
15
|
private _handle;
|
|
16
16
|
/** @ignore */
|
|
17
17
|
constructor();
|
|
18
|
-
getInitialComponentData(): Record<string, any>;
|
|
18
|
+
protected getInitialComponentData(): Record<string, any>;
|
|
19
19
|
/**
|
|
20
20
|
* Gets the underlying PlayCanvas scrollbar component.
|
|
21
21
|
* @returns The scrollbar component.
|
|
@@ -66,9 +66,4 @@ declare class ScrollbarComponentElement extends ComponentElement {
|
|
|
66
66
|
static get observedAttributes(): string[];
|
|
67
67
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
68
68
|
}
|
|
69
|
-
declare global {
|
|
70
|
-
interface HTMLElementTagNameMap {
|
|
71
|
-
'pc-scrollbar': ScrollbarComponentElement;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
69
|
export { ScrollbarComponentElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ScrollViewComponent
|
|
1
|
+
import type { ScrollViewComponent } from 'playcanvas';
|
|
2
|
+
import { Vec2 } from 'playcanvas';
|
|
2
3
|
import { ComponentElement } from './component';
|
|
3
4
|
/**
|
|
4
5
|
* The ScrollViewComponentElement interface provides properties and methods for manipulating
|
|
@@ -24,29 +25,31 @@ declare class ScrollViewComponentElement extends ComponentElement {
|
|
|
24
25
|
private _verticalScrollbar;
|
|
25
26
|
/** @ignore */
|
|
26
27
|
constructor();
|
|
27
|
-
getInitialComponentData(): Record<string, any>;
|
|
28
|
+
protected getInitialComponentData(): Record<string, any>;
|
|
28
29
|
/**
|
|
29
30
|
* Gets the underlying PlayCanvas scroll view component.
|
|
30
31
|
* @returns The scroll view component.
|
|
31
32
|
*/
|
|
32
33
|
get component(): ScrollViewComponent;
|
|
33
34
|
/**
|
|
34
|
-
* Sets whether horizontal
|
|
35
|
+
* Sets whether scrolling along the horizontal axis is enabled. This is a toggle, unlike the
|
|
36
|
+
* `orientation` of a `<pc-scrollbar>`, for which `horizontal` is one of the accepted values.
|
|
35
37
|
* @param value - Whether horizontal scrolling is enabled.
|
|
36
38
|
*/
|
|
37
39
|
set horizontal(value: boolean);
|
|
38
40
|
/**
|
|
39
|
-
* Gets whether horizontal
|
|
41
|
+
* Gets whether scrolling along the horizontal axis is enabled.
|
|
40
42
|
* @returns Whether horizontal scrolling is enabled.
|
|
41
43
|
*/
|
|
42
44
|
get horizontal(): boolean;
|
|
43
45
|
/**
|
|
44
|
-
* Sets whether vertical
|
|
46
|
+
* Sets whether scrolling along the vertical axis is enabled. This is a toggle, unlike the
|
|
47
|
+
* `orientation` of a `<pc-scrollbar>`, for which `vertical` is one of the accepted values.
|
|
45
48
|
* @param value - Whether vertical scrolling is enabled.
|
|
46
49
|
*/
|
|
47
50
|
set vertical(value: boolean);
|
|
48
51
|
/**
|
|
49
|
-
* Gets whether vertical
|
|
52
|
+
* Gets whether scrolling along the vertical axis is enabled.
|
|
50
53
|
* @returns Whether vertical scrolling is enabled.
|
|
51
54
|
*/
|
|
52
55
|
get vertical(): boolean;
|
|
@@ -172,9 +175,4 @@ declare class ScrollViewComponentElement extends ComponentElement {
|
|
|
172
175
|
static get observedAttributes(): string[];
|
|
173
176
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
174
177
|
}
|
|
175
|
-
declare global {
|
|
176
|
-
interface HTMLElementTagNameMap {
|
|
177
|
-
'pc-scrollview': ScrollViewComponentElement;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
178
|
export { ScrollViewComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SoundComponent } from 'playcanvas';
|
|
1
|
+
import type { SoundComponent } from 'playcanvas';
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
@@ -18,7 +18,7 @@ declare class SoundComponentElement extends ComponentElement {
|
|
|
18
18
|
private _volume;
|
|
19
19
|
/** @ignore */
|
|
20
20
|
constructor();
|
|
21
|
-
getInitialComponentData(): {
|
|
21
|
+
protected getInitialComponentData(): {
|
|
22
22
|
distanceModel: "linear" | "exponential" | "inverse";
|
|
23
23
|
maxDistance: number;
|
|
24
24
|
pitch: number;
|
|
@@ -105,9 +105,4 @@ declare class SoundComponentElement extends ComponentElement {
|
|
|
105
105
|
static get observedAttributes(): string[];
|
|
106
106
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
107
107
|
}
|
|
108
|
-
declare global {
|
|
109
|
-
interface HTMLElementTagNameMap {
|
|
110
|
-
'pc-sounds': SoundComponentElement;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
108
|
export { SoundComponentElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SoundSlot } from 'playcanvas';
|
|
1
|
+
import type { SoundSlot } from 'playcanvas';
|
|
2
2
|
import { AsyncElement } from '../async-element';
|
|
3
3
|
import { SoundComponentElement } from './sound-component';
|
|
4
4
|
/**
|
|
@@ -24,6 +24,13 @@ declare class SoundSlotElement extends AsyncElement {
|
|
|
24
24
|
* emit a misleading "must be a direct child" warning for what is an ordinary removal.
|
|
25
25
|
*/
|
|
26
26
|
private _soundElement;
|
|
27
|
+
/**
|
|
28
|
+
* Incremented on every connect and disconnect, and captured by connectedCallback on entry —
|
|
29
|
+
* a resume from an await abandons itself if the value has moved on, so a stale callback can
|
|
30
|
+
* neither act on a torn-down tree nor add its slot alongside a re-inserted element's own
|
|
31
|
+
* callback.
|
|
32
|
+
*/
|
|
33
|
+
private _connectionGeneration;
|
|
27
34
|
/**
|
|
28
35
|
* The sound slot.
|
|
29
36
|
*/
|
|
@@ -124,9 +131,4 @@ declare class SoundSlotElement extends AsyncElement {
|
|
|
124
131
|
static get observedAttributes(): string[];
|
|
125
132
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
126
133
|
}
|
|
127
|
-
declare global {
|
|
128
|
-
interface HTMLElementTagNameMap {
|
|
129
|
-
'pc-sound': SoundSlotElement;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
134
|
export { SoundSlotElement };
|