@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.
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "name": "@nebula.js/sn-histogram:properties",
5
5
  "description": "Histogram generic object definition",
6
- "version": "1.2.0",
6
+ "version": "1.3.0",
7
7
  "license": "MIT",
8
8
  "stability": "experimental",
9
9
  "x-qlik-visibility": "private"
package/core/esm/index.js CHANGED
@@ -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
  */
@@ -4550,7 +4550,7 @@ const properties = {
4550
4550
  * @default
4551
4551
  */
4552
4552
  // oxlint-disable-next-line no-undef
4553
- version: "1.2.0",
4553
+ version: "1.3.0",
4554
4554
  /**
4555
4555
  * Extends `HyperCubeDef`, see Engine API: `HyperCubeDef`.
4556
4556
  * @extends {HyperCubeDef}
@@ -4783,6 +4783,26 @@ const properties = {
4783
4783
  footnote: ""
4784
4784
  };
4785
4785
 
4786
+ const FALLBACK_INDEX = 6;
4787
+
4788
+ /**
4789
+ * Index of the theme's primary color in the first color picker palette.
4790
+ * Custom themes may not put the primary color at a fixed position, so it is looked up.
4791
+ * The theme is not always available when the chart is created (e.g. qlik-embed), then the old default applies.
4792
+ */
4793
+ function getDefaultBarColor(theme) {
4794
+ const palette = theme?.getDataColorPickerPalettes()?.[0]?.colors;
4795
+ if (!palette?.length) {
4796
+ return {
4797
+ index: FALLBACK_INDEX
4798
+ };
4799
+ }
4800
+ const index = palette.indexOf(theme.getDataColorSpecials().primary);
4801
+ return {
4802
+ index: index === -1 ? Math.min(FALLBACK_INDEX, palette.length - 1) : index
4803
+ };
4804
+ }
4805
+
4786
4806
  function data(env) {
4787
4807
  const {
4788
4808
  translator
@@ -15699,16 +15719,7 @@ function propertyDefinition(env) {
15699
15719
  }
15700
15720
  };
15701
15721
  const theme = env.theme;
15702
- const defaultColor = () => {
15703
- const {
15704
- primary
15705
- } = theme.getDataColorSpecials();
15706
- const palette = theme.getDataColorPickerPalettes()[0].colors;
15707
- const index = palette.indexOf(primary);
15708
- return {
15709
- index: index === -1 ? Math.min(6, palette.length - 1) : index
15710
- };
15711
- };
15722
+ const defaultColor = () => getDefaultBarColor(theme);
15712
15723
  const colors = {
15713
15724
  translation: "properties.colors",
15714
15725
  type: "items",
@@ -16158,7 +16169,16 @@ function supernova(env) {
16158
16169
  const dataDefinition = data(env);
16159
16170
  return {
16160
16171
  qae: {
16161
- properties,
16172
+ properties: {
16173
+ ...properties,
16174
+ color: {
16175
+ ...properties.color,
16176
+ bar: {
16177
+ ...properties.color?.bar,
16178
+ paletteColor: getDefaultBarColor(env.theme)
16179
+ }
16180
+ }
16181
+ },
16162
16182
  data: {
16163
16183
  targets: [dataDefinition]
16164
16184
  },