@flowgram.ai/form-materials 0.4.9 → 0.4.11
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 +54 -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/coze-editor-extensions/extensions/inputs-tree.js +172 -0
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tree.js +106 -0
- package/dist/cjs/components/coze-editor-extensions/index.js +86 -0
- package/dist/cjs/components/coze-editor-extensions/styles.js +89 -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 +166 -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 +85 -0
- package/dist/cjs/components/json-editor-with-variables/index.js +57 -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/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-variables/editor.js +48 -0
- package/dist/cjs/components/prompt-editor-with-variables/index.js +57 -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 +144 -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 +237 -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 +66 -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/coze-editor-extensions/extensions/inputs-tree.mjs +135 -0
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tree.mjs +72 -0
- package/dist/esm/components/coze-editor-extensions/index.mjs +18 -0
- package/{src/components/prompt-editor-with-variables/styles.tsx → dist/esm/components/coze-editor-extensions/styles.mjs} +7 -15
- 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 +27 -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 +51 -0
- package/dist/esm/components/json-editor-with-variables/index.mjs +5 -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/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +14 -0
- package/dist/esm/components/prompt-editor-with-variables/index.mjs +5 -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 +101 -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 +22 -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 +13 -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/coze-editor-extensions/extensions/inputs-tree.d.ts +14 -0
- package/dist/types/components/coze-editor-extensions/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/coze-editor-extensions/extensions/variable-tree.d.ts +8 -0
- package/dist/types/components/coze-editor-extensions/index.d.ts +18 -0
- package/dist/types/components/coze-editor-extensions/styles.d.ts +9 -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 +29 -0
- package/dist/types/components/dynamic-value-input/styles.d.ts +8 -0
- package/dist/types/components/index.d.ts +30 -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/index.d.ts +6 -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/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/type-selector/index.d.ts +25 -0
- package/dist/types/components/variable-selector/context.d.ts +16 -0
- package/dist/types/components/variable-selector/index.d.ts +31 -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 +48 -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 +20 -21
- package/src/components/assign-row/index.tsx +3 -3
- package/src/components/assign-row/types.ts +1 -1
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/blur-input/index.tsx +9 -1
- package/src/components/code-editor/editor.tsx +10 -9
- 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 +1 -1
- package/src/components/code-editor/theme/index.ts +1 -1
- package/src/components/code-editor/theme/light.ts +1 -1
- package/src/components/condition-row/hooks/useRule.ts +1 -1
- package/src/components/condition-row/types.ts +1 -1
- package/src/components/constant-input/index.tsx +1 -1
- package/src/components/{prompt-editor-with-inputs/inputs-picker.tsx → coze-editor-extensions/extensions/inputs-tree.tsx} +95 -5
- package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.tsx +1 -1
- package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.tsx +12 -6
- package/src/components/coze-editor-extensions/index.tsx +33 -0
- package/src/components/db-condition-row/types.ts +1 -1
- package/src/components/display-flow-value/index.tsx +1 -1
- package/src/components/dynamic-value-input/hooks.ts +1 -1
- package/src/components/dynamic-value-input/index.tsx +1 -1
- package/src/components/index.ts +55 -25
- package/src/components/inputs-values/index.tsx +1 -1
- package/src/components/inputs-values/types.ts +1 -1
- package/src/components/inputs-values-tree/row.tsx +1 -1
- package/src/components/json-editor-with-variables/editor.tsx +6 -6
- package/src/components/prompt-editor/editor.tsx +2 -2
- 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/types.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/editor.tsx +2 -3
- package/src/components/prompt-editor-with-variables/editor.tsx +3 -5
- package/src/components/variable-selector/index.tsx +2 -0
- package/src/effects/auto-rename-ref/index.ts +1 -1
- 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/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 +1 -1
- package/src/hooks/index.ts +6 -0
- package/src/index.ts +101 -8
- package/src/plugins/index.ts +11 -2
- package/src/plugins/json-schema-preset/index.tsx +4 -4
- package/src/shared/flow-value/index.ts +11 -1
- package/src/shared/flow-value/utils.ts +1 -2
- package/src/shared/index.ts +26 -5
- package/src/shared/inject-material/index.tsx +10 -6
- package/src/validate/index.ts +6 -0
- package/src/validate/validate-flow-value/index.tsx +1 -1
- package/bin/index.ts +0 -80
- package/bin/materials.ts +0 -134
- package/bin/project.ts +0 -95
- package/bin/utils/import.ts +0 -127
- package/bin/utils/traverse-file.ts +0 -60
- package/dist/esm/chunk-727SU246.js +0 -13
- package/dist/esm/chunk-727SU246.js.map +0 -1
- package/dist/esm/chunk-DEZUEMUM.js +0 -284
- package/dist/esm/chunk-DEZUEMUM.js.map +0 -1
- package/dist/esm/chunk-IHOHRV5V.js +0 -477
- package/dist/esm/chunk-IHOHRV5V.js.map +0 -1
- package/dist/esm/editor-4X7K477H.js +0 -282
- package/dist/esm/editor-4X7K477H.js.map +0 -1
- package/dist/esm/editor-6UMULJYB.js +0 -180
- package/dist/esm/editor-6UMULJYB.js.map +0 -1
- package/dist/esm/editor-E2BQTPCD.js +0 -388
- package/dist/esm/editor-E2BQTPCD.js.map +0 -1
- package/dist/esm/editor-OXPGKPF5.js +0 -167
- package/dist/esm/editor-OXPGKPF5.js.map +0 -1
- package/dist/esm/editor-Z24WLBPO.js +0 -249
- package/dist/esm/editor-Z24WLBPO.js.map +0 -1
- package/dist/esm/index.js +0 -2668
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.mts +0 -1002
- package/dist/index.d.ts +0 -1002
- package/dist/index.js +0 -5127
- package/dist/index.js.map +0 -1
- package/src/components/assign-row/components/blur-input.tsx +0 -27
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +0 -174
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +0 -83
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +0 -94
- /package/src/components/{json-editor-with-variables → coze-editor-extensions}/styles.tsx +0 -0
- /package/src/{typings/flow-value/index.ts → shared/flow-value/types.ts} +0 -0
package/src/index.ts
CHANGED
|
@@ -3,11 +3,104 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
export {
|
|
7
|
+
AssignRow,
|
|
8
|
+
AssignRows,
|
|
9
|
+
BatchOutputs,
|
|
10
|
+
BatchVariableSelector,
|
|
11
|
+
BlurInput,
|
|
12
|
+
CodeEditor,
|
|
13
|
+
CodeEditorMini,
|
|
14
|
+
ConditionRow,
|
|
15
|
+
ConstantInput,
|
|
16
|
+
DBConditionRow,
|
|
17
|
+
DisplayFlowValue,
|
|
18
|
+
DisplayInputsValueAllInTag,
|
|
19
|
+
DisplayInputsValues,
|
|
20
|
+
DisplayOutputs,
|
|
21
|
+
DisplaySchemaTag,
|
|
22
|
+
DisplaySchemaTree,
|
|
23
|
+
DynamicValueInput,
|
|
24
|
+
InjectDynamicValueInput,
|
|
25
|
+
InjectTypeSelector,
|
|
26
|
+
InjectVariableSelector,
|
|
27
|
+
InputsValues,
|
|
28
|
+
InputsValuesTree,
|
|
29
|
+
JsonEditorWithVariables,
|
|
30
|
+
JsonSchemaEditor,
|
|
31
|
+
PromptEditor,
|
|
32
|
+
PromptEditorWithInputs,
|
|
33
|
+
PromptEditorWithVariables,
|
|
34
|
+
TypeSelector,
|
|
35
|
+
VariableSelector,
|
|
36
|
+
VariableSelectorProvider,
|
|
37
|
+
EditorVariableTagInject,
|
|
38
|
+
EditorVariableTree,
|
|
39
|
+
EditorInputsTree,
|
|
40
|
+
getTypeSelectValue,
|
|
41
|
+
parseTypeSelectValue,
|
|
42
|
+
type AssignValueType,
|
|
43
|
+
type CodeEditorPropsType,
|
|
44
|
+
type ConditionRowValueType,
|
|
45
|
+
type ConstantInputStrategy,
|
|
46
|
+
type DBConditionOptionType,
|
|
47
|
+
type DBConditionRowValueType,
|
|
48
|
+
type JsonEditorWithVariablesProps,
|
|
49
|
+
type PromptEditorPropsType,
|
|
50
|
+
type PromptEditorWithInputsProps,
|
|
51
|
+
type PromptEditorWithVariablesProps,
|
|
52
|
+
type TypeSelectorProps,
|
|
53
|
+
type VariableSelectorProps,
|
|
54
|
+
useVariableTree,
|
|
55
|
+
} from './components';
|
|
56
|
+
export {
|
|
57
|
+
autoRenameRefEffect,
|
|
58
|
+
listenRefSchemaChange,
|
|
59
|
+
listenRefValueChange,
|
|
60
|
+
provideBatchInputEffect,
|
|
61
|
+
provideJsonSchemaOutputs,
|
|
62
|
+
syncVariableTitle,
|
|
63
|
+
validateWhenVariableSync,
|
|
64
|
+
} from './effects';
|
|
65
|
+
export {
|
|
66
|
+
createBatchOutputsFormPlugin,
|
|
67
|
+
createInferAssignPlugin,
|
|
68
|
+
createInferInputsPlugin,
|
|
69
|
+
provideBatchOutputsEffect,
|
|
70
|
+
} from './form-plugins';
|
|
71
|
+
export { useObjectList } from './hooks';
|
|
72
|
+
export {
|
|
73
|
+
JsonSchemaTypePresetProvider,
|
|
74
|
+
JsonSchemaUtils,
|
|
75
|
+
createDisableDeclarationPlugin,
|
|
76
|
+
createTypePresetPlugin,
|
|
77
|
+
type ConstantRendererProps,
|
|
78
|
+
type IJsonSchema,
|
|
79
|
+
type JsonSchemaBasicType,
|
|
80
|
+
type JsonSchemaTypeRegistry,
|
|
81
|
+
useTypeManager,
|
|
82
|
+
} from './plugins';
|
|
83
|
+
export {
|
|
84
|
+
FlowValueUtils,
|
|
85
|
+
createInjectMaterial,
|
|
86
|
+
formatLegacyRefOnInit,
|
|
87
|
+
formatLegacyRefOnSubmit,
|
|
88
|
+
formatLegacyRefToNewRef,
|
|
89
|
+
formatNewRefToLegacyRef,
|
|
90
|
+
isLegacyFlowRefValueSchema,
|
|
91
|
+
isNewFlowRefValueSchema,
|
|
92
|
+
lazySuspense,
|
|
93
|
+
polyfillCreateRoot,
|
|
94
|
+
type FlowValueType,
|
|
95
|
+
type IFlowConstantRefValue,
|
|
96
|
+
type IFlowConstantValue,
|
|
97
|
+
type IFlowExpressionValue,
|
|
98
|
+
type IFlowRefValue,
|
|
99
|
+
type IFlowTemplateValue,
|
|
100
|
+
type IFlowValue,
|
|
101
|
+
type IFlowValueExtra,
|
|
102
|
+
type IPolyfillRoot,
|
|
103
|
+
unstableSetCreateRoot,
|
|
104
|
+
withSuspense,
|
|
105
|
+
} from './shared';
|
|
106
|
+
export { validateFlowValue } from './validate';
|
package/src/plugins/index.ts
CHANGED
|
@@ -3,5 +3,14 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export { createDisableDeclarationPlugin } from './disable-declaration-plugin';
|
|
7
|
+
export {
|
|
8
|
+
JsonSchemaTypePresetProvider,
|
|
9
|
+
JsonSchemaUtils,
|
|
10
|
+
createTypePresetPlugin,
|
|
11
|
+
type ConstantRendererProps,
|
|
12
|
+
type IJsonSchema,
|
|
13
|
+
type JsonSchemaBasicType,
|
|
14
|
+
type JsonSchemaTypeRegistry,
|
|
15
|
+
useTypeManager,
|
|
16
|
+
} from './json-schema-preset';
|
|
@@ -33,9 +33,9 @@ export {
|
|
|
33
33
|
createTypePresetPlugin,
|
|
34
34
|
useTypeManager,
|
|
35
35
|
JsonSchemaTypePresetProvider,
|
|
36
|
-
IJsonSchema,
|
|
37
36
|
JsonSchemaUtils,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
type IJsonSchema,
|
|
38
|
+
type JsonSchemaTypeRegistry,
|
|
39
|
+
type ConstantRendererProps,
|
|
40
|
+
type JsonSchemaBasicType,
|
|
41
41
|
};
|
|
@@ -3,4 +3,14 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
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';
|
package/src/shared/index.ts
CHANGED
|
@@ -3,8 +3,29 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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';
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
usePlaygroundContainer,
|
|
12
12
|
} from '@flowgram.ai/editor';
|
|
13
13
|
|
|
14
|
+
type WithRenderKey<T> = T & { renderKey?: string };
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* Creates a material component wrapper with dependency injection support
|
|
16
18
|
*
|
|
@@ -48,12 +50,15 @@ import {
|
|
|
48
50
|
* @returns Wrapper component with dependency injection support
|
|
49
51
|
*/
|
|
50
52
|
export function createInjectMaterial<Props>(
|
|
51
|
-
Component: React.FC<Props>
|
|
53
|
+
Component: WithRenderKey<React.FC<Props> | React.ExoticComponent<Props>>,
|
|
52
54
|
params?: {
|
|
53
55
|
renderKey?: string;
|
|
54
56
|
}
|
|
55
|
-
): React.FC<Props
|
|
56
|
-
|
|
57
|
+
): WithRenderKey<React.FC<Props>> {
|
|
58
|
+
// Determine render key: prioritize param specified, then component renderKey, finally component name
|
|
59
|
+
const renderKey = params?.renderKey || Component.renderKey || Component.name || '';
|
|
60
|
+
|
|
61
|
+
const InjectComponent: WithRenderKey<React.FC<Props>> = (props) => {
|
|
57
62
|
const container = usePlaygroundContainer();
|
|
58
63
|
|
|
59
64
|
// Check if renderer registry is bound in container
|
|
@@ -65,9 +70,6 @@ export function createInjectMaterial<Props>(
|
|
|
65
70
|
// Get renderer registry instance
|
|
66
71
|
const rendererRegistry = container.get(FlowRendererRegistry);
|
|
67
72
|
|
|
68
|
-
// Determine render key: prioritize param specified, then component renderKey, finally component name
|
|
69
|
-
const renderKey = params?.renderKey || Component.renderKey || Component.name || '';
|
|
70
|
-
|
|
71
73
|
// Get corresponding renderer from registry
|
|
72
74
|
const renderer = rendererRegistry.tryToGetRendererComponent(renderKey);
|
|
73
75
|
|
|
@@ -83,5 +85,7 @@ export function createInjectMaterial<Props>(
|
|
|
83
85
|
});
|
|
84
86
|
};
|
|
85
87
|
|
|
88
|
+
InjectComponent.renderKey = renderKey;
|
|
89
|
+
|
|
86
90
|
return InjectComponent;
|
|
87
91
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { isNil } from 'lodash-es';
|
|
7
7
|
import { FeedbackLevel, FlowNodeEntity, getNodeScope } from '@flowgram.ai/editor';
|
|
8
8
|
|
|
9
|
-
import { IFlowValue } from '@/
|
|
9
|
+
import { IFlowValue } from '@/shared';
|
|
10
10
|
import { FlowValueUtils } from '@/shared';
|
|
11
11
|
|
|
12
12
|
interface Context {
|
package/bin/index.ts
DELETED
|
@@ -1,80 +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
|
-
console.log(chalk.bold('These npm dependencies will be added to your project'));
|
|
76
|
-
console.log(packagesToInstall);
|
|
77
|
-
installDependencies(packagesToInstall, projectInfo);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
program.parse(process.argv);
|
package/bin/materials.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import fs from 'fs';
|
|
9
|
-
|
|
10
|
-
import { traverseRecursiveFiles } from './utils/traverse-file';
|
|
11
|
-
import { replaceImport, traverseFileImports } from './utils/import';
|
|
12
|
-
import { ProjectInfo } from './project'; // Import ProjectInfo
|
|
13
|
-
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = path.dirname(__filename);
|
|
16
|
-
|
|
17
|
-
// Added type definitions
|
|
18
|
-
export interface Material {
|
|
19
|
-
name: string;
|
|
20
|
-
type: string;
|
|
21
|
-
path: string;
|
|
22
|
-
[key: string]: any; // For other properties from config.json
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const _types: string[] = [
|
|
26
|
-
'components',
|
|
27
|
-
'effects',
|
|
28
|
-
'plugins',
|
|
29
|
-
'shared',
|
|
30
|
-
'typings',
|
|
31
|
-
'validate',
|
|
32
|
-
'form-plugins',
|
|
33
|
-
'hooks',
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
export function listAllMaterials(): Material[] {
|
|
37
|
-
const _materials: Material[] = [];
|
|
38
|
-
|
|
39
|
-
for (const _type of _types) {
|
|
40
|
-
// 在 Node.js 中,import.meta.dirname 不可用,可使用 import.meta.url 结合 url 模块来获取目录路径
|
|
41
|
-
|
|
42
|
-
const materialsPath: string = path.join(__dirname, '..', 'src', _type);
|
|
43
|
-
_materials.push(
|
|
44
|
-
...fs
|
|
45
|
-
.readdirSync(materialsPath)
|
|
46
|
-
.map((_path: string) => {
|
|
47
|
-
if (_path === 'index.ts') {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
name: _path, // Assuming the folder name is the material name
|
|
53
|
-
type: _type,
|
|
54
|
-
path: path.join(materialsPath, _path),
|
|
55
|
-
} as Material;
|
|
56
|
-
})
|
|
57
|
-
.filter((material): material is Material => material !== null)
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return _materials;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export const getFormMaterialDependencies = (): Record<string, string> => {
|
|
65
|
-
const packageJsonPath: string = path.join(__dirname, '..', 'package.json');
|
|
66
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
67
|
-
|
|
68
|
-
return packageJson.dependencies;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const copyMaterial = (
|
|
72
|
-
material: Material,
|
|
73
|
-
projectInfo: ProjectInfo
|
|
74
|
-
): {
|
|
75
|
-
packagesToInstall: string[];
|
|
76
|
-
} => {
|
|
77
|
-
const formMaterialDependencies = getFormMaterialDependencies();
|
|
78
|
-
|
|
79
|
-
const sourceDir: string = material.path;
|
|
80
|
-
const materialRoot: string = path.join(
|
|
81
|
-
projectInfo.projectPath,
|
|
82
|
-
'src',
|
|
83
|
-
'form-materials',
|
|
84
|
-
`${material.type}`
|
|
85
|
-
);
|
|
86
|
-
const targetDir = path.join(materialRoot, material.name);
|
|
87
|
-
const packagesToInstall: Set<string> = new Set();
|
|
88
|
-
|
|
89
|
-
fs.cpSync(sourceDir, targetDir, { recursive: true });
|
|
90
|
-
|
|
91
|
-
for (const file of traverseRecursiveFiles(targetDir)) {
|
|
92
|
-
if (['.ts', '.tsx'].includes(file.suffix)) {
|
|
93
|
-
for (const importDeclaration of traverseFileImports(file.content)) {
|
|
94
|
-
const { source } = importDeclaration;
|
|
95
|
-
|
|
96
|
-
if (source.startsWith('@/')) {
|
|
97
|
-
// is inner import
|
|
98
|
-
console.log(`Replace Import from ${source} to @flowgram.ai/form-materials`);
|
|
99
|
-
file.replace((content) =>
|
|
100
|
-
replaceImport(content, importDeclaration, [
|
|
101
|
-
{ ...importDeclaration, source: '@flowgram.ai/form-materials' },
|
|
102
|
-
])
|
|
103
|
-
);
|
|
104
|
-
if (projectInfo.flowgramVersion !== 'workspace:*') {
|
|
105
|
-
packagesToInstall.add(`@flowgram.ai/form-materials@${projectInfo.flowgramVersion}`);
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
packagesToInstall.add('@flowgram.ai/form-materials');
|
|
109
|
-
} else if (!source.startsWith('.') && !source.startsWith('react')) {
|
|
110
|
-
// check if is in form material dependencies
|
|
111
|
-
const [dep, version] =
|
|
112
|
-
Object.entries(formMaterialDependencies).find(([_key]) => source.startsWith(_key)) ||
|
|
113
|
-
[];
|
|
114
|
-
if (!dep) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (version === 'workspace:*') {
|
|
118
|
-
if (projectInfo.flowgramVersion !== 'workspace:*') {
|
|
119
|
-
packagesToInstall.add(`${dep}@${projectInfo.flowgramVersion}`);
|
|
120
|
-
} else {
|
|
121
|
-
packagesToInstall.add(dep);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
packagesToInstall.add(`${dep}@${version}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
packagesToInstall: [...packagesToInstall],
|
|
133
|
-
};
|
|
134
|
-
};
|
package/bin/project.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import { execSync } from 'child_process';
|
|
9
|
-
|
|
10
|
-
// Added type definitions
|
|
11
|
-
interface PackageJson {
|
|
12
|
-
dependencies: { [key: string]: string };
|
|
13
|
-
devDependencies?: { [key: string]: string };
|
|
14
|
-
peerDependencies?: { [key: string]: string };
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ProjectInfo {
|
|
19
|
-
projectPath: string;
|
|
20
|
-
packageJsonPath: string;
|
|
21
|
-
packageJson: PackageJson;
|
|
22
|
-
flowgramVersion: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function getProjectInfo(): ProjectInfo {
|
|
26
|
-
// get nearest package.json
|
|
27
|
-
let projectPath: string = process.cwd();
|
|
28
|
-
|
|
29
|
-
while (projectPath !== '/' && !fs.existsSync(path.join(projectPath, 'package.json'))) {
|
|
30
|
-
projectPath = path.join(projectPath, '..');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (projectPath === '/') {
|
|
34
|
-
throw new Error('Please run this command in a valid project');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const packageJsonPath: string = path.join(projectPath, 'package.json');
|
|
38
|
-
const packageJson: PackageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
39
|
-
|
|
40
|
-
// fixed layout or free layout
|
|
41
|
-
const flowgramVersion: string | undefined =
|
|
42
|
-
packageJson.dependencies['@flowgram.ai/fixed-layout-editor'] ||
|
|
43
|
-
packageJson.dependencies['@flowgram.ai/free-layout-editor'] ||
|
|
44
|
-
packageJson.dependencies['@flowgram.ai/editor'];
|
|
45
|
-
|
|
46
|
-
if (!flowgramVersion) {
|
|
47
|
-
throw new Error(
|
|
48
|
-
'Please install @flowgram.ai/fixed-layout-editor or @flowgram.ai/free-layout-editor'
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
projectPath,
|
|
54
|
-
packageJsonPath,
|
|
55
|
-
packageJson,
|
|
56
|
-
flowgramVersion, // TypeScript will ensure this is string due to the check above
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function findRushJson(startPath: string): string | null {
|
|
61
|
-
let currentPath: string = startPath;
|
|
62
|
-
while (currentPath !== '/' && !fs.existsSync(path.join(currentPath, 'rush.json'))) {
|
|
63
|
-
currentPath = path.join(currentPath, '..');
|
|
64
|
-
}
|
|
65
|
-
if (fs.existsSync(path.join(currentPath, 'rush.json'))) {
|
|
66
|
-
return path.join(currentPath, 'rush.json');
|
|
67
|
-
}
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function installDependencies(packages: string[], projectInfo: ProjectInfo): void {
|
|
72
|
-
if (fs.existsSync(path.join(projectInfo.projectPath, 'yarn.lock'))) {
|
|
73
|
-
console.log(`yarn add ${packages.join(' ')}`);
|
|
74
|
-
execSync(`yarn add ${packages.join(' ')}`, { stdio: 'inherit' });
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (fs.existsSync(path.join(projectInfo.projectPath, 'pnpm-lock.yaml'))) {
|
|
79
|
-
console.log(`pnpm add ${packages.join(' ')}`);
|
|
80
|
-
execSync(`pnpm add ${packages.join(' ')}`, { stdio: 'inherit' });
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// rush monorepo
|
|
85
|
-
if (findRushJson(projectInfo.projectPath)) {
|
|
86
|
-
console.log(`rush add ${packages.map((pkg) => `--package ${pkg}`).join(' ')}`);
|
|
87
|
-
execSync(`rush add ${packages.map((pkg) => `--package ${pkg}`).join(' ')}`, {
|
|
88
|
-
stdio: 'inherit',
|
|
89
|
-
});
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
console.log(`npm install ${packages.join(' ')}`);
|
|
94
|
-
execSync(`npm install ${packages.join(' ')}`, { stdio: 'inherit' });
|
|
95
|
-
}
|