@playcanvas/web-components 0.12.0 → 0.13.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.cts +281 -0
- package/dist/app.d.ts +61 -3
- package/dist/asset.d.cts +224 -0
- package/dist/asset.d.ts +8 -2
- package/dist/async-element.d.cts +103 -0
- package/dist/async-element.d.ts +6 -4
- package/dist/colors.d.cts +1 -0
- package/dist/components/button-component.d.cts +186 -0
- package/dist/components/button-component.d.ts +1 -1
- package/dist/components/camera-component.d.cts +253 -0
- package/dist/components/camera-component.d.ts +1 -1
- package/dist/components/collision-component.d.cts +73 -0
- package/dist/components/collision-component.d.ts +1 -1
- package/dist/components/component.d.cts +82 -0
- package/dist/components/component.d.ts +1 -1
- package/dist/components/element-component.d.cts +316 -0
- package/dist/components/element-component.d.ts +1 -1
- package/dist/components/gsplat-component.d.cts +108 -0
- package/dist/components/gsplat-component.d.ts +1 -1
- package/dist/components/layoutchild-component.d.cts +110 -0
- package/dist/components/layoutchild-component.d.ts +1 -1
- package/dist/components/layoutgroup-component.d.cts +136 -0
- package/dist/components/layoutgroup-component.d.ts +1 -1
- package/dist/components/light-component.d.cts +264 -0
- package/dist/components/light-component.d.ts +1 -1
- package/dist/components/listener-component.d.cts +20 -0
- package/dist/components/listener-component.d.ts +1 -1
- package/dist/components/particlesystem-component.d.cts +52 -0
- package/dist/components/particlesystem-component.d.ts +1 -1
- package/dist/components/render-component.d.cts +76 -0
- package/dist/components/render-component.d.ts +1 -1
- package/dist/components/rigidbody-component.d.cts +88 -0
- package/dist/components/rigidbody-component.d.ts +1 -1
- package/dist/components/screen-component.d.cts +70 -0
- package/dist/components/screen-component.d.ts +1 -1
- package/dist/components/script-component.d.cts +163 -0
- package/dist/components/script-component.d.ts +1 -1
- package/dist/components/script.d.cts +94 -0
- package/dist/components/script.d.ts +1 -1
- package/dist/components/scrollbar-component.d.cts +69 -0
- package/dist/components/scrollbar-component.d.ts +1 -1
- package/dist/components/scrollview-component.d.cts +178 -0
- package/dist/components/scrollview-component.d.ts +1 -1
- package/dist/components/sound-component.d.cts +108 -0
- package/dist/components/sound-component.d.ts +1 -1
- package/dist/components/sound-slot.d.cts +134 -0
- package/dist/components/sound-slot.d.ts +2 -2
- package/dist/custom-elements.json +80 -22
- package/dist/entity-base.d.cts +67 -0
- package/dist/entity-base.d.ts +2 -2
- package/dist/entity.d.cts +131 -0
- package/dist/entity.d.ts +1 -1
- package/dist/index.d.cts +79 -0
- package/dist/index.d.ts +33 -33
- package/dist/loading-bar.d.cts +35 -0
- package/dist/material.d.cts +1011 -0
- package/dist/model.d.cts +72 -0
- package/dist/model.d.ts +1 -1
- package/dist/module.d.cts +29 -0
- package/dist/module.d.ts +16 -10
- package/dist/node.d.cts +253 -0
- package/dist/node.d.ts +1 -1
- package/dist/parse.d.cts +147 -0
- package/dist/pwc.cjs +285 -92
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +286 -93
- 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 +286 -93
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.cts +117 -0
- package/dist/scene.d.ts +1 -1
- package/dist/sky.d.cts +121 -0
- package/dist/sky.d.ts +1 -1
- package/dist/vscode.html-custom-data.json +3 -3
- package/dist/web-types.json +42 -6
- package/package.json +16 -7
- package/src/app.ts +211 -49
- package/src/asset.ts +34 -2
- package/src/async-element.ts +4 -2
- package/src/components/button-component.ts +7 -7
- package/src/components/element-component.ts +7 -7
- package/src/components/gsplat-component.ts +3 -3
- package/src/components/particlesystem-component.ts +7 -8
- package/src/components/script-component.ts +2 -2
- package/src/components/sound-slot.ts +2 -2
- package/src/loading-bar.ts +2 -2
- package/src/material.ts +2 -2
- package/src/model.ts +2 -5
- package/src/module.ts +39 -20
- package/src/sky.ts +2 -3
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { AppElement } from './app.cjs';
|
|
2
|
+
import type { EntityBaseElement } from './entity-base.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
5
|
+
*
|
|
6
|
+
* @fires {CustomEvent} ready - Fired when the element is fully initialized — once per readiness
|
|
7
|
+
* cycle, so an element that is torn down and re-initialized (for example by removing and
|
|
8
|
+
* re-inserting it) fires it again. Bubbles and is composed.
|
|
9
|
+
*/
|
|
10
|
+
declare class AsyncElement extends HTMLElement {
|
|
11
|
+
private _readyPromise;
|
|
12
|
+
private _readyResolve;
|
|
13
|
+
private _readyResolved;
|
|
14
|
+
/** @ignore */
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* The nearest ancestor `<pc-app>` element, or `null` if this element has no `<pc-app>`
|
|
18
|
+
* ancestor. The search starts at the parent, so an element never resolves to itself.
|
|
19
|
+
* @returns The closest app element, or `null`.
|
|
20
|
+
*/
|
|
21
|
+
get closestApp(): AppElement | null;
|
|
22
|
+
/**
|
|
23
|
+
* The nearest ancestor element that fronts an entity — `<pc-entity>` or `<pc-node>` — or
|
|
24
|
+
* `null` if this element has no such ancestor. The search starts at the parent, so an element
|
|
25
|
+
* never resolves to itself.
|
|
26
|
+
* @returns The closest entity-fronting element, or `null`.
|
|
27
|
+
*/
|
|
28
|
+
get closestEntity(): EntityBaseElement | null;
|
|
29
|
+
/**
|
|
30
|
+
* Called when the element is fully initialized and ready. Subclasses should call this when
|
|
31
|
+
* they're ready. Resolves the ready promise and dispatches a bubbling, composed `ready`
|
|
32
|
+
* event. Signals at most once per readiness cycle: a repeat call before {@link _resetReady}
|
|
33
|
+
* has re-armed the promise does nothing.
|
|
34
|
+
*/
|
|
35
|
+
protected _onReady(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the ready promise to its pending state. Subclasses should call this when the
|
|
38
|
+
* resource their readiness announced is torn down (typically from `disconnectedCallback`),
|
|
39
|
+
* so that a later re-initialization can signal readiness again. Does nothing while the
|
|
40
|
+
* promise is still pending — an in-flight waiter carries over to the next readiness cycle
|
|
41
|
+
* rather than being stranded on a promise nothing will ever resolve.
|
|
42
|
+
*/
|
|
43
|
+
protected _resetReady(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a promise that resolves with this element when it's ready. This is the low-level
|
|
46
|
+
* primitive underlying {@link whenReady}, which is the recommended way to wait for elements.
|
|
47
|
+
*
|
|
48
|
+
* Readiness tracks the element's current lifecycle: once a ready element is torn down (for
|
|
49
|
+
* example by removing it from the document), this returns a fresh promise that resolves when
|
|
50
|
+
* the element is next ready. A promise obtained earlier stays resolved — call this again
|
|
51
|
+
* after re-inserting an element rather than reusing a promise from before its removal.
|
|
52
|
+
* @returns A promise that resolves with this element when it's ready.
|
|
53
|
+
*/
|
|
54
|
+
ready(): Promise<this>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A union of the tag names of all elements that initialize asynchronously (i.e. elements whose
|
|
58
|
+
* classes extend {@link AsyncElement}).
|
|
59
|
+
*/
|
|
60
|
+
type AsyncElementTagName = {
|
|
61
|
+
[K in keyof HTMLElementTagNameMap]: HTMLElementTagNameMap[K] extends AsyncElement ? K : never;
|
|
62
|
+
}[keyof HTMLElementTagNameMap];
|
|
63
|
+
/**
|
|
64
|
+
* Waits for the first element matching the given tag name to be fully initialized. Note that the
|
|
65
|
+
* promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
66
|
+
* that is not a direct child of `<pc-scripts>`, or a `<pc-app>` that could not create a graphics
|
|
67
|
+
* device — listen for its `error` event instead). A component element outside a `<pc-entity>` is
|
|
68
|
+
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
69
|
+
* element logs a warning naming the parent it requires.
|
|
70
|
+
* @param target - The tag name of the element to wait for (e.g. `'pc-app'`).
|
|
71
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
72
|
+
* @example
|
|
73
|
+
* const { app } = await whenReady('pc-app');
|
|
74
|
+
*/
|
|
75
|
+
declare function whenReady<K extends AsyncElementTagName>(target: K): Promise<HTMLElementTagNameMap[K]>;
|
|
76
|
+
/**
|
|
77
|
+
* Waits for the given element to be fully initialized. Note that the promise never settles if
|
|
78
|
+
* the element cannot finish initializing (for example, an element that is never added to the
|
|
79
|
+
* document).
|
|
80
|
+
* @param target - The element to wait for.
|
|
81
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
82
|
+
* @example
|
|
83
|
+
* const appElement = document.createElement('pc-app');
|
|
84
|
+
* document.body.appendChild(appElement);
|
|
85
|
+
* const { app } = await whenReady(appElement);
|
|
86
|
+
*/
|
|
87
|
+
declare function whenReady<T extends AsyncElement>(target: T): Promise<T>;
|
|
88
|
+
/**
|
|
89
|
+
* Waits for the first element matching the given CSS selector to be fully initialized. Note that
|
|
90
|
+
* the promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
91
|
+
* that is not a direct child of `<pc-scripts>`, or a `<pc-app>` that could not create a graphics
|
|
92
|
+
* device — listen for its `error` event instead). A component element outside a `<pc-entity>` is
|
|
93
|
+
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
94
|
+
* element logs a warning naming the parent it requires.
|
|
95
|
+
* @param target - A CSS selector matching the element to wait for (e.g. `'#my-app'`).
|
|
96
|
+
* @returns A promise that resolves with the element once it's ready.
|
|
97
|
+
* @example
|
|
98
|
+
* // In TypeScript, supply the element type when using an arbitrary selector
|
|
99
|
+
* const { entity } = await whenReady<EntityElement>('pc-entity[name="camera"]');
|
|
100
|
+
*/
|
|
101
|
+
declare function whenReady<T extends AsyncElement = AsyncElement, S extends string = string>(target: S extends Exclude<keyof HTMLElementTagNameMap, AsyncElementTagName> ? never : S): Promise<T>;
|
|
102
|
+
export { AsyncElement, whenReady };
|
|
103
|
+
export type { AsyncElementTagName };
|
package/dist/async-element.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AppElement } from './app';
|
|
2
|
-
import type { EntityBaseElement } from './entity-base';
|
|
1
|
+
import type { AppElement } from './app.js';
|
|
2
|
+
import type { EntityBaseElement } from './entity-base.js';
|
|
3
3
|
/**
|
|
4
4
|
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
5
5
|
*
|
|
@@ -63,7 +63,8 @@ type AsyncElementTagName = {
|
|
|
63
63
|
/**
|
|
64
64
|
* Waits for the first element matching the given tag name to be fully initialized. Note that the
|
|
65
65
|
* promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
66
|
-
* that is not a direct child of `<pc-scripts
|
|
66
|
+
* that is not a direct child of `<pc-scripts>`, or a `<pc-app>` that could not create a graphics
|
|
67
|
+
* device — listen for its `error` event instead). A component element outside a `<pc-entity>` is
|
|
67
68
|
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
68
69
|
* element logs a warning naming the parent it requires.
|
|
69
70
|
* @param target - The tag name of the element to wait for (e.g. `'pc-app'`).
|
|
@@ -87,7 +88,8 @@ declare function whenReady<T extends AsyncElement>(target: T): Promise<T>;
|
|
|
87
88
|
/**
|
|
88
89
|
* Waits for the first element matching the given CSS selector to be fully initialized. Note that
|
|
89
90
|
* the promise never settles if the element cannot finish initializing (for example, a `<pc-script>`
|
|
90
|
-
* that is not a direct child of `<pc-scripts
|
|
91
|
+
* that is not a direct child of `<pc-scripts>`, or a `<pc-app>` that could not create a graphics
|
|
92
|
+
* device — listen for its `error` event instead). A component element outside a `<pc-entity>` is
|
|
91
93
|
* the exception: it still becomes ready, but its `component` is `null`. Either way, a misplaced
|
|
92
94
|
* element logs a warning naming the parent it requires.
|
|
93
95
|
* @param target - A CSS selector matching the element to wait for (e.g. `'#my-app'`).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CSS_COLORS: Record<string, string>;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { ButtonComponent } from 'playcanvas';
|
|
2
|
+
import { Color, Vec4 } from 'playcanvas';
|
|
3
|
+
import { ComponentElement } from './component.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* The ButtonComponentElement interface provides properties and methods for manipulating
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-button/ | `<pc-button>`} elements.
|
|
7
|
+
* The ButtonComponentElement interface also inherits the properties and methods of the
|
|
8
|
+
* {@link HTMLElement} interface.
|
|
9
|
+
*
|
|
10
|
+
* @category Components
|
|
11
|
+
*/
|
|
12
|
+
declare class ButtonComponentElement extends ComponentElement {
|
|
13
|
+
private _active;
|
|
14
|
+
private _image;
|
|
15
|
+
private _hitPadding;
|
|
16
|
+
private _transitionMode;
|
|
17
|
+
private _hoverTint;
|
|
18
|
+
private _pressedTint;
|
|
19
|
+
private _inactiveTint;
|
|
20
|
+
private _fadeDuration;
|
|
21
|
+
private _hoverSpriteAsset;
|
|
22
|
+
private _hoverSpriteFrame;
|
|
23
|
+
private _pressedSpriteAsset;
|
|
24
|
+
private _pressedSpriteFrame;
|
|
25
|
+
private _inactiveSpriteAsset;
|
|
26
|
+
private _inactiveSpriteFrame;
|
|
27
|
+
/** @ignore */
|
|
28
|
+
constructor();
|
|
29
|
+
protected getInitialComponentData(): Record<string, any>;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the underlying PlayCanvas button component.
|
|
32
|
+
* @returns The button component.
|
|
33
|
+
*/
|
|
34
|
+
get component(): ButtonComponent;
|
|
35
|
+
/**
|
|
36
|
+
* Sets whether the button is active and responds to input.
|
|
37
|
+
* @param value - Whether the button is active.
|
|
38
|
+
*/
|
|
39
|
+
set active(value: boolean);
|
|
40
|
+
/**
|
|
41
|
+
* Gets whether the button is active.
|
|
42
|
+
* @returns Whether the button is active.
|
|
43
|
+
*/
|
|
44
|
+
get active(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` whose image
|
|
47
|
+
* element is used for visual transitions. Defaults to the button's own entity.
|
|
48
|
+
* @param value - The image entity reference.
|
|
49
|
+
*/
|
|
50
|
+
set image(value: string);
|
|
51
|
+
/**
|
|
52
|
+
* Gets the reference to the `<pc-entity>` whose image element is used for visual transitions.
|
|
53
|
+
* @returns The image entity reference.
|
|
54
|
+
*/
|
|
55
|
+
get image(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the padding used to expand the button's hit area, as a Vec4 (left, bottom, right, top).
|
|
58
|
+
* @param value - The hit padding.
|
|
59
|
+
*/
|
|
60
|
+
set hitPadding(value: Vec4);
|
|
61
|
+
/**
|
|
62
|
+
* Gets the padding used to expand the button's hit area.
|
|
63
|
+
* @returns The hit padding.
|
|
64
|
+
*/
|
|
65
|
+
get hitPadding(): Vec4;
|
|
66
|
+
/**
|
|
67
|
+
* Sets how the button reacts to being hovered/pressed. Can be `tint` or `sprite`. Defaults to
|
|
68
|
+
* `tint`.
|
|
69
|
+
* @param value - The transition mode.
|
|
70
|
+
*/
|
|
71
|
+
set transitionMode(value: 'tint' | 'sprite');
|
|
72
|
+
/**
|
|
73
|
+
* Gets how the button reacts to being hovered/pressed.
|
|
74
|
+
* @returns The transition mode.
|
|
75
|
+
*/
|
|
76
|
+
get transitionMode(): "tint" | "sprite";
|
|
77
|
+
/**
|
|
78
|
+
* Sets the tint color applied to the image entity when the button is hovered (tint transition
|
|
79
|
+
* mode).
|
|
80
|
+
* @param value - The hover tint.
|
|
81
|
+
*/
|
|
82
|
+
set hoverTint(value: Color);
|
|
83
|
+
/**
|
|
84
|
+
* Gets the hover tint color.
|
|
85
|
+
* @returns The hover tint.
|
|
86
|
+
*/
|
|
87
|
+
get hoverTint(): Color;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the tint color applied to the image entity when the button is pressed (tint transition
|
|
90
|
+
* mode).
|
|
91
|
+
* @param value - The pressed tint.
|
|
92
|
+
*/
|
|
93
|
+
set pressedTint(value: Color);
|
|
94
|
+
/**
|
|
95
|
+
* Gets the pressed tint color.
|
|
96
|
+
* @returns The pressed tint.
|
|
97
|
+
*/
|
|
98
|
+
get pressedTint(): Color;
|
|
99
|
+
/**
|
|
100
|
+
* Sets the tint color applied to the image entity when the button is inactive (tint transition
|
|
101
|
+
* mode).
|
|
102
|
+
* @param value - The inactive tint.
|
|
103
|
+
*/
|
|
104
|
+
set inactiveTint(value: Color);
|
|
105
|
+
/**
|
|
106
|
+
* Gets the inactive tint color.
|
|
107
|
+
* @returns The inactive tint.
|
|
108
|
+
*/
|
|
109
|
+
get inactiveTint(): Color;
|
|
110
|
+
/**
|
|
111
|
+
* Sets the duration (in milliseconds) over which tint transitions are applied.
|
|
112
|
+
* @param value - The fade duration.
|
|
113
|
+
*/
|
|
114
|
+
set fadeDuration(value: number);
|
|
115
|
+
/**
|
|
116
|
+
* Gets the duration over which tint transitions are applied.
|
|
117
|
+
* @returns The fade duration.
|
|
118
|
+
*/
|
|
119
|
+
get fadeDuration(): number;
|
|
120
|
+
/**
|
|
121
|
+
* Sets the id of the `pc-asset` sprite shown when the button is hovered (sprite transition
|
|
122
|
+
* mode).
|
|
123
|
+
* @param value - The hover sprite asset id.
|
|
124
|
+
*/
|
|
125
|
+
set hoverSpriteAsset(value: string);
|
|
126
|
+
/**
|
|
127
|
+
* Gets the id of the `pc-asset` sprite shown when the button is hovered.
|
|
128
|
+
* @returns The hover sprite asset id.
|
|
129
|
+
*/
|
|
130
|
+
get hoverSpriteAsset(): string;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the frame of the hover sprite to show.
|
|
133
|
+
* @param value - The hover sprite frame.
|
|
134
|
+
*/
|
|
135
|
+
set hoverSpriteFrame(value: number);
|
|
136
|
+
/**
|
|
137
|
+
* Gets the frame of the hover sprite to show.
|
|
138
|
+
* @returns The hover sprite frame.
|
|
139
|
+
*/
|
|
140
|
+
get hoverSpriteFrame(): number;
|
|
141
|
+
/**
|
|
142
|
+
* Sets the id of the `pc-asset` sprite shown when the button is pressed (sprite transition
|
|
143
|
+
* mode).
|
|
144
|
+
* @param value - The pressed sprite asset id.
|
|
145
|
+
*/
|
|
146
|
+
set pressedSpriteAsset(value: string);
|
|
147
|
+
/**
|
|
148
|
+
* Gets the id of the `pc-asset` sprite shown when the button is pressed.
|
|
149
|
+
* @returns The pressed sprite asset id.
|
|
150
|
+
*/
|
|
151
|
+
get pressedSpriteAsset(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Sets the frame of the pressed sprite to show.
|
|
154
|
+
* @param value - The pressed sprite frame.
|
|
155
|
+
*/
|
|
156
|
+
set pressedSpriteFrame(value: number);
|
|
157
|
+
/**
|
|
158
|
+
* Gets the frame of the pressed sprite to show.
|
|
159
|
+
* @returns The pressed sprite frame.
|
|
160
|
+
*/
|
|
161
|
+
get pressedSpriteFrame(): number;
|
|
162
|
+
/**
|
|
163
|
+
* Sets the id of the `pc-asset` sprite shown when the button is inactive (sprite transition
|
|
164
|
+
* mode).
|
|
165
|
+
* @param value - The inactive sprite asset id.
|
|
166
|
+
*/
|
|
167
|
+
set inactiveSpriteAsset(value: string);
|
|
168
|
+
/**
|
|
169
|
+
* Gets the id of the `pc-asset` sprite shown when the button is inactive.
|
|
170
|
+
* @returns The inactive sprite asset id.
|
|
171
|
+
*/
|
|
172
|
+
get inactiveSpriteAsset(): string;
|
|
173
|
+
/**
|
|
174
|
+
* Sets the frame of the inactive sprite to show.
|
|
175
|
+
* @param value - The inactive sprite frame.
|
|
176
|
+
*/
|
|
177
|
+
set inactiveSpriteFrame(value: number);
|
|
178
|
+
/**
|
|
179
|
+
* Gets the frame of the inactive sprite to show.
|
|
180
|
+
* @returns The inactive sprite frame.
|
|
181
|
+
*/
|
|
182
|
+
get inactiveSpriteFrame(): number;
|
|
183
|
+
static get observedAttributes(): string[];
|
|
184
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
185
|
+
}
|
|
186
|
+
export { ButtonComponentElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonComponent } from 'playcanvas';
|
|
2
2
|
import { Color, Vec4 } from 'playcanvas';
|
|
3
|
-
import { ComponentElement } from './component';
|
|
3
|
+
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The ButtonComponentElement interface provides properties and methods for manipulating
|
|
6
6
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-button/ | `<pc-button>`} elements.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { CameraComponent } from 'playcanvas';
|
|
2
|
+
import { Color, Vec4 } from 'playcanvas';
|
|
3
|
+
import { ComponentElement } from './component.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
7
|
+
* The CameraComponentElement interface also inherits the properties and methods of the
|
|
8
|
+
* {@link HTMLElement} interface.
|
|
9
|
+
*
|
|
10
|
+
* @category Components
|
|
11
|
+
*/
|
|
12
|
+
declare class CameraComponentElement extends ComponentElement {
|
|
13
|
+
private _clearColor;
|
|
14
|
+
private _clearColorBuffer;
|
|
15
|
+
private _clearDepthBuffer;
|
|
16
|
+
private _clearStencilBuffer;
|
|
17
|
+
private _cullFaces;
|
|
18
|
+
private _farClip;
|
|
19
|
+
private _flipFaces;
|
|
20
|
+
private _fov;
|
|
21
|
+
private _frustumCulling;
|
|
22
|
+
private _gamma;
|
|
23
|
+
private _horizontalFov;
|
|
24
|
+
private _nearClip;
|
|
25
|
+
private _projection;
|
|
26
|
+
private _orthoHeight;
|
|
27
|
+
private _priority;
|
|
28
|
+
private _rect;
|
|
29
|
+
private _scissorRect;
|
|
30
|
+
private _tonemap;
|
|
31
|
+
/** @ignore */
|
|
32
|
+
constructor();
|
|
33
|
+
protected getInitialComponentData(): {
|
|
34
|
+
clearColor: Color;
|
|
35
|
+
clearColorBuffer: boolean;
|
|
36
|
+
clearDepthBuffer: boolean;
|
|
37
|
+
clearStencilBuffer: boolean;
|
|
38
|
+
cullFaces: boolean;
|
|
39
|
+
farClip: number;
|
|
40
|
+
flipFaces: boolean;
|
|
41
|
+
fov: number;
|
|
42
|
+
frustumCulling: boolean;
|
|
43
|
+
gammaCorrection: 0 | 1;
|
|
44
|
+
horizontalFov: boolean;
|
|
45
|
+
nearClip: number;
|
|
46
|
+
projection: number;
|
|
47
|
+
orthoHeight: number;
|
|
48
|
+
priority: number;
|
|
49
|
+
rect: Vec4;
|
|
50
|
+
scissorRect: Vec4;
|
|
51
|
+
toneMapping: number;
|
|
52
|
+
};
|
|
53
|
+
get xrAvailable(): boolean | null;
|
|
54
|
+
/**
|
|
55
|
+
* Starts the camera in XR mode.
|
|
56
|
+
* @param type - The type of XR mode to start.
|
|
57
|
+
* @param space - The space to start the camera in.
|
|
58
|
+
*/
|
|
59
|
+
startXr(type: 'immersive-ar' | 'immersive-vr', space: 'bounded-floor' | 'local' | 'local-floor' | 'unbounded' | 'viewer'): void;
|
|
60
|
+
/**
|
|
61
|
+
* Ends the camera's XR mode.
|
|
62
|
+
*/
|
|
63
|
+
endXr(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the underlying PlayCanvas camera component.
|
|
66
|
+
* @returns The camera component.
|
|
67
|
+
*/
|
|
68
|
+
get component(): CameraComponent;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the clear color of the camera.
|
|
71
|
+
* @param value - The clear color.
|
|
72
|
+
*/
|
|
73
|
+
set clearColor(value: Color);
|
|
74
|
+
/**
|
|
75
|
+
* Gets the clear color of the camera.
|
|
76
|
+
* @returns The clear color.
|
|
77
|
+
*/
|
|
78
|
+
get clearColor(): Color;
|
|
79
|
+
/**
|
|
80
|
+
* Sets the clear color buffer of the camera.
|
|
81
|
+
* @param value - The clear color buffer.
|
|
82
|
+
*/
|
|
83
|
+
set clearColorBuffer(value: boolean);
|
|
84
|
+
/**
|
|
85
|
+
* Gets the clear color buffer of the camera.
|
|
86
|
+
* @returns The clear color buffer.
|
|
87
|
+
*/
|
|
88
|
+
get clearColorBuffer(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the clear depth buffer of the camera.
|
|
91
|
+
* @param value - The clear depth buffer.
|
|
92
|
+
*/
|
|
93
|
+
set clearDepthBuffer(value: boolean);
|
|
94
|
+
/**
|
|
95
|
+
* Gets the clear depth buffer of the camera.
|
|
96
|
+
* @returns The clear depth buffer.
|
|
97
|
+
*/
|
|
98
|
+
get clearDepthBuffer(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Sets the clear stencil buffer of the camera.
|
|
101
|
+
* @param value - The clear stencil buffer.
|
|
102
|
+
*/
|
|
103
|
+
set clearStencilBuffer(value: boolean);
|
|
104
|
+
/**
|
|
105
|
+
* Gets the clear stencil buffer of the camera.
|
|
106
|
+
* @returns The clear stencil buffer.
|
|
107
|
+
*/
|
|
108
|
+
get clearStencilBuffer(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the cull faces of the camera.
|
|
111
|
+
* @param value - The cull faces.
|
|
112
|
+
*/
|
|
113
|
+
set cullFaces(value: boolean);
|
|
114
|
+
/**
|
|
115
|
+
* Gets the cull faces of the camera.
|
|
116
|
+
* @returns The cull faces.
|
|
117
|
+
*/
|
|
118
|
+
get cullFaces(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Sets the far clip distance of the camera.
|
|
121
|
+
* @param value - The far clip distance.
|
|
122
|
+
*/
|
|
123
|
+
set farClip(value: number);
|
|
124
|
+
/**
|
|
125
|
+
* Gets the far clip distance of the camera.
|
|
126
|
+
* @returns The far clip distance.
|
|
127
|
+
*/
|
|
128
|
+
get farClip(): number;
|
|
129
|
+
/**
|
|
130
|
+
* Sets the flip faces of the camera.
|
|
131
|
+
* @param value - The flip faces.
|
|
132
|
+
*/
|
|
133
|
+
set flipFaces(value: boolean);
|
|
134
|
+
/**
|
|
135
|
+
* Gets the flip faces of the camera.
|
|
136
|
+
* @returns The flip faces.
|
|
137
|
+
*/
|
|
138
|
+
get flipFaces(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Sets the field of view of the camera.
|
|
141
|
+
* @param value - The field of view.
|
|
142
|
+
*/
|
|
143
|
+
set fov(value: number);
|
|
144
|
+
/**
|
|
145
|
+
* Gets the field of view of the camera.
|
|
146
|
+
* @returns The field of view.
|
|
147
|
+
*/
|
|
148
|
+
get fov(): number;
|
|
149
|
+
/**
|
|
150
|
+
* Sets the frustum culling of the camera.
|
|
151
|
+
* @param value - The frustum culling.
|
|
152
|
+
*/
|
|
153
|
+
set frustumCulling(value: boolean);
|
|
154
|
+
/**
|
|
155
|
+
* Gets the frustum culling of the camera.
|
|
156
|
+
* @returns The frustum culling.
|
|
157
|
+
*/
|
|
158
|
+
get frustumCulling(): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Sets the gamma correction of the camera.
|
|
161
|
+
* @param value - The gamma correction.
|
|
162
|
+
*/
|
|
163
|
+
set gamma(value: 'linear' | 'srgb');
|
|
164
|
+
/**
|
|
165
|
+
* Gets the gamma correction of the camera.
|
|
166
|
+
* @returns The gamma correction.
|
|
167
|
+
*/
|
|
168
|
+
get gamma(): 'linear' | 'srgb';
|
|
169
|
+
/**
|
|
170
|
+
* Sets whether the camera's field of view (fov) is horizontal or vertical. Defaults to false
|
|
171
|
+
* (meaning it is vertical be default).
|
|
172
|
+
* @param value - Whether the camera's field of view is horizontal.
|
|
173
|
+
*/
|
|
174
|
+
set horizontalFov(value: boolean);
|
|
175
|
+
/**
|
|
176
|
+
* Gets whether the camera's field of view (fov) is horizontal or vertical.
|
|
177
|
+
* @returns Whether the camera's field of view is horizontal.
|
|
178
|
+
*/
|
|
179
|
+
get horizontalFov(): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Sets the near clip distance of the camera.
|
|
182
|
+
* @param value - The near clip distance.
|
|
183
|
+
*/
|
|
184
|
+
set nearClip(value: number);
|
|
185
|
+
/**
|
|
186
|
+
* Gets the near clip distance of the camera.
|
|
187
|
+
* @returns The near clip distance.
|
|
188
|
+
*/
|
|
189
|
+
get nearClip(): number;
|
|
190
|
+
/**
|
|
191
|
+
* Sets the orthographic height of the camera.
|
|
192
|
+
* @param value - The orthographic height.
|
|
193
|
+
*/
|
|
194
|
+
set orthoHeight(value: number);
|
|
195
|
+
/**
|
|
196
|
+
* Gets the orthographic height of the camera.
|
|
197
|
+
* @returns The orthographic height.
|
|
198
|
+
*/
|
|
199
|
+
get orthoHeight(): number;
|
|
200
|
+
/**
|
|
201
|
+
* Sets the priority of the camera.
|
|
202
|
+
* @param value - The priority.
|
|
203
|
+
*/
|
|
204
|
+
set priority(value: number);
|
|
205
|
+
/**
|
|
206
|
+
* Gets the priority of the camera.
|
|
207
|
+
* @returns The priority.
|
|
208
|
+
*/
|
|
209
|
+
get priority(): number;
|
|
210
|
+
/**
|
|
211
|
+
* Sets the projection of the camera. Use `orthoHeight` to size an orthographic projection.
|
|
212
|
+
* @param value - The projection ('perspective' or 'orthographic').
|
|
213
|
+
*/
|
|
214
|
+
set projection(value: 'perspective' | 'orthographic');
|
|
215
|
+
/**
|
|
216
|
+
* Gets the projection of the camera.
|
|
217
|
+
* @returns The projection.
|
|
218
|
+
*/
|
|
219
|
+
get projection(): "perspective" | "orthographic";
|
|
220
|
+
/**
|
|
221
|
+
* Sets the rect of the camera.
|
|
222
|
+
* @param value - The rect.
|
|
223
|
+
*/
|
|
224
|
+
set rect(value: Vec4);
|
|
225
|
+
/**
|
|
226
|
+
* Gets the rect of the camera.
|
|
227
|
+
* @returns The rect.
|
|
228
|
+
*/
|
|
229
|
+
get rect(): Vec4;
|
|
230
|
+
/**
|
|
231
|
+
* Sets the scissor rect of the camera.
|
|
232
|
+
* @param value - The scissor rect.
|
|
233
|
+
*/
|
|
234
|
+
set scissorRect(value: Vec4);
|
|
235
|
+
/**
|
|
236
|
+
* Gets the scissor rect of the camera.
|
|
237
|
+
* @returns The scissor rect.
|
|
238
|
+
*/
|
|
239
|
+
get scissorRect(): Vec4;
|
|
240
|
+
/**
|
|
241
|
+
* Sets the tone mapping of the camera.
|
|
242
|
+
* @param value - The tone mapping.
|
|
243
|
+
*/
|
|
244
|
+
set tonemap(value: 'none' | 'linear' | 'filmic' | 'hejl' | 'aces' | 'aces2' | 'neutral');
|
|
245
|
+
/**
|
|
246
|
+
* Gets the tone mapping of the camera.
|
|
247
|
+
* @returns The tone mapping.
|
|
248
|
+
*/
|
|
249
|
+
get tonemap(): 'none' | 'linear' | 'filmic' | 'hejl' | 'aces' | 'aces2' | 'neutral';
|
|
250
|
+
static get observedAttributes(): string[];
|
|
251
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
252
|
+
}
|
|
253
|
+
export { CameraComponentElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CameraComponent } from 'playcanvas';
|
|
2
2
|
import { Color, Vec4 } from 'playcanvas';
|
|
3
|
-
import { ComponentElement } from './component';
|
|
3
|
+
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
6
6
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { CollisionComponent } from 'playcanvas';
|
|
2
|
+
import { Quat, Vec3 } from 'playcanvas';
|
|
3
|
+
import { ComponentElement } from './component.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
7
|
+
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
8
|
+
* {@link HTMLElement} interface.
|
|
9
|
+
*
|
|
10
|
+
* For `type="mesh"`, the collision geometry defaults to the host entity's own render component
|
|
11
|
+
* (its render asset) — a collider matching the visible mesh, which is what a mesh collider on a
|
|
12
|
+
* glTF node means. The default resolves each time the component applies, so a `pc-node` that
|
|
13
|
+
* retargets or rebinds picks up the new node's geometry. An entity with no asset-backed render
|
|
14
|
+
* component warns, and the collider has no shape.
|
|
15
|
+
*
|
|
16
|
+
* @category Components
|
|
17
|
+
*/
|
|
18
|
+
declare class CollisionComponentElement extends ComponentElement {
|
|
19
|
+
private _angularOffset;
|
|
20
|
+
private _axis;
|
|
21
|
+
private _convexHull;
|
|
22
|
+
private _halfExtents;
|
|
23
|
+
private _height;
|
|
24
|
+
private _linearOffset;
|
|
25
|
+
private _radius;
|
|
26
|
+
private _type;
|
|
27
|
+
/** @ignore */
|
|
28
|
+
constructor();
|
|
29
|
+
protected getInitialComponentData(): {
|
|
30
|
+
axis: number;
|
|
31
|
+
angularOffset: Quat;
|
|
32
|
+
convexHull: boolean;
|
|
33
|
+
halfExtents: Vec3;
|
|
34
|
+
height: number;
|
|
35
|
+
linearOffset: Vec3;
|
|
36
|
+
radius: number;
|
|
37
|
+
type: "box" | "capsule" | "compound" | "cone" | "cylinder" | "mesh" | "sphere";
|
|
38
|
+
};
|
|
39
|
+
protected initComponent(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Defaults a mesh collider's geometry to the host entity's own render component. The
|
|
42
|
+
* engine's mesh collider only works with explicitly supplied geometry, and the element has
|
|
43
|
+
* no attribute to supply it - so the host's visible geometry, the meaning a mesh collider
|
|
44
|
+
* on a glTF node carries, fills the gap. Runs on every application (so a rebound `pc-node`
|
|
45
|
+
* recomputes it) and on a runtime switch to `type="mesh"`; an explicitly assigned
|
|
46
|
+
* `renderAsset` is never overwritten.
|
|
47
|
+
*/
|
|
48
|
+
private _applyMeshGeometryDefault;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the underlying PlayCanvas collision component.
|
|
51
|
+
* @returns The collision component.
|
|
52
|
+
*/
|
|
53
|
+
get component(): CollisionComponent;
|
|
54
|
+
set angularOffset(value: Quat);
|
|
55
|
+
get angularOffset(): Quat;
|
|
56
|
+
set axis(value: number);
|
|
57
|
+
get axis(): number;
|
|
58
|
+
set convexHull(value: boolean);
|
|
59
|
+
get convexHull(): boolean;
|
|
60
|
+
set halfExtents(value: Vec3);
|
|
61
|
+
get halfExtents(): Vec3;
|
|
62
|
+
set height(value: number);
|
|
63
|
+
get height(): number;
|
|
64
|
+
set linearOffset(value: Vec3);
|
|
65
|
+
get linearOffset(): Vec3;
|
|
66
|
+
set radius(value: number);
|
|
67
|
+
get radius(): number;
|
|
68
|
+
set type(value: 'box' | 'capsule' | 'compound' | 'cone' | 'cylinder' | 'mesh' | 'sphere');
|
|
69
|
+
get type(): "box" | "capsule" | "compound" | "cone" | "cylinder" | "mesh" | "sphere";
|
|
70
|
+
static get observedAttributes(): string[];
|
|
71
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
72
|
+
}
|
|
73
|
+
export { CollisionComponentElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollisionComponent } from 'playcanvas';
|
|
2
2
|
import { Quat, Vec3 } from 'playcanvas';
|
|
3
|
-
import { ComponentElement } from './component';
|
|
3
|
+
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
6
6
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|