@osm-editor-kit/osm-maplibre 0.1.0-alpha.0

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.
@@ -0,0 +1,4 @@
1
+ export declare const MAP_FOCUS_MUTED_COLOR = "#94a3b8";
2
+ export declare const MAP_FOCUS_MUTED_OPACITY = 0.3;
3
+ export declare function focusCaseColor(matchExpression: unknown, activeColor: unknown, mutedColor?: string): unknown;
4
+ export declare function focusCaseOpacity(matchExpression: unknown, activeOpacity: number, mutedOpacity?: number): unknown;
@@ -0,0 +1,22 @@
1
+ export declare const EARTH_CIRCUMFERENCE = 40075016.686;
2
+ export declare const TILE_SIZE = 512;
3
+ export declare const GERMANY_LAT = 51;
4
+ export declare const PIXEL_SCALE_GERMANY: number;
5
+ export declare function pixelScaleFactorAtLat(latitudeDeg: number): number;
6
+ export declare function metersPerPixel(zoom: number, latitudeDeg: number): number;
7
+ export declare function pixelsFromMeters(meters: number, zoom: number, latitudeDeg: number): number;
8
+ /**
9
+ * Line width in px from a numeric feature property in metres.
10
+ * Optional `extraMeters` expands the line (e.g. hit targets) in ground units so zoom stays top-level.
11
+ */
12
+ export declare function lineWidthFromMeters(property?: string, options?: {
13
+ extraMeters?: number;
14
+ }): readonly unknown[];
15
+ /**
16
+ * Line offset in px from a numeric feature property in metres.
17
+ * Optional `sign` (e.g. left/right ±1) is multiplied inside stop outputs so `zoom`
18
+ * stays the top-level interpolate input — do not wrap this expression in `*`.
19
+ */
20
+ export declare function lineOffsetFromMeters(property?: string, fraction?: number, options?: {
21
+ sign?: unknown;
22
+ }): readonly unknown[];
@@ -0,0 +1,21 @@
1
+ import type { StyleSpecification } from 'maplibre-gl';
2
+ import { appendCustomContentAnchor } from './custom-content-anchor';
3
+ import { patchOpenFreeMapStyle } from './patch-openfreemap-style';
4
+ /** Upstream CDN URL — used to regenerate the checked-in patched style. */
5
+ export declare const OPENFREEMAP_POSITRON_STYLE_URL = "https://tiles.openfreemap.org/styles/positron";
6
+ /** iD-style `imagery_used` label for the default basemap when no ELI overlay is active. */
7
+ export declare const OPENFREEMAP_POSITRON_IMAGERY_USED = "OpenFreeMap Positron";
8
+ /** Patches upstream Positron (null-safe filters + app layer anchor). */
9
+ export declare function buildOpenFreeMapPositronStyle(style: StyleSpecification): StyleSpecification;
10
+ /**
11
+ * Local patched Positron style (no runtime `transformStyle`).
12
+ *
13
+ * TEMPORARY — delete `styles/openfreemap-positron.json`, the fetch script, and
14
+ * `patch-openfreemap-style.ts` once https://github.com/hyperknot/openfreemap/issues/107
15
+ * is live on the CDN with null-safe filters (upstream PR only fixed `boundary_3`:
16
+ * https://github.com/hyperknot/openfreemap-styles/pull/18). Then point the map at
17
+ * `OPENFREEMAP_POSITRON_STYLE_URL` again.
18
+ */
19
+ export declare const OPENFREEMAP_POSITRON_STYLE: StyleSpecification;
20
+ export { appendCustomContentAnchor, patchOpenFreeMapStyle };
21
+ export { MAP_CUSTOM_CONTENT_ANCHOR_LAYER_ID, MAP_CUSTOM_CONTENT_ANCHOR_SOURCE_ID, } from './custom-content-anchor';
@@ -0,0 +1,6 @@
1
+ import type { StyleSpecification } from 'maplibre-gl';
2
+ /**
3
+ * Null-safe numeric filters across Positron layers (`admin_level`, `ref_length`, `rank`, …).
4
+ * Broader than openfreemap-styles#18 (`boundary_3` only) — CDN still ships other unsafe compares.
5
+ */
6
+ export declare function patchOpenFreeMapStyle(style: StyleSpecification): StyleSpecification;
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@osm-editor-kit/osm-maplibre",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "MapLibre helpers for OSM editors: OpenFreeMap Positron style, overlay anchors, and metre-based paint.",
5
+ "license": "MIT",
6
+ "author": "Tobias Jordans",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/osmberlin/street-space-editor.git",
10
+ "directory": "packages/osm-maplibre"
11
+ },
12
+ "type": "module",
13
+ "sideEffects": false,
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "tag": "alpha"
27
+ },
28
+ "scripts": {
29
+ "build": "tsup && rm -f .tsbuildinfo && tsc -p tsconfig.build.json",
30
+ "fetch-openfreemap-style": "bun run scripts/fetch-openfreemap-positron-style.ts",
31
+ "type-check": "tsc --noEmit",
32
+ "test-run": "bun test src/test",
33
+ "prepublishOnly": "bun run build && bun ../../scripts/package-exports-for-publish.ts",
34
+ "postpublish": "bun ../../scripts/package-exports-restore.ts",
35
+ "prepack": "bun ../../scripts/package-exports-for-publish.ts",
36
+ "postpack": "bun ../../scripts/package-exports-restore.ts"
37
+ },
38
+ "dependencies": {
39
+ "maplibre-gl": "^5.7.1"
40
+ },
41
+ "devDependencies": {
42
+ "bun-types": "^1.2.20",
43
+ "tsup": "^8.5.1",
44
+ "typescript": "^7.0.0"
45
+ },
46
+ "publishExports": {
47
+ ".": {
48
+ "types": "./dist/index.d.ts",
49
+ "import": "./dist/index.js"
50
+ },
51
+ "./package.json": "./package.json"
52
+ }
53
+ }