@emuanalytics/flow-rdf-core 4.0.2 → 4.0.3

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.cjs CHANGED
@@ -4,7 +4,7 @@ const mobx = require('mobx');
4
4
  const Debug = require('debug');
5
5
  const flowEngineClient = require('@emuanalytics/flow-engine-client');
6
6
  const randomId = require('./shared/flow-rdf-core.f50908f0.cjs');
7
- const mapFeatureStream = require('./shared/flow-rdf-core.9b5dad76.cjs');
7
+ const mapFeatureStream = require('./shared/flow-rdf-core.06e85a6c.cjs');
8
8
  const maplibre = require('@emuanalytics/maplibre-gl');
9
9
  const EventEmitter = require('eventemitter3');
10
10
  const mobxUtils = require('mobx-utils');
@@ -35,7 +35,7 @@ const maplibre__default = /*#__PURE__*/_interopDefaultCompat(maplibre);
35
35
  const EventEmitter__default = /*#__PURE__*/_interopDefaultCompat(EventEmitter);
36
36
  const lzString__default = /*#__PURE__*/_interopDefaultCompat(lzString);
37
37
 
38
- const version = "4.0.2";
38
+ const version = "4.0.3";
39
39
 
40
40
  const CONSOLE_HIGHLIGHT_STYLE$1 = `
41
41
  padding: 2px 4px;
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ export { makeAutoObservable, makeObservable } from 'mobx';
4
4
  import Debug from 'debug';
5
5
  import { Client } from '@emuanalytics/flow-engine-client';
6
6
  import { i as isUndefined, f as isString, o as isNumber, s as isBoolean, j as isArray, b as isNil, A as randomId, y as isPlainObject, d as isDefined, g as isStringFull, z as isURL, e as ensureArray } from './shared/flow-rdf-core.25e5f6d7.mjs';
7
- import { R as ReactiveExpression, F as FlowError, f as MapStyleChangeEvent, P as PluginManager, e as MapLayer, d as MapDataSource, g as MapSourceEvent, M as MapEvent, c as FlowMapError, b as MapFeatureStream, a as assert, h as MapLoadingEvent, i as MapMouseEvent, j as die } from './shared/flow-rdf-core.e2b1bb7f.mjs';
7
+ import { R as ReactiveExpression, F as FlowError, f as MapStyleChangeEvent, P as PluginManager, e as MapLayer, d as MapDataSource, g as MapSourceEvent, M as MapEvent, c as FlowMapError, b as MapFeatureStream, a as assert, h as MapLoadingEvent, i as MapMouseEvent, j as die } from './shared/flow-rdf-core.65045caf.mjs';
8
8
  import maplibre from '@emuanalytics/maplibre-gl';
9
9
  import EventEmitter from 'eventemitter3';
10
10
  import { toStream } from 'mobx-utils';
@@ -15,7 +15,7 @@ import lzString from 'lz-string';
15
15
  import 'parsimmon';
16
16
  import 'colorbrewer';
17
17
 
18
- const version = "4.0.2";
18
+ const version = "4.0.3";
19
19
 
20
20
  const CONSOLE_HIGHLIGHT_STYLE$1 = `
21
21
  padding: 2px 4px;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const mapFeatureStream = require('../../../shared/flow-rdf-core.9b5dad76.cjs');
3
+ const mapFeatureStream = require('../../../shared/flow-rdf-core.06e85a6c.cjs');
4
4
  const MapboxDraw = require('@emuanalytics/mapbox-gl-draw');
5
5
  const turfArea = require('@turf/area');
6
6
  const turfBBox = require('@turf/bbox');
@@ -1,5 +1,5 @@
1
- import { M as MapEvent, a as assert, b as MapFeatureStream, F as FlowError, c as FlowMapError, d as MapDataSource, e as MapLayer, R as ReactiveExpression } from '../../../shared/flow-rdf-core.e2b1bb7f.mjs';
2
- export { P as PluginManager } from '../../../shared/flow-rdf-core.e2b1bb7f.mjs';
1
+ import { M as MapEvent, a as assert, b as MapFeatureStream, F as FlowError, c as FlowMapError, d as MapDataSource, e as MapLayer, R as ReactiveExpression } from '../../../shared/flow-rdf-core.65045caf.mjs';
2
+ export { P as PluginManager } from '../../../shared/flow-rdf-core.65045caf.mjs';
3
3
  import MapboxDraw from '@emuanalytics/mapbox-gl-draw';
4
4
  import turfArea from '@turf/area';
5
5
  import turfBBox from '@turf/bbox';
@@ -279,7 +279,7 @@ class ExpressionParser {
279
279
  const palettes = {};
280
280
  function registerColorBrewerPalettes() {
281
281
  Object.keys(colorbrewer__default).filter((key) => key !== "schemeGroups").forEach(
282
- (key) => palettes[key] = {
282
+ (key) => palettes[key.toLowerCase()] = {
283
283
  id: key,
284
284
  colors: colorbrewer__default[key][5]
285
285
  }
@@ -291,16 +291,20 @@ function fromPalette(expr, parentExpression) {
291
291
  let colorStops = expr.slice(3);
292
292
  let palette;
293
293
  if (randomId.isString(paletteIdOrArray)) {
294
- palette = palettes[paletteIdOrArray]?.colors || palettes["Greys"].colors;
294
+ palette = palettes[paletteIdOrArray.toLowerCase()]?.colors || palettes["Greys"].colors;
295
295
  } else if (randomId.isArray(paletteIdOrArray) && paletteIdOrArray[0] === "literal") {
296
296
  palette = paletteIdOrArray[1];
297
297
  } else {
298
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["from-palette requires palette id as string or custom palette array"]);
298
+ throw new FlowExpressionError(parentExpression.expression, "evaluationError", [
299
+ "from-palette requires palette id as string or custom palette array"
300
+ ]);
299
301
  }
300
302
  const numPaletteEntries = palette.length;
301
303
  let reversePalette = false;
302
304
  if (numPaletteEntries < 5) {
303
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["custom palette requires at least 5 color entries"]);
305
+ throw new FlowExpressionError(parentExpression.expression, "evaluationError", [
306
+ "custom palette requires at least 5 color entries"
307
+ ]);
304
308
  }
305
309
  switch (colorStops.length) {
306
310
  case 2:
@@ -316,7 +320,9 @@ function fromPalette(expr, parentExpression) {
316
320
  colorStops = colorStops.slice(0, numPaletteEntries);
317
321
  break;
318
322
  default:
319
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["incorrect color stop arguments"]);
323
+ throw new FlowExpressionError(parentExpression.expression, "evaluationError", [
324
+ "incorrect color stop arguments"
325
+ ]);
320
326
  }
321
327
  if (colorStops.length === 2) {
322
328
  const min = colorStops[0];
@@ -366,7 +372,10 @@ const regexi = {
366
372
 
367
373
  function stateCustomFunction(expr, parentExpression) {
368
374
  if (!parentExpression.store) {
369
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["no state store provided"]);
375
+ console.warn(
376
+ `The reactive expression '${parentExpression.expression}' references state properties but is not bound to a state store. The expression cannot be evaluated - returning null.`
377
+ );
378
+ return null;
370
379
  }
371
380
  const path = expr.slice(1).join(".");
372
381
  const val = parentExpression.store.get(path);
@@ -258,7 +258,7 @@ class ExpressionParser {
258
258
  const palettes = {};
259
259
  function registerColorBrewerPalettes() {
260
260
  Object.keys(colorbrewer).filter((key) => key !== "schemeGroups").forEach(
261
- (key) => palettes[key] = {
261
+ (key) => palettes[key.toLowerCase()] = {
262
262
  id: key,
263
263
  colors: colorbrewer[key][5]
264
264
  }
@@ -270,16 +270,20 @@ function fromPalette(expr, parentExpression) {
270
270
  let colorStops = expr.slice(3);
271
271
  let palette;
272
272
  if (isString(paletteIdOrArray)) {
273
- palette = palettes[paletteIdOrArray]?.colors || palettes["Greys"].colors;
273
+ palette = palettes[paletteIdOrArray.toLowerCase()]?.colors || palettes["Greys"].colors;
274
274
  } else if (isArray(paletteIdOrArray) && paletteIdOrArray[0] === "literal") {
275
275
  palette = paletteIdOrArray[1];
276
276
  } else {
277
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["from-palette requires palette id as string or custom palette array"]);
277
+ throw new FlowExpressionError(parentExpression.expression, "evaluationError", [
278
+ "from-palette requires palette id as string or custom palette array"
279
+ ]);
278
280
  }
279
281
  const numPaletteEntries = palette.length;
280
282
  let reversePalette = false;
281
283
  if (numPaletteEntries < 5) {
282
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["custom palette requires at least 5 color entries"]);
284
+ throw new FlowExpressionError(parentExpression.expression, "evaluationError", [
285
+ "custom palette requires at least 5 color entries"
286
+ ]);
283
287
  }
284
288
  switch (colorStops.length) {
285
289
  case 2:
@@ -295,7 +299,9 @@ function fromPalette(expr, parentExpression) {
295
299
  colorStops = colorStops.slice(0, numPaletteEntries);
296
300
  break;
297
301
  default:
298
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["incorrect color stop arguments"]);
302
+ throw new FlowExpressionError(parentExpression.expression, "evaluationError", [
303
+ "incorrect color stop arguments"
304
+ ]);
299
305
  }
300
306
  if (colorStops.length === 2) {
301
307
  const min = colorStops[0];
@@ -345,7 +351,10 @@ const regexi = {
345
351
 
346
352
  function stateCustomFunction(expr, parentExpression) {
347
353
  if (!parentExpression.store) {
348
- throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["no state store provided"]);
354
+ console.warn(
355
+ `The reactive expression '${parentExpression.expression}' references state properties but is not bound to a state store. The expression cannot be evaluated - returning null.`
356
+ );
357
+ return null;
349
358
  }
350
359
  const path = expr.slice(1).join(".");
351
360
  const val = parentExpression.store.get(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emuanalytics/flow-rdf-core",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "type": "module",