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.mjs CHANGED
@@ -360,6 +360,26 @@ var createPopulator = ({
360
360
  };
361
361
  };
362
362
 
363
+ // src/data/utils/match-filters.ts
364
+ function isInFilter(filter) {
365
+ return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
366
+ }
367
+ var someIntersect = (a, b) => a.some((v) => b.includes(v));
368
+ function matchFilter(value, filter) {
369
+ if (Array.isArray(value)) {
370
+ if (isInFilter(filter)) return someIntersect(value, filter.$in);
371
+ return value.includes(filter);
372
+ } else {
373
+ if (isInFilter(filter)) return filter.$in.includes(value);
374
+ return value === filter;
375
+ }
376
+ }
377
+ function matchFilters(item, filters) {
378
+ return Object.entries(filters).every(([key, filter]) => {
379
+ return matchFilter(item.properties[key], filter);
380
+ });
381
+ }
382
+
363
383
  // src/data/getDataClient.ts
364
384
  var getDataClient = (options) => {
365
385
  const observers = /* @__PURE__ */ new Map();
@@ -435,7 +455,12 @@ var getDataClient = (options) => {
435
455
  queryKey: [featureType, "list", params],
436
456
  queryFn: async () => {
437
457
  const features = await internalFilterByType(featureType);
438
- return params.populate === true ? await Promise.all(features.map((f) => populator[featureType](f))) : features;
458
+ const filters = params.filters ?? {};
459
+ let result = features;
460
+ if (params.filters) {
461
+ result = features.filter((f) => matchFilters(f, filters));
462
+ }
463
+ return params.populate === true ? await Promise.all(result.map((f) => populator[featureType](f))) : result;
439
464
  },
440
465
  ...options2 ?? {}
441
466
  });
@@ -3339,9 +3364,11 @@ var createSVGPathFromMarkerSymbol2 = (style) => {
3339
3364
  fill = "#000000"
3340
3365
  } = style;
3341
3366
  const scale2 = markerWidth / 24;
3367
+ const strokeWidth = 2;
3368
+ const halfStrokeWidth = 0.5 * strokeWidth;
3342
3369
  if (Array.isArray(markerPath)) {
3343
3370
  return markerPath.map(
3344
- ({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}"/>`
3371
+ ({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}" stroke="#ffffff" stroke-width="${strokeWidth}" />`
3345
3372
  );
3346
3373
  }
3347
3374
  return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill}" />`;
@@ -3356,7 +3383,6 @@ var createSpriteMaterialByLabelSymbol2 = (labelSymbol) => {
3356
3383
  const baseSVG = createSVGPathFromMarkerSymbol2(base);
3357
3384
  const iconSVG = icon ? createSVGPathFromMarkerSymbol2(icon) : "";
3358
3385
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
3359
- console.log(svg);
3360
3386
  const textureLoader = new TextureLoader3();
3361
3387
  const scaleFactor = 200 / 24;
3362
3388
  svgToDataURL(svg, scaleFactor).then((png) => {
@@ -3446,14 +3472,12 @@ var Element3DRenderer = class extends EventTarget {
3446
3472
  markerType: "path",
3447
3473
  markerPath: [
3448
3474
  {
3449
- path: "M21.75 0H0.25V21.5H8.35L11.3 24L14.2 21.5H21.75V0Z",
3475
+ path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
3450
3476
  fill: "#ff0000"
3451
3477
  }
3452
3478
  ],
3453
3479
  markerPathWidth: 24,
3454
- markerPathHeight: 24,
3455
- markerWidth: 30,
3456
- markerHeight: 30
3480
+ markerPathHeight: 24
3457
3481
  };
3458
3482
  const markerSymbol = {
3459
3483
  markerType: "path",