@playcanvas/web-components 0.9.0 → 0.10.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 +18 -0
- package/dist/app.d.ts +55 -9
- package/dist/asset.d.ts +25 -1
- package/dist/async-element.d.ts +15 -2
- package/dist/components/button-component.d.ts +1 -1
- package/dist/components/camera-component.d.ts +1 -1
- package/dist/components/collision-component.d.ts +1 -1
- package/dist/components/component.d.ts +6 -5
- package/dist/components/element-component.d.ts +1 -1
- package/dist/components/gsplat-component.d.ts +1 -1
- package/dist/components/layoutchild-component.d.ts +1 -1
- package/dist/components/layoutgroup-component.d.ts +1 -1
- package/dist/components/light-component.d.ts +1 -1
- package/dist/components/particlesystem-component.d.ts +1 -1
- package/dist/components/render-component.d.ts +1 -1
- package/dist/components/rigidbody-component.d.ts +1 -1
- package/dist/components/screen-component.d.ts +1 -1
- package/dist/components/script.d.ts +8 -1
- package/dist/components/scrollbar-component.d.ts +1 -1
- package/dist/components/scrollview-component.d.ts +1 -1
- package/dist/components/sound-component.d.ts +1 -1
- package/dist/components/sound-slot.d.ts +9 -1
- package/dist/custom-elements.json +16704 -0
- package/dist/entity.d.ts +24 -5
- package/dist/loading-bar.d.ts +35 -0
- package/dist/material.d.ts +972 -4
- package/dist/model.d.ts +1 -1
- package/dist/module.d.ts +10 -0
- package/dist/{utils.d.ts → parse.d.ts} +63 -33
- package/dist/pwc.cjs +3070 -699
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +3070 -699
- 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 +3071 -700
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +12 -4
- package/dist/sky.d.ts +1 -1
- package/dist/vscode.html-custom-data.json +1800 -0
- package/dist/web-types.json +3836 -0
- package/package.json +29 -11
- package/src/app.ts +178 -78
- package/src/asset.ts +44 -2
- package/src/async-element.ts +17 -4
- package/src/components/button-component.ts +6 -6
- package/src/components/camera-component.ts +2 -2
- package/src/components/collision-component.ts +2 -2
- package/src/components/component.ts +8 -7
- package/src/components/element-component.ts +6 -6
- package/src/components/gsplat-component.ts +3 -3
- package/src/components/layoutchild-component.ts +2 -2
- package/src/components/layoutgroup-component.ts +2 -2
- package/src/components/light-component.ts +2 -2
- package/src/components/particlesystem-component.ts +2 -2
- package/src/components/render-component.ts +10 -5
- package/src/components/rigidbody-component.ts +2 -2
- package/src/components/screen-component.ts +2 -2
- package/src/components/script-component.ts +4 -4
- package/src/components/script.ts +9 -2
- package/src/components/scrollbar-component.ts +3 -3
- package/src/components/scrollview-component.ts +6 -6
- package/src/components/sound-component.ts +2 -2
- package/src/components/sound-slot.ts +31 -9
- package/src/entity.ts +56 -22
- package/src/loading-bar.ts +122 -0
- package/src/material.ts +2402 -59
- package/src/model.ts +2 -2
- package/src/module.ts +10 -0
- package/src/{utils.ts → parse.ts} +104 -65
- package/src/scene.ts +51 -21
- package/src/sky.ts +3 -3
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
|
@@ -5,6 +5,11 @@ import { AsyncElement } from './async-element';
|
|
|
5
5
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/ | `<pc-app>`} elements.
|
|
6
6
|
* The AppElement interface also inherits the properties and methods of the
|
|
7
7
|
* {@link HTMLElement} interface.
|
|
8
|
+
*
|
|
9
|
+
* @fires {ProgressEvent} progress - Fired while the application preloads its assets. `loaded` and
|
|
10
|
+
* `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded.
|
|
11
|
+
* Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does
|
|
12
|
+
* not bubble.
|
|
8
13
|
*/
|
|
9
14
|
declare class AppElement extends AsyncElement {
|
|
10
15
|
/**
|
|
@@ -17,18 +22,31 @@ declare class AppElement extends AsyncElement {
|
|
|
17
22
|
private _depth;
|
|
18
23
|
private _stencil;
|
|
19
24
|
private _highResolution;
|
|
25
|
+
private _loadingBar;
|
|
26
|
+
private _bar;
|
|
20
27
|
private _hierarchyReady;
|
|
21
28
|
private _picker;
|
|
22
29
|
private _hasPointerListeners;
|
|
23
30
|
private _hoveredEntity;
|
|
31
|
+
private _pickToken;
|
|
24
32
|
private _pointerHandlers;
|
|
25
33
|
private _app;
|
|
34
|
+
private _loadProgress;
|
|
26
35
|
/**
|
|
27
|
-
* The PlayCanvas application instance.
|
|
28
|
-
* {@link whenReady} or the element's `ready()`
|
|
29
|
-
*
|
|
36
|
+
* The PlayCanvas application instance. `null` until the element is ready, and again once it
|
|
37
|
+
* has been removed from the document — await {@link whenReady} or the element's `ready()`
|
|
38
|
+
* promise before accessing it.
|
|
39
|
+
* @returns The application instance, or `null`.
|
|
30
40
|
*/
|
|
31
|
-
get app(): AppBase;
|
|
41
|
+
get app(): AppBase | null;
|
|
42
|
+
/**
|
|
43
|
+
* The asset preload progress of the application, as a fraction from 0 to 1. It is 0 until
|
|
44
|
+
* preloading begins (and again once the element has been removed from the document), and 1
|
|
45
|
+
* once preloading has finished — including when there was nothing to preload. Read this to
|
|
46
|
+
* initialize a loading UI; subsequent updates arrive via the `progress` event.
|
|
47
|
+
* @returns The preload progress.
|
|
48
|
+
*/
|
|
49
|
+
get loadProgress(): number;
|
|
32
50
|
/**
|
|
33
51
|
* Creates a new AppElement instance.
|
|
34
52
|
*
|
|
@@ -41,9 +59,21 @@ declare class AppElement extends AsyncElement {
|
|
|
41
59
|
_pickerCreate(): void;
|
|
42
60
|
_pickerDestroy(): void;
|
|
43
61
|
private _getPickerCoordinates;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Picks the scene under the pointer and returns the graph node that was hit, or `null`.
|
|
64
|
+
*
|
|
65
|
+
* The read back is asynchronous because the synchronous {@link Picker.getSelection} is not
|
|
66
|
+
* supported on WebGPU, where it returns an empty selection rather than failing - which
|
|
67
|
+
* silently disabled every `onpointer*` handler once WebGPU became the resolved backend. The
|
|
68
|
+
* async variant works on both backends and does not block the main thread on a GPU read.
|
|
69
|
+
*
|
|
70
|
+
* @param event - The pointer event to pick under.
|
|
71
|
+
* @returns The graph node under the pointer, or `null` if nothing was hit.
|
|
72
|
+
*/
|
|
73
|
+
private _pickNode;
|
|
74
|
+
_onPointerMove(event: PointerEvent): Promise<void>;
|
|
75
|
+
_onPointerDown(event: PointerEvent): Promise<void>;
|
|
76
|
+
_onPointerUp(event: PointerEvent): Promise<void>;
|
|
47
77
|
_onPointerListenerAdded(type: string): void;
|
|
48
78
|
_onPointerListenerRemoved(type: string): void;
|
|
49
79
|
/**
|
|
@@ -67,7 +97,8 @@ declare class AppElement extends AsyncElement {
|
|
|
67
97
|
*/
|
|
68
98
|
get antialias(): boolean;
|
|
69
99
|
/**
|
|
70
|
-
* Sets the graphics backend.
|
|
100
|
+
* Sets the graphics backend. Defaults to 'webgpu', which falls back to 'webgl2' if WebGPU
|
|
101
|
+
* is not supported by the browser.
|
|
71
102
|
* @param value - The graphics backend ('webgpu', 'webgl2', or 'null').
|
|
72
103
|
*/
|
|
73
104
|
set backend(value: 'webgpu' | 'webgl2' | 'null');
|
|
@@ -103,6 +134,21 @@ declare class AppElement extends AsyncElement {
|
|
|
103
134
|
* @returns The high resolution flag.
|
|
104
135
|
*/
|
|
105
136
|
get highResolution(): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Sets whether the application shows its built-in loading bar while it boots and preloads its
|
|
139
|
+
* assets. Enabled by default; setting `false` removes the bar immediately, while setting
|
|
140
|
+
* `true` has no effect until the element is next connected. The bar can be themed with the
|
|
141
|
+
* CSS custom properties `--pc-loading-bar-color`, `--pc-loading-bar-background` and
|
|
142
|
+
* `--pc-loading-bar-height`.
|
|
143
|
+
* @param value - The loading bar flag.
|
|
144
|
+
*/
|
|
145
|
+
set loadingBar(value: boolean);
|
|
146
|
+
/**
|
|
147
|
+
* Gets whether the application shows its built-in loading bar while it boots and preloads
|
|
148
|
+
* its assets.
|
|
149
|
+
* @returns The loading bar flag.
|
|
150
|
+
*/
|
|
151
|
+
get loadingBar(): boolean;
|
|
106
152
|
/**
|
|
107
153
|
* Sets the stencil flag.
|
|
108
154
|
* @param value - The stencil flag.
|
|
@@ -114,7 +160,7 @@ declare class AppElement extends AsyncElement {
|
|
|
114
160
|
*/
|
|
115
161
|
get stencil(): boolean;
|
|
116
162
|
static get observedAttributes(): string[];
|
|
117
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
163
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
118
164
|
}
|
|
119
165
|
declare global {
|
|
120
166
|
interface HTMLElementTagNameMap {
|
package/dist/asset.d.ts
CHANGED
|
@@ -12,6 +12,28 @@ import { AsyncElement } from './async-element';
|
|
|
12
12
|
* while the application is running are created and registered on insertion, and begin loading
|
|
13
13
|
* immediately unless `lazy`. A `pc-asset` must be a direct child of `pc-app` — elements placed
|
|
14
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.
|
|
30
|
+
*
|
|
31
|
+
* @fires {Event} load - Fired each time the asset finishes loading, including a `lazy` asset
|
|
32
|
+
* loaded later and any subsequent reloads. Does not bubble — listen on this element, or use a
|
|
33
|
+
* capture-phase listener on an ancestor to observe every asset.
|
|
34
|
+
* @fires {ErrorEvent} error - Fired when the asset fails to load, with the engine's error in
|
|
35
|
+
* `message`. Does not bubble. The element still becomes ready — readiness means the load settled,
|
|
36
|
+
* not that it succeeded.
|
|
15
37
|
*/
|
|
16
38
|
declare class AssetElement extends AsyncElement {
|
|
17
39
|
private _lazy;
|
|
@@ -22,6 +44,8 @@ declare class AssetElement extends AsyncElement {
|
|
|
22
44
|
asset: Asset | null;
|
|
23
45
|
connectedCallback(): Promise<void>;
|
|
24
46
|
disconnectedCallback(): void;
|
|
47
|
+
private _onAssetLoad;
|
|
48
|
+
private _onAssetError;
|
|
25
49
|
createAsset(): void;
|
|
26
50
|
/**
|
|
27
51
|
* Builds the `data` object for the asset from an optional inline `data` attribute (JSON) and,
|
|
@@ -44,7 +68,7 @@ declare class AssetElement extends AsyncElement {
|
|
|
44
68
|
get lazy(): boolean;
|
|
45
69
|
static get(id: string): Asset | null | undefined;
|
|
46
70
|
static get observedAttributes(): string[];
|
|
47
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
71
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
48
72
|
}
|
|
49
73
|
declare global {
|
|
50
74
|
interface HTMLElementTagNameMap {
|
package/dist/async-element.d.ts
CHANGED
|
@@ -2,14 +2,27 @@ 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;
|
|
8
11
|
private _readyResolve;
|
|
9
12
|
/** @ignore */
|
|
10
13
|
constructor();
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The nearest ancestor `<pc-app>` element, or `null` if this element has no `<pc-app>`
|
|
16
|
+
* ancestor. The search starts at the parent, so an element never resolves to itself.
|
|
17
|
+
* @returns The closest app element, or `null`.
|
|
18
|
+
*/
|
|
19
|
+
get closestApp(): AppElement | null;
|
|
20
|
+
/**
|
|
21
|
+
* The nearest ancestor `<pc-entity>` element, or `null` if this element has no `<pc-entity>`
|
|
22
|
+
* ancestor. The search starts at the parent, so an element never resolves to itself.
|
|
23
|
+
* @returns The closest entity element, or `null`.
|
|
24
|
+
*/
|
|
25
|
+
get closestEntity(): EntityElement | null;
|
|
13
26
|
/**
|
|
14
27
|
* Called when the element is fully initialized and ready. Subclasses should call this when
|
|
15
28
|
* they're ready. Resolves the ready promise and dispatches a bubbling, composed `ready`
|
|
@@ -180,7 +180,7 @@ declare class ButtonComponentElement extends ComponentElement {
|
|
|
180
180
|
*/
|
|
181
181
|
get inactiveSpriteFrame(): number;
|
|
182
182
|
static get observedAttributes(): string[];
|
|
183
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
183
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
184
184
|
}
|
|
185
185
|
declare global {
|
|
186
186
|
interface HTMLElementTagNameMap {
|
|
@@ -247,7 +247,7 @@ 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
251
|
}
|
|
252
252
|
declare global {
|
|
253
253
|
interface HTMLElementTagNameMap {
|
|
@@ -51,7 +51,7 @@ declare class CollisionComponentElement extends ComponentElement {
|
|
|
51
51
|
set type(value: 'box' | 'capsule' | 'compound' | 'cone' | 'cylinder' | 'mesh' | 'sphere');
|
|
52
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
55
|
}
|
|
56
56
|
declare global {
|
|
57
57
|
interface HTMLElementTagNameMap {
|
|
@@ -23,11 +23,12 @@ declare class ComponentElement extends AsyncElement {
|
|
|
23
23
|
connectedCallback(): Promise<void>;
|
|
24
24
|
disconnectedCallback(): void;
|
|
25
25
|
/**
|
|
26
|
-
* The PlayCanvas component instance.
|
|
27
|
-
* {@link whenReady} or the
|
|
28
|
-
*
|
|
26
|
+
* The PlayCanvas component instance. `null` until the element is ready, and also for an
|
|
27
|
+
* element that is not a descendant of a `<pc-entity>` — await {@link whenReady} or the
|
|
28
|
+
* element's `ready()` promise before accessing it.
|
|
29
|
+
* @returns The component instance, or `null`.
|
|
29
30
|
*/
|
|
30
|
-
get component(): Component;
|
|
31
|
+
get component(): Component | null;
|
|
31
32
|
/**
|
|
32
33
|
* Sets the enabled state of the component.
|
|
33
34
|
* @param value - The enabled state of the component.
|
|
@@ -39,6 +40,6 @@ declare class ComponentElement extends AsyncElement {
|
|
|
39
40
|
*/
|
|
40
41
|
get enabled(): boolean;
|
|
41
42
|
static get observedAttributes(): string[];
|
|
42
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
43
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
43
44
|
}
|
|
44
45
|
export { ComponentElement };
|
|
@@ -310,7 +310,7 @@ 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
314
|
}
|
|
315
315
|
declare global {
|
|
316
316
|
interface HTMLElementTagNameMap {
|
|
@@ -103,7 +103,7 @@ 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
107
|
}
|
|
108
108
|
declare global {
|
|
109
109
|
interface HTMLElementTagNameMap {
|
|
@@ -105,7 +105,7 @@ 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
109
|
}
|
|
110
110
|
declare global {
|
|
111
111
|
interface HTMLElementTagNameMap {
|
|
@@ -130,7 +130,7 @@ declare class LayoutGroupComponentElement extends ComponentElement {
|
|
|
130
130
|
*/
|
|
131
131
|
get wrap(): boolean;
|
|
132
132
|
static get observedAttributes(): string[];
|
|
133
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
133
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
134
134
|
}
|
|
135
135
|
declare global {
|
|
136
136
|
interface HTMLElementTagNameMap {
|
|
@@ -258,7 +258,7 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
258
258
|
*/
|
|
259
259
|
get shadowBlockerSamples(): number;
|
|
260
260
|
static get observedAttributes(): string[];
|
|
261
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
261
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
262
262
|
}
|
|
263
263
|
declare global {
|
|
264
264
|
interface HTMLElementTagNameMap {
|
|
@@ -47,7 +47,7 @@ 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
51
|
}
|
|
52
52
|
declare global {
|
|
53
53
|
interface HTMLElementTagNameMap {
|
|
@@ -71,7 +71,7 @@ declare class RenderComponentElement extends ComponentElement {
|
|
|
71
71
|
*/
|
|
72
72
|
get receiveShadows(): boolean;
|
|
73
73
|
static get observedAttributes(): string[];
|
|
74
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
74
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
75
75
|
}
|
|
76
76
|
declare global {
|
|
77
77
|
interface HTMLElementTagNameMap {
|
|
@@ -82,7 +82,7 @@ declare class RigidBodyComponentElement extends ComponentElement {
|
|
|
82
82
|
set type(value: 'static' | 'dynamic' | 'kinematic');
|
|
83
83
|
get type(): "static" | "dynamic" | "kinematic";
|
|
84
84
|
static get observedAttributes(): string[];
|
|
85
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
85
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
86
86
|
}
|
|
87
87
|
declare global {
|
|
88
88
|
interface HTMLElementTagNameMap {
|
|
@@ -43,7 +43,7 @@ declare class ScreenComponentElement extends ComponentElement {
|
|
|
43
43
|
set screenSpace(value: boolean);
|
|
44
44
|
get screenSpace(): boolean;
|
|
45
45
|
static get observedAttributes(): string[];
|
|
46
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
46
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
47
47
|
}
|
|
48
48
|
declare global {
|
|
49
49
|
interface HTMLElementTagNameMap {
|
|
@@ -25,6 +25,13 @@ import { AsyncElement } from '../async-element';
|
|
|
25
25
|
*
|
|
26
26
|
* The element becomes ready once its script instance has been created by the parent
|
|
27
27
|
* `<pc-scripts>` element.
|
|
28
|
+
*
|
|
29
|
+
* @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
|
|
30
|
+
* `detail` carries the new `attributes` object. Bubbles.
|
|
31
|
+
* @fires {CustomEvent} scriptenablechange - Fired when the script's enabled state changes. The
|
|
32
|
+
* `detail` carries the new `enabled` state. Bubbles.
|
|
33
|
+
* @fires {CustomEvent} scriptnamechange - Fired when the script is renamed on a live element. The
|
|
34
|
+
* `detail` carries `oldName` and `newName`. Bubbles.
|
|
28
35
|
*/
|
|
29
36
|
declare class ScriptElement extends AsyncElement {
|
|
30
37
|
private _attributes;
|
|
@@ -97,7 +104,7 @@ declare class ScriptElement extends AsyncElement {
|
|
|
97
104
|
*/
|
|
98
105
|
_onScriptCreated(): void;
|
|
99
106
|
static get observedAttributes(): string[];
|
|
100
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
107
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
101
108
|
}
|
|
102
109
|
declare global {
|
|
103
110
|
interface HTMLElementTagNameMap {
|
|
@@ -64,7 +64,7 @@ declare class ScrollbarComponentElement extends ComponentElement {
|
|
|
64
64
|
*/
|
|
65
65
|
get handle(): string;
|
|
66
66
|
static get observedAttributes(): string[];
|
|
67
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
67
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
68
68
|
}
|
|
69
69
|
declare global {
|
|
70
70
|
interface HTMLElementTagNameMap {
|
|
@@ -170,7 +170,7 @@ declare class ScrollViewComponentElement extends ComponentElement {
|
|
|
170
170
|
*/
|
|
171
171
|
get verticalScrollbar(): string;
|
|
172
172
|
static get observedAttributes(): string[];
|
|
173
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
173
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
174
174
|
}
|
|
175
175
|
declare global {
|
|
176
176
|
interface HTMLElementTagNameMap {
|
|
@@ -103,7 +103,7 @@ declare class SoundComponentElement extends ComponentElement {
|
|
|
103
103
|
*/
|
|
104
104
|
get volume(): 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
107
|
}
|
|
108
108
|
declare global {
|
|
109
109
|
interface HTMLElementTagNameMap {
|
|
@@ -16,6 +16,14 @@ declare class SoundSlotElement extends AsyncElement {
|
|
|
16
16
|
private _pitch;
|
|
17
17
|
private _startTime;
|
|
18
18
|
private _volume;
|
|
19
|
+
/**
|
|
20
|
+
* The `<pc-sounds>` this slot was added to, captured at connect time.
|
|
21
|
+
*
|
|
22
|
+
* `disconnectedCallback` cannot rediscover it: by the time the element is disconnected its
|
|
23
|
+
* `parentElement` is already `null`, so a lookup would both fail to find the component and
|
|
24
|
+
* emit a misleading "must be a direct child" warning for what is an ordinary removal.
|
|
25
|
+
*/
|
|
26
|
+
private _soundElement;
|
|
19
27
|
/**
|
|
20
28
|
* The sound slot.
|
|
21
29
|
*/
|
|
@@ -114,7 +122,7 @@ declare class SoundSlotElement extends AsyncElement {
|
|
|
114
122
|
*/
|
|
115
123
|
get volume(): number;
|
|
116
124
|
static get observedAttributes(): string[];
|
|
117
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
125
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
118
126
|
}
|
|
119
127
|
declare global {
|
|
120
128
|
interface HTMLElementTagNameMap {
|