@smplrspace/smplr-loader 2.24.1-beta.1 → 2.25.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.
@@ -27,6 +27,7 @@ declare interface BaseDataLayer<T, D extends UnknownData> {
27
27
  onClick?: (dataElement: T & D, event: PointerEvent) => void;
28
28
  onHover?: (dataElement: T & D, event: LimitedPointerEvent) => void;
29
29
  onHoverOut?: (dataElement: T & D, event: LimitedPointerEvent) => void;
30
+ legend?: LegendConfig;
30
31
  }
31
32
 
32
33
  declare type CameraMode = '2d' | '3d'
@@ -38,6 +39,14 @@ declare interface CategoryScaleOptions<C extends string> {
38
39
  nodata?: string;
39
40
  }
40
41
 
42
+ declare const categorySwatches: <C extends string>({ categories, nodata, excludeNoData, noDataLabel, }: CategoryScaleOptions<C> & {
43
+ excludeNoData?: boolean | undefined;
44
+ noDataLabel?: string | undefined;
45
+ }) => {
46
+ color: string;
47
+ label: string;
48
+ }[];
49
+
41
50
  declare interface ClientOptions {
42
51
  organizationId: string;
43
52
  clientToken: string;
@@ -47,16 +56,33 @@ declare namespace Color {
47
56
  export {
48
57
  drawLegend,
49
58
  Legend,
59
+ cssToSmplrColor,
60
+ smplrToCssColor,
50
61
  NumericScale,
51
62
  numericScale,
52
63
  categoryScale,
64
+ categorySwatches,
53
65
  ragScale,
54
- cssToSmplrColor,
55
- smplrToCssColor
66
+ ragSwatches
56
67
  }
57
68
  }
58
69
  export { Color }
59
70
 
71
+ declare interface ColorSwatches extends Pick<ColorSwatchesProps, 'swatches'> {
72
+ type: 'swatches';
73
+ }
74
+
75
+ declare interface ColorSwatchesProps {
76
+ swatches: {
77
+ color: string;
78
+ label: string;
79
+ group?: string;
80
+ }[];
81
+ size?: number;
82
+ correctColor?: boolean;
83
+ noLabels?: boolean;
84
+ }
85
+
60
86
  declare const cssToSmplrColor: (c: string) => string;
61
87
 
62
88
  declare interface CubeOptions<D> {
@@ -305,8 +331,24 @@ declare interface IconDataLayer<D extends UnknownData = NoData> extends BaseData
305
331
  disableElevationCorrection?: boolean;
306
332
  }
307
333
 
334
+ declare interface IconLegend extends Pick<IconsSwatchesProps, 'icons'> {
335
+ type: 'icons';
336
+ }
337
+
338
+ declare interface IconsSwatchesProps {
339
+ icons: {
340
+ url: string;
341
+ label: string;
342
+ group?: string;
343
+ }[];
344
+ height?: number;
345
+ noLabels?: boolean;
346
+ }
347
+
308
348
  declare const Legend: FC<LegendProps>;
309
349
 
350
+ declare type LegendConfig = NumericLegend | ColorSwatches | IconLegend;
351
+
310
352
  declare interface LegendProps {
311
353
  colorScale: (n: number | null | undefined) => string;
312
354
  domain?: [number, number];
@@ -391,6 +433,10 @@ declare type NoData = Record<string, never>;
391
433
  declare interface NonInteractiveDataLayer<T, D extends UnknownData> {
392
434
  }
393
435
 
436
+ declare interface NumericLegend extends Pick<LegendProps, 'colorScale' | 'domain' | 'ticks'> {
437
+ type: 'numeric';
438
+ }
439
+
394
440
  declare enum NumericScale {
395
441
  OrRd = "OrRd",
396
442
  PuBu = "PuBu",
@@ -743,6 +789,14 @@ declare interface RAGScaleOptions<C extends string> {
743
789
  nodata?: string;
744
790
  }
745
791
 
792
+ declare const ragSwatches: <C extends string>({ categories, colors, nodata, excludeNoData, noDataLabel, }: RAGScaleOptions<C> & {
793
+ excludeNoData?: boolean | undefined;
794
+ noDataLabel?: string | undefined;
795
+ }) => {
796
+ color: string;
797
+ label: string;
798
+ }[];
799
+
746
800
  declare interface RenderOptions {
747
801
  compass?: boolean
748
802
  annotations?: boolean
@@ -914,7 +968,7 @@ declare interface Vector3Coord extends Vector2Coord {
914
968
  z: number;
915
969
  }
916
970
 
917
- export declare const version = "2.24.1-beta.1";
971
+ export declare const version = "2.25.0";
918
972
 
919
973
  declare interface ViewerOptions {
920
974
  mode?: CameraMode;
@@ -926,6 +980,7 @@ declare interface ViewerOptions {
926
980
  autoRotate?: boolean;
927
981
  hideNavigationButtons?: boolean;
928
982
  hideLevelPicker?: boolean;
983
+ legendPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
929
984
  compass?: boolean;
930
985
  annotations?: boolean;
931
986
  renderOptions?: RenderOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smplrspace/smplr-loader",
3
- "version": "2.24.1-beta.1",
3
+ "version": "2.25.0",
4
4
  "description": "NPM package to load a typed Smplr.js from CDN easily",
5
5
  "type": "module",
6
6
  "files": [