@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
  */
@@ -23258,7 +23258,7 @@
23258
23258
  * @default
23259
23259
  */
23260
23260
  // oxlint-disable-next-line no-undef
23261
- version: "1.2.0",
23261
+ version: "1.3.0",
23262
23262
  /**
23263
23263
  * Extends `HyperCubeDef`, see Engine API: `HyperCubeDef`.
23264
23264
  * @extends {HyperCubeDef}
@@ -23491,6 +23491,26 @@
23491
23491
  footnote: ""
23492
23492
  };
23493
23493
 
23494
+ const FALLBACK_INDEX = 6;
23495
+
23496
+ /**
23497
+ * Index of the theme's primary color in the first color picker palette.
23498
+ * Custom themes may not put the primary color at a fixed position, so it is looked up.
23499
+ * The theme is not always available when the chart is created (e.g. qlik-embed), then the old default applies.
23500
+ */
23501
+ function getDefaultBarColor(theme) {
23502
+ const palette = theme?.getDataColorPickerPalettes()?.[0]?.colors;
23503
+ if (!palette?.length) {
23504
+ return {
23505
+ index: FALLBACK_INDEX
23506
+ };
23507
+ }
23508
+ const index = palette.indexOf(theme.getDataColorSpecials().primary);
23509
+ return {
23510
+ index: index === -1 ? Math.min(FALLBACK_INDEX, palette.length - 1) : index
23511
+ };
23512
+ }
23513
+
23494
23514
  function data(env) {
23495
23515
  const {
23496
23516
  translator
@@ -34531,16 +34551,7 @@
34531
34551
  }
34532
34552
  };
34533
34553
  const theme = env.theme;
34534
- const defaultColor = () => {
34535
- const {
34536
- primary
34537
- } = theme.getDataColorSpecials();
34538
- const palette = theme.getDataColorPickerPalettes()[0].colors;
34539
- const index = palette.indexOf(primary);
34540
- return {
34541
- index: index === -1 ? Math.min(6, palette.length - 1) : index
34542
- };
34543
- };
34554
+ const defaultColor = () => getDefaultBarColor(theme);
34544
34555
  const colors = {
34545
34556
  translation: "properties.colors",
34546
34557
  type: "items",
@@ -34990,7 +35001,16 @@
34990
35001
  const dataDefinition = data(env);
34991
35002
  return {
34992
35003
  qae: {
34993
- properties,
35004
+ properties: {
35005
+ ...properties,
35006
+ color: {
35007
+ ...properties.color,
35008
+ bar: {
35009
+ ...properties.color?.bar,
35010
+ paletteColor: getDefaultBarColor(env.theme)
35011
+ }
35012
+ }
35013
+ },
34994
35014
  data: {
34995
35015
  targets: [dataDefinition]
34996
35016
  },