@visactor/vrender 1.1.0-alpha.22 → 1.1.0-alpha.24

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.js CHANGED
@@ -169,7 +169,7 @@
169
169
  }
170
170
  }
171
171
 
172
- var __awaiter$a = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
172
+ var __awaiter$8 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
173
173
  return new (P || (P = Promise))(function (resolve, reject) {
174
174
  function fulfilled(value) {
175
175
  try {
@@ -338,7 +338,7 @@
338
338
  return this._env || this.setEnv("browser"), this.envContribution.loadBlob(url);
339
339
  }
340
340
  loadFont(name, source, descriptors) {
341
- return __awaiter$a(this, void 0, void 0, function* () {
341
+ return __awaiter$8(this, void 0, void 0, function* () {
342
342
  return this._env || this.setEnv("browser"), this.envContribution.loadFont(name, source, descriptors);
343
343
  });
344
344
  }
@@ -2668,7 +2668,7 @@
2668
2668
  };
2669
2669
  const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
2670
2670
 
2671
- var __awaiter$9 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
2671
+ var __awaiter$7 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
2672
2672
  return new (P || (P = Promise))(function (resolve, reject) {
2673
2673
  function fulfilled(value) {
2674
2674
  try {
@@ -2736,7 +2736,7 @@
2736
2736
  }
2737
2737
  }
2738
2738
  forEachChildrenAsync(cb, reverse = !1) {
2739
- return __awaiter$9(this, void 0, void 0, function* () {
2739
+ return __awaiter$7(this, void 0, void 0, function* () {
2740
2740
  if (reverse) {
2741
2741
  let child = this._lastChild,
2742
2742
  i = 0;
@@ -5202,6 +5202,7 @@
5202
5202
  cornerRadius: 0,
5203
5203
  padRadius: 0,
5204
5204
  padAngle: 0,
5205
+ clipRange: 1,
5205
5206
  cap: !1,
5206
5207
  forceShowCap: !1
5207
5208
  });
@@ -6292,7 +6293,7 @@
6292
6293
  return str.startsWith("<");
6293
6294
  }
6294
6295
 
6295
- var __awaiter$8 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
6296
+ var __awaiter$6 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
6296
6297
  return new (P || (P = Promise))(function (resolve, reject) {
6297
6298
  function fulfilled(value) {
6298
6299
  try {
@@ -6321,7 +6322,7 @@
6321
6322
  group.incrementalAppendChild(graphic);
6322
6323
  }
6323
6324
  function waitForAllSubLayers(stage) {
6324
- return __awaiter$8(this, void 0, void 0, function* () {
6325
+ return __awaiter$6(this, void 0, void 0, function* () {
6325
6326
  const promiseList = [],
6326
6327
  layers = stage.getChildren();
6327
6328
  yield new Promise(resolve => {
@@ -8809,6 +8810,7 @@
8809
8810
  FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
8810
8811
  point = new Point(),
8811
8812
  EMPTY_STATE_NAMES = [],
8813
+ deprecatedLocalStateFallbackWarningStateNames = new Set(),
8812
8814
  BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
8813
8815
  function isPlainObjectValue(value) {
8814
8816
  return "object" == typeof value && null != value && !Array.isArray(value);
@@ -8983,6 +8985,12 @@
8983
8985
  var _a, _b;
8984
8986
  return this.localStateDefinitionsSource !== this.states && (this.localStateDefinitionsSource = this.states, this.localFallbackVersion = (null !== (_a = this.localFallbackVersion) && void 0 !== _a ? _a : 0) + 1), null !== (_b = this.localFallbackVersion) && void 0 !== _b ? _b : 0;
8985
8987
  }
8988
+ warnDeprecatedLocalStatesFallback(stateNames) {
8989
+ for (let index = 0; index < stateNames.length; index++) {
8990
+ const stateName = stateNames[index];
8991
+ deprecatedLocalStateFallbackWarningStateNames.has(stateName) || (deprecatedLocalStateFallbackWarningStateNames.add(stateName), console.warn(`[VRender] graphic.states fallback for missing shared state definition "${stateName}" is deprecated. Move the state definition to sharedStateDefinitions or use stateProxy for dynamic per-graphic styles.`));
8992
+ }
8993
+ }
8986
8994
  resolveEffectiveCompiledDefinitions() {
8987
8995
  this.syncSharedStateScopeBindingFromTree(!1);
8988
8996
  const boundScope = this.boundSharedStateScope;
@@ -9017,6 +9025,7 @@
9017
9025
  stateProxyModeKey: sharedStateProxyModeKey,
9018
9026
  stateProxyEligibility: sharedStateProxyEligibility
9019
9027
  };
9028
+ this.warnDeprecatedLocalStatesFallback(missingStateNames);
9020
9029
  const localStatesVersion = this.getLocalStatesVersion(),
9021
9030
  stateProxyModeKey = this.stateProxy ? `missing:${missingStateNames.sort().join("|")}` : "none",
9022
9031
  cacheKey = `shared:${boundScope.revision}:fallback:${localStatesVersion}:${stateProxyModeKey}`;
@@ -9907,8 +9916,7 @@
9907
9916
  invalidateResolver() {
9908
9917
  var _a, _b;
9909
9918
  if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
9910
- this.syncStateResolveContext();
9911
- this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1, this.stateEngine.invalidateResolverCache();
9919
+ this.syncStateResolveContext(), this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1, this.stateEngine.invalidateResolverCache();
9912
9920
  const transition = this.stateEngine.applyStates(this.currentStates),
9913
9921
  resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
9914
9922
  this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
@@ -12831,7 +12839,7 @@
12831
12839
  return new Area(attributes);
12832
12840
  }
12833
12841
 
12834
- const ARC_UPDATE_TAG_KEY = ["innerRadius", "outerRadius", "startAngle", "endAngle", "cornerRadius", "padAngle", "padRadius", "cap", ...GRAPHIC_UPDATE_TAG_KEY];
12842
+ const ARC_UPDATE_TAG_KEY = ["innerRadius", "outerRadius", "startAngle", "endAngle", "cornerRadius", "padAngle", "padRadius", "clipRange", "cap", ...GRAPHIC_UPDATE_TAG_KEY];
12835
12843
  class Arc extends Graphic {
12836
12844
  constructor(params) {
12837
12845
  super(params), this.type = "arc", this.numberType = ARC_NUMBER_TYPE;
@@ -12875,11 +12883,12 @@
12875
12883
  endAngle = arcTheme.endAngle
12876
12884
  } = this.attribute;
12877
12885
  const {
12878
- cap = arcTheme.cap
12886
+ cap = arcTheme.cap,
12887
+ clipRange = arcTheme.clipRange
12879
12888
  } = this.attribute,
12880
- sign = endAngle - startAngle >= 0 ? 1 : -1,
12881
- deltaAngle = endAngle - startAngle;
12882
- if (startAngle = clampAngleByRadian(startAngle), endAngle = startAngle + deltaAngle, cap && abs(deltaAngle) < pi2 - epsilon) {
12889
+ sign = endAngle - startAngle >= 0 ? 1 : -1;
12890
+ let deltaAngle = endAngle - startAngle;
12891
+ if (deltaAngle *= Math.max(0, Math.min(clipRange, 1)), startAngle = clampAngleByRadian(startAngle), endAngle = startAngle + deltaAngle, cap && abs(deltaAngle) > epsilon && abs(deltaAngle) < pi2 - epsilon) {
12883
12892
  let startCap = 1,
12884
12893
  endCap = 1;
12885
12894
  cap.length && (startCap = Number(cap[0]), endCap = Number(cap[1]));
@@ -14304,7 +14313,7 @@
14304
14313
  }
14305
14314
  }
14306
14315
 
14307
- var __awaiter$7 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
14316
+ var __awaiter$5 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
14308
14317
  return new (P || (P = Promise))(function (resolve, reject) {
14309
14318
  function fulfilled(value) {
14310
14319
  try {
@@ -14374,7 +14383,7 @@
14374
14383
  } else graphic.forEachChildren(cb, reverse);
14375
14384
  }
14376
14385
  function foreachAsync(graphic, defaultZIndex, cb, reverse = !1) {
14377
- return __awaiter$7(this, void 0, void 0, function* () {
14386
+ return __awaiter$5(this, void 0, void 0, function* () {
14378
14387
  yield graphic.forEachChildrenAsync(cb, reverse);
14379
14388
  });
14380
14389
  }
@@ -15261,7 +15270,7 @@
15261
15270
  return isBrowserEnv() ? "browser" : "node";
15262
15271
  }
15263
15272
 
15264
- var __awaiter$6 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
15273
+ var __awaiter$4 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
15265
15274
  return new (P || (P = Promise))(function (resolve, reject) {
15266
15275
  function fulfilled(value) {
15267
15276
  try {
@@ -15458,7 +15467,7 @@
15458
15467
  }
15459
15468
  runJob(job) {
15460
15469
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
15461
- return __awaiter$6(this, void 0, void 0, function* () {
15470
+ return __awaiter$4(this, void 0, void 0, function* () {
15462
15471
  if ("cancelled" === job.status) return;
15463
15472
  if (yield this.waitForNextFrame(), "cancelled" === job.status) return;
15464
15473
  job.status = "running", null === (_a = this.perfMonitor) || void 0 === _a || _a.recordEvent("deferred-job-start", {
@@ -17943,7 +17952,7 @@
17943
17952
  }
17944
17953
 
17945
17954
  var STATUS,
17946
- __awaiter$5 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
17955
+ __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
17947
17956
  return new (P || (P = Promise))(function (resolve, reject) {
17948
17957
  function fulfilled(value) {
17949
17958
  try {
@@ -17978,7 +17987,7 @@
17978
17987
  }, this.defaultRenderMap.set(this.lineRender.numberType, this.lineRender), this.defaultRenderMap.set(this.areaRender.numberType, this.areaRender);
17979
17988
  }
17980
17989
  draw(renderService, drawContext) {
17981
- return __awaiter$5(this, void 0, void 0, function* () {
17990
+ return __awaiter$3(this, void 0, void 0, function* () {
17982
17991
  if (this.checkingForDrawPromise) return;
17983
17992
  this.lastRenderService = renderService, this.lastDrawContext = drawContext, this.checkingForDrawPromise = this.checkForDraw(drawContext);
17984
17993
  const skipDraw = yield this.checkingForDrawPromise;
@@ -17999,15 +18008,15 @@
17999
18008
  });
18000
18009
  }
18001
18010
  _increaseRender(group, drawContext) {
18002
- return __awaiter$5(this, void 0, void 0, function* () {
18011
+ return __awaiter$3(this, void 0, void 0, function* () {
18003
18012
  this.rendering = !0, yield this._renderIncrementalGroup(group, drawContext);
18004
18013
  });
18005
18014
  }
18006
18015
  _renderIncrementalGroup(group, drawContext) {
18007
- return __awaiter$5(this, void 0, void 0, function* () {
18016
+ return __awaiter$3(this, void 0, void 0, function* () {
18008
18017
  this.count = group.count, yield new Promise(resolve => {
18009
18018
  this.renderItem(group, drawContext, {
18010
- drawingCb: () => __awaiter$5(this, void 0, void 0, function* () {
18019
+ drawingCb: () => __awaiter$3(this, void 0, void 0, function* () {
18011
18020
  if (2 !== group.count) yield foreachAsync(group, DefaultAttribute.zIndex, (item, i) => {
18012
18021
  if (this.status === STATUS.STOP) return !0;
18013
18022
  if (item.isContainer) return !1;
@@ -18028,7 +18037,7 @@
18028
18037
  });
18029
18038
  }
18030
18039
  waitToNextFrame() {
18031
- return __awaiter$5(this, void 0, void 0, function* () {
18040
+ return __awaiter$3(this, void 0, void 0, function* () {
18032
18041
  return new Promise(resolve => {
18033
18042
  this.global.getRequestAnimationFrame()(() => {
18034
18043
  resolve(!1);
@@ -18037,13 +18046,13 @@
18037
18046
  });
18038
18047
  }
18039
18048
  checkForDraw(drawContext) {
18040
- return __awaiter$5(this, void 0, void 0, function* () {
18049
+ return __awaiter$3(this, void 0, void 0, function* () {
18041
18050
  let skip = this.rendering;
18042
18051
  return drawContext.restartIncremental && (skip = !1, yield this.forceStop(), this.resetToInit()), skip;
18043
18052
  });
18044
18053
  }
18045
18054
  forceStop() {
18046
- return __awaiter$5(this, void 0, void 0, function* () {
18055
+ return __awaiter$3(this, void 0, void 0, function* () {
18047
18056
  this.rendering && (this.status = STATUS.STOP, yield new Promise(resolve => {
18048
18057
  this.hooks.completeDraw.tap("stopCb", () => {
18049
18058
  this.status = STATUS.NORMAL, this.hooks.completeDraw.taps = this.hooks.completeDraw.taps.filter(item => "stopCb" !== item.name), resolve(!1);
@@ -18055,11 +18064,11 @@
18055
18064
  this.currFrameStartAt = 0, this.currentIdx = 0;
18056
18065
  }
18057
18066
  renderGroup(group, drawContext) {
18058
- return __awaiter$5(this, void 0, void 0, function* () {
18067
+ return __awaiter$3(this, void 0, void 0, function* () {
18059
18068
  if (!drawContext.break && !1 !== group.attribute.visibleAll) return group.incremental && drawContext.startAtId === group._uid ? (yield this._increaseRender(group, drawContext), void (drawContext.break = !0)) : void (yield new Promise(resolve => {
18060
18069
  this.renderItem(group, drawContext, {
18061
- drawingCb: () => __awaiter$5(this, void 0, void 0, function* () {
18062
- yield foreachAsync(group, DefaultAttribute.zIndex, item => __awaiter$5(this, void 0, void 0, function* () {
18070
+ drawingCb: () => __awaiter$3(this, void 0, void 0, function* () {
18071
+ yield foreachAsync(group, DefaultAttribute.zIndex, item => __awaiter$3(this, void 0, void 0, function* () {
18063
18072
  drawContext.break || item.isContainer && (yield this.renderGroup(item, drawContext));
18064
18073
  })), resolve(!1);
18065
18074
  })
@@ -19937,7 +19946,7 @@
19937
19946
  }
19938
19947
  }
19939
19948
 
19940
- var __awaiter$4 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
19949
+ var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
19941
19950
  return new (P || (P = Promise))(function (resolve, reject) {
19942
19951
  function fulfilled(value) {
19943
19952
  try {
@@ -20031,7 +20040,7 @@
20031
20040
  };
20032
20041
  }
20033
20042
  loadFont(font, source, descriptors) {
20034
- return __awaiter$4(this, void 0, void 0, function* () {
20043
+ return __awaiter$2(this, void 0, void 0, function* () {
20035
20044
  return {
20036
20045
  loadState: "fail"
20037
20046
  };
@@ -21196,7 +21205,7 @@
21196
21205
  };
21197
21206
  }
21198
21207
 
21199
- var __rest$g = undefined && undefined.__rest || function (s, e) {
21208
+ var __rest$f = undefined && undefined.__rest || function (s, e) {
21200
21209
  var t = {};
21201
21210
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
21202
21211
  if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
@@ -21294,7 +21303,7 @@
21294
21303
  {
21295
21304
  textConfig = []
21296
21305
  } = _a,
21297
- rest = __rest$g(_a, ["textConfig"]);
21306
+ rest = __rest$f(_a, ["textConfig"]);
21298
21307
  if ("Backspace" === ev.type && !textConfig.length) return;
21299
21308
  let str = ev.data;
21300
21309
  this.isComposing || "Backspace" === ev.type || str || (str = "\n"), this.selectionStartCursorIdx > this.cursorIndex && ([this.cursorIndex, this.selectionStartCursorIdx] = [this.selectionStartCursorIdx, this.cursorIndex]);
@@ -22316,77 +22325,82 @@
22316
22325
  return instance;
22317
22326
  }
22318
22327
 
22319
- let loadArcModule = !1;
22328
+ function isBindingContextLoaded(loadedContexts, context) {
22329
+ const key = "object" == typeof context && null !== context || "function" == typeof context ? context : loadedContexts;
22330
+ return !!loadedContexts.has(key) || (loadedContexts.add(key), !1);
22331
+ }
22332
+
22333
+ const loadedArcModuleContexts = new WeakSet();
22320
22334
  function bindArcRenderModule({
22321
22335
  bind: bind
22322
22336
  }) {
22323
- loadArcModule || (loadArcModule = !0, bind(DefaultCanvasArcRender).toSelf().inSingletonScope(), bind(ArcRender).to(DefaultCanvasArcRender).inSingletonScope(), bind(GraphicRender).toService(ArcRender), bind(ArcRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ArcRenderContribution));
22337
+ isBindingContextLoaded(loadedArcModuleContexts, bind) || (bind(DefaultCanvasArcRender).toSelf().inSingletonScope(), bind(ArcRender).to(DefaultCanvasArcRender).inSingletonScope(), bind(GraphicRender).toService(ArcRender), bind(ArcRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ArcRenderContribution));
22324
22338
  }
22325
22339
  const arcModule = bindArcRenderModule;
22326
22340
 
22327
- let loadRectModule = !1;
22341
+ const loadedRectModuleContexts = new WeakSet();
22328
22342
  function bindRectRenderModule({
22329
22343
  bind: bind
22330
22344
  }) {
22331
- loadRectModule || (loadRectModule = !0, bind(DefaultCanvasRectRender).toDynamicValue(({
22345
+ isBindingContextLoaded(loadedRectModuleContexts, bind) || (bind(DefaultCanvasRectRender).toDynamicValue(({
22332
22346
  container: container
22333
22347
  }) => new DefaultCanvasRectRender(createContributionProvider$1(RectRenderContribution, container))).inSingletonScope(), bind(RectRender).toService(DefaultCanvasRectRender), bind(GraphicRender).toService(RectRender), bind(SplitRectAfterRenderContribution).toSelf(), bind(SplitRectBeforeRenderContribution).toSelf(), bind(RectRenderContribution).toService(SplitRectAfterRenderContribution), bind(RectRenderContribution).toService(SplitRectBeforeRenderContribution), bind(RectRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, RectRenderContribution));
22334
22348
  }
22335
22349
  const rectModule = bindRectRenderModule;
22336
22350
 
22337
- let loadLineModule = !1;
22351
+ const loadedLineModuleContexts = new WeakSet();
22338
22352
  function bindLineRenderModule({
22339
22353
  bind: bind
22340
22354
  }) {
22341
- loadLineModule || (loadLineModule = !0, bind(DefaultCanvasLineRender).toSelf().inSingletonScope(), bind(DefaultIncrementalCanvasLineRender).toSelf().inSingletonScope(), bind(LineRender).to(DefaultCanvasLineRender).inSingletonScope(), bind(GraphicRender).toService(LineRender));
22355
+ isBindingContextLoaded(loadedLineModuleContexts, bind) || (bind(DefaultCanvasLineRender).toSelf().inSingletonScope(), bind(DefaultIncrementalCanvasLineRender).toSelf().inSingletonScope(), bind(LineRender).to(DefaultCanvasLineRender).inSingletonScope(), bind(GraphicRender).toService(LineRender));
22342
22356
  }
22343
22357
  const lineModule = bindLineRenderModule;
22344
22358
 
22345
- let loadAreaModule = !1;
22359
+ const loadedAreaModuleContexts = new WeakSet();
22346
22360
  function bindAreaRenderModule({
22347
22361
  bind: bind
22348
22362
  }) {
22349
- loadAreaModule || (loadAreaModule = !0, bind(DefaultCanvasAreaRender).toSelf().inSingletonScope(), bind(AreaRender).to(DefaultCanvasAreaRender).inSingletonScope(), bind(GraphicRender).toService(AreaRender), bind(AreaRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, AreaRenderContribution), bind(DefaultIncrementalCanvasAreaRender).toSelf().inSingletonScope());
22363
+ isBindingContextLoaded(loadedAreaModuleContexts, bind) || (bind(DefaultCanvasAreaRender).toSelf().inSingletonScope(), bind(AreaRender).to(DefaultCanvasAreaRender).inSingletonScope(), bind(GraphicRender).toService(AreaRender), bind(AreaRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, AreaRenderContribution), bind(DefaultIncrementalCanvasAreaRender).toSelf().inSingletonScope());
22350
22364
  }
22351
22365
  const areaModule = bindAreaRenderModule;
22352
22366
 
22353
- let loadSymbolModule = !1;
22367
+ const loadedSymbolModuleContexts = new WeakSet();
22354
22368
  function bindSymbolRenderModule({
22355
22369
  bind: bind
22356
22370
  }) {
22357
- loadSymbolModule || (loadSymbolModule = !0, bind(DefaultCanvasSymbolRender).toSelf().inSingletonScope(), bind(SymbolRender).to(DefaultCanvasSymbolRender).inSingletonScope(), bind(GraphicRender).toService(SymbolRender), bind(SymbolRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, SymbolRenderContribution));
22371
+ isBindingContextLoaded(loadedSymbolModuleContexts, bind) || (bind(DefaultCanvasSymbolRender).toSelf().inSingletonScope(), bind(SymbolRender).to(DefaultCanvasSymbolRender).inSingletonScope(), bind(GraphicRender).toService(SymbolRender), bind(SymbolRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, SymbolRenderContribution));
22358
22372
  }
22359
22373
  const symbolModule = bindSymbolRenderModule;
22360
22374
 
22361
- let loadCircleModule = !1;
22375
+ const loadedCircleModuleContexts = new WeakSet();
22362
22376
  function bindCircleRenderModule({
22363
22377
  bind: bind
22364
22378
  }) {
22365
- loadCircleModule || (loadCircleModule = !0, bind(DefaultCanvasCircleRender).toSelf().inSingletonScope(), bind(CircleRender).to(DefaultCanvasCircleRender).inSingletonScope(), bind(GraphicRender).toService(CircleRender), bind(CircleRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, CircleRenderContribution));
22379
+ isBindingContextLoaded(loadedCircleModuleContexts, bind) || (bind(DefaultCanvasCircleRender).toSelf().inSingletonScope(), bind(CircleRender).to(DefaultCanvasCircleRender).inSingletonScope(), bind(GraphicRender).toService(CircleRender), bind(CircleRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, CircleRenderContribution));
22366
22380
  }
22367
22381
  const circleModule = bindCircleRenderModule;
22368
22382
 
22369
- let loadTextModule = !1;
22383
+ const loadedTextModuleContexts = new WeakSet();
22370
22384
  function bindTextRenderModule({
22371
22385
  bind: bind
22372
22386
  }) {
22373
- loadTextModule || (loadTextModule = !0, bind(TextRender).to(DefaultCanvasTextRender).inSingletonScope(), bind(GraphicRender).toService(TextRender), bind(TextRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, TextRenderContribution));
22387
+ isBindingContextLoaded(loadedTextModuleContexts, bind) || (bind(TextRender).to(DefaultCanvasTextRender).inSingletonScope(), bind(GraphicRender).toService(TextRender), bind(TextRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, TextRenderContribution));
22374
22388
  }
22375
22389
  const textModule = bindTextRenderModule;
22376
22390
 
22377
- let loadPathModule = !1;
22391
+ const loadedPathModuleContexts = new WeakSet();
22378
22392
  function bindPathRenderModule({
22379
22393
  bind: bind
22380
22394
  }) {
22381
- loadPathModule || (loadPathModule = !0, bind(DefaultCanvasPathRender).toSelf().inSingletonScope(), bind(PathRender).to(DefaultCanvasPathRender).inSingletonScope(), bind(GraphicRender).toService(PathRender), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PathRenderContribution));
22395
+ isBindingContextLoaded(loadedPathModuleContexts, bind) || (bind(DefaultCanvasPathRender).toSelf().inSingletonScope(), bind(PathRender).to(DefaultCanvasPathRender).inSingletonScope(), bind(GraphicRender).toService(PathRender), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PathRenderContribution));
22382
22396
  }
22383
22397
  const pathModule = bindPathRenderModule;
22384
22398
 
22385
- let loadPolygonModule = !1;
22399
+ const loadedPolygonModuleContexts = new WeakSet();
22386
22400
  function bindPolygonRenderModule({
22387
22401
  bind: bind
22388
22402
  }) {
22389
- loadPolygonModule || (loadPolygonModule = !0, bind(PolygonRender).to(DefaultCanvasPolygonRender).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PolygonRenderContribution));
22403
+ isBindingContextLoaded(loadedPolygonModuleContexts, bind) || (bind(PolygonRender).to(DefaultCanvasPolygonRender).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PolygonRenderContribution));
22390
22404
  }
22391
22405
  const polygonModule = bindPolygonRenderModule;
22392
22406
 
@@ -22427,11 +22441,11 @@
22427
22441
  }
22428
22442
  }
22429
22443
 
22430
- let loadStarModule = !1;
22444
+ const loadedStarModuleContexts = new WeakSet();
22431
22445
  function bindStarRenderModule({
22432
22446
  bind: bind
22433
22447
  }) {
22434
- loadStarModule || (loadStarModule = !0, bind(DefaultCanvasStarRender).toDynamicValue(({
22448
+ isBindingContextLoaded(loadedStarModuleContexts, bind) || (bind(DefaultCanvasStarRender).toDynamicValue(({
22435
22449
  container: container
22436
22450
  }) => new DefaultCanvasStarRender(createContributionProvider$1(StarRenderContribution, container))).inSingletonScope(), bind(StarRender).toService(DefaultCanvasStarRender), bind(GraphicRender).toService(StarRender));
22437
22451
  }
@@ -22464,11 +22478,11 @@
22464
22478
  }
22465
22479
  }
22466
22480
 
22467
- let loadGlyphModule = !1;
22481
+ const loadedGlyphModuleContexts = new WeakSet();
22468
22482
  function bindGlyphRenderModule({
22469
22483
  bind: bind
22470
22484
  }) {
22471
- loadGlyphModule || (loadGlyphModule = !0, bind(GlyphRender).to(DefaultCanvasGlyphRender).inSingletonScope(), bind(GraphicRender).toService(GlyphRender));
22485
+ isBindingContextLoaded(loadedGlyphModuleContexts, bind) || (bind(GlyphRender).to(DefaultCanvasGlyphRender).inSingletonScope(), bind(GraphicRender).toService(GlyphRender));
22472
22486
  }
22473
22487
  const glyphModule = bindGlyphRenderModule;
22474
22488
 
@@ -22524,19 +22538,19 @@
22524
22538
  }
22525
22539
  }
22526
22540
 
22527
- let loadRichtextModule = !1;
22541
+ const loadedRichtextModuleContexts = new WeakSet();
22528
22542
  function bindRichtextRenderModule({
22529
22543
  bind: bind
22530
22544
  }) {
22531
- loadRichtextModule || (loadRichtextModule = !0, bind(RichTextRender).to(DefaultCanvasRichTextRender).inSingletonScope(), bind(GraphicRender).toService(RichTextRender));
22545
+ isBindingContextLoaded(loadedRichtextModuleContexts, bind) || (bind(RichTextRender).to(DefaultCanvasRichTextRender).inSingletonScope(), bind(GraphicRender).toService(RichTextRender));
22532
22546
  }
22533
22547
  const richtextModule = bindRichtextRenderModule;
22534
22548
 
22535
- let loadImageModule = !1;
22549
+ const loadedImageModuleContexts = new WeakSet();
22536
22550
  function bindImageRenderModule({
22537
22551
  bind: bind
22538
22552
  }) {
22539
- loadImageModule || (loadImageModule = !0, bind(ImageRender).to(DefaultCanvasImageRender).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ImageRenderContribution));
22553
+ isBindingContextLoaded(loadedImageModuleContexts, bind) || (bind(ImageRender).to(DefaultCanvasImageRender).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ImageRenderContribution));
22540
22554
  }
22541
22555
  const imageModule = bindImageRenderModule;
22542
22556
 
@@ -22663,11 +22677,11 @@
22663
22677
  }
22664
22678
  }
22665
22679
 
22666
- let loadRect3dModule = !1;
22680
+ const loadedRect3dModuleContexts = new WeakSet();
22667
22681
  function bindRect3dRenderModule({
22668
22682
  bind: bind
22669
22683
  }) {
22670
- loadRect3dModule || (loadRect3dModule = !0, bind(Rect3DRender).to(DefaultCanvasRect3dRender).inSingletonScope(), bind(GraphicRender).toService(Rect3DRender));
22684
+ isBindingContextLoaded(loadedRect3dModuleContexts, bind) || (bind(Rect3DRender).to(DefaultCanvasRect3dRender).inSingletonScope(), bind(GraphicRender).toService(Rect3DRender));
22671
22685
  }
22672
22686
  const rect3dModule = bindRect3dRenderModule;
22673
22687
 
@@ -22792,11 +22806,11 @@
22792
22806
  }
22793
22807
  }
22794
22808
 
22795
- let loadArc3dModule = !1;
22809
+ const loadedArc3dModuleContexts = new WeakSet();
22796
22810
  function bindArc3dRenderModule({
22797
22811
  bind: bind
22798
22812
  }) {
22799
- loadArc3dModule || (loadArc3dModule = !0, bind(Arc3dRender).to(DefaultCanvasArc3DRender).inSingletonScope(), bind(GraphicRender).toService(Arc3dRender));
22813
+ isBindingContextLoaded(loadedArc3dModuleContexts, bind) || (bind(Arc3dRender).to(DefaultCanvasArc3DRender).inSingletonScope(), bind(GraphicRender).toService(Arc3dRender));
22800
22814
  }
22801
22815
  const arc3dModule = bindArc3dRenderModule;
22802
22816
 
@@ -22831,11 +22845,11 @@
22831
22845
  }
22832
22846
  }
22833
22847
 
22834
- let loadPyramid3dModule = !1;
22848
+ const loadedPyramid3dModuleContexts = new WeakSet();
22835
22849
  function bindPyramid3dRenderModule({
22836
22850
  bind: bind
22837
22851
  }) {
22838
- loadPyramid3dModule || (loadPyramid3dModule = !0, bind(Pyramid3dRender).to(DefaultCanvasPyramid3dRender).inSingletonScope(), bind(GraphicRender).toService(Pyramid3dRender));
22852
+ isBindingContextLoaded(loadedPyramid3dModuleContexts, bind) || (bind(Pyramid3dRender).to(DefaultCanvasPyramid3dRender).inSingletonScope(), bind(GraphicRender).toService(Pyramid3dRender));
22839
22853
  }
22840
22854
  const pyramid3dModule = bindPyramid3dRenderModule;
22841
22855
 
@@ -27097,7 +27111,9 @@
27097
27111
  init() {
27098
27112
  this._context = new HarmonyContext2d(this, this._dpr);
27099
27113
  }
27100
- resize(width, height) {}
27114
+ resize(width, height) {
27115
+ this.controled && (this._pixelWidth = width * this._dpr, this._pixelHeight = height * this._dpr, this._displayWidth = width, this._displayHeight = height, this._nativeCanvas.width = this._pixelWidth, this._nativeCanvas.height = this._pixelHeight, this._context.dpr = this._dpr);
27116
+ }
27101
27117
  release(...params) {}
27102
27118
  }
27103
27119
  HarmonyCanvas.env = "harmony";
@@ -28028,7 +28044,7 @@
28028
28044
  (null === (_a = container.isBound) || void 0 === _a ? void 0 : _a.call(container, BrowserWindowHandlerContribution)) || container.bind(BrowserWindowHandlerContribution).toSelf(), (null === (_b = container.getNamed) || void 0 === _b ? void 0 : _b.call(container, WindowHandlerContribution, BrowserWindowHandlerContribution.env)) || container.bind(WindowHandlerContribution).toService(BrowserWindowHandlerContribution).whenTargetNamed(BrowserWindowHandlerContribution.env);
28029
28045
  }
28030
28046
 
28031
- var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
28047
+ var __awaiter$1 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
28032
28048
  return new (P || (P = Promise))(function (resolve, reject) {
28033
28049
  function fulfilled(value) {
28034
28050
  try {
@@ -28247,7 +28263,7 @@
28247
28263
  };
28248
28264
  }
28249
28265
  loadFont(font, source, descriptors) {
28250
- return __awaiter$3(this, void 0, void 0, function* () {
28266
+ return __awaiter$1(this, void 0, void 0, function* () {
28251
28267
  return new FontFace(font, isString$1(source) ? `url(${source})` : source, descriptors).load().then(function (loadedFont) {
28252
28268
  return document.fonts.add(loadedFont), {
28253
28269
  loadState: "success"
@@ -28346,7 +28362,12 @@
28346
28362
  createWindowByCanvas(params) {
28347
28363
  let canvas;
28348
28364
  if ("string" == typeof params.canvas) {
28349
- if (canvas = this.global.getElementById(params.canvas), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
28365
+ if (canvas = this.global.getElementById(params.canvas), canvas || (canvas = this.global.createCanvas({
28366
+ id: params.canvas,
28367
+ width: params.width,
28368
+ height: params.height,
28369
+ dpr: params.dpr
28370
+ })), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
28350
28371
  } else canvas = params.canvas;
28351
28372
  let width = params.width,
28352
28373
  height = params.height;
@@ -28673,17 +28694,55 @@
28673
28694
  }
28674
28695
  }
28675
28696
 
28676
- function makeUpCanvas$4(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, pixelRatio) {
28677
- const dpr = null != pixelRatio ? pixelRatio : tt.getSystemInfoSync().pixelRatio;
28678
- canvasIdLists.forEach((id, i) => {
28679
- const ctx = tt.createCanvasContext(id),
28680
- canvas = new CanvasWrapDisableWH(ctx.canvas || {}, ctx, dpr, domref.width, domref.height, id);
28681
- ctx.canvas = canvas, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
28682
- });
28697
+ function getMiniAppCanvasOptions(params, pixelRatio, offscreen = null == params.id) {
28698
+ var _a, _b, _c;
28699
+ return {
28700
+ id: null == params.id ? void 0 : String(params.id),
28701
+ width: null !== (_a = params.width) && void 0 !== _a ? _a : 0,
28702
+ height: null !== (_b = params.height) && void 0 !== _b ? _b : 0,
28703
+ dpr: null !== (_c = params.dpr) && void 0 !== _c ? _c : pixelRatio,
28704
+ offscreen: offscreen
28705
+ };
28706
+ }
28707
+ function wrapMiniAppNativeCanvas(nativeCanvas, options) {
28708
+ var _a;
28709
+ const ctx = null === (_a = null == nativeCanvas ? void 0 : nativeCanvas.getContext) || void 0 === _a ? void 0 : _a.call(nativeCanvas, "2d");
28710
+ if (!ctx) throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');
28711
+ return new CanvasWrapEnableWH(nativeCanvas, ctx, options.dpr, options.width, options.height, options.id);
28712
+ }
28713
+ function wrapMiniAppContextCanvas(ctx, options) {
28714
+ if (!ctx) throw new Error("MiniApp canvas bridge returned an empty 2d context.");
28715
+ const canvas = new CanvasWrapDisableWH(ctx.canvas || {}, ctx, options.dpr, options.width, options.height, options.id);
28716
+ return ctx.canvas = canvas, canvas;
28717
+ }
28718
+ function createCanvasWithFactory(params, pixelRatio, canvasMap, factory) {
28719
+ const options = getMiniAppCanvasOptions(params, pixelRatio),
28720
+ id = options.id;
28721
+ if (null != id) {
28722
+ const existing = canvasMap.get(id);
28723
+ if (existing) return existing;
28724
+ }
28725
+ if (!factory) return null;
28726
+ const canvas = wrapMiniAppNativeCanvas(factory(options), options);
28727
+ return null != id && canvasMap.set(id, canvas), canvas;
28728
+ }
28729
+
28730
+ const FEISHU_CANVAS_BRIDGE_ERROR = "Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).";
28731
+ function getFeishuRuntime(params) {
28732
+ var _a, _b, _c, _d, _e;
28733
+ try {
28734
+ return null !== (_c = null !== (_b = null !== (_a = null == params ? void 0 : params.feishu) && void 0 !== _a ? _a : null == params ? void 0 : params.tt) && void 0 !== _b ? _b : null == params ? void 0 : params.runtime) && void 0 !== _c ? _c : "undefined" != typeof tt ? tt : void 0;
28735
+ } catch (_f) {
28736
+ return null !== (_e = null !== (_d = null == params ? void 0 : params.feishu) && void 0 !== _d ? _d : null == params ? void 0 : params.tt) && void 0 !== _e ? _e : null == params ? void 0 : params.runtime;
28737
+ }
28738
+ }
28739
+ function getFeishuPixelRatio(params, runtime = getFeishuRuntime(params)) {
28740
+ var _a, _b, _c, _d;
28741
+ return null !== (_d = null !== (_a = null == params ? void 0 : params.pixelRatio) && void 0 !== _a ? _a : null === (_c = null === (_b = null == runtime ? void 0 : runtime.getSystemInfoSync) || void 0 === _b ? void 0 : _b.call(runtime)) || void 0 === _c ? void 0 : _c.pixelRatio) && void 0 !== _d ? _d : 1;
28683
28742
  }
28684
28743
  class FeishuEnvContribution extends BaseEnvContribution {
28685
28744
  constructor() {
28686
- super(), this.type = "feishu", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
28745
+ super(), this.type = "feishu", this.supportEvent = !0, this.canvasMap = new Map(), this.feishuEnvParams = {}, this.supportsTouchEvents = !0;
28687
28746
  try {
28688
28747
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
28689
28748
  } catch (err) {
@@ -28692,13 +28751,13 @@
28692
28751
  this.applyStyles = !0;
28693
28752
  }
28694
28753
  getDynamicCanvasCount() {
28695
- return this.freeCanvasList.length;
28754
+ return 0;
28696
28755
  }
28697
28756
  getStaticCanvasCount() {
28698
28757
  return 9999;
28699
28758
  }
28700
- configure(service, params) {
28701
- service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$4(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.pixelRatio));
28759
+ configure(service, params = {}) {
28760
+ service.env === this.type && (service.setActiveEnvContribution(this), this.feishuEnvParams = params);
28702
28761
  }
28703
28762
  loadImage(url) {
28704
28763
  return Promise.resolve({
@@ -28710,13 +28769,21 @@
28710
28769
  return Promise.reject();
28711
28770
  }
28712
28771
  createCanvas(params) {
28713
- const result = this.freeCanvasList[this.canvasIdx] || this.freeCanvasList[this.freeCanvasList.length - 1];
28714
- return this.canvasIdx++, result;
28772
+ var _a;
28773
+ const envParams = this.feishuEnvParams,
28774
+ runtime = getFeishuRuntime(envParams),
28775
+ dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : getFeishuPixelRatio(envParams, runtime),
28776
+ factoryCanvas = createCanvasWithFactory(params, dpr, this.canvasMap, envParams.canvasFactory);
28777
+ if (factoryCanvas) return factoryCanvas;
28778
+ const options = getMiniAppCanvasOptions(params, dpr, !1);
28779
+ if (null == options.id || "function" != typeof (null == runtime ? void 0 : runtime.createCanvasContext)) throw new Error(FEISHU_CANVAS_BRIDGE_ERROR);
28780
+ const canvas = wrapMiniAppContextCanvas(runtime.createCanvasContext(options.id), options);
28781
+ return this.canvasMap.set(options.id, canvas), canvas;
28715
28782
  }
28716
28783
  createOffscreenCanvas(params) {}
28717
28784
  releaseCanvas(canvas) {}
28718
28785
  getDevicePixelRatio() {
28719
- return tt.getSystemInfoSync().pixelRatio;
28786
+ return getFeishuPixelRatio(this.feishuEnvParams);
28720
28787
  }
28721
28788
  getRequestAnimationFrame() {
28722
28789
  return function (callback) {
@@ -28784,6 +28851,40 @@
28784
28851
  this.cache = {};
28785
28852
  }
28786
28853
  };
28854
+ function setMiniAppEventTarget$2(event, key, value) {
28855
+ if (event && value) try {
28856
+ event[key] = value;
28857
+ } catch (_a) {
28858
+ Object.defineProperty(event, key, {
28859
+ configurable: !0,
28860
+ value: value
28861
+ });
28862
+ }
28863
+ }
28864
+ function isValidCoordinate$3(value) {
28865
+ return "number" == typeof value && Number.isFinite(value);
28866
+ }
28867
+ function pickCoordinate$3(...values) {
28868
+ for (let i = 0; i < values.length; i++) if (isValidCoordinate$3(values[i])) return values[i];
28869
+ }
28870
+ function setHarmonyEventValue(event, key, value) {
28871
+ try {
28872
+ event[key] = value;
28873
+ } catch (_a) {
28874
+ Object.defineProperty(event, key, {
28875
+ configurable: !0,
28876
+ value: value
28877
+ });
28878
+ }
28879
+ }
28880
+ function normalizeHarmonyTouchEventPoint(event) {
28881
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
28882
+ const touch = null !== (_b = null === (_a = null == event ? void 0 : event.changedTouches) || void 0 === _a ? void 0 : _a[0]) && void 0 !== _b ? _b : null === (_c = null == event ? void 0 : event.touches) || void 0 === _c ? void 0 : _c[0];
28883
+ if (!touch) return;
28884
+ const x = pickCoordinate$3(event.x, event.offsetX, event.clientX, event.pageX, touch.x, touch.offsetX, touch.clientX, touch.pageX),
28885
+ y = pickCoordinate$3(event.y, event.offsetY, event.clientY, event.pageY, touch.y, touch.offsetY, touch.clientY, touch.pageY);
28886
+ null != x && null != y && (!event.touches && event.changedTouches && setHarmonyEventValue(event, "touches", "touchend" === event.type || "touchcancel" === event.type ? [] : event.changedTouches), setHarmonyEventValue(event, "x", x), setHarmonyEventValue(event, "y", y), setHarmonyEventValue(event, "offsetX", null !== (_d = event.offsetX) && void 0 !== _d ? _d : x), setHarmonyEventValue(event, "offsetY", null !== (_e = event.offsetY) && void 0 !== _e ? _e : y), setHarmonyEventValue(event, "clientX", null !== (_f = event.clientX) && void 0 !== _f ? _f : x), setHarmonyEventValue(event, "clientY", null !== (_g = event.clientY) && void 0 !== _g ? _g : y), setHarmonyEventValue(event, "pageX", null !== (_h = event.pageX) && void 0 !== _h ? _h : x), setHarmonyEventValue(event, "pageY", null !== (_j = event.pageY) && void 0 !== _j ? _j : y), touch.x = null !== (_k = touch.x) && void 0 !== _k ? _k : x, touch.y = null !== (_l = touch.y) && void 0 !== _l ? _l : y, touch.offsetX = null !== (_m = touch.offsetX) && void 0 !== _m ? _m : x, touch.offsetY = null !== (_o = touch.offsetY) && void 0 !== _o ? _o : y, touch.clientX = null !== (_p = touch.clientX) && void 0 !== _p ? _p : x, touch.clientY = null !== (_q = touch.clientY) && void 0 !== _q ? _q : y, touch.pageX = null !== (_r = touch.pageX) && void 0 !== _r ? _r : x, touch.pageY = null !== (_s = touch.pageY) && void 0 !== _s ? _s : y);
28887
+ }
28787
28888
  class HarmonyWindowHandlerContribution extends BaseWindowHandlerContribution {
28788
28889
  get container() {
28789
28890
  return null;
@@ -28812,7 +28913,8 @@
28812
28913
  createWindowByConfig(params) {
28813
28914
  const nativeCanvas = this.global.createCanvas({
28814
28915
  width: params.width,
28815
- height: params.height
28916
+ height: params.height,
28917
+ dpr: params.dpr
28816
28918
  }),
28817
28919
  options = {
28818
28920
  width: params.width,
@@ -28827,7 +28929,12 @@
28827
28929
  createWindowByCanvas(params) {
28828
28930
  let canvas;
28829
28931
  if ("string" == typeof params.canvas) {
28830
- if (canvas = this.global.getElementById(params.canvas), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
28932
+ if (canvas = this.global.getElementById(params.canvas), canvas || (canvas = this.global.createCanvas({
28933
+ id: params.canvas,
28934
+ width: params.width,
28935
+ height: params.height,
28936
+ dpr: params.dpr
28937
+ })), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
28831
28938
  } else canvas = params.canvas;
28832
28939
  let width = params.width,
28833
28940
  height = params.height;
@@ -28835,15 +28942,19 @@
28835
28942
  const data = canvas.getBoundingClientRect();
28836
28943
  width = data.width, height = data.height;
28837
28944
  }
28838
- this.canvas = new HarmonyCanvas({
28945
+ let dpr = params.dpr;
28946
+ null == dpr && (dpr = canvas.width / width), this.canvas = new HarmonyCanvas({
28839
28947
  width: width,
28840
28948
  height: height,
28841
- dpr: 1,
28949
+ dpr: dpr,
28842
28950
  nativeCanvas: canvas,
28843
28951
  canvasControled: params.canvasControled
28844
28952
  });
28845
28953
  }
28846
- releaseWindow() {}
28954
+ releaseWindow() {
28955
+ var _a, _b;
28956
+ this.eventManager.cleanEvent(), null === (_b = null === (_a = this.canvas) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a);
28957
+ }
28847
28958
  resizeWindow(width, height) {
28848
28959
  this.canvas.resize(width, height);
28849
28960
  }
@@ -28866,12 +28977,15 @@
28866
28977
  this.eventManager.removeEventListener(type, listener);
28867
28978
  }
28868
28979
  dispatchEvent(event) {
28980
+ var _a;
28869
28981
  const {
28870
28982
  type: type
28871
28983
  } = event;
28872
- return !!this.eventManager.cache[type] && (event.changedTouches && event.changedTouches[0] && (event.offsetX = event.changedTouches[0].x, event.changedTouches[0].offsetX = event.changedTouches[0].x, event.changedTouches[0].clientX = event.changedTouches[0].x, event.offsetY = event.changedTouches[0].y, event.changedTouches[0].offsetY = event.changedTouches[0].y, event.changedTouches[0].clientY = event.changedTouches[0].y), event.preventDefault = () => {}, event.stopPropagation = () => {}, this.eventManager.cache[type].listener && this.eventManager.cache[type].listener.forEach(f => {
28984
+ if (!this.eventManager.cache[type]) return !1;
28985
+ const nativeCanvas = null === (_a = this.canvas) || void 0 === _a ? void 0 : _a.nativeCanvas;
28986
+ return setMiniAppEventTarget$2(event, "target", nativeCanvas), setMiniAppEventTarget$2(event, "currentTarget", nativeCanvas), normalizeHarmonyTouchEventPoint(event), event.preventDefault = () => {}, event.stopPropagation = () => {}, this.eventManager.cache[type].listener && this.eventManager.cache[type].listener.forEach(f => {
28873
28987
  f(event);
28874
- }), !0);
28988
+ }), !0;
28875
28989
  }
28876
28990
  getStyle() {
28877
28991
  return {};
@@ -28903,24 +29017,89 @@
28903
29017
  (null === (_a = container.isBound) || void 0 === _a ? void 0 : _a.call(container, HarmonyWindowHandlerContribution)) || container.bind(HarmonyWindowHandlerContribution).toSelf(), (null === (_b = container.getNamed) || void 0 === _b ? void 0 : _b.call(container, WindowHandlerContribution, HarmonyWindowHandlerContribution.env)) || container.bind(WindowHandlerContribution).toService(HarmonyWindowHandlerContribution).whenTargetNamed(HarmonyWindowHandlerContribution.env);
28904
29018
  }
28905
29019
 
28906
- function createCanvas(width, height, id) {
28907
- const _c = new OffscreenCanvas(width, height),
28908
- context = _c.getContext("2d");
28909
- return new CanvasWrapDisableWH({
29020
+ const HARMONY_CANVAS_BRIDGE_ERROR = "Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.",
29021
+ HARMONY_CANVAS_SIZE_ERROR = "Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.";
29022
+ function isValidCoordinate$2(value) {
29023
+ return "number" == typeof value && Number.isFinite(value);
29024
+ }
29025
+ function pickCoordinate$2(...values) {
29026
+ for (let i = 0; i < values.length; i++) if (isValidCoordinate$2(values[i])) return values[i];
29027
+ }
29028
+ function getPrimaryTouch$1(event) {
29029
+ var _a, _b, _c;
29030
+ return null !== (_b = null === (_a = null == event ? void 0 : event.changedTouches) || void 0 === _a ? void 0 : _a[0]) && void 0 !== _b ? _b : null === (_c = null == event ? void 0 : event.touches) || void 0 === _c ? void 0 : _c[0];
29031
+ }
29032
+ function getHarmonyEventPoint(event) {
29033
+ const touch = getPrimaryTouch$1(event),
29034
+ x = pickCoordinate$2(null == event ? void 0 : event.x, null == event ? void 0 : event.offsetX, null == event ? void 0 : event.clientX, null == event ? void 0 : event.pageX, null == touch ? void 0 : touch.x, null == touch ? void 0 : touch.offsetX, null == touch ? void 0 : touch.clientX, null == touch ? void 0 : touch.pageX),
29035
+ y = pickCoordinate$2(null == event ? void 0 : event.y, null == event ? void 0 : event.offsetY, null == event ? void 0 : event.clientY, null == event ? void 0 : event.pageY, null == touch ? void 0 : touch.y, null == touch ? void 0 : touch.offsetY, null == touch ? void 0 : touch.clientY, null == touch ? void 0 : touch.pageY);
29036
+ return null == x || null == y ? null : {
29037
+ x: x,
29038
+ y: y
29039
+ };
29040
+ }
29041
+ function getHarmonyRuntime(params) {
29042
+ var _a;
29043
+ return null !== (_a = null == params ? void 0 : params.harmony) && void 0 !== _a ? _a : null == params ? void 0 : params.runtime;
29044
+ }
29045
+ function getHarmonyPixelRatio(params) {
29046
+ var _a;
29047
+ return null !== (_a = null == params ? void 0 : params.pixelRatio) && void 0 !== _a ? _a : 1;
29048
+ }
29049
+ function getCanvasSize$1(width, height) {
29050
+ if (!isValidCoordinate$2(width) || !isValidCoordinate$2(height)) throw new Error(HARMONY_CANVAS_SIZE_ERROR);
29051
+ return {
29052
+ width: width,
29053
+ height: height
29054
+ };
29055
+ }
29056
+ function getGlobalOffscreenCanvasCtor() {
29057
+ try {
29058
+ return "undefined" != typeof OffscreenCanvas ? OffscreenCanvas : void 0;
29059
+ } catch (err) {
29060
+ return;
29061
+ }
29062
+ }
29063
+ function createFallbackOffscreenCanvas(width, height) {
29064
+ const OffscreenCanvasCtor = getGlobalOffscreenCanvasCtor();
29065
+ return "function" != typeof OffscreenCanvasCtor ? null : new OffscreenCanvasCtor(width, height);
29066
+ }
29067
+ function wrapHarmonyNativeCanvas(nativeCanvas, id, width, height, dpr) {
29068
+ var _a, _b, _c;
29069
+ nativeCanvas.width = width * dpr, nativeCanvas.height = height * dpr;
29070
+ const context = null !== (_b = null === (_a = nativeCanvas.getContext) || void 0 === _a ? void 0 : _a.call(nativeCanvas, "2d")) && void 0 !== _b ? _b : null === (_c = nativeCanvas.getContext) || void 0 === _c ? void 0 : _c.call(nativeCanvas);
29071
+ if (!context) throw new Error(HARMONY_CANVAS_BRIDGE_ERROR);
29072
+ return "function" != typeof nativeCanvas.getBoundingClientRect && (nativeCanvas.getBoundingClientRect = () => ({
29073
+ width: width,
29074
+ height: height
29075
+ })), new CanvasWrapEnableWH(nativeCanvas, context, dpr, width, height, id);
29076
+ }
29077
+ function createHarmonyNativeCanvas(id, width, height, dpr, offscreen, params, runtime) {
29078
+ const options = {
29079
+ id: id,
28910
29080
  width: width,
28911
29081
  height: height,
28912
- context: context,
28913
- _c: _c,
28914
- getBoundingClientRect: () => ({
28915
- width: width,
28916
- height: height
28917
- }),
28918
- getContext: () => context
28919
- }, context, 1, width, height, id);
29082
+ dpr: dpr,
29083
+ offscreen: offscreen
29084
+ };
29085
+ if (params.canvasFactory) return params.canvasFactory(options);
29086
+ if (offscreen && "function" == typeof (null == runtime ? void 0 : runtime.createOffscreenCanvas)) {
29087
+ const canvas = runtime.createOffscreenCanvas(options);
29088
+ if (canvas) return canvas;
29089
+ }
29090
+ if (!offscreen && "function" == typeof (null == runtime ? void 0 : runtime.createCanvas)) {
29091
+ const canvas = runtime.createCanvas(options);
29092
+ if (canvas) return canvas;
29093
+ }
29094
+ if (offscreen) {
29095
+ const canvas = createFallbackOffscreenCanvas(width * dpr, height * dpr);
29096
+ if (canvas) return canvas;
29097
+ }
29098
+ throw new Error(HARMONY_CANVAS_BRIDGE_ERROR);
28920
29099
  }
28921
29100
  class HarmonyEnvContribution extends BaseEnvContribution {
28922
29101
  constructor() {
28923
- super(), this.type = "harmony", this.supportEvent = !0, this.supportsTouchEvents = !0;
29102
+ super(), this.type = "harmony", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
28924
29103
  try {
28925
29104
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
28926
29105
  } catch (err) {
@@ -28928,8 +29107,8 @@
28928
29107
  }
28929
29108
  this.applyStyles = !0, this.rafSTO = new RafBasedSTO(0);
28930
29109
  }
28931
- configure(service, params) {
28932
- service.env === this.type && service.setActiveEnvContribution(this);
29110
+ configure(service, params = {}) {
29111
+ service.env === this.type && (service.setActiveEnvContribution(this), this.harmonyEnvParams = params, this.harmonyRuntime = getHarmonyRuntime(params));
28933
29112
  }
28934
29113
  getDynamicCanvasCount() {
28935
29114
  return 9999;
@@ -28937,17 +29116,56 @@
28937
29116
  getStaticCanvasCount() {
28938
29117
  return 9999;
28939
29118
  }
28940
- loadImage(url) {}
29119
+ loadImage(url) {
29120
+ var _a;
29121
+ if ("function" != typeof (null === (_a = this.harmonyRuntime) || void 0 === _a ? void 0 : _a.createImage)) return Promise.resolve({
29122
+ data: null,
29123
+ loadState: "fail"
29124
+ });
29125
+ const img = this.harmonyRuntime.createImage(url);
29126
+ return new Promise(resolve => {
29127
+ img.onload = () => {
29128
+ resolve({
29129
+ data: img,
29130
+ loadState: "success"
29131
+ });
29132
+ }, img.onerror = () => {
29133
+ resolve({
29134
+ data: null,
29135
+ loadState: "fail"
29136
+ });
29137
+ };
29138
+ });
29139
+ }
28941
29140
  loadSvg(url) {
28942
- return Promise.reject();
29141
+ return Promise.resolve({
29142
+ data: null,
29143
+ loadState: "fail"
29144
+ });
28943
29145
  }
28944
29146
  createCanvas(params) {
28945
- return createCanvas(params.width, params.height, params.id);
29147
+ var _a, _b;
29148
+ const envParams = null !== (_a = this.harmonyEnvParams) && void 0 !== _a ? _a : {},
29149
+ runtime = getHarmonyRuntime(envParams),
29150
+ dpr = null !== (_b = params.dpr) && void 0 !== _b ? _b : getHarmonyPixelRatio(envParams),
29151
+ size = getCanvasSize$1(params.width, params.height);
29152
+ if (null != params.id) {
29153
+ const id = String(params.id),
29154
+ existing = this.canvasMap.get(id);
29155
+ if (existing) return existing;
29156
+ const canvas = wrapHarmonyNativeCanvas(createHarmonyNativeCanvas(id, size.width, size.height, dpr, !1, envParams, runtime), id, size.width, size.height, dpr);
29157
+ return this.canvasMap.set(id, canvas), canvas;
29158
+ }
29159
+ const result = this.freeCanvasList[this.canvasIdx] || this.freeCanvasList[this.freeCanvasList.length - 1];
29160
+ if (this.canvasIdx++, result) return result;
29161
+ const id = Math.random().toString(),
29162
+ canvas = wrapHarmonyNativeCanvas(createHarmonyNativeCanvas(id, size.width, size.height, dpr, !0, envParams, runtime), id, size.width, size.height, dpr);
29163
+ return this.canvasMap.set(id, canvas), this.freeCanvasList.push(canvas), canvas;
28946
29164
  }
28947
29165
  createOffscreenCanvas(params) {}
28948
29166
  releaseCanvas(canvas) {}
28949
29167
  getDevicePixelRatio() {
28950
- return 1;
29168
+ return getHarmonyPixelRatio(this.harmonyEnvParams);
28951
29169
  }
28952
29170
  getRequestAnimationFrame() {
28953
29171
  return callback => this.rafSTO.call(callback);
@@ -28959,7 +29177,7 @@
28959
29177
  }
28960
29178
  mapToCanvasPoint(event) {
28961
29179
  var _a;
28962
- return null === (_a = null == event ? void 0 : event.type) || void 0 === _a || _a.startsWith("mouse"), event;
29180
+ return null !== (_a = getHarmonyEventPoint(event)) && void 0 !== _a ? _a : event;
28963
29181
  }
28964
29182
  addEventListener(type, listener, options) {
28965
29183
  return null;
@@ -28971,7 +29189,8 @@
28971
29189
  return null;
28972
29190
  }
28973
29191
  getElementById(str) {
28974
- return null;
29192
+ var _a;
29193
+ return null !== (_a = this.canvasMap.get(str)) && void 0 !== _a ? _a : null;
28975
29194
  }
28976
29195
  getRootElement() {
28977
29196
  return null;
@@ -29243,13 +29462,11 @@
29243
29462
  }
29244
29463
  return null;
29245
29464
  }
29246
- function getCanvasSize(domref, width, height) {
29247
- const resolvedWidth = null != width ? width : null == domref ? void 0 : domref.width,
29248
- resolvedHeight = null != height ? height : null == domref ? void 0 : domref.height;
29249
- if (!isValidCoordinate(resolvedWidth) || !isValidCoordinate(resolvedHeight)) throw new Error(LYNX_CANVAS_SIZE_ERROR);
29465
+ function getCanvasSize(width, height) {
29466
+ if (!isValidCoordinate(width) || !isValidCoordinate(height)) throw new Error(LYNX_CANVAS_SIZE_ERROR);
29250
29467
  return {
29251
- width: resolvedWidth,
29252
- height: resolvedHeight
29468
+ width: width,
29469
+ height: height
29253
29470
  };
29254
29471
  }
29255
29472
  function wrapLynxNativeCanvas(nativeCanvas, id, width, height, dpr) {
@@ -29273,29 +29490,6 @@
29273
29490
  }
29274
29491
  throw new Error(LYNX_CANVAS_BRIDGE_ERROR);
29275
29492
  }
29276
- function makeUpCanvas$3(params = {}, canvasMap, freeCanvasList) {
29277
- const runtime = getLynxRuntime(params),
29278
- {
29279
- domref: domref,
29280
- canvasIdLists = [],
29281
- freeCanvasIdx = 0
29282
- } = params,
29283
- offscreen = !!params.offscreen,
29284
- dpr = getLynxPixelRatio(params, runtime);
29285
- if (canvasIdLists.forEach((id, i) => {
29286
- const size = getCanvasSize(domref),
29287
- canvas = wrapLynxNativeCanvas(createLynxNativeCanvas(id, size.width, size.height, dpr, offscreen, params, runtime), id, size.width, size.height, dpr);
29288
- canvasMap.set(id, canvas), i > freeCanvasIdx && freeCanvasList.push(canvas);
29289
- }), !freeCanvasList.length && domref && "function" == typeof (null == runtime ? void 0 : runtime.createOffscreenCanvas)) {
29290
- const size = getCanvasSize(domref),
29291
- _canvas = runtime.createOffscreenCanvas();
29292
- _canvas.width = size.width * dpr, _canvas.height = size.height * dpr;
29293
- const ctx = _canvas.getContext("2d"),
29294
- id = Math.random().toString(),
29295
- canvas = new CanvasWrapEnableWH(_canvas, ctx, dpr, size.width, size.height, id);
29296
- canvasMap.set(id, canvas), freeCanvasList.push(canvas);
29297
- }
29298
- }
29299
29493
  function createImageElement(src, isSvg = !1, runtime = getGlobalLynxRuntime()) {
29300
29494
  if (isSvg) return Promise.reject();
29301
29495
  if ("function" != typeof (null == runtime ? void 0 : runtime.createImage)) return Promise.reject(new Error("Lynx image bridge is unavailable."));
@@ -29319,7 +29513,7 @@
29319
29513
  this.applyStyles = !0;
29320
29514
  }
29321
29515
  configure(service, params = {}) {
29322
- service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params), makeUpCanvas$3(params, this.canvasMap, this.freeCanvasList));
29516
+ service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params));
29323
29517
  }
29324
29518
  getDynamicCanvasCount() {
29325
29519
  return this.freeCanvasList.length;
@@ -29351,7 +29545,7 @@
29351
29545
  const envParams = null !== (_a = this.lynxEnvParams) && void 0 !== _a ? _a : {},
29352
29546
  runtime = getLynxRuntime(envParams),
29353
29547
  dpr = null !== (_b = params.dpr) && void 0 !== _b ? _b : getLynxPixelRatio(envParams, runtime),
29354
- size = getCanvasSize(envParams.domref, params.width, params.height),
29548
+ size = getCanvasSize(params.width, params.height),
29355
29549
  canvas = wrapLynxNativeCanvas(createLynxNativeCanvas(id, size.width, size.height, dpr, !1, envParams, runtime), id, size.width, size.height, dpr);
29356
29550
  return this.canvasMap.set(id, canvas), canvas;
29357
29551
  }
@@ -29360,7 +29554,7 @@
29360
29554
  const envParams = null !== (_c = this.lynxEnvParams) && void 0 !== _c ? _c : {},
29361
29555
  runtime = getLynxRuntime(envParams),
29362
29556
  dpr = null !== (_d = params.dpr) && void 0 !== _d ? _d : getLynxPixelRatio(envParams, runtime),
29363
- size = getCanvasSize(envParams.domref, params.width, params.height),
29557
+ size = getCanvasSize(params.width, params.height),
29364
29558
  id = Math.random().toString(),
29365
29559
  canvas = wrapLynxNativeCanvas(createLynxNativeCanvas(id, size.width, size.height, dpr, !0, envParams, runtime), id, size.width, size.height, dpr);
29366
29560
  return this.canvasMap.set(id, canvas), this.freeCanvasList.push(canvas), canvas;
@@ -29671,7 +29865,12 @@
29671
29865
  createWindowByCanvas(params) {
29672
29866
  let canvas;
29673
29867
  if ("string" == typeof params.canvas) {
29674
- if (canvas = this.global.getElementById(params.canvas), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
29868
+ if (canvas = this.global.getElementById(params.canvas), canvas || (canvas = this.global.createCanvas({
29869
+ id: params.canvas,
29870
+ width: params.width,
29871
+ height: params.height,
29872
+ dpr: params.dpr
29873
+ })), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
29675
29874
  } else canvas = params.canvas;
29676
29875
  let width = params.width,
29677
29876
  height = params.height;
@@ -29756,16 +29955,10 @@
29756
29955
  (null === (_a = container.isBound) || void 0 === _a ? void 0 : _a.call(container, TaroWindowHandlerContribution)) || container.bind(TaroWindowHandlerContribution).toSelf(), (null === (_b = container.getNamed) || void 0 === _b ? void 0 : _b.call(container, WindowHandlerContribution, TaroWindowHandlerContribution.env)) || container.bind(WindowHandlerContribution).toService(TaroWindowHandlerContribution).whenTargetNamed(TaroWindowHandlerContribution.env);
29757
29956
  }
29758
29957
 
29759
- function makeUpCanvas$2(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, taro, dpr) {
29760
- canvasIdLists.forEach((id, i) => {
29761
- const ctx = taro.createCanvasContext(id),
29762
- canvas = new CanvasWrapDisableWH(ctx.canvas || {}, ctx, dpr, domref.width, domref.height, id);
29763
- return ctx.canvas = canvas, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas), canvas;
29764
- });
29765
- }
29958
+ const TARO_CANVAS_BRIDGE_ERROR = "Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).";
29766
29959
  class TaroEnvContribution extends BaseEnvContribution {
29767
29960
  constructor() {
29768
- super(), this.type = "taro", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
29961
+ super(), this.type = "taro", this.supportEvent = !0, this.canvasMap = new Map(), this.pixelRatio = 1, this.taroEnvParams = {}, this.supportsTouchEvents = !0;
29769
29962
  try {
29770
29963
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
29771
29964
  } catch (err) {
@@ -29774,7 +29967,7 @@
29774
29967
  this.applyStyles = !0;
29775
29968
  }
29776
29969
  getDynamicCanvasCount() {
29777
- return this.freeCanvasList.length;
29970
+ return 0;
29778
29971
  }
29779
29972
  getStaticCanvasCount() {
29780
29973
  return 9999;
@@ -29783,8 +29976,9 @@
29783
29976
  var _a;
29784
29977
  return null === (_a = null == event ? void 0 : event.type) || void 0 === _a || _a.startsWith("mouse"), event;
29785
29978
  }
29786
- configure(service, params) {
29787
- service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$2(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.taro, params.pixelRatio), this.taro = params.taro, this.pixelRatio = params.pixelRatio);
29979
+ configure(service, params = {}) {
29980
+ var _a;
29981
+ service.env === this.type && (service.setActiveEnvContribution(this), this.taroEnvParams = params, this.taro = params.taro, this.pixelRatio = null !== (_a = params.pixelRatio) && void 0 !== _a ? _a : 1);
29788
29982
  }
29789
29983
  loadImage(url) {
29790
29984
  return Promise.resolve({
@@ -29793,7 +29987,7 @@
29793
29987
  });
29794
29988
  }
29795
29989
  loadSvg(svgStr) {
29796
- const _window = window || globalThis;
29990
+ const _window = "undefined" != typeof window ? window : globalThis;
29797
29991
  if (_window.DOMParser) {
29798
29992
  const svg = new _window.DOMParser().parseFromString(svgStr, "image/svg+xml").children[0],
29799
29993
  data = new XMLSerializer().serializeToString(svg),
@@ -29816,8 +30010,15 @@
29816
30010
  return Promise.reject();
29817
30011
  }
29818
30012
  createCanvas(params) {
29819
- const result = this.freeCanvasList[this.canvasIdx] || this.freeCanvasList[this.freeCanvasList.length - 1];
29820
- return this.canvasIdx++, result;
30013
+ var _a, _b;
30014
+ const envParams = this.taroEnvParams,
30015
+ dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : this.getDevicePixelRatio(),
30016
+ factoryCanvas = createCanvasWithFactory(params, dpr, this.canvasMap, envParams.canvasFactory);
30017
+ if (factoryCanvas) return factoryCanvas;
30018
+ const options = getMiniAppCanvasOptions(params, dpr, !1);
30019
+ if (null == options.id || "function" != typeof (null === (_b = envParams.taro) || void 0 === _b ? void 0 : _b.createCanvasContext)) throw new Error(TARO_CANVAS_BRIDGE_ERROR);
30020
+ const canvas = wrapMiniAppContextCanvas(envParams.taro.createCanvasContext(options.id), options);
30021
+ return this.canvasMap.set(options.id, canvas), canvas;
29821
30022
  }
29822
30023
  createOffscreenCanvas(params) {}
29823
30024
  releaseCanvas(canvas) {}
@@ -29925,7 +30126,12 @@
29925
30126
  createWindowByCanvas(params) {
29926
30127
  let canvas;
29927
30128
  if ("string" == typeof params.canvas) {
29928
- if (canvas = this.global.getElementById(params.canvas), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
30129
+ if (canvas = this.global.getElementById(params.canvas), canvas || (canvas = this.global.createCanvas({
30130
+ id: params.canvas,
30131
+ width: params.width,
30132
+ height: params.height,
30133
+ dpr: params.dpr
30134
+ })), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
29929
30135
  } else canvas = params.canvas;
29930
30136
  let width = params.width,
29931
30137
  height = params.height;
@@ -30000,51 +30206,22 @@
30000
30206
  (null === (_a = container.isBound) || void 0 === _a ? void 0 : _a.call(container, TTWindowHandlerContribution)) || container.bind(TTWindowHandlerContribution).toSelf(), (null === (_b = container.getNamed) || void 0 === _b ? void 0 : _b.call(container, WindowHandlerContribution, TTWindowHandlerContribution.env)) || container.bind(WindowHandlerContribution).toService(TTWindowHandlerContribution).whenTargetNamed(TTWindowHandlerContribution.env);
30001
30207
  }
30002
30208
 
30003
- var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
30004
- return new (P || (P = Promise))(function (resolve, reject) {
30005
- function fulfilled(value) {
30006
- try {
30007
- step(generator.next(value));
30008
- } catch (e) {
30009
- reject(e);
30010
- }
30011
- }
30012
- function rejected(value) {
30013
- try {
30014
- step(generator.throw(value));
30015
- } catch (e) {
30016
- reject(e);
30017
- }
30018
- }
30019
- function step(result) {
30020
- var value;
30021
- result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
30022
- resolve(value);
30023
- })).then(fulfilled, rejected);
30024
- }
30025
- step((generator = generator.apply(thisArg, _arguments || [])).next());
30026
- });
30027
- };
30028
- function makeUpCanvas$1(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, component) {
30029
- return __awaiter$2(this, void 0, void 0, function* () {
30030
- const dpr = tt.getSystemInfoSync().pixelRatio;
30031
- for (let i = 0; i < canvasIdLists.length; i++) {
30032
- const id = canvasIdLists[i];
30033
- yield new Promise(resolve => {
30034
- let data = tt.createSelectorQuery();
30035
- component && (data = data.in(component)), data.select(`#${id}`).node().exec(res => {
30036
- const canvas = res[0].node,
30037
- width = canvas.width,
30038
- height = canvas.height;
30039
- canvas.width = width * dpr, canvas.height = height * dpr, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas), resolve(null);
30040
- });
30041
- });
30042
- }
30043
- });
30209
+ const TT_CANVAS_BRIDGE_ERROR = "TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).";
30210
+ function getTTRuntime(params) {
30211
+ var _a, _b, _c;
30212
+ try {
30213
+ return null !== (_b = null !== (_a = null == params ? void 0 : params.tt) && void 0 !== _a ? _a : null == params ? void 0 : params.runtime) && void 0 !== _b ? _b : "undefined" != typeof tt ? tt : void 0;
30214
+ } catch (_d) {
30215
+ return null !== (_c = null == params ? void 0 : params.tt) && void 0 !== _c ? _c : null == params ? void 0 : params.runtime;
30216
+ }
30217
+ }
30218
+ function getTTPixelRatio(params, runtime = getTTRuntime(params)) {
30219
+ var _a, _b, _c, _d;
30220
+ return null !== (_d = null !== (_a = null == params ? void 0 : params.pixelRatio) && void 0 !== _a ? _a : null === (_c = null === (_b = null == runtime ? void 0 : runtime.getSystemInfoSync) || void 0 === _b ? void 0 : _b.call(runtime)) || void 0 === _c ? void 0 : _c.pixelRatio) && void 0 !== _d ? _d : 1;
30044
30221
  }
30045
30222
  class TTEnvContribution extends BaseEnvContribution {
30046
30223
  constructor() {
30047
- super(), this.type = "tt", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
30224
+ super(), this.type = "tt", this.supportEvent = !0, this.canvasMap = new Map(), this.ttEnvParams = {}, this.supportsTouchEvents = !0;
30048
30225
  try {
30049
30226
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
30050
30227
  } catch (err) {
@@ -30052,8 +30229,8 @@
30052
30229
  }
30053
30230
  this.applyStyles = !0;
30054
30231
  }
30055
- configure(service, params) {
30056
- if (service.env === this.type) return service.setActiveEnvContribution(this), makeUpCanvas$1(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.component).then(() => {});
30232
+ configure(service, params = {}) {
30233
+ service.env === this.type && (service.setActiveEnvContribution(this), this.ttEnvParams = params);
30057
30234
  }
30058
30235
  loadImage(url) {
30059
30236
  return Promise.resolve({
@@ -30065,13 +30242,21 @@
30065
30242
  return Promise.reject();
30066
30243
  }
30067
30244
  createCanvas(params) {
30068
- const result = this.freeCanvasList[this.canvasIdx] || this.freeCanvasList[this.freeCanvasList.length - 1];
30069
- return this.canvasIdx++, result;
30245
+ var _a;
30246
+ const envParams = this.ttEnvParams,
30247
+ runtime = getTTRuntime(envParams),
30248
+ dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : getTTPixelRatio(envParams, runtime),
30249
+ factoryCanvas = createCanvasWithFactory(params, dpr, this.canvasMap, envParams.canvasFactory);
30250
+ if (factoryCanvas) return factoryCanvas;
30251
+ const options = getMiniAppCanvasOptions(params, dpr, !1);
30252
+ if (null == options.id || "function" != typeof (null == runtime ? void 0 : runtime.createCanvasContext)) throw new Error(TT_CANVAS_BRIDGE_ERROR);
30253
+ const canvas = wrapMiniAppContextCanvas(runtime.createCanvasContext(options.id), options);
30254
+ return this.canvasMap.set(options.id, canvas), canvas;
30070
30255
  }
30071
30256
  createOffscreenCanvas(params) {}
30072
30257
  releaseCanvas(canvas) {}
30073
30258
  getDevicePixelRatio() {
30074
- return tt.getSystemInfoSync().pixelRatio;
30259
+ return getTTPixelRatio(this.ttEnvParams);
30075
30260
  }
30076
30261
  getRequestAnimationFrame() {
30077
30262
  return function (callback) {
@@ -30192,7 +30377,12 @@
30192
30377
  createWindowByCanvas(params) {
30193
30378
  let canvas;
30194
30379
  if ("string" == typeof params.canvas) {
30195
- if (canvas = this.global.getElementById(params.canvas), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
30380
+ if (canvas = this.global.getElementById(params.canvas), canvas || (canvas = this.global.createCanvas({
30381
+ id: params.canvas,
30382
+ width: params.width,
30383
+ height: params.height,
30384
+ dpr: params.dpr
30385
+ })), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
30196
30386
  } else canvas = params.canvas;
30197
30387
  let width = params.width,
30198
30388
  height = params.height;
@@ -30270,55 +30460,22 @@
30270
30460
  (null === (_a = container.isBound) || void 0 === _a ? void 0 : _a.call(container, WxWindowHandlerContribution)) || container.bind(WxWindowHandlerContribution).toSelf(), (null === (_b = container.getNamed) || void 0 === _b ? void 0 : _b.call(container, WindowHandlerContribution, WxWindowHandlerContribution.env)) || container.bind(WindowHandlerContribution).toService(WxWindowHandlerContribution).whenTargetNamed(WxWindowHandlerContribution.env);
30271
30461
  }
30272
30462
 
30273
- var __awaiter$1 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
30274
- return new (P || (P = Promise))(function (resolve, reject) {
30275
- function fulfilled(value) {
30276
- try {
30277
- step(generator.next(value));
30278
- } catch (e) {
30279
- reject(e);
30280
- }
30281
- }
30282
- function rejected(value) {
30283
- try {
30284
- step(generator.throw(value));
30285
- } catch (e) {
30286
- reject(e);
30287
- }
30288
- }
30289
- function step(result) {
30290
- var value;
30291
- result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
30292
- resolve(value);
30293
- })).then(fulfilled, rejected);
30294
- }
30295
- step((generator = generator.apply(thisArg, _arguments || [])).next());
30296
- });
30297
- };
30298
- function makeUpCanvas(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, component, forceUpdate) {
30299
- return __awaiter$1(this, void 0, void 0, function* () {
30300
- const dpr = wx.getSystemInfoSync().pixelRatio;
30301
- for (let i = 0; i < canvasIdLists.length; i++) {
30302
- const id = canvasIdLists[i];
30303
- !forceUpdate && canvasMap.has(id) || (yield new Promise(resolve => {
30304
- let data = wx.createSelectorQuery();
30305
- component && (data = data.in(component)), data.select(`#${id}`).fields({
30306
- node: !0,
30307
- size: !0
30308
- }).exec(res => {
30309
- if (!res[0]) return;
30310
- const canvas = res[0].node,
30311
- width = res[0].width,
30312
- height = res[0].height;
30313
- canvas.width = width * dpr, canvas.height = height * dpr, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas), resolve(null);
30314
- });
30315
- }));
30316
- }
30317
- });
30463
+ const WX_CANVAS_BRIDGE_ERROR = "Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).";
30464
+ function getWxRuntime(params) {
30465
+ var _a, _b, _c;
30466
+ try {
30467
+ return null !== (_b = null !== (_a = null == params ? void 0 : params.wx) && void 0 !== _a ? _a : null == params ? void 0 : params.runtime) && void 0 !== _b ? _b : "undefined" != typeof wx ? wx : void 0;
30468
+ } catch (_d) {
30469
+ return null !== (_c = null == params ? void 0 : params.wx) && void 0 !== _c ? _c : null == params ? void 0 : params.runtime;
30470
+ }
30471
+ }
30472
+ function getWxPixelRatio(params, runtime = getWxRuntime(params)) {
30473
+ var _a, _b, _c, _d;
30474
+ return null !== (_d = null !== (_a = null == params ? void 0 : params.pixelRatio) && void 0 !== _a ? _a : null === (_c = null === (_b = null == runtime ? void 0 : runtime.getSystemInfoSync) || void 0 === _b ? void 0 : _b.call(runtime)) || void 0 === _c ? void 0 : _c.pixelRatio) && void 0 !== _d ? _d : 1;
30318
30475
  }
30319
30476
  class WxEnvContribution extends BaseEnvContribution {
30320
30477
  constructor() {
30321
- super(), this.type = "wx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
30478
+ super(), this.type = "wx", this.supportEvent = !0, this.canvasMap = new Map(), this.wxEnvParams = {}, this.supportsTouchEvents = !0;
30322
30479
  try {
30323
30480
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
30324
30481
  } catch (err) {
@@ -30326,8 +30483,8 @@
30326
30483
  }
30327
30484
  this.applyStyles = !0;
30328
30485
  }
30329
- configure(service, params) {
30330
- if (service.env === this.type) return service.setActiveEnvContribution(this), makeUpCanvas(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.component, params.forceUpdate).then(() => {});
30486
+ configure(service, params = {}) {
30487
+ service.env === this.type && (service.setActiveEnvContribution(this), this.wxEnvParams = params);
30331
30488
  }
30332
30489
  loadImage(url) {
30333
30490
  return Promise.resolve({
@@ -30342,13 +30499,21 @@
30342
30499
  });
30343
30500
  }
30344
30501
  createCanvas(params) {
30345
- const result = this.freeCanvasList[this.canvasIdx] || this.freeCanvasList[this.freeCanvasList.length - 1];
30346
- return this.canvasIdx++, result;
30502
+ var _a;
30503
+ const envParams = this.wxEnvParams,
30504
+ runtime = getWxRuntime(envParams),
30505
+ dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : getWxPixelRatio(envParams, runtime),
30506
+ factoryCanvas = createCanvasWithFactory(params, dpr, this.canvasMap, envParams.canvasFactory);
30507
+ if (factoryCanvas) return factoryCanvas;
30508
+ const options = getMiniAppCanvasOptions(params, dpr, !1);
30509
+ if (null == options.id || "function" != typeof (null == runtime ? void 0 : runtime.createCanvasContext)) throw new Error(WX_CANVAS_BRIDGE_ERROR);
30510
+ const canvas = wrapMiniAppContextCanvas(runtime.createCanvasContext(options.id), options);
30511
+ return this.canvasMap.set(options.id, canvas), canvas;
30347
30512
  }
30348
30513
  createOffscreenCanvas(params) {}
30349
30514
  releaseCanvas(canvas) {}
30350
30515
  getDevicePixelRatio() {
30351
- return wx.getSystemInfoSync().pixelRatio;
30516
+ return getWxPixelRatio(this.wxEnvParams);
30352
30517
  }
30353
30518
  getRequestAnimationFrame() {
30354
30519
  return function (callback) {
@@ -31396,7 +31561,7 @@
31396
31561
  }, params);
31397
31562
  };
31398
31563
 
31399
- var __rest$f = undefined && undefined.__rest || function (s, e) {
31564
+ var __rest$e = undefined && undefined.__rest || function (s, e) {
31400
31565
  var t = {};
31401
31566
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
31402
31567
  if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
@@ -31420,7 +31585,7 @@
31420
31585
  animation: animation,
31421
31586
  timeline: timeline
31422
31587
  } = _a,
31423
- props = __rest$f(_a, ["key", "name", "id", "attribute", "stateProxy", "animation", "timeline"]);
31588
+ props = __rest$e(_a, ["key", "name", "id", "attribute", "stateProxy", "animation", "timeline"]);
31424
31589
  let c = type;
31425
31590
  isString$1(type) && (c = graphicCreator$1[type]);
31426
31591
  const childrenList = [];
@@ -32871,187 +33036,6 @@
32871
33036
  loadLottieModule || (loadLottieModule = !0, container.bind(DefaultCanvasLottieRender).toDynamicValue(() => new DefaultCanvasLottieRender(createContributionProvider(RectRenderContribution, container))).inSingletonScope(), container.bind(GraphicRender).toService(DefaultCanvasLottieRender));
32872
33037
  }
32873
33038
 
32874
- var VRenderKitsRuntime = /*#__PURE__*/Object.freeze({
32875
- __proto__: null,
32876
- BrowserEnvContribution: BrowserEnvContribution,
32877
- CanvasArc3dPicker: CanvasArc3dPicker,
32878
- CanvasArcPicker: CanvasArcPicker,
32879
- CanvasAreaPicker: CanvasAreaPicker,
32880
- CanvasCirclePicker: CanvasCirclePicker,
32881
- CanvasGifImagePicker: CanvasGifImagePicker,
32882
- CanvasGlyphPicker: CanvasGlyphPicker,
32883
- CanvasGroupPicker: CanvasGroupPicker,
32884
- CanvasImagePicker: CanvasImagePicker,
32885
- CanvasLinePicker: CanvasLinePicker,
32886
- CanvasLottiePicker: CanvasLottiePicker,
32887
- CanvasPathPicker: CanvasPathPicker,
32888
- CanvasPickerContribution: CanvasPickerContribution,
32889
- CanvasPolygonPicker: CanvasPolygonPicker,
32890
- CanvasPyramid3dPicker: CanvasPyramid3dPicker,
32891
- CanvasRect3dPicker: CanvasRect3dPicker,
32892
- CanvasRectPicker: CanvasRectPicker,
32893
- CanvasRichTextPicker: CanvasRichTextPicker,
32894
- CanvasStarPicker: CanvasStarPicker,
32895
- CanvasSymbolPicker: CanvasSymbolPicker,
32896
- CanvasTextPicker: CanvasTextPicker,
32897
- DragNDrop: DragNDrop,
32898
- Fragment: Fragment,
32899
- Gesture: Gesture,
32900
- GifImage: GifImage,
32901
- Lottie: Lottie,
32902
- MathArcPicker: MathArcPicker,
32903
- MathAreaPicker: MathAreaPicker,
32904
- MathCirclePicker: MathCirclePicker,
32905
- MathGlyphPicker: MathGlyphPicker,
32906
- MathImagePicker: MathImagePicker,
32907
- MathLinePicker: MathLinePicker,
32908
- MathPathPicker: MathPathPicker,
32909
- MathPickerContribution: MathPickerContribution,
32910
- MathPolygonPicker: MathPolygonPicker,
32911
- MathRectPicker: MathRectPicker,
32912
- MathRichTextPicker: MathRichTextPicker,
32913
- MathSymbolPicker: MathSymbolPicker,
32914
- MathTextPicker: MathTextPicker,
32915
- REACT_TO_CANOPUS_EVENTS: REACT_TO_CANOPUS_EVENTS,
32916
- REACT_TO_CANOPUS_EVENTS_LIST: REACT_TO_CANOPUS_EVENTS_LIST,
32917
- VArc: VArc,
32918
- VArc3d: VArc3d,
32919
- VArea: VArea,
32920
- VCircle: VCircle,
32921
- VGlyph: VGlyph,
32922
- VGroup: VGroup,
32923
- VImage: VImage,
32924
- VLine: VLine,
32925
- VPath: VPath,
32926
- VPolygon: VPolygon,
32927
- VPyramid3d: VPyramid3d,
32928
- VRect: VRect,
32929
- VRect3d: VRect3d,
32930
- VRichText: VRichText,
32931
- VSymbol: VSymbol,
32932
- VText: VText,
32933
- _registerArc: _registerArc,
32934
- alternatingWave: alternatingWave,
32935
- bindArc3dCanvasPickerContribution: bindArc3dCanvasPickerContribution,
32936
- bindArcCanvasPickerContribution: bindArcCanvasPickerContribution,
32937
- bindArcMathPickerContribution: bindArcMathPickerContribution,
32938
- bindAreaCanvasPickerContribution: bindAreaCanvasPickerContribution,
32939
- bindAreaMathPickerContribution: bindAreaMathPickerContribution,
32940
- bindBrowserEnv: bindBrowserEnv,
32941
- bindCircleCanvasPickerContribution: bindCircleCanvasPickerContribution,
32942
- bindCircleMathPickerContribution: bindCircleMathPickerContribution,
32943
- bindFeishuEnv: bindFeishuEnv,
32944
- bindGifImageCanvasPickerContribution: bindGifImageCanvasPickerContribution,
32945
- bindGifImageRenderContribution: bindGifImageRenderContribution,
32946
- bindGlyphCanvasPickerContribution: bindGlyphCanvasPickerContribution,
32947
- bindGlyphMathPickerContribution: bindGlyphMathPickerContribution,
32948
- bindHarmonyEnv: bindHarmonyEnv,
32949
- bindImageCanvasPickerContribution: bindImageCanvasPickerContribution,
32950
- bindImageMathPickerContribution: bindImageMathPickerContribution,
32951
- bindLineCanvasPickerContribution: bindLineCanvasPickerContribution,
32952
- bindLineMathPickerContribution: bindLineMathPickerContribution,
32953
- bindLottieCanvasPickerContribution: bindLottieCanvasPickerContribution,
32954
- bindLottieRenderContribution: bindLottieRenderContribution,
32955
- bindLynxEnv: bindLynxEnv,
32956
- bindMathPicker: bindMathPicker,
32957
- bindNodeEnv: bindNodeEnv,
32958
- bindPathCanvasPickerContribution: bindPathCanvasPickerContribution,
32959
- bindPathMathPickerContribution: bindPathMathPickerContribution,
32960
- bindPolygonCanvasPickerContribution: bindPolygonCanvasPickerContribution,
32961
- bindPolygonMathPickerContribution: bindPolygonMathPickerContribution,
32962
- bindPyramid3dCanvasPickerContribution: bindPyramid3dCanvasPickerContribution,
32963
- bindRect3dCanvasPickerContribution: bindRect3dCanvasPickerContribution,
32964
- bindRectCanvasPickerContribution: bindRectCanvasPickerContribution,
32965
- bindRectMathPickerContribution: bindRectMathPickerContribution,
32966
- bindRichTextMathPickerContribution: bindRichTextMathPickerContribution,
32967
- bindRichtextCanvasPickerContribution: bindRichtextCanvasPickerContribution,
32968
- bindSymbolCanvasPickerContribution: bindSymbolCanvasPickerContribution,
32969
- bindSymbolMathPickerContribution: bindSymbolMathPickerContribution,
32970
- bindTTEnv: bindTTEnv,
32971
- bindTaroEnv: bindTaroEnv,
32972
- bindTextCanvasPickerContribution: bindTextCanvasPickerContribution,
32973
- bindTextMathPickerContribution: bindTextMathPickerContribution,
32974
- bindWxEnv: bindWxEnv,
32975
- centerToCorner: centerToCorner,
32976
- columnCenterToEdge: columnCenterToEdge,
32977
- columnEdgeToCenter: columnEdgeToCenter,
32978
- columnLeftToRight: columnLeftToRight,
32979
- columnRightToLeft: columnRightToLeft,
32980
- cornerToCenter: cornerToCenter,
32981
- createGifImage: createGifImage,
32982
- createImageElement: createImageElement$1,
32983
- createLottie: createLottie,
32984
- decodeReactDom: decodeReactDom,
32985
- diagonalCenterToEdge: diagonalCenterToEdge,
32986
- diagonalTopLeftToBottomRight: diagonalTopLeftToBottomRight,
32987
- initAllEnv: initAllEnv,
32988
- initBrowserEnv: initBrowserEnv,
32989
- initFeishuEnv: initFeishuEnv,
32990
- initHarmonyEnv: initHarmonyEnv,
32991
- initLynxEnv: initLynxEnv,
32992
- initNodeEnv: initNodeEnv,
32993
- initTTEnv: initTTEnv,
32994
- initTaroEnv: initTaroEnv,
32995
- initWxEnv: initWxEnv,
32996
- installBrowserEnvToApp: installBrowserEnvToApp,
32997
- installBrowserPickersToApp: installBrowserPickersToApp,
32998
- installDefaultGraphicsToApp: installDefaultGraphicsToApp,
32999
- installFeishuEnvToApp: installFeishuEnvToApp,
33000
- installHarmonyEnvToApp: installHarmonyEnvToApp,
33001
- installLynxEnvToApp: installLynxEnvToApp,
33002
- installMathPickersToApp: installMathPickersToApp,
33003
- installNodeEnvToApp: installNodeEnvToApp,
33004
- installNodePickersToApp: installNodePickersToApp,
33005
- installTTEnvToApp: installTTEnvToApp,
33006
- installTaroEnvToApp: installTaroEnvToApp,
33007
- installWxEnvToApp: installWxEnvToApp,
33008
- jsx: jsx,
33009
- loadAllEnv: loadAllEnv,
33010
- loadAllModule: loadAllModule,
33011
- loadBrowserEnv: loadBrowserEnv,
33012
- loadFeishuEnv: loadFeishuEnv,
33013
- loadHarmonyEnv: loadHarmonyEnv,
33014
- loadLynxEnv: loadLynxEnv,
33015
- loadMathPicker: loadMathPicker,
33016
- loadNodeEnv: loadNodeEnv,
33017
- loadTTEnv: loadTTEnv,
33018
- loadTaroEnv: loadTaroEnv,
33019
- loadWxEnv: loadWxEnv,
33020
- particleEffect: particleEffect,
33021
- pulseWave: pulseWave,
33022
- randomOpacity: randomOpacity,
33023
- registerArc: registerArc,
33024
- registerArc3d: registerArc3d,
33025
- registerArea: registerArea,
33026
- registerCircle: registerCircle,
33027
- registerGifGraphic: registerGifGraphic,
33028
- registerGifImage: registerGifImage,
33029
- registerGlyph: registerGlyph,
33030
- registerGroup: registerGroup,
33031
- registerImage: registerImage,
33032
- registerLine: registerLine,
33033
- registerPath: registerPath,
33034
- registerPolygon: registerPolygon,
33035
- registerPyramid3d: registerPyramid3d,
33036
- registerRect: registerRect,
33037
- registerRect3d: registerRect3d,
33038
- registerRichtext: registerRichtext,
33039
- registerShadowRoot: registerShadowRoot,
33040
- registerStar: registerStar,
33041
- registerSymbol: registerSymbol,
33042
- registerText: registerText,
33043
- registerWrapText: registerWrapText,
33044
- rippleEffect: rippleEffect,
33045
- rotationScan: rotationScan,
33046
- roughModule: roughModule,
33047
- rowBottomToTop: rowBottomToTop,
33048
- rowCenterToEdge: rowCenterToEdge,
33049
- rowEdgeToCenter: rowEdgeToCenter,
33050
- rowTopToBottom: rowTopToBottom,
33051
- snakeWave: snakeWave,
33052
- spiralEffect: spiralEffect
33053
- });
33054
-
33055
33039
  class Easing {
33056
33040
  constructor() {}
33057
33041
  static linear(t) {
@@ -37398,36 +37382,40 @@
37398
37382
  super(from, to, duration, easing, params);
37399
37383
  }
37400
37384
  onBind() {
37401
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
37385
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
37402
37386
  let from, to;
37403
37387
  super.onBind();
37404
37388
  const attrs = this.target.getFinalAttribute(),
37405
- fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {};
37406
- switch (null === (_b = this.params) || void 0 === _b ? void 0 : _b.direction) {
37389
+ fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {},
37390
+ options = null === (_b = this.params) || void 0 === _b ? void 0 : _b.options,
37391
+ direction = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.direction) && void 0 !== _d ? _d : null == options ? void 0 : options.direction,
37392
+ fromScaleX = null !== (_j = null !== (_g = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromScaleX) && void 0 !== _f ? _f : null == options ? void 0 : options.fromScaleX) && void 0 !== _g ? _g : null === (_h = this.params) || void 0 === _h ? void 0 : _h.fromScale) && void 0 !== _j ? _j : null == options ? void 0 : options.fromScale,
37393
+ fromScaleY = null !== (_p = null !== (_m = null !== (_l = null === (_k = this.params) || void 0 === _k ? void 0 : _k.fromScaleY) && void 0 !== _l ? _l : null == options ? void 0 : options.fromScaleY) && void 0 !== _m ? _m : null === (_o = this.params) || void 0 === _o ? void 0 : _o.fromScale) && void 0 !== _p ? _p : null == options ? void 0 : options.fromScale;
37394
+ switch (direction) {
37407
37395
  case "x":
37408
37396
  from = {
37409
- scaleX: null !== (_c = fromAttrs.scaleX) && void 0 !== _c ? _c : 0
37397
+ scaleX: null !== (_q = null != fromScaleX ? fromScaleX : fromAttrs.scaleX) && void 0 !== _q ? _q : 0
37410
37398
  }, to = {
37411
- scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1
37399
+ scaleX: null !== (_r = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _r ? _r : 1
37412
37400
  }, this._updateFunction = this.updateX;
37413
37401
  break;
37414
37402
  case "y":
37415
37403
  from = {
37416
- scaleY: null !== (_e = fromAttrs.scaleY) && void 0 !== _e ? _e : 0
37404
+ scaleY: null !== (_s = null != fromScaleY ? fromScaleY : fromAttrs.scaleY) && void 0 !== _s ? _s : 0
37417
37405
  }, to = {
37418
- scaleY: null !== (_f = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _f ? _f : 1
37406
+ scaleY: null !== (_t = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _t ? _t : 1
37419
37407
  }, this._updateFunction = this.updateY;
37420
37408
  break;
37421
37409
  default:
37422
37410
  from = {
37423
- scaleX: null !== (_g = fromAttrs.scaleX) && void 0 !== _g ? _g : 0,
37424
- scaleY: null !== (_h = fromAttrs.scaleY) && void 0 !== _h ? _h : 0
37411
+ scaleX: null !== (_u = null != fromScaleX ? fromScaleX : fromAttrs.scaleX) && void 0 !== _u ? _u : 0,
37412
+ scaleY: null !== (_v = null != fromScaleY ? fromScaleY : fromAttrs.scaleY) && void 0 !== _v ? _v : 0
37425
37413
  }, to = {
37426
- scaleX: null !== (_j = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _j ? _j : 1,
37427
- scaleY: null !== (_k = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _k ? _k : 1
37414
+ scaleX: null !== (_w = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _w ? _w : 1,
37415
+ scaleY: null !== (_x = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _x ? _x : 1
37428
37416
  }, this._updateFunction = this.updateXY;
37429
37417
  }
37430
- null === (_m = (_l = this.target).applyFinalAttributeToAttribute) || void 0 === _m || _m.call(_l), this.props = to, this.from = from, this.to = to, !1 !== (null === (_o = this.params.controlOptions) || void 0 === _o ? void 0 : _o.immediatelyApply) && applyAppearStartAttributes(this.target, from);
37418
+ null === (_z = (_y = this.target).applyFinalAttributeToAttribute) || void 0 === _z || _z.call(_y), this.props = to, this.from = from, this.to = to, !1 !== (null === (_0 = this.params.controlOptions) || void 0 === _0 ? void 0 : _0.immediatelyApply) && applyAppearStartAttributes(this.target, from);
37431
37419
  }
37432
37420
  onEnd(cb) {
37433
37421
  super.onEnd(cb);
@@ -40547,7 +40535,7 @@
40547
40535
  registerGroup(), registerRect(), registerSymbol(), registerRichtext(), registerText();
40548
40536
  }
40549
40537
 
40550
- var __rest$e = undefined && undefined.__rest || function (s, e) {
40538
+ var __rest$d = undefined && undefined.__rest || function (s, e) {
40551
40539
  var t = {};
40552
40540
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
40553
40541
  if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
@@ -40601,7 +40589,7 @@
40601
40589
  const {
40602
40590
  visible: shapeVisible
40603
40591
  } = shape,
40604
- shapeStyle = __rest$e(shape, ["visible"]);
40592
+ shapeStyle = __rest$d(shape, ["visible"]);
40605
40593
  if (isBoolean$1(shapeVisible)) {
40606
40594
  const size = (null == shapeStyle ? void 0 : shapeStyle.size) || 10,
40607
40595
  maxSize = isNumber$2(size) ? size : Math.max(size[0], size[1]);
@@ -40702,7 +40690,7 @@
40702
40690
  const {
40703
40691
  visible: bgVisible
40704
40692
  } = panel,
40705
- backgroundStyle = __rest$e(panel, ["visible"]);
40693
+ backgroundStyle = __rest$d(panel, ["visible"]);
40706
40694
  if (visible && isBoolean$1(bgVisible)) {
40707
40695
  const bgRect = this.createOrUpdateChild("tag-panel", Object.assign(Object.assign({}, backgroundStyle), {
40708
40696
  visible: bgVisible && !!text,
@@ -40784,7 +40772,7 @@
40784
40772
  merge(theme.poptip, DEFAULT_THEME, defaultPoptipTheme);
40785
40773
  }
40786
40774
 
40787
- var __rest$d = undefined && undefined.__rest || function (s, e) {
40775
+ var __rest$c = undefined && undefined.__rest || function (s, e) {
40788
40776
  var t = {};
40789
40777
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
40790
40778
  if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
@@ -40893,7 +40881,7 @@
40893
40881
  visible: bgVisible,
40894
40882
  square: square
40895
40883
  } = panel,
40896
- backgroundStyle = __rest$d(panel, ["visible", "square"]);
40884
+ backgroundStyle = __rest$c(panel, ["visible", "square"]);
40897
40885
  if (square) {
40898
40886
  const maxWH = max(popTipWidth, poptipHeight);
40899
40887
  popTipWidth = maxWH;
@@ -42874,7 +42862,7 @@
42874
42862
  registerGroup(), registerPath();
42875
42863
  }
42876
42864
 
42877
- var __rest$c = undefined && undefined.__rest || function (s, e) {
42865
+ var __rest$b = undefined && undefined.__rest || function (s, e) {
42878
42866
  var t = {};
42879
42867
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
42880
42868
  if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
@@ -42981,7 +42969,7 @@
42981
42969
  style: style,
42982
42970
  state: state
42983
42971
  } = _a,
42984
- restLineAttrs = __rest$c(_a, ["startSymbol", "endSymbol", "style", "state"]),
42972
+ restLineAttrs = __rest$b(_a, ["startSymbol", "endSymbol", "style", "state"]),
42985
42973
  lineAttrs = Object.assign({
42986
42974
  startSymbol: startSymbol,
42987
42975
  endSymbol: endSymbol,
@@ -43022,7 +43010,7 @@
43022
43010
  state = {},
43023
43011
  maxWidth: maxWidth
43024
43012
  } = _d,
43025
- restAttrs = __rest$c(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state", "maxWidth"]);
43013
+ restAttrs = __rest$b(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state", "maxWidth"]);
43026
43014
  let percent = .5;
43027
43015
  "start" === position ? percent = 0 : "end" === position && (percent = 1);
43028
43016
  const {
@@ -43124,7 +43112,7 @@
43124
43112
  text: textContent = "",
43125
43113
  maxWidth: maxWidth
43126
43114
  } = _c,
43127
- restAttrs = __rest$c(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
43115
+ restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
43128
43116
  point = this.getTickCoord(0);
43129
43117
  "bottom" === orient || "top" === orient ? point.x = position : point.y = position;
43130
43118
  let tickLength = 0;
@@ -43496,7 +43484,7 @@
43496
43484
  });
43497
43485
  }
43498
43486
 
43499
- var __rest$b = undefined && undefined.__rest || function (s, e) {
43487
+ var __rest$a = undefined && undefined.__rest || function (s, e) {
43500
43488
  var t = {};
43501
43489
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
43502
43490
  if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
@@ -43555,7 +43543,7 @@
43555
43543
  background: background,
43556
43544
  state = {}
43557
43545
  } = _d,
43558
- restAttrs = __rest$b(_d, ["space", "textStyle", "shape", "background", "state"]);
43546
+ restAttrs = __rest$a(_d, ["space", "textStyle", "shape", "background", "state"]);
43559
43547
  let titlePoint = center,
43560
43548
  labelHeight = 0;
43561
43549
  (null === (_a = this.attribute.label) || void 0 === _a ? void 0 : _a.visible) && !1 === this.attribute.label.inside && (labelHeight = get$1(this.attribute.label, "style.fontSize", 12) + get$1(this.attribute.label, "space", 4));
@@ -45114,15 +45102,6 @@
45114
45102
  return "left" === align ? 0 : "right" === align ? 1 : .5;
45115
45103
  }
45116
45104
 
45117
- var __rest$a = undefined && undefined.__rest || function (s, e) {
45118
- var t = {};
45119
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
45120
- if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
45121
- var i = 0;
45122
- for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
45123
- }
45124
- return t;
45125
- };
45126
45105
  class LabelUpdate extends AComponentAnimate {
45127
45106
  onBind() {
45128
45107
  const animator = createComponentAnimator(this.target);
@@ -45138,8 +45117,8 @@
45138
45117
  } = this.params,
45139
45118
  diff = {};
45140
45119
  for (const key in curText.attribute) prevText.attribute[key] !== curText.attribute[key] && (diff[key] = curText.attribute[key]);
45141
- const rest = __rest$a(diff, ["text"]);
45142
- animator.animate(prevText, {
45120
+ const rest = Object.assign({}, diff);
45121
+ delete rest.text, animator.animate(prevText, {
45143
45122
  type: "to",
45144
45123
  to: rest,
45145
45124
  duration: duration,
@@ -45369,14 +45348,6 @@
45369
45348
  }
45370
45349
  return t;
45371
45350
  };
45372
- function cloneAttributeSnapshot(value) {
45373
- if (!isObject$1(value) || isArray$1(value)) return value;
45374
- const snapshot = {};
45375
- return Object.keys(value).forEach(key => {
45376
- const nextValue = value[key];
45377
- snapshot[key] = isObject$1(nextValue) && !isArray$1(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
45378
- }), snapshot;
45379
- }
45380
45351
  loadLabelComponent();
45381
45352
  class LabelBase extends AnimateComponent {
45382
45353
  setBitmap(bitmap) {
@@ -45420,7 +45391,7 @@
45420
45391
  }
45421
45392
  labeling(textBounds, graphicBounds, position, offset) {}
45422
45393
  _getLabelLinePoints(text, baseMark) {
45423
- return connectLineBetweenBounds(text.AABBBounds, null == baseMark ? void 0 : baseMark.AABBBounds);
45394
+ return connectLineBetweenBounds(text.AABBBounds, this.getGraphicFinalLayoutBounds(baseMark));
45424
45395
  }
45425
45396
  _createLabelLine(text, baseMark) {
45426
45397
  const points = this._getLabelLinePoints(text, baseMark);
@@ -45488,11 +45459,8 @@
45488
45459
  }
45489
45460
  render() {
45490
45461
  if (this._exitReleaseState) return;
45491
- if (this._prepare(), isNil$1(this._idToGraphic) || this._isCollectionBase && isNil$1(this._idToPoint)) return;
45492
- const markAttributeList = [];
45493
- !1 !== this._enableAnimation && this._baseMarks.forEach(mark => {
45494
- markAttributeList.push(cloneAttributeSnapshot(mark.attribute)), mark.initAttributes(this.getGraphicFinalLayoutAttributes(mark));
45495
- });
45462
+ if (this._finalLayoutBoundsCache = void 0, this._prepare(), isNil$1(this._idToGraphic) || this._isCollectionBase && isNil$1(this._idToPoint)) return;
45463
+ this._finalLayoutBoundsCache = new Map();
45496
45464
  const {
45497
45465
  overlap: overlap,
45498
45466
  smartInvert: smartInvert,
@@ -45517,9 +45485,7 @@
45517
45485
  }
45518
45486
  isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(overlapLabels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this).concat(filteredLabels) : !1 !== overlap && (labels = this._overlapping(overlapLabels).concat(filteredLabels)), isFunction$1(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this), labels && labels.length && labels.forEach(label => {
45519
45487
  this._bindEvent(label), this._setStatesOfText(label);
45520
- }), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels), !1 !== this._enableAnimation && this._baseMarks.forEach((mark, index) => {
45521
- mark.initAttributes(markAttributeList[index]);
45522
- });
45488
+ }), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels), this._finalLayoutBoundsCache = void 0;
45523
45489
  }
45524
45490
  _bindEvent(target) {
45525
45491
  if (this.attribute.disableTriggerEvent) return;
@@ -45586,6 +45552,24 @@
45586
45552
  var _a;
45587
45553
  return !!(null === (_a = null == graphic ? void 0 : graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs);
45588
45554
  }
45555
+ shouldUseGraphicFinalLayoutAttributes(graphic) {
45556
+ var _a;
45557
+ return !!graphic && (!!(null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.animationState) || this.hasGraphicContextFinalLayoutAttributes(graphic));
45558
+ }
45559
+ getGraphicFinalLayoutBounds(graphic) {
45560
+ var _a, _b;
45561
+ if (!graphic) return;
45562
+ const useFinalAttrs = this.shouldUseGraphicFinalLayoutAttributes(graphic),
45563
+ graphicAttrs = useFinalAttrs ? this.getGraphicFinalLayoutAttributes(graphic) : graphic.attribute;
45564
+ if (!1 === (null == graphicAttrs ? void 0 : graphicAttrs.visible)) return;
45565
+ if (!useFinalAttrs) return graphic.AABBBounds;
45566
+ const cachedBounds = null === (_a = this._finalLayoutBoundsCache) || void 0 === _a ? void 0 : _a.get(graphic);
45567
+ if (cachedBounds) return cachedBounds;
45568
+ const clonedGraphic = graphic.clone();
45569
+ clonedGraphic.initAttributes(Object.assign(Object.assign({}, clonedGraphic.attribute), graphicAttrs));
45570
+ const bounds = clonedGraphic.AABBBounds;
45571
+ return null === (_b = this._finalLayoutBoundsCache) || void 0 === _b || _b.set(graphic, bounds), bounds;
45572
+ }
45589
45573
  _initText(data = []) {
45590
45574
  const {
45591
45575
  textStyle = {}
@@ -45733,7 +45717,8 @@
45733
45717
  result = [],
45734
45718
  checkBounds = strategy.some(s => "bound" === s.type);
45735
45719
  avoidBaseMark && (null === (_a = this._baseMarks) || void 0 === _a || _a.forEach(mark => {
45736
- mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, !0));
45720
+ const markBounds = this.getGraphicFinalLayoutBounds(mark);
45721
+ markBounds && bitmap.setRange(boundToRange(bmpTool, markBounds, !0));
45737
45722
  })), avoidMarks.length > 0 && avoidMarks.forEach(avoid => {
45738
45723
  isString$1(avoid) ? getNoneGroupMarksByName(this.getRootNode(), avoid).forEach(avoidMark => {
45739
45724
  avoidMark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoidMark.AABBBounds, !0));
@@ -45749,7 +45734,7 @@
45749
45734
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
45750
45735
  continue;
45751
45736
  }
45752
- if (checkBounds && baseMark && baseMark.AABBBounds && this._canPlaceInside(text.AABBBounds, baseMark.AABBBounds)) {
45737
+ if (checkBounds && baseMark && this._canPlaceInside(text.AABBBounds, this.getGraphicFinalLayoutBounds(baseMark))) {
45753
45738
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
45754
45739
  continue;
45755
45740
  }
@@ -45774,6 +45759,7 @@
45774
45759
  return result;
45775
45760
  }
45776
45761
  isMarkInsideRect(baseMark, bmpTool) {
45762
+ if (!baseMark) return !1;
45777
45763
  const {
45778
45764
  left: left,
45779
45765
  right: right,
@@ -45786,11 +45772,9 @@
45786
45772
  y1: -top,
45787
45773
  y2: bmpTool.height + bottom
45788
45774
  },
45789
- bounds = baseMark.AABBBounds;
45790
- if (0 !== bounds.width() && 0 !== bounds.height()) return isRectIntersect(baseMark.AABBBounds, rect, !0);
45791
- const {
45792
- attribute: attribute
45793
- } = baseMark;
45775
+ bounds = this.getGraphicFinalLayoutBounds(baseMark);
45776
+ if (bounds && 0 !== bounds.width() && 0 !== bounds.height()) return isRectIntersect(bounds, rect, !0);
45777
+ const attribute = this.shouldUseGraphicFinalLayoutAttributes(baseMark) ? this.getGraphicFinalLayoutAttributes(baseMark) : baseMark.attribute;
45794
45778
  if ("rect" === baseMark.type) {
45795
45779
  const {
45796
45780
  x: x,
@@ -45815,19 +45799,13 @@
45815
45799
  if (baseMarkGroupName) return this.getRootNode().find(node => node.name === baseMarkGroupName, !0);
45816
45800
  }
45817
45801
  getGraphicBounds(graphic, point = {}, position) {
45818
- var _a;
45819
45802
  if (graphic) {
45820
- if (!1 !== graphic.attribute.visible) {
45821
- if ((null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.animationState) || this.hasGraphicContextFinalLayoutAttributes(graphic)) {
45822
- const clonedGraphic = graphic.clone();
45823
- return Object.assign(clonedGraphic.attribute, this.getGraphicFinalLayoutAttributes(graphic)), clonedGraphic.AABBBounds;
45824
- }
45825
- return graphic.AABBBounds;
45826
- }
45803
+ const graphicAttrs = this.shouldUseGraphicFinalLayoutAttributes(graphic) ? this.getGraphicFinalLayoutAttributes(graphic) : graphic.attribute;
45804
+ if (!1 !== graphicAttrs.visible) return this.getGraphicFinalLayoutBounds(graphic);
45827
45805
  const {
45828
45806
  x: x,
45829
45807
  y: y
45830
- } = graphic.attribute;
45808
+ } = graphicAttrs;
45831
45809
  return {
45832
45810
  x1: x,
45833
45811
  x2: x,
@@ -46015,8 +45993,9 @@
46015
45993
  }
46016
45994
  const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode),
46017
45995
  similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor,
46018
- isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds),
46019
- isIntersect = !isInside && label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds);
45996
+ baseMarkBounds = this.getGraphicFinalLayoutBounds(baseMark),
45997
+ isInside = this._canPlaceInside(label.AABBBounds, baseMarkBounds),
45998
+ isIntersect = !isInside && label.AABBBounds && baseMarkBounds && baseMarkBounds.intersects(label.AABBBounds);
46020
45999
  if (isInside || outsideEnable || isIntersect && "inside" === interactInvertType) {
46021
46000
  const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
46022
46001
  if (fill && label.setAttributes({
@@ -48601,6 +48580,10 @@
48601
48580
  }
48602
48581
  }
48603
48582
 
48583
+ function getSegmentLineGraphics(segment) {
48584
+ var _a;
48585
+ return segment ? [...(null !== (_a = segment.lines) && void 0 !== _a ? _a : []), segment.line].filter(Boolean) : [];
48586
+ }
48604
48587
  function graphicFadeIn(graphic, delay, duration, easing) {
48605
48588
  var _a, _b, _c, _d, _e;
48606
48589
  if (!graphic) return;
@@ -48619,7 +48602,7 @@
48619
48602
  }, duration, easing);
48620
48603
  }
48621
48604
  function segmentFadeIn(segment, delay, duration, easing) {
48622
- segment && (graphicFadeIn(segment.startSymbol, delay, duration, easing), segment.lines.forEach(line => graphicFadeIn(line, delay, duration, easing)), graphicFadeIn(segment.line, delay, duration, easing), graphicFadeIn(segment.endSymbol, delay, duration, easing));
48605
+ segment && (graphicFadeIn(segment.startSymbol, delay, duration, easing), getSegmentLineGraphics(segment).forEach(line => graphicFadeIn(line, delay, duration, easing)), graphicFadeIn(segment.endSymbol, delay, duration, easing));
48623
48606
  }
48624
48607
  function tagFadeIn(tag, delay, duration, easing) {
48625
48608
  tag && (graphicFadeIn(tag.getTextShape(), delay, duration, easing), graphicFadeIn(tag.getBgRect(), delay, duration, easing));
@@ -48638,7 +48621,7 @@
48638
48621
  }, duration, easing));
48639
48622
  }
48640
48623
  function segmentFadeOut(segment, delay, duration, easing) {
48641
- segment && (graphicFadeOut(segment.startSymbol, delay, duration, easing), segment.lines.forEach(line => graphicFadeOut(line, delay, duration, easing)), graphicFadeOut(segment.line, delay, duration, easing), graphicFadeOut(segment.endSymbol, delay, duration, easing));
48624
+ segment && (graphicFadeOut(segment.startSymbol, delay, duration, easing), getSegmentLineGraphics(segment).forEach(line => graphicFadeOut(line, delay, duration, easing)), graphicFadeOut(segment.endSymbol, delay, duration, easing));
48642
48625
  }
48643
48626
  function tagFadeOut(tag, delay, duration, easing) {
48644
48627
  tag && (graphicFadeOut(tag.getTextShape(), delay, duration, easing), graphicFadeOut(tag.getBgRect(), delay, duration, easing));
@@ -48649,12 +48632,14 @@
48649
48632
  lineDuration = .7 * duration,
48650
48633
  endSymbolDuration = .1 * duration,
48651
48634
  labelDuration = .1 * duration;
48652
- graphicFadeIn(line.startSymbol, delay, startSymbolDuration, easing), line.lines.forEach(line => commitUpdateAnimationTarget(line, {
48635
+ graphicFadeIn(line.startSymbol, delay, startSymbolDuration, easing);
48636
+ const lines = getSegmentLineGraphics(line);
48637
+ lines.forEach(line => commitUpdateAnimationTarget(line, {
48653
48638
  clipRange: 1
48654
48639
  }, {
48655
48640
  clipRange: 0
48656
- })), line.lines.forEach((l, index) => {
48657
- const stepDuration = lineDuration / line.lines.length;
48641
+ })), lines.forEach((l, index) => {
48642
+ const stepDuration = lineDuration / lines.length;
48658
48643
  l.animate().wait(delay + startSymbolDuration + index * stepDuration).to({
48659
48644
  clipRange: 1
48660
48645
  }, stepDuration, easing);
@@ -48711,12 +48696,14 @@
48711
48696
  decorativeDuration = .05 * duration,
48712
48697
  endSymbolDuration = .1 * duration,
48713
48698
  labelDuration = .1 * duration;
48714
- graphicFadeIn(itemLine.startSymbol, delay, startSymbolDuration, easing), itemLine.lines.forEach(line => commitUpdateAnimationTarget(line, {
48699
+ graphicFadeIn(itemLine.startSymbol, delay, startSymbolDuration, easing);
48700
+ const lines = getSegmentLineGraphics(itemLine);
48701
+ lines.forEach(line => commitUpdateAnimationTarget(line, {
48715
48702
  clipRange: 1
48716
48703
  }, {
48717
48704
  clipRange: 0
48718
- })), itemLine.lines.forEach((l, index) => {
48719
- const stepDuration = lineDuration / itemLine.lines.length;
48705
+ })), lines.forEach((l, index) => {
48706
+ const stepDuration = lineDuration / lines.length;
48720
48707
  l.animate().wait(delay + startSymbolDuration + index * stepDuration).to({
48721
48708
  clipRange: 1
48722
48709
  }, stepDuration, easing);
@@ -55730,14 +55717,13 @@
55730
55717
  const BOOTSTRAP_STATE = Symbol.for('vrender.bootstrap.state');
55731
55718
  const installBrowserEnvToAppWithParams = installBrowserEnvToApp;
55732
55719
  const installNodeEnvToAppWithParams = installNodeEnvToApp;
55733
- const runtimeKits = VRenderKitsRuntime;
55734
55720
  const miniEnvBootstraps = {
55735
- taro: { installEnv: runtimeKits.installTaroEnvToApp, loadEnv: runtimeKits.loadTaroEnv },
55736
- feishu: { installEnv: runtimeKits.installFeishuEnvToApp, loadEnv: runtimeKits.loadFeishuEnv },
55737
- tt: { installEnv: runtimeKits.installTTEnvToApp, loadEnv: runtimeKits.loadTTEnv },
55738
- wx: { installEnv: runtimeKits.installWxEnvToApp, loadEnv: runtimeKits.loadWxEnv },
55739
- lynx: { installEnv: runtimeKits.installLynxEnvToApp, loadEnv: runtimeKits.loadLynxEnv },
55740
- harmony: { installEnv: runtimeKits.installHarmonyEnvToApp, loadEnv: runtimeKits.loadHarmonyEnv }
55721
+ taro: { installEnv: installTaroEnvToApp, loadEnv: loadTaroEnv },
55722
+ feishu: { installEnv: installFeishuEnvToApp, loadEnv: loadFeishuEnv },
55723
+ tt: { installEnv: installTTEnvToApp, loadEnv: loadTTEnv },
55724
+ wx: { installEnv: installWxEnvToApp, loadEnv: loadWxEnv },
55725
+ lynx: { installEnv: installLynxEnvToApp, loadEnv: loadLynxEnv },
55726
+ harmony: { installEnv: installHarmonyEnvToApp, loadEnv: loadHarmonyEnv }
55741
55727
  };
55742
55728
  const pluginRegistrations = [
55743
55729
  registerFlexLayoutPlugin,
@@ -55882,7 +55868,7 @@
55882
55868
  const bootstrap = miniEnvBootstraps[env];
55883
55869
  bootstrap.installEnv(app, envParams);
55884
55870
  installDefaultGraphicsToApp(app);
55885
- runtimeKits.installMathPickersToApp(app);
55871
+ installMathPickersToApp(app);
55886
55872
  bootstrap.loadEnv();
55887
55873
  legacyGraphicRegistrations.forEach(register => register());
55888
55874
  syncLegacyRenderersToApp(app);
@@ -56113,7 +56099,7 @@
56113
56099
  return resolveLegacyApp().createStage(params);
56114
56100
  }
56115
56101
 
56116
- const version = "1.1.0-alpha.22";
56102
+ const version = "1.1.0-alpha.24";
56117
56103
 
56118
56104
  exports.AComponentAnimate = AComponentAnimate;
56119
56105
  exports.ACustomAnimate = ACustomAnimate;