@playcanvas/web-components 0.2.11 → 0.3.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2011-2025 PlayCanvas
3
+ Copyright (c) 2011-2026 PlayCanvas Ltd.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -13,6 +13,7 @@ declare class ElementComponentElement extends ComponentElement {
13
13
  private _asset;
14
14
  private _autoWidth;
15
15
  private _color;
16
+ private _enableMarkup;
16
17
  private _fontSize;
17
18
  private _lineHeight;
18
19
  private _pivot;
@@ -27,6 +28,7 @@ declare class ElementComponentElement extends ComponentElement {
27
28
  anchor: Vec4;
28
29
  autoWidth: boolean;
29
30
  color: Color;
31
+ enableMarkup: boolean;
30
32
  fontAsset: number;
31
33
  fontSize: number;
32
34
  lineHeight: number;
@@ -81,6 +83,16 @@ declare class ElementComponentElement extends ComponentElement {
81
83
  * @returns The color.
82
84
  */
83
85
  get color(): Color;
86
+ /**
87
+ * Sets whether the element component should use markup.
88
+ * @param value - Whether to enable markup.
89
+ */
90
+ set enableMarkup(value: boolean);
91
+ /**
92
+ * Gets whether the element component should use markup.
93
+ * @returns Whether markup is enabled.
94
+ */
95
+ get enableMarkup(): boolean;
84
96
  /**
85
97
  * Sets the font size of the element component.
86
98
  * @param value - The font size.
@@ -11,11 +11,13 @@ import { ComponentElement } from './component';
11
11
  declare class SplatComponentElement extends ComponentElement {
12
12
  private _asset;
13
13
  private _castShadows;
14
+ private _unified;
14
15
  /** @ignore */
15
16
  constructor();
16
17
  getInitialComponentData(): {
17
18
  asset: import("playcanvas").Asset | null | undefined;
18
19
  castShadows: boolean;
20
+ unified: boolean;
19
21
  };
20
22
  /**
21
23
  * Gets the underlying PlayCanvas splat component.
@@ -42,6 +44,17 @@ declare class SplatComponentElement extends ComponentElement {
42
44
  * @returns Whether the splat casts shadows.
43
45
  */
44
46
  get castShadows(): boolean;
47
+ /**
48
+ * Sets whether the splat supports global sorting and LOD streaming. This property can only be
49
+ * changed when the component is disabled.
50
+ * @param value - Whether the splat supports global sorting and LOD streaming.
51
+ */
52
+ set unified(value: boolean);
53
+ /**
54
+ * Gets whether the splat supports global sorting and LOD streaming.
55
+ * @returns Whether the splat supports global sorting and LOD streaming.
56
+ */
57
+ get unified(): boolean;
45
58
  static get observedAttributes(): string[];
46
59
  attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
47
60
  }
package/dist/pwc.cjs CHANGED
@@ -2118,6 +2118,7 @@ class ElementComponentElement extends ComponentElement {
2118
2118
  this._asset = '';
2119
2119
  this._autoWidth = true;
2120
2120
  this._color = new playcanvas.Color(1, 1, 1, 1);
2121
+ this._enableMarkup = false;
2121
2122
  this._fontSize = 32;
2122
2123
  this._lineHeight = 32;
2123
2124
  this._pivot = new playcanvas.Vec2(0.5, 0.5);
@@ -2134,6 +2135,7 @@ class ElementComponentElement extends ComponentElement {
2134
2135
  anchor: this._anchor,
2135
2136
  autoWidth: this._autoWidth,
2136
2137
  color: this._color,
2138
+ enableMarkup: this._enableMarkup,
2137
2139
  fontAsset: AssetElement.get(this._asset).id,
2138
2140
  fontSize: this._fontSize,
2139
2141
  lineHeight: this._lineHeight,
@@ -2220,6 +2222,23 @@ class ElementComponentElement extends ComponentElement {
2220
2222
  get color() {
2221
2223
  return this._color;
2222
2224
  }
2225
+ /**
2226
+ * Sets whether the element component should use markup.
2227
+ * @param value - Whether to enable markup.
2228
+ */
2229
+ set enableMarkup(value) {
2230
+ this._enableMarkup = value;
2231
+ if (this.component) {
2232
+ this.component.enableMarkup = value;
2233
+ }
2234
+ }
2235
+ /**
2236
+ * Gets whether the element component should use markup.
2237
+ * @returns Whether markup is enabled.
2238
+ */
2239
+ get enableMarkup() {
2240
+ return this._enableMarkup;
2241
+ }
2223
2242
  /**
2224
2243
  * Sets the font size of the element component.
2225
2244
  * @param value - The font size.
@@ -2346,6 +2365,7 @@ class ElementComponentElement extends ComponentElement {
2346
2365
  'asset',
2347
2366
  'auto-width',
2348
2367
  'color',
2368
+ 'enable-markup',
2349
2369
  'font-size',
2350
2370
  'line-height',
2351
2371
  'pivot',
@@ -2370,6 +2390,9 @@ class ElementComponentElement extends ComponentElement {
2370
2390
  case 'color':
2371
2391
  this.color = parseColor(newValue);
2372
2392
  break;
2393
+ case 'enable-markup':
2394
+ this.enableMarkup = this.hasAttribute(name);
2395
+ break;
2373
2396
  case 'font-size':
2374
2397
  this.fontSize = Number(newValue);
2375
2398
  break;
@@ -4259,11 +4282,13 @@ class SplatComponentElement extends ComponentElement {
4259
4282
  super('gsplat');
4260
4283
  this._asset = '';
4261
4284
  this._castShadows = false;
4285
+ this._unified = false;
4262
4286
  }
4263
4287
  getInitialComponentData() {
4264
4288
  return {
4265
4289
  asset: AssetElement.get(this._asset),
4266
- castShadows: this._castShadows
4290
+ castShadows: this._castShadows,
4291
+ unified: this._unified
4267
4292
  };
4268
4293
  }
4269
4294
  /**
@@ -4308,11 +4333,34 @@ class SplatComponentElement extends ComponentElement {
4308
4333
  get castShadows() {
4309
4334
  return this._castShadows;
4310
4335
  }
4336
+ /**
4337
+ * Sets whether the splat supports global sorting and LOD streaming. This property can only be
4338
+ * changed when the component is disabled.
4339
+ * @param value - Whether the splat supports global sorting and LOD streaming.
4340
+ */
4341
+ set unified(value) {
4342
+ if (this.component && this.component.enabled) {
4343
+ console.warn('The "unified" property can only be changed when the component is disabled.');
4344
+ return;
4345
+ }
4346
+ this._unified = value;
4347
+ if (this.component) {
4348
+ this.component.unified = value;
4349
+ }
4350
+ }
4351
+ /**
4352
+ * Gets whether the splat supports global sorting and LOD streaming.
4353
+ * @returns Whether the splat supports global sorting and LOD streaming.
4354
+ */
4355
+ get unified() {
4356
+ return this._unified;
4357
+ }
4311
4358
  static get observedAttributes() {
4312
4359
  return [
4313
4360
  ...super.observedAttributes,
4314
4361
  'asset',
4315
- 'cast-shadows'
4362
+ 'cast-shadows',
4363
+ 'unified'
4316
4364
  ];
4317
4365
  }
4318
4366
  attributeChangedCallback(name, _oldValue, newValue) {
@@ -4324,6 +4372,9 @@ class SplatComponentElement extends ComponentElement {
4324
4372
  case 'cast-shadows':
4325
4373
  this.castShadows = this.hasAttribute('cast-shadows');
4326
4374
  break;
4375
+ case 'unified':
4376
+ this.unified = this.hasAttribute('unified');
4377
+ break;
4327
4378
  }
4328
4379
  }
4329
4380
  }