mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Remove kbn-ace, ace and brace dependencies (#195703)
This commit is contained in:
parent
446ad9475b
commit
d86ce77217
50 changed files with 4 additions and 2551 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -6,7 +6,6 @@
|
|||
####
|
||||
|
||||
x-pack/test/alerting_api_integration/common/plugins/aad @elastic/response-ops
|
||||
packages/kbn-ace @elastic/kibana-management
|
||||
x-pack/plugins/actions @elastic/response-ops
|
||||
x-pack/test/alerting_api_integration/common/plugins/actions_simulators @elastic/response-ops
|
||||
packages/kbn-actions-types @elastic/response-ops
|
||||
|
|
31
NOTICE.txt
31
NOTICE.txt
|
@ -68,37 +68,6 @@ Author Tobias Koppers @sokra
|
|||
---
|
||||
This product has relied on ASTExplorer that is licensed under MIT.
|
||||
|
||||
---
|
||||
This product includes code that is based on Ace editor, which was available
|
||||
under a "BSD" license.
|
||||
|
||||
Distributed under the BSD license:
|
||||
|
||||
Copyright (c) 2010, Ajax.org B.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Ajax.org B.V. nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
---
|
||||
This product includes code that is based on flot-charts, which was available
|
||||
under a "MIT" license.
|
||||
|
|
|
@ -1,210 +0,0 @@
|
|||
{
|
||||
"id": "@kbn/ace",
|
||||
"client": {
|
||||
"classes": [],
|
||||
"functions": [],
|
||||
"interfaces": [],
|
||||
"enums": [],
|
||||
"misc": [],
|
||||
"objects": []
|
||||
},
|
||||
"server": {
|
||||
"classes": [],
|
||||
"functions": [],
|
||||
"interfaces": [],
|
||||
"enums": [],
|
||||
"misc": [],
|
||||
"objects": []
|
||||
},
|
||||
"common": {
|
||||
"classes": [],
|
||||
"functions": [
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.addToRules",
|
||||
"type": "Function",
|
||||
"tags": [],
|
||||
"label": "addToRules",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"(otherRules: any, embedUnder: any) => void"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/x_json_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"children": [
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.addToRules.$1",
|
||||
"type": "Any",
|
||||
"tags": [],
|
||||
"label": "otherRules",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"any"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/x_json_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"isRequired": true
|
||||
},
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.addToRules.$2",
|
||||
"type": "Any",
|
||||
"tags": [],
|
||||
"label": "embedUnder",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"any"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/x_json_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"isRequired": true
|
||||
}
|
||||
],
|
||||
"returnComment": [],
|
||||
"initialIsOpen": false
|
||||
},
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.ElasticsearchSqlHighlightRules",
|
||||
"type": "Function",
|
||||
"tags": [],
|
||||
"label": "ElasticsearchSqlHighlightRules",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"(this: any) => void"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/elasticsearch_sql_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"returnComment": [],
|
||||
"children": [],
|
||||
"initialIsOpen": false
|
||||
},
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.installXJsonMode",
|
||||
"type": "Function",
|
||||
"tags": [],
|
||||
"label": "installXJsonMode",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"(editor: ",
|
||||
"Editor",
|
||||
") => void"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/x_json/x_json.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"children": [
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.installXJsonMode.$1",
|
||||
"type": "Object",
|
||||
"tags": [],
|
||||
"label": "editor",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"Editor"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/x_json/x_json.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"isRequired": true
|
||||
}
|
||||
],
|
||||
"returnComment": [],
|
||||
"initialIsOpen": false
|
||||
},
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.ScriptHighlightRules",
|
||||
"type": "Function",
|
||||
"tags": [],
|
||||
"label": "ScriptHighlightRules",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"(this: any) => void"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/script_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"children": [
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.ScriptHighlightRules.$1",
|
||||
"type": "Any",
|
||||
"tags": [],
|
||||
"label": "this",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"any"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/script_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"isRequired": true
|
||||
}
|
||||
],
|
||||
"returnComment": [],
|
||||
"initialIsOpen": false
|
||||
},
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.XJsonHighlightRules",
|
||||
"type": "Function",
|
||||
"tags": [],
|
||||
"label": "XJsonHighlightRules",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"(this: any) => void"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/x_json_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"children": [
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.XJsonHighlightRules.$1",
|
||||
"type": "Any",
|
||||
"tags": [],
|
||||
"label": "this",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"any"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/lexer_rules/x_json_highlight_rules.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"isRequired": true
|
||||
}
|
||||
],
|
||||
"returnComment": [],
|
||||
"initialIsOpen": false
|
||||
}
|
||||
],
|
||||
"interfaces": [],
|
||||
"enums": [],
|
||||
"misc": [
|
||||
{
|
||||
"parentPluginId": "@kbn/ace",
|
||||
"id": "def-common.XJsonMode",
|
||||
"type": "Any",
|
||||
"tags": [],
|
||||
"label": "XJsonMode",
|
||||
"description": [],
|
||||
"signature": [
|
||||
"any"
|
||||
],
|
||||
"path": "packages/kbn-ace/src/ace/modes/x_json/x_json.ts",
|
||||
"deprecated": false,
|
||||
"trackAdoption": false,
|
||||
"initialIsOpen": false
|
||||
}
|
||||
],
|
||||
"objects": []
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
---
|
||||
####
|
||||
#### This document is auto-generated and is meant to be viewed inside our experimental, new docs system.
|
||||
#### Reach out in #docs-engineering for more info.
|
||||
####
|
||||
id: kibKbnAcePluginApi
|
||||
slug: /kibana-dev-docs/api/kbn-ace
|
||||
title: "@kbn/ace"
|
||||
image: https://source.unsplash.com/400x175/?github
|
||||
description: API docs for the @kbn/ace plugin
|
||||
date: 2024-10-09
|
||||
tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ace']
|
||||
---
|
||||
import kbnAceObj from './kbn_ace.devdocs.json';
|
||||
|
||||
|
||||
|
||||
Contact [@elastic/kibana-management](https://github.com/orgs/elastic/teams/kibana-management) for questions regarding this plugin.
|
||||
|
||||
**Code health stats**
|
||||
|
||||
| Public API count | Any count | Items lacking comments | Missing exports |
|
||||
|-------------------|-----------|------------------------|-----------------|
|
||||
| 11 | 5 | 11 | 0 |
|
||||
|
||||
## Common
|
||||
|
||||
### Functions
|
||||
<DocDefinitionList data={kbnAceObj.common.functions}/>
|
||||
|
||||
### Consts, variables and types
|
||||
<DocDefinitionList data={kbnAceObj.common.misc}/>
|
||||
|
|
@ -242,7 +242,6 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana']
|
|||
|
||||
| Package name | Maintaining team | Description | API Cnt | Any Cnt | Missing<br />comments | Missing<br />exports |
|
||||
|--------------|----------------|-----------|--------------|----------|---------------|--------|
|
||||
| <DocLink id="kibKbnAcePluginApi" text="@kbn/ace"/> | [@elastic/kibana-management](https://github.com/orgs/elastic/teams/kibana-management) | - | 11 | 5 | 11 | 0 |
|
||||
| <DocLink id="kibKbnActionsTypesPluginApi" text="@kbn/actions-types"/> | [@elastic/response-ops](https://github.com/orgs/elastic/teams/response-ops) | - | 14 | 0 | 14 | 0 |
|
||||
| <DocLink id="kibKbnAiopsComponentsPluginApi" text="@kbn/aiops-components"/> | [@elastic/ml-ui](https://github.com/orgs/elastic/teams/ml-ui) | - | 36 | 0 | 0 | 0 |
|
||||
| <DocLink id="kibKbnAiopsLogPatternAnalysisPluginApi" text="@kbn/aiops-log-pattern-analysis"/> | [@elastic/ml-ui](https://github.com/orgs/elastic/teams/ml-ui) | - | 2 | 0 | 0 | 0 |
|
||||
|
@ -797,4 +796,3 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana']
|
|||
| <DocLink id="kibKbnYarnLockValidatorPluginApi" text="@kbn/yarn-lock-validator"/> | [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kibana-operations) | - | 9 | 0 | 4 | 0 |
|
||||
| <DocLink id="kibKbnZodPluginApi" text="@kbn/zod"/> | [@elastic/kibana-core](https://github.com/orgs/elastic/teams/kibana-core) | - | 1254 | 0 | 4 | 0 |
|
||||
| <DocLink id="kibKbnZodHelpersPluginApi" text="@kbn/zod-helpers"/> | [@elastic/security-detection-rule-management](https://github.com/orgs/elastic/teams/security-detection-rule-management) | - | 20 | 0 | 10 | 0 |
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ yarn kbn watch
|
|||
[discrete]
|
||||
=== List of Already Migrated Packages to Bazel
|
||||
|
||||
- @kbn/ace
|
||||
- @kbn/analytics
|
||||
- @kbn/apm-config-loader
|
||||
- @kbn/apm-utils
|
||||
|
@ -93,4 +92,4 @@ yarn kbn watch
|
|||
- @kbn/ui-shared-deps-npm
|
||||
- @kbn/ui-shared-deps-src
|
||||
- @kbn/utility-types
|
||||
- @kbn/utils
|
||||
- @kbn/utils
|
|
@ -154,7 +154,6 @@
|
|||
"@hapi/wreck": "^18.1.0",
|
||||
"@hello-pangea/dnd": "16.6.0",
|
||||
"@kbn/aad-fixtures-plugin": "link:x-pack/test/alerting_api_integration/common/plugins/aad",
|
||||
"@kbn/ace": "link:packages/kbn-ace",
|
||||
"@kbn/actions-plugin": "link:x-pack/plugins/actions",
|
||||
"@kbn/actions-simulators-plugin": "link:x-pack/test/alerting_api_integration/common/plugins/actions_simulators",
|
||||
"@kbn/actions-types": "link:packages/kbn-actions-types",
|
||||
|
@ -1066,7 +1065,6 @@
|
|||
"bitmap-sdf": "^1.0.3",
|
||||
"blurhash": "^2.0.1",
|
||||
"borc": "3.0.0",
|
||||
"brace": "0.11.1",
|
||||
"brok": "^6.0.0",
|
||||
"byte-size": "^8.1.0",
|
||||
"cacheable-lookup": "6",
|
||||
|
@ -1204,7 +1202,6 @@
|
|||
"re-resizable": "^6.9.9",
|
||||
"re2js": "0.4.2",
|
||||
"react": "^17.0.2",
|
||||
"react-ace": "^7.0.5",
|
||||
"react-diff-view": "^3.2.1",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-dropzone": "^4.2.9",
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# @kbn/ace
|
||||
|
||||
This package contains the XJSON mode for brace. This is an extension of the `brace/mode/json` mode.
|
||||
|
||||
This package also contains an import of the entire brace editor which is used for creating the custom XJSON worker.
|
||||
|
||||
## Note to plugins
|
||||
_This code should not be eagerly loaded_.
|
||||
|
||||
Make sure imports of this package are behind a lazy-load `import()` statement.
|
||||
|
||||
Your plugin should already be loading application code this way in the `mount` function.
|
||||
|
||||
## Deprecated
|
||||
|
||||
This package is considered deprecated and will be removed in future.
|
||||
|
||||
New and existing editor functionality should use Monaco.
|
||||
|
||||
_Do not add new functionality to this package_. Build new functionality for Monaco and use it instead.
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export {
|
||||
ElasticsearchSqlHighlightRules,
|
||||
ScriptHighlightRules,
|
||||
XJsonHighlightRules,
|
||||
addXJsonToRules,
|
||||
XJsonMode,
|
||||
installXJsonMode,
|
||||
} from './src/ace/modes';
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/ace",
|
||||
"owner": "@elastic/kibana-management"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"name": "@kbn/ace",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export {
|
||||
ElasticsearchSqlHighlightRules,
|
||||
ScriptHighlightRules,
|
||||
XJsonHighlightRules,
|
||||
addXJsonToRules,
|
||||
} from './lexer_rules';
|
||||
|
||||
export { installXJsonMode, XJsonMode } from './x_json';
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import ace from 'brace';
|
||||
|
||||
const { TextHighlightRules } = ace.acequire('ace/mode/text_highlight_rules');
|
||||
const oop = ace.acequire('ace/lib/oop');
|
||||
|
||||
export const ElasticsearchSqlHighlightRules = function (this: any) {
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-commands.html
|
||||
const keywords =
|
||||
'describe|between|in|like|not|and|or|desc|select|from|where|having|group|by|order' +
|
||||
'asc|desc|pivot|for|in|as|show|columns|include|frozen|tables|escape|limit|rlike|all|distinct|is';
|
||||
|
||||
const builtinConstants = 'true|false';
|
||||
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-syntax-show-functions.html
|
||||
const builtinFunctions =
|
||||
'avg|count|first|first_value|last|last_value|max|min|sum|kurtosis|mad|percentile|percentile_rank|skewness' +
|
||||
'|stddev_pop|sum_of_squares|var_pop|histogram|case|coalesce|greatest|ifnull|iif|isnull|least|nullif|nvl' +
|
||||
'|curdate|current_date|current_time|current_timestamp|curtime|dateadd|datediff|datepart|datetrunc|date_add' +
|
||||
'|date_diff|date_part|date_trunc|day|dayname|dayofmonth|dayofweek|dayofyear|day_name|day_of_month|day_of_week' +
|
||||
'|day_of_year|dom|dow|doy|hour|hour_of_day|idow|isodayofweek|isodow|isoweek|isoweekofyear|iso_day_of_week|iso_week_of_year' +
|
||||
'|iw|iwoy|minute|minute_of_day|minute_of_hour|month|monthname|month_name|month_of_year|now|quarter|second|second_of_minute' +
|
||||
'|timestampadd|timestampdiff|timestamp_add|timestamp_diff|today|week|week_of_year|year|abs|acos|asin|atan|atan2|cbrt' +
|
||||
'|ceil|ceiling|cos|cosh|cot|degrees|e|exp|expm1|floor|log|log10|mod|pi|power|radians|rand|random|round|sign|signum|sin' +
|
||||
'|sinh|sqrt|tan|truncate|ascii|bit_length|char|character_length|char_length|concat|insert|lcase|left|length|locate' +
|
||||
'|ltrim|octet_length|position|repeat|replace|right|rtrim|space|substring|ucase|cast|convert|database|user|st_astext|st_aswkt' +
|
||||
'|st_distance|st_geometrytype|st_geomfromtext|st_wkttosql|st_x|st_y|st_z|score';
|
||||
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-data-types.html
|
||||
const dataTypes =
|
||||
'null|boolean|byte|short|integer|long|double|float|half_float|scaled_float|keyword|text|binary|date|ip|object|nested|time' +
|
||||
'|interval_year|interval_month|interval_day|interval_hour|interval_minute|interval_second|interval_year_to_month' +
|
||||
'inteval_day_to_hour|interval_day_to_minute|interval_day_to_second|interval_hour_to_minute|interval_hour_to_second' +
|
||||
'interval_minute_to_second|geo_point|geo_shape|shape';
|
||||
|
||||
const keywordMapper = this.createKeywordMapper(
|
||||
{
|
||||
keyword: [keywords, builtinFunctions, builtinConstants, dataTypes].join('|'),
|
||||
},
|
||||
'identifier',
|
||||
true
|
||||
);
|
||||
|
||||
this.$rules = {
|
||||
start: [
|
||||
{
|
||||
token: 'comment',
|
||||
regex: '--.*$',
|
||||
},
|
||||
{
|
||||
token: 'comment',
|
||||
start: '/\\*',
|
||||
end: '\\*/',
|
||||
},
|
||||
{
|
||||
token: 'string', // " string
|
||||
regex: '".*?"',
|
||||
},
|
||||
{
|
||||
token: 'constant', // ' string
|
||||
regex: "'.*?'",
|
||||
},
|
||||
{
|
||||
token: 'string', // ` string (apache drill)
|
||||
regex: '`.*?`',
|
||||
},
|
||||
{
|
||||
token: 'entity.name.function', // float
|
||||
regex: '[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b',
|
||||
},
|
||||
{
|
||||
token: keywordMapper,
|
||||
regex: '[a-zA-Z_$][a-zA-Z0-9_$]*\\b',
|
||||
},
|
||||
{
|
||||
token: 'keyword.operator',
|
||||
regex: '⇐|<⇒|\\*|\\.|\\:\\:|\\+|\\-|\\/|\\/\\/|%|&|\\^|~|<|>|<=|=>|==|!=|<>|=',
|
||||
},
|
||||
{
|
||||
token: 'paren.lparen',
|
||||
regex: '[\\(]',
|
||||
},
|
||||
{
|
||||
token: 'paren.rparen',
|
||||
regex: '[\\)]',
|
||||
},
|
||||
{
|
||||
token: 'text',
|
||||
regex: '\\s+',
|
||||
},
|
||||
],
|
||||
};
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(ElasticsearchSqlHighlightRules, TextHighlightRules);
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { ElasticsearchSqlHighlightRules } from './elasticsearch_sql_highlight_rules';
|
||||
export { ScriptHighlightRules } from './script_highlight_rules';
|
||||
export { XJsonHighlightRules, addToRules as addXJsonToRules } from './x_json_highlight_rules';
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import ace from 'brace';
|
||||
const oop = ace.acequire('ace/lib/oop');
|
||||
const { TextHighlightRules } = ace.acequire('ace/mode/text_highlight_rules');
|
||||
const painlessKeywords =
|
||||
'def|int|long|byte|String|float|double|char|null|if|else|while|do|for|continue|break|new|try|catch|throw|this|instanceof|return|ctx';
|
||||
|
||||
export function ScriptHighlightRules(this: any) {
|
||||
this.name = 'ScriptHighlightRules';
|
||||
this.$rules = {
|
||||
start: [
|
||||
{
|
||||
token: 'script.comment',
|
||||
regex: '\\/\\/.*$',
|
||||
},
|
||||
{
|
||||
token: 'script.string.regexp',
|
||||
regex: '[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)',
|
||||
},
|
||||
{
|
||||
token: 'script.string', // single line
|
||||
regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
||||
},
|
||||
{
|
||||
token: 'script.constant.numeric', // hex
|
||||
regex: '0[xX][0-9a-fA-F]+\\b',
|
||||
},
|
||||
{
|
||||
token: 'script.constant.numeric', // float
|
||||
regex: '[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b',
|
||||
},
|
||||
{
|
||||
token: 'script.constant.language.boolean',
|
||||
regex: '(?:true|false)\\b',
|
||||
},
|
||||
{
|
||||
token: 'script.keyword',
|
||||
regex: painlessKeywords,
|
||||
},
|
||||
{
|
||||
token: 'script.text',
|
||||
regex: '[a-zA-Z_$][a-zA-Z0-9_$]*\\b',
|
||||
},
|
||||
{
|
||||
token: 'script.keyword.operator',
|
||||
regex:
|
||||
'\\?\\.|\\*\\.|=~|==~|!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|->|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|typeof|void)',
|
||||
},
|
||||
{
|
||||
token: 'script.lparen',
|
||||
regex: '[[({]',
|
||||
},
|
||||
{
|
||||
token: 'script.rparen',
|
||||
regex: '[\\])}]',
|
||||
},
|
||||
{
|
||||
token: 'script.text',
|
||||
regex: '\\s+',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
oop.inherits(ScriptHighlightRules, TextHighlightRules);
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { defaultsDeep } from 'lodash';
|
||||
import ace from 'brace';
|
||||
import 'brace/mode/json';
|
||||
|
||||
import { ElasticsearchSqlHighlightRules } from './elasticsearch_sql_highlight_rules';
|
||||
import { ScriptHighlightRules } from './script_highlight_rules';
|
||||
|
||||
const { JsonHighlightRules } = ace.acequire('ace/mode/json_highlight_rules');
|
||||
const oop = ace.acequire('ace/lib/oop');
|
||||
|
||||
const jsonRules = function (root: any) {
|
||||
root = root ? root : 'json';
|
||||
const rules: any = {};
|
||||
const xJsonRules = [
|
||||
{
|
||||
token: [
|
||||
'variable',
|
||||
'whitespace',
|
||||
'ace.punctuation.colon',
|
||||
'whitespace',
|
||||
'punctuation.start_triple_quote',
|
||||
],
|
||||
regex: '("(?:[^"]*_)?script"|"inline"|"source")(\\s*?)(:)(\\s*?)(""")',
|
||||
next: 'script-start',
|
||||
merge: false,
|
||||
push: true,
|
||||
},
|
||||
{
|
||||
token: 'variable', // single line
|
||||
regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)',
|
||||
},
|
||||
{
|
||||
token: 'punctuation.start_triple_quote',
|
||||
regex: '"""',
|
||||
next: 'string_literal',
|
||||
merge: false,
|
||||
push: true,
|
||||
},
|
||||
{
|
||||
token: 'string', // single line
|
||||
regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
|
||||
},
|
||||
{
|
||||
token: 'constant.numeric', // hex
|
||||
regex: '0[xX][0-9a-fA-F]+\\b',
|
||||
},
|
||||
{
|
||||
token: 'constant.numeric', // float
|
||||
regex: '[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b',
|
||||
},
|
||||
{
|
||||
token: 'constant.language.boolean',
|
||||
regex: '(?:true|false)\\b',
|
||||
},
|
||||
{
|
||||
token: 'invalid.illegal', // single quoted strings are not allowed
|
||||
regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
||||
},
|
||||
{
|
||||
token: 'invalid.illegal', // comments are not allowed
|
||||
regex: '\\/\\/.*$',
|
||||
},
|
||||
{
|
||||
token: 'paren.lparen',
|
||||
merge: false,
|
||||
regex: '{',
|
||||
next: root,
|
||||
push: true,
|
||||
},
|
||||
{
|
||||
token: 'paren.lparen',
|
||||
merge: false,
|
||||
regex: '[[(]',
|
||||
},
|
||||
{
|
||||
token: 'paren.rparen',
|
||||
merge: false,
|
||||
regex: '[\\])]',
|
||||
},
|
||||
{
|
||||
token: 'paren.rparen',
|
||||
regex: '}',
|
||||
merge: false,
|
||||
next: 'pop',
|
||||
},
|
||||
{
|
||||
token: 'punctuation.comma',
|
||||
regex: ',',
|
||||
},
|
||||
{
|
||||
token: 'punctuation.colon',
|
||||
regex: ':',
|
||||
},
|
||||
{
|
||||
token: 'whitespace',
|
||||
regex: '\\s+',
|
||||
},
|
||||
{
|
||||
token: 'text',
|
||||
regex: '.+?',
|
||||
},
|
||||
];
|
||||
|
||||
rules[root] = xJsonRules;
|
||||
rules[root + '-sql'] = [
|
||||
{
|
||||
token: [
|
||||
'variable',
|
||||
'whitespace',
|
||||
'ace.punctuation.colon',
|
||||
'whitespace',
|
||||
'punctuation.start_triple_quote',
|
||||
],
|
||||
regex: '("query")(\\s*?)(:)(\\s*?)(""")',
|
||||
next: 'sql-start',
|
||||
merge: false,
|
||||
push: true,
|
||||
},
|
||||
].concat(xJsonRules as any);
|
||||
|
||||
rules.string_literal = [
|
||||
{
|
||||
token: 'punctuation.end_triple_quote',
|
||||
regex: '"""',
|
||||
next: 'pop',
|
||||
},
|
||||
{
|
||||
token: 'multi_string',
|
||||
regex: '.',
|
||||
},
|
||||
];
|
||||
return rules;
|
||||
};
|
||||
|
||||
export function XJsonHighlightRules(this: any) {
|
||||
this.$rules = {
|
||||
...jsonRules('start'),
|
||||
};
|
||||
|
||||
this.embedRules(ScriptHighlightRules, 'script-', [
|
||||
{
|
||||
token: 'punctuation.end_triple_quote',
|
||||
regex: '"""',
|
||||
next: 'pop',
|
||||
},
|
||||
]);
|
||||
|
||||
this.embedRules(ElasticsearchSqlHighlightRules, 'sql-', [
|
||||
{
|
||||
token: 'punctuation.end_triple_quote',
|
||||
regex: '"""',
|
||||
next: 'pop',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
oop.inherits(XJsonHighlightRules, JsonHighlightRules);
|
||||
|
||||
export function addToRules(otherRules: any, embedUnder: any) {
|
||||
otherRules.$rules = defaultsDeep(otherRules.$rules, jsonRules(embedUnder));
|
||||
otherRules.embedRules(ScriptHighlightRules, 'script-', [
|
||||
{
|
||||
token: 'punctuation.end_triple_quote',
|
||||
regex: '"""',
|
||||
next: 'pop',
|
||||
},
|
||||
]);
|
||||
otherRules.embedRules(ElasticsearchSqlHighlightRules, 'sql-', [
|
||||
{
|
||||
token: 'punctuation.end_triple_quote',
|
||||
regex: '"""',
|
||||
next: 'pop',
|
||||
},
|
||||
]);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { installXJsonMode, XJsonMode } from './x_json';
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
// @ts-ignore
|
||||
import src from '!!raw-loader!./x_json.ace.worker';
|
||||
|
||||
export const workerModule = {
|
||||
id: 'ace/mode/json_worker',
|
||||
src,
|
||||
};
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
// Satisfy TS's requirements that the module be declared per './index.ts'.
|
||||
declare module '!!raw-loader!./worker.js' {
|
||||
const content: string;
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default content;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import ace from 'brace';
|
||||
import { XJsonHighlightRules } from '..';
|
||||
import { workerModule } from './worker';
|
||||
|
||||
const { WorkerClient } = ace.acequire('ace/worker/worker_client');
|
||||
|
||||
const oop = ace.acequire('ace/lib/oop');
|
||||
|
||||
const { Mode: JSONMode } = ace.acequire('ace/mode/json');
|
||||
const { Tokenizer: AceTokenizer } = ace.acequire('ace/tokenizer');
|
||||
const { MatchingBraceOutdent } = ace.acequire('ace/mode/matching_brace_outdent');
|
||||
const { CstyleBehaviour } = ace.acequire('ace/mode/behaviour/cstyle');
|
||||
const { FoldMode: CStyleFoldMode } = ace.acequire('ace/mode/folding/cstyle');
|
||||
|
||||
const XJsonMode: any = function XJsonMode(this: any) {
|
||||
const ruleset: any = new (XJsonHighlightRules as any)();
|
||||
ruleset.normalizeRules();
|
||||
this.$tokenizer = new AceTokenizer(ruleset.getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
|
||||
oop.inherits(XJsonMode, JSONMode);
|
||||
|
||||
// Then clobber `createWorker` method to install our worker source. Per ace's wiki: https://github.com/ajaxorg/ace/wiki/Syntax-validation
|
||||
(XJsonMode.prototype as any).createWorker = function (session: ace.IEditSession) {
|
||||
const xJsonWorker = new WorkerClient(['ace'], workerModule, 'JsonWorker');
|
||||
|
||||
xJsonWorker.attachToDocument(session.getDocument());
|
||||
|
||||
xJsonWorker.on('annotate', function (e: { data: any }) {
|
||||
session.setAnnotations(e.data);
|
||||
});
|
||||
|
||||
xJsonWorker.on('terminate', function () {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
return xJsonWorker;
|
||||
};
|
||||
|
||||
export { XJsonMode };
|
||||
|
||||
export function installXJsonMode(editor: ace.Editor) {
|
||||
const session = editor.getSession();
|
||||
session.setMode(new XJsonMode());
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": false,
|
||||
"outDir": "target/types",
|
||||
"stripInternal": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"src/ace/modes/x_json/worker/x_json.ace.worker.js"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
]
|
||||
}
|
|
@ -122,11 +122,6 @@ export class ImportResolver {
|
|||
return true;
|
||||
}
|
||||
|
||||
// ignore amd require done by ace syntax plugin
|
||||
if (req === 'ace/lib/dom') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// typescript validates these imports fine and they're purely virtual thanks to ambient type definitions in @elastic/eui so /shrug
|
||||
if (
|
||||
req.startsWith('@elastic/eui/src/components/') ||
|
||||
|
|
|
@ -99,12 +99,6 @@ describe('#resolve()', () => {
|
|||
}
|
||||
`);
|
||||
|
||||
expect(resolver.resolve('ace/lib/dom', FIXTURES_DIR)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"type": "ignore",
|
||||
}
|
||||
`);
|
||||
|
||||
expect(resolver.resolve('@elastic/eui/src/components/foo', FIXTURES_DIR))
|
||||
.toMatchInlineSnapshot(`
|
||||
Object {
|
||||
|
|
|
@ -70,7 +70,7 @@ module.exports = (request, options) => {
|
|||
return FILE_MOCK;
|
||||
}
|
||||
|
||||
if (reqExt === '.worker' && (reqBasename.endsWith('.ace') || reqBasename.endsWith('.editor'))) {
|
||||
if (reqExt === '.worker' && reqBasename.endsWith('.editor')) {
|
||||
return WORKER_MOCK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ RUNTIME_DEPS = [
|
|||
"@npm//jquery",
|
||||
"@npm//lodash",
|
||||
"@npm//moment-timezone",
|
||||
"@npm//react-ace",
|
||||
"@npm//react-dom",
|
||||
"@npm//react-router-dom",
|
||||
"@npm//react-router-dom-v5-compat",
|
||||
|
|
|
@ -88,7 +88,6 @@ module.exports = (_, argv) => {
|
|||
'moment-timezone/moment-timezone',
|
||||
'moment-timezone/data/packed/latest.json',
|
||||
'moment',
|
||||
'react-ace',
|
||||
'react-dom',
|
||||
'react-dom/server',
|
||||
'react-router-dom',
|
||||
|
|
|
@ -1,202 +0,0 @@
|
|||
// SASSTODO: Replace with an EUI editor
|
||||
// Intentionally not using the EuiCodeBlock colors here because they actually change
|
||||
// hue from light to dark theme. So some colors would change while others wouldn't.
|
||||
// Seemed weird, so just hexing all the colors but using the `makeHighContrastColor()`
|
||||
// function to ensure accessible contrast.
|
||||
|
||||
// In order to override the TM (Textmate) theme of Ace/Brace, everywhere,
|
||||
// it is being scoped by a known outer selector
|
||||
.kbnBody {
|
||||
.ace-tm {
|
||||
$aceBackground: tintOrShade($euiColorLightShade, 50%, 0);
|
||||
|
||||
background-color: $euiColorLightestShade;
|
||||
color: $euiTextColor;
|
||||
|
||||
.ace_scrollbar {
|
||||
@include euiScrollBar;
|
||||
}
|
||||
|
||||
.ace_gutter-active-line,
|
||||
.ace_marker-layer .ace_active-line {
|
||||
background-color: transparentize($euiColorLightShade, .3);
|
||||
}
|
||||
|
||||
.ace_snippet-marker {
|
||||
width: 100%;
|
||||
background-color: $aceBackground;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.ace_indent-guide {
|
||||
background: linear-gradient(to left, $euiColorMediumShade 0%, $euiColorMediumShade 1px, transparent 1px, transparent 100%);
|
||||
}
|
||||
|
||||
.ace_search {
|
||||
z-index: $euiZLevel1 + 1;
|
||||
}
|
||||
|
||||
.ace_layer.ace_marker-layer {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.ace_warning {
|
||||
color: $euiColorDanger;
|
||||
}
|
||||
|
||||
.ace_method {
|
||||
color: makeHighContrastColor(#DD0A73, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_url,
|
||||
.ace_start_triple_quote,
|
||||
.ace_end_triple_quote {
|
||||
color: makeHighContrastColor(#00A69B, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_multi_string {
|
||||
color: makeHighContrastColor(#009926, $aceBackground);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.ace_gutter {
|
||||
background-color: $euiColorEmptyShade;
|
||||
color: $euiColorDarkShade;
|
||||
border-left: 1px solid $aceBackground;
|
||||
}
|
||||
|
||||
.ace_print-margin {
|
||||
width: 1px;
|
||||
background: $euiColorLightShade;
|
||||
}
|
||||
|
||||
.ace_fold {
|
||||
background-color: #6B72E6;
|
||||
}
|
||||
|
||||
.ace_cursor {
|
||||
color: $euiColorFullShade;
|
||||
}
|
||||
|
||||
.ace_invisible {
|
||||
color: $euiColorLightShade;
|
||||
}
|
||||
|
||||
.ace_storage,
|
||||
.ace_keyword {
|
||||
color: makeHighContrastColor(#0079A5, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_constant {
|
||||
color: makeHighContrastColor(#900, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_constant.ace_buildin {
|
||||
color: makeHighContrastColor(rgb(88, 72, 246), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_constant.ace_language {
|
||||
color: makeHighContrastColor(rgb(88, 92, 246), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_constant.ace_library {
|
||||
color: makeHighContrastColor(#009926, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_invalid {
|
||||
background-color: euiCallOutColor('danger', 'background');
|
||||
color: euiCallOutColor('danger', 'foreground');
|
||||
}
|
||||
|
||||
.ace_support.ace_function {
|
||||
color: makeHighContrastColor(rgb(60, 76, 114), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_support.ace_constant {
|
||||
color: makeHighContrastColor(#009926, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_support.ace_type,
|
||||
.ace_support.ace_class {
|
||||
color: makeHighContrastColor(rgb(109, 121, 222), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_keyword.ace_operator {
|
||||
color: makeHighContrastColor($euiColorDarkShade, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_string {
|
||||
color: makeHighContrastColor(#009926, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_comment {
|
||||
color: makeHighContrastColor(rgb(76, 136, 107), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_comment.ace_doc {
|
||||
color: makeHighContrastColor(#0079A5, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_comment.ace_doc.ace_tag {
|
||||
color: makeHighContrastColor($euiColorMediumShade, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_constant.ace_numeric {
|
||||
color: makeHighContrastColor(#0079A5, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_variable {
|
||||
color: makeHighContrastColor(#0079A5, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_xml-pe {
|
||||
color: makeHighContrastColor($euiColorDarkShade, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_entity.ace_name.ace_function {
|
||||
color: makeHighContrastColor(#0000A2, $aceBackground);
|
||||
}
|
||||
|
||||
.ace_heading {
|
||||
color: makeHighContrastColor(rgb(12, 7, 255), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_list {
|
||||
color: makeHighContrastColor(rgb(185, 6, 144), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_meta.ace_tag {
|
||||
color: makeHighContrastColor(rgb(0, 22, 142), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_string.ace_regex {
|
||||
color: makeHighContrastColor(rgb(255, 0, 0), $aceBackground);
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selection {
|
||||
background: tintOrShade($euiColorPrimary, 70%, 70%);
|
||||
}
|
||||
|
||||
&.ace_multiselect .ace_selection.ace_start {
|
||||
box-shadow: 0 0 3px 0 $euiColorEmptyShade;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_step {
|
||||
background: tintOrShade($euiColorWarning, 80%, 80%);
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_stack {
|
||||
background: tintOrShade($euiColorSuccess, 80%, 80%);
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_bracket {
|
||||
margin: -1px 0 0 -1px;
|
||||
border: $euiBorderThin;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selected-word {
|
||||
background: $euiColorLightestShade;
|
||||
border: $euiBorderThin;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
@import './base';
|
||||
@import './ace_overrides';
|
||||
@import './chrome/index';
|
||||
@import './rendering/index';
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
.kbnUiAceKeyboardHint {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
background: transparentize($euiColorEmptyShade, .3);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
|
||||
&:focus {
|
||||
opacity: 1;
|
||||
border: 2px solid $euiColorPrimary;
|
||||
z-index: $euiZLevel1;
|
||||
}
|
||||
|
||||
&.kbnUiAceKeyboardHint-isInactive {
|
||||
display: none;
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { useUIAceKeyboardMode } from './use_ui_ace_keyboard_mode';
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import { keys, EuiText } from '@elastic/eui';
|
||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
|
||||
import './_ui_ace_keyboard_mode.scss';
|
||||
import type { AnalyticsServiceStart, I18nStart, ThemeServiceStart } from '@kbn/core/public';
|
||||
|
||||
interface StartServices {
|
||||
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
|
||||
i18n: I18nStart;
|
||||
theme: Pick<ThemeServiceStart, 'theme$'>;
|
||||
}
|
||||
|
||||
const OverlayText = (startServices: StartServices) => (
|
||||
// The point of this element is for accessibility purposes, so ignore eslint error
|
||||
// in this case
|
||||
//
|
||||
<KibanaRenderContextProvider {...startServices}>
|
||||
<EuiText size="s" data-test-subj="a11y-overlay">
|
||||
Press Enter to start editing.
|
||||
</EuiText>
|
||||
<EuiText size="s">When you’re done, press Escape to stop editing.</EuiText>
|
||||
</KibanaRenderContextProvider>
|
||||
);
|
||||
|
||||
export function useUIAceKeyboardMode(
|
||||
aceTextAreaElement: HTMLTextAreaElement | null,
|
||||
startServices: StartServices,
|
||||
isAccessibilityOverlayEnabled: boolean = true
|
||||
) {
|
||||
const overlayMountNode = useRef<HTMLDivElement | null>(null);
|
||||
const autoCompleteVisibleRef = useRef<boolean>(false);
|
||||
useEffect(() => {
|
||||
function onDismissOverlay(event: KeyboardEvent) {
|
||||
if (event.key === keys.ENTER) {
|
||||
event.preventDefault();
|
||||
aceTextAreaElement!.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function enableOverlay() {
|
||||
if (overlayMountNode.current) {
|
||||
overlayMountNode.current.focus();
|
||||
}
|
||||
}
|
||||
|
||||
const isAutoCompleteVisible = () => {
|
||||
const autoCompleter = document.querySelector<HTMLDivElement>('.ace_autocomplete');
|
||||
if (!autoCompleter) {
|
||||
return false;
|
||||
}
|
||||
// The autoComplete is just hidden when it's closed, not removed from the DOM.
|
||||
return autoCompleter.style.display !== 'none';
|
||||
};
|
||||
|
||||
const documentKeyDownListener = () => {
|
||||
autoCompleteVisibleRef.current = isAutoCompleteVisible();
|
||||
};
|
||||
|
||||
const aceKeydownListener = (event: KeyboardEvent) => {
|
||||
if (event.key === keys.ESCAPE && !autoCompleteVisibleRef.current) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
enableOverlay();
|
||||
}
|
||||
};
|
||||
if (aceTextAreaElement && isAccessibilityOverlayEnabled) {
|
||||
// We don't control HTML elements inside of ace so we imperatively create an element
|
||||
// that acts as a container and insert it just before ace's textarea element
|
||||
// so that the overlay lives at the correct spot in the DOM hierarchy.
|
||||
overlayMountNode.current = document.createElement('div');
|
||||
overlayMountNode.current.className = 'kbnUiAceKeyboardHint';
|
||||
overlayMountNode.current.setAttribute('role', 'application');
|
||||
overlayMountNode.current.tabIndex = 0;
|
||||
overlayMountNode.current.addEventListener('focus', enableOverlay);
|
||||
overlayMountNode.current.addEventListener('keydown', onDismissOverlay);
|
||||
|
||||
ReactDOM.render(<OverlayText {...startServices} />, overlayMountNode.current);
|
||||
|
||||
aceTextAreaElement.parentElement!.insertBefore(overlayMountNode.current, aceTextAreaElement);
|
||||
aceTextAreaElement.setAttribute('tabindex', '-1');
|
||||
|
||||
// Order of events:
|
||||
// 1. Document capture event fires first and we check whether an autocomplete menu is open on keydown
|
||||
// (not ideal because this is scoped to the entire document).
|
||||
// 2. Ace changes it's state (like hiding or showing autocomplete menu)
|
||||
// 3. We check what button was pressed and whether autocomplete was visible then determine
|
||||
// whether it should act like a dismiss or if we should display an overlay.
|
||||
document.addEventListener('keydown', documentKeyDownListener, { capture: true });
|
||||
aceTextAreaElement.addEventListener('keydown', aceKeydownListener);
|
||||
}
|
||||
return () => {
|
||||
if (aceTextAreaElement && isAccessibilityOverlayEnabled) {
|
||||
document.removeEventListener('keydown', documentKeyDownListener, { capture: true });
|
||||
aceTextAreaElement.removeEventListener('keydown', aceKeydownListener);
|
||||
const textAreaContainer = aceTextAreaElement.parentElement;
|
||||
if (textAreaContainer && textAreaContainer.contains(overlayMountNode.current!)) {
|
||||
textAreaContainer.removeChild(overlayMountNode.current!);
|
||||
}
|
||||
}
|
||||
};
|
||||
}, [aceTextAreaElement, startServices, isAccessibilityOverlayEnabled]);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { useUIAceKeyboardMode } from '../../__packages_do_not_import__/ace';
|
|
@ -12,7 +12,6 @@
|
|||
* In the future, each top level folder should be exported like that to avoid naming collision
|
||||
*/
|
||||
import * as Forms from './forms';
|
||||
import * as ace from './ace';
|
||||
import * as GlobalFlyout from './global_flyout';
|
||||
import * as XJson from './xjson';
|
||||
|
||||
|
@ -47,7 +46,7 @@ export {
|
|||
useAuthorizationContext,
|
||||
} from './authorization';
|
||||
|
||||
export { Forms, ace, GlobalFlyout, XJson };
|
||||
export { Forms, GlobalFlyout, XJson };
|
||||
|
||||
export { extractQueryParams, attemptToURIDecode } from './url';
|
||||
|
||||
|
|
|
@ -7,22 +7,6 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
/*
|
||||
@TODO
|
||||
|
||||
The react-ace and brace/mode/json imports below are loaded eagerly - before this plugin is explicitly loaded by users. This makes
|
||||
the brace JSON mode, used for JSON syntax highlighting and grammar checking, available across all of Kibana plugins.
|
||||
|
||||
This is not ideal because we are loading JS that is not necessary for Kibana to start, but the alternative
|
||||
is breaking JSON mode for an unknown number of ace editors across Kibana - not all components reference the underlying
|
||||
EuiCodeEditor (for instance, explicitly).
|
||||
|
||||
Importing here is a way of preventing a more sophisticated solution to this problem since we want to, eventually,
|
||||
migrate all code editors over to Monaco. Once that is done, we should remove this import.
|
||||
*/
|
||||
import 'react-ace';
|
||||
import 'brace/mode/json';
|
||||
|
||||
export * from './field';
|
||||
export * from './form_row';
|
||||
export * from './fields';
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
"@kbn/storybook",
|
||||
"@kbn/shared-ux-link-redirect-app",
|
||||
"@kbn/code-editor",
|
||||
"@kbn/react-kibana-context-render",
|
||||
"@kbn/core-application-common",
|
||||
],
|
||||
"exclude": [
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
import './index.scss';
|
||||
import 'brace/mode/json';
|
||||
|
||||
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
||||
import { EventEmitter } from 'events';
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
// 3. Filter in Discover by the scripted field
|
||||
// 4. Visualize with aggregation on the scripted field by clicking unifiedFieldList.clickFieldListItemVisualize
|
||||
|
||||
// NOTE: Scripted field input is managed by Ace editor, which automatically
|
||||
// appends closing braces, for exmaple, if you type opening square brace [
|
||||
// it will automatically insert a a closing square brace ], etc.
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
// 3. Filter in Discover by the scripted field
|
||||
// 4. Visualize with aggregation on the scripted field by clicking unifiedFieldList.clickFieldListItemVisualize
|
||||
|
||||
// NOTE: Scripted field input is managed by Ace editor, which automatically
|
||||
// appends closing braces, for exmaple, if you type opening square brace [
|
||||
// it will automatically insert a a closing square brace ], etc.
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
// START AUTOMATED PACKAGE LISTING
|
||||
"@kbn/aad-fixtures-plugin": ["x-pack/test/alerting_api_integration/common/plugins/aad"],
|
||||
"@kbn/aad-fixtures-plugin/*": ["x-pack/test/alerting_api_integration/common/plugins/aad/*"],
|
||||
"@kbn/ace": ["packages/kbn-ace"],
|
||||
"@kbn/ace/*": ["packages/kbn-ace/*"],
|
||||
"@kbn/actions-plugin": ["x-pack/plugins/actions"],
|
||||
"@kbn/actions-plugin/*": ["x-pack/plugins/actions/*"],
|
||||
"@kbn/actions-simulators-plugin": ["x-pack/test/alerting_api_integration/common/plugins/actions_simulators"],
|
||||
|
|
|
@ -30,8 +30,6 @@ import {
|
|||
EuiTextColor,
|
||||
EuiTitle,
|
||||
} from '@elastic/eui';
|
||||
import 'react-ace';
|
||||
import 'brace/theme/textmate';
|
||||
|
||||
import { getIndexListUri } from '@kbn/index-management-plugin/public';
|
||||
import { routing } from '../../../../../services/routing';
|
||||
|
|
|
@ -5,11 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
// brace/ace uses the Worker class, which is not currently provided by JSDOM.
|
||||
// This is not required for the tests to pass, but it rather suppresses lengthy
|
||||
// warnings in the console which adds unnecessary noise to the test output.
|
||||
import '@kbn/web-worker-stub';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '@kbn/core/public/mocks';
|
||||
|
|
|
@ -5,13 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import 'brace';
|
||||
import 'brace/mode/json';
|
||||
// brace/ace uses the Worker class, which is not currently provided by JSDOM.
|
||||
// This is not required for the tests to pass, but it rather suppresses lengthy
|
||||
// warnings in the console which adds unnecessary noise to the test output.
|
||||
import '@kbn/web-worker-stub';
|
||||
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import '@kbn/code-editor-mock/jest_helper';
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import 'react-ace';
|
||||
import 'brace/mode/json';
|
||||
import 'brace/theme/github';
|
||||
|
||||
import { EuiButton, EuiFormRow, EuiLink, EuiSpacer, EuiText } from '@elastic/eui';
|
||||
import React, { Fragment, useState } from 'react';
|
||||
|
||||
|
|
|
@ -5,11 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
// brace/ace uses the Worker class, which is not currently provided by JSDOM.
|
||||
// This is not required for the tests to pass, but it rather suppresses lengthy
|
||||
// warnings in the console which adds unnecessary noise to the test output.
|
||||
import '@kbn/web-worker-stub';
|
||||
|
||||
import { EuiErrorBoundary } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
"@kbn/core-saved-objects-api-server-internal",
|
||||
"@kbn/core-saved-objects-api-server-mocks",
|
||||
"@kbn/logging-mocks",
|
||||
"@kbn/web-worker-stub",
|
||||
"@kbn/core-saved-objects-utils-server",
|
||||
"@kbn/core-saved-objects-api-server",
|
||||
"@kbn/core-saved-objects-base-server-internal",
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import 'brace';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
import 'brace';
|
||||
import React, { useState } from 'react';
|
||||
import { docLinksServiceMock } from '@kbn/core/public/mocks';
|
||||
import { httpServiceMock } from '@kbn/core/public/mocks';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React, { memo, PropsWithChildren, useCallback } from 'react';
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import 'brace/theme/github';
|
||||
import { EuiCallOut, EuiHorizontalRule, EuiSpacer } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
|
|
22
yarn.lock
22
yarn.lock
|
@ -3295,10 +3295,6 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/ace@link:packages/kbn-ace":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/actions-plugin@link:x-pack/plugins/actions":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -13579,11 +13575,6 @@ brace-expansion@^2.0.1:
|
|||
dependencies:
|
||||
balanced-match "^1.0.0"
|
||||
|
||||
brace@0.11.1, brace@^0.11.1:
|
||||
version "0.11.1"
|
||||
resolved "https://registry.yarnpkg.com/brace/-/brace-0.11.1.tgz#4896fcc9d544eef45f4bb7660db320d3b379fe58"
|
||||
integrity sha1-SJb8ydVE7vRfS7dmDbMg07N5/lg=
|
||||
|
||||
braces@^2.3.1:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz"
|
||||
|
@ -16326,7 +16317,7 @@ diacritics@^1.3.0:
|
|||
resolved "https://registry.yarnpkg.com/diacritics/-/diacritics-1.3.0.tgz#3efa87323ebb863e6696cebb0082d48ff3d6f7a1"
|
||||
integrity sha1-PvqHMj67hj5mls67AILUj/PW96E=
|
||||
|
||||
diff-match-patch@^1.0.0, diff-match-patch@^1.0.4, diff-match-patch@^1.0.5:
|
||||
diff-match-patch@^1.0.0, diff-match-patch@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz#abb584d5f10cd1196dfc55aa03701592ae3f7b37"
|
||||
integrity sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==
|
||||
|
@ -26617,17 +26608,6 @@ re2js@0.4.2:
|
|||
resolved "https://registry.yarnpkg.com/re2js/-/re2js-0.4.2.tgz#e344697e64d128ea65c121d6581e67ee5bfa5feb"
|
||||
integrity sha512-wuv0p0BGbrVIkobV8zh82WjDurXko0QNCgaif6DdRAljgVm2iio4PVYCwjAxGaWen1/QZXWDM67dIslmz7AIbA==
|
||||
|
||||
react-ace@^7.0.5:
|
||||
version "7.0.5"
|
||||
resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-7.0.5.tgz#798299fd52ddf3a3dcc92afc5865538463544f01"
|
||||
integrity sha512-3iI+Rg2bZXCn9K984ll2OF4u9SGcJH96Q1KsUgs9v4M2WePS4YeEHfW2nrxuqJrAkE5kZbxaCE79k6kqK0YBjg==
|
||||
dependencies:
|
||||
brace "^0.11.1"
|
||||
diff-match-patch "^1.0.4"
|
||||
lodash.get "^4.4.2"
|
||||
lodash.isequal "^4.5.0"
|
||||
prop-types "^15.7.2"
|
||||
|
||||
react-clientside-effect@^1.2.6:
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/react-clientside-effect/-/react-clientside-effect-1.2.6.tgz#29f9b14e944a376b03fb650eed2a754dd128ea3a"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue