@visactor/vrender-core 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/cjs/graphic/graphic.d.ts +7 -4
- package/cjs/graphic/graphic.js +27 -9
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +6 -4
- package/cjs/graphic/group.js +21 -11
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/node-tree.d.ts +2 -1
- package/cjs/graphic/node-tree.js +1 -1
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +2 -1
- package/cjs/graphic/richtext.js +2 -2
- package/cjs/graphic/richtext.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 +2 -1
- package/cjs/interface/node-tree.js.map +1 -1
- package/dist/index.es.js +82 -27
- package/es/graphic/graphic.d.ts +7 -4
- package/es/graphic/graphic.js +27 -9
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +6 -4
- package/es/graphic/group.js +21 -11
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/node-tree.d.ts +2 -1
- package/es/graphic/node-tree.js +1 -1
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/richtext.d.ts +2 -1
- package/es/graphic/richtext.js +2 -2
- package/es/graphic/richtext.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 +2 -1
- 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, _inheritedSharedStateScope) {
|
|
715
715
|
return;
|
|
716
716
|
}
|
|
717
717
|
forEachChildren(cb, reverse = false) {
|
|
@@ -9960,9 +9960,8 @@ class GraphicImpl extends Node {
|
|
|
9960
9960
|
}
|
|
9961
9961
|
return (_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope;
|
|
9962
9962
|
}
|
|
9963
|
-
|
|
9963
|
+
syncSharedStateScopeBinding(nextScope, markDirty = true) {
|
|
9964
9964
|
var _a;
|
|
9965
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
9966
9965
|
if (this.boundSharedStateScope === nextScope) {
|
|
9967
9966
|
this.syncSharedStateActiveRegistrations();
|
|
9968
9967
|
return false;
|
|
@@ -9979,7 +9978,13 @@ class GraphicImpl extends Node {
|
|
|
9979
9978
|
}
|
|
9980
9979
|
return true;
|
|
9981
9980
|
}
|
|
9982
|
-
|
|
9981
|
+
syncSharedStateScopeBindingFromTree(markDirty = true, inheritedSharedStateScope) {
|
|
9982
|
+
const nextScope = inheritedSharedStateScope === undefined
|
|
9983
|
+
? this.resolveBoundSharedStateScope()
|
|
9984
|
+
: inheritedSharedStateScope !== null && inheritedSharedStateScope !== void 0 ? inheritedSharedStateScope : undefined;
|
|
9985
|
+
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
9986
|
+
}
|
|
9987
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = true, inheritedSharedStateScope) {
|
|
9983
9988
|
var _a, _b;
|
|
9984
9989
|
if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
9985
9990
|
!this.boundSharedStateScope &&
|
|
@@ -9987,7 +9992,7 @@ class GraphicImpl extends Node {
|
|
|
9987
9992
|
!this.sharedStateDirty) {
|
|
9988
9993
|
return false;
|
|
9989
9994
|
}
|
|
9990
|
-
return this.syncSharedStateScopeBindingFromTree(markDirty);
|
|
9995
|
+
return this.syncSharedStateScopeBindingFromTree(markDirty, inheritedSharedStateScope);
|
|
9991
9996
|
}
|
|
9992
9997
|
syncSharedStateActiveRegistrations() {
|
|
9993
9998
|
var _a;
|
|
@@ -10002,6 +10007,9 @@ class GraphicImpl extends Node {
|
|
|
10002
10007
|
this.registeredActiveScopes = undefined;
|
|
10003
10008
|
return;
|
|
10004
10009
|
}
|
|
10010
|
+
if ((previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) {
|
|
10011
|
+
return;
|
|
10012
|
+
}
|
|
10005
10013
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
10006
10014
|
previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.forEach(scope => {
|
|
10007
10015
|
if (!nextScopes.has(scope)) {
|
|
@@ -10013,6 +10021,18 @@ class GraphicImpl extends Node {
|
|
|
10013
10021
|
});
|
|
10014
10022
|
this.registeredActiveScopes = nextScopes;
|
|
10015
10023
|
}
|
|
10024
|
+
isSharedStateScopeChainRegistered(previousScopes) {
|
|
10025
|
+
let scope = this.boundSharedStateScope;
|
|
10026
|
+
let scopeCount = 0;
|
|
10027
|
+
while (scope) {
|
|
10028
|
+
if (!previousScopes.has(scope)) {
|
|
10029
|
+
return false;
|
|
10030
|
+
}
|
|
10031
|
+
scopeCount += 1;
|
|
10032
|
+
scope = scope.parentScope;
|
|
10033
|
+
}
|
|
10034
|
+
return scopeCount === previousScopes.size;
|
|
10035
|
+
}
|
|
10016
10036
|
clearSharedStateActiveRegistrations() {
|
|
10017
10037
|
const previousScopes = this.registeredActiveScopes;
|
|
10018
10038
|
if (previousScopes) {
|
|
@@ -10028,12 +10048,12 @@ class GraphicImpl extends Node {
|
|
|
10028
10048
|
enqueueGraphicSharedStateRefresh(this.stage, this);
|
|
10029
10049
|
scheduleStageSharedStateRefresh(this.stage);
|
|
10030
10050
|
}
|
|
10031
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
10051
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
10032
10052
|
if (this.stage !== stage || this.layer !== layer) {
|
|
10033
|
-
this.setStage(stage, layer);
|
|
10053
|
+
this.setStage(stage, layer, inheritedSharedStateScope);
|
|
10034
10054
|
return;
|
|
10035
10055
|
}
|
|
10036
|
-
this.syncSharedStateScopeBindingOnTreeChange();
|
|
10056
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
10037
10057
|
}
|
|
10038
10058
|
refreshSharedStateBeforeRender() {
|
|
10039
10059
|
var _a;
|
|
@@ -11190,6 +11210,16 @@ class GraphicImpl extends Node {
|
|
|
11190
11210
|
var _a;
|
|
11191
11211
|
return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
|
|
11192
11212
|
}
|
|
11213
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
11214
|
+
var _a;
|
|
11215
|
+
this.states = definitions;
|
|
11216
|
+
if (this.localStateDefinitionsSource !== definitions) {
|
|
11217
|
+
this.localStateDefinitionsSource = definitions;
|
|
11218
|
+
this.localStateDefinitionsVersion = ((_a = this.localStateDefinitionsVersion) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
11219
|
+
}
|
|
11220
|
+
this.compiledStateDefinitions = compiledDefinitions;
|
|
11221
|
+
this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
11222
|
+
}
|
|
11193
11223
|
getStateResolveBaseAttrs() {
|
|
11194
11224
|
var _a;
|
|
11195
11225
|
return ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
|
|
@@ -11748,7 +11778,7 @@ class GraphicImpl extends Node {
|
|
|
11748
11778
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
11749
11779
|
}
|
|
11750
11780
|
}
|
|
11751
|
-
setStage(stage, layer) {
|
|
11781
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
11752
11782
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
11753
11783
|
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;
|
|
11754
11784
|
const previousStage = this.stage;
|
|
@@ -11759,7 +11789,7 @@ class GraphicImpl extends Node {
|
|
|
11759
11789
|
this.boundSharedStateScope ||
|
|
11760
11790
|
((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
|
|
11761
11791
|
this.sharedStateDirty) {
|
|
11762
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
11792
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
11763
11793
|
}
|
|
11764
11794
|
this.setStageToShadowRoot(stage, layer);
|
|
11765
11795
|
if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
@@ -11809,7 +11839,7 @@ class GraphicImpl extends Node {
|
|
|
11809
11839
|
this.boundSharedStateScope ||
|
|
11810
11840
|
((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
|
|
11811
11841
|
this.sharedStateDirty) {
|
|
11812
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
11842
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
11813
11843
|
}
|
|
11814
11844
|
}
|
|
11815
11845
|
detachStageForRelease() {
|
|
@@ -15596,8 +15626,8 @@ class RichText extends Graphic {
|
|
|
15596
15626
|
clone() {
|
|
15597
15627
|
return new RichText(Object.assign({}, this.attribute));
|
|
15598
15628
|
}
|
|
15599
|
-
setStage(stage, layer) {
|
|
15600
|
-
super.setStage(stage, layer);
|
|
15629
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
15630
|
+
super.setStage(stage, layer, inheritedSharedStateScope);
|
|
15601
15631
|
const frameCache = this.getFrameCache();
|
|
15602
15632
|
frameCache.icons.forEach(icon => {
|
|
15603
15633
|
icon.setStage(stage, layer);
|
|
@@ -16518,7 +16548,7 @@ class Group extends Graphic {
|
|
|
16518
16548
|
});
|
|
16519
16549
|
this.addUpdateBoundTag();
|
|
16520
16550
|
}
|
|
16521
|
-
setStage(stage, layer) {
|
|
16551
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
16522
16552
|
var _a, _b, _c, _d, _e, _f;
|
|
16523
16553
|
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;
|
|
16524
16554
|
const needsSharedStateTreeSync = this.hasSharedStateDefinitions() ||
|
|
@@ -16532,12 +16562,12 @@ class Group extends Graphic {
|
|
|
16532
16562
|
this.layer = layer;
|
|
16533
16563
|
if (needsSharedStateTreeSync) {
|
|
16534
16564
|
this.ensureSharedStateScopeBound();
|
|
16535
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
16565
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
16536
16566
|
}
|
|
16537
16567
|
this.setStageToShadowRoot(stage, layer);
|
|
16538
16568
|
this._onSetStage && this._onSetStage(this, stage, layer);
|
|
16539
16569
|
(_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
|
|
16540
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16570
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16541
16571
|
return;
|
|
16542
16572
|
}
|
|
16543
16573
|
const layerChanged = this.layer !== layer;
|
|
@@ -16546,11 +16576,11 @@ class Group extends Graphic {
|
|
|
16546
16576
|
}
|
|
16547
16577
|
if (needsSharedStateTreeSync) {
|
|
16548
16578
|
this.ensureSharedStateScopeBound();
|
|
16549
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
16550
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16579
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
16580
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16551
16581
|
}
|
|
16552
16582
|
else if (layerChanged) {
|
|
16553
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16583
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16554
16584
|
}
|
|
16555
16585
|
}
|
|
16556
16586
|
addUpdatePositionTag() {
|
|
@@ -16645,23 +16675,48 @@ class Group extends Graphic {
|
|
|
16645
16675
|
hasSharedStateDefinitions() {
|
|
16646
16676
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
16647
16677
|
}
|
|
16648
|
-
|
|
16678
|
+
resolveChildSharedStateScope(inheritedSharedStateScope) {
|
|
16679
|
+
var _a;
|
|
16680
|
+
if (this.sharedStateScope) {
|
|
16681
|
+
return this.sharedStateScope;
|
|
16682
|
+
}
|
|
16683
|
+
if (inheritedSharedStateScope !== undefined) {
|
|
16684
|
+
return inheritedSharedStateScope;
|
|
16685
|
+
}
|
|
16686
|
+
return (_a = this.resolveBoundSharedStateScope()) !== null && _a !== void 0 ? _a : null;
|
|
16687
|
+
}
|
|
16688
|
+
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
16689
|
+
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
16649
16690
|
this.forEachChildren(item => {
|
|
16650
|
-
this.
|
|
16691
|
+
this.setStageToChild(item, childSharedStateScope);
|
|
16651
16692
|
});
|
|
16652
16693
|
}
|
|
16653
|
-
|
|
16654
|
-
child
|
|
16694
|
+
setStageToChild(child, inheritedSharedStateScope) {
|
|
16695
|
+
const graphic = child;
|
|
16696
|
+
if (typeof graphic.setStage === 'function' &&
|
|
16697
|
+
(child.onParentSharedStateTreeChanged === Graphic.prototype.onParentSharedStateTreeChanged ||
|
|
16698
|
+
child.onParentSharedStateTreeChanged === Group.prototype.onParentSharedStateTreeChanged) &&
|
|
16699
|
+
(graphic.stage !== this.stage || graphic.layer !== this.layer)) {
|
|
16700
|
+
graphic.setStage(this.stage, this.layer, inheritedSharedStateScope);
|
|
16701
|
+
return;
|
|
16702
|
+
}
|
|
16703
|
+
child.onParentSharedStateTreeChanged(this.stage, this.layer, inheritedSharedStateScope);
|
|
16704
|
+
}
|
|
16705
|
+
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
16706
|
+
if (inheritedSharedStateScope === undefined) {
|
|
16707
|
+
inheritedSharedStateScope = this.resolveChildSharedStateScope();
|
|
16708
|
+
}
|
|
16709
|
+
this.setStageToChild(child, inheritedSharedStateScope);
|
|
16655
16710
|
}
|
|
16656
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
16711
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
16657
16712
|
var _a;
|
|
16658
16713
|
if (this.stage !== stage || this.layer !== layer) {
|
|
16659
|
-
this.setStage(stage, layer);
|
|
16714
|
+
this.setStage(stage, layer, inheritedSharedStateScope);
|
|
16660
16715
|
return;
|
|
16661
16716
|
}
|
|
16662
16717
|
this.ensureSharedStateScopeBound();
|
|
16663
|
-
this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
|
|
16664
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16718
|
+
this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length), inheritedSharedStateScope);
|
|
16719
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16665
16720
|
}
|
|
16666
16721
|
}
|
|
16667
16722
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
package/es/graphic/graphic.d.ts
CHANGED
|
@@ -142,12 +142,14 @@ 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
|
|
145
|
+
protected syncSharedStateScopeBinding(nextScope: SharedStateScope<T> | SharedStateScope<Record<string, any>> | undefined, markDirty?: boolean): boolean;
|
|
146
|
+
protected syncSharedStateScopeBindingFromTree(markDirty?: boolean, inheritedSharedStateScope?: SharedStateScope<Record<string, any>> | null): boolean;
|
|
147
|
+
protected syncSharedStateScopeBindingOnTreeChange(markDirty?: boolean, inheritedSharedStateScope?: SharedStateScope<Record<string, any>> | null): boolean;
|
|
147
148
|
protected syncSharedStateActiveRegistrations(): void;
|
|
149
|
+
protected isSharedStateScopeChainRegistered(previousScopes: Set<SharedStateScope<T>>): boolean;
|
|
148
150
|
protected clearSharedStateActiveRegistrations(): void;
|
|
149
151
|
protected markSharedStateDirty(): void;
|
|
150
|
-
onParentSharedStateTreeChanged(stage?: IStage, layer?: ILayer): void;
|
|
152
|
+
onParentSharedStateTreeChanged(stage?: IStage, layer?: ILayer, inheritedSharedStateScope?: SharedStateScope<Record<string, any>> | null): void;
|
|
151
153
|
refreshSharedStateBeforeRender(): void;
|
|
152
154
|
protected getLocalStatesVersion(): number;
|
|
153
155
|
protected resolveEffectiveCompiledDefinitions(): {
|
|
@@ -237,6 +239,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
237
239
|
}): void;
|
|
238
240
|
hasState(stateName?: string): boolean;
|
|
239
241
|
getState(stateName: string): Partial<T> | StateDefinition<T> | undefined;
|
|
242
|
+
setStateDefinitionsWithCompiled(definitions: StateDefinitionsInput<T>, compiledDefinitions: Map<string, CompiledStateDefinition<T>>): void;
|
|
240
243
|
protected getStateResolveBaseAttrs(): Partial<T>;
|
|
241
244
|
protected syncStateResolveContext(stateResolveBaseAttrs?: Partial<T>): Partial<T>;
|
|
242
245
|
protected ensureStateEngine(stateResolveBaseAttrs?: Partial<T>): StateEngine<T>;
|
|
@@ -292,7 +295,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
292
295
|
}, resetScale?: boolean): [number, number];
|
|
293
296
|
protected doUpdateLocalMatrix(): void;
|
|
294
297
|
protected doUpdateGlobalMatrix(): void;
|
|
295
|
-
setStage(stage?: IStage, layer?: ILayer): void;
|
|
298
|
+
setStage(stage?: IStage, layer?: ILayer, inheritedSharedStateScope?: SharedStateScope<Record<string, any>> | null): void;
|
|
296
299
|
detachStageForRelease(): void;
|
|
297
300
|
setStageToShadowRoot(stage?: IStage, layer?: ILayer): void;
|
|
298
301
|
onAddStep(step: IStep): void;
|
package/es/graphic/graphic.js
CHANGED
|
@@ -181,9 +181,8 @@ class GraphicImpl extends Node {
|
|
|
181
181
|
}
|
|
182
182
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
syncSharedStateScopeBinding(nextScope, markDirty = !0) {
|
|
185
185
|
var _a;
|
|
186
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
187
186
|
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(),
|
|
188
187
|
!1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0,
|
|
189
188
|
this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0,
|
|
@@ -191,9 +190,13 @@ class GraphicImpl extends Node {
|
|
|
191
190
|
markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(),
|
|
192
191
|
!0);
|
|
193
192
|
}
|
|
194
|
-
|
|
193
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
|
|
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) {
|
|
195
198
|
var _a, _b;
|
|
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);
|
|
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, inheritedSharedStateScope);
|
|
197
200
|
}
|
|
198
201
|
syncSharedStateActiveRegistrations() {
|
|
199
202
|
var _a;
|
|
@@ -201,6 +204,7 @@ class GraphicImpl extends Node {
|
|
|
201
204
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach((scope => {
|
|
202
205
|
scope.subtreeActiveDescendants.delete(this);
|
|
203
206
|
})), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
207
|
+
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
204
208
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
205
209
|
null == previousScopes || previousScopes.forEach((scope => {
|
|
206
210
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -208,6 +212,14 @@ class GraphicImpl extends Node {
|
|
|
208
212
|
scope.subtreeActiveDescendants.add(this);
|
|
209
213
|
})), this.registeredActiveScopes = nextScopes;
|
|
210
214
|
}
|
|
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
|
+
}
|
|
211
223
|
clearSharedStateActiveRegistrations() {
|
|
212
224
|
const previousScopes = this.registeredActiveScopes;
|
|
213
225
|
previousScopes && (previousScopes.forEach((scope => {
|
|
@@ -218,8 +230,8 @@ class GraphicImpl extends Node {
|
|
|
218
230
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this),
|
|
219
231
|
scheduleStageSharedStateRefresh(this.stage);
|
|
220
232
|
}
|
|
221
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
222
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
233
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
234
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
|
|
223
235
|
}
|
|
224
236
|
refreshSharedStateBeforeRender() {
|
|
225
237
|
var _a;
|
|
@@ -862,6 +874,12 @@ class GraphicImpl extends Node {
|
|
|
862
874
|
var _a;
|
|
863
875
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
864
876
|
}
|
|
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
|
+
}
|
|
865
883
|
getStateResolveBaseAttrs() {
|
|
866
884
|
var _a;
|
|
867
885
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -1186,11 +1204,11 @@ class GraphicImpl extends Node {
|
|
|
1186
1204
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
1187
1205
|
}
|
|
1188
1206
|
}
|
|
1189
|
-
setStage(stage, layer) {
|
|
1207
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
1190
1208
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1191
1209
|
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;
|
|
1192
1210
|
if (this.stage !== stage || this.layer !== layer) {
|
|
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),
|
|
1211
|
+
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),
|
|
1194
1212
|
this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
1195
1213
|
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 = [];
|
|
1196
1214
|
this.visitTrackedAnimates((a => {
|
|
@@ -1208,7 +1226,7 @@ class GraphicImpl extends Node {
|
|
|
1208
1226
|
}
|
|
1209
1227
|
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));
|
|
1210
1228
|
}
|
|
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);
|
|
1229
|
+
((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);
|
|
1212
1230
|
}
|
|
1213
1231
|
detachStageForRelease() {
|
|
1214
1232
|
var _a, _b, _c;
|