modern-canvas 0.4.28 → 0.4.29

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/dist/index.mjs CHANGED
@@ -10443,13 +10443,18 @@ let Text2D = class extends TextureRect2D {
10443
10443
  measureDom;
10444
10444
  fonts;
10445
10445
  texture = new CanvasTexture();
10446
- _baseText = new Text();
10446
+ base = new Text();
10447
10447
  measureResult;
10448
10448
  _subTextsCount = 0;
10449
10449
  constructor(properties, children = []) {
10450
10450
  super();
10451
10451
  this.setProperties(properties);
10452
10452
  this.append(children);
10453
+ if (properties?.plugins) {
10454
+ properties.plugins.forEach((plugin) => {
10455
+ this.base.use(plugin);
10456
+ });
10457
+ }
10453
10458
  }
10454
10459
  _updateProperty(key, value, oldValue, declaration) {
10455
10460
  super._updateProperty(key, value, oldValue, declaration);
@@ -10469,13 +10474,14 @@ let Text2D = class extends TextureRect2D {
10469
10474
  });
10470
10475
  }
10471
10476
  }
10472
- _updateText() {
10473
- this._baseText.style = this.style.toJSON();
10474
- this._baseText.content = this.content ?? "";
10475
- this._baseText.effects = this.effects;
10476
- this._baseText.fonts = this.fonts;
10477
- this._baseText.measureDom = this.measureDom;
10478
- this._baseText.requestUpdate();
10477
+ _updateBase() {
10478
+ this.base.style = this.style.toJSON();
10479
+ this.base.content = this.content ?? "";
10480
+ this.base.effects = this.effects;
10481
+ this.base.fonts = this.fonts;
10482
+ this.base.measureDom = this.measureDom;
10483
+ this.emit("updateBase", this.base);
10484
+ this.base.requestUpdate();
10479
10485
  }
10480
10486
  _updateStyleProperty(key, value, oldValue) {
10481
10487
  switch (key) {
@@ -10527,8 +10533,8 @@ let Text2D = class extends TextureRect2D {
10527
10533
  }
10528
10534
  }
10529
10535
  measure() {
10530
- this._updateText();
10531
- return this._baseText.measure();
10536
+ this._updateBase();
10537
+ return this.base.measure();
10532
10538
  }
10533
10539
  updateMeasure() {
10534
10540
  this.measureResult = this.measure();
@@ -10579,7 +10585,7 @@ let Text2D = class extends TextureRect2D {
10579
10585
  if (onText2DRender) {
10580
10586
  onText2DRender();
10581
10587
  } else {
10582
- this._baseText.render({
10588
+ this.base.render({
10583
10589
  pixelRatio: this.texture.pixelRatio,
10584
10590
  view: this.texture.source
10585
10591
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.4.28",
4
+ "version": "0.4.29",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",
@@ -72,13 +72,13 @@
72
72
  "modern-font": "^0.4.1",
73
73
  "modern-idoc": "^0.2.13",
74
74
  "modern-path2d": "^1.2.18",
75
- "modern-text": "^1.3.2",
75
+ "modern-text": "^1.3.4",
76
76
  "yoga-layout": "^3.2.1"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@antfu/eslint-config": "^4.11.0",
80
80
  "@types/earcut": "^3.0.0",
81
- "@types/node": "^22.13.14",
81
+ "@types/node": "^22.13.17",
82
82
  "bumpp": "^10.1.0",
83
83
  "conventional-changelog-cli": "^5.0.0",
84
84
  "eslint": "^9.23.0",
@@ -88,8 +88,8 @@
88
88
  "simple-git-hooks": "^2.12.1",
89
89
  "typescript": "^5.8.2",
90
90
  "unbuild": "^3.5.0",
91
- "vite": "^6.2.3",
92
- "vitest": "^3.0.9"
91
+ "vite": "^6.2.4",
92
+ "vitest": "^3.1.1"
93
93
  },
94
94
  "simple-git-hooks": {
95
95
  "pre-commit": "pnpm lint-staged"