-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into task/onboarding-s…
…plash
- Loading branch information
Showing
772 changed files
with
12,398 additions
and
4,359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,8 +86,9 @@ | |
"**/@types/angular": "^1.6.56", | ||
"**/@types/hoist-non-react-statics": "^3.3.1", | ||
"**/@types/chai": "^4.2.11", | ||
"**/cypress/@types/lodash": "^4.14.155", | ||
"**/typescript": "3.9.5", | ||
"**/graphql-toolkit/lodash": "^4.17.13", | ||
"**/graphql-toolkit/lodash": "^4.17.15", | ||
"**/hoist-non-react-statics": "^3.3.2", | ||
"**/isomorphic-git/**/base64-js": "^1.2.1", | ||
"**/image-diff/gm/debug": "^2.6.9", | ||
|
@@ -122,7 +123,7 @@ | |
"@babel/plugin-transform-modules-commonjs": "^7.10.1", | ||
"@babel/register": "^7.10.1", | ||
"@elastic/apm-rum": "^5.2.0", | ||
"@elastic/charts": "19.6.3", | ||
"@elastic/charts": "19.7.0", | ||
"@elastic/datemath": "5.0.3", | ||
"@elastic/ems-client": "7.9.3", | ||
"@elastic/eui": "24.1.0", | ||
|
@@ -213,8 +214,7 @@ | |
"leaflet.heat": "0.2.0", | ||
"less": "npm:@elastic/[email protected]", | ||
"less-loader": "5.0.0", | ||
"lodash": "npm:@elastic/[email protected]", | ||
"lodash.clonedeep": "^4.5.0", | ||
"lodash": "^4.17.15", | ||
"lru-cache": "4.1.5", | ||
"markdown-it": "^10.0.0", | ||
"mini-css-extract-plugin": "0.8.0", | ||
|
@@ -355,8 +355,7 @@ | |
"@types/json5": "^0.0.30", | ||
"@types/license-checker": "15.0.0", | ||
"@types/listr": "^0.14.0", | ||
"@types/lodash": "^3.10.1", | ||
"@types/lodash.clonedeep": "^4.5.4", | ||
"@types/lodash": "^4.14.155", | ||
"@types/lru-cache": "^5.1.0", | ||
"@types/markdown-it": "^0.0.7", | ||
"@types/minimatch": "^2.0.29", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,7 @@ | |
"dependencies": { | ||
"@babel/runtime": "^7.10.2", | ||
"@kbn/i18n": "1.0.0", | ||
"lodash": "npm:@elastic/[email protected]", | ||
"lodash.clone": "^4.5.0", | ||
"lodash": "^4.17.15", | ||
"uuid": "3.3.2" | ||
}, | ||
"devDependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...bn-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/styles/_globals_v7light.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$globalStyleConstant: 11; |
1 change: 1 addition & 0 deletions
1
...kbn-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/styles/_globals_v8dark.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$globalStyleConstant: 12; |
1 change: 1 addition & 0 deletions
1
...bn-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/styles/_globals_v8light.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$globalStyleConstant: 13; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { parseThemeTags } from './theme_tags'; | ||
|
||
it('returns default tags when passed undefined', () => { | ||
expect(parseThemeTags()).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7dark", | ||
"v7light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns all tags when passed *', () => { | ||
expect(parseThemeTags('*')).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7dark", | ||
"v7light", | ||
"v8dark", | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns specific tag when passed a single value', () => { | ||
expect(parseThemeTags('v8light')).toMatchInlineSnapshot(` | ||
Array [ | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns specific tags when passed a comma separated list', () => { | ||
expect(parseThemeTags('v8light, v7dark,v7light')).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7dark", | ||
"v7light", | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns specific tags when passed an array', () => { | ||
expect(parseThemeTags(['v8light', 'v7light'])).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7light", | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('throws when an invalid tag is in the array', () => { | ||
expect(() => parseThemeTags(['v8light', 'v7light', 'bar'])).toThrowErrorMatchingInlineSnapshot( | ||
`"Invalid theme tags [bar], options: [v7dark, v7light, v8dark, v8light]"` | ||
); | ||
}); | ||
|
||
it('throws when an invalid tags in comma separated list', () => { | ||
expect(() => parseThemeTags('v8light ,v7light,bar,box ')).toThrowErrorMatchingInlineSnapshot( | ||
`"Invalid theme tags [bar, box], options: [v7dark, v7light, v8dark, v8light]"` | ||
); | ||
}); | ||
|
||
it('returns tags in alphabetical order', () => { | ||
const tags = parseThemeTags(['v7light', 'v8light']); | ||
expect(tags).toEqual(tags.slice().sort((a, b) => a.localeCompare(b))); | ||
}); | ||
|
||
it('returns an immutable array', () => { | ||
expect(() => { | ||
const tags = parseThemeTags('v8light'); | ||
// @ts-expect-error | ||
tags.push('foo'); | ||
}).toThrowErrorMatchingInlineSnapshot(`"Cannot add property 1, object is not extensible"`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { ascending } from './array_helpers'; | ||
|
||
const tags = (...themeTags: string[]) => | ||
Object.freeze(themeTags.sort(ascending((tag) => tag)) as ThemeTag[]); | ||
|
||
const validTag = (tag: any): tag is ThemeTag => ALL_THEMES.includes(tag); | ||
const isArrayOfStrings = (input: unknown): input is string[] => | ||
Array.isArray(input) && input.every((v) => typeof v === 'string'); | ||
|
||
export type ThemeTags = readonly ThemeTag[]; | ||
export type ThemeTag = 'v7light' | 'v7dark' | 'v8light' | 'v8dark'; | ||
export const DEFAULT_THEMES = tags('v7light', 'v7dark'); | ||
export const ALL_THEMES = tags('v7light', 'v7dark', 'v8light', 'v8dark'); | ||
|
||
export function parseThemeTags(input?: any): ThemeTags { | ||
if (!input) { | ||
return DEFAULT_THEMES; | ||
} | ||
|
||
if (input === '*') { | ||
return ALL_THEMES; | ||
} | ||
|
||
if (typeof input === 'string') { | ||
input = input.split(',').map((tag) => tag.trim()); | ||
} | ||
|
||
if (!isArrayOfStrings(input)) { | ||
throw new Error(`Invalid theme tags, must be an array of strings`); | ||
} | ||
|
||
if (!input.length) { | ||
throw new Error( | ||
`Invalid theme tags, you must specify at least one of [${ALL_THEMES.join(', ')}]` | ||
); | ||
} | ||
|
||
const invalidTags = input.filter((t) => !validTag(t)); | ||
if (invalidTags.length) { | ||
throw new Error( | ||
`Invalid theme tags [${invalidTags.join(', ')}], options: [${ALL_THEMES.join(', ')}]` | ||
); | ||
} | ||
|
||
return tags(...input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.