@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/cjs/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/cjs/graphic/graphic.js
CHANGED
|
@@ -144,8 +144,9 @@ 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
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0) {
|
|
148
148
|
var _a;
|
|
149
|
+
const nextScope = this.resolveBoundSharedStateScope();
|
|
149
150
|
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(),
|
|
150
151
|
!1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0,
|
|
151
152
|
this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0,
|
|
@@ -153,13 +154,9 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
153
154
|
markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(),
|
|
154
155
|
!0);
|
|
155
156
|
}
|
|
156
|
-
|
|
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) {
|
|
157
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
161
158
|
var _a, _b;
|
|
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
|
|
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);
|
|
163
160
|
}
|
|
164
161
|
syncSharedStateActiveRegistrations() {
|
|
165
162
|
var _a;
|
|
@@ -167,7 +164,6 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
167
164
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach((scope => {
|
|
168
165
|
scope.subtreeActiveDescendants.delete(this);
|
|
169
166
|
})), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
170
|
-
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
171
167
|
const nextScopes = new Set((0, shared_state_scope_1.collectSharedStateScopeChain)(this.boundSharedStateScope));
|
|
172
168
|
null == previousScopes || previousScopes.forEach((scope => {
|
|
173
169
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -175,14 +171,6 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
175
171
|
scope.subtreeActiveDescendants.add(this);
|
|
176
172
|
})), this.registeredActiveScopes = nextScopes;
|
|
177
173
|
}
|
|
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
|
-
}
|
|
186
174
|
clearSharedStateActiveRegistrations() {
|
|
187
175
|
const previousScopes = this.registeredActiveScopes;
|
|
188
176
|
previousScopes && (previousScopes.forEach((scope => {
|
|
@@ -193,8 +181,8 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
193
181
|
this.sharedStateDirty = !0, (0, shared_state_refresh_1.enqueueGraphicSharedStateRefresh)(this.stage, this),
|
|
194
182
|
(0, shared_state_refresh_1.scheduleStageSharedStateRefresh)(this.stage);
|
|
195
183
|
}
|
|
196
|
-
onParentSharedStateTreeChanged(stage, layer
|
|
197
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(
|
|
184
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
185
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
198
186
|
}
|
|
199
187
|
refreshSharedStateBeforeRender() {
|
|
200
188
|
var _a;
|
|
@@ -844,12 +832,6 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
844
832
|
var _a;
|
|
845
833
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
846
834
|
}
|
|
847
|
-
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
848
|
-
var _a;
|
|
849
|
-
this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions,
|
|
850
|
-
this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1),
|
|
851
|
-
this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
|
|
852
|
-
}
|
|
853
835
|
getStateResolveBaseAttrs() {
|
|
854
836
|
var _a;
|
|
855
837
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -1038,10 +1020,8 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1038
1020
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
1039
1021
|
}
|
|
1040
1022
|
addState(stateName, keepCurrentStates, hasAnimation) {
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
-
const nextStates = keepCurrentStates && (null == currentStates ? void 0 : currentStates.length) ? currentStates.concat([ stateName ]) : [ stateName ];
|
|
1044
|
-
this.useStates(nextStates, hasAnimation);
|
|
1023
|
+
const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
|
|
1024
|
+
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
1045
1025
|
}
|
|
1046
1026
|
setStates(states, options) {
|
|
1047
1027
|
var _a, _b, _c;
|
|
@@ -1177,11 +1157,11 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1177
1157
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
1178
1158
|
}
|
|
1179
1159
|
}
|
|
1180
|
-
setStage(stage, layer
|
|
1160
|
+
setStage(stage, layer) {
|
|
1181
1161
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1182
1162
|
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;
|
|
1183
1163
|
if (this.stage !== stage || this.layer !== layer) {
|
|
1184
|
-
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
|
|
1164
|
+
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),
|
|
1185
1165
|
this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
1186
1166
|
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 = [];
|
|
1187
1167
|
this.visitTrackedAnimates((a => {
|
|
@@ -1199,7 +1179,7 @@ class GraphicImpl extends node_tree_1.Node {
|
|
|
1199
1179
|
}
|
|
1200
1180
|
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));
|
|
1201
1181
|
}
|
|
1202
|
-
((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
|
|
1182
|
+
((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);
|
|
1203
1183
|
}
|
|
1204
1184
|
detachStageForRelease() {
|
|
1205
1185
|
var _a, _b, _c;
|