@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,418 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import createEle from "crelt";
|
|
21
|
+
import {
|
|
22
|
+
runScopeHandlers
|
|
23
|
+
} from "@codemirror/view";
|
|
24
|
+
import {
|
|
25
|
+
closeSearchPanel,
|
|
26
|
+
findNext,
|
|
27
|
+
findPrevious,
|
|
28
|
+
getSearchQuery,
|
|
29
|
+
replaceAll,
|
|
30
|
+
replaceNext,
|
|
31
|
+
SearchQuery,
|
|
32
|
+
setSearchQuery
|
|
33
|
+
} from "@codemirror/search";
|
|
34
|
+
import { MatchCount } from "./dom/match-count";
|
|
35
|
+
import {
|
|
36
|
+
IconCaseSensitive,
|
|
37
|
+
IconRegExp,
|
|
38
|
+
IconWholeWord,
|
|
39
|
+
IconArrowUp,
|
|
40
|
+
IconArrowDown,
|
|
41
|
+
IconReplace,
|
|
42
|
+
IconReplaceAll,
|
|
43
|
+
IconClose,
|
|
44
|
+
IconChevronRight
|
|
45
|
+
} from "./dom/icon";
|
|
46
|
+
class SearchPanel {
|
|
47
|
+
constructor(view) {
|
|
48
|
+
this.view = view;
|
|
49
|
+
this.commit = this.commit.bind(this);
|
|
50
|
+
this.query = getSearchQuery(view.state);
|
|
51
|
+
this.matchCount = new MatchCount();
|
|
52
|
+
const searchLine = this.initSearchLine(view);
|
|
53
|
+
const replaceLine = this.initReplaceLine(view);
|
|
54
|
+
const replaceLineStatus = () => {
|
|
55
|
+
var _a;
|
|
56
|
+
if (view.state.readOnly) {
|
|
57
|
+
replaceLine.style.display = "none";
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!((_a = this.expand) == null ? void 0 : _a.checked)) {
|
|
61
|
+
replaceLine.style.display = "none";
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
replaceLine.style.display = "flex";
|
|
65
|
+
};
|
|
66
|
+
replaceLineStatus();
|
|
67
|
+
const expand = this.initExpandButton(view, () => replaceLineStatus());
|
|
68
|
+
const onMouseDown = useDragSearchPanel(this);
|
|
69
|
+
this.dom = createEle(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
onkeydown: (e) => this.keydown(e),
|
|
73
|
+
class: "cm-custom-search"
|
|
74
|
+
},
|
|
75
|
+
[
|
|
76
|
+
createEle("div", {
|
|
77
|
+
class: "cm-custom-search-drag",
|
|
78
|
+
onmousedown: onMouseDown
|
|
79
|
+
}),
|
|
80
|
+
...expand,
|
|
81
|
+
createEle(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
class: "cm-custom-search-panel-content"
|
|
85
|
+
},
|
|
86
|
+
[searchLine, replaceLine]
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
);
|
|
90
|
+
this.updateMatchCount(view.state, this.query);
|
|
91
|
+
}
|
|
92
|
+
initExpandButton(view, onExpandChange) {
|
|
93
|
+
this.expand = new IconChevronRight({
|
|
94
|
+
name: "expand",
|
|
95
|
+
title: phrase(view, "展开"),
|
|
96
|
+
onchange: onExpandChange
|
|
97
|
+
});
|
|
98
|
+
return view.state.readOnly ? [] : [
|
|
99
|
+
createEle(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
class: "cm-custom-search-panel-expand"
|
|
103
|
+
},
|
|
104
|
+
[this.expand.dom]
|
|
105
|
+
)
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
initSearchLine(view) {
|
|
109
|
+
const inputWrapperRef = {
|
|
110
|
+
current: null
|
|
111
|
+
};
|
|
112
|
+
const handleInputFocus = () => {
|
|
113
|
+
var _a;
|
|
114
|
+
(_a = inputWrapperRef.current) == null ? void 0 : _a.focus();
|
|
115
|
+
if (inputWrapperRef.current && !inputWrapperRef.current.classList.contains(
|
|
116
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
117
|
+
)) {
|
|
118
|
+
inputWrapperRef.current.classList.add(
|
|
119
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const handleInputBlur = () => {
|
|
124
|
+
var _a;
|
|
125
|
+
(_a = inputWrapperRef.current) == null ? void 0 : _a.blur();
|
|
126
|
+
if (inputWrapperRef.current) {
|
|
127
|
+
inputWrapperRef.current.classList.remove(
|
|
128
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
this.searchField = createEle("input", {
|
|
133
|
+
value: this.query.search,
|
|
134
|
+
placeholder: phrase(view, "查找"),
|
|
135
|
+
title: phrase(view, "查找"),
|
|
136
|
+
class: "cm-custom-text-field",
|
|
137
|
+
name: "search",
|
|
138
|
+
form: "",
|
|
139
|
+
"main-field": "true",
|
|
140
|
+
onchange: this.commit,
|
|
141
|
+
onkeyup: this.commit,
|
|
142
|
+
onfocus: handleInputFocus,
|
|
143
|
+
onblur: handleInputBlur
|
|
144
|
+
});
|
|
145
|
+
this.caseField = new IconCaseSensitive({
|
|
146
|
+
checked: this.query.caseSensitive,
|
|
147
|
+
onchange: () => {
|
|
148
|
+
this.searchField.focus();
|
|
149
|
+
this.commit();
|
|
150
|
+
},
|
|
151
|
+
name: "case",
|
|
152
|
+
title: phrase(view, "区分大小写")
|
|
153
|
+
});
|
|
154
|
+
this.reField = new IconRegExp({
|
|
155
|
+
name: "re",
|
|
156
|
+
checked: this.query.regexp,
|
|
157
|
+
onchange: () => {
|
|
158
|
+
this.searchField.focus();
|
|
159
|
+
this.commit();
|
|
160
|
+
},
|
|
161
|
+
title: phrase(view, "正则表达式")
|
|
162
|
+
});
|
|
163
|
+
this.wordField = new IconWholeWord({
|
|
164
|
+
name: "word",
|
|
165
|
+
checked: this.query.wholeWord,
|
|
166
|
+
onchange: () => {
|
|
167
|
+
this.searchField.focus();
|
|
168
|
+
this.commit();
|
|
169
|
+
},
|
|
170
|
+
title: phrase(view, "全词匹配")
|
|
171
|
+
});
|
|
172
|
+
this.arrowUp = new IconArrowUp({
|
|
173
|
+
name: "previous",
|
|
174
|
+
onclick: () => {
|
|
175
|
+
findPrevious(view);
|
|
176
|
+
this.updateMatchCount(view.state, this.query);
|
|
177
|
+
},
|
|
178
|
+
title: phrase(view, "上一个匹配")
|
|
179
|
+
});
|
|
180
|
+
this.arrowDown = new IconArrowDown({
|
|
181
|
+
name: "next",
|
|
182
|
+
onclick: () => {
|
|
183
|
+
findNext(view);
|
|
184
|
+
this.updateMatchCount(view.state, this.query);
|
|
185
|
+
},
|
|
186
|
+
title: phrase(view, "下一个匹配")
|
|
187
|
+
});
|
|
188
|
+
inputWrapperRef.current = createEle(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
class: "cm-custom-search-panel-content-input-wrapper"
|
|
192
|
+
},
|
|
193
|
+
[
|
|
194
|
+
this.searchField,
|
|
195
|
+
// enter.dom,
|
|
196
|
+
this.caseField.dom,
|
|
197
|
+
this.reField.dom,
|
|
198
|
+
this.wordField.dom
|
|
199
|
+
]
|
|
200
|
+
);
|
|
201
|
+
return createEle(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
class: "cm-custom-search-panel-content-top"
|
|
205
|
+
},
|
|
206
|
+
[
|
|
207
|
+
inputWrapperRef.current,
|
|
208
|
+
this.matchCount.dom,
|
|
209
|
+
createEle(
|
|
210
|
+
"div",
|
|
211
|
+
{
|
|
212
|
+
class: "cm-custom-search-action-wrapper"
|
|
213
|
+
},
|
|
214
|
+
[
|
|
215
|
+
this.arrowUp.dom,
|
|
216
|
+
this.arrowDown.dom,
|
|
217
|
+
new IconClose({
|
|
218
|
+
name: "close-icon",
|
|
219
|
+
onclick: () => closeSearchPanel(view),
|
|
220
|
+
title: phrase(view, "关闭")
|
|
221
|
+
}).dom
|
|
222
|
+
]
|
|
223
|
+
)
|
|
224
|
+
]
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
initReplaceLine(view) {
|
|
228
|
+
const inputWrapperRef = {
|
|
229
|
+
current: null
|
|
230
|
+
};
|
|
231
|
+
const handleInputFocus = () => {
|
|
232
|
+
var _a;
|
|
233
|
+
(_a = inputWrapperRef.current) == null ? void 0 : _a.focus();
|
|
234
|
+
if (inputWrapperRef.current && !inputWrapperRef.current.classList.contains(
|
|
235
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
236
|
+
)) {
|
|
237
|
+
inputWrapperRef.current.classList.add(
|
|
238
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const handleInputBlur = () => {
|
|
243
|
+
var _a;
|
|
244
|
+
(_a = inputWrapperRef.current) == null ? void 0 : _a.blur();
|
|
245
|
+
if (inputWrapperRef.current) {
|
|
246
|
+
inputWrapperRef.current.classList.remove(
|
|
247
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
this.replaceField = createEle("input", {
|
|
252
|
+
value: this.query.replace,
|
|
253
|
+
placeholder: phrase(view, "替换"),
|
|
254
|
+
title: phrase(view, "替换"),
|
|
255
|
+
class: "cm-custom-text-field",
|
|
256
|
+
name: "replace",
|
|
257
|
+
form: "",
|
|
258
|
+
onchange: this.commit,
|
|
259
|
+
onkeyup: this.commit,
|
|
260
|
+
onfocus: handleInputFocus,
|
|
261
|
+
onblur: handleInputBlur
|
|
262
|
+
});
|
|
263
|
+
this.replace = new IconReplace({
|
|
264
|
+
name: "replace",
|
|
265
|
+
onclick: () => {
|
|
266
|
+
replaceNext(view);
|
|
267
|
+
this.updateMatchCount(view.state, this.query);
|
|
268
|
+
},
|
|
269
|
+
title: phrase(view, "替换")
|
|
270
|
+
});
|
|
271
|
+
this.replaceAll = new IconReplaceAll({
|
|
272
|
+
name: "replaceAll",
|
|
273
|
+
onclick: () => {
|
|
274
|
+
replaceAll(view);
|
|
275
|
+
this.updateMatchCount(view.state, this.query);
|
|
276
|
+
},
|
|
277
|
+
title: phrase(view, "替换所有")
|
|
278
|
+
});
|
|
279
|
+
inputWrapperRef.current = createEle(
|
|
280
|
+
"div",
|
|
281
|
+
{
|
|
282
|
+
class: "cm-custom-search-panel-content-input-wrapper"
|
|
283
|
+
},
|
|
284
|
+
[this.replaceField]
|
|
285
|
+
);
|
|
286
|
+
return createEle(
|
|
287
|
+
"div",
|
|
288
|
+
{
|
|
289
|
+
class: "cm-custom-search-panel-content-bottom"
|
|
290
|
+
},
|
|
291
|
+
[inputWrapperRef.current, this.replace.dom, this.replaceAll.dom]
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
commit() {
|
|
295
|
+
const query = new SearchQuery({
|
|
296
|
+
search: this.searchField.value,
|
|
297
|
+
caseSensitive: this.caseField.checked,
|
|
298
|
+
regexp: this.reField.checked,
|
|
299
|
+
wholeWord: this.wordField.checked,
|
|
300
|
+
replace: this.replaceField.value
|
|
301
|
+
});
|
|
302
|
+
if (!query.eq(this.query)) {
|
|
303
|
+
this.query = query;
|
|
304
|
+
this.view.dispatch({ effects: setSearchQuery.of(query) });
|
|
305
|
+
}
|
|
306
|
+
this.updateMatchCount(this.view.state, this.query);
|
|
307
|
+
}
|
|
308
|
+
keydown(e) {
|
|
309
|
+
if (runScopeHandlers(this.view, e, "search-panel")) {
|
|
310
|
+
e.preventDefault();
|
|
311
|
+
} else if ((e.keyCode === 13 || e.key === "Enter") && e.target === this.searchField) {
|
|
312
|
+
e.preventDefault();
|
|
313
|
+
(e.shiftKey ? findPrevious : findNext)(this.view);
|
|
314
|
+
} else if ((e.keyCode === 13 || e.key === "Enter") && e.target === this.replaceField) {
|
|
315
|
+
e.preventDefault();
|
|
316
|
+
replaceNext(this.view);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
updateMatchCount(state, query) {
|
|
320
|
+
this.matchCount.data = __spreadProps(__spreadValues({}, findMatchIndex(state, query)), {
|
|
321
|
+
searching: !!query.search
|
|
322
|
+
});
|
|
323
|
+
if (this.matchCount.data.matchCount > 0) {
|
|
324
|
+
this.replace.disabled = false;
|
|
325
|
+
this.replaceAll.disabled = false;
|
|
326
|
+
this.arrowUp.disabled = false;
|
|
327
|
+
this.arrowDown.disabled = false;
|
|
328
|
+
} else {
|
|
329
|
+
this.replace.disabled = true;
|
|
330
|
+
this.replaceAll.disabled = true;
|
|
331
|
+
this.arrowUp.disabled = true;
|
|
332
|
+
this.arrowDown.disabled = true;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
update(update) {
|
|
336
|
+
for (const tr of update.transactions) {
|
|
337
|
+
for (const effect of tr.effects) {
|
|
338
|
+
if (effect.is(setSearchQuery) && !effect.value.eq(this.query)) {
|
|
339
|
+
this.setQuery(effect.value);
|
|
340
|
+
this.updateMatchCount(update.state, effect.value);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
setQuery(query) {
|
|
346
|
+
this.query = query;
|
|
347
|
+
this.searchField.value = query.search;
|
|
348
|
+
this.replaceField.value = query.replace;
|
|
349
|
+
this.caseField.checked = query.caseSensitive;
|
|
350
|
+
this.reField.checked = query.regexp;
|
|
351
|
+
this.wordField.checked = query.wholeWord;
|
|
352
|
+
}
|
|
353
|
+
mount() {
|
|
354
|
+
this.searchField.select();
|
|
355
|
+
}
|
|
356
|
+
get top() {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function phrase(view, p) {
|
|
361
|
+
return view.state.phrase(p);
|
|
362
|
+
}
|
|
363
|
+
function findMatchIndex(state, query) {
|
|
364
|
+
try {
|
|
365
|
+
const { from, to } = state.selection.main;
|
|
366
|
+
let index = 0;
|
|
367
|
+
let matchIndex = -1;
|
|
368
|
+
const cursor = query.getCursor(state);
|
|
369
|
+
let data = cursor.next();
|
|
370
|
+
while (!data.done) {
|
|
371
|
+
if (data.value.from === from && data.value.to === to) {
|
|
372
|
+
matchIndex = index;
|
|
373
|
+
}
|
|
374
|
+
data = cursor.next();
|
|
375
|
+
index++;
|
|
376
|
+
}
|
|
377
|
+
return { matchIndex, matchCount: index };
|
|
378
|
+
} catch (e) {
|
|
379
|
+
return { matchIndex: -1, matchCount: 0 };
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function useDragSearchPanel(panel) {
|
|
383
|
+
let isResizing = false;
|
|
384
|
+
let startX = 0;
|
|
385
|
+
let startWidth = 0;
|
|
386
|
+
const onMouseMove = (e) => {
|
|
387
|
+
e.preventDefault();
|
|
388
|
+
e.stopPropagation();
|
|
389
|
+
if (!isResizing || !(panel == null ? void 0 : panel.dom)) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const newWidth = startX - e.clientX + startWidth;
|
|
393
|
+
panel.dom.style.width = `${newWidth}px`;
|
|
394
|
+
};
|
|
395
|
+
const onMouseUp = (e) => {
|
|
396
|
+
e.preventDefault();
|
|
397
|
+
e.stopPropagation();
|
|
398
|
+
isResizing = false;
|
|
399
|
+
startX = 0;
|
|
400
|
+
startWidth = 0;
|
|
401
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
402
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
403
|
+
};
|
|
404
|
+
const onMouseDown = (e) => {
|
|
405
|
+
var _a;
|
|
406
|
+
e.preventDefault();
|
|
407
|
+
e.stopPropagation();
|
|
408
|
+
isResizing = true;
|
|
409
|
+
startX = e.clientX;
|
|
410
|
+
startWidth = (_a = panel == null ? void 0 : panel.dom.clientWidth) != null ? _a : 0;
|
|
411
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
412
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
413
|
+
};
|
|
414
|
+
return onMouseDown;
|
|
415
|
+
}
|
|
416
|
+
export {
|
|
417
|
+
SearchPanel
|
|
418
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { EditorView } from "@codemirror/view";
|
|
2
|
+
import { Prec } from "@codemirror/state";
|
|
3
|
+
const theme = Prec.high(
|
|
4
|
+
EditorView.theme({
|
|
5
|
+
"& .cm-panels.cm-panels-top": {
|
|
6
|
+
borderBottom: "none",
|
|
7
|
+
backgroundColor: "transparent"
|
|
8
|
+
},
|
|
9
|
+
"& .cm-panels.cm-panels-bottom": {
|
|
10
|
+
borderTop: "none",
|
|
11
|
+
backgroundColor: "transparent",
|
|
12
|
+
border: "1px solid rgba(28, 31, 35, .08)"
|
|
13
|
+
},
|
|
14
|
+
"& .cm-searchMatch": {
|
|
15
|
+
outline: "none"
|
|
16
|
+
},
|
|
17
|
+
"& .cm-custom-search": {
|
|
18
|
+
position: "absolute",
|
|
19
|
+
top: 0,
|
|
20
|
+
right: "10px",
|
|
21
|
+
backgroundColor: "#f3f3f3",
|
|
22
|
+
display: "flex",
|
|
23
|
+
padding: "4px",
|
|
24
|
+
boxSizing: "border-box",
|
|
25
|
+
minWidth: "360px",
|
|
26
|
+
maxWidth: "calc(100% - 30px)",
|
|
27
|
+
borderRadius: "4px",
|
|
28
|
+
boxShadow: "0 2px 8px 2px rgba(0, 0, 0, 0.16)",
|
|
29
|
+
overflow: "hidden"
|
|
30
|
+
},
|
|
31
|
+
"& .cm-custom-search button": {
|
|
32
|
+
borderWidth: 0
|
|
33
|
+
},
|
|
34
|
+
"& .cm-custom-search input": {
|
|
35
|
+
outline: "none"
|
|
36
|
+
},
|
|
37
|
+
"& .cm-custom-search .cm-custom-search-drag": {
|
|
38
|
+
width: "3px",
|
|
39
|
+
height: "100%",
|
|
40
|
+
position: "absolute",
|
|
41
|
+
top: "0px",
|
|
42
|
+
left: "0px",
|
|
43
|
+
backgroundColor: "#c8c8c8"
|
|
44
|
+
},
|
|
45
|
+
"& .cm-custom-search .cm-custom-search-drag:hover": {
|
|
46
|
+
backgroundColor: "#0090f1",
|
|
47
|
+
cursor: "col-resize"
|
|
48
|
+
},
|
|
49
|
+
"& .cm-custom-text-field": {
|
|
50
|
+
backgroundColor: "inherit",
|
|
51
|
+
padding: 0,
|
|
52
|
+
border: "none",
|
|
53
|
+
color: "#444d56",
|
|
54
|
+
fontSize: "12px",
|
|
55
|
+
lineHeight: "16px",
|
|
56
|
+
verticalAlign: "middle",
|
|
57
|
+
width: "calc(100% - 58px)"
|
|
58
|
+
},
|
|
59
|
+
"& .cm-custom-search-panel-icon": {
|
|
60
|
+
display: "inline-flex",
|
|
61
|
+
"align-items": "center",
|
|
62
|
+
"justify-content": "center",
|
|
63
|
+
padding: "4px",
|
|
64
|
+
"border-radius": "2px",
|
|
65
|
+
"background-color": "transparent",
|
|
66
|
+
"box-sizing": "border-box",
|
|
67
|
+
width: "20px",
|
|
68
|
+
height: "20px",
|
|
69
|
+
cursor: "pointer"
|
|
70
|
+
},
|
|
71
|
+
"& .cm-custom-search-panel-icon:hover": {
|
|
72
|
+
color: "rgba(0, 100, 250, 1)",
|
|
73
|
+
backgroundColor: "rgba(46, 60, 56, .09)"
|
|
74
|
+
},
|
|
75
|
+
"& .cm-custom-search-panel-icon:active": {
|
|
76
|
+
backgroundColor: "rgba(46, 50, 56, .13)"
|
|
77
|
+
},
|
|
78
|
+
"& .cm-custom-search-panel-icon span": {
|
|
79
|
+
display: "inline-flex",
|
|
80
|
+
lineHeight: "12px",
|
|
81
|
+
fontSize: "12px"
|
|
82
|
+
},
|
|
83
|
+
"& .cm-custom-search-panel-icon-active": {
|
|
84
|
+
color: "rgba(0, 100, 250, 1)",
|
|
85
|
+
backgroundColor: "rgba(46, 50, 56, .05)"
|
|
86
|
+
},
|
|
87
|
+
"& .cm-custom-search-panel-icon-disabled": {
|
|
88
|
+
color: "rgba(28, 31, 35, .35)",
|
|
89
|
+
backgroundColor: "transparent"
|
|
90
|
+
},
|
|
91
|
+
"& .cm-custom-search-panel-icon-disabled:hover": {
|
|
92
|
+
color: "rgba(28, 31, 35, .35)",
|
|
93
|
+
backgroundColor: "transparent"
|
|
94
|
+
},
|
|
95
|
+
"& .cm-custom-search-panel-icon-disabled:active": {
|
|
96
|
+
color: "rgba(28, 31, 35, .35)",
|
|
97
|
+
backgroundColor: "transparent"
|
|
98
|
+
},
|
|
99
|
+
"& .cm-custom-search-panel-expand": {
|
|
100
|
+
display: "flex",
|
|
101
|
+
padding: "4px"
|
|
102
|
+
},
|
|
103
|
+
"& .cm-custom-search-panel-content": {
|
|
104
|
+
display: "flex",
|
|
105
|
+
flexDirection: "column",
|
|
106
|
+
flex: 1
|
|
107
|
+
},
|
|
108
|
+
"& .cm-custom-search-panel-content-top": {
|
|
109
|
+
display: "flex",
|
|
110
|
+
alignItems: "center"
|
|
111
|
+
},
|
|
112
|
+
"& .cm-custom-search-action-wrapper": {
|
|
113
|
+
display: "flex",
|
|
114
|
+
alignItems: "center",
|
|
115
|
+
justifyContent: "end"
|
|
116
|
+
},
|
|
117
|
+
"& .cm-custom-search-panel-content-input-wrapper": {
|
|
118
|
+
display: "flex",
|
|
119
|
+
alignItems: "center",
|
|
120
|
+
flex: 1,
|
|
121
|
+
position: "relative",
|
|
122
|
+
border: "1px solid #555",
|
|
123
|
+
padding: "4px",
|
|
124
|
+
minWidth: "170px",
|
|
125
|
+
marginLeft: "4px",
|
|
126
|
+
marginRight: "6px",
|
|
127
|
+
borderRadius: "2px"
|
|
128
|
+
},
|
|
129
|
+
"& .cm-custom-search-panel-content-input-wrapper-focus": {
|
|
130
|
+
borderColor: "rgba(0, 100, 250, 1)"
|
|
131
|
+
},
|
|
132
|
+
"& .cm-custom-search-panel-content-input-wrapper .cm-custom-search-panel-icon": {
|
|
133
|
+
position: "absolute",
|
|
134
|
+
top: "4px",
|
|
135
|
+
right: "4px",
|
|
136
|
+
padding: "2px",
|
|
137
|
+
width: "16px",
|
|
138
|
+
height: "16px !important"
|
|
139
|
+
},
|
|
140
|
+
"& .cm-panel.cm-custom-search [name=word]": {
|
|
141
|
+
right: "22px"
|
|
142
|
+
},
|
|
143
|
+
"& .cm-panel.cm-custom-search [name=case]": {
|
|
144
|
+
right: "40px"
|
|
145
|
+
},
|
|
146
|
+
"& .cm-panel.cm-custom-search [name=enter]": {
|
|
147
|
+
right: "58px"
|
|
148
|
+
},
|
|
149
|
+
"& .cm-panel.cm-custom-search [name=previous]": {
|
|
150
|
+
marginRight: "2px"
|
|
151
|
+
},
|
|
152
|
+
"& .cm-panel.cm-custom-search [name=next]": {
|
|
153
|
+
marginRight: "2px"
|
|
154
|
+
},
|
|
155
|
+
"& .cm-panel.cm-custom-search [name=close-icon]": {
|
|
156
|
+
marginRight: "2px"
|
|
157
|
+
},
|
|
158
|
+
"& .cm-panel.cm-custom-search [name=replace]": {
|
|
159
|
+
marginRight: "2px"
|
|
160
|
+
},
|
|
161
|
+
"& .cm-panel.cm-custom-search [name=expand]": {
|
|
162
|
+
transform: "rotate(0deg)"
|
|
163
|
+
},
|
|
164
|
+
"& .cm-panel.cm-custom-search [name=expand].cm-custom-search-panel-icon-active": {
|
|
165
|
+
transform: "rotate(90deg)"
|
|
166
|
+
},
|
|
167
|
+
"& .cm-custom-search-match-count": {
|
|
168
|
+
fontSize: "12px",
|
|
169
|
+
width: "80px",
|
|
170
|
+
overflow: "hidden"
|
|
171
|
+
},
|
|
172
|
+
"& .cm-custom-search-panel-content-bottom": {
|
|
173
|
+
marginRight: "104px",
|
|
174
|
+
display: "flex",
|
|
175
|
+
alignItems: "center"
|
|
176
|
+
},
|
|
177
|
+
"& .cm-custom-search-panel-content-bottom .cm-custom-search-panel-content-input-wrapper": {
|
|
178
|
+
marginTop: "6px"
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
);
|
|
182
|
+
export {
|
|
183
|
+
theme
|
|
184
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { useInjector } from "@coze-editor/editor/react";
|
|
3
|
+
import { astDecorator } from "@coze-editor/editor";
|
|
4
|
+
import { VARIABLE_MAX_LEN } from "../../consts";
|
|
5
|
+
import styles from "./validation.module";
|
|
6
|
+
function validate(text) {
|
|
7
|
+
const regex = new RegExp(`^[a-zA-Z][\\w]{0,${VARIABLE_MAX_LEN - 1}}$`, "gm");
|
|
8
|
+
if (regex.test(text)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
function Validation({
|
|
14
|
+
variables,
|
|
15
|
+
isNormalTemplate
|
|
16
|
+
}) {
|
|
17
|
+
const injector = useInjector();
|
|
18
|
+
useLayoutEffect(
|
|
19
|
+
() => injector.inject([
|
|
20
|
+
astDecorator.whole.of((cursor, state) => {
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
if (cursor.name === "JinjaExpression" && ((_a = cursor.node.firstChild) == null ? void 0 : _a.name) === "JinjaExpressionStart" && ((_b = cursor.node.lastChild) == null ? void 0 : _b.name) === "JinjaExpressionEnd") {
|
|
23
|
+
const from = cursor.node.firstChild.to;
|
|
24
|
+
const to = cursor.node.lastChild.from;
|
|
25
|
+
const text = state.sliceDoc(from, to);
|
|
26
|
+
if (validate(text) && isNormalTemplate) {
|
|
27
|
+
return {
|
|
28
|
+
type: "className",
|
|
29
|
+
className: styles.valid,
|
|
30
|
+
from,
|
|
31
|
+
to
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (!isNormalTemplate) {
|
|
35
|
+
const item = variables == null ? void 0 : variables.find((variable) => variable.key === text);
|
|
36
|
+
if (item) {
|
|
37
|
+
return {
|
|
38
|
+
type: "className",
|
|
39
|
+
className: styles.valid,
|
|
40
|
+
from,
|
|
41
|
+
to
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
type: "className",
|
|
47
|
+
className: styles.invalid,
|
|
48
|
+
from,
|
|
49
|
+
to
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
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) {
|
|
53
|
+
const from = cursor.node.firstChild.to;
|
|
54
|
+
const to = cursor.node.lastChild.from;
|
|
55
|
+
const text = state.sliceDoc(from, to);
|
|
56
|
+
return (variables || []).map((variable) => {
|
|
57
|
+
if (variable.key) {
|
|
58
|
+
const index = text.indexOf(variable.key);
|
|
59
|
+
if (index !== -1) {
|
|
60
|
+
return {
|
|
61
|
+
type: "className",
|
|
62
|
+
className: styles.valid,
|
|
63
|
+
from: from + index,
|
|
64
|
+
to: from + index + variable.key.length + 1
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return void 0;
|
|
69
|
+
}).filter(
|
|
70
|
+
(item) => item !== void 0
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return void 0;
|
|
74
|
+
})
|
|
75
|
+
]),
|
|
76
|
+
[injector, variables]
|
|
77
|
+
);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
var validation_default = Validation;
|
|
81
|
+
export {
|
|
82
|
+
Validation,
|
|
83
|
+
validation_default as default
|
|
84
|
+
};
|