@visactor/vrender-core 1.1.11 → 1.1.12

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.
Files changed (48) hide show
  1. package/cjs/canvas/conical-gradient.js +1 -1
  2. package/cjs/canvas/constants.js +1 -1
  3. package/cjs/canvas/empty-context.js +1 -1
  4. package/cjs/canvas/index.js +1 -1
  5. package/cjs/canvas/util.js +1 -1
  6. package/cjs/common/bezier-utils.js +2 -1
  7. package/cjs/common/contribution-store-state.js +1 -2
  8. package/cjs/common/generator.d.ts +0 -1
  9. package/cjs/common/generator.js +13 -2
  10. package/cjs/common/generator.js.map +1 -1
  11. package/cjs/common/path-svg.js +2 -1
  12. package/cjs/common/render-command-list.js +1 -2
  13. package/cjs/common/seg-context.js +1 -1
  14. package/cjs/common/simplify.js +1 -1
  15. package/cjs/common/sort.js +1 -1
  16. package/cjs/common/split-path.js +1 -1
  17. package/cjs/common/text.js +1 -1
  18. package/cjs/graphic/graphic.js +1 -0
  19. package/cjs/graphic/graphic.js.map +1 -1
  20. package/cjs/graphic/text.js +17 -7
  21. package/cjs/graphic/text.js.map +1 -1
  22. package/cjs/graphic/wrap-text.js +4 -2
  23. package/cjs/graphic/wrap-text.js.map +1 -1
  24. package/dist/index.es.js +20 -12
  25. package/es/canvas/conical-gradient.js +1 -1
  26. package/es/canvas/constants.js +1 -1
  27. package/es/canvas/empty-context.js +1 -1
  28. package/es/canvas/index.js +1 -1
  29. package/es/canvas/util.js +1 -1
  30. package/es/common/bezier-utils.js +2 -1
  31. package/es/common/contribution-store-state.js +1 -2
  32. package/es/common/generator.d.ts +0 -1
  33. package/es/common/generator.js +12 -3
  34. package/es/common/generator.js.map +1 -1
  35. package/es/common/path-svg.js +2 -1
  36. package/es/common/render-command-list.js +1 -2
  37. package/es/common/seg-context.js +1 -1
  38. package/es/common/simplify.js +1 -1
  39. package/es/common/sort.js +1 -1
  40. package/es/common/split-path.js +1 -1
  41. package/es/common/text.js +1 -1
  42. package/es/graphic/graphic.js +1 -0
  43. package/es/graphic/graphic.js.map +1 -1
  44. package/es/graphic/text.js +17 -7
  45. package/es/graphic/text.js.map +1 -1
  46. package/es/graphic/wrap-text.js +4 -2
  47. package/es/graphic/wrap-text.js.map +1 -1
  48. package/package.json +3 -3
@@ -1,8 +1,17 @@
1
+ const GENERATOR_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/generator-state");
2
+
3
+ function getGeneratorState() {
4
+ const scope = globalThis;
5
+ return scope[GENERATOR_STATE_SYMBOL] || (scope[GENERATOR_STATE_SYMBOL] = {
6
+ autoIncrementId: 0
7
+ });
8
+ }
9
+
10
+ const generatorState = getGeneratorState();
11
+
1
12
  export class Generator {
2
13
  static GenAutoIncrementId() {
3
- return Generator.auto_increment_id++;
14
+ return generatorState.autoIncrementId++;
4
15
  }
5
16
  }
6
-
7
- Generator.auto_increment_id = 0;
8
17
  //# sourceMappingURL=generator.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/generator.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAS;IAGpB,MAAM,CAAC,kBAAkB;QACvB,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;IACvC,CAAC;;AAJc,2BAAiB,GAAW,CAAC,CAAC","file":"generator.js","sourcesContent":["export class Generator {\n private static auto_increment_id: number = 0;\n\n static GenAutoIncrementId(): number {\n return Generator.auto_increment_id++;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/common/generator.ts"],"names":[],"mappings":"AAIA,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAEpF,SAAS,iBAAiB;IACxB,MAAM,KAAK,GAAG,UAEb,CAAC;IACF,OAAO,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAAG,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC;AACnG,CAAC;AAID,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;AAE3C,MAAM,OAAO,SAAS;IACpB,MAAM,CAAC,kBAAkB;QACvB,OAAO,cAAc,CAAC,eAAe,EAAE,CAAC;IAC1C,CAAC;CACF","file":"generator.js","sourcesContent":["interface IGeneratorState {\n autoIncrementId: number;\n}\n\nconst GENERATOR_STATE_SYMBOL = Symbol.for('@visactor/vrender-core/generator-state');\n\nfunction getGeneratorState(): IGeneratorState {\n const scope = globalThis as typeof globalThis & {\n [GENERATOR_STATE_SYMBOL]?: IGeneratorState;\n };\n return scope[GENERATOR_STATE_SYMBOL] || (scope[GENERATOR_STATE_SYMBOL] = { autoIncrementId: 0 });\n}\n\n// Application and legacy runtime state are shared across bundles. Keep node ids in the same\n// global scope so a shared Stage cannot receive a Layer with a colliding id from another bundle.\nconst generatorState = getGeneratorState();\n\nexport class Generator {\n static GenAutoIncrementId(): number {\n return generatorState.autoIncrementId++;\n }\n}\n"]}
@@ -54,4 +54,5 @@ export function parseSvgPath(str) {
54
54
  } else result.push(currCommandData);
55
55
  } else result.push(currCommandData);
56
56
  return result;
57
- }
57
+ }
58
+ //# sourceMappingURL=path-svg.js.map
@@ -5,5 +5,4 @@ export function renderCommandList(commandList, context, x = 0, y = 0, sx = 1, sy
5
5
  const command = commandList[i];
6
6
  commandFuncs[command[0]](command, context, x, y, sx, sy, z);
7
7
  }
8
- }
9
- //# sourceMappingURL=render-command-list.js.map
8
+ }
@@ -91,4 +91,4 @@ export class ReflectSegContext extends SegContext {
91
91
  return super.clear();
92
92
  }
93
93
  }
94
- //# sourceMappingURL=seg-context.js.map
94
+ //# sourceMappingURL=seg-context.js.map
@@ -30,4 +30,4 @@ export function flatten_simplify(points, tolerance, highestQuality) {
30
30
  if (points.length <= 10) return points;
31
31
  return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
32
32
  }
33
- //# sourceMappingURL=simplify.js.map
33
+ //# sourceMappingURL=simplify.js.map
package/es/common/sort.js CHANGED
@@ -94,4 +94,4 @@ export function findNextGraphic(graphic, id, defaultZIndex, reverse = !1) {
94
94
  !1)), reverse);
95
95
  return result;
96
96
  }
97
- //# sourceMappingURL=sort.js.map
97
+ //# sourceMappingURL=sort.js.map
@@ -248,4 +248,4 @@ export const splitPath = (path, count) => {
248
248
  }
249
249
  return res;
250
250
  };
251
- //# sourceMappingURL=split-path.js.map
251
+ //# sourceMappingURL=split-path.js.map
package/es/common/text.js CHANGED
@@ -24,4 +24,4 @@ export function textAttributesToStyle(attrs) {
24
24
  attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"),
25
25
  attrs.fill && isString(attrs.fill) && (style.color = attrs.fill), style;
26
26
  }
27
- //# sourceMappingURL=text.js.map
27
+ //# sourceMappingURL=text.js.map
@@ -744,6 +744,7 @@ export class Graphic extends Node {
744
744
  [key]: value
745
745
  }, this.attribute, key, context);
746
746
  if (params) this._setAttributes(params, forceUpdateTag, context); else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context); else {
747
+ this.detachAttributeFromBaseAttributes();
747
748
  const nextAttrs = {
748
749
  [key]: value
749
750
  };