@visactor/vrender-core 1.1.0-alpha.18 → 1.1.0-alpha.19
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 +3 -1
- package/cjs/graphic/graphic.js +20 -14
- package/cjs/graphic/graphic.js.map +1 -1
- package/dist/index.es.js +23 -16
- package/es/graphic/graphic.d.ts +3 -1
- package/es/graphic/graphic.js +20 -14
- package/es/graphic/graphic.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -10841,18 +10841,17 @@ class Graphic extends Node {
|
|
|
10841
10841
|
};
|
|
10842
10842
|
}
|
|
10843
10843
|
recomputeCurrentStatePatch() {
|
|
10844
|
-
var _a, _b
|
|
10844
|
+
var _a, _b;
|
|
10845
10845
|
if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
10846
10846
|
this.effectiveStates = [];
|
|
10847
10847
|
this.resolvedStatePatch = undefined;
|
|
10848
10848
|
this.syncSharedStateActiveRegistrations();
|
|
10849
10849
|
return;
|
|
10850
10850
|
}
|
|
10851
|
-
const stateResolveBaseAttrs =
|
|
10852
|
-
const stateModel = this.createStateModel();
|
|
10853
|
-
(_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.setResolveContext(this, stateResolveBaseAttrs);
|
|
10851
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
|
|
10852
|
+
const stateModel = this.createStateModel(stateResolveBaseAttrs);
|
|
10854
10853
|
const transition = stateModel.useStates(this.currentStates);
|
|
10855
|
-
const effectiveStates = (
|
|
10854
|
+
const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
|
|
10856
10855
|
const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
|
|
10857
10856
|
? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
10858
10857
|
this.currentStates = transition.states;
|
|
@@ -11903,7 +11902,16 @@ class Graphic extends Node {
|
|
|
11903
11902
|
var _a;
|
|
11904
11903
|
return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
|
|
11905
11904
|
}
|
|
11906
|
-
|
|
11905
|
+
getStateResolveBaseAttrs() {
|
|
11906
|
+
var _a;
|
|
11907
|
+
return ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
|
|
11908
|
+
}
|
|
11909
|
+
syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
11910
|
+
var _a;
|
|
11911
|
+
(_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.setResolveContext(this, stateResolveBaseAttrs);
|
|
11912
|
+
return stateResolveBaseAttrs;
|
|
11913
|
+
}
|
|
11914
|
+
createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
11907
11915
|
const { compiledDefinitions, stateProxyEligibility, stateProxyModeKey } = this.resolveEffectiveCompiledDefinitions();
|
|
11908
11916
|
this.compiledStateDefinitions = compiledDefinitions;
|
|
11909
11917
|
if (!compiledDefinitions) {
|
|
@@ -11931,6 +11939,7 @@ class Graphic extends Node {
|
|
|
11931
11939
|
this.stateEngineMergeMode = this.stateMergeMode;
|
|
11932
11940
|
this.stateEngineStateProxyModeKey = stateProxyModeKey;
|
|
11933
11941
|
}
|
|
11942
|
+
this.syncStateResolveContext(stateResolveBaseAttrs);
|
|
11934
11943
|
return new StateModel({
|
|
11935
11944
|
states: this.states,
|
|
11936
11945
|
currentStates: this.currentStates,
|
|
@@ -12031,7 +12040,7 @@ class Graphic extends Node {
|
|
|
12031
12040
|
};
|
|
12032
12041
|
}
|
|
12033
12042
|
resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = false) {
|
|
12034
|
-
var _a, _b
|
|
12043
|
+
var _a, _b;
|
|
12035
12044
|
let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
|
|
12036
12045
|
const isSimpleLocalTransition = !!transition;
|
|
12037
12046
|
let resolvedStateAttrs;
|
|
@@ -12039,18 +12048,17 @@ class Graphic extends Node {
|
|
|
12039
12048
|
resolvedStateAttrs = transition.resolvedStateAttrs;
|
|
12040
12049
|
}
|
|
12041
12050
|
else {
|
|
12042
|
-
const stateResolveBaseAttrs =
|
|
12043
|
-
const stateModel = this.createStateModel();
|
|
12044
|
-
(_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.setResolveContext(this, stateResolveBaseAttrs);
|
|
12051
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
|
|
12052
|
+
const stateModel = this.createStateModel(stateResolveBaseAttrs);
|
|
12045
12053
|
if (forceResolverRefresh) {
|
|
12046
|
-
(
|
|
12054
|
+
(_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.invalidateResolverCache();
|
|
12047
12055
|
}
|
|
12048
12056
|
transition = stateModel.useStates(states);
|
|
12049
12057
|
resolvedStateAttrs =
|
|
12050
12058
|
this.stateEngine && this.compiledStateDefinitions
|
|
12051
12059
|
? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
12052
12060
|
}
|
|
12053
|
-
const effectiveStates = (
|
|
12061
|
+
const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
|
|
12054
12062
|
return {
|
|
12055
12063
|
transition,
|
|
12056
12064
|
effectiveStates: effectiveStates,
|
|
@@ -12331,13 +12339,12 @@ class Graphic extends Node {
|
|
|
12331
12339
|
}
|
|
12332
12340
|
}
|
|
12333
12341
|
invalidateResolver() {
|
|
12334
|
-
var _a, _b
|
|
12342
|
+
var _a, _b;
|
|
12335
12343
|
if (!this.stateEngine || !((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.compiledStateDefinitions) {
|
|
12336
12344
|
return;
|
|
12337
12345
|
}
|
|
12338
|
-
|
|
12339
|
-
this.
|
|
12340
|
-
this.resolverEpoch = ((_c = this.resolverEpoch) !== null && _c !== void 0 ? _c : 0) + 1;
|
|
12346
|
+
this.syncStateResolveContext();
|
|
12347
|
+
this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
|
|
12341
12348
|
this.stateEngine.invalidateResolverCache();
|
|
12342
12349
|
const transition = this.stateEngine.applyStates(this.currentStates);
|
|
12343
12350
|
const resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
|
package/es/graphic/graphic.d.ts
CHANGED
|
@@ -245,7 +245,9 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
245
245
|
}): void;
|
|
246
246
|
hasState(stateName?: string): boolean;
|
|
247
247
|
getState(stateName: string): Partial<T> | StateDefinition<T> | undefined;
|
|
248
|
-
protected
|
|
248
|
+
protected getStateResolveBaseAttrs(): Partial<T>;
|
|
249
|
+
protected syncStateResolveContext(stateResolveBaseAttrs?: Partial<T>): Partial<T>;
|
|
250
|
+
protected createStateModel(stateResolveBaseAttrs?: Partial<T>): StateModel<T>;
|
|
249
251
|
protected resolveSimpleLocalStateTransition(states: string[], previousStates: readonly string[]): {
|
|
250
252
|
changed: boolean;
|
|
251
253
|
states: string[];
|
package/es/graphic/graphic.js
CHANGED
|
@@ -290,12 +290,10 @@ export class Graphic extends Node {
|
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
recomputeCurrentStatePatch() {
|
|
293
|
-
var _a, _b
|
|
293
|
+
var _a, _b;
|
|
294
294
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [],
|
|
295
295
|
this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
|
|
296
|
-
const stateResolveBaseAttrs = null !== (_b =
|
|
297
|
-
null === (_c = this.stateEngine) || void 0 === _c || _c.setResolveContext(this, stateResolveBaseAttrs);
|
|
298
|
-
const transition = stateModel.useStates(this.currentStates), effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states, resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
296
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(), transition = this.createStateModel(stateResolveBaseAttrs).useStates(this.currentStates), effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states, resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
299
297
|
this.currentStates = transition.states, this.effectiveStates = [ ...effectiveStates ],
|
|
300
298
|
this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
|
|
301
299
|
}
|
|
@@ -879,7 +877,16 @@ export class Graphic extends Node {
|
|
|
879
877
|
var _a;
|
|
880
878
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
881
879
|
}
|
|
882
|
-
|
|
880
|
+
getStateResolveBaseAttrs() {
|
|
881
|
+
var _a;
|
|
882
|
+
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
883
|
+
}
|
|
884
|
+
syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
885
|
+
var _a;
|
|
886
|
+
return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs),
|
|
887
|
+
stateResolveBaseAttrs;
|
|
888
|
+
}
|
|
889
|
+
createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
883
890
|
const {compiledDefinitions: compiledDefinitions, stateProxyEligibility: stateProxyEligibility, stateProxyModeKey: stateProxyModeKey} = this.resolveEffectiveCompiledDefinitions();
|
|
884
891
|
return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.stateEngineStateProxy === this.stateProxy && this.stateEngineStateSort === this.stateSort && this.stateEngineMergeMode === this.stateMergeMode && this.stateEngineStateProxyModeKey === stateProxyModeKey || (this.stateEngine = new StateEngine({
|
|
885
892
|
compiledDefinitions: compiledDefinitions,
|
|
@@ -892,7 +899,7 @@ export class Graphic extends Node {
|
|
|
892
899
|
this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode,
|
|
893
900
|
this.stateEngineStateProxyModeKey = stateProxyModeKey) : (this.stateEngine = void 0,
|
|
894
901
|
this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0),
|
|
895
|
-
new StateModel({
|
|
902
|
+
this.syncStateResolveContext(stateResolveBaseAttrs), new StateModel({
|
|
896
903
|
states: this.states,
|
|
897
904
|
currentStates: this.currentStates,
|
|
898
905
|
stateSort: this.stateSort,
|
|
@@ -954,19 +961,18 @@ export class Graphic extends Node {
|
|
|
954
961
|
};
|
|
955
962
|
}
|
|
956
963
|
resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
|
|
957
|
-
var _a, _b
|
|
964
|
+
var _a, _b;
|
|
958
965
|
let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
|
|
959
966
|
const isSimpleLocalTransition = !!transition;
|
|
960
967
|
let resolvedStateAttrs;
|
|
961
968
|
if (transition) resolvedStateAttrs = transition.resolvedStateAttrs; else {
|
|
962
|
-
const stateResolveBaseAttrs =
|
|
963
|
-
null === (
|
|
964
|
-
forceResolverRefresh && (null === (_c = this.stateEngine) || void 0 === _c || _c.invalidateResolverCache()),
|
|
969
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(), stateModel = this.createStateModel(stateResolveBaseAttrs);
|
|
970
|
+
forceResolverRefresh && (null === (_a = this.stateEngine) || void 0 === _a || _a.invalidateResolverCache()),
|
|
965
971
|
transition = stateModel.useStates(states), resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
966
972
|
}
|
|
967
973
|
return {
|
|
968
974
|
transition: transition,
|
|
969
|
-
effectiveStates: null !== (
|
|
975
|
+
effectiveStates: null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
|
|
970
976
|
resolvedStateAttrs: resolvedStateAttrs,
|
|
971
977
|
isSimpleLocalTransition: isSimpleLocalTransition
|
|
972
978
|
};
|
|
@@ -1123,10 +1129,10 @@ export class Graphic extends Node {
|
|
|
1123
1129
|
}
|
|
1124
1130
|
}
|
|
1125
1131
|
invalidateResolver() {
|
|
1126
|
-
var _a, _b
|
|
1132
|
+
var _a, _b;
|
|
1127
1133
|
if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
|
|
1128
|
-
|
|
1129
|
-
this.
|
|
1134
|
+
this.syncStateResolveContext();
|
|
1135
|
+
this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1,
|
|
1130
1136
|
this.stateEngine.invalidateResolverCache();
|
|
1131
1137
|
const transition = this.stateEngine.applyStates(this.currentStates), resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
|
|
1132
1138
|
this.effectiveStates = [ ...transition.effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
|