@visactor/vrender-core 1.1.4-alpha.2 → 1.1.4-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/graphic/graphic.d.ts +4 -7
- package/cjs/graphic/graphic.js +11 -31
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +4 -7
- package/cjs/graphic/group.js +17 -31
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/node-tree.d.ts +1 -2
- package/cjs/graphic/node-tree.js +1 -1
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +1 -2
- package/cjs/graphic/richtext.js +2 -2
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/state/state-engine.d.ts +0 -1
- package/cjs/graphic/state/state-engine.js +0 -17
- package/cjs/graphic/state/state-engine.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -1
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/node-tree.d.ts +1 -2
- package/cjs/interface/node-tree.js.map +1 -1
- package/dist/index.es.js +36 -131
- package/es/graphic/graphic.d.ts +4 -7
- package/es/graphic/graphic.js +11 -31
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +4 -7
- package/es/graphic/group.js +17 -31
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/node-tree.d.ts +1 -2
- package/es/graphic/node-tree.js +1 -1
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/richtext.d.ts +1 -2
- package/es/graphic/richtext.js +2 -2
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/state/state-engine.d.ts +0 -1
- package/es/graphic/state/state-engine.js +0 -17
- package/es/graphic/state/state-engine.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -1
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/node-tree.d.ts +1 -2
- package/es/interface/node-tree.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -711,7 +711,7 @@ class Node extends EventEmitter {
|
|
|
711
711
|
this.parent = null;
|
|
712
712
|
this._count = 1;
|
|
713
713
|
}
|
|
714
|
-
onParentSharedStateTreeChanged(_stage, _layer
|
|
714
|
+
onParentSharedStateTreeChanged(_stage, _layer) {
|
|
715
715
|
return;
|
|
716
716
|
}
|
|
717
717
|
forEachChildren(cb, reverse = false) {
|
|
@@ -9222,10 +9222,6 @@ class StateEngine {
|
|
|
9222
9222
|
this.baseAttributes = baseAttributes;
|
|
9223
9223
|
}
|
|
9224
9224
|
applyStates(stateNames) {
|
|
9225
|
-
const singleStaticStateResult = this.tryApplySingleStaticState(stateNames);
|
|
9226
|
-
if (singleStaticStateResult) {
|
|
9227
|
-
return singleStaticStateResult;
|
|
9228
|
-
}
|
|
9229
9225
|
const uniqueStates = Array.from(new Set(stateNames));
|
|
9230
9226
|
const sortedStates = this.sortStates(uniqueStates);
|
|
9231
9227
|
const adjudicated = this.adjudicate(sortedStates);
|
|
@@ -9248,36 +9244,6 @@ class StateEngine {
|
|
|
9248
9244
|
suppressed: [...this._suppressed]
|
|
9249
9245
|
};
|
|
9250
9246
|
}
|
|
9251
|
-
tryApplySingleStaticState(stateNames) {
|
|
9252
|
-
if (stateNames.length !== 1 || this.mergeMode !== 'shallow') {
|
|
9253
|
-
return undefined;
|
|
9254
|
-
}
|
|
9255
|
-
const stateName = stateNames[0];
|
|
9256
|
-
const definition = this.compiledDefinitions.get(stateName);
|
|
9257
|
-
if (definition && (definition.hasResolver || definition.exclude.size || definition.suppress.size)) {
|
|
9258
|
-
return undefined;
|
|
9259
|
-
}
|
|
9260
|
-
const changed = this._activeStates.length !== 1 ||
|
|
9261
|
-
this._activeStates[0] !== stateName ||
|
|
9262
|
-
this._effectiveStates.length !== 1 ||
|
|
9263
|
-
this._effectiveStates[0] !== stateName ||
|
|
9264
|
-
this._suppressed.length !== 0;
|
|
9265
|
-
this._activeStates = [stateName];
|
|
9266
|
-
this._effectiveStates = [stateName];
|
|
9267
|
-
this._suppressed = [];
|
|
9268
|
-
if (changed || !this.resolverCacheValid) {
|
|
9269
|
-
this.resolverPatchCache.clear();
|
|
9270
|
-
this.resolverCacheKey = stateName;
|
|
9271
|
-
this.resolverCacheValid = true;
|
|
9272
|
-
this._resolvedPatch = (definition === null || definition === void 0 ? void 0 : definition.patch) ? cloneValue(definition.patch) : {};
|
|
9273
|
-
}
|
|
9274
|
-
return {
|
|
9275
|
-
changed,
|
|
9276
|
-
activeStates: [...this._activeStates],
|
|
9277
|
-
effectiveStates: [...this._effectiveStates],
|
|
9278
|
-
suppressed: []
|
|
9279
|
-
};
|
|
9280
|
-
}
|
|
9281
9247
|
addState(stateName, keepCurrentStates) {
|
|
9282
9248
|
if (this._activeStates.includes(stateName) && (keepCurrentStates || this._activeStates.length === 1)) {
|
|
9283
9249
|
return {
|
|
@@ -9994,8 +9960,9 @@ class GraphicImpl extends Node {
|
|
|
9994
9960
|
}
|
|
9995
9961
|
return (_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope;
|
|
9996
9962
|
}
|
|
9997
|
-
|
|
9963
|
+
syncSharedStateScopeBindingFromTree(markDirty = true) {
|
|
9998
9964
|
var _a;
|
|
9965
|
+
const nextScope = this.resolveBoundSharedStateScope();
|
|
9999
9966
|
if (this.boundSharedStateScope === nextScope) {
|
|
10000
9967
|
this.syncSharedStateActiveRegistrations();
|
|
10001
9968
|
return false;
|
|
@@ -10012,13 +9979,7 @@ class GraphicImpl extends Node {
|
|
|
10012
9979
|
}
|
|
10013
9980
|
return true;
|
|
10014
9981
|
}
|
|
10015
|
-
|
|
10016
|
-
const nextScope = inheritedSharedStateScope === undefined
|
|
10017
|
-
? this.resolveBoundSharedStateScope()
|
|
10018
|
-
: inheritedSharedStateScope !== null && inheritedSharedStateScope !== void 0 ? inheritedSharedStateScope : undefined;
|
|
10019
|
-
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
10020
|
-
}
|
|
10021
|
-
syncSharedStateScopeBindingOnTreeChange(markDirty = true, inheritedSharedStateScope) {
|
|
9982
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = true) {
|
|
10022
9983
|
var _a, _b;
|
|
10023
9984
|
if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
10024
9985
|
!this.boundSharedStateScope &&
|
|
@@ -10026,7 +9987,7 @@ class GraphicImpl extends Node {
|
|
|
10026
9987
|
!this.sharedStateDirty) {
|
|
10027
9988
|
return false;
|
|
10028
9989
|
}
|
|
10029
|
-
return this.syncSharedStateScopeBindingFromTree(markDirty
|
|
9990
|
+
return this.syncSharedStateScopeBindingFromTree(markDirty);
|
|
10030
9991
|
}
|
|
10031
9992
|
syncSharedStateActiveRegistrations() {
|
|
10032
9993
|
var _a;
|
|
@@ -10041,9 +10002,6 @@ class GraphicImpl extends Node {
|
|
|
10041
10002
|
this.registeredActiveScopes = undefined;
|
|
10042
10003
|
return;
|
|
10043
10004
|
}
|
|
10044
|
-
if ((previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) {
|
|
10045
|
-
return;
|
|
10046
|
-
}
|
|
10047
10005
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
10048
10006
|
previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.forEach(scope => {
|
|
10049
10007
|
if (!nextScopes.has(scope)) {
|
|
@@ -10055,18 +10013,6 @@ class GraphicImpl extends Node {
|
|
|
10055
10013
|
});
|
|
10056
10014
|
this.registeredActiveScopes = nextScopes;
|
|
10057
10015
|
}
|
|
10058
|
-
isSharedStateScopeChainRegistered(previousScopes) {
|
|
10059
|
-
let scope = this.boundSharedStateScope;
|
|
10060
|
-
let scopeCount = 0;
|
|
10061
|
-
while (scope) {
|
|
10062
|
-
if (!previousScopes.has(scope)) {
|
|
10063
|
-
return false;
|
|
10064
|
-
}
|
|
10065
|
-
scopeCount += 1;
|
|
10066
|
-
scope = scope.parentScope;
|
|
10067
|
-
}
|
|
10068
|
-
return scopeCount === previousScopes.size;
|
|
10069
|
-
}
|
|
10070
10016
|
clearSharedStateActiveRegistrations() {
|
|
10071
10017
|
const previousScopes = this.registeredActiveScopes;
|
|
10072
10018
|
if (previousScopes) {
|
|
@@ -10082,12 +10028,12 @@ class GraphicImpl extends Node {
|
|
|
10082
10028
|
enqueueGraphicSharedStateRefresh(this.stage, this);
|
|
10083
10029
|
scheduleStageSharedStateRefresh(this.stage);
|
|
10084
10030
|
}
|
|
10085
|
-
onParentSharedStateTreeChanged(stage, layer
|
|
10031
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
10086
10032
|
if (this.stage !== stage || this.layer !== layer) {
|
|
10087
|
-
this.setStage(stage, layer
|
|
10033
|
+
this.setStage(stage, layer);
|
|
10088
10034
|
return;
|
|
10089
10035
|
}
|
|
10090
|
-
this.syncSharedStateScopeBindingOnTreeChange(
|
|
10036
|
+
this.syncSharedStateScopeBindingOnTreeChange();
|
|
10091
10037
|
}
|
|
10092
10038
|
refreshSharedStateBeforeRender() {
|
|
10093
10039
|
var _a;
|
|
@@ -11244,16 +11190,6 @@ class GraphicImpl extends Node {
|
|
|
11244
11190
|
var _a;
|
|
11245
11191
|
return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
|
|
11246
11192
|
}
|
|
11247
|
-
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
11248
|
-
var _a;
|
|
11249
|
-
this.states = definitions;
|
|
11250
|
-
if (this.localStateDefinitionsSource !== definitions) {
|
|
11251
|
-
this.localStateDefinitionsSource = definitions;
|
|
11252
|
-
this.localStateDefinitionsVersion = ((_a = this.localStateDefinitionsVersion) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
11253
|
-
}
|
|
11254
|
-
this.compiledStateDefinitions = compiledDefinitions;
|
|
11255
|
-
this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
11256
|
-
}
|
|
11257
11193
|
getStateResolveBaseAttrs() {
|
|
11258
11194
|
var _a;
|
|
11259
11195
|
return ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
|
|
@@ -11570,12 +11506,11 @@ class GraphicImpl extends Node {
|
|
|
11570
11506
|
}
|
|
11571
11507
|
}
|
|
11572
11508
|
addState(stateName, keepCurrentStates, hasAnimation) {
|
|
11573
|
-
const
|
|
11574
|
-
if (
|
|
11509
|
+
const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
|
|
11510
|
+
if (!transition.changed) {
|
|
11575
11511
|
return;
|
|
11576
11512
|
}
|
|
11577
|
-
|
|
11578
|
-
this.useStates(nextStates, hasAnimation);
|
|
11513
|
+
this.useStates(transition.states, hasAnimation);
|
|
11579
11514
|
}
|
|
11580
11515
|
setStates(states, options) {
|
|
11581
11516
|
var _a, _b, _c;
|
|
@@ -11813,7 +11748,7 @@ class GraphicImpl extends Node {
|
|
|
11813
11748
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
11814
11749
|
}
|
|
11815
11750
|
}
|
|
11816
|
-
setStage(stage, layer
|
|
11751
|
+
setStage(stage, layer) {
|
|
11817
11752
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
11818
11753
|
const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
|
|
11819
11754
|
const previousStage = this.stage;
|
|
@@ -11824,7 +11759,7 @@ class GraphicImpl extends Node {
|
|
|
11824
11759
|
this.boundSharedStateScope ||
|
|
11825
11760
|
((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
|
|
11826
11761
|
this.sharedStateDirty) {
|
|
11827
|
-
this.syncSharedStateScopeBindingOnTreeChange(true
|
|
11762
|
+
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
11828
11763
|
}
|
|
11829
11764
|
this.setStageToShadowRoot(stage, layer);
|
|
11830
11765
|
if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
@@ -11874,7 +11809,7 @@ class GraphicImpl extends Node {
|
|
|
11874
11809
|
this.boundSharedStateScope ||
|
|
11875
11810
|
((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
|
|
11876
11811
|
this.sharedStateDirty) {
|
|
11877
|
-
this.syncSharedStateScopeBindingOnTreeChange(true
|
|
11812
|
+
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
11878
11813
|
}
|
|
11879
11814
|
}
|
|
11880
11815
|
detachStageForRelease() {
|
|
@@ -15661,8 +15596,8 @@ class RichText extends Graphic {
|
|
|
15661
15596
|
clone() {
|
|
15662
15597
|
return new RichText(Object.assign({}, this.attribute));
|
|
15663
15598
|
}
|
|
15664
|
-
setStage(stage, layer
|
|
15665
|
-
super.setStage(stage, layer
|
|
15599
|
+
setStage(stage, layer) {
|
|
15600
|
+
super.setStage(stage, layer);
|
|
15666
15601
|
const frameCache = this.getFrameCache();
|
|
15667
15602
|
frameCache.icons.forEach(icon => {
|
|
15668
15603
|
icon.setStage(stage, layer);
|
|
@@ -16516,7 +16451,7 @@ class Group extends Graphic {
|
|
|
16516
16451
|
}
|
|
16517
16452
|
incrementalAppendChild(node) {
|
|
16518
16453
|
const data = super.appendChild(node);
|
|
16519
|
-
if (data
|
|
16454
|
+
if (data) {
|
|
16520
16455
|
this.syncChildSharedStateTreeBinding(data);
|
|
16521
16456
|
}
|
|
16522
16457
|
this.addUpdateBoundTag();
|
|
@@ -16530,7 +16465,7 @@ class Group extends Graphic {
|
|
|
16530
16465
|
return;
|
|
16531
16466
|
}
|
|
16532
16467
|
_updateChildToStage(child) {
|
|
16533
|
-
if (child
|
|
16468
|
+
if (child) {
|
|
16534
16469
|
this.syncChildSharedStateTreeBinding(child);
|
|
16535
16470
|
}
|
|
16536
16471
|
this.addUpdateBoundTag();
|
|
@@ -16538,8 +16473,10 @@ class Group extends Graphic {
|
|
|
16538
16473
|
}
|
|
16539
16474
|
appendChild(node, addStage = true) {
|
|
16540
16475
|
const data = super.appendChild(node);
|
|
16541
|
-
if (data
|
|
16542
|
-
|
|
16476
|
+
if (data) {
|
|
16477
|
+
if (addStage) {
|
|
16478
|
+
this.syncChildSharedStateTreeBinding(data);
|
|
16479
|
+
}
|
|
16543
16480
|
}
|
|
16544
16481
|
this.addUpdateBoundTag();
|
|
16545
16482
|
return data;
|
|
@@ -16581,7 +16518,7 @@ class Group extends Graphic {
|
|
|
16581
16518
|
});
|
|
16582
16519
|
this.addUpdateBoundTag();
|
|
16583
16520
|
}
|
|
16584
|
-
setStage(stage, layer
|
|
16521
|
+
setStage(stage, layer) {
|
|
16585
16522
|
var _a, _b, _c, _d, _e, _f;
|
|
16586
16523
|
const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
|
|
16587
16524
|
const needsSharedStateTreeSync = this.hasSharedStateDefinitions() ||
|
|
@@ -16595,12 +16532,12 @@ class Group extends Graphic {
|
|
|
16595
16532
|
this.layer = layer;
|
|
16596
16533
|
if (needsSharedStateTreeSync) {
|
|
16597
16534
|
this.ensureSharedStateScopeBound();
|
|
16598
|
-
this.syncSharedStateScopeBindingOnTreeChange(true
|
|
16535
|
+
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
16599
16536
|
}
|
|
16600
16537
|
this.setStageToShadowRoot(stage, layer);
|
|
16601
16538
|
this._onSetStage && this._onSetStage(this, stage, layer);
|
|
16602
16539
|
(_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
|
|
16603
|
-
this.notifyChildrenSharedStateTreeChanged(
|
|
16540
|
+
this.notifyChildrenSharedStateTreeChanged();
|
|
16604
16541
|
return;
|
|
16605
16542
|
}
|
|
16606
16543
|
const layerChanged = this.layer !== layer;
|
|
@@ -16609,11 +16546,11 @@ class Group extends Graphic {
|
|
|
16609
16546
|
}
|
|
16610
16547
|
if (needsSharedStateTreeSync) {
|
|
16611
16548
|
this.ensureSharedStateScopeBound();
|
|
16612
|
-
this.syncSharedStateScopeBindingOnTreeChange(true
|
|
16613
|
-
this.notifyChildrenSharedStateTreeChanged(
|
|
16549
|
+
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
16550
|
+
this.notifyChildrenSharedStateTreeChanged();
|
|
16614
16551
|
}
|
|
16615
16552
|
else if (layerChanged) {
|
|
16616
|
-
this.notifyChildrenSharedStateTreeChanged(
|
|
16553
|
+
this.notifyChildrenSharedStateTreeChanged();
|
|
16617
16554
|
}
|
|
16618
16555
|
}
|
|
16619
16556
|
addUpdatePositionTag() {
|
|
@@ -16708,55 +16645,23 @@ class Group extends Graphic {
|
|
|
16708
16645
|
hasSharedStateDefinitions() {
|
|
16709
16646
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
16710
16647
|
}
|
|
16711
|
-
|
|
16712
|
-
var _a;
|
|
16713
|
-
if (this.sharedStateScope) {
|
|
16714
|
-
return this.sharedStateScope;
|
|
16715
|
-
}
|
|
16716
|
-
if (inheritedSharedStateScope !== undefined) {
|
|
16717
|
-
return inheritedSharedStateScope;
|
|
16718
|
-
}
|
|
16719
|
-
return (_a = this.resolveBoundSharedStateScope()) !== null && _a !== void 0 ? _a : null;
|
|
16720
|
-
}
|
|
16721
|
-
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
16722
|
-
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
16648
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
16723
16649
|
this.forEachChildren(item => {
|
|
16724
|
-
this.
|
|
16650
|
+
this.syncChildSharedStateTreeBinding(item);
|
|
16725
16651
|
});
|
|
16726
16652
|
}
|
|
16727
|
-
|
|
16728
|
-
|
|
16729
|
-
return true;
|
|
16730
|
-
}
|
|
16731
|
-
return (child.onParentSharedStateTreeChanged !== Graphic.prototype.onParentSharedStateTreeChanged &&
|
|
16732
|
-
child.onParentSharedStateTreeChanged !== Group.prototype.onParentSharedStateTreeChanged);
|
|
16733
|
-
}
|
|
16734
|
-
setStageToChild(child, inheritedSharedStateScope) {
|
|
16735
|
-
const graphic = child;
|
|
16736
|
-
if (typeof graphic.setStage === 'function' &&
|
|
16737
|
-
(child.onParentSharedStateTreeChanged === Graphic.prototype.onParentSharedStateTreeChanged ||
|
|
16738
|
-
child.onParentSharedStateTreeChanged === Group.prototype.onParentSharedStateTreeChanged) &&
|
|
16739
|
-
(graphic.stage !== this.stage || graphic.layer !== this.layer)) {
|
|
16740
|
-
graphic.setStage(this.stage, this.layer, inheritedSharedStateScope);
|
|
16741
|
-
return;
|
|
16742
|
-
}
|
|
16743
|
-
child.onParentSharedStateTreeChanged(this.stage, this.layer, inheritedSharedStateScope);
|
|
16744
|
-
}
|
|
16745
|
-
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
16746
|
-
if (inheritedSharedStateScope === undefined) {
|
|
16747
|
-
inheritedSharedStateScope = this.resolveChildSharedStateScope();
|
|
16748
|
-
}
|
|
16749
|
-
this.setStageToChild(child, inheritedSharedStateScope);
|
|
16653
|
+
syncChildSharedStateTreeBinding(child) {
|
|
16654
|
+
child.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
16750
16655
|
}
|
|
16751
|
-
onParentSharedStateTreeChanged(stage, layer
|
|
16656
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
16752
16657
|
var _a;
|
|
16753
16658
|
if (this.stage !== stage || this.layer !== layer) {
|
|
16754
|
-
this.setStage(stage, layer
|
|
16659
|
+
this.setStage(stage, layer);
|
|
16755
16660
|
return;
|
|
16756
16661
|
}
|
|
16757
16662
|
this.ensureSharedStateScopeBound();
|
|
16758
|
-
this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)
|
|
16759
|
-
this.notifyChildrenSharedStateTreeChanged(
|
|
16663
|
+
this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
|
|
16664
|
+
this.notifyChildrenSharedStateTreeChanged();
|
|
16760
16665
|
}
|
|
16761
16666
|
}
|
|
16762
16667
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
package/es/graphic/graphic.d.ts
CHANGED
|
@@ -142,14 +142,12 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
142
142
|
getAttributes(): T;
|
|
143
143
|
protected getStateTransitionOrchestrator(): StateTransitionOrchestrator<T>;
|
|
144
144
|
protected resolveBoundSharedStateScope(): SharedStateScope<T> | SharedStateScope<Record<string, any>> | undefined;
|
|
145
|
-
protected
|
|
146
|
-
protected
|
|
147
|
-
protected syncSharedStateScopeBindingOnTreeChange(markDirty?: boolean, inheritedSharedStateScope?: SharedStateScope<Record<string, any>> | null): boolean;
|
|
145
|
+
protected syncSharedStateScopeBindingFromTree(markDirty?: boolean): boolean;
|
|
146
|
+
protected syncSharedStateScopeBindingOnTreeChange(markDirty?: boolean): boolean;
|
|
148
147
|
protected syncSharedStateActiveRegistrations(): void;
|
|
149
|
-
protected isSharedStateScopeChainRegistered(previousScopes: Set<SharedStateScope<T>>): boolean;
|
|
150
148
|
protected clearSharedStateActiveRegistrations(): void;
|
|
151
149
|
protected markSharedStateDirty(): void;
|
|
152
|
-
onParentSharedStateTreeChanged(stage?: IStage, layer?: ILayer
|
|
150
|
+
onParentSharedStateTreeChanged(stage?: IStage, layer?: ILayer): void;
|
|
153
151
|
refreshSharedStateBeforeRender(): void;
|
|
154
152
|
protected getLocalStatesVersion(): number;
|
|
155
153
|
protected resolveEffectiveCompiledDefinitions(): {
|
|
@@ -239,7 +237,6 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
239
237
|
}): void;
|
|
240
238
|
hasState(stateName?: string): boolean;
|
|
241
239
|
getState(stateName: string): Partial<T> | StateDefinition<T> | undefined;
|
|
242
|
-
setStateDefinitionsWithCompiled(definitions: StateDefinitionsInput<T>, compiledDefinitions: Map<string, CompiledStateDefinition<T>>): void;
|
|
243
240
|
protected getStateResolveBaseAttrs(): Partial<T>;
|
|
244
241
|
protected syncStateResolveContext(stateResolveBaseAttrs?: Partial<T>): Partial<T>;
|
|
245
242
|
protected ensureStateEngine(stateResolveBaseAttrs?: Partial<T>): StateEngine<T>;
|
|
@@ -295,7 +292,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
295
292
|
}, resetScale?: boolean): [number, number];
|
|
296
293
|
protected doUpdateLocalMatrix(): void;
|
|
297
294
|
protected doUpdateGlobalMatrix(): void;
|
|
298
|
-
setStage(stage?: IStage, layer?: ILayer
|
|
295
|
+
setStage(stage?: IStage, layer?: ILayer): void;
|
|
299
296
|
detachStageForRelease(): void;
|
|
300
297
|
setStageToShadowRoot(stage?: IStage, layer?: ILayer): void;
|
|
301
298
|
onAddStep(step: IStep): void;
|
package/es/graphic/graphic.js
CHANGED
|
@@ -181,8 +181,9 @@ class GraphicImpl extends Node {
|
|
|
181
181
|
}
|
|
182
182
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0) {
|
|
185
185
|
var _a;
|
|
186
|
+
const nextScope = this.resolveBoundSharedStateScope();
|
|
186
187
|
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(),
|
|
187
188
|
!1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0,
|
|
188
189
|
this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0,
|
|
@@ -190,13 +191,9 @@ class GraphicImpl extends Node {
|
|
|
190
191
|
markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(),
|
|
191
192
|
!0);
|
|
192
193
|
}
|
|
193
|
-
|
|
194
|
-
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
195
|
-
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
196
|
-
}
|
|
197
|
-
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
194
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
198
195
|
var _a, _b;
|
|
199
|
-
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
|
|
196
|
+
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);
|
|
200
197
|
}
|
|
201
198
|
syncSharedStateActiveRegistrations() {
|
|
202
199
|
var _a;
|
|
@@ -204,7 +201,6 @@ class GraphicImpl extends Node {
|
|
|
204
201
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach((scope => {
|
|
205
202
|
scope.subtreeActiveDescendants.delete(this);
|
|
206
203
|
})), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
207
|
-
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
208
204
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
209
205
|
null == previousScopes || previousScopes.forEach((scope => {
|
|
210
206
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -212,14 +208,6 @@ class GraphicImpl extends Node {
|
|
|
212
208
|
scope.subtreeActiveDescendants.add(this);
|
|
213
209
|
})), this.registeredActiveScopes = nextScopes;
|
|
214
210
|
}
|
|
215
|
-
isSharedStateScopeChainRegistered(previousScopes) {
|
|
216
|
-
let scope = this.boundSharedStateScope, scopeCount = 0;
|
|
217
|
-
for (;scope; ) {
|
|
218
|
-
if (!previousScopes.has(scope)) return !1;
|
|
219
|
-
scopeCount += 1, scope = scope.parentScope;
|
|
220
|
-
}
|
|
221
|
-
return scopeCount === previousScopes.size;
|
|
222
|
-
}
|
|
223
211
|
clearSharedStateActiveRegistrations() {
|
|
224
212
|
const previousScopes = this.registeredActiveScopes;
|
|
225
213
|
previousScopes && (previousScopes.forEach((scope => {
|
|
@@ -230,8 +218,8 @@ class GraphicImpl extends Node {
|
|
|
230
218
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this),
|
|
231
219
|
scheduleStageSharedStateRefresh(this.stage);
|
|
232
220
|
}
|
|
233
|
-
onParentSharedStateTreeChanged(stage, layer
|
|
234
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(
|
|
221
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
222
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
235
223
|
}
|
|
236
224
|
refreshSharedStateBeforeRender() {
|
|
237
225
|
var _a;
|
|
@@ -874,12 +862,6 @@ class GraphicImpl extends Node {
|
|
|
874
862
|
var _a;
|
|
875
863
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
876
864
|
}
|
|
877
|
-
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
878
|
-
var _a;
|
|
879
|
-
this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions,
|
|
880
|
-
this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1),
|
|
881
|
-
this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
882
|
-
}
|
|
883
865
|
getStateResolveBaseAttrs() {
|
|
884
866
|
var _a;
|
|
885
867
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -1068,10 +1050,8 @@ class GraphicImpl extends Node {
|
|
|
1068
1050
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
1069
1051
|
}
|
|
1070
1052
|
addState(stateName, keepCurrentStates, hasAnimation) {
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1073
|
-
const nextStates = keepCurrentStates && (null == currentStates ? void 0 : currentStates.length) ? currentStates.concat([ stateName ]) : [ stateName ];
|
|
1074
|
-
this.useStates(nextStates, hasAnimation);
|
|
1053
|
+
const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
|
|
1054
|
+
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
1075
1055
|
}
|
|
1076
1056
|
setStates(states, options) {
|
|
1077
1057
|
var _a, _b, _c;
|
|
@@ -1206,11 +1186,11 @@ class GraphicImpl extends Node {
|
|
|
1206
1186
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
1207
1187
|
}
|
|
1208
1188
|
}
|
|
1209
|
-
setStage(stage, layer
|
|
1189
|
+
setStage(stage, layer) {
|
|
1210
1190
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1211
1191
|
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, previousStage = this.stage;
|
|
1212
1192
|
if (this.stage !== stage || this.layer !== layer) {
|
|
1213
|
-
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
|
|
1193
|
+
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),
|
|
1214
1194
|
this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
1215
1195
|
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage), nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage), detachedStageAnimates = [];
|
|
1216
1196
|
this.visitTrackedAnimates((a => {
|
|
@@ -1228,7 +1208,7 @@ class GraphicImpl extends Node {
|
|
|
1228
1208
|
}
|
|
1229
1209
|
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));
|
|
1230
1210
|
}
|
|
1231
|
-
((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
|
|
1211
|
+
((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);
|
|
1232
1212
|
}
|
|
1233
1213
|
detachStageForRelease() {
|
|
1234
1214
|
var _a, _b, _c;
|