@knotx/decorators 0.2.11 → 0.2.12

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/dist/index.d.cts CHANGED
@@ -1,14 +1,14 @@
1
- import { BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer, VerticalAlignment, HorizontalAlignment, Container, NodeOperatorFunction, NodeOperationPipe, NodeRenderType, PluginTools } from '@knotx/core';
1
+ import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer, VerticalAlignment, HorizontalAlignment, Container, NodeOperatorFunction, NodeOperationPipe, NodeRenderType, PluginTools } from '@knotx/core';
2
2
  import { Schema } from 'jsonschema';
3
3
 
4
4
  interface IInternalPlugin<TPluginName extends string = string, TRenderType extends RenderType = RenderType> extends IPlugin<TPluginName, any, TRenderType> {
5
5
  }
6
- type CMDC<TK extends string, TM extends (...args: any[]) => any, TN extends string = string, TC extends Record<string, any> | undefined = any> = ClassMethodDecoratorContext<{
6
+ type CMDC<TK extends string, TM extends (...args: any[]) => any, TN extends string = string, TC extends IRecord | undefined = any> = ClassMethodDecoratorContext<{
7
7
  [key in TK]: TM;
8
8
  } & BasePlugin<TN, TC, RenderType> & IPlugin<TN, TC, RenderType>, TM> & {
9
9
  name: TK;
10
10
  };
11
- type CFDC<TK extends string, TV, TN extends string = string, TC extends Record<string, any> | undefined = any> = ClassFieldDecoratorContext<{
11
+ type CFDC<TK extends string, TV, TN extends string = string, TC extends IRecord | undefined = any> = ClassFieldDecoratorContext<{
12
12
  [key in TK]: TV;
13
13
  } & BasePlugin<TN, TC, RenderType> & IPlugin<TN, TC, RenderType>, TV> & {
14
14
  name: TK;
@@ -61,7 +61,7 @@ declare function edgeOperator<K extends string, V extends EdgeOperatorFunction>(
61
61
  * }
62
62
  * ```
63
63
  */
64
- declare function edgePipe<K extends string>(): <T, V extends (...args: any[]) => EdgeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
64
+ declare function edgePipe<K extends string>(): <T extends IRecord, V extends (...args: any[]) => EdgeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
65
65
 
66
66
  /**
67
67
  * 连线渲染器装饰器
@@ -114,7 +114,7 @@ interface InjectDecoratorCallableDataType {
114
114
  * @example
115
115
  * ```
116
116
  * @inject('nodes')
117
- * nodes!: NodeData[]
117
+ * nodes!: Node[]
118
118
  * ```
119
119
  */
120
120
  <T extends InjectableDataKey>(engineKey: T): (_: undefined, context: ClassFieldDecoratorContext<IInternalPlugin, Engine[T]>) => void;
@@ -191,7 +191,7 @@ interface InjectDecoratorCallableMethodType {
191
191
  * @example
192
192
  * ```
193
193
  * @inject('getNode')
194
- * getNode!: (id: string) => NodeData | undefined
194
+ * getNode!: (id: string) => Node | undefined
195
195
  *
196
196
  * @inject('dispatchNodeOperation')
197
197
  * dispatchNodeOperation!: (operation: NodeOperation) => void
@@ -208,7 +208,7 @@ interface InjectDecoratorInjectableType {
208
208
  * @example
209
209
  * ```
210
210
  * @inject((injectable, context) => injectable.nodes.filter(node => node.id === context.id))
211
- * filteredNodes!: NodeData[]
211
+ * filteredNodes!: Node[]
212
212
  * ```
213
213
  */
214
214
  <R>(selector: (injectable: Injectable) => R): (_: undefined, context: ClassFieldDecoratorContext<IInternalPlugin, R>) => void;
@@ -255,7 +255,7 @@ interface SubscribeDecoratorCallableDataType {
255
255
  * @example
256
256
  * ```
257
257
  * @subscribe('nodes')
258
- * nodes!: NodeData[]
258
+ * nodes!: Node[]
259
259
  * ```
260
260
  */
261
261
  <T extends SubscribeDataKey>(engineKey: T): <TK extends string>(_: any, context: CMDC<TK, (v: Engine[T]) => void>) => void;
@@ -369,7 +369,7 @@ declare function nodeOperator<K extends string, V extends NodeOperatorFunction>(
369
369
  * }
370
370
  * ```
371
371
  */
372
- declare function nodePipe<K extends string>(): <T, V extends (...args: any[]) => NodeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
372
+ declare function nodePipe<K extends string>(): <T extends IRecord, V extends (...args: any[]) => NodeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
373
373
 
374
374
  /**
375
375
  * 节点类型装饰器
@@ -391,13 +391,13 @@ declare function nodeType<K extends string, T extends string, V extends NodeRend
391
391
  * 配置装饰器
392
392
  * 自动绑定 OnInit 和 OnConfigChange 生命周期函数 和 observable 装饰器
393
393
  */
394
- declare function config<K extends string, V extends Record<string, any>>(): (_: any, context: CFDC<K, V, string, V>) => void;
394
+ declare function config<K extends string, V extends IRecord>(): (_: any, context: CFDC<K, V, string, V>) => void;
395
395
 
396
396
  /**
397
397
  * 生命周期装饰器
398
398
  * 在插件初始化时调用
399
399
  */
400
- declare function OnInit<K extends string, TPluginConfig extends Record<string, any> | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
400
+ declare function OnInit<K extends string, TPluginConfig extends IRecord | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
401
401
  /**
402
402
  * 销毁装饰器
403
403
  * 在插件销毁时调用
@@ -407,7 +407,7 @@ declare function OnDestroy<K extends string>(_: any, context: CMDC<K, () => void
407
407
  * 配置变更装饰器
408
408
  * 在插件配置变更时调用
409
409
  */
410
- declare function OnConfigChange<K extends string, TPluginConfig extends Record<string, any> | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
410
+ declare function OnConfigChange<K extends string, TPluginConfig extends IRecord | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
411
411
 
412
412
  declare function observable<K extends string, T>(): (_: any, context: CFDC<K, T>) => void;
413
413
 
package/dist/index.d.mts CHANGED
@@ -1,14 +1,14 @@
1
- import { BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer, VerticalAlignment, HorizontalAlignment, Container, NodeOperatorFunction, NodeOperationPipe, NodeRenderType, PluginTools } from '@knotx/core';
1
+ import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer, VerticalAlignment, HorizontalAlignment, Container, NodeOperatorFunction, NodeOperationPipe, NodeRenderType, PluginTools } from '@knotx/core';
2
2
  import { Schema } from 'jsonschema';
3
3
 
4
4
  interface IInternalPlugin<TPluginName extends string = string, TRenderType extends RenderType = RenderType> extends IPlugin<TPluginName, any, TRenderType> {
5
5
  }
6
- type CMDC<TK extends string, TM extends (...args: any[]) => any, TN extends string = string, TC extends Record<string, any> | undefined = any> = ClassMethodDecoratorContext<{
6
+ type CMDC<TK extends string, TM extends (...args: any[]) => any, TN extends string = string, TC extends IRecord | undefined = any> = ClassMethodDecoratorContext<{
7
7
  [key in TK]: TM;
8
8
  } & BasePlugin<TN, TC, RenderType> & IPlugin<TN, TC, RenderType>, TM> & {
9
9
  name: TK;
10
10
  };
11
- type CFDC<TK extends string, TV, TN extends string = string, TC extends Record<string, any> | undefined = any> = ClassFieldDecoratorContext<{
11
+ type CFDC<TK extends string, TV, TN extends string = string, TC extends IRecord | undefined = any> = ClassFieldDecoratorContext<{
12
12
  [key in TK]: TV;
13
13
  } & BasePlugin<TN, TC, RenderType> & IPlugin<TN, TC, RenderType>, TV> & {
14
14
  name: TK;
@@ -61,7 +61,7 @@ declare function edgeOperator<K extends string, V extends EdgeOperatorFunction>(
61
61
  * }
62
62
  * ```
63
63
  */
64
- declare function edgePipe<K extends string>(): <T, V extends (...args: any[]) => EdgeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
64
+ declare function edgePipe<K extends string>(): <T extends IRecord, V extends (...args: any[]) => EdgeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
65
65
 
66
66
  /**
67
67
  * 连线渲染器装饰器
@@ -114,7 +114,7 @@ interface InjectDecoratorCallableDataType {
114
114
  * @example
115
115
  * ```
116
116
  * @inject('nodes')
117
- * nodes!: NodeData[]
117
+ * nodes!: Node[]
118
118
  * ```
119
119
  */
120
120
  <T extends InjectableDataKey>(engineKey: T): (_: undefined, context: ClassFieldDecoratorContext<IInternalPlugin, Engine[T]>) => void;
@@ -191,7 +191,7 @@ interface InjectDecoratorCallableMethodType {
191
191
  * @example
192
192
  * ```
193
193
  * @inject('getNode')
194
- * getNode!: (id: string) => NodeData | undefined
194
+ * getNode!: (id: string) => Node | undefined
195
195
  *
196
196
  * @inject('dispatchNodeOperation')
197
197
  * dispatchNodeOperation!: (operation: NodeOperation) => void
@@ -208,7 +208,7 @@ interface InjectDecoratorInjectableType {
208
208
  * @example
209
209
  * ```
210
210
  * @inject((injectable, context) => injectable.nodes.filter(node => node.id === context.id))
211
- * filteredNodes!: NodeData[]
211
+ * filteredNodes!: Node[]
212
212
  * ```
213
213
  */
214
214
  <R>(selector: (injectable: Injectable) => R): (_: undefined, context: ClassFieldDecoratorContext<IInternalPlugin, R>) => void;
@@ -255,7 +255,7 @@ interface SubscribeDecoratorCallableDataType {
255
255
  * @example
256
256
  * ```
257
257
  * @subscribe('nodes')
258
- * nodes!: NodeData[]
258
+ * nodes!: Node[]
259
259
  * ```
260
260
  */
261
261
  <T extends SubscribeDataKey>(engineKey: T): <TK extends string>(_: any, context: CMDC<TK, (v: Engine[T]) => void>) => void;
@@ -369,7 +369,7 @@ declare function nodeOperator<K extends string, V extends NodeOperatorFunction>(
369
369
  * }
370
370
  * ```
371
371
  */
372
- declare function nodePipe<K extends string>(): <T, V extends (...args: any[]) => NodeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
372
+ declare function nodePipe<K extends string>(): <T extends IRecord, V extends (...args: any[]) => NodeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
373
373
 
374
374
  /**
375
375
  * 节点类型装饰器
@@ -391,13 +391,13 @@ declare function nodeType<K extends string, T extends string, V extends NodeRend
391
391
  * 配置装饰器
392
392
  * 自动绑定 OnInit 和 OnConfigChange 生命周期函数 和 observable 装饰器
393
393
  */
394
- declare function config<K extends string, V extends Record<string, any>>(): (_: any, context: CFDC<K, V, string, V>) => void;
394
+ declare function config<K extends string, V extends IRecord>(): (_: any, context: CFDC<K, V, string, V>) => void;
395
395
 
396
396
  /**
397
397
  * 生命周期装饰器
398
398
  * 在插件初始化时调用
399
399
  */
400
- declare function OnInit<K extends string, TPluginConfig extends Record<string, any> | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
400
+ declare function OnInit<K extends string, TPluginConfig extends IRecord | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
401
401
  /**
402
402
  * 销毁装饰器
403
403
  * 在插件销毁时调用
@@ -407,7 +407,7 @@ declare function OnDestroy<K extends string>(_: any, context: CMDC<K, () => void
407
407
  * 配置变更装饰器
408
408
  * 在插件配置变更时调用
409
409
  */
410
- declare function OnConfigChange<K extends string, TPluginConfig extends Record<string, any> | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
410
+ declare function OnConfigChange<K extends string, TPluginConfig extends IRecord | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
411
411
 
412
412
  declare function observable<K extends string, T>(): (_: any, context: CFDC<K, T>) => void;
413
413
 
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer, VerticalAlignment, HorizontalAlignment, Container, NodeOperatorFunction, NodeOperationPipe, NodeRenderType, PluginTools } from '@knotx/core';
1
+ import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer, VerticalAlignment, HorizontalAlignment, Container, NodeOperatorFunction, NodeOperationPipe, NodeRenderType, PluginTools } from '@knotx/core';
2
2
  import { Schema } from 'jsonschema';
3
3
 
4
4
  interface IInternalPlugin<TPluginName extends string = string, TRenderType extends RenderType = RenderType> extends IPlugin<TPluginName, any, TRenderType> {
5
5
  }
6
- type CMDC<TK extends string, TM extends (...args: any[]) => any, TN extends string = string, TC extends Record<string, any> | undefined = any> = ClassMethodDecoratorContext<{
6
+ type CMDC<TK extends string, TM extends (...args: any[]) => any, TN extends string = string, TC extends IRecord | undefined = any> = ClassMethodDecoratorContext<{
7
7
  [key in TK]: TM;
8
8
  } & BasePlugin<TN, TC, RenderType> & IPlugin<TN, TC, RenderType>, TM> & {
9
9
  name: TK;
10
10
  };
11
- type CFDC<TK extends string, TV, TN extends string = string, TC extends Record<string, any> | undefined = any> = ClassFieldDecoratorContext<{
11
+ type CFDC<TK extends string, TV, TN extends string = string, TC extends IRecord | undefined = any> = ClassFieldDecoratorContext<{
12
12
  [key in TK]: TV;
13
13
  } & BasePlugin<TN, TC, RenderType> & IPlugin<TN, TC, RenderType>, TV> & {
14
14
  name: TK;
@@ -61,7 +61,7 @@ declare function edgeOperator<K extends string, V extends EdgeOperatorFunction>(
61
61
  * }
62
62
  * ```
63
63
  */
64
- declare function edgePipe<K extends string>(): <T, V extends (...args: any[]) => EdgeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
64
+ declare function edgePipe<K extends string>(): <T extends IRecord, V extends (...args: any[]) => EdgeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
65
65
 
66
66
  /**
67
67
  * 连线渲染器装饰器
@@ -114,7 +114,7 @@ interface InjectDecoratorCallableDataType {
114
114
  * @example
115
115
  * ```
116
116
  * @inject('nodes')
117
- * nodes!: NodeData[]
117
+ * nodes!: Node[]
118
118
  * ```
119
119
  */
120
120
  <T extends InjectableDataKey>(engineKey: T): (_: undefined, context: ClassFieldDecoratorContext<IInternalPlugin, Engine[T]>) => void;
@@ -191,7 +191,7 @@ interface InjectDecoratorCallableMethodType {
191
191
  * @example
192
192
  * ```
193
193
  * @inject('getNode')
194
- * getNode!: (id: string) => NodeData | undefined
194
+ * getNode!: (id: string) => Node | undefined
195
195
  *
196
196
  * @inject('dispatchNodeOperation')
197
197
  * dispatchNodeOperation!: (operation: NodeOperation) => void
@@ -208,7 +208,7 @@ interface InjectDecoratorInjectableType {
208
208
  * @example
209
209
  * ```
210
210
  * @inject((injectable, context) => injectable.nodes.filter(node => node.id === context.id))
211
- * filteredNodes!: NodeData[]
211
+ * filteredNodes!: Node[]
212
212
  * ```
213
213
  */
214
214
  <R>(selector: (injectable: Injectable) => R): (_: undefined, context: ClassFieldDecoratorContext<IInternalPlugin, R>) => void;
@@ -255,7 +255,7 @@ interface SubscribeDecoratorCallableDataType {
255
255
  * @example
256
256
  * ```
257
257
  * @subscribe('nodes')
258
- * nodes!: NodeData[]
258
+ * nodes!: Node[]
259
259
  * ```
260
260
  */
261
261
  <T extends SubscribeDataKey>(engineKey: T): <TK extends string>(_: any, context: CMDC<TK, (v: Engine[T]) => void>) => void;
@@ -369,7 +369,7 @@ declare function nodeOperator<K extends string, V extends NodeOperatorFunction>(
369
369
  * }
370
370
  * ```
371
371
  */
372
- declare function nodePipe<K extends string>(): <T, V extends (...args: any[]) => NodeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
372
+ declare function nodePipe<K extends string>(): <T extends IRecord, V extends (...args: any[]) => NodeOperationPipe<T>>(_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
373
373
 
374
374
  /**
375
375
  * 节点类型装饰器
@@ -391,13 +391,13 @@ declare function nodeType<K extends string, T extends string, V extends NodeRend
391
391
  * 配置装饰器
392
392
  * 自动绑定 OnInit 和 OnConfigChange 生命周期函数 和 observable 装饰器
393
393
  */
394
- declare function config<K extends string, V extends Record<string, any>>(): (_: any, context: CFDC<K, V, string, V>) => void;
394
+ declare function config<K extends string, V extends IRecord>(): (_: any, context: CFDC<K, V, string, V>) => void;
395
395
 
396
396
  /**
397
397
  * 生命周期装饰器
398
398
  * 在插件初始化时调用
399
399
  */
400
- declare function OnInit<K extends string, TPluginConfig extends Record<string, any> | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
400
+ declare function OnInit<K extends string, TPluginConfig extends IRecord | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
401
401
  /**
402
402
  * 销毁装饰器
403
403
  * 在插件销毁时调用
@@ -407,7 +407,7 @@ declare function OnDestroy<K extends string>(_: any, context: CMDC<K, () => void
407
407
  * 配置变更装饰器
408
408
  * 在插件配置变更时调用
409
409
  */
410
- declare function OnConfigChange<K extends string, TPluginConfig extends Record<string, any> | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
410
+ declare function OnConfigChange<K extends string, TPluginConfig extends IRecord | undefined>(_: any, context: CMDC<K, (config: TPluginConfig) => void, string, TPluginConfig> | CFDC<K, (config: TPluginConfig) => void, string, TPluginConfig>): void;
411
411
 
412
412
  declare function observable<K extends string, T>(): (_: any, context: CFDC<K, T>) => void;
413
413
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/decorators",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Decorators for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -28,20 +28,20 @@
28
28
  "dist"
29
29
  ],
30
30
  "peerDependencies": {
31
- "@knotx/jsx": "0.2.10"
31
+ "@knotx/jsx": "0.2.11"
32
32
  },
33
33
  "dependencies": {
34
34
  "jsonschema": "^1.5.0",
35
35
  "lodash-es": "^4.17.21",
36
36
  "rxjs": "^7.8.1",
37
- "@knotx/core": "0.2.10"
37
+ "@knotx/core": "0.2.11"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/lodash-es": "^4.14.12",
41
- "@knotx/build-config": "0.2.10",
42
- "@knotx/eslint-config": "0.2.10",
43
- "@knotx/jsx": "0.2.10",
44
- "@knotx/typescript-config": "0.2.10"
41
+ "@knotx/build-config": "0.2.11",
42
+ "@knotx/eslint-config": "0.2.11",
43
+ "@knotx/jsx": "0.2.11",
44
+ "@knotx/typescript-config": "0.2.11"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "unbuild",