@rxflow/base 0.0.2 → 0.0.4-alpha.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.
Files changed (131) hide show
  1. package/cjs/Flow.d.ts +1 -1
  2. package/cjs/Flow.d.ts.map +1 -1
  3. package/cjs/Flow.js +28 -10
  4. package/cjs/components/Legend/index.d.ts.map +1 -1
  5. package/cjs/components/Legend/index.js +2 -1
  6. package/cjs/components/Popover/index.d.ts +1 -9
  7. package/cjs/components/Popover/index.d.ts.map +1 -1
  8. package/cjs/components/Popover/index.js +14 -75
  9. package/cjs/components/Tooltip/index.d.ts +1 -10
  10. package/cjs/components/Tooltip/index.d.ts.map +1 -1
  11. package/cjs/components/Tooltip/index.js +11 -83
  12. package/cjs/edges/manhattan.d.ts.map +1 -1
  13. package/cjs/edges/manhattan.js +100 -30
  14. package/cjs/hoc/createFlow.d.ts +30 -4
  15. package/cjs/hoc/createFlow.d.ts.map +1 -1
  16. package/cjs/hoc/createFlow.js +45 -18
  17. package/cjs/hooks/index.d.ts +5 -2
  18. package/cjs/hooks/index.d.ts.map +1 -1
  19. package/cjs/hooks/index.js +44 -22
  20. package/cjs/hooks/props/index.d.ts +12 -0
  21. package/cjs/hooks/props/index.d.ts.map +1 -0
  22. package/cjs/hooks/props/index.js +49 -0
  23. package/cjs/hooks/props/useFlowProps.d.ts +23 -0
  24. package/cjs/hooks/props/useFlowProps.d.ts.map +1 -0
  25. package/cjs/hooks/props/useFlowProps.js +34 -0
  26. package/cjs/hooks/props/useGetFlowProps.d.ts +19 -0
  27. package/cjs/hooks/props/useGetFlowProps.d.ts.map +1 -0
  28. package/cjs/hooks/props/useGetFlowProps.js +38 -0
  29. package/cjs/hooks/props/useGetInputProps.d.ts +18 -0
  30. package/cjs/hooks/props/useGetInputProps.d.ts.map +1 -0
  31. package/cjs/hooks/props/useGetInputProps.js +38 -0
  32. package/cjs/hooks/props/useInputProps.d.ts +14 -0
  33. package/cjs/hooks/props/useInputProps.d.ts.map +1 -0
  34. package/cjs/hooks/props/useInputProps.js +33 -0
  35. package/cjs/hooks/useListenRender.js +4 -4
  36. package/cjs/hooks/useTheme.d.ts.map +1 -1
  37. package/cjs/hooks/useTheme.js +3 -2
  38. package/cjs/index.d.ts +6 -3
  39. package/cjs/index.d.ts.map +1 -1
  40. package/cjs/index.js +46 -14
  41. package/cjs/providers/FlowProvider.d.ts +7 -1
  42. package/cjs/providers/FlowProvider.d.ts.map +1 -1
  43. package/cjs/providers/FlowProvider.js +33 -14
  44. package/cjs/store/PropsStore.d.ts +11 -6
  45. package/cjs/store/PropsStore.d.ts.map +1 -1
  46. package/cjs/store/PropsStore.js +55 -39
  47. package/cjs/types/props.d.ts +83 -0
  48. package/cjs/types/props.d.ts.map +1 -0
  49. package/cjs/types/props.js +5 -0
  50. package/cjs/types.d.ts +5 -1
  51. package/cjs/types.d.ts.map +1 -1
  52. package/cjs/utils/wrapNodeTypes.d.ts +30 -0
  53. package/cjs/utils/wrapNodeTypes.d.ts.map +1 -0
  54. package/cjs/utils/wrapNodeTypes.js +56 -0
  55. package/cjs/workers/manhattan.worker.js +12534 -31
  56. package/cjs/workers/manhattan.worker.js.map +7 -0
  57. package/esm/Flow.d.ts +1 -1
  58. package/esm/Flow.d.ts.map +1 -1
  59. package/esm/Flow.js +30 -16
  60. package/esm/components/Legend/index.d.ts.map +1 -1
  61. package/esm/components/Legend/index.js +3 -2
  62. package/esm/components/Popover/index.d.ts +1 -9
  63. package/esm/components/Popover/index.d.ts.map +1 -1
  64. package/esm/components/Popover/index.js +16 -87
  65. package/esm/components/Tooltip/index.d.ts +1 -10
  66. package/esm/components/Tooltip/index.d.ts.map +1 -1
  67. package/esm/components/Tooltip/index.js +14 -97
  68. package/esm/edges/manhattan.d.ts.map +1 -1
  69. package/esm/edges/manhattan.js +95 -23
  70. package/esm/hoc/createFlow.d.ts +30 -4
  71. package/esm/hoc/createFlow.d.ts.map +1 -1
  72. package/esm/hoc/createFlow.js +48 -20
  73. package/esm/hooks/index.d.ts +5 -2
  74. package/esm/hooks/index.d.ts.map +1 -1
  75. package/esm/hooks/index.js +8 -3
  76. package/esm/hooks/props/index.d.ts +12 -0
  77. package/esm/hooks/props/index.d.ts.map +1 -0
  78. package/esm/hooks/props/index.js +12 -0
  79. package/esm/hooks/props/useFlowProps.d.ts +23 -0
  80. package/esm/hooks/props/useFlowProps.d.ts.map +1 -0
  81. package/esm/hooks/props/useFlowProps.js +29 -0
  82. package/esm/hooks/props/useGetFlowProps.d.ts +19 -0
  83. package/esm/hooks/props/useGetFlowProps.d.ts.map +1 -0
  84. package/esm/hooks/props/useGetFlowProps.js +31 -0
  85. package/esm/hooks/props/useGetInputProps.d.ts +18 -0
  86. package/esm/hooks/props/useGetInputProps.d.ts.map +1 -0
  87. package/esm/hooks/props/useGetInputProps.js +31 -0
  88. package/esm/hooks/props/useInputProps.d.ts +14 -0
  89. package/esm/hooks/props/useInputProps.d.ts.map +1 -0
  90. package/esm/hooks/props/useInputProps.js +27 -0
  91. package/esm/hooks/useListenRender.js +4 -4
  92. package/esm/hooks/useTheme.d.ts.map +1 -1
  93. package/esm/hooks/useTheme.js +3 -2
  94. package/esm/index.d.ts +6 -3
  95. package/esm/index.d.ts.map +1 -1
  96. package/esm/index.js +22 -3
  97. package/esm/providers/FlowProvider.d.ts +7 -1
  98. package/esm/providers/FlowProvider.d.ts.map +1 -1
  99. package/esm/providers/FlowProvider.js +36 -15
  100. package/esm/store/PropsStore.d.ts +11 -6
  101. package/esm/store/PropsStore.d.ts.map +1 -1
  102. package/esm/store/PropsStore.js +75 -34
  103. package/esm/types/props.d.ts +83 -0
  104. package/esm/types/props.d.ts.map +1 -0
  105. package/esm/types/props.js +1 -0
  106. package/esm/types.d.ts +5 -1
  107. package/esm/types.d.ts.map +1 -1
  108. package/esm/utils/wrapNodeTypes.d.ts +30 -0
  109. package/esm/utils/wrapNodeTypes.d.ts.map +1 -0
  110. package/esm/utils/wrapNodeTypes.js +55 -0
  111. package/esm/workers/manhattan.worker.js +1 -1
  112. package/esm/workers/manhattan.worker.js.map +7 -0
  113. package/package.json +5 -3
  114. package/cjs/hooks/props/useGetProps.d.ts +0 -6
  115. package/cjs/hooks/props/useGetProps.d.ts.map +0 -1
  116. package/cjs/hooks/props/useGetProps.js +0 -29
  117. package/cjs/hooks/props/useProps.d.ts +0 -2
  118. package/cjs/hooks/props/useProps.d.ts.map +0 -1
  119. package/cjs/hooks/props/useProps.js +0 -20
  120. package/cjs/hooks/props/usePropsSelector.d.ts +0 -13
  121. package/cjs/hooks/props/usePropsSelector.d.ts.map +0 -1
  122. package/cjs/hooks/props/usePropsSelector.js +0 -37
  123. package/esm/hooks/props/useGetProps.d.ts +0 -6
  124. package/esm/hooks/props/useGetProps.d.ts.map +0 -1
  125. package/esm/hooks/props/useGetProps.js +0 -21
  126. package/esm/hooks/props/useProps.d.ts +0 -2
  127. package/esm/hooks/props/useProps.d.ts.map +0 -1
  128. package/esm/hooks/props/useProps.js +0 -14
  129. package/esm/hooks/props/usePropsSelector.d.ts +0 -13
  130. package/esm/hooks/props/usePropsSelector.d.ts.map +0 -1
  131. package/esm/hooks/props/usePropsSelector.js +0 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxflow/base",
3
- "version": "0.0.2",
3
+ "version": "0.0.4-alpha.0",
4
4
  "description": "BaseFlow - 核心 Flow 组件库",
5
5
  "keywords": [
6
6
  "reactflow",
@@ -37,12 +37,13 @@
37
37
  "cjs"
38
38
  ],
39
39
  "scripts": {
40
- "build": "father build"
40
+ "build": "node scripts/build-worker.mjs && father build",
41
+ "build:worker": "node scripts/build-worker.mjs"
41
42
  },
42
43
  "dependencies": {
43
44
  "@ant-design/icons": "^6.0.0",
44
45
  "@antv/hierarchy": "0.6.14",
45
- "@rxflow/manhattan": "^0.0.2",
46
+ "@rxflow/manhattan": "^0.0.4-alpha.0",
46
47
  "@xyflow/react": "^12.8.6",
47
48
  "@xyflow/system": "^0.0.70",
48
49
  "@zumer/snapdom": "^1.9.9",
@@ -71,6 +72,7 @@
71
72
  "@types/node": "^24.9.1",
72
73
  "@types/react": "^19.1.4",
73
74
  "@types/react-dom": "^19.1.5",
75
+ "esbuild": "^0.20.0",
74
76
  "react": ">=16.0.0",
75
77
  "react-dom": ">=16.0.0"
76
78
  },
@@ -1,6 +0,0 @@
1
- import { IBaseFlowProps } from "../../types";
2
- export declare const useGetProps: <P = IBaseFlowProps<import("@xyflow/react").Node, import("@xyflow/react").Edge>>() => {
3
- (): P;
4
- <U>(selector: (state: P) => U): U;
5
- };
6
- //# sourceMappingURL=useGetProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGetProps.d.ts","sourceRoot":"","sources":["useGetProps.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,cAAc,EAAC,MAAM,aAAa,CAAC;AAI1D,eAAO,MAAM,WAAW;QAIH,CAAC;0BAEiB,CAAC,KAAK,CAAC,GAAG,CAAC;CAMjD,CAAA"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useGetProps = void 0;
7
- var _react = require("react");
8
- var _useGetState = require("../state/useGetState");
9
- /**
10
- * @author: yanxianliang
11
- * @date: 2025-10-16 16:12
12
- * @modified:2025/10/16 16:12 by yanxianliang
13
- * @desc:
14
- *
15
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
16
- */
17
-
18
- const useGetProps = () => {
19
- const getState = (0, _useGetState.useGetState)();
20
- // 如果 selector 是空的
21
-
22
- // @ts-ignore
23
-
24
- return (0, _react.useCallback)(selector => {
25
- const props = getState().props;
26
- return selector ? selector(props) : props;
27
- }, []);
28
- };
29
- exports.useGetProps = useGetProps;
@@ -1,2 +0,0 @@
1
- export declare const useProps: <T = Record<string, any>>() => T;
2
- //# sourceMappingURL=useProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useProps.d.ts","sourceRoot":"","sources":["useProps.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ,kCAEpB,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useProps = void 0;
7
- var _ = require("../..");
8
- /**
9
- * @author: yanxianliang
10
- * @date: 2025-10-16 20:22
11
- * @modified:2025/10/16 20:22 by yanxianliang
12
- * @desc: 获取传入的props
13
- *
14
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
15
- */
16
-
17
- const useProps = () => {
18
- return (0, _.useSelector)(state => state.props);
19
- };
20
- exports.useProps = useProps;
@@ -1,13 +0,0 @@
1
- /**
2
- * @author: yanxianliang
3
- * @date: 2025-10-16 16:12
4
- * @modified:2025/10/16 16:12 by yanxianliang
5
- * @desc:
6
- *
7
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
8
- */
9
- import { StoreApi } from "zustand/vanilla";
10
- import { IBaseFlowProps, ExtractState } from "../../types";
11
- export declare function usePropsSelector<GraphProps = IBaseFlowProps>(): GraphProps;
12
- export declare function usePropsSelector<GraphProps = IBaseFlowProps, U = unknown>(selector: (state: ExtractState<StoreApi<GraphProps>>) => U): U;
13
- //# sourceMappingURL=usePropsSelector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePropsSelector.d.ts","sourceRoot":"","sources":["usePropsSelector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAGzD,wBAAgB,gBAAgB,CAAC,UAAU,GAAG,cAAc,KAAK,UAAU,CAAC;AAC5E,wBAAgB,gBAAgB,CAAC,UAAU,GAAG,cAAc,EAAE,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.usePropsSelector = usePropsSelector;
7
- var _useSelector = require("../state/useSelector");
8
- /**
9
- * @author: yanxianliang
10
- * @date: 2025-10-16 16:12
11
- * @modified:2025/10/16 16:12 by yanxianliang
12
- * @desc:
13
- *
14
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
15
- */
16
-
17
- function usePropsSelector(selector) {
18
- return (0, _useSelector.useSelector)(state => {
19
- const props = state.props;
20
- return selector ? selector(props) : props;
21
- });
22
- }
23
-
24
- //
25
- // export function usePropsSelector<GraphProps = IBaseFlowProps>(): GraphProps;
26
- // export function usePropsSelector<GraphProps = IBaseFlowProps, U = unknown>(selector: (state: ExtractState<StoreApi<GraphProps>>) => U): U;
27
- //
28
- // export function usePropsSelector<
29
- // GraphProps = IBaseFlowProps,
30
- // U = any,
31
- // >(selector?: ExtractState<StoreApi<GraphProps>>) {
32
- // const useStore = useContext(PropsContext)?.useStore as UseBoundStore<StoreApi<GraphProps>>;
33
- // if (!useStore) {
34
- // throw new Error("usePropsSelector must be used within PropsProvider");
35
- // }
36
- // return useStore(selector as (state: ExtractState<StoreApi<GraphProps>>) => U);
37
- // }
@@ -1,6 +0,0 @@
1
- import { IBaseFlowProps } from "../../types";
2
- export declare const useGetProps: <P = IBaseFlowProps<import("@xyflow/react").Node, import("@xyflow/react").Edge>>() => {
3
- (): P;
4
- <U>(selector: (state: P) => U): U;
5
- };
6
- //# sourceMappingURL=useGetProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGetProps.d.ts","sourceRoot":"","sources":["useGetProps.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,cAAc,EAAC,MAAM,aAAa,CAAC;AAI1D,eAAO,MAAM,WAAW;QAIH,CAAC;0BAEiB,CAAC,KAAK,CAAC,GAAG,CAAC;CAMjD,CAAA"}
@@ -1,21 +0,0 @@
1
- /**
2
- * @author: yanxianliang
3
- * @date: 2025-10-16 16:12
4
- * @modified:2025/10/16 16:12 by yanxianliang
5
- * @desc:
6
- *
7
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
8
- */
9
- import { useCallback } from "react";
10
- import { useGetState } from "../state/useGetState";
11
- export var useGetProps = function useGetProps() {
12
- var getState = useGetState();
13
- // 如果 selector 是空的
14
-
15
- // @ts-ignore
16
-
17
- return useCallback(function (selector) {
18
- var props = getState().props;
19
- return selector ? selector(props) : props;
20
- }, []);
21
- };
@@ -1,2 +0,0 @@
1
- export declare const useProps: <T = Record<string, any>>() => T;
2
- //# sourceMappingURL=useProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useProps.d.ts","sourceRoot":"","sources":["useProps.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ,kCAEpB,CAAA"}
@@ -1,14 +0,0 @@
1
- /**
2
- * @author: yanxianliang
3
- * @date: 2025-10-16 20:22
4
- * @modified:2025/10/16 20:22 by yanxianliang
5
- * @desc: 获取传入的props
6
- *
7
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
8
- */
9
- import { useSelector } from "../..";
10
- export var useProps = function useProps() {
11
- return useSelector(function (state) {
12
- return state.props;
13
- });
14
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * @author: yanxianliang
3
- * @date: 2025-10-16 16:12
4
- * @modified:2025/10/16 16:12 by yanxianliang
5
- * @desc:
6
- *
7
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
8
- */
9
- import { StoreApi } from "zustand/vanilla";
10
- import { IBaseFlowProps, ExtractState } from "../../types";
11
- export declare function usePropsSelector<GraphProps = IBaseFlowProps>(): GraphProps;
12
- export declare function usePropsSelector<GraphProps = IBaseFlowProps, U = unknown>(selector: (state: ExtractState<StoreApi<GraphProps>>) => U): U;
13
- //# sourceMappingURL=usePropsSelector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePropsSelector.d.ts","sourceRoot":"","sources":["usePropsSelector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAGzD,wBAAgB,gBAAgB,CAAC,UAAU,GAAG,cAAc,KAAK,UAAU,CAAC;AAC5E,wBAAgB,gBAAgB,CAAC,UAAU,GAAG,cAAc,EAAE,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * @author: yanxianliang
3
- * @date: 2025-10-16 16:12
4
- * @modified:2025/10/16 16:12 by yanxianliang
5
- * @desc:
6
- *
7
- * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
8
- */
9
-
10
- import { useSelector } from "../state/useSelector";
11
- export function usePropsSelector(selector) {
12
- return useSelector(function (state) {
13
- var props = state.props;
14
- return selector ? selector(props) : props;
15
- });
16
- }
17
-
18
- //
19
- // export function usePropsSelector<GraphProps = IBaseFlowProps>(): GraphProps;
20
- // export function usePropsSelector<GraphProps = IBaseFlowProps, U = unknown>(selector: (state: ExtractState<StoreApi<GraphProps>>) => U): U;
21
- //
22
- // export function usePropsSelector<
23
- // GraphProps = IBaseFlowProps,
24
- // U = any,
25
- // >(selector?: ExtractState<StoreApi<GraphProps>>) {
26
- // const useStore = useContext(PropsContext)?.useStore as UseBoundStore<StoreApi<GraphProps>>;
27
- // if (!useStore) {
28
- // throw new Error("usePropsSelector must be used within PropsProvider");
29
- // }
30
- // return useStore(selector as (state: ExtractState<StoreApi<GraphProps>>) => U);
31
- // }