@react-x11/components 0.3.0 → 0.5.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.
- package/README.md +131 -4
- package/dist/charts/components.d.ts +3 -1
- package/dist/charts/components.d.ts.map +1 -1
- package/dist/charts/components.js +8 -4
- package/dist/charts/components.js.map +1 -1
- package/dist/charts/node.d.ts +13 -6
- package/dist/charts/node.d.ts.map +1 -1
- package/dist/charts/node.js +75 -24
- package/dist/charts/node.js.map +1 -1
- package/dist/charts/render.d.ts +4 -0
- package/dist/charts/render.d.ts.map +1 -1
- package/dist/charts/render.js +11 -6
- package/dist/charts/render.js.map +1 -1
- package/dist/code-editor/node.d.ts +47 -16
- package/dist/code-editor/node.d.ts.map +1 -1
- package/dist/code-editor/node.js +121 -51
- package/dist/code-editor/node.js.map +1 -1
- package/dist/flow/draw.d.ts +19 -1
- package/dist/flow/draw.d.ts.map +1 -1
- package/dist/flow/draw.js +64 -35
- package/dist/flow/draw.js.map +1 -1
- package/dist/flow/index.d.ts.map +1 -1
- package/dist/flow/index.js +24 -8
- package/dist/flow/index.js.map +1 -1
- package/dist/flow/model.d.ts +4 -2
- package/dist/flow/model.d.ts.map +1 -1
- package/dist/flow/model.js +4 -2
- package/dist/flow/model.js.map +1 -1
- package/dist/flow/node.d.ts +40 -9
- package/dist/flow/node.d.ts.map +1 -1
- package/dist/flow/node.js +142 -53
- package/dist/flow/node.js.map +1 -1
- package/dist/flow/types.d.ts +46 -21
- package/dist/flow/types.d.ts.map +1 -1
- package/dist/formula/index.d.ts +4 -2
- package/dist/formula/index.d.ts.map +1 -1
- package/dist/formula/index.js.map +1 -1
- package/dist/formula/node.d.ts +5 -1
- package/dist/formula/node.d.ts.map +1 -1
- package/dist/formula/node.js +19 -3
- package/dist/formula/node.js.map +1 -1
- package/dist/html/controls.d.ts +4 -1
- package/dist/html/controls.d.ts.map +1 -1
- package/dist/html/controls.js.map +1 -1
- package/dist/html/css/cascade.d.ts +11 -5
- package/dist/html/css/cascade.d.ts.map +1 -1
- package/dist/html/css/cascade.js +18 -8
- package/dist/html/css/cascade.js.map +1 -1
- package/dist/html/css/parse.d.ts +15 -10
- package/dist/html/css/parse.d.ts.map +1 -1
- package/dist/html/css/parse.js +41 -16
- package/dist/html/css/parse.js.map +1 -1
- package/dist/html/css/style.d.ts +3 -0
- package/dist/html/css/style.d.ts.map +1 -1
- package/dist/html/css/style.js +3 -1
- package/dist/html/css/style.js.map +1 -1
- package/dist/html/css/values.d.ts +14 -1
- package/dist/html/css/values.d.ts.map +1 -1
- package/dist/html/css/values.js +11 -8
- package/dist/html/css/values.js.map +1 -1
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +1 -0
- package/dist/html/index.js.map +1 -1
- package/dist/html/layout/boxes.d.ts +12 -5
- package/dist/html/layout/boxes.d.ts.map +1 -1
- package/dist/html/layout/boxes.js +7 -4
- package/dist/html/layout/boxes.js.map +1 -1
- package/dist/html/layout/inline.d.ts.map +1 -1
- package/dist/html/layout/inline.js +22 -1
- package/dist/html/layout/inline.js.map +1 -1
- package/dist/html/node.d.ts +22 -8
- package/dist/html/node.d.ts.map +1 -1
- package/dist/html/node.js +97 -15
- package/dist/html/node.js.map +1 -1
- package/dist/html/paint.d.ts +3 -0
- package/dist/html/paint.d.ts.map +1 -1
- package/dist/html/paint.js +2 -2
- package/dist/html/paint.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/maps/clip.d.ts +43 -0
- package/dist/maps/clip.d.ts.map +1 -0
- package/dist/maps/clip.js +171 -0
- package/dist/maps/clip.js.map +1 -0
- package/dist/maps/gzip.d.ts +15 -0
- package/dist/maps/gzip.d.ts.map +1 -0
- package/dist/maps/gzip.js +56 -0
- package/dist/maps/gzip.js.map +1 -0
- package/dist/maps/index.d.ts +55 -0
- package/dist/maps/index.d.ts.map +1 -0
- package/dist/maps/index.js +141 -0
- package/dist/maps/index.js.map +1 -0
- package/dist/maps/labels.d.ts +123 -0
- package/dist/maps/labels.d.ts.map +1 -0
- package/dist/maps/labels.js +323 -0
- package/dist/maps/labels.js.map +1 -0
- package/dist/maps/mvt.d.ts +244 -0
- package/dist/maps/mvt.d.ts.map +1 -0
- package/dist/maps/mvt.js +820 -0
- package/dist/maps/mvt.js.map +1 -0
- package/dist/maps/node.d.ts +278 -0
- package/dist/maps/node.d.ts.map +1 -0
- package/dist/maps/node.js +1459 -0
- package/dist/maps/node.js.map +1 -0
- package/dist/maps/overlay.d.ts +157 -0
- package/dist/maps/overlay.d.ts.map +1 -0
- package/dist/maps/overlay.js +472 -0
- package/dist/maps/overlay.js.map +1 -0
- package/dist/maps/paint.d.ts +226 -0
- package/dist/maps/paint.d.ts.map +1 -0
- package/dist/maps/paint.js +705 -0
- package/dist/maps/paint.js.map +1 -0
- package/dist/maps/proj.d.ts +281 -0
- package/dist/maps/proj.d.ts.map +1 -0
- package/dist/maps/proj.js +451 -0
- package/dist/maps/proj.js.map +1 -0
- package/dist/maps/sources.d.ts +256 -0
- package/dist/maps/sources.d.ts.map +1 -0
- package/dist/maps/sources.js +210 -0
- package/dist/maps/sources.js.map +1 -0
- package/dist/maps/style.d.ts +141 -0
- package/dist/maps/style.d.ts.map +1 -0
- package/dist/maps/style.js +147 -0
- package/dist/maps/style.js.map +1 -0
- package/dist/maps/styles.d.ts +82 -0
- package/dist/maps/styles.d.ts.map +1 -0
- package/dist/maps/styles.js +898 -0
- package/dist/maps/styles.js.map +1 -0
- package/dist/maps/tiles.d.ts +283 -0
- package/dist/maps/tiles.d.ts.map +1 -0
- package/dist/maps/tiles.js +469 -0
- package/dist/maps/tiles.js.map +1 -0
- package/dist/maps/types.d.ts +244 -0
- package/dist/maps/types.d.ts.map +1 -0
- package/dist/maps/types.js +2 -0
- package/dist/maps/types.js.map +1 -0
- package/dist/qml/containers.d.ts +3 -0
- package/dist/qml/containers.d.ts.map +1 -0
- package/dist/qml/containers.js +331 -0
- package/dist/qml/containers.js.map +1 -0
- package/dist/qml/controls.d.ts +12 -0
- package/dist/qml/controls.d.ts.map +1 -0
- package/dist/qml/controls.js +21 -0
- package/dist/qml/controls.js.map +1 -0
- package/dist/qml/globals.d.ts +6 -0
- package/dist/qml/globals.d.ts.map +1 -0
- package/dist/qml/globals.js +25 -0
- package/dist/qml/globals.js.map +1 -0
- package/dist/qml/index.d.ts +15 -0
- package/dist/qml/index.d.ts.map +1 -0
- package/dist/qml/index.js +25 -0
- package/dist/qml/index.js.map +1 -0
- package/dist/qml/interaction.d.ts +12 -0
- package/dist/qml/interaction.d.ts.map +1 -0
- package/dist/qml/interaction.js +246 -0
- package/dist/qml/interaction.js.map +1 -0
- package/dist/qml/ir.d.ts +106 -0
- package/dist/qml/ir.d.ts.map +1 -0
- package/dist/qml/ir.js +7 -0
- package/dist/qml/ir.js.map +1 -0
- package/dist/qml/layouts.d.ts +3 -0
- package/dist/qml/layouts.d.ts.map +1 -0
- package/dist/qml/layouts.js +122 -0
- package/dist/qml/layouts.js.map +1 -0
- package/dist/qml/models.d.ts +14 -0
- package/dist/qml/models.d.ts.map +1 -0
- package/dist/qml/models.js +80 -0
- package/dist/qml/models.js.map +1 -0
- package/dist/qml/objects.d.ts +228 -0
- package/dist/qml/objects.d.ts.map +1 -0
- package/dist/qml/objects.js +1103 -0
- package/dist/qml/objects.js.map +1 -0
- package/dist/qml/parse.d.ts +10 -0
- package/dist/qml/parse.d.ts.map +1 -0
- package/dist/qml/parse.js +607 -0
- package/dist/qml/parse.js.map +1 -0
- package/dist/qml/qtquick.d.ts +7 -0
- package/dist/qml/qtquick.d.ts.map +1 -0
- package/dist/qml/qtquick.js +347 -0
- package/dist/qml/qtquick.js.map +1 -0
- package/dist/qml/react.d.ts +83 -0
- package/dist/qml/react.d.ts.map +1 -0
- package/dist/qml/react.js +323 -0
- package/dist/qml/react.js.map +1 -0
- package/dist/qml/resolver.d.ts +38 -0
- package/dist/qml/resolver.d.ts.map +1 -0
- package/dist/qml/resolver.js +64 -0
- package/dist/qml/resolver.js.map +1 -0
- package/dist/qml/slots.d.ts +65 -0
- package/dist/qml/slots.d.ts.map +1 -0
- package/dist/qml/slots.js +230 -0
- package/dist/qml/slots.js.map +1 -0
- package/dist/qml/states.d.ts +5 -0
- package/dist/qml/states.d.ts.map +1 -0
- package/dist/qml/states.js +276 -0
- package/dist/qml/states.js.map +1 -0
- package/dist/qml/view-utils.d.ts +42 -0
- package/dist/qml/view-utils.d.ts.map +1 -0
- package/dist/qml/view-utils.js +121 -0
- package/dist/qml/view-utils.js.map +1 -0
- package/dist/reorder/hx.d.ts +18 -0
- package/dist/reorder/hx.d.ts.map +1 -0
- package/dist/reorder/hx.js +10 -0
- package/dist/reorder/hx.js.map +1 -0
- package/dist/reorder/index.d.ts +314 -0
- package/dist/reorder/index.d.ts.map +1 -0
- package/dist/reorder/index.js +1539 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/model.d.ts +107 -0
- package/dist/reorder/model.d.ts.map +1 -0
- package/dist/reorder/model.js +162 -0
- package/dist/reorder/model.js.map +1 -0
- package/dist/richtext/node.d.ts +15 -5
- package/dist/richtext/node.d.ts.map +1 -1
- package/dist/richtext/node.js +40 -11
- package/dist/richtext/node.js.map +1 -1
- package/dist/richtext/runs.d.ts +35 -13
- package/dist/richtext/runs.d.ts.map +1 -1
- package/dist/richtext/runs.js +83 -27
- package/dist/richtext/runs.js.map +1 -1
- package/dist/tabs/hx.d.ts +18 -0
- package/dist/tabs/hx.d.ts.map +1 -0
- package/dist/tabs/hx.js +10 -0
- package/dist/tabs/hx.js.map +1 -0
- package/dist/tabs/index.d.ts +160 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/tabs/index.js +1265 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/terminal/vt/fonts.d.ts +45 -15
- package/dist/terminal/vt/fonts.d.ts.map +1 -1
- package/dist/terminal/vt/fonts.js +89 -19
- package/dist/terminal/vt/fonts.js.map +1 -1
- package/dist/terminal/vt/index.d.ts +1 -1
- package/dist/terminal/vt/index.d.ts.map +1 -1
- package/dist/terminal/vt/index.js +3 -3
- package/dist/terminal/vt/index.js.map +1 -1
- package/dist/terminal/vt/node.d.ts +42 -0
- package/dist/terminal/vt/node.d.ts.map +1 -1
- package/dist/terminal/vt/node.js +95 -11
- package/dist/terminal/vt/node.js.map +1 -1
- package/dist/terminal/vt/pty.d.ts +16 -0
- package/dist/terminal/vt/pty.d.ts.map +1 -1
- package/dist/terminal/vt/pty.js +186 -0
- package/dist/terminal/vt/pty.js.map +1 -1
- package/dist/terminal/vt/renderer.d.ts.map +1 -1
- package/dist/terminal/vt/renderer.js +13 -3
- package/dist/terminal/vt/renderer.js.map +1 -1
- package/package.json +23 -3
- package/src/charts/components.ts +14 -7
- package/src/charts/node.ts +81 -26
- package/src/charts/render.ts +16 -6
- package/src/code-editor/node.ts +147 -53
- package/src/flow/draw.ts +104 -35
- package/src/flow/index.ts +33 -13
- package/src/flow/model.ts +4 -2
- package/src/flow/node.ts +158 -59
- package/src/flow/types.ts +46 -21
- package/src/formula/index.ts +4 -2
- package/src/formula/node.ts +24 -5
- package/src/html/controls.ts +4 -1
- package/src/html/css/cascade.ts +18 -7
- package/src/html/css/parse.ts +46 -21
- package/src/html/css/style.ts +6 -1
- package/src/html/css/values.ts +25 -9
- package/src/html/index.ts +1 -0
- package/src/html/layout/boxes.ts +19 -9
- package/src/html/layout/inline.ts +23 -1
- package/src/html/node.ts +110 -17
- package/src/html/paint.ts +17 -2
- package/src/index.ts +142 -0
- package/src/maps/clip.ts +184 -0
- package/src/maps/gzip.ts +66 -0
- package/src/maps/index.ts +316 -0
- package/src/maps/labels.ts +442 -0
- package/src/maps/mvt.ts +857 -0
- package/src/maps/node.ts +1819 -0
- package/src/maps/overlay.ts +639 -0
- package/src/maps/paint.ts +978 -0
- package/src/maps/proj.ts +641 -0
- package/src/maps/sources.ts +425 -0
- package/src/maps/style.ts +309 -0
- package/src/maps/styles.ts +1040 -0
- package/src/maps/tiles.ts +676 -0
- package/src/maps/types.ts +260 -0
- package/src/qml/containers.tsx +380 -0
- package/src/qml/controls.tsx +47 -0
- package/src/qml/globals.ts +33 -0
- package/src/qml/index.ts +67 -0
- package/src/qml/interaction.tsx +317 -0
- package/src/qml/ir.ts +80 -0
- package/src/qml/layouts.tsx +141 -0
- package/src/qml/models.ts +101 -0
- package/src/qml/objects.ts +1431 -0
- package/src/qml/parse.ts +624 -0
- package/src/qml/qtquick.tsx +413 -0
- package/src/qml/react.tsx +454 -0
- package/src/qml/resolver.ts +99 -0
- package/src/qml/slots.ts +249 -0
- package/src/qml/states.ts +318 -0
- package/src/qml/view-utils.ts +140 -0
- package/src/reorder/hx.ts +31 -0
- package/src/reorder/index.ts +2223 -0
- package/src/reorder/model.ts +232 -0
- package/src/richtext/node.ts +49 -14
- package/src/richtext/runs.ts +115 -30
- package/src/tabs/hx.ts +31 -0
- package/src/tabs/index.ts +1686 -0
- package/src/terminal/vt/fonts.ts +128 -36
- package/src/terminal/vt/index.ts +4 -2
- package/src/terminal/vt/node.ts +105 -12
- package/src/terminal/vt/pty.ts +243 -0
- package/src/terminal/vt/renderer.ts +13 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,mEAAmE;AACnE,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,wEAAwE;AACxE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,eAAe;AACf,uEAAuE;AACvE,uEAAuE;AACvE,iEAAiE;AACjE,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EACL,OAAO,EACP,K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I,EACJ,aAAa,EACb,YAAY;AACZ,sEAAsE;AACtE,oDAAoD;AACpD,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,mEAAmE;AACnE,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,wEAAwE;AACxE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,eAAe;AACf,uEAAuE;AACvE,uEAAuE;AACvE,iEAAiE;AACjE,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EACL,OAAO,EACP,KAAK,EACL,aAAa,GACd,MAAM,qBAAqB,CAAC;AAiB7B,6EAA6E;AAC7E,6EAA6E;AAC7E,4DAA4D;AAC5D,OAAO,EACL,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,iBAAiB;AACjB,4EAA4E;AAC5E,0DAA0D;AAC1D,eAAe,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,OAAO,GACR,MAAM,yBAAyB,CAAC;AAYjC,2EAA2E;AAC3E,2EAA2E;AAC3E,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,KAAK,EACL,KAAK,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EACX,SAAS,EACT,iBAAiB,GAClB,MAAM,mBAA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EACX,QAAQ,GACT,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** The clip window, in the same target pixels the path is built in. */
|
|
2
|
+
export interface ClipRect {
|
|
3
|
+
minX: number;
|
|
4
|
+
minY: number;
|
|
5
|
+
maxX: number;
|
|
6
|
+
maxY: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* How far outside the pane geometry is still kept.
|
|
10
|
+
*
|
|
11
|
+
* Not zero: a line clipped exactly at the edge would have its join and its
|
|
12
|
+
* cap drawn at the boundary rather than outside it, which shows as a blunt
|
|
13
|
+
* end against the pane's edge. A margin wider than any stroke this draws
|
|
14
|
+
* puts those artefacts off-screen, and is still far inside the range that
|
|
15
|
+
* overflows.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CLIP_MARGIN = 256;
|
|
18
|
+
export declare function clipOf(pane: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}, scale: number): ClipRect;
|
|
24
|
+
/**
|
|
25
|
+
* Cohen-Sutherland: the visible piece of one segment, or null.
|
|
26
|
+
*
|
|
27
|
+
* Chosen over Liang-Barsky because the common case here is a segment wholly
|
|
28
|
+
* inside or wholly outside, and both are answered by one `&`/`|` of the two
|
|
29
|
+
* endpoints' codes with no arithmetic at all.
|
|
30
|
+
*/
|
|
31
|
+
export declare function clipSegment(ax: number, ay: number, bx: number, by: number, clip: ClipRect): [number, number, number, number] | null;
|
|
32
|
+
/**
|
|
33
|
+
* Sutherland-Hodgman: a ring clipped to the rectangle, in place of the
|
|
34
|
+
* original.
|
|
35
|
+
*
|
|
36
|
+
* Rings rather than segments, because a fill needs a closed boundary: the
|
|
37
|
+
* part of a polygon that crosses the window has to come back along the
|
|
38
|
+
* window's edge, which segment clipping cannot produce. Winding is
|
|
39
|
+
* preserved, so an interior ring stays an interior ring and the non-zero
|
|
40
|
+
* fill still puts a hole where one belongs.
|
|
41
|
+
*/
|
|
42
|
+
export declare function clipRing(points: readonly number[], clip: ClipRect): number[];
|
|
43
|
+
//# sourceMappingURL=clip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/maps/clip.ts"],"names":[],"mappings":"AAsBA,uEAAuE;AACvE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,wBAAgB,MAAM,CACpB,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC7D,KAAK,EAAE,MAAM,GACZ,QAAQ,CAOV;AAiBD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,QAAQ,GACb,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAoCzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAsD5E"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Clipping geometry to the target, and why anything has to.
|
|
2
|
+
//
|
|
3
|
+
// **Coordinates in this renderer are bounded and the world's are not.**
|
|
4
|
+
// ntk hands a stroke's geometry to XRender as 16.16 fixed point, which
|
|
5
|
+
// overflows a signed 32-bit word at 32,768, and a composite's coordinates
|
|
6
|
+
// are int16. Two things routinely exceed that:
|
|
7
|
+
//
|
|
8
|
+
// - an **overlay**, which is geography: a route's far end stays where it
|
|
9
|
+
// is when the camera zooms into one corner of it, and a world is
|
|
10
|
+
// `512 · 2^zoom` pixels — 134 million at zoom 20;
|
|
11
|
+
// - a **tile drawn past its own depth**, where one source tile is
|
|
12
|
+
// rasterized into each cell of a grid over it, so a tile-wide polygon is
|
|
13
|
+
// `span` tiles wide in the surface's pixels.
|
|
14
|
+
//
|
|
15
|
+
// Both want the same two algorithms, so they live here rather than twice.
|
|
16
|
+
// Cohen-Sutherland for a line, because the common case is a segment wholly
|
|
17
|
+
// inside or wholly outside and both are answered by one `&`/`|` of the
|
|
18
|
+
// endpoints' codes with no arithmetic at all; Sutherland-Hodgman for an
|
|
19
|
+
// area, because a fill needs a closed boundary — the part of a polygon that
|
|
20
|
+
// crosses the window has to come back along the window's edge, which
|
|
21
|
+
// segment clipping cannot produce.
|
|
22
|
+
/**
|
|
23
|
+
* How far outside the pane geometry is still kept.
|
|
24
|
+
*
|
|
25
|
+
* Not zero: a line clipped exactly at the edge would have its join and its
|
|
26
|
+
* cap drawn at the boundary rather than outside it, which shows as a blunt
|
|
27
|
+
* end against the pane's edge. A margin wider than any stroke this draws
|
|
28
|
+
* puts those artefacts off-screen, and is still far inside the range that
|
|
29
|
+
* overflows.
|
|
30
|
+
*/
|
|
31
|
+
export const CLIP_MARGIN = 256;
|
|
32
|
+
export function clipOf(pane, scale) {
|
|
33
|
+
return {
|
|
34
|
+
minX: (pane.x - CLIP_MARGIN) * scale,
|
|
35
|
+
minY: (pane.y - CLIP_MARGIN) * scale,
|
|
36
|
+
maxX: (pane.x + pane.width + CLIP_MARGIN) * scale,
|
|
37
|
+
maxY: (pane.y + pane.height + CLIP_MARGIN) * scale,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const INSIDE = 0;
|
|
41
|
+
const LEFT = 1;
|
|
42
|
+
const RIGHT = 2;
|
|
43
|
+
const BOTTOM = 4;
|
|
44
|
+
const TOP = 8;
|
|
45
|
+
function outcode(x, y, clip) {
|
|
46
|
+
let code = INSIDE;
|
|
47
|
+
if (x < clip.minX)
|
|
48
|
+
code |= LEFT;
|
|
49
|
+
else if (x > clip.maxX)
|
|
50
|
+
code |= RIGHT;
|
|
51
|
+
if (y < clip.minY)
|
|
52
|
+
code |= BOTTOM;
|
|
53
|
+
else if (y > clip.maxY)
|
|
54
|
+
code |= TOP;
|
|
55
|
+
return code;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Cohen-Sutherland: the visible piece of one segment, or null.
|
|
59
|
+
*
|
|
60
|
+
* Chosen over Liang-Barsky because the common case here is a segment wholly
|
|
61
|
+
* inside or wholly outside, and both are answered by one `&`/`|` of the two
|
|
62
|
+
* endpoints' codes with no arithmetic at all.
|
|
63
|
+
*/
|
|
64
|
+
export function clipSegment(ax, ay, bx, by, clip) {
|
|
65
|
+
let x0 = ax;
|
|
66
|
+
let y0 = ay;
|
|
67
|
+
let x1 = bx;
|
|
68
|
+
let y1 = by;
|
|
69
|
+
let code0 = outcode(x0, y0, clip);
|
|
70
|
+
let code1 = outcode(x1, y1, clip);
|
|
71
|
+
for (;;) {
|
|
72
|
+
if ((code0 | code1) === 0)
|
|
73
|
+
return [x0, y0, x1, y1]; // both inside
|
|
74
|
+
if ((code0 & code1) !== 0)
|
|
75
|
+
return null; // both beyond one edge
|
|
76
|
+
const code = code0 !== 0 ? code0 : code1;
|
|
77
|
+
let x = 0;
|
|
78
|
+
let y = 0;
|
|
79
|
+
if (code & TOP) {
|
|
80
|
+
x = x0 + ((x1 - x0) * (clip.maxY - y0)) / (y1 - y0);
|
|
81
|
+
y = clip.maxY;
|
|
82
|
+
}
|
|
83
|
+
else if (code & BOTTOM) {
|
|
84
|
+
x = x0 + ((x1 - x0) * (clip.minY - y0)) / (y1 - y0);
|
|
85
|
+
y = clip.minY;
|
|
86
|
+
}
|
|
87
|
+
else if (code & RIGHT) {
|
|
88
|
+
y = y0 + ((y1 - y0) * (clip.maxX - x0)) / (x1 - x0);
|
|
89
|
+
x = clip.maxX;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
y = y0 + ((y1 - y0) * (clip.minX - x0)) / (x1 - x0);
|
|
93
|
+
x = clip.minX;
|
|
94
|
+
}
|
|
95
|
+
if (code === code0) {
|
|
96
|
+
x0 = x;
|
|
97
|
+
y0 = y;
|
|
98
|
+
code0 = outcode(x0, y0, clip);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
x1 = x;
|
|
102
|
+
y1 = y;
|
|
103
|
+
code1 = outcode(x1, y1, clip);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Sutherland-Hodgman: a ring clipped to the rectangle, in place of the
|
|
109
|
+
* original.
|
|
110
|
+
*
|
|
111
|
+
* Rings rather than segments, because a fill needs a closed boundary: the
|
|
112
|
+
* part of a polygon that crosses the window has to come back along the
|
|
113
|
+
* window's edge, which segment clipping cannot produce. Winding is
|
|
114
|
+
* preserved, so an interior ring stays an interior ring and the non-zero
|
|
115
|
+
* fill still puts a hole where one belongs.
|
|
116
|
+
*/
|
|
117
|
+
export function clipRing(points, clip) {
|
|
118
|
+
let output = [...points];
|
|
119
|
+
const edges = [
|
|
120
|
+
[
|
|
121
|
+
(x) => x >= clip.minX,
|
|
122
|
+
(ax, ay, bx, by) => [
|
|
123
|
+
clip.minX,
|
|
124
|
+
ay + ((by - ay) * (clip.minX - ax)) / (bx - ax),
|
|
125
|
+
],
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
(x) => x <= clip.maxX,
|
|
129
|
+
(ax, ay, bx, by) => [
|
|
130
|
+
clip.maxX,
|
|
131
|
+
ay + ((by - ay) * (clip.maxX - ax)) / (bx - ax),
|
|
132
|
+
],
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
(_x, y) => y >= clip.minY,
|
|
136
|
+
(ax, ay, bx, by) => [
|
|
137
|
+
ax + ((bx - ax) * (clip.minY - ay)) / (by - ay),
|
|
138
|
+
clip.minY,
|
|
139
|
+
],
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
(_x, y) => y <= clip.maxY,
|
|
143
|
+
(ax, ay, bx, by) => [
|
|
144
|
+
ax + ((bx - ax) * (clip.maxY - ay)) / (by - ay),
|
|
145
|
+
clip.maxY,
|
|
146
|
+
],
|
|
147
|
+
],
|
|
148
|
+
];
|
|
149
|
+
for (const [inside, intersect] of edges) {
|
|
150
|
+
const input = output;
|
|
151
|
+
output = [];
|
|
152
|
+
if (input.length < 6)
|
|
153
|
+
return [];
|
|
154
|
+
for (let i = 0; i < input.length; i += 2) {
|
|
155
|
+
const ax = input[i];
|
|
156
|
+
const ay = input[i + 1];
|
|
157
|
+
const bx = input[(i + 2) % input.length];
|
|
158
|
+
const by = input[(i + 3) % input.length];
|
|
159
|
+
const aIn = inside(ax, ay);
|
|
160
|
+
const bIn = inside(bx, by);
|
|
161
|
+
if (aIn)
|
|
162
|
+
output.push(ax, ay);
|
|
163
|
+
if (aIn !== bIn) {
|
|
164
|
+
const [ix, iy] = intersect(ax, ay, bx, by);
|
|
165
|
+
output.push(ix, iy);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return output;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=clip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/maps/clip.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,0EAA0E;AAC1E,+CAA+C;AAC/C,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,qDAAqD;AACrD,mEAAmE;AACnE,4EAA4E;AAC5E,gDAAgD;AAChD,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,wEAAwE;AACxE,4EAA4E;AAC5E,qE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AC;YAAE,OAAO,EAAE,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACpB,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACxB,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC3B,IAAI,GAAG;gBAAE,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC7B,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;gBAChB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The two bytes every gzip member starts with. */
|
|
2
|
+
export declare function isGzip(bytes: Uint8Array): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Teach this package how to un-gzip, for a runtime where it cannot find out
|
|
5
|
+
* by itself.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { gunzipSync } from 'node:zlib';
|
|
9
|
+
* setGunzip((data) => gunzipSync(data));
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function setGunzip(gunzipSync: (data: Uint8Array) => Uint8Array): void;
|
|
13
|
+
/** The bytes, un-gzipped if they were. */
|
|
14
|
+
export declare function gunzipIfNeeded(bytes: Uint8Array): Uint8Array;
|
|
15
|
+
//# sourceMappingURL=gzip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/maps/gzip.ts"],"names":[],"mappings":"AAiBA,mDAAmD;AACnD,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAEjD;AAQD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,GAAG,IAAI,CAE5E;AAeD,0CAA0C;AAC1C,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAU5D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Un-gzip a tile body, when it is one.
|
|
2
|
+
//
|
|
3
|
+
// Tile servers serve `Content-Encoding: gzip` — which a `fetch` undoes —
|
|
4
|
+
// and a good number of them *also* store the tile gzipped inside that, so
|
|
5
|
+
// the body an application hands over may still have the magic on it. That
|
|
6
|
+
// is a transport detail rather than the decoder's business, so it is
|
|
7
|
+
// unwrapped once, here, and `parseTile` only ever sees protobuf.
|
|
8
|
+
//
|
|
9
|
+
// `node:zlib` is reached the way `src/embed/host.ts` reaches `child_process`
|
|
10
|
+
// and for the same reason: `tsconfig.build.json` sets `types: []`, so `src/`
|
|
11
|
+
// may not name a Node module, and a package that did would stop resolving
|
|
12
|
+
// on a runtime that has no such module. So the module is found on
|
|
13
|
+
// `globalThis` if the host put it there and otherwise not at all — and a
|
|
14
|
+
// runtime with no zlib gets a clear error naming the one line of
|
|
15
|
+
// application code that fixes it, rather than a protobuf parse failure
|
|
16
|
+
// twenty frames away.
|
|
17
|
+
/** The two bytes every gzip member starts with. */
|
|
18
|
+
export function isGzip(bytes) {
|
|
19
|
+
return bytes.length > 2 && bytes[0] === 0x1f && bytes[1] === 0x8b;
|
|
20
|
+
}
|
|
21
|
+
let zlib;
|
|
22
|
+
/**
|
|
23
|
+
* Teach this package how to un-gzip, for a runtime where it cannot find out
|
|
24
|
+
* by itself.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { gunzipSync } from 'node:zlib';
|
|
28
|
+
* setGunzip((data) => gunzipSync(data));
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function setGunzip(gunzipSync) {
|
|
32
|
+
zlib = { gunzipSync };
|
|
33
|
+
}
|
|
34
|
+
function findZlib() {
|
|
35
|
+
if (zlib !== undefined)
|
|
36
|
+
return zlib;
|
|
37
|
+
// Node and Bun both expose it on `globalThis` under a `require` that a
|
|
38
|
+
// bundler will not follow, which is what keeps this out of a browser
|
|
39
|
+
// bundle. Anything else: no zlib, and `setGunzip` is the way in.
|
|
40
|
+
const g = globalThis;
|
|
41
|
+
const module = g.process?.getBuiltinModule?.('node:zlib');
|
|
42
|
+
zlib = module && typeof module.gunzipSync === 'function' ? module : null;
|
|
43
|
+
return zlib;
|
|
44
|
+
}
|
|
45
|
+
/** The bytes, un-gzipped if they were. */
|
|
46
|
+
export function gunzipIfNeeded(bytes) {
|
|
47
|
+
if (!isGzip(bytes))
|
|
48
|
+
return bytes;
|
|
49
|
+
const found = findZlib();
|
|
50
|
+
if (!found) {
|
|
51
|
+
throw new Error('a gzipped tile arrived and this runtime has no zlib — ' +
|
|
52
|
+
'un-gzip it in your source, or call setGunzip() once at startup');
|
|
53
|
+
}
|
|
54
|
+
return found.gunzipSync(bytes);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=gzip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gzip.js","sourceRoot":"","sources":["../../src/maps/gzip.ts"],"names":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CAAC;IACD,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { ELEMENT, MapViewNode } from './node.js';
|
|
3
|
+
import type { MapProps, MapViewProps } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A map.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const source = osmVectorSource({
|
|
9
|
+
* fetch: async (url, signal) => {
|
|
10
|
+
* const response = await fetch(url, { signal });
|
|
11
|
+
* if (response.status === 404) return null;
|
|
12
|
+
* return new Uint8Array(await response.arrayBuffer());
|
|
13
|
+
* },
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* <Map
|
|
17
|
+
* sources={[source]}
|
|
18
|
+
* defaultCamera={{ center: { lon: -0.1281, lat: 51.508 }, zoom: 13 }}
|
|
19
|
+
* markers={[{ id: 'home', position: { lon: -0.1281, lat: 51.508 } }]}
|
|
20
|
+
* onMarkerClick={(marker) => select(marker.id)}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Pass `camera` and `onCameraChange` instead of `defaultCamera` for the
|
|
25
|
+
* controlled form, where the application owns where the map is looking.
|
|
26
|
+
*/
|
|
27
|
+
export declare function Map(props: MapProps): ReactElement;
|
|
28
|
+
/** The host element name, for an application that would rather write
|
|
29
|
+
* `<mapview>`. The raw element is the whole component minus the
|
|
30
|
+
* controlled/uncontrolled fork and the box around it. */
|
|
31
|
+
export { ELEMENT as MAPVIEW_ELEMENT, MapViewNode };
|
|
32
|
+
export { DEFAULT_TILE_SIZE, EARTH_CIRCUMFERENCE, EARTH_RADIUS, MAX_LATITUDE, boundsOf, cameraForBounds, dataTileFor, distanceMetres, latFromMercatorY, lonFromMercatorX, mercatorScale, mercatorXFromLon, mercatorYFromLat, metresPerPixel, parentTile, project, projectLngLat, projectPoint, rasterFor, sourceZoomFor, subTileOf, tileBounds, tileContains, tileCountAt, tileCover, tileKey, tileOf, tileTransform, transformFor, unproject, unprojectPoint, visibleBounds, worldSize, zoomOffsetFor, wrapLon, wrapTileX, } from './proj.js';
|
|
33
|
+
export { OSM_ATTRIBUTION, OSM_RASTER_URL, OSM_VECTOR_URL, googleTileSource, osmRasterSource, osmVectorSource, parseVectorTile, pyramidOf, tileUrl, } from './sources.js';
|
|
34
|
+
export { setGunzip } from './gzip.js';
|
|
35
|
+
export { DARK_PALETTE, LIGHT_PALETTE, openMapTilesStyle, shortbreadStyle, } from './styles.js';
|
|
36
|
+
export { compileFilter, resolveZoomed } from './style.js';
|
|
37
|
+
export { decodePolyline, geoJsonOverlays, markerAt, markerRect, } from './overlay.js';
|
|
38
|
+
export { GeomType, GeometryBuffer, MvtError, parseTile } from './mvt.js';
|
|
39
|
+
export { TileCache } from './tiles.js';
|
|
40
|
+
export type { FitBoundsOptions, MapFrameStats, MapHandle, MapPointerEvent, MapProps, MapViewProps, } from './types.js';
|
|
41
|
+
export type { LngLat, LngLatBounds, MapCamera, MercatorPoint, TileCoverEntry, TileId, TilePyramid, TileRaster, Transform, } from './proj.js';
|
|
42
|
+
export type { GoogleSession, GoogleTileSourceOptions, MapSource, TileData, TileRequest, } from './sources.js';
|
|
43
|
+
export type { MapMarker, MapOverlay, GeoJsonLike } from './overlay.js';
|
|
44
|
+
export type { CircleLayer, FillLayer, LineLayer, MapFilter, MapStyle, MapStyleLayer, SymbolLayer, Zoomed, } from './style.js';
|
|
45
|
+
export type { MapPalette, OpenMapTilesStyleOptions, ShortbreadStyleOptions, } from './styles.js';
|
|
46
|
+
export type { FeatureValue, GeometryData, VectorTile, VectorTileLayer, FeatureCursor, } from './mvt.js';
|
|
47
|
+
export type { CachedTile, TileStatus } from './tiles.js';
|
|
48
|
+
declare module 'react-x11/jsx-runtime' {
|
|
49
|
+
namespace JSX {
|
|
50
|
+
interface IntrinsicElements {
|
|
51
|
+
mapview: MapViewProps;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/maps/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAS1C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAsB,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAIV,QAAQ,EACR,YAAY,EACb,MAAM,YAAY,CAAC;AAoCpB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,YAAY,CAmFjD;AAED;;0DAE0D;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,WAAW,EAAE,CAAC;AAEnD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,aAAa,EACb,YAAY,EACZ,SAAS,EACT,aAAa,EACb,SAAS,EACT,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,aAAa,EACb,YAAY,EACZ,SAAS,EACT,cAAc,EACd,aAAa,EACb,SAAS,EACT,aAAa,EACb,OAAO,EACP,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,SAAS,EACT,OAAO,GACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,aAAa,EACb,iBAAi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
|
+
// `<Map>` — a 2D map: vector tiles the application supplies, drawn, panned,
|
|
2
|
+
// zoomed, with markers and overlays on top.
|
|
3
|
+
//
|
|
4
|
+
// The surface is deliberately close to Leaflet's and MapLibre's, because a
|
|
5
|
+
// map's API is a solved problem and an application that has described a
|
|
6
|
+
// camera, a marker and a tile source for one of those should not have to
|
|
7
|
+
// describe them again. What differs is the one thing that could not be
|
|
8
|
+
// carried over: nothing here fetches. A source is a function the
|
|
9
|
+
// application supplies, for the reason `src/html/`'s `onResource` is — see
|
|
10
|
+
// `./sources.ts`.
|
|
11
|
+
//
|
|
12
|
+
// **Registration happens when this module is evaluated**, which is the
|
|
13
|
+
// design and not a shortcut: nothing in the package registers anything
|
|
14
|
+
// until an application imports the component that needs it, so
|
|
15
|
+
// `sideEffects: false` stays honest. Do not move it into `../index.ts`
|
|
16
|
+
// (AGENTS.md, "Tree-shaking is a constraint").
|
|
17
|
+
import React, { useImperativeHandle, useRef } from 'react';
|
|
18
|
+
import { registerElement, registeredElements } from 'react-x11/host';
|
|
19
|
+
import { createStyles, flattenStyle } from 'react-x11/style';
|
|
20
|
+
import { ELEMENT, MapViewNode, SELF_DAMAGED_PROPS } from './node.js';
|
|
21
|
+
if (!registeredElements().includes(ELEMENT)) {
|
|
22
|
+
registerElement(ELEMENT, {
|
|
23
|
+
create: (props, app) => new MapViewNode(props, app),
|
|
24
|
+
// No `semanticNames`: not one of this element's prop names is also a
|
|
25
|
+
// style name — `center`, `zoom`, `sources` and `markers` are all clear,
|
|
26
|
+
// and the map style is `mapStyle` precisely so that `style` stays
|
|
27
|
+
// react-x11's. `test/maps.test.ts` is what keeps that true, because the
|
|
28
|
+
// failure it guards against (throws in development, works in
|
|
29
|
+
// production) is the worst shape a bug can have.
|
|
30
|
+
childrenAllowed: false,
|
|
31
|
+
// The commit claim: changes to these damage nothing by name — the
|
|
32
|
+
// element's own `applyProps` diffs them into the boxes that actually
|
|
33
|
+
// changed (react-x11#301). Without this, every pan step's new `camera`
|
|
34
|
+
// and every moved marker would repaint the whole pane.
|
|
35
|
+
selfDamagedProps: [...SELF_DAMAGED_PROPS],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `pane` is the default for the box `<Map>` renders: it fills its parent —
|
|
40
|
+
* unless the application's own style gives it a height or a `flexGrow`, in
|
|
41
|
+
* which case adding one would silently override what it asked for.
|
|
42
|
+
* Checked against the *flattened* style, so an array works too.
|
|
43
|
+
*/
|
|
44
|
+
const styles = createStyles({
|
|
45
|
+
pane: { flexGrow: 1, overflow: 'hidden' },
|
|
46
|
+
clip: { overflow: 'hidden' },
|
|
47
|
+
fill: { flexGrow: 1 },
|
|
48
|
+
});
|
|
49
|
+
const DEFAULT_CAMERA = { center: { lon: 0, lat: 20 }, zoom: 2 };
|
|
50
|
+
/**
|
|
51
|
+
* A map.
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const source = osmVectorSource({
|
|
55
|
+
* fetch: async (url, signal) => {
|
|
56
|
+
* const response = await fetch(url, { signal });
|
|
57
|
+
* if (response.status === 404) return null;
|
|
58
|
+
* return new Uint8Array(await response.arrayBuffer());
|
|
59
|
+
* },
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* <Map
|
|
63
|
+
* sources={[source]}
|
|
64
|
+
* defaultCamera={{ center: { lon: -0.1281, lat: 51.508 }, zoom: 13 }}
|
|
65
|
+
* markers={[{ id: 'home', position: { lon: -0.1281, lat: 51.508 } }]}
|
|
66
|
+
* onMarkerClick={(marker) => select(marker.id)}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* Pass `camera` and `onCameraChange` instead of `defaultCamera` for the
|
|
71
|
+
* controlled form, where the application owns where the map is looking.
|
|
72
|
+
*/
|
|
73
|
+
export function Map(props) {
|
|
74
|
+
const { camera, defaultCamera, onCameraChange, style, children, ref, ...rest } = props;
|
|
75
|
+
const view = useRef(null);
|
|
76
|
+
const controlled = camera !== undefined;
|
|
77
|
+
useImperativeHandle(ref, () => ({
|
|
78
|
+
// Every method reads the node at call time rather than closing over
|
|
79
|
+
// it: the ref attaches after the commit that created the node, and a
|
|
80
|
+
// handle built once must still work for the whole mount.
|
|
81
|
+
getCamera: () => view.current?.getCamera() ?? DEFAULT_CAMERA,
|
|
82
|
+
setCamera: (next) => view.current?.setCamera(next),
|
|
83
|
+
panBy: (dx, dy) => view.current?.panBy(dx, dy),
|
|
84
|
+
zoomIn: (step) => view.current?.zoomIn(step),
|
|
85
|
+
zoomOut: (step) => view.current?.zoomOut(step),
|
|
86
|
+
zoomTo: (zoom) => view.current?.zoomTo(zoom),
|
|
87
|
+
fitBounds: (bounds, options) => view.current?.fitBounds(bounds, options),
|
|
88
|
+
fitMarkers: (ids, options) => view.current?.fitMarkers(ids, options),
|
|
89
|
+
getBounds: () => view.current?.getBounds() ?? {
|
|
90
|
+
west: -180,
|
|
91
|
+
south: -85,
|
|
92
|
+
east: 180,
|
|
93
|
+
north: 85,
|
|
94
|
+
},
|
|
95
|
+
project: (position) => view.current?.project(position) ?? { x: 0, y: 0 },
|
|
96
|
+
unproject: (x, y) => view.current?.unproject(x, y) ?? { lon: 0, lat: 0 },
|
|
97
|
+
markerAt: (x, y) => view.current?.markerAt(x, y) ?? null,
|
|
98
|
+
refresh: () => view.current?.refresh(),
|
|
99
|
+
stats: () => view.current?.stats() ?? null,
|
|
100
|
+
}), []);
|
|
101
|
+
const flat = flattenStyle(style ?? null);
|
|
102
|
+
const sized = flat.height !== undefined ||
|
|
103
|
+
flat.flexGrow !== undefined ||
|
|
104
|
+
flat.flexBasis !== undefined;
|
|
105
|
+
// The pane and anything the application puts over it are siblings rather
|
|
106
|
+
// than parent and children: a registered element's own drawing happens
|
|
107
|
+
// *after* `super.paint` has painted its children, so anything mounted
|
|
108
|
+
// inside would be painted over by the map. Beside it, and after it, a
|
|
109
|
+
// legend or a control panel lands on top. `<Flow>` makes the same
|
|
110
|
+
// arrangement for the same reason.
|
|
111
|
+
return React.createElement('box', { style: sized ? [styles.clip, style] : [styles.pane, style] }, React.createElement(ELEMENT, {
|
|
112
|
+
...rest,
|
|
113
|
+
key: 'pane',
|
|
114
|
+
ref: view,
|
|
115
|
+
// The controlled/uncontrolled fork, and the whole of it. Controlled:
|
|
116
|
+
// the application's camera goes down and the element only ever
|
|
117
|
+
// *asks* to move. Uncontrolled: nothing goes down after the seed, the
|
|
118
|
+
// element owns the camera, and a pan never reaches React — which is
|
|
119
|
+
// the difference between a drag that blits a strip and one that
|
|
120
|
+
// re-renders and re-claims the pane on every pointer step.
|
|
121
|
+
camera: controlled ? camera : undefined,
|
|
122
|
+
defaultCamera: controlled ? undefined : (defaultCamera ?? DEFAULT_CAMERA),
|
|
123
|
+
onCameraChange,
|
|
124
|
+
style: styles.fill,
|
|
125
|
+
role: rest.role ?? 'group',
|
|
126
|
+
'aria-label': rest['aria-label'] ?? 'Map',
|
|
127
|
+
}), children);
|
|
128
|
+
}
|
|
129
|
+
/** The host element name, for an application that would rather write
|
|
130
|
+
* `<mapview>`. The raw element is the whole component minus the
|
|
131
|
+
* controlled/uncontrolled fork and the box around it. */
|
|
132
|
+
export { ELEMENT as MAPVIEW_ELEMENT, MapViewNode };
|
|
133
|
+
export { DEFAULT_TILE_SIZE, EARTH_CIRCUMFERENCE, EARTH_RADIUS, MAX_LATITUDE, boundsOf, cameraForBounds, dataTileFor, distanceMetres, latFromMercatorY, lonFromMercatorX, mercatorScale, mercatorXFromLon, mercatorYFromLat, metresPerPixel, parentTile, project, projectLngLat, projectPoint, rasterFor, sourceZoomFor, subTileOf, tileBounds, tileContains, tileCountAt, tileCover, tileKey, tileOf, tileTransform, transformFor, unproject, unprojectPoint, visibleBounds, worldSize, zoomOffsetFor, wrapLon, wrapTileX, } from './proj.js';
|
|
134
|
+
export { OSM_ATTRIBUTION, OSM_RASTER_URL, OSM_VECTOR_URL, googleTileSource, osmRasterSource, osmVectorSource, parseVectorTile, pyramidOf, tileUrl, } from './sources.js';
|
|
135
|
+
export { setGunzip } from './gzip.js';
|
|
136
|
+
export { DARK_PALETTE, LIGHT_PALETTE, openMapTilesStyle, shortbreadStyle, } from './styles.js';
|
|
137
|
+
export { compileFilter, resolveZoomed } from './style.js';
|
|
138
|
+
export { decodePolyline, geoJsonOverlays, markerAt, markerRect, } from './overlay.js';
|
|
139
|
+
export { GeomType, GeometryBuffer, MvtError, parseTile } from './mvt.js';
|
|
140
|
+
export { TileCache } from './tiles.js';
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/maps/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4CAA4C;AAC5C,EAAE;AACF,2EAA2E;AAC3E,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;AACvE,iEAAiE;AACjE,2EAA2E;AAC3E,kBAAkB;AAClB,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,+DAA+D;AAC/D,uEAAuE;AACvE,+CAA+C;AAC/C,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAO7D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAWrE,IAAI,CAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5C,eAAe,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC;QACnD,qEAAqE;QACrE,wEAAwE;QACxE,kEAAkE;QAClE,wEAAwE;QACxE,6DAA6D;QAC7D,iDAAiD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