floor-editor-ts 1.3.7 → 1.3.8

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,4 +1,6 @@
1
1
  import { Floor, Project } from '../../lib/models/types';
2
+ import { HeatmapColorScale } from '../../lib/utils/heatmapColorScale';
3
+ export type { HeatmapColorLevel, HeatmapColorScale, } from '../../lib/utils/heatmapColorScale';
2
4
  /** Camera from host app — used to assign floor camera furniture via select. */
3
5
  export interface SiteCameraOption {
4
6
  serial: string;
@@ -24,6 +26,11 @@ export interface FloorEditorConfig {
24
26
  floorMaxHeight: number;
25
27
  heatmapEnabled: boolean;
26
28
  heatmapMatrix: number[][];
29
+ /**
30
+ * Floor heatmap color scale from host.
31
+ * `gradient` (default) or `levels` with host-defined N bands — see docs/heatmap-host-standard.md §8.
32
+ */
33
+ heatmapColorScale?: HeatmapColorScale;
27
34
  projectName?: string;
28
35
  selectedCameraSerial?: string | null;
29
36
  showCameraCones?: boolean;
@@ -1,6 +1,7 @@
1
1
  import { Point, Wall, Door, Window as Win, FurnitureItem, Stair, Column, Floor, Annotation, Room } from '../../../lib/models/types';
2
2
  import { CanvasState } from '../../../lib/utils/canvasInteraction';
3
3
  import { ProjectSettings } from '../../../lib/stores/settings';
4
+ import { HeatmapColorScale } from '../../../lib/utils/heatmapColorScale';
4
5
  export declare function wallLength(w: Wall): number;
5
6
  export declare function wallPointAt(w: Wall, t: number): Point;
6
7
  export declare function wallTangentAt(w: Wall, t: number): Point;
@@ -49,4 +50,4 @@ export declare function drawMinimap(cs: CanvasState, minimapCanvas: HTMLCanvasEl
49
50
  maxX: number;
50
51
  maxY: number;
51
52
  } | null): void;
52
- export declare function drawFloorHeatmap(cs: CanvasState, floor: Floor, heatmapMatrix: number[][], detectedRooms: Room[]): void;
53
+ export declare function drawFloorHeatmap(cs: CanvasState, floor: Floor, heatmapMatrix: number[][], detectedRooms: Room[], colorScale?: HeatmapColorScale | null): void;
@@ -0,0 +1,39 @@
1
+ /** Host-defined discrete heatmap band. */
2
+ export interface HeatmapColorLevel {
3
+ /** Inclusive lower bound for this band (see resolve rules). */
4
+ min: number;
5
+ /** Optional inclusive upper bound; if every level has max, use closed ranges. */
6
+ max?: number;
7
+ /** CSS color (hex / rgb / rgba). */
8
+ color: string;
9
+ /** Legend label — metadata for host; unused when drawing. */
10
+ label?: string;
11
+ }
12
+ /**
13
+ * Floor heatmap color scale from host config.
14
+ * - `gradient`: value / max(matrix) → built-in continuous palette
15
+ * - `levels`: absolute thresholds + host colors (N bands, host-defined)
16
+ */
17
+ export interface HeatmapColorScale {
18
+ mode: "gradient" | "levels";
19
+ levels?: HeatmapColorLevel[];
20
+ /** Cells with value <= hideBelow are not drawn. Default 0. */
21
+ hideBelow?: number;
22
+ }
23
+ export declare function normalizeHeatmapColorScale(value: unknown): HeatmapColorScale | undefined;
24
+ /** Fingerprint for heatmap offscreen cache invalidation. */
25
+ export declare function getHeatmapColorScaleKey(scale: HeatmapColorScale | null | undefined): string;
26
+ export declare function colorWithAlpha(color: string, alpha: number): string;
27
+ /**
28
+ * Resolve discrete band color for a cell value.
29
+ * @returns null → do not draw
30
+ */
31
+ export declare function resolveHeatmapLevelColor(value: number, scale: HeatmapColorScale): {
32
+ color: string;
33
+ levelIndex: number;
34
+ levelCount: number;
35
+ } | null;
36
+ export declare function isLevelsColorScale(scale: HeatmapColorScale | null | undefined): scale is HeatmapColorScale & {
37
+ mode: "levels";
38
+ levels: HeatmapColorLevel[];
39
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "floor-editor-ts",
3
3
  "private": false,
4
- "version": "1.3.7",
4
+ "version": "1.3.8",
5
5
  "type": "module",
6
6
  "main": "./dist/floor-editor.es.js",
7
7
  "module": "./dist/floor-editor.es.js",