@visactor/vrender-kits 1.1.4-alpha.0 → 1.1.4-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/canvas/contributions/create-canvas-module.js +1 -1
- package/cjs/canvas/contributions/modules.js +1 -1
- package/cjs/env/contributions/canvas-wrap.js +1 -1
- package/cjs/env/contributions/feishu-contribution.js +1 -1
- package/dist/index.es.js +90 -30
- package/es/canvas/contributions/create-canvas-module.js +1 -1
- package/es/canvas/contributions/modules.js +1 -1
- package/es/env/contributions/canvas-wrap.js +1 -1
- package/es/env/contributions/feishu-contribution.js +1 -1
- package/package.json +4 -4
|
@@ -45,4 +45,4 @@ exports.loadAllCavnvas = loadAllCavnvas, exports.loadBrowserCanvas = loadBrowser
|
|
|
45
45
|
exports.loadFeishuCanvas = loadFeishuCanvas, exports.loadLynxCanvas = loadLynxCanvas,
|
|
46
46
|
exports.loadNodeCanvas = loadNodeCanvas, exports.loadTaroCanvas = loadTaroCanvas,
|
|
47
47
|
exports.loadTTCanvas = loadTTCanvas, exports.loadWxCanvas = loadWxCanvas;
|
|
48
|
-
//# sourceMappingURL=modules.js.map
|
|
48
|
+
//# sourceMappingURL=modules.js.map
|
package/dist/index.es.js
CHANGED
|
@@ -4496,13 +4496,14 @@ function applyFillStyle(ctx, character, b) {
|
|
|
4496
4496
|
}) : fillStyle, setTextStyle(ctx, character);
|
|
4497
4497
|
}
|
|
4498
4498
|
function applyStrokeStyle(ctx, character) {
|
|
4499
|
+
var _a, _b;
|
|
4499
4500
|
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
4500
4501
|
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
4501
4502
|
const {
|
|
4502
4503
|
strokeOpacity = 1,
|
|
4503
4504
|
opacity = 1
|
|
4504
4505
|
} = character;
|
|
4505
|
-
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
4506
|
+
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.setLineDash(null !== (_a = character.lineDash) && void 0 !== _a ? _a : []), ctx.lineDashOffset = null !== (_b = character.lineDashOffset) && void 0 !== _b ? _b : 0, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
4506
4507
|
}
|
|
4507
4508
|
function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
|
|
4508
4509
|
if (desc.length <= 1) return 0;
|
|
@@ -6286,7 +6287,7 @@ class Node extends EventEmitter {
|
|
|
6286
6287
|
constructor() {
|
|
6287
6288
|
super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
|
|
6288
6289
|
}
|
|
6289
|
-
onParentSharedStateTreeChanged(_stage, _layer) {}
|
|
6290
|
+
onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
|
|
6290
6291
|
forEachChildren(cb, reverse = !1) {
|
|
6291
6292
|
if (reverse) {
|
|
6292
6293
|
let child = this._lastChild,
|
|
@@ -8208,6 +8209,8 @@ class StateEngine {
|
|
|
8208
8209
|
this.graphic === graphic && this.baseAttributes === baseAttributes || this.invalidateResolverCache(), this.graphic = graphic, this.baseAttributes = baseAttributes;
|
|
8209
8210
|
}
|
|
8210
8211
|
applyStates(stateNames) {
|
|
8212
|
+
const singleStaticStateResult = this.tryApplySingleStaticState(stateNames);
|
|
8213
|
+
if (singleStaticStateResult) return singleStaticStateResult;
|
|
8211
8214
|
const uniqueStates = Array.from(new Set(stateNames)),
|
|
8212
8215
|
sortedStates = this.sortStates(uniqueStates),
|
|
8213
8216
|
adjudicated = this.adjudicate(sortedStates),
|
|
@@ -8222,6 +8225,19 @@ class StateEngine {
|
|
|
8222
8225
|
suppressed: [...this._suppressed]
|
|
8223
8226
|
};
|
|
8224
8227
|
}
|
|
8228
|
+
tryApplySingleStaticState(stateNames) {
|
|
8229
|
+
if (1 !== stateNames.length || "shallow" !== this.mergeMode) return;
|
|
8230
|
+
const stateName = stateNames[0],
|
|
8231
|
+
definition = this.compiledDefinitions.get(stateName);
|
|
8232
|
+
if (definition && (definition.hasResolver || definition.exclude.size || definition.suppress.size)) return;
|
|
8233
|
+
const changed = 1 !== this._activeStates.length || this._activeStates[0] !== stateName || 1 !== this._effectiveStates.length || this._effectiveStates[0] !== stateName || 0 !== this._suppressed.length;
|
|
8234
|
+
return this._activeStates = [stateName], this._effectiveStates = [stateName], this._suppressed = [], !changed && this.resolverCacheValid || (this.resolverPatchCache.clear(), this.resolverCacheKey = stateName, this.resolverCacheValid = !0, this._resolvedPatch = (null == definition ? void 0 : definition.patch) ? cloneValue(definition.patch) : {}), {
|
|
8235
|
+
changed: changed,
|
|
8236
|
+
activeStates: [...this._activeStates],
|
|
8237
|
+
effectiveStates: [...this._effectiveStates],
|
|
8238
|
+
suppressed: []
|
|
8239
|
+
};
|
|
8240
|
+
}
|
|
8225
8241
|
addState(stateName, keepCurrentStates) {
|
|
8226
8242
|
if (this._activeStates.includes(stateName) && (keepCurrentStates || 1 === this._activeStates.length)) return {
|
|
8227
8243
|
changed: !1,
|
|
@@ -8573,12 +8589,12 @@ const NOWORK_ANIMATE_ATTR = {
|
|
|
8573
8589
|
cursor: 1,
|
|
8574
8590
|
html: 1
|
|
8575
8591
|
};
|
|
8576
|
-
class
|
|
8592
|
+
class GraphicImpl extends Node {
|
|
8577
8593
|
static mixin(source) {
|
|
8578
8594
|
const keys = Object.keys(source);
|
|
8579
8595
|
for (let i = 0; i < keys.length; ++i) {
|
|
8580
8596
|
const propertyName = keys[i];
|
|
8581
|
-
Object.defineProperty(
|
|
8597
|
+
Object.defineProperty(this.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
|
|
8582
8598
|
}
|
|
8583
8599
|
}
|
|
8584
8600
|
get AABBBounds() {
|
|
@@ -8634,14 +8650,17 @@ class Graphic extends Node {
|
|
|
8634
8650
|
}
|
|
8635
8651
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
8636
8652
|
}
|
|
8637
|
-
|
|
8653
|
+
syncSharedStateScopeBinding(nextScope, markDirty = !0) {
|
|
8638
8654
|
var _a;
|
|
8639
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
8640
8655
|
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.syncSharedStateActiveRegistrations(), markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(), !0);
|
|
8641
8656
|
}
|
|
8642
|
-
|
|
8657
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
|
|
8658
|
+
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
8659
|
+
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
8660
|
+
}
|
|
8661
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
8643
8662
|
var _a, _b;
|
|
8644
|
-
return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty);
|
|
8663
|
+
return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty, inheritedSharedStateScope);
|
|
8645
8664
|
}
|
|
8646
8665
|
syncSharedStateActiveRegistrations() {
|
|
8647
8666
|
var _a;
|
|
@@ -8649,6 +8668,7 @@ class Graphic extends Node {
|
|
|
8649
8668
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
|
|
8650
8669
|
scope.subtreeActiveDescendants.delete(this);
|
|
8651
8670
|
}), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
8671
|
+
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
8652
8672
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
8653
8673
|
null == previousScopes || previousScopes.forEach(scope => {
|
|
8654
8674
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -8656,6 +8676,15 @@ class Graphic extends Node {
|
|
|
8656
8676
|
scope.subtreeActiveDescendants.add(this);
|
|
8657
8677
|
}), this.registeredActiveScopes = nextScopes;
|
|
8658
8678
|
}
|
|
8679
|
+
isSharedStateScopeChainRegistered(previousScopes) {
|
|
8680
|
+
let scope = this.boundSharedStateScope,
|
|
8681
|
+
scopeCount = 0;
|
|
8682
|
+
for (; scope;) {
|
|
8683
|
+
if (!previousScopes.has(scope)) return !1;
|
|
8684
|
+
scopeCount += 1, scope = scope.parentScope;
|
|
8685
|
+
}
|
|
8686
|
+
return scopeCount === previousScopes.size;
|
|
8687
|
+
}
|
|
8659
8688
|
clearSharedStateActiveRegistrations() {
|
|
8660
8689
|
const previousScopes = this.registeredActiveScopes;
|
|
8661
8690
|
previousScopes && (previousScopes.forEach(scope => {
|
|
@@ -8665,8 +8694,8 @@ class Graphic extends Node {
|
|
|
8665
8694
|
markSharedStateDirty() {
|
|
8666
8695
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
8667
8696
|
}
|
|
8668
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
8669
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
8697
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
8698
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
|
|
8670
8699
|
}
|
|
8671
8700
|
refreshSharedStateBeforeRender() {
|
|
8672
8701
|
var _a;
|
|
@@ -9317,6 +9346,10 @@ class Graphic extends Node {
|
|
|
9317
9346
|
var _a;
|
|
9318
9347
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
9319
9348
|
}
|
|
9349
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
9350
|
+
var _a;
|
|
9351
|
+
this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions, this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1), this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
9352
|
+
}
|
|
9320
9353
|
getStateResolveBaseAttrs() {
|
|
9321
9354
|
var _a;
|
|
9322
9355
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -9510,8 +9543,10 @@ class Graphic extends Node {
|
|
|
9510
9543
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
9511
9544
|
}
|
|
9512
9545
|
addState(stateName, keepCurrentStates, hasAnimation) {
|
|
9513
|
-
const
|
|
9514
|
-
|
|
9546
|
+
const currentStates = this.currentStates;
|
|
9547
|
+
if ((null == currentStates ? void 0 : currentStates.includes(stateName)) && (keepCurrentStates || 1 === currentStates.length)) return;
|
|
9548
|
+
const nextStates = keepCurrentStates && (null == currentStates ? void 0 : currentStates.length) ? currentStates.concat([stateName]) : [stateName];
|
|
9549
|
+
this.useStates(nextStates, hasAnimation);
|
|
9515
9550
|
}
|
|
9516
9551
|
setStates(states, options) {
|
|
9517
9552
|
var _a, _b, _c;
|
|
@@ -9664,12 +9699,12 @@ class Graphic extends Node {
|
|
|
9664
9699
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
9665
9700
|
}
|
|
9666
9701
|
}
|
|
9667
|
-
setStage(stage, layer) {
|
|
9702
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
9668
9703
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
9669
9704
|
const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
|
|
9670
9705
|
previousStage = this.stage;
|
|
9671
9706
|
if (this.stage !== stage || this.layer !== layer) {
|
|
9672
|
-
if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
9707
|
+
if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
9673
9708
|
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
9674
9709
|
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
9675
9710
|
detachedStageAnimates = [];
|
|
@@ -9686,7 +9721,7 @@ class Graphic extends Node {
|
|
|
9686
9721
|
}
|
|
9687
9722
|
return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_h = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _h || _h.call(graphicService, this, stage));
|
|
9688
9723
|
}
|
|
9689
|
-
((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0);
|
|
9724
|
+
((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope);
|
|
9690
9725
|
}
|
|
9691
9726
|
detachStageForRelease() {
|
|
9692
9727
|
var _a, _b, _c;
|
|
@@ -9817,13 +9852,26 @@ class Graphic extends Node {
|
|
|
9817
9852
|
return null;
|
|
9818
9853
|
}
|
|
9819
9854
|
}
|
|
9855
|
+
GraphicImpl.userSymbolMap = {};
|
|
9856
|
+
const GRAPHIC_CLASS_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-class");
|
|
9857
|
+
function createGraphicClassState() {
|
|
9858
|
+
return {
|
|
9859
|
+
Graphic: GraphicImpl
|
|
9860
|
+
};
|
|
9861
|
+
}
|
|
9862
|
+
function getGraphicClassState() {
|
|
9863
|
+
var _a;
|
|
9864
|
+
const globalScope = globalThis;
|
|
9865
|
+
return null !== (_a = globalScope[GRAPHIC_CLASS_SYMBOL]) && void 0 !== _a || (globalScope[GRAPHIC_CLASS_SYMBOL] = createGraphicClassState()), globalScope[GRAPHIC_CLASS_SYMBOL];
|
|
9866
|
+
}
|
|
9867
|
+
const Graphic = getGraphicClassState().Graphic;
|
|
9820
9868
|
function backgroundNotImage(image) {
|
|
9821
9869
|
return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl(image) || image.includes("/") || isBase64(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
|
|
9822
9870
|
}
|
|
9823
9871
|
function isExternalTexture(texture) {
|
|
9824
9872
|
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl(texture) || texture.includes("/") || isBase64(texture)) : isObject(texture));
|
|
9825
9873
|
}
|
|
9826
|
-
Graphic.
|
|
9874
|
+
Graphic.mixin(EventTarget);
|
|
9827
9875
|
|
|
9828
9876
|
const defaultThemeObj = {
|
|
9829
9877
|
arc: DefaultArcAttribute,
|
|
@@ -10062,17 +10110,17 @@ class Group extends Graphic {
|
|
|
10062
10110
|
}
|
|
10063
10111
|
incrementalAppendChild(node) {
|
|
10064
10112
|
const data = super.appendChild(node);
|
|
10065
|
-
return data && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
10113
|
+
return data && this.shouldSyncChildSharedStateTreeBinding(data) && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
10066
10114
|
}
|
|
10067
10115
|
incrementalClearChild() {
|
|
10068
10116
|
super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
|
|
10069
10117
|
}
|
|
10070
10118
|
_updateChildToStage(child) {
|
|
10071
|
-
return child && this.syncChildSharedStateTreeBinding(child), this.addUpdateBoundTag(), child;
|
|
10119
|
+
return child && this.shouldSyncChildSharedStateTreeBinding(child) && this.syncChildSharedStateTreeBinding(child), this.addUpdateBoundTag(), child;
|
|
10072
10120
|
}
|
|
10073
10121
|
appendChild(node, addStage = !0) {
|
|
10074
10122
|
const data = super.appendChild(node);
|
|
10075
|
-
return data && addStage && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), data;
|
|
10123
|
+
return data && addStage && this.shouldSyncChildSharedStateTreeBinding(data) && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), data;
|
|
10076
10124
|
}
|
|
10077
10125
|
insertBefore(newNode, referenceNode) {
|
|
10078
10126
|
return this._updateChildToStage(super.insertBefore(newNode, referenceNode));
|
|
@@ -10095,13 +10143,13 @@ class Group extends Graphic {
|
|
|
10095
10143
|
child.setStage(null, null);
|
|
10096
10144
|
}), this.addUpdateBoundTag();
|
|
10097
10145
|
}
|
|
10098
|
-
setStage(stage, layer) {
|
|
10146
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
10099
10147
|
var _a, _b, _c, _d, _e, _f;
|
|
10100
10148
|
const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
|
|
10101
10149
|
needsSharedStateTreeSync = this.hasSharedStateDefinitions() || this.sharedStateScope || (null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty;
|
|
10102
|
-
if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged();
|
|
10150
|
+
if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
10103
10151
|
const layerChanged = this.layer !== layer;
|
|
10104
|
-
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
10152
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
10105
10153
|
}
|
|
10106
10154
|
addUpdatePositionTag() {
|
|
10107
10155
|
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
@@ -10160,17 +10208,29 @@ class Group extends Graphic {
|
|
|
10160
10208
|
hasSharedStateDefinitions() {
|
|
10161
10209
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
10162
10210
|
}
|
|
10163
|
-
|
|
10211
|
+
resolveChildSharedStateScope(inheritedSharedStateScope) {
|
|
10212
|
+
var _a;
|
|
10213
|
+
return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
|
|
10214
|
+
}
|
|
10215
|
+
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
10216
|
+
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
10164
10217
|
this.forEachChildren(item => {
|
|
10165
|
-
this.
|
|
10218
|
+
this.setStageToChild(item, childSharedStateScope);
|
|
10166
10219
|
});
|
|
10167
10220
|
}
|
|
10168
|
-
|
|
10169
|
-
|
|
10221
|
+
shouldSyncChildSharedStateTreeBinding(child) {
|
|
10222
|
+
return !(!this.stage && !this.layer) || child.onParentSharedStateTreeChanged !== Graphic.prototype.onParentSharedStateTreeChanged && child.onParentSharedStateTreeChanged !== Group.prototype.onParentSharedStateTreeChanged;
|
|
10170
10223
|
}
|
|
10171
|
-
|
|
10224
|
+
setStageToChild(child, inheritedSharedStateScope) {
|
|
10225
|
+
const graphic = child;
|
|
10226
|
+
"function" != typeof graphic.setStage || child.onParentSharedStateTreeChanged !== Graphic.prototype.onParentSharedStateTreeChanged && child.onParentSharedStateTreeChanged !== Group.prototype.onParentSharedStateTreeChanged || graphic.stage === this.stage && graphic.layer === this.layer ? child.onParentSharedStateTreeChanged(this.stage, this.layer, inheritedSharedStateScope) : graphic.setStage(this.stage, this.layer, inheritedSharedStateScope);
|
|
10227
|
+
}
|
|
10228
|
+
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
10229
|
+
void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
|
|
10230
|
+
}
|
|
10231
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
10172
10232
|
var _a;
|
|
10173
|
-
this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)), this.notifyChildrenSharedStateTreeChanged()) : this.setStage(stage, layer);
|
|
10233
|
+
this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length), inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : this.setStage(stage, layer, inheritedSharedStateScope);
|
|
10174
10234
|
}
|
|
10175
10235
|
}
|
|
10176
10236
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -13544,8 +13604,8 @@ class RichText extends Graphic {
|
|
|
13544
13604
|
clone() {
|
|
13545
13605
|
return new RichText(Object.assign({}, this.attribute));
|
|
13546
13606
|
}
|
|
13547
|
-
setStage(stage, layer) {
|
|
13548
|
-
super.setStage(stage, layer);
|
|
13607
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
13608
|
+
super.setStage(stage, layer, inheritedSharedStateScope);
|
|
13549
13609
|
this.getFrameCache().icons.forEach(icon => {
|
|
13550
13610
|
icon.setStage(stage, layer);
|
|
13551
13611
|
});
|
|
@@ -8,4 +8,4 @@ export function createModule(CanvasConstructor, ContextConstructor) {
|
|
|
8
8
|
hasContextFactory || bindingContainer.bind(Context2dFactory).toDynamicValue((() => (params, dpr) => new ContextConstructor(params, dpr))).whenTargetNamed(ContextConstructor.env);
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=create-canvas-module.js.map
|
|
11
|
+
//# sourceMappingURL=create-canvas-module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-kits",
|
|
3
|
-
"version": "1.1.4-alpha.
|
|
3
|
+
"version": "1.1.4-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index-node.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@visactor/vutils": "~1.0.12",
|
|
47
|
-
"@visactor/vrender-core": "1.1.4-alpha.
|
|
47
|
+
"@visactor/vrender-core": "1.1.4-alpha.2",
|
|
48
48
|
"@resvg/resvg-js": "2.4.1",
|
|
49
49
|
"roughjs": "4.6.6",
|
|
50
50
|
"gifuct-js": "2.1.2",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"vite": "3.2.6",
|
|
70
70
|
"typescript": "4.9.5",
|
|
71
71
|
"cross-env": "^7.0.3",
|
|
72
|
-
"@internal/eslint-config": "0.0.1",
|
|
73
72
|
"@internal/ts-config": "0.0.1",
|
|
74
|
-
"@internal/bundler": "0.0.1"
|
|
73
|
+
"@internal/bundler": "0.0.1",
|
|
74
|
+
"@internal/eslint-config": "0.0.1"
|
|
75
75
|
},
|
|
76
76
|
"keywords": [
|
|
77
77
|
"VisActor",
|