@playcanvas/web-components 0.13.0 → 0.14.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/app.d.cts +35 -0
- package/dist/app.d.ts +35 -0
- package/dist/asset.d.cts +7 -1
- package/dist/asset.d.ts +7 -1
- package/dist/colors.d.cts +1 -1
- package/dist/colors.d.ts +1 -1
- package/dist/custom-elements.json +114 -1
- package/dist/entity-base.d.cts +1 -7
- package/dist/entity-base.d.ts +1 -7
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- 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 +506 -54
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +506 -54
- 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 +506 -54
- package/dist/pwc.mjs.map +1 -1
- package/dist/vscode.html-custom-data.json +12 -2
- package/dist/web-types.json +22 -3
- package/package.json +3 -3
- package/src/app.ts +92 -19
- package/src/asset.ts +34 -2
- package/src/colors.ts +5 -0
- 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/entity-base.ts +3 -3
- package/src/index.ts +2 -0
- package/src/loading-bar.ts +2 -3
- package/src/material.ts +31 -2
- package/src/model.ts +158 -5
- package/src/node.ts +277 -2
- package/src/parse.ts +11 -1
- package/src/sky.ts +2 -3
package/src/parse.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { CSS_COLORS } from './colors';
|
|
|
28
28
|
* @param value - The value to split.
|
|
29
29
|
* @param count - The required number of components.
|
|
30
30
|
* @returns The parsed components, or `null`.
|
|
31
|
-
* @
|
|
31
|
+
* @internal
|
|
32
32
|
*/
|
|
33
33
|
export const parseComponents = (value: string, count: number): number[] | null => {
|
|
34
34
|
const components = value.trim().split(/\s+/).map(Number);
|
|
@@ -61,6 +61,7 @@ const cloneDefault = <T extends Color | Quat | Vec2 | Vec3 | Vec4 | null>(value:
|
|
|
61
61
|
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
62
62
|
* @param defaultValue - The value to use when the attribute is absent or removed.
|
|
63
63
|
* @returns The parsed boolean.
|
|
64
|
+
* @internal
|
|
64
65
|
*/
|
|
65
66
|
export const parseBool = (value: string | null, defaultValue: boolean): boolean => {
|
|
66
67
|
return value === null ? defaultValue : value !== 'false';
|
|
@@ -77,6 +78,7 @@ export const parseBool = (value: string | null, defaultValue: boolean): boolean
|
|
|
77
78
|
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
78
79
|
* @param attribute - The attribute name, used in the warning message.
|
|
79
80
|
* @returns The parsed Color object.
|
|
81
|
+
* @internal
|
|
80
82
|
*/
|
|
81
83
|
export const parseColor = <T extends Color | null>(
|
|
82
84
|
value: string | null,
|
|
@@ -129,6 +131,7 @@ export const parseColor = <T extends Color | null>(
|
|
|
129
131
|
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
130
132
|
* @param attribute - The attribute name, used in the warning message.
|
|
131
133
|
* @returns The resolved enum name.
|
|
134
|
+
* @internal
|
|
132
135
|
*/
|
|
133
136
|
export const parseEnum = <T extends string>(
|
|
134
137
|
value: string | null,
|
|
@@ -158,6 +161,7 @@ export const parseEnum = <T extends string>(
|
|
|
158
161
|
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
159
162
|
* @param attribute - The attribute name, used in the warning message.
|
|
160
163
|
* @returns The parsed number.
|
|
164
|
+
* @internal
|
|
161
165
|
*/
|
|
162
166
|
export const parseNumber = <T extends number | null>(
|
|
163
167
|
value: string | null,
|
|
@@ -187,6 +191,7 @@ export const parseNumber = <T extends number | null>(
|
|
|
187
191
|
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
188
192
|
* @param attribute - The attribute name, used in the warning message.
|
|
189
193
|
* @returns The parsed Quat object.
|
|
194
|
+
* @internal
|
|
190
195
|
*/
|
|
191
196
|
export const parseQuat = <T extends Quat | null>(
|
|
192
197
|
value: string | null,
|
|
@@ -217,6 +222,7 @@ export const parseQuat = <T extends Quat | null>(
|
|
|
217
222
|
* @param value - The attribute value to parse (`null` when the attribute is absent).
|
|
218
223
|
* @param defaultValue - The value to use when the attribute is absent or removed.
|
|
219
224
|
* @returns The parsed tag names.
|
|
225
|
+
* @internal
|
|
220
226
|
*/
|
|
221
227
|
export const parseTags = (value: string | null, defaultValue: string[] = []): string[] => {
|
|
222
228
|
if (value === null) {
|
|
@@ -239,6 +245,7 @@ export const parseTags = (value: string | null, defaultValue: string[] = []): st
|
|
|
239
245
|
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
240
246
|
* @param attribute - The attribute name, used in the warning message.
|
|
241
247
|
* @returns The parsed Vec2 object.
|
|
248
|
+
* @internal
|
|
242
249
|
*/
|
|
243
250
|
export const parseVec2 = <T extends Vec2 | null>(
|
|
244
251
|
value: string | null,
|
|
@@ -267,6 +274,7 @@ export const parseVec2 = <T extends Vec2 | null>(
|
|
|
267
274
|
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
268
275
|
* @param attribute - The attribute name, used in the warning message.
|
|
269
276
|
* @returns The parsed Vec3 object.
|
|
277
|
+
* @internal
|
|
270
278
|
*/
|
|
271
279
|
export const parseVec3 = <T extends Vec3 | null>(
|
|
272
280
|
value: string | null,
|
|
@@ -295,6 +303,7 @@ export const parseVec3 = <T extends Vec3 | null>(
|
|
|
295
303
|
* @param defaultValue - The value to use when the attribute is absent or invalid.
|
|
296
304
|
* @param attribute - The attribute name, used in the warning message.
|
|
297
305
|
* @returns The parsed Vec4 object.
|
|
306
|
+
* @internal
|
|
298
307
|
*/
|
|
299
308
|
export const parseVec4 = <T extends Vec4 | null>(
|
|
300
309
|
value: string | null,
|
|
@@ -321,6 +330,7 @@ export const parseVec4 = <T extends Vec4 | null>(
|
|
|
321
330
|
*
|
|
322
331
|
* @param ref - The reference string to resolve.
|
|
323
332
|
* @returns The resolved entity, or `null`.
|
|
333
|
+
* @internal
|
|
324
334
|
*/
|
|
325
335
|
export const getEntity = (ref: string): Entity | null => {
|
|
326
336
|
if (!ref) {
|
package/src/sky.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Asset, EventHandle, Scene, Texture } from 'playcanvas';
|
|
|
2
2
|
import { EnvLighting, LAYERID_SKYBOX, Quat, Vec3 } from 'playcanvas';
|
|
3
3
|
|
|
4
4
|
import type { AppElement } from './app';
|
|
5
|
-
import {
|
|
5
|
+
import { useAsset } from './asset';
|
|
6
6
|
import { AsyncElement } from './async-element';
|
|
7
7
|
import { parseBool, parseEnum, parseNumber, parseVec3 } from './parse';
|
|
8
8
|
|
|
@@ -116,7 +116,7 @@ class SkyElement extends AsyncElement {
|
|
|
116
116
|
|
|
117
117
|
this._appElement = appElement;
|
|
118
118
|
|
|
119
|
-
const asset =
|
|
119
|
+
const asset = useAsset(this._asset);
|
|
120
120
|
if (!asset) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
@@ -136,7 +136,6 @@ class SkyElement extends AsyncElement {
|
|
|
136
136
|
}
|
|
137
137
|
this._generateSkybox(asset);
|
|
138
138
|
});
|
|
139
|
-
app.assets.load(asset);
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
|