@flowgram.ai/node-variable-plugin 0.1.0-alpha.2 → 0.1.0-alpha.21
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/esm/index.js +35 -29
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +46 -11
- package/dist/index.d.ts +46 -11
- package/dist/index.js +38 -32
- package/dist/index.js.map +1 -1
- package/package.json +14 -19
package/dist/esm/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { useEntityFromContext } from "@flowgram.ai/core";
|
|
|
12
12
|
var PublicScopeProvider = ({ children }) => {
|
|
13
13
|
const node = useEntityFromContext();
|
|
14
14
|
const publicScope = useMemo(() => node.getData(FlowNodeVariableData).public, [node]);
|
|
15
|
-
return /* @__PURE__ */ React.createElement(ScopeProvider, {
|
|
15
|
+
return /* @__PURE__ */ React.createElement(ScopeProvider, { scope: publicScope }, children);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// src/with-node-variables.tsx
|
|
@@ -39,7 +39,7 @@ var PrivateScopeProvider = ({ children }) => {
|
|
|
39
39
|
}
|
|
40
40
|
return variableData.private;
|
|
41
41
|
}, [node]);
|
|
42
|
-
return /* @__PURE__ */ React3.createElement(ScopeProvider2, {
|
|
42
|
+
return /* @__PURE__ */ React3.createElement(ScopeProvider2, { scope: privateScope }, children);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
// src/form-v2/create-provider-effect.ts
|
|
@@ -48,69 +48,75 @@ import { DataEvent } from "@flowgram.ai/node";
|
|
|
48
48
|
function createEffectFromVariableProvider(options) {
|
|
49
49
|
const getScope = (node) => {
|
|
50
50
|
const variableData = node.getData(FlowNodeVariableData3);
|
|
51
|
-
if (options.private) {
|
|
51
|
+
if (options.private || options.scope === "private") {
|
|
52
52
|
return variableData.initPrivate();
|
|
53
53
|
}
|
|
54
54
|
return variableData.public;
|
|
55
55
|
};
|
|
56
|
-
const transformValueToAST = ({ value, context }) => {
|
|
56
|
+
const transformValueToAST = ({ value, name, context, formValues, form }) => {
|
|
57
57
|
if (!context) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
const { node } = context;
|
|
61
61
|
const scope = getScope(node);
|
|
62
|
-
|
|
62
|
+
const parsedValue = options.parse(value, {
|
|
63
|
+
node,
|
|
64
|
+
scope,
|
|
65
|
+
options,
|
|
66
|
+
name,
|
|
67
|
+
formValues,
|
|
68
|
+
form
|
|
69
|
+
});
|
|
70
|
+
scope.ast.set(options.namespace || name || "", {
|
|
63
71
|
kind: ASTKind.VariableDeclarationList,
|
|
64
|
-
declarations:
|
|
65
|
-
node,
|
|
66
|
-
scope,
|
|
67
|
-
options,
|
|
68
|
-
formItem: void 0
|
|
69
|
-
})
|
|
72
|
+
declarations: Array.isArray(parsedValue) ? parsedValue : [parsedValue]
|
|
70
73
|
});
|
|
71
74
|
};
|
|
72
75
|
return [
|
|
73
76
|
{
|
|
74
77
|
event: DataEvent.onValueInit,
|
|
75
|
-
effect: (params) => {
|
|
78
|
+
effect: ((params) => {
|
|
76
79
|
const { context } = params;
|
|
77
80
|
const scope = getScope(context.node);
|
|
78
81
|
const disposable = options.onInit?.({
|
|
79
82
|
node: context.node,
|
|
80
83
|
scope,
|
|
81
84
|
options,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
name: params.name,
|
|
86
|
+
formValues: params.formValues,
|
|
87
|
+
form: params.form
|
|
85
88
|
});
|
|
86
|
-
if (disposable) {
|
|
87
|
-
scope.toDispose.push(disposable);
|
|
88
|
-
}
|
|
89
89
|
transformValueToAST(params);
|
|
90
|
-
|
|
90
|
+
return () => {
|
|
91
|
+
disposable?.dispose();
|
|
92
|
+
};
|
|
93
|
+
})
|
|
91
94
|
},
|
|
92
95
|
{
|
|
93
96
|
event: DataEvent.onValueChange,
|
|
94
|
-
effect: (params) => {
|
|
97
|
+
effect: ((params) => {
|
|
95
98
|
transformValueToAST(params);
|
|
96
|
-
}
|
|
99
|
+
})
|
|
97
100
|
}
|
|
98
101
|
];
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
// src/form-v2/create-variable-provider-plugin.ts
|
|
102
105
|
import { DataEvent as DataEvent2, defineFormPluginCreator } from "@flowgram.ai/node";
|
|
103
|
-
var createVariableProviderPlugin = defineFormPluginCreator(
|
|
106
|
+
var createVariableProviderPlugin = defineFormPluginCreator({
|
|
107
|
+
name: "VariableProviderPlugin",
|
|
104
108
|
onInit: (ctx, opts) => {
|
|
105
109
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
onSetupFormMeta({ mergeEffect }) {
|
|
111
|
+
mergeEffect({
|
|
112
|
+
arr: [
|
|
113
|
+
{
|
|
114
|
+
event: DataEvent2.onValueInitOrChange,
|
|
115
|
+
effect: () => {
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
]
|
|
119
|
+
});
|
|
114
120
|
},
|
|
115
121
|
onDispose: (ctx, opts) => {
|
|
116
122
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create-node-variable-plugin.ts","../../src/with-node-variables.tsx","../../src/components/PublicScopeProvider.tsx","../../src/components/PrivateScopeProvider.tsx","../../src/form-v2/create-provider-effect.ts","../../src/form-v2/create-variable-provider-plugin.ts"],"sourcesContent":["// import { FormManager } from '@flowgram.ai/form-core';\nimport { NodeManager } from '@flowgram.ai/form-core';\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { withNodeVariables } from './with-node-variables';\n\n// import { withNodeVariables } from './with-node-variables';\n\nexport const createNodeVariablePlugin = definePluginCreator({\n onInit(ctx) {\n const nodeManager = ctx.get<NodeManager>(NodeManager);\n nodeManager.registerNodeRenderHoc(withNodeVariables);\n },\n});\n","
|
|
1
|
+
{"version":3,"sources":["../../src/create-node-variable-plugin.ts","../../src/with-node-variables.tsx","../../src/components/PublicScopeProvider.tsx","../../src/components/PrivateScopeProvider.tsx","../../src/form-v2/create-provider-effect.ts","../../src/form-v2/create-variable-provider-plugin.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n// import { FormManager } from '@flowgram.ai/form-core';\nimport { NodeManager } from '@flowgram.ai/form-core';\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { withNodeVariables } from './with-node-variables';\n\n// import { withNodeVariables } from './with-node-variables';\n\nexport const createNodeVariablePlugin = definePluginCreator({\n onInit(ctx) {\n const nodeManager = ctx.get<NodeManager>(NodeManager);\n nodeManager.registerNodeRenderHoc(withNodeVariables);\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nimport { NodeRenderHoc, type NodeRenderProps } from '@flowgram.ai/form-core';\n\nimport { PublicScopeProvider } from './components/PublicScopeProvider';\n\n// eslint-disable-next-line react/display-name\nexport const withNodeVariables: NodeRenderHoc = (Component) => (props: NodeRenderProps) =>\n (\n <PublicScopeProvider>\n <Component {...props} />\n </PublicScopeProvider>\n );\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { useMemo } from 'react';\n\nimport { FlowNodeVariableData, type Scope, ScopeProvider } from '@flowgram.ai/variable-plugin';\nimport { useEntityFromContext } from '@flowgram.ai/core';\n\ninterface VariableProviderProps {\n children: React.ReactElement;\n}\n\n/**\n * PublicScopeProvider provides the public scope to its children via context.\n */\nexport const PublicScopeProvider = ({ children }: VariableProviderProps) => {\n const node = useEntityFromContext();\n\n const publicScope: Scope = useMemo(() => node.getData(FlowNodeVariableData).public, [node]);\n\n return <ScopeProvider scope={publicScope}>{children}</ScopeProvider>;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { useMemo } from 'react';\n\nimport { FlowNodeVariableData, type Scope, ScopeProvider } from '@flowgram.ai/variable-plugin';\nimport { useEntityFromContext } from '@flowgram.ai/core';\n\ninterface VariableProviderProps {\n children: React.ReactElement;\n}\n\n/**\n * PrivateScopeProvider provides the private scope to its children via context.\n */\nexport const PrivateScopeProvider = ({ children }: VariableProviderProps) => {\n const node = useEntityFromContext();\n\n const privateScope: Scope = useMemo(() => {\n const variableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n if (!variableData.private) {\n variableData.initPrivate();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return variableData.private!;\n }, [node]);\n\n return <ScopeProvider scope={privateScope}>{children}</ScopeProvider>;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowNodeVariableData, type Scope, ASTKind } from '@flowgram.ai/variable-plugin';\nimport { DataEvent, type Effect, type EffectOptions } from '@flowgram.ai/node';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { type VariableProviderAbilityOptions } from '../types';\n\n/**\n * 根据 VariableProvider 生成 FormV2 的 Effect\n * @param options\n * @returns\n */\nexport function createEffectFromVariableProvider(\n options: VariableProviderAbilityOptions\n): EffectOptions[] {\n const getScope = (node: FlowNodeEntity): Scope => {\n const variableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n\n if (options.private || options.scope === 'private') {\n return variableData.initPrivate();\n }\n return variableData.public;\n };\n\n const transformValueToAST: Effect = ({ value, name, context, formValues, form }) => {\n if (!context) {\n return;\n }\n const { node } = context;\n const scope = getScope(node);\n\n const parsedValue = options.parse(value, {\n node,\n scope,\n options,\n name,\n formValues,\n form,\n });\n\n // Fix: When parsedValue is not an array, transform it to array\n scope.ast.set(options.namespace || name || '', {\n kind: ASTKind.VariableDeclarationList,\n declarations: Array.isArray(parsedValue) ? parsedValue : [parsedValue],\n });\n };\n\n return [\n {\n event: DataEvent.onValueInit,\n effect: ((params) => {\n const { context } = params;\n\n const scope = getScope(context.node);\n const disposable = options.onInit?.({\n node: context.node,\n scope,\n options,\n name: params.name,\n formValues: params.formValues,\n form: params.form,\n });\n\n transformValueToAST(params);\n\n return () => {\n disposable?.dispose();\n };\n }) as Effect,\n },\n {\n event: DataEvent.onValueChange,\n effect: ((params) => {\n transformValueToAST(params);\n }) as Effect,\n },\n ];\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { DataEvent, defineFormPluginCreator } from '@flowgram.ai/node';\n\nexport const createVariableProviderPlugin = defineFormPluginCreator({\n name: 'VariableProviderPlugin',\n onInit: (ctx, opts) => {\n // todo\n // console.log('>>> VariableProviderPlugin init', ctx, opts);\n },\n onSetupFormMeta({ mergeEffect }) {\n mergeEffect({\n arr: [\n {\n event: DataEvent.onValueInitOrChange,\n effect: () => {\n // todo\n // console.log('>>> VariableProviderPlugin effect triggered');\n },\n },\n ],\n });\n },\n onDispose: (ctx, opts) => {\n // todo\n // console.log('>>> VariableProviderPlugin dispose', ctx, opts);\n },\n});\n"],"mappings":"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","names":["React","React","React","useMemo","FlowNodeVariableData","ScopeProvider","useEntityFromContext","FlowNodeVariableData","DataEvent"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,51 +1,82 @@
|
|
|
1
1
|
import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
2
|
-
import { VariableDeclarationJSON, ASTNodeJSON
|
|
3
|
-
import { FormItem } from '@flowgram.ai/form-core';
|
|
4
|
-
import { FlowNodeEntity } from '@flowgram.ai/document';
|
|
2
|
+
import { Scope, VariableDeclarationJSON, ASTNodeJSON } from '@flowgram.ai/variable-plugin';
|
|
5
3
|
import { Disposable } from '@flowgram.ai/utils';
|
|
6
|
-
import React from 'react';
|
|
7
4
|
import * as _flowgram_ai_node from '@flowgram.ai/node';
|
|
8
|
-
import { EffectOptions } from '@flowgram.ai/node';
|
|
5
|
+
import { EffectFuncProps, EffectOptions } from '@flowgram.ai/node';
|
|
6
|
+
import { FlowNodeEntity } from '@flowgram.ai/document';
|
|
7
|
+
import React from 'react';
|
|
9
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
11
|
+
* SPDX-License-Identifier: MIT
|
|
12
|
+
*/
|
|
10
13
|
declare const createNodeVariablePlugin: _flowgram_ai_core.PluginCreator<unknown>;
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
17
|
+
* SPDX-License-Identifier: MIT
|
|
18
|
+
*/
|
|
19
|
+
|
|
12
20
|
interface VariableAbilityCommonContext {
|
|
13
21
|
node: FlowNodeEntity;
|
|
14
|
-
formItem?: FormItem;
|
|
15
22
|
scope: Scope;
|
|
16
23
|
options: VariableAbilityOptions;
|
|
24
|
+
name: string;
|
|
25
|
+
formValues: EffectFuncProps['formValues'];
|
|
26
|
+
form: EffectFuncProps['form'];
|
|
17
27
|
}
|
|
18
28
|
interface VariableAbilityInitCtx extends VariableAbilityCommonContext {
|
|
19
|
-
triggerSync: () => void;
|
|
20
29
|
}
|
|
21
30
|
interface VariableAbilityOptions {
|
|
22
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated use scope: 'private'
|
|
33
|
+
*/
|
|
23
34
|
private?: boolean;
|
|
24
35
|
namespace?: string;
|
|
25
36
|
scope?: 'private' | 'public';
|
|
26
37
|
onInit?: (ctx: VariableAbilityInitCtx) => Disposable | undefined;
|
|
27
|
-
disableRemoveASTWhenFormItemDispose?: boolean;
|
|
28
38
|
[key: string]: any;
|
|
29
39
|
}
|
|
30
40
|
interface VariableAbilityParseContext extends VariableAbilityCommonContext {
|
|
31
41
|
}
|
|
32
42
|
interface VariableProviderAbilityOptions<V = any> extends VariableAbilityOptions {
|
|
33
|
-
parse: (v: V, ctx: VariableAbilityParseContext) => VariableDeclarationJSON[];
|
|
43
|
+
parse: (v: V, ctx: VariableAbilityParseContext) => VariableDeclarationJSON | VariableDeclarationJSON[];
|
|
34
44
|
}
|
|
35
45
|
interface VariableConsumerAbilityOptions<V = any> extends VariableAbilityOptions {
|
|
36
46
|
parse: (v: V, ctx: VariableAbilityParseContext) => ASTNodeJSON | undefined;
|
|
37
47
|
}
|
|
38
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
51
|
+
* SPDX-License-Identifier: MIT
|
|
52
|
+
*/
|
|
53
|
+
|
|
39
54
|
interface VariableProviderProps$1 {
|
|
40
55
|
children: React.ReactElement;
|
|
41
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* PrivateScopeProvider provides the private scope to its children via context.
|
|
59
|
+
*/
|
|
42
60
|
declare const PrivateScopeProvider: ({ children }: VariableProviderProps$1) => React.JSX.Element;
|
|
43
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
64
|
+
* SPDX-License-Identifier: MIT
|
|
65
|
+
*/
|
|
66
|
+
|
|
44
67
|
interface VariableProviderProps {
|
|
45
68
|
children: React.ReactElement;
|
|
46
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* PublicScopeProvider provides the public scope to its children via context.
|
|
72
|
+
*/
|
|
47
73
|
declare const PublicScopeProvider: ({ children }: VariableProviderProps) => React.JSX.Element;
|
|
48
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
77
|
+
* SPDX-License-Identifier: MIT
|
|
78
|
+
*/
|
|
79
|
+
|
|
49
80
|
/**
|
|
50
81
|
* 根据 VariableProvider 生成 FormV2 的 Effect
|
|
51
82
|
* @param options
|
|
@@ -53,6 +84,10 @@ declare const PublicScopeProvider: ({ children }: VariableProviderProps) => Reac
|
|
|
53
84
|
*/
|
|
54
85
|
declare function createEffectFromVariableProvider(options: VariableProviderAbilityOptions): EffectOptions[];
|
|
55
86
|
|
|
56
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
89
|
+
* SPDX-License-Identifier: MIT
|
|
90
|
+
*/
|
|
91
|
+
declare const createVariableProviderPlugin: _flowgram_ai_node.FormPluginCreator<unknown>;
|
|
57
92
|
|
|
58
93
|
export { PrivateScopeProvider, PublicScopeProvider, type VariableAbilityParseContext, type VariableConsumerAbilityOptions, type VariableProviderAbilityOptions, createEffectFromVariableProvider, createNodeVariablePlugin, createVariableProviderPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,51 +1,82 @@
|
|
|
1
1
|
import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
2
|
-
import { VariableDeclarationJSON, ASTNodeJSON
|
|
3
|
-
import { FormItem } from '@flowgram.ai/form-core';
|
|
4
|
-
import { FlowNodeEntity } from '@flowgram.ai/document';
|
|
2
|
+
import { Scope, VariableDeclarationJSON, ASTNodeJSON } from '@flowgram.ai/variable-plugin';
|
|
5
3
|
import { Disposable } from '@flowgram.ai/utils';
|
|
6
|
-
import React from 'react';
|
|
7
4
|
import * as _flowgram_ai_node from '@flowgram.ai/node';
|
|
8
|
-
import { EffectOptions } from '@flowgram.ai/node';
|
|
5
|
+
import { EffectFuncProps, EffectOptions } from '@flowgram.ai/node';
|
|
6
|
+
import { FlowNodeEntity } from '@flowgram.ai/document';
|
|
7
|
+
import React from 'react';
|
|
9
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
11
|
+
* SPDX-License-Identifier: MIT
|
|
12
|
+
*/
|
|
10
13
|
declare const createNodeVariablePlugin: _flowgram_ai_core.PluginCreator<unknown>;
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
17
|
+
* SPDX-License-Identifier: MIT
|
|
18
|
+
*/
|
|
19
|
+
|
|
12
20
|
interface VariableAbilityCommonContext {
|
|
13
21
|
node: FlowNodeEntity;
|
|
14
|
-
formItem?: FormItem;
|
|
15
22
|
scope: Scope;
|
|
16
23
|
options: VariableAbilityOptions;
|
|
24
|
+
name: string;
|
|
25
|
+
formValues: EffectFuncProps['formValues'];
|
|
26
|
+
form: EffectFuncProps['form'];
|
|
17
27
|
}
|
|
18
28
|
interface VariableAbilityInitCtx extends VariableAbilityCommonContext {
|
|
19
|
-
triggerSync: () => void;
|
|
20
29
|
}
|
|
21
30
|
interface VariableAbilityOptions {
|
|
22
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated use scope: 'private'
|
|
33
|
+
*/
|
|
23
34
|
private?: boolean;
|
|
24
35
|
namespace?: string;
|
|
25
36
|
scope?: 'private' | 'public';
|
|
26
37
|
onInit?: (ctx: VariableAbilityInitCtx) => Disposable | undefined;
|
|
27
|
-
disableRemoveASTWhenFormItemDispose?: boolean;
|
|
28
38
|
[key: string]: any;
|
|
29
39
|
}
|
|
30
40
|
interface VariableAbilityParseContext extends VariableAbilityCommonContext {
|
|
31
41
|
}
|
|
32
42
|
interface VariableProviderAbilityOptions<V = any> extends VariableAbilityOptions {
|
|
33
|
-
parse: (v: V, ctx: VariableAbilityParseContext) => VariableDeclarationJSON[];
|
|
43
|
+
parse: (v: V, ctx: VariableAbilityParseContext) => VariableDeclarationJSON | VariableDeclarationJSON[];
|
|
34
44
|
}
|
|
35
45
|
interface VariableConsumerAbilityOptions<V = any> extends VariableAbilityOptions {
|
|
36
46
|
parse: (v: V, ctx: VariableAbilityParseContext) => ASTNodeJSON | undefined;
|
|
37
47
|
}
|
|
38
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
51
|
+
* SPDX-License-Identifier: MIT
|
|
52
|
+
*/
|
|
53
|
+
|
|
39
54
|
interface VariableProviderProps$1 {
|
|
40
55
|
children: React.ReactElement;
|
|
41
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* PrivateScopeProvider provides the private scope to its children via context.
|
|
59
|
+
*/
|
|
42
60
|
declare const PrivateScopeProvider: ({ children }: VariableProviderProps$1) => React.JSX.Element;
|
|
43
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
64
|
+
* SPDX-License-Identifier: MIT
|
|
65
|
+
*/
|
|
66
|
+
|
|
44
67
|
interface VariableProviderProps {
|
|
45
68
|
children: React.ReactElement;
|
|
46
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* PublicScopeProvider provides the public scope to its children via context.
|
|
72
|
+
*/
|
|
47
73
|
declare const PublicScopeProvider: ({ children }: VariableProviderProps) => React.JSX.Element;
|
|
48
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
77
|
+
* SPDX-License-Identifier: MIT
|
|
78
|
+
*/
|
|
79
|
+
|
|
49
80
|
/**
|
|
50
81
|
* 根据 VariableProvider 生成 FormV2 的 Effect
|
|
51
82
|
* @param options
|
|
@@ -53,6 +84,10 @@ declare const PublicScopeProvider: ({ children }: VariableProviderProps) => Reac
|
|
|
53
84
|
*/
|
|
54
85
|
declare function createEffectFromVariableProvider(options: VariableProviderAbilityOptions): EffectOptions[];
|
|
55
86
|
|
|
56
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
89
|
+
* SPDX-License-Identifier: MIT
|
|
90
|
+
*/
|
|
91
|
+
declare const createVariableProviderPlugin: _flowgram_ai_node.FormPluginCreator<unknown>;
|
|
57
92
|
|
|
58
93
|
export { PrivateScopeProvider, PublicScopeProvider, type VariableAbilityParseContext, type VariableConsumerAbilityOptions, type VariableProviderAbilityOptions, createEffectFromVariableProvider, createNodeVariablePlugin, createVariableProviderPlugin };
|
package/dist/index.js
CHANGED
|
@@ -28,15 +28,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
PrivateScopeProvider: () => PrivateScopeProvider,
|
|
34
34
|
PublicScopeProvider: () => PublicScopeProvider,
|
|
35
35
|
createEffectFromVariableProvider: () => createEffectFromVariableProvider,
|
|
36
36
|
createNodeVariablePlugin: () => createNodeVariablePlugin,
|
|
37
37
|
createVariableProviderPlugin: () => createVariableProviderPlugin
|
|
38
38
|
});
|
|
39
|
-
module.exports = __toCommonJS(
|
|
39
|
+
module.exports = __toCommonJS(index_exports);
|
|
40
40
|
|
|
41
41
|
// src/create-node-variable-plugin.ts
|
|
42
42
|
var import_form_core = require("@flowgram.ai/form-core");
|
|
@@ -52,7 +52,7 @@ var import_core = require("@flowgram.ai/core");
|
|
|
52
52
|
var PublicScopeProvider = ({ children }) => {
|
|
53
53
|
const node = (0, import_core.useEntityFromContext)();
|
|
54
54
|
const publicScope = (0, import_react.useMemo)(() => node.getData(import_variable_plugin.FlowNodeVariableData).public, [node]);
|
|
55
|
-
return /* @__PURE__ */ import_react.default.createElement(import_variable_plugin.ScopeProvider, {
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(import_variable_plugin.ScopeProvider, { scope: publicScope }, children);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
// src/with-node-variables.tsx
|
|
@@ -79,7 +79,7 @@ var PrivateScopeProvider = ({ children }) => {
|
|
|
79
79
|
}
|
|
80
80
|
return variableData.private;
|
|
81
81
|
}, [node]);
|
|
82
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_variable_plugin2.ScopeProvider, {
|
|
82
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_variable_plugin2.ScopeProvider, { scope: privateScope }, children);
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
// src/form-v2/create-provider-effect.ts
|
|
@@ -88,69 +88,75 @@ var import_node = require("@flowgram.ai/node");
|
|
|
88
88
|
function createEffectFromVariableProvider(options) {
|
|
89
89
|
const getScope = (node) => {
|
|
90
90
|
const variableData = node.getData(import_variable_plugin3.FlowNodeVariableData);
|
|
91
|
-
if (options.private) {
|
|
91
|
+
if (options.private || options.scope === "private") {
|
|
92
92
|
return variableData.initPrivate();
|
|
93
93
|
}
|
|
94
94
|
return variableData.public;
|
|
95
95
|
};
|
|
96
|
-
const transformValueToAST = ({ value, context }) => {
|
|
96
|
+
const transformValueToAST = ({ value, name, context, formValues, form }) => {
|
|
97
97
|
if (!context) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const { node } = context;
|
|
101
101
|
const scope = getScope(node);
|
|
102
|
-
|
|
102
|
+
const parsedValue = options.parse(value, {
|
|
103
|
+
node,
|
|
104
|
+
scope,
|
|
105
|
+
options,
|
|
106
|
+
name,
|
|
107
|
+
formValues,
|
|
108
|
+
form
|
|
109
|
+
});
|
|
110
|
+
scope.ast.set(options.namespace || name || "", {
|
|
103
111
|
kind: import_variable_plugin3.ASTKind.VariableDeclarationList,
|
|
104
|
-
declarations:
|
|
105
|
-
node,
|
|
106
|
-
scope,
|
|
107
|
-
options,
|
|
108
|
-
formItem: void 0
|
|
109
|
-
})
|
|
112
|
+
declarations: Array.isArray(parsedValue) ? parsedValue : [parsedValue]
|
|
110
113
|
});
|
|
111
114
|
};
|
|
112
115
|
return [
|
|
113
116
|
{
|
|
114
117
|
event: import_node.DataEvent.onValueInit,
|
|
115
|
-
effect: (params) => {
|
|
118
|
+
effect: ((params) => {
|
|
116
119
|
const { context } = params;
|
|
117
120
|
const scope = getScope(context.node);
|
|
118
121
|
const disposable = options.onInit?.({
|
|
119
122
|
node: context.node,
|
|
120
123
|
scope,
|
|
121
124
|
options,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
name: params.name,
|
|
126
|
+
formValues: params.formValues,
|
|
127
|
+
form: params.form
|
|
125
128
|
});
|
|
126
|
-
if (disposable) {
|
|
127
|
-
scope.toDispose.push(disposable);
|
|
128
|
-
}
|
|
129
129
|
transformValueToAST(params);
|
|
130
|
-
|
|
130
|
+
return () => {
|
|
131
|
+
disposable?.dispose();
|
|
132
|
+
};
|
|
133
|
+
})
|
|
131
134
|
},
|
|
132
135
|
{
|
|
133
136
|
event: import_node.DataEvent.onValueChange,
|
|
134
|
-
effect: (params) => {
|
|
137
|
+
effect: ((params) => {
|
|
135
138
|
transformValueToAST(params);
|
|
136
|
-
}
|
|
139
|
+
})
|
|
137
140
|
}
|
|
138
141
|
];
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
// src/form-v2/create-variable-provider-plugin.ts
|
|
142
145
|
var import_node2 = require("@flowgram.ai/node");
|
|
143
|
-
var createVariableProviderPlugin = (0, import_node2.defineFormPluginCreator)(
|
|
146
|
+
var createVariableProviderPlugin = (0, import_node2.defineFormPluginCreator)({
|
|
147
|
+
name: "VariableProviderPlugin",
|
|
144
148
|
onInit: (ctx, opts) => {
|
|
145
149
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
onSetupFormMeta({ mergeEffect }) {
|
|
151
|
+
mergeEffect({
|
|
152
|
+
arr: [
|
|
153
|
+
{
|
|
154
|
+
event: import_node2.DataEvent.onValueInitOrChange,
|
|
155
|
+
effect: () => {
|
|
156
|
+
}
|
|
151
157
|
}
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
]
|
|
159
|
+
});
|
|
154
160
|
},
|
|
155
161
|
onDispose: (ctx, opts) => {
|
|
156
162
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/create-node-variable-plugin.ts","../src/with-node-variables.tsx","../src/components/PublicScopeProvider.tsx","../src/components/PrivateScopeProvider.tsx","../src/form-v2/create-provider-effect.ts","../src/form-v2/create-variable-provider-plugin.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/create-node-variable-plugin.ts","../src/with-node-variables.tsx","../src/components/PublicScopeProvider.tsx","../src/components/PrivateScopeProvider.tsx","../src/form-v2/create-provider-effect.ts","../src/form-v2/create-variable-provider-plugin.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './create-node-variable-plugin';\nexport {\n VariableProviderAbilityOptions,\n VariableConsumerAbilityOptions,\n VariableAbilityParseContext,\n} from './types';\nexport { PrivateScopeProvider } from './components/PrivateScopeProvider';\nexport { PublicScopeProvider } from './components/PublicScopeProvider';\nexport { createEffectFromVariableProvider } from './form-v2/create-provider-effect';\nexport { createVariableProviderPlugin } from './form-v2/create-variable-provider-plugin';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n// import { FormManager } from '@flowgram.ai/form-core';\nimport { NodeManager } from '@flowgram.ai/form-core';\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { withNodeVariables } from './with-node-variables';\n\n// import { withNodeVariables } from './with-node-variables';\n\nexport const createNodeVariablePlugin = definePluginCreator({\n onInit(ctx) {\n const nodeManager = ctx.get<NodeManager>(NodeManager);\n nodeManager.registerNodeRenderHoc(withNodeVariables);\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nimport { NodeRenderHoc, type NodeRenderProps } from '@flowgram.ai/form-core';\n\nimport { PublicScopeProvider } from './components/PublicScopeProvider';\n\n// eslint-disable-next-line react/display-name\nexport const withNodeVariables: NodeRenderHoc = (Component) => (props: NodeRenderProps) =>\n (\n <PublicScopeProvider>\n <Component {...props} />\n </PublicScopeProvider>\n );\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { useMemo } from 'react';\n\nimport { FlowNodeVariableData, type Scope, ScopeProvider } from '@flowgram.ai/variable-plugin';\nimport { useEntityFromContext } from '@flowgram.ai/core';\n\ninterface VariableProviderProps {\n children: React.ReactElement;\n}\n\n/**\n * PublicScopeProvider provides the public scope to its children via context.\n */\nexport const PublicScopeProvider = ({ children }: VariableProviderProps) => {\n const node = useEntityFromContext();\n\n const publicScope: Scope = useMemo(() => node.getData(FlowNodeVariableData).public, [node]);\n\n return <ScopeProvider scope={publicScope}>{children}</ScopeProvider>;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { useMemo } from 'react';\n\nimport { FlowNodeVariableData, type Scope, ScopeProvider } from '@flowgram.ai/variable-plugin';\nimport { useEntityFromContext } from '@flowgram.ai/core';\n\ninterface VariableProviderProps {\n children: React.ReactElement;\n}\n\n/**\n * PrivateScopeProvider provides the private scope to its children via context.\n */\nexport const PrivateScopeProvider = ({ children }: VariableProviderProps) => {\n const node = useEntityFromContext();\n\n const privateScope: Scope = useMemo(() => {\n const variableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n if (!variableData.private) {\n variableData.initPrivate();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return variableData.private!;\n }, [node]);\n\n return <ScopeProvider scope={privateScope}>{children}</ScopeProvider>;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowNodeVariableData, type Scope, ASTKind } from '@flowgram.ai/variable-plugin';\nimport { DataEvent, type Effect, type EffectOptions } from '@flowgram.ai/node';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { type VariableProviderAbilityOptions } from '../types';\n\n/**\n * 根据 VariableProvider 生成 FormV2 的 Effect\n * @param options\n * @returns\n */\nexport function createEffectFromVariableProvider(\n options: VariableProviderAbilityOptions\n): EffectOptions[] {\n const getScope = (node: FlowNodeEntity): Scope => {\n const variableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n\n if (options.private || options.scope === 'private') {\n return variableData.initPrivate();\n }\n return variableData.public;\n };\n\n const transformValueToAST: Effect = ({ value, name, context, formValues, form }) => {\n if (!context) {\n return;\n }\n const { node } = context;\n const scope = getScope(node);\n\n const parsedValue = options.parse(value, {\n node,\n scope,\n options,\n name,\n formValues,\n form,\n });\n\n // Fix: When parsedValue is not an array, transform it to array\n scope.ast.set(options.namespace || name || '', {\n kind: ASTKind.VariableDeclarationList,\n declarations: Array.isArray(parsedValue) ? parsedValue : [parsedValue],\n });\n };\n\n return [\n {\n event: DataEvent.onValueInit,\n effect: ((params) => {\n const { context } = params;\n\n const scope = getScope(context.node);\n const disposable = options.onInit?.({\n node: context.node,\n scope,\n options,\n name: params.name,\n formValues: params.formValues,\n form: params.form,\n });\n\n transformValueToAST(params);\n\n return () => {\n disposable?.dispose();\n };\n }) as Effect,\n },\n {\n event: DataEvent.onValueChange,\n effect: ((params) => {\n transformValueToAST(params);\n }) as Effect,\n },\n ];\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { DataEvent, defineFormPluginCreator } from '@flowgram.ai/node';\n\nexport const createVariableProviderPlugin = defineFormPluginCreator({\n name: 'VariableProviderPlugin',\n onInit: (ctx, opts) => {\n // todo\n // console.log('>>> VariableProviderPlugin init', ctx, opts);\n },\n onSetupFormMeta({ mergeEffect }) {\n mergeEffect({\n arr: [\n {\n event: DataEvent.onValueInitOrChange,\n effect: () => {\n // todo\n // console.log('>>> VariableProviderPlugin effect triggered');\n },\n },\n ],\n });\n },\n onDispose: (ctx, opts) => {\n // todo\n // console.log('>>> VariableProviderPlugin dispose', ctx, opts);\n },\n});\n"],"mappings":"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","names":["import_core","import_react","React","React","import_react","import_variable_plugin","import_core","React","import_variable_plugin","import_node"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/node-variable-plugin",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.21",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,35 +18,30 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"inversify": "^6.0.1",
|
|
20
20
|
"reflect-metadata": "~0.2.2",
|
|
21
|
-
"
|
|
22
|
-
"@flowgram.ai/core": "0.1.0-alpha.
|
|
23
|
-
"@flowgram.ai/
|
|
24
|
-
"@flowgram.ai/
|
|
25
|
-
"@flowgram.ai/
|
|
26
|
-
"@flowgram.ai/
|
|
27
|
-
"@flowgram.ai/variable-plugin": "0.1.0-alpha.2"
|
|
21
|
+
"@flowgram.ai/form-core": "0.1.0-alpha.21",
|
|
22
|
+
"@flowgram.ai/core": "0.1.0-alpha.21",
|
|
23
|
+
"@flowgram.ai/node": "0.1.0-alpha.21",
|
|
24
|
+
"@flowgram.ai/utils": "0.1.0-alpha.21",
|
|
25
|
+
"@flowgram.ai/document": "0.1.0-alpha.21",
|
|
26
|
+
"@flowgram.ai/variable-plugin": "0.1.0-alpha.21"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@types/bezier-js": "4.1.3",
|
|
31
|
-
"@types/lodash": "^4.14.137",
|
|
32
30
|
"@types/react": "^18",
|
|
33
31
|
"@types/react-dom": "^18",
|
|
34
|
-
"@
|
|
35
|
-
"@vitest/coverage-v8": "^0.32.0",
|
|
32
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
36
33
|
"eslint": "^8.54.0",
|
|
37
34
|
"react": "^18",
|
|
38
35
|
"react-dom": "^18",
|
|
39
|
-
"styled-components": "^5",
|
|
40
36
|
"tsup": "^8.0.1",
|
|
41
|
-
"typescript": "^5.
|
|
42
|
-
"vitest": "^
|
|
43
|
-
"@flowgram.ai/eslint-config": "0.1.0-alpha.
|
|
44
|
-
"@flowgram.ai/ts-config": "0.1.0-alpha.
|
|
37
|
+
"typescript": "^5.8.3",
|
|
38
|
+
"vitest": "^3.2.4",
|
|
39
|
+
"@flowgram.ai/eslint-config": "0.1.0-alpha.21",
|
|
40
|
+
"@flowgram.ai/ts-config": "0.1.0-alpha.21"
|
|
45
41
|
},
|
|
46
42
|
"peerDependencies": {
|
|
47
|
-
"react": ">=
|
|
48
|
-
"react-dom": ">=
|
|
49
|
-
"styled-components": ">=4"
|
|
43
|
+
"react": ">=16.8",
|
|
44
|
+
"react-dom": ">=16.8"
|
|
50
45
|
},
|
|
51
46
|
"publishConfig": {
|
|
52
47
|
"access": "public",
|