@smplrspace/smplr-loader 2.14.2-beta.1 → 2.14.2-beta.4

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,7 @@
1
1
  import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera';
2
+ import { CSSProperties } from 'react';
2
3
  import { Dispatch } from 'react';
4
+ import { FC } from 'react';
3
5
  import { Reducer } from 'react';
4
6
  import { ReducerAction } from 'react';
5
7
  import { RefObject } from 'react';
@@ -20,11 +22,34 @@ declare interface BaseDataLayer<T, D extends UnknownData> {
20
22
 
21
23
  declare type CameraMode = '2d' | '3d'
22
24
 
25
+ declare const categoryScale: <C extends string>({ categories, nodata, }: CategoryScaleOptions<C>) => (category: C) => string;
26
+
27
+ declare interface CategoryScaleOptions<C extends string> {
28
+ categories: Record<C, string>;
29
+ nodata?: string;
30
+ }
31
+
23
32
  declare interface ClientOptions {
24
33
  organizationId: string;
25
34
  clientToken: string;
26
35
  }
27
36
 
37
+ declare namespace Color {
38
+ export {
39
+ drawLegend,
40
+ Legend,
41
+ NumericScale,
42
+ numericScale,
43
+ categoryScale,
44
+ ragScale,
45
+ cssToSmplrColor,
46
+ smplrToCssColor
47
+ }
48
+ }
49
+ export { Color }
50
+
51
+ declare const cssToSmplrColor: (c: string) => string;
52
+
28
53
  declare interface CubeOptions<D> {
29
54
  shape: 'cube';
30
55
  size?: number;
@@ -99,6 +124,10 @@ declare interface DottedPolylineDataLayer<D extends UnknownData = NoData> extend
99
124
  waves?: number;
100
125
  }
101
126
 
127
+ declare const drawLegend: ({ containerId, ...legendProps }: LegendProps & {
128
+ containerId: string;
129
+ }) => void;
130
+
102
131
  declare type EventEmitter = ReturnType<typeof useEventEmitter>;
103
132
 
104
133
  declare type EventHandler = () => void;
@@ -278,6 +307,17 @@ declare interface IconDataLayer<D extends UnknownData = NoData> extends BaseData
278
307
  }) => void;
279
308
  }
280
309
 
310
+ declare const Legend: FC<LegendProps>;
311
+
312
+ declare interface LegendProps {
313
+ colorScale: (n: number | null | undefined) => string;
314
+ domain?: [number, number];
315
+ ticks?: Record<number, number | string>;
316
+ barStyle?: CSSProperties;
317
+ labelStyle?: CSSProperties;
318
+ correctColor?: boolean;
319
+ }
320
+
281
321
  declare interface Listener {
282
322
  event: EventType;
283
323
  handler: EventHandler;
@@ -289,6 +329,51 @@ declare type NoData = Record<string, never>;
289
329
  declare interface NonInteractiveDataLayer<T, D extends UnknownData> {
290
330
  }
291
331
 
332
+ declare enum NumericScale {
333
+ OrRd = "OrRd",
334
+ PuBu = "PuBu",
335
+ BuPu = "BuPu",
336
+ Oranges = "Oranges",
337
+ BuGn = "BuGn",
338
+ YlOrBr = "YlOrBr",
339
+ YlGn = "YlGn",
340
+ Reds = "Reds",
341
+ RdPu = "RdPu",
342
+ Greens = "Greens",
343
+ YlGnBu = "YlGnBu",
344
+ Purples = "Purples",
345
+ GnBu = "GnBu",
346
+ Greys = "Greys",
347
+ YlOrRd = "YlOrRd",
348
+ PuRd = "PuRd",
349
+ Blues = "Blues",
350
+ PuBuGn = "PuBuGn",
351
+ Viridis = "Viridis",
352
+ Spectral = "Spectral",
353
+ RdYlGn = "RdYlGn",
354
+ RdBu = "RdBu",
355
+ PiYG = "PiYG",
356
+ PRGn = "PRGn",
357
+ RdYlBu = "RdYlBu",
358
+ BrBG = "BrBG",
359
+ RdGy = "RdGy",
360
+ PuOr = "PuOr"
361
+ }
362
+
363
+ declare const numericScale: ({ name, domain, invert, padding, gamma, brighten, saturate, nodata, classes, }: NumericScaleOptions) => (n: number | null | undefined) => string;
364
+
365
+ declare interface NumericScaleOptions {
366
+ name: NumericScale | string;
367
+ domain?: [number, number];
368
+ invert?: boolean;
369
+ padding?: number | [number, number];
370
+ gamma?: number;
371
+ brighten?: number;
372
+ saturate?: number;
373
+ nodata?: string;
374
+ classes?: number | number[];
375
+ }
376
+
292
377
  declare type OnPickFn = (args: { coordinates: SmplrCoord3d; furnitureId?: string }) => void
293
378
 
294
379
  declare interface OrbitCamera extends ArcRotateCamera {
@@ -471,6 +556,18 @@ export declare class QueryClient {
471
556
  }): SmplrCoord2d[];
472
557
  }
473
558
 
559
+ declare const ragScale: <C extends string>({ categories, colors, nodata, }: RAGScaleOptions<C>) => (category: C) => string;
560
+
561
+ declare interface RAGScaleOptions<C extends string> {
562
+ categories?: Partial<Record<'red' | 'amber' | 'green', C>>;
563
+ colors?: {
564
+ red?: string;
565
+ amber?: string;
566
+ green?: string;
567
+ };
568
+ nodata?: string;
569
+ }
570
+
474
571
  declare interface RenderOptions {
475
572
  compass?: boolean
476
573
  annotations?: boolean
@@ -529,6 +626,8 @@ declare interface SmplrScene extends Scene {
529
626
  cameras: SmplrCamera[];
530
627
  }
531
628
 
629
+ declare const smplrToCssColor: (c: string) => string;
630
+
532
631
  export declare class Space {
533
632
  private options;
534
633
  private viewerStarted;
@@ -610,7 +709,7 @@ declare interface Vector3Coord extends Vector2Coord {
610
709
  z: number;
611
710
  }
612
711
 
613
- export declare const version = "2.14.2-beta.1";
712
+ export declare const version = "2.14.2-beta.4";
614
713
 
615
714
  declare interface ViewerOptions {
616
715
  mode?: CameraMode;
package/dist/types.d.ts CHANGED
@@ -5,8 +5,10 @@ export {}
5
5
 
6
6
  export interface Smplr {
7
7
  version: typeof smplr.version
8
+ toString: typeof smplr.toString
8
9
  Space: typeof smplr.Space
9
10
  QueryClient: typeof smplr.QueryClient
11
+ Color: typeof smplr.Color
10
12
  }
11
13
 
12
14
  declare global {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smplrspace/smplr-loader",
3
- "version": "2.14.2-beta.1",
3
+ "version": "2.14.2-beta.4",
4
4
  "description": "NPM package to load a typed Smplr.js from CDN easily",
5
5
  "type": "module",
6
6
  "files": [