@knotx/react 0.4.11 → 0.4.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.cjs CHANGED
@@ -181,6 +181,8 @@ function usePluginConfigUpdate(engineRef, {
181
181
  }
182
182
 
183
183
  var __defProp = Object.defineProperty;
184
+ var __defProps = Object.defineProperties;
185
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
184
186
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
185
187
  var __hasOwnProp = Object.prototype.hasOwnProperty;
186
188
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -196,6 +198,7 @@ var __spreadValues = (a, b) => {
196
198
  }
197
199
  return a;
198
200
  };
201
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
199
202
  const Knotx = react.memo(react.forwardRef(({
200
203
  className,
201
204
  style,
@@ -207,7 +210,8 @@ const Knotx = react.memo(react.forwardRef(({
207
210
  plugins: _plugins,
208
211
  pluginConfig,
209
212
  disablePresetPlugins = false,
210
- onInit
213
+ onInit,
214
+ direction = "horizontal"
211
215
  }, ref) => {
212
216
  const [, rerender] = react.useReducer((state) => state + 1, 0);
213
217
  const initRef = react.useRef(false);
@@ -215,7 +219,7 @@ const Knotx = react.memo(react.forwardRef(({
215
219
  const plugins = useMergedPlugins(_plugins, disablePresetPlugins);
216
220
  if (!engineRef.current) {
217
221
  engineRef.current = initReactEngine({
218
- container: { width: 0, height: 0 },
222
+ container: { width: 0, height: 0, direction },
219
223
  nodes: nodes != null ? nodes : initialNodes,
220
224
  edges: edges != null ? edges : initialEdges,
221
225
  plugins,
@@ -226,7 +230,9 @@ const Knotx = react.memo(react.forwardRef(({
226
230
  if (!engineRef.current) {
227
231
  return;
228
232
  }
229
- engineRef.current.container = containerSize;
233
+ engineRef.current.container = __spreadProps(__spreadValues({}, containerSize), {
234
+ direction
235
+ });
230
236
  if (!initRef.current) {
231
237
  initRef.current = true;
232
238
  onInit == null ? void 0 : onInit(engineRef.current);
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { IRecord, Engine, Plugin, Node, Edge } from '@knotx/core';
1
+ import { IRecord, Engine, Plugin, Node, Edge, Direction } from '@knotx/core';
2
2
  export { Direction, Edge, EdgeOperation, EdgeOperationPipe, EdgeOperatorFunction, EdgeProps, EdgeRenderType, EngineOptions, IData, IEngineRuntime, IPlugin, Layer, LayerComponent, Node, NodeMeasured, NodeOperation, NodeOperationPipe, NodeOperatorFunction, NodePosition, NodeProps, NodeRenderType, Plugin, PluginConfigs, PluginData, PluginTools, Position } from '@knotx/core';
3
3
  import { FC, MutableRefObject, Ref, CSSProperties, ForwardedRef, ReactElement } from 'react';
4
4
 
@@ -44,6 +44,7 @@ type KnotxProps<TPlugins extends Plugin[] = Plugin[], TNode extends IRecord = IR
44
44
  */
45
45
  disablePresetPlugins?: boolean;
46
46
  onInit?: (engine: ReactEngine<TNode, TEdge>) => void;
47
+ direction?: Direction;
47
48
  } & ((TPlugins[number] extends Plugin<infer T> ? {
48
49
  [TName in T as Extract<TPlugins[number], Plugin<TName>> extends Plugin<TName, undefined> ? never : TName]: Extract<TPlugins[number], Plugin<TName>> extends infer T ? T extends Plugin<TName, infer TConfig> ? TConfig : never : never;
49
50
  } : {}) extends infer PluginConfig ? {} extends PluginConfig ? {
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { IRecord, Engine, Plugin, Node, Edge } from '@knotx/core';
1
+ import { IRecord, Engine, Plugin, Node, Edge, Direction } from '@knotx/core';
2
2
  export { Direction, Edge, EdgeOperation, EdgeOperationPipe, EdgeOperatorFunction, EdgeProps, EdgeRenderType, EngineOptions, IData, IEngineRuntime, IPlugin, Layer, LayerComponent, Node, NodeMeasured, NodeOperation, NodeOperationPipe, NodeOperatorFunction, NodePosition, NodeProps, NodeRenderType, Plugin, PluginConfigs, PluginData, PluginTools, Position } from '@knotx/core';
3
3
  import { FC, MutableRefObject, Ref, CSSProperties, ForwardedRef, ReactElement } from 'react';
4
4
 
@@ -44,6 +44,7 @@ type KnotxProps<TPlugins extends Plugin[] = Plugin[], TNode extends IRecord = IR
44
44
  */
45
45
  disablePresetPlugins?: boolean;
46
46
  onInit?: (engine: ReactEngine<TNode, TEdge>) => void;
47
+ direction?: Direction;
47
48
  } & ((TPlugins[number] extends Plugin<infer T> ? {
48
49
  [TName in T as Extract<TPlugins[number], Plugin<TName>> extends Plugin<TName, undefined> ? never : TName]: Extract<TPlugins[number], Plugin<TName>> extends infer T ? T extends Plugin<TName, infer TConfig> ? TConfig : never : never;
49
50
  } : {}) extends infer PluginConfig ? {} extends PluginConfig ? {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IRecord, Engine, Plugin, Node, Edge } from '@knotx/core';
1
+ import { IRecord, Engine, Plugin, Node, Edge, Direction } from '@knotx/core';
2
2
  export { Direction, Edge, EdgeOperation, EdgeOperationPipe, EdgeOperatorFunction, EdgeProps, EdgeRenderType, EngineOptions, IData, IEngineRuntime, IPlugin, Layer, LayerComponent, Node, NodeMeasured, NodeOperation, NodeOperationPipe, NodeOperatorFunction, NodePosition, NodeProps, NodeRenderType, Plugin, PluginConfigs, PluginData, PluginTools, Position } from '@knotx/core';
3
3
  import { FC, MutableRefObject, Ref, CSSProperties, ForwardedRef, ReactElement } from 'react';
4
4
 
@@ -44,6 +44,7 @@ type KnotxProps<TPlugins extends Plugin[] = Plugin[], TNode extends IRecord = IR
44
44
  */
45
45
  disablePresetPlugins?: boolean;
46
46
  onInit?: (engine: ReactEngine<TNode, TEdge>) => void;
47
+ direction?: Direction;
47
48
  } & ((TPlugins[number] extends Plugin<infer T> ? {
48
49
  [TName in T as Extract<TPlugins[number], Plugin<TName>> extends Plugin<TName, undefined> ? never : TName]: Extract<TPlugins[number], Plugin<TName>> extends infer T ? T extends Plugin<TName, infer TConfig> ? TConfig : never : never;
49
50
  } : {}) extends infer PluginConfig ? {} extends PluginConfig ? {
package/dist/index.js CHANGED
@@ -179,6 +179,8 @@ function usePluginConfigUpdate(engineRef, {
179
179
  }
180
180
 
181
181
  var __defProp = Object.defineProperty;
182
+ var __defProps = Object.defineProperties;
183
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
182
184
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
183
185
  var __hasOwnProp = Object.prototype.hasOwnProperty;
184
186
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -194,6 +196,7 @@ var __spreadValues = (a, b) => {
194
196
  }
195
197
  return a;
196
198
  };
199
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
197
200
  const Knotx = memo(forwardRef(({
198
201
  className,
199
202
  style,
@@ -205,7 +208,8 @@ const Knotx = memo(forwardRef(({
205
208
  plugins: _plugins,
206
209
  pluginConfig,
207
210
  disablePresetPlugins = false,
208
- onInit
211
+ onInit,
212
+ direction = "horizontal"
209
213
  }, ref) => {
210
214
  const [, rerender] = useReducer((state) => state + 1, 0);
211
215
  const initRef = useRef(false);
@@ -213,7 +217,7 @@ const Knotx = memo(forwardRef(({
213
217
  const plugins = useMergedPlugins(_plugins, disablePresetPlugins);
214
218
  if (!engineRef.current) {
215
219
  engineRef.current = initReactEngine({
216
- container: { width: 0, height: 0 },
220
+ container: { width: 0, height: 0, direction },
217
221
  nodes: nodes != null ? nodes : initialNodes,
218
222
  edges: edges != null ? edges : initialEdges,
219
223
  plugins,
@@ -224,7 +228,9 @@ const Knotx = memo(forwardRef(({
224
228
  if (!engineRef.current) {
225
229
  return;
226
230
  }
227
- engineRef.current.container = containerSize;
231
+ engineRef.current.container = __spreadProps(__spreadValues({}, containerSize), {
232
+ direction
233
+ });
228
234
  if (!initRef.current) {
229
235
  initRef.current = true;
230
236
  onInit == null ? void 0 : onInit(engineRef.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/react",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "React for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -33,19 +33,19 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "rxjs": "^7.8.1",
36
- "@knotx/core": "0.4.11",
37
- "@knotx/jsx": "0.4.11",
38
- "@knotx/plugins-base-render": "0.4.11"
36
+ "@knotx/core": "0.4.12",
37
+ "@knotx/jsx": "0.4.12",
38
+ "@knotx/plugins-base-render": "0.4.12"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/react": "^17.0.0",
42
42
  "@types/react-dom": "^17.0.0",
43
43
  "react": "^17.0.0",
44
44
  "react-dom": "^17.0.0",
45
- "@knotx/build-config": "0.4.11",
46
- "@knotx/eslint-config": "0.4.11",
47
- "@knotx/jsx": "0.4.11",
48
- "@knotx/typescript-config": "0.4.11"
45
+ "@knotx/build-config": "0.4.12",
46
+ "@knotx/eslint-config": "0.4.12",
47
+ "@knotx/jsx": "0.4.12",
48
+ "@knotx/typescript-config": "0.4.12"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "unbuild",