@nika-js/onlymap 0.7.1 → 0.7.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/CHANGELOG.md CHANGED
@@ -8,6 +8,20 @@ Note: npm collapsed a few closely-spaced releases — the GPX/FlatGeobuf (0.5.4)
8
8
  and GeoParquet (0.5.5) work shipped to npm together as **0.5.6**, so npm's
9
9
  version list jumps 0.5.3 → 0.5.6. Each logical version is listed here regardless.
10
10
 
11
+ ## 0.7.3 — 2026-09-03
12
+
13
+ ### Added
14
+ - **`pow` now means a power curve.** `scale(..., pow, ...)` requires a trailing `exponent=` (e.g. `exponent=2`); without one it silently produced a straight line — identical to the new `linear`, which is now the honest way to spell that. An exponent-less `pow` errors with both ways out named.
15
+ - **`linear` joins the scale() kinds.** A plain linear numeric ramp — the most common way to size points by a value — previously had no name (`sqrt`, `log`, `pow` existed, `linear` did not), which pushed authors toward guessing. `get-point-radius="scale($mag, linear, [4, 18], domain=[4.5, 7.8])"` now does exactly what it reads as.
16
+
17
+ ### Fixed
18
+ - **A scale() whose kind doesn't match its range is now an error instead of an invisible layer.** `sequential` and `diverging` interpolate colors; given a numeric range like `[4, 18]` they silently produced black for every feature — a map of 641 earthquake points rendered at zero pixels with no warning anywhere. The mismatch is caught at validation time in both directions, and the message names the kind to use instead.
19
+
20
+ ## 0.7.2 — 2026-09-03
21
+
22
+ ### Fixed
23
+ - **A time or number filter whose data is still loading now works once it arrives.** The filter and time-slider widgets read their slider's range from the layer's data, but were only listening for structural changes — so if the data finished loading after the widget first drew, they never heard about it. The filter came up with an empty range and dragging it selected nothing; the time slider never appeared at all. Whether you hit this came down to which finished first, the data or the page, so the same map could work in one place and not another. Both widgets now follow their own layer's data.
24
+
11
25
  ## 0.7.1 — 2026-09-03
12
26
 
13
27
  ### Fixed
package/README.md CHANGED
@@ -102,7 +102,7 @@ get-fill-color="scale($depth, sequential, ['#ffffcc','#800026'], domain=[0,700])
102
102
  get-text="formatDate($time, 'datetime', 'UTC')"
103
103
  ```
104
104
 
105
- Built-ins: `scale()` (types: `sequential`, `diverging`, `threshold`, `sqrt`, `log`, `pow` — explicit `domain=` required), `colorRamp()`, `clamp()`, `lerp()`, `formatDate()`, and `Math.*`. `formatDate(value, style?, timeZone?)` turns epoch-millisecond or ISO values into readable labels; styles are `date`, `datetime` (default), `time`, and `iso`, with `UTC` as the default zone (`local` or an IANA zone such as `Asia/Singapore` are explicit alternatives). Multi-line accessors go in a `<script type="om/accessors">` block; genuinely arbitrary JS needs an explicit `js` opt-in on the layer. Untrusted (agent-written) expressions are safe by construction: the compiler is an AST whitelist, not an eval.
105
+ Built-ins: `scale()` (types: `sequential`, `diverging`, `threshold`, `linear`, `sqrt`, `log`, `pow` — explicit `domain=` required; color kinds take color-stop ranges, numeric kinds take number ranges, and `pow` takes a trailing `exponent=2`), `colorRamp()`, `clamp()`, `lerp()`, `formatDate()`, and `Math.*`. `formatDate(value, style?, timeZone?)` turns epoch-millisecond or ISO values into readable labels; styles are `date`, `datetime` (default), `time`, and `iso`, with `UTC` as the default zone (`local` or an IANA zone such as `Asia/Singapore` are explicit alternatives). Multi-line accessors go in a `<script type="om/accessors">` block; genuinely arbitrary JS needs an explicit `js` opt-in on the layer. Untrusted (agent-written) expressions are safe by construction: the compiler is an AST whitelist, not an eval.
106
106
 
107
107
  Date-valued filter sliders use the same contract without a custom widget:
108
108
 
@@ -19,7 +19,7 @@ async function v(N = {}) {
19
19
  if (n) {
20
20
  const { createRequire: I } = await import(
21
21
  /*webpackIgnore:true*/
22
- "./lerc-nHFgnN0N.js"
22
+ "./lerc-BPTGJlrt.js"
23
23
  ).then((g) => g._);
24
24
  var O = I(import.meta.url);
25
25
  }
@@ -1,4 +1,4 @@
1
- import { C as ny, L as sy, M as oy, m as ay, c as ka, a as Sd, z as oc, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-CnwhAoQ5.js";
1
+ import { C as ny, L as sy, M as oy, m as ay, c as ka, a as Sd, z as oc, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-BRdaiH3a.js";
2
2
  const Cd = Math.PI / 180, gy = 180 / Math.PI;
3
3
  function em(Pe, J = 0) {
4
4
  const me = Math.min(180, Pe) * Cd;
@@ -1,9 +1,19 @@
1
- export declare const SCALE_TYPES: readonly ["sequential", "diverging", "threshold", "sqrt", "log", "pow"];
1
+ export declare const SCALE_TYPES: readonly ["sequential", "diverging", "threshold", "linear", "sqrt", "log", "pow"];
2
2
  export type ScaleType = (typeof SCALE_TYPES)[number];
3
3
  export declare function isScaleType(name: string): name is ScaleType;
4
4
  /** A resolved, callable D3 scale — `(value) => output`. */
5
5
  export type CompiledScale = (value: number) => unknown;
6
- export declare function buildScale(type: ScaleType, range: unknown[], domain: number[]): CompiledScale;
6
+ /**
7
+ * Kind/range agreement, checked at COMPILE time (the range is always a literal).
8
+ * `sequential`/`diverging` interpolate COLORS: a numeric range like [4,18] gets
9
+ * fed to d3's color parser, which fails and yields black — so every feature got
10
+ * `[0,0,0]` where a radius belonged, and a whole layer rendered at 0px with no
11
+ * error (the field-reported invisible-earthquakes bug). The numeric kinds fail
12
+ * the same way in reverse. `threshold` maps arbitrary outputs and accepts both.
13
+ * Returns an error message, or null when the pairing is valid.
14
+ */
15
+ export declare function scaleRangeMismatch(type: ScaleType, range: unknown[]): string | null;
16
+ export declare function buildScale(type: ScaleType, range: unknown[], domain: number[], exponent?: number): CompiledScale;
7
17
  /**
8
18
  * `colorRamp(value, domain, colors)` — the doc names this as a registered
9
19
  * built-in alongside scale()/clamp()/lerp() without giving a worked example;
@@ -1,4 +1,4 @@
1
- import { r as p, n as d } from "./index-CnwhAoQ5.js";
1
+ import { r as p, n as d } from "./index-BRdaiH3a.js";
2
2
  function g(t) {
3
3
  if (t == null) return !0;
4
4
  const e = t, n = e.id?.code;