@playcanvas/web-components 0.2.4 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/web-components",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://playcanvas.com",
6
6
  "description": "Web Components for the PlayCanvas Engine",
@@ -40,25 +40,25 @@
40
40
  "@mediapipe/tasks-vision": "0.10.21",
41
41
  "@playcanvas/eslint-config": "2.0.9",
42
42
  "@rollup/plugin-commonjs": "28.0.3",
43
- "@rollup/plugin-node-resolve": "16.0.0",
43
+ "@rollup/plugin-node-resolve": "16.0.1",
44
44
  "@rollup/plugin-terser": "0.4.4",
45
45
  "@rollup/plugin-typescript": "12.1.2",
46
46
  "@tweenjs/tween.js": "25.0.0",
47
- "@typescript-eslint/eslint-plugin": "8.26.1",
48
- "@typescript-eslint/parser": "8.26.1",
47
+ "@typescript-eslint/eslint-plugin": "8.31.0",
48
+ "@typescript-eslint/parser": "8.31.0",
49
49
  "concurrently": "9.1.2",
50
50
  "earcut": "3.0.1",
51
- "eslint": "9.22.0",
52
- "eslint-import-resolver-typescript": "3.8.4",
51
+ "eslint": "9.25.1",
52
+ "eslint-import-resolver-typescript": "4.3.4",
53
53
  "globals": "16.0.0",
54
- "mp4-muxer": "5.2.0",
54
+ "mp4-muxer": "5.2.1",
55
55
  "opentype.js": "1.3.4",
56
- "playcanvas": "2.5.1",
57
- "rollup": "4.35.0",
56
+ "playcanvas": "2.7.1",
57
+ "rollup": "4.40.0",
58
58
  "serve": "14.2.4",
59
59
  "tslib": "2.8.1",
60
- "typedoc": "0.27.9",
60
+ "typedoc": "0.28.3",
61
61
  "typedoc-plugin-mdn-links": "5.0.1",
62
- "typescript": "5.8.2"
62
+ "typescript": "5.8.3"
63
63
  }
64
64
  }
package/src/asset.ts CHANGED
@@ -28,7 +28,7 @@ const extToType = new Map([
28
28
  const processBufferView = (
29
29
  gltfBuffer: any,
30
30
  buffers: Array<any>,
31
- continuation: (err: string, result: any) => void
31
+ continuation: (err: string | null, result: any) => void
32
32
  ) => {
33
33
  if (gltfBuffer.extensions && gltfBuffer.extensions.EXT_meshopt_compression) {
34
34
  const extensionDef = gltfBuffer.extensions.EXT_meshopt_compression;
@@ -103,6 +103,7 @@ class AssetElement extends HTMLElement {
103
103
  }
104
104
  });
105
105
  } else {
106
+ // @ts-ignore
106
107
  this.asset = new Asset(id, type, { url: src });
107
108
  }
108
109
 
@@ -52,6 +52,8 @@ class LightComponentElement extends ComponentElement {
52
52
 
53
53
  private _vsmBias = 0.01;
54
54
 
55
+ private _vsmBlurSize = 11;
56
+
55
57
  /** @ignore */
56
58
  constructor() {
57
59
  super('light');
@@ -72,7 +74,8 @@ class LightComponentElement extends ComponentElement {
72
74
  shadowResolution: this._shadowResolution,
73
75
  shadowType: shadowTypes.get(this._shadowType),
74
76
  type: this._type,
75
- vsmBias: this._vsmBias
77
+ vsmBias: this._vsmBias,
78
+ vsmBlurSize: this._vsmBlurSize
76
79
  };
77
80
  }
78
81
 
@@ -365,6 +368,25 @@ class LightComponentElement extends ComponentElement {
365
368
  return this._vsmBias;
366
369
  }
367
370
 
371
+ /**
372
+ * Sets the VSM blur size of the light. Minimum is 1, maximum is 25. Default is 11.
373
+ * @param value - The VSM blur size.
374
+ */
375
+ set vsmBlurSize(value: number) {
376
+ this._vsmBlurSize = value;
377
+ if (this.component) {
378
+ this.component.vsmBlurSize = value;
379
+ }
380
+ }
381
+
382
+ /**
383
+ * Gets the VSM blur size of the light.
384
+ * @returns The VSM blur size.
385
+ */
386
+ get vsmBlurSize() {
387
+ return this._vsmBlurSize;
388
+ }
389
+
368
390
  static get observedAttributes() {
369
391
  return [
370
392
  ...super.observedAttributes,
@@ -381,7 +403,8 @@ class LightComponentElement extends ComponentElement {
381
403
  'shadow-resolution',
382
404
  'shadow-type',
383
405
  'type',
384
- 'vsm-bias'
406
+ 'vsm-bias',
407
+ 'vsm-blur-size'
385
408
  ];
386
409
  }
387
410
 
@@ -431,6 +454,9 @@ class LightComponentElement extends ComponentElement {
431
454
  case 'vsm-bias':
432
455
  this.vsmBias = Number(newValue);
433
456
  break;
457
+ case 'vsm-blur-size':
458
+ this.vsmBlurSize = Number(newValue);
459
+ break;
434
460
  }
435
461
  }
436
462
  }
@@ -12,7 +12,9 @@ import { AssetElement } from '../asset';
12
12
  * @category Components
13
13
  */
14
14
  class SplatComponentElement extends ComponentElement {
15
- private _asset: string = '';
15
+ private _asset = '';
16
+
17
+ private _castShadows = false;
16
18
 
17
19
  /** @ignore */
18
20
  constructor() {
@@ -21,7 +23,8 @@ class SplatComponentElement extends ComponentElement {
21
23
 
22
24
  getInitialComponentData() {
23
25
  return {
24
- asset: AssetElement.get(this._asset)
26
+ asset: AssetElement.get(this._asset),
27
+ castShadows: this._castShadows
25
28
  };
26
29
  }
27
30
 
@@ -53,8 +56,31 @@ class SplatComponentElement extends ComponentElement {
53
56
  return this._asset;
54
57
  }
55
58
 
59
+ /**
60
+ * Sets whether the splat casts shadows.
61
+ * @param value - Whether the splat casts shadows.
62
+ */
63
+ set castShadows(value: boolean) {
64
+ this._castShadows = value;
65
+ if (this.component) {
66
+ this.component.castShadows = value;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Gets whether the splat casts shadows.
72
+ * @returns Whether the splat casts shadows.
73
+ */
74
+ get castShadows() {
75
+ return this._castShadows;
76
+ }
77
+
56
78
  static get observedAttributes() {
57
- return [...super.observedAttributes, 'asset'];
79
+ return [
80
+ ...super.observedAttributes,
81
+ 'asset',
82
+ 'cast-shadows'
83
+ ];
58
84
  }
59
85
 
60
86
  attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
@@ -64,6 +90,9 @@ class SplatComponentElement extends ComponentElement {
64
90
  case 'asset':
65
91
  this.asset = newValue;
66
92
  break;
93
+ case 'cast-shadows':
94
+ this.castShadows = this.hasAttribute('cast-shadows');
95
+ break;
67
96
  }
68
97
  }
69
98
  }
package/src/module.ts CHANGED
@@ -17,22 +17,15 @@ class ModuleElement extends HTMLElement {
17
17
 
18
18
  private async loadModule(): Promise<void> {
19
19
  const name = this.getAttribute('name')!;
20
- const glue = this.getAttribute('glue')!;
21
- const wasm = this.getAttribute('wasm')!;
22
- const fallback = this.getAttribute('fallback')!;
20
+ const glueUrl = this.getAttribute('glue')!;
21
+ const wasmUrl = this.getAttribute('wasm')!;
22
+ const fallbackUrl = this.getAttribute('fallback')!;
23
+ const config = { glueUrl, wasmUrl, fallbackUrl };
23
24
 
24
25
  if (name === 'Basis') {
25
- basisInitialize({
26
- glueUrl: glue,
27
- wasmUrl: wasm,
28
- fallbackUrl: fallback
29
- });
26
+ basisInitialize(config);
30
27
  } else {
31
- WasmModule.setConfig(name, {
32
- glueUrl: glue,
33
- wasmUrl: wasm,
34
- fallbackUrl: fallback
35
- });
28
+ WasmModule.setConfig(name, config);
36
29
 
37
30
  await new Promise<void>((resolve) => {
38
31
  WasmModule.getInstance(name, () => resolve());