@fusion.dev/helix-plot 0.236.0 → 0.237.1

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.
@@ -63,7 +63,7 @@ export interface PlotColors {
63
63
  quiet: string;
64
64
  /**
65
65
  * The ramp a height is shaded along, from `--spatial-surface-chart-low` to
66
- * `--spatial-surface-chart-high`: a quiet tint of `primary-active` up to it whole.
66
+ * `--spatial-surface-chart-high`: 35% of `primary-strong` up to it whole.
67
67
  */
68
68
  ramp: {
69
69
  high: string;
@@ -50,8 +50,8 @@ export const plotColorsFrom = (chart, groups, extra = {}) => {
50
50
  for (let at = 0; at < Math.max(groups, 1); at++) {
51
51
  colors.push(read(`var(--chart-series-${(at % SERIES) + 1}, var(--helix-color-primary))`) ?? ink);
52
52
  }
53
- const high = read('var(--spatial-surface-chart-high, var(--helix-color-primary-active))') ?? ink;
54
- const low = read('var(--spatial-surface-chart-low, color-mix(in oklab, var(--helix-color-primary-active) 15%, var(--helix-color-surface-sunken)))') ?? ground;
53
+ const high = read('var(--spatial-surface-chart-high, var(--helix-color-primary-strong))') ?? ink;
54
+ const low = read('var(--spatial-surface-chart-low, color-mix(in oklab, var(--helix-color-primary-strong) 35%, var(--helix-color-surface-sunken)))') ?? ground;
55
55
  const named = {};
56
56
  for (const [name, value] of Object.entries(extra)) {
57
57
  named[name] = read(value) ?? ink;
@@ -14,8 +14,12 @@ export declare const lookThrough: (material: Material, amount: number) => void;
14
14
  * on every step of a ramp.
15
15
  */
16
16
  export declare const edgeOf: (face: Color) => Color;
17
- /** A number on an axis, written short enough for a tick. */
18
- export declare const tickText: (value: number) => string;
17
+ /**
18
+ * A number on an axis, written short enough for a tick and grouped in
19
+ * `locale` as the flat charts write theirs, such as `3,000`: the runtime's own
20
+ * locale where it is empty. Negative zero is written as zero.
21
+ */
22
+ export declare const tickText: (value: number, locale?: string) => string;
19
23
  /** Where a number stands in the box, from -1 at its axis' low end to 1 at its high end. */
20
24
  export declare const inBox: (axis: Axis, value: number) => number;
21
25
  /** The plot's three axes: across, up, and in depth, and how long the box is along each, where not a cube. */
@@ -1,4 +1,4 @@
1
- import { boxLabels, pageBudget, } from '@fusion.dev/helix-core';
1
+ import { boxLabels, formatNumbers, pageBudget, wordsLocale, } from '@fusion.dev/helix-core';
2
2
  import { BufferGeometry, CanvasTexture, Color, Float32BufferAttribute, LineBasicMaterial, LineSegments, PerspectiveCamera, Raycaster, Scene, Spherical, Sprite, SpriteMaterial, Vector2, Vector3, WebGLRenderer, } from 'three';
3
3
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
4
4
  const STEP = Math.PI / 12;
@@ -18,7 +18,7 @@ export const edgeOf = (face) => {
18
18
  return face.clone().lerp(new Color(hsl.l < 0.5 ? 0xffffff : 0x000000), hsl.l < 0.5 ? 0.22 : 0.18);
19
19
  };
20
20
  const ease = (at) => (at < 0.5 ? 2 * at * at : 1 - (-2 * at + 2) ** 2 / 2);
21
- export const tickText = (value) => String(Number(value.toPrecision(6)));
21
+ export const tickText = (value, locale = '') => formatNumbers(locale)(Number(value.toPrecision(6)) || 0);
22
22
  export const inBox = (axis, value) => {
23
23
  const [low, high] = axis.range;
24
24
  return high === low ? 0 : ((value - low) / (high - low)) * 2 * HALF - HALF;
@@ -172,11 +172,12 @@ export const createStage = (container, options) => {
172
172
  const on = place.project(camera);
173
173
  return { depth, x: ((on.x + 1) / 2) * width, y: ((1 - on.y) / 2) * height };
174
174
  };
175
+ const locale = wordsLocale(container);
175
176
  const text = (axis) => ({
176
177
  name: axis.name,
177
178
  ticks: axis.ticks.map((tick, index) => ({
178
179
  at: inBox(axis, tick) / HALF,
179
- text: axis.labels?.[index] ?? tickText(tick),
180
+ text: axis.labels?.[index] ?? tickText(tick, locale),
180
181
  })),
181
182
  });
182
183
  for (const one of boxLabels(seen, { x: text(axes.x), y: text(axes.y), z: text(axes.z) }, { gap: 6, name: 13, tick: 11, wide: 0.58 })) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-plot",
3
3
  "description": "Connects the Helix spatial charts to three.js, which draws them in three dimensions: Spatial Bar Chart, Spatial Heatmap, Spatial Ribbon Chart, Spatial Scatter Chart, Spatial Surface Chart, and Spatial Treemap.",
4
- "version": "0.236.0",
4
+ "version": "0.237.1",
5
5
  "license": "MIT",
6
6
  "author": "Fusion Development Group",
7
7
  "repository": {
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "bugs": "https://github.com/project-fusion/fusion/issues",
38
38
  "dependencies": {
39
- "@fusion.dev/helix-core": "0.236.0"
39
+ "@fusion.dev/helix-core": "0.237.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@fusion.dev/helix-headless": "0.236.0",
43
- "@fusion.dev/helix-testing": "0.236.0",
42
+ "@fusion.dev/helix-headless": "0.237.1",
43
+ "@fusion.dev/helix-testing": "0.237.1",
44
44
  "@types/bun": "^1.4.4",
45
45
  "@types/three": "^0.186.0",
46
46
  "three": "^0.186.1"