@playcanvas/web-components 0.8.2 → 0.10.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/README.md +18 -0
- package/dist/app.d.ts +13 -4
- package/dist/asset.d.ts +33 -3
- package/dist/async-element.d.ts +54 -4
- package/dist/components/button-component.d.ts +11 -5
- package/dist/components/camera-component.d.ts +10 -5
- package/dist/components/collision-component.d.ts +10 -5
- package/dist/components/component.d.ts +8 -2
- package/dist/components/element-component.d.ts +18 -13
- package/dist/components/gsplat-component.d.ts +7 -2
- package/dist/components/layoutchild-component.d.ts +7 -2
- package/dist/components/layoutgroup-component.d.ts +22 -16
- package/dist/components/light-component.d.ts +13 -7
- package/dist/components/listener-component.d.ts +6 -1
- package/dist/components/particlesystem-component.d.ts +7 -2
- package/dist/components/render-component.d.ts +14 -5
- package/dist/components/rigidbody-component.d.ts +10 -5
- package/dist/components/screen-component.d.ts +7 -2
- package/dist/components/script-component.d.ts +116 -16
- package/dist/components/script.d.ts +79 -8
- package/dist/components/scrollbar-component.d.ts +11 -5
- package/dist/components/scrollview-component.d.ts +18 -11
- package/dist/components/sound-component.d.ts +7 -2
- package/dist/components/sound-slot.d.ts +17 -4
- package/dist/custom-elements.json +16231 -0
- package/dist/entity.d.ts +45 -3
- package/dist/index.d.ts +3 -2
- package/dist/material.d.ts +976 -4
- package/dist/model.d.ts +6 -1
- package/dist/module.d.ts +15 -0
- package/dist/parse.d.ts +144 -0
- package/dist/pwc.cjs +5735 -2923
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +5735 -2923
- 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 +2 -0
- package/dist/pwc.min.mjs.map +1 -0
- package/dist/pwc.mjs +5736 -2925
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +15 -6
- package/dist/sky.d.ts +7 -1
- package/dist/vscode.html-custom-data.json +1795 -0
- package/dist/web-types.json +3592 -0
- package/package.json +32 -14
- package/src/app.ts +42 -15
- package/src/asset.ts +78 -8
- package/src/async-element.ts +89 -5
- package/src/components/button-component.ts +31 -24
- package/src/components/camera-component.ts +30 -24
- package/src/components/collision-component.ts +20 -14
- package/src/components/component.ts +33 -14
- package/src/components/element-component.ts +62 -56
- package/src/components/gsplat-component.ts +16 -9
- package/src/components/layoutchild-component.ts +17 -10
- package/src/components/layoutgroup-component.ts +39 -32
- package/src/components/light-component.ts +34 -32
- package/src/components/listener-component.ts +8 -2
- package/src/components/particlesystem-component.ts +10 -4
- package/src/components/render-component.ts +28 -12
- package/src/components/rigidbody-component.ts +22 -16
- package/src/components/screen-component.ts +16 -10
- package/src/components/script-component.ts +512 -125
- package/src/components/script.ts +123 -16
- package/src/components/scrollbar-component.ts +21 -14
- package/src/components/scrollview-component.ts +42 -34
- package/src/components/sound-component.ts +17 -10
- package/src/components/sound-slot.ts +50 -19
- package/src/entity.ts +84 -76
- package/src/index.ts +5 -2
- package/src/material.ts +2432 -62
- package/src/model.ts +8 -2
- package/src/module.ts +16 -0
- package/src/parse.ts +298 -0
- package/src/scene.ts +26 -13
- package/src/sky.ts +36 -18
- package/dist/utils.d.ts +0 -56
- package/src/utils.ts +0 -119
package/README.md
CHANGED
|
@@ -38,6 +38,24 @@ See PlayCanvas Web Components in action here: https://playcanvas.github.io/web-c
|
|
|
38
38
|
|
|
39
39
|
Please see the [Getting Started Guide](https://developer.playcanvas.com/user-manual/web-components/getting-started/) for installation and usage instructions.
|
|
40
40
|
|
|
41
|
+
## Editor Support
|
|
42
|
+
|
|
43
|
+
The package ships a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest), which editors use to offer tag and attribute completions, valid attribute values and hover documentation when authoring HTML.
|
|
44
|
+
|
|
45
|
+
**VS Code** — add the following to your workspace `.vscode/settings.json`:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"html.customData": [
|
|
50
|
+
"./node_modules/@playcanvas/web-components/dist/vscode.html-custom-data.json"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**JetBrains IDEs** (WebStorm, IntelliJ IDEA) — no setup required. The IDE discovers the bundled `web-types.json` automatically.
|
|
56
|
+
|
|
57
|
+
**Other tooling** — the manifest itself is at `@playcanvas/web-components/dist/custom-elements.json` and is declared in the package's `customElements` field, which is how tools such as `lit-analyzer` and Storybook locate it.
|
|
58
|
+
|
|
41
59
|
## Development
|
|
42
60
|
|
|
43
61
|
### Setting Up Local Development
|
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
|
*
|
|
@@ -64,7 +67,8 @@ declare class AppElement extends AsyncElement {
|
|
|
64
67
|
*/
|
|
65
68
|
get antialias(): boolean;
|
|
66
69
|
/**
|
|
67
|
-
* Sets the graphics backend.
|
|
70
|
+
* Sets the graphics backend. Defaults to 'webgpu', which falls back to 'webgl2' if WebGPU
|
|
71
|
+
* is not supported by the browser.
|
|
68
72
|
* @param value - The graphics backend ('webgpu', 'webgl2', or 'null').
|
|
69
73
|
*/
|
|
70
74
|
set backend(value: 'webgpu' | 'webgl2' | 'null');
|
|
@@ -111,6 +115,11 @@ declare class AppElement extends AsyncElement {
|
|
|
111
115
|
*/
|
|
112
116
|
get stencil(): boolean;
|
|
113
117
|
static get observedAttributes(): string[];
|
|
114
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
118
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
119
|
+
}
|
|
120
|
+
declare global {
|
|
121
|
+
interface HTMLElementTagNameMap {
|
|
122
|
+
'pc-app': AppElement;
|
|
123
|
+
}
|
|
115
124
|
}
|
|
116
125
|
export { AppElement };
|
package/dist/asset.d.ts
CHANGED
|
@@ -1,16 +1,41 @@
|
|
|
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.
|
|
15
|
+
*
|
|
16
|
+
* Apart from `lazy`, these attributes are read once when the asset is created, so changing them
|
|
17
|
+
* later has no effect.
|
|
18
|
+
*
|
|
19
|
+
* @attribute {string} id - The identifier used to reference the asset from other elements.
|
|
20
|
+
* @attribute {string} src - The URL of the asset to load.
|
|
21
|
+
* @attribute {string} type - The asset type. Inferred from the `src` file extension when omitted.
|
|
22
|
+
* @attribute {string} data - Additional asset data, as a JSON object.
|
|
23
|
+
* @attribute {string} atlas - For a `sprite` asset, the `id` of the texture atlas asset it uses.
|
|
24
|
+
* The atlas must be declared before the sprite.
|
|
25
|
+
* @attribute {string} frame-keys - For a `sprite` asset, the atlas frame keys it uses, separated
|
|
26
|
+
* by spaces or commas.
|
|
27
|
+
* @attribute {number} pixels-per-unit - For a `sprite` asset, the number of pixels per world unit.
|
|
28
|
+
* @attribute {'simple' | 'sliced' | 'tiled'} render-mode - For a `sprite` asset, how the sprite is
|
|
29
|
+
* rendered when resized.
|
|
7
30
|
*/
|
|
8
|
-
declare class AssetElement extends
|
|
31
|
+
declare class AssetElement extends AsyncElement {
|
|
9
32
|
private _lazy;
|
|
10
33
|
/**
|
|
11
|
-
* The asset that is loaded.
|
|
34
|
+
* The asset that is loaded. Available once the element is ready — await
|
|
35
|
+
* {@link whenReady} or the element's `ready()` promise before accessing it.
|
|
12
36
|
*/
|
|
13
37
|
asset: Asset | null;
|
|
38
|
+
connectedCallback(): Promise<void>;
|
|
14
39
|
disconnectedCallback(): void;
|
|
15
40
|
createAsset(): void;
|
|
16
41
|
/**
|
|
@@ -34,6 +59,11 @@ declare class AssetElement extends HTMLElement {
|
|
|
34
59
|
get lazy(): boolean;
|
|
35
60
|
static get(id: string): Asset | null | undefined;
|
|
36
61
|
static get observedAttributes(): string[];
|
|
37
|
-
attributeChangedCallback(name: string, _oldValue: string,
|
|
62
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
63
|
+
}
|
|
64
|
+
declare global {
|
|
65
|
+
interface HTMLElementTagNameMap {
|
|
66
|
+
'pc-asset': AssetElement;
|
|
67
|
+
}
|
|
38
68
|
}
|
|
39
69
|
export { AssetElement };
|
package/dist/async-element.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { AppElement } from './app';
|
|
|
2
2
|
import { EntityElement } from './entity';
|
|
3
3
|
/**
|
|
4
4
|
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
5
|
+
*
|
|
6
|
+
* @fires {CustomEvent} ready - Fired once the element is fully initialized. Bubbles and is
|
|
7
|
+
* composed.
|
|
5
8
|
*/
|
|
6
9
|
declare class AsyncElement extends HTMLElement {
|
|
7
10
|
private _readyPromise;
|
|
@@ -11,14 +14,61 @@ declare class AsyncElement extends HTMLElement {
|
|
|
11
14
|
get closestApp(): AppElement;
|
|
12
15
|
get closestEntity(): EntityElement;
|
|
13
16
|
/**
|
|
14
|
-
* Called when the element is fully initialized and ready.
|
|
15
|
-
*
|
|
17
|
+
* Called when the element is fully initialized and ready. Subclasses should call this when
|
|
18
|
+
* they're ready. Resolves the ready promise and dispatches a bubbling, composed `ready`
|
|
19
|
+
* event.
|
|
16
20
|
*/
|
|
17
21
|
protected _onReady(): void;
|
|
18
22
|
/**
|
|
19
|
-
* Returns a promise that resolves with this element when it's ready.
|
|
23
|
+
* Returns a promise that resolves with this element when it's ready. This is the low-level
|
|
24
|
+
* primitive underlying {@link whenReady}, which is the recommended way to wait for elements.
|
|
20
25
|
* @returns A promise that resolves with this element when it's ready.
|
|
21
26
|
*/
|
|
22
27
|
ready(): Promise<this>;
|
|
23
28
|
}
|
|
24
|
-
|
|
29
|
+
/**
|
|
30
|
+
* A union of the tag names of all elements that initialize asynchronously (i.e. elements whose
|
|
31
|
+
* classes extend {@link AsyncElement}).
|
|
32
|
+
*/
|
|
33
|
+
type AsyncElementTagName = {
|
|
34
|
+
[K in keyof HTMLElementTagNameMap]: HTMLElementTagNameMap[K] extends AsyncElement ? K : never;
|
|
35
|
+
}[keyof HTMLElementTagNameMap];
|
|
36
|
+
/**
|
|
37
|
+
* Waits for the first element matching the given tag name to be fully initialized. Note that the
|
|
38
|
+
* promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
39
|
+
* that is not a direct child of `<pc-scripts>`). A component element outside a `<pc-entity>` is
|
|
40
|
+
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
41
|
+
* element logs a warning naming the parent it requires.
|
|
42
|
+
* @param target - The tag name of the element to wait for (e.g. `'pc-app'`).
|
|
43
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
44
|
+
* @example
|
|
45
|
+
* const { app } = await whenReady('pc-app');
|
|
46
|
+
*/
|
|
47
|
+
declare function whenReady<K extends AsyncElementTagName>(target: K): Promise<HTMLElementTagNameMap[K]>;
|
|
48
|
+
/**
|
|
49
|
+
* Waits for the given element to be fully initialized. Note that the promise never settles if
|
|
50
|
+
* the element cannot finish initializing (for example, an element that is never added to the
|
|
51
|
+
* document).
|
|
52
|
+
* @param target - The element to wait for.
|
|
53
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
54
|
+
* @example
|
|
55
|
+
* const appElement = document.createElement('pc-app');
|
|
56
|
+
* document.body.appendChild(appElement);
|
|
57
|
+
* const { app } = await whenReady(appElement);
|
|
58
|
+
*/
|
|
59
|
+
declare function whenReady<T extends AsyncElement>(target: T): Promise<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Waits for the first element matching the given CSS selector to be fully initialized. Note that
|
|
62
|
+
* the promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
63
|
+
* that is not a direct child of `<pc-scripts>`). A component element outside a `<pc-entity>` is
|
|
64
|
+
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
65
|
+
* element logs a warning naming the parent it requires.
|
|
66
|
+
* @param target - A CSS selector matching the element to wait for (e.g. `'#my-app'`).
|
|
67
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
68
|
+
* @example
|
|
69
|
+
* // In TypeScript, supply the element type when using an arbitrary selector
|
|
70
|
+
* const { entity } = await whenReady<EntityElement>('pc-entity[name="camera"]');
|
|
71
|
+
*/
|
|
72
|
+
declare function whenReady<T extends AsyncElement = AsyncElement, S extends string = string>(target: S extends Exclude<keyof HTMLElementTagNameMap, AsyncElementTagName> ? never : S): Promise<T>;
|
|
73
|
+
export { AsyncElement, whenReady };
|
|
74
|
+
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).
|
|
@@ -179,6 +180,11 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
179
180
|
*/
|
|
180
181
|
get inactiveSpriteFrame(): number;
|
|
181
182
|
static get observedAttributes(): string[];
|
|
182
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
183
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
184
|
+
}
|
|
185
|
+
declare global {
|
|
186
|
+
interface HTMLElementTagNameMap {
|
|
187
|
+
'pc-button': ButtonComponentElement;
|
|
188
|
+
}
|
|
183
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.
|
|
@@ -247,6 +247,11 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
247
247
|
*/
|
|
248
248
|
get tonemap(): 'none' | 'linear' | 'filmic' | 'hejl' | 'aces' | 'aces2' | 'neutral';
|
|
249
249
|
static get observedAttributes(): string[];
|
|
250
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
250
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
251
|
+
}
|
|
252
|
+
declare global {
|
|
253
|
+
interface HTMLElementTagNameMap {
|
|
254
|
+
'pc-camera': CameraComponentElement;
|
|
255
|
+
}
|
|
251
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
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
54
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
55
|
+
}
|
|
56
|
+
declare global {
|
|
57
|
+
interface HTMLElementTagNameMap {
|
|
58
|
+
'pc-collision': CollisionComponentElement;
|
|
59
|
+
}
|
|
55
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.
|
|
@@ -33,6 +39,6 @@ declare class ComponentElement extends AsyncElement {
|
|
|
33
39
|
*/
|
|
34
40
|
get enabled(): boolean;
|
|
35
41
|
static get observedAttributes(): string[];
|
|
36
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
42
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
37
43
|
}
|
|
38
44
|
export { ComponentElement };
|
|
@@ -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.
|
|
@@ -310,6 +310,11 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
310
310
|
*/
|
|
311
311
|
get maxFontSize(): number;
|
|
312
312
|
static get observedAttributes(): string[];
|
|
313
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
313
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
314
|
+
}
|
|
315
|
+
declare global {
|
|
316
|
+
interface HTMLElementTagNameMap {
|
|
317
|
+
'pc-element': ElementComponentElement;
|
|
318
|
+
}
|
|
314
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.
|
|
@@ -103,6 +103,11 @@ declare class GSplatComponentElement extends ComponentElement {
|
|
|
103
103
|
*/
|
|
104
104
|
get lodRangeMax(): number;
|
|
105
105
|
static get observedAttributes(): string[];
|
|
106
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
106
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
107
|
+
}
|
|
108
|
+
declare global {
|
|
109
|
+
interface HTMLElementTagNameMap {
|
|
110
|
+
'pc-gsplat': GSplatComponentElement;
|
|
111
|
+
}
|
|
107
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.
|
|
@@ -105,6 +105,11 @@ declare class LayoutChildComponentElement extends ComponentElement {
|
|
|
105
105
|
*/
|
|
106
106
|
get excludeFromLayout(): boolean;
|
|
107
107
|
static get observedAttributes(): string[];
|
|
108
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
108
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
109
|
+
}
|
|
110
|
+
declare global {
|
|
111
|
+
interface HTMLElementTagNameMap {
|
|
112
|
+
'pc-layoutchild': LayoutChildComponentElement;
|
|
113
|
+
}
|
|
109
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.
|
|
@@ -129,6 +130,11 @@ declare class LayoutGroupComponentElement extends ComponentElement {
|
|
|
129
130
|
*/
|
|
130
131
|
get wrap(): boolean;
|
|
131
132
|
static get observedAttributes(): string[];
|
|
132
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
133
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
134
|
+
}
|
|
135
|
+
declare global {
|
|
136
|
+
interface HTMLElementTagNameMap {
|
|
137
|
+
'pc-layoutgroup': LayoutGroupComponentElement;
|
|
138
|
+
}
|
|
133
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.
|
|
@@ -257,6 +258,11 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
257
258
|
*/
|
|
258
259
|
get shadowBlockerSamples(): number;
|
|
259
260
|
static get observedAttributes(): string[];
|
|
260
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
261
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
262
|
+
}
|
|
263
|
+
declare global {
|
|
264
|
+
interface HTMLElementTagNameMap {
|
|
265
|
+
'pc-light': LightComponentElement;
|
|
266
|
+
}
|
|
261
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
|
/**
|
|
@@ -47,6 +47,11 @@ declare class ParticleSystemComponentElement extends ComponentElement {
|
|
|
47
47
|
*/
|
|
48
48
|
stop(): void;
|
|
49
49
|
static get observedAttributes(): string[];
|
|
50
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
50
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'pc-particles': ParticleSystemComponentElement;
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
export { ParticleSystemComponentElement };
|