modern-canvas 0.9.1 → 0.9.2

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
@@ -870,6 +870,9 @@ class Input extends Observable {
870
870
  let IID = 0;
871
871
  class CoreObject extends Reactivable {
872
872
  instanceId = ++IID;
873
+ get json() {
874
+ return this.toJSON();
875
+ }
873
876
  _nextTick() {
874
877
  return nextTick();
875
878
  }
@@ -9695,17 +9698,7 @@ class BaseElement2DText extends CoreObject {
9695
9698
  constructor(parent) {
9696
9699
  super();
9697
9700
  this.parent = parent;
9698
- this.base.on("updateProperty", (...args) => {
9699
- switch (args[0]) {
9700
- case "content":
9701
- case "effects":
9702
- case "fill":
9703
- case "outline":
9704
- this.setProperty(args[0], args[1]);
9705
- break;
9706
- }
9707
- this._updateProperty(...args);
9708
- });
9701
+ this.base.setPropertyAccessor(this);
9709
9702
  }
9710
9703
  base = new Text();
9711
9704
  measureResult;
@@ -9731,17 +9724,8 @@ class BaseElement2DText extends CoreObject {
9731
9724
  break;
9732
9725
  }
9733
9726
  }
9734
- _update() {
9735
- this.base.style = {
9736
- justifyContent: "center",
9737
- alignItems: "center",
9738
- textAlign: "center",
9739
- ...this.parent.style.toJSON()
9740
- };
9741
- this.base.update();
9742
- }
9743
9727
  _updateTextureMap() {
9744
- this._update();
9728
+ this.base.update();
9745
9729
  this._textureMap.clear();
9746
9730
  const pGlyphBoxs = [];
9747
9731
  this.base.paragraphs.forEach((p, pIndex) => {
@@ -9797,12 +9781,6 @@ class BaseElement2DText extends CoreObject {
9797
9781
  this.content = normalizeTextContent(content);
9798
9782
  }
9799
9783
  measure() {
9800
- this.base.style = {
9801
- justifyContent: "center",
9802
- alignItems: "center",
9803
- textAlign: "center",
9804
- ...this.parent.style.toJSON()
9805
- };
9806
9784
  return this.base.measure();
9807
9785
  }
9808
9786
  updateMeasure() {
@@ -9825,7 +9803,7 @@ class BaseElement2DText extends CoreObject {
9825
9803
  }
9826
9804
  draw() {
9827
9805
  const ctx = this.parent.context;
9828
- this._update();
9806
+ this.base.update();
9829
9807
  this.base.pathSets.forEach((pathSet) => {
9830
9808
  pathSet.paths.forEach((path) => {
9831
9809
  const meta = path.getMeta();
@@ -9896,22 +9874,25 @@ __decorateClass$m([
9896
9874
  property({ fallback: true })
9897
9875
  ], BaseElement2DText.prototype, "enabled");
9898
9876
  __decorateClass$m([
9899
- property({ alias: "base.content", fallback: () => [] })
9877
+ property({ fallback: () => [] })
9900
9878
  ], BaseElement2DText.prototype, "content");
9901
9879
  __decorateClass$m([
9902
- property({ alias: "base.effects" })
9880
+ property({ alias: "parent.style.json" })
9881
+ ], BaseElement2DText.prototype, "style");
9882
+ __decorateClass$m([
9883
+ property()
9903
9884
  ], BaseElement2DText.prototype, "effects");
9904
9885
  __decorateClass$m([
9905
- property({ alias: "base.fill" })
9886
+ property()
9906
9887
  ], BaseElement2DText.prototype, "fill");
9907
9888
  __decorateClass$m([
9908
- property({ alias: "base.outline" })
9889
+ property()
9909
9890
  ], BaseElement2DText.prototype, "outline");
9910
9891
  __decorateClass$m([
9911
- property({ internal: true, alias: "base.measureDom" })
9892
+ property({ alias: "base.measureDom" })
9912
9893
  ], BaseElement2DText.prototype, "measureDom");
9913
9894
  __decorateClass$m([
9914
- property({ internal: true, alias: "base.fonts" })
9895
+ property({ alias: "base.fonts" })
9915
9896
  ], BaseElement2DText.prototype, "fonts");
9916
9897
 
9917
9898
  var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.9.1",
4
+ "version": "0.9.2",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",
@@ -74,14 +74,14 @@
74
74
  "colord": "^2.9.3",
75
75
  "earcut": "^3.0.2",
76
76
  "modern-font": "^0.4.1",
77
- "modern-idoc": "^0.9.3",
77
+ "modern-idoc": "^0.9.11",
78
78
  "modern-path2d": "^1.4.9",
79
- "modern-text": "^1.8.2"
79
+ "modern-text": "^1.8.3"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@antfu/eslint-config": "^5.3.0",
83
83
  "@types/earcut": "^3.0.0",
84
- "@types/node": "^24.5.1",
84
+ "@types/node": "^24.5.2",
85
85
  "bumpp": "^10.2.3",
86
86
  "conventional-changelog-cli": "^5.0.0",
87
87
  "eslint": "^9.35.0",
@@ -91,7 +91,7 @@
91
91
  "simple-git-hooks": "^2.13.1",
92
92
  "typescript": "^5.9.2",
93
93
  "unbuild": "^3.6.1",
94
- "vite": "^7.1.5",
94
+ "vite": "^7.1.6",
95
95
  "vitest": "^3.2.4",
96
96
  "yoga-layout": "^3.2.1"
97
97
  },