@playcanvas/web-components 0.2.5 → 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.5",
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",
@@ -44,21 +44,21 @@
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.28.0",
48
- "@typescript-eslint/parser": "8.28.0",
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.23.0",
52
- "eslint-import-resolver-typescript": "4.2.2",
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.6.0",
57
- "rollup": "4.37.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.28.1",
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
@@ -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
 
@@ -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());