@nebula.js/sn-histogram 1.2.0 → 1.3.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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/sn-histogram v1.2.0
2
+ * @nebula.js/sn-histogram v1.3.0
3
3
  * Copyright (c) 2026 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -15345,7 +15345,7 @@ System.register(['@nebula.js/stardust', 'picasso.js', 'picasso-plugin-q'], (func
15345
15345
  * @default
15346
15346
  */
15347
15347
  // oxlint-disable-next-line no-undef
15348
- version: "1.2.0",
15348
+ version: "1.3.0",
15349
15349
  /**
15350
15350
  * Extends `HyperCubeDef`, see Engine API: `HyperCubeDef`.
15351
15351
  * @extends {HyperCubeDef}
@@ -15578,6 +15578,26 @@ System.register(['@nebula.js/stardust', 'picasso.js', 'picasso-plugin-q'], (func
15578
15578
  footnote: ""
15579
15579
  };
15580
15580
 
15581
+ const FALLBACK_INDEX = 6;
15582
+
15583
+ /**
15584
+ * Index of the theme's primary color in the first color picker palette.
15585
+ * Custom themes may not put the primary color at a fixed position, so it is looked up.
15586
+ * The theme is not always available when the chart is created (e.g. qlik-embed), then the old default applies.
15587
+ */
15588
+ function getDefaultBarColor(theme) {
15589
+ const palette = theme?.getDataColorPickerPalettes()?.[0]?.colors;
15590
+ if (!palette?.length) {
15591
+ return {
15592
+ index: FALLBACK_INDEX
15593
+ };
15594
+ }
15595
+ const index = palette.indexOf(theme.getDataColorSpecials().primary);
15596
+ return {
15597
+ index: index === -1 ? Math.min(FALLBACK_INDEX, palette.length - 1) : index
15598
+ };
15599
+ }
15600
+
15581
15601
  function data(env) {
15582
15602
  const {
15583
15603
  translator
@@ -26618,16 +26638,7 @@ System.register(['@nebula.js/stardust', 'picasso.js', 'picasso-plugin-q'], (func
26618
26638
  }
26619
26639
  };
26620
26640
  const theme = env.theme;
26621
- const defaultColor = () => {
26622
- const {
26623
- primary
26624
- } = theme.getDataColorSpecials();
26625
- const palette = theme.getDataColorPickerPalettes()[0].colors;
26626
- const index = palette.indexOf(primary);
26627
- return {
26628
- index: index === -1 ? Math.min(6, palette.length - 1) : index
26629
- };
26630
- };
26641
+ const defaultColor = () => getDefaultBarColor(theme);
26631
26642
  const colors = {
26632
26643
  translation: "properties.colors",
26633
26644
  type: "items",
@@ -27077,7 +27088,16 @@ System.register(['@nebula.js/stardust', 'picasso.js', 'picasso-plugin-q'], (func
27077
27088
  const dataDefinition = data(env);
27078
27089
  return {
27079
27090
  qae: {
27080
- properties,
27091
+ properties: {
27092
+ ...properties,
27093
+ color: {
27094
+ ...properties.color,
27095
+ bar: {
27096
+ ...properties.color?.bar,
27097
+ paletteColor: getDefaultBarColor(env.theme)
27098
+ }
27099
+ }
27100
+ },
27081
27101
  data: {
27082
27102
  targets: [dataDefinition]
27083
27103
  },