diff --git a/package-lock.json b/package-lock.json index d66693e..ceae322 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5228,7 +5228,7 @@ "version": "0.3.0", "license": "GPL-3.0", "dependencies": { - "@maplibre/maplibre-gl-style-spec": "^25.0.0", + "@maplibre/maplibre-gl-style-spec": "^26.2.1", "@openwaters/seascape": "^0.3.0", "@versatiles/style": "^5.12.1" }, @@ -5241,6 +5241,25 @@ "vitest": "^4.1.9" } }, + "style/node_modules/@maplibre/maplibre-gl-style-spec": { + "version": "26.2.1", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-26.2.1.tgz", + "integrity": "sha512-QFKCXkOeSzOr8jF75jm6kySOg+dUvOehPhRi68gcOYPHb7U5JloUq0dJW0Y5/fZV8ygfT0Vp2RWodvq+fyxFWA==", + "license": "ISC", + "dependencies": { + "@mapbox/jsonlint-lines-primitives": "^2.0.3", + "@mapbox/unitbezier": "^1.0.0", + "json-stringify-pretty-compact": "^4.0.0", + "minimist": "^1.2.8", + "quickselect": "^3.0.0", + "tinyqueue": "^3.0.0" + }, + "bin": { + "gl-style-format": "dist/gl-style-format.mjs", + "gl-style-migrate": "dist/gl-style-migrate.mjs", + "gl-style-validate": "dist/gl-style-validate.mjs" + } + }, "viewer": { "name": "seamap-viewer", "dependencies": { diff --git a/style/index.test.ts b/style/index.test.ts index c3172e3..a630a58 100644 --- a/style/index.test.ts +++ b/style/index.test.ts @@ -146,7 +146,11 @@ describe("isolated dangers", () => { }; const point = (properties: Record) => ({ type: 1, properties }) as never; const highlighted = (properties: Record) => - featureFilter(layer.filter).filter({ zoom: 12 }, point(properties), undefined as never); + featureFilter(layer.filter, "layers.isolated-dangers.filter").filter( + { zoom: 12 }, + point(properties), + undefined as never, + ); it("rings a shoal hazard in navigable water", () => { expect(highlighted({ type: "wreck", depth: 1.5, surrounding_depth: 15 })).toBe(true); @@ -168,7 +172,11 @@ describe("isolated dangers", () => { filter: never; }; const ringed = (properties: Record) => - featureFilter(deep.filter).filter({ zoom: 12 }, point(properties), undefined as never); + featureFilter(deep.filter, "layers.isolated-dangers.filter").filter( + { zoom: 12 }, + point(properties), + undefined as never, + ); // a 35 m hazard is "shallow" at safety 40, but the tiles stop retaining hazards past 30 — // highlighting it would promise coverage the data does not have expect(ringed({ type: "rock", depth: 35, surrounding_depth: 50 })).toBe(false); @@ -193,7 +201,11 @@ describe("thinning and decoration", () => { const layer = (id: string) => chartLayers({ safety: 2 }).symbols.find((l) => l.id === id) as { filter: never }; const draws = (id: string, zoom: number, properties: Record) => - featureFilter(layer(id).filter).filter({ zoom }, point(properties), undefined as never); + featureFilter(layer(id).filter, `layers.${id}.filter`).filter( + { zoom }, + point(properties), + undefined as never, + ); const buoy = { type: "buoy_lateral", family: "minor_aid", topmark_shape: "cone" }; const turbine = { type: "landmark", family: "structure" }; @@ -298,7 +310,11 @@ describe("restricted access", () => { const point = (properties: Record) => ({ type: 1, properties }) as never; const drawn = (id: string, properties: Record) => - featureFilter(layer(id).filter).filter({ zoom: 16 }, point(properties), undefined as never); + featureFilter(layer(id).filter, `layers.${id}.filter`).filter( + { zoom: 16 }, + point(properties), + undefined as never, + ); const slipway = { type: "small_craft_facility", category: "slipway" }; @@ -323,7 +339,10 @@ describe("restricted access", () => { expect(drawn("harhours", { type: "small_craft_facility", category: "fishing" })).toBe(false); for (const key of ["icon-opacity", "text-opacity"]) { - const compiled = createExpression(layer("harhours").paint[key]); + const compiled = createExpression( + layer("harhours").paint[key], + `layers.harhours.paint.${key}`, + ); if (compiled.result !== "success") throw new Error(`${key} failed to compile`); const opacity = (access?: string) => compiled.value.evaluate({ zoom: 12 }, point(access ? { access } : {})); @@ -337,7 +356,10 @@ describe("restricted access", () => { describe("fuel dock labels", () => { const layout = (all.find((l) => l.id === "small-craft-facilities") as { layout: never }) .layout as Record; - const compiled = createExpression(layout["text-field"]); + const compiled = createExpression( + layout["text-field"], + "layers.small-craft-facilities.layout.text-field", + ); if (compiled.result !== "success") throw new Error("text-field failed to compile"); const label = (properties: Record) => compiled.value @@ -380,7 +402,7 @@ it("never scales an icon above the sheet's resolution", () => { for (const layer of all) { const size = (layer as { layout?: Record }).layout?.["icon-size"]; if (size === undefined) continue; - const compiled = createExpression(size); + const compiled = createExpression(size, `layers.${layer.id}.layout.icon-size`); if (compiled.result !== "success") throw new Error(`${layer.id}: icon-size failed to compile`); for (let zoom = 0; zoom <= 22; zoom += 0.25) { for (const properties of variants) { diff --git a/style/package.json b/style/package.json index 3b7ea13..caa9b89 100644 --- a/style/package.json +++ b/style/package.json @@ -33,7 +33,7 @@ "test": "vitest run" }, "dependencies": { - "@maplibre/maplibre-gl-style-spec": "^25.0.0", + "@maplibre/maplibre-gl-style-spec": "^26.2.1", "@openwaters/seascape": "^0.3.0", "@versatiles/style": "^5.12.1" },