@playcanvas/web-components 0.2.12 → 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.
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;