@elastic/eui-theme-common 0.0.1 → 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/lib/cjs/global_styling/functions/index.js +0 -5
- package/lib/cjs/global_styling/functions/index.js.map +1 -1
- package/lib/cjs/global_styling/functions/size.js +0 -8
- package/lib/cjs/global_styling/functions/size.js.map +1 -1
- package/lib/cjs/global_styling/index.js +0 -5
- package/lib/cjs/global_styling/index.js.map +1 -1
- package/lib/cjs/global_styling/types.d.ts +2 -0
- package/lib/cjs/global_styling/types.d.ts.map +1 -1
- package/lib/cjs/global_styling/types.js +0 -1
- package/lib/cjs/global_styling/types.js.map +1 -1
- package/lib/cjs/global_styling/variables/animations.js +0 -1
- package/lib/cjs/global_styling/variables/animations.js.map +1 -1
- package/lib/cjs/global_styling/variables/borders.js +0 -1
- package/lib/cjs/global_styling/variables/breakpoint.js +0 -1
- package/lib/cjs/global_styling/variables/breakpoint.js.map +1 -1
- package/lib/cjs/global_styling/variables/buttons.js +0 -1
- package/lib/cjs/global_styling/variables/colors.d.ts +45 -0
- package/lib/cjs/global_styling/variables/colors.d.ts.map +1 -1
- package/lib/cjs/global_styling/variables/colors.js +0 -1
- package/lib/cjs/global_styling/variables/colors.js.map +1 -1
- package/lib/cjs/global_styling/variables/components.d.ts +28 -0
- package/lib/cjs/global_styling/variables/components.d.ts.map +1 -1
- package/lib/cjs/global_styling/variables/components.js +0 -1
- package/lib/cjs/global_styling/variables/components.js.map +1 -1
- package/lib/cjs/global_styling/variables/flags.d.ts +8 -0
- package/lib/cjs/global_styling/variables/flags.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/flags.js +6 -0
- package/lib/cjs/global_styling/variables/flags.js.map +1 -0
- package/lib/cjs/global_styling/variables/forms.js +0 -1
- package/lib/cjs/global_styling/variables/index.d.ts +1 -1
- package/lib/cjs/global_styling/variables/index.d.ts.map +1 -1
- package/lib/cjs/global_styling/variables/index.js +11 -16
- package/lib/cjs/global_styling/variables/index.js.map +1 -1
- package/lib/cjs/global_styling/variables/levels.js +0 -1
- package/lib/cjs/global_styling/variables/levels.js.map +1 -1
- package/lib/cjs/global_styling/variables/shadow.js +0 -1
- package/lib/cjs/global_styling/variables/shadow.js.map +1 -1
- package/lib/cjs/global_styling/variables/size.js +0 -1
- package/lib/cjs/global_styling/variables/size.js.map +1 -1
- package/lib/cjs/global_styling/variables/states.js +0 -1
- package/lib/cjs/global_styling/variables/typography.js +0 -1
- package/lib/cjs/global_styling/variables/typography.js.map +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +11 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/services/index.d.ts +2 -0
- package/lib/cjs/services/index.d.ts.map +1 -0
- package/lib/cjs/services/index.js +17 -0
- package/lib/cjs/services/index.js.map +1 -0
- package/lib/cjs/services/vis_color_store.d.ts +34 -0
- package/lib/cjs/services/vis_color_store.d.ts.map +1 -0
- package/lib/cjs/services/vis_color_store.js +96 -0
- package/lib/cjs/services/vis_color_store.js.map +1 -0
- package/lib/cjs/services/vis_color_store.test.js +70 -0
- package/lib/cjs/services/vis_color_store.test.js.map +1 -0
- package/lib/cjs/types.js +0 -1
- package/lib/cjs/utils.js +0 -42
- package/lib/cjs/utils.js.map +1 -1
- package/lib/cjs/utils.test.js +0 -15
- package/lib/cjs/utils.test.js.map +1 -1
- package/lib/esm/global_styling/types.d.ts +2 -0
- package/lib/esm/global_styling/types.js.map +1 -1
- package/lib/esm/global_styling/variables/colors.d.ts +45 -0
- package/lib/esm/global_styling/variables/components.d.ts +28 -0
- package/lib/esm/global_styling/variables/flags.d.ts +7 -0
- package/lib/esm/global_styling/variables/flags.js +9 -0
- package/lib/esm/global_styling/variables/flags.js.map +1 -0
- package/lib/esm/global_styling/variables/index.d.ts +1 -1
- package/lib/esm/global_styling/variables/index.js +1 -1
- package/lib/esm/global_styling/variables/index.js.map +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/services/index.d.ts +1 -0
- package/lib/esm/services/index.js +9 -0
- package/lib/esm/services/index.js.map +1 -0
- package/lib/esm/services/vis_color_store.d.ts +33 -0
- package/lib/esm/services/vis_color_store.js +69 -0
- package/lib/esm/services/vis_color_store.js.map +1 -0
- package/lib/esm/services/vis_color_store.test.d.ts +1 -0
- package/lib/esm/services/vis_color_store.test.js +66 -0
- package/lib/esm/services/vis_color_store.test.js.map +1 -0
- package/package.json +9 -4
- package/src/global_styling/index.scss +0 -3
- package/src/global_styling/variables/_borders.scss +1 -1
- package/src/global_styling/variables/_index.scss +0 -1
- package/lib/cjs/.tsbuildinfo +0 -1
- package/lib/cjs/global_styling/variables/_colors_vis.d.ts +0 -13
- package/lib/cjs/global_styling/variables/_colors_vis.d.ts.map +0 -1
- package/lib/cjs/global_styling/variables/_colors_vis.js +0 -69
- package/lib/cjs/global_styling/variables/_colors_vis.js.map +0 -1
- package/lib/esm/.tsbuildinfo +0 -1
- package/lib/esm/global_styling/variables/_colors_vis.d.ts +0 -12
- package/lib/esm/global_styling/variables/_colors_vis.js +0 -60
- package/lib/esm/global_styling/variables/_colors_vis.js.map +0 -1
- package/src/global_styling/variables/_colors_vis.scss +0 -72
package/lib/cjs/utils.test.js
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.js");
|
|
4
|
-
require("core-js/modules/es.symbol.description.js");
|
|
5
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
6
|
-
require("core-js/modules/es.array.from.js");
|
|
7
|
-
require("core-js/modules/es.array.iterator.js");
|
|
8
|
-
require("core-js/modules/es.array.slice.js");
|
|
9
|
-
require("core-js/modules/es.date.to-string.js");
|
|
10
|
-
require("core-js/modules/es.function.name.js");
|
|
11
|
-
require("core-js/modules/es.object.to-string.js");
|
|
12
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
13
|
-
require("core-js/modules/es.regexp.test.js");
|
|
14
|
-
require("core-js/modules/es.regexp.to-string.js");
|
|
15
|
-
require("core-js/modules/es.string.iterator.js");
|
|
16
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
17
|
-
require("core-js/modules/es.array.is-array.js");
|
|
18
3
|
var _utils = require("./utils");
|
|
19
4
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
20
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.test.js","names":["_utils","require","_slicedToArray","r","e","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","t","toString","call","slice","constructor","name","Array","from","test","length","n","l","Symbol","iterator","i","u","f","o","next","Object","done","push","value","isArray","describe","it","expect","isInverseColorMode","toBe","getColorMode","toEqual","undefined","obj","parent","child","other","thing","string","nested","number","func","colors","LIGHT","primary","DARK","getOn","toBeInstanceOf","Function","beforeEach","existing","val","setOn","trail","blazing","happening","now","output","computed","_ref","_ref2","path","Computed","computer","dependencies","theme","buildTheme","secondary","_ref3","_ref4","concat","sizes","small","getComputed","themeName","tertiary","custom","myProp","_ref5","_ref6","key","mergeDeep","b","c","d","getTokenName"],"sources":["../../src/utils.test.ts"],"sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0 and the Server Side Public License, v 1; you may not use this file except\n * in compliance with, at your election, the Elastic License 2.0 or the Server\n * Side Public License, v 1.\n */\n\nimport {\n isInverseColorMode,\n getColorMode,\n getOn,\n setOn,\n computed,\n Computed,\n getComputed,\n buildTheme,\n mergeDeep,\n getTokenName,\n} from './utils';\n\ndescribe('isInverseColorMode', () => {\n it(\"true only if 'inverse'\", () => {\n expect(isInverseColorMode('LIGHT')).toBe(false);\n expect(isInverseColorMode('DARK')).toBe(false);\n expect(isInverseColorMode('custom')).toBe(false);\n expect(isInverseColorMode()).toBe(false);\n expect(isInverseColorMode('INVERSE')).toBe(true);\n });\n});\n\ndescribe('getColorMode', () => {\n it(\"defaults to 'LIGHT'\", () => {\n expect(getColorMode()).toEqual('LIGHT');\n });\n it('uses `parentMode` as fallback', () => {\n expect(getColorMode(undefined, 'DARK')).toEqual('DARK');\n });\n it(\"understands 'INVERSE'\", () => {\n expect(getColorMode('INVERSE', 'DARK')).toEqual('LIGHT');\n expect(getColorMode('INVERSE', 'LIGHT')).toEqual('DARK');\n expect(getColorMode('INVERSE')).toEqual('LIGHT');\n });\n});\n\ndescribe('getOn', () => {\n const obj = {\n parent: {\n child: 'childVal',\n },\n other: {\n thing: {\n string: 'stringVal',\n nested: ['array'],\n number: 0,\n func: () => {},\n },\n },\n colors: {\n LIGHT: { primary: '#000' },\n DARK: { primary: '#FFF' },\n },\n };\n it('gets values at the given path', () => {\n expect(getOn(obj, 'parent')).toEqual({\n child: 'childVal',\n });\n expect(getOn(obj, 'parent.child')).toEqual('childVal');\n expect(getOn(obj, 'other.thing.string')).toEqual('stringVal');\n });\n it('gets values of various kinds', () => {\n expect(getOn(obj, 'other.thing.nested')).toEqual(['array']);\n expect(getOn(obj, 'other.thing.number')).toEqual(0);\n expect(getOn(obj, 'other.thing.func')).toBeInstanceOf(Function);\n });\n it('can shortcut color modes', () => {\n expect(getOn(obj, 'colors.primary', 'LIGHT')).toEqual('#000');\n expect(getOn(obj, 'colors.primary', 'DARK')).toEqual('#FFF');\n });\n it('will not error', () => {\n expect(getOn(obj, 'nope')).toBe(undefined);\n expect(getOn(obj, 'other.nope')).toBe(undefined);\n expect(getOn(obj, 'other.thing.nope')).toBe(undefined);\n });\n});\n\ndescribe('setOn', () => {\n let obj: {};\n beforeEach(() => {\n obj = {\n existing: {\n nested: {\n val: 'value',\n },\n },\n };\n });\n it('sets values at the given path', () => {\n setOn(obj, 'existing.new', 'value');\n expect(obj).toEqual({\n existing: { nested: { val: 'value' }, new: 'value' },\n });\n setOn(obj, 'existing.nested.new', 'value');\n expect(obj).toEqual({\n existing: { nested: { val: 'value', new: 'value' }, new: 'value' },\n });\n });\n it('deep arbitrary creation', () => {\n setOn(obj, 'trail.blazing.happening.now', 'wow');\n expect(obj).toEqual({\n existing: { nested: { val: 'value' } },\n trail: { blazing: { happening: { now: 'wow' } } },\n });\n });\n it('overrides existing path value', () => {\n setOn(obj, 'existing.nested', 'diff');\n expect(obj).toEqual({\n existing: {\n nested: 'diff',\n },\n });\n });\n});\n\ndescribe('computed', () => {\n it('should transform to Computed with dependencies array', () => {\n const output = computed(([path]) => path, ['path.to']);\n expect(output).toBeInstanceOf(Computed);\n expect(output.computer).toBeInstanceOf(Function);\n expect(output.dependencies).toEqual(['path.to']);\n });\n it('should transform to Computed with single dependency', () => {\n const output = computed((path) => path, 'path.to');\n expect(output).toBeInstanceOf(Computed);\n expect(output.computer).toBeInstanceOf(Function);\n expect(output.dependencies).toEqual('path.to');\n });\n it('should transform to Computed without dependencies array', () => {\n const output = computed((path) => path);\n expect(output).toBeInstanceOf(Computed);\n });\n});\n\nconst theme = buildTheme(\n {\n colors: {\n LIGHT: {\n primary: '#000',\n secondary: computed(([primary]) => `${primary}000`, ['colors.primary']),\n },\n DARK: {\n primary: '#FFF',\n secondary: computed((theme) => `${theme.colors.primary}FFF`),\n },\n },\n sizes: {\n small: 8,\n },\n },\n 'minimal'\n);\ndescribe('getComputed', () => {\n it('computes all values and returns only the current color mode', () => {\n // @ts-expect-error intentionally not using a full EUI theme definition\n expect(getComputed(theme, {}, 'LIGHT')).toEqual({\n colors: { primary: '#000', secondary: '#000000' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n // @ts-expect-error intentionally not using a full EUI theme definition\n expect(getComputed(theme, {}, 'DARK')).toEqual({\n colors: { primary: '#FFF', secondary: '#FFFFFF' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n it('respects simple overrides', () => {\n expect(\n // @ts-expect-error intentionally not using a full EUI theme definition\n getComputed(theme, buildTheme({ sizes: { small: 4 } }, ''), 'LIGHT')\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000' },\n sizes: { small: 4 },\n themeName: 'minimal',\n });\n });\n it('respects overrides in computation', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme({ colors: { LIGHT: { primary: '#CCC' } } }, ''),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#CCC', secondary: '#CCC000' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n it('respects property extensions', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme({ colors: { LIGHT: { tertiary: '#333' } } }, ''),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000', tertiary: '#333' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n it('respects section extensions', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme({ custom: { myProp: '#333' } }, ''),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000' },\n sizes: { small: 8 },\n custom: { myProp: '#333' },\n themeName: 'minimal',\n });\n });\n it('respects extensions in computation', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme(\n {\n colors: {\n LIGHT: {\n tertiary: computed(\n ([primary]) => `${primary}333`,\n ['colors.primary']\n ),\n },\n },\n },\n ''\n ),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000', tertiary: '#000333' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n});\n\ndescribe('buildTheme', () => {\n it('builds an EUI theme system', () => {\n // TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for property 'length' which is either non-existant or configurable in the proxy target\n // expect(theme).toEqual(Proxy); // get() trap returns theme.model\n // expect(theme.root).toEqual(Proxy);\n expect(theme.key).toEqual('minimal');\n });\n});\n\ndescribe('mergeDeep', () => {\n it('merge simple objects, second into first', () => {\n expect(mergeDeep({ a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 });\n expect(mergeDeep({ a: 1 }, { a: 2 })).toEqual({ a: 2 });\n });\n it('merge complex objects, second into first', () => {\n expect(\n mergeDeep({ a: 1, b: { c: { d: 3 } } }, { b: { c: { d: 4 } } })\n ).toEqual({ a: 1, b: { c: { d: 4 } } });\n expect(\n mergeDeep({ a: 1, b: { c: { d: 3 } } }, { b: { c: { e: 5 } } })\n ).toEqual({ a: 1, b: { c: { d: 3, e: 5 } } });\n });\n});\n\ndescribe('getTokenName', () => {\n it('returns the correct token name', () => {\n expect(getTokenName('backgroundBase', 'primary')).toEqual(\n 'backgroundBasePrimary'\n );\n expect(getTokenName('backgroundBase', 'primary', 'hovered')).toEqual(\n 'backgroundBasePrimaryHovered'\n );\n });\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAAA,MAAA,GAAAC,OAAA;AAWiB,SAAAC,eAAAC,CAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,CAAA,KAAAG,qBAAA,CAAAH,CAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,CAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAJ,CAAA,EAAAO,CAAA,QAAAP,CAAA,2BAAAA,CAAA,SAAAQ,iBAAA,CAAAR,CAAA,EAAAO,CAAA,OAAAE,CAAA,MAAAC,QAAA,CAAAC,IAAA,CAAAX,CAAA,EAAAY,KAAA,6BAAAH,CAAA,IAAAT,CAAA,CAAAa,WAAA,KAAAJ,CAAA,GAAAT,CAAA,CAAAa,WAAA,C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AAM,CAAC,IAAA0D,mBAAY,EAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAACtD,OAAO,CACvD,uBACF,CAAC;IACDJ,MAAM,CAAC,IAAA0D,mBAAY,EAAC,gBAAgB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAACtD,OAAO,CAClE,8BACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"utils.test.js","names":["_utils","require","_slicedToArray","r","e","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","t","toString","call","slice","constructor","name","Array","from","test","length","n","l","Symbol","iterator","i","u","f","o","next","Object","done","push","value","isArray","describe","it","expect","isInverseColorMode","toBe","getColorMode","toEqual","undefined","obj","parent","child","other","thing","string","nested","number","func","colors","LIGHT","primary","DARK","getOn","toBeInstanceOf","Function","beforeEach","existing","val","setOn","trail","blazing","happening","now","output","computed","_ref","_ref2","path","Computed","computer","dependencies","theme","buildTheme","secondary","_ref3","_ref4","concat","sizes","small","getComputed","themeName","tertiary","custom","myProp","_ref5","_ref6","key","mergeDeep","b","c","d","getTokenName"],"sources":["../../src/utils.test.ts"],"sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0 and the Server Side Public License, v 1; you may not use this file except\n * in compliance with, at your election, the Elastic License 2.0 or the Server\n * Side Public License, v 1.\n */\n\nimport {\n isInverseColorMode,\n getColorMode,\n getOn,\n setOn,\n computed,\n Computed,\n getComputed,\n buildTheme,\n mergeDeep,\n getTokenName,\n} from './utils';\n\ndescribe('isInverseColorMode', () => {\n it(\"true only if 'inverse'\", () => {\n expect(isInverseColorMode('LIGHT')).toBe(false);\n expect(isInverseColorMode('DARK')).toBe(false);\n expect(isInverseColorMode('custom')).toBe(false);\n expect(isInverseColorMode()).toBe(false);\n expect(isInverseColorMode('INVERSE')).toBe(true);\n });\n});\n\ndescribe('getColorMode', () => {\n it(\"defaults to 'LIGHT'\", () => {\n expect(getColorMode()).toEqual('LIGHT');\n });\n it('uses `parentMode` as fallback', () => {\n expect(getColorMode(undefined, 'DARK')).toEqual('DARK');\n });\n it(\"understands 'INVERSE'\", () => {\n expect(getColorMode('INVERSE', 'DARK')).toEqual('LIGHT');\n expect(getColorMode('INVERSE', 'LIGHT')).toEqual('DARK');\n expect(getColorMode('INVERSE')).toEqual('LIGHT');\n });\n});\n\ndescribe('getOn', () => {\n const obj = {\n parent: {\n child: 'childVal',\n },\n other: {\n thing: {\n string: 'stringVal',\n nested: ['array'],\n number: 0,\n func: () => {},\n },\n },\n colors: {\n LIGHT: { primary: '#000' },\n DARK: { primary: '#FFF' },\n },\n };\n it('gets values at the given path', () => {\n expect(getOn(obj, 'parent')).toEqual({\n child: 'childVal',\n });\n expect(getOn(obj, 'parent.child')).toEqual('childVal');\n expect(getOn(obj, 'other.thing.string')).toEqual('stringVal');\n });\n it('gets values of various kinds', () => {\n expect(getOn(obj, 'other.thing.nested')).toEqual(['array']);\n expect(getOn(obj, 'other.thing.number')).toEqual(0);\n expect(getOn(obj, 'other.thing.func')).toBeInstanceOf(Function);\n });\n it('can shortcut color modes', () => {\n expect(getOn(obj, 'colors.primary', 'LIGHT')).toEqual('#000');\n expect(getOn(obj, 'colors.primary', 'DARK')).toEqual('#FFF');\n });\n it('will not error', () => {\n expect(getOn(obj, 'nope')).toBe(undefined);\n expect(getOn(obj, 'other.nope')).toBe(undefined);\n expect(getOn(obj, 'other.thing.nope')).toBe(undefined);\n });\n});\n\ndescribe('setOn', () => {\n let obj: {};\n beforeEach(() => {\n obj = {\n existing: {\n nested: {\n val: 'value',\n },\n },\n };\n });\n it('sets values at the given path', () => {\n setOn(obj, 'existing.new', 'value');\n expect(obj).toEqual({\n existing: { nested: { val: 'value' }, new: 'value' },\n });\n setOn(obj, 'existing.nested.new', 'value');\n expect(obj).toEqual({\n existing: { nested: { val: 'value', new: 'value' }, new: 'value' },\n });\n });\n it('deep arbitrary creation', () => {\n setOn(obj, 'trail.blazing.happening.now', 'wow');\n expect(obj).toEqual({\n existing: { nested: { val: 'value' } },\n trail: { blazing: { happening: { now: 'wow' } } },\n });\n });\n it('overrides existing path value', () => {\n setOn(obj, 'existing.nested', 'diff');\n expect(obj).toEqual({\n existing: {\n nested: 'diff',\n },\n });\n });\n});\n\ndescribe('computed', () => {\n it('should transform to Computed with dependencies array', () => {\n const output = computed(([path]) => path, ['path.to']);\n expect(output).toBeInstanceOf(Computed);\n expect(output.computer).toBeInstanceOf(Function);\n expect(output.dependencies).toEqual(['path.to']);\n });\n it('should transform to Computed with single dependency', () => {\n const output = computed((path) => path, 'path.to');\n expect(output).toBeInstanceOf(Computed);\n expect(output.computer).toBeInstanceOf(Function);\n expect(output.dependencies).toEqual('path.to');\n });\n it('should transform to Computed without dependencies array', () => {\n const output = computed((path) => path);\n expect(output).toBeInstanceOf(Computed);\n });\n});\n\nconst theme = buildTheme(\n {\n colors: {\n LIGHT: {\n primary: '#000',\n secondary: computed(([primary]) => `${primary}000`, ['colors.primary']),\n },\n DARK: {\n primary: '#FFF',\n secondary: computed((theme) => `${theme.colors.primary}FFF`),\n },\n },\n sizes: {\n small: 8,\n },\n },\n 'minimal'\n);\ndescribe('getComputed', () => {\n it('computes all values and returns only the current color mode', () => {\n // @ts-expect-error intentionally not using a full EUI theme definition\n expect(getComputed(theme, {}, 'LIGHT')).toEqual({\n colors: { primary: '#000', secondary: '#000000' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n // @ts-expect-error intentionally not using a full EUI theme definition\n expect(getComputed(theme, {}, 'DARK')).toEqual({\n colors: { primary: '#FFF', secondary: '#FFFFFF' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n it('respects simple overrides', () => {\n expect(\n // @ts-expect-error intentionally not using a full EUI theme definition\n getComputed(theme, buildTheme({ sizes: { small: 4 } }, ''), 'LIGHT')\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000' },\n sizes: { small: 4 },\n themeName: 'minimal',\n });\n });\n it('respects overrides in computation', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme({ colors: { LIGHT: { primary: '#CCC' } } }, ''),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#CCC', secondary: '#CCC000' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n it('respects property extensions', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme({ colors: { LIGHT: { tertiary: '#333' } } }, ''),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000', tertiary: '#333' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n it('respects section extensions', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme({ custom: { myProp: '#333' } }, ''),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000' },\n sizes: { small: 8 },\n custom: { myProp: '#333' },\n themeName: 'minimal',\n });\n });\n it('respects extensions in computation', () => {\n expect(\n getComputed(\n // @ts-expect-error intentionally not using a full EUI theme definition\n theme,\n buildTheme(\n {\n colors: {\n LIGHT: {\n tertiary: computed(\n ([primary]) => `${primary}333`,\n ['colors.primary']\n ),\n },\n },\n },\n ''\n ),\n 'LIGHT'\n )\n ).toEqual({\n colors: { primary: '#000', secondary: '#000000', tertiary: '#000333' },\n sizes: { small: 8 },\n themeName: 'minimal',\n });\n });\n});\n\ndescribe('buildTheme', () => {\n it('builds an EUI theme system', () => {\n // TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for property 'length' which is either non-existant or configurable in the proxy target\n // expect(theme).toEqual(Proxy); // get() trap returns theme.model\n // expect(theme.root).toEqual(Proxy);\n expect(theme.key).toEqual('minimal');\n });\n});\n\ndescribe('mergeDeep', () => {\n it('merge simple objects, second into first', () => {\n expect(mergeDeep({ a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 });\n expect(mergeDeep({ a: 1 }, { a: 2 })).toEqual({ a: 2 });\n });\n it('merge complex objects, second into first', () => {\n expect(\n mergeDeep({ a: 1, b: { c: { d: 3 } } }, { b: { c: { d: 4 } } })\n ).toEqual({ a: 1, b: { c: { d: 4 } } });\n expect(\n mergeDeep({ a: 1, b: { c: { d: 3 } } }, { b: { c: { e: 5 } } })\n ).toEqual({ a: 1, b: { c: { d: 3, e: 5 } } });\n });\n});\n\ndescribe('getTokenName', () => {\n it('returns the correct token name', () => {\n expect(getTokenName('backgroundBase', 'primary')).toEqual(\n 'backgroundBasePrimary'\n );\n expect(getTokenName('backgroundBase', 'primary', 'hovered')).toEqual(\n 'backgroundBasePrimaryHovered'\n );\n });\n});\n"],"mappings":";;AAQA,IAAAA,MAAA,GAAAC,OAAA;AAWiB,SAAAC,eAAAC,CAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,CAAA,KAAAG,qBAAA,CAAAH,CAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,CAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAJ,CAAA,EAAAO,CAAA,QAAAP,CAAA,2BAAAA,CAAA,SAAAQ,iBAAA,CAAAR,CAAA,EAAAO,CAAA,OAAAE,CAAA,MAAAC,QAAA,CAAAC,IAAA,CAAAX,CAAA,EAAAY,KAAA,6BAAAH,CAAA,IAAAT,CAAA,CAAAa,WAAA,KAAAJ,CAAA,GAAAT,CAAA,CAAAa,WAAA,CAAAC,IAAA,aAAAL,CAAA,cAAAA,CAAA,GAAAM,KAAA,CAAAC,IAAA,CAAAhB,CAAA,oBAAAS,CAAA,+CAAAQ,IAAA,CAAAR,CAAA,IAAAD,iBAAA,CAAAR,CAAA,EAAAO,CAAA;AAAA,SAAAC,kBAAAR,CAAA,EAAAO,CAAA,aAAAA,CAAA,IAAAA,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AAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ import { _EuiThemeFont } from './variables/typography';
|
|
|
9
9
|
import { _EuiThemeFocus } from './variables/states';
|
|
10
10
|
import { _EuiThemeLevels } from './variables/levels';
|
|
11
11
|
import { _EuiThemeComponents } from './variables/components';
|
|
12
|
+
import { _EuiThemeFlags } from './variables';
|
|
12
13
|
export declare const COLOR_MODES_STANDARD: {
|
|
13
14
|
readonly light: "LIGHT";
|
|
14
15
|
readonly dark: "DARK";
|
|
@@ -38,6 +39,7 @@ export declare type EuiThemeShape = {
|
|
|
38
39
|
breakpoint: _EuiThemeBreakpoints;
|
|
39
40
|
levels: _EuiThemeLevels;
|
|
40
41
|
components: _EuiThemeComponents;
|
|
42
|
+
flags: _EuiThemeFlags;
|
|
41
43
|
};
|
|
42
44
|
export declare type EuiThemeSystem<T = {}> = {
|
|
43
45
|
root: EuiThemeShape & T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/global_styling/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/global_styling/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACJ,CAAC;AACX,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAkB,CAAC"}
|
|
@@ -228,6 +228,50 @@ export declare type _EuiThemeBorderColors = {
|
|
|
228
228
|
borderStrongWarning: ColorModeSwitch;
|
|
229
229
|
borderStrongDanger: ColorModeSwitch;
|
|
230
230
|
};
|
|
231
|
+
export declare type _EuiThemeVisColors = {
|
|
232
|
+
euiColorVis0: string;
|
|
233
|
+
euiColorVis1: string;
|
|
234
|
+
euiColorVis2: string;
|
|
235
|
+
euiColorVis3: string;
|
|
236
|
+
euiColorVis4: string;
|
|
237
|
+
euiColorVis5: string;
|
|
238
|
+
euiColorVis6: string;
|
|
239
|
+
euiColorVis7: string;
|
|
240
|
+
euiColorVis8: string;
|
|
241
|
+
euiColorVis9: string;
|
|
242
|
+
euiColorVisAsTextLight0: string;
|
|
243
|
+
euiColorVisAsTextLight1: string;
|
|
244
|
+
euiColorVisAsTextLight2: string;
|
|
245
|
+
euiColorVisAsTextLight3: string;
|
|
246
|
+
euiColorVisAsTextLight4: string;
|
|
247
|
+
euiColorVisAsTextLight5: string;
|
|
248
|
+
euiColorVisAsTextLight6: string;
|
|
249
|
+
euiColorVisAsTextDark0: string;
|
|
250
|
+
euiColorVisAsTextDark1: string;
|
|
251
|
+
euiColorVisAsTextDark2: string;
|
|
252
|
+
euiColorVisAsTextDark3: string;
|
|
253
|
+
euiColorVisAsTextDark4: string;
|
|
254
|
+
euiColorVisAsTextDark5: string;
|
|
255
|
+
euiColorVisAsTextDark6: string;
|
|
256
|
+
euiColorVisSuccess0: string;
|
|
257
|
+
euiColorVisSuccess1: string;
|
|
258
|
+
euiColorVisWarning0: string;
|
|
259
|
+
euiColorVisDanger0: string;
|
|
260
|
+
euiColorVisDanger1: string;
|
|
261
|
+
euiColorVisNeutral0: string;
|
|
262
|
+
euiColorVisGrey0: string;
|
|
263
|
+
euiColorVisGrey1: string;
|
|
264
|
+
euiColorVisGrey2: string;
|
|
265
|
+
euiColorVisGrey3: string;
|
|
266
|
+
euiColorVisWarm0: string;
|
|
267
|
+
euiColorVisWarm1: string;
|
|
268
|
+
euiColorVisWarm2: string;
|
|
269
|
+
euiColorVisCool0: string;
|
|
270
|
+
euiColorVisCool1: string;
|
|
271
|
+
euiColorVisCool2: string;
|
|
272
|
+
euiColorVisComplementary0: string;
|
|
273
|
+
euiColorVisComplementary1: string;
|
|
274
|
+
};
|
|
231
275
|
export declare type _EuiThemeConstantColors = {
|
|
232
276
|
/**
|
|
233
277
|
* Purest **white**
|
|
@@ -239,6 +283,7 @@ export declare type _EuiThemeConstantColors = {
|
|
|
239
283
|
* @deprecated
|
|
240
284
|
*/
|
|
241
285
|
ink: string;
|
|
286
|
+
vis: _EuiThemeVisColors;
|
|
242
287
|
};
|
|
243
288
|
export declare type _EuiThemeColorsMode = _EuiThemeBrandColors & _EuiThemeBrandTextColors & _EuiThemeShadeColors & _EuiThemeSpecialColors & _EuiThemeTextColors & _EuiThemeBackgroundColors & _EuiThemeTransparentBackgroundColors & _EuiThemeBorderColors;
|
|
244
289
|
export declare type _EuiThemeColors = StrictColorModeSwitch<_EuiThemeColorsMode> & _EuiThemeConstantColors;
|
|
@@ -4,12 +4,36 @@ import { _EuiThemeFormColors } from './forms';
|
|
|
4
4
|
export declare type _EuiThemeComponentColors = {
|
|
5
5
|
buttonGroupBorderColor: ColorModeSwitch;
|
|
6
6
|
buttonGroupBorderColorSelected: ColorModeSwitch;
|
|
7
|
+
buttonGroupFocusColor: ColorModeSwitch;
|
|
7
8
|
badgeBackgroundSubdued: ColorModeSwitch;
|
|
8
9
|
badgeBorderColorHollow: ColorModeSwitch;
|
|
9
10
|
badgeIconButtonBackgroundHover: ColorModeSwitch;
|
|
10
11
|
bottomBarBackground: ColorModeSwitch;
|
|
11
12
|
breadcrumbsApplicationBackground: ColorModeSwitch;
|
|
12
13
|
breadcrumbsApplicationColor: ColorModeSwitch;
|
|
14
|
+
codeBackground: ColorModeSwitch;
|
|
15
|
+
codeBackgroundSelected: ColorModeSwitch;
|
|
16
|
+
codeColor: ColorModeSwitch;
|
|
17
|
+
codeInlineColor: ColorModeSwitch;
|
|
18
|
+
codeCommentColor: ColorModeSwitch;
|
|
19
|
+
codeSelectorColor: ColorModeSwitch;
|
|
20
|
+
codeStringColor: ColorModeSwitch;
|
|
21
|
+
codeTagColor: ColorModeSwitch;
|
|
22
|
+
codeNameColor: ColorModeSwitch;
|
|
23
|
+
codeNumberColor: ColorModeSwitch;
|
|
24
|
+
codeKeywordColor: ColorModeSwitch;
|
|
25
|
+
codeFunctionTitleColor: ColorModeSwitch;
|
|
26
|
+
codeTypeColor: ColorModeSwitch;
|
|
27
|
+
codeAttributeColor: ColorModeSwitch;
|
|
28
|
+
codeSymbolColor: ColorModeSwitch;
|
|
29
|
+
codeParamsColor: ColorModeSwitch;
|
|
30
|
+
codeMetaColor: ColorModeSwitch;
|
|
31
|
+
codeTitleColor: ColorModeSwitch;
|
|
32
|
+
codeSectionColor: ColorModeSwitch;
|
|
33
|
+
codeAdditionColor: ColorModeSwitch;
|
|
34
|
+
codeDeletionColor: ColorModeSwitch;
|
|
35
|
+
codeSelectorClassColor: ColorModeSwitch;
|
|
36
|
+
codeSelectorIdColor: ColorModeSwitch;
|
|
13
37
|
collapsibleNavGroupBackground: ColorModeSwitch;
|
|
14
38
|
collapsibleNavGroupBackgroundDark: ColorModeSwitch;
|
|
15
39
|
dataGridVerticalLineBorderColor: ColorModeSwitch;
|
|
@@ -28,6 +52,10 @@ export declare type _EuiThemeComponentColors = {
|
|
|
28
52
|
listGroupItemBackgroundSubduedActive: ColorModeSwitch;
|
|
29
53
|
listGroupItemBackgroundHover: ColorModeSwitch;
|
|
30
54
|
listGroupItemBackgroundPrimaryHover: ColorModeSwitch;
|
|
55
|
+
loadingChartMonoBackground0: ColorModeSwitch;
|
|
56
|
+
loadingChartMonoBackground1: ColorModeSwitch;
|
|
57
|
+
loadingChartMonoBackground2: ColorModeSwitch;
|
|
58
|
+
loadingChartMonoBackground3: ColorModeSwitch;
|
|
31
59
|
markBackground: ColorModeSwitch;
|
|
32
60
|
markdownFormatTableBorderColor: ColorModeSwitch;
|
|
33
61
|
popoverPanelBackground: ColorModeSwitch;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../../src/global_styling/variables/flags.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -2,7 +2,6 @@ export * from './animations';
|
|
|
2
2
|
export * from './borders';
|
|
3
3
|
export * from './breakpoint';
|
|
4
4
|
export * from './colors';
|
|
5
|
-
export * from './_colors_vis';
|
|
6
5
|
export * from './levels';
|
|
7
6
|
export * from './size';
|
|
8
7
|
export * from './shadow';
|
|
@@ -11,3 +10,4 @@ export * from './typography';
|
|
|
11
10
|
export * from './buttons';
|
|
12
11
|
export * from './forms';
|
|
13
12
|
export * from './components';
|
|
13
|
+
export * from './flags';
|
|
@@ -9,7 +9,6 @@ export * from './animations';
|
|
|
9
9
|
export * from './borders';
|
|
10
10
|
export * from './breakpoint';
|
|
11
11
|
export * from './colors';
|
|
12
|
-
export * from './_colors_vis';
|
|
13
12
|
export * from './levels';
|
|
14
13
|
export * from './size';
|
|
15
14
|
export * from './shadow';
|
|
@@ -18,4 +17,5 @@ export * from './typography';
|
|
|
18
17
|
export * from './buttons';
|
|
19
18
|
export * from './forms';
|
|
20
19
|
export * from './components';
|
|
20
|
+
export * from './flags';
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/global_styling/variables/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/global_styling/variables/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAE3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vis_color_store';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
export * from './vis_color_store';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { _EuiThemeVisColors } from '../global_styling';
|
|
2
|
+
export declare const VIS_COLOR_STORE_EVENTS: {
|
|
3
|
+
readonly UPDATE: "UPDATE";
|
|
4
|
+
};
|
|
5
|
+
export declare type VisColorStoreEvents = keyof typeof VIS_COLOR_STORE_EVENTS;
|
|
6
|
+
declare type EventId = string;
|
|
7
|
+
export declare type _EuiVisColorStore = {
|
|
8
|
+
visColors: _EuiThemeVisColors;
|
|
9
|
+
hasVisColorAdjustment: boolean;
|
|
10
|
+
setVisColors: (colors: _EuiThemeVisColors, hasVisColorAdjustment?: boolean) => void;
|
|
11
|
+
subscribe: (eventName: VisColorStoreEvents, callback: any) => EventId;
|
|
12
|
+
unsubscribe: (eventName: VisColorStoreEvents, id: EventId) => void;
|
|
13
|
+
};
|
|
14
|
+
declare class EuiVisColorStoreImpl implements _EuiVisColorStore {
|
|
15
|
+
private _visColors;
|
|
16
|
+
private _hasVisColorAdjustment;
|
|
17
|
+
private events;
|
|
18
|
+
constructor(dependencies: {
|
|
19
|
+
defaultColors: _EuiThemeVisColors;
|
|
20
|
+
hasVisColorAdjustment: boolean;
|
|
21
|
+
});
|
|
22
|
+
get visColors(): _EuiVisColorStore['visColors'];
|
|
23
|
+
get hasVisColorAdjustment(): _EuiVisColorStore['hasVisColorAdjustment'];
|
|
24
|
+
setVisColors: (colors: _EuiThemeVisColors, hasColorAdjustment?: boolean | undefined) => void;
|
|
25
|
+
subscribe: (eventName: VisColorStoreEvents, callback: NonNullable<any>) => string;
|
|
26
|
+
unsubscribe: (eventName: VisColorStoreEvents, id: EventId) => void;
|
|
27
|
+
private publishUpdate;
|
|
28
|
+
}
|
|
29
|
+
export declare class EuiVisColorStore {
|
|
30
|
+
private static instance;
|
|
31
|
+
static getInstance(defaultColors: _EuiThemeVisColors, hasVisColorAdjustment: boolean): EuiVisColorStoreImpl;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import isEqual from 'lodash/isEqual';
|
|
9
|
+
import { uniqueId } from 'lodash';
|
|
10
|
+
export const VIS_COLOR_STORE_EVENTS = {
|
|
11
|
+
UPDATE: 'UPDATE',
|
|
12
|
+
};
|
|
13
|
+
class EuiVisColorStoreImpl {
|
|
14
|
+
constructor(dependencies) {
|
|
15
|
+
this.events = {};
|
|
16
|
+
this.setVisColors = (colors, hasColorAdjustment) => {
|
|
17
|
+
if (!isEqual(this._visColors, colors) ||
|
|
18
|
+
hasColorAdjustment !== this._hasVisColorAdjustment) {
|
|
19
|
+
this._visColors = colors;
|
|
20
|
+
if (hasColorAdjustment != null) {
|
|
21
|
+
this._hasVisColorAdjustment = hasColorAdjustment;
|
|
22
|
+
}
|
|
23
|
+
this.publishUpdate(VIS_COLOR_STORE_EVENTS.UPDATE, this._visColors);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.subscribe = (eventName, callback) => {
|
|
27
|
+
if (this.events[eventName] == null) {
|
|
28
|
+
this.events[eventName] = new Map();
|
|
29
|
+
}
|
|
30
|
+
const id = uniqueId(`${eventName}_`);
|
|
31
|
+
this.events[eventName].set(id, callback);
|
|
32
|
+
return id;
|
|
33
|
+
};
|
|
34
|
+
this.unsubscribe = (eventName, id) => {
|
|
35
|
+
if (this.events[eventName] != null && this.events[eventName].has(id)) {
|
|
36
|
+
this.events[eventName].delete(id);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
this.publishUpdate = (eventName, colors) => {
|
|
40
|
+
if (this.events[eventName])
|
|
41
|
+
this.events[eventName].forEach((callback) => {
|
|
42
|
+
// use timeout to execute callbacks after theme updates
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
callback?.(colors);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
this._visColors = dependencies.defaultColors;
|
|
49
|
+
this._hasVisColorAdjustment = dependencies.hasVisColorAdjustment;
|
|
50
|
+
}
|
|
51
|
+
get visColors() {
|
|
52
|
+
return this._visColors;
|
|
53
|
+
}
|
|
54
|
+
get hasVisColorAdjustment() {
|
|
55
|
+
return this._hasVisColorAdjustment;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export class EuiVisColorStore {
|
|
59
|
+
static getInstance(defaultColors, hasVisColorAdjustment) {
|
|
60
|
+
if (!this.instance) {
|
|
61
|
+
this.instance = new EuiVisColorStoreImpl({
|
|
62
|
+
defaultColors,
|
|
63
|
+
hasVisColorAdjustment,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return this.instance;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=vis_color_store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis_color_store.js","sourceRoot":"","sources":["../../../src/services/vis_color_store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM,EAAE,QAAQ;CACR,CAAC;AAeX,MAAM,oBAAoB;IAQxB,YAAY,YAGX;QARO,WAAM,GAAmD,EAGhE,CAAC;QAkBF,iBAAY,GAAG,CAAC,MAA0B,EAAE,kBAA4B,EAAE,EAAE;YAC1E,IACE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;gBACjC,kBAAkB,KAAK,IAAI,CAAC,sBAAsB,EAClD;gBACA,IAAI,CAAC,UA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,CAAC;gBACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAvDA,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,aAAa,CAAC;QAC7C,IAAI,CAAC,sBAAsB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACnE,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,qBAAqB;QACvB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;CA8CF;AAED,MAAM,OAAO,gBAAgB;IAG3B,MAAM,CAAC,WAAW,CAChB,aAAiC,EACjC,qBAA8B;QAE9B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAoB,CAAC;gBACvC,aAAa;gBACb,qBAAqB;aACtB,CAAC,CAAC;SACJ;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import { EuiVisColorStore, VIS_COLOR_STORE_EVENTS } from './vis_color_store';
|
|
9
|
+
jest.useFakeTimers();
|
|
10
|
+
const visColors = {
|
|
11
|
+
euiColorVis0: '#aabbcc',
|
|
12
|
+
};
|
|
13
|
+
describe('EuiVisColorStore', () => {
|
|
14
|
+
const visColorStore = EuiVisColorStore.getInstance(visColors, false);
|
|
15
|
+
let updateFn;
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
updateFn = jest.fn();
|
|
18
|
+
});
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
jest.clearAllMocks();
|
|
21
|
+
});
|
|
22
|
+
describe('setVisColors()', () => {
|
|
23
|
+
const customColors = {
|
|
24
|
+
...visColors,
|
|
25
|
+
euiColorVis0: '#00ff00',
|
|
26
|
+
};
|
|
27
|
+
it('has initial colors', () => {
|
|
28
|
+
expect(visColorStore.visColors).toEqual(visColors);
|
|
29
|
+
});
|
|
30
|
+
it('updates colors', () => {
|
|
31
|
+
visColorStore.setVisColors(customColors);
|
|
32
|
+
expect(visColorStore.visColors).toEqual(customColors);
|
|
33
|
+
});
|
|
34
|
+
it('updates hasVisColorAdjustment', () => {
|
|
35
|
+
visColorStore.setVisColors(customColors, true);
|
|
36
|
+
expect(visColorStore.hasVisColorAdjustment).toEqual(true);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('subcribe and unsubscribe', () => {
|
|
40
|
+
it('subscribes to store updates', () => {
|
|
41
|
+
const customColors = {
|
|
42
|
+
...visColors,
|
|
43
|
+
euiColorVis0: '#ff0000',
|
|
44
|
+
};
|
|
45
|
+
const id = visColorStore.subscribe(VIS_COLOR_STORE_EVENTS.UPDATE, updateFn);
|
|
46
|
+
expect(id).toContain('UPDATE');
|
|
47
|
+
visColorStore.setVisColors(customColors);
|
|
48
|
+
jest.runAllTimers();
|
|
49
|
+
expect(updateFn).toHaveBeenCalledTimes(1);
|
|
50
|
+
expect(updateFn).toHaveBeenCalledWith(customColors);
|
|
51
|
+
});
|
|
52
|
+
it('unsubscribes from store updates', () => {
|
|
53
|
+
const customColors = {
|
|
54
|
+
...visColors,
|
|
55
|
+
euiColorVis0: '#0000ff',
|
|
56
|
+
};
|
|
57
|
+
const id = visColorStore.subscribe(VIS_COLOR_STORE_EVENTS.UPDATE, updateFn);
|
|
58
|
+
expect(id).toContain('UPDATE');
|
|
59
|
+
visColorStore.unsubscribe(VIS_COLOR_STORE_EVENTS.UPDATE, id);
|
|
60
|
+
visColorStore.setVisColors(customColors);
|
|
61
|
+
jest.runAllTimers();
|
|
62
|
+
expect(updateFn).toHaveBeenCalledTimes(0);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=vis_color_store.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis_color_store.test.js","sourceRoot":"","sources":["../../../src/services/vis_color_store.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,IAAI,CAAC,aAAa,EAAE,CAAC;AAErB,MAAM,SAAS,GAAuB;IACpC,YAAY,EAAE,SAAS;CACF,CAAC;AAExB,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,aAAa,GAAG,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACrE,IAAI,QAAmB,CAAC;IAExB,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,MAAM,YAAY,GAAG;YACnB,GAAG,SAAS;YACZ,YAAY,EAAE,SAAS;SACxB,CAAC;QAEF,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YAC5B,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;YACxB,aAAa,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;YAEzC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAA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CAAC,YAAY,CAAC,CAAC;YACzC,IAAI,CAAC,YAAY,EAAE,CAAC;YAEpB,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui-theme-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "EUI theme common",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build:clean": "rimraf lib/",
|
|
8
8
|
"build": "yarn build:clean && yarn build:compile && yarn build:compile:cjs && yarn build:types",
|
|
9
9
|
"build:compile": "tsc --project ./tsconfig.json",
|
|
10
|
-
"build:compile:cjs": "NODE_ENV=production babel src --out-dir=lib/cjs --extensions .js,.ts,.tsx --source-maps",
|
|
10
|
+
"build:compile:cjs": "NODE_ENV=production NO_COREJS_POLYFILL=true babel src --out-dir=lib/cjs --extensions .js,.ts,.tsx --source-maps=true",
|
|
11
11
|
"build:types": "NODE_ENV=production tsc --project tsconfig.types.json",
|
|
12
12
|
"build-pack": "yarn build && npm pack",
|
|
13
13
|
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-sass",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"url": "https://github.com/elastic/eui.git",
|
|
22
22
|
"directory": "packages/eui-theme-common"
|
|
23
23
|
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@types/lodash": "^4.14.202",
|
|
26
|
+
"lodash": "^4.17.21"
|
|
27
|
+
},
|
|
24
28
|
"devDependencies": {
|
|
25
29
|
"@babel/cli": "^7.21.5",
|
|
26
30
|
"@babel/core": "^7.21.8",
|
|
@@ -67,10 +71,11 @@
|
|
|
67
71
|
}
|
|
68
72
|
},
|
|
69
73
|
"files": [
|
|
70
|
-
"lib",
|
|
74
|
+
"lib/",
|
|
71
75
|
"src/**/*.scss",
|
|
72
76
|
"README.md",
|
|
73
|
-
"licenses"
|
|
77
|
+
"licenses",
|
|
78
|
+
"!lib/**/*.tsbuildinfo"
|
|
74
79
|
],
|
|
75
80
|
"installConfig": {
|
|
76
81
|
"hoistingLimits": "workspaces"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
$euiBorderWidthThin: 1px !default;
|
|
4
4
|
$euiBorderWidthThick: 2px !default;
|
|
5
5
|
|
|
6
|
-
$euiBorderColor: $
|
|
6
|
+
$euiBorderColor: $euiColorBorderBaseSubdued !default;
|
|
7
7
|
$euiBorderRadius: $euiSizeS * .75 !default;
|
|
8
8
|
$euiBorderRadiusSmall: $euiSizeS * .5 !default;
|
|
9
9
|
$euiBorderThick: $euiBorderWidthThick solid $euiBorderColor !default;
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
// Global colors are established and importer per theme, before this manifest
|
|
10
10
|
// Import order is important. Size, vis colors, ...etc are used in other variables.
|
|
11
11
|
@import 'size';
|
|
12
|
-
@import 'colors_vis';
|
|
13
12
|
@import 'animations';
|
|
14
13
|
@import 'font_weight';
|
|
15
14
|
@import 'typography';
|