origam 2.37.38 → 2.37.40

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/src/components/Chart/OrigamChartAxis.vue +15 -1
  3. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +5 -1
  4. package/dist/src/components/Chart/OrigamChartBullet.vue +5 -1
  5. package/dist/src/components/Chart/OrigamChartCandlestick.vue +5 -1
  6. package/dist/src/components/Chart/OrigamChartCartesian.vue +9 -2
  7. package/dist/src/components/Chart/OrigamChartHeatmap.vue +6 -1
  8. package/dist/src/components/Chart/OrigamChartHoneycomb.vue +5 -1
  9. package/dist/src/components/Chart/OrigamChartMap.vue +7 -2
  10. package/dist/src/components/Chart/OrigamChartPareto.vue +5 -1
  11. package/dist/src/components/Chart/OrigamChartPictorial.vue +7 -2
  12. package/dist/src/components/Chart/OrigamChartPolar.vue +5 -1
  13. package/dist/src/components/Chart/OrigamChartPolarBar.vue +5 -1
  14. package/dist/src/components/Chart/OrigamChartPyramid.vue +5 -1
  15. package/dist/src/components/Chart/OrigamChartRadar.vue +6 -1
  16. package/dist/src/components/Chart/OrigamChartSankey.vue +7 -2
  17. package/dist/src/components/Chart/OrigamChartSparkline.vue +11 -4
  18. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +5 -1
  19. package/dist/src/components/Chart/OrigamChartSunburst.vue +5 -1
  20. package/dist/src/components/Chart/OrigamChartTreemap.vue +5 -1
  21. package/dist/src/components/Chart/OrigamChartVariwide.vue +5 -1
  22. package/dist/src/components/Chart/OrigamChartWordCloud.vue +5 -1
  23. package/dist/src/composables/Chart/chart-roving.composable.cjs +69 -0
  24. package/dist/src/composables/Chart/chart-roving.composable.d.ts +33 -0
  25. package/dist/src/composables/Chart/chart-roving.composable.js +64 -0
  26. package/dist/src/composables/index.cjs +12 -0
  27. package/dist/src/composables/index.d.ts +1 -0
  28. package/dist/src/composables/index.js +1 -0
  29. package/dist/src/consts/Chart/chart.const.cjs +14 -1
  30. package/dist/src/consts/Chart/chart.const.d.ts +53 -1
  31. package/dist/src/consts/Chart/chart.const.js +13 -0
  32. package/dist/src/interfaces/Chart/chart-axis.interface.d.ts +11 -0
  33. package/dist/src/interfaces/Chart/chart-roving.interface.cjs +1 -0
  34. package/dist/src/interfaces/Chart/chart-roving.interface.d.ts +12 -0
  35. package/dist/src/interfaces/Chart/chart-roving.interface.js +0 -0
  36. package/dist/src/interfaces/index.cjs +11 -0
  37. package/dist/src/interfaces/index.d.ts +1 -0
  38. package/dist/src/interfaces/index.js +1 -0
  39. package/dist/src/types/Chart/chart.type.d.ts +8 -0
  40. package/dist/src/utils/Chart/chart-axis-label.util.cjs +35 -0
  41. package/dist/src/utils/Chart/chart-axis-label.util.d.ts +24 -0
  42. package/dist/src/utils/Chart/chart-axis-label.util.js +24 -0
  43. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.decimateAxisTicks = decimateAxisTicks;
7
+ exports.measureWidestAxisLabel = measureWidestAxisLabel;
8
+ var _chart = require("../../consts/Chart/chart.const.cjs");
9
+ function measureWidestAxisLabel(root) {
10
+ if (!root) return null;
11
+ const nodes = Array.from(root.querySelectorAll(".origam-chart__axis-label--x"));
12
+ let widest = 0;
13
+ for (const node of nodes) {
14
+ const length = typeof node.getComputedTextLength === "function" ? node.getComputedTextLength() : 0;
15
+ if (length > widest) widest = length;
16
+ }
17
+ return widest > 0 ? widest : null;
18
+ }
19
+ function decimateAxisTicks(ticks, format, measured) {
20
+ let longest = 0;
21
+ for (const tick of ticks) longest = Math.max(longest, format(tick.value).length);
22
+ const widest = measured ?? longest * _chart.CHART_AXIS_LABEL_CHAR_WIDTH;
23
+ let pitch = Infinity;
24
+ let previous;
25
+ for (const tick of ticks) {
26
+ if (previous !== void 0) pitch = Math.min(pitch, Math.abs(tick.position - previous));
27
+ previous = tick.position;
28
+ }
29
+ const step = Number.isFinite(pitch) && pitch > 0 ? Math.max(1, Math.ceil((widest + _chart.CHART_AXIS_LABEL_MIN_GAP) / pitch)) : 1;
30
+ return ticks.map((tick, i) => ({
31
+ tick,
32
+ i,
33
+ shown: i % step === 0
34
+ }));
35
+ }
@@ -0,0 +1,24 @@
1
+ import type { IChartAxisLabelSlot } from '../../interfaces/Chart/chart-axis.interface';
2
+ import type { IChartTick } from '../../interfaces/Chart/chart.interface';
3
+ /*********************************************************
4
+ * measureWidestAxisLabel (#1325)
5
+ *
6
+ * @description
7
+ * Largeur réelle (getComputedTextLength) de la plus longue étiquette X
8
+ * sous `root`, ou `null` quand rien n'est mesurable (SSR, jsdom, aucun
9
+ * label, largeur nulle) : l'appelant retombe alors sur l'estimation.
10
+ * Ces fonctions vivent hors du .vue : le paquet publié expose les
11
+ * .vue sans types, et un `ref<…>` ou un lambda typé y devient erreur
12
+ * pour tout consommateur qui les vérifie.
13
+ ********************************************************/
14
+ export declare function measureWidestAxisLabel(root: ParentNode | null): number | null;
15
+ /*********************************************************
16
+ * decimateAxisTicks (#1325)
17
+ *
18
+ * @description
19
+ * Une étiquette sur N : N = ceil((largeur + écart minimal) / plus petit
20
+ * écart entre graduations). `measured` (px) l'emporte ; sinon la largeur
21
+ * est estimée (caractères × CHART_AXIS_LABEL_CHAR_WIDTH), identique côté
22
+ * serveur et client.
23
+ ********************************************************/
24
+ export declare function decimateAxisTicks(ticks: Array<IChartTick>, format: (value: number | string) => string, measured: number | null): Array<IChartAxisLabelSlot>;
@@ -0,0 +1,24 @@
1
+ import { CHART_AXIS_LABEL_CHAR_WIDTH, CHART_AXIS_LABEL_MIN_GAP } from "../../consts/Chart/chart.const.js";
2
+ export function measureWidestAxisLabel(root) {
3
+ if (!root) return null;
4
+ const nodes = Array.from(root.querySelectorAll(".origam-chart__axis-label--x"));
5
+ let widest = 0;
6
+ for (const node of nodes) {
7
+ const length = typeof node.getComputedTextLength === "function" ? node.getComputedTextLength() : 0;
8
+ if (length > widest) widest = length;
9
+ }
10
+ return widest > 0 ? widest : null;
11
+ }
12
+ export function decimateAxisTicks(ticks, format, measured) {
13
+ let longest = 0;
14
+ for (const tick of ticks) longest = Math.max(longest, format(tick.value).length);
15
+ const widest = measured ?? longest * CHART_AXIS_LABEL_CHAR_WIDTH;
16
+ let pitch = Infinity;
17
+ let previous;
18
+ for (const tick of ticks) {
19
+ if (previous !== void 0) pitch = Math.min(pitch, Math.abs(tick.position - previous));
20
+ previous = tick.position;
21
+ }
22
+ const step = Number.isFinite(pitch) && pitch > 0 ? Math.max(1, Math.ceil((widest + CHART_AXIS_LABEL_MIN_GAP) / pitch)) : 1;
23
+ return ticks.map((tick, i) => ({ tick, i, shown: i % step === 0 }));
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "origam",
3
- "version": "2.37.38",
3
+ "version": "2.37.40",
4
4
  "type": "module",
5
5
  "description": "origam — a Vue 3 design system with multi-theme design tokens, CSS-first components and TypeScript types.",
6
6
  "keywords": [