venue-js 1.0.0-3 → 1.0.0-next.2
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.
- package/dist/index.d.mts +33 -24
- package/dist/index.d.ts +33 -24
- package/dist/index.js +31 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ export { QueryObserver } from '@tanstack/query-core';
|
|
|
3
3
|
import * as geojson from 'geojson';
|
|
4
4
|
import { Position, Geometry, GeoJsonProperties, Feature, Point, Polygon, MultiPolygon, LineString, GeometryCollection } from 'geojson';
|
|
5
5
|
import * as maptalks from 'maptalks';
|
|
6
|
-
import { Coordinate, Map, MapViewType, MapAnimationOptionsType, HandlerFn, EventParams, MapPaddingType, Extent
|
|
7
|
-
import {
|
|
6
|
+
import { Coordinate, Map, MapViewType, MapAnimationOptionsType, HandlerFn, EventParams, MapPaddingType, Extent } from 'maptalks';
|
|
7
|
+
import { ThreeLayer, BaseObject } from 'maptalks.three';
|
|
8
8
|
import { ExtrudePolygonOptionType } from 'maptalks.three/dist/type';
|
|
9
9
|
import { SpriteMaterial, AmbientLight, DirectionalLight } from 'three';
|
|
10
10
|
|
|
@@ -627,6 +627,14 @@ type FeaturePopulatedResponseMap = {
|
|
|
627
627
|
};
|
|
628
628
|
type PopulatableFeatureType = keyof FeaturePopulatedResponseMap;
|
|
629
629
|
|
|
630
|
+
type Value = string | boolean | number;
|
|
631
|
+
type EqFilter = Value;
|
|
632
|
+
type InFilter = {
|
|
633
|
+
$in: (Value)[];
|
|
634
|
+
};
|
|
635
|
+
type Filter = EqFilter | InFilter;
|
|
636
|
+
type Filters = Record<string, Filter>;
|
|
637
|
+
|
|
630
638
|
interface VenueClientOptions {
|
|
631
639
|
projectId: string;
|
|
632
640
|
apiKey: string;
|
|
@@ -638,6 +646,7 @@ interface FindParams {
|
|
|
638
646
|
}
|
|
639
647
|
interface FilterParams {
|
|
640
648
|
populate?: boolean;
|
|
649
|
+
filters?: Filters;
|
|
641
650
|
}
|
|
642
651
|
interface PopulatedParams {
|
|
643
652
|
populate: true;
|
|
@@ -715,7 +724,7 @@ declare class RendererManager extends EventTarget {
|
|
|
715
724
|
private elementsByOrdinal;
|
|
716
725
|
constructor(map: maptalks.Map, options: RendererManagerOptions);
|
|
717
726
|
set dataClient(value: any);
|
|
718
|
-
getElementsByOrdinal: (ordinal: number) =>
|
|
727
|
+
getElementsByOrdinal: (ordinal: number) => any[];
|
|
719
728
|
changeLevelByOrdinal(targetOrdinal: null | number | number[]): void;
|
|
720
729
|
createMarker(coordinate: Position, ordinal: number, label: string): void;
|
|
721
730
|
}
|
|
@@ -871,12 +880,12 @@ declare class IndoorMap extends EventTarget {
|
|
|
871
880
|
* Change Level & animate to path / geometry / view / etc.
|
|
872
881
|
* ================================== */
|
|
873
882
|
changeLevelByOrdinal(ordinal: number | number[]): void;
|
|
874
|
-
getFeatureExtent: (feature: any, scaleFactor?: number) =>
|
|
875
|
-
getExtentCenter: (extent: Extent) =>
|
|
883
|
+
getFeatureExtent: (feature: any, scaleFactor?: number) => any;
|
|
884
|
+
getExtentCenter: (extent: Extent) => any;
|
|
876
885
|
getExtentZoom: (extent: Extent, options?: {
|
|
877
886
|
isFraction?: boolean;
|
|
878
887
|
padding?: MapPaddingType;
|
|
879
|
-
}) =>
|
|
888
|
+
}) => any;
|
|
880
889
|
findVenueInView: () => {
|
|
881
890
|
venueId: string;
|
|
882
891
|
distance: number;
|
|
@@ -942,10 +951,10 @@ declare class IndoorMap extends EventTarget {
|
|
|
942
951
|
/**
|
|
943
952
|
* Other functions
|
|
944
953
|
*/
|
|
945
|
-
enableClick: () =>
|
|
946
|
-
disableClick: () =>
|
|
947
|
-
freeze: () =>
|
|
948
|
-
unfreeze: () =>
|
|
954
|
+
enableClick: () => any;
|
|
955
|
+
disableClick: () => any;
|
|
956
|
+
freeze: () => any;
|
|
957
|
+
unfreeze: () => any;
|
|
949
958
|
/**
|
|
950
959
|
* render (frame)
|
|
951
960
|
*/
|
|
@@ -956,8 +965,8 @@ declare class IndoorMap extends EventTarget {
|
|
|
956
965
|
right: number;
|
|
957
966
|
bottom: number;
|
|
958
967
|
};
|
|
959
|
-
}) =>
|
|
960
|
-
setMaxExtent(extent: Extent):
|
|
968
|
+
}) => any;
|
|
969
|
+
setMaxExtent(extent: Extent): any;
|
|
961
970
|
render(): void;
|
|
962
971
|
}
|
|
963
972
|
|
|
@@ -1038,22 +1047,22 @@ declare function styledFeatureGenerator(mapTheme: any): {
|
|
|
1038
1047
|
createVenue: (feature: any) => any;
|
|
1039
1048
|
createLevel: (feature: any) => any;
|
|
1040
1049
|
createUnit: (feature: any) => any;
|
|
1041
|
-
createMarker: (feature: any) =>
|
|
1042
|
-
createOriginMarker: (feature: any) =>
|
|
1043
|
-
createDestinationPinMarker: (feature: any, mapConfig: any) =>
|
|
1044
|
-
createDestinationLogoMarker: (feature: any, mapConfig?: {}) =>
|
|
1045
|
-
createUserLocationMarker: (feature: any) =>
|
|
1046
|
-
createLastUserLocationMarker: (feature: any) =>
|
|
1047
|
-
createHighlightOccupantMarker: (feature: any, mapConfig: any) =>
|
|
1048
|
-
createHighlight2DAmenityMarkerFrom3DMarker: (feature: any, mapConfig: any) =>
|
|
1050
|
+
createMarker: (feature: any) => any;
|
|
1051
|
+
createOriginMarker: (feature: any) => any;
|
|
1052
|
+
createDestinationPinMarker: (feature: any, mapConfig: any) => any;
|
|
1053
|
+
createDestinationLogoMarker: (feature: any, mapConfig?: {}) => any;
|
|
1054
|
+
createUserLocationMarker: (feature: any) => any;
|
|
1055
|
+
createLastUserLocationMarker: (feature: any) => any;
|
|
1056
|
+
createHighlightOccupantMarker: (feature: any, mapConfig: any) => any;
|
|
1057
|
+
createHighlight2DAmenityMarkerFrom3DMarker: (feature: any, mapConfig: any) => any;
|
|
1049
1058
|
createKiosk: (feature: any) => any;
|
|
1050
1059
|
createSection: (feature: any) => any;
|
|
1051
|
-
createOccupant: (feature: any, location: any, mapConfig: any) =>
|
|
1052
|
-
createOpening: (feature: any) =>
|
|
1060
|
+
createOccupant: (feature: any, location: any, mapConfig: any) => any;
|
|
1061
|
+
createOpening: (feature: any) => any;
|
|
1053
1062
|
createFixture: (feature: any) => any;
|
|
1054
|
-
createLineStringFromGeometries: (geometries: any) =>
|
|
1063
|
+
createLineStringFromGeometries: (geometries: any) => any;
|
|
1055
1064
|
create3DStepPath: (feature: any, threeLayer: any, option?: {}) => NavigationPath;
|
|
1056
|
-
createDecoration: (decoration: any, options: any) =>
|
|
1065
|
+
createDecoration: (decoration: any, options: any) => any;
|
|
1057
1066
|
/** Three JS */
|
|
1058
1067
|
create3DFootprint: (feature: any, threeLayer: any, options: any) => Promise<any[]>;
|
|
1059
1068
|
create3DGroundLabel: (label: any, threeLayer: any) => GroundLabel;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { QueryObserver } from '@tanstack/query-core';
|
|
|
3
3
|
import * as geojson from 'geojson';
|
|
4
4
|
import { Position, Geometry, GeoJsonProperties, Feature, Point, Polygon, MultiPolygon, LineString, GeometryCollection } from 'geojson';
|
|
5
5
|
import * as maptalks from 'maptalks';
|
|
6
|
-
import { Coordinate, Map, MapViewType, MapAnimationOptionsType, HandlerFn, EventParams, MapPaddingType, Extent
|
|
7
|
-
import {
|
|
6
|
+
import { Coordinate, Map, MapViewType, MapAnimationOptionsType, HandlerFn, EventParams, MapPaddingType, Extent } from 'maptalks';
|
|
7
|
+
import { ThreeLayer, BaseObject } from 'maptalks.three';
|
|
8
8
|
import { ExtrudePolygonOptionType } from 'maptalks.three/dist/type';
|
|
9
9
|
import { SpriteMaterial, AmbientLight, DirectionalLight } from 'three';
|
|
10
10
|
|
|
@@ -627,6 +627,14 @@ type FeaturePopulatedResponseMap = {
|
|
|
627
627
|
};
|
|
628
628
|
type PopulatableFeatureType = keyof FeaturePopulatedResponseMap;
|
|
629
629
|
|
|
630
|
+
type Value = string | boolean | number;
|
|
631
|
+
type EqFilter = Value;
|
|
632
|
+
type InFilter = {
|
|
633
|
+
$in: (Value)[];
|
|
634
|
+
};
|
|
635
|
+
type Filter = EqFilter | InFilter;
|
|
636
|
+
type Filters = Record<string, Filter>;
|
|
637
|
+
|
|
630
638
|
interface VenueClientOptions {
|
|
631
639
|
projectId: string;
|
|
632
640
|
apiKey: string;
|
|
@@ -638,6 +646,7 @@ interface FindParams {
|
|
|
638
646
|
}
|
|
639
647
|
interface FilterParams {
|
|
640
648
|
populate?: boolean;
|
|
649
|
+
filters?: Filters;
|
|
641
650
|
}
|
|
642
651
|
interface PopulatedParams {
|
|
643
652
|
populate: true;
|
|
@@ -715,7 +724,7 @@ declare class RendererManager extends EventTarget {
|
|
|
715
724
|
private elementsByOrdinal;
|
|
716
725
|
constructor(map: maptalks.Map, options: RendererManagerOptions);
|
|
717
726
|
set dataClient(value: any);
|
|
718
|
-
getElementsByOrdinal: (ordinal: number) =>
|
|
727
|
+
getElementsByOrdinal: (ordinal: number) => any[];
|
|
719
728
|
changeLevelByOrdinal(targetOrdinal: null | number | number[]): void;
|
|
720
729
|
createMarker(coordinate: Position, ordinal: number, label: string): void;
|
|
721
730
|
}
|
|
@@ -871,12 +880,12 @@ declare class IndoorMap extends EventTarget {
|
|
|
871
880
|
* Change Level & animate to path / geometry / view / etc.
|
|
872
881
|
* ================================== */
|
|
873
882
|
changeLevelByOrdinal(ordinal: number | number[]): void;
|
|
874
|
-
getFeatureExtent: (feature: any, scaleFactor?: number) =>
|
|
875
|
-
getExtentCenter: (extent: Extent) =>
|
|
883
|
+
getFeatureExtent: (feature: any, scaleFactor?: number) => any;
|
|
884
|
+
getExtentCenter: (extent: Extent) => any;
|
|
876
885
|
getExtentZoom: (extent: Extent, options?: {
|
|
877
886
|
isFraction?: boolean;
|
|
878
887
|
padding?: MapPaddingType;
|
|
879
|
-
}) =>
|
|
888
|
+
}) => any;
|
|
880
889
|
findVenueInView: () => {
|
|
881
890
|
venueId: string;
|
|
882
891
|
distance: number;
|
|
@@ -942,10 +951,10 @@ declare class IndoorMap extends EventTarget {
|
|
|
942
951
|
/**
|
|
943
952
|
* Other functions
|
|
944
953
|
*/
|
|
945
|
-
enableClick: () =>
|
|
946
|
-
disableClick: () =>
|
|
947
|
-
freeze: () =>
|
|
948
|
-
unfreeze: () =>
|
|
954
|
+
enableClick: () => any;
|
|
955
|
+
disableClick: () => any;
|
|
956
|
+
freeze: () => any;
|
|
957
|
+
unfreeze: () => any;
|
|
949
958
|
/**
|
|
950
959
|
* render (frame)
|
|
951
960
|
*/
|
|
@@ -956,8 +965,8 @@ declare class IndoorMap extends EventTarget {
|
|
|
956
965
|
right: number;
|
|
957
966
|
bottom: number;
|
|
958
967
|
};
|
|
959
|
-
}) =>
|
|
960
|
-
setMaxExtent(extent: Extent):
|
|
968
|
+
}) => any;
|
|
969
|
+
setMaxExtent(extent: Extent): any;
|
|
961
970
|
render(): void;
|
|
962
971
|
}
|
|
963
972
|
|
|
@@ -1038,22 +1047,22 @@ declare function styledFeatureGenerator(mapTheme: any): {
|
|
|
1038
1047
|
createVenue: (feature: any) => any;
|
|
1039
1048
|
createLevel: (feature: any) => any;
|
|
1040
1049
|
createUnit: (feature: any) => any;
|
|
1041
|
-
createMarker: (feature: any) =>
|
|
1042
|
-
createOriginMarker: (feature: any) =>
|
|
1043
|
-
createDestinationPinMarker: (feature: any, mapConfig: any) =>
|
|
1044
|
-
createDestinationLogoMarker: (feature: any, mapConfig?: {}) =>
|
|
1045
|
-
createUserLocationMarker: (feature: any) =>
|
|
1046
|
-
createLastUserLocationMarker: (feature: any) =>
|
|
1047
|
-
createHighlightOccupantMarker: (feature: any, mapConfig: any) =>
|
|
1048
|
-
createHighlight2DAmenityMarkerFrom3DMarker: (feature: any, mapConfig: any) =>
|
|
1050
|
+
createMarker: (feature: any) => any;
|
|
1051
|
+
createOriginMarker: (feature: any) => any;
|
|
1052
|
+
createDestinationPinMarker: (feature: any, mapConfig: any) => any;
|
|
1053
|
+
createDestinationLogoMarker: (feature: any, mapConfig?: {}) => any;
|
|
1054
|
+
createUserLocationMarker: (feature: any) => any;
|
|
1055
|
+
createLastUserLocationMarker: (feature: any) => any;
|
|
1056
|
+
createHighlightOccupantMarker: (feature: any, mapConfig: any) => any;
|
|
1057
|
+
createHighlight2DAmenityMarkerFrom3DMarker: (feature: any, mapConfig: any) => any;
|
|
1049
1058
|
createKiosk: (feature: any) => any;
|
|
1050
1059
|
createSection: (feature: any) => any;
|
|
1051
|
-
createOccupant: (feature: any, location: any, mapConfig: any) =>
|
|
1052
|
-
createOpening: (feature: any) =>
|
|
1060
|
+
createOccupant: (feature: any, location: any, mapConfig: any) => any;
|
|
1061
|
+
createOpening: (feature: any) => any;
|
|
1053
1062
|
createFixture: (feature: any) => any;
|
|
1054
|
-
createLineStringFromGeometries: (geometries: any) =>
|
|
1063
|
+
createLineStringFromGeometries: (geometries: any) => any;
|
|
1055
1064
|
create3DStepPath: (feature: any, threeLayer: any, option?: {}) => NavigationPath;
|
|
1056
|
-
createDecoration: (decoration: any, options: any) =>
|
|
1065
|
+
createDecoration: (decoration: any, options: any) => any;
|
|
1057
1066
|
/** Three JS */
|
|
1058
1067
|
create3DFootprint: (feature: any, threeLayer: any, options: any) => Promise<any[]>;
|
|
1059
1068
|
create3DGroundLabel: (label: any, threeLayer: any) => GroundLabel;
|
package/dist/index.js
CHANGED
|
@@ -439,6 +439,26 @@ var createPopulator = ({
|
|
|
439
439
|
};
|
|
440
440
|
};
|
|
441
441
|
|
|
442
|
+
// src/data/utils/match-filters.ts
|
|
443
|
+
function isInFilter(filter) {
|
|
444
|
+
return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
|
|
445
|
+
}
|
|
446
|
+
var someIntersect = (a, b) => a.some((v) => b.includes(v));
|
|
447
|
+
function matchFilter(value, filter) {
|
|
448
|
+
if (Array.isArray(value)) {
|
|
449
|
+
if (isInFilter(filter)) return someIntersect(value, filter.$in);
|
|
450
|
+
return value.includes(filter);
|
|
451
|
+
} else {
|
|
452
|
+
if (isInFilter(filter)) return filter.$in.includes(value);
|
|
453
|
+
return value === filter;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function matchFilters(item, filters) {
|
|
457
|
+
return Object.entries(filters).every(([key, filter]) => {
|
|
458
|
+
return matchFilter(item.properties[key], filter);
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
442
462
|
// src/data/getDataClient.ts
|
|
443
463
|
var getDataClient = (options) => {
|
|
444
464
|
const observers = /* @__PURE__ */ new Map();
|
|
@@ -514,7 +534,12 @@ var getDataClient = (options) => {
|
|
|
514
534
|
queryKey: [featureType, "list", params],
|
|
515
535
|
queryFn: async () => {
|
|
516
536
|
const features = await internalFilterByType(featureType);
|
|
517
|
-
|
|
537
|
+
const filters = params.filters ?? {};
|
|
538
|
+
let result = features;
|
|
539
|
+
if (params.filters) {
|
|
540
|
+
result = features.filter((f) => matchFilters(f, filters));
|
|
541
|
+
}
|
|
542
|
+
return params.populate === true ? await Promise.all(result.map((f) => populator[featureType](f))) : result;
|
|
518
543
|
},
|
|
519
544
|
...options2 ?? {}
|
|
520
545
|
});
|
|
@@ -3382,9 +3407,11 @@ var createSVGPathFromMarkerSymbol2 = (style) => {
|
|
|
3382
3407
|
fill = "#000000"
|
|
3383
3408
|
} = style;
|
|
3384
3409
|
const scale2 = markerWidth / 24;
|
|
3410
|
+
const strokeWidth = 2;
|
|
3411
|
+
const halfStrokeWidth = 0.5 * strokeWidth;
|
|
3385
3412
|
if (Array.isArray(markerPath)) {
|
|
3386
3413
|
return markerPath.map(
|
|
3387
|
-
({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}"/>`
|
|
3414
|
+
({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}" stroke="#ffffff" stroke-width="${strokeWidth}" />`
|
|
3388
3415
|
);
|
|
3389
3416
|
}
|
|
3390
3417
|
return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill}" />`;
|
|
@@ -3399,7 +3426,6 @@ var createSpriteMaterialByLabelSymbol2 = (labelSymbol) => {
|
|
|
3399
3426
|
const baseSVG = createSVGPathFromMarkerSymbol2(base);
|
|
3400
3427
|
const iconSVG = icon ? createSVGPathFromMarkerSymbol2(icon) : "";
|
|
3401
3428
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
|
|
3402
|
-
console.log(svg);
|
|
3403
3429
|
const textureLoader = new import_three7.TextureLoader();
|
|
3404
3430
|
const scaleFactor = 200 / 24;
|
|
3405
3431
|
svgToDataURL(svg, scaleFactor).then((png) => {
|
|
@@ -3489,14 +3515,12 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3489
3515
|
markerType: "path",
|
|
3490
3516
|
markerPath: [
|
|
3491
3517
|
{
|
|
3492
|
-
path: "
|
|
3518
|
+
path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
|
|
3493
3519
|
fill: "#ff0000"
|
|
3494
3520
|
}
|
|
3495
3521
|
],
|
|
3496
3522
|
markerPathWidth: 24,
|
|
3497
|
-
markerPathHeight: 24
|
|
3498
|
-
markerWidth: 30,
|
|
3499
|
-
markerHeight: 30
|
|
3523
|
+
markerPathHeight: 24
|
|
3500
3524
|
};
|
|
3501
3525
|
const markerSymbol = {
|
|
3502
3526
|
markerType: "path",
|