@visactor/vrender-core 1.1.0 → 1.1.1-alpha.0
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/color-utils.js +2 -1
- package/cjs/common/contribution-provider.d.ts +2 -2
- package/cjs/common/contribution-provider.js +8 -4
- package/cjs/common/contribution-provider.js.map +1 -1
- package/cjs/common/event-listener-manager.js +1 -2
- package/cjs/common/performance-raf.js +1 -1
- package/cjs/common/polygon.js +2 -2
- package/cjs/common/rect-utils.js +1 -1
- package/cjs/common/render-area.js +2 -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/common/simplify.js +1 -1
- package/cjs/common/sort.js +1 -1
- package/cjs/common/split-path.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +1 -2
- 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/entries/runtime-installer.d.ts +13 -0
- package/cjs/entries/runtime-installer.js +53 -10
- package/cjs/entries/runtime-installer.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +6 -4
- package/cjs/graphic/graphic.js +26 -9
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +6 -2
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/dist/index.es.js +131 -16
- package/es/common/color-utils.js +2 -1
- package/es/common/contribution-provider.d.ts +2 -2
- package/es/common/contribution-provider.js +8 -4
- package/es/common/contribution-provider.js.map +1 -1
- package/es/common/event-listener-manager.js +1 -2
- package/es/common/performance-raf.js +1 -1
- package/es/common/polygon.js +1 -1
- package/es/common/rect-utils.js +1 -1
- package/es/common/render-area.js +2 -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/common/simplify.js +1 -1
- package/es/common/sort.js +1 -1
- package/es/common/split-path.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +1 -2
- 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/entries/runtime-installer.d.ts +13 -0
- package/es/entries/runtime-installer.js +51 -7
- package/es/entries/runtime-installer.js.map +1 -1
- package/es/graphic/graphic.d.ts +6 -4
- package/es/graphic/graphic.js +26 -9
- package/es/graphic/graphic.js.map +1 -1
- package/es/interface/graphic.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js +6 -2
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/package.json +1 -1
package/es/common/polygon.js
CHANGED
package/es/common/rect-utils.js
CHANGED
package/es/common/render-area.js
CHANGED
package/es/common/seg-context.js
CHANGED
package/es/common/simplify.js
CHANGED
|
@@ -30,4 +30,4 @@ export function flatten_simplify(points, tolerance, highestQuality) {
|
|
|
30
30
|
if (points.length <= 10) return points;
|
|
31
31
|
return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
|
|
32
32
|
}
|
|
33
|
-
//# sourceMappingURL=simplify.js.map
|
|
33
|
+
//# sourceMappingURL=simplify.js.map
|
package/es/common/sort.js
CHANGED
package/es/common/split-path.js
CHANGED
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
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
|
@@ -2,6 +2,18 @@ import type { IGlobal, IGraphicPicker } from '../interface';
|
|
|
2
2
|
import type { IApp } from './types';
|
|
3
3
|
import type { ServiceIdentifier } from '../common/explicit-binding';
|
|
4
4
|
import { type ILegacyBindingContext } from '../legacy/binding-context';
|
|
5
|
+
export type TRuntimeContributionModuleRegistry = (bind: ILegacyBindingContext['bind'], unbind: (serviceIdentifier: ServiceIdentifier) => void, isBound: ILegacyBindingContext['isBound'], rebind: ILegacyBindingContext['rebind']) => void;
|
|
6
|
+
export type TRuntimeContributionModule = ((context: ILegacyBindingContext) => void) | {
|
|
7
|
+
registry: TRuntimeContributionModuleRegistry;
|
|
8
|
+
};
|
|
9
|
+
export type TRuntimeContributionInstallTarget = 'graphic-renderer' | 'draw-contribution' | {
|
|
10
|
+
picker: ServiceIdentifier<IGraphicPicker>;
|
|
11
|
+
};
|
|
12
|
+
export interface IRuntimeContributionModuleInstallOptions {
|
|
13
|
+
app?: IApp;
|
|
14
|
+
legacy?: boolean;
|
|
15
|
+
targets?: TRuntimeContributionInstallTarget[];
|
|
16
|
+
}
|
|
5
17
|
export declare function getRuntimeInstallerBindingContext(): ILegacyBindingContext;
|
|
6
18
|
export declare function refreshRuntimeInstallerContributions(): void;
|
|
7
19
|
export declare function getRuntimeInstallerGlobal(): IGlobal;
|
|
@@ -9,3 +21,4 @@ export declare function configureRuntimeApplicationForApp(app: IApp): void;
|
|
|
9
21
|
export declare function installRuntimeGraphicRenderersToApp(app: IApp): void;
|
|
10
22
|
export declare function installRuntimeDrawContributionsToApp(app: IApp): void;
|
|
11
23
|
export declare function installRuntimePickersToApp<T extends IGraphicPicker>(app: IApp, serviceIdentifier: ServiceIdentifier<T>): void;
|
|
24
|
+
export declare function installRuntimeContributionModule(module: TRuntimeContributionModule, { app, legacy, targets }?: IRuntimeContributionModuleInstallOptions): void;
|
|
@@ -18,6 +18,8 @@ import graphicModule from "../graphic/graphic-service/graphic-module";
|
|
|
18
18
|
|
|
19
19
|
import { createLegacyBindingContext } from "../legacy/binding-context";
|
|
20
20
|
|
|
21
|
+
import { getLegacyBindingContext, preLoadAllModule } from "../legacy/bootstrap";
|
|
22
|
+
|
|
21
23
|
import pickModule from "../picker/pick-modules";
|
|
22
24
|
|
|
23
25
|
import { AreaRenderContribution } from "../render/contributions/render/contributions/constants";
|
|
@@ -44,7 +46,7 @@ const runtimeInstallerContext = createLegacyBindingContext();
|
|
|
44
46
|
|
|
45
47
|
let runtimeGlobal, runtimeInstallerPreloaded = !1;
|
|
46
48
|
|
|
47
|
-
const RUNTIME_RENDERER_NAMESPACE = "vrender:runtime-renderer", RUNTIME_PICKER_NAMESPACE = "vrender:runtime-picker", runtimeEntryKeys = new WeakMap, runtimeDrawContributions = new WeakMap;
|
|
49
|
+
const RUNTIME_RENDERER_NAMESPACE = "vrender:runtime-renderer", RUNTIME_PICKER_NAMESPACE = "vrender:runtime-picker", runtimeEntryKeys = new WeakMap, runtimeDrawContributions = new WeakMap, loadedRuntimeContributionModules = new WeakMap, DEFAULT_RUNTIME_CONTRIBUTION_TARGETS = [ "graphic-renderer" ], noopUnbindRuntimeContributionService = () => {};
|
|
48
50
|
|
|
49
51
|
function ensureRuntimeInstallerPreloaded() {
|
|
50
52
|
runtimeInstallerPreloaded || (runtimeInstallerPreloaded = !0, coreModule({
|
|
@@ -119,13 +121,13 @@ export function installRuntimeGraphicRenderersToApp(app) {
|
|
|
119
121
|
var _a;
|
|
120
122
|
const bindingContext = getRuntimeInstallerBindingContext();
|
|
121
123
|
refreshRuntimeInstallerContributions();
|
|
122
|
-
const renderers = bindingContext.getAll(GraphicRender), registeredKeys = getTrackedEntryKeys(app.registry.renderer,
|
|
123
|
-
clearTrackedEntryKeys(app.registry.renderer,
|
|
124
|
+
const renderers = bindingContext.getAll(GraphicRender), registeredKeys = getTrackedEntryKeys(app.registry.renderer, RUNTIME_RENDERER_NAMESPACE);
|
|
125
|
+
clearTrackedEntryKeys(app.registry.renderer, RUNTIME_RENDERER_NAMESPACE, null === (_a = app.registry.renderer.unregister) || void 0 === _a ? void 0 : _a.bind(app.registry.renderer)),
|
|
124
126
|
registerRuntimeEntries(((key, renderer) => {
|
|
125
127
|
var _a;
|
|
126
128
|
null === (_a = null == renderer ? void 0 : renderer.reInit) || void 0 === _a || _a.call(renderer),
|
|
127
129
|
app.registry.renderer.register(key, renderer), registeredKeys.add(key);
|
|
128
|
-
}), renderers,
|
|
130
|
+
}), renderers, RUNTIME_RENDERER_NAMESPACE);
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
export function installRuntimeDrawContributionsToApp(app) {
|
|
@@ -148,10 +150,52 @@ export function installRuntimePickersToApp(app, serviceIdentifier) {
|
|
|
148
150
|
var _a;
|
|
149
151
|
const bindingContext = getRuntimeInstallerBindingContext();
|
|
150
152
|
refreshRuntimeInstallerContributions();
|
|
151
|
-
const pickers = bindingContext.getAll(serviceIdentifier), registeredKeys = getTrackedEntryKeys(app.registry.picker,
|
|
152
|
-
clearTrackedEntryKeys(app.registry.picker,
|
|
153
|
+
const pickers = bindingContext.getAll(serviceIdentifier), registeredKeys = getTrackedEntryKeys(app.registry.picker, RUNTIME_PICKER_NAMESPACE);
|
|
154
|
+
clearTrackedEntryKeys(app.registry.picker, RUNTIME_PICKER_NAMESPACE, null === (_a = app.registry.picker.unregister) || void 0 === _a ? void 0 : _a.bind(app.registry.picker)),
|
|
153
155
|
registerRuntimeEntries(((key, picker) => {
|
|
154
156
|
app.registry.picker.register(key, picker), registeredKeys.add(key);
|
|
155
|
-
}), pickers,
|
|
157
|
+
}), pickers, RUNTIME_PICKER_NAMESPACE);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function getRuntimeContributionModuleIdentity(module) {
|
|
161
|
+
return module;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function hasLoadedRuntimeContributionModule(context, module) {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
return null !== (_b = null === (_a = loadedRuntimeContributionModules.get(context)) || void 0 === _a ? void 0 : _a.has(getRuntimeContributionModuleIdentity(module))) && void 0 !== _b && _b;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function markRuntimeContributionModuleLoaded(context, module) {
|
|
170
|
+
let modules = loadedRuntimeContributionModules.get(context);
|
|
171
|
+
modules || (modules = new WeakSet, loadedRuntimeContributionModules.set(context, modules)),
|
|
172
|
+
modules.add(getRuntimeContributionModuleIdentity(module));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function loadRuntimeContributionModuleToContext(context, module) {
|
|
176
|
+
hasLoadedRuntimeContributionModule(context, module) || ("function" == typeof module ? module(context) : module.registry(context.bind, noopUnbindRuntimeContributionService, context.isBound, context.rebind),
|
|
177
|
+
markRuntimeContributionModuleLoaded(context, module));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function isRuntimePickerTarget(target) {
|
|
181
|
+
return "object" == typeof target && null !== target && "picker" in target;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function installRuntimeContributionTargetsToApp(app, targets) {
|
|
185
|
+
const resolvedTargets = null != targets ? targets : DEFAULT_RUNTIME_CONTRIBUTION_TARGETS;
|
|
186
|
+
let installGraphicRenderers = !1, installDrawContributions = !1;
|
|
187
|
+
const pickerTargets = new Set;
|
|
188
|
+
resolvedTargets.forEach((target => {
|
|
189
|
+
"graphic-renderer" === target ? installGraphicRenderers = !0 : "draw-contribution" === target ? installDrawContributions = !0 : isRuntimePickerTarget(target) && pickerTargets.add(target.picker);
|
|
190
|
+
})), installDrawContributions && installRuntimeDrawContributionsToApp(app), installGraphicRenderers && installRuntimeGraphicRenderersToApp(app),
|
|
191
|
+
pickerTargets.forEach((serviceIdentifier => {
|
|
192
|
+
installRuntimePickersToApp(app, serviceIdentifier);
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function installRuntimeContributionModule(module, {app: app, legacy: legacy = !0, targets: targets} = {}) {
|
|
197
|
+
loadRuntimeContributionModuleToContext(getRuntimeInstallerBindingContext(), module),
|
|
198
|
+
legacy && (preLoadAllModule(), loadRuntimeContributionModuleToContext(getLegacyBindingContext(), module)),
|
|
199
|
+
refreshRuntimeInstallerContributions(), app && installRuntimeContributionTargetsToApp(app, targets);
|
|
156
200
|
}
|
|
157
201
|
//# sourceMappingURL=runtime-installer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entries/runtime-installer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,aAAa,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAA8B,MAAM,2BAA2B,CAAC;AACnG,O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,YAAY,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEvF,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QACnC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACjC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;YAC9E,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;SAC9B;QACD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,GAAS,EACT,iBAAuC;;IAEvC,MAAM,cAAc,GAAG,iCAAiC,EAAE,CAAC;IAC3D,oCAAoC,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACzD,MAAM,cAAc,GAAG,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAgB,EAAE,wBAAwB,CAAC,CAAC;IAEpG,qBAAqB,CACnB,GAAG,CAAC,QAAQ,CAAC,MAAgB,EAC7B,wBAAwB,EACxB,MAAA,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,0CAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC1D,CAAC;IAEF,sBAAsB,CACpB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACd,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1C,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC,EACD,OAAgB,EAChB,wBAAwB,CACzB,CAAC;AACJ,CAAC","file":"runtime-installer.js","sourcesContent":["import type {\n IContributionProvider,\n IAreaRenderContribution,\n IDrawItemInterceptorContribution,\n IEnvContribution,\n IGlobal,\n IGraphicPicker,\n IPlugin\n} from '../interface';\nimport type { IApp } from './types';\nimport { application } from '../application';\nimport { CanvasFactory, Context2dFactory } from '../canvas/constants';\nimport { ContributionStore, createContributionProvider } from '../common/contribution-provider';\nimport type { ServiceIdentifier } from '../common/explicit-binding';\nimport { EnvContribution } from '../constants';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport { DefaultGlobal } from '../core/global';\nimport { WindowHandlerContribution, DefaultWindow } from '../core/window';\nimport coreModule from '../core/core-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport { createLegacyBindingContext, type ILegacyBindingContext } from '../legacy/binding-context';\nimport pickModule from '../picker/pick-modules';\nimport { AreaRenderContribution } from '../render/contributions/render/contributions/constants';\nimport { DrawItemInterceptor } from '../render/contributions/render/draw-interceptor';\nimport { DefaultIncrementalCanvasAreaRender } from '../render/contributions/render/incremental-area-render';\nimport { DefaultIncrementalDrawContribution } from '../render/contributions/render/incremental-draw-contribution';\nimport { DefaultIncrementalCanvasLineRender } from '../render/contributions/render/incremental-line-render';\nimport renderModule from '../render/render-modules';\nimport { GraphicRender } from '../render/contributions/render/symbol';\nimport loadRenderContributions from '../render/contributions/modules';\nimport { AutoEnablePlugins } from '../plugins/constants';\nimport { DefaultPluginService } from '../plugins/plugin-service';\n\nconst runtimeInstallerContext = createLegacyBindingContext();\nlet runtimeInstallerPreloaded = false;\nlet runtimeGlobal: IGlobal | undefined;\nconst RUNTIME_RENDERER_NAMESPACE = 'vrender:runtime-renderer';\nconst RUNTIME_PICKER_NAMESPACE = 'vrender:runtime-picker';\nconst runtimeEntryKeys = new WeakMap<object, Map<string, Set<string>>>();\nconst runtimeDrawContributions = new WeakMap<object, Set<IDrawItemInterceptorContribution>>();\n\nfunction ensureRuntimeInstallerPreloaded(): void {\n if (runtimeInstallerPreloaded) {\n return;\n }\n\n runtimeInstallerPreloaded = true;\n coreModule({ bind: runtimeInstallerContext.bind });\n graphicModule({ bind: runtimeInstallerContext.bind });\n renderModule({ bind: runtimeInstallerContext.bind });\n pickModule({ bind: runtimeInstallerContext.bind, isBound: runtimeInstallerContext.isBound });\n loadBuiltinContributions(runtimeInstallerContext);\n loadRenderContributions(runtimeInstallerContext);\n}\n\nfunction resolveRuntimeNamed<T>(serviceIdentifier: ServiceIdentifier<T>, name: string): T {\n const bindingContext = getRuntimeInstallerBindingContext();\n const instance = bindingContext.getNamed(serviceIdentifier, name);\n\n if (instance == null) {\n throw new Error(`${String(serviceIdentifier)} is not configured for ${name}`);\n }\n\n return instance;\n}\n\nfunction registerRuntimeEntries<T extends { type?: string }>(\n register: (key: string, value: T) => void,\n entries: T[],\n prefix: string\n): void {\n entries.forEach((entry, index) => {\n const name = entry?.type ?? entry?.constructor?.name ?? `${prefix}-entry`;\n register(`${prefix}:${String(name)}:${index}`, entry);\n });\n}\n\nfunction getTrackedEntryKeys(registry: object, namespace: string): Set<string> {\n let namespaces = runtimeEntryKeys.get(registry);\n if (!namespaces) {\n namespaces = new Map();\n runtimeEntryKeys.set(registry, namespaces);\n }\n\n let keys = namespaces.get(namespace);\n if (!keys) {\n keys = new Set();\n namespaces.set(namespace, keys);\n }\n\n return keys;\n}\n\nfunction clearTrackedEntryKeys(registry: object, namespace: string, unregister?: (key: string) => void): void {\n const keys = getTrackedEntryKeys(registry, namespace);\n if (unregister) {\n keys.forEach(key => unregister(key));\n }\n keys.clear();\n}\n\nfunction createAppRegistryContributionProvider<T>(app: IApp, key: ServiceIdentifier<T>): IContributionProvider<T> {\n return {\n getContributions: () => app.context.registry.contribution.get(key as any) as T[]\n };\n}\n\nexport function getRuntimeInstallerBindingContext(): ILegacyBindingContext {\n ensureRuntimeInstallerPreloaded();\n return runtimeInstallerContext;\n}\n\nexport function refreshRuntimeInstallerContributions(): void {\n ContributionStore.refreshAllContributions();\n}\n\nexport function getRuntimeInstallerGlobal(): IGlobal {\n ensureRuntimeInstallerPreloaded();\n runtimeGlobal ??= new DefaultGlobal(\n createContributionProvider<IEnvContribution>(EnvContribution, runtimeInstallerContext)\n );\n return runtimeGlobal;\n}\n\nexport function configureRuntimeApplicationForApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n const global = getRuntimeInstallerGlobal();\n\n application.global = global;\n application.canvasFactory = env => bindingContext.getNamed(CanvasFactory, env);\n application.context2dFactory = env => bindingContext.getNamed(Context2dFactory, env);\n application.windowHandlerFactory = env => resolveRuntimeNamed(WindowHandlerContribution, env);\n application.windowFactory = () =>\n new DefaultWindow(global, env => resolveRuntimeNamed(WindowHandlerContribution, env));\n application.pluginServiceFactory = () =>\n new DefaultPluginService(createContributionProvider<IPlugin>(AutoEnablePlugins, bindingContext), {\n pluginRegistry: app.context.registry.plugin as any\n });\n application.incrementalDrawContributionFactory = () =>\n new DefaultIncrementalDrawContribution(\n [],\n new DefaultIncrementalCanvasLineRender(),\n new DefaultIncrementalCanvasAreaRender(\n createContributionProvider<IAreaRenderContribution>(AreaRenderContribution, bindingContext)\n ),\n createAppRegistryContributionProvider<IDrawItemInterceptorContribution>(app, DrawItemInterceptor)\n );\n}\n\nexport function installRuntimeGraphicRenderersToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const renderers = bindingContext.getAll(GraphicRender);\n const registeredKeys = getTrackedEntryKeys(app.registry.renderer as object, RUNTIME_RENDERER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.renderer as object,\n RUNTIME_RENDERER_NAMESPACE,\n app.registry.renderer.unregister?.bind(app.registry.renderer)\n );\n\n registerRuntimeEntries(\n (key, renderer) => {\n renderer?.reInit?.();\n app.registry.renderer.register(key, renderer);\n registeredKeys.add(key);\n },\n renderers as any[],\n RUNTIME_RENDERER_NAMESPACE\n );\n}\n\nexport function installRuntimeDrawContributionsToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const contributions = bindingContext.getAll(DrawItemInterceptor) as IDrawItemInterceptorContribution[];\n const tracked =\n runtimeDrawContributions.get(app.context.registry.contribution as object) ??\n new Set<IDrawItemInterceptorContribution>();\n tracked.forEach(contribution => {\n app.context.registry.contribution.unregister?.(DrawItemInterceptor, contribution);\n });\n tracked.clear();\n runtimeDrawContributions.set(app.context.registry.contribution as object, tracked);\n const registered = new Set(app.context.registry.contribution.get(DrawItemInterceptor));\n\n contributions.forEach(contribution => {\n if (!registered.has(contribution)) {\n app.context.registry.contribution.register(DrawItemInterceptor, contribution);\n registered.add(contribution);\n }\n tracked.add(contribution);\n });\n}\n\nexport function installRuntimePickersToApp<T extends IGraphicPicker>(\n app: IApp,\n serviceIdentifier: ServiceIdentifier<T>\n): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const pickers = bindingContext.getAll(serviceIdentifier);\n const registeredKeys = getTrackedEntryKeys(app.registry.picker as object, RUNTIME_PICKER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.picker as object,\n RUNTIME_PICKER_NAMESPACE,\n app.registry.picker.unregister?.bind(app.registry.picker)\n );\n\n registerRuntimeEntries(\n (key, picker) => {\n app.registry.picker.register(key, picker);\n registeredKeys.add(key);\n },\n pickers as any[],\n RUNTIME_PICKER_NAMESPACE\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/entries/runtime-installer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1E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cAAc,EAAE,MAAM,CAAC,CAAC;IAE/D,IAAI,MAAM,EAAE;QACV,gBAAgB,EAAE,CAAC;QACnB,sCAAsC,CAAC,uBAAuB,EAAE,EAAE,MAAM,CAAC,CAAC;KAC3E;IAED,oCAAoC,EAAE,CAAC;IAEvC,IAAI,GAAG,EAAE;QACP,sCAAsC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACtD;AACH,CAAC","file":"runtime-installer.js","sourcesContent":["import type {\n IContributionProvider,\n IAreaRenderContribution,\n IDrawItemInterceptorContribution,\n IEnvContribution,\n IGlobal,\n IGraphicPicker,\n IPlugin\n} from '../interface';\nimport type { IApp } from './types';\nimport { application } from '../application';\nimport { CanvasFactory, Context2dFactory } from '../canvas/constants';\nimport { ContributionStore, createContributionProvider } from '../common/contribution-provider';\nimport type { ServiceIdentifier } from '../common/explicit-binding';\nimport { EnvContribution } from '../constants';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport { DefaultGlobal } from '../core/global';\nimport { WindowHandlerContribution, DefaultWindow } from '../core/window';\nimport coreModule from '../core/core-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport { createLegacyBindingContext, type ILegacyBindingContext } from '../legacy/binding-context';\nimport { getLegacyBindingContext, preLoadAllModule } from '../legacy/bootstrap';\nimport pickModule from '../picker/pick-modules';\nimport { AreaRenderContribution } from '../render/contributions/render/contributions/constants';\nimport { DrawItemInterceptor } from '../render/contributions/render/draw-interceptor';\nimport { DefaultIncrementalCanvasAreaRender } from '../render/contributions/render/incremental-area-render';\nimport { DefaultIncrementalDrawContribution } from '../render/contributions/render/incremental-draw-contribution';\nimport { DefaultIncrementalCanvasLineRender } from '../render/contributions/render/incremental-line-render';\nimport renderModule from '../render/render-modules';\nimport { GraphicRender } from '../render/contributions/render/symbol';\nimport loadRenderContributions from '../render/contributions/modules';\nimport { AutoEnablePlugins } from '../plugins/constants';\nimport { DefaultPluginService } from '../plugins/plugin-service';\n\nexport type TRuntimeContributionModuleRegistry = (\n bind: ILegacyBindingContext['bind'],\n unbind: (serviceIdentifier: ServiceIdentifier) => void,\n isBound: ILegacyBindingContext['isBound'],\n rebind: ILegacyBindingContext['rebind']\n) => void;\n\nexport type TRuntimeContributionModule =\n | ((context: ILegacyBindingContext) => void)\n | {\n registry: TRuntimeContributionModuleRegistry;\n };\n\nexport type TRuntimeContributionInstallTarget =\n | 'graphic-renderer'\n | 'draw-contribution'\n | {\n picker: ServiceIdentifier<IGraphicPicker>;\n };\n\nexport interface IRuntimeContributionModuleInstallOptions {\n app?: IApp;\n legacy?: boolean;\n targets?: TRuntimeContributionInstallTarget[];\n}\n\nconst runtimeInstallerContext = createLegacyBindingContext();\nlet runtimeInstallerPreloaded = false;\nlet runtimeGlobal: IGlobal | undefined;\nconst RUNTIME_RENDERER_NAMESPACE = 'vrender:runtime-renderer';\nconst RUNTIME_PICKER_NAMESPACE = 'vrender:runtime-picker';\nconst runtimeEntryKeys = new WeakMap<object, Map<string, Set<string>>>();\nconst runtimeDrawContributions = new WeakMap<object, Set<IDrawItemInterceptorContribution>>();\nconst loadedRuntimeContributionModules = new WeakMap<object, WeakSet<object>>();\nconst DEFAULT_RUNTIME_CONTRIBUTION_TARGETS: TRuntimeContributionInstallTarget[] = ['graphic-renderer'];\nconst noopUnbindRuntimeContributionService = (): void => undefined;\n\nfunction ensureRuntimeInstallerPreloaded(): void {\n if (runtimeInstallerPreloaded) {\n return;\n }\n\n runtimeInstallerPreloaded = true;\n coreModule({ bind: runtimeInstallerContext.bind });\n graphicModule({ bind: runtimeInstallerContext.bind });\n renderModule({ bind: runtimeInstallerContext.bind });\n pickModule({ bind: runtimeInstallerContext.bind, isBound: runtimeInstallerContext.isBound });\n loadBuiltinContributions(runtimeInstallerContext);\n loadRenderContributions(runtimeInstallerContext);\n}\n\nfunction resolveRuntimeNamed<T>(serviceIdentifier: ServiceIdentifier<T>, name: string): T {\n const bindingContext = getRuntimeInstallerBindingContext();\n const instance = bindingContext.getNamed(serviceIdentifier, name);\n\n if (instance == null) {\n throw new Error(`${String(serviceIdentifier)} is not configured for ${name}`);\n }\n\n return instance;\n}\n\nfunction registerRuntimeEntries<T extends { type?: string }>(\n register: (key: string, value: T) => void,\n entries: T[],\n prefix: string\n): void {\n entries.forEach((entry, index) => {\n const name = entry?.type ?? entry?.constructor?.name ?? `${prefix}-entry`;\n register(`${prefix}:${String(name)}:${index}`, entry);\n });\n}\n\nfunction getTrackedEntryKeys(registry: object, namespace: string): Set<string> {\n let namespaces = runtimeEntryKeys.get(registry);\n if (!namespaces) {\n namespaces = new Map();\n runtimeEntryKeys.set(registry, namespaces);\n }\n\n let keys = namespaces.get(namespace);\n if (!keys) {\n keys = new Set();\n namespaces.set(namespace, keys);\n }\n\n return keys;\n}\n\nfunction clearTrackedEntryKeys(registry: object, namespace: string, unregister?: (key: string) => void): void {\n const keys = getTrackedEntryKeys(registry, namespace);\n if (unregister) {\n keys.forEach(key => unregister(key));\n }\n keys.clear();\n}\n\nfunction createAppRegistryContributionProvider<T>(app: IApp, key: ServiceIdentifier<T>): IContributionProvider<T> {\n return {\n getContributions: () => app.context.registry.contribution.get(key as any) as T[]\n };\n}\n\nexport function getRuntimeInstallerBindingContext(): ILegacyBindingContext {\n ensureRuntimeInstallerPreloaded();\n return runtimeInstallerContext;\n}\n\nexport function refreshRuntimeInstallerContributions(): void {\n ContributionStore.refreshAllContributions();\n}\n\nexport function getRuntimeInstallerGlobal(): IGlobal {\n ensureRuntimeInstallerPreloaded();\n runtimeGlobal ??= new DefaultGlobal(\n createContributionProvider<IEnvContribution>(EnvContribution, runtimeInstallerContext)\n );\n return runtimeGlobal;\n}\n\nexport function configureRuntimeApplicationForApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n const global = getRuntimeInstallerGlobal();\n\n application.global = global;\n application.canvasFactory = env => bindingContext.getNamed(CanvasFactory, env);\n application.context2dFactory = env => bindingContext.getNamed(Context2dFactory, env);\n application.windowHandlerFactory = env => resolveRuntimeNamed(WindowHandlerContribution, env);\n application.windowFactory = () =>\n new DefaultWindow(global, env => resolveRuntimeNamed(WindowHandlerContribution, env));\n application.pluginServiceFactory = () =>\n new DefaultPluginService(createContributionProvider<IPlugin>(AutoEnablePlugins, bindingContext), {\n pluginRegistry: app.context.registry.plugin as any\n });\n application.incrementalDrawContributionFactory = () =>\n new DefaultIncrementalDrawContribution(\n [],\n new DefaultIncrementalCanvasLineRender(),\n new DefaultIncrementalCanvasAreaRender(\n createContributionProvider<IAreaRenderContribution>(AreaRenderContribution, bindingContext)\n ),\n createAppRegistryContributionProvider<IDrawItemInterceptorContribution>(app, DrawItemInterceptor)\n );\n}\n\nexport function installRuntimeGraphicRenderersToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const renderers = bindingContext.getAll(GraphicRender);\n const registeredKeys = getTrackedEntryKeys(app.registry.renderer as object, RUNTIME_RENDERER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.renderer as object,\n RUNTIME_RENDERER_NAMESPACE,\n app.registry.renderer.unregister?.bind(app.registry.renderer)\n );\n\n registerRuntimeEntries(\n (key, renderer) => {\n renderer?.reInit?.();\n app.registry.renderer.register(key, renderer);\n registeredKeys.add(key);\n },\n renderers as any[],\n RUNTIME_RENDERER_NAMESPACE\n );\n}\n\nexport function installRuntimeDrawContributionsToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const contributions = bindingContext.getAll(DrawItemInterceptor) as IDrawItemInterceptorContribution[];\n const tracked =\n runtimeDrawContributions.get(app.context.registry.contribution as object) ??\n new Set<IDrawItemInterceptorContribution>();\n tracked.forEach(contribution => {\n app.context.registry.contribution.unregister?.(DrawItemInterceptor, contribution);\n });\n tracked.clear();\n runtimeDrawContributions.set(app.context.registry.contribution as object, tracked);\n const registered = new Set(app.context.registry.contribution.get(DrawItemInterceptor));\n\n contributions.forEach(contribution => {\n if (!registered.has(contribution)) {\n app.context.registry.contribution.register(DrawItemInterceptor, contribution);\n registered.add(contribution);\n }\n tracked.add(contribution);\n });\n}\n\nexport function installRuntimePickersToApp<T extends IGraphicPicker>(\n app: IApp,\n serviceIdentifier: ServiceIdentifier<T>\n): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const pickers = bindingContext.getAll(serviceIdentifier);\n const registeredKeys = getTrackedEntryKeys(app.registry.picker as object, RUNTIME_PICKER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.picker as object,\n RUNTIME_PICKER_NAMESPACE,\n app.registry.picker.unregister?.bind(app.registry.picker)\n );\n\n registerRuntimeEntries(\n (key, picker) => {\n app.registry.picker.register(key, picker);\n registeredKeys.add(key);\n },\n pickers as any[],\n RUNTIME_PICKER_NAMESPACE\n );\n}\n\nfunction getRuntimeContributionModuleIdentity(module: TRuntimeContributionModule): object {\n return module as object;\n}\n\nfunction hasLoadedRuntimeContributionModule(\n context: ILegacyBindingContext,\n module: TRuntimeContributionModule\n): boolean {\n return loadedRuntimeContributionModules.get(context)?.has(getRuntimeContributionModuleIdentity(module)) ?? false;\n}\n\nfunction markRuntimeContributionModuleLoaded(context: ILegacyBindingContext, module: TRuntimeContributionModule): void {\n let modules = loadedRuntimeContributionModules.get(context);\n if (!modules) {\n modules = new WeakSet<object>();\n loadedRuntimeContributionModules.set(context, modules);\n }\n modules.add(getRuntimeContributionModuleIdentity(module));\n}\n\nfunction loadRuntimeContributionModuleToContext(\n context: ILegacyBindingContext,\n module: TRuntimeContributionModule\n): void {\n if (hasLoadedRuntimeContributionModule(context, module)) {\n return;\n }\n\n if (typeof module === 'function') {\n module(context);\n } else {\n module.registry(context.bind, noopUnbindRuntimeContributionService, context.isBound, context.rebind);\n }\n\n markRuntimeContributionModuleLoaded(context, module);\n}\n\nfunction isRuntimePickerTarget(\n target: TRuntimeContributionInstallTarget\n): target is { picker: ServiceIdentifier<IGraphicPicker> } {\n return typeof target === 'object' && target !== null && 'picker' in target;\n}\n\nfunction installRuntimeContributionTargetsToApp(\n app: IApp,\n targets: TRuntimeContributionInstallTarget[] | undefined\n): void {\n const resolvedTargets = targets ?? DEFAULT_RUNTIME_CONTRIBUTION_TARGETS;\n let installGraphicRenderers = false;\n let installDrawContributions = false;\n const pickerTargets = new Set<ServiceIdentifier<IGraphicPicker>>();\n\n resolvedTargets.forEach(target => {\n if (target === 'graphic-renderer') {\n installGraphicRenderers = true;\n } else if (target === 'draw-contribution') {\n installDrawContributions = true;\n } else if (isRuntimePickerTarget(target)) {\n pickerTargets.add(target.picker);\n }\n });\n\n if (installDrawContributions) {\n installRuntimeDrawContributionsToApp(app);\n }\n if (installGraphicRenderers) {\n installRuntimeGraphicRenderersToApp(app);\n }\n pickerTargets.forEach(serviceIdentifier => {\n installRuntimePickersToApp(app, serviceIdentifier);\n });\n}\n\nexport function installRuntimeContributionModule(\n module: TRuntimeContributionModule,\n { app, legacy = true, targets }: IRuntimeContributionModuleInstallOptions = {}\n): void {\n const runtimeContext = getRuntimeInstallerBindingContext();\n loadRuntimeContributionModuleToContext(runtimeContext, module);\n\n if (legacy) {\n preLoadAllModule();\n loadRuntimeContributionModuleToContext(getLegacyBindingContext(), module);\n }\n\n refreshRuntimeInstallerContributions();\n\n if (app) {\n installRuntimeContributionTargetsToApp(app, targets);\n }\n}\n"]}
|
package/es/graphic/graphic.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ type ResolvedGraphicStateTransition<T> = {
|
|
|
26
26
|
effectiveStates: string[];
|
|
27
27
|
resolvedStateAttrs: Partial<T>;
|
|
28
28
|
};
|
|
29
|
+
type ExcludedAttributeKeys = Record<string, true>;
|
|
29
30
|
export declare const NOWORK_ANIMATE_ATTR: {
|
|
30
31
|
strokeSeg: number;
|
|
31
32
|
boundsPadding: number;
|
|
@@ -155,9 +156,9 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
155
156
|
protected recomputeCurrentStatePatch(): void;
|
|
156
157
|
protected buildStaticAttributeSnapshot(): Partial<T>;
|
|
157
158
|
protected buildRemovedStateAnimationAttrs(targetStateAttrs: Partial<T>, previousResolvedStatePatch?: Partial<T>): Partial<T>;
|
|
158
|
-
protected syncObjectToSnapshot(target: Record<string, any>, snapshot: Record<string, any
|
|
159
|
-
protected _syncAttribute(): AttributeDelta;
|
|
160
|
-
protected _syncFinalAttributeFromStaticTruth(): void;
|
|
159
|
+
protected syncObjectToSnapshot(target: Record<string, any>, snapshot: Record<string, any>, excludedKeys?: ExcludedAttributeKeys): AttributeDelta;
|
|
160
|
+
protected _syncAttribute(excludedKeys?: ExcludedAttributeKeys): AttributeDelta;
|
|
161
|
+
protected _syncFinalAttributeFromStaticTruth(excludedKeys?: ExcludedAttributeKeys): void;
|
|
161
162
|
protected mergeAttributeDeltaCategory(category: UpdateCategory, key: string, prev: unknown, next: unknown): number;
|
|
162
163
|
protected submitUpdateByCategory(category: UpdateCategory, forceUpdateTag?: boolean): void;
|
|
163
164
|
protected submitUpdateByDelta(delta: AttributeDelta, forceUpdateTag?: boolean): void;
|
|
@@ -170,9 +171,10 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
170
171
|
protected commitBaseAttributesByTouchedKeys(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
171
172
|
protected commitBaseAttributeBySingleKey(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
172
173
|
protected applyBaseAttributes(params: Partial<T>): void;
|
|
174
|
+
protected _commitAnimationStaticAttributes(params: Partial<T>, context?: ISetAttributeContext): void;
|
|
173
175
|
applyAnimationTransientAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
174
176
|
protected applyTransientAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
175
|
-
protected _restoreAttributeFromStaticTruth(context?: ISetAttributeContext): void;
|
|
177
|
+
protected _restoreAttributeFromStaticTruth(context?: ISetAttributeContext, excludedKeys?: ExcludedAttributeKeys): void;
|
|
176
178
|
protected collectStatePatchDeltaKeys(previousPatch?: Partial<T>, nextPatch?: Partial<T>): string[];
|
|
177
179
|
protected getStaticTruthValueForStateKey(key: string, nextPatch?: Partial<T>): {
|
|
178
180
|
hasValue: boolean;
|
package/es/graphic/graphic.js
CHANGED
|
@@ -286,9 +286,10 @@ export class Graphic extends Node {
|
|
|
286
286
|
} else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
|
|
287
287
|
})), extraAttrs;
|
|
288
288
|
}
|
|
289
|
-
syncObjectToSnapshot(target, snapshot) {
|
|
289
|
+
syncObjectToSnapshot(target, snapshot, excludedKeys) {
|
|
290
290
|
const delta = new Map;
|
|
291
291
|
return new Set([ ...Object.keys(target), ...Object.keys(snapshot) ]).forEach((key => {
|
|
292
|
+
if (!0 === (null == excludedKeys ? void 0 : excludedKeys[key])) return;
|
|
292
293
|
const hasNext = Object.prototype.hasOwnProperty.call(snapshot, key), previousValue = target[key];
|
|
293
294
|
if (!hasNext) return void (Object.prototype.hasOwnProperty.call(target, key) && (delta.set(key, {
|
|
294
295
|
prev: previousValue,
|
|
@@ -301,17 +302,17 @@ export class Graphic extends Node {
|
|
|
301
302
|
}), target[key] = cloneAttributeValue(nextValue));
|
|
302
303
|
})), delta;
|
|
303
304
|
}
|
|
304
|
-
_syncAttribute() {
|
|
305
|
+
_syncAttribute(excludedKeys) {
|
|
305
306
|
this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
|
|
306
|
-
const snapshot = this.buildStaticAttributeSnapshot(), delta = this.syncObjectToSnapshot(this.attribute, snapshot);
|
|
307
|
-
return this.valid = this.isValid(), this.attributeMayContainTransientAttrs =
|
|
307
|
+
const snapshot = this.buildStaticAttributeSnapshot(), delta = this.syncObjectToSnapshot(this.attribute, snapshot, excludedKeys);
|
|
308
|
+
return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !!excludedKeys,
|
|
308
309
|
delta;
|
|
309
310
|
}
|
|
310
|
-
_syncFinalAttributeFromStaticTruth() {
|
|
311
|
+
_syncFinalAttributeFromStaticTruth(excludedKeys) {
|
|
311
312
|
const target = this.finalAttribute;
|
|
312
313
|
if (!target) return;
|
|
313
314
|
const snapshot = this.buildStaticAttributeSnapshot();
|
|
314
|
-
this.syncObjectToSnapshot(target, snapshot);
|
|
315
|
+
this.syncObjectToSnapshot(target, snapshot, excludedKeys);
|
|
315
316
|
}
|
|
316
317
|
mergeAttributeDeltaCategory(category, key, prev, next) {
|
|
317
318
|
var _a;
|
|
@@ -381,6 +382,22 @@ export class Graphic extends Node {
|
|
|
381
382
|
this.getBaseAttributesStorage()[key] = params[key];
|
|
382
383
|
}
|
|
383
384
|
}
|
|
385
|
+
_commitAnimationStaticAttributes(params, context) {
|
|
386
|
+
if (!params) return;
|
|
387
|
+
const source = params, baseAttributes = this.getBaseAttributesStorage(), target = this.attribute, delta = new Map;
|
|
388
|
+
let hasKeys = !1;
|
|
389
|
+
for (const key in source) {
|
|
390
|
+
if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
|
|
391
|
+
hasKeys = !0;
|
|
392
|
+
const previousValue = target[key], nextValue = source[key];
|
|
393
|
+
baseAttributes[key] = nextValue, target[key] = nextValue, areAttributeValuesEqual(previousValue, nextValue) || delta.set(key, {
|
|
394
|
+
prev: previousValue,
|
|
395
|
+
next: nextValue
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
hasKeys && (this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !0,
|
|
399
|
+
this.submitUpdateByDelta(delta), this.onAttributeUpdate(context));
|
|
400
|
+
}
|
|
384
401
|
applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
|
|
385
402
|
const source = params;
|
|
386
403
|
let target, needsShapeAndBounds = forceUpdateTag;
|
|
@@ -402,9 +419,9 @@ export class Graphic extends Node {
|
|
|
402
419
|
delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(),
|
|
403
420
|
this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
|
|
404
421
|
}
|
|
405
|
-
_restoreAttributeFromStaticTruth(context) {
|
|
406
|
-
this._syncFinalAttributeFromStaticTruth();
|
|
407
|
-
const delta = this._syncAttribute();
|
|
422
|
+
_restoreAttributeFromStaticTruth(context, excludedKeys) {
|
|
423
|
+
this._syncFinalAttributeFromStaticTruth(excludedKeys);
|
|
424
|
+
const delta = this._syncAttribute(excludedKeys);
|
|
408
425
|
this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
|
|
409
426
|
}
|
|
410
427
|
collectStatePatchDeltaKeys(previousPatch, nextPatch) {
|