@playcanvas/web-components 0.5.0 → 0.7.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.
Files changed (36) hide show
  1. package/dist/asset.d.ts +8 -0
  2. package/dist/components/button-component.d.ts +184 -0
  3. package/dist/components/camera-component.d.ts +1 -1
  4. package/dist/components/element-component.d.ts +162 -16
  5. package/dist/components/gsplat-component.d.ts +79 -0
  6. package/dist/components/layoutchild-component.d.ts +110 -0
  7. package/dist/components/layoutgroup-component.d.ts +134 -0
  8. package/dist/components/light-component.d.ts +1 -1
  9. package/dist/components/scrollbar-component.d.ts +68 -0
  10. package/dist/components/scrollview-component.d.ts +173 -0
  11. package/dist/entity.d.ts +4 -0
  12. package/dist/index.d.ts +7 -2
  13. package/dist/pwc.cjs +1957 -59
  14. package/dist/pwc.cjs.map +1 -1
  15. package/dist/pwc.js +1957 -59
  16. package/dist/pwc.js.map +1 -1
  17. package/dist/pwc.min.js +1 -1
  18. package/dist/pwc.min.js.map +1 -1
  19. package/dist/pwc.mjs +1953 -60
  20. package/dist/pwc.mjs.map +1 -1
  21. package/dist/utils.d.ts +20 -1
  22. package/package.json +9 -9
  23. package/src/app.ts +5 -0
  24. package/src/asset.ts +75 -2
  25. package/src/components/button-component.ts +450 -0
  26. package/src/components/element-component.ts +415 -5
  27. package/src/components/gsplat-component.ts +161 -0
  28. package/src/components/layoutchild-component.ts +232 -0
  29. package/src/components/layoutgroup-component.ts +297 -0
  30. package/src/components/scrollbar-component.ts +166 -0
  31. package/src/components/scrollview-component.ts +427 -0
  32. package/src/entity.ts +15 -1
  33. package/src/index.ts +12 -2
  34. package/src/utils.ts +49 -1
  35. package/dist/components/splat-component.d.ts +0 -48
  36. package/src/components/splat-component.ts +0 -102
@@ -0,0 +1,427 @@
1
+ import { SCROLL_MODE_BOUNCE, SCROLL_MODE_CLAMP, SCROLL_MODE_INFINITE, SCROLLBAR_VISIBILITY_SHOW_ALWAYS, SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED, ScrollViewComponent, Vec2 } from 'playcanvas';
2
+
3
+ import { ComponentElement } from './component';
4
+ import { getEntity, parseEnum, parseVec2 } from '../utils';
5
+
6
+ const scrollModes = new Map<string, number>([
7
+ ['clamp', SCROLL_MODE_CLAMP],
8
+ ['bounce', SCROLL_MODE_BOUNCE],
9
+ ['infinite', SCROLL_MODE_INFINITE]
10
+ ]);
11
+
12
+ const visibilities = new Map<string, number>([
13
+ ['always', SCROLLBAR_VISIBILITY_SHOW_ALWAYS],
14
+ ['when-required', SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED]
15
+ ]);
16
+
17
+ /**
18
+ * The ScrollViewComponentElement interface provides properties and methods for manipulating
19
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scrollview/ | `<pc-scrollview>`} elements.
20
+ * The ScrollViewComponentElement interface also inherits the properties and methods of the
21
+ * {@link HTMLElement} interface.
22
+ *
23
+ * @category Components
24
+ */
25
+ class ScrollViewComponentElement extends ComponentElement {
26
+ private _horizontal = true;
27
+
28
+ private _vertical = true;
29
+
30
+ private _scrollMode: number = SCROLL_MODE_BOUNCE;
31
+
32
+ private _bounceAmount = 0.1;
33
+
34
+ private _friction = 0.05;
35
+
36
+ private _useMouseWheel = true;
37
+
38
+ private _mouseWheelSensitivity = new Vec2(1, 1);
39
+
40
+ private _horizontalScrollbarVisibility: number = SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED;
41
+
42
+ private _verticalScrollbarVisibility: number = SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED;
43
+
44
+ private _viewport = '';
45
+
46
+ private _content = '';
47
+
48
+ private _horizontalScrollbar = '';
49
+
50
+ private _verticalScrollbar = '';
51
+
52
+ /** @ignore */
53
+ constructor() {
54
+ super('scrollview');
55
+ }
56
+
57
+ getInitialComponentData() {
58
+ const data: Record<string, any> = {
59
+ horizontal: this._horizontal,
60
+ vertical: this._vertical,
61
+ scrollMode: this._scrollMode,
62
+ bounceAmount: this._bounceAmount,
63
+ friction: this._friction,
64
+ useMouseWheel: this._useMouseWheel,
65
+ mouseWheelSensitivity: this._mouseWheelSensitivity,
66
+ horizontalScrollbarVisibility: this._horizontalScrollbarVisibility,
67
+ verticalScrollbarVisibility: this._verticalScrollbarVisibility
68
+ };
69
+
70
+ const viewport = getEntity(this._viewport);
71
+ if (viewport) {
72
+ data.viewportEntity = viewport;
73
+ }
74
+
75
+ const content = getEntity(this._content);
76
+ if (content) {
77
+ data.contentEntity = content;
78
+ }
79
+
80
+ const horizontalScrollbar = getEntity(this._horizontalScrollbar);
81
+ if (horizontalScrollbar) {
82
+ data.horizontalScrollbarEntity = horizontalScrollbar;
83
+ }
84
+
85
+ const verticalScrollbar = getEntity(this._verticalScrollbar);
86
+ if (verticalScrollbar) {
87
+ data.verticalScrollbarEntity = verticalScrollbar;
88
+ }
89
+
90
+ return data;
91
+ }
92
+
93
+ /**
94
+ * Gets the underlying PlayCanvas scroll view component.
95
+ * @returns The scroll view component.
96
+ */
97
+ get component(): ScrollViewComponent | null {
98
+ return super.component as ScrollViewComponent | null;
99
+ }
100
+
101
+ /**
102
+ * Sets whether horizontal scrolling is enabled.
103
+ * @param value - Whether horizontal scrolling is enabled.
104
+ */
105
+ set horizontal(value: boolean) {
106
+ this._horizontal = value;
107
+ if (this.component) {
108
+ this.component.horizontal = value;
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Gets whether horizontal scrolling is enabled.
114
+ * @returns Whether horizontal scrolling is enabled.
115
+ */
116
+ get horizontal() {
117
+ return this._horizontal;
118
+ }
119
+
120
+ /**
121
+ * Sets whether vertical scrolling is enabled.
122
+ * @param value - Whether vertical scrolling is enabled.
123
+ */
124
+ set vertical(value: boolean) {
125
+ this._vertical = value;
126
+ if (this.component) {
127
+ this.component.vertical = value;
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Gets whether vertical scrolling is enabled.
133
+ * @returns Whether vertical scrolling is enabled.
134
+ */
135
+ get vertical() {
136
+ return this._vertical;
137
+ }
138
+
139
+ /**
140
+ * Sets how the scroll view should behave when the content is scrolled beyond its bounds. Can be
141
+ * `clamp` (0), `bounce` (1) or `infinite` (2).
142
+ * @param value - The scroll mode.
143
+ */
144
+ set scrollMode(value: number) {
145
+ this._scrollMode = value;
146
+ if (this.component) {
147
+ this.component.scrollMode = value;
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Gets how the scroll view behaves when the content is scrolled beyond its bounds.
153
+ * @returns The scroll mode.
154
+ */
155
+ get scrollMode() {
156
+ return this._scrollMode;
157
+ }
158
+
159
+ /**
160
+ * Sets how far the content is allowed to bounce beyond its bounds when `scroll-mode` is
161
+ * `bounce`, in the range 0 to 1.
162
+ * @param value - The bounce amount.
163
+ */
164
+ set bounceAmount(value: number) {
165
+ this._bounceAmount = value;
166
+ if (this.component) {
167
+ this.component.bounceAmount = value;
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Gets the bounce amount.
173
+ * @returns The bounce amount.
174
+ */
175
+ get bounceAmount() {
176
+ return this._bounceAmount;
177
+ }
178
+
179
+ /**
180
+ * Sets how freely the content moves once thrown, in the range 0 (no friction) to 1.
181
+ * @param value - The friction.
182
+ */
183
+ set friction(value: number) {
184
+ this._friction = value;
185
+ if (this.component) {
186
+ this.component.friction = value;
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Gets the friction.
192
+ * @returns The friction.
193
+ */
194
+ get friction() {
195
+ return this._friction;
196
+ }
197
+
198
+ /**
199
+ * Sets whether the scroll view responds to mouse wheel events.
200
+ * @param value - Whether to use the mouse wheel.
201
+ */
202
+ set useMouseWheel(value: boolean) {
203
+ this._useMouseWheel = value;
204
+ if (this.component) {
205
+ this.component.useMouseWheel = value;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Gets whether the scroll view responds to mouse wheel events.
211
+ * @returns Whether the mouse wheel is used.
212
+ */
213
+ get useMouseWheel() {
214
+ return this._useMouseWheel;
215
+ }
216
+
217
+ /**
218
+ * Sets the mouse wheel sensitivity as a Vec2 (horizontal, vertical). A value of 0 on an axis
219
+ * disables mouse wheel scrolling for that axis.
220
+ * @param value - The mouse wheel sensitivity.
221
+ */
222
+ set mouseWheelSensitivity(value: Vec2) {
223
+ this._mouseWheelSensitivity = value;
224
+ if (this.component) {
225
+ this.component.mouseWheelSensitivity = value;
226
+ }
227
+ }
228
+
229
+ /**
230
+ * Gets the mouse wheel sensitivity.
231
+ * @returns The mouse wheel sensitivity.
232
+ */
233
+ get mouseWheelSensitivity() {
234
+ return this._mouseWheelSensitivity;
235
+ }
236
+
237
+ /**
238
+ * Sets the visibility of the horizontal scrollbar. Can be `always` (0) or `when-required` (1).
239
+ * @param value - The horizontal scrollbar visibility.
240
+ */
241
+ set horizontalScrollbarVisibility(value: number) {
242
+ this._horizontalScrollbarVisibility = value;
243
+ if (this.component) {
244
+ this.component.horizontalScrollbarVisibility = value;
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Gets the visibility of the horizontal scrollbar.
250
+ * @returns The horizontal scrollbar visibility.
251
+ */
252
+ get horizontalScrollbarVisibility() {
253
+ return this._horizontalScrollbarVisibility;
254
+ }
255
+
256
+ /**
257
+ * Sets the visibility of the vertical scrollbar. Can be `always` (0) or `when-required` (1).
258
+ * @param value - The vertical scrollbar visibility.
259
+ */
260
+ set verticalScrollbarVisibility(value: number) {
261
+ this._verticalScrollbarVisibility = value;
262
+ if (this.component) {
263
+ this.component.verticalScrollbarVisibility = value;
264
+ }
265
+ }
266
+
267
+ /**
268
+ * Gets the visibility of the vertical scrollbar.
269
+ * @returns The vertical scrollbar visibility.
270
+ */
271
+ get verticalScrollbarVisibility() {
272
+ return this._verticalScrollbarVisibility;
273
+ }
274
+
275
+ /**
276
+ * Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` used as the
277
+ * viewport, which clips the content to the scroll view's bounds.
278
+ * @param value - The viewport entity reference.
279
+ */
280
+ set viewport(value: string) {
281
+ this._viewport = value;
282
+ const entity = getEntity(value);
283
+ if (this.component && entity) {
284
+ this.component.viewportEntity = entity;
285
+ }
286
+ }
287
+
288
+ /**
289
+ * Gets the reference to the `<pc-entity>` used as the viewport.
290
+ * @returns The viewport entity reference.
291
+ */
292
+ get viewport() {
293
+ return this._viewport;
294
+ }
295
+
296
+ /**
297
+ * Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` used as the
298
+ * content, which is moved as the scroll view is scrolled.
299
+ * @param value - The content entity reference.
300
+ */
301
+ set content(value: string) {
302
+ this._content = value;
303
+ const entity = getEntity(value);
304
+ if (this.component && entity) {
305
+ this.component.contentEntity = entity;
306
+ }
307
+ }
308
+
309
+ /**
310
+ * Gets the reference to the `<pc-entity>` used as the content.
311
+ * @returns The content entity reference.
312
+ */
313
+ get content() {
314
+ return this._content;
315
+ }
316
+
317
+ /**
318
+ * Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` containing
319
+ * the horizontal `<pc-scrollbar>`.
320
+ * @param value - The horizontal scrollbar entity reference.
321
+ */
322
+ set horizontalScrollbar(value: string) {
323
+ this._horizontalScrollbar = value;
324
+ const entity = getEntity(value);
325
+ if (this.component && entity) {
326
+ this.component.horizontalScrollbarEntity = entity;
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Gets the reference to the `<pc-entity>` containing the horizontal scrollbar.
332
+ * @returns The horizontal scrollbar entity reference.
333
+ */
334
+ get horizontalScrollbar() {
335
+ return this._horizontalScrollbar;
336
+ }
337
+
338
+ /**
339
+ * Sets the reference (CSS selector, element id or entity name) to the `<pc-entity>` containing
340
+ * the vertical `<pc-scrollbar>`.
341
+ * @param value - The vertical scrollbar entity reference.
342
+ */
343
+ set verticalScrollbar(value: string) {
344
+ this._verticalScrollbar = value;
345
+ const entity = getEntity(value);
346
+ if (this.component && entity) {
347
+ this.component.verticalScrollbarEntity = entity;
348
+ }
349
+ }
350
+
351
+ /**
352
+ * Gets the reference to the `<pc-entity>` containing the vertical scrollbar.
353
+ * @returns The vertical scrollbar entity reference.
354
+ */
355
+ get verticalScrollbar() {
356
+ return this._verticalScrollbar;
357
+ }
358
+
359
+ static get observedAttributes() {
360
+ return [
361
+ ...super.observedAttributes,
362
+ 'horizontal',
363
+ 'vertical',
364
+ 'scroll-mode',
365
+ 'bounce-amount',
366
+ 'friction',
367
+ 'use-mouse-wheel',
368
+ 'mouse-wheel-sensitivity',
369
+ 'horizontal-scrollbar-visibility',
370
+ 'vertical-scrollbar-visibility',
371
+ 'viewport',
372
+ 'content',
373
+ 'horizontal-scrollbar',
374
+ 'vertical-scrollbar'
375
+ ];
376
+ }
377
+
378
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
379
+ super.attributeChangedCallback(name, _oldValue, newValue);
380
+
381
+ switch (name) {
382
+ case 'horizontal':
383
+ this.horizontal = newValue !== 'false';
384
+ break;
385
+ case 'vertical':
386
+ this.vertical = newValue !== 'false';
387
+ break;
388
+ case 'scroll-mode':
389
+ this.scrollMode = parseEnum(newValue, scrollModes, SCROLL_MODE_BOUNCE);
390
+ break;
391
+ case 'bounce-amount':
392
+ this.bounceAmount = Number(newValue);
393
+ break;
394
+ case 'friction':
395
+ this.friction = Number(newValue);
396
+ break;
397
+ case 'use-mouse-wheel':
398
+ this.useMouseWheel = newValue !== 'false';
399
+ break;
400
+ case 'mouse-wheel-sensitivity':
401
+ this.mouseWheelSensitivity = parseVec2(newValue);
402
+ break;
403
+ case 'horizontal-scrollbar-visibility':
404
+ this.horizontalScrollbarVisibility = parseEnum(newValue, visibilities, SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED);
405
+ break;
406
+ case 'vertical-scrollbar-visibility':
407
+ this.verticalScrollbarVisibility = parseEnum(newValue, visibilities, SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED);
408
+ break;
409
+ case 'viewport':
410
+ this.viewport = newValue;
411
+ break;
412
+ case 'content':
413
+ this.content = newValue;
414
+ break;
415
+ case 'horizontal-scrollbar':
416
+ this.horizontalScrollbar = newValue;
417
+ break;
418
+ case 'vertical-scrollbar':
419
+ this.verticalScrollbar = newValue;
420
+ break;
421
+ }
422
+ }
423
+ }
424
+
425
+ customElements.define('pc-scrollview', ScrollViewComponentElement);
426
+
427
+ export { ScrollViewComponentElement };
package/src/entity.ts CHANGED
@@ -45,12 +45,24 @@ class EntityElement extends AsyncElement {
45
45
  */
46
46
  private _listeners: { [key: string]: EventListener[] } = {};
47
47
 
48
+ /**
49
+ * Whether the hierarchy has been built for this entity.
50
+ */
51
+ private _built = false;
52
+
48
53
  /**
49
54
  * The PlayCanvas entity instance.
50
55
  */
51
56
  entity: Entity | null = null;
52
57
 
53
58
  createEntity(app: AppBase) {
59
+ // Guard against double creation. When a subtree is inserted at runtime (e.g. cloning a
60
+ // `<template>`), an ancestor's connectedCallback eagerly creates descendant entities; the
61
+ // descendants' own connectedCallbacks would otherwise create them a second time.
62
+ if (this.entity) {
63
+ return;
64
+ }
65
+
54
66
  // Create a new entity
55
67
  this.entity = new Entity(this.getAttribute('name') || this._name, app);
56
68
 
@@ -106,7 +118,8 @@ class EntityElement extends AsyncElement {
106
118
  }
107
119
 
108
120
  buildHierarchy(app: AppBase) {
109
- if (!this.entity) return;
121
+ if (!this.entity || this._built) return;
122
+ this._built = true;
110
123
 
111
124
  const closestEntity = this.closestEntity;
112
125
  if (closestEntity?.entity) {
@@ -152,6 +165,7 @@ class EntityElement extends AsyncElement {
152
165
  // Destroy the entity
153
166
  this.entity.destroy();
154
167
  this.entity = null;
168
+ this._built = false;
155
169
  }
156
170
  }
157
171
 
package/src/index.ts CHANGED
@@ -16,20 +16,25 @@ import { AppElement } from './app';
16
16
  import { EntityElement } from './entity';
17
17
  import { AssetElement } from './asset';
18
18
  import { ListenerComponentElement } from './components/listener-component';
19
+ import { ButtonComponentElement } from './components/button-component';
19
20
  import { CameraComponentElement } from './components/camera-component';
20
21
  import { CollisionComponentElement } from './components/collision-component';
21
22
  import { ComponentElement } from './components/component';
22
23
  import { ElementComponentElement } from './components/element-component';
24
+ import { LayoutChildComponentElement } from './components/layoutchild-component';
25
+ import { LayoutGroupComponentElement } from './components/layoutgroup-component';
23
26
  import { LightComponentElement } from './components/light-component';
24
27
  import { ParticleSystemComponentElement } from './components/particlesystem-component';
25
28
  import { RenderComponentElement } from './components/render-component';
26
29
  import { RigidBodyComponentElement } from './components/rigidbody-component';
27
30
  import { ScreenComponentElement } from './components/screen-component';
31
+ import { ScrollbarComponentElement } from './components/scrollbar-component';
32
+ import { ScrollViewComponentElement } from './components/scrollview-component';
28
33
  import { ScriptComponentElement } from './components/script-component';
29
34
  import { ScriptElement } from './components/script';
30
35
  import { SoundComponentElement } from './components/sound-component';
31
36
  import { SoundSlotElement } from './components/sound-slot';
32
- import { SplatComponentElement } from './components/splat-component';
37
+ import { GSplatComponentElement } from './components/gsplat-component';
33
38
  import { MaterialElement } from './material';
34
39
  import { ModelElement } from './model';
35
40
  import { SceneElement } from './scene';
@@ -41,21 +46,26 @@ export {
41
46
  AppElement,
42
47
  EntityElement,
43
48
  AssetElement,
49
+ ButtonComponentElement,
44
50
  CameraComponentElement,
45
51
  CollisionComponentElement,
46
52
  ComponentElement,
47
53
  ElementComponentElement,
54
+ LayoutChildComponentElement,
55
+ LayoutGroupComponentElement,
48
56
  ParticleSystemComponentElement,
49
57
  LightComponentElement,
50
58
  ListenerComponentElement,
51
59
  RenderComponentElement,
52
60
  RigidBodyComponentElement,
53
61
  ScreenComponentElement,
62
+ ScrollbarComponentElement,
63
+ ScrollViewComponentElement,
54
64
  ScriptComponentElement,
55
65
  ScriptElement,
56
66
  SoundComponentElement,
57
67
  SoundSlotElement,
58
- SplatComponentElement,
68
+ GSplatComponentElement,
59
69
  MaterialElement,
60
70
  ModelElement,
61
71
  SceneElement,
package/src/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Color, Quat, Vec2, Vec3, Vec4 } from 'playcanvas';
1
+ import { Color, Entity, Quat, Vec2, Vec3, Vec4 } from 'playcanvas';
2
2
 
3
3
  import { CSS_COLORS } from './colors';
4
4
 
@@ -69,3 +69,51 @@ export const parseVec4 = (value: string): Vec4 => {
69
69
  const components = value.split(' ').map(Number);
70
70
  return new Vec4(components);
71
71
  };
72
+
73
+ /**
74
+ * Resolves an enum value supplied as either a named string (looked up in `map`) or a numeric
75
+ * string. Falls back to `defaultValue` when the value is neither a known name nor a finite number.
76
+ *
77
+ * @param value - The attribute value to parse.
78
+ * @param map - A map of named values to their numeric enum equivalents.
79
+ * @param defaultValue - The value to return when parsing fails.
80
+ * @returns The resolved numeric enum value.
81
+ */
82
+ export const parseEnum = (value: string, map: Map<string, number>, defaultValue: number): number => {
83
+ const named = map.get(value);
84
+ if (named !== undefined) {
85
+ return named;
86
+ }
87
+ const numeric = Number(value);
88
+ return Number.isFinite(numeric) ? numeric : defaultValue;
89
+ };
90
+
91
+ /**
92
+ * Resolves a reference string to the {@link Entity} backing a `<pc-entity>` element. The reference
93
+ * can be a CSS selector (e.g. `#my-id`, `pc-entity[name="Foo"]`), a bare element id, or a bare
94
+ * entity name. Returns `null` if no matching element (or backing entity) is found.
95
+ *
96
+ * @param ref - The reference string to resolve.
97
+ * @returns The resolved entity, or `null`.
98
+ */
99
+ export const getEntity = (ref: string): Entity | null => {
100
+ if (!ref) {
101
+ return null;
102
+ }
103
+
104
+ let element: Element | null = null;
105
+
106
+ // Try the reference as a CSS selector. An invalid selector (e.g. a bare name containing
107
+ // spaces) throws, in which case we fall back to id/name lookups below.
108
+ try {
109
+ element = document.querySelector(ref);
110
+ } catch {
111
+ element = null;
112
+ }
113
+
114
+ if (!element) {
115
+ element = document.getElementById(ref) ?? document.querySelector(`pc-entity[name="${ref}"]`);
116
+ }
117
+
118
+ return (element as { entity?: Entity } | null)?.entity ?? null;
119
+ };
@@ -1,48 +0,0 @@
1
- import { GSplatComponent } from 'playcanvas';
2
- import { ComponentElement } from './component';
3
- /**
4
- * The SplatComponentElement interface provides properties and methods for manipulating
5
- * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
6
- * The SplatComponentElement interface also inherits the properties and methods of the
7
- * {@link HTMLElement} interface.
8
- *
9
- * @category Components
10
- */
11
- declare class SplatComponentElement extends ComponentElement {
12
- private _asset;
13
- private _castShadows;
14
- /** @ignore */
15
- constructor();
16
- getInitialComponentData(): {
17
- asset: import("playcanvas").Asset | null | undefined;
18
- castShadows: boolean;
19
- };
20
- /**
21
- * Gets the underlying PlayCanvas splat component.
22
- * @returns The splat component.
23
- */
24
- get component(): GSplatComponent | null;
25
- /**
26
- * Sets id of the `pc-asset` to use for the splat.
27
- * @param value - The asset ID.
28
- */
29
- set asset(value: string);
30
- /**
31
- * Gets the id of the `pc-asset` to use for the splat.
32
- * @returns The asset ID.
33
- */
34
- get asset(): string;
35
- /**
36
- * Sets whether the splat casts shadows.
37
- * @param value - Whether the splat casts shadows.
38
- */
39
- set castShadows(value: boolean);
40
- /**
41
- * Gets whether the splat casts shadows.
42
- * @returns Whether the splat casts shadows.
43
- */
44
- get castShadows(): boolean;
45
- static get observedAttributes(): string[];
46
- attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
47
- }
48
- export { SplatComponentElement };