@visactor/vrender-core 1.1.8-alpha.0 → 1.1.8-alpha.2
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 +1 -2
- package/cjs/animate/config.js +2 -1
- package/cjs/graphic/graphic.d.ts +8 -4
- package/cjs/graphic/graphic.js +36 -13
- 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 +103 -27
- package/es/allocator/bounds-allocate.js +1 -2
- package/es/animate/config.js +2 -1
- package/es/graphic/graphic.d.ts +8 -4
- package/es/graphic/graphic.js +36 -13
- 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 +2 -2
|
@@ -34,5 +34,4 @@ class DefaultBoundsAllocate {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
exports.DefaultBoundsAllocate = DefaultBoundsAllocate, exports.boundsAllocate = new DefaultBoundsAllocate;
|
|
38
|
-
//# sourceMappingURL=bounds-allocate.js.map
|
|
37
|
+
exports.DefaultBoundsAllocate = DefaultBoundsAllocate, exports.boundsAllocate = new DefaultBoundsAllocate;
|
package/cjs/animate/config.js
CHANGED
package/cjs/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>;
|
|
@@ -259,6 +262,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
259
262
|
shouldRefreshSameStatePatch: boolean;
|
|
260
263
|
};
|
|
261
264
|
protected sameStatePatches(left?: Partial<T>, right?: Partial<T>): boolean;
|
|
265
|
+
protected hasStatePatch(patch?: Partial<T>): boolean;
|
|
262
266
|
protected commitSameStatePatchRefresh(states: string[], hasAnimation?: boolean, animateSameStatePatchChange?: boolean): void;
|
|
263
267
|
protected resolveStateAnimateConfig(animateConfig?: IAnimateConfig): any;
|
|
264
268
|
applyStateAttrs(attrs: Partial<T>, stateNames: string[], hasAnimation?: boolean, isClear?: boolean, animateConfig?: IAnimateConfig, extraAnimateAttrs?: Partial<T>, stateTransitionTargetAttrs?: Partial<T>): void;
|
|
@@ -295,7 +299,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
|
|
|
295
299
|
}, resetScale?: boolean): [number, number];
|
|
296
300
|
protected doUpdateLocalMatrix(): void;
|
|
297
301
|
protected doUpdateGlobalMatrix(): void;
|
|
298
|
-
setStage(stage?: IStage, layer?: ILayer): void;
|
|
302
|
+
setStage(stage?: IStage, layer?: ILayer, inheritedSharedStateScope?: SharedStateScope<Record<string, any>> | null): void;
|
|
299
303
|
detachStageForRelease(): void;
|
|
300
304
|
setStageToShadowRoot(stage?: IStage, layer?: ILayer): void;
|
|
301
305
|
onAddStep(step: IStep): void;
|
package/cjs/graphic/graphic.js
CHANGED
|
@@ -144,9 +144,8 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
144
144
|
}
|
|
145
145
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
syncSharedStateScopeBinding(nextScope, markDirty = !0) {
|
|
148
148
|
var _a;
|
|
149
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
150
149
|
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(),
|
|
151
150
|
!1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0,
|
|
152
151
|
this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0,
|
|
@@ -154,9 +153,13 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
154
153
|
markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(),
|
|
155
154
|
!0);
|
|
156
155
|
}
|
|
157
|
-
|
|
156
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
|
|
157
|
+
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
158
|
+
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
159
|
+
}
|
|
160
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
158
161
|
var _a, _b;
|
|
159
|
-
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);
|
|
162
|
+
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);
|
|
160
163
|
}
|
|
161
164
|
syncSharedStateActiveRegistrations() {
|
|
162
165
|
var _a;
|
|
@@ -164,6 +167,7 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
164
167
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach((scope => {
|
|
165
168
|
scope.subtreeActiveDescendants.delete(this);
|
|
166
169
|
})), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
170
|
+
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
167
171
|
const nextScopes = new Set((0, shared_state_scope_1.collectSharedStateScopeChain)(this.boundSharedStateScope));
|
|
168
172
|
null == previousScopes || previousScopes.forEach((scope => {
|
|
169
173
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -171,6 +175,14 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
171
175
|
scope.subtreeActiveDescendants.add(this);
|
|
172
176
|
})), this.registeredActiveScopes = nextScopes;
|
|
173
177
|
}
|
|
178
|
+
isSharedStateScopeChainRegistered(previousScopes) {
|
|
179
|
+
let scope = this.boundSharedStateScope, scopeCount = 0;
|
|
180
|
+
for (;scope; ) {
|
|
181
|
+
if (!previousScopes.has(scope)) return !1;
|
|
182
|
+
scopeCount += 1, scope = scope.parentScope;
|
|
183
|
+
}
|
|
184
|
+
return scopeCount === previousScopes.size;
|
|
185
|
+
}
|
|
174
186
|
clearSharedStateActiveRegistrations() {
|
|
175
187
|
const previousScopes = this.registeredActiveScopes;
|
|
176
188
|
previousScopes && (previousScopes.forEach((scope => {
|
|
@@ -181,8 +193,8 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
181
193
|
this.sharedStateDirty = !0, (0, shared_state_refresh_1.enqueueGraphicSharedStateRefresh)(this.stage, this),
|
|
182
194
|
(0, shared_state_refresh_1.scheduleStageSharedStateRefresh)(this.stage);
|
|
183
195
|
}
|
|
184
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
185
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
196
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
197
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
|
|
186
198
|
}
|
|
187
199
|
refreshSharedStateBeforeRender() {
|
|
188
200
|
var _a;
|
|
@@ -831,6 +843,12 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
831
843
|
var _a;
|
|
832
844
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
833
845
|
}
|
|
846
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
847
|
+
var _a;
|
|
848
|
+
this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions,
|
|
849
|
+
this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1),
|
|
850
|
+
this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
851
|
+
}
|
|
834
852
|
getStateResolveBaseAttrs() {
|
|
835
853
|
var _a;
|
|
836
854
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -945,6 +963,11 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
945
963
|
}
|
|
946
964
|
return !0;
|
|
947
965
|
}
|
|
966
|
+
hasStatePatch(patch) {
|
|
967
|
+
if (!patch) return !1;
|
|
968
|
+
for (const key in patch) if (Object.prototype.hasOwnProperty.call(patch, key)) return !0;
|
|
969
|
+
return !1;
|
|
970
|
+
}
|
|
948
971
|
commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
|
|
949
972
|
var _a;
|
|
950
973
|
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs} = this.resolveGraphicStateTransition(states, !0), patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
@@ -1008,7 +1031,7 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1008
1031
|
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
1009
1032
|
if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) if (this.currentStates = transition.states,
|
|
1010
1033
|
this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1,
|
|
1011
|
-
this.clearSharedStateActiveRegistrations(), hasAnimation) {
|
|
1034
|
+
this.clearSharedStateActiveRegistrations(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch)) if (hasAnimation) {
|
|
1012
1035
|
this._syncFinalAttributeFromStaticTruth();
|
|
1013
1036
|
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
1014
1037
|
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
@@ -1016,7 +1039,7 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1016
1039
|
type: enums_1.AttributeUpdateType.STATE
|
|
1017
1040
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
1018
1041
|
type: enums_1.AttributeUpdateType.STATE
|
|
1019
|
-
}), this.emitStateUpdateEvent();
|
|
1042
|
+
}), this.emitStateUpdateEvent(); else this.emitStateUpdateEvent();
|
|
1020
1043
|
}
|
|
1021
1044
|
removeState(stateName, hasAnimation) {
|
|
1022
1045
|
const transition = this.resolveRemoveStateTransition(stateName);
|
|
@@ -1047,7 +1070,7 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1047
1070
|
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs} = this.resolveGraphicStateTransition(states);
|
|
1048
1071
|
if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) if (this.currentStates = transition.states,
|
|
1049
1072
|
this.effectiveStates = [ ...effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
|
|
1050
|
-
this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation) {
|
|
1073
|
+
this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch) || this.hasStatePatch(resolvedStateAttrs)) if (hasAnimation) {
|
|
1051
1074
|
this._syncFinalAttributeFromStaticTruth();
|
|
1052
1075
|
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
1053
1076
|
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
@@ -1055,7 +1078,7 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1055
1078
|
type: enums_1.AttributeUpdateType.STATE
|
|
1056
1079
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
1057
1080
|
type: enums_1.AttributeUpdateType.STATE
|
|
1058
|
-
}), this.emitStateUpdateEvent();
|
|
1081
|
+
}), this.emitStateUpdateEvent(); else this.emitStateUpdateEvent();
|
|
1059
1082
|
}
|
|
1060
1083
|
invalidateResolver() {
|
|
1061
1084
|
var _a, _b;
|
|
@@ -1166,11 +1189,11 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1166
1189
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
1167
1190
|
}
|
|
1168
1191
|
}
|
|
1169
|
-
setStage(stage, layer) {
|
|
1192
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
1170
1193
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1171
1194
|
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_1.application.graphicService, previousStage = this.stage;
|
|
1172
1195
|
if (this.stage !== stage || this.layer !== layer) {
|
|
1173
|
-
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),
|
|
1196
|
+
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),
|
|
1174
1197
|
this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
1175
1198
|
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 = [];
|
|
1176
1199
|
this.visitTrackedAnimates((a => {
|
|
@@ -1188,7 +1211,7 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1188
1211
|
}
|
|
1189
1212
|
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));
|
|
1190
1213
|
}
|
|
1191
|
-
((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);
|
|
1214
|
+
((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);
|
|
1192
1215
|
}
|
|
1193
1216
|
detachStageForRelease() {
|
|
1194
1217
|
var _a, _b, _c;
|