@visactor/vrender-core 1.1.7 → 1.1.8-alpha.1
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/allocator/bounds-allocate.js +2 -1
- package/cjs/animate/config.js +1 -2
- 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/allocator/bounds-allocate.js +2 -1
- package/es/animate/config.js +1 -2
- 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) {
|
|
@@ -9975,9 +9975,8 @@ class GraphicImpl extends Node {
|
|
|
9975
9975
|
}
|
|
9976
9976
|
return (_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope;
|
|
9977
9977
|
}
|
|
9978
|
-
|
|
9978
|
+
syncSharedStateScopeBinding(nextScope, markDirty = true) {
|
|
9979
9979
|
var _a;
|
|
9980
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
9981
9980
|
if (this.boundSharedStateScope === nextScope) {
|
|
9982
9981
|
this.syncSharedStateActiveRegistrations();
|
|
9983
9982
|
return false;
|
|
@@ -9994,7 +9993,13 @@ class GraphicImpl extends Node {
|
|
|
9994
9993
|
}
|
|
9995
9994
|
return true;
|
|
9996
9995
|
}
|
|
9997
|
-
|
|
9996
|
+
syncSharedStateScopeBindingFromTree(markDirty = true, inheritedSharedStateScope) {
|
|
9997
|
+
const nextScope = inheritedSharedStateScope === undefined
|
|
9998
|
+
? this.resolveBoundSharedStateScope()
|
|
9999
|
+
: inheritedSharedStateScope !== null && inheritedSharedStateScope !== void 0 ? inheritedSharedStateScope : undefined;
|
|
10000
|
+
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
10001
|
+
}
|
|
10002
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = true, inheritedSharedStateScope) {
|
|
9998
10003
|
var _a, _b;
|
|
9999
10004
|
if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
10000
10005
|
!this.boundSharedStateScope &&
|
|
@@ -10002,7 +10007,7 @@ class GraphicImpl extends Node {
|
|
|
10002
10007
|
!this.sharedStateDirty) {
|
|
10003
10008
|
return false;
|
|
10004
10009
|
}
|
|
10005
|
-
return this.syncSharedStateScopeBindingFromTree(markDirty);
|
|
10010
|
+
return this.syncSharedStateScopeBindingFromTree(markDirty, inheritedSharedStateScope);
|
|
10006
10011
|
}
|
|
10007
10012
|
syncSharedStateActiveRegistrations() {
|
|
10008
10013
|
var _a;
|
|
@@ -10017,6 +10022,9 @@ class GraphicImpl extends Node {
|
|
|
10017
10022
|
this.registeredActiveScopes = undefined;
|
|
10018
10023
|
return;
|
|
10019
10024
|
}
|
|
10025
|
+
if ((previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) {
|
|
10026
|
+
return;
|
|
10027
|
+
}
|
|
10020
10028
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
10021
10029
|
previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.forEach(scope => {
|
|
10022
10030
|
if (!nextScopes.has(scope)) {
|
|
@@ -10028,6 +10036,18 @@ class GraphicImpl extends Node {
|
|
|
10028
10036
|
});
|
|
10029
10037
|
this.registeredActiveScopes = nextScopes;
|
|
10030
10038
|
}
|
|
10039
|
+
isSharedStateScopeChainRegistered(previousScopes) {
|
|
10040
|
+
let scope = this.boundSharedStateScope;
|
|
10041
|
+
let scopeCount = 0;
|
|
10042
|
+
while (scope) {
|
|
10043
|
+
if (!previousScopes.has(scope)) {
|
|
10044
|
+
return false;
|
|
10045
|
+
}
|
|
10046
|
+
scopeCount += 1;
|
|
10047
|
+
scope = scope.parentScope;
|
|
10048
|
+
}
|
|
10049
|
+
return scopeCount === previousScopes.size;
|
|
10050
|
+
}
|
|
10031
10051
|
clearSharedStateActiveRegistrations() {
|
|
10032
10052
|
const previousScopes = this.registeredActiveScopes;
|
|
10033
10053
|
if (previousScopes) {
|
|
@@ -10043,12 +10063,12 @@ class GraphicImpl extends Node {
|
|
|
10043
10063
|
enqueueGraphicSharedStateRefresh(this.stage, this);
|
|
10044
10064
|
scheduleStageSharedStateRefresh(this.stage);
|
|
10045
10065
|
}
|
|
10046
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
10066
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
10047
10067
|
if (this.stage !== stage || this.layer !== layer) {
|
|
10048
|
-
this.setStage(stage, layer);
|
|
10068
|
+
this.setStage(stage, layer, inheritedSharedStateScope);
|
|
10049
10069
|
return;
|
|
10050
10070
|
}
|
|
10051
|
-
this.syncSharedStateScopeBindingOnTreeChange();
|
|
10071
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
10052
10072
|
}
|
|
10053
10073
|
refreshSharedStateBeforeRender() {
|
|
10054
10074
|
var _a;
|
|
@@ -11203,6 +11223,16 @@ class GraphicImpl extends Node {
|
|
|
11203
11223
|
var _a;
|
|
11204
11224
|
return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
|
|
11205
11225
|
}
|
|
11226
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
11227
|
+
var _a;
|
|
11228
|
+
this.states = definitions;
|
|
11229
|
+
if (this.localStateDefinitionsSource !== definitions) {
|
|
11230
|
+
this.localStateDefinitionsSource = definitions;
|
|
11231
|
+
this.localStateDefinitionsVersion = ((_a = this.localStateDefinitionsVersion) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
11232
|
+
}
|
|
11233
|
+
this.compiledStateDefinitions = compiledDefinitions;
|
|
11234
|
+
this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
11235
|
+
}
|
|
11206
11236
|
getStateResolveBaseAttrs() {
|
|
11207
11237
|
var _a;
|
|
11208
11238
|
return ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
|
|
@@ -11768,7 +11798,7 @@ class GraphicImpl extends Node {
|
|
|
11768
11798
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
11769
11799
|
}
|
|
11770
11800
|
}
|
|
11771
|
-
setStage(stage, layer) {
|
|
11801
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
11772
11802
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
11773
11803
|
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;
|
|
11774
11804
|
const previousStage = this.stage;
|
|
@@ -11779,7 +11809,7 @@ class GraphicImpl extends Node {
|
|
|
11779
11809
|
this.boundSharedStateScope ||
|
|
11780
11810
|
((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
|
|
11781
11811
|
this.sharedStateDirty) {
|
|
11782
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
11812
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
11783
11813
|
}
|
|
11784
11814
|
this.setStageToShadowRoot(stage, layer);
|
|
11785
11815
|
if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
@@ -11829,7 +11859,7 @@ class GraphicImpl extends Node {
|
|
|
11829
11859
|
this.boundSharedStateScope ||
|
|
11830
11860
|
((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
|
|
11831
11861
|
this.sharedStateDirty) {
|
|
11832
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
11862
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
11833
11863
|
}
|
|
11834
11864
|
}
|
|
11835
11865
|
detachStageForRelease() {
|
|
@@ -15617,8 +15647,8 @@ class RichText extends Graphic {
|
|
|
15617
15647
|
clone() {
|
|
15618
15648
|
return new RichText(Object.assign({}, this.attribute));
|
|
15619
15649
|
}
|
|
15620
|
-
setStage(stage, layer) {
|
|
15621
|
-
super.setStage(stage, layer);
|
|
15650
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
15651
|
+
super.setStage(stage, layer, inheritedSharedStateScope);
|
|
15622
15652
|
const frameCache = this.getFrameCache();
|
|
15623
15653
|
frameCache.icons.forEach(icon => {
|
|
15624
15654
|
icon.setStage(stage, layer);
|
|
@@ -16539,7 +16569,7 @@ class Group extends Graphic {
|
|
|
16539
16569
|
});
|
|
16540
16570
|
this.addUpdateBoundTag();
|
|
16541
16571
|
}
|
|
16542
|
-
setStage(stage, layer) {
|
|
16572
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
16543
16573
|
var _a, _b, _c, _d, _e, _f;
|
|
16544
16574
|
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;
|
|
16545
16575
|
const needsSharedStateTreeSync = this.hasSharedStateDefinitions() ||
|
|
@@ -16553,12 +16583,12 @@ class Group extends Graphic {
|
|
|
16553
16583
|
this.layer = layer;
|
|
16554
16584
|
if (needsSharedStateTreeSync) {
|
|
16555
16585
|
this.ensureSharedStateScopeBound();
|
|
16556
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
16586
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
16557
16587
|
}
|
|
16558
16588
|
this.setStageToShadowRoot(stage, layer);
|
|
16559
16589
|
this._onSetStage && this._onSetStage(this, stage, layer);
|
|
16560
16590
|
(_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
|
|
16561
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16591
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16562
16592
|
return;
|
|
16563
16593
|
}
|
|
16564
16594
|
const layerChanged = this.layer !== layer;
|
|
@@ -16567,11 +16597,11 @@ class Group extends Graphic {
|
|
|
16567
16597
|
}
|
|
16568
16598
|
if (needsSharedStateTreeSync) {
|
|
16569
16599
|
this.ensureSharedStateScopeBound();
|
|
16570
|
-
this.syncSharedStateScopeBindingOnTreeChange(true);
|
|
16571
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16600
|
+
this.syncSharedStateScopeBindingOnTreeChange(true, inheritedSharedStateScope);
|
|
16601
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16572
16602
|
}
|
|
16573
16603
|
else if (layerChanged) {
|
|
16574
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16604
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16575
16605
|
}
|
|
16576
16606
|
}
|
|
16577
16607
|
addUpdatePositionTag() {
|
|
@@ -16666,23 +16696,48 @@ class Group extends Graphic {
|
|
|
16666
16696
|
hasSharedStateDefinitions() {
|
|
16667
16697
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
16668
16698
|
}
|
|
16669
|
-
|
|
16699
|
+
resolveChildSharedStateScope(inheritedSharedStateScope) {
|
|
16700
|
+
var _a;
|
|
16701
|
+
if (this.sharedStateScope) {
|
|
16702
|
+
return this.sharedStateScope;
|
|
16703
|
+
}
|
|
16704
|
+
if (inheritedSharedStateScope !== undefined) {
|
|
16705
|
+
return inheritedSharedStateScope;
|
|
16706
|
+
}
|
|
16707
|
+
return (_a = this.resolveBoundSharedStateScope()) !== null && _a !== void 0 ? _a : null;
|
|
16708
|
+
}
|
|
16709
|
+
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
16710
|
+
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
16670
16711
|
this.forEachChildren(item => {
|
|
16671
|
-
this.
|
|
16712
|
+
this.setStageToChild(item, childSharedStateScope);
|
|
16672
16713
|
});
|
|
16673
16714
|
}
|
|
16674
|
-
|
|
16675
|
-
child
|
|
16715
|
+
setStageToChild(child, inheritedSharedStateScope) {
|
|
16716
|
+
const graphic = child;
|
|
16717
|
+
if (typeof graphic.setStage === 'function' &&
|
|
16718
|
+
(child.onParentSharedStateTreeChanged === Graphic.prototype.onParentSharedStateTreeChanged ||
|
|
16719
|
+
child.onParentSharedStateTreeChanged === Group.prototype.onParentSharedStateTreeChanged) &&
|
|
16720
|
+
(graphic.stage !== this.stage || graphic.layer !== this.layer)) {
|
|
16721
|
+
graphic.setStage(this.stage, this.layer, inheritedSharedStateScope);
|
|
16722
|
+
return;
|
|
16723
|
+
}
|
|
16724
|
+
child.onParentSharedStateTreeChanged(this.stage, this.layer, inheritedSharedStateScope);
|
|
16725
|
+
}
|
|
16726
|
+
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
16727
|
+
if (inheritedSharedStateScope === undefined) {
|
|
16728
|
+
inheritedSharedStateScope = this.resolveChildSharedStateScope();
|
|
16729
|
+
}
|
|
16730
|
+
this.setStageToChild(child, inheritedSharedStateScope);
|
|
16676
16731
|
}
|
|
16677
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
16732
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
16678
16733
|
var _a;
|
|
16679
16734
|
if (this.stage !== stage || this.layer !== layer) {
|
|
16680
|
-
this.setStage(stage, layer);
|
|
16735
|
+
this.setStage(stage, layer, inheritedSharedStateScope);
|
|
16681
16736
|
return;
|
|
16682
16737
|
}
|
|
16683
16738
|
this.ensureSharedStateScopeBound();
|
|
16684
|
-
this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
|
|
16685
|
-
this.notifyChildrenSharedStateTreeChanged();
|
|
16739
|
+
this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length), inheritedSharedStateScope);
|
|
16740
|
+
this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
16686
16741
|
}
|
|
16687
16742
|
}
|
|
16688
16743
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
package/es/animate/config.js
CHANGED
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(): {
|
|
@@ -240,6 +242,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
240
242
|
}): void;
|
|
241
243
|
hasState(stateName?: string): boolean;
|
|
242
244
|
getState(stateName: string): Partial<T> | StateDefinition<T> | undefined;
|
|
245
|
+
setStateDefinitionsWithCompiled(definitions: StateDefinitionsInput<T>, compiledDefinitions: Map<string, CompiledStateDefinition<T>>): void;
|
|
243
246
|
protected getStateResolveBaseAttrs(): Partial<T>;
|
|
244
247
|
protected syncStateResolveContext(stateResolveBaseAttrs?: Partial<T>): Partial<T>;
|
|
245
248
|
protected ensureStateEngine(stateResolveBaseAttrs?: Partial<T>): StateEngine<T>;
|
|
@@ -295,7 +298,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
295
298
|
}, resetScale?: boolean): [number, number];
|
|
296
299
|
protected doUpdateLocalMatrix(): void;
|
|
297
300
|
protected doUpdateGlobalMatrix(): void;
|
|
298
|
-
setStage(stage?: IStage, layer?: ILayer): void;
|
|
301
|
+
setStage(stage?: IStage, layer?: ILayer, inheritedSharedStateScope?: SharedStateScope<Record<string, any>> | null): void;
|
|
299
302
|
detachStageForRelease(): void;
|
|
300
303
|
setStageToShadowRoot(stage?: IStage, layer?: ILayer): void;
|
|
301
304
|
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;
|
|
@@ -861,6 +873,12 @@ class GraphicImpl extends Node {
|
|
|
861
873
|
var _a;
|
|
862
874
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
863
875
|
}
|
|
876
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
877
|
+
var _a;
|
|
878
|
+
this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions,
|
|
879
|
+
this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1),
|
|
880
|
+
this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
881
|
+
}
|
|
864
882
|
getStateResolveBaseAttrs() {
|
|
865
883
|
var _a;
|
|
866
884
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -1195,11 +1213,11 @@ class GraphicImpl extends Node {
|
|
|
1195
1213
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
1196
1214
|
}
|
|
1197
1215
|
}
|
|
1198
|
-
setStage(stage, layer) {
|
|
1216
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
1199
1217
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1200
1218
|
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;
|
|
1201
1219
|
if (this.stage !== stage || this.layer !== layer) {
|
|
1202
|
-
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),
|
|
1220
|
+
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),
|
|
1203
1221
|
this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
1204
1222
|
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 = [];
|
|
1205
1223
|
this.visitTrackedAnimates((a => {
|
|
@@ -1217,7 +1235,7 @@ class GraphicImpl extends Node {
|
|
|
1217
1235
|
}
|
|
1218
1236
|
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));
|
|
1219
1237
|
}
|
|
1220
|
-
((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);
|
|
1238
|
+
((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);
|
|
1221
1239
|
}
|
|
1222
1240
|
detachStageForRelease() {
|
|
1223
1241
|
var _a, _b, _c;
|