@cozeloop/prompt-components 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/basic-editor/custom-facet.js +9 -0
- package/dist/es/basic-editor/diff.js +138 -0
- package/dist/{go-syntax-067c4f5d.mjs → es/basic-editor/extensions/go-syntax.js} +9 -16
- package/dist/es/basic-editor/extensions/go-template.js +16 -0
- package/dist/{go-theme-062a6df6.mjs → es/basic-editor/extensions/go-theme.js} +4 -3
- package/dist/es/basic-editor/extensions/jinja.js +80 -0
- package/dist/es/basic-editor/extensions/keymap.js +442 -0
- package/dist/es/basic-editor/extensions/language-support.js +12 -0
- package/dist/es/basic-editor/extensions/markdown.js +58 -0
- package/dist/es/basic-editor/extensions/search/dom/icon.js +250 -0
- package/dist/es/basic-editor/extensions/search/dom/match-count.js +33 -0
- package/dist/es/basic-editor/extensions/search/index.js +18 -0
- package/dist/es/basic-editor/extensions/search/panel.js +418 -0
- package/dist/es/basic-editor/extensions/search/theme.js +184 -0
- package/dist/es/basic-editor/extensions/validation.js +84 -0
- package/dist/es/basic-editor/extensions/validation.module.js +5 -0
- package/dist/es/basic-editor/extensions/validation_module.css +7 -0
- package/dist/es/basic-editor/extensions/variable.js +178 -0
- package/dist/es/basic-editor/index.js +171 -0
- package/dist/es/code-editor/code-editor.js +83 -0
- package/dist/es/code-editor/index.js +12 -0
- package/dist/es/code-editor/json-editor.js +157 -0
- package/dist/es/code-editor/raw-text-editor.js +46 -0
- package/dist/es/code-editor/text-editor.js +41 -0
- package/dist/es/code-editor/themes/coze-dark.js +112 -0
- package/dist/es/code-editor/themes/coze-light.js +118 -0
- package/dist/es/consts/index.js +12 -0
- package/dist/es/dev-layout/index.js +35 -0
- package/dist/es/idls/fornax_ml_flow/index.js +2322 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/ai_annotate.js +41 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/aidpcallback.js +108 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/annotation_job.js +52 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/base.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/batch_infer.js +72 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/dataprocess.js +10 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/dataset.js +36 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/datasetv2.js +139 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/datasetv2job.js +40 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/datasetv2lineage.js +25 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/datasetv2similarity.js +12 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/filter.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/flow_devops_evaluation_callback_common.js +36 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/flow_devops_prompt_common.js +318 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/fornax_domain_model.js +326 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/ml_flow_domain_model.js +327 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/openapi.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_annotateservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_annotationjobservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_batchinferservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_crowdsourcingannotationjobservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_dataprocessservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_datasetservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_datasetservicev2.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_modelservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_annotationjobservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_batchinferservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_datasetservicev2.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_tagservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow/namespaces/tag.js +33 -0
- package/dist/es/idls/prompt_api/index.js +2009 -0
- package/dist/es/idls/prompt_api/namespaces/base.js +0 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_callback.js +35 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_commercial_openapi.js +0 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_common.js +318 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_debug.js +0 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_manage.js +23 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_mcp.js +0 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_optimize.js +0 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_paas.js +43 -0
- package/dist/es/idls/prompt_api/namespaces/flow_devops_prompt_platform.js +0 -0
- package/dist/es/idls/prompt_api/namespaces/mcp.js +9 -0
- package/dist/es/idls/prompt_api/namespaces/model.js +320 -0
- package/dist/es/idls/prompt_api/namespaces/permission.js +47 -0
- package/dist/es/idls/prompt_api/namespaces/release.js +25 -0
- package/dist/es/index.js +66 -0
- package/dist/es/mermaid-diagram/index.js +148 -0
- package/dist/es/mermaid-diagram/index.module.js +5 -0
- package/dist/es/mermaid-diagram/index_module.css +4 -0
- package/dist/es/mermaid-diagram/use-svg-pan-zoom.js +49 -0
- package/dist/es/mermaid-diagram/utils.js +74 -0
- package/dist/es/model-config-editor/basic-type.js +73 -0
- package/dist/es/model-config-editor/index.module.js +5 -0
- package/dist/es/model-config-editor/index_module.css +8 -0
- package/dist/es/model-config-editor/model-config-form.js +130 -0
- package/dist/es/model-config-editor/popover-type.js +118 -0
- package/dist/es/model-select/index.js +136 -0
- package/dist/es/model-select/index.module.js +5 -0
- package/dist/es/model-select/index_module.css +14 -0
- package/dist/es/model-select/model-option/index.js +161 -0
- package/dist/es/model-select/model-option/index.module.js +5 -0
- package/dist/es/model-select/model-option/index_module.css +23 -0
- package/dist/es/model-select/model-option-group/index.js +44 -0
- package/dist/es/prompt-editor/index.js +188 -0
- package/dist/es/prompt-editor/index.module.js +5 -0
- package/dist/es/prompt-editor/index_module.css +71 -0
- package/dist/es/prompt-editor/message-type-select.js +74 -0
- package/dist/es/schema-editor/index.js +43 -0
- package/dist/es/utils/base.js +53 -0
- package/dist/es/utils/model-config.js +32 -0
- package/dist/lib/basic-editor/custom-facet.js +33 -0
- package/dist/lib/basic-editor/diff.js +167 -0
- package/dist/lib/basic-editor/extensions/go-syntax.js +146 -0
- package/dist/lib/basic-editor/extensions/go-template.js +50 -0
- package/dist/lib/basic-editor/extensions/go-theme.js +1091 -0
- package/dist/lib/basic-editor/extensions/jinja.js +100 -0
- package/dist/lib/basic-editor/extensions/keymap.js +465 -0
- package/dist/lib/basic-editor/extensions/language-support.js +32 -0
- package/dist/lib/basic-editor/extensions/markdown.js +78 -0
- package/dist/lib/basic-editor/extensions/search/dom/icon.js +291 -0
- package/dist/lib/basic-editor/extensions/search/dom/match-count.js +67 -0
- package/dist/lib/basic-editor/extensions/search/index.js +38 -0
- package/dist/lib/basic-editor/extensions/search/panel.js +429 -0
- package/dist/lib/basic-editor/extensions/search/theme.js +208 -0
- package/dist/lib/basic-editor/extensions/validation.js +118 -0
- package/dist/lib/basic-editor/extensions/validation.module.js +25 -0
- package/dist/lib/basic-editor/extensions/validation_module.css +7 -0
- package/dist/lib/basic-editor/extensions/variable.js +190 -0
- package/dist/lib/basic-editor/index.js +193 -0
- package/dist/lib/code-editor/code-editor.js +117 -0
- package/dist/lib/code-editor/index.js +40 -0
- package/dist/lib/code-editor/json-editor.js +184 -0
- package/dist/lib/code-editor/raw-text-editor.js +70 -0
- package/dist/lib/code-editor/text-editor.js +75 -0
- package/dist/lib/code-editor/themes/coze-dark.js +136 -0
- package/dist/lib/code-editor/themes/coze-light.js +142 -0
- package/dist/lib/consts/index.js +38 -0
- package/dist/lib/dev-layout/index.js +69 -0
- package/dist/lib/idls/fornax_ml_flow/index.js +2414 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/ai_annotate.js +69 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/aidpcallback.js +140 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/annotation_job.js +82 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/base.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/batch_infer.js +105 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/dataprocess.js +34 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/dataset.js +63 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/datasetv2.js +177 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/datasetv2job.js +68 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/datasetv2lineage.js +50 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/datasetv2similarity.js +37 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/filter.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/flow_devops_evaluation_callback_common.js +62 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/flow_devops_prompt_common.js +378 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/fornax_domain_model.js +384 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/ml_flow_domain_model.js +385 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/openapi.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_annotateservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_annotationjobservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_batchinferservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_crowdsourcingannotationjobservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_dataprocessservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_datasetservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_datasetservicev2.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_modelservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_annotationjobservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_batchinferservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_datasetservicev2.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_tagservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow/namespaces/tag.js +60 -0
- package/dist/lib/idls/prompt_api/index.js +2071 -0
- package/dist/lib/idls/prompt_api/namespaces/base.js +16 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_callback.js +62 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_commercial_openapi.js +16 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_common.js +378 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_debug.js +16 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_manage.js +49 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_mcp.js +16 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_optimize.js +16 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_paas.js +72 -0
- package/dist/lib/idls/prompt_api/namespaces/flow_devops_prompt_platform.js +16 -0
- package/dist/lib/idls/prompt_api/namespaces/mcp.js +33 -0
- package/dist/lib/idls/prompt_api/namespaces/model.js +377 -0
- package/dist/lib/idls/prompt_api/namespaces/permission.js +72 -0
- package/dist/lib/idls/prompt_api/namespaces/release.js +50 -0
- package/dist/lib/index.js +110 -0
- package/dist/lib/mermaid-diagram/index.js +174 -0
- package/dist/lib/mermaid-diagram/index.module.js +25 -0
- package/dist/lib/mermaid-diagram/index_module.css +4 -0
- package/dist/lib/mermaid-diagram/use-svg-pan-zoom.js +83 -0
- package/dist/lib/mermaid-diagram/utils.js +98 -0
- package/dist/lib/model-config-editor/basic-type.js +105 -0
- package/dist/lib/model-config-editor/index.module.js +25 -0
- package/dist/lib/model-config-editor/index_module.css +8 -0
- package/dist/lib/model-config-editor/model-config-form.js +149 -0
- package/dist/lib/model-config-editor/popover-type.js +145 -0
- package/dist/lib/model-select/index.js +170 -0
- package/dist/lib/model-select/index.module.js +25 -0
- package/dist/lib/model-select/index_module.css +14 -0
- package/dist/lib/model-select/model-option/index.js +188 -0
- package/dist/lib/model-select/model-option/index.module.js +25 -0
- package/dist/lib/model-select/model-option/index_module.css +23 -0
- package/dist/lib/model-select/model-option-group/index.js +75 -0
- package/dist/lib/prompt-editor/index.js +218 -0
- package/dist/lib/prompt-editor/index.module.js +25 -0
- package/dist/lib/prompt-editor/index_module.css +71 -0
- package/dist/lib/prompt-editor/message-type-select.js +108 -0
- package/dist/lib/schema-editor/index.js +77 -0
- package/dist/lib/utils/base.js +82 -0
- package/dist/lib/utils/model-config.js +67 -0
- package/dist/{src → types}/basic-editor/custom-facet.d.ts +1 -2
- package/dist/types/basic-editor/diff.d.ts +15 -0
- package/dist/types/basic-editor/extensions/go-syntax.d.ts +71 -0
- package/dist/types/basic-editor/extensions/go-template.d.ts +1 -0
- package/dist/{src → types}/basic-editor/extensions/go-theme.d.ts +1 -1
- package/dist/types/basic-editor/extensions/jinja.d.ts +6 -0
- package/dist/{src → types}/basic-editor/extensions/keymap.d.ts +2 -3
- package/dist/types/basic-editor/extensions/language-support.d.ts +2 -0
- package/dist/types/basic-editor/extensions/markdown.d.ts +2 -0
- package/dist/types/basic-editor/extensions/search/dom/icon.d.ts +59 -0
- package/dist/types/basic-editor/extensions/search/dom/match-count.d.ts +14 -0
- package/dist/types/basic-editor/extensions/search/index.d.ts +1 -0
- package/dist/types/basic-editor/extensions/search/panel.d.ts +32 -0
- package/dist/types/basic-editor/extensions/search/theme.d.ts +1 -0
- package/dist/types/basic-editor/extensions/validation.d.ts +10 -0
- package/dist/types/basic-editor/extensions/variable.d.ts +14 -0
- package/dist/types/basic-editor/index.d.ts +28 -0
- package/dist/types/code-editor/code-editor.d.ts +23 -0
- package/dist/{src → types}/code-editor/index.d.ts +1 -1
- package/dist/types/code-editor/json-editor.d.ts +17 -0
- package/dist/types/code-editor/raw-text-editor.d.ts +11 -0
- package/dist/types/code-editor/text-editor.d.ts +23 -0
- package/dist/types/code-editor/themes/coze-dark.d.ts +1 -0
- package/dist/types/code-editor/themes/coze-light.d.ts +1 -0
- package/dist/{src → types}/consts/index.d.ts +1 -1
- package/dist/types/dev-layout/index.d.ts +13 -0
- package/dist/types/idls/fornax_ml_flow/index.d.ts +779 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/ai_annotate.d.ts +102 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/aidpcallback.d.ts +227 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/annotation_job.d.ts +402 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/base.d.ts +18 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/batch_infer.d.ts +331 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/dataprocess.d.ts +16 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/dataset.d.ts +88 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/datasetv2.d.ts +462 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/datasetv2job.d.ts +180 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/datasetv2lineage.d.ts +69 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/datasetv2similarity.d.ts +8 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/filter.d.ts +39 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/flow_devops_evaluation_callback_common.d.ts +88 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/flow_devops_prompt_common.d.ts +370 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/fornax_domain_model.d.ts +320 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/ml_flow_domain_model.d.ts +510 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/openapi.d.ts +6 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_annotateservice.d.ts +106 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_annotationjobservice.d.ts +256 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_batchinferservice.d.ts +73 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_crowdsourcingannotationjobservice.d.ts +94 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_dataprocessservice.d.ts +11 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_datasetservice.d.ts +24 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_datasetservicev2.d.ts +653 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_modelservice.d.ts +83 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_annotationjobservice.d.ts +81 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_batchinferservice.d.ts +24 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_openapi_datasetservicev2.d.ts +260 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/stone_fornax_ml_flow_tagservice.d.ts +111 -0
- package/dist/types/idls/fornax_ml_flow/namespaces/tag.d.ts +109 -0
- package/dist/types/idls/prompt_api/index.d.ts +667 -0
- package/dist/types/idls/prompt_api/namespaces/base.d.ts +18 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_callback.d.ts +102 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_commercial_openapi.d.ts +81 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_common.d.ts +1270 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_debug.d.ts +197 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_manage.d.ts +769 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_mcp.d.ts +301 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_optimize.d.ts +155 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_paas.d.ts +198 -0
- package/dist/types/idls/prompt_api/namespaces/flow_devops_prompt_platform.d.ts +230 -0
- package/dist/types/idls/prompt_api/namespaces/mcp.d.ts +95 -0
- package/dist/types/idls/prompt_api/namespaces/model.d.ts +315 -0
- package/dist/types/idls/prompt_api/namespaces/permission.d.ts +52 -0
- package/dist/types/idls/prompt_api/namespaces/release.d.ts +62 -0
- package/dist/{src → types}/index.d.ts +7 -7
- package/dist/types/mermaid-diagram/index.d.ts +12 -0
- package/dist/types/mermaid-diagram/use-svg-pan-zoom.d.ts +17 -0
- package/dist/{src → types}/mermaid-diagram/utils.d.ts +1 -1
- package/dist/types/model-config-editor/basic-type.d.ts +19 -0
- package/dist/types/model-config-editor/model-config-form.d.ts +14 -0
- package/dist/types/model-config-editor/popover-type.d.ts +25 -0
- package/dist/types/model-select/index.d.ts +38 -0
- package/dist/types/model-select/model-option/index.d.ts +30 -0
- package/dist/types/model-select/model-option-group/index.d.ts +15 -0
- package/dist/types/prompt-editor/index.d.ts +30 -0
- package/dist/types/prompt-editor/message-type-select.d.ts +16 -0
- package/dist/types/schema-editor/index.d.ts +18 -0
- package/dist/{src → types}/utils/base.d.ts +4 -5
- package/dist/types/utils/model-config.d.ts +4 -0
- package/package.json +8 -16
- package/dist/edenx.config.d.ts +0 -2
- package/dist/go-syntax-4deb0289.js +0 -8
- package/dist/go-theme-fbd8a4fa.js +0 -1
- package/dist/index.cjs +0 -61
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2788
- package/dist/src/basic-editor/diff.d.ts +0 -16
- package/dist/src/basic-editor/extensions/go-syntax.d.ts +0 -71
- package/dist/src/basic-editor/extensions/go-template.d.ts +0 -1
- package/dist/src/basic-editor/extensions/jinja.d.ts +0 -4
- package/dist/src/basic-editor/extensions/language-support.d.ts +0 -2
- package/dist/src/basic-editor/extensions/markdown.d.ts +0 -2
- package/dist/src/basic-editor/extensions/search/dom/icon.d.ts +0 -59
- package/dist/src/basic-editor/extensions/search/dom/match-count.d.ts +0 -14
- package/dist/src/basic-editor/extensions/search/index.d.ts +0 -1
- package/dist/src/basic-editor/extensions/search/panel.d.ts +0 -33
- package/dist/src/basic-editor/extensions/search/theme.d.ts +0 -1
- package/dist/src/basic-editor/extensions/validation.d.ts +0 -8
- package/dist/src/basic-editor/extensions/variable.d.ts +0 -11
- package/dist/src/basic-editor/index.d.ts +0 -29
- package/dist/src/code-editor/json-editor.d.ts +0 -18
- package/dist/src/code-editor/raw-text-editor.d.ts +0 -11
- package/dist/src/dev-layout/index.d.ts +0 -7
- package/dist/src/mermaid-diagram/index.d.ts +0 -12
- package/dist/src/mermaid-diagram/use-svg-pan-zoom.d.ts +0 -12
- package/dist/src/model-config-editor/basic-type.d.ts +0 -13
- package/dist/src/model-config-editor/model-config-form.d.ts +0 -13
- package/dist/src/model-config-editor/popover-type.d.ts +0 -19
- package/dist/src/model-select/index.d.ts +0 -27
- package/dist/src/model-select/model-option/index.d.ts +0 -25
- package/dist/src/model-select/model-option-group/index.d.ts +0 -16
- package/dist/src/prompt-editor/index.d.ts +0 -31
- package/dist/src/prompt-editor/message-type-select.d.ts +0 -11
- package/dist/src/schema-editor/index.d.ts +0 -11
- package/dist/src/utils/model-config.d.ts +0 -5
- package/dist/style.css +0 -1
- package/dist/test-build.d.ts +0 -7
- package/dist/vite.config.d.ts +0 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var validation_exports = {};
|
|
30
|
+
__export(validation_exports, {
|
|
31
|
+
Validation: () => Validation,
|
|
32
|
+
default: () => validation_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(validation_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_react2 = require("@coze-editor/editor/react");
|
|
37
|
+
var import_editor = require("@coze-editor/editor");
|
|
38
|
+
var import_consts = require("../../consts");
|
|
39
|
+
var import_validation = __toESM(require("./validation.module"));
|
|
40
|
+
function validate(text) {
|
|
41
|
+
const regex = new RegExp(`^[a-zA-Z][\\w]{0,${import_consts.VARIABLE_MAX_LEN - 1}}$`, "gm");
|
|
42
|
+
if (regex.test(text)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
function Validation({
|
|
48
|
+
variables,
|
|
49
|
+
isNormalTemplate
|
|
50
|
+
}) {
|
|
51
|
+
const injector = (0, import_react2.useInjector)();
|
|
52
|
+
(0, import_react.useLayoutEffect)(
|
|
53
|
+
() => injector.inject([
|
|
54
|
+
import_editor.astDecorator.whole.of((cursor, state) => {
|
|
55
|
+
var _a, _b, _c, _d;
|
|
56
|
+
if (cursor.name === "JinjaExpression" && ((_a = cursor.node.firstChild) == null ? void 0 : _a.name) === "JinjaExpressionStart" && ((_b = cursor.node.lastChild) == null ? void 0 : _b.name) === "JinjaExpressionEnd") {
|
|
57
|
+
const from = cursor.node.firstChild.to;
|
|
58
|
+
const to = cursor.node.lastChild.from;
|
|
59
|
+
const text = state.sliceDoc(from, to);
|
|
60
|
+
if (validate(text) && isNormalTemplate) {
|
|
61
|
+
return {
|
|
62
|
+
type: "className",
|
|
63
|
+
className: import_validation.default.valid,
|
|
64
|
+
from,
|
|
65
|
+
to
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (!isNormalTemplate) {
|
|
69
|
+
const item = variables == null ? void 0 : variables.find((variable) => variable.key === text);
|
|
70
|
+
if (item) {
|
|
71
|
+
return {
|
|
72
|
+
type: "className",
|
|
73
|
+
className: import_validation.default.valid,
|
|
74
|
+
from,
|
|
75
|
+
to
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
type: "className",
|
|
81
|
+
className: import_validation.default.invalid,
|
|
82
|
+
from,
|
|
83
|
+
to
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (cursor.name === "JinjaStatement" && ((_c = cursor.node.firstChild) == null ? void 0 : _c.name) === "JinjaStatementStart" && ((_d = cursor.node.lastChild) == null ? void 0 : _d.name) === "JinjaStatementEnd" && !isNormalTemplate) {
|
|
87
|
+
const from = cursor.node.firstChild.to;
|
|
88
|
+
const to = cursor.node.lastChild.from;
|
|
89
|
+
const text = state.sliceDoc(from, to);
|
|
90
|
+
return (variables || []).map((variable) => {
|
|
91
|
+
if (variable.key) {
|
|
92
|
+
const index = text.indexOf(variable.key);
|
|
93
|
+
if (index !== -1) {
|
|
94
|
+
return {
|
|
95
|
+
type: "className",
|
|
96
|
+
className: import_validation.default.valid,
|
|
97
|
+
from: from + index,
|
|
98
|
+
to: from + index + variable.key.length + 1
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return void 0;
|
|
103
|
+
}).filter(
|
|
104
|
+
(item) => item !== void 0
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
return void 0;
|
|
108
|
+
})
|
|
109
|
+
]),
|
|
110
|
+
[injector, variables]
|
|
111
|
+
);
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
var validation_default = Validation;
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
Validation
|
|
118
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var validation_exports = {};
|
|
20
|
+
__export(validation_exports, {
|
|
21
|
+
default: () => validation_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(validation_exports);
|
|
24
|
+
var import_validation_module = require("./validation_module.css");
|
|
25
|
+
var validation_default = { "valid": "valid_5e57b", "invalid": "invalid_5e57b" };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var variable_exports = {};
|
|
37
|
+
__export(variable_exports, {
|
|
38
|
+
default: () => variable_default
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(variable_exports);
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_react = require("react");
|
|
43
|
+
var import_react2 = require("@coze-editor/editor/react");
|
|
44
|
+
var import_coze_design = require("@coze-arch/coze-design");
|
|
45
|
+
function Variable({
|
|
46
|
+
variables,
|
|
47
|
+
isGoTemplate
|
|
48
|
+
}) {
|
|
49
|
+
const [posKey, setPosKey] = (0, import_react.useState)("");
|
|
50
|
+
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
51
|
+
const [position, setPosition] = (0, import_react.useState)(-1);
|
|
52
|
+
const editor = (0, import_react2.useEditor)();
|
|
53
|
+
function insert(variableName) {
|
|
54
|
+
const range = (0, import_react2.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
55
|
+
if (!range) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
editor.replaceText(__spreadProps(__spreadValues({}, range), {
|
|
59
|
+
text: isGoTemplate ? `{{.${variableName}}}` : `{{${variableName}}}`,
|
|
60
|
+
cursorOffset: variableName ? 0 : -2
|
|
61
|
+
}));
|
|
62
|
+
setVisible(false);
|
|
63
|
+
}
|
|
64
|
+
function handleOpenChange(e) {
|
|
65
|
+
setPosition(e.state.selection.main.head);
|
|
66
|
+
setVisible(e.value && variables.length > 0);
|
|
67
|
+
}
|
|
68
|
+
(0, import_react.useEffect)(() => {
|
|
69
|
+
if (!editor) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (visible) {
|
|
73
|
+
editor.disableKeybindings(["ArrowUp", "ArrowDown", "Enter"]);
|
|
74
|
+
} else {
|
|
75
|
+
editor.disableKeybindings([]);
|
|
76
|
+
}
|
|
77
|
+
}, [editor, visible]);
|
|
78
|
+
const selectedIndex = usePopoverNavigation({
|
|
79
|
+
enable: visible,
|
|
80
|
+
variables,
|
|
81
|
+
onApply: insert
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
|
+
import_react2.Mention,
|
|
86
|
+
{
|
|
87
|
+
trigger: (tr) => {
|
|
88
|
+
if (tr.docChanged) {
|
|
89
|
+
let context = void 0;
|
|
90
|
+
tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
|
|
91
|
+
if (fromA > 0 && // 新增,非替换
|
|
92
|
+
fromA === toA && // 新增内容为 {
|
|
93
|
+
inserted.toString() === "{}" && // { 前还有个 {
|
|
94
|
+
tr.state.sliceDoc(
|
|
95
|
+
Math.max(0, fromA - 1),
|
|
96
|
+
Math.max(0, fromA)
|
|
97
|
+
) === "{") {
|
|
98
|
+
context = {
|
|
99
|
+
from: fromB - 1,
|
|
100
|
+
to: toB + 1,
|
|
101
|
+
triggerCharacter: "{{",
|
|
102
|
+
cursorPosition: tr.state.selection.main.head
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return context;
|
|
107
|
+
}
|
|
108
|
+
return void 0;
|
|
109
|
+
},
|
|
110
|
+
onOpenChange: handleOpenChange
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
+
import_coze_design.Popover,
|
|
115
|
+
{
|
|
116
|
+
visible,
|
|
117
|
+
trigger: "custom",
|
|
118
|
+
position: "topLeft",
|
|
119
|
+
rePosKey: posKey,
|
|
120
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "p-1 min-w-[100px] flex flex-col gap-1", children: [
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_coze_design.Typography.Text, { type: "secondary", strong: true, children: "插入变量" }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "max-h-[200px] overflow-y-auto", children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: `cursor-pointer hover:bg-gray-100 px-2 py-1 mb-0.5 rounded ${selectedIndex === index ? "!bg-gray-200" : ""}`,
|
|
126
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
127
|
+
onClick: () => (variable == null ? void 0 : variable.key) && insert(variable.key),
|
|
128
|
+
children: variable.key
|
|
129
|
+
},
|
|
130
|
+
variable.key
|
|
131
|
+
)) })
|
|
132
|
+
] }),
|
|
133
|
+
onClickOutSide: () => setVisible(false),
|
|
134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
135
|
+
import_react2.PositionMirror,
|
|
136
|
+
{
|
|
137
|
+
position,
|
|
138
|
+
onChange: () => setPosKey(String(Math.random()))
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] });
|
|
144
|
+
}
|
|
145
|
+
function usePopoverNavigation(options) {
|
|
146
|
+
const { enable, variables, onApply } = options;
|
|
147
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react.useState)(0);
|
|
148
|
+
const indexRef = (0, import_react2.useLatest)(selectedIndex);
|
|
149
|
+
const variablesRef = (0, import_react2.useLatest)([...variables, { key: "" }]);
|
|
150
|
+
const onApplyRef = (0, import_react2.useLatest)(onApply);
|
|
151
|
+
(0, import_react.useEffect)(() => {
|
|
152
|
+
setSelectedIndex(0);
|
|
153
|
+
}, [enable]);
|
|
154
|
+
(0, import_react.useEffect)(() => {
|
|
155
|
+
if (!enable) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
function handleNavigation(e) {
|
|
159
|
+
switch (e.key) {
|
|
160
|
+
case "ArrowUp":
|
|
161
|
+
setSelectedIndex((prevIndex) => {
|
|
162
|
+
const nextIndex = prevIndex - 1;
|
|
163
|
+
return Math.max(0, nextIndex);
|
|
164
|
+
});
|
|
165
|
+
break;
|
|
166
|
+
case "ArrowDown":
|
|
167
|
+
setSelectedIndex((prevIndex) => {
|
|
168
|
+
const nextIndex = prevIndex + 1;
|
|
169
|
+
return Math.min(variablesRef.current.length - 1, nextIndex);
|
|
170
|
+
});
|
|
171
|
+
break;
|
|
172
|
+
case "Enter": {
|
|
173
|
+
const variableName = variablesRef.current[indexRef.current];
|
|
174
|
+
if (variableName) {
|
|
175
|
+
onApplyRef.current(variableName.key || "");
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
default:
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
document.addEventListener("keydown", handleNavigation, false);
|
|
184
|
+
return () => {
|
|
185
|
+
document.removeEventListener("keydown", handleNavigation, false);
|
|
186
|
+
};
|
|
187
|
+
}, [enable]);
|
|
188
|
+
return selectedIndex;
|
|
189
|
+
}
|
|
190
|
+
var variable_default = Variable;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(from))
|
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
+
mod
|
|
44
|
+
));
|
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
+
var basic_editor_exports = {};
|
|
47
|
+
__export(basic_editor_exports, {
|
|
48
|
+
PromptBasicEditor: () => PromptBasicEditor
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(basic_editor_exports);
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
var import_react = require("react");
|
|
53
|
+
var import_react2 = require("@coze-editor/editor/react");
|
|
54
|
+
var import_preset_prompt = __toESM(require("@coze-editor/editor/preset-prompt"));
|
|
55
|
+
var import_view = require("@codemirror/view");
|
|
56
|
+
var import_state = require("@codemirror/state");
|
|
57
|
+
var import_commands = require("@codemirror/commands");
|
|
58
|
+
var import_variable = __toESM(require("./extensions/variable"));
|
|
59
|
+
var import_validation = __toESM(require("./extensions/validation"));
|
|
60
|
+
var import_search = require("./extensions/search");
|
|
61
|
+
var import_markdown = __toESM(require("./extensions/markdown"));
|
|
62
|
+
var import_language_support = __toESM(require("./extensions/language-support"));
|
|
63
|
+
var import_keymap = require("./extensions/keymap");
|
|
64
|
+
var import_jinja = __toESM(require("./extensions/jinja"));
|
|
65
|
+
var import_go_template = require("./extensions/go-template");
|
|
66
|
+
const extensions = [
|
|
67
|
+
import_view.EditorView.theme({
|
|
68
|
+
".cm-gutters": {
|
|
69
|
+
backgroundColor: "transparent",
|
|
70
|
+
borderRight: "none"
|
|
71
|
+
},
|
|
72
|
+
".cm-scroller": {
|
|
73
|
+
paddingLeft: "10px",
|
|
74
|
+
paddingRight: "6px !important"
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
import_state.Prec.high(import_view.keymap.of([{ key: "Tab", run: import_keymap.insertFourSpaces }, import_commands.indentWithTab]))
|
|
78
|
+
];
|
|
79
|
+
const PromptBasicEditor = (0, import_react.forwardRef)(
|
|
80
|
+
({
|
|
81
|
+
defaultValue,
|
|
82
|
+
onChange,
|
|
83
|
+
variables,
|
|
84
|
+
height,
|
|
85
|
+
minHeight,
|
|
86
|
+
maxHeight,
|
|
87
|
+
fontSize = 13,
|
|
88
|
+
forbidJinjaHighlight,
|
|
89
|
+
forbidVariables,
|
|
90
|
+
readOnly,
|
|
91
|
+
linePlaceholder = "请输入内容,支持按此格式书写变量:{{USER_NAME}}",
|
|
92
|
+
customExtensions = [],
|
|
93
|
+
autoScrollToBottom,
|
|
94
|
+
onBlur,
|
|
95
|
+
isGoTemplate,
|
|
96
|
+
onFocus,
|
|
97
|
+
canSearch,
|
|
98
|
+
children,
|
|
99
|
+
isJinja2Template
|
|
100
|
+
}, ref) => {
|
|
101
|
+
const editorRef = (0, import_react.useRef)(null);
|
|
102
|
+
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
103
|
+
setEditorValue: (value) => {
|
|
104
|
+
var _a;
|
|
105
|
+
const editor = editorRef.current;
|
|
106
|
+
if (!editor) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
(_a = editor == null ? void 0 : editor.setValue) == null ? void 0 : _a.call(editor, value || "");
|
|
110
|
+
},
|
|
111
|
+
insertText: (text) => {
|
|
112
|
+
const editor = editorRef.current;
|
|
113
|
+
if (!editor) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const range = editor.getSelection();
|
|
117
|
+
if (!range) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
editor.replaceText(__spreadProps(__spreadValues({}, range), {
|
|
121
|
+
text,
|
|
122
|
+
cursorOffset: 0
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
const newExtensions = (0, import_react.useMemo)(() => {
|
|
127
|
+
const xExtensions = [...extensions, ...customExtensions];
|
|
128
|
+
const searchExt = canSearch ? [...(0, import_search.search)()] : [];
|
|
129
|
+
if (isGoTemplate) {
|
|
130
|
+
return [...xExtensions, import_go_template.goExtension, ...searchExt];
|
|
131
|
+
}
|
|
132
|
+
return [...xExtensions, ...searchExt];
|
|
133
|
+
}, [customExtensions, extensions, isGoTemplate, canSearch]);
|
|
134
|
+
(0, import_react.useEffect)(() => {
|
|
135
|
+
if (isJinja2Template || isGoTemplate) {
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
var _a;
|
|
138
|
+
(_a = editorRef.current) == null ? void 0 : _a.updateWholeDecorations();
|
|
139
|
+
}, 150);
|
|
140
|
+
}
|
|
141
|
+
}, [variables, isJinja2Template, isGoTemplate]);
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react2.EditorProvider, { children: [
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
import_react2.Renderer,
|
|
145
|
+
{
|
|
146
|
+
plugins: import_preset_prompt.default,
|
|
147
|
+
defaultValue,
|
|
148
|
+
options: {
|
|
149
|
+
editable: !readOnly,
|
|
150
|
+
readOnly,
|
|
151
|
+
height,
|
|
152
|
+
minHeight: minHeight || height,
|
|
153
|
+
maxHeight: maxHeight || height,
|
|
154
|
+
fontSize
|
|
155
|
+
},
|
|
156
|
+
onChange: (e) => onChange == null ? void 0 : onChange(e.value),
|
|
157
|
+
onFocus,
|
|
158
|
+
onBlur,
|
|
159
|
+
extensions: newExtensions,
|
|
160
|
+
didMount: (editor) => {
|
|
161
|
+
editorRef.current = editor;
|
|
162
|
+
if (autoScrollToBottom) {
|
|
163
|
+
editor.$view.dispatch({
|
|
164
|
+
effects: import_view.EditorView.scrollIntoView(
|
|
165
|
+
editor.$view.state.doc.length
|
|
166
|
+
)
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
!forbidVariables && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_variable.default, { variables: variables || [], isGoTemplate }),
|
|
173
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_language_support.default, {}),
|
|
174
|
+
!forbidJinjaHighlight && !isGoTemplate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
+
import_validation.default,
|
|
177
|
+
{
|
|
178
|
+
variables,
|
|
179
|
+
isNormalTemplate: !isJinja2Template && !isGoTemplate
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jinja.default, { isJinja2Template })
|
|
183
|
+
] }),
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_markdown.default, {}),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.Placeholder, { children: linePlaceholder }),
|
|
186
|
+
children
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
191
|
+
0 && (module.exports = {
|
|
192
|
+
PromptBasicEditor
|
|
193
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var code_editor_exports = {};
|
|
30
|
+
__export(code_editor_exports, {
|
|
31
|
+
CodeEditor: () => CodeEditor
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(code_editor_exports);
|
|
34
|
+
var import_react = require("@coze-editor/editor/react");
|
|
35
|
+
var import_preset_code = __toESM(require("@coze-editor/editor/preset-code"));
|
|
36
|
+
var import_language_shell = require("@coze-editor/editor/language-shell");
|
|
37
|
+
var import_language_json = require("@coze-editor/editor/language-json");
|
|
38
|
+
var import_editor = require("@coze-editor/editor");
|
|
39
|
+
var import_view = require("@codemirror/view");
|
|
40
|
+
var import_coze_light = require("./themes/coze-light");
|
|
41
|
+
var import_coze_dark = require("./themes/coze-dark");
|
|
42
|
+
import_preset_code.languages.register("json", {
|
|
43
|
+
// mixLanguages 用于解决 「插值也使用了括号,导致无法正确高亮」的问题
|
|
44
|
+
language: (0, import_editor.mixLanguages)({
|
|
45
|
+
outerLanguage: import_language_json.json.language
|
|
46
|
+
}),
|
|
47
|
+
languageService: import_language_json.json.languageService
|
|
48
|
+
});
|
|
49
|
+
import_preset_code.languages.register("shell", import_language_shell.shell);
|
|
50
|
+
import_preset_code.themes.register("coze-light", import_coze_light.cozeLight);
|
|
51
|
+
import_preset_code.themes.register("coze-dark", import_coze_dark.cozeDark);
|
|
52
|
+
const minHeightOption = (value) => import_view.EditorView.theme({
|
|
53
|
+
".cm-content, .cm-gutter, .cm-right-gutter": {
|
|
54
|
+
minHeight: typeof value === "number" ? `${value}px` : typeof value === "string" ? value : "unset"
|
|
55
|
+
},
|
|
56
|
+
"&.cm-editor": {
|
|
57
|
+
minHeight: typeof value === "number" ? `${value}px` : typeof value === "string" ? value : "unset"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const maxHeightOption = (value) => import_view.EditorView.theme({
|
|
61
|
+
"&.cm-editor": {
|
|
62
|
+
maxHeight: typeof value === "number" ? `${value}px` : typeof value === "string" ? value : "unset"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const heightOption = (value) => import_view.EditorView.theme({
|
|
66
|
+
"&.cm-editor": {
|
|
67
|
+
height: typeof value === "number" ? `${value}px` : typeof value === "string" ? value : "unset"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const paddingOption = (value) => import_view.EditorView.theme({
|
|
71
|
+
"&.cm-editor": {
|
|
72
|
+
padding: typeof value === "number" ? `${value}px` : typeof value === "string" ? value : "unset"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const borderRadiusOption = (value) => import_view.EditorView.theme({
|
|
76
|
+
"&.cm-editor, .cm-gutters": {
|
|
77
|
+
borderRadius: typeof value === "number" ? `${value}px` : typeof value === "string" ? value : "unset"
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const lineHeightOption = (value) => import_view.EditorView.theme({
|
|
81
|
+
".cm-content, .cm-gutter, .cm-right-gutter": {
|
|
82
|
+
lineHeight: typeof value === "number" ? `${value}px` : typeof value === "string" ? value : "unset"
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
function createStyleOptions() {
|
|
86
|
+
return [
|
|
87
|
+
(0, import_react.option)("minHeight", minHeightOption),
|
|
88
|
+
(0, import_react.option)("maxHeight", maxHeightOption),
|
|
89
|
+
(0, import_react.option)("editerHeight", heightOption),
|
|
90
|
+
(0, import_react.option)("borderRadius", borderRadiusOption),
|
|
91
|
+
(0, import_react.option)("padding", paddingOption),
|
|
92
|
+
(0, import_react.option)("lineHeight", lineHeightOption)
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
const builtinExtensions = [
|
|
96
|
+
import_view.EditorView.theme({
|
|
97
|
+
"&.cm-focused": {
|
|
98
|
+
outline: "none"
|
|
99
|
+
},
|
|
100
|
+
"& *": {
|
|
101
|
+
fontFamily: 'Menlo, Monaco, "Courier New", monospace'
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
import_view.EditorView.theme({
|
|
105
|
+
"&.cm-content": {
|
|
106
|
+
wordBreak: "break-all"
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
];
|
|
110
|
+
const CodeEditor = (0, import_react.createRenderer)(
|
|
111
|
+
[...import_preset_code.default, ...createStyleOptions()],
|
|
112
|
+
builtinExtensions
|
|
113
|
+
);
|
|
114
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
115
|
+
0 && (module.exports = {
|
|
116
|
+
CodeEditor
|
|
117
|
+
});
|