@knotx/core 0.4.3 → 0.4.5

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.
@@ -1,4 +1,4 @@
1
1
  import 'jsonschema';
2
2
  import 'rxjs';
3
- export { C as Container, 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.DA6YV1kV.cjs';
3
+ export { C as Container, 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.Cw_3pM9o.cjs';
4
4
  import '@knotx/data';
@@ -1,4 +1,4 @@
1
1
  import 'jsonschema';
2
2
  import 'rxjs';
3
- export { C as Container, 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.DA6YV1kV.mjs';
3
+ export { C as Container, 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.Cw_3pM9o.mjs';
4
4
  import '@knotx/data';
@@ -1,4 +1,4 @@
1
1
  import 'jsonschema';
2
2
  import 'rxjs';
3
- export { C as Container, 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.DA6YV1kV.js';
3
+ export { C as Container, 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.Cw_3pM9o.js';
4
4
  import '@knotx/data';
package/dist/index.cjs CHANGED
@@ -4,7 +4,6 @@ const definition = require('./definition.cjs');
4
4
  const jsonschema = require('jsonschema');
5
5
  const lodashEs = require('lodash-es');
6
6
  const rxjs = require('rxjs');
7
- const core = require('@knotx/core');
8
7
  const utils = require('@knotx/utils');
9
8
  const data = require('@knotx/data');
10
9
 
@@ -16,12 +15,16 @@ class DOMElement {
16
15
  this.dom = dom;
17
16
  __publicField$4(this, "classList");
18
17
  __publicField$4(this, "attribute");
18
+ __publicField$4(this, "uniqSelector");
19
19
  this.classList = dom.classList;
20
20
  this.attribute = {
21
21
  get: (name) => dom.getAttribute(name),
22
22
  set: (name, value) => dom.setAttribute(name, value),
23
23
  remove: (name) => dom.removeAttribute(name)
24
24
  };
25
+ if (dom.id) {
26
+ this.uniqSelector = `#${dom.id}`;
27
+ }
25
28
  }
26
29
  getRect() {
27
30
  return this.dom.getBoundingClientRect();
@@ -146,24 +149,12 @@ var __spreadValues$2 = (a, b) => {
146
149
  function getLayerRenders(plugin) {
147
150
  var _a;
148
151
  const components = [];
149
- let isRenderConsumed = false;
150
152
  for (const [name, layer] of Object.entries((_a = Reflect.get(plugin, utils.getSymbol("layer"))) != null ? _a : {})) {
151
153
  components.push(__spreadValues$2({
152
154
  plugin: plugin.name,
153
155
  name: `${plugin.name}:${name}`,
154
156
  render: wrapRender(Reflect.get(plugin, name), plugin)
155
157
  }, layer));
156
- if (name === "render") {
157
- isRenderConsumed = true;
158
- }
159
- }
160
- if (!isRenderConsumed && plugin.render) {
161
- components.push({
162
- plugin: plugin.name,
163
- name: `${plugin.name}:render`,
164
- layer: core.Layer.Foreground,
165
- render: wrapRender(plugin.render, plugin)
166
- });
167
158
  }
168
159
  return components;
169
160
  }
@@ -479,7 +470,7 @@ const _BasePlugin = class _BasePlugin {
479
470
  Reflect.set(this, utils.getSymbol("engine"), new rxjs.BehaviorSubject(null));
480
471
  }
481
472
  get pluginId() {
482
- return `${this.name.toLowerCase()}-${this._instanceId}`;
473
+ return `knotx-plugin-${this.name.toLowerCase()}-${this._instanceId}`;
483
474
  }
484
475
  onDestroy() {
485
476
  this.subscriptions.forEach((subscription) => {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Engine } from './shared/core.DA6YV1kV.cjs';
2
- export { G as BasePlugin, A as CallToolMethod, C as Container, 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, D as Interaction, F as InteractionManager, B as InteractionPriority, 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.DA6YV1kV.cjs';
1
+ import { E as Engine } from './shared/core.Cw_3pM9o.cjs';
2
+ export { G as BasePlugin, A as CallToolMethod, C as Container, 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, D as Interaction, F as InteractionManager, B as InteractionPriority, 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.Cw_3pM9o.cjs';
3
3
  import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  export * from '@knotx/data';
@@ -55,6 +55,10 @@ interface EventListenerObject<E> {
55
55
  interface Element {
56
56
  classList: ElementClassList;
57
57
  attribute: ElementAttribute;
58
+ /**
59
+ * 唯一标识,如果存在,则在顶层进行 query 时,只会查出来一个元素(当前元素)
60
+ */
61
+ uniqSelector: string | undefined;
58
62
  getRect: () => ElementRect;
59
63
  addEventListener: EventListenerDefinition;
60
64
  removeEventListener: EventListenerDefinition;
@@ -65,6 +69,7 @@ declare class DOMElement implements Element {
65
69
  readonly dom: HTMLElement;
66
70
  classList: ElementClassList;
67
71
  attribute: ElementAttribute;
72
+ uniqSelector: string | undefined;
68
73
  constructor(dom: HTMLElement);
69
74
  getRect(): DOMRect;
70
75
  query(selector: string): Element | null;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Engine } from './shared/core.DA6YV1kV.mjs';
2
- export { G as BasePlugin, A as CallToolMethod, C as Container, 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, D as Interaction, F as InteractionManager, B as InteractionPriority, 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.DA6YV1kV.mjs';
1
+ import { E as Engine } from './shared/core.Cw_3pM9o.mjs';
2
+ export { G as BasePlugin, A as CallToolMethod, C as Container, 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, D as Interaction, F as InteractionManager, B as InteractionPriority, 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.Cw_3pM9o.mjs';
3
3
  import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  export * from '@knotx/data';
@@ -55,6 +55,10 @@ interface EventListenerObject<E> {
55
55
  interface Element {
56
56
  classList: ElementClassList;
57
57
  attribute: ElementAttribute;
58
+ /**
59
+ * 唯一标识,如果存在,则在顶层进行 query 时,只会查出来一个元素(当前元素)
60
+ */
61
+ uniqSelector: string | undefined;
58
62
  getRect: () => ElementRect;
59
63
  addEventListener: EventListenerDefinition;
60
64
  removeEventListener: EventListenerDefinition;
@@ -65,6 +69,7 @@ declare class DOMElement implements Element {
65
69
  readonly dom: HTMLElement;
66
70
  classList: ElementClassList;
67
71
  attribute: ElementAttribute;
72
+ uniqSelector: string | undefined;
68
73
  constructor(dom: HTMLElement);
69
74
  getRect(): DOMRect;
70
75
  query(selector: string): Element | null;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Engine } from './shared/core.DA6YV1kV.js';
2
- export { G as BasePlugin, A as CallToolMethod, C as Container, 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, D as Interaction, F as InteractionManager, B as InteractionPriority, 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.DA6YV1kV.js';
1
+ import { E as Engine } from './shared/core.Cw_3pM9o.js';
2
+ export { G as BasePlugin, A as CallToolMethod, C as Container, 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, D as Interaction, F as InteractionManager, B as InteractionPriority, 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.Cw_3pM9o.js';
3
3
  import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  export * from '@knotx/data';
@@ -55,6 +55,10 @@ interface EventListenerObject<E> {
55
55
  interface Element {
56
56
  classList: ElementClassList;
57
57
  attribute: ElementAttribute;
58
+ /**
59
+ * 唯一标识,如果存在,则在顶层进行 query 时,只会查出来一个元素(当前元素)
60
+ */
61
+ uniqSelector: string | undefined;
58
62
  getRect: () => ElementRect;
59
63
  addEventListener: EventListenerDefinition;
60
64
  removeEventListener: EventListenerDefinition;
@@ -65,6 +69,7 @@ declare class DOMElement implements Element {
65
69
  readonly dom: HTMLElement;
66
70
  classList: ElementClassList;
67
71
  attribute: ElementAttribute;
72
+ uniqSelector: string | undefined;
68
73
  constructor(dom: HTMLElement);
69
74
  getRect(): DOMRect;
70
75
  query(selector: string): Element | null;
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@ export { Layer } from './definition.js';
2
2
  import { Validator } from 'jsonschema';
3
3
  import { set, get } from 'lodash-es';
4
4
  import { BehaviorSubject, identity } from 'rxjs';
5
- import { Layer } from '@knotx/core';
6
5
  import { getSymbol } from '@knotx/utils';
7
6
  export * from '@knotx/utils';
8
7
  import { DataManager } from '@knotx/data';
@@ -16,12 +15,16 @@ class DOMElement {
16
15
  this.dom = dom;
17
16
  __publicField$4(this, "classList");
18
17
  __publicField$4(this, "attribute");
18
+ __publicField$4(this, "uniqSelector");
19
19
  this.classList = dom.classList;
20
20
  this.attribute = {
21
21
  get: (name) => dom.getAttribute(name),
22
22
  set: (name, value) => dom.setAttribute(name, value),
23
23
  remove: (name) => dom.removeAttribute(name)
24
24
  };
25
+ if (dom.id) {
26
+ this.uniqSelector = `#${dom.id}`;
27
+ }
25
28
  }
26
29
  getRect() {
27
30
  return this.dom.getBoundingClientRect();
@@ -146,24 +149,12 @@ var __spreadValues$2 = (a, b) => {
146
149
  function getLayerRenders(plugin) {
147
150
  var _a;
148
151
  const components = [];
149
- let isRenderConsumed = false;
150
152
  for (const [name, layer] of Object.entries((_a = Reflect.get(plugin, getSymbol("layer"))) != null ? _a : {})) {
151
153
  components.push(__spreadValues$2({
152
154
  plugin: plugin.name,
153
155
  name: `${plugin.name}:${name}`,
154
156
  render: wrapRender(Reflect.get(plugin, name), plugin)
155
157
  }, layer));
156
- if (name === "render") {
157
- isRenderConsumed = true;
158
- }
159
- }
160
- if (!isRenderConsumed && plugin.render) {
161
- components.push({
162
- plugin: plugin.name,
163
- name: `${plugin.name}:render`,
164
- layer: Layer.Foreground,
165
- render: wrapRender(plugin.render, plugin)
166
- });
167
158
  }
168
159
  return components;
169
160
  }
@@ -479,7 +470,7 @@ const _BasePlugin = class _BasePlugin {
479
470
  Reflect.set(this, getSymbol("engine"), new BehaviorSubject(null));
480
471
  }
481
472
  get pluginId() {
482
- return `${this.name.toLowerCase()}-${this._instanceId}`;
473
+ return `knotx-plugin-${this.name.toLowerCase()}-${this._instanceId}`;
483
474
  }
484
475
  onDestroy() {
485
476
  this.subscriptions.forEach((subscription) => {
@@ -123,7 +123,7 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
123
123
  get nodes(): Node<TNode>[];
124
124
  get edges(): Edge<TEdge>[];
125
125
  get layers(): Map<number, LayerComponent<TRenderType>[]>;
126
- get plugins(): IPlugin<string, any, RenderType>[];
126
+ get plugins(): IPlugin<string, any>[];
127
127
  constructor(options: EngineOptions<TNode, TEdge>);
128
128
  private init;
129
129
  callTool: CallToolMethod;
@@ -173,7 +173,7 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
173
173
  destroy(): void;
174
174
  }
175
175
 
176
- declare abstract class BasePlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = undefined, TRenderType extends RenderType = RenderType> implements IPlugin<TPluginName, TPluginConfig, TRenderType> {
176
+ declare abstract class BasePlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = undefined, TRenderType extends RenderType = RenderType> implements IPlugin<TPluginName, TPluginConfig> {
177
177
  abstract name: TPluginName;
178
178
  constructor(__: TPluginConfig);
179
179
  private static _instanceId;
@@ -262,14 +262,13 @@ interface LayerComponent<TRenderType> {
262
262
  */
263
263
  offset?: number;
264
264
  }
265
- interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any, TRenderType extends RenderType = RenderType> {
265
+ interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any> {
266
266
  name: TPluginName;
267
267
  pluginId: string;
268
268
  description?: string;
269
269
  onInit?: (config: TPluginConfig) => void;
270
270
  onConfigChange?: (config: TPluginConfig) => void;
271
271
  onDestroy?: () => void;
272
- render?: (...args: Parameters<TRenderType>) => ReturnType<TRenderType>;
273
272
  }
274
273
  type Plugin<TName extends string = string, TConfig extends IRecord | undefined = any, TRenderType extends RenderType = RenderType> = new (__: TConfig) => BasePlugin<TName, TConfig, TRenderType>;
275
274
  type PluginConfigs<TPlugins extends Plugin[]> = ((TPlugins[number] extends Plugin<infer T> ? {
@@ -123,7 +123,7 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
123
123
  get nodes(): Node<TNode>[];
124
124
  get edges(): Edge<TEdge>[];
125
125
  get layers(): Map<number, LayerComponent<TRenderType>[]>;
126
- get plugins(): IPlugin<string, any, RenderType>[];
126
+ get plugins(): IPlugin<string, any>[];
127
127
  constructor(options: EngineOptions<TNode, TEdge>);
128
128
  private init;
129
129
  callTool: CallToolMethod;
@@ -173,7 +173,7 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
173
173
  destroy(): void;
174
174
  }
175
175
 
176
- declare abstract class BasePlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = undefined, TRenderType extends RenderType = RenderType> implements IPlugin<TPluginName, TPluginConfig, TRenderType> {
176
+ declare abstract class BasePlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = undefined, TRenderType extends RenderType = RenderType> implements IPlugin<TPluginName, TPluginConfig> {
177
177
  abstract name: TPluginName;
178
178
  constructor(__: TPluginConfig);
179
179
  private static _instanceId;
@@ -262,14 +262,13 @@ interface LayerComponent<TRenderType> {
262
262
  */
263
263
  offset?: number;
264
264
  }
265
- interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any, TRenderType extends RenderType = RenderType> {
265
+ interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any> {
266
266
  name: TPluginName;
267
267
  pluginId: string;
268
268
  description?: string;
269
269
  onInit?: (config: TPluginConfig) => void;
270
270
  onConfigChange?: (config: TPluginConfig) => void;
271
271
  onDestroy?: () => void;
272
- render?: (...args: Parameters<TRenderType>) => ReturnType<TRenderType>;
273
272
  }
274
273
  type Plugin<TName extends string = string, TConfig extends IRecord | undefined = any, TRenderType extends RenderType = RenderType> = new (__: TConfig) => BasePlugin<TName, TConfig, TRenderType>;
275
274
  type PluginConfigs<TPlugins extends Plugin[]> = ((TPlugins[number] extends Plugin<infer T> ? {
@@ -123,7 +123,7 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
123
123
  get nodes(): Node<TNode>[];
124
124
  get edges(): Edge<TEdge>[];
125
125
  get layers(): Map<number, LayerComponent<TRenderType>[]>;
126
- get plugins(): IPlugin<string, any, RenderType>[];
126
+ get plugins(): IPlugin<string, any>[];
127
127
  constructor(options: EngineOptions<TNode, TEdge>);
128
128
  private init;
129
129
  callTool: CallToolMethod;
@@ -173,7 +173,7 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
173
173
  destroy(): void;
174
174
  }
175
175
 
176
- declare abstract class BasePlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = undefined, TRenderType extends RenderType = RenderType> implements IPlugin<TPluginName, TPluginConfig, TRenderType> {
176
+ declare abstract class BasePlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = undefined, TRenderType extends RenderType = RenderType> implements IPlugin<TPluginName, TPluginConfig> {
177
177
  abstract name: TPluginName;
178
178
  constructor(__: TPluginConfig);
179
179
  private static _instanceId;
@@ -262,14 +262,13 @@ interface LayerComponent<TRenderType> {
262
262
  */
263
263
  offset?: number;
264
264
  }
265
- interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any, TRenderType extends RenderType = RenderType> {
265
+ interface IPlugin<TPluginName extends string = string, TPluginConfig extends IRecord | undefined = any> {
266
266
  name: TPluginName;
267
267
  pluginId: string;
268
268
  description?: string;
269
269
  onInit?: (config: TPluginConfig) => void;
270
270
  onConfigChange?: (config: TPluginConfig) => void;
271
271
  onDestroy?: () => void;
272
- render?: (...args: Parameters<TRenderType>) => ReturnType<TRenderType>;
273
272
  }
274
273
  type Plugin<TName extends string = string, TConfig extends IRecord | undefined = any, TRenderType extends RenderType = RenderType> = new (__: TConfig) => BasePlugin<TName, TConfig, TRenderType>;
275
274
  type PluginConfigs<TPlugins extends Plugin[]> = ((TPlugins[number] extends Plugin<infer T> ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/core",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
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.4.3",
50
- "@knotx/utils": "0.4.3"
49
+ "@knotx/data": "0.4.5",
50
+ "@knotx/utils": "0.4.5"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/lodash-es": "^4.17.12",
54
- "@knotx/build-config": "0.4.3",
55
- "@knotx/eslint-config": "0.4.3",
56
- "@knotx/typescript-config": "0.4.3"
54
+ "@knotx/build-config": "0.4.5",
55
+ "@knotx/eslint-config": "0.4.5",
56
+ "@knotx/typescript-config": "0.4.5"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "unbuild",