@flowgram.ai/form-materials 0.2.20 → 0.2.22

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 (28) hide show
  1. package/dist/esm/index.js +683 -4
  2. package/dist/esm/index.js.map +1 -1
  3. package/dist/index.d.mts +42 -10
  4. package/dist/index.d.ts +42 -10
  5. package/dist/index.js +707 -48
  6. package/dist/index.js.map +1 -1
  7. package/package.json +6 -5
  8. package/src/components/code-editor/config.json +9 -0
  9. package/src/components/code-editor/index.tsx +59 -0
  10. package/src/components/code-editor/language-features.ts +24 -0
  11. package/src/components/code-editor/theme/dark.ts +119 -0
  12. package/src/components/code-editor/theme/index.ts +12 -0
  13. package/src/components/code-editor/theme/light.ts +119 -0
  14. package/src/components/code-editor/utils.ts +20 -0
  15. package/src/components/index.ts +3 -0
  16. package/src/components/json-editor-with-variables/config.json +13 -0
  17. package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +173 -0
  18. package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +83 -0
  19. package/src/components/json-editor-with-variables/index.tsx +19 -0
  20. package/src/components/json-editor-with-variables/styles.tsx +44 -0
  21. package/src/components/prompt-editor/config.json +1 -1
  22. package/src/components/prompt-editor/index.tsx +15 -2
  23. package/src/components/prompt-editor/types.tsx +2 -0
  24. package/src/components/prompt-editor-with-inputs/config.json +13 -0
  25. package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +82 -0
  26. package/src/components/prompt-editor-with-inputs/index.tsx +22 -0
  27. package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +100 -0
  28. package/src/components/prompt-editor-with-variables/config.json +4 -3
package/dist/index.d.mts CHANGED
@@ -160,7 +160,7 @@ interface RendererProps<Value = any> {
160
160
  onChange?: (value: Value) => void;
161
161
  readonly?: boolean;
162
162
  }
163
- interface PropsType$3 extends RendererProps {
163
+ interface PropsType$4 extends RendererProps {
164
164
  schema: IJsonSchema;
165
165
  strategies?: Strategy[];
166
166
  [key: string]: any;
@@ -171,14 +171,14 @@ interface PropsType$3 extends RendererProps {
171
171
  * SPDX-License-Identifier: MIT
172
172
  */
173
173
 
174
- declare function ConstantInput(props: PropsType$3): React$1.JSX.Element;
174
+ declare function ConstantInput(props: PropsType$4): React$1.JSX.Element;
175
175
 
176
176
  /**
177
177
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
178
178
  * SPDX-License-Identifier: MIT
179
179
  */
180
180
 
181
- interface PropsType$2 {
181
+ interface PropsType$3 {
182
182
  value?: IFlowConstantRefValue;
183
183
  onChange: (value?: IFlowConstantRefValue) => void;
184
184
  readonly?: boolean;
@@ -191,7 +191,7 @@ interface PropsType$2 {
191
191
  [key: string]: any;
192
192
  };
193
193
  }
194
- declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType$2): React$1.JSX.Element;
194
+ declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType$3): React$1.JSX.Element;
195
195
 
196
196
  /**
197
197
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -239,7 +239,7 @@ declare function ConditionRow({ style, value, onChange, readonly }: PropTypes):
239
239
  */
240
240
 
241
241
  type ValueType = Record<string, IFlowRefValue | undefined>;
242
- interface PropsType$1 {
242
+ interface PropsType$2 {
243
243
  value?: ValueType;
244
244
  onChange: (value?: ValueType) => void;
245
245
  readonly?: boolean;
@@ -252,18 +252,20 @@ interface PropsType$1 {
252
252
  * SPDX-License-Identifier: MIT
253
253
  */
254
254
 
255
- declare function BatchOutputs(props: PropsType$1): React$1.JSX.Element;
255
+ declare function BatchOutputs(props: PropsType$2): React$1.JSX.Element;
256
256
 
257
257
  /**
258
258
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
259
259
  * SPDX-License-Identifier: MIT
260
260
  */
261
261
 
262
- type PropsType = React$1.PropsWithChildren<{
262
+ type PropsType$1 = React$1.PropsWithChildren<{
263
263
  value?: IFlowTemplateValue;
264
264
  onChange: (value?: IFlowTemplateValue) => void;
265
265
  readonly?: boolean;
266
266
  hasError?: boolean;
267
+ placeholder?: string;
268
+ activeLinePlaceholder?: string;
267
269
  style?: React$1.CSSProperties;
268
270
  }>;
269
271
 
@@ -272,8 +274,8 @@ type PropsType = React$1.PropsWithChildren<{
272
274
  * SPDX-License-Identifier: MIT
273
275
  */
274
276
 
275
- type PromptEditorPropsType = PropsType;
276
- declare function PromptEditor(props: PropsType): React$1.JSX.Element;
277
+ type PromptEditorPropsType = PropsType$1;
278
+ declare function PromptEditor(props: PropsType$1): React$1.JSX.Element;
277
279
 
278
280
  /**
279
281
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -282,6 +284,36 @@ declare function PromptEditor(props: PropsType): React$1.JSX.Element;
282
284
 
283
285
  declare function PromptEditorWithVariables(props: PromptEditorPropsType): React$1.JSX.Element;
284
286
 
287
+ /**
288
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
289
+ * SPDX-License-Identifier: MIT
290
+ */
291
+
292
+ interface PropsType extends PromptEditorPropsType {
293
+ inputsValues: Record<string, IFlowValue>;
294
+ }
295
+ declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PropsType): React$1.JSX.Element;
296
+
297
+ /**
298
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
299
+ * SPDX-License-Identifier: MIT
300
+ */
301
+
302
+ interface CodeEditorPropsType extends React$1.PropsWithChildren<{}> {
303
+ value?: string;
304
+ onChange?: (value: string) => void;
305
+ languageId: 'python' | 'typescript' | 'shell' | 'json';
306
+ theme?: 'dark' | 'light';
307
+ }
308
+ declare function CodeEditor({ value, onChange, languageId, theme, children, }: CodeEditorPropsType): React$1.JSX.Element;
309
+
310
+ /**
311
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
312
+ * SPDX-License-Identifier: MIT
313
+ */
314
+
315
+ declare function JsonEditorWithVariables(props: Omit<CodeEditorPropsType, 'languageId'>): React$1.JSX.Element;
316
+
285
317
  /**
286
318
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
287
319
  * SPDX-License-Identifier: MIT
@@ -458,4 +490,4 @@ declare const createBatchOutputsFormPlugin: FormPluginCreator<{
458
490
  outputKey: string;
459
491
  }>;
460
492
 
461
- export { ArrayIcons, BatchOutputs, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, PromptEditor, type PromptEditorPropsType, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, createBatchOutputsFormPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useVariableTree };
493
+ export { ArrayIcons, BatchOutputs, BatchVariableSelector, CodeEditor, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, JsonEditorWithVariables, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, createBatchOutputsFormPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useVariableTree };
package/dist/index.d.ts CHANGED
@@ -160,7 +160,7 @@ interface RendererProps<Value = any> {
160
160
  onChange?: (value: Value) => void;
161
161
  readonly?: boolean;
162
162
  }
163
- interface PropsType$3 extends RendererProps {
163
+ interface PropsType$4 extends RendererProps {
164
164
  schema: IJsonSchema;
165
165
  strategies?: Strategy[];
166
166
  [key: string]: any;
@@ -171,14 +171,14 @@ interface PropsType$3 extends RendererProps {
171
171
  * SPDX-License-Identifier: MIT
172
172
  */
173
173
 
174
- declare function ConstantInput(props: PropsType$3): React$1.JSX.Element;
174
+ declare function ConstantInput(props: PropsType$4): React$1.JSX.Element;
175
175
 
176
176
  /**
177
177
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
178
178
  * SPDX-License-Identifier: MIT
179
179
  */
180
180
 
181
- interface PropsType$2 {
181
+ interface PropsType$3 {
182
182
  value?: IFlowConstantRefValue;
183
183
  onChange: (value?: IFlowConstantRefValue) => void;
184
184
  readonly?: boolean;
@@ -191,7 +191,7 @@ interface PropsType$2 {
191
191
  [key: string]: any;
192
192
  };
193
193
  }
194
- declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType$2): React$1.JSX.Element;
194
+ declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType$3): React$1.JSX.Element;
195
195
 
196
196
  /**
197
197
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -239,7 +239,7 @@ declare function ConditionRow({ style, value, onChange, readonly }: PropTypes):
239
239
  */
240
240
 
241
241
  type ValueType = Record<string, IFlowRefValue | undefined>;
242
- interface PropsType$1 {
242
+ interface PropsType$2 {
243
243
  value?: ValueType;
244
244
  onChange: (value?: ValueType) => void;
245
245
  readonly?: boolean;
@@ -252,18 +252,20 @@ interface PropsType$1 {
252
252
  * SPDX-License-Identifier: MIT
253
253
  */
254
254
 
255
- declare function BatchOutputs(props: PropsType$1): React$1.JSX.Element;
255
+ declare function BatchOutputs(props: PropsType$2): React$1.JSX.Element;
256
256
 
257
257
  /**
258
258
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
259
259
  * SPDX-License-Identifier: MIT
260
260
  */
261
261
 
262
- type PropsType = React$1.PropsWithChildren<{
262
+ type PropsType$1 = React$1.PropsWithChildren<{
263
263
  value?: IFlowTemplateValue;
264
264
  onChange: (value?: IFlowTemplateValue) => void;
265
265
  readonly?: boolean;
266
266
  hasError?: boolean;
267
+ placeholder?: string;
268
+ activeLinePlaceholder?: string;
267
269
  style?: React$1.CSSProperties;
268
270
  }>;
269
271
 
@@ -272,8 +274,8 @@ type PropsType = React$1.PropsWithChildren<{
272
274
  * SPDX-License-Identifier: MIT
273
275
  */
274
276
 
275
- type PromptEditorPropsType = PropsType;
276
- declare function PromptEditor(props: PropsType): React$1.JSX.Element;
277
+ type PromptEditorPropsType = PropsType$1;
278
+ declare function PromptEditor(props: PropsType$1): React$1.JSX.Element;
277
279
 
278
280
  /**
279
281
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -282,6 +284,36 @@ declare function PromptEditor(props: PropsType): React$1.JSX.Element;
282
284
 
283
285
  declare function PromptEditorWithVariables(props: PromptEditorPropsType): React$1.JSX.Element;
284
286
 
287
+ /**
288
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
289
+ * SPDX-License-Identifier: MIT
290
+ */
291
+
292
+ interface PropsType extends PromptEditorPropsType {
293
+ inputsValues: Record<string, IFlowValue>;
294
+ }
295
+ declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PropsType): React$1.JSX.Element;
296
+
297
+ /**
298
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
299
+ * SPDX-License-Identifier: MIT
300
+ */
301
+
302
+ interface CodeEditorPropsType extends React$1.PropsWithChildren<{}> {
303
+ value?: string;
304
+ onChange?: (value: string) => void;
305
+ languageId: 'python' | 'typescript' | 'shell' | 'json';
306
+ theme?: 'dark' | 'light';
307
+ }
308
+ declare function CodeEditor({ value, onChange, languageId, theme, children, }: CodeEditorPropsType): React$1.JSX.Element;
309
+
310
+ /**
311
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
312
+ * SPDX-License-Identifier: MIT
313
+ */
314
+
315
+ declare function JsonEditorWithVariables(props: Omit<CodeEditorPropsType, 'languageId'>): React$1.JSX.Element;
316
+
285
317
  /**
286
318
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
287
319
  * SPDX-License-Identifier: MIT
@@ -458,4 +490,4 @@ declare const createBatchOutputsFormPlugin: FormPluginCreator<{
458
490
  outputKey: string;
459
491
  }>;
460
492
 
461
- export { ArrayIcons, BatchOutputs, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, PromptEditor, type PromptEditorPropsType, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, createBatchOutputsFormPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useVariableTree };
493
+ export { ArrayIcons, BatchOutputs, BatchVariableSelector, CodeEditor, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, JsonEditorWithVariables, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, createBatchOutputsFormPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useVariableTree };