@playcanvas/web-components 0.11.1 → 0.13.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 +1 -1
- package/dist/app.d.cts +246 -0
- package/dist/app.d.ts +38 -13
- package/dist/asset.d.cts +218 -0
- package/dist/asset.d.ts +145 -6
- package/dist/async-element.d.cts +103 -0
- package/dist/async-element.d.ts +11 -8
- 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 +17 -1
- package/dist/components/component.d.cts +82 -0
- package/dist/components/component.d.ts +20 -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 +1127 -179
- package/dist/entity-base.d.cts +67 -0
- package/dist/entity-base.d.ts +67 -0
- package/dist/entity.d.cts +131 -0
- package/dist/entity.d.ts +3 -38
- package/dist/index.d.cts +79 -0
- package/dist/index.d.ts +35 -32
- package/dist/loading-bar.d.cts +35 -0
- package/dist/material.d.cts +1011 -0
- package/dist/material.d.ts +2 -1
- package/dist/model.d.cts +72 -0
- package/dist/model.d.ts +27 -5
- 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 +253 -0
- package/dist/parse.d.cts +147 -0
- package/dist/pwc.cjs +1496 -200
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +1497 -201
- 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 +1496 -202
- 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 +127 -5
- package/dist/web-types.json +399 -59
- package/package.json +16 -7
- package/src/app.ts +137 -45
- package/src/asset.ts +439 -9
- package/src/async-element.ts +11 -8
- package/src/components/collision-component.ts +35 -0
- package/src/components/component.ts +93 -3
- package/src/entity-base.ts +136 -0
- package/src/entity.ts +23 -117
- package/src/index.ts +5 -0
- package/src/loading-bar.ts +2 -2
- package/src/material.ts +2 -2
- package/src/model.ts +79 -11
- package/src/module.ts +39 -20
- package/src/node.ts +715 -0
- package/src/sky.ts +0 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { ScriptComponent } from 'playcanvas';
|
|
2
|
+
import { ComponentElement } from './component.cjs';
|
|
3
|
+
export type ScriptAttributesChangeEvent = {
|
|
4
|
+
detail: {
|
|
5
|
+
attributes: Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
} & CustomEvent;
|
|
8
|
+
export type ScriptEnableChangeEvent = {
|
|
9
|
+
detail: {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
};
|
|
12
|
+
} & CustomEvent;
|
|
13
|
+
export type ScriptNameChangeEvent = {
|
|
14
|
+
detail: {
|
|
15
|
+
oldName: string;
|
|
16
|
+
newName: string;
|
|
17
|
+
};
|
|
18
|
+
} & CustomEvent;
|
|
19
|
+
/**
|
|
20
|
+
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
21
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
|
|
22
|
+
* The ScriptComponentElement interface also inherits the properties and methods of the
|
|
23
|
+
* {@link HTMLElement} interface.
|
|
24
|
+
*
|
|
25
|
+
* @category Components
|
|
26
|
+
*/
|
|
27
|
+
declare class ScriptComponentElement extends ComponentElement {
|
|
28
|
+
private observer;
|
|
29
|
+
/** @ignore */
|
|
30
|
+
constructor();
|
|
31
|
+
connectedCallback(): Promise<void>;
|
|
32
|
+
protected initComponent(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Recursively converts raw attribute data into proper PlayCanvas types. Supported conversions:
|
|
35
|
+
* - "asset:id" → the Asset created by the `pc-asset` element with that id
|
|
36
|
+
* - "entity:ref" → the Entity backing a `pc-entity` element. The reference can be a CSS
|
|
37
|
+
* selector, an element id or an entity name.
|
|
38
|
+
* - "vec2:1 2" → new Vec2(1, 2)
|
|
39
|
+
* - "vec3:1 2 3" → new Vec3(1, 2, 3)
|
|
40
|
+
* - "vec4:1 2 3 4" → new Vec4(1, 2, 3, 4)
|
|
41
|
+
* - "color:1 0.5 0.5 1" → new Color(1, 0.5, 0.5, 1)
|
|
42
|
+
*
|
|
43
|
+
* A prefixed string that fails to resolve or parse logs a warning and is left as the raw
|
|
44
|
+
* string.
|
|
45
|
+
* @param item - The item to convert.
|
|
46
|
+
* @returns The converted item.
|
|
47
|
+
*/
|
|
48
|
+
private convertAttributes;
|
|
49
|
+
/**
|
|
50
|
+
* Recursively merge properties from source into target. When the target value is a Vec2,
|
|
51
|
+
* Vec3, Vec4 or Color and the source value is a plain numeric array, the array is converted
|
|
52
|
+
* to the target's type — so script attributes with math-typed defaults can be written as
|
|
53
|
+
* plain JSON arrays (e.g. `"focusPoint": [0, 1.75, 0]`).
|
|
54
|
+
* @param target - The target object to merge into.
|
|
55
|
+
* @param source - The source object to merge from.
|
|
56
|
+
* @returns The merged object.
|
|
57
|
+
*/
|
|
58
|
+
private mergeDeep;
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether a value is one of the math types that plain numeric arrays convert to.
|
|
61
|
+
* @param value - The value to check.
|
|
62
|
+
* @returns Whether the value is a math type.
|
|
63
|
+
*/
|
|
64
|
+
private isMathType;
|
|
65
|
+
/**
|
|
66
|
+
* Converts a plain numeric array to the math type of `current`. A 3-element array targeting
|
|
67
|
+
* a Quat is interpreted as Euler angles in degrees, mirroring the `parseQuat` attribute
|
|
68
|
+
* grammar. Returns `null` (and logs a warning) when the array's length or contents don't
|
|
69
|
+
* match the type.
|
|
70
|
+
* @param current - The current (typed) value of the property.
|
|
71
|
+
* @param value - The incoming array.
|
|
72
|
+
* @param key - The property name, used in the warning message.
|
|
73
|
+
* @returns The converted value, or `null`.
|
|
74
|
+
*/
|
|
75
|
+
private arrayToMathType;
|
|
76
|
+
/**
|
|
77
|
+
* Update script attributes by merging converted values into the script. `enabled` is always
|
|
78
|
+
* excluded (it is configured through the element's `enabled` attribute, not the JSON blob),
|
|
79
|
+
* as are any keys in `exclude` — used to keep per-property attributes authoritative over
|
|
80
|
+
* the blob without writing a property twice.
|
|
81
|
+
* @param script - The script to update.
|
|
82
|
+
* @param attributes - The attributes to merge into the script.
|
|
83
|
+
* @param exclude - Keys to strip from the merge.
|
|
84
|
+
*/
|
|
85
|
+
private applyAttributes;
|
|
86
|
+
/**
|
|
87
|
+
* Returns the camelCase keys of the per-property attributes present on a `pc-script`
|
|
88
|
+
* element.
|
|
89
|
+
* @param scriptElement - The `pc-script` element.
|
|
90
|
+
* @returns The camelCase keys.
|
|
91
|
+
*/
|
|
92
|
+
private inlineKeys;
|
|
93
|
+
/**
|
|
94
|
+
* Resolves the script instance owned by a `pc-script` element. Returns `null` when the
|
|
95
|
+
* element has no created script, or when its name resolves to a script created by a
|
|
96
|
+
* different element (e.g. a duplicate-named sibling).
|
|
97
|
+
* @param scriptElement - The `pc-script` element.
|
|
98
|
+
* @returns The owned script, or `null`.
|
|
99
|
+
*/
|
|
100
|
+
private scriptFor;
|
|
101
|
+
private handleScriptAttributesChange;
|
|
102
|
+
private handleScriptEnableChange;
|
|
103
|
+
/**
|
|
104
|
+
* Handles a runtime `name` change on a child `pc-script`, swapping the engine script instance
|
|
105
|
+
* to match. Without this the element would keep pointing at the old-name instance: the old
|
|
106
|
+
* script would go on running while every subsequent update (attribute changes, enable
|
|
107
|
+
* changes, destruction on removal) resolved the new name and silently no-opped.
|
|
108
|
+
*
|
|
109
|
+
* The new instance is built by the normal creation path, so both attribute channels are
|
|
110
|
+
* re-applied to it and the declared enabled state is restored.
|
|
111
|
+
* @param event - The name change event.
|
|
112
|
+
*/
|
|
113
|
+
private handleScriptNameChange;
|
|
114
|
+
/**
|
|
115
|
+
* Creates the script instance for a `pc-script` element. The instance is created disabled,
|
|
116
|
+
* the element's converted attributes are merged over the instance's defaults (which is what
|
|
117
|
+
* allows plain numeric arrays to be typed against those defaults), and only then is the
|
|
118
|
+
* declared enabled state applied — so `initialize()` runs with every attribute in place.
|
|
119
|
+
* @param scriptElement - The `pc-script` element to create the script instance for.
|
|
120
|
+
* @returns The created script, or `null`.
|
|
121
|
+
*/
|
|
122
|
+
private createScript;
|
|
123
|
+
/**
|
|
124
|
+
* Applies the per-property attributes present on a `pc-script` element — any attribute that
|
|
125
|
+
* is not part of the element's own API or a reserved HTML attribute name. These are applied
|
|
126
|
+
* after the `attributes` JSON, so an individual attribute always takes precedence over the
|
|
127
|
+
* blob.
|
|
128
|
+
* @param script - The script to apply the attributes to.
|
|
129
|
+
* @param scriptElement - The `pc-script` element holding the attributes.
|
|
130
|
+
*/
|
|
131
|
+
private applyInlineAttributes;
|
|
132
|
+
/**
|
|
133
|
+
* Applies a single per-property attribute change to the script of a `pc-script` element.
|
|
134
|
+
* When the attribute has been removed, the value from the `attributes` JSON (if any) takes
|
|
135
|
+
* effect again.
|
|
136
|
+
* @param scriptElement - The `pc-script` element whose attribute changed.
|
|
137
|
+
* @param attributeName - The name of the changed attribute.
|
|
138
|
+
*/
|
|
139
|
+
private applyScriptProperty;
|
|
140
|
+
/**
|
|
141
|
+
* Applies one attribute string to a script property. A string-typed attribute takes the
|
|
142
|
+
* value verbatim (so literals like 'color:red' are never hijacked by prefix conversion).
|
|
143
|
+
* Otherwise, explicit prefixes (`asset:`, `entity:`, `vec2:`, `vec3:`, `vec4:`, `color:`)
|
|
144
|
+
* carry their own type, and unprefixed values are parsed according to the type of the
|
|
145
|
+
* attribute's current value. The Script API itself (methods, `entity`, `app`) is never
|
|
146
|
+
* overwritten, invalid values keep the current value, and exceptions thrown by user
|
|
147
|
+
* getters/setters are contained so one bad attribute cannot abort the rest of a batch.
|
|
148
|
+
* @param script - The script to apply the value to.
|
|
149
|
+
* @param scriptName - The script name, used in warning messages.
|
|
150
|
+
* @param attributeName - The (kebab-case) element attribute name.
|
|
151
|
+
* @param value - The attribute value.
|
|
152
|
+
*/
|
|
153
|
+
private setScriptProperty;
|
|
154
|
+
private destroyScript;
|
|
155
|
+
private handleMutations;
|
|
156
|
+
disconnectedCallback(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Gets the underlying PlayCanvas script component.
|
|
159
|
+
* @returns The script component.
|
|
160
|
+
*/
|
|
161
|
+
get component(): ScriptComponent;
|
|
162
|
+
}
|
|
163
|
+
export { ScriptComponentElement };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Script } from 'playcanvas';
|
|
2
|
+
import { AsyncElement } from '../async-element.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* The ScriptElement interface provides properties and methods for manipulating
|
|
5
|
+
* `<pc-script>` elements. The ScriptElement interface also inherits the properties and
|
|
6
|
+
* methods of the {@link AsyncElement} interface.
|
|
7
|
+
*
|
|
8
|
+
* Script attributes can be supplied through two channels:
|
|
9
|
+
*
|
|
10
|
+
* - **Per-property attributes**: any non-reserved attribute on the element maps to the script
|
|
11
|
+
* attribute of the same name (kebab-case to camelCase, e.g. `focus-point` → `focusPoint`).
|
|
12
|
+
* Values are parsed according to the type of the attribute's current value — initially the
|
|
13
|
+
* script's declared default (numbers, booleans, strings, Vec2/3/4, Color, Quat as Euler
|
|
14
|
+
* angles) — and the `asset:`/`entity:`/`vec2:`/`vec3:`/`vec4:`/`color:` prefixes may be used
|
|
15
|
+
* to be explicit.
|
|
16
|
+
* - **The `attributes` JSON attribute**: an object supporting nested structures and attribute
|
|
17
|
+
* names that collide with reserved HTML attribute names (e.g. `title`).
|
|
18
|
+
*
|
|
19
|
+
* When both specify the same attribute, the per-property attribute wins — at creation and
|
|
20
|
+
* whenever either channel changes at runtime. The element's own `name` and `enabled`
|
|
21
|
+
* attributes configure the element itself and are not script attributes.
|
|
22
|
+
*
|
|
23
|
+
* Changing `name` on a live element destroys the old-name script instance and creates the
|
|
24
|
+
* new-name one, re-applying both attribute channels to it.
|
|
25
|
+
*
|
|
26
|
+
* The element becomes ready once its script instance has been created by the parent
|
|
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.
|
|
35
|
+
*/
|
|
36
|
+
declare class ScriptElement extends AsyncElement {
|
|
37
|
+
private _attributes;
|
|
38
|
+
private _enabled;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the attributes of the script as an object. Values are converted with the same rules
|
|
41
|
+
* as the `attributes` attribute: `asset:`/`entity:` references and `vec2:`/`vec3:`/`vec4:`/
|
|
42
|
+
* `color:` prefixed strings are resolved, and a plain numeric array is converted to the
|
|
43
|
+
* type of the attribute it targets when that attribute currently holds a Vec2, Vec3, Vec4
|
|
44
|
+
* or Color.
|
|
45
|
+
* @param value - The attributes of the script.
|
|
46
|
+
*/
|
|
47
|
+
set scriptAttributes(value: Record<string, any>);
|
|
48
|
+
/**
|
|
49
|
+
* Gets the attributes of the script.
|
|
50
|
+
* @returns The attributes of the script.
|
|
51
|
+
*/
|
|
52
|
+
get scriptAttributes(): Record<string, any>;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the enabled state of the script.
|
|
55
|
+
* @param value - The enabled state of the script.
|
|
56
|
+
*/
|
|
57
|
+
set enabled(value: boolean);
|
|
58
|
+
/**
|
|
59
|
+
* Gets the enabled state of the script.
|
|
60
|
+
* @returns The enabled state of the script.
|
|
61
|
+
*/
|
|
62
|
+
get enabled(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Sets the name of the script to create. The `name` attribute is the single source of truth
|
|
65
|
+
* (it is what the parent `<pc-scripts>` element reads when creating the instance), so the
|
|
66
|
+
* property writes through to it — assigning before insertion works as expected:
|
|
67
|
+
*
|
|
68
|
+
* ```js
|
|
69
|
+
* const script = document.createElement('pc-script');
|
|
70
|
+
* script.name = 'rotate';
|
|
71
|
+
* scriptsElement.appendChild(script);
|
|
72
|
+
* await script.ready();
|
|
73
|
+
* ```
|
|
74
|
+
* @param value - The name.
|
|
75
|
+
*/
|
|
76
|
+
set name(value: string);
|
|
77
|
+
/**
|
|
78
|
+
* Gets the name of the script.
|
|
79
|
+
* @returns The name.
|
|
80
|
+
*/
|
|
81
|
+
get name(): string;
|
|
82
|
+
/**
|
|
83
|
+
* Gets the {@link Script} instance created for this element. Returns `null` until the
|
|
84
|
+
* instance exists — await {@link whenReady} or the element's `ready()` promise before
|
|
85
|
+
* accessing it.
|
|
86
|
+
* @returns The script instance, or `null`.
|
|
87
|
+
*/
|
|
88
|
+
get script(): Script | null;
|
|
89
|
+
connectedCallback(): void;
|
|
90
|
+
disconnectedCallback(): void;
|
|
91
|
+
static get observedAttributes(): string[];
|
|
92
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
93
|
+
}
|
|
94
|
+
export { ScriptElement };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Script } from 'playcanvas';
|
|
2
|
-
import { AsyncElement } from '../async-element';
|
|
2
|
+
import { AsyncElement } from '../async-element.js';
|
|
3
3
|
/**
|
|
4
4
|
* The ScriptElement interface provides properties and methods for manipulating
|
|
5
5
|
* `<pc-script>` elements. The ScriptElement interface also inherits the properties and
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ScrollbarComponent } from 'playcanvas';
|
|
2
|
+
import { ComponentElement } from './component.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* The ScrollbarComponentElement interface provides properties and methods for manipulating
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scrollbar/ | `<pc-scrollbar>`} elements.
|
|
6
|
+
* The ScrollbarComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
8
|
+
*
|
|
9
|
+
* @category Components
|
|
10
|
+
*/
|
|
11
|
+
declare class ScrollbarComponentElement extends ComponentElement {
|
|
12
|
+
private _orientation;
|
|
13
|
+
private _value;
|
|
14
|
+
private _handleSize;
|
|
15
|
+
private _handle;
|
|
16
|
+
/** @ignore */
|
|
17
|
+
constructor();
|
|
18
|
+
protected getInitialComponentData(): Record<string, any>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the underlying PlayCanvas scrollbar component.
|
|
21
|
+
* @returns The scrollbar component.
|
|
22
|
+
*/
|
|
23
|
+
get component(): ScrollbarComponent;
|
|
24
|
+
/**
|
|
25
|
+
* Sets the orientation of the scrollbar. Can be `horizontal` or `vertical`. Defaults to
|
|
26
|
+
* `horizontal`.
|
|
27
|
+
* @param value - The orientation.
|
|
28
|
+
*/
|
|
29
|
+
set orientation(value: 'horizontal' | 'vertical');
|
|
30
|
+
/**
|
|
31
|
+
* Gets the orientation of the scrollbar.
|
|
32
|
+
* @returns The orientation.
|
|
33
|
+
*/
|
|
34
|
+
get orientation(): "horizontal" | "vertical";
|
|
35
|
+
/**
|
|
36
|
+
* Sets the current position value of the scrollbar, in the range 0 to 1.
|
|
37
|
+
* @param value - The scrollbar value.
|
|
38
|
+
*/
|
|
39
|
+
set value(value: number);
|
|
40
|
+
/**
|
|
41
|
+
* Gets the current position value of the scrollbar.
|
|
42
|
+
* @returns The scrollbar value.
|
|
43
|
+
*/
|
|
44
|
+
get value(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the size of the handle relative to the size of the track, in the range 0 to 1.
|
|
47
|
+
* @param value - The handle size.
|
|
48
|
+
*/
|
|
49
|
+
set handleSize(value: number);
|
|
50
|
+
/**
|
|
51
|
+
* Gets the size of the handle relative to the size of the track.
|
|
52
|
+
* @returns The handle size.
|
|
53
|
+
*/
|
|
54
|
+
get handleSize(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` used as the
|
|
57
|
+
* scrollbar handle.
|
|
58
|
+
* @param value - The handle entity reference.
|
|
59
|
+
*/
|
|
60
|
+
set handle(value: string);
|
|
61
|
+
/**
|
|
62
|
+
* Gets the reference to the `<pc-entity>` used as the scrollbar handle.
|
|
63
|
+
* @returns The handle entity reference.
|
|
64
|
+
*/
|
|
65
|
+
get handle(): string;
|
|
66
|
+
static get observedAttributes(): string[];
|
|
67
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
68
|
+
}
|
|
69
|
+
export { ScrollbarComponentElement };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScrollbarComponent } from 'playcanvas';
|
|
2
|
-
import { ComponentElement } from './component';
|
|
2
|
+
import { ComponentElement } from './component.js';
|
|
3
3
|
/**
|
|
4
4
|
* The ScrollbarComponentElement interface provides properties and methods for manipulating
|
|
5
5
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scrollbar/ | `<pc-scrollbar>`} elements.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { ScrollViewComponent } from 'playcanvas';
|
|
2
|
+
import { Vec2 } from 'playcanvas';
|
|
3
|
+
import { ComponentElement } from './component.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* The ScrollViewComponentElement interface provides properties and methods for manipulating
|
|
6
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scrollview/ | `<pc-scrollview>`} elements.
|
|
7
|
+
* The ScrollViewComponentElement interface also inherits the properties and methods of the
|
|
8
|
+
* {@link HTMLElement} interface.
|
|
9
|
+
*
|
|
10
|
+
* @category Components
|
|
11
|
+
*/
|
|
12
|
+
declare class ScrollViewComponentElement extends ComponentElement {
|
|
13
|
+
private _horizontal;
|
|
14
|
+
private _vertical;
|
|
15
|
+
private _scrollMode;
|
|
16
|
+
private _bounceAmount;
|
|
17
|
+
private _friction;
|
|
18
|
+
private _useMouseWheel;
|
|
19
|
+
private _mouseWheelSensitivity;
|
|
20
|
+
private _horizontalScrollbarVisibility;
|
|
21
|
+
private _verticalScrollbarVisibility;
|
|
22
|
+
private _viewport;
|
|
23
|
+
private _content;
|
|
24
|
+
private _horizontalScrollbar;
|
|
25
|
+
private _verticalScrollbar;
|
|
26
|
+
/** @ignore */
|
|
27
|
+
constructor();
|
|
28
|
+
protected getInitialComponentData(): Record<string, any>;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the underlying PlayCanvas scroll view component.
|
|
31
|
+
* @returns The scroll view component.
|
|
32
|
+
*/
|
|
33
|
+
get component(): ScrollViewComponent;
|
|
34
|
+
/**
|
|
35
|
+
* Sets whether scrolling along the horizontal axis is enabled. This is a toggle, unlike the
|
|
36
|
+
* `orientation` of a `<pc-scrollbar>`, for which `horizontal` is one of the accepted values.
|
|
37
|
+
* @param value - Whether horizontal scrolling is enabled.
|
|
38
|
+
*/
|
|
39
|
+
set horizontal(value: boolean);
|
|
40
|
+
/**
|
|
41
|
+
* Gets whether scrolling along the horizontal axis is enabled.
|
|
42
|
+
* @returns Whether horizontal scrolling is enabled.
|
|
43
|
+
*/
|
|
44
|
+
get horizontal(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Sets whether scrolling along the vertical axis is enabled. This is a toggle, unlike the
|
|
47
|
+
* `orientation` of a `<pc-scrollbar>`, for which `vertical` is one of the accepted values.
|
|
48
|
+
* @param value - Whether vertical scrolling is enabled.
|
|
49
|
+
*/
|
|
50
|
+
set vertical(value: boolean);
|
|
51
|
+
/**
|
|
52
|
+
* Gets whether scrolling along the vertical axis is enabled.
|
|
53
|
+
* @returns Whether vertical scrolling is enabled.
|
|
54
|
+
*/
|
|
55
|
+
get vertical(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Sets how the scroll view should behave when the content is scrolled beyond its bounds. Can be
|
|
58
|
+
* `clamp`, `bounce` or `infinite`. Defaults to `bounce`.
|
|
59
|
+
* @param value - The scroll mode.
|
|
60
|
+
*/
|
|
61
|
+
set scrollMode(value: 'clamp' | 'bounce' | 'infinite');
|
|
62
|
+
/**
|
|
63
|
+
* Gets how the scroll view behaves when the content is scrolled beyond its bounds.
|
|
64
|
+
* @returns The scroll mode.
|
|
65
|
+
*/
|
|
66
|
+
get scrollMode(): "clamp" | "bounce" | "infinite";
|
|
67
|
+
/**
|
|
68
|
+
* Sets how far the content is allowed to bounce beyond its bounds when `scroll-mode` is
|
|
69
|
+
* `bounce`, in the range 0 to 1.
|
|
70
|
+
* @param value - The bounce amount.
|
|
71
|
+
*/
|
|
72
|
+
set bounceAmount(value: number);
|
|
73
|
+
/**
|
|
74
|
+
* Gets the bounce amount.
|
|
75
|
+
* @returns The bounce amount.
|
|
76
|
+
*/
|
|
77
|
+
get bounceAmount(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Sets how freely the content moves once thrown, in the range 0 (no friction) to 1.
|
|
80
|
+
* @param value - The friction.
|
|
81
|
+
*/
|
|
82
|
+
set friction(value: number);
|
|
83
|
+
/**
|
|
84
|
+
* Gets the friction.
|
|
85
|
+
* @returns The friction.
|
|
86
|
+
*/
|
|
87
|
+
get friction(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Sets whether the scroll view responds to mouse wheel events.
|
|
90
|
+
* @param value - Whether to use the mouse wheel.
|
|
91
|
+
*/
|
|
92
|
+
set useMouseWheel(value: boolean);
|
|
93
|
+
/**
|
|
94
|
+
* Gets whether the scroll view responds to mouse wheel events.
|
|
95
|
+
* @returns Whether the mouse wheel is used.
|
|
96
|
+
*/
|
|
97
|
+
get useMouseWheel(): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Sets the mouse wheel sensitivity as a Vec2 (horizontal, vertical). A value of 0 on an axis
|
|
100
|
+
* disables mouse wheel scrolling for that axis.
|
|
101
|
+
* @param value - The mouse wheel sensitivity.
|
|
102
|
+
*/
|
|
103
|
+
set mouseWheelSensitivity(value: Vec2);
|
|
104
|
+
/**
|
|
105
|
+
* Gets the mouse wheel sensitivity.
|
|
106
|
+
* @returns The mouse wheel sensitivity.
|
|
107
|
+
*/
|
|
108
|
+
get mouseWheelSensitivity(): Vec2;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the visibility of the horizontal scrollbar. Can be `always` or `when-required`.
|
|
111
|
+
* Defaults to `when-required`.
|
|
112
|
+
* @param value - The horizontal scrollbar visibility.
|
|
113
|
+
*/
|
|
114
|
+
set horizontalScrollbarVisibility(value: 'always' | 'when-required');
|
|
115
|
+
/**
|
|
116
|
+
* Gets the visibility of the horizontal scrollbar.
|
|
117
|
+
* @returns The horizontal scrollbar visibility.
|
|
118
|
+
*/
|
|
119
|
+
get horizontalScrollbarVisibility(): "always" | "when-required";
|
|
120
|
+
/**
|
|
121
|
+
* Sets the visibility of the vertical scrollbar. Can be `always` or `when-required`.
|
|
122
|
+
* Defaults to `when-required`.
|
|
123
|
+
* @param value - The vertical scrollbar visibility.
|
|
124
|
+
*/
|
|
125
|
+
set verticalScrollbarVisibility(value: 'always' | 'when-required');
|
|
126
|
+
/**
|
|
127
|
+
* Gets the visibility of the vertical scrollbar.
|
|
128
|
+
* @returns The vertical scrollbar visibility.
|
|
129
|
+
*/
|
|
130
|
+
get verticalScrollbarVisibility(): "always" | "when-required";
|
|
131
|
+
/**
|
|
132
|
+
* Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` used as the
|
|
133
|
+
* viewport, which clips the content to the scroll view's bounds.
|
|
134
|
+
* @param value - The viewport entity reference.
|
|
135
|
+
*/
|
|
136
|
+
set viewport(value: string);
|
|
137
|
+
/**
|
|
138
|
+
* Gets the reference to the `<pc-entity>` used as the viewport.
|
|
139
|
+
* @returns The viewport entity reference.
|
|
140
|
+
*/
|
|
141
|
+
get viewport(): string;
|
|
142
|
+
/**
|
|
143
|
+
* Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` used as the
|
|
144
|
+
* content, which is moved as the scroll view is scrolled.
|
|
145
|
+
* @param value - The content entity reference.
|
|
146
|
+
*/
|
|
147
|
+
set content(value: string);
|
|
148
|
+
/**
|
|
149
|
+
* Gets the reference to the `<pc-entity>` used as the content.
|
|
150
|
+
* @returns The content entity reference.
|
|
151
|
+
*/
|
|
152
|
+
get content(): string;
|
|
153
|
+
/**
|
|
154
|
+
* Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` containing
|
|
155
|
+
* the horizontal `<pc-scrollbar>`.
|
|
156
|
+
* @param value - The horizontal scrollbar entity reference.
|
|
157
|
+
*/
|
|
158
|
+
set horizontalScrollbar(value: string);
|
|
159
|
+
/**
|
|
160
|
+
* Gets the reference to the `<pc-entity>` containing the horizontal scrollbar.
|
|
161
|
+
* @returns The horizontal scrollbar entity reference.
|
|
162
|
+
*/
|
|
163
|
+
get horizontalScrollbar(): string;
|
|
164
|
+
/**
|
|
165
|
+
* Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` containing
|
|
166
|
+
* the vertical `<pc-scrollbar>`.
|
|
167
|
+
* @param value - The vertical scrollbar entity reference.
|
|
168
|
+
*/
|
|
169
|
+
set verticalScrollbar(value: string);
|
|
170
|
+
/**
|
|
171
|
+
* Gets the reference to the `<pc-entity>` containing the vertical scrollbar.
|
|
172
|
+
* @returns The vertical scrollbar entity reference.
|
|
173
|
+
*/
|
|
174
|
+
get verticalScrollbar(): string;
|
|
175
|
+
static get observedAttributes(): string[];
|
|
176
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
177
|
+
}
|
|
178
|
+
export { ScrollViewComponentElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScrollViewComponent } from 'playcanvas';
|
|
2
2
|
import { Vec2 } from 'playcanvas';
|
|
3
|
-
import { ComponentElement } from './component';
|
|
3
|
+
import { ComponentElement } from './component.js';
|
|
4
4
|
/**
|
|
5
5
|
* The ScrollViewComponentElement interface provides properties and methods for manipulating
|
|
6
6
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scrollview/ | `<pc-scrollview>`} elements.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { SoundComponent } from 'playcanvas';
|
|
2
|
+
import { ComponentElement } from './component.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
|
|
6
|
+
* The SoundComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
8
|
+
*
|
|
9
|
+
* @category Components
|
|
10
|
+
*/
|
|
11
|
+
declare class SoundComponentElement extends ComponentElement {
|
|
12
|
+
private _distanceModel;
|
|
13
|
+
private _maxDistance;
|
|
14
|
+
private _pitch;
|
|
15
|
+
private _positional;
|
|
16
|
+
private _refDistance;
|
|
17
|
+
private _rollOffFactor;
|
|
18
|
+
private _volume;
|
|
19
|
+
/** @ignore */
|
|
20
|
+
constructor();
|
|
21
|
+
protected getInitialComponentData(): {
|
|
22
|
+
distanceModel: "linear" | "exponential" | "inverse";
|
|
23
|
+
maxDistance: number;
|
|
24
|
+
pitch: number;
|
|
25
|
+
positional: boolean;
|
|
26
|
+
refDistance: number;
|
|
27
|
+
rollOffFactor: number;
|
|
28
|
+
volume: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Gets the underlying PlayCanvas sound component.
|
|
32
|
+
* @returns The sound component.
|
|
33
|
+
*/
|
|
34
|
+
get component(): SoundComponent;
|
|
35
|
+
/**
|
|
36
|
+
* Sets which algorithm to use to reduce the volume of the sound as it moves away from the listener.
|
|
37
|
+
* @param value - The distance model.
|
|
38
|
+
*/
|
|
39
|
+
set distanceModel(value: 'exponential' | 'inverse' | 'linear');
|
|
40
|
+
/**
|
|
41
|
+
* Gets which algorithm to use to reduce the volume of the sound as it moves away from the listener.
|
|
42
|
+
* @returns The distance model.
|
|
43
|
+
*/
|
|
44
|
+
get distanceModel(): 'exponential' | 'inverse' | 'linear';
|
|
45
|
+
/**
|
|
46
|
+
* Sets the maximum distance from the listener at which audio falloff stops.
|
|
47
|
+
* @param value - The max distance.
|
|
48
|
+
*/
|
|
49
|
+
set maxDistance(value: number);
|
|
50
|
+
/**
|
|
51
|
+
* Gets the maximum distance from the listener at which audio falloff stops.
|
|
52
|
+
* @returns The max distance.
|
|
53
|
+
*/
|
|
54
|
+
get maxDistance(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the pitch of the sound.
|
|
57
|
+
* @param value - The pitch.
|
|
58
|
+
*/
|
|
59
|
+
set pitch(value: number);
|
|
60
|
+
/**
|
|
61
|
+
* Gets the pitch of the sound.
|
|
62
|
+
* @returns The pitch.
|
|
63
|
+
*/
|
|
64
|
+
get pitch(): number;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the positional flag of the sound.
|
|
67
|
+
* @param value - The positional flag.
|
|
68
|
+
*/
|
|
69
|
+
set positional(value: boolean);
|
|
70
|
+
/**
|
|
71
|
+
* Gets the positional flag of the sound.
|
|
72
|
+
* @returns The positional flag.
|
|
73
|
+
*/
|
|
74
|
+
get positional(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the reference distance for reducing volume as the sound source moves further from the listener. Defaults to 1.
|
|
77
|
+
* @param value - The ref distance.
|
|
78
|
+
*/
|
|
79
|
+
set refDistance(value: number);
|
|
80
|
+
/**
|
|
81
|
+
* Gets the reference distance for reducing volume as the sound source moves further from the listener.
|
|
82
|
+
* @returns The ref distance.
|
|
83
|
+
*/
|
|
84
|
+
get refDistance(): number;
|
|
85
|
+
/**
|
|
86
|
+
* Sets the factor used in the falloff equation. Defaults to 1.
|
|
87
|
+
* @param value - The roll-off factor.
|
|
88
|
+
*/
|
|
89
|
+
set rollOffFactor(value: number);
|
|
90
|
+
/**
|
|
91
|
+
* Gets the factor used in the falloff equation.
|
|
92
|
+
* @returns The roll-off factor.
|
|
93
|
+
*/
|
|
94
|
+
get rollOffFactor(): number;
|
|
95
|
+
/**
|
|
96
|
+
* Sets the volume of the sound.
|
|
97
|
+
* @param value - The volume.
|
|
98
|
+
*/
|
|
99
|
+
set volume(value: number);
|
|
100
|
+
/**
|
|
101
|
+
* Gets the volume of the sound.
|
|
102
|
+
* @returns The volume.
|
|
103
|
+
*/
|
|
104
|
+
get volume(): number;
|
|
105
|
+
static get observedAttributes(): string[];
|
|
106
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
107
|
+
}
|
|
108
|
+
export { SoundComponentElement };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SoundComponent } from 'playcanvas';
|
|
2
|
-
import { ComponentElement } from './component';
|
|
2
|
+
import { ComponentElement } from './component.js';
|
|
3
3
|
/**
|
|
4
4
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
5
5
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
|