@nika-js/onlymap 0.9.1 → 0.10.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +26 -2
  3. package/dist/{basemap-DL0mk9Bf.js → basemap-9lXclX9H.js} +3882 -3980
  4. package/dist/cartograph/elements/om-frame.d.ts +67 -1
  5. package/dist/cartograph/georef.d.ts +18 -4
  6. package/dist/cartograph/schema.d.ts +11 -0
  7. package/dist/cartograph.js +1480 -1311
  8. package/dist/cartograph.standalone.js +1808 -1615
  9. package/dist/{cityjson-D_V5GY8b.js → cityjson-k-z1r6c0.js} +1 -1
  10. package/dist/{crs-DsDQ4Q4i.js → crs-BzE_KP4M.js} +25 -2
  11. package/dist/{crs-Ciu7Xs7a.js → crs-ChglCB3O.js} +39 -16
  12. package/dist/elements/om-map.d.ts +10 -0
  13. package/dist/{geoparquet-DJxZA0if.js → geoparquet-DFDZDBun.js} +10 -10
  14. package/dist/globe-view-D9wjfL0T.js +104 -0
  15. package/dist/hillshade-C2BQr6pd.js +298 -0
  16. package/dist/{hillshade-shader-n_zManfZ.js → hillshade-shader-DI2uLSNU.js} +15 -10
  17. package/dist/hillshade-shader.d.ts +18 -2
  18. package/dist/hillshade.d.ts +30 -0
  19. package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
  20. package/dist/{index-CvuDsvnk.js → index-4Tvlt0iO.js} +47 -47
  21. package/dist/{index-BjcPjICh.js → index-Bn66l3KG.js} +59 -59
  22. package/dist/index-BuXrMq5D.js +322 -0
  23. package/dist/index-CNRbZHkK.js +459 -0
  24. package/dist/{index-DdTZSuAb.js → index-CkovmN47.js} +106 -106
  25. package/dist/index-CmuOizAF.js +641 -0
  26. package/dist/index-CvT5QHBS.js +65 -0
  27. package/dist/{index-vLXZuog4.js → index-DnVHKI61.js} +1 -1
  28. package/dist/{index-oY3XHIux.js → index-JjyDEqAS.js} +18178 -16943
  29. package/dist/index.d.ts +4 -0
  30. package/dist/layer-registry.d.ts +27 -0
  31. package/dist/{lerc-Bph62dCb.js → lerc-C1mQ_Kqq.js} +1 -1
  32. package/dist/onlymap.standalone.js +48211 -45574
  33. package/dist/onlymapjs.js +77 -74
  34. package/dist/parse-manifest.d.ts +6 -0
  35. package/dist/plane-camera.d.ts +59 -0
  36. package/dist/plane-layers.d.ts +56 -0
  37. package/dist/plane-tiles.d.ts +99 -0
  38. package/dist/plane-tileset.d.ts +31 -0
  39. package/dist/plane-warp.d.ts +91 -0
  40. package/dist/post-process-effect-DfslKPM6.js +197 -0
  41. package/dist/programmatic.d.ts +16 -1
  42. package/dist/projection.d.ts +118 -0
  43. package/dist/{raster-D-eTzCE3.js → raster-D2NzdjZE.js} +4 -4
  44. package/dist/{raster-pipeline-BlOnMPJe.js → raster-pipeline-qnD1icOv.js} +4 -3
  45. package/dist/runtime-core.d.ts +140 -1
  46. package/dist/serialize/clip.d.ts +50 -0
  47. package/dist/serialize/declutter.d.ts +44 -0
  48. package/dist/serialize/emit.d.ts +60 -0
  49. package/dist/serialize/index.d.ts +64 -0
  50. package/dist/serialize/strategy.d.ts +30 -0
  51. package/dist/serialize/style.d.ts +77 -0
  52. package/dist/snapshot.d.ts +46 -0
  53. package/dist/surface-anchor.d.ts +6 -0
  54. package/dist/text-on-path-Dm7vtNqt.js +146 -0
  55. package/dist/text-on-path.d.ts +157 -0
  56. package/dist/transform/buffer.d.ts +63 -0
  57. package/dist/transform/contour.d.ts +37 -0
  58. package/dist/transform/dot-density.d.ts +19 -0
  59. package/dist/transform/field.d.ts +80 -0
  60. package/dist/transform/geometry.d.ts +20 -0
  61. package/dist/transform/index.d.ts +29 -0
  62. package/dist/transform/simplify.d.ts +10 -0
  63. package/dist/transform/smooth.d.ts +12 -0
  64. package/dist/transform-stage.d.ts +92 -0
  65. package/dist/version.d.ts +1 -1
  66. package/dist/{zarr-BGDoEtFb.js → zarr-D5e5agMG.js} +2 -2
  67. package/docs/cartograph.md +12 -4
  68. package/docs/cartography.md +328 -0
  69. package/docs/design/arrows.md +182 -0
  70. package/docs/design/carto-substrate.md +1055 -0
  71. package/docs/design/extensions.md +250 -0
  72. package/llms.txt +2 -1
  73. package/onlymapjs.attributes.json +18 -0
  74. package/onlymapjs.html-data.json +169 -19
  75. package/package.json +1 -1
  76. package/skills/onlymapjs/SKILL.md +6 -2
  77. package/skills/onlymapjs/references/syntax.md +22 -2
  78. package/dist/hillshade-DR3TxO1a.js +0 -186
  79. package/dist/index-DO_w0tqR.js +0 -514
@@ -26,6 +26,8 @@ export declare class OmFrameElement extends CartographElementBase implements Car
26
26
  /** Live-mode state. */
27
27
  private liveMap;
28
28
  private liveCorners;
29
+ /** In-flight live-map CRS resolve, so a render storm does not queue several. */
30
+ private pendingLiveCrs;
29
31
  private mountToken;
30
32
  private mounting;
31
33
  private mountingSource;
@@ -46,8 +48,27 @@ export declare class OmFrameElement extends CartographElementBase implements Car
46
48
  * than caching it correctly.
47
49
  */
48
50
  get georef(): FrameGeoref | null;
51
+ /**
52
+ * Resolve a live map's CRS through the core's lazy proj4, into the same
53
+ * cache the static path uses. Until it lands the frame reports no
54
+ * georeference, which is the existing contract for "a CRS still resolving" —
55
+ * furniture waits rather than being placed through the wrong plane.
56
+ */
57
+ private ensureLiveCrsForward;
49
58
  /** The raster a static frame draws — its first <img> child, if any. */
50
59
  get raster(): HTMLImageElement | null;
60
+ /**
61
+ * The frozen VECTOR picture a static frame draws, if it has one
62
+ * (docs/design/carto-substrate.md §7).
63
+ *
64
+ * Marked rather than found by tag: the locator inset draws its footprint in
65
+ * an `<svg>` of its own, and a bare `:scope > svg` would pick whichever came
66
+ * first in the DOM. Two pictures, one selector, and the bug would be a frame
67
+ * showing its own overview polygon instead of the map.
68
+ */
69
+ get vector(): SVGSVGElement | null;
70
+ /** What a static frame actually shows — vector first, because a frozen sheet that has both was frozen twice and the newer one is the vector. */
71
+ private get staticSource();
51
72
  disconnectedCallback(): void;
52
73
  /**
53
74
  * Bump the generation token so a mount already in flight cannot adopt its
@@ -74,6 +95,15 @@ export declare class OmFrameElement extends CartographElementBase implements Car
74
95
  * raster by the view that was captured, not the one that was authored.
75
96
  */
76
97
  private readonly onLiveViewSettled;
98
+ /**
99
+ * Write this frame's ground scale onto the map it mounts, so millimetre
100
+ * transforms resolve against the sheet they are actually on.
101
+ *
102
+ * Only while the georef is real: a degenerate or still-resolving frame has
103
+ * no scale to state, and writing a wrong one is worse than writing none —
104
+ * the transform would run at a tolerance nobody chose.
105
+ */
106
+ private applyReferenceScale;
77
107
  private updateLiveCorners;
78
108
  private mountLive;
79
109
  private sizeLiveMap;
@@ -107,6 +137,32 @@ export declare class OmFrameElement extends CartographElementBase implements Car
107
137
  * re-renders at the requested resolution through the core.
108
138
  */
109
139
  captureAt(scale: number): Promise<HTMLImageElement | null>;
140
+ /**
141
+ * Freeze this live frame into a static one (docs/design/carto-substrate.md §7).
142
+ *
143
+ * `format: "svg"` stores an inline `<svg>` — editable linework with the
144
+ * raster bands embedded inside it — and `"raster"` stores the `<img>` this
145
+ * has always produced. Either way the frame becomes `mode="static"` placed by
146
+ * the SAME `crs` + `corners` it already reported, because the georef model
147
+ * does not change: a frozen frame is a picture plus four corners, and that
148
+ * was true before vector and stays true after.
149
+ *
150
+ * The corners are read from `this.georef` BEFORE the mode flips. A live
151
+ * frame derives them from its camera, and a static one from the attribute —
152
+ * so reading after the flip would read an attribute that has not been
153
+ * written yet, and the sheet would land at the previous freeze's position.
154
+ *
155
+ * Returns false, and freezes NOTHING, when the frame has no georeference to
156
+ * freeze at. The case that matters is a projected frame whose CRS is still
157
+ * resolving proj4: its corners are not merely unknown, they are about to
158
+ * change, and a sheet placed by them would be placed wrong and look right.
159
+ * Call it again once `ready` has settled.
160
+ */
161
+ freeze(opts?: {
162
+ format?: "raster" | "svg";
163
+ scale?: number;
164
+ effectDpi?: number;
165
+ }): Promise<boolean>;
110
166
  /**
111
167
  * Point this frame's camera at a lon/lat box — the atlas's per-page refit.
112
168
  * Solves for the zoom that fits the box in the frame's own pixel size, in
@@ -115,7 +171,17 @@ export declare class OmFrameElement extends CartographElementBase implements Car
115
171
  * follows from the same source as any authored camera.
116
172
  */
117
173
  fitBounds(bounds: [number, number, number, number]): void;
118
- /** Export hook: capture before the page paints (see render.ts). */
174
+ /**
175
+ * Export hook: capture before the page paints (see render.ts).
176
+ *
177
+ * A live frame re-renders at the target resolution. A frozen VECTOR frame
178
+ * has to be rasterised too — not because it should be, but because the
179
+ * canvas exporter draws pixels, and `drawImage` cannot take an inline
180
+ * `<svg>` element. It is rasterised at the export's own resolution from its
181
+ * own markup, so a 300 dpi plate gets 300 dpi linework rather than an
182
+ * upscaled screen rendering. The PRINT path does not go through here at all
183
+ * — a browser prints inline vector natively, which is the point of §7.
184
+ */
119
185
  prepareCartograph(env: PaintEnv): Promise<void>;
120
186
  /** Export hook: forget the capture, so a failed pre-pass never reuses it. */
121
187
  discardCartograph(): void;
@@ -26,6 +26,20 @@
26
26
  * only reason this module ever awaits anything.
27
27
  */
28
28
  import type { LngLat } from "../geodesy";
29
+ /**
30
+ * THE CRS LAYER NOW LIVES IN THE CORE (`src/projection.ts`).
31
+ *
32
+ * It existed here first, and in `crs.ts` as an inverse-only half, until the
33
+ * plane view and the vector serializer both needed the same thing with a batch
34
+ * path and a local origin. Rather than a third copy, this module keeps its
35
+ * interface — every name below is part of the cartograph's public API — and
36
+ * delegates. `Projection` is a structural superset of `CrsForward` (it adds
37
+ * `units` and `metresPerUnit`), so the two are assignable without adapters.
38
+ *
39
+ * What stays here is the one thing the core has no use for: the UNCLAMPED
40
+ * Mercator a live frame's corners need.
41
+ */
42
+ import { mercatorForward as coreMercatorForward, mercatorInverse as coreMercatorInverse, normalizeCrs as coreNormalizeCrs, utmDef as coreUtmDef } from "../projection";
29
43
  /** A planar coordinate in a CRS (metres for projected CRSs, degrees for geographic). */
30
44
  export type PlaneXY = [number, number];
31
45
  /** Forward/inverse pair for a frame's CRS — the plane the homography is fitted in. */
@@ -34,10 +48,10 @@ export interface CrsForward {
34
48
  forward(lngLat: LngLat): PlaneXY;
35
49
  inverse(xy: PlaneXY): LngLat;
36
50
  }
37
- export declare function mercatorForward([lng, lat]: LngLat): PlaneXY;
38
- export declare function mercatorInverse([x, y]: PlaneXY): LngLat;
51
+ export declare const mercatorForward: typeof coreMercatorForward;
52
+ export declare const mercatorInverse: typeof coreMercatorInverse;
39
53
  /** Normalize "3857" / "epsg:3857" / "EPSG::3857" to "EPSG:3857"; null when unparseable. */
40
- export declare function normalizeCrs(raw: string | null | undefined): string | null;
54
+ export declare const normalizeCrs: typeof coreNormalizeCrs;
41
55
  /** The CRSs this module handles with no proj4 load. */
42
56
  export declare function builtinCrsForward(crs: string | null | undefined): CrsForward | null;
43
57
  /**
@@ -47,7 +61,7 @@ export declare function builtinCrsForward(crs: string | null | undefined): CrsFo
47
61
  */
48
62
  export declare function resolveCrsForward(crs: string | null | undefined, crsDef?: string | null): Promise<CrsForward | null>;
49
63
  /** Formulaic UTM definition — the zones no regional table can enumerate. */
50
- export declare function utmDef(zone: number, hemisphere: "N" | "S"): string | null;
64
+ export declare const utmDef: typeof coreUtmDef;
51
65
  /** Row-major 3×3: [a,b,c, d,e,f, g,h,i] mapping [x,y,1] → [u,v,w]. */
52
66
  export type Mat3 = readonly [number, number, number, number, number, number, number, number, number];
53
67
  /**
@@ -36,3 +36,14 @@ export declare const INERT_RESERVED_CARTOGRAPH_ATTRS: ReadonlyMap<string, string
36
36
  export declare const PLACED_ATTR_NAMES: readonly ["id", "x", "y", "w", "h", "rotation", "z", "locked", "hidden"];
37
37
  export declare const CARTOGRAPH_ELEMENT_ATTRS: Record<string, readonly string[]>;
38
38
  export declare const CARTOGRAPH_TAG_NAMES: readonly string[];
39
+ /**
40
+ * Marks a frozen frame's VECTOR picture — the inline `<svg>` that
41
+ * `snapshot({format: "svg"})` produced (docs/design/carto-substrate.md §7).
42
+ *
43
+ * It lives here rather than on the element because the VALIDATOR needs it too,
44
+ * and the validator must not import an element module: that would pull
45
+ * `defineElement` and its side effects into a pass that only ever reads parsed
46
+ * markup. Marked rather than found by tag name, because the locator inset
47
+ * draws its footprint in an `<svg>` of its own.
48
+ */
49
+ export declare const VECTOR_MARK = "data-om-carto-vector";