@visactor/vrender-kits 1.1.5 → 1.1.6-alpha.0
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.es.js +47 -21
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -6287,7 +6287,7 @@ class Node extends EventEmitter {
|
|
|
6287
6287
|
constructor() {
|
|
6288
6288
|
super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
|
|
6289
6289
|
}
|
|
6290
|
-
onParentSharedStateTreeChanged(_stage, _layer) {}
|
|
6290
|
+
onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
|
|
6291
6291
|
forEachChildren(cb, reverse = !1) {
|
|
6292
6292
|
if (reverse) {
|
|
6293
6293
|
let child = this._lastChild,
|
|
@@ -8635,14 +8635,17 @@ class GraphicImpl extends Node {
|
|
|
8635
8635
|
}
|
|
8636
8636
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
8637
8637
|
}
|
|
8638
|
-
|
|
8638
|
+
syncSharedStateScopeBinding(nextScope, markDirty = !0) {
|
|
8639
8639
|
var _a;
|
|
8640
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
8641
8640
|
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);
|
|
8642
8641
|
}
|
|
8643
|
-
|
|
8642
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
|
|
8643
|
+
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
8644
|
+
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
8645
|
+
}
|
|
8646
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
8644
8647
|
var _a, _b;
|
|
8645
|
-
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);
|
|
8648
|
+
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);
|
|
8646
8649
|
}
|
|
8647
8650
|
syncSharedStateActiveRegistrations() {
|
|
8648
8651
|
var _a;
|
|
@@ -8650,6 +8653,7 @@ class GraphicImpl extends Node {
|
|
|
8650
8653
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
|
|
8651
8654
|
scope.subtreeActiveDescendants.delete(this);
|
|
8652
8655
|
}), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
8656
|
+
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
8653
8657
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
8654
8658
|
null == previousScopes || previousScopes.forEach(scope => {
|
|
8655
8659
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -8657,6 +8661,15 @@ class GraphicImpl extends Node {
|
|
|
8657
8661
|
scope.subtreeActiveDescendants.add(this);
|
|
8658
8662
|
}), this.registeredActiveScopes = nextScopes;
|
|
8659
8663
|
}
|
|
8664
|
+
isSharedStateScopeChainRegistered(previousScopes) {
|
|
8665
|
+
let scope = this.boundSharedStateScope,
|
|
8666
|
+
scopeCount = 0;
|
|
8667
|
+
for (; scope;) {
|
|
8668
|
+
if (!previousScopes.has(scope)) return !1;
|
|
8669
|
+
scopeCount += 1, scope = scope.parentScope;
|
|
8670
|
+
}
|
|
8671
|
+
return scopeCount === previousScopes.size;
|
|
8672
|
+
}
|
|
8660
8673
|
clearSharedStateActiveRegistrations() {
|
|
8661
8674
|
const previousScopes = this.registeredActiveScopes;
|
|
8662
8675
|
previousScopes && (previousScopes.forEach(scope => {
|
|
@@ -8666,8 +8679,8 @@ class GraphicImpl extends Node {
|
|
|
8666
8679
|
markSharedStateDirty() {
|
|
8667
8680
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
8668
8681
|
}
|
|
8669
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
8670
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
8682
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
8683
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
|
|
8671
8684
|
}
|
|
8672
8685
|
refreshSharedStateBeforeRender() {
|
|
8673
8686
|
var _a;
|
|
@@ -9318,6 +9331,10 @@ class GraphicImpl extends Node {
|
|
|
9318
9331
|
var _a;
|
|
9319
9332
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
9320
9333
|
}
|
|
9334
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
9335
|
+
var _a;
|
|
9336
|
+
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}`;
|
|
9337
|
+
}
|
|
9321
9338
|
getStateResolveBaseAttrs() {
|
|
9322
9339
|
var _a;
|
|
9323
9340
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -9665,12 +9682,12 @@ class GraphicImpl extends Node {
|
|
|
9665
9682
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
9666
9683
|
}
|
|
9667
9684
|
}
|
|
9668
|
-
setStage(stage, layer) {
|
|
9685
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
9669
9686
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
9670
9687
|
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,
|
|
9671
9688
|
previousStage = this.stage;
|
|
9672
9689
|
if (this.stage !== stage || this.layer !== layer) {
|
|
9673
|
-
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()) {
|
|
9690
|
+
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()) {
|
|
9674
9691
|
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
9675
9692
|
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
9676
9693
|
detachedStageAnimates = [];
|
|
@@ -9687,7 +9704,7 @@ class GraphicImpl extends Node {
|
|
|
9687
9704
|
}
|
|
9688
9705
|
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));
|
|
9689
9706
|
}
|
|
9690
|
-
((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);
|
|
9707
|
+
((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);
|
|
9691
9708
|
}
|
|
9692
9709
|
detachStageForRelease() {
|
|
9693
9710
|
var _a, _b, _c;
|
|
@@ -10109,13 +10126,13 @@ class Group extends Graphic {
|
|
|
10109
10126
|
child.setStage(null, null);
|
|
10110
10127
|
}), this.addUpdateBoundTag();
|
|
10111
10128
|
}
|
|
10112
|
-
setStage(stage, layer) {
|
|
10129
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
10113
10130
|
var _a, _b, _c, _d, _e, _f;
|
|
10114
10131
|
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,
|
|
10115
10132
|
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;
|
|
10116
|
-
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();
|
|
10133
|
+
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);
|
|
10117
10134
|
const layerChanged = this.layer !== layer;
|
|
10118
|
-
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
10135
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
10119
10136
|
}
|
|
10120
10137
|
addUpdatePositionTag() {
|
|
10121
10138
|
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
@@ -10174,17 +10191,26 @@ class Group extends Graphic {
|
|
|
10174
10191
|
hasSharedStateDefinitions() {
|
|
10175
10192
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
10176
10193
|
}
|
|
10177
|
-
|
|
10194
|
+
resolveChildSharedStateScope(inheritedSharedStateScope) {
|
|
10195
|
+
var _a;
|
|
10196
|
+
return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
|
|
10197
|
+
}
|
|
10198
|
+
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
10199
|
+
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
10178
10200
|
this.forEachChildren(item => {
|
|
10179
|
-
this.
|
|
10201
|
+
this.setStageToChild(item, childSharedStateScope);
|
|
10180
10202
|
});
|
|
10181
10203
|
}
|
|
10182
|
-
|
|
10183
|
-
child
|
|
10204
|
+
setStageToChild(child, inheritedSharedStateScope) {
|
|
10205
|
+
const graphic = child;
|
|
10206
|
+
"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);
|
|
10184
10207
|
}
|
|
10185
|
-
|
|
10208
|
+
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
10209
|
+
void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
|
|
10210
|
+
}
|
|
10211
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
10186
10212
|
var _a;
|
|
10187
|
-
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);
|
|
10213
|
+
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);
|
|
10188
10214
|
}
|
|
10189
10215
|
}
|
|
10190
10216
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -13558,8 +13584,8 @@ class RichText extends Graphic {
|
|
|
13558
13584
|
clone() {
|
|
13559
13585
|
return new RichText(Object.assign({}, this.attribute));
|
|
13560
13586
|
}
|
|
13561
|
-
setStage(stage, layer) {
|
|
13562
|
-
super.setStage(stage, layer);
|
|
13587
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
13588
|
+
super.setStage(stage, layer, inheritedSharedStateScope);
|
|
13563
13589
|
this.getFrameCache().icons.forEach(icon => {
|
|
13564
13590
|
icon.setStage(stage, layer);
|
|
13565
13591
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-kits",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6-alpha.0",
|
|
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.
|
|
47
|
+
"@visactor/vrender-core": "1.1.6-alpha.0",
|
|
48
48
|
"@resvg/resvg-js": "2.4.1",
|
|
49
49
|
"roughjs": "4.6.6",
|
|
50
50
|
"gifuct-js": "2.1.2",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"typescript": "4.9.5",
|
|
71
71
|
"cross-env": "^7.0.3",
|
|
72
72
|
"@internal/bundler": "0.0.1",
|
|
73
|
-
"@internal/
|
|
74
|
-
"@internal/
|
|
73
|
+
"@internal/eslint-config": "0.0.1",
|
|
74
|
+
"@internal/ts-config": "0.0.1"
|
|
75
75
|
},
|
|
76
76
|
"keywords": [
|
|
77
77
|
"VisActor",
|