@knotx/decorators 0.3.9 → 0.4.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/dist/index.cjs +26 -2
- package/dist/index.d.cts +5 -13
- package/dist/index.d.mts +5 -13
- package/dist/index.d.ts +5 -13
- package/dist/index.js +26 -2
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -77,14 +77,38 @@ function edgePipe() {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
var __defProp$1 = Object.defineProperty;
|
|
81
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
82
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
83
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
84
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
85
|
+
var __spreadValues$1 = (a, b) => {
|
|
86
|
+
for (var prop in b || (b = {}))
|
|
87
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
88
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
89
|
+
if (__getOwnPropSymbols$1)
|
|
90
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
91
|
+
if (__propIsEnum$1.call(b, prop))
|
|
92
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
93
|
+
}
|
|
94
|
+
return a;
|
|
95
|
+
};
|
|
96
|
+
const DEFAULT_EDGE_CONFIG = {
|
|
97
|
+
sourcePosition: "right",
|
|
98
|
+
targetPosition: "left",
|
|
99
|
+
sourceXOffset: 0,
|
|
100
|
+
sourceYOffset: 0,
|
|
101
|
+
targetXOffset: 0,
|
|
102
|
+
targetYOffset: 0
|
|
103
|
+
};
|
|
104
|
+
function edgeType(type, edgeConfig) {
|
|
81
105
|
return function(_, context) {
|
|
82
106
|
if (context.static) {
|
|
83
107
|
return;
|
|
84
108
|
}
|
|
85
109
|
context.addInitializer(function() {
|
|
86
110
|
subscribeEngine.call(this, (engine) => {
|
|
87
|
-
pushSubscription.call(this, engine.registerEdgeRenderer(type, "bind" in this[context.name] ? this[context.name].bind(this) : this[context.name]));
|
|
111
|
+
pushSubscription.call(this, engine.registerEdgeRenderer(type, "bind" in this[context.name] ? this[context.name].bind(this) : this[context.name], __spreadValues$1(__spreadValues$1({}, DEFAULT_EDGE_CONFIG), edgeConfig)));
|
|
88
112
|
});
|
|
89
113
|
});
|
|
90
114
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer,
|
|
1
|
+
import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, EdgeConfig, Engine, PluginData, Layer, Position, 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> {
|
|
@@ -77,7 +77,7 @@ declare function edgePipe<K extends string>(): <V extends (...args: any[]) => Ed
|
|
|
77
77
|
* }
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
|
-
declare function edgeType<K extends string, T extends string, V extends EdgeRenderType>(type: T): (_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
|
|
80
|
+
declare function edgeType<K extends string, T extends string, V extends EdgeRenderType>(type: T, edgeConfig?: EdgeConfig): (_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
|
|
81
81
|
|
|
82
82
|
type InjectableDataKey = keyof {
|
|
83
83
|
[K in keyof Engine as Engine[K] extends (...args: any[]) => any ? never : K]: Engine[K];
|
|
@@ -287,14 +287,6 @@ declare const subscribe: SubscribeDecorator;
|
|
|
287
287
|
|
|
288
288
|
declare function layer<K extends string>(layer: Layer, offset?: number): (_: any, context: CMDC<K, () => void>) => void;
|
|
289
289
|
|
|
290
|
-
/**
|
|
291
|
-
* 面板位置
|
|
292
|
-
* @example
|
|
293
|
-
* ```
|
|
294
|
-
* @panel('top')
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
type PanelPosition = VerticalAlignment | HorizontalAlignment | `${HorizontalAlignment}-${VerticalAlignment}` | 'center';
|
|
298
290
|
/**
|
|
299
291
|
* 面板偏移
|
|
300
292
|
* @example
|
|
@@ -311,7 +303,7 @@ interface PanelOffset {
|
|
|
311
303
|
* @param position 面板位置
|
|
312
304
|
* @param offset 面板偏移
|
|
313
305
|
*/
|
|
314
|
-
declare function createPanelWrapper(position:
|
|
306
|
+
declare function createPanelWrapper(position: Position, offset?: PanelOffset): ({ children, container }: {
|
|
315
307
|
children: React.ReactNode;
|
|
316
308
|
container: Container;
|
|
317
309
|
}) => JSX.Element;
|
|
@@ -320,7 +312,7 @@ declare function createPanelWrapper(position: PanelPosition, offset?: PanelOffse
|
|
|
320
312
|
* @param position 面板位置
|
|
321
313
|
* @param offset 面板偏移
|
|
322
314
|
*/
|
|
323
|
-
declare function panel<K extends string>(position:
|
|
315
|
+
declare function panel<K extends string>(position: Position, offset?: PanelOffset): (_: any, context: CMDC<K, () => any>) => void;
|
|
324
316
|
|
|
325
317
|
/**
|
|
326
318
|
* 节点操作装饰器
|
|
@@ -486,4 +478,4 @@ type InferSchemaType<T> = T extends Schema ? InferParamsFromSchema<T> : any;
|
|
|
486
478
|
*/
|
|
487
479
|
declare function tool<TN extends keyof PluginTools, TP extends keyof PluginTools[TN], TS extends Schema>(description: string, parameters: TS): (_: any, context: CMDC<Extract<TP, string>, PluginTools[TN][TP], TN>) => void;
|
|
488
480
|
|
|
489
|
-
export { type InferParamsFromSchema, type InferSchemaType, type InjectDecorator, type InjectDecoratorCallableDataType, type InjectDecoratorCallableMethodType, type InjectDecoratorCallablePluginDataType, type InjectDecoratorInjectableDataType, type InjectDecoratorInjectableMethodType, type InjectDecoratorInjectablePluginDataType, type InjectDecoratorInjectableType, type InjectWithContext, type Injectable, type InjectableDataKey, type InjectableMethodKey, OnConfigChange, OnDestroy, OnInit, type PanelOffset, type
|
|
481
|
+
export { type InferParamsFromSchema, type InferSchemaType, type InjectDecorator, type InjectDecoratorCallableDataType, type InjectDecoratorCallableMethodType, type InjectDecoratorCallablePluginDataType, type InjectDecoratorInjectableDataType, type InjectDecoratorInjectableMethodType, type InjectDecoratorInjectablePluginDataType, type InjectDecoratorInjectableType, type InjectWithContext, type Injectable, type InjectableDataKey, type InjectableMethodKey, OnConfigChange, OnDestroy, OnInit, type PanelOffset, type SubscribeDataKey, type SubscribeDecorator, type SubscribeDecoratorCallableDataType, type SubscribeDecoratorCallablePluginDataType, type SubscribeDecoratorSelectableDataType, type SubscribeDecoratorSelectablePluginDataType, type ToolParams, config, createPanelWrapper, edgeOperator, edgePipe, edgeType, inject, layer, nodeOperator, nodePipe, nodeType, observable, panel, register, subscribe, tool };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer,
|
|
1
|
+
import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, EdgeConfig, Engine, PluginData, Layer, Position, 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> {
|
|
@@ -77,7 +77,7 @@ declare function edgePipe<K extends string>(): <V extends (...args: any[]) => Ed
|
|
|
77
77
|
* }
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
|
-
declare function edgeType<K extends string, T extends string, V extends EdgeRenderType>(type: T): (_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
|
|
80
|
+
declare function edgeType<K extends string, T extends string, V extends EdgeRenderType>(type: T, edgeConfig?: EdgeConfig): (_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
|
|
81
81
|
|
|
82
82
|
type InjectableDataKey = keyof {
|
|
83
83
|
[K in keyof Engine as Engine[K] extends (...args: any[]) => any ? never : K]: Engine[K];
|
|
@@ -287,14 +287,6 @@ declare const subscribe: SubscribeDecorator;
|
|
|
287
287
|
|
|
288
288
|
declare function layer<K extends string>(layer: Layer, offset?: number): (_: any, context: CMDC<K, () => void>) => void;
|
|
289
289
|
|
|
290
|
-
/**
|
|
291
|
-
* 面板位置
|
|
292
|
-
* @example
|
|
293
|
-
* ```
|
|
294
|
-
* @panel('top')
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
type PanelPosition = VerticalAlignment | HorizontalAlignment | `${HorizontalAlignment}-${VerticalAlignment}` | 'center';
|
|
298
290
|
/**
|
|
299
291
|
* 面板偏移
|
|
300
292
|
* @example
|
|
@@ -311,7 +303,7 @@ interface PanelOffset {
|
|
|
311
303
|
* @param position 面板位置
|
|
312
304
|
* @param offset 面板偏移
|
|
313
305
|
*/
|
|
314
|
-
declare function createPanelWrapper(position:
|
|
306
|
+
declare function createPanelWrapper(position: Position, offset?: PanelOffset): ({ children, container }: {
|
|
315
307
|
children: React.ReactNode;
|
|
316
308
|
container: Container;
|
|
317
309
|
}) => JSX.Element;
|
|
@@ -320,7 +312,7 @@ declare function createPanelWrapper(position: PanelPosition, offset?: PanelOffse
|
|
|
320
312
|
* @param position 面板位置
|
|
321
313
|
* @param offset 面板偏移
|
|
322
314
|
*/
|
|
323
|
-
declare function panel<K extends string>(position:
|
|
315
|
+
declare function panel<K extends string>(position: Position, offset?: PanelOffset): (_: any, context: CMDC<K, () => any>) => void;
|
|
324
316
|
|
|
325
317
|
/**
|
|
326
318
|
* 节点操作装饰器
|
|
@@ -486,4 +478,4 @@ type InferSchemaType<T> = T extends Schema ? InferParamsFromSchema<T> : any;
|
|
|
486
478
|
*/
|
|
487
479
|
declare function tool<TN extends keyof PluginTools, TP extends keyof PluginTools[TN], TS extends Schema>(description: string, parameters: TS): (_: any, context: CMDC<Extract<TP, string>, PluginTools[TN][TP], TN>) => void;
|
|
488
480
|
|
|
489
|
-
export { type InferParamsFromSchema, type InferSchemaType, type InjectDecorator, type InjectDecoratorCallableDataType, type InjectDecoratorCallableMethodType, type InjectDecoratorCallablePluginDataType, type InjectDecoratorInjectableDataType, type InjectDecoratorInjectableMethodType, type InjectDecoratorInjectablePluginDataType, type InjectDecoratorInjectableType, type InjectWithContext, type Injectable, type InjectableDataKey, type InjectableMethodKey, OnConfigChange, OnDestroy, OnInit, type PanelOffset, type
|
|
481
|
+
export { type InferParamsFromSchema, type InferSchemaType, type InjectDecorator, type InjectDecoratorCallableDataType, type InjectDecoratorCallableMethodType, type InjectDecoratorCallablePluginDataType, type InjectDecoratorInjectableDataType, type InjectDecoratorInjectableMethodType, type InjectDecoratorInjectablePluginDataType, type InjectDecoratorInjectableType, type InjectWithContext, type Injectable, type InjectableDataKey, type InjectableMethodKey, OnConfigChange, OnDestroy, OnInit, type PanelOffset, type SubscribeDataKey, type SubscribeDecorator, type SubscribeDecoratorCallableDataType, type SubscribeDecoratorCallablePluginDataType, type SubscribeDecoratorSelectableDataType, type SubscribeDecoratorSelectablePluginDataType, type ToolParams, config, createPanelWrapper, edgeOperator, edgePipe, edgeType, inject, layer, nodeOperator, nodePipe, nodeType, observable, panel, register, subscribe, tool };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, Engine, PluginData, Layer,
|
|
1
|
+
import { IRecord, BasePlugin, RenderType, IPlugin, EdgeOperatorFunction, EdgeOperationPipe, EdgeRenderType, EdgeConfig, Engine, PluginData, Layer, Position, 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> {
|
|
@@ -77,7 +77,7 @@ declare function edgePipe<K extends string>(): <V extends (...args: any[]) => Ed
|
|
|
77
77
|
* }
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
|
-
declare function edgeType<K extends string, T extends string, V extends EdgeRenderType>(type: T): (_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
|
|
80
|
+
declare function edgeType<K extends string, T extends string, V extends EdgeRenderType>(type: T, edgeConfig?: EdgeConfig): (_: any, context: CMDC<K, V> | CFDC<K, V>) => void;
|
|
81
81
|
|
|
82
82
|
type InjectableDataKey = keyof {
|
|
83
83
|
[K in keyof Engine as Engine[K] extends (...args: any[]) => any ? never : K]: Engine[K];
|
|
@@ -287,14 +287,6 @@ declare const subscribe: SubscribeDecorator;
|
|
|
287
287
|
|
|
288
288
|
declare function layer<K extends string>(layer: Layer, offset?: number): (_: any, context: CMDC<K, () => void>) => void;
|
|
289
289
|
|
|
290
|
-
/**
|
|
291
|
-
* 面板位置
|
|
292
|
-
* @example
|
|
293
|
-
* ```
|
|
294
|
-
* @panel('top')
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
type PanelPosition = VerticalAlignment | HorizontalAlignment | `${HorizontalAlignment}-${VerticalAlignment}` | 'center';
|
|
298
290
|
/**
|
|
299
291
|
* 面板偏移
|
|
300
292
|
* @example
|
|
@@ -311,7 +303,7 @@ interface PanelOffset {
|
|
|
311
303
|
* @param position 面板位置
|
|
312
304
|
* @param offset 面板偏移
|
|
313
305
|
*/
|
|
314
|
-
declare function createPanelWrapper(position:
|
|
306
|
+
declare function createPanelWrapper(position: Position, offset?: PanelOffset): ({ children, container }: {
|
|
315
307
|
children: React.ReactNode;
|
|
316
308
|
container: Container;
|
|
317
309
|
}) => JSX.Element;
|
|
@@ -320,7 +312,7 @@ declare function createPanelWrapper(position: PanelPosition, offset?: PanelOffse
|
|
|
320
312
|
* @param position 面板位置
|
|
321
313
|
* @param offset 面板偏移
|
|
322
314
|
*/
|
|
323
|
-
declare function panel<K extends string>(position:
|
|
315
|
+
declare function panel<K extends string>(position: Position, offset?: PanelOffset): (_: any, context: CMDC<K, () => any>) => void;
|
|
324
316
|
|
|
325
317
|
/**
|
|
326
318
|
* 节点操作装饰器
|
|
@@ -486,4 +478,4 @@ type InferSchemaType<T> = T extends Schema ? InferParamsFromSchema<T> : any;
|
|
|
486
478
|
*/
|
|
487
479
|
declare function tool<TN extends keyof PluginTools, TP extends keyof PluginTools[TN], TS extends Schema>(description: string, parameters: TS): (_: any, context: CMDC<Extract<TP, string>, PluginTools[TN][TP], TN>) => void;
|
|
488
480
|
|
|
489
|
-
export { type InferParamsFromSchema, type InferSchemaType, type InjectDecorator, type InjectDecoratorCallableDataType, type InjectDecoratorCallableMethodType, type InjectDecoratorCallablePluginDataType, type InjectDecoratorInjectableDataType, type InjectDecoratorInjectableMethodType, type InjectDecoratorInjectablePluginDataType, type InjectDecoratorInjectableType, type InjectWithContext, type Injectable, type InjectableDataKey, type InjectableMethodKey, OnConfigChange, OnDestroy, OnInit, type PanelOffset, type
|
|
481
|
+
export { type InferParamsFromSchema, type InferSchemaType, type InjectDecorator, type InjectDecoratorCallableDataType, type InjectDecoratorCallableMethodType, type InjectDecoratorCallablePluginDataType, type InjectDecoratorInjectableDataType, type InjectDecoratorInjectableMethodType, type InjectDecoratorInjectablePluginDataType, type InjectDecoratorInjectableType, type InjectWithContext, type Injectable, type InjectableDataKey, type InjectableMethodKey, OnConfigChange, OnDestroy, OnInit, type PanelOffset, type SubscribeDataKey, type SubscribeDecorator, type SubscribeDecoratorCallableDataType, type SubscribeDecoratorCallablePluginDataType, type SubscribeDecoratorSelectableDataType, type SubscribeDecoratorSelectablePluginDataType, type ToolParams, config, createPanelWrapper, edgeOperator, edgePipe, edgeType, inject, layer, nodeOperator, nodePipe, nodeType, observable, panel, register, subscribe, tool };
|
package/dist/index.js
CHANGED
|
@@ -75,14 +75,38 @@ function edgePipe() {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
var __defProp$1 = Object.defineProperty;
|
|
79
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
80
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
81
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
82
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
83
|
+
var __spreadValues$1 = (a, b) => {
|
|
84
|
+
for (var prop in b || (b = {}))
|
|
85
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
86
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
87
|
+
if (__getOwnPropSymbols$1)
|
|
88
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
89
|
+
if (__propIsEnum$1.call(b, prop))
|
|
90
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
91
|
+
}
|
|
92
|
+
return a;
|
|
93
|
+
};
|
|
94
|
+
const DEFAULT_EDGE_CONFIG = {
|
|
95
|
+
sourcePosition: "right",
|
|
96
|
+
targetPosition: "left",
|
|
97
|
+
sourceXOffset: 0,
|
|
98
|
+
sourceYOffset: 0,
|
|
99
|
+
targetXOffset: 0,
|
|
100
|
+
targetYOffset: 0
|
|
101
|
+
};
|
|
102
|
+
function edgeType(type, edgeConfig) {
|
|
79
103
|
return function(_, context) {
|
|
80
104
|
if (context.static) {
|
|
81
105
|
return;
|
|
82
106
|
}
|
|
83
107
|
context.addInitializer(function() {
|
|
84
108
|
subscribeEngine.call(this, (engine) => {
|
|
85
|
-
pushSubscription.call(this, engine.registerEdgeRenderer(type, "bind" in this[context.name] ? this[context.name].bind(this) : this[context.name]));
|
|
109
|
+
pushSubscription.call(this, engine.registerEdgeRenderer(type, "bind" in this[context.name] ? this[context.name].bind(this) : this[context.name], __spreadValues$1(__spreadValues$1({}, DEFAULT_EDGE_CONFIG), edgeConfig)));
|
|
86
110
|
});
|
|
87
111
|
});
|
|
88
112
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/decorators",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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.
|
|
31
|
+
"@knotx/jsx": "0.4.0"
|
|
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.
|
|
37
|
+
"@knotx/core": "0.4.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/lodash-es": "^4.14.12",
|
|
41
|
-
"@knotx/build-config": "0.
|
|
42
|
-
"@knotx/eslint-config": "0.
|
|
43
|
-
"@knotx/jsx": "0.
|
|
44
|
-
"@knotx/typescript-config": "0.
|
|
41
|
+
"@knotx/build-config": "0.4.0",
|
|
42
|
+
"@knotx/eslint-config": "0.4.0",
|
|
43
|
+
"@knotx/jsx": "0.4.0",
|
|
44
|
+
"@knotx/typescript-config": "0.4.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "unbuild",
|