@visactor/vrender-core 1.1.4-alpha.1 → 1.1.4-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/common/bounds-context.js +1 -2
- package/cjs/common/custom-path2d.js +2 -1
- package/cjs/common/module-guard.js +1 -1
- package/cjs/common/morphing-utils.js +1 -1
- package/cjs/common/path-svg.js +1 -1
- package/cjs/common/performance-raf.js +1 -2
- package/cjs/common/polygon.js +2 -2
- package/cjs/common/rect-utils.js +1 -1
- package/cjs/common/render-area.js +1 -1
- package/cjs/common/render-command-list.js +1 -1
- package/cjs/common/render-curve.js +1 -1
- package/cjs/common/render-utils.js +1 -1
- package/cjs/common/seg-context.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/core-modules.js +2 -1
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/layer-service.js +1 -1
- package/cjs/core/layer.js +1 -1
- package/cjs/core/light.js +1 -1
- package/cjs/core/stage.js +1 -1
- package/cjs/core/window.js +1 -1
- package/cjs/graphic/graphic.d.ts +7 -4
- package/cjs/graphic/graphic.js +31 -11
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +7 -4
- package/cjs/graphic/group.js +31 -17
- 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/utils.js +3 -0
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +4 -1
- package/cjs/graphic/richtext.js +2 -2
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/state/state-engine.d.ts +1 -0
- package/cjs/graphic/state/state-engine.js +17 -0
- package/cjs/graphic/state/state-engine.js.map +1 -1
- package/cjs/interface/graphic/richText.d.ts +2 -0
- package/cjs/interface/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 +134 -36
- package/es/common/bounds-context.js +1 -2
- package/es/common/custom-path2d.js +2 -1
- package/es/common/module-guard.js +1 -1
- package/es/common/morphing-utils.js +1 -1
- package/es/common/path-svg.js +1 -1
- package/es/common/performance-raf.js +1 -2
- package/es/common/polygon.js +1 -1
- package/es/common/rect-utils.js +1 -1
- package/es/common/render-area.js +1 -1
- package/es/common/render-command-list.js +1 -1
- package/es/common/render-curve.js +1 -1
- package/es/common/render-utils.js +1 -1
- package/es/common/seg-context.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/core-modules.js +2 -1
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +1 -1
- package/es/core/index.js +1 -1
- package/es/core/layer-service.js +1 -1
- package/es/core/layer.js +1 -1
- package/es/core/light.js +1 -1
- package/es/core/stage.js +1 -1
- package/es/core/window.js +1 -1
- package/es/graphic/graphic.d.ts +7 -4
- package/es/graphic/graphic.js +31 -11
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +7 -4
- package/es/graphic/group.js +31 -17
- 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/utils.js +3 -0
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext.d.ts +4 -1
- package/es/graphic/richtext.js +2 -2
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/state/state-engine.d.ts +1 -0
- package/es/graphic/state/state-engine.js +17 -0
- package/es/graphic/state/state-engine.js.map +1 -1
- package/es/interface/graphic/richText.d.ts +2 -0
- package/es/interface/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/es/core/camera.js
CHANGED
package/es/core/constants.js
CHANGED
|
@@ -9,4 +9,4 @@ export const StaticLayerHandlerContribution = Symbol.for("StaticLayerHandlerCont
|
|
|
9
9
|
export const DynamicLayerHandlerContribution = Symbol.for("DynamicLayerHandlerContribution");
|
|
10
10
|
|
|
11
11
|
export const VirtualLayerHandlerContribution = Symbol.for("VirtualLayerHandlerContribution");
|
|
12
|
-
//# sourceMappingURL=constants.js.map
|
|
12
|
+
//# sourceMappingURL=constants.js.map
|
package/es/core/core-modules.js
CHANGED
|
@@ -20,4 +20,5 @@ export function bindCoreModules({bind: bind}) {
|
|
|
20
20
|
bind(TransformUtil).to(DefaultTransformUtil).inSingletonScope(), bind(LayerService).to(DefaultLayerService).inSingletonScope();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export default bindCoreModules;
|
|
23
|
+
export default bindCoreModules;
|
|
24
|
+
//# sourceMappingURL=core-modules.js.map
|
package/es/core/global.js
CHANGED
package/es/core/graphic-utils.js
CHANGED
package/es/core/index.js
CHANGED
package/es/core/layer-service.js
CHANGED
package/es/core/layer.js
CHANGED
package/es/core/light.js
CHANGED
package/es/core/stage.js
CHANGED
package/es/core/window.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(): {
|
|
@@ -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;
|
|
@@ -1050,8 +1068,10 @@ class GraphicImpl extends Node {
|
|
|
1050
1068
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
1051
1069
|
}
|
|
1052
1070
|
addState(stateName, keepCurrentStates, hasAnimation) {
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1071
|
+
const currentStates = this.currentStates;
|
|
1072
|
+
if ((null == currentStates ? void 0 : currentStates.includes(stateName)) && (keepCurrentStates || 1 === currentStates.length)) return;
|
|
1073
|
+
const nextStates = keepCurrentStates && (null == currentStates ? void 0 : currentStates.length) ? currentStates.concat([ stateName ]) : [ stateName ];
|
|
1074
|
+
this.useStates(nextStates, hasAnimation);
|
|
1055
1075
|
}
|
|
1056
1076
|
setStates(states, options) {
|
|
1057
1077
|
var _a, _b, _c;
|
|
@@ -1186,11 +1206,11 @@ class GraphicImpl extends Node {
|
|
|
1186
1206
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
1187
1207
|
}
|
|
1188
1208
|
}
|
|
1189
|
-
setStage(stage, layer) {
|
|
1209
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
1190
1210
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1191
1211
|
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
1212
|
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),
|
|
1213
|
+
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
1214
|
this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
|
|
1195
1215
|
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
1216
|
this.visitTrackedAnimates((a => {
|
|
@@ -1208,7 +1228,7 @@ class GraphicImpl extends Node {
|
|
|
1208
1228
|
}
|
|
1209
1229
|
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
1230
|
}
|
|
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);
|
|
1231
|
+
((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
1232
|
}
|
|
1213
1233
|
detachStageForRelease() {
|
|
1214
1234
|
var _a, _b, _c;
|