@flowgram.ai/form-materials 0.4.9 → 0.4.10
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 +19 -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/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/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 +50 -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 +2 -2
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +3 -3
- 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/extensions/inputs-tree.tsx +4 -4
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +3 -3
- 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 +98 -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/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/{typings/flow-value/index.ts → shared/flow-value/types.ts} +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import styled_components, { css } from "styled-components";
|
|
4
|
+
import semi_icons from "@douyinfe/semi-icons";
|
|
5
|
+
const UIContainer = styled_components.div`
|
|
6
|
+
/* & .semi-input {
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
border-radius: 6px;
|
|
9
|
+
height: 24px;
|
|
10
|
+
} */
|
|
11
|
+
`;
|
|
12
|
+
const UIRow = styled_components.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 6px;
|
|
16
|
+
`;
|
|
17
|
+
const UICollapseTrigger = styled_components.div`
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
margin-right: 5px;
|
|
20
|
+
`;
|
|
21
|
+
const UIExpandDetail = styled_components.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
`;
|
|
25
|
+
const UILabel = styled_components.div`
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
color: #999;
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
margin-bottom: 2px;
|
|
30
|
+
`;
|
|
31
|
+
const UITreeItems = styled_components.div`
|
|
32
|
+
display: grid;
|
|
33
|
+
grid-template-columns: auto 1fr;
|
|
34
|
+
|
|
35
|
+
${({ $shrink })=>$shrink && css`
|
|
36
|
+
padding-left: 3px;
|
|
37
|
+
margin-top: 10px;
|
|
38
|
+
`}
|
|
39
|
+
`;
|
|
40
|
+
const UITreeItemLeft = styled_components.div`
|
|
41
|
+
grid-column: 1;
|
|
42
|
+
position: relative;
|
|
43
|
+
width: 16px;
|
|
44
|
+
|
|
45
|
+
${({ $showLine, $isLast, $showCollapse })=>{
|
|
46
|
+
let height = $isLast ? '24px' : '100%';
|
|
47
|
+
let width = $showCollapse ? '12px' : '30px';
|
|
48
|
+
return $showLine && css`
|
|
49
|
+
&::before {
|
|
50
|
+
/* 竖线 */
|
|
51
|
+
content: '';
|
|
52
|
+
height: ${height};
|
|
53
|
+
position: absolute;
|
|
54
|
+
left: -14px;
|
|
55
|
+
top: -16px;
|
|
56
|
+
width: 1px;
|
|
57
|
+
background: #d9d9d9;
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&::after {
|
|
62
|
+
/* 横线 */
|
|
63
|
+
content: '';
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: -14px; // 横线起点和竖线对齐
|
|
66
|
+
top: 8px; // 跟随你的行高调整
|
|
67
|
+
width: ${width}; // 横线长度
|
|
68
|
+
height: 1px;
|
|
69
|
+
background: #d9d9d9;
|
|
70
|
+
display: block;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
}}
|
|
74
|
+
`;
|
|
75
|
+
const UITreeItemRight = styled_components.div`
|
|
76
|
+
grid-column: 2;
|
|
77
|
+
margin-bottom: 10px;
|
|
78
|
+
|
|
79
|
+
&:last-child {
|
|
80
|
+
margin-bottom: 0px;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
const UITreeItemMain = styled_components.div`
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
gap: 10px;
|
|
87
|
+
position: relative;
|
|
88
|
+
`;
|
|
89
|
+
const UICollapsible = styled_components.div`
|
|
90
|
+
display: none;
|
|
91
|
+
|
|
92
|
+
${({ $collapse })=>$collapse && css`
|
|
93
|
+
display: block;
|
|
94
|
+
`}
|
|
95
|
+
`;
|
|
96
|
+
const UIName = styled_components.div`
|
|
97
|
+
flex-grow: 1;
|
|
98
|
+
`;
|
|
99
|
+
const UIType = styled_components.div``;
|
|
100
|
+
const UIRequired = styled_components.div``;
|
|
101
|
+
const UIActions = styled_components.div`
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
`;
|
|
104
|
+
const iconAddChildrenSvg = /*#__PURE__*/ jsxs("svg", {
|
|
105
|
+
className: "icon-icon icon-icon-coz_add_node ",
|
|
106
|
+
width: "1em",
|
|
107
|
+
height: "1em",
|
|
108
|
+
viewBox: "0 0 24 24",
|
|
109
|
+
fill: "currentColor",
|
|
110
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ jsx("path", {
|
|
113
|
+
fillRule: "evenodd",
|
|
114
|
+
clipRule: "evenodd",
|
|
115
|
+
d: "M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
|
|
116
|
+
}),
|
|
117
|
+
/*#__PURE__*/ jsx("path", {
|
|
118
|
+
d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z"
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
const IconAddChildren = ()=>/*#__PURE__*/ jsx(semi_icons, {
|
|
123
|
+
size: "small",
|
|
124
|
+
svg: iconAddChildrenSvg
|
|
125
|
+
});
|
|
126
|
+
const DefaultValueWrapper = styled_components.div`
|
|
127
|
+
margin: 0;
|
|
128
|
+
`;
|
|
129
|
+
const ConstantInputWrapper = styled_components.div`
|
|
130
|
+
flex-grow: 1;
|
|
131
|
+
|
|
132
|
+
& .semi-tree-select,
|
|
133
|
+
& .semi-input-number,
|
|
134
|
+
& .semi-select {
|
|
135
|
+
width: 100%;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
export { ConstantInputWrapper, DefaultValueWrapper, IconAddChildren, UIActions, UICollapseTrigger, UICollapsible, UIContainer, UIExpandDetail, UILabel, UIName, UIRequired, UIRow, UITreeItemLeft, UITreeItemMain, UITreeItemRight, UITreeItems, UIType };
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { ActiveLinePlaceholder, EditorProvider, Renderer } from "@flowgram.ai/coze-editor/react";
|
|
4
|
+
import preset_prompt from "@flowgram.ai/coze-editor/preset-prompt";
|
|
5
|
+
import { UIContainer } from "./styles.mjs";
|
|
6
|
+
import markdown from "./extensions/markdown.mjs";
|
|
7
|
+
import language_support from "./extensions/language-support.mjs";
|
|
8
|
+
import jinja from "./extensions/jinja.mjs";
|
|
9
|
+
function PromptEditor(props) {
|
|
10
|
+
const { value, onChange, readonly, placeholder, activeLinePlaceholder, style, hasError, children, disableMarkdownHighlight, options } = props || {};
|
|
11
|
+
const editorRef = useRef(null);
|
|
12
|
+
useEffect(()=>{
|
|
13
|
+
if (editorRef.current?.getValue() !== value?.content) editorRef.current?.setValue(String(value?.content || ''));
|
|
14
|
+
}, [
|
|
15
|
+
value
|
|
16
|
+
]);
|
|
17
|
+
return /*#__PURE__*/ jsx(UIContainer, {
|
|
18
|
+
$hasError: hasError,
|
|
19
|
+
style: style,
|
|
20
|
+
children: /*#__PURE__*/ jsxs(EditorProvider, {
|
|
21
|
+
children: [
|
|
22
|
+
/*#__PURE__*/ jsx(Renderer, {
|
|
23
|
+
didMount: (editor)=>{
|
|
24
|
+
editorRef.current = editor;
|
|
25
|
+
},
|
|
26
|
+
plugins: preset_prompt,
|
|
27
|
+
defaultValue: String(value?.content),
|
|
28
|
+
options: {
|
|
29
|
+
readOnly: readonly,
|
|
30
|
+
editable: !readonly,
|
|
31
|
+
placeholder,
|
|
32
|
+
...options
|
|
33
|
+
},
|
|
34
|
+
onChange: (e)=>{
|
|
35
|
+
onChange({
|
|
36
|
+
type: 'template',
|
|
37
|
+
content: e.value
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
activeLinePlaceholder && /*#__PURE__*/ jsx(ActiveLinePlaceholder, {
|
|
42
|
+
children: activeLinePlaceholder
|
|
43
|
+
}),
|
|
44
|
+
!disableMarkdownHighlight && /*#__PURE__*/ jsx(markdown, {}),
|
|
45
|
+
/*#__PURE__*/ jsx(language_support, {}),
|
|
46
|
+
/*#__PURE__*/ jsx(jinja, {}),
|
|
47
|
+
children
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export { PromptEditor };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { useInjector } from "@flowgram.ai/coze-editor/react";
|
|
3
|
+
import { astDecorator } from "@flowgram.ai/coze-editor";
|
|
4
|
+
import { EditorView } from "@codemirror/view";
|
|
5
|
+
function JinjaHighlight() {
|
|
6
|
+
const injector = useInjector();
|
|
7
|
+
useLayoutEffect(()=>injector.inject([
|
|
8
|
+
astDecorator.whole.of((cursor)=>{
|
|
9
|
+
if ('JinjaStatementStart' === cursor.name || 'JinjaStatementEnd' === cursor.name) return {
|
|
10
|
+
type: 'className',
|
|
11
|
+
className: 'jinja-statement-bracket'
|
|
12
|
+
};
|
|
13
|
+
if ('JinjaComment' === cursor.name) return {
|
|
14
|
+
type: 'className',
|
|
15
|
+
className: 'jinja-comment'
|
|
16
|
+
};
|
|
17
|
+
if ('JinjaExpression' === cursor.name) return {
|
|
18
|
+
type: 'className',
|
|
19
|
+
className: 'jinja-expression'
|
|
20
|
+
};
|
|
21
|
+
}),
|
|
22
|
+
EditorView.theme({
|
|
23
|
+
'.jinja-statement-bracket': {
|
|
24
|
+
color: '#D1009D'
|
|
25
|
+
},
|
|
26
|
+
'.jinja-comment': {
|
|
27
|
+
color: '#0607094D'
|
|
28
|
+
},
|
|
29
|
+
'.jinja-expression': {
|
|
30
|
+
color: '#4E40E5'
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
]), [
|
|
34
|
+
injector
|
|
35
|
+
]);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const jinja = JinjaHighlight;
|
|
39
|
+
export { jinja as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { useInjector } from "@flowgram.ai/coze-editor/react";
|
|
3
|
+
import { languageSupport } from "@flowgram.ai/coze-editor/preset-prompt";
|
|
4
|
+
function LanguageSupport() {
|
|
5
|
+
const injector = useInjector();
|
|
6
|
+
useLayoutEffect(()=>injector.inject([
|
|
7
|
+
languageSupport
|
|
8
|
+
]), [
|
|
9
|
+
injector
|
|
10
|
+
]);
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const language_support = LanguageSupport;
|
|
14
|
+
export { language_support as default };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { useInjector } from "@flowgram.ai/coze-editor/react";
|
|
3
|
+
import { astDecorator } from "@flowgram.ai/coze-editor";
|
|
4
|
+
import { EditorView } from "@codemirror/view";
|
|
5
|
+
function MarkdownHighlight() {
|
|
6
|
+
const injector = useInjector();
|
|
7
|
+
useLayoutEffect(()=>injector.inject([
|
|
8
|
+
astDecorator.whole.of((cursor)=>{
|
|
9
|
+
if (cursor.name.startsWith('ATXHeading')) return {
|
|
10
|
+
type: 'className',
|
|
11
|
+
className: 'heading'
|
|
12
|
+
};
|
|
13
|
+
if ('Emphasis' === cursor.name) return {
|
|
14
|
+
type: 'className',
|
|
15
|
+
className: 'emphasis'
|
|
16
|
+
};
|
|
17
|
+
if ('StrongEmphasis' === cursor.name) return {
|
|
18
|
+
type: 'className',
|
|
19
|
+
className: 'strong-emphasis'
|
|
20
|
+
};
|
|
21
|
+
if ('ListMark' === cursor.name || 'QuoteMark' === cursor.name) return {
|
|
22
|
+
type: 'className',
|
|
23
|
+
className: 'mark'
|
|
24
|
+
};
|
|
25
|
+
}),
|
|
26
|
+
EditorView.theme({
|
|
27
|
+
'.heading': {
|
|
28
|
+
color: '#00818C',
|
|
29
|
+
fontWeight: 'bold'
|
|
30
|
+
},
|
|
31
|
+
'.emphasis': {
|
|
32
|
+
fontStyle: 'italic'
|
|
33
|
+
},
|
|
34
|
+
'.strong-emphasis': {
|
|
35
|
+
fontWeight: 'bold'
|
|
36
|
+
},
|
|
37
|
+
'.mark': {
|
|
38
|
+
color: '#4E40E5'
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
]), [
|
|
42
|
+
injector
|
|
43
|
+
]);
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const markdown = MarkdownHighlight;
|
|
47
|
+
export { markdown as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled_components, { css } from "styled-components";
|
|
2
|
+
const UIContainer = styled_components.div`
|
|
3
|
+
background-color: var(--semi-color-fill-0);
|
|
4
|
+
padding-left: 10px;
|
|
5
|
+
padding-right: 6px;
|
|
6
|
+
|
|
7
|
+
${({ $hasError })=>$hasError && css`
|
|
8
|
+
border: 1px solid var(--semi-color-danger-6);
|
|
9
|
+
`}
|
|
10
|
+
`;
|
|
11
|
+
export { UIContainer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "react";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { PromptEditor } from "../prompt-editor/index.mjs";
|
|
4
|
+
import { InputsTree } from "./extensions/inputs-tree.mjs";
|
|
5
|
+
function PromptEditorWithInputs({ inputsValues, ...restProps }) {
|
|
6
|
+
return /*#__PURE__*/ jsx(PromptEditor, {
|
|
7
|
+
...restProps,
|
|
8
|
+
children: /*#__PURE__*/ jsx(InputsTree, {
|
|
9
|
+
inputsValues: inputsValues
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export { PromptEditorWithInputs };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Mention, PositionMirror, getCurrentMentionReplaceRange, useEditor } from "@flowgram.ai/coze-editor/react";
|
|
4
|
+
import { Popover } from "@douyinfe/semi-ui";
|
|
5
|
+
import { InputsPicker } from "../inputs-picker.mjs";
|
|
6
|
+
function InputsTree({ inputsValues }) {
|
|
7
|
+
const [posKey, setPosKey] = useState('');
|
|
8
|
+
const [visible, setVisible] = useState(false);
|
|
9
|
+
const [position, setPosition] = useState(-1);
|
|
10
|
+
const editor = useEditor();
|
|
11
|
+
function insert(variablePath) {
|
|
12
|
+
const range = getCurrentMentionReplaceRange(editor.$view.state);
|
|
13
|
+
if (!range) return;
|
|
14
|
+
let { from, to } = range;
|
|
15
|
+
while('{' === editor.$view.state.doc.sliceString(from - 1, from))from--;
|
|
16
|
+
while('}' === editor.$view.state.doc.sliceString(to, to + 1))to++;
|
|
17
|
+
editor.replaceText({
|
|
18
|
+
...range,
|
|
19
|
+
text: '{{' + variablePath + '}}'
|
|
20
|
+
});
|
|
21
|
+
setVisible(false);
|
|
22
|
+
}
|
|
23
|
+
function handleOpenChange(e) {
|
|
24
|
+
setPosition(e.state.selection.main.head);
|
|
25
|
+
setVisible(e.value);
|
|
26
|
+
}
|
|
27
|
+
useEffect(()=>{
|
|
28
|
+
if (!editor) return;
|
|
29
|
+
}, [
|
|
30
|
+
editor,
|
|
31
|
+
visible
|
|
32
|
+
]);
|
|
33
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ jsx(Mention, {
|
|
36
|
+
triggerCharacters: [
|
|
37
|
+
'{',
|
|
38
|
+
'{}',
|
|
39
|
+
'@'
|
|
40
|
+
],
|
|
41
|
+
onOpenChange: handleOpenChange
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ jsx(Popover, {
|
|
44
|
+
visible: visible,
|
|
45
|
+
trigger: "custom",
|
|
46
|
+
position: "topLeft",
|
|
47
|
+
rePosKey: posKey,
|
|
48
|
+
content: /*#__PURE__*/ jsx("div", {
|
|
49
|
+
style: {
|
|
50
|
+
width: 300
|
|
51
|
+
},
|
|
52
|
+
children: /*#__PURE__*/ jsx(InputsPicker, {
|
|
53
|
+
inputsValues: inputsValues,
|
|
54
|
+
onSelect: (v)=>{
|
|
55
|
+
insert(v);
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
children: /*#__PURE__*/ jsx(PositionMirror, {
|
|
60
|
+
position: position,
|
|
61
|
+
onChange: ()=>setPosKey(String(Math.random()))
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export { InputsTree };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { isPlainObject, last } from "lodash-es";
|
|
4
|
+
import { ASTMatch, useScopeAvailable } from "@flowgram.ai/editor";
|
|
5
|
+
import { Tree } from "@douyinfe/semi-ui";
|
|
6
|
+
import { FlowValueUtils } from "../../shared/index.mjs";
|
|
7
|
+
function InputsPicker({ inputsValues, onSelect }) {
|
|
8
|
+
const available = useScopeAvailable();
|
|
9
|
+
const getArrayDrilldown = (type, depth = 1)=>{
|
|
10
|
+
if (ASTMatch.isArray(type.items)) return getArrayDrilldown(type.items, depth + 1);
|
|
11
|
+
return {
|
|
12
|
+
type: type.items,
|
|
13
|
+
depth: depth
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const renderVariable = (variable, keyPath)=>{
|
|
17
|
+
let type = variable?.type;
|
|
18
|
+
let children;
|
|
19
|
+
if (ASTMatch.isObject(type)) children = (type.properties || []).map((_property)=>renderVariable(_property, [
|
|
20
|
+
...keyPath,
|
|
21
|
+
_property.key
|
|
22
|
+
])).filter(Boolean);
|
|
23
|
+
if (ASTMatch.isArray(type)) {
|
|
24
|
+
const drilldown = getArrayDrilldown(type);
|
|
25
|
+
if (ASTMatch.isObject(drilldown.type)) children = (drilldown.type.properties || []).map((_property)=>renderVariable(_property, [
|
|
26
|
+
...keyPath,
|
|
27
|
+
...new Array(drilldown.depth).fill('[0]'),
|
|
28
|
+
_property.key
|
|
29
|
+
])).filter(Boolean);
|
|
30
|
+
}
|
|
31
|
+
const key = keyPath.map((_key, idx)=>'[0]' === _key || 0 === idx ? _key : `.${_key}`).join('');
|
|
32
|
+
return {
|
|
33
|
+
key: key,
|
|
34
|
+
label: last(keyPath),
|
|
35
|
+
value: key,
|
|
36
|
+
children
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const getTreeData = (value, keyPath)=>{
|
|
40
|
+
const currKey = keyPath.join('.');
|
|
41
|
+
if (FlowValueUtils.isFlowValue(value)) {
|
|
42
|
+
if (FlowValueUtils.isRef(value)) {
|
|
43
|
+
const variable = available.getByKeyPath(value.content || []);
|
|
44
|
+
if (variable) return renderVariable(variable, keyPath);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
key: currKey,
|
|
48
|
+
value: currKey,
|
|
49
|
+
label: last(keyPath)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (isPlainObject(value)) return {
|
|
53
|
+
key: currKey,
|
|
54
|
+
value: currKey,
|
|
55
|
+
label: last(keyPath),
|
|
56
|
+
children: Object.entries(value).map(([key, value])=>getTreeData(value, [
|
|
57
|
+
...keyPath,
|
|
58
|
+
key
|
|
59
|
+
])).filter(Boolean)
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const treeData = useMemo(()=>Object.entries(inputsValues).map(([key, value])=>getTreeData(value, [
|
|
63
|
+
key
|
|
64
|
+
])).filter(Boolean), []);
|
|
65
|
+
return /*#__PURE__*/ jsx(Tree, {
|
|
66
|
+
treeData: treeData,
|
|
67
|
+
onSelect: (v)=>onSelect(v)
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export { InputsPicker };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { PromptEditor } from "../prompt-editor/index.mjs";
|
|
4
|
+
import { VariableTree } from "./extensions/variable-tree.mjs";
|
|
5
|
+
import { VariableTagInject } from "./extensions/variable-tag.mjs";
|
|
6
|
+
function PromptEditorWithVariables(props) {
|
|
7
|
+
return /*#__PURE__*/ jsxs(PromptEditor, {
|
|
8
|
+
...props,
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ jsx(VariableTree, {}),
|
|
11
|
+
/*#__PURE__*/ jsx(VariableTagInject, {})
|
|
12
|
+
]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { PromptEditorWithVariables };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect } from "react";
|
|
3
|
+
import { isEqual, last } from "lodash-es";
|
|
4
|
+
import { Disposable, DisposableCollection, useCurrentScope } from "@flowgram.ai/editor";
|
|
5
|
+
import { useInjector } from "@flowgram.ai/coze-editor/react";
|
|
6
|
+
import { Popover } from "@douyinfe/semi-ui";
|
|
7
|
+
import { IconIssueStroked } from "@douyinfe/semi-icons";
|
|
8
|
+
import { Decoration, EditorView, MatchDecorator, ViewPlugin, WidgetType } from "@codemirror/view";
|
|
9
|
+
import { polyfillCreateRoot } from "../../../shared/index.mjs";
|
|
10
|
+
import { UIPopoverContent, UIRootTitle, UITag, UIVarName } from "../styles.mjs";
|
|
11
|
+
class VariableTagWidget extends WidgetType {
|
|
12
|
+
constructor({ keyPath, scope }){
|
|
13
|
+
super(), this.toDispose = new DisposableCollection(), this.renderIcon = (icon)=>{
|
|
14
|
+
if ('string' == typeof icon) return /*#__PURE__*/ jsx("img", {
|
|
15
|
+
style: {
|
|
16
|
+
marginRight: 8
|
|
17
|
+
},
|
|
18
|
+
width: 12,
|
|
19
|
+
height: 12,
|
|
20
|
+
src: icon
|
|
21
|
+
});
|
|
22
|
+
return icon;
|
|
23
|
+
};
|
|
24
|
+
this.keyPath = keyPath;
|
|
25
|
+
this.scope = scope;
|
|
26
|
+
}
|
|
27
|
+
renderVariable(v) {
|
|
28
|
+
if (!v) return void this.root.render(/*#__PURE__*/ jsx(UITag, {
|
|
29
|
+
prefixIcon: /*#__PURE__*/ jsx(IconIssueStroked, {}),
|
|
30
|
+
color: "amber",
|
|
31
|
+
children: "Unknown"
|
|
32
|
+
}));
|
|
33
|
+
const rootField = last(v.parentFields);
|
|
34
|
+
const rootTitle = /*#__PURE__*/ jsx(UIRootTitle, {
|
|
35
|
+
children: rootField?.meta.title ? `${rootField.meta.title} -` : ''
|
|
36
|
+
});
|
|
37
|
+
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
38
|
+
this.root.render(/*#__PURE__*/ jsx(Popover, {
|
|
39
|
+
content: /*#__PURE__*/ jsxs(UIPopoverContent, {
|
|
40
|
+
children: [
|
|
41
|
+
rootIcon,
|
|
42
|
+
rootTitle,
|
|
43
|
+
/*#__PURE__*/ jsx(UIVarName, {
|
|
44
|
+
children: v?.keyPath.slice(1).join('.')
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
children: /*#__PURE__*/ jsxs(UITag, {
|
|
49
|
+
prefixIcon: rootIcon,
|
|
50
|
+
children: [
|
|
51
|
+
rootTitle,
|
|
52
|
+
/*#__PURE__*/ jsx(UIVarName, {
|
|
53
|
+
children: v?.key
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
toDOM(view) {
|
|
60
|
+
const dom = document.createElement('span');
|
|
61
|
+
this.root = polyfillCreateRoot(dom);
|
|
62
|
+
this.toDispose.push(Disposable.create(()=>{
|
|
63
|
+
this.root.unmount();
|
|
64
|
+
}));
|
|
65
|
+
this.toDispose.push(this.scope.available.trackByKeyPath(this.keyPath, (v)=>{
|
|
66
|
+
this.renderVariable(v);
|
|
67
|
+
}, {
|
|
68
|
+
triggerOnInit: false
|
|
69
|
+
}));
|
|
70
|
+
this.renderVariable(this.scope.available.getByKeyPath(this.keyPath));
|
|
71
|
+
return dom;
|
|
72
|
+
}
|
|
73
|
+
eq(other) {
|
|
74
|
+
return isEqual(this.keyPath, other.keyPath);
|
|
75
|
+
}
|
|
76
|
+
ignoreEvent() {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
destroy(dom) {
|
|
80
|
+
this.toDispose.dispose();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function VariableTagInject() {
|
|
84
|
+
const injector = useInjector();
|
|
85
|
+
const scope = useCurrentScope();
|
|
86
|
+
useLayoutEffect(()=>{
|
|
87
|
+
const atMatcher = new MatchDecorator({
|
|
88
|
+
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
89
|
+
decoration: (match)=>Decoration.replace({
|
|
90
|
+
widget: new VariableTagWidget({
|
|
91
|
+
keyPath: match[1]?.split('.') ?? [],
|
|
92
|
+
scope
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
return injector.inject([
|
|
97
|
+
ViewPlugin.fromClass(class {
|
|
98
|
+
constructor(view){
|
|
99
|
+
this.view = view;
|
|
100
|
+
this.decorations = atMatcher.createDeco(view);
|
|
101
|
+
}
|
|
102
|
+
update() {
|
|
103
|
+
this.decorations = atMatcher.createDeco(this.view);
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
decorations: (p)=>p.decorations,
|
|
107
|
+
provide (p) {
|
|
108
|
+
return EditorView.atomicRanges.of((view)=>view.plugin(p)?.decorations ?? Decoration.none);
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
]);
|
|
112
|
+
}, [
|
|
113
|
+
injector
|
|
114
|
+
]);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
export { VariableTagInject };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Mention, PositionMirror, getCurrentMentionReplaceRange, useEditor } from "@flowgram.ai/coze-editor/react";
|
|
4
|
+
import { Popover, Tree } from "@douyinfe/semi-ui";
|
|
5
|
+
import { useVariableTree } from "../../variable-selector/index.mjs";
|
|
6
|
+
function VariableTree() {
|
|
7
|
+
const [posKey, setPosKey] = useState('');
|
|
8
|
+
const [visible, setVisible] = useState(false);
|
|
9
|
+
const [position, setPosition] = useState(-1);
|
|
10
|
+
const editor = useEditor();
|
|
11
|
+
function insert(variablePath) {
|
|
12
|
+
const range = getCurrentMentionReplaceRange(editor.$view.state);
|
|
13
|
+
if (!range) return;
|
|
14
|
+
let { from, to } = range;
|
|
15
|
+
while('{' === editor.$view.state.doc.sliceString(from - 1, from))from--;
|
|
16
|
+
while('}' === editor.$view.state.doc.sliceString(to, to + 1))to++;
|
|
17
|
+
editor.replaceText({
|
|
18
|
+
from,
|
|
19
|
+
to,
|
|
20
|
+
text: '{{' + variablePath + '}}'
|
|
21
|
+
});
|
|
22
|
+
setVisible(false);
|
|
23
|
+
}
|
|
24
|
+
function handleOpenChange(e) {
|
|
25
|
+
setPosition(e.state.selection.main.head);
|
|
26
|
+
setVisible(e.value);
|
|
27
|
+
}
|
|
28
|
+
useEffect(()=>{
|
|
29
|
+
if (!editor) return;
|
|
30
|
+
}, [
|
|
31
|
+
editor,
|
|
32
|
+
visible
|
|
33
|
+
]);
|
|
34
|
+
const treeData = useVariableTree({});
|
|
35
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ jsx(Mention, {
|
|
38
|
+
triggerCharacters: [
|
|
39
|
+
'{',
|
|
40
|
+
'{}',
|
|
41
|
+
'@'
|
|
42
|
+
],
|
|
43
|
+
onOpenChange: handleOpenChange
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ jsx(Popover, {
|
|
46
|
+
visible: visible,
|
|
47
|
+
trigger: "custom",
|
|
48
|
+
position: "topLeft",
|
|
49
|
+
rePosKey: posKey,
|
|
50
|
+
content: /*#__PURE__*/ jsx("div", {
|
|
51
|
+
style: {
|
|
52
|
+
width: 300
|
|
53
|
+
},
|
|
54
|
+
children: /*#__PURE__*/ jsx(Tree, {
|
|
55
|
+
treeData: treeData,
|
|
56
|
+
onSelect: (v)=>{
|
|
57
|
+
insert(v);
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
children: /*#__PURE__*/ jsx(PositionMirror, {
|
|
62
|
+
position: position,
|
|
63
|
+
onChange: ()=>setPosKey(String(Math.random()))
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export { VariableTree };
|