@zcomponent/core 0.0.26 → 0.0.27

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/lib/context.d.ts CHANGED
@@ -38,6 +38,7 @@ export declare class ContextManager {
38
38
  fork<T extends new (contextManager: ContextManager, props: {}) => any>(ctx: ConstructorWithOnlyOptional<T>): [ContextManager, InstanceType<T>];
39
39
  fork<T extends new (contextManager: ContextManager, props: {}) => any>(ctx: T, props: ConstructorParameters<T>[1]): [ContextManager, InstanceType<T>];
40
40
  forkMultiple<T extends ConstructorWithProps[]>(...ctx: T): [ContextManager, InstancesOfConstructorsWithProps<T>];
41
+ emptyFork(): ContextManager;
41
42
  delete(ctx: ContextConstructor): void;
42
43
  private _keyForContext;
43
44
  }
package/lib/context.js CHANGED
@@ -51,7 +51,7 @@ export class ContextManager {
51
51
  ret._byKey = Object.create(this._byKey);
52
52
  const key = this._keyForContext(ctx);
53
53
  const instance = new ctx(this, props ?? {});
54
- this._byKey[key] = instance;
54
+ ret._byKey[key] = instance;
55
55
  return [ret, instance];
56
56
  }
57
57
  forkMultiple(...ctx) {
@@ -67,6 +67,11 @@ export class ContextManager {
67
67
  }
68
68
  return [ret, instances];
69
69
  }
70
+ emptyFork() {
71
+ const ret = new ContextManager();
72
+ ret._byKey = Object.create(this._byKey);
73
+ return ret;
74
+ }
70
75
  delete(ctx) {
71
76
  const key = this._keyForContext(ctx);
72
77
  const existing = this._byKey[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/core",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",