@knotx/core 0.5.5 → 0.5.7
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/definition.d.cts +1 -1
- package/dist/definition.d.mts +1 -1
- package/dist/definition.d.ts +1 -1
- package/dist/index.cjs +29 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +29 -4
- package/dist/shared/{core.CWuBY8YD.d.cts → core.DtSgs5KK.d.cts} +16 -1
- package/dist/shared/{core.CWuBY8YD.d.mts → core.DtSgs5KK.d.mts} +16 -1
- package/dist/shared/{core.CWuBY8YD.d.ts → core.DtSgs5KK.d.ts} +16 -1
- package/package.json +6 -6
package/dist/definition.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'jsonschema';
|
|
2
2
|
import 'rxjs';
|
|
3
|
-
export { C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, L as Layer, j as LayerComponent, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.
|
|
3
|
+
export { C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, L as Layer, j as LayerComponent, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.DtSgs5KK.cjs';
|
|
4
4
|
import '@knotx/data';
|
package/dist/definition.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'jsonschema';
|
|
2
2
|
import 'rxjs';
|
|
3
|
-
export { C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, L as Layer, j as LayerComponent, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.
|
|
3
|
+
export { C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, L as Layer, j as LayerComponent, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.DtSgs5KK.mjs';
|
|
4
4
|
import '@knotx/data';
|
package/dist/definition.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'jsonschema';
|
|
2
2
|
import 'rxjs';
|
|
3
|
-
export { C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, L as Layer, j as LayerComponent, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.
|
|
3
|
+
export { C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, L as Layer, j as LayerComponent, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.DtSgs5KK.js';
|
|
4
4
|
import '@knotx/data';
|
package/dist/index.cjs
CHANGED
|
@@ -124,7 +124,7 @@ class InteractionManager {
|
|
|
124
124
|
}
|
|
125
125
|
return interaction;
|
|
126
126
|
}, null);
|
|
127
|
-
this.interactions.values().forEach((interaction) => {
|
|
127
|
+
Array.from(this.interactions.values()).forEach((interaction) => {
|
|
128
128
|
interaction.active = interaction === activeInteraction;
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -163,6 +163,8 @@ function wrapRender(render, plugin) {
|
|
|
163
163
|
return wrapped;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
const defaultLogger = console;
|
|
167
|
+
|
|
166
168
|
var __defProp$2 = Object.defineProperty;
|
|
167
169
|
var __defProps$1 = Object.defineProperties;
|
|
168
170
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
@@ -186,6 +188,7 @@ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !==
|
|
|
186
188
|
class Engine {
|
|
187
189
|
constructor(options) {
|
|
188
190
|
__publicField$2(this, "runtime");
|
|
191
|
+
__publicField$2(this, "logger");
|
|
189
192
|
__publicField$2(this, "interaction", new InteractionManager());
|
|
190
193
|
__publicField$2(this, "nodesManager");
|
|
191
194
|
__publicField$2(this, "edgesManager");
|
|
@@ -276,8 +279,9 @@ class Engine {
|
|
|
276
279
|
}
|
|
277
280
|
return tool(parameters);
|
|
278
281
|
});
|
|
279
|
-
var _a;
|
|
282
|
+
var _a, _b;
|
|
280
283
|
this.runtime = (_a = options.runtime) != null ? _a : {};
|
|
284
|
+
this.logger = (_b = options.logger) != null ? _b : defaultLogger;
|
|
281
285
|
this.container$.next(options.container);
|
|
282
286
|
this.nodesManager = new data.DataManager("nodes");
|
|
283
287
|
this.edgesManager = new data.DataManager("edges");
|
|
@@ -465,11 +469,14 @@ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !==
|
|
|
465
469
|
const _BasePlugin = class _BasePlugin {
|
|
466
470
|
constructor(__) {
|
|
467
471
|
__publicField$1(this, "_instanceId", _BasePlugin._instanceId++);
|
|
472
|
+
__publicField$1(this, "_pluginId");
|
|
473
|
+
__publicField$1(this, "_logger");
|
|
468
474
|
/**
|
|
469
475
|
* 插件生命周期中的订阅回调
|
|
470
476
|
* 可随时存入,销毁时会自动执行
|
|
471
477
|
*/
|
|
472
478
|
__publicField$1(this, "subscriptions", []);
|
|
479
|
+
__publicField$1(this, "isDestroyed", false);
|
|
473
480
|
__publicField$1(this, "callTool", (...args) => {
|
|
474
481
|
var _a;
|
|
475
482
|
return (_a = Reflect.get(this, utils.getSymbol("engine")).value) == null ? void 0 : _a.callTool(...args);
|
|
@@ -477,9 +484,27 @@ const _BasePlugin = class _BasePlugin {
|
|
|
477
484
|
Reflect.set(this, utils.getSymbol("engine"), new rxjs.BehaviorSubject(null));
|
|
478
485
|
}
|
|
479
486
|
get pluginId() {
|
|
480
|
-
|
|
487
|
+
var _a;
|
|
488
|
+
return (_a = this._pluginId) != null ? _a : this._pluginId = `knotx-plugin-${this.name.toLowerCase()}-${this._instanceId}`;
|
|
489
|
+
}
|
|
490
|
+
get logger() {
|
|
491
|
+
var _a, _b;
|
|
492
|
+
if (!this._logger) {
|
|
493
|
+
const engineLogger = (_b = (_a = Reflect.get(this, utils.getSymbol("engine")).value) == null ? void 0 : _a.logger) != null ? _b : defaultLogger;
|
|
494
|
+
this._logger = {
|
|
495
|
+
debug: (...args) => engineLogger.debug(this.pluginId, ...args),
|
|
496
|
+
info: (...args) => engineLogger.info(this.pluginId, ...args),
|
|
497
|
+
warn: (...args) => engineLogger.warn(this.pluginId, ...args),
|
|
498
|
+
error: (...args) => engineLogger.error(this.pluginId, ...args)
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
return this._logger;
|
|
481
502
|
}
|
|
482
503
|
onDestroy() {
|
|
504
|
+
if (this.isDestroyed) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
this.isDestroyed = true;
|
|
483
508
|
this.subscriptions.forEach((subscription) => {
|
|
484
509
|
if (typeof subscription === "function") {
|
|
485
510
|
subscription();
|
|
@@ -584,6 +609,7 @@ exports.Engine = Engine;
|
|
|
584
609
|
exports.InteractionManager = InteractionManager;
|
|
585
610
|
exports.InteractionPriority = InteractionPriority;
|
|
586
611
|
exports.Runtime = Runtime;
|
|
612
|
+
exports.defaultLogger = defaultLogger;
|
|
587
613
|
exports.getLayerRenders = getLayerRenders;
|
|
588
614
|
exports.use = use;
|
|
589
615
|
Object.prototype.hasOwnProperty.call(utils, '__proto__') &&
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Engine } from './shared/core.
|
|
2
|
-
export {
|
|
1
|
+
import { E as Engine } from './shared/core.DtSgs5KK.cjs';
|
|
2
|
+
export { M as BasePlugin, A as CallToolMethod, C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, z as EngineOptions, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, F as Interaction, G as InteractionManager, B as InteractionPriority, L as Layer, j as LayerComponent, J as Logger, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment, K as defaultLogger } from './shared/core.DtSgs5KK.cjs';
|
|
3
3
|
import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
|
|
4
4
|
import { BehaviorSubject } from 'rxjs';
|
|
5
5
|
export * from '@knotx/data';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Engine } from './shared/core.
|
|
2
|
-
export {
|
|
1
|
+
import { E as Engine } from './shared/core.DtSgs5KK.mjs';
|
|
2
|
+
export { M as BasePlugin, A as CallToolMethod, C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, z as EngineOptions, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, F as Interaction, G as InteractionManager, B as InteractionPriority, L as Layer, j as LayerComponent, J as Logger, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment, K as defaultLogger } from './shared/core.DtSgs5KK.mjs';
|
|
3
3
|
import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
|
|
4
4
|
import { BehaviorSubject } from 'rxjs';
|
|
5
5
|
export * from '@knotx/data';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Engine } from './shared/core.
|
|
2
|
-
export {
|
|
1
|
+
import { E as Engine } from './shared/core.DtSgs5KK.js';
|
|
2
|
+
export { M as BasePlugin, A as CallToolMethod, C as Container, D as Direction, d as Edge, e as EdgeConfig, v as EdgeOperation, t as EdgeOperationPipe, x as EdgeOperatorFunction, f as EdgeProps, i as EdgeRender, h as EdgeRenderType, z as EngineOptions, p as EngineTools, H as HorizontalAlignment, y as IEngineRuntime, k as IPlugin, q as IPluginInfo, I as IRecord, r as IToolInfo, F as Interaction, G as InteractionManager, B as InteractionPriority, L as Layer, j as LayerComponent, J as Logger, b as Node, a as NodeMeasured, u as NodeOperation, s as NodeOperationPipe, w as NodeOperatorFunction, N as NodePosition, c as NodeProps, g as NodeRenderType, l as Plugin, m as PluginConfigs, n as PluginData, o as PluginTools, P as Position, R as RenderType, V as VerticalAlignment, K as defaultLogger } from './shared/core.DtSgs5KK.js';
|
|
3
3
|
import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
|
|
4
4
|
import { BehaviorSubject } from 'rxjs';
|
|
5
5
|
export * from '@knotx/data';
|
package/dist/index.js
CHANGED
|
@@ -124,7 +124,7 @@ class InteractionManager {
|
|
|
124
124
|
}
|
|
125
125
|
return interaction;
|
|
126
126
|
}, null);
|
|
127
|
-
this.interactions.values().forEach((interaction) => {
|
|
127
|
+
Array.from(this.interactions.values()).forEach((interaction) => {
|
|
128
128
|
interaction.active = interaction === activeInteraction;
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -163,6 +163,8 @@ function wrapRender(render, plugin) {
|
|
|
163
163
|
return wrapped;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
const defaultLogger = console;
|
|
167
|
+
|
|
166
168
|
var __defProp$2 = Object.defineProperty;
|
|
167
169
|
var __defProps$1 = Object.defineProperties;
|
|
168
170
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
@@ -186,6 +188,7 @@ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !==
|
|
|
186
188
|
class Engine {
|
|
187
189
|
constructor(options) {
|
|
188
190
|
__publicField$2(this, "runtime");
|
|
191
|
+
__publicField$2(this, "logger");
|
|
189
192
|
__publicField$2(this, "interaction", new InteractionManager());
|
|
190
193
|
__publicField$2(this, "nodesManager");
|
|
191
194
|
__publicField$2(this, "edgesManager");
|
|
@@ -276,8 +279,9 @@ class Engine {
|
|
|
276
279
|
}
|
|
277
280
|
return tool(parameters);
|
|
278
281
|
});
|
|
279
|
-
var _a;
|
|
282
|
+
var _a, _b;
|
|
280
283
|
this.runtime = (_a = options.runtime) != null ? _a : {};
|
|
284
|
+
this.logger = (_b = options.logger) != null ? _b : defaultLogger;
|
|
281
285
|
this.container$.next(options.container);
|
|
282
286
|
this.nodesManager = new DataManager("nodes");
|
|
283
287
|
this.edgesManager = new DataManager("edges");
|
|
@@ -465,11 +469,14 @@ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !==
|
|
|
465
469
|
const _BasePlugin = class _BasePlugin {
|
|
466
470
|
constructor(__) {
|
|
467
471
|
__publicField$1(this, "_instanceId", _BasePlugin._instanceId++);
|
|
472
|
+
__publicField$1(this, "_pluginId");
|
|
473
|
+
__publicField$1(this, "_logger");
|
|
468
474
|
/**
|
|
469
475
|
* 插件生命周期中的订阅回调
|
|
470
476
|
* 可随时存入,销毁时会自动执行
|
|
471
477
|
*/
|
|
472
478
|
__publicField$1(this, "subscriptions", []);
|
|
479
|
+
__publicField$1(this, "isDestroyed", false);
|
|
473
480
|
__publicField$1(this, "callTool", (...args) => {
|
|
474
481
|
var _a;
|
|
475
482
|
return (_a = Reflect.get(this, getSymbol("engine")).value) == null ? void 0 : _a.callTool(...args);
|
|
@@ -477,9 +484,27 @@ const _BasePlugin = class _BasePlugin {
|
|
|
477
484
|
Reflect.set(this, getSymbol("engine"), new BehaviorSubject(null));
|
|
478
485
|
}
|
|
479
486
|
get pluginId() {
|
|
480
|
-
|
|
487
|
+
var _a;
|
|
488
|
+
return (_a = this._pluginId) != null ? _a : this._pluginId = `knotx-plugin-${this.name.toLowerCase()}-${this._instanceId}`;
|
|
489
|
+
}
|
|
490
|
+
get logger() {
|
|
491
|
+
var _a, _b;
|
|
492
|
+
if (!this._logger) {
|
|
493
|
+
const engineLogger = (_b = (_a = Reflect.get(this, getSymbol("engine")).value) == null ? void 0 : _a.logger) != null ? _b : defaultLogger;
|
|
494
|
+
this._logger = {
|
|
495
|
+
debug: (...args) => engineLogger.debug(this.pluginId, ...args),
|
|
496
|
+
info: (...args) => engineLogger.info(this.pluginId, ...args),
|
|
497
|
+
warn: (...args) => engineLogger.warn(this.pluginId, ...args),
|
|
498
|
+
error: (...args) => engineLogger.error(this.pluginId, ...args)
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
return this._logger;
|
|
481
502
|
}
|
|
482
503
|
onDestroy() {
|
|
504
|
+
if (this.isDestroyed) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
this.isDestroyed = true;
|
|
483
508
|
this.subscriptions.forEach((subscription) => {
|
|
484
509
|
if (typeof subscription === "function") {
|
|
485
510
|
subscription();
|
|
@@ -577,4 +602,4 @@ function use(hook, context) {
|
|
|
577
602
|
return Runtime.getInstance().runInContext("render", hook, context);
|
|
578
603
|
}
|
|
579
604
|
|
|
580
|
-
export { BasePlugin, DOMElement, Engine, InteractionManager, InteractionPriority, Runtime, getLayerRenders, use };
|
|
605
|
+
export { BasePlugin, DOMElement, Engine, InteractionManager, InteractionPriority, Runtime, defaultLogger, getLayerRenders, use };
|
|
@@ -2,6 +2,14 @@ import { Schema } from 'jsonschema';
|
|
|
2
2
|
import { BehaviorSubject, Subscription, SubscriptionLike } from 'rxjs';
|
|
3
3
|
import { DataManager, DataOperationPipe, DataOperation } from '@knotx/data';
|
|
4
4
|
|
|
5
|
+
interface Logger {
|
|
6
|
+
debug: (...args: any[]) => void;
|
|
7
|
+
info: (...args: any[]) => void;
|
|
8
|
+
warn: (...args: any[]) => void;
|
|
9
|
+
error: (...args: any[]) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const defaultLogger: Logger;
|
|
12
|
+
|
|
5
13
|
/**
|
|
6
14
|
* 用户交互优先级定义
|
|
7
15
|
* 数值越大优先级越高
|
|
@@ -87,6 +95,7 @@ interface EngineOptions<TNode extends IRecord = IRecord, TEdge extends IRecord =
|
|
|
87
95
|
nodes?: Node<TNode>[];
|
|
88
96
|
edges?: Edge<TEdge>[];
|
|
89
97
|
runtime?: IEngineRuntime;
|
|
98
|
+
logger?: Logger;
|
|
90
99
|
}
|
|
91
100
|
declare module '@knotx/core' {
|
|
92
101
|
interface EngineTools {
|
|
@@ -104,6 +113,7 @@ interface CallToolMethod {
|
|
|
104
113
|
}
|
|
105
114
|
declare class Engine<TRenderType extends RenderType = RenderType, TNode extends IRecord = IRecord, TEdge extends IRecord = IRecord> {
|
|
106
115
|
readonly runtime: IEngineRuntime;
|
|
116
|
+
readonly logger: Logger;
|
|
107
117
|
readonly interaction: InteractionManager;
|
|
108
118
|
readonly nodesManager: DataManager<Node<TNode>>;
|
|
109
119
|
readonly edgesManager: DataManager<Edge<TEdge>>;
|
|
@@ -179,12 +189,16 @@ declare abstract class BasePlugin<TPluginName extends string = string, TPluginCo
|
|
|
179
189
|
constructor(__: TPluginConfig);
|
|
180
190
|
private static _instanceId;
|
|
181
191
|
private _instanceId;
|
|
192
|
+
private _pluginId?;
|
|
182
193
|
get pluginId(): string;
|
|
194
|
+
private _logger?;
|
|
195
|
+
get logger(): Logger;
|
|
183
196
|
/**
|
|
184
197
|
* 插件生命周期中的订阅回调
|
|
185
198
|
* 可随时存入,销毁时会自动执行
|
|
186
199
|
*/
|
|
187
200
|
protected subscriptions: (SubscriptionLike | (() => void))[];
|
|
201
|
+
protected isDestroyed: boolean;
|
|
188
202
|
protected callTool: Engine['callTool'];
|
|
189
203
|
onDestroy(): void;
|
|
190
204
|
}
|
|
@@ -270,6 +284,7 @@ interface LayerComponent<TRenderType> {
|
|
|
270
284
|
interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any> {
|
|
271
285
|
name: TPluginName;
|
|
272
286
|
pluginId: string;
|
|
287
|
+
logger: Logger;
|
|
273
288
|
description?: string;
|
|
274
289
|
onInit?: (config: TPluginConfig) => void;
|
|
275
290
|
onConfigChange?: (config: TPluginConfig) => void;
|
|
@@ -333,4 +348,4 @@ interface IEngineRuntime {
|
|
|
333
348
|
};
|
|
334
349
|
}
|
|
335
350
|
|
|
336
|
-
export { type CallToolMethod as A, InteractionPriority as B, type Container as C, type Direction as D, Engine as E, type Interaction as F, InteractionManager as G, type HorizontalAlignment as H, type IRecord as I,
|
|
351
|
+
export { type CallToolMethod as A, InteractionPriority as B, type Container as C, type Direction as D, Engine as E, type Interaction as F, InteractionManager as G, type HorizontalAlignment as H, type IRecord as I, type Logger as J, defaultLogger as K, Layer as L, BasePlugin as M, type NodePosition as N, type Position as P, type RenderType as R, type VerticalAlignment as V, type NodeMeasured as a, type Node as b, type NodeProps as c, type Edge as d, type EdgeConfig as e, type EdgeProps as f, type NodeRenderType as g, type EdgeRenderType as h, type EdgeRender as i, type LayerComponent as j, type IPlugin as k, type Plugin as l, type PluginConfigs as m, type PluginData as n, type PluginTools as o, type EngineTools as p, type IPluginInfo as q, type IToolInfo as r, type NodeOperationPipe as s, type EdgeOperationPipe as t, type NodeOperation as u, type EdgeOperation as v, type NodeOperatorFunction as w, type EdgeOperatorFunction as x, type IEngineRuntime as y, type EngineOptions as z };
|
|
@@ -2,6 +2,14 @@ import { Schema } from 'jsonschema';
|
|
|
2
2
|
import { BehaviorSubject, Subscription, SubscriptionLike } from 'rxjs';
|
|
3
3
|
import { DataManager, DataOperationPipe, DataOperation } from '@knotx/data';
|
|
4
4
|
|
|
5
|
+
interface Logger {
|
|
6
|
+
debug: (...args: any[]) => void;
|
|
7
|
+
info: (...args: any[]) => void;
|
|
8
|
+
warn: (...args: any[]) => void;
|
|
9
|
+
error: (...args: any[]) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const defaultLogger: Logger;
|
|
12
|
+
|
|
5
13
|
/**
|
|
6
14
|
* 用户交互优先级定义
|
|
7
15
|
* 数值越大优先级越高
|
|
@@ -87,6 +95,7 @@ interface EngineOptions<TNode extends IRecord = IRecord, TEdge extends IRecord =
|
|
|
87
95
|
nodes?: Node<TNode>[];
|
|
88
96
|
edges?: Edge<TEdge>[];
|
|
89
97
|
runtime?: IEngineRuntime;
|
|
98
|
+
logger?: Logger;
|
|
90
99
|
}
|
|
91
100
|
declare module '@knotx/core' {
|
|
92
101
|
interface EngineTools {
|
|
@@ -104,6 +113,7 @@ interface CallToolMethod {
|
|
|
104
113
|
}
|
|
105
114
|
declare class Engine<TRenderType extends RenderType = RenderType, TNode extends IRecord = IRecord, TEdge extends IRecord = IRecord> {
|
|
106
115
|
readonly runtime: IEngineRuntime;
|
|
116
|
+
readonly logger: Logger;
|
|
107
117
|
readonly interaction: InteractionManager;
|
|
108
118
|
readonly nodesManager: DataManager<Node<TNode>>;
|
|
109
119
|
readonly edgesManager: DataManager<Edge<TEdge>>;
|
|
@@ -179,12 +189,16 @@ declare abstract class BasePlugin<TPluginName extends string = string, TPluginCo
|
|
|
179
189
|
constructor(__: TPluginConfig);
|
|
180
190
|
private static _instanceId;
|
|
181
191
|
private _instanceId;
|
|
192
|
+
private _pluginId?;
|
|
182
193
|
get pluginId(): string;
|
|
194
|
+
private _logger?;
|
|
195
|
+
get logger(): Logger;
|
|
183
196
|
/**
|
|
184
197
|
* 插件生命周期中的订阅回调
|
|
185
198
|
* 可随时存入,销毁时会自动执行
|
|
186
199
|
*/
|
|
187
200
|
protected subscriptions: (SubscriptionLike | (() => void))[];
|
|
201
|
+
protected isDestroyed: boolean;
|
|
188
202
|
protected callTool: Engine['callTool'];
|
|
189
203
|
onDestroy(): void;
|
|
190
204
|
}
|
|
@@ -270,6 +284,7 @@ interface LayerComponent<TRenderType> {
|
|
|
270
284
|
interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any> {
|
|
271
285
|
name: TPluginName;
|
|
272
286
|
pluginId: string;
|
|
287
|
+
logger: Logger;
|
|
273
288
|
description?: string;
|
|
274
289
|
onInit?: (config: TPluginConfig) => void;
|
|
275
290
|
onConfigChange?: (config: TPluginConfig) => void;
|
|
@@ -333,4 +348,4 @@ interface IEngineRuntime {
|
|
|
333
348
|
};
|
|
334
349
|
}
|
|
335
350
|
|
|
336
|
-
export { type CallToolMethod as A, InteractionPriority as B, type Container as C, type Direction as D, Engine as E, type Interaction as F, InteractionManager as G, type HorizontalAlignment as H, type IRecord as I,
|
|
351
|
+
export { type CallToolMethod as A, InteractionPriority as B, type Container as C, type Direction as D, Engine as E, type Interaction as F, InteractionManager as G, type HorizontalAlignment as H, type IRecord as I, type Logger as J, defaultLogger as K, Layer as L, BasePlugin as M, type NodePosition as N, type Position as P, type RenderType as R, type VerticalAlignment as V, type NodeMeasured as a, type Node as b, type NodeProps as c, type Edge as d, type EdgeConfig as e, type EdgeProps as f, type NodeRenderType as g, type EdgeRenderType as h, type EdgeRender as i, type LayerComponent as j, type IPlugin as k, type Plugin as l, type PluginConfigs as m, type PluginData as n, type PluginTools as o, type EngineTools as p, type IPluginInfo as q, type IToolInfo as r, type NodeOperationPipe as s, type EdgeOperationPipe as t, type NodeOperation as u, type EdgeOperation as v, type NodeOperatorFunction as w, type EdgeOperatorFunction as x, type IEngineRuntime as y, type EngineOptions as z };
|
|
@@ -2,6 +2,14 @@ import { Schema } from 'jsonschema';
|
|
|
2
2
|
import { BehaviorSubject, Subscription, SubscriptionLike } from 'rxjs';
|
|
3
3
|
import { DataManager, DataOperationPipe, DataOperation } from '@knotx/data';
|
|
4
4
|
|
|
5
|
+
interface Logger {
|
|
6
|
+
debug: (...args: any[]) => void;
|
|
7
|
+
info: (...args: any[]) => void;
|
|
8
|
+
warn: (...args: any[]) => void;
|
|
9
|
+
error: (...args: any[]) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const defaultLogger: Logger;
|
|
12
|
+
|
|
5
13
|
/**
|
|
6
14
|
* 用户交互优先级定义
|
|
7
15
|
* 数值越大优先级越高
|
|
@@ -87,6 +95,7 @@ interface EngineOptions<TNode extends IRecord = IRecord, TEdge extends IRecord =
|
|
|
87
95
|
nodes?: Node<TNode>[];
|
|
88
96
|
edges?: Edge<TEdge>[];
|
|
89
97
|
runtime?: IEngineRuntime;
|
|
98
|
+
logger?: Logger;
|
|
90
99
|
}
|
|
91
100
|
declare module '@knotx/core' {
|
|
92
101
|
interface EngineTools {
|
|
@@ -104,6 +113,7 @@ interface CallToolMethod {
|
|
|
104
113
|
}
|
|
105
114
|
declare class Engine<TRenderType extends RenderType = RenderType, TNode extends IRecord = IRecord, TEdge extends IRecord = IRecord> {
|
|
106
115
|
readonly runtime: IEngineRuntime;
|
|
116
|
+
readonly logger: Logger;
|
|
107
117
|
readonly interaction: InteractionManager;
|
|
108
118
|
readonly nodesManager: DataManager<Node<TNode>>;
|
|
109
119
|
readonly edgesManager: DataManager<Edge<TEdge>>;
|
|
@@ -179,12 +189,16 @@ declare abstract class BasePlugin<TPluginName extends string = string, TPluginCo
|
|
|
179
189
|
constructor(__: TPluginConfig);
|
|
180
190
|
private static _instanceId;
|
|
181
191
|
private _instanceId;
|
|
192
|
+
private _pluginId?;
|
|
182
193
|
get pluginId(): string;
|
|
194
|
+
private _logger?;
|
|
195
|
+
get logger(): Logger;
|
|
183
196
|
/**
|
|
184
197
|
* 插件生命周期中的订阅回调
|
|
185
198
|
* 可随时存入,销毁时会自动执行
|
|
186
199
|
*/
|
|
187
200
|
protected subscriptions: (SubscriptionLike | (() => void))[];
|
|
201
|
+
protected isDestroyed: boolean;
|
|
188
202
|
protected callTool: Engine['callTool'];
|
|
189
203
|
onDestroy(): void;
|
|
190
204
|
}
|
|
@@ -270,6 +284,7 @@ interface LayerComponent<TRenderType> {
|
|
|
270
284
|
interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any> {
|
|
271
285
|
name: TPluginName;
|
|
272
286
|
pluginId: string;
|
|
287
|
+
logger: Logger;
|
|
273
288
|
description?: string;
|
|
274
289
|
onInit?: (config: TPluginConfig) => void;
|
|
275
290
|
onConfigChange?: (config: TPluginConfig) => void;
|
|
@@ -333,4 +348,4 @@ interface IEngineRuntime {
|
|
|
333
348
|
};
|
|
334
349
|
}
|
|
335
350
|
|
|
336
|
-
export { type CallToolMethod as A, InteractionPriority as B, type Container as C, type Direction as D, Engine as E, type Interaction as F, InteractionManager as G, type HorizontalAlignment as H, type IRecord as I,
|
|
351
|
+
export { type CallToolMethod as A, InteractionPriority as B, type Container as C, type Direction as D, Engine as E, type Interaction as F, InteractionManager as G, type HorizontalAlignment as H, type IRecord as I, type Logger as J, defaultLogger as K, Layer as L, BasePlugin as M, type NodePosition as N, type Position as P, type RenderType as R, type VerticalAlignment as V, type NodeMeasured as a, type Node as b, type NodeProps as c, type Edge as d, type EdgeConfig as e, type EdgeProps as f, type NodeRenderType as g, type EdgeRenderType as h, type EdgeRender as i, type LayerComponent as j, type IPlugin as k, type Plugin as l, type PluginConfigs as m, type PluginData as n, type PluginTools as o, type EngineTools as p, type IPluginInfo as q, type IToolInfo as r, type NodeOperationPipe as s, type EdgeOperationPipe as t, type NodeOperation as u, type EdgeOperation as v, type NodeOperatorFunction as w, type EdgeOperatorFunction as x, type IEngineRuntime as y, type EngineOptions as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "Core for Knotx",
|
|
5
5
|
"author": "boenfu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"jsonschema": "^1.5.0",
|
|
47
47
|
"lodash-es": "^4.17.21",
|
|
48
48
|
"rxjs": "^7.8.1",
|
|
49
|
-
"@knotx/data": "0.5.
|
|
50
|
-
"@knotx/utils": "0.5.
|
|
49
|
+
"@knotx/data": "0.5.7",
|
|
50
|
+
"@knotx/utils": "0.5.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/lodash-es": "^4.17.12",
|
|
54
|
-
"@knotx/build-config": "0.5.
|
|
55
|
-
"@knotx/eslint-config": "0.5.
|
|
56
|
-
"@knotx/typescript-config": "0.5.
|
|
54
|
+
"@knotx/build-config": "0.5.7",
|
|
55
|
+
"@knotx/eslint-config": "0.5.7",
|
|
56
|
+
"@knotx/typescript-config": "0.5.7"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "unbuild",
|