@visactor/vrender-kits 1.1.3 → 1.1.4-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.
Files changed (2) hide show
  1. package/dist/index.es.js +166 -94
  2. package/package.json +4 -4
package/dist/index.es.js CHANGED
@@ -2365,11 +2365,32 @@ const PickItemInterceptor = Symbol.for("PickItemInterceptor");
2365
2365
  const PickServiceInterceptor = Symbol.for("PickServiceInterceptor");
2366
2366
 
2367
2367
  class Application {}
2368
- const application = new Application();
2368
+ const APPLICATION_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/application-state");
2369
+ function createApplicationState() {
2370
+ return {
2371
+ application: new Application()
2372
+ };
2373
+ }
2374
+ function getApplicationState() {
2375
+ const scope = globalThis;
2376
+ return scope[APPLICATION_STATE_SYMBOL] || (scope[APPLICATION_STATE_SYMBOL] = createApplicationState()), scope[APPLICATION_STATE_SYMBOL];
2377
+ }
2378
+ const application = getApplicationState().application;
2369
2379
 
2370
2380
  const CanvasFactory = Symbol.for("CanvasFactory");
2371
2381
  const Context2dFactory = Symbol.for("Context2dFactory");
2372
2382
 
2383
+ const CONTRIBUTION_STORE_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/contribution-store-state");
2384
+ function createContributionStoreState() {
2385
+ return {
2386
+ store: new Map()
2387
+ };
2388
+ }
2389
+ function getContributionStoreState() {
2390
+ const scope = globalThis;
2391
+ return scope[CONTRIBUTION_STORE_STATE_SYMBOL] || (scope[CONTRIBUTION_STORE_STATE_SYMBOL] = createContributionStoreState()), scope[CONTRIBUTION_STORE_STATE_SYMBOL];
2392
+ }
2393
+
2373
2394
  const ContributionProvider = Symbol("ContributionProvider");
2374
2395
  class ContributionProviderCache {
2375
2396
  constructor(serviceIdentifier, container) {
@@ -2407,7 +2428,7 @@ class ContributionStore {
2407
2428
  });
2408
2429
  }
2409
2430
  }
2410
- ContributionStore.store = new Map();
2431
+ ContributionStore.store = getContributionStoreState().store;
2411
2432
 
2412
2433
  const EnvContribution = Symbol.for("EnvContribution");
2413
2434
  const VGlobal = Symbol.for("VGlobal");
@@ -6100,6 +6121,17 @@ class DefaultTransformUtil {
6100
6121
  }
6101
6122
  }
6102
6123
 
6124
+ const FACTORY_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/factory-state");
6125
+ function createFactoryState() {
6126
+ return {
6127
+ pluginClasses: {}
6128
+ };
6129
+ }
6130
+ function getFactoryState() {
6131
+ const scope = globalThis;
6132
+ return scope[FACTORY_STATE_SYMBOL] || (scope[FACTORY_STATE_SYMBOL] = createFactoryState()), scope[FACTORY_STATE_SYMBOL];
6133
+ }
6134
+
6103
6135
  class FederatedEvent {
6104
6136
  get layerX() {
6105
6137
  return this.layer.x;
@@ -10894,7 +10926,6 @@ function createGraphicCtor(creator) {
10894
10926
  }
10895
10927
  };
10896
10928
  }
10897
- const sharedGraphicFactory = new GraphicFactory();
10898
10929
  class GraphicCreator {
10899
10930
  constructor() {
10900
10931
  this.store = new Map();
@@ -10909,13 +10940,25 @@ class GraphicCreator {
10909
10940
  return this.store.has(name) ? createGraphic(name, attributes) : null;
10910
10941
  }
10911
10942
  }
10912
- const graphicCreator = new GraphicCreator();
10943
+ const GRAPHIC_REGISTRY_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-registry");
10944
+ function createGraphicRegistryState() {
10945
+ return {
10946
+ graphicCreator: new GraphicCreator(),
10947
+ graphicFactory: new GraphicFactory()
10948
+ };
10949
+ }
10950
+ function getGraphicRegistryState() {
10951
+ const scope = globalThis;
10952
+ return scope[GRAPHIC_REGISTRY_SYMBOL] || (scope[GRAPHIC_REGISTRY_SYMBOL] = createGraphicRegistryState()), scope[GRAPHIC_REGISTRY_SYMBOL];
10953
+ }
10954
+ const sharedGraphicRegistry = getGraphicRegistryState();
10955
+ const graphicCreator = sharedGraphicRegistry.graphicCreator;
10913
10956
  function registerGraphic(name, creator) {
10914
10957
  if (!name) throw new Error("Graphic registration requires a non-empty graphic type");
10915
- graphicCreator.registerStore(name, creator), sharedGraphicFactory.register(name, createGraphicCtor(creator));
10958
+ graphicCreator.registerStore(name, creator), sharedGraphicRegistry.graphicFactory.register(name, createGraphicCtor(creator));
10916
10959
  }
10917
10960
  function createGraphic(name, attributes) {
10918
- return sharedGraphicFactory.create(name, attributes);
10961
+ return sharedGraphicRegistry.graphicFactory.create(name, attributes);
10919
10962
  }
10920
10963
 
10921
10964
  function getModelMatrix(out, graphic, theme) {
@@ -11216,7 +11259,7 @@ class Factory {
11216
11259
  return Factory._pluginClasses[pluginKey];
11217
11260
  }
11218
11261
  }
11219
- Factory._pluginClasses = {};
11262
+ Factory._pluginClasses = getFactoryState().pluginClasses;
11220
11263
 
11221
11264
  function defaultLayerHandlerFactory(layerMode) {
11222
11265
  const handlerFactory = application.layerHandlerFactory;
@@ -11305,84 +11348,6 @@ function bindGraphicModules({
11305
11348
  bind(GraphicService).to(DefaultGraphicService), bind(GraphicCreator$1).toConstantValue(graphicCreator);
11306
11349
  }
11307
11350
 
11308
- class LegacyBindingSyntax {
11309
- constructor(record) {
11310
- this.record = record;
11311
- }
11312
- to(constructor) {
11313
- return this.record.implementationType = "constructor", this.record.implementationConstructor = constructor, this.record.cached = !1, this.record.cachedValue = void 0, this;
11314
- }
11315
- toSelf() {
11316
- return this.to(this.record.serviceIdentifier);
11317
- }
11318
- toDynamicValue(factory) {
11319
- return this.record.implementationType = "dynamic", this.record.implementationFactory = factory, this.record.cached = !1, this.record.cachedValue = void 0, this;
11320
- }
11321
- toConstantValue(value) {
11322
- return this.record.implementationType = "constant", this.record.implementationValue = value, this.record.cached = !0, this.record.cachedValue = value, this;
11323
- }
11324
- toService(serviceIdentifier) {
11325
- return this.record.implementationType = "service", this.record.linkedServiceIdentifier = serviceIdentifier, this.record.cached = !1, this.record.cachedValue = void 0, this;
11326
- }
11327
- inSingletonScope() {
11328
- return this.record.scope = "singleton", this;
11329
- }
11330
- whenTargetNamed(name) {
11331
- return this.record.named = name, this;
11332
- }
11333
- }
11334
- class LegacyBindingContext {
11335
- constructor() {
11336
- this.bindings = new Map(), this.bind = serviceIdentifier => {
11337
- const record = {
11338
- serviceIdentifier: serviceIdentifier,
11339
- scope: "transient",
11340
- cached: !1
11341
- },
11342
- records = this.bindings.get(serviceIdentifier);
11343
- return records ? records.push(record) : this.bindings.set(serviceIdentifier, [record]), new LegacyBindingSyntax(record);
11344
- }, this.rebind = serviceIdentifier => (this.bindings.delete(serviceIdentifier), this.bind(serviceIdentifier)), this.isBound = serviceIdentifier => {
11345
- var _a, _b;
11346
- return (null !== (_b = null === (_a = this.bindings.get(serviceIdentifier)) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0) > 0;
11347
- }, this.getAll = serviceIdentifier => {
11348
- const records = this.bindings.get(serviceIdentifier);
11349
- return (null == records ? void 0 : records.length) ? records.map(record => this.resolveBinding(record)).filter(value => void 0 !== value) : [];
11350
- }, this.getNamed = (serviceIdentifier, name) => {
11351
- const records = this.bindings.get(serviceIdentifier);
11352
- if (!(null == records ? void 0 : records.length)) return;
11353
- const record = records.find(item => item.named === name);
11354
- return record ? this.resolveBinding(record) : void 0;
11355
- };
11356
- }
11357
- resolveBinding(record) {
11358
- var _a;
11359
- if ("singleton" === record.scope && record.cached) return record.cachedValue;
11360
- let value;
11361
- switch (record.implementationType) {
11362
- case "constant":
11363
- value = record.implementationValue;
11364
- break;
11365
- case "constructor":
11366
- value = record.implementationConstructor ? new record.implementationConstructor() : void 0;
11367
- break;
11368
- case "dynamic":
11369
- value = null === (_a = record.implementationFactory) || void 0 === _a ? void 0 : _a.call(record, {
11370
- container: this
11371
- });
11372
- break;
11373
- case "service":
11374
- record.linkedServiceIdentifier && ([value] = this.getAll(record.linkedServiceIdentifier));
11375
- break;
11376
- default:
11377
- value = void 0;
11378
- }
11379
- return "singleton" === record.scope && (record.cached = !0, record.cachedValue = value), value;
11380
- }
11381
- }
11382
- function createLegacyBindingContext() {
11383
- return new LegacyBindingContext();
11384
- }
11385
-
11386
11351
  const RenderService = Symbol.for("RenderService");
11387
11352
 
11388
11353
  function bindRenderServiceModule({
@@ -15698,7 +15663,98 @@ function load(container) {
15698
15663
  });
15699
15664
  }
15700
15665
 
15701
- const legacyBindingContext = createLegacyBindingContext();
15666
+ class LegacyBindingSyntax {
15667
+ constructor(record) {
15668
+ this.record = record;
15669
+ }
15670
+ to(constructor) {
15671
+ return this.record.implementationType = "constructor", this.record.implementationConstructor = constructor, this.record.cached = !1, this.record.cachedValue = void 0, this;
15672
+ }
15673
+ toSelf() {
15674
+ return this.to(this.record.serviceIdentifier);
15675
+ }
15676
+ toDynamicValue(factory) {
15677
+ return this.record.implementationType = "dynamic", this.record.implementationFactory = factory, this.record.cached = !1, this.record.cachedValue = void 0, this;
15678
+ }
15679
+ toConstantValue(value) {
15680
+ return this.record.implementationType = "constant", this.record.implementationValue = value, this.record.cached = !0, this.record.cachedValue = value, this;
15681
+ }
15682
+ toService(serviceIdentifier) {
15683
+ return this.record.implementationType = "service", this.record.linkedServiceIdentifier = serviceIdentifier, this.record.cached = !1, this.record.cachedValue = void 0, this;
15684
+ }
15685
+ inSingletonScope() {
15686
+ return this.record.scope = "singleton", this;
15687
+ }
15688
+ whenTargetNamed(name) {
15689
+ return this.record.named = name, this;
15690
+ }
15691
+ }
15692
+ class LegacyBindingContext {
15693
+ constructor() {
15694
+ this.bindings = new Map(), this.bind = serviceIdentifier => {
15695
+ const record = {
15696
+ serviceIdentifier: serviceIdentifier,
15697
+ scope: "transient",
15698
+ cached: !1
15699
+ },
15700
+ records = this.bindings.get(serviceIdentifier);
15701
+ return records ? records.push(record) : this.bindings.set(serviceIdentifier, [record]), new LegacyBindingSyntax(record);
15702
+ }, this.rebind = serviceIdentifier => (this.bindings.delete(serviceIdentifier), this.bind(serviceIdentifier)), this.isBound = serviceIdentifier => {
15703
+ var _a, _b;
15704
+ return (null !== (_b = null === (_a = this.bindings.get(serviceIdentifier)) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0) > 0;
15705
+ }, this.getAll = serviceIdentifier => {
15706
+ const records = this.bindings.get(serviceIdentifier);
15707
+ return (null == records ? void 0 : records.length) ? records.map(record => this.resolveBinding(record)).filter(value => void 0 !== value) : [];
15708
+ }, this.getNamed = (serviceIdentifier, name) => {
15709
+ const records = this.bindings.get(serviceIdentifier);
15710
+ if (!(null == records ? void 0 : records.length)) return;
15711
+ const record = records.find(item => item.named === name);
15712
+ return record ? this.resolveBinding(record) : void 0;
15713
+ };
15714
+ }
15715
+ resolveBinding(record) {
15716
+ var _a;
15717
+ if ("singleton" === record.scope && record.cached) return record.cachedValue;
15718
+ let value;
15719
+ switch (record.implementationType) {
15720
+ case "constant":
15721
+ value = record.implementationValue;
15722
+ break;
15723
+ case "constructor":
15724
+ value = record.implementationConstructor ? new record.implementationConstructor() : void 0;
15725
+ break;
15726
+ case "dynamic":
15727
+ value = null === (_a = record.implementationFactory) || void 0 === _a ? void 0 : _a.call(record, {
15728
+ container: this
15729
+ });
15730
+ break;
15731
+ case "service":
15732
+ record.linkedServiceIdentifier && ([value] = this.getAll(record.linkedServiceIdentifier));
15733
+ break;
15734
+ default:
15735
+ value = void 0;
15736
+ }
15737
+ return "singleton" === record.scope && (record.cached = !0, record.cachedValue = value), value;
15738
+ }
15739
+ }
15740
+ function createLegacyBindingContext() {
15741
+ return new LegacyBindingContext();
15742
+ }
15743
+
15744
+ const LEGACY_BOOTSTRAP_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");
15745
+ function createLegacyBootstrapState() {
15746
+ return {
15747
+ legacyBindingContext: createLegacyBindingContext(),
15748
+ preloaded: !1
15749
+ };
15750
+ }
15751
+ function getLegacyBootstrapState() {
15752
+ const scope = globalThis;
15753
+ return scope[LEGACY_BOOTSTRAP_STATE_SYMBOL] || (scope[LEGACY_BOOTSTRAP_STATE_SYMBOL] = createLegacyBootstrapState()), scope[LEGACY_BOOTSTRAP_STATE_SYMBOL];
15754
+ }
15755
+
15756
+ const legacyBootstrapState = getLegacyBootstrapState(),
15757
+ legacyBindingContext = legacyBootstrapState.legacyBindingContext;
15702
15758
  function getLegacyBindingContext() {
15703
15759
  return legacyBindingContext;
15704
15760
  }
@@ -16505,15 +16561,30 @@ class DefaultIncrementalCanvasLineRender extends DefaultCanvasLineRender {
16505
16561
  }
16506
16562
  }
16507
16563
 
16508
- const runtimeInstallerContext = createLegacyBindingContext();
16509
- let runtimeGlobal,
16510
- runtimeInstallerPreloaded = !1;
16511
- const RUNTIME_RENDERER_NAMESPACE = "vrender:runtime-renderer",
16564
+ const RUNTIME_INSTALLER_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/runtime-installer-state");
16565
+ function createRuntimeInstallerState() {
16566
+ return {
16567
+ runtimeInstallerContext: createLegacyBindingContext(),
16568
+ preloaded: !1,
16569
+ runtimeEntryKeys: new WeakMap(),
16570
+ runtimeDrawContributions: new WeakMap(),
16571
+ loadedRuntimeContributionModules: new WeakMap()
16572
+ };
16573
+ }
16574
+ function getRuntimeInstallerState() {
16575
+ const scope = globalThis;
16576
+ return scope[RUNTIME_INSTALLER_STATE_SYMBOL] || (scope[RUNTIME_INSTALLER_STATE_SYMBOL] = createRuntimeInstallerState()), scope[RUNTIME_INSTALLER_STATE_SYMBOL];
16577
+ }
16578
+
16579
+ const runtimeInstallerState = getRuntimeInstallerState(),
16580
+ runtimeInstallerContext = runtimeInstallerState.runtimeInstallerContext,
16581
+ RUNTIME_RENDERER_NAMESPACE = "vrender:runtime-renderer",
16512
16582
  RUNTIME_PICKER_NAMESPACE = "vrender:runtime-picker",
16513
- runtimeEntryKeys = new WeakMap(),
16514
- runtimeDrawContributions = new WeakMap();
16583
+ runtimeEntryKeys = runtimeInstallerState.runtimeEntryKeys,
16584
+ runtimeDrawContributions = runtimeInstallerState.runtimeDrawContributions;
16585
+ runtimeInstallerState.loadedRuntimeContributionModules;
16515
16586
  function ensureRuntimeInstallerPreloaded() {
16516
- runtimeInstallerPreloaded || (runtimeInstallerPreloaded = !0, bindCoreModules({
16587
+ runtimeInstallerState.preloaded || (runtimeInstallerState.preloaded = !0, bindCoreModules({
16517
16588
  bind: runtimeInstallerContext.bind
16518
16589
  }), bindGraphicModules({
16519
16590
  bind: runtimeInstallerContext.bind
@@ -16558,7 +16629,8 @@ function refreshRuntimeInstallerContributions() {
16558
16629
  ContributionStore.refreshAllContributions();
16559
16630
  }
16560
16631
  function getRuntimeInstallerGlobal() {
16561
- return ensureRuntimeInstallerPreloaded(), null != runtimeGlobal || (runtimeGlobal = new DefaultGlobal(createContributionProvider(EnvContribution, runtimeInstallerContext))), runtimeGlobal;
16632
+ var _a;
16633
+ return ensureRuntimeInstallerPreloaded(), null !== (_a = runtimeInstallerState.runtimeGlobal) && void 0 !== _a || (runtimeInstallerState.runtimeGlobal = new DefaultGlobal(createContributionProvider(EnvContribution, runtimeInstallerContext))), runtimeInstallerState.runtimeGlobal;
16562
16634
  }
16563
16635
  function configureRuntimeApplicationForApp(app) {
16564
16636
  const bindingContext = getRuntimeInstallerBindingContext(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-kits",
3
- "version": "1.1.3",
3
+ "version": "1.1.4-alpha.0",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index-node.js",
@@ -44,7 +44,7 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@visactor/vutils": "~1.0.12",
47
- "@visactor/vrender-core": "1.1.3",
47
+ "@visactor/vrender-core": "1.1.4-alpha.0",
48
48
  "@resvg/resvg-js": "2.4.1",
49
49
  "roughjs": "4.6.6",
50
50
  "gifuct-js": "2.1.2",
@@ -69,9 +69,9 @@
69
69
  "vite": "3.2.6",
70
70
  "typescript": "4.9.5",
71
71
  "cross-env": "^7.0.3",
72
+ "@internal/eslint-config": "0.0.1",
72
73
  "@internal/ts-config": "0.0.1",
73
- "@internal/bundler": "0.0.1",
74
- "@internal/eslint-config": "0.0.1"
74
+ "@internal/bundler": "0.0.1"
75
75
  },
76
76
  "keywords": [
77
77
  "VisActor",