@logicflow/react-node-registry 1.2.0-alpha.7 → 1.2.1

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/README.md CHANGED
@@ -3,16 +3,19 @@
3
3
  LogicFlow Shape for rendering React components.
4
4
 
5
5
  ## Installation
6
+
7
+ 此包将 React 组件桥接到 LogicFlow 节点系统,`@logicflow/core`、`react`、`react-dom` 需要由使用方显式提供。
8
+
6
9
  ```shell
7
- npm install @logicflow/react-node-registry
10
+ npm install @logicflow/core @logicflow/react-node-registry react react-dom
8
11
  ```
9
12
  or
10
13
  ```shell
11
- yarn add @logicflow/react-node-registry
14
+ yarn add @logicflow/core @logicflow/react-node-registry react react-dom
12
15
  ```
13
16
  or
14
17
  ```shell
15
- pnpm add @logicflow/react-node-registry
18
+ pnpm add @logicflow/core @logicflow/react-node-registry react react-dom
16
19
  ```
17
20
 
18
21
  ## Usage
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@logicflow/react-node-registry",
3
- "version": "1.2.0-alpha.7",
3
+ "version": "1.2.1",
4
4
  "description": "LogicFlow React Shape",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
- "unpkg": "dist/index.js",
8
- "jsdeliver": "dist/index.js",
7
+ "unpkg": "dist/index.min.js",
8
+ "jsdelivr": "dist/index.min.js",
9
9
  "types": "lib/index.d.ts",
10
10
  "keywords": [
11
11
  "@logicflow/react-node-registry",
@@ -18,16 +18,23 @@
18
18
  "peerDependencies": {
19
19
  "react": ">= 18.0.0",
20
20
  "react-dom": ">= 18.0.0",
21
- "@logicflow/core": "2.2.0-alpha.7"
21
+ "@logicflow/core": "2.2.1"
22
22
  },
23
23
  "dependencies": {
24
+ "lodash-es": "^4.17.21"
25
+ },
26
+ "devDependencies": {
24
27
  "@types/react": "^18.0.25",
25
28
  "@types/react-dom": "^18.0.9",
26
29
  "react": "^18.0.0",
27
30
  "react-dom": "^18.0.0",
28
- "lodash-es": "^4.17.21",
29
- "@logicflow/core": "2.2.0-alpha.7"
31
+ "@logicflow/core": "2.2.1"
30
32
  },
33
+ "files": [
34
+ "dist",
35
+ "es",
36
+ "lib"
37
+ ],
31
38
  "scripts": {
32
39
  "clean:turbo": "rss",
33
40
  "clean:build": "rss",
@@ -1,34 +0,0 @@
1
-
2
- > @logicflow/react-node-registry@1.2.0-alpha.6 prebuild /Users/didi/Desktop/github/LogicFlow/packages/react-node-registry
3
- > rss
4
-
5
- > [prebuild] run-s -s clean:build
6
- > [clean:build] rimraf dist es lib
7
-
8
- > @logicflow/react-node-registry@1.2.0-alpha.6 build /Users/didi/Desktop/github/LogicFlow/packages/react-node-registry
9
- > rss
10
-
11
- > [build] run-p -s build:dev build:umd
12
- > [build:dev] pnpm run --if-present build:less && run-p -s build:cjs build:esm
13
- > [build:umd] pnpm run --if-present build:less && rollup -c ../../rollup.config.js --bundleConfigAsCjs
14
- > [build:less] ./scripts/build-less
15
- > [build:less] ./scripts/build-less
16
- 
17
- ./src/index.ts → dist/index.min.js...
18
- +------------------------------------+
19
- | |
20
- | Bundle Format: umd |
21
- | Bundle Name: ReactNodeRegistry |
22
- | External Globals: |
23
- |  @logicflow/core: Core |
24
- |  react: React |
25
- |  react-dom: ReactDom |
26
- | |
27
- | Destination: dist/index.min.js |
28
- | Bundle Size: 433 B |
29
- | Minified Size: 394 B |
30
- | GZipped Size: 208 B |
31
- | |
32
- +------------------------------------+
33
- (!) [plugin typescript] @rollup/plugin-typescript: Rollup requires that TypeScript produces ES Modules. Unfortunately your configuration specifies a "module" other than "esnext". Unless you know what you're doing, please change "module" to "esnext" in the target tsconfig.json file or plugin options.
34
- created dist/index.min.js in 9.8s
package/CHANGELOG.md DELETED
@@ -1,251 +0,0 @@
1
- # @logicflow/react-node-registry
2
-
3
- ## 1.2.0-alpha.7
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies
8
- - @logicflow/core@2.2.0-alpha.7
9
-
10
- ## 1.2.0-alpha.6
11
-
12
- ### Patch Changes
13
-
14
- - Updated dependencies
15
- - @logicflow/core@2.2.0-alpha.6
16
-
17
- ## 1.2.0-alpha.5
18
-
19
- ### Patch Changes
20
-
21
- - Updated dependencies
22
- - @logicflow/core@2.2.0-alpha.5
23
-
24
- ## 1.2.0-alpha.4
25
-
26
- ### Patch Changes
27
-
28
- - Updated dependencies
29
- - @logicflow/core@2.2.0-alpha.4
30
-
31
- ## 1.2.0-alpha.3
32
-
33
- ### Patch Changes
34
-
35
- - feat: 整体UI美化,并丰富可配置的UI项
36
- - Updated dependencies
37
- - @logicflow/core@2.2.0-alpha.3
38
-
39
- ## 1.2.0-alpha.2
40
-
41
- ### Patch Changes
42
-
43
- - Updated dependencies
44
- - @logicflow/core@2.2.0-alpha.2
45
-
46
- ## 1.2.0-alpha.1
47
-
48
- ### Patch Changes
49
-
50
- - Updated dependencies
51
- - @logicflow/core@2.2.0
52
-
53
- ## 1.2.0-alpha.0
54
-
55
- ### Patch Changes
56
-
57
- - Updated dependencies
58
- - @logicflow/core@2.2.0-alpha.0
59
-
60
- ## 1.1.4
61
-
62
- ### Patch Changes
63
-
64
- - Updated dependencies
65
- - @logicflow/core@2.1.4
66
-
67
- ## 1.1.3
68
-
69
- ### Patch Changes
70
-
71
- - Updated dependencies
72
- - @logicflow/core@2.1.3
73
-
74
- ## 1.1.2
75
-
76
- ### Patch Changes
77
-
78
- - Updated dependencies
79
- - @logicflow/core@2.1.2
80
-
81
- ## 1.1.1
82
-
83
- ### Patch Changes
84
-
85
- - Updated dependencies
86
- - @logicflow/core@2.1.1
87
-
88
- ## 1.1.0
89
-
90
- ### Patch Changes
91
-
92
- - fix: 修复issue反馈的bug&支持小地图展示vue节点
93
-
94
- ## 1.0.18
95
-
96
- ### Patch Changes
97
-
98
- - Updated dependencies
99
- - @logicflow/core@2.0.16
100
-
101
- ## 1.0.17
102
-
103
- ### Patch Changes
104
-
105
- - Updated dependencies
106
- - @logicflow/core@2.0.15
107
-
108
- ## 1.0.16
109
-
110
- ### Patch Changes
111
-
112
- - Updated dependencies
113
- - @logicflow/core@2.0.14
114
-
115
- ## 1.0.15
116
-
117
- ### Patch Changes
118
-
119
- - fix:(extension): 所有导出方式支持局部导出+修复相对路径导出问题 & 渐进连线+highlight优化
120
-
121
- ## 1.0.14
122
-
123
- ### Patch Changes
124
-
125
- - Updated dependencies
126
- - @logicflow/core@2.0.13
127
-
128
- ## 1.0.13
129
-
130
- ### Patch Changes
131
-
132
- - Updated dependencies
133
- - @logicflow/core@2.0.12
134
-
135
- ## 1.0.12
136
-
137
- ### Patch Changes
138
-
139
- - Updated dependencies
140
- - @logicflow/core@2.0.11
141
-
142
- ## 1.0.11
143
-
144
- ### Patch Changes
145
-
146
- - fix: 修复issue反馈的bug
147
- - Updated dependencies
148
- - @logicflow/core@2.0.10
149
-
150
- ## 1.0.10
151
-
152
- ### Patch Changes
153
-
154
- - Updated dependencies
155
- - @logicflow/core@2.0.9
156
-
157
- ## 1.0.9
158
-
159
- ### Patch Changes
160
-
161
- - release react/vue-node-registry
162
-
163
- ## 1.0.8
164
-
165
- ### Patch Changes
166
-
167
- - Updated dependencies
168
- - @logicflow/core@2.0.8
169
-
170
- ## 1.0.7
171
-
172
- ### Patch Changes
173
-
174
- - fix: 修复一些问题
175
- - fix: 修复一些问题
176
- - fix: 修复文本拖拽不符合预期的问题 by ChangeSuger
177
- - feat: 支持动态修改 Grid 的配置 by ChangeSuger
178
- - fix: 修复 2.x 与 1.x 下相同的网格线宽,Grid 表现不一致的问题 by ChangeSuger
179
- - fix: node:dnd-drag 增加事件数据 by HeatonZ
180
- - fix(extension): 【dynamic-group】修复mousemove和isCollapsed相关问题 by wbccb
181
- - fix: 修复 windows 系统 node20 环境下样式文件打包失败的问题 by ChangeSuger
182
- - fix: 修复 node:dnd-drag 事件的类型检查问题 by ChangeSuger
183
- - fix(example): 修复文档中vue3自定义组件不能正常显示bug by zkt2002
184
- - fix(core): 在没有拖拽的情况下,Control组件突然销毁,不触发cancelDrag(#1926) by wbccb
185
- - fix(core): 修复笔记本触摸板点击边事件失效 by wuchenguang1998
186
- - feat(examples): 添加动画边demo by DymoneLewis
187
- - fix(core): 类型定义 properties:change 改为 node:properties-change by HeatonZ
188
- - feat: node-registry 自定义properties类型 by HeatonZ
189
- - fix(core): 修复 polyline 与多边形节点的交点不正确的问题 by Yuan-ZW
190
- - Updated dependencies
191
- - @logicflow/core@2.0.7
192
-
193
- ## 1.0.6
194
-
195
- ### Patch Changes
196
-
197
- - Release New Version
198
- - Updated dependencies
199
- - @logicflow/core@2.0.6
200
-
201
- ## 1.0.5
202
-
203
- ### Patch Changes
204
-
205
- - Updated dependencies
206
- - @logicflow/core@2.0.5
207
-
208
- ## 1.0.4
209
-
210
- ### Patch Changes
211
-
212
- - Updated dependencies
213
- - Updated dependencies
214
- - @logicflow/core@2.0.4
215
-
216
- ## 1.0.3
217
-
218
- ### Patch Changes: Release 1.0.3 Version
219
-
220
- - Updated dependencies
221
- - @logicflow/core@2.0.3
222
-
223
- ## 1.0.2
224
-
225
- ### Patch Changes
226
-
227
- - Release New Version,移除多余 console
228
-
229
- - Updated dependencies
230
- - @logicflow/core@2.0.2
231
-
232
- ## 1.0.1
233
-
234
- ### Patch Changes
235
-
236
- - Updated dependencies
237
- - @logicflow/core@2.0.1
238
-
239
- ## 1.0.0
240
-
241
- ### Patch Changes
242
-
243
- - Release 2.0 New Version 🎉🎉🎉🎉
244
- - Updated dependencies
245
-
246
- - @logicflow/core@2.0.0
247
-
248
- - feat: 开发 react-node-registry 包用于用户自定义 react 节点
249
- - 通过监听 properties 变化的事件,触发节点的更新
250
- - 通过 Portal 的方式,可以获取到宿主系统的数据(比如状态),保持组件渲染和系统同步
251
- - react-node-registry 包增加 LICENSE 文件
package/rollup.config.js DELETED
@@ -1,52 +0,0 @@
1
- import path from 'node:path'
2
- import postcss from 'rollup-plugin-postcss'
3
- import postcssUrl from 'postcss-url'
4
- import postcssImport from 'postcss-import'
5
- import { rollupConfig } from '../../rollup.config'
6
-
7
- export default [
8
- {
9
- input: 'src/index.less',
10
- output: [
11
- {
12
- file: 'dist/index.css',
13
- },
14
- {
15
- file: 'lib/index.css',
16
- },
17
- {
18
- file: 'lib/style/index.css',
19
- },
20
- {
21
- file: 'es/index.css',
22
- },
23
- {
24
- file: 'es/style/index.css',
25
- },
26
- ],
27
- plugins: [
28
- postcss({
29
- plugins: [
30
- postcssImport({
31
- resolve: (id) => {
32
- if (id.startsWith('~')) {
33
- return path.resolve('node_modules', id.slice(1))
34
- }
35
- return id
36
- },
37
- }),
38
- postcssUrl({
39
- url: 'inline', // 选择 'inline' 选项将外部资源内联到最终的 CSS 文件中
40
- // maxSize: 10, // 以KB为单位的最大文件大小,超过此大小的文件将不会被内联
41
- }),
42
- ],
43
- use: [['less', { javascriptEnabled: true }]],
44
- extract: true,
45
- // extract: 'index.css', // 提取到一个单独的 CSS 文件
46
- // extract: path.resolve('dist/index.css'), // 提取到一个单独的 CSS 文件
47
- minimize: true,
48
- }),
49
- ],
50
- },
51
- rollupConfig(),
52
- ]
@@ -1,33 +0,0 @@
1
- import React from 'react'
2
- import { BaseNodeModel, GraphModel } from '@logicflow/core'
3
- import TitleBar from './TitleBar'
4
-
5
- export type ContainerProps = {
6
- node: BaseNodeModel
7
- graph: GraphModel
8
- children?: React.ReactNode
9
- }
10
-
11
- export const Container: React.FC<ContainerProps> = ({
12
- node,
13
- graph,
14
- children,
15
- }) => {
16
- const props: any = node?.properties || {}
17
- const titleColor = props.style?.titleColor || '#E5EEFC'
18
- const expanded = props._expanded === true
19
-
20
- return (
21
- <div
22
- className="lf-vue-node-container"
23
- style={{
24
- background: `linear-gradient(180deg, ${titleColor} 0%, #FFFFFF 24px)`,
25
- }}
26
- >
27
- {props._showTitle && <TitleBar node={node} graph={graph} />}
28
- {expanded && <div className="lf-vue-node-content-wrap">{children}</div>}
29
- </div>
30
- )
31
- }
32
-
33
- export default Container
@@ -1,149 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react'
2
- import { BaseNodeModel, GraphModel } from '@logicflow/core'
3
- import { isNumber } from 'lodash-es'
4
-
5
- export type TitleBarProps = {
6
- node: BaseNodeModel
7
- graph: GraphModel
8
- }
9
-
10
- export const TitleBar: React.FC<TitleBarProps> = ({ node, graph }) => {
11
- const props: any = node?.properties || {}
12
- const icon = props._icon
13
- const title = props._title || ''
14
- const expanded = !!props._expanded
15
- const titleHeight = isNumber(props._titleHeight) ? props._titleHeight : 28
16
- const actProps = props._titleActions || []
17
- const privActs = (node as any).__actions || []
18
- const actions =
19
- Array.isArray(privActs) && privActs.length > 0 ? privActs : actProps
20
- const showMoreAction = Array.isArray(actions) && actions.length > 0
21
- const trigger = props.titleTrigger === 'hover' ? 'hover' : 'click'
22
- const [showTooltip, setShowTooltip] = useState(false)
23
- const moreBtnRef = useRef<HTMLButtonElement | null>(null)
24
- const tooltipRef = useRef<HTMLDivElement | null>(null)
25
-
26
- const toggleExpand = () => {
27
- const cur = !!node?.properties?._expanded
28
- node?.setProperty('_expanded', !cur)
29
- }
30
-
31
- const runAction = (act: any) => {
32
- const fn =
33
- act?.callback ||
34
- (privActs || []).find((a: any) => a?.name === act?.name)?.callback
35
- typeof fn === 'function' && fn(node, graph)
36
- }
37
-
38
- useEffect(() => {
39
- if (trigger === 'hover') {
40
- const mb = moreBtnRef.current
41
- const tt = tooltipRef.current
42
- const onEnter = () => setShowTooltip(true)
43
- const onLeave = () => setShowTooltip(false)
44
- mb?.addEventListener('mouseenter', onEnter)
45
- mb?.addEventListener('mouseleave', onLeave)
46
- tt?.addEventListener('mouseenter', onEnter)
47
- tt?.addEventListener('mouseleave', onLeave)
48
- return () => {
49
- mb?.removeEventListener('mouseenter', onEnter)
50
- mb?.removeEventListener('mouseleave', onLeave)
51
- tt?.removeEventListener('mouseenter', onEnter)
52
- tt?.removeEventListener('mouseleave', onLeave)
53
- }
54
- }
55
- const onDoc = (e: MouseEvent) => {
56
- const mb = moreBtnRef.current
57
- const tt = tooltipRef.current
58
- const t = e.target as Node
59
- if (showTooltip && mb && tt && !mb.contains(t) && !tt.contains(t)) {
60
- setShowTooltip(false)
61
- }
62
- }
63
- document.addEventListener('click', onDoc)
64
- return () => document.removeEventListener('click', onDoc)
65
- }, [trigger, showTooltip])
66
-
67
- return (
68
- <div
69
- className={
70
- expanded
71
- ? 'lf-vue-node-title lf-vue-node-title-expanded'
72
- : 'lf-vue-node-title'
73
- }
74
- style={{ height: expanded ? titleHeight : 18 }}
75
- title={title}
76
- >
77
- <div className="lf-vue-node-title-left">
78
- {icon ? <i className="lf-vue-node-title-icon">{icon}</i> : null}
79
- <span className="lf-vue-node-title-text">{title}</span>
80
- </div>
81
- <div className="lf-vue-node-title-actions">
82
- <button
83
- className="lf-vue-node-title-expand"
84
- onClick={(e) => {
85
- e.stopPropagation()
86
- toggleExpand()
87
- }}
88
- >
89
- <svg
90
- width={14}
91
- height={12}
92
- viewBox="0 0 14 12"
93
- xmlns="http://www.w3.org/2000/svg"
94
- className="lf-vue-node-title-expand-icon"
95
- style={{ transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)' }}
96
- >
97
- <path
98
- d="M0.5201124,5.47988755C0.23603013,5.7639699,0.24460429,6.2271326,0.53900635,6.5005059L6.3195491,11.8681526C6.7032304,12.2244282,7.2967696,12.2244282,7.6804514,11.8681526L13.460994,6.5005059C13.755396,6.2271326,13.76397,5.7639699,13.479888,5.47988755C13.211547,5.21154633,12.779465,5.20215771,12.499721,5.45858961L7.3378625,10.1902928C7.1467018,10.3655233,6.8532982,10.3655233,6.6621375,10.1902928L1.5002797,5.45858967C1.2205358,5.20215771,0.78845364,5.21154633,0.5201124,5.47988755Z"
99
- fill="#474747"
100
- />
101
- <path
102
- d="M0.5201124,0.47988755C0.23603013,0.7639699,0.24460429,1.2271326,0.53900635,1.5005059L6.3195491,6.8681526C6.7032304,7.2244282,7.2967696,7.2244282,7.6804514,6.8681526L13.460994,1.5005059C13.755396,1.2271326,13.76397,0.7639699,13.479888,0.47988755C13.211547,0.21154633,12.779465,0.20215771,12.499721,0.45858961L7.3378625,5.1902928C7.1467018,5.3655233,6.8532982,5.3655233,6.6621375,5.1902928L1.5002797,0.45858967C1.2205358,0.20215771,0.78845364,0.21154633,0.5201124,0.47988755Z"
103
- fill="#9B9B9B"
104
- />
105
- </svg>
106
- </button>
107
- {showMoreAction && (
108
- <button
109
- ref={moreBtnRef}
110
- className="lf-vue-node-title-more"
111
- onClick={(e) => {
112
- e.stopPropagation()
113
- if (trigger === 'click') setShowTooltip(!showTooltip)
114
- }}
115
- >
116
- <i className="lf-vue-node-title-more-icon">⋯</i>
117
- </button>
118
- )}
119
- {showMoreAction && (
120
- <div
121
- ref={tooltipRef}
122
- className="lf-vue-node-title-tooltip"
123
- style={{
124
- opacity: showTooltip ? 1 : 0,
125
- pointerEvents: showTooltip ? 'auto' : 'none',
126
- }}
127
- >
128
- <div className="lf-vue-node-title-tooltip-list">
129
- {actions.map((act: any, idx: number) => (
130
- <div
131
- key={idx}
132
- className="lf-vue-node-title-tooltip-item"
133
- onClick={(e) => {
134
- e.stopPropagation()
135
- runAction(act)
136
- }}
137
- >
138
- {act?.name || ''}
139
- </div>
140
- ))}
141
- </div>
142
- </div>
143
- )}
144
- </div>
145
- </div>
146
- )
147
- }
148
-
149
- export default TitleBar
package/src/index.less DELETED
@@ -1 +0,0 @@
1
- @import url('./style/index.less');
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './view'
2
- export * from './model'
3
- export * from './registry'
4
- export * from './wrapper'
5
- export * from './portal'