@elastic/eui-theme-common 10.1.0 → 10.2.0-snapshot.1794367676681
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/math.js +1 -1
- package/lib/cjs/services/color_palette.d.ts +23 -0
- package/lib/cjs/services/color_palette.js +79 -0
- package/lib/cjs/services/eui_palettes.d.ts +132 -0
- package/lib/cjs/services/eui_palettes.js +312 -0
- package/lib/cjs/services/index.d.ts +2 -0
- package/lib/cjs/services/index.js +22 -0
- package/lib/cjs/services/vis_color_store.d.ts +1 -1
- package/lib/cjs/services/vis_color_store.js +4 -1
- package/lib/cjs/services/vis_color_store.test.js +46 -1
- package/lib/cjs/utils.js +1 -1
- package/lib/cjs/utils.test.js +1 -1
- package/lib/esm/services/color_palette.d.ts +23 -0
- package/lib/esm/services/color_palette.js +79 -0
- package/lib/esm/services/eui_palettes.d.ts +132 -0
- package/lib/esm/services/eui_palettes.js +291 -0
- package/lib/esm/services/index.d.ts +2 -0
- package/lib/esm/services/index.js +2 -0
- package/lib/esm/services/vis_color_store.d.ts +1 -1
- package/lib/esm/services/vis_color_store.js +4 -0
- package/lib/esm/services/vis_color_store.test.js +35 -0
- package/package.json +4 -3
|
@@ -59,3 +59,38 @@ describe('EuiVisColorStore', () => {
|
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
|
+
describe('getInstance() initialization contract', () => {
|
|
63
|
+
// Each test gets a fresh module registry so the singleton starts
|
|
64
|
+
// uninitialized, as it would for a consumer that imports this package
|
|
65
|
+
// standalone (e.g. without @elastic/eui).
|
|
66
|
+
it('throws when accessed before being initialized with default colors', () => {
|
|
67
|
+
jest.isolateModules(() => {
|
|
68
|
+
const { EuiVisColorStore: FreshStore } = jest.requireActual('./vis_color_store');
|
|
69
|
+
expect(() => FreshStore.getInstance()).toThrow('EuiVisColorStore was accessed before it was initialized');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
it('returns the existing instance when called without arguments after initialization', () => {
|
|
73
|
+
jest.isolateModules(() => {
|
|
74
|
+
const { EuiVisColorStore: FreshStore } = jest.requireActual('./vis_color_store');
|
|
75
|
+
const initialized = FreshStore.getInstance(visColors);
|
|
76
|
+
expect(FreshStore.getInstance()).toBe(initialized);
|
|
77
|
+
expect(FreshStore.getInstance().visColors).toEqual(visColors);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
it('provides palette defaults once a theme package has initialized the store', () => {
|
|
81
|
+
jest.isolateModules(() => {
|
|
82
|
+
const { EuiVisColorStore: FreshStore } = jest.requireActual('./vis_color_store');
|
|
83
|
+
const { euiPaletteColorBlind } = jest.requireActual('./eui_palettes');
|
|
84
|
+
// simulates what a theme package (e.g. @elastic/eui-theme-borealis)
|
|
85
|
+
// does on import
|
|
86
|
+
FreshStore.getInstance(visColors);
|
|
87
|
+
expect(euiPaletteColorBlind()[0]).toBe(visColors.euiColorVis0);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
it('palette functions throw a descriptive error when no theme initialized the store', () => {
|
|
91
|
+
jest.isolateModules(() => {
|
|
92
|
+
const { euiPaletteColorBlind } = jest.requireActual('./eui_palettes');
|
|
93
|
+
expect(() => euiPaletteColorBlind()).toThrow('EuiVisColorStore was accessed before it was initialized');
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui-theme-common",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0-snapshot.1794367676681",
|
|
4
4
|
"description": "EUI theme common",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"scripts": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@types/lodash": "^4.14.202",
|
|
28
28
|
"chroma-js": "^2.4.2",
|
|
29
|
-
"lodash": "^4.
|
|
29
|
+
"lodash": "^4.18.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.21.5",
|
|
@@ -83,5 +83,6 @@
|
|
|
83
83
|
],
|
|
84
84
|
"installConfig": {
|
|
85
85
|
"hoistingLimits": "workspaces"
|
|
86
|
-
}
|
|
86
|
+
},
|
|
87
|
+
"stableVersion": "10.2.0"
|
|
87
88
|
}
|