@nebula.js/stardust 4.6.1 → 4.7.0

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/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.6.1
2
+ * @nebula.js/stardust v4.7.0
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -2306,7 +2306,7 @@ function extend$3(parent, definition) {
2306
2306
  return prototype;
2307
2307
  }
2308
2308
 
2309
- function Color() {}
2309
+ function Color$1() {}
2310
2310
 
2311
2311
  var darker = 0.7;
2312
2312
  var brighter = 1 / darker;
@@ -2473,7 +2473,7 @@ var named = {
2473
2473
  yellowgreen: 0x9acd32
2474
2474
  };
2475
2475
 
2476
- define(Color, color$3, {
2476
+ define(Color$1, color$3, {
2477
2477
  copy(channels) {
2478
2478
  return Object.assign(new this.constructor, this, channels);
2479
2479
  },
@@ -2509,15 +2509,15 @@ function color$3(format) {
2509
2509
  format = (format + "").trim().toLowerCase();
2510
2510
  return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
2511
2511
  : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
2512
- : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
2513
- : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
2512
+ : l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
2513
+ : l === 4 ? rgba$1((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
2514
2514
  : null) // invalid hex
2515
2515
  : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
2516
2516
  : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
2517
- : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
2518
- : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
2519
- : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
2520
- : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
2517
+ : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
2518
+ : (m = reRgbaPercent.exec(format)) ? rgba$1(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
2519
+ : (m = reHslPercent.exec(format)) ? hsla$1(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
2520
+ : (m = reHslaPercent.exec(format)) ? hsla$1(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
2521
2521
  : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
2522
2522
  : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
2523
2523
  : null;
@@ -2527,19 +2527,19 @@ function rgbn(n) {
2527
2527
  return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
2528
2528
  }
2529
2529
 
2530
- function rgba(r, g, b, a) {
2530
+ function rgba$1(r, g, b, a) {
2531
2531
  if (a <= 0) r = g = b = NaN;
2532
2532
  return new Rgb(r, g, b, a);
2533
2533
  }
2534
2534
 
2535
2535
  function rgbConvert(o) {
2536
- if (!(o instanceof Color)) o = color$3(o);
2536
+ if (!(o instanceof Color$1)) o = color$3(o);
2537
2537
  if (!o) return new Rgb;
2538
2538
  o = o.rgb();
2539
2539
  return new Rgb(o.r, o.g, o.b, o.opacity);
2540
2540
  }
2541
2541
 
2542
- function rgb(r, g, b, opacity) {
2542
+ function rgb$1(r, g, b, opacity) {
2543
2543
  return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
2544
2544
  }
2545
2545
 
@@ -2550,7 +2550,7 @@ function Rgb(r, g, b, opacity) {
2550
2550
  this.opacity = +opacity;
2551
2551
  }
2552
2552
 
2553
- define(Rgb, rgb, extend$3(Color, {
2553
+ define(Rgb, rgb$1, extend$3(Color$1, {
2554
2554
  brighter(k) {
2555
2555
  k = k == null ? brighter : Math.pow(brighter, k);
2556
2556
  return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
@@ -2579,11 +2579,11 @@ define(Rgb, rgb, extend$3(Color, {
2579
2579
  }));
2580
2580
 
2581
2581
  function rgb_formatHex() {
2582
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
2582
+ return `#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}`;
2583
2583
  }
2584
2584
 
2585
2585
  function rgb_formatHex8() {
2586
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
2586
+ return `#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}${hex$1((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
2587
2587
  }
2588
2588
 
2589
2589
  function rgb_formatRgb() {
@@ -2599,12 +2599,12 @@ function clampi(value) {
2599
2599
  return Math.max(0, Math.min(255, Math.round(value) || 0));
2600
2600
  }
2601
2601
 
2602
- function hex(value) {
2602
+ function hex$1(value) {
2603
2603
  value = clampi(value);
2604
2604
  return (value < 16 ? "0" : "") + value.toString(16);
2605
2605
  }
2606
2606
 
2607
- function hsla(h, s, l, a) {
2607
+ function hsla$1(h, s, l, a) {
2608
2608
  if (a <= 0) h = s = l = NaN;
2609
2609
  else if (l <= 0 || l >= 1) h = s = NaN;
2610
2610
  else if (s <= 0) h = NaN;
@@ -2613,7 +2613,7 @@ function hsla(h, s, l, a) {
2613
2613
 
2614
2614
  function hslConvert(o) {
2615
2615
  if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
2616
- if (!(o instanceof Color)) o = color$3(o);
2616
+ if (!(o instanceof Color$1)) o = color$3(o);
2617
2617
  if (!o) return new Hsl;
2618
2618
  if (o instanceof Hsl) return o;
2619
2619
  o = o.rgb();
@@ -2637,7 +2637,7 @@ function hslConvert(o) {
2637
2637
  return new Hsl(h, s, l, o.opacity);
2638
2638
  }
2639
2639
 
2640
- function hsl(h, s, l, opacity) {
2640
+ function hsl$1(h, s, l, opacity) {
2641
2641
  return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
2642
2642
  }
2643
2643
 
@@ -2648,7 +2648,7 @@ function Hsl(h, s, l, opacity) {
2648
2648
  this.opacity = +opacity;
2649
2649
  }
2650
2650
 
2651
- define(Hsl, hsl, extend$3(Color, {
2651
+ define(Hsl, hsl$1, extend$3(Color$1, {
2652
2652
  brighter(k) {
2653
2653
  k = k == null ? brighter : Math.pow(brighter, k);
2654
2654
  return new Hsl(this.h, this.s, this.l * k, this.opacity);
@@ -3241,7 +3241,7 @@ function blend(c1, c2, t) {
3241
3241
  const g = Math.floor(c1.g + (c2.g - c1.g) * t);
3242
3242
  const b = Math.floor(c1.b + (c2.b - c1.b) * t);
3243
3243
  const a = Math.floor(c1.opacity + (c2.opacity - c1.opacity) * t);
3244
- return rgb(r, g, b, a);
3244
+ return rgb$1(r, g, b, a);
3245
3245
  }
3246
3246
  class ColorScale {
3247
3247
  constructor(nanColor) {
@@ -4073,10 +4073,10 @@ function useEventCallback(fn) {
4073
4073
  useEnhancedEffect$1(() => {
4074
4074
  ref.current = fn;
4075
4075
  });
4076
- return React.useCallback((...args) =>
4076
+ return React.useRef((...args) =>
4077
4077
  // @ts-expect-error hide `this`
4078
4078
  // tslint:disable-next-line:ban-comma-operator
4079
- (0, ref.current)(...args), []);
4079
+ (0, ref.current)(...args)).current;
4080
4080
  }
4081
4081
 
4082
4082
  function useForkRef(...refs) {
@@ -5670,7 +5670,7 @@ function StyledEngineProvider(props) {
5670
5670
  }
5671
5671
 
5672
5672
  /**
5673
- * @mui/styled-engine v5.14.13
5673
+ * @mui/styled-engine v5.14.17
5674
5674
  *
5675
5675
  * @license MIT
5676
5676
  * This source code is licensed under the MIT license found in the
@@ -7934,7 +7934,7 @@ function createPalette(palette) {
7934
7934
  }
7935
7935
 
7936
7936
  const _excluded$9 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
7937
- function round(value) {
7937
+ function round$1(value) {
7938
7938
  return Math.round(value * 1e5) / 1e5;
7939
7939
  }
7940
7940
  const caseAllCaps = {
@@ -7974,7 +7974,7 @@ function createTypography(palette, typography) {
7974
7974
  // Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/
7975
7975
  lineHeight
7976
7976
  }, fontFamily === defaultFontFamily ? {
7977
- letterSpacing: `${round(letterSpacing / size)}em`
7977
+ letterSpacing: `${round$1(letterSpacing / size)}em`
7978
7978
  } : {}, casing, allVariants);
7979
7979
  const variants = {
7980
7980
  h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
@@ -8330,6 +8330,7 @@ const light = {
8330
8330
  excluded: '#BEBEBE',
8331
8331
  selectedExcluded: '#BEBEBE',
8332
8332
  possible: colors.grey100,
8333
+ selectedContrastText: colors.grey100,
8333
8334
  mainContrastText: colors.grey100,
8334
8335
  alternativeContrastText: colors.grey25,
8335
8336
  excludedContrastText: colors.grey25,
@@ -8397,6 +8398,7 @@ const dark = {
8397
8398
  excluded: colors.grey10,
8398
8399
  selectedExcluded: colors.grey10,
8399
8400
  possible: colors.grey80,
8401
+ selectedContrastText: colors.grey100,
8400
8402
  mainContrastText: colors.grey100,
8401
8403
  alternativeContrastText: colors.grey100,
8402
8404
  excludedContrastText: colors.grey100,
@@ -8549,7 +8551,7 @@ function create$3(definition) {
8549
8551
  return cache[key];
8550
8552
  }
8551
8553
 
8552
- const NEBULA_VERSION_HASH = "2504" ;
8554
+ const NEBULA_VERSION_HASH = "d794" ;
8553
8555
  ClassNameGenerator$1.configure(componentName => {
8554
8556
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8555
8557
  });
@@ -8810,7 +8812,7 @@ function boot(_ref2) {
8810
8812
  const appRef = React__default.createRef();
8811
8813
  const element = document.createElement('div');
8812
8814
  element.style.display = 'none';
8813
- element.setAttribute('data-nebulajs-version', "4.6.1" );
8815
+ element.setAttribute('data-nebulajs-version', "4.7.0" );
8814
8816
  element.setAttribute('data-app-id', app.id);
8815
8817
  document.body.appendChild(element);
8816
8818
  if (context) {
@@ -10313,7 +10315,6 @@ const StyledCheckbox = styled$1(Checkbox, {
10313
10315
  shouldForwardProp: p => p !== 'styles'
10314
10316
  })(_ref => {
10315
10317
  let {
10316
- theme,
10317
10318
  styles
10318
10319
  } = _ref;
10319
10320
  return {
@@ -10344,13 +10345,13 @@ const StyledCheckbox = styled$1(Checkbox, {
10344
10345
  borderRadius: borderRadius - 1,
10345
10346
  width: 12,
10346
10347
  height: 12,
10347
- backgroundColor: theme.palette.selected.excluded
10348
+ backgroundColor: styles.selections.excluded
10348
10349
  },
10349
10350
  ["& .".concat(classes$b.cbIconAlternative)]: {
10350
10351
  borderRadius: borderRadius - 1,
10351
10352
  width: 12,
10352
10353
  height: 12,
10353
- backgroundColor: theme.palette.selected.alternative
10354
+ backgroundColor: styles.selections.alternative
10354
10355
  },
10355
10356
  ["&.".concat(classes$b.checkbox)]: {
10356
10357
  margin: 0,
@@ -14909,7 +14910,7 @@ const StyledInputAdornment = styled$1(InputAdornment, {
14909
14910
  styles
14910
14911
  } = _ref;
14911
14912
  return {
14912
- color: styles.content.color
14913
+ color: styles.search.color
14913
14914
  };
14914
14915
  });
14915
14916
  const StyledOutlinedInput = styled$1(OutlinedInput, {
@@ -14919,8 +14920,10 @@ const StyledOutlinedInput = styled$1(OutlinedInput, {
14919
14920
  styles
14920
14921
  } = _ref2;
14921
14922
  return {
14922
- color: styles.content.color,
14923
- display: 'flex'
14923
+ display: 'flex',
14924
+ '& .MuiInputBase-root': {
14925
+ color: styles.search.color
14926
+ }
14924
14927
  };
14925
14928
  });
14926
14929
  function ListBoxSearch(_ref3) {
@@ -15539,297 +15542,1614 @@ function hasSelections(layout) {
15539
15542
  return totalCounts > 0;
15540
15543
  }
15541
15544
 
15542
- const pink = {
15543
- 50: '#fce4ec',
15544
- 100: '#f8bbd0',
15545
- 200: '#f48fb1',
15546
- 300: '#f06292',
15547
- 400: '#ec407a',
15548
- 500: '#e91e63',
15549
- 600: '#d81b60',
15550
- 700: '#c2185b',
15551
- 800: '#ad1457',
15552
- 900: '#880e4f',
15553
- A100: '#ff80ab',
15554
- A200: '#ff4081',
15555
- A400: '#f50057',
15556
- A700: '#c51162'
15557
- };
15558
- var pink$1 = pink;
15559
-
15560
- const deepPurple = {
15561
- 50: '#ede7f6',
15562
- 100: '#d1c4e9',
15563
- 200: '#b39ddb',
15564
- 300: '#9575cd',
15565
- 400: '#7e57c2',
15566
- 500: '#673ab7',
15567
- 600: '#5e35b1',
15568
- 700: '#512da8',
15569
- 800: '#4527a0',
15570
- 900: '#311b92',
15571
- A100: '#b388ff',
15572
- A200: '#7c4dff',
15573
- A400: '#651fff',
15574
- A700: '#6200ea'
15575
- };
15576
- var deepPurple$1 = deepPurple;
15577
-
15578
- const indigo = {
15579
- 50: '#e8eaf6',
15580
- 100: '#c5cae9',
15581
- 200: '#9fa8da',
15582
- 300: '#7986cb',
15583
- 400: '#5c6bc0',
15584
- 500: '#3f51b5',
15585
- 600: '#3949ab',
15586
- 700: '#303f9f',
15587
- 800: '#283593',
15588
- 900: '#1a237e',
15589
- A100: '#8c9eff',
15590
- A200: '#536dfe',
15591
- A400: '#3d5afe',
15592
- A700: '#304ffe'
15593
- };
15594
- var indigo$1 = indigo;
15595
-
15596
- const cyan = {
15597
- 50: '#e0f7fa',
15598
- 100: '#b2ebf2',
15599
- 200: '#80deea',
15600
- 300: '#4dd0e1',
15601
- 400: '#26c6da',
15602
- 500: '#00bcd4',
15603
- 600: '#00acc1',
15604
- 700: '#0097a7',
15605
- 800: '#00838f',
15606
- 900: '#006064',
15607
- A100: '#84ffff',
15608
- A200: '#18ffff',
15609
- A400: '#00e5ff',
15610
- A700: '#00b8d4'
15611
- };
15612
- var cyan$1 = cyan;
15613
-
15614
- const teal = {
15615
- 50: '#e0f2f1',
15616
- 100: '#b2dfdb',
15617
- 200: '#80cbc4',
15618
- 300: '#4db6ac',
15619
- 400: '#26a69a',
15620
- 500: '#009688',
15621
- 600: '#00897b',
15622
- 700: '#00796b',
15623
- 800: '#00695c',
15624
- 900: '#004d40',
15625
- A100: '#a7ffeb',
15626
- A200: '#64ffda',
15627
- A400: '#1de9b6',
15628
- A700: '#00bfa5'
15629
- };
15630
- var teal$1 = teal;
15631
-
15632
- const lightGreen = {
15633
- 50: '#f1f8e9',
15634
- 100: '#dcedc8',
15635
- 200: '#c5e1a5',
15636
- 300: '#aed581',
15637
- 400: '#9ccc65',
15638
- 500: '#8bc34a',
15639
- 600: '#7cb342',
15640
- 700: '#689f38',
15641
- 800: '#558b2f',
15642
- 900: '#33691e',
15643
- A100: '#ccff90',
15644
- A200: '#b2ff59',
15645
- A400: '#76ff03',
15646
- A700: '#64dd17'
15647
- };
15648
- var lightGreen$1 = lightGreen;
15649
-
15650
- const lime = {
15651
- 50: '#f9fbe7',
15652
- 100: '#f0f4c3',
15653
- 200: '#e6ee9c',
15654
- 300: '#dce775',
15655
- 400: '#d4e157',
15656
- 500: '#cddc39',
15657
- 600: '#c0ca33',
15658
- 700: '#afb42b',
15659
- 800: '#9e9d24',
15660
- 900: '#827717',
15661
- A100: '#f4ff81',
15662
- A200: '#eeff41',
15663
- A400: '#c6ff00',
15664
- A700: '#aeea00'
15665
- };
15666
- var lime$1 = lime;
15667
-
15668
- const yellow = {
15669
- 50: '#fffde7',
15670
- 100: '#fff9c4',
15671
- 200: '#fff59d',
15672
- 300: '#fff176',
15673
- 400: '#ffee58',
15674
- 500: '#ffeb3b',
15675
- 600: '#fdd835',
15676
- 700: '#fbc02d',
15677
- 800: '#f9a825',
15678
- 900: '#f57f17',
15679
- A100: '#ffff8d',
15680
- A200: '#ffff00',
15681
- A400: '#ffea00',
15682
- A700: '#ffd600'
15683
- };
15684
- var yellow$1 = yellow;
15685
-
15686
- const amber = {
15687
- 50: '#fff8e1',
15688
- 100: '#ffecb3',
15689
- 200: '#ffe082',
15690
- 300: '#ffd54f',
15691
- 400: '#ffca28',
15692
- 500: '#ffc107',
15693
- 600: '#ffb300',
15694
- 700: '#ffa000',
15695
- 800: '#ff8f00',
15696
- 900: '#ff6f00',
15697
- A100: '#ffe57f',
15698
- A200: '#ffd740',
15699
- A400: '#ffc400',
15700
- A700: '#ffab00'
15701
- };
15702
- var amber$1 = amber;
15703
-
15704
- const deepOrange = {
15705
- 50: '#fbe9e7',
15706
- 100: '#ffccbc',
15707
- 200: '#ffab91',
15708
- 300: '#ff8a65',
15709
- 400: '#ff7043',
15710
- 500: '#ff5722',
15711
- 600: '#f4511e',
15712
- 700: '#e64a19',
15713
- 800: '#d84315',
15714
- 900: '#bf360c',
15715
- A100: '#ff9e80',
15716
- A200: '#ff6e40',
15717
- A400: '#ff3d00',
15718
- A700: '#dd2c00'
15719
- };
15720
- var deepOrange$1 = deepOrange;
15721
-
15722
- const brown = {
15723
- 50: '#efebe9',
15724
- 100: '#d7ccc8',
15725
- 200: '#bcaaa4',
15726
- 300: '#a1887f',
15727
- 400: '#8d6e63',
15728
- 500: '#795548',
15729
- 600: '#6d4c41',
15730
- 700: '#5d4037',
15731
- 800: '#4e342e',
15732
- 900: '#3e2723',
15733
- A100: '#d7ccc8',
15734
- A200: '#bcaaa4',
15735
- A400: '#8d6e63',
15736
- A700: '#5d4037'
15737
- };
15738
- var brown$1 = brown;
15739
-
15740
- const blueGrey = {
15741
- 50: '#eceff1',
15742
- 100: '#cfd8dc',
15743
- 200: '#b0bec5',
15744
- 300: '#90a4ae',
15745
- 400: '#78909c',
15746
- 500: '#607d8b',
15747
- 600: '#546e7a',
15748
- 700: '#455a64',
15749
- 800: '#37474f',
15750
- 900: '#263238',
15751
- A100: '#cfd8dc',
15752
- A200: '#b0bec5',
15753
- A400: '#78909c',
15754
- A700: '#455a64'
15755
- };
15756
- var blueGrey$1 = blueGrey;
15757
-
15758
- var namedColors = /*#__PURE__*/Object.freeze({
15759
- __proto__: null,
15760
- amber: amber$1,
15761
- blue: blue$1,
15762
- blueGrey: blueGrey$1,
15763
- brown: brown$1,
15764
- common: common$1,
15765
- cyan: cyan$1,
15766
- deepOrange: deepOrange$1,
15767
- deepPurple: deepPurple$1,
15768
- green: green$1,
15769
- grey: grey$1,
15770
- indigo: indigo$1,
15771
- lightBlue: lightBlue$1,
15772
- lightGreen: lightGreen$1,
15773
- lime: lime$1,
15774
- orange: orange$1,
15775
- pink: pink$1,
15776
- purple: purple$1,
15777
- red: red$1,
15778
- teal: teal$1,
15779
- yellow: yellow$1
15780
- });
15545
+ const colorStruct = {
15546
+ aliceblue: {
15547
+ r: 240,
15548
+ g: 248,
15549
+ b: 255
15550
+ },
15551
+ antiquewhite: {
15552
+ r: 250,
15553
+ g: 235,
15554
+ b: 215
15555
+ },
15556
+ aqua: {
15557
+ r: 0,
15558
+ g: 255,
15559
+ b: 255
15560
+ },
15561
+ aquamarine: {
15562
+ r: 127,
15563
+ g: 255,
15564
+ b: 212
15565
+ },
15566
+ azure: {
15567
+ r: 240,
15568
+ g: 255,
15569
+ b: 255
15570
+ },
15571
+ beige: {
15572
+ r: 245,
15573
+ g: 245,
15574
+ b: 220
15575
+ },
15576
+ bisque: {
15577
+ r: 255,
15578
+ g: 228,
15579
+ b: 196
15580
+ },
15581
+ black: {
15582
+ r: 0,
15583
+ g: 0,
15584
+ b: 0
15585
+ },
15586
+ blanchedalmond: {
15587
+ r: 255,
15588
+ g: 235,
15589
+ b: 205
15590
+ },
15591
+ blue: {
15592
+ r: 0,
15593
+ g: 0,
15594
+ b: 255
15595
+ },
15596
+ blueviolet: {
15597
+ r: 138,
15598
+ g: 43,
15599
+ b: 226
15600
+ },
15601
+ brown: {
15602
+ r: 165,
15603
+ g: 42,
15604
+ b: 42
15605
+ },
15606
+ burlywood: {
15607
+ r: 222,
15608
+ g: 184,
15609
+ b: 135
15610
+ },
15611
+ cadetblue: {
15612
+ r: 95,
15613
+ g: 158,
15614
+ b: 160
15615
+ },
15616
+ chartreuse: {
15617
+ r: 127,
15618
+ g: 255,
15619
+ b: 0
15620
+ },
15621
+ chocolate: {
15622
+ r: 210,
15623
+ g: 105,
15624
+ b: 30
15625
+ },
15626
+ coral: {
15627
+ r: 255,
15628
+ g: 127,
15629
+ b: 80
15630
+ },
15631
+ cornflowerblue: {
15632
+ r: 100,
15633
+ g: 149,
15634
+ b: 237
15635
+ },
15636
+ cornsilk: {
15637
+ r: 255,
15638
+ g: 248,
15639
+ b: 220
15640
+ },
15641
+ crimson: {
15642
+ r: 220,
15643
+ g: 20,
15644
+ b: 60
15645
+ },
15646
+ cyan: {
15647
+ r: 0,
15648
+ g: 255,
15649
+ b: 255
15650
+ },
15651
+ darkblue: {
15652
+ r: 0,
15653
+ g: 0,
15654
+ b: 139
15655
+ },
15656
+ darkcyan: {
15657
+ r: 0,
15658
+ g: 139,
15659
+ b: 139
15660
+ },
15661
+ darkgoldenrod: {
15662
+ r: 184,
15663
+ g: 134,
15664
+ b: 11
15665
+ },
15666
+ darkgray: {
15667
+ r: 169,
15668
+ g: 169,
15669
+ b: 169
15670
+ },
15671
+ darkgreen: {
15672
+ r: 0,
15673
+ g: 100,
15674
+ b: 0
15675
+ },
15676
+ darkgrey: {
15677
+ r: 169,
15678
+ g: 169,
15679
+ b: 169
15680
+ },
15681
+ darkkhaki: {
15682
+ r: 189,
15683
+ g: 183,
15684
+ b: 107
15685
+ },
15686
+ darkmagenta: {
15687
+ r: 139,
15688
+ g: 0,
15689
+ b: 139
15690
+ },
15691
+ darkolivegreen: {
15692
+ r: 85,
15693
+ g: 107,
15694
+ b: 47
15695
+ },
15696
+ darkorange: {
15697
+ r: 255,
15698
+ g: 140,
15699
+ b: 0
15700
+ },
15701
+ darkorchid: {
15702
+ r: 153,
15703
+ g: 50,
15704
+ b: 204
15705
+ },
15706
+ darkred: {
15707
+ r: 139,
15708
+ g: 0,
15709
+ b: 0
15710
+ },
15711
+ darksalmon: {
15712
+ r: 233,
15713
+ g: 150,
15714
+ b: 122
15715
+ },
15716
+ darkseagreen: {
15717
+ r: 143,
15718
+ g: 188,
15719
+ b: 143
15720
+ },
15721
+ darkslateblue: {
15722
+ r: 72,
15723
+ g: 61,
15724
+ b: 139
15725
+ },
15726
+ darkslategray: {
15727
+ r: 47,
15728
+ g: 79,
15729
+ b: 79
15730
+ },
15731
+ darkslategrey: {
15732
+ r: 47,
15733
+ g: 79,
15734
+ b: 79
15735
+ },
15736
+ darkturquoise: {
15737
+ r: 0,
15738
+ g: 206,
15739
+ b: 209
15740
+ },
15741
+ darkviolet: {
15742
+ r: 148,
15743
+ g: 0,
15744
+ b: 211
15745
+ },
15746
+ deeppink: {
15747
+ r: 255,
15748
+ g: 20,
15749
+ b: 147
15750
+ },
15751
+ deepskyblue: {
15752
+ r: 0,
15753
+ g: 191,
15754
+ b: 255
15755
+ },
15756
+ dimgray: {
15757
+ r: 105,
15758
+ g: 105,
15759
+ b: 105
15760
+ },
15761
+ dimgrey: {
15762
+ r: 105,
15763
+ g: 105,
15764
+ b: 105
15765
+ },
15766
+ dodgerblue: {
15767
+ r: 30,
15768
+ g: 144,
15769
+ b: 255
15770
+ },
15771
+ firebrick: {
15772
+ r: 178,
15773
+ g: 34,
15774
+ b: 34
15775
+ },
15776
+ floralwhite: {
15777
+ r: 255,
15778
+ g: 250,
15779
+ b: 240
15780
+ },
15781
+ forestgreen: {
15782
+ r: 34,
15783
+ g: 139,
15784
+ b: 34
15785
+ },
15786
+ fuchsia: {
15787
+ r: 255,
15788
+ g: 0,
15789
+ b: 255
15790
+ },
15791
+ gainsboro: {
15792
+ r: 220,
15793
+ g: 220,
15794
+ b: 220
15795
+ },
15796
+ ghostwhite: {
15797
+ r: 248,
15798
+ g: 248,
15799
+ b: 255
15800
+ },
15801
+ gold: {
15802
+ r: 255,
15803
+ g: 215,
15804
+ b: 0
15805
+ },
15806
+ goldenrod: {
15807
+ r: 218,
15808
+ g: 165,
15809
+ b: 32
15810
+ },
15811
+ gray: {
15812
+ r: 128,
15813
+ g: 128,
15814
+ b: 128
15815
+ },
15816
+ green: {
15817
+ r: 0,
15818
+ g: 128,
15819
+ b: 0
15820
+ },
15821
+ greenyellow: {
15822
+ r: 173,
15823
+ g: 255,
15824
+ b: 47
15825
+ },
15826
+ grey: {
15827
+ r: 128,
15828
+ g: 128,
15829
+ b: 128
15830
+ },
15831
+ honeydew: {
15832
+ r: 240,
15833
+ g: 255,
15834
+ b: 240
15835
+ },
15836
+ hotpink: {
15837
+ r: 255,
15838
+ g: 105,
15839
+ b: 180
15840
+ },
15841
+ indianred: {
15842
+ r: 205,
15843
+ g: 92,
15844
+ b: 92
15845
+ },
15846
+ indigo: {
15847
+ r: 75,
15848
+ g: 0,
15849
+ b: 130
15850
+ },
15851
+ ivory: {
15852
+ r: 255,
15853
+ g: 255,
15854
+ b: 240
15855
+ },
15856
+ khaki: {
15857
+ r: 240,
15858
+ g: 230,
15859
+ b: 140
15860
+ },
15861
+ lavender: {
15862
+ r: 230,
15863
+ g: 230,
15864
+ b: 250
15865
+ },
15866
+ lavenderblush: {
15867
+ r: 255,
15868
+ g: 240,
15869
+ b: 245
15870
+ },
15871
+ lawngreen: {
15872
+ r: 124,
15873
+ g: 252,
15874
+ b: 0
15875
+ },
15876
+ lemonchiffon: {
15877
+ r: 255,
15878
+ g: 250,
15879
+ b: 205
15880
+ },
15881
+ lightblue: {
15882
+ r: 173,
15883
+ g: 216,
15884
+ b: 230
15885
+ },
15886
+ lightcoral: {
15887
+ r: 240,
15888
+ g: 128,
15889
+ b: 128
15890
+ },
15891
+ lightcyan: {
15892
+ r: 224,
15893
+ g: 255,
15894
+ b: 255
15895
+ },
15896
+ lightgoldenrodyellow: {
15897
+ r: 250,
15898
+ g: 250,
15899
+ b: 210
15900
+ },
15901
+ lightgray: {
15902
+ r: 211,
15903
+ g: 211,
15904
+ b: 211
15905
+ },
15906
+ lightgreen: {
15907
+ r: 144,
15908
+ g: 238,
15909
+ b: 144
15910
+ },
15911
+ lightgrey: {
15912
+ r: 211,
15913
+ g: 211,
15914
+ b: 211
15915
+ },
15916
+ lightpink: {
15917
+ r: 255,
15918
+ g: 182,
15919
+ b: 193
15920
+ },
15921
+ lightsalmon: {
15922
+ r: 255,
15923
+ g: 160,
15924
+ b: 122
15925
+ },
15926
+ lightseagreen: {
15927
+ r: 32,
15928
+ g: 178,
15929
+ b: 170
15930
+ },
15931
+ lightskyblue: {
15932
+ r: 135,
15933
+ g: 206,
15934
+ b: 250
15935
+ },
15936
+ lightslategray: {
15937
+ r: 119,
15938
+ g: 136,
15939
+ b: 153
15940
+ },
15941
+ lightslategrey: {
15942
+ r: 119,
15943
+ g: 136,
15944
+ b: 153
15945
+ },
15946
+ lightsteelblue: {
15947
+ r: 176,
15948
+ g: 196,
15949
+ b: 222
15950
+ },
15951
+ lightyellow: {
15952
+ r: 255,
15953
+ g: 255,
15954
+ b: 224
15955
+ },
15956
+ lime: {
15957
+ r: 0,
15958
+ g: 255,
15959
+ b: 0
15960
+ },
15961
+ limegreen: {
15962
+ r: 50,
15963
+ g: 205,
15964
+ b: 50
15965
+ },
15966
+ linen: {
15967
+ r: 250,
15968
+ g: 240,
15969
+ b: 230
15970
+ },
15971
+ magenta: {
15972
+ r: 255,
15973
+ g: 0,
15974
+ b: 255
15975
+ },
15976
+ maroon: {
15977
+ r: 128,
15978
+ g: 0,
15979
+ b: 0
15980
+ },
15981
+ mediumaquamarine: {
15982
+ r: 102,
15983
+ g: 205,
15984
+ b: 170
15985
+ },
15986
+ mediumblue: {
15987
+ r: 0,
15988
+ g: 0,
15989
+ b: 205
15990
+ },
15991
+ mediumorchid: {
15992
+ r: 186,
15993
+ g: 85,
15994
+ b: 211
15995
+ },
15996
+ mediumpurple: {
15997
+ r: 147,
15998
+ g: 112,
15999
+ b: 219
16000
+ },
16001
+ mediumseagreen: {
16002
+ r: 60,
16003
+ g: 179,
16004
+ b: 113
16005
+ },
16006
+ mediumslateblue: {
16007
+ r: 123,
16008
+ g: 104,
16009
+ b: 238
16010
+ },
16011
+ mediumspringgreen: {
16012
+ r: 0,
16013
+ g: 250,
16014
+ b: 154
16015
+ },
16016
+ mediumturquoise: {
16017
+ r: 72,
16018
+ g: 209,
16019
+ b: 204
16020
+ },
16021
+ mediumvioletred: {
16022
+ r: 199,
16023
+ g: 21,
16024
+ b: 133
16025
+ },
16026
+ midnightblue: {
16027
+ r: 25,
16028
+ g: 25,
16029
+ b: 112
16030
+ },
16031
+ mintcream: {
16032
+ r: 245,
16033
+ g: 255,
16034
+ b: 250
16035
+ },
16036
+ mistyrose: {
16037
+ r: 255,
16038
+ g: 228,
16039
+ b: 225
16040
+ },
16041
+ moccasin: {
16042
+ r: 255,
16043
+ g: 228,
16044
+ b: 181
16045
+ },
16046
+ navajowhite: {
16047
+ r: 255,
16048
+ g: 222,
16049
+ b: 173
16050
+ },
16051
+ navy: {
16052
+ r: 0,
16053
+ g: 0,
16054
+ b: 128
16055
+ },
16056
+ oldlace: {
16057
+ r: 253,
16058
+ g: 245,
16059
+ b: 230
16060
+ },
16061
+ olive: {
16062
+ r: 128,
16063
+ g: 128,
16064
+ b: 0
16065
+ },
16066
+ olivedrab: {
16067
+ r: 107,
16068
+ g: 142,
16069
+ b: 35
16070
+ },
16071
+ orange: {
16072
+ r: 255,
16073
+ g: 165,
16074
+ b: 0
16075
+ },
16076
+ orangered: {
16077
+ r: 255,
16078
+ g: 69,
16079
+ b: 0
16080
+ },
16081
+ orchid: {
16082
+ r: 218,
16083
+ g: 112,
16084
+ b: 214
16085
+ },
16086
+ palegoldenrod: {
16087
+ r: 238,
16088
+ g: 232,
16089
+ b: 170
16090
+ },
16091
+ palegreen: {
16092
+ r: 152,
16093
+ g: 251,
16094
+ b: 152
16095
+ },
16096
+ paleturquoise: {
16097
+ r: 175,
16098
+ g: 238,
16099
+ b: 238
16100
+ },
16101
+ palevioletred: {
16102
+ r: 219,
16103
+ g: 112,
16104
+ b: 147
16105
+ },
16106
+ papayawhip: {
16107
+ r: 255,
16108
+ g: 239,
16109
+ b: 213
16110
+ },
16111
+ peachpuff: {
16112
+ r: 255,
16113
+ g: 218,
16114
+ b: 185
16115
+ },
16116
+ peru: {
16117
+ r: 205,
16118
+ g: 133,
16119
+ b: 63
16120
+ },
16121
+ pink: {
16122
+ r: 255,
16123
+ g: 192,
16124
+ b: 203
16125
+ },
16126
+ plum: {
16127
+ r: 221,
16128
+ g: 160,
16129
+ b: 221
16130
+ },
16131
+ powderblue: {
16132
+ r: 176,
16133
+ g: 224,
16134
+ b: 230
16135
+ },
16136
+ purple: {
16137
+ r: 128,
16138
+ g: 0,
16139
+ b: 128
16140
+ },
16141
+ red: {
16142
+ r: 255,
16143
+ g: 0,
16144
+ b: 0
16145
+ },
16146
+ rosybrown: {
16147
+ r: 188,
16148
+ g: 143,
16149
+ b: 143
16150
+ },
16151
+ royalblue: {
16152
+ r: 65,
16153
+ g: 105,
16154
+ b: 225
16155
+ },
16156
+ saddlebrown: {
16157
+ r: 139,
16158
+ g: 69,
16159
+ b: 19
16160
+ },
16161
+ salmon: {
16162
+ r: 250,
16163
+ g: 128,
16164
+ b: 114
16165
+ },
16166
+ sandybrown: {
16167
+ r: 244,
16168
+ g: 164,
16169
+ b: 96
16170
+ },
16171
+ seagreen: {
16172
+ r: 46,
16173
+ g: 139,
16174
+ b: 87
16175
+ },
16176
+ seashell: {
16177
+ r: 255,
16178
+ g: 245,
16179
+ b: 238
16180
+ },
16181
+ sienna: {
16182
+ r: 160,
16183
+ g: 82,
16184
+ b: 45
16185
+ },
16186
+ silver: {
16187
+ r: 192,
16188
+ g: 192,
16189
+ b: 192
16190
+ },
16191
+ skyblue: {
16192
+ r: 135,
16193
+ g: 206,
16194
+ b: 235
16195
+ },
16196
+ slateblue: {
16197
+ r: 106,
16198
+ g: 90,
16199
+ b: 205
16200
+ },
16201
+ slategray: {
16202
+ r: 112,
16203
+ g: 128,
16204
+ b: 144
16205
+ },
16206
+ slategrey: {
16207
+ r: 112,
16208
+ g: 128,
16209
+ b: 144
16210
+ },
16211
+ snow: {
16212
+ r: 255,
16213
+ g: 250,
16214
+ b: 250
16215
+ },
16216
+ springgreen: {
16217
+ r: 0,
16218
+ g: 255,
16219
+ b: 127
16220
+ },
16221
+ steelblue: {
16222
+ r: 70,
16223
+ g: 130,
16224
+ b: 180
16225
+ },
16226
+ tan: {
16227
+ r: 210,
16228
+ g: 180,
16229
+ b: 140
16230
+ },
16231
+ teal: {
16232
+ r: 0,
16233
+ g: 128,
16234
+ b: 128
16235
+ },
16236
+ thistle: {
16237
+ r: 216,
16238
+ g: 191,
16239
+ b: 216
16240
+ },
16241
+ tomato: {
16242
+ r: 255,
16243
+ g: 99,
16244
+ b: 71
16245
+ },
16246
+ transparent: {
16247
+ r: 255,
16248
+ g: 255,
16249
+ b: 255,
16250
+ a: 0
16251
+ },
16252
+ turquoise: {
16253
+ r: 64,
16254
+ g: 224,
16255
+ b: 208
16256
+ },
16257
+ violet: {
16258
+ r: 238,
16259
+ g: 130,
16260
+ b: 238
16261
+ },
16262
+ wheat: {
16263
+ r: 245,
16264
+ g: 222,
16265
+ b: 179
16266
+ },
16267
+ white: {
16268
+ r: 255,
16269
+ g: 255,
16270
+ b: 255
16271
+ },
16272
+ whitesmoke: {
16273
+ r: 245,
16274
+ g: 245,
16275
+ b: 245
16276
+ },
16277
+ yellow: {
16278
+ r: 255,
16279
+ g: 255,
16280
+ b: 0
16281
+ },
16282
+ yellowgreen: {
16283
+ r: 154,
16284
+ g: 205,
16285
+ b: 50
16286
+ }
16287
+ };
16288
+
16289
+ /* eslint-disable no-param-reassign */
16290
+ /* eslint-disable camelcase */
16291
+ /* eslint-disable no-nested-ternary */
16292
+ /* eslint-disable no-cond-assign */
16293
+ /* eslint-disable prefer-destructuring */
16294
+ /* eslint-disable no-underscore-dangle */
15781
16295
 
15782
- const LIGHT = '#FFF';
15783
- const DARK = '#000';
15784
- const TRANSPARENT = 'rgba(255, 255, 255, 0)';
15785
16296
 
15786
16297
  /**
15787
- * If needed, converts a named color to a more reliable CSS color format.
15788
- *
15789
- * @param {string} c The CSS color.
15790
- * @returns {string} Converted color or same color as before.
16298
+ * Module which defines a color object
15791
16299
  * @private
16300
+ * @exports objects.views/charts/representation/color
16301
+ * @expose module:objects.views/charts/representation/color~Color
16302
+ */
16303
+
16304
+ // color formats
16305
+ const rgb = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/i;
16306
+ const rgba = /^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d(\.\d+)?)\)$/i;
16307
+ const hex = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i;
16308
+ const hexShort = /^#([A-f0-9])([A-f0-9])([A-f0-9])$/i;
16309
+ const hsl = /^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i;
16310
+ const hsla = /^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,(\d(\.\d+)?)\)$/i;
16311
+ const {
16312
+ floor
16313
+ } = Math;
16314
+ const {
16315
+ round
16316
+ } = Math;
16317
+
16318
+ /**
16319
+ * @class
16320
+ * @classdesc Class which provides color transformation functionality
16321
+ * @description This is a constructor.
16322
+ * @private This is a constructor.
16323
+ * @param {object} - Parameters to create a color from different notations
15792
16324
  * @example
15793
- * convertNamedColor('red') => '#FF0000'
16325
+ * // a few ways of instantiating a red color
16326
+ * var red;
16327
+ * red = new Color(255, 0, 0, 1); // rgba as parameters
16328
+ * red = new Color('#ff0000'); // hex
16329
+ * red = new Color('rgb(255,0,0)');//rgb as string
16330
+ * red = new Color('hsl(0, 100, 50)');// hsl as string
16331
+ * red = new Color(16711680);// uint
15794
16332
  */
15795
- function convertNamedColor(c) {
15796
- let out = c;
15797
- try {
15798
- if (c in namedColors) {
15799
- ({
15800
- 500: out
15801
- } = namedColors[c]); // 500 exposes the standard color
15802
- } else if (c === 'transparent') {
15803
- out = TRANSPARENT;
16333
+ class Color {
16334
+ constructor() {
16335
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16336
+ args[_key] = arguments[_key];
15804
16337
  }
15805
- } catch (err) {
15806
- out = c;
16338
+ let r = 0;
16339
+ let g = 0;
16340
+ let b = 0;
16341
+ let a = 1;
16342
+ let h;
16343
+ let s;
16344
+ let lcs;
16345
+ let l;
16346
+ let v;
16347
+ let c;
16348
+ let h_;
16349
+ let x;
16350
+ let rgb_;
16351
+ let m;
16352
+ let matches;
16353
+ let colorString;
16354
+ this._invalid = false;
16355
+ if (args[0] instanceof Color) {
16356
+ r = args[0]._r;
16357
+ g = args[0]._g;
16358
+ b = args[0]._b;
16359
+ a = args[0]._a;
16360
+ this._invalid = args[0]._invalid;
16361
+ } else if (args.length < 3) {
16362
+ if (typeof args[0] === 'string') {
16363
+ colorString = args[0];
16364
+ if (matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(colorString)) {
16365
+ r = parseInt(matches[1], 10);
16366
+ g = parseInt(matches[2], 10);
16367
+ b = parseInt(matches[3], 10);
16368
+ } else if (matches = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d(\.\d+)?)\s*\)$/i.exec(colorString)) {
16369
+ // rgba(1, 2, 3, 0.4)
16370
+ r = parseInt(matches[1], 10);
16371
+ g = parseInt(matches[2], 10);
16372
+ b = parseInt(matches[3], 10);
16373
+ a = parseFloat(matches[4]);
16374
+ } else if (matches = /^ARGB\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(colorString)) {
16375
+ // ARGB(255,255,255,255)
16376
+ a = parseInt(matches[1], 10) / 255;
16377
+ r = parseInt(matches[2], 10);
16378
+ g = parseInt(matches[3], 10);
16379
+ b = parseInt(matches[4], 10);
16380
+ } else if (matches = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(colorString)) {
16381
+ // #aBc123
16382
+ r = parseInt(matches[1], 16);
16383
+ g = parseInt(matches[2], 16);
16384
+ b = parseInt(matches[3], 16);
16385
+ a = 1;
16386
+ } else if (matches = /^#([A-f0-9])([A-f0-9])([A-f0-9])$/i.exec(colorString)) {
16387
+ // #a5F
16388
+ r = parseInt(matches[1] + matches[1], 16);
16389
+ g = parseInt(matches[2] + matches[2], 16);
16390
+ b = parseInt(matches[3] + matches[3], 16);
16391
+ a = 1;
16392
+ } else if (matches = /^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i.exec(colorString)) {
16393
+ // hsl(1, 2, 3)
16394
+ h = parseFloat(matches[1]);
16395
+ s = parseFloat(matches[3]);
16396
+ l = parseFloat(matches[5]);
16397
+ h %= 360;
16398
+ s /= 100;
16399
+ l /= 100;
16400
+ h = h < 0 ? 0 : h > 360 ? 360 : h;
16401
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
16402
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
16403
+ c = l <= 0.5 ? 2 * l * s : (2 - 2 * l) * s;
16404
+ h_ = h / 60;
16405
+ x = c * (1 - Math.abs(h_ % 2 - 1));
16406
+ rgb_ = [];
16407
+ h_ = Math.floor(h_);
16408
+ switch (h_) {
16409
+ case 0:
16410
+ rgb_ = [c, x, 0];
16411
+ break;
16412
+ case 1:
16413
+ rgb_ = [x, c, 0];
16414
+ break;
16415
+ case 2:
16416
+ rgb_ = [0, c, x];
16417
+ break;
16418
+ case 3:
16419
+ rgb_ = [0, x, c];
16420
+ break;
16421
+ case 4:
16422
+ rgb_ = [x, 0, c];
16423
+ break;
16424
+ case 5:
16425
+ rgb_ = [c, 0, x];
16426
+ break;
16427
+ default:
16428
+ rgb_ = [0, 0, 0];
16429
+ }
16430
+ m = l - 0.5 * c;
16431
+ r = rgb_[0] + m;
16432
+ g = rgb_[1] + m;
16433
+ b = rgb_[2] + m;
16434
+ r = round(255 * r);
16435
+ g = round(255 * g);
16436
+ b = round(255 * b);
16437
+ a = 1.0;
16438
+ } else if (matches = /^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,(\d(\.\d+)?)\)$/i.exec(colorString)) {
16439
+ // hsla(1,2,3,0.4)
16440
+ h = parseFloat(matches[1]);
16441
+ s = parseFloat(matches[3]);
16442
+ l = parseFloat(matches[5]);
16443
+ a = parseFloat(matches[7]);
16444
+ h %= 360;
16445
+ s /= 100;
16446
+ l /= 100;
16447
+ h = h < 0 ? 0 : h > 360 ? 360 : h;
16448
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
16449
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
16450
+ c = l <= 0.5 ? 2 * l * s : (2 - 2 * l) * s;
16451
+ h_ = h / 60;
16452
+ x = c * (1 - Math.abs(h_ % 2 - 1));
16453
+ rgb_ = [];
16454
+ h_ = Math.floor(h_);
16455
+ switch (h_) {
16456
+ case 0:
16457
+ rgb_ = [c, x, 0];
16458
+ break;
16459
+ case 1:
16460
+ rgb_ = [x, c, 0];
16461
+ break;
16462
+ case 2:
16463
+ rgb_ = [0, c, x];
16464
+ break;
16465
+ case 3:
16466
+ rgb_ = [0, x, c];
16467
+ break;
16468
+ case 4:
16469
+ rgb_ = [x, 0, c];
16470
+ break;
16471
+ case 5:
16472
+ rgb_ = [c, 0, x];
16473
+ break;
16474
+ default:
16475
+ rgb_ = [0, 0, 0];
16476
+ }
16477
+ m = l - 0.5 * c;
16478
+ r = rgb_[0] + m;
16479
+ g = rgb_[1] + m;
16480
+ b = rgb_[2] + m;
16481
+ r = round(255 * r);
16482
+ g = round(255 * g);
16483
+ b = round(255 * b);
16484
+ } else if (matches = /^hsv\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i.exec(colorString)) {
16485
+ // hsv(1, 2, 3) {
16486
+ h = parseFloat(matches[1]);
16487
+ s = parseFloat(matches[3]);
16488
+ v = parseFloat(matches[5]);
16489
+ h %= 360;
16490
+ s /= 100;
16491
+ v /= 100;
16492
+ h = h < 0 ? 0 : h > 360 ? 360 : h;
16493
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
16494
+ v = v < 0 ? 0 : v > 1 ? 1 : v;
16495
+ c = v * s;
16496
+ h_ = h / 60;
16497
+ x = c * (1 - Math.abs(h_ % 2 - 1));
16498
+ rgb_ = [];
16499
+ h_ = Math.floor(h_);
16500
+ switch (h_) {
16501
+ case 0:
16502
+ rgb_ = [c, x, 0];
16503
+ break;
16504
+ case 1:
16505
+ rgb_ = [x, c, 0];
16506
+ break;
16507
+ case 2:
16508
+ rgb_ = [0, c, x];
16509
+ break;
16510
+ case 3:
16511
+ rgb_ = [0, x, c];
16512
+ break;
16513
+ case 4:
16514
+ rgb_ = [x, 0, c];
16515
+ break;
16516
+ case 5:
16517
+ rgb_ = [c, 0, x];
16518
+ break;
16519
+ default:
16520
+ rgb_ = [0, 0, 0];
16521
+ }
16522
+ m = v - c;
16523
+ r = rgb_[0] + m;
16524
+ g = rgb_[1] + m;
16525
+ b = rgb_[2] + m;
16526
+ r = round(255 * r);
16527
+ g = round(255 * g);
16528
+ b = round(255 * b);
16529
+ a = 1.0;
16530
+ } else if (colorStruct[colorString.toLowerCase()]) {
16531
+ lcs = colorString.toLowerCase();
16532
+ r = colorStruct[lcs].r;
16533
+ g = colorStruct[lcs].g;
16534
+ b = colorStruct[lcs].b;
16535
+ a = typeof colorStruct[lcs].a === 'number' ? colorStruct[lcs].a : 1.0;
16536
+ } else {
16537
+ this._invalid = true;
16538
+ }
16539
+ } else if (typeof args[0] === 'number' && args[0] >= 0 && args[1] === 'argb') {
16540
+ a = (0xff000000 & args[0]) >>> 24;
16541
+ a /= 255;
16542
+ r = (0xff0000 & args[0]) >> 16;
16543
+ g = (0x00ff00 & args[0]) >> 8;
16544
+ b = 0x0000ff & args[0];
16545
+ } else if (typeof args[0] === 'number' && args[0] >= 0) {
16546
+ r = (0xff0000 & args[0]) >> 16;
16547
+ g = (0x00ff00 & args[0]) >> 8;
16548
+ b = 0x0000ff & args[0];
16549
+ } else {
16550
+ this._invalid = true;
16551
+ }
16552
+ } else if (args.length >= 3) {
16553
+ r = args[0];
16554
+ g = args[1];
16555
+ b = args[2];
16556
+ a = arguments.length >= 4 ? args[3] : 1;
16557
+ } else {
16558
+ this._invalid = true;
16559
+ }
16560
+ if (Number.isNaN(+r + g + b + a)) {
16561
+ this._invalid = true;
16562
+ }
16563
+ this._r = floor(r);
16564
+ this._g = floor(g);
16565
+ this._b = floor(b);
16566
+ this._a = a;
16567
+
16568
+ // object to cache string representations in various color spaces
16569
+ this._spaces = {};
16570
+ }
16571
+ isInvalid() {
16572
+ return this._invalid;
16573
+ }
16574
+
16575
+ /**
16576
+ * Sets alpha value of color
16577
+ * @private
16578
+ * @param {number} a - Alpha value of the color
16579
+ */
16580
+ setAlpha(a) {
16581
+ this._a = a;
16582
+ this._spaces = {};
16583
+ }
16584
+
16585
+ /**
16586
+ * Gets the alpha value of this color
16587
+ * @private
16588
+ * @returns {number}
16589
+ */
16590
+ getAlpha() {
16591
+ return this._a;
16592
+ }
16593
+
16594
+ /**
16595
+ * Returns an rgb string representation of this color.
16596
+ * @private
16597
+ * @return {string} An rgb string representation of this color
16598
+ */
16599
+ toRGB() {
16600
+ if (!this._spaces.rgb) {
16601
+ this._spaces.rgb = Color.toRGB(this);
16602
+ }
16603
+ return this._spaces.rgb;
16604
+ }
16605
+
16606
+ /**
16607
+ * Returns an rgba string representation of this color.
16608
+ * @private
16609
+ * @return {string} An rgba string representation of this color.
16610
+ */
16611
+ toRGBA() {
16612
+ if (!this._spaces.rgba) {
16613
+ this._spaces.rgba = Color.toRGBA(this);
16614
+ }
16615
+ return this._spaces.rgba;
16616
+ }
16617
+ toString() {
16618
+ if (!this._spaces.rgb) {
16619
+ this._spaces.rgb = Color.toRGB(this);
16620
+ }
16621
+ return this._spaces.rgb;
16622
+ }
16623
+
16624
+ /**
16625
+ * Returns a hex string representation of this color.
16626
+ * @private
16627
+ * @return {string}
16628
+ */
16629
+ toHex() {
16630
+ if (!this._spaces.hex) {
16631
+ this._spaces.hex = Color.toHex(this);
16632
+ }
16633
+ return this._spaces.hex;
16634
+ }
16635
+
16636
+ /**
16637
+ * Returns a hsl string representation of this color using "bi-hexcone" model for lightness
16638
+ * @private
16639
+ * @param {boolean} luma - Whether to use luma calculation
16640
+ * @return {string} In format hsl(0,0,0)
16641
+ */
16642
+ toHSL(luma) {
16643
+ if (!this._spaces.hsl) {
16644
+ this._spaces.hsl = Color.toHSL(this, luma);
16645
+ }
16646
+ return this._spaces.hsl;
16647
+ }
16648
+
16649
+ /**
16650
+ * Returns a hsla string representation of this color using "bi-hexcone" model for lightness
16651
+ * @private
16652
+ * @param {boolean} luma - Whether to use luma calculation
16653
+ * @return {string} In format hsla(0,0,0,0)
16654
+ */
16655
+ toHSLA(luma) {
16656
+ if (!this._spaces.hsla) {
16657
+ this._spaces.hsla = Color.toHSLA(this, luma);
16658
+ }
16659
+ return this._spaces.hsla;
16660
+ }
16661
+
16662
+ /**
16663
+ * Return the color components in hsv space using "hexcone" model for value (lightness)
16664
+ * @private
16665
+ * @param {Color|string} c
16666
+ * @returns {object} The color components in hsv space {h:0-360, s:0-100, v:0-100}
16667
+ */
16668
+ toHSV() {
16669
+ const hsvComp = this.toHSVComponents();
16670
+ return "hsv(".concat(hsvComp.h, ",").concat(hsvComp.s, ",").concat(hsvComp.v, ")");
16671
+ }
16672
+
16673
+ /**
16674
+ * Return the color components in hsv space using "hexcone" model for value (lightness)
16675
+ * @private
16676
+ * @param {Color|string} c
16677
+ * @returns {object} The color components in hsv space {h:0-360, s:0-100, v:0-100}
16678
+ */
16679
+ toHSVComponents() {
16680
+ if (!this._spaces.hsvComp) {
16681
+ this._spaces.hsvComp = Color.toHSVComponents(this);
16682
+ }
16683
+ return this._spaces.hsvComp;
16684
+ }
16685
+
16686
+ /**
16687
+ * Returns a uint representation of this color
16688
+ * @private
16689
+ * @return {number}
16690
+ */
16691
+ toNumber() {
16692
+ if (!this._spaces.num) {
16693
+ this._spaces.num = Color.toNumber(this);
16694
+ }
16695
+ return this._spaces.num;
16696
+ }
16697
+
16698
+ /**
16699
+ * Checks if this color is perceived as dark.
16700
+ * @private
16701
+ * @return {string} True if the luminance is below 160, false otherwise.
16702
+ */
16703
+ isDark() {
16704
+ return this.isInvalid() || this.getLuminance() < 125; // luminace calc option #2
16705
+ // return this.getLuminance() < 160; //luminace calc option #3
16706
+ }
16707
+
16708
+ /**
16709
+ * Calculates the perceived luminance of the color.
16710
+ * @private
16711
+ * @return {number} A value in the range 0-255 where a low value is considered dark and vice versa.
16712
+ */
16713
+ getLuminance() {
16714
+ // alpha channel is not considered
16715
+ if (typeof this._lumi === 'undefined') {
16716
+ // calculate luminance
16717
+ // this._lumi = 0.2126 * this._r + 0.7152 * this._g + 0.0722 * this._b; // option 1
16718
+ this._lumi = 0.299 * this._r + 0.587 * this._g + 0.114 * this._b; // option 2
16719
+ // this._lumi = Math.sqrt( 0.241 * this._r * this._r + 0.691 * this._g * this._g + 0.068 * this._b * this._b ); // option 3
16720
+ }
16721
+
16722
+ return this._lumi;
16723
+ }
16724
+
16725
+ /**
16726
+ * Shifts the color towards a lighter or darker shade
16727
+ * @private
16728
+ * @param {number} value - A value in the range -100-100 to shift the color with along the HSL lightness.
16729
+ * @return {string} The shifted color as hsla string.
16730
+ */
16731
+ shiftLuminance(value) {
16732
+ const chsla = this.toHSLA();
16733
+ const matches = /^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,(\d(\.\d+)?)\)$/i.exec(chsla);
16734
+ const h = parseFloat(matches[1]);
16735
+ const s = parseFloat(matches[3]);
16736
+ let l = parseFloat(matches[5]);
16737
+ const a = parseFloat(matches[7]);
16738
+ // l *= 1 + value / 100;
16739
+ // l = Math.max( 0, l % 100 );
16740
+ l += value;
16741
+ l = Math.max(0, Math.min(l, 100));
16742
+
16743
+ // if( value > 0 ){
16744
+ // s = s*0.2; //removing saturation to avoid the border from being too light
16745
+ // }
16746
+
16747
+ return "hsla(".concat(h, ",").concat(s, ",").concat(l, ",").concat(a, ")");
16748
+ }
16749
+
16750
+ /**
16751
+ * Compares two colors.
16752
+ * @private
16753
+ * @param {Color} c The color to compare with.
16754
+ * @return {boolean} True if the rgba channels are the same, false otherwise
16755
+ */
16756
+ isEqual(c) {
16757
+ if (c instanceof Color) {
16758
+ return this._r === c._r && this._g === c._g && this._b === c._b && this._a === c._a;
16759
+ }
16760
+ c = new Color(c);
16761
+ return this._r === c._r && this._g === c._g && this._b === c._b && this._a === c._a;
16762
+ }
16763
+
16764
+ /**
16765
+ * Linearly interpolates each channel of two colors.
16766
+ * @private
16767
+ * @param {Color} c2 The other color.
16768
+ * @param {number} t The interpolation value in the range (0-1).
16769
+ * @return {string} The blend as an rgb string.
16770
+ */
16771
+ blend(c2, t) {
16772
+ const r = floor(this._r + (c2._r - this._r) * t);
16773
+ const g = floor(this._g + (c2._g - this._g) * t);
16774
+ const b = floor(this._b + (c2._b - this._b) * t);
16775
+ const a = floor(this._a + (c2._a - this._a) * t);
16776
+ return "rgba(".concat([r, g, b, a].join(','), ")");
16777
+ }
16778
+ createShiftedColor(v) {
16779
+ if (v === undefined || Number.isNaN(+v)) {
16780
+ v = 1;
16781
+ }
16782
+ const lumi = this.getLuminance();
16783
+ const greenMultiplier = this._g < 126 ? 1 : 1 + this._g / 512;
16784
+ const hsla_string = this.shiftLuminance((lumi * greenMultiplier < 220 ? 0.8 + 4 * (1 / (lumi + 1)) : -(0.8 + 1 * (lumi / 255))) * 20 * v);
16785
+ return new Color(hsla_string);
16786
+ }
16787
+
16788
+ /**
16789
+ * Returns an rgb string representation of this color
16790
+ * @private
16791
+ * @param {Color|string} c
16792
+ * @returns {string} An rgb string with channel values within range 0-255.
16793
+ */
16794
+ static toRGB(c) {
16795
+ if (c instanceof Color) {
16796
+ return "rgb(".concat([c._r, c._g, c._b].join(','), ")");
16797
+ }
16798
+ if (typeof c === 'string') {
16799
+ c = Color.toNumber(c);
16800
+ }
16801
+ const r = (c & 0xff0000) >> 16;
16802
+ const g = (c & 0x00ff00) >> 8;
16803
+ const b = c & 0x0000ff;
16804
+ return "rgb(".concat(r, ",").concat(g, ",").concat(b, ")");
16805
+ }
16806
+
16807
+ /**
16808
+ *
16809
+ * @private
16810
+ * @param c
16811
+ * @param a
16812
+ * @returns {string} The color rgb format.
16813
+ */
16814
+ static toRGBA(c, a) {
16815
+ if (c instanceof Color) {
16816
+ return "rgba(".concat([c._r, c._g, c._b, typeof a !== 'undefined' ? a : c._a].join(','), ")");
16817
+ }
16818
+ if (typeof c === 'string') {
16819
+ c = Color.toNumber(c);
16820
+ }
16821
+ const r = (c & 0xff0000) >> 16;
16822
+ const g = (c & 0x00ff00) >> 8;
16823
+ const b = c & 0x0000ff;
16824
+ return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(typeof a !== 'undefined' ? a : c._a, ")");
16825
+ }
16826
+
16827
+ /**
16828
+ *
16829
+ * @private
16830
+ * @param {Color|string} c
16831
+ * @returns {string} The color in hexadecimal space.
16832
+ */
16833
+ static toHex(c) {
16834
+ let r;
16835
+ let g;
16836
+ let b;
16837
+ if (c instanceof Color) {
16838
+ r = c._r.toString(16);
16839
+ g = c._g.toString(16);
16840
+ b = c._b.toString(16);
16841
+ if (r.length === 1) {
16842
+ r = "0".concat(r);
16843
+ }
16844
+ if (g.length === 1) {
16845
+ g = "0".concat(g);
16846
+ }
16847
+ if (b.length === 1) {
16848
+ b = "0".concat(b);
16849
+ }
16850
+ return "#".concat([r, g, b].join(''));
16851
+ }
16852
+ if (typeof c === 'string') {
16853
+ c = Color.toNumber(c);
16854
+ }
16855
+ r = ((c & 0xff0000) >> 16).toString(16);
16856
+ g = ((c & 0x00ff00) >> 8).toString(16);
16857
+ b = (c & 0x0000ff).toString(16);
16858
+ if (r.length === 1) {
16859
+ r = "0".concat(r);
16860
+ }
16861
+ if (g.length === 1) {
16862
+ g = "0".concat(g);
16863
+ }
16864
+ if (b.length === 1) {
16865
+ b = "0".concat(b);
16866
+ }
16867
+ return "#".concat(r).concat(g).concat(b);
16868
+ }
16869
+
16870
+ /**
16871
+ * Return the color in hsl space using "bi-hexcone" model for lightness
16872
+ * @private
16873
+ * @param {Color|string} c
16874
+ * @param {boolean} luma - Whether to use luma calculation
16875
+ * @returns {string} The color in hsl space.
16876
+ */
16877
+ static toHSL(c, luma) {
16878
+ let h = 0;
16879
+ let s;
16880
+ let l;
16881
+ let ch;
16882
+ if (typeof c === 'string') {
16883
+ c = new Color(c);
16884
+ }
16885
+
16886
+ // red, green, blue, hue, saturation, lightness/luma, max, min, chroma
16887
+ const r = c._r / 255;
16888
+ const g = c._g / 255;
16889
+ const b = c._b / 255;
16890
+ const max = Math.max(r, g, b);
16891
+ const min = Math.min(r, g, b);
16892
+ if (luma) {
16893
+ // Y'709 http://en.wikipedia.org/wiki/Rec._709
16894
+ // Y′709 = 0.21R + 0.72G + 0.07B
16895
+ l = 0.21 * r + 0.72 * g + 0.07 * b;
16896
+ } else {
16897
+ l = (max + min) / 2;
16898
+ }
16899
+ if (max === min) {
16900
+ // greyscale
16901
+ s = 0;
16902
+ h = 0;
16903
+ } else {
16904
+ ch = max - min;
16905
+ s = l > 0.5 ? ch / (2 - max - min) : ch / (max + min);
16906
+ switch (max) {
16907
+ case r:
16908
+ h = (g - b) / ch + (g < b ? 6 : 0);
16909
+ break;
16910
+ case g:
16911
+ h = (b - r) / ch + 2;
16912
+ break;
16913
+ case b:
16914
+ h = (r - g) / ch + 4;
16915
+ break;
16916
+ }
16917
+ h /= 6;
16918
+ }
16919
+ return "hsl(".concat(h * 360, ",").concat(s * 100, ",").concat(l * 100, ")");
16920
+ }
16921
+
16922
+ /**
16923
+ * Return the color in hsla space using "bi-hexcone" model for lightness
16924
+ * @private
16925
+ * @param {Color|string} c
16926
+ * @param {boolean} luma - Whether to use luma calculation
16927
+ * @returns {string} The color in hsla space.
16928
+ */
16929
+ static toHSLA(c, luma) {
16930
+ let h = 0;
16931
+ let s;
16932
+ let l;
16933
+ let ch;
16934
+ if (typeof c === 'string') {
16935
+ c = new Color(c);
16936
+ }
16937
+
16938
+ // red, green, blue, hue, saturation, lightness/luma, max, min, chroma
16939
+ const r = c._r / 255;
16940
+ const g = c._g / 255;
16941
+ const b = c._b / 255;
16942
+ const a = c._a;
16943
+ const max = Math.max(r, g, b);
16944
+ const min = Math.min(r, g, b);
16945
+ if (luma) {
16946
+ // Y'709 http://en.wikipedia.org/wiki/Rec._709
16947
+ // Y′709 = 0.21R + 0.72G + 0.07B
16948
+ l = 0.21 * r + 0.72 * g + 0.07 * b;
16949
+ } else {
16950
+ l = (max + min) / 2;
16951
+ }
16952
+ if (max === min) {
16953
+ // greyscale
16954
+ s = 0;
16955
+ h = 0;
16956
+ } else {
16957
+ ch = max - min;
16958
+ s = l > 0.5 ? ch / (2 - max - min) : ch / (max + min);
16959
+ switch (max) {
16960
+ case r:
16961
+ h = (g - b) / ch + (g < b ? 6 : 0);
16962
+ break;
16963
+ case g:
16964
+ h = (b - r) / ch + 2;
16965
+ break;
16966
+ case b:
16967
+ h = (r - g) / ch + 4;
16968
+ break;
16969
+ }
16970
+ h /= 6;
16971
+ }
16972
+ return "hsla(".concat(h * 360, ",").concat(s * 100, ",").concat(l * 100, ",").concat(a, ")");
16973
+ }
16974
+
16975
+ /**
16976
+ * Return the color components in hsv space using "hexcone" model for value (lightness)
16977
+ * @private
16978
+ * @param {Color|string} c
16979
+ * @returns {object} The color components in hsv space {h:0-360, s:0-100, v:0-100}
16980
+ */
16981
+ static toHSVComponents(c) {
16982
+ let h = 0;
16983
+ let s;
16984
+ let ch;
16985
+ if (typeof c === 'string') {
16986
+ c = new Color(c);
16987
+ }
16988
+
16989
+ // red, green, blue, hue, saturation, value/luma, max, min, chroma
16990
+ const r = c._r / 255;
16991
+ const g = c._g / 255;
16992
+ const b = c._b / 255;
16993
+ const max = Math.max(r, g, b);
16994
+ const min = Math.min(r, g, b);
16995
+ const v = max;
16996
+ if (max === min) {
16997
+ // greyscale
16998
+ s = 0;
16999
+ h = 0;
17000
+ } else {
17001
+ ch = max - min;
17002
+ s = ch === 0 ? 0 : ch / v;
17003
+ switch (max) {
17004
+ case r:
17005
+ h = (g - b) / ch + (g < b ? 6 : 0);
17006
+ break;
17007
+ case g:
17008
+ h = (b - r) / ch + 2;
17009
+ break;
17010
+ case b:
17011
+ h = (r - g) / ch + 4;
17012
+ break;
17013
+ }
17014
+ h /= 6;
17015
+ }
17016
+ return {
17017
+ h: h * 360 % 360,
17018
+ s: s * 100,
17019
+ v: v * 100
17020
+ };
17021
+ }
17022
+
17023
+ /**
17024
+ * Returns an number representation of the color
17025
+ * @private
17026
+ * @param {Color|string} c
17027
+ * @returns {Number} Unsigned integer in the range 0-16 777 216
17028
+ */
17029
+ static toNumber() {
17030
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
17031
+ args[_key2] = arguments[_key2];
17032
+ }
17033
+ if (args.length === 1 && args[0] instanceof Color) {
17034
+ return (args[0]._r << 16) + (args[0]._g << 8) + args[0]._b;
17035
+ }
17036
+ let r = 0;
17037
+ let g = 0;
17038
+ let b = 0;
17039
+ let matches;
17040
+ let colorString;
17041
+ if (args.length === 1) {
17042
+ if (typeof args[0] === 'string') {
17043
+ colorString = args[0];
17044
+ if (matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/i.exec(colorString)) {
17045
+ r = parseInt(matches[1], 10);
17046
+ g = parseInt(matches[2], 10);
17047
+ b = parseInt(matches[3], 10);
17048
+ } else if (matches = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(colorString)) {
17049
+ r = parseInt(matches[1], 16);
17050
+ g = parseInt(matches[2], 16);
17051
+ b = parseInt(matches[3], 16);
17052
+ } else if (matches = /^#([A-f0-9])([A-f0-9])([A-f0-9])$/i.exec(colorString)) {
17053
+ r = parseInt(matches[1] + matches[1], 16);
17054
+ g = parseInt(matches[2] + matches[2], 16);
17055
+ b = parseInt(matches[3] + matches[3], 16);
17056
+ }
17057
+ }
17058
+ }
17059
+ return (r << 16) + (g << 8) + b;
17060
+ }
17061
+ static blend(c1, c2, t) {
17062
+ c1 = Color.toNumber(c1);
17063
+ c2 = Color.toNumber(c2);
17064
+ const r1 = (c1 & 0xff0000) >> 16;
17065
+ const g1 = (c1 & 0x00ff00) >> 8;
17066
+ const b1 = c1 & 0x0000ff;
17067
+ const r2 = (c2 & 0xff0000) >> 16;
17068
+ const g2 = (c2 & 0x00ff00) >> 8;
17069
+ const b2 = c2 & 0x0000ff;
17070
+ const r = r1 + (r2 - r1) * t;
17071
+ const g = g1 + (g2 - g1) * t;
17072
+ const b = b1 + (b2 - b1) * t;
17073
+ return (r << 16) + (g << 8) + b;
17074
+ }
17075
+ static getBlend(c1, c2, t) {
17076
+ const r = c1._r + (c2._r - c1._r) * t;
17077
+ const g = c1._g + (c2._g - c1._g) * t;
17078
+ const b = c1._b + (c2._b - c1._b) * t;
17079
+ const a = c1._a + (c2._a - c1._a) * t;
17080
+ return new Color(r, g, b, a);
17081
+ }
17082
+ static isCSSColor(color) {
17083
+ if (arguments.length > 1 || typeof color !== 'string') {
17084
+ return false;
17085
+ }
17086
+ return rgb.test(color) || rgba.test(color) || hex.test(color) || hexShort.test(color) || hsl.test(color) || hsla.test(color) || colorStruct[color.toLowerCase()];
17087
+ }
17088
+ static getBestContrast(color, cl, cd) {
17089
+ const lum = color.getLuminance();
17090
+ return Math.abs(lum - cl.getLuminance()) > Math.abs(lum - cd.getLuminance()) ? cl : cd;
17091
+ }
17092
+ static getContrast(color1, color2) {
17093
+ if (!color1 || !color2) {
17094
+ return undefined;
17095
+ }
17096
+ const l1 = color1.getLuminance() / 100;
17097
+ const l2 = color2.getLuminance() / 100;
17098
+ if (l1 > l2) {
17099
+ return (l1 + 0.05) / (l2 + 0.05);
17100
+ }
17101
+ return (l2 + 0.05) / (l1 + 0.05);
17102
+ }
17103
+ static isDark() {
17104
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
17105
+ args[_key3] = arguments[_key3];
17106
+ }
17107
+ const C = new Color(...args);
17108
+ return C.isDark(...args);
17109
+ }
17110
+ static useDarkLabel(areaColor, bgIsDark) {
17111
+ return areaColor._a > 0.5 ? !areaColor.isDark() : !bgIsDark;
15807
17112
  }
15808
- return out;
15809
17113
  }
15810
- const hasEnoughContrast = (desiredTextColor, backgroundColor) => {
15811
- const desired = convertNamedColor(desiredTextColor);
15812
- const background = convertNamedColor(backgroundColor);
15813
- const CONTRAST_THRESHOLD = 3.0;
15814
- let isContrastingEnough;
17114
+
17115
+ const LIGHT = '#FFF';
17116
+ const DARK = '#000';
17117
+ const CONTRAST_THRESHOLD = 1.5;
17118
+ const LIGHT_PREFERRED_THRESHOLD = 3;
17119
+ const getContrast = (desired, background) => {
17120
+ let contrast = false;
17121
+ const des = new Color(desired);
17122
+ const bg = new Color(background);
17123
+ if (bg.isInvalid() || des.isInvalid() || bg.getAlpha() < 1 || des.getAlpha() < 1) {
17124
+ return undefined;
17125
+ }
15815
17126
  try {
15816
- isContrastingEnough = getContrastRatio(desired, background) > CONTRAST_THRESHOLD;
17127
+ contrast = Color.getContrast(des, bg);
15817
17128
  } catch (err) {
15818
- // The function throws on unsupported or misspelled colors.
15819
- // In these cases, simply return true.
15820
- isContrastingEnough = true;
17129
+ contrast = undefined;
15821
17130
  }
15822
- return isContrastingEnough;
17131
+ return contrast;
15823
17132
  };
15824
17133
  function getContrastingColor(backgroundColor) {
15825
17134
  let desiredTextColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
15826
17135
  let dark = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DARK;
15827
17136
  let light = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : LIGHT;
17137
+ const lightColor = new Color(light);
17138
+ const bg = new Color(backgroundColor);
17139
+ const des = new Color(desiredTextColor);
17140
+ if (bg.isInvalid() || des.isInvalid() || bg.getAlpha() < 1 || des.getAlpha() < 1) {
17141
+ return desiredTextColor;
17142
+ }
17143
+
17144
+ // Always prioritise light color if it gives better contrast than desired color's.
17145
+ const lightColorContrast = getContrast(lightColor, bg);
17146
+ const desiredColorContrast = getContrast(des, bg);
17147
+ const useLightColor = lightColorContrast > desiredColorContrast || lightColorContrast > LIGHT_PREFERRED_THRESHOLD;
15828
17148
  let contrastingColor;
15829
- if (desiredTextColor && hasEnoughContrast(desiredTextColor, backgroundColor)) {
17149
+ if (desiredTextColor && desiredColorContrast > CONTRAST_THRESHOLD && !useLightColor) {
15830
17150
  contrastingColor = desiredTextColor;
15831
17151
  } else {
15832
- contrastingColor = hasEnoughContrast(light, backgroundColor) ? light : dark;
17152
+ contrastingColor = useLightColor ? light : dark;
15833
17153
  }
15834
17154
  return contrastingColor;
15835
17155
  }
@@ -15846,10 +17166,17 @@ function getOverridesAsObject() {
15846
17166
  });
15847
17167
  return overrides;
15848
17168
  }
15849
- function getSelectionColors(theme, getListboxStyle, overrides) {
17169
+ function getSelectionColors(_ref) {
15850
17170
  var _overrides$theme, _theme$palette, _overrides$theme$cont, _overrides$theme2, _overrides$selections, _selectionColors$sele, _theme$palette2, _selectionColors$alte, _theme$palette3, _selectionColors$excl, _theme$palette4, _selectionColors$sele2, _theme$palette5, _selectionColors$poss, _theme$palette6, _theme$palette7, _theme$palette8, _theme$palette9, _theme$palette10, _theme$palette11;
15851
- const desiredTextColor = ((_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.fontColor) === null || _overrides$theme === void 0 ? void 0 : _overrides$theme.color) || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
15852
- const useContrastTextColor = (_overrides$theme$cont = (_overrides$theme2 = overrides.theme) === null || _overrides$theme2 === void 0 || (_overrides$theme2 = _overrides$theme2.content) === null || _overrides$theme2 === void 0 ? void 0 : _overrides$theme2.useContrastColor) !== null && _overrides$theme$cont !== void 0 ? _overrides$theme$cont : true;
17171
+ let {
17172
+ theme,
17173
+ getListboxStyle,
17174
+ overrides,
17175
+ checkboxes
17176
+ } = _ref;
17177
+ const componentContentTextColor = (_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.fontColor) === null || _overrides$theme === void 0 ? void 0 : _overrides$theme.color;
17178
+ const desiredTextColor = componentContentTextColor || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
17179
+ const useContrastTextColor = !checkboxes && ((_overrides$theme$cont = (_overrides$theme2 = overrides.theme) === null || _overrides$theme2 === void 0 || (_overrides$theme2 = _overrides$theme2.content) === null || _overrides$theme2 === void 0 ? void 0 : _overrides$theme2.useContrastColor) !== null && _overrides$theme$cont !== void 0 ? _overrides$theme$cont : true);
15853
17180
 
15854
17181
  // Background colors
15855
17182
  const selectionColors = ((_overrides$selections = overrides.selections) === null || _overrides$selections === void 0 ? void 0 : _overrides$selections.colors) || {};
@@ -15860,7 +17187,7 @@ function getSelectionColors(theme, getListboxStyle, overrides) {
15860
17187
  const possible = ((_selectionColors$poss = selectionColors.possible) === null || _selectionColors$poss === void 0 ? void 0 : _selectionColors$poss.color) || getListboxStyle('', 'backgroundColor') || ((_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.selected.possible) || '#FFFFFF';
15861
17188
 
15862
17189
  // Font colors
15863
- let selectedContrast = desiredTextColor || ((_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.selected.main);
17190
+ let selectedContrast = desiredTextColor || ((_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.selected.selectedContrastText);
15864
17191
  let alternativeContrast = desiredTextColor || ((_theme$palette8 = theme.palette) === null || _theme$palette8 === void 0 ? void 0 : _theme$palette8.selected.alternativeContrastText);
15865
17192
  let excludedContrast = desiredTextColor || ((_theme$palette9 = theme.palette) === null || _theme$palette9 === void 0 ? void 0 : _theme$palette9.selected.excludedContrastText);
15866
17193
  let selectedExcludedContrast = desiredTextColor || ((_theme$palette10 = theme.palette) === null || _theme$palette10 === void 0 ? void 0 : _theme$palette10.selected.selectedExcludedContrastText);
@@ -15886,17 +17213,22 @@ function getSelectionColors(theme, getListboxStyle, overrides) {
15886
17213
  possibleContrast
15887
17214
  };
15888
17215
  }
15889
- function getStyles(_ref) {
17216
+ function getStyles(_ref2) {
15890
17217
  var _themeOverrides$heade, _themeOverrides$heade2, _themeOverrides$conte;
15891
17218
  let {
15892
17219
  themeApi,
15893
17220
  theme,
15894
17221
  components = [],
15895
17222
  checkboxes = false
15896
- } = _ref;
17223
+ } = _ref2;
15897
17224
  const overrides = getOverridesAsObject(components);
15898
17225
  const getListboxStyle = (path, prop) => themeApi.getStyle('object.listBox', path, prop);
15899
- const selections = getSelectionColors(theme, getListboxStyle, overrides);
17226
+ const selections = getSelectionColors({
17227
+ theme,
17228
+ getListboxStyle,
17229
+ overrides,
17230
+ checkboxes
17231
+ });
15900
17232
  const themeOverrides = overrides.theme || {};
15901
17233
  return {
15902
17234
  backgroundColor: getListboxStyle('', 'backgroundColor') || theme.palette.background.default,
@@ -15912,6 +17244,9 @@ function getStyles(_ref) {
15912
17244
  fontSize: ((_themeOverrides$conte = themeOverrides.content) === null || _themeOverrides$conte === void 0 ? void 0 : _themeOverrides$conte.fontSize) || getListboxStyle('content', 'fontSize'),
15913
17245
  fontFamily: getListboxStyle('content', 'fontFamily')
15914
17246
  },
17247
+ search: {
17248
+ color: getListboxStyle('content', 'color')
17249
+ },
15915
17250
  selections
15916
17251
  };
15917
17252
  }
@@ -20457,6 +21792,85 @@ function Supernova(_ref) {
20457
21792
  }));
20458
21793
  }
20459
21794
 
21795
+ const MULTI_REG = /,(?![^(]*\))/;
21796
+ const SINGLE_REG = /\s(?![^(]*\))/;
21797
+ const LENGTH_REG = /^[0-9]+[a-zA-Z%]+?$/;
21798
+ const PREDEFINED_STRINGS = ['none', 'inset', 'initial', 'inherit'];
21799
+ const isLength = v => v === '0' || LENGTH_REG.test(v);
21800
+ const getColor = singleShadowString => {
21801
+ if (!singleShadowString) return undefined;
21802
+ const parts = singleShadowString.split(SINGLE_REG).filter(part => !PREDEFINED_STRINGS.includes(part.toLowerCase()));
21803
+ const last = parts.at(-1);
21804
+ const color = last && !isLength(last) && !PREDEFINED_STRINGS.includes(last.toLowerCase()) ? last : undefined;
21805
+ return color;
21806
+ };
21807
+ const getShadows = shadowString => {
21808
+ if (!shadowString) return [];
21809
+ return shadowString.split(MULTI_REG).map(s => s.trim());
21810
+ };
21811
+
21812
+ /**
21813
+ * Combine box shadow with box shadow color.
21814
+ * @param {string} boxShadow - Box shadow which may include color
21815
+ * @param {string} themeBoxShadow - Box shadow from theme which may include color
21816
+ * @param {string | undefined} boxShadowColor - Box shadow color
21817
+ * @returns {string} Returns the combined box shadow and box shadow color
21818
+ *
21819
+ * If boxShadow is a single shadow and has a color then this color will be replaced by boxShadowColor and then
21820
+ * returned as the result,otherwise boxShadowColor will be added to boxShadow and then returned as the result.
21821
+ * If boxShadow is multiple shadows or an empty string then it will be returned as the result.
21822
+ *
21823
+ * @example getFullBoxShadow('none', '', 'red') returns 'none'
21824
+ *
21825
+ * @example getFullBoxShadow('initial', '', 'red') returns 'initial'
21826
+ *
21827
+ * @example getFullBoxShadow('inherit', '', 'red') returns 'inherit'
21828
+ *
21829
+ * @example getFullBoxShadow('', '', 'red') returns ''
21830
+ *
21831
+ * @example getFullBoxShadow('1px 2px blue, 3px 6px green', '', 'red') returns '1px 2px blue, 3px 6px green'
21832
+ *
21833
+ * @example getFullBoxShadow('1px 2px blue', '', 'red') returns '1px 2px red'
21834
+ *
21835
+ * @example getFullBoxShadow('1px 2px', '', 'red') returns '1px 2px red'
21836
+ *
21837
+ * @example getFullBoxShadow('1px 2px', '2px 5px green', undefined) returns '1px 2px green'
21838
+ *
21839
+ * @example getFullBoxShadow('1px 2px', '2px 5px', undefined) returns '1px 2px'
21840
+ */
21841
+ const getFullBoxShadow = (boxShadow, themeBoxShadow, boxShadowColor) => {
21842
+ if (boxShadow && PREDEFINED_STRINGS.includes(boxShadow.toLowerCase())) return boxShadow.toLowerCase();
21843
+ const shadowArray = getShadows(boxShadow);
21844
+ if (shadowArray.length !== 1) return boxShadow;
21845
+ let shadowColor = boxShadowColor;
21846
+ if (!shadowColor) {
21847
+ const themeShadowArray = getShadows(themeBoxShadow);
21848
+ if (themeShadowArray.length !== 1) return boxShadow;
21849
+ shadowColor = getColor(themeShadowArray[0]);
21850
+ }
21851
+ if (!shadowColor) return boxShadow;
21852
+ const color = getColor(shadowArray[0]);
21853
+ if (color) return boxShadow.replace(color, shadowColor);
21854
+ return "".concat(boxShadow, " ").concat(shadowColor);
21855
+ };
21856
+
21857
+ function resolveProperty(path, attribute, theme, objectType) {
21858
+ if (theme && objectType) {
21859
+ return theme.getStyle("object.".concat(objectType), path, attribute);
21860
+ }
21861
+ if (theme) {
21862
+ return theme.getStyle('', path, attribute);
21863
+ }
21864
+ return undefined;
21865
+ }
21866
+
21867
+ function resolveColor(colorObj, path, attribute, theme, objectType) {
21868
+ if (colorObj && theme) {
21869
+ return colorObj.color !== 'none' ? theme.getColorPickerColor(colorObj, true) : undefined;
21870
+ }
21871
+ return resolveProperty(path, attribute, theme, objectType);
21872
+ }
21873
+
20460
21874
  const imageSizingToCssProperty = {
20461
21875
  originalSize: 'auto auto',
20462
21876
  alwaysFit: 'contain',
@@ -20534,21 +21948,29 @@ function resolveBgImage(bgComp, app) {
20534
21948
  }
20535
21949
  return undefined;
20536
21950
  }
20537
- function resolveBgColor(bgComp, theme, objectType) {
20538
- const bgColor = bgComp === null || bgComp === void 0 ? void 0 : bgComp.bgColor;
21951
+ function resolveBgColor(comp, theme, objectType) {
21952
+ const bgColor = comp === null || comp === void 0 ? void 0 : comp.bgColor;
20539
21953
  if (bgColor && theme) {
20540
21954
  if (bgColor.useExpression) {
20541
21955
  return theme.validateColor(bgColor.colorExpression);
20542
21956
  }
20543
- return bgColor.color && bgColor.color.color !== 'none' ? theme.getColorPickerColor(bgColor.color, true) : undefined;
20544
- }
20545
- if (theme && objectType) {
20546
- return theme.getStyle("object.".concat(objectType), '', 'backgroundColor');
20547
- }
20548
- if (theme) {
20549
- return theme.getStyle('', '', 'backgroundColor');
20550
21957
  }
20551
- return undefined;
21958
+ return resolveColor(bgColor === null || bgColor === void 0 ? void 0 : bgColor.color, '', 'backgroundColor', theme, objectType);
21959
+ }
21960
+ function resolveBorder(comp, theme, objectType) {
21961
+ const borderColor = resolveColor(comp === null || comp === void 0 ? void 0 : comp.borderColor, '', 'borderColor', theme, objectType);
21962
+ const borderWidth = (comp === null || comp === void 0 ? void 0 : comp.borderWidth) || resolveProperty('', 'borderWidth', theme, objectType);
21963
+ return borderWidth && borderColor ? "".concat(borderWidth, " solid ").concat(borderColor) : undefined;
21964
+ }
21965
+ function resolveBorderRadius(comp, theme, objectType) {
21966
+ return (comp === null || comp === void 0 ? void 0 : comp.borderRadius) || resolveProperty('', 'borderRadius', theme, objectType);
21967
+ }
21968
+ function resolveBoxShadow(comp, theme, objectType) {
21969
+ var _comp$shadow, _comp$shadow2;
21970
+ const themeBoxShadow = resolveProperty('shadow', 'boxShadow', theme, objectType);
21971
+ const boxShadow = (comp === null || comp === void 0 || (_comp$shadow = comp.shadow) === null || _comp$shadow === void 0 ? void 0 : _comp$shadow.boxShadow) || themeBoxShadow;
21972
+ const boxShadowColor = resolveColor(comp === null || comp === void 0 || (_comp$shadow2 = comp.shadow) === null || _comp$shadow2 === void 0 ? void 0 : _comp$shadow2.boxShadowColor, 'shadow', 'boxShadowColor', theme, objectType);
21973
+ return getFullBoxShadow(boxShadow, themeBoxShadow, boxShadowColor);
20552
21974
  }
20553
21975
  function unfurlFontStyle(fontStyle, target) {
20554
21976
  if (fontStyle && Array.isArray(fontStyle)) {
@@ -20569,6 +21991,34 @@ function resolveTextStyle(textComp, target, theme, objectType) {
20569
21991
  };
20570
21992
  }
20571
21993
 
21994
+ const useStyling = (layout, theme, app, themeName) => {
21995
+ const styling = useMemo$1(() => {
21996
+ if (layout && theme) {
21997
+ const generalComp = layout.components ? layout.components.find(comp => comp.key === 'general') : null;
21998
+ const titleStyles = {
21999
+ main: resolveTextStyle(generalComp, 'main', theme, layout.visualization),
22000
+ footer: resolveTextStyle(generalComp, 'footer', theme, layout.visualization),
22001
+ subTitle: resolveTextStyle(generalComp, 'subTitle', theme, layout.visualization)
22002
+ };
22003
+ const bgColor = resolveBgColor(generalComp, theme, layout.visualization);
22004
+ const bgImage = resolveBgImage(generalComp, app);
22005
+ const border = resolveBorder(generalComp, theme, layout.visualization);
22006
+ const borderRadius = resolveBorderRadius(generalComp, theme, layout.visualization);
22007
+ const boxShadow = resolveBoxShadow(generalComp, theme, layout.visualization);
22008
+ return {
22009
+ titleStyles,
22010
+ bgColor,
22011
+ bgImage,
22012
+ border,
22013
+ borderRadius,
22014
+ boxShadow
22015
+ };
22016
+ }
22017
+ return {};
22018
+ }, [layout, theme, app, themeName]);
22019
+ return styling;
22020
+ };
22021
+
20572
22022
  /**
20573
22023
  * @interface
20574
22024
  * @extends HTMLElement
@@ -20898,9 +22348,14 @@ const Cell = forwardRef((_ref6, ref) => {
20898
22348
  enter: null,
20899
22349
  leave: null
20900
22350
  });
20901
- const [bgColor, setBgColor] = useState$1(undefined);
20902
- const [bgImage, setBgImage] = useState$1(undefined); // {url: "", size: "", pos: ""}
20903
- const [titleStyles, setTitleStyles] = useState$1(undefined);
22351
+ const {
22352
+ titleStyles,
22353
+ bgColor,
22354
+ bgImage,
22355
+ border,
22356
+ borderRadius,
22357
+ boxShadow
22358
+ } = useStyling(layout, halo.public.theme, halo.app, themeName);
20904
22359
  const focusHandler = useRef({
20905
22360
  focusToolbarButton(last) {
20906
22361
  // eslint-disable-next-line react/no-this-in-sfc
@@ -20910,18 +22365,6 @@ const Cell = forwardRef((_ref6, ref) => {
20910
22365
  useEffect$1(() => {
20911
22366
  eventmixin(focusHandler.current);
20912
22367
  }, []);
20913
- useEffect$1(() => {
20914
- if (layout && halo.public.theme) {
20915
- const bgComp = layout.components ? layout.components.find(comp => comp.key === 'general') : null;
20916
- setTitleStyles({
20917
- main: resolveTextStyle(bgComp, 'main', halo.public.theme, layout.visualization),
20918
- footer: resolveTextStyle(bgComp, 'footer', halo.public.theme, layout.visualization),
20919
- subTitle: resolveTextStyle(bgComp, 'subTitle', halo.public.theme, layout.visualization)
20920
- });
20921
- setBgColor(resolveBgColor(bgComp, halo.public.theme, layout.visualization));
20922
- setBgImage(resolveBgImage(bgComp, halo.app));
20923
- }
20924
- }, [layout, halo.public.theme, halo.app, themeName]);
20925
22368
  focusHandler.current.blurCallback = resetFocus => {
20926
22369
  halo.root.toggleFocusOfCells();
20927
22370
  if (resetFocus && contentNode) {
@@ -21112,7 +22555,11 @@ const Cell = forwardRef((_ref6, ref) => {
21112
22555
  backgroundImage: bgImage && bgImage.url ? "url(".concat(bgImage.url, ")") : undefined,
21113
22556
  backgroundRepeat: 'no-repeat',
21114
22557
  backgroundSize: bgImage && bgImage.size,
21115
- backgroundPosition: bgImage && bgImage.pos
22558
+ backgroundPosition: bgImage && bgImage.pos,
22559
+ border,
22560
+ borderRadius,
22561
+ boxShadow,
22562
+ boxSizing: 'border-box'
21116
22563
  },
21117
22564
  elevation: 0,
21118
22565
  square: true,