@playcanvas/web-components 0.13.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/colors.d.cts +1 -1
- package/dist/colors.d.ts +1 -1
- package/dist/components/joint-component.d.cts +521 -0
- package/dist/components/joint-component.d.ts +521 -0
- package/dist/custom-elements.json +1029 -0
- package/dist/entity-base.d.cts +1 -7
- package/dist/entity-base.d.ts +1 -7
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/loading-bar.d.cts +1 -35
- package/dist/loading-bar.d.ts +1 -35
- package/dist/material.d.cts +13 -0
- package/dist/material.d.ts +13 -0
- package/dist/model.d.cts +71 -0
- package/dist/model.d.ts +71 -0
- package/dist/node.d.cts +55 -0
- package/dist/node.d.ts +55 -0
- package/dist/parse.d.cts +1 -130
- package/dist/parse.d.ts +1 -130
- package/dist/pwc.cjs +1410 -148
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +1410 -148
- 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 +1410 -149
- package/dist/pwc.mjs.map +1 -1
- package/dist/vscode.html-custom-data.json +203 -1
- package/dist/web-types.json +368 -2
- package/package.json +5 -4
- package/src/app.ts +18 -0
- package/src/colors.ts +5 -0
- package/src/components/joint-component.ts +984 -0
- package/src/entity-base.ts +3 -3
- package/src/entity.ts +28 -7
- package/src/index.ts +6 -0
- package/src/loading-bar.ts +2 -3
- package/src/material.ts +29 -0
- package/src/model.ts +156 -0
- package/src/node.ts +279 -9
- package/src/parse.ts +11 -1
package/dist/parse.d.cts
CHANGED
|
@@ -15,133 +15,4 @@
|
|
|
15
15
|
* `getEntity` is the exception: it resolves a reference to a live entity rather than parsing a
|
|
16
16
|
* literal, and returns `null` instead of falling back to a default.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
import { Color, Quat, Vec2, Vec3, Vec4 } from 'playcanvas';
|
|
20
|
-
/**
|
|
21
|
-
* Splits an attribute value into exactly `count` numeric components. Returns `null` when the
|
|
22
|
-
* value does not consist of exactly `count` whitespace-separated finite numbers.
|
|
23
|
-
*
|
|
24
|
-
* @param value - The value to split.
|
|
25
|
-
* @param count - The required number of components.
|
|
26
|
-
* @returns The parsed components, or `null`.
|
|
27
|
-
* @ignore
|
|
28
|
-
*/
|
|
29
|
-
export declare const parseComponents: (value: string, count: number) => number[] | null;
|
|
30
|
-
/**
|
|
31
|
-
* Parse a boolean attribute value. The same rules apply to every boolean attribute:
|
|
32
|
-
*
|
|
33
|
-
* - Attribute absent (or removed): the supplied default is used.
|
|
34
|
-
* - Attribute set to the string 'false': `false`.
|
|
35
|
-
* - Attribute present with any other value, including the empty string of a bare boolean
|
|
36
|
-
* attribute (e.g. `<pc-light cast-shadows>`): `true`.
|
|
37
|
-
*
|
|
38
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
39
|
-
* @param defaultValue - The value to use when the attribute is absent or removed.
|
|
40
|
-
* @returns The parsed boolean.
|
|
41
|
-
*/
|
|
42
|
-
export declare const parseBool: (value: string | null, defaultValue: boolean) => boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Parse a color attribute value. The expected format is a CSS color name (e.g. 'rebeccapurple'),
|
|
45
|
-
* a hex color (e.g. '#ff0000' or '#f00'), or 3 or 4 space-separated numbers in the range 0 to 1
|
|
46
|
-
* (e.g. '1 0.5 0.5' or '1 0.5 0.5 0.5'). Returns `defaultValue` (cloned, when it is a color)
|
|
47
|
-
* when the attribute is absent (`null`), or when the value is malformed — the latter also logs
|
|
48
|
-
* a warning.
|
|
49
|
-
*
|
|
50
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
51
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
52
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
53
|
-
* @returns The parsed Color object.
|
|
54
|
-
*/
|
|
55
|
-
export declare const parseColor: <T extends Color | null>(value: string | null, defaultValue: T, attribute: string) => Color | T;
|
|
56
|
-
/**
|
|
57
|
-
* Resolves an enum attribute value against its set of valid names. Returns the value when it is
|
|
58
|
-
* one of the valid names. Returns `defaultValue` when the attribute is absent (`null`), or when
|
|
59
|
-
* the value is invalid — the latter also logs a warning listing the valid names.
|
|
60
|
-
*
|
|
61
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
62
|
-
* @param valid - The valid names: an array, or a map whose keys are the valid names. Only the keys
|
|
63
|
-
* are read, so the map's value type is unconstrained - engine enums are mostly numeric constants,
|
|
64
|
-
* but some (e.g. `SCALEMODE_BLEND`) are strings.
|
|
65
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
66
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
67
|
-
* @returns The resolved enum name.
|
|
68
|
-
*/
|
|
69
|
-
export declare const parseEnum: <T extends string>(value: string | null, valid: readonly T[] | ReadonlyMap<T, unknown>, defaultValue: T, attribute: string) => T;
|
|
70
|
-
/**
|
|
71
|
-
* Parses a number attribute value. Returns the parsed number when the value is a finite number.
|
|
72
|
-
* Returns `defaultValue` when the attribute is absent (`null`), or when the value is not a
|
|
73
|
-
* finite number — the latter also logs a warning.
|
|
74
|
-
*
|
|
75
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
76
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
77
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
78
|
-
* @returns The parsed number.
|
|
79
|
-
*/
|
|
80
|
-
export declare const parseNumber: <T extends number | null>(value: string | null, defaultValue: T, attribute: string) => number | T;
|
|
81
|
-
/**
|
|
82
|
-
* Parse an Euler-angles attribute value into a quaternion. The expected format is 3
|
|
83
|
-
* space-separated angles in degrees (e.g. '0 90 0'). Returns `defaultValue` (cloned, when it is
|
|
84
|
-
* a quaternion) when the attribute is absent (`null`), or when the value is malformed — the
|
|
85
|
-
* latter also logs a warning.
|
|
86
|
-
*
|
|
87
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
88
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
89
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
90
|
-
* @returns The parsed Quat object.
|
|
91
|
-
*/
|
|
92
|
-
export declare const parseQuat: <T extends Quat | null>(value: string | null, defaultValue: T, attribute: string) => Quat | T;
|
|
93
|
-
/**
|
|
94
|
-
* Parse a tags attribute value. The expected format is a comma-separated list of tag names
|
|
95
|
-
* (e.g. 'enemy, flying'). Surrounding whitespace is trimmed from each name and empty names are
|
|
96
|
-
* discarded, so a trailing comma or a doubled separator does not produce a blank tag. Returns a
|
|
97
|
-
* copy of `defaultValue` when the attribute is absent or removed (`null`).
|
|
98
|
-
*
|
|
99
|
-
* Every value is valid, so this never warns.
|
|
100
|
-
*
|
|
101
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
102
|
-
* @param defaultValue - The value to use when the attribute is absent or removed.
|
|
103
|
-
* @returns The parsed tag names.
|
|
104
|
-
*/
|
|
105
|
-
export declare const parseTags: (value: string | null, defaultValue?: string[]) => string[];
|
|
106
|
-
/**
|
|
107
|
-
* Parse a Vec2 attribute value. The expected format is 2 space-separated numbers (e.g. '1 2').
|
|
108
|
-
* Returns `defaultValue` (cloned, when it is a vector) when the attribute is absent (`null`),
|
|
109
|
-
* or when the value is malformed — the latter also logs a warning.
|
|
110
|
-
*
|
|
111
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
112
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
113
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
114
|
-
* @returns The parsed Vec2 object.
|
|
115
|
-
*/
|
|
116
|
-
export declare const parseVec2: <T extends Vec2 | null>(value: string | null, defaultValue: T, attribute: string) => Vec2 | T;
|
|
117
|
-
/**
|
|
118
|
-
* Parse a Vec3 attribute value. The expected format is 3 space-separated numbers (e.g. '1 2 3').
|
|
119
|
-
* Returns `defaultValue` (cloned, when it is a vector) when the attribute is absent (`null`),
|
|
120
|
-
* or when the value is malformed — the latter also logs a warning.
|
|
121
|
-
*
|
|
122
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
123
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
124
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
125
|
-
* @returns The parsed Vec3 object.
|
|
126
|
-
*/
|
|
127
|
-
export declare const parseVec3: <T extends Vec3 | null>(value: string | null, defaultValue: T, attribute: string) => Vec3 | T;
|
|
128
|
-
/**
|
|
129
|
-
* Parse a Vec4 attribute value. The expected format is 4 space-separated numbers
|
|
130
|
-
* (e.g. '1 2 3 4'). Returns `defaultValue` (cloned, when it is a vector) when the attribute is
|
|
131
|
-
* absent (`null`), or when the value is malformed — the latter also logs a warning.
|
|
132
|
-
*
|
|
133
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
134
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
135
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
136
|
-
* @returns The parsed Vec4 object.
|
|
137
|
-
*/
|
|
138
|
-
export declare const parseVec4: <T extends Vec4 | null>(value: string | null, defaultValue: T, attribute: string) => Vec4 | T;
|
|
139
|
-
/**
|
|
140
|
-
* Resolves a reference string to the {@link Entity} backing a `<pc-entity>` element. The reference
|
|
141
|
-
* can be a CSS selector (e.g. `#my-id`, `pc-entity[name="Foo"]`), a bare element id, or a bare
|
|
142
|
-
* entity name. Returns `null` if no matching element (or backing entity) is found.
|
|
143
|
-
*
|
|
144
|
-
* @param ref - The reference string to resolve.
|
|
145
|
-
* @returns The resolved entity, or `null`.
|
|
146
|
-
*/
|
|
147
|
-
export declare const getEntity: (ref: string) => Entity | null;
|
|
18
|
+
export {};
|
package/dist/parse.d.ts
CHANGED
|
@@ -15,133 +15,4 @@
|
|
|
15
15
|
* `getEntity` is the exception: it resolves a reference to a live entity rather than parsing a
|
|
16
16
|
* literal, and returns `null` instead of falling back to a default.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
import { Color, Quat, Vec2, Vec3, Vec4 } from 'playcanvas';
|
|
20
|
-
/**
|
|
21
|
-
* Splits an attribute value into exactly `count` numeric components. Returns `null` when the
|
|
22
|
-
* value does not consist of exactly `count` whitespace-separated finite numbers.
|
|
23
|
-
*
|
|
24
|
-
* @param value - The value to split.
|
|
25
|
-
* @param count - The required number of components.
|
|
26
|
-
* @returns The parsed components, or `null`.
|
|
27
|
-
* @ignore
|
|
28
|
-
*/
|
|
29
|
-
export declare const parseComponents: (value: string, count: number) => number[] | null;
|
|
30
|
-
/**
|
|
31
|
-
* Parse a boolean attribute value. The same rules apply to every boolean attribute:
|
|
32
|
-
*
|
|
33
|
-
* - Attribute absent (or removed): the supplied default is used.
|
|
34
|
-
* - Attribute set to the string 'false': `false`.
|
|
35
|
-
* - Attribute present with any other value, including the empty string of a bare boolean
|
|
36
|
-
* attribute (e.g. `<pc-light cast-shadows>`): `true`.
|
|
37
|
-
*
|
|
38
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
39
|
-
* @param defaultValue - The value to use when the attribute is absent or removed.
|
|
40
|
-
* @returns The parsed boolean.
|
|
41
|
-
*/
|
|
42
|
-
export declare const parseBool: (value: string | null, defaultValue: boolean) => boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Parse a color attribute value. The expected format is a CSS color name (e.g. 'rebeccapurple'),
|
|
45
|
-
* a hex color (e.g. '#ff0000' or '#f00'), or 3 or 4 space-separated numbers in the range 0 to 1
|
|
46
|
-
* (e.g. '1 0.5 0.5' or '1 0.5 0.5 0.5'). Returns `defaultValue` (cloned, when it is a color)
|
|
47
|
-
* when the attribute is absent (`null`), or when the value is malformed — the latter also logs
|
|
48
|
-
* a warning.
|
|
49
|
-
*
|
|
50
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
51
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
52
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
53
|
-
* @returns The parsed Color object.
|
|
54
|
-
*/
|
|
55
|
-
export declare const parseColor: <T extends Color | null>(value: string | null, defaultValue: T, attribute: string) => Color | T;
|
|
56
|
-
/**
|
|
57
|
-
* Resolves an enum attribute value against its set of valid names. Returns the value when it is
|
|
58
|
-
* one of the valid names. Returns `defaultValue` when the attribute is absent (`null`), or when
|
|
59
|
-
* the value is invalid — the latter also logs a warning listing the valid names.
|
|
60
|
-
*
|
|
61
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
62
|
-
* @param valid - The valid names: an array, or a map whose keys are the valid names. Only the keys
|
|
63
|
-
* are read, so the map's value type is unconstrained - engine enums are mostly numeric constants,
|
|
64
|
-
* but some (e.g. `SCALEMODE_BLEND`) are strings.
|
|
65
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
66
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
67
|
-
* @returns The resolved enum name.
|
|
68
|
-
*/
|
|
69
|
-
export declare const parseEnum: <T extends string>(value: string | null, valid: readonly T[] | ReadonlyMap<T, unknown>, defaultValue: T, attribute: string) => T;
|
|
70
|
-
/**
|
|
71
|
-
* Parses a number attribute value. Returns the parsed number when the value is a finite number.
|
|
72
|
-
* Returns `defaultValue` when the attribute is absent (`null`), or when the value is not a
|
|
73
|
-
* finite number — the latter also logs a warning.
|
|
74
|
-
*
|
|
75
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
76
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
77
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
78
|
-
* @returns The parsed number.
|
|
79
|
-
*/
|
|
80
|
-
export declare const parseNumber: <T extends number | null>(value: string | null, defaultValue: T, attribute: string) => number | T;
|
|
81
|
-
/**
|
|
82
|
-
* Parse an Euler-angles attribute value into a quaternion. The expected format is 3
|
|
83
|
-
* space-separated angles in degrees (e.g. '0 90 0'). Returns `defaultValue` (cloned, when it is
|
|
84
|
-
* a quaternion) when the attribute is absent (`null`), or when the value is malformed — the
|
|
85
|
-
* latter also logs a warning.
|
|
86
|
-
*
|
|
87
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
88
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
89
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
90
|
-
* @returns The parsed Quat object.
|
|
91
|
-
*/
|
|
92
|
-
export declare const parseQuat: <T extends Quat | null>(value: string | null, defaultValue: T, attribute: string) => Quat | T;
|
|
93
|
-
/**
|
|
94
|
-
* Parse a tags attribute value. The expected format is a comma-separated list of tag names
|
|
95
|
-
* (e.g. 'enemy, flying'). Surrounding whitespace is trimmed from each name and empty names are
|
|
96
|
-
* discarded, so a trailing comma or a doubled separator does not produce a blank tag. Returns a
|
|
97
|
-
* copy of `defaultValue` when the attribute is absent or removed (`null`).
|
|
98
|
-
*
|
|
99
|
-
* Every value is valid, so this never warns.
|
|
100
|
-
*
|
|
101
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
102
|
-
* @param defaultValue - The value to use when the attribute is absent or removed.
|
|
103
|
-
* @returns The parsed tag names.
|
|
104
|
-
*/
|
|
105
|
-
export declare const parseTags: (value: string | null, defaultValue?: string[]) => string[];
|
|
106
|
-
/**
|
|
107
|
-
* Parse a Vec2 attribute value. The expected format is 2 space-separated numbers (e.g. '1 2').
|
|
108
|
-
* Returns `defaultValue` (cloned, when it is a vector) when the attribute is absent (`null`),
|
|
109
|
-
* or when the value is malformed — the latter also logs a warning.
|
|
110
|
-
*
|
|
111
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
112
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
113
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
114
|
-
* @returns The parsed Vec2 object.
|
|
115
|
-
*/
|
|
116
|
-
export declare const parseVec2: <T extends Vec2 | null>(value: string | null, defaultValue: T, attribute: string) => Vec2 | T;
|
|
117
|
-
/**
|
|
118
|
-
* Parse a Vec3 attribute value. The expected format is 3 space-separated numbers (e.g. '1 2 3').
|
|
119
|
-
* Returns `defaultValue` (cloned, when it is a vector) when the attribute is absent (`null`),
|
|
120
|
-
* or when the value is malformed — the latter also logs a warning.
|
|
121
|
-
*
|
|
122
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
123
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
124
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
125
|
-
* @returns The parsed Vec3 object.
|
|
126
|
-
*/
|
|
127
|
-
export declare const parseVec3: <T extends Vec3 | null>(value: string | null, defaultValue: T, attribute: string) => Vec3 | T;
|
|
128
|
-
/**
|
|
129
|
-
* Parse a Vec4 attribute value. The expected format is 4 space-separated numbers
|
|
130
|
-
* (e.g. '1 2 3 4'). Returns `defaultValue` (cloned, when it is a vector) when the attribute is
|
|
131
|
-
* absent (`null`), or when the value is malformed — the latter also logs a warning.
|
|
132
|
-
*
|
|
133
|
-
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
134
|
-
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
135
|
-
* @param attribute - The attribute name, used in the warning message.
|
|
136
|
-
* @returns The parsed Vec4 object.
|
|
137
|
-
*/
|
|
138
|
-
export declare const parseVec4: <T extends Vec4 | null>(value: string | null, defaultValue: T, attribute: string) => Vec4 | T;
|
|
139
|
-
/**
|
|
140
|
-
* Resolves a reference string to the {@link Entity} backing a `<pc-entity>` element. The reference
|
|
141
|
-
* can be a CSS selector (e.g. `#my-id`, `pc-entity[name="Foo"]`), a bare element id, or a bare
|
|
142
|
-
* entity name. Returns `null` if no matching element (or backing entity) is found.
|
|
143
|
-
*
|
|
144
|
-
* @param ref - The reference string to resolve.
|
|
145
|
-
* @returns The resolved entity, or `null`.
|
|
146
|
-
*/
|
|
147
|
-
export declare const getEntity: (ref: string) => Entity | null;
|
|
18
|
+
export {};
|