@playcanvas/web-components 0.8.2 → 0.9.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.
- package/dist/app.d.ts +10 -2
- package/dist/asset.d.ts +18 -3
- package/dist/async-element.d.ts +51 -4
- package/dist/components/button-component.d.ts +10 -4
- package/dist/components/camera-component.d.ts +9 -4
- package/dist/components/collision-component.d.ts +9 -4
- package/dist/components/component.d.ts +7 -1
- package/dist/components/element-component.d.ts +17 -12
- package/dist/components/gsplat-component.d.ts +6 -1
- package/dist/components/layoutchild-component.d.ts +6 -1
- package/dist/components/layoutgroup-component.d.ts +21 -15
- package/dist/components/light-component.d.ts +12 -6
- package/dist/components/listener-component.d.ts +6 -1
- package/dist/components/particlesystem-component.d.ts +6 -1
- package/dist/components/render-component.d.ts +13 -4
- package/dist/components/rigidbody-component.d.ts +9 -4
- package/dist/components/screen-component.d.ts +6 -1
- package/dist/components/script-component.d.ts +116 -16
- package/dist/components/script.d.ts +72 -8
- package/dist/components/scrollbar-component.d.ts +10 -4
- package/dist/components/scrollview-component.d.ts +17 -10
- package/dist/components/sound-component.d.ts +6 -1
- package/dist/components/sound-slot.d.ts +8 -3
- package/dist/entity.d.ts +26 -2
- package/dist/index.d.ts +3 -2
- package/dist/material.d.ts +10 -0
- package/dist/model.d.ts +5 -0
- package/dist/module.d.ts +5 -0
- package/dist/pwc.cjs +1574 -853
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +1574 -853
- 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.mjs +1575 -855
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +14 -5
- package/dist/sky.d.ts +6 -0
- package/dist/utils.d.ts +81 -23
- package/package.json +7 -7
- package/src/app.ts +38 -12
- package/src/asset.ts +61 -8
- package/src/async-element.ts +86 -5
- package/src/components/button-component.ts +26 -19
- package/src/components/camera-component.ts +29 -23
- package/src/components/collision-component.ts +19 -13
- package/src/components/component.ts +32 -13
- package/src/components/element-component.ts +58 -52
- package/src/components/gsplat-component.ts +14 -7
- package/src/components/layoutchild-component.ts +16 -9
- package/src/components/layoutgroup-component.ts +38 -31
- package/src/components/light-component.ts +33 -31
- package/src/components/listener-component.ts +8 -2
- package/src/components/particlesystem-component.ts +8 -2
- package/src/components/render-component.ts +19 -8
- package/src/components/rigidbody-component.ts +21 -15
- package/src/components/screen-component.ts +15 -9
- package/src/components/script-component.ts +512 -125
- package/src/components/script.ts +116 -16
- package/src/components/scrollbar-component.ts +19 -12
- package/src/components/scrollview-component.ts +37 -29
- package/src/components/sound-component.ts +16 -9
- package/src/components/sound-slot.ts +23 -14
- package/src/entity.ts +61 -71
- package/src/index.ts +5 -2
- package/src/material.ts +34 -1
- package/src/model.ts +6 -0
- package/src/module.ts +6 -0
- package/src/scene.ts +25 -12
- package/src/sky.ts +34 -16
- package/src/utils.ts +180 -40
package/dist/app.d.ts
CHANGED
|
@@ -22,10 +22,13 @@ declare class AppElement extends AsyncElement {
|
|
|
22
22
|
private _hasPointerListeners;
|
|
23
23
|
private _hoveredEntity;
|
|
24
24
|
private _pointerHandlers;
|
|
25
|
+
private _app;
|
|
25
26
|
/**
|
|
26
|
-
* The PlayCanvas application instance.
|
|
27
|
+
* The PlayCanvas application instance. Available once the element is ready — await
|
|
28
|
+
* {@link whenReady} or the element's `ready()` promise before accessing it.
|
|
29
|
+
* @returns The application instance.
|
|
27
30
|
*/
|
|
28
|
-
app: AppBase
|
|
31
|
+
get app(): AppBase;
|
|
29
32
|
/**
|
|
30
33
|
* Creates a new AppElement instance.
|
|
31
34
|
*
|
|
@@ -113,4 +116,9 @@ declare class AppElement extends AsyncElement {
|
|
|
113
116
|
static get observedAttributes(): string[];
|
|
114
117
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
115
118
|
}
|
|
119
|
+
declare global {
|
|
120
|
+
interface HTMLElementTagNameMap {
|
|
121
|
+
'pc-app': AppElement;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
116
124
|
export { AppElement };
|
package/dist/asset.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { Asset } from 'playcanvas';
|
|
2
|
+
import { AsyncElement } from './async-element';
|
|
2
3
|
/**
|
|
3
4
|
* The AssetElement interface provides properties and methods for manipulating
|
|
4
5
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
|
|
5
6
|
* The AssetElement interface also inherits the properties and methods of the
|
|
6
7
|
* {@link HTMLElement} interface.
|
|
8
|
+
*
|
|
9
|
+
* The element becomes ready once the containing application has started and the asset is in the
|
|
10
|
+
* state declared by the markup: loaded for preloaded assets (even if loading failed — check the
|
|
11
|
+
* asset's `resource`), or registered and awaiting a load for `lazy` assets. Elements inserted
|
|
12
|
+
* while the application is running are created and registered on insertion, and begin loading
|
|
13
|
+
* immediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed
|
|
14
|
+
* elsewhere, or with an unsupported asset type, never become ready.
|
|
7
15
|
*/
|
|
8
|
-
declare class AssetElement extends
|
|
16
|
+
declare class AssetElement extends AsyncElement {
|
|
9
17
|
private _lazy;
|
|
10
18
|
/**
|
|
11
|
-
* The asset that is loaded.
|
|
19
|
+
* The asset that is loaded. Available once the element is ready — await
|
|
20
|
+
* {@link whenReady} or the element's `ready()` promise before accessing it.
|
|
12
21
|
*/
|
|
13
22
|
asset: Asset | null;
|
|
23
|
+
connectedCallback(): Promise<void>;
|
|
14
24
|
disconnectedCallback(): void;
|
|
15
25
|
createAsset(): void;
|
|
16
26
|
/**
|
|
@@ -34,6 +44,11 @@ declare class AssetElement extends HTMLElement {
|
|
|
34
44
|
get lazy(): boolean;
|
|
35
45
|
static get(id: string): Asset | null | undefined;
|
|
36
46
|
static get observedAttributes(): string[];
|
|
37
|
-
attributeChangedCallback(name: string, _oldValue: string,
|
|
47
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
48
|
+
}
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
'pc-asset': AssetElement;
|
|
52
|
+
}
|
|
38
53
|
}
|
|
39
54
|
export { AssetElement };
|
package/dist/async-element.d.ts
CHANGED
|
@@ -11,14 +11,61 @@ declare class AsyncElement extends HTMLElement {
|
|
|
11
11
|
get closestApp(): AppElement;
|
|
12
12
|
get closestEntity(): EntityElement;
|
|
13
13
|
/**
|
|
14
|
-
* Called when the element is fully initialized and ready.
|
|
15
|
-
*
|
|
14
|
+
* Called when the element is fully initialized and ready. Subclasses should call this when
|
|
15
|
+
* they're ready. Resolves the ready promise and dispatches a bubbling, composed `ready`
|
|
16
|
+
* event.
|
|
16
17
|
*/
|
|
17
18
|
protected _onReady(): void;
|
|
18
19
|
/**
|
|
19
|
-
* Returns a promise that resolves with this element when it's ready.
|
|
20
|
+
* Returns a promise that resolves with this element when it's ready. This is the low-level
|
|
21
|
+
* primitive underlying {@link whenReady}, which is the recommended way to wait for elements.
|
|
20
22
|
* @returns A promise that resolves with this element when it's ready.
|
|
21
23
|
*/
|
|
22
24
|
ready(): Promise<this>;
|
|
23
25
|
}
|
|
24
|
-
|
|
26
|
+
/**
|
|
27
|
+
* A union of the tag names of all elements that initialize asynchronously (i.e. elements whose
|
|
28
|
+
* classes extend {@link AsyncElement}).
|
|
29
|
+
*/
|
|
30
|
+
type AsyncElementTagName = {
|
|
31
|
+
[K in keyof HTMLElementTagNameMap]: HTMLElementTagNameMap[K] extends AsyncElement ? K : never;
|
|
32
|
+
}[keyof HTMLElementTagNameMap];
|
|
33
|
+
/**
|
|
34
|
+
* Waits for the first element matching the given tag name to be fully initialized. Note that the
|
|
35
|
+
* promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
36
|
+
* that is not a direct child of `<pc-scripts>`). A component element outside a `<pc-entity>` is
|
|
37
|
+
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
38
|
+
* element logs a warning naming the parent it requires.
|
|
39
|
+
* @param target - The tag name of the element to wait for (e.g. `'pc-app'`).
|
|
40
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
41
|
+
* @example
|
|
42
|
+
* const { app } = await whenReady('pc-app');
|
|
43
|
+
*/
|
|
44
|
+
declare function whenReady<K extends AsyncElementTagName>(target: K): Promise<HTMLElementTagNameMap[K]>;
|
|
45
|
+
/**
|
|
46
|
+
* Waits for the given element to be fully initialized. Note that the promise never settles if
|
|
47
|
+
* the element cannot finish initializing (for example, an element that is never added to the
|
|
48
|
+
* document).
|
|
49
|
+
* @param target - The element to wait for.
|
|
50
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
51
|
+
* @example
|
|
52
|
+
* const appElement = document.createElement('pc-app');
|
|
53
|
+
* document.body.appendChild(appElement);
|
|
54
|
+
* const { app } = await whenReady(appElement);
|
|
55
|
+
*/
|
|
56
|
+
declare function whenReady<T extends AsyncElement>(target: T): Promise<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Waits for the first element matching the given CSS selector to be fully initialized. Note that
|
|
59
|
+
* the promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
60
|
+
* that is not a direct child of `<pc-scripts>`). A component element outside a `<pc-entity>` is
|
|
61
|
+
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
62
|
+
* element logs a warning naming the parent it requires.
|
|
63
|
+
* @param target - A CSS selector matching the element to wait for (e.g. `'#my-app'`).
|
|
64
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
65
|
+
* @example
|
|
66
|
+
* // In TypeScript, supply the element type when using an arbitrary selector
|
|
67
|
+
* const { entity } = await whenReady<EntityElement>('pc-entity[name="camera"]');
|
|
68
|
+
*/
|
|
69
|
+
declare function whenReady<T extends AsyncElement = AsyncElement, S extends string = string>(target: S extends Exclude<keyof HTMLElementTagNameMap, AsyncElementTagName> ? never : S): Promise<T>;
|
|
70
|
+
export { AsyncElement, whenReady };
|
|
71
|
+
export type { AsyncElementTagName };
|
|
@@ -30,7 +30,7 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
30
30
|
* Gets the underlying PlayCanvas button component.
|
|
31
31
|
* @returns The button component.
|
|
32
32
|
*/
|
|
33
|
-
get component(): ButtonComponent
|
|
33
|
+
get component(): ButtonComponent;
|
|
34
34
|
/**
|
|
35
35
|
* Sets whether the button is active and responds to input.
|
|
36
36
|
* @param value - Whether the button is active.
|
|
@@ -63,15 +63,16 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
63
63
|
*/
|
|
64
64
|
get hitPadding(): Vec4;
|
|
65
65
|
/**
|
|
66
|
-
* Sets how the button reacts to being hovered/pressed. Can be `tint`
|
|
66
|
+
* Sets how the button reacts to being hovered/pressed. Can be `tint` or `sprite`. Defaults to
|
|
67
|
+
* `tint`.
|
|
67
68
|
* @param value - The transition mode.
|
|
68
69
|
*/
|
|
69
|
-
set transitionMode(value:
|
|
70
|
+
set transitionMode(value: 'tint' | 'sprite');
|
|
70
71
|
/**
|
|
71
72
|
* Gets how the button reacts to being hovered/pressed.
|
|
72
73
|
* @returns The transition mode.
|
|
73
74
|
*/
|
|
74
|
-
get transitionMode():
|
|
75
|
+
get transitionMode(): "tint" | "sprite";
|
|
75
76
|
/**
|
|
76
77
|
* Sets the tint color applied to the image entity when the button is hovered (tint transition
|
|
77
78
|
* mode).
|
|
@@ -181,4 +182,9 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
181
182
|
static get observedAttributes(): string[];
|
|
182
183
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
183
184
|
}
|
|
185
|
+
declare global {
|
|
186
|
+
interface HTMLElementTagNameMap {
|
|
187
|
+
'pc-button': ButtonComponentElement;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
184
190
|
export { ButtonComponentElement };
|
|
@@ -42,14 +42,14 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
42
42
|
gammaCorrection: 0 | 1;
|
|
43
43
|
horizontalFov: boolean;
|
|
44
44
|
nearClip: number;
|
|
45
|
-
|
|
45
|
+
projection: 0 | 1;
|
|
46
46
|
orthoHeight: number;
|
|
47
47
|
priority: number;
|
|
48
48
|
rect: Vec4;
|
|
49
49
|
scissorRect: Vec4;
|
|
50
|
-
toneMapping:
|
|
50
|
+
toneMapping: number | undefined;
|
|
51
51
|
};
|
|
52
|
-
get xrAvailable(): boolean | null
|
|
52
|
+
get xrAvailable(): boolean | null;
|
|
53
53
|
/**
|
|
54
54
|
* Starts the camera in XR mode.
|
|
55
55
|
* @param type - The type of XR mode to start.
|
|
@@ -64,7 +64,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
64
64
|
* Gets the underlying PlayCanvas camera component.
|
|
65
65
|
* @returns The camera component.
|
|
66
66
|
*/
|
|
67
|
-
get component(): CameraComponent
|
|
67
|
+
get component(): CameraComponent;
|
|
68
68
|
/**
|
|
69
69
|
* Sets the clear color of the camera.
|
|
70
70
|
* @param value - The clear color.
|
|
@@ -249,4 +249,9 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
249
249
|
static get observedAttributes(): string[];
|
|
250
250
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
251
251
|
}
|
|
252
|
+
declare global {
|
|
253
|
+
interface HTMLElementTagNameMap {
|
|
254
|
+
'pc-camera': CameraComponentElement;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
252
257
|
export { CameraComponentElement };
|
|
@@ -27,13 +27,13 @@ declare class CollisionComponentElement extends ComponentElement {
|
|
|
27
27
|
height: number;
|
|
28
28
|
linearOffset: Vec3;
|
|
29
29
|
radius: number;
|
|
30
|
-
type:
|
|
30
|
+
type: "box" | "capsule" | "compound" | "cone" | "cylinder" | "mesh" | "sphere";
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Gets the underlying PlayCanvas collision component.
|
|
34
34
|
* @returns The collision component.
|
|
35
35
|
*/
|
|
36
|
-
get component(): CollisionComponent
|
|
36
|
+
get component(): CollisionComponent;
|
|
37
37
|
set angularOffset(value: Quat);
|
|
38
38
|
get angularOffset(): Quat;
|
|
39
39
|
set axis(value: number);
|
|
@@ -48,9 +48,14 @@ declare class CollisionComponentElement extends ComponentElement {
|
|
|
48
48
|
get linearOffset(): Vec3;
|
|
49
49
|
set radius(value: number);
|
|
50
50
|
get radius(): number;
|
|
51
|
-
set type(value:
|
|
52
|
-
get type():
|
|
51
|
+
set type(value: 'box' | 'capsule' | 'compound' | 'cone' | 'cylinder' | 'mesh' | 'sphere');
|
|
52
|
+
get type(): "box" | "capsule" | "compound" | "cone" | "cylinder" | "mesh" | "sphere";
|
|
53
53
|
static get observedAttributes(): string[];
|
|
54
54
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
55
55
|
}
|
|
56
|
+
declare global {
|
|
57
|
+
interface HTMLElementTagNameMap {
|
|
58
|
+
'pc-collision': CollisionComponentElement;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
56
61
|
export { CollisionComponentElement };
|
|
@@ -9,6 +9,7 @@ declare class ComponentElement extends AsyncElement {
|
|
|
9
9
|
private _componentName;
|
|
10
10
|
private _enabled;
|
|
11
11
|
private _component;
|
|
12
|
+
private _appElement;
|
|
12
13
|
/**
|
|
13
14
|
* Creates a new ComponentElement instance.
|
|
14
15
|
*
|
|
@@ -21,7 +22,12 @@ declare class ComponentElement extends AsyncElement {
|
|
|
21
22
|
initComponent(): void;
|
|
22
23
|
connectedCallback(): Promise<void>;
|
|
23
24
|
disconnectedCallback(): void;
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The PlayCanvas component instance. Available once the element is ready — await
|
|
27
|
+
* {@link whenReady} or the element's `ready()` promise before accessing it.
|
|
28
|
+
* @returns The component instance.
|
|
29
|
+
*/
|
|
30
|
+
get component(): Component;
|
|
25
31
|
/**
|
|
26
32
|
* Sets the enabled state of the component.
|
|
27
33
|
* @param value - The enabled state of the component.
|
|
@@ -10,13 +10,13 @@ import { ComponentElement } from './component';
|
|
|
10
10
|
*/
|
|
11
11
|
declare class ElementComponentElement extends ComponentElement {
|
|
12
12
|
private _anchor;
|
|
13
|
-
private _asset;
|
|
14
13
|
private _autoWidth;
|
|
15
14
|
private _autoHeight;
|
|
16
15
|
private _autoFitWidth;
|
|
17
16
|
private _autoFitHeight;
|
|
18
17
|
private _color;
|
|
19
18
|
private _enableMarkup;
|
|
19
|
+
private _fontAsset;
|
|
20
20
|
private _fontSize;
|
|
21
21
|
private _maxFontSize;
|
|
22
22
|
private _minFontSize;
|
|
@@ -43,7 +43,7 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
43
43
|
* Gets the underlying PlayCanvas element component.
|
|
44
44
|
* @returns The element component.
|
|
45
45
|
*/
|
|
46
|
-
get component(): ElementComponent
|
|
46
|
+
get component(): ElementComponent;
|
|
47
47
|
/**
|
|
48
48
|
* Sets the anchor of the element component.
|
|
49
49
|
* @param value - The anchor.
|
|
@@ -54,16 +54,6 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
54
54
|
* @returns The anchor.
|
|
55
55
|
*/
|
|
56
56
|
get anchor(): Vec4;
|
|
57
|
-
/**
|
|
58
|
-
* Sets the id of the `pc-asset` to use for the font (text elements).
|
|
59
|
-
* @param value - The asset ID.
|
|
60
|
-
*/
|
|
61
|
-
set asset(value: string);
|
|
62
|
-
/**
|
|
63
|
-
* Gets the id of the `pc-asset` to use for the font.
|
|
64
|
-
* @returns The asset ID.
|
|
65
|
-
*/
|
|
66
|
-
get asset(): string;
|
|
67
57
|
/**
|
|
68
58
|
* Sets whether the element component should automatically adjust its width to the text content
|
|
69
59
|
* (text elements only).
|
|
@@ -106,6 +96,16 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
106
96
|
* @returns Whether markup is enabled.
|
|
107
97
|
*/
|
|
108
98
|
get enableMarkup(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Sets the id of the `pc-asset` to use for the font (text elements).
|
|
101
|
+
* @param value - The font asset ID.
|
|
102
|
+
*/
|
|
103
|
+
set fontAsset(value: string);
|
|
104
|
+
/**
|
|
105
|
+
* Gets the id of the `pc-asset` to use for the font.
|
|
106
|
+
* @returns The font asset ID.
|
|
107
|
+
*/
|
|
108
|
+
get fontAsset(): string;
|
|
109
109
|
/**
|
|
110
110
|
* Sets the font size of the element component.
|
|
111
111
|
* @param value - The font size.
|
|
@@ -312,4 +312,9 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
312
312
|
static get observedAttributes(): string[];
|
|
313
313
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
314
314
|
}
|
|
315
|
+
declare global {
|
|
316
|
+
interface HTMLElementTagNameMap {
|
|
317
|
+
'pc-element': ElementComponentElement;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
315
320
|
export { ElementComponentElement };
|
|
@@ -29,7 +29,7 @@ declare class GSplatComponentElement extends ComponentElement {
|
|
|
29
29
|
* Gets the underlying PlayCanvas gsplat component.
|
|
30
30
|
* @returns The gsplat component.
|
|
31
31
|
*/
|
|
32
|
-
get component(): GSplatComponent
|
|
32
|
+
get component(): GSplatComponent;
|
|
33
33
|
/**
|
|
34
34
|
* Sets id of the `pc-asset` to use for the splat.
|
|
35
35
|
* @param value - The asset ID.
|
|
@@ -105,4 +105,9 @@ declare class GSplatComponentElement extends ComponentElement {
|
|
|
105
105
|
static get observedAttributes(): string[];
|
|
106
106
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
107
107
|
}
|
|
108
|
+
declare global {
|
|
109
|
+
interface HTMLElementTagNameMap {
|
|
110
|
+
'pc-gsplat': GSplatComponentElement;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
108
113
|
export { GSplatComponentElement };
|
|
@@ -31,7 +31,7 @@ declare class LayoutChildComponentElement extends ComponentElement {
|
|
|
31
31
|
* Gets the underlying PlayCanvas layout child component.
|
|
32
32
|
* @returns The layout child component.
|
|
33
33
|
*/
|
|
34
|
-
get component(): LayoutChildComponent
|
|
34
|
+
get component(): LayoutChildComponent;
|
|
35
35
|
/**
|
|
36
36
|
* Sets the minimum width the element should be laid out with.
|
|
37
37
|
* @param value - The minimum width.
|
|
@@ -107,4 +107,9 @@ declare class LayoutChildComponentElement extends ComponentElement {
|
|
|
107
107
|
static get observedAttributes(): string[];
|
|
108
108
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
109
109
|
}
|
|
110
|
+
declare global {
|
|
111
|
+
interface HTMLElementTagNameMap {
|
|
112
|
+
'pc-layoutchild': LayoutChildComponentElement;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
110
115
|
export { LayoutChildComponentElement };
|
|
@@ -21,31 +21,32 @@ declare class LayoutGroupComponentElement extends ComponentElement {
|
|
|
21
21
|
/** @ignore */
|
|
22
22
|
constructor();
|
|
23
23
|
getInitialComponentData(): {
|
|
24
|
-
orientation: number;
|
|
24
|
+
orientation: number | undefined;
|
|
25
25
|
reverseX: boolean;
|
|
26
26
|
reverseY: boolean;
|
|
27
27
|
alignment: Vec2;
|
|
28
28
|
padding: Vec4;
|
|
29
29
|
spacing: Vec2;
|
|
30
|
-
widthFitting: number;
|
|
31
|
-
heightFitting: number;
|
|
30
|
+
widthFitting: number | undefined;
|
|
31
|
+
heightFitting: number | undefined;
|
|
32
32
|
wrap: boolean;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* Gets the underlying PlayCanvas layout group component.
|
|
36
36
|
* @returns The layout group component.
|
|
37
37
|
*/
|
|
38
|
-
get component(): LayoutGroupComponent
|
|
38
|
+
get component(): LayoutGroupComponent;
|
|
39
39
|
/**
|
|
40
|
-
* Sets the orientation of the layout group. Can be `horizontal`
|
|
40
|
+
* Sets the orientation of the layout group. Can be `horizontal` or `vertical`. Defaults to
|
|
41
|
+
* `horizontal`.
|
|
41
42
|
* @param value - The orientation.
|
|
42
43
|
*/
|
|
43
|
-
set orientation(value:
|
|
44
|
+
set orientation(value: 'horizontal' | 'vertical');
|
|
44
45
|
/**
|
|
45
46
|
* Gets the orientation of the layout group.
|
|
46
47
|
* @returns The orientation.
|
|
47
48
|
*/
|
|
48
|
-
get orientation():
|
|
49
|
+
get orientation(): "horizontal" | "vertical";
|
|
49
50
|
/**
|
|
50
51
|
* Sets whether the order of children is reversed along the horizontal axis.
|
|
51
52
|
* @param value - Whether to reverse the horizontal order.
|
|
@@ -97,27 +98,27 @@ declare class LayoutGroupComponentElement extends ComponentElement {
|
|
|
97
98
|
*/
|
|
98
99
|
get spacing(): Vec2;
|
|
99
100
|
/**
|
|
100
|
-
* Sets the fitting mode along the horizontal axis. Can be `none
|
|
101
|
-
*
|
|
101
|
+
* Sets the fitting mode along the horizontal axis. Can be `none`, `stretch`, `shrink` or
|
|
102
|
+
* `both`. Defaults to `none`.
|
|
102
103
|
* @param value - The width fitting mode.
|
|
103
104
|
*/
|
|
104
|
-
set widthFitting(value:
|
|
105
|
+
set widthFitting(value: 'none' | 'stretch' | 'shrink' | 'both');
|
|
105
106
|
/**
|
|
106
107
|
* Gets the fitting mode along the horizontal axis.
|
|
107
108
|
* @returns The width fitting mode.
|
|
108
109
|
*/
|
|
109
|
-
get widthFitting():
|
|
110
|
+
get widthFitting(): "none" | "stretch" | "shrink" | "both";
|
|
110
111
|
/**
|
|
111
|
-
* Sets the fitting mode along the vertical axis. Can be `none
|
|
112
|
-
*
|
|
112
|
+
* Sets the fitting mode along the vertical axis. Can be `none`, `stretch`, `shrink` or
|
|
113
|
+
* `both`. Defaults to `none`.
|
|
113
114
|
* @param value - The height fitting mode.
|
|
114
115
|
*/
|
|
115
|
-
set heightFitting(value:
|
|
116
|
+
set heightFitting(value: 'none' | 'stretch' | 'shrink' | 'both');
|
|
116
117
|
/**
|
|
117
118
|
* Gets the fitting mode along the vertical axis.
|
|
118
119
|
* @returns The height fitting mode.
|
|
119
120
|
*/
|
|
120
|
-
get heightFitting():
|
|
121
|
+
get heightFitting(): "none" | "stretch" | "shrink" | "both";
|
|
121
122
|
/**
|
|
122
123
|
* Sets whether children wrap onto a new line/column when they overflow the group.
|
|
123
124
|
* @param value - Whether to wrap children.
|
|
@@ -131,4 +132,9 @@ declare class LayoutGroupComponentElement extends ComponentElement {
|
|
|
131
132
|
static get observedAttributes(): string[];
|
|
132
133
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
133
134
|
}
|
|
135
|
+
declare global {
|
|
136
|
+
interface HTMLElementTagNameMap {
|
|
137
|
+
'pc-layoutgroup': LayoutGroupComponentElement;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
134
140
|
export { LayoutGroupComponentElement };
|
|
@@ -46,8 +46,8 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
46
46
|
shadowIntensity: number;
|
|
47
47
|
shadowResolution: number;
|
|
48
48
|
shadowSamples: number;
|
|
49
|
-
shadowType:
|
|
50
|
-
type:
|
|
49
|
+
shadowType: number | undefined;
|
|
50
|
+
type: "directional" | "omni" | "spot";
|
|
51
51
|
vsmBias: number;
|
|
52
52
|
vsmBlurSize: number;
|
|
53
53
|
};
|
|
@@ -55,7 +55,7 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
55
55
|
* Gets the underlying PlayCanvas light component.
|
|
56
56
|
* @returns The light component.
|
|
57
57
|
*/
|
|
58
|
-
get component(): LightComponent
|
|
58
|
+
get component(): LightComponent;
|
|
59
59
|
/**
|
|
60
60
|
* Sets the cast shadows flag of the light.
|
|
61
61
|
* @param value - The cast shadows flag.
|
|
@@ -187,15 +187,16 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
187
187
|
*/
|
|
188
188
|
get shadowType(): "pcf1-16f" | "pcf1-32f" | "pcf3-16f" | "pcf3-32f" | "pcf5-16f" | "pcf5-32f" | "vsm-16f" | "vsm-32f" | "pcss-32f";
|
|
189
189
|
/**
|
|
190
|
-
* Sets the type of the light.
|
|
190
|
+
* Sets the type of the light. Can be `directional`, `omni` or `spot`. Defaults to
|
|
191
|
+
* `directional`.
|
|
191
192
|
* @param value - The type.
|
|
192
193
|
*/
|
|
193
|
-
set type(value:
|
|
194
|
+
set type(value: 'directional' | 'omni' | 'spot');
|
|
194
195
|
/**
|
|
195
196
|
* Gets the type of the light.
|
|
196
197
|
* @returns The type.
|
|
197
198
|
*/
|
|
198
|
-
get type():
|
|
199
|
+
get type(): "directional" | "omni" | "spot";
|
|
199
200
|
/**
|
|
200
201
|
* Sets the VSM bias of the light.
|
|
201
202
|
* @param value - The VSM bias.
|
|
@@ -259,4 +260,9 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
259
260
|
static get observedAttributes(): string[];
|
|
260
261
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
261
262
|
}
|
|
263
|
+
declare global {
|
|
264
|
+
interface HTMLElementTagNameMap {
|
|
265
|
+
'pc-light': LightComponentElement;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
262
268
|
export { LightComponentElement };
|
|
@@ -15,6 +15,11 @@ declare class ListenerComponentElement extends ComponentElement {
|
|
|
15
15
|
* Gets the underlying PlayCanvas audio listener component.
|
|
16
16
|
* @returns The audio listener component.
|
|
17
17
|
*/
|
|
18
|
-
get component(): AudioListenerComponent
|
|
18
|
+
get component(): AudioListenerComponent;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'pc-listener': ListenerComponentElement;
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
export { ListenerComponentElement };
|
|
@@ -17,7 +17,7 @@ declare class ParticleSystemComponentElement extends ComponentElement {
|
|
|
17
17
|
* Gets the underlying PlayCanvas particle system component.
|
|
18
18
|
* @returns The particle system component.
|
|
19
19
|
*/
|
|
20
|
-
get component(): ParticleSystemComponent
|
|
20
|
+
get component(): ParticleSystemComponent;
|
|
21
21
|
private applyConfig;
|
|
22
22
|
private _loadAsset;
|
|
23
23
|
/**
|
|
@@ -49,4 +49,9 @@ declare class ParticleSystemComponentElement extends ComponentElement {
|
|
|
49
49
|
static get observedAttributes(): string[];
|
|
50
50
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
51
51
|
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'pc-particles': ParticleSystemComponentElement;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
52
57
|
export { ParticleSystemComponentElement };
|
|
@@ -6,6 +6,10 @@ import { ComponentElement } from './component';
|
|
|
6
6
|
* The RenderComponentElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
8
|
*
|
|
9
|
+
* This element renders one of the engine's built-in primitives, selected with `type` (defaulting
|
|
10
|
+
* to `box`). It does not cover the engine's `asset` render type, since there is no way to supply
|
|
11
|
+
* a render asset here — use `pc-model` for glTF content instead.
|
|
12
|
+
*
|
|
9
13
|
* @category Components
|
|
10
14
|
*/
|
|
11
15
|
declare class RenderComponentElement extends ComponentElement {
|
|
@@ -16,7 +20,7 @@ declare class RenderComponentElement extends ComponentElement {
|
|
|
16
20
|
/** @ignore */
|
|
17
21
|
constructor();
|
|
18
22
|
getInitialComponentData(): {
|
|
19
|
-
type: "box" | "
|
|
23
|
+
type: "box" | "capsule" | "cone" | "cylinder" | "sphere" | "plane";
|
|
20
24
|
castShadows: boolean;
|
|
21
25
|
material: StandardMaterial | null | undefined;
|
|
22
26
|
receiveShadows: boolean;
|
|
@@ -25,17 +29,17 @@ declare class RenderComponentElement extends ComponentElement {
|
|
|
25
29
|
* Gets the underlying PlayCanvas render component.
|
|
26
30
|
* @returns The render component.
|
|
27
31
|
*/
|
|
28
|
-
get component(): RenderComponent
|
|
32
|
+
get component(): RenderComponent;
|
|
29
33
|
/**
|
|
30
34
|
* Sets the type of the render component.
|
|
31
35
|
* @param value - The type.
|
|
32
36
|
*/
|
|
33
|
-
set type(value: '
|
|
37
|
+
set type(value: 'box' | 'capsule' | 'cone' | 'cylinder' | 'plane' | 'sphere');
|
|
34
38
|
/**
|
|
35
39
|
* Gets the type of the render component.
|
|
36
40
|
* @returns The type.
|
|
37
41
|
*/
|
|
38
|
-
get type(): '
|
|
42
|
+
get type(): 'box' | 'capsule' | 'cone' | 'cylinder' | 'plane' | 'sphere';
|
|
39
43
|
/**
|
|
40
44
|
* Sets the cast shadows flag of the render component.
|
|
41
45
|
* @param value - The cast shadows flag.
|
|
@@ -69,4 +73,9 @@ declare class RenderComponentElement extends ComponentElement {
|
|
|
69
73
|
static get observedAttributes(): string[];
|
|
70
74
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
71
75
|
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface HTMLElementTagNameMap {
|
|
78
|
+
'pc-render': RenderComponentElement;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
72
81
|
export { RenderComponentElement };
|
|
@@ -56,13 +56,13 @@ declare class RigidBodyComponentElement extends ComponentElement {
|
|
|
56
56
|
mass: number;
|
|
57
57
|
restitution: number;
|
|
58
58
|
rollingFriction: number;
|
|
59
|
-
type:
|
|
59
|
+
type: "static" | "dynamic" | "kinematic";
|
|
60
60
|
};
|
|
61
61
|
/**
|
|
62
62
|
* Gets the underlying PlayCanvas rigidbody component.
|
|
63
63
|
* @returns The rigidbody component.
|
|
64
64
|
*/
|
|
65
|
-
get component(): RigidBodyComponent
|
|
65
|
+
get component(): RigidBodyComponent;
|
|
66
66
|
set angularDamping(value: number);
|
|
67
67
|
get angularDamping(): number;
|
|
68
68
|
set angularFactor(value: Vec3);
|
|
@@ -79,9 +79,14 @@ declare class RigidBodyComponentElement extends ComponentElement {
|
|
|
79
79
|
get restitution(): number;
|
|
80
80
|
set rollingFriction(value: number);
|
|
81
81
|
get rollingFriction(): number;
|
|
82
|
-
set type(value:
|
|
83
|
-
get type():
|
|
82
|
+
set type(value: 'static' | 'dynamic' | 'kinematic');
|
|
83
|
+
get type(): "static" | "dynamic" | "kinematic";
|
|
84
84
|
static get observedAttributes(): string[];
|
|
85
85
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
86
86
|
}
|
|
87
|
+
declare global {
|
|
88
|
+
interface HTMLElementTagNameMap {
|
|
89
|
+
'pc-rigidbody': RigidBodyComponentElement;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
87
92
|
export { RigidBodyComponentElement };
|
|
@@ -29,7 +29,7 @@ declare class ScreenComponentElement extends ComponentElement {
|
|
|
29
29
|
* Gets the underlying PlayCanvas screen component.
|
|
30
30
|
* @returns The screen component.
|
|
31
31
|
*/
|
|
32
|
-
get component(): ScreenComponent
|
|
32
|
+
get component(): ScreenComponent;
|
|
33
33
|
set priority(value: number);
|
|
34
34
|
get priority(): number;
|
|
35
35
|
set referenceResolution(value: Vec2);
|
|
@@ -45,4 +45,9 @@ declare class ScreenComponentElement extends ComponentElement {
|
|
|
45
45
|
static get observedAttributes(): string[];
|
|
46
46
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
47
47
|
}
|
|
48
|
+
declare global {
|
|
49
|
+
interface HTMLElementTagNameMap {
|
|
50
|
+
'pc-screen': ScreenComponentElement;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
48
53
|
export { ScreenComponentElement };
|