@flowgram.ai/form-materials 0.1.0-alpha.13 → 0.1.0-alpha.15
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/bin/run.sh +6 -0
- package/dist/cjs/components/assign-row/index.js +112 -0
- package/dist/cjs/components/assign-row/types.js +18 -0
- package/dist/cjs/components/assign-rows/index.js +85 -0
- package/dist/cjs/components/batch-outputs/index.js +91 -0
- package/dist/cjs/components/batch-outputs/styles.js +60 -0
- package/dist/cjs/components/batch-outputs/types.js +18 -0
- package/dist/cjs/components/batch-variable-selector/index.js +53 -0
- package/dist/cjs/components/blur-input/index.js +64 -0
- package/dist/cjs/components/code-editor/editor.js +117 -0
- package/dist/cjs/components/code-editor/index.js +57 -0
- package/dist/cjs/components/code-editor/init-worker.js +56 -0
- package/dist/cjs/components/code-editor/language-features.js +21 -0
- package/dist/cjs/components/code-editor/theme/dark.js +188 -0
- package/dist/cjs/components/code-editor/theme/index.js +11 -0
- package/dist/cjs/components/code-editor/theme/light.js +195 -0
- package/dist/cjs/components/code-editor/utils.js +42 -0
- package/dist/cjs/components/code-editor-mini/index.js +66 -0
- package/dist/cjs/components/condition-row/constants.js +165 -0
- package/dist/cjs/components/condition-row/hooks/useOp.js +78 -0
- package/dist/cjs/components/condition-row/hooks/useRule.js +68 -0
- package/dist/cjs/components/condition-row/index.js +123 -0
- package/dist/cjs/components/condition-row/styles.js +77 -0
- package/dist/cjs/components/condition-row/types.js +52 -0
- package/dist/cjs/components/constant-input/index.js +80 -0
- package/dist/cjs/components/constant-input/types.js +18 -0
- package/dist/cjs/components/db-condition-row/hooks/use-left.js +86 -0
- package/dist/cjs/components/db-condition-row/hooks/use-op.js +79 -0
- package/dist/cjs/components/db-condition-row/index.js +115 -0
- package/dist/cjs/components/db-condition-row/styles.js +94 -0
- package/dist/cjs/components/db-condition-row/types.js +18 -0
- package/dist/cjs/components/display-flow-value/index.js +64 -0
- package/dist/cjs/components/display-inputs-values/index.js +76 -0
- package/dist/cjs/components/display-inputs-values/styles.js +51 -0
- package/dist/cjs/components/display-outputs/index.js +72 -0
- package/dist/cjs/components/display-outputs/styles.js +51 -0
- package/dist/cjs/components/display-schema-tag/index.js +77 -0
- package/dist/cjs/components/display-schema-tag/styles.js +71 -0
- package/dist/cjs/components/display-schema-tree/index.js +93 -0
- package/dist/cjs/components/display-schema-tree/styles.js +135 -0
- package/dist/cjs/components/dynamic-value-input/hooks.js +99 -0
- package/dist/cjs/components/dynamic-value-input/index.js +174 -0
- package/dist/cjs/components/dynamic-value-input/styles.js +107 -0
- package/dist/cjs/components/index.js +156 -0
- package/dist/cjs/components/inputs-values/index.js +112 -0
- package/dist/cjs/components/inputs-values/styles.js +60 -0
- package/dist/cjs/components/inputs-values/types.js +18 -0
- package/dist/cjs/components/inputs-values-tree/hooks/use-child-list.js +77 -0
- package/dist/cjs/components/inputs-values-tree/index.js +87 -0
- package/dist/cjs/components/inputs-values-tree/row.js +183 -0
- package/dist/cjs/components/inputs-values-tree/styles.js +177 -0
- package/dist/cjs/components/inputs-values-tree/types.js +18 -0
- package/dist/cjs/components/json-editor-with-variables/editor.js +81 -0
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tree.js +97 -0
- package/dist/cjs/components/json-editor-with-variables/index.js +57 -0
- package/dist/cjs/components/json-editor-with-variables/styles.js +89 -0
- package/dist/cjs/components/json-schema-editor/default-value.js +54 -0
- package/dist/cjs/components/json-schema-editor/hooks.js +130 -0
- package/dist/cjs/components/json-schema-editor/index.js +246 -0
- package/dist/cjs/components/json-schema-editor/styles.js +231 -0
- package/dist/cjs/components/json-schema-editor/types.js +18 -0
- package/dist/cjs/components/prompt-editor/editor.js +99 -0
- package/dist/cjs/components/prompt-editor/extensions/jinja.js +73 -0
- package/dist/cjs/components/prompt-editor/extensions/language-support.js +48 -0
- package/dist/cjs/components/prompt-editor/extensions/markdown.js +81 -0
- package/dist/cjs/components/prompt-editor/index.js +57 -0
- package/dist/cjs/components/prompt-editor/styles.js +55 -0
- package/dist/cjs/components/prompt-editor/types.js +7 -0
- package/dist/cjs/components/prompt-editor-with-inputs/editor.js +47 -0
- package/dist/cjs/components/prompt-editor-with-inputs/extensions/inputs-tree.js +101 -0
- package/dist/cjs/components/prompt-editor-with-inputs/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-inputs/inputs-picker.js +104 -0
- package/dist/cjs/components/prompt-editor-with-variables/editor.js +49 -0
- package/dist/cjs/components/prompt-editor-with-variables/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/prompt-editor-with-variables/extensions/variable-tree.js +103 -0
- package/dist/cjs/components/prompt-editor-with-variables/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-variables/styles.js +89 -0
- package/dist/cjs/components/type-selector/index.js +139 -0
- package/dist/cjs/components/variable-selector/context.js +56 -0
- package/dist/cjs/components/variable-selector/index.js +143 -0
- package/dist/cjs/components/variable-selector/styles.js +114 -0
- package/dist/cjs/components/variable-selector/use-variable-tree.js +100 -0
- package/dist/cjs/effects/auto-rename-ref/index.js +98 -0
- package/dist/cjs/effects/index.js +60 -0
- package/dist/cjs/effects/listen-ref-schema-change/index.js +57 -0
- package/dist/cjs/effects/listen-ref-value-change/index.js +54 -0
- package/dist/cjs/effects/provide-batch-input/index.js +64 -0
- package/dist/cjs/effects/provide-json-schema-outputs/index.js +49 -0
- package/dist/cjs/effects/sync-variable-title/index.js +52 -0
- package/dist/cjs/effects/validate-when-variable-sync/index.js +49 -0
- package/dist/cjs/form-plugins/batch-outputs-plugin/index.js +97 -0
- package/dist/cjs/form-plugins/index.js +47 -0
- package/dist/cjs/form-plugins/infer-assign-plugin/index.js +72 -0
- package/dist/cjs/form-plugins/infer-inputs-plugin/index.js +47 -0
- package/dist/cjs/hooks/index.js +36 -0
- package/dist/cjs/hooks/use-object-list/index.js +136 -0
- package/dist/cjs/index.js +228 -0
- package/dist/cjs/plugins/disable-declaration-plugin/create-disable-declaration-plugin.js +51 -0
- package/dist/cjs/plugins/disable-declaration-plugin/index.js +36 -0
- package/dist/cjs/plugins/index.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/create-type-preset-plugin.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/index.js +57 -0
- package/dist/cjs/plugins/json-schema-preset/manager.js +18 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/array.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/boolean.js +63 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/date-time.js +52 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/index.js +53 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/integer.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/number.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/object.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/string.js +54 -0
- package/dist/cjs/shared/flow-value/index.js +36 -0
- package/dist/cjs/shared/flow-value/schema.js +82 -0
- package/dist/cjs/shared/flow-value/types.js +18 -0
- package/dist/cjs/shared/flow-value/utils.js +142 -0
- package/dist/cjs/shared/format-legacy-refs/index.js +99 -0
- package/dist/cjs/shared/index.js +73 -0
- package/dist/cjs/shared/inject-material/index.js +65 -0
- package/dist/cjs/shared/lazy-suspense/index.js +58 -0
- package/dist/cjs/shared/polyfill-create-root/index.js +53 -0
- package/dist/cjs/validate/index.js +36 -0
- package/dist/cjs/validate/validate-flow-value/index.js +63 -0
- package/dist/esm/components/assign-row/index.mjs +78 -0
- package/dist/esm/components/assign-row/types.mjs +0 -0
- package/dist/esm/components/assign-rows/index.mjs +51 -0
- package/dist/esm/components/batch-outputs/index.mjs +57 -0
- package/dist/esm/components/batch-outputs/styles.mjs +13 -0
- package/dist/esm/components/batch-outputs/types.mjs +0 -0
- package/dist/esm/components/batch-variable-selector/index.mjs +19 -0
- package/dist/esm/components/blur-input/index.mjs +20 -0
- package/dist/esm/components/code-editor/editor.mjs +55 -0
- package/dist/esm/components/code-editor/index.mjs +5 -0
- package/dist/esm/components/code-editor/init-worker.mjs +19 -0
- package/dist/esm/components/code-editor/language-features.mjs +15 -0
- package/dist/esm/components/code-editor/theme/dark.mjs +154 -0
- package/dist/esm/components/code-editor/theme/index.mjs +5 -0
- package/dist/esm/components/code-editor/theme/light.mjs +161 -0
- package/dist/esm/components/code-editor/utils.mjs +8 -0
- package/dist/esm/components/code-editor-mini/index.mjs +22 -0
- package/dist/esm/components/condition-row/constants.mjs +128 -0
- package/dist/esm/components/condition-row/hooks/useOp.mjs +44 -0
- package/dist/esm/components/condition-row/hooks/useRule.mjs +34 -0
- package/dist/esm/components/condition-row/index.mjs +89 -0
- package/dist/esm/components/condition-row/styles.mjs +21 -0
- package/dist/esm/components/condition-row/types.mjs +18 -0
- package/dist/esm/components/constant-input/index.mjs +36 -0
- package/dist/esm/components/constant-input/types.mjs +0 -0
- package/dist/esm/components/db-condition-row/hooks/use-left.mjs +52 -0
- package/dist/esm/components/db-condition-row/hooks/use-op.mjs +45 -0
- package/dist/esm/components/db-condition-row/index.mjs +81 -0
- package/dist/esm/components/db-condition-row/styles.mjs +32 -0
- package/dist/esm/components/db-condition-row/types.mjs +0 -0
- package/dist/esm/components/display-flow-value/index.mjs +30 -0
- package/dist/esm/components/display-inputs-values/index.mjs +39 -0
- package/dist/esm/components/display-inputs-values/styles.mjs +7 -0
- package/dist/esm/components/display-outputs/index.mjs +38 -0
- package/dist/esm/components/display-outputs/styles.mjs +7 -0
- package/dist/esm/components/display-schema-tag/index.mjs +33 -0
- package/dist/esm/components/display-schema-tag/styles.mjs +21 -0
- package/dist/esm/components/display-schema-tree/index.mjs +49 -0
- package/dist/esm/components/display-schema-tree/styles.mjs +79 -0
- package/dist/esm/components/dynamic-value-input/hooks.mjs +59 -0
- package/dist/esm/components/dynamic-value-input/index.mjs +137 -0
- package/dist/esm/components/dynamic-value-input/styles.mjs +54 -0
- package/dist/esm/components/index.mjs +26 -0
- package/dist/esm/components/inputs-values/index.mjs +78 -0
- package/dist/esm/components/inputs-values/styles.mjs +13 -0
- package/dist/esm/components/inputs-values/types.mjs +0 -0
- package/dist/esm/components/inputs-values-tree/hooks/use-child-list.mjs +43 -0
- package/dist/esm/components/inputs-values-tree/index.mjs +53 -0
- package/dist/esm/components/inputs-values-tree/row.mjs +149 -0
- package/dist/esm/components/inputs-values-tree/styles.mjs +105 -0
- package/dist/esm/components/inputs-values-tree/types.mjs +0 -0
- package/dist/esm/components/json-editor-with-variables/editor.mjs +47 -0
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tree.mjs +63 -0
- package/dist/esm/components/json-editor-with-variables/index.mjs +5 -0
- package/dist/esm/components/json-editor-with-variables/styles.mjs +36 -0
- package/dist/esm/components/json-schema-editor/default-value.mjs +20 -0
- package/dist/esm/components/json-schema-editor/hooks.mjs +96 -0
- package/dist/esm/components/json-schema-editor/index.mjs +212 -0
- package/dist/esm/components/json-schema-editor/styles.mjs +138 -0
- package/dist/esm/components/json-schema-editor/types.mjs +0 -0
- package/dist/esm/components/prompt-editor/editor.mjs +52 -0
- package/dist/esm/components/prompt-editor/extensions/jinja.mjs +39 -0
- package/dist/esm/components/prompt-editor/extensions/language-support.mjs +14 -0
- package/dist/esm/components/prompt-editor/extensions/markdown.mjs +47 -0
- package/dist/esm/components/prompt-editor/index.mjs +5 -0
- package/dist/esm/components/prompt-editor/styles.mjs +11 -0
- package/dist/esm/components/prompt-editor/types.mjs +1 -0
- package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +13 -0
- package/dist/esm/components/prompt-editor-with-inputs/extensions/inputs-tree.mjs +67 -0
- package/dist/esm/components/prompt-editor-with-inputs/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-inputs/inputs-picker.mjs +70 -0
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +15 -0
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tree.mjs +69 -0
- package/dist/esm/components/prompt-editor-with-variables/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-variables/styles.mjs +36 -0
- package/dist/esm/components/type-selector/index.mjs +96 -0
- package/dist/esm/components/variable-selector/context.mjs +16 -0
- package/dist/esm/components/variable-selector/index.mjs +100 -0
- package/dist/esm/components/variable-selector/styles.mjs +58 -0
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +66 -0
- package/dist/esm/effects/auto-rename-ref/index.mjs +64 -0
- package/dist/esm/effects/index.mjs +8 -0
- package/dist/esm/effects/listen-ref-schema-change/index.mjs +23 -0
- package/dist/esm/effects/listen-ref-value-change/index.mjs +20 -0
- package/dist/esm/effects/provide-batch-input/index.mjs +30 -0
- package/dist/esm/effects/provide-json-schema-outputs/index.mjs +15 -0
- package/dist/esm/effects/sync-variable-title/index.mjs +18 -0
- package/dist/esm/effects/validate-when-variable-sync/index.mjs +15 -0
- package/dist/esm/form-plugins/batch-outputs-plugin/index.mjs +60 -0
- package/dist/esm/form-plugins/index.mjs +4 -0
- package/dist/esm/form-plugins/infer-assign-plugin/index.mjs +38 -0
- package/dist/esm/form-plugins/infer-inputs-plugin/index.mjs +13 -0
- package/dist/esm/hooks/index.mjs +2 -0
- package/dist/esm/hooks/use-object-list/index.mjs +102 -0
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/plugins/disable-declaration-plugin/create-disable-declaration-plugin.mjs +17 -0
- package/dist/esm/plugins/disable-declaration-plugin/index.mjs +2 -0
- package/dist/esm/plugins/index.mjs +3 -0
- package/dist/esm/plugins/json-schema-preset/create-type-preset-plugin.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/index.mjs +14 -0
- package/dist/esm/plugins/json-schema-preset/manager.mjs +0 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/array.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/boolean.mjs +29 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/date-time.mjs +18 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/index.mjs +19 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/integer.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/number.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/object.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/string.mjs +20 -0
- package/dist/esm/shared/flow-value/index.mjs +2 -0
- package/dist/esm/shared/flow-value/schema.mjs +26 -0
- package/dist/esm/shared/flow-value/types.mjs +0 -0
- package/dist/esm/shared/flow-value/utils.mjs +108 -0
- package/dist/esm/shared/format-legacy-refs/index.mjs +50 -0
- package/dist/esm/shared/index.mjs +6 -0
- package/dist/esm/shared/inject-material/index.mjs +21 -0
- package/dist/esm/shared/lazy-suspense/index.mjs +21 -0
- package/dist/esm/shared/polyfill-create-root/index.mjs +16 -0
- package/dist/esm/validate/index.mjs +2 -0
- package/dist/esm/validate/validate-flow-value/index.mjs +29 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/components/assign-row/index.d.ts +8 -0
- package/dist/types/components/assign-row/types.d.ts +20 -0
- package/dist/types/components/assign-rows/index.d.ts +11 -0
- package/dist/types/components/batch-outputs/index.d.ts +7 -0
- package/dist/types/components/batch-outputs/styles.d.ts +6 -0
- package/dist/types/components/batch-outputs/types.d.ts +18 -0
- package/dist/types/components/batch-variable-selector/index.d.ts +7 -0
- package/dist/types/components/blur-input/index.d.ts +7 -0
- package/dist/types/components/code-editor/editor.d.ts +23 -0
- package/dist/types/components/code-editor/index.d.ts +6 -0
- package/{src/validate/index.tsx → dist/types/components/code-editor/init-worker.d.ts} +1 -2
- package/{src/typings/index.ts → dist/types/components/code-editor/language-features.d.ts} +1 -2
- package/dist/types/components/code-editor/theme/dark.d.ts +6 -0
- package/{src/hooks/index.tsx → dist/types/components/code-editor/theme/index.d.ts} +1 -2
- package/dist/types/components/code-editor/theme/light.d.ts +6 -0
- package/dist/types/components/code-editor/utils.d.ts +5 -0
- package/dist/types/components/code-editor-mini/index.d.ts +7 -0
- package/dist/types/components/condition-row/constants.d.ts +7 -0
- package/dist/types/components/condition-row/hooks/useOp.d.ts +18 -0
- package/dist/types/components/condition-row/hooks/useRule.d.ts +9 -0
- package/dist/types/components/condition-row/index.d.ts +22 -0
- package/dist/types/components/condition-row/styles.d.ts +9 -0
- package/dist/types/components/condition-row/types.d.ts +34 -0
- package/dist/types/components/constant-input/index.d.ts +8 -0
- package/dist/types/components/constant-input/types.d.ts +16 -0
- package/dist/types/components/db-condition-row/hooks/use-left.d.ts +18 -0
- package/dist/types/components/db-condition-row/hooks/use-op.d.ts +18 -0
- package/dist/types/components/db-condition-row/index.d.ts +19 -0
- package/dist/types/components/db-condition-row/styles.d.ts +12 -0
- package/dist/types/components/db-condition-row/types.d.ts +25 -0
- package/dist/types/components/display-flow-value/index.d.ts +15 -0
- package/dist/types/components/display-inputs-values/index.d.ts +14 -0
- package/dist/types/components/display-inputs-values/styles.d.ts +5 -0
- package/dist/types/components/display-outputs/index.d.ts +14 -0
- package/dist/types/components/display-outputs/styles.d.ts +5 -0
- package/dist/types/components/display-schema-tag/index.d.ts +14 -0
- package/dist/types/components/display-schema-tag/styles.d.ts +8 -0
- package/dist/types/components/display-schema-tree/index.d.ts +16 -0
- package/dist/types/components/display-schema-tree/styles.d.ts +11 -0
- package/dist/types/components/dynamic-value-input/hooks.d.ts +28 -0
- package/dist/types/components/dynamic-value-input/index.d.ts +27 -0
- package/dist/types/components/dynamic-value-input/styles.d.ts +8 -0
- package/dist/types/components/index.d.ts +29 -0
- package/dist/types/components/inputs-values/index.d.ts +7 -0
- package/dist/types/components/inputs-values/styles.d.ts +6 -0
- package/dist/types/components/inputs-values/types.d.ts +19 -0
- package/dist/types/components/inputs-values-tree/hooks/use-child-list.d.ts +19 -0
- package/dist/types/components/inputs-values-tree/index.d.ts +7 -0
- package/dist/types/components/inputs-values-tree/row.d.ts +15 -0
- package/dist/types/components/inputs-values-tree/styles.d.ts +23 -0
- package/dist/types/components/inputs-values-tree/types.d.ts +18 -0
- package/dist/types/components/json-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/json-editor-with-variables/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/json-editor-with-variables/extensions/variable-tree.d.ts +6 -0
- package/dist/types/components/json-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/json-editor-with-variables/styles.d.ts +9 -0
- package/dist/types/components/json-schema-editor/default-value.d.ts +17 -0
- package/dist/types/components/json-schema-editor/hooks.d.ts +12 -0
- package/dist/types/components/json-schema-editor/index.d.ts +14 -0
- package/dist/types/components/json-schema-editor/styles.d.ts +30 -0
- package/dist/types/components/json-schema-editor/types.d.ts +20 -0
- package/dist/types/components/prompt-editor/editor.d.ts +15 -0
- package/dist/types/components/prompt-editor/extensions/jinja.d.ts +6 -0
- package/dist/types/components/prompt-editor/extensions/language-support.d.ts +6 -0
- package/dist/types/components/prompt-editor/extensions/markdown.d.ts +6 -0
- package/dist/types/components/prompt-editor/index.d.ts +6 -0
- package/dist/types/components/prompt-editor/styles.d.ts +7 -0
- package/dist/types/components/prompt-editor/types.d.ts +16 -0
- package/dist/types/components/prompt-editor-with-inputs/editor.d.ts +10 -0
- package/dist/types/components/prompt-editor-with-inputs/extensions/inputs-tree.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-inputs/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-inputs/inputs-picker.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tree.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/styles.d.ts +9 -0
- package/dist/types/components/type-selector/index.d.ts +23 -0
- package/dist/types/components/variable-selector/context.d.ts +16 -0
- package/dist/types/components/variable-selector/index.d.ts +29 -0
- package/dist/types/components/variable-selector/styles.d.ts +14 -0
- package/dist/types/components/variable-selector/use-variable-tree.d.ts +18 -0
- package/dist/types/effects/auto-rename-ref/index.d.ts +17 -0
- package/dist/types/effects/index.d.ts +11 -0
- package/dist/types/effects/listen-ref-schema-change/index.d.ts +22 -0
- package/dist/types/effects/listen-ref-value-change/index.d.ts +22 -0
- package/dist/types/effects/provide-batch-input/index.d.ts +6 -0
- package/dist/types/effects/provide-json-schema-outputs/index.d.ts +6 -0
- package/dist/types/effects/sync-variable-title/index.d.ts +6 -0
- package/dist/types/effects/validate-when-variable-sync/index.d.ts +8 -0
- package/dist/types/form-plugins/batch-outputs-plugin/index.d.ts +12 -0
- package/dist/types/form-plugins/index.d.ts +7 -0
- package/dist/types/form-plugins/infer-assign-plugin/index.d.ts +10 -0
- package/dist/types/form-plugins/infer-inputs-plugin/index.d.ts +11 -0
- package/dist/types/hooks/index.d.ts +5 -0
- package/dist/types/hooks/use-object-list/index.d.ts +22 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/plugins/disable-declaration-plugin/create-disable-declaration-plugin.d.ts +5 -0
- package/dist/types/plugins/disable-declaration-plugin/index.d.ts +5 -0
- package/dist/types/plugins/index.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/create-type-preset-plugin.d.ts +9 -0
- package/dist/types/plugins/json-schema-preset/index.d.ts +13 -0
- package/dist/types/plugins/json-schema-preset/manager.d.ts +17 -0
- package/dist/types/plugins/json-schema-preset/type-definition/array.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/boolean.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/date-time.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/index.d.ts +5 -0
- package/dist/types/plugins/json-schema-preset/type-definition/integer.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/number.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/object.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/string.d.ts +6 -0
- package/dist/types/shared/flow-value/index.d.ts +6 -0
- package/dist/types/shared/flow-value/schema.d.ts +107 -0
- package/dist/types/shared/flow-value/types.d.ts +32 -0
- package/dist/types/shared/flow-value/utils.d.ts +65 -0
- package/dist/types/shared/format-legacy-refs/index.d.ts +84 -0
- package/dist/types/shared/index.d.ts +9 -0
- package/dist/types/shared/inject-material/index.d.ts +46 -0
- package/dist/types/shared/lazy-suspense/index.d.ts +7 -0
- package/dist/types/shared/polyfill-create-root/index.d.ts +10 -0
- package/dist/types/validate/index.d.ts +5 -0
- package/dist/types/validate/validate-flow-value/index.d.ts +19 -0
- package/package.json +22 -23
- package/src/components/assign-row/index.tsx +3 -3
- package/src/components/assign-row/types.ts +1 -1
- package/src/components/batch-outputs/index.tsx +3 -2
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/code-editor/editor.tsx +97 -0
- package/src/components/code-editor/index.tsx +5 -89
- package/src/components/code-editor/init-worker.ts +27 -0
- package/src/components/code-editor/language-features.ts +6 -27
- package/src/components/code-editor/theme/dark.ts +50 -31
- package/src/components/code-editor/theme/index.ts +1 -1
- package/src/components/code-editor/theme/light.ts +57 -33
- package/src/components/code-editor-mini/index.tsx +2 -2
- package/src/components/condition-row/constants.ts +8 -0
- package/src/components/condition-row/hooks/useRule.ts +1 -1
- package/src/components/condition-row/index.tsx +4 -0
- package/src/components/condition-row/types.ts +1 -1
- package/src/components/constant-input/index.tsx +1 -1
- package/src/components/db-condition-row/hooks/use-left.tsx +66 -0
- package/src/components/db-condition-row/hooks/use-op.tsx +59 -0
- package/src/components/db-condition-row/index.tsx +93 -0
- package/src/components/db-condition-row/styles.tsx +43 -0
- package/src/components/db-condition-row/types.ts +34 -0
- package/src/components/display-flow-value/index.tsx +3 -13
- package/src/components/display-inputs-values/index.tsx +44 -6
- package/src/components/dynamic-value-input/hooks.ts +25 -4
- package/src/components/dynamic-value-input/index.tsx +21 -12
- package/src/components/dynamic-value-input/styles.tsx +14 -4
- package/src/components/index.ts +50 -22
- package/src/components/inputs-values/index.tsx +15 -4
- package/src/components/inputs-values/styles.tsx +1 -1
- package/src/components/inputs-values/types.ts +1 -1
- package/src/components/inputs-values-tree/hooks/use-child-list.tsx +76 -0
- package/src/components/inputs-values-tree/index.tsx +62 -0
- package/src/components/inputs-values-tree/row.tsx +177 -0
- package/src/components/inputs-values-tree/styles.tsx +128 -0
- package/src/components/inputs-values-tree/types.ts +21 -0
- package/src/components/json-editor-with-variables/editor.tsx +69 -0
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +7 -6
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +3 -3
- package/src/components/json-editor-with-variables/index.tsx +5 -59
- package/src/components/json-schema-editor/default-value.tsx +1 -3
- package/src/components/json-schema-editor/hooks.tsx +14 -3
- package/src/components/json-schema-editor/index.tsx +18 -58
- package/src/components/json-schema-editor/styles.tsx +12 -55
- package/src/components/json-schema-editor/types.ts +0 -1
- package/src/components/prompt-editor/editor.tsx +81 -0
- package/src/components/prompt-editor/extensions/jinja.tsx +2 -2
- package/src/components/prompt-editor/extensions/language-support.tsx +2 -2
- package/src/components/prompt-editor/extensions/markdown.tsx +2 -2
- package/src/components/prompt-editor/index.tsx +5 -62
- package/src/components/prompt-editor/types.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/editor.tsx +25 -0
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +15 -4
- package/src/components/prompt-editor-with-inputs/index.tsx +5 -16
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +34 -17
- package/src/components/prompt-editor-with-variables/editor.tsx +22 -0
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +13 -21
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +16 -4
- package/src/components/prompt-editor-with-variables/index.tsx +5 -13
- package/src/components/type-selector/index.tsx +12 -2
- package/src/components/variable-selector/context.tsx +28 -0
- package/src/components/variable-selector/index.tsx +10 -1
- package/src/components/variable-selector/use-variable-tree.tsx +3 -3
- package/src/effects/auto-rename-ref/index.ts +8 -55
- package/src/effects/index.ts +7 -7
- package/src/effects/listen-ref-schema-change/index.ts +1 -1
- package/src/effects/listen-ref-value-change/index.ts +1 -1
- package/src/effects/provide-batch-input/index.ts +1 -1
- package/src/effects/validate-when-variable-sync/index.ts +1 -1
- package/src/form-plugins/batch-outputs-plugin/index.ts +1 -1
- package/src/form-plugins/index.ts +3 -3
- package/src/form-plugins/infer-assign-plugin/index.ts +2 -2
- package/src/form-plugins/infer-inputs-plugin/index.ts +4 -76
- package/src/hooks/index.ts +6 -0
- package/src/hooks/use-object-list/index.tsx +35 -7
- package/src/index.ts +98 -7
- package/src/plugins/index.ts +11 -2
- package/src/plugins/json-schema-preset/index.tsx +4 -4
- package/src/plugins/json-schema-preset/manager.ts +1 -0
- package/src/plugins/json-schema-preset/type-definition/date-time.tsx +25 -0
- package/src/plugins/json-schema-preset/type-definition/index.tsx +2 -0
- package/src/plugins/json-schema-preset/type-definition/string.tsx +18 -9
- package/src/shared/flow-value/index.ts +16 -0
- package/src/shared/flow-value/schema.ts +38 -0
- package/src/{typings/flow-value/index.ts → shared/flow-value/types.ts} +3 -1
- package/src/shared/flow-value/utils.ts +200 -0
- package/src/shared/format-legacy-refs/index.ts +1 -1
- package/src/shared/index.ts +26 -2
- package/src/shared/lazy-suspense/index.tsx +28 -0
- package/src/shared/polyfill-create-root/index.tsx +33 -0
- package/src/validate/index.ts +6 -0
- package/src/validate/validate-flow-value/index.tsx +4 -16
- package/bin/index.ts +0 -91
- package/bin/materials.ts +0 -107
- package/bin/project.ts +0 -95
- package/bin/utils/import.ts +0 -127
- package/bin/utils/traverse-file.ts +0 -60
- package/dist/esm/index.js +0 -3864
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.mts +0 -763
- package/dist/index.d.ts +0 -763
- package/dist/index.js +0 -3849
- package/dist/index.js.map +0 -1
- package/src/components/inputs-values/components/blur-input.tsx +0 -27
- package/src/components/json-schema-editor/components/blur-input.tsx +0 -27
- package/src/plugins/disable-declaration-plugin/config.json +0 -5
- package/src/plugins/json-schema-preset/config.json +0 -9
- /package/src/components/{assign-row/components/blur-input.tsx → blur-input/index.tsx} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* eslint-disable react/prop-types */
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { DatePicker } from '@douyinfe/semi-ui';
|
|
10
|
+
|
|
11
|
+
import { type JsonSchemaTypeRegistry } from '../manager';
|
|
12
|
+
|
|
13
|
+
export const dateTimeRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
14
|
+
type: 'date-time',
|
|
15
|
+
ConstantRenderer: (props) => (
|
|
16
|
+
<DatePicker
|
|
17
|
+
size="small"
|
|
18
|
+
type="dateTime"
|
|
19
|
+
density="compact"
|
|
20
|
+
style={{ width: '100%', ...(props.style || {}) }}
|
|
21
|
+
disabled={props.readonly}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
),
|
|
25
|
+
};
|
|
@@ -9,6 +9,7 @@ import { stringRegistry } from './string';
|
|
|
9
9
|
import { objectRegistry } from './object';
|
|
10
10
|
import { numberRegistry } from './number';
|
|
11
11
|
import { integerRegistry } from './integer';
|
|
12
|
+
import { dateTimeRegistry } from './date-time';
|
|
12
13
|
import { booleanRegistry } from './boolean';
|
|
13
14
|
import { arrayRegistry } from './array';
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ export const jsonSchemaTypePreset = [
|
|
|
19
20
|
integerRegistry,
|
|
20
21
|
booleanRegistry,
|
|
21
22
|
arrayRegistry,
|
|
23
|
+
dateTimeRegistry,
|
|
22
24
|
];
|
|
23
25
|
|
|
24
26
|
jsonSchemaTypePreset.forEach((_type) => jsonSchemaTypeManager.register(_type));
|
|
@@ -7,18 +7,27 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
9
|
import { I18n } from '@flowgram.ai/editor';
|
|
10
|
-
import { Input } from '@douyinfe/semi-ui';
|
|
10
|
+
import { Input, TextArea } from '@douyinfe/semi-ui';
|
|
11
11
|
|
|
12
12
|
import { type JsonSchemaTypeRegistry } from '../manager';
|
|
13
13
|
|
|
14
14
|
export const stringRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
15
15
|
type: 'string',
|
|
16
|
-
ConstantRenderer: (props) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
ConstantRenderer: (props) =>
|
|
17
|
+
props?.enableMultiLineStr ? (
|
|
18
|
+
<TextArea
|
|
19
|
+
autosize
|
|
20
|
+
rows={1}
|
|
21
|
+
placeholder={I18n.t('Please Input String')}
|
|
22
|
+
disabled={props.readonly}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
) : (
|
|
26
|
+
<Input
|
|
27
|
+
size="small"
|
|
28
|
+
placeholder={I18n.t('Please Input String')}
|
|
29
|
+
disabled={props.readonly}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
),
|
|
24
33
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { FlowValueUtils } from './utils';
|
|
7
|
+
export {
|
|
8
|
+
type IFlowValueExtra,
|
|
9
|
+
type FlowValueType,
|
|
10
|
+
type IFlowValue,
|
|
11
|
+
type IFlowConstantValue,
|
|
12
|
+
type IFlowRefValue,
|
|
13
|
+
type IFlowExpressionValue,
|
|
14
|
+
type IFlowTemplateValue,
|
|
15
|
+
type IFlowConstantRefValue,
|
|
16
|
+
} from './types';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import z from 'zod';
|
|
7
|
+
|
|
8
|
+
// Shared extra schema for flow value types
|
|
9
|
+
export const extraSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
index: z.number().optional(),
|
|
12
|
+
})
|
|
13
|
+
.optional();
|
|
14
|
+
|
|
15
|
+
export const constantSchema = z.object({
|
|
16
|
+
type: z.literal('constant'),
|
|
17
|
+
content: z.any().optional(),
|
|
18
|
+
schema: z.any().optional(),
|
|
19
|
+
extra: extraSchema,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const refSchema = z.object({
|
|
23
|
+
type: z.literal('ref'),
|
|
24
|
+
content: z.array(z.string()).optional(),
|
|
25
|
+
extra: extraSchema,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const expressionSchema = z.object({
|
|
29
|
+
type: z.literal('expression'),
|
|
30
|
+
content: z.string().optional(),
|
|
31
|
+
extra: extraSchema,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const templateSchema = z.object({
|
|
35
|
+
type: z.literal('template'),
|
|
36
|
+
content: z.string().optional(),
|
|
37
|
+
extra: extraSchema,
|
|
38
|
+
});
|
|
@@ -9,9 +9,11 @@ export interface IFlowValueExtra {
|
|
|
9
9
|
index?: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
export type FlowValueType = 'constant' | 'ref' | 'expression' | 'template';
|
|
13
|
+
|
|
12
14
|
export interface IFlowConstantValue {
|
|
13
15
|
type: 'constant';
|
|
14
|
-
content?:
|
|
16
|
+
content?: any;
|
|
15
17
|
schema?: IJsonSchema;
|
|
16
18
|
extra?: IFlowValueExtra;
|
|
17
19
|
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { isArray, isObject, isPlainObject, uniq } from 'lodash-es';
|
|
7
|
+
import { IJsonSchema, JsonSchemaUtils } from '@flowgram.ai/json-schema';
|
|
8
|
+
import { Scope } from '@flowgram.ai/editor';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
IFlowConstantValue,
|
|
12
|
+
IFlowRefValue,
|
|
13
|
+
IFlowExpressionValue,
|
|
14
|
+
IFlowTemplateValue,
|
|
15
|
+
IFlowValue,
|
|
16
|
+
IFlowConstantRefValue,
|
|
17
|
+
FlowValueType,
|
|
18
|
+
} from './types';
|
|
19
|
+
import { constantSchema, refSchema, expressionSchema, templateSchema } from './schema';
|
|
20
|
+
|
|
21
|
+
export namespace FlowValueUtils {
|
|
22
|
+
/**
|
|
23
|
+
* Check if the value is a constant type
|
|
24
|
+
*/
|
|
25
|
+
export function isConstant(value: any): value is IFlowConstantValue {
|
|
26
|
+
return constantSchema.safeParse(value).success;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Check if the value is a reference type
|
|
31
|
+
*/
|
|
32
|
+
export function isRef(value: any): value is IFlowRefValue {
|
|
33
|
+
return refSchema.safeParse(value).success;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Check if the value is an expression type
|
|
38
|
+
*/
|
|
39
|
+
export function isExpression(value: any): value is IFlowExpressionValue {
|
|
40
|
+
return expressionSchema.safeParse(value).success;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check if the value is a template type
|
|
45
|
+
*/
|
|
46
|
+
export function isTemplate(value: any): value is IFlowTemplateValue {
|
|
47
|
+
return templateSchema.safeParse(value).success;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Check if the value is either a constant or reference type
|
|
52
|
+
*/
|
|
53
|
+
export function isConstantOrRef(value: any): value is IFlowConstantRefValue {
|
|
54
|
+
return isConstant(value) || isRef(value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Check if the value is a valid flow value type
|
|
59
|
+
*/
|
|
60
|
+
export function isFlowValue(value: any): value is IFlowValue {
|
|
61
|
+
return isConstant(value) || isRef(value) || isExpression(value) || isTemplate(value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Traverse all flow values in the given value
|
|
66
|
+
* @param value The value to traverse
|
|
67
|
+
* @param options The options to traverse
|
|
68
|
+
* @returns A generator of flow values
|
|
69
|
+
*/
|
|
70
|
+
export function* traverse(
|
|
71
|
+
value: any,
|
|
72
|
+
options: {
|
|
73
|
+
includeTypes?: FlowValueType[];
|
|
74
|
+
path?: string;
|
|
75
|
+
}
|
|
76
|
+
): Generator<{ value: IFlowValue; path: string }> {
|
|
77
|
+
const { includeTypes = ['ref', 'template'], path = '' } = options;
|
|
78
|
+
|
|
79
|
+
if (isPlainObject(value)) {
|
|
80
|
+
if (isRef(value) && includeTypes.includes('ref')) {
|
|
81
|
+
yield { value, path };
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (isTemplate(value) && includeTypes.includes('template')) {
|
|
86
|
+
yield { value, path };
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (isExpression(value) && includeTypes.includes('expression')) {
|
|
91
|
+
yield { value, path };
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (isConstant(value) && includeTypes.includes('constant')) {
|
|
96
|
+
yield { value, path };
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
for (const [_key, _value] of Object.entries(value)) {
|
|
101
|
+
yield* traverse(_value, { ...options, path: `${path}.${_key}` });
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (isArray(value)) {
|
|
107
|
+
for (const [_idx, _value] of value.entries()) {
|
|
108
|
+
yield* traverse(_value, { ...options, path: `${path}[${_idx}]` });
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Get all key paths in the template value
|
|
118
|
+
* @param value The template value
|
|
119
|
+
* @returns A list of key paths
|
|
120
|
+
*/
|
|
121
|
+
export function getTemplateKeyPaths(value: IFlowTemplateValue) {
|
|
122
|
+
// find all keyPath wrapped in {{}}
|
|
123
|
+
const keyPathReg = /\{\{([^\}\{]+)\}\}/g;
|
|
124
|
+
return uniq(value.content?.match(keyPathReg) || []).map((_keyPath) =>
|
|
125
|
+
_keyPath.slice(2, -2).split('.')
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Infer the schema of the constant value
|
|
131
|
+
* @param value
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
export function inferConstantJsonSchema(value: IFlowConstantValue): IJsonSchema | undefined {
|
|
135
|
+
if (value?.schema) {
|
|
136
|
+
return value.schema;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (typeof value.content === 'string') {
|
|
140
|
+
return {
|
|
141
|
+
type: 'string',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (typeof value.content === 'number') {
|
|
146
|
+
return {
|
|
147
|
+
type: 'number',
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (typeof value.content === 'boolean') {
|
|
152
|
+
return {
|
|
153
|
+
type: 'boolean',
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (isObject(value.content)) {
|
|
158
|
+
return {
|
|
159
|
+
type: 'object',
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Infer the schema of the flow value
|
|
167
|
+
* @param values The flow value or object contains flow value
|
|
168
|
+
* @param scope
|
|
169
|
+
* @returns
|
|
170
|
+
*/
|
|
171
|
+
export function inferJsonSchema(values: any, scope: Scope): IJsonSchema | undefined {
|
|
172
|
+
if (isPlainObject(values)) {
|
|
173
|
+
if (isConstant(values)) {
|
|
174
|
+
return inferConstantJsonSchema(values);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (isRef(values)) {
|
|
178
|
+
const variable = scope.available.getByKeyPath(values?.content);
|
|
179
|
+
const schema = variable?.type ? JsonSchemaUtils.astToSchema(variable?.type) : undefined;
|
|
180
|
+
|
|
181
|
+
return schema;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (isTemplate(values)) {
|
|
185
|
+
return { type: 'string' };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
type: 'object',
|
|
190
|
+
properties: Object.keys(values).reduce((acc, key) => {
|
|
191
|
+
const schema = inferJsonSchema((values as any)[key], scope);
|
|
192
|
+
if (schema) {
|
|
193
|
+
acc[key] = schema;
|
|
194
|
+
}
|
|
195
|
+
return acc;
|
|
196
|
+
}, {} as Record<string, IJsonSchema>),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
package/src/shared/index.ts
CHANGED
|
@@ -3,5 +3,29 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
6
|
+
export {
|
|
7
|
+
FlowValueUtils,
|
|
8
|
+
type FlowValueType,
|
|
9
|
+
type IFlowConstantRefValue,
|
|
10
|
+
type IFlowConstantValue,
|
|
11
|
+
type IFlowExpressionValue,
|
|
12
|
+
type IFlowRefValue,
|
|
13
|
+
type IFlowTemplateValue,
|
|
14
|
+
type IFlowValue,
|
|
15
|
+
type IFlowValueExtra,
|
|
16
|
+
} from './flow-value';
|
|
17
|
+
export {
|
|
18
|
+
formatLegacyRefOnInit,
|
|
19
|
+
formatLegacyRefOnSubmit,
|
|
20
|
+
formatLegacyRefToNewRef,
|
|
21
|
+
formatNewRefToLegacyRef,
|
|
22
|
+
isLegacyFlowRefValueSchema,
|
|
23
|
+
isNewFlowRefValueSchema,
|
|
24
|
+
} from './format-legacy-refs';
|
|
25
|
+
export { createInjectMaterial } from './inject-material';
|
|
26
|
+
export { lazySuspense, withSuspense } from './lazy-suspense';
|
|
27
|
+
export {
|
|
28
|
+
polyfillCreateRoot,
|
|
29
|
+
unstableSetCreateRoot,
|
|
30
|
+
type IPolyfillRoot,
|
|
31
|
+
} from './polyfill-create-root';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { ComponentType, lazy, Suspense } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Skeleton } from '@douyinfe/semi-ui';
|
|
9
|
+
|
|
10
|
+
export function withSuspense<T extends ComponentType<any>>(
|
|
11
|
+
Component: T,
|
|
12
|
+
fallback?: React.ReactNode
|
|
13
|
+
): T {
|
|
14
|
+
const WithSuspenseComponent: T = ((props: any) => (
|
|
15
|
+
<Suspense fallback={fallback || <Skeleton.Paragraph style={{ width: '100%' }} rows={1} />}>
|
|
16
|
+
<Component {...props} />
|
|
17
|
+
</Suspense>
|
|
18
|
+
)) as any;
|
|
19
|
+
|
|
20
|
+
return WithSuspenseComponent;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function lazySuspense<T extends ComponentType<any>>(
|
|
24
|
+
params: Parameters<typeof lazy<T>>[0],
|
|
25
|
+
fallback?: React.ReactNode
|
|
26
|
+
) {
|
|
27
|
+
return withSuspense(lazy(params), fallback);
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as ReactDOM from 'react-dom';
|
|
7
|
+
|
|
8
|
+
export interface IPolyfillRoot {
|
|
9
|
+
render(children: React.ReactNode): void;
|
|
10
|
+
unmount(): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* React 18 polyfill
|
|
15
|
+
* @param dom
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
let unstableCreateRoot = (dom: HTMLElement): IPolyfillRoot => ({
|
|
19
|
+
render(children: JSX.Element) {
|
|
20
|
+
ReactDOM.render(children, dom);
|
|
21
|
+
},
|
|
22
|
+
unmount() {
|
|
23
|
+
ReactDOM.unmountComponentAtNode(dom);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function polyfillCreateRoot(dom: HTMLElement): IPolyfillRoot {
|
|
28
|
+
return unstableCreateRoot(dom);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function unstableSetCreateRoot(createRoot: (dom: HTMLElement) => IPolyfillRoot) {
|
|
32
|
+
unstableCreateRoot = createRoot;
|
|
33
|
+
}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { isNil
|
|
6
|
+
import { isNil } from 'lodash-es';
|
|
7
7
|
import { FeedbackLevel, FlowNodeEntity, getNodeScope } from '@flowgram.ai/editor';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { IFlowValue } from '@/shared';
|
|
10
|
+
import { FlowValueUtils } from '@/shared';
|
|
10
11
|
|
|
11
12
|
interface Context {
|
|
12
13
|
node: FlowNodeEntity;
|
|
@@ -43,7 +44,7 @@ export function validateFlowValue(value: IFlowValue | undefined, ctx: Context) {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
if (value?.type === 'template') {
|
|
46
|
-
const allRefs = getTemplateKeyPaths(value);
|
|
47
|
+
const allRefs = FlowValueUtils.getTemplateKeyPaths(value);
|
|
47
48
|
|
|
48
49
|
for (const ref of allRefs) {
|
|
49
50
|
const variable = getNodeScope(node).available.getByKeyPath(ref);
|
|
@@ -58,16 +59,3 @@ export function validateFlowValue(value: IFlowValue | undefined, ctx: Context) {
|
|
|
58
59
|
|
|
59
60
|
return undefined;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* get template key paths
|
|
64
|
-
* @param value
|
|
65
|
-
* @returns
|
|
66
|
-
*/
|
|
67
|
-
function getTemplateKeyPaths(value: IFlowTemplateValue) {
|
|
68
|
-
// find all keyPath wrapped in {{}}
|
|
69
|
-
const keyPathReg = /{{(.*?)}}/g;
|
|
70
|
-
return uniq(value.content?.match(keyPathReg) || []).map((_keyPath) =>
|
|
71
|
-
_keyPath.slice(2, -2).split('.')
|
|
72
|
-
);
|
|
73
|
-
}
|
package/bin/index.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S npx tsx@latest
|
|
2
|
-
|
|
3
|
-
import inquirer from 'inquirer';
|
|
4
|
-
import { Command } from 'commander';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
|
|
7
|
-
import { getProjectInfo, installDependencies, ProjectInfo } from './project.js';
|
|
8
|
-
import { copyMaterial, listAllMaterials, Material } from './materials.js';
|
|
9
|
-
|
|
10
|
-
const program = new Command();
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.version('1.0.1')
|
|
14
|
-
.description('Add official materials to your project')
|
|
15
|
-
.argument('[materialName]', 'Optional material name to skip selection (format: type/name)')
|
|
16
|
-
.action(async (materialName?: string) => {
|
|
17
|
-
// materialName can be undefined
|
|
18
|
-
console.log(chalk.bgGreenBright('Welcome to @flowgram.ai/form-materials CLI!'));
|
|
19
|
-
|
|
20
|
-
const projectInfo: ProjectInfo = getProjectInfo();
|
|
21
|
-
|
|
22
|
-
console.log(chalk.bold('Project Info:'));
|
|
23
|
-
console.log(chalk.black(` - Flowgram Version: ${projectInfo.flowgramVersion}`));
|
|
24
|
-
console.log(chalk.black(` - Project Path: ${projectInfo.projectPath}`));
|
|
25
|
-
|
|
26
|
-
const materials: Material[] = listAllMaterials();
|
|
27
|
-
|
|
28
|
-
let material: Material | undefined; // material can be undefined
|
|
29
|
-
|
|
30
|
-
// Check if materialName is provided and exists in materials
|
|
31
|
-
if (materialName) {
|
|
32
|
-
const selectedMaterial = materials.find((m) => `${m.type}/${m.name}` === materialName);
|
|
33
|
-
if (selectedMaterial) {
|
|
34
|
-
material = selectedMaterial;
|
|
35
|
-
console.log(chalk.green(`Using material: ${materialName}`));
|
|
36
|
-
} else {
|
|
37
|
-
console.log(
|
|
38
|
-
chalk.yellow(`Material "${materialName}" not found. Please select from the list:`)
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// If material not found or materialName not provided, prompt user to select
|
|
44
|
-
if (!material) {
|
|
45
|
-
// User select one component
|
|
46
|
-
const result = await inquirer.prompt<{
|
|
47
|
-
material: Material; // Specify type for prompt result
|
|
48
|
-
}>([
|
|
49
|
-
{
|
|
50
|
-
type: 'list',
|
|
51
|
-
name: 'material',
|
|
52
|
-
message: 'Select one material to add:',
|
|
53
|
-
choices: [
|
|
54
|
-
...materials.map((_material) => ({
|
|
55
|
-
name: `${_material.type}/${_material.name}`,
|
|
56
|
-
value: _material,
|
|
57
|
-
})),
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
]);
|
|
61
|
-
material = result.material;
|
|
62
|
-
}
|
|
63
|
-
// Ensure material is defined before proceeding
|
|
64
|
-
if (!material) {
|
|
65
|
-
console.error(chalk.red('No material selected. Exiting.'));
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 4. Copy the materials to the project
|
|
70
|
-
console.log(chalk.bold('The following materials will be added to your project'));
|
|
71
|
-
console.log(material);
|
|
72
|
-
let { packagesToInstall } = copyMaterial(material, projectInfo);
|
|
73
|
-
|
|
74
|
-
// 4. Install the dependencies
|
|
75
|
-
packagesToInstall = packagesToInstall.map((_pkg) => {
|
|
76
|
-
if (
|
|
77
|
-
_pkg.startsWith(`@flowgram.ai/`) &&
|
|
78
|
-
projectInfo.flowgramVersion !== 'workspace:*' &&
|
|
79
|
-
!_pkg.endsWith(`@${projectInfo.flowgramVersion}`)
|
|
80
|
-
) {
|
|
81
|
-
return `${_pkg}@${projectInfo.flowgramVersion}`;
|
|
82
|
-
}
|
|
83
|
-
return _pkg;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
console.log(chalk.bold('These npm dependencies will be added to your project'));
|
|
87
|
-
console.log(packagesToInstall);
|
|
88
|
-
installDependencies(packagesToInstall, projectInfo);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
program.parse(process.argv);
|