modern-canvas 0.9.1 → 0.9.3

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,12 @@ 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
+ }
876
+ set json(val) {
877
+ this.setProperties(val);
878
+ }
873
879
  _nextTick() {
874
880
  return nextTick();
875
881
  }
@@ -9695,17 +9701,7 @@ class BaseElement2DText extends CoreObject {
9695
9701
  constructor(parent) {
9696
9702
  super();
9697
9703
  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
- });
9704
+ this.base.setPropertyAccessor(this);
9709
9705
  }
9710
9706
  base = new Text();
9711
9707
  measureResult;
@@ -9731,17 +9727,8 @@ class BaseElement2DText extends CoreObject {
9731
9727
  break;
9732
9728
  }
9733
9729
  }
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
9730
  _updateTextureMap() {
9744
- this._update();
9731
+ this.base.update();
9745
9732
  this._textureMap.clear();
9746
9733
  const pGlyphBoxs = [];
9747
9734
  this.base.paragraphs.forEach((p, pIndex) => {
@@ -9797,12 +9784,6 @@ class BaseElement2DText extends CoreObject {
9797
9784
  this.content = normalizeTextContent(content);
9798
9785
  }
9799
9786
  measure() {
9800
- this.base.style = {
9801
- justifyContent: "center",
9802
- alignItems: "center",
9803
- textAlign: "center",
9804
- ...this.parent.style.toJSON()
9805
- };
9806
9787
  return this.base.measure();
9807
9788
  }
9808
9789
  updateMeasure() {
@@ -9825,7 +9806,7 @@ class BaseElement2DText extends CoreObject {
9825
9806
  }
9826
9807
  draw() {
9827
9808
  const ctx = this.parent.context;
9828
- this._update();
9809
+ this.base.update();
9829
9810
  this.base.pathSets.forEach((pathSet) => {
9830
9811
  pathSet.paths.forEach((path) => {
9831
9812
  const meta = path.getMeta();
@@ -9896,22 +9877,25 @@ __decorateClass$m([
9896
9877
  property({ fallback: true })
9897
9878
  ], BaseElement2DText.prototype, "enabled");
9898
9879
  __decorateClass$m([
9899
- property({ alias: "base.content", fallback: () => [] })
9880
+ property({ fallback: () => [] })
9900
9881
  ], BaseElement2DText.prototype, "content");
9901
9882
  __decorateClass$m([
9902
- property({ alias: "base.effects" })
9883
+ property({ alias: "parent.style.json" })
9884
+ ], BaseElement2DText.prototype, "style");
9885
+ __decorateClass$m([
9886
+ property()
9903
9887
  ], BaseElement2DText.prototype, "effects");
9904
9888
  __decorateClass$m([
9905
- property({ alias: "base.fill" })
9889
+ property()
9906
9890
  ], BaseElement2DText.prototype, "fill");
9907
9891
  __decorateClass$m([
9908
- property({ alias: "base.outline" })
9892
+ property()
9909
9893
  ], BaseElement2DText.prototype, "outline");
9910
9894
  __decorateClass$m([
9911
- property({ internal: true, alias: "base.measureDom" })
9895
+ property({ alias: "base.measureDom" })
9912
9896
  ], BaseElement2DText.prototype, "measureDom");
9913
9897
  __decorateClass$m([
9914
- property({ internal: true, alias: "base.fonts" })
9898
+ property({ alias: "base.fonts" })
9915
9899
  ], BaseElement2DText.prototype, "fonts");
9916
9900
 
9917
9901
  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.3",
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
  },