@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
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { CompiledFilter, MapStyleLayer } from './style.js';
|
|
2
|
+
import { GeometryBuffer } from './mvt.js';
|
|
3
|
+
import type { VectorTile } from './mvt.js';
|
|
4
|
+
/**
|
|
5
|
+
* The slice of ntk's 2d context this draws through.
|
|
6
|
+
*
|
|
7
|
+
* Structural because react-x11 types `Context2D` as `unknown` on purpose —
|
|
8
|
+
* it is ntk's API rather than react-x11's — so something has to name the
|
|
9
|
+
* operations, and naming them once beats naming them at sixty call sites
|
|
10
|
+
* (the same argument `src/flow/draw.ts` makes).
|
|
11
|
+
*/
|
|
12
|
+
export interface MapCanvas {
|
|
13
|
+
fillStyle: unknown;
|
|
14
|
+
strokeStyle: unknown;
|
|
15
|
+
lineWidth: number;
|
|
16
|
+
lineJoin?: unknown;
|
|
17
|
+
lineCap?: unknown;
|
|
18
|
+
globalAlpha?: number;
|
|
19
|
+
save(): void;
|
|
20
|
+
restore(): void;
|
|
21
|
+
beginPath(): void;
|
|
22
|
+
closePath(): void;
|
|
23
|
+
moveTo(x: number, y: number): void;
|
|
24
|
+
lineTo(x: number, y: number): void;
|
|
25
|
+
rect(x: number, y: number, w: number, h: number): void;
|
|
26
|
+
arc(x: number, y: number, r: number, from: number, to: number): void;
|
|
27
|
+
fill(): void;
|
|
28
|
+
stroke(): void;
|
|
29
|
+
clip(): void;
|
|
30
|
+
fillRect(x: number, y: number, w: number, h: number): void;
|
|
31
|
+
/** One request for many rectangles — what a marker cluster and a
|
|
32
|
+
* scale bar are drawn with. */
|
|
33
|
+
fillRects?(rects: readonly number[]): void;
|
|
34
|
+
setLineDash?(segments: readonly number[]): void;
|
|
35
|
+
roundRect?(x: number, y: number, w: number, h: number, radii: number): void;
|
|
36
|
+
drawImage?(image: unknown, ...args: number[]): void;
|
|
37
|
+
/** Straight RGBA in, for a raster tile the application decoded. */
|
|
38
|
+
putImageData?(data: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
data: Uint8Array;
|
|
42
|
+
}, x: number, y: number): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether a context can draw at all.
|
|
46
|
+
*
|
|
47
|
+
* The mock backend the headless suite runs on has no path API, which is the
|
|
48
|
+
* repo convention for keeping a drawn element testable: the element's paint
|
|
49
|
+
* becomes a no-op there rather than a throw, and everything worth asserting
|
|
50
|
+
* about it — the cover, the projection, the cache, the hit test — is
|
|
51
|
+
* asserted without pixels.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isMapCanvas(ctx: unknown): ctx is MapCanvas;
|
|
54
|
+
/**
|
|
55
|
+
* The clock a rasterization budget is measured on.
|
|
56
|
+
*
|
|
57
|
+
* `performance.now()` rather than `Date.now()`, because a budget is a
|
|
58
|
+
* sub-frame quantity and `Date.now()` counts whole milliseconds: an 8 ms
|
|
59
|
+
* budget measured on it carries 12% of error, and anything under 1 ms
|
|
60
|
+
* rounds to a deadline that has already passed — so `rasterBudgetMs: 0.5`
|
|
61
|
+
* would silently mean "never rasterize", which is not what it says.
|
|
62
|
+
* Reached through `globalThis` because `src/` compiles with `types: []`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function now(): number;
|
|
65
|
+
/** Vertices after which the accumulated path is flushed. Large enough that
|
|
66
|
+
* a whole ordinary layer is one path, small enough that the 130,000-vertex
|
|
67
|
+
* outlier is a few rather than one enormous request. */
|
|
68
|
+
export declare const BATCH_VERTICES = 12000;
|
|
69
|
+
/**
|
|
70
|
+
* How a tile's own integer coordinates reach the target.
|
|
71
|
+
*
|
|
72
|
+
* `ox`/`oy`/`span` place the tile: its local `0` lands at `ox`, and its
|
|
73
|
+
* whole square is `span` target pixels across — so a layer's scale is
|
|
74
|
+
* `span / layer.extent`, computed **per layer**, because extent is a
|
|
75
|
+
* per-layer field and real tiles use that (OSM's Shortbread cuts `streets`,
|
|
76
|
+
* `land`, `ocean` and `water_polygons` at 2048 and its other twenty layers
|
|
77
|
+
* at 4096; a renderer that reads it once per tile draws half of them at
|
|
78
|
+
* twice their size).
|
|
79
|
+
*
|
|
80
|
+
* `pixelsPerLogical` is what a style's lengths are multiplied by. On the
|
|
81
|
+
* direct path it is simply the display scale. On the retained path it is
|
|
82
|
+
* `surfaceSize / tileScreenSize`, which is the display scale divided by
|
|
83
|
+
* whatever the composite is about to multiply by — so a two-logical-pixel
|
|
84
|
+
* road is two logical pixels on screen at every fractional zoom, without
|
|
85
|
+
* the raster being redrawn for any of them.
|
|
86
|
+
*/
|
|
87
|
+
export interface TileDraw {
|
|
88
|
+
ox: number;
|
|
89
|
+
oy: number;
|
|
90
|
+
span: number;
|
|
91
|
+
pixelsPerLogical: number;
|
|
92
|
+
/** The zoom the style is resolved at. */
|
|
93
|
+
zoom: number;
|
|
94
|
+
/** Target pixels below which a vertex is dropped as a duplicate of the
|
|
95
|
+
* one before it. `0` disables decimation. */
|
|
96
|
+
tolerance?: number;
|
|
97
|
+
/** Target pixels below which a whole feature is skipped. */
|
|
98
|
+
minFeature?: number;
|
|
99
|
+
/** Clip rectangle in target coordinates — the direct path's viewport.
|
|
100
|
+
* Null on the retained path, where the surface is the clip. */
|
|
101
|
+
clip?: {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
} | null;
|
|
107
|
+
/**
|
|
108
|
+
* Vertices after which the accumulated path is flushed, if not
|
|
109
|
+
* {@link BATCH_VERTICES}.
|
|
110
|
+
*
|
|
111
|
+
* One number for both backends since react-x11 2.6.1, and it was not
|
|
112
|
+
* before that. On **X11** a fill or stroke becomes an a8 coverage mask
|
|
113
|
+
* over the path's bounding box, uploaded with one `PutImage`, so a bigger
|
|
114
|
+
* path is fewer uploads over the same pixels — the number wants to be
|
|
115
|
+
* large. On the **Cocoa** backend `CGContextStrokePath` used to be
|
|
116
|
+
* quadratic in the number of subpaths, so it wanted the opposite, and
|
|
117
|
+
* `<Map>` probed the backend to pick. Core chunks that stroke itself now
|
|
118
|
+
* (react-x11#457), at a size it can choose and a caller cannot, so
|
|
119
|
+
* batching small there only defeats it.
|
|
120
|
+
*/
|
|
121
|
+
batchVertices?: number;
|
|
122
|
+
}
|
|
123
|
+
/** What a rasterization cost, for the bench and for `onFrame`. */
|
|
124
|
+
export interface DrawStats {
|
|
125
|
+
layers: number;
|
|
126
|
+
features: number;
|
|
127
|
+
/** Vertices that survived decimation and were sent. */
|
|
128
|
+
vertices: number;
|
|
129
|
+
/** Vertices dropped as sub-pixel duplicates. */
|
|
130
|
+
decimated: number;
|
|
131
|
+
/** Features skipped because their whole box was sub-pixel. */
|
|
132
|
+
culled: number;
|
|
133
|
+
/** `fill()` and `stroke()` calls — the request count, near enough. */
|
|
134
|
+
batches: number;
|
|
135
|
+
}
|
|
136
|
+
/** A style layer with its filter already compiled — what a cache holds so
|
|
137
|
+
* the compile happens once per style rather than once per tile. */
|
|
138
|
+
export interface PreparedLayer {
|
|
139
|
+
layer: MapStyleLayer;
|
|
140
|
+
filter: CompiledFilter;
|
|
141
|
+
}
|
|
142
|
+
/** A maximal run of consecutive style layers over one source layer. */
|
|
143
|
+
export interface StyleRun {
|
|
144
|
+
sourceLayer: string;
|
|
145
|
+
/** `[from, to)` into {@link PreparedStyle.layers}. */
|
|
146
|
+
from: number;
|
|
147
|
+
to: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A style with its filters compiled and its runs found — computed once per
|
|
151
|
+
* style, not once per tile.
|
|
152
|
+
*
|
|
153
|
+
* The runs are also the unit of **resumable** rasterization: a tile's own
|
|
154
|
+
* layers are drawn run by run, with a time budget between them, so a
|
|
155
|
+
* hundred-millisecond tile becomes a dozen frames that each stay inside
|
|
156
|
+
* one. See {@link drawTileRun}.
|
|
157
|
+
*/
|
|
158
|
+
export interface PreparedStyle {
|
|
159
|
+
layers: PreparedLayer[];
|
|
160
|
+
runs: StyleRun[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Compile a style once.
|
|
164
|
+
*
|
|
165
|
+
* Runs rather than a global grouping by source layer, because the order a
|
|
166
|
+
* style lists its layers in *is* the cartography — water over landuse,
|
|
167
|
+
* buildings over both — and a grouping would reorder a style that
|
|
168
|
+
* interleaves two sources. A run preserves order exactly and captures the
|
|
169
|
+
* win whenever a style is written the way the casing-then-fill split forces
|
|
170
|
+
* anyway: a road network is fourteen consecutive layers over `streets`.
|
|
171
|
+
*/
|
|
172
|
+
export declare function prepareStyle(style: {
|
|
173
|
+
layers: readonly MapStyleLayer[];
|
|
174
|
+
}): PreparedStyle;
|
|
175
|
+
/**
|
|
176
|
+
* Scratch a caller keeps between tiles, so nothing here allocates per
|
|
177
|
+
* feature or per layer.
|
|
178
|
+
*/
|
|
179
|
+
export declare class DrawScratch {
|
|
180
|
+
buffer: GeometryBuffer;
|
|
181
|
+
/** One clipped ring at a time, reused, so the overzoom path allocates
|
|
182
|
+
* nothing per part either. */
|
|
183
|
+
ring: number[];
|
|
184
|
+
stats: DrawStats;
|
|
185
|
+
private _buckets;
|
|
186
|
+
/** `n` index lists, emptied. Grown to the widest run ever seen and then
|
|
187
|
+
* reused for the life of the element. */
|
|
188
|
+
buckets(n: number): number[][];
|
|
189
|
+
resetStats(): DrawStats;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Draw every layer of the style this tile has data for.
|
|
193
|
+
*
|
|
194
|
+
* The style is walked in **runs of consecutive layers over one source
|
|
195
|
+
* layer**, and each run's features are seeked once for the whole run. That
|
|
196
|
+
* is worth stating plainly because it is the difference between a fast
|
|
197
|
+
* zoom-12 tile and a slow one: a road network is fourteen style layers over
|
|
198
|
+
* `streets` (seven classes, and a casing pass before the fill pass so that
|
|
199
|
+
* junctions knit), so a layer-at-a-time walk parses each of eight thousand
|
|
200
|
+
* features' headers and tags fourteen times over. A run parses them once
|
|
201
|
+
* and asks fourteen already-compiled filters about them.
|
|
202
|
+
*
|
|
203
|
+
* Runs rather than a global grouping by source layer, because the order a
|
|
204
|
+
* style lists its layers in *is* the cartography — water over landuse,
|
|
205
|
+
* buildings over both — and a grouping would reorder a style that
|
|
206
|
+
* interleaves. A run preserves order exactly and captures the win whenever
|
|
207
|
+
* a style is written the way the casing/fill split forces anyway.
|
|
208
|
+
*/
|
|
209
|
+
export declare function drawTileLayers(ctx: MapCanvas, tile: VectorTile, prepared: PreparedStyle, draw: TileDraw, scratch: DrawScratch): DrawStats;
|
|
210
|
+
/**
|
|
211
|
+
* One run of the style, drawn.
|
|
212
|
+
*
|
|
213
|
+
* The unit a caller budgets in: the node draws runs until its per-frame
|
|
214
|
+
* budget is spent, remembers where it stopped, and comes back next frame.
|
|
215
|
+
* Layers are painted bottom-up, so a tile stopped part-way looks like a map
|
|
216
|
+
* whose upper layers have not arrived — which is what a partly-drawn map
|
|
217
|
+
* should look like — rather than like a hole.
|
|
218
|
+
*/
|
|
219
|
+
export declare function drawTileRun(ctx: MapCanvas, tile: VectorTile, prepared: PreparedStyle, runIndex: number, draw: TileDraw, scratch: DrawScratch, resume?: {
|
|
220
|
+
/** Skip this many of the run's active layers — where a previous frame
|
|
221
|
+
* stopped. */
|
|
222
|
+
fromLayer?: number;
|
|
223
|
+
/** Stop after the layer that crosses this, on {@link now}'s clock. */
|
|
224
|
+
deadline?: number;
|
|
225
|
+
}): number;
|
|
226
|
+
//# sourceMappingURL=paint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../../src/maps/paint.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAU,MAAM,YAAY,CAAC;AAExE,OAAO,EAAY,cAAc,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,UAAU,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,IAAI,IAAI,CAAC;IAClB,SAAS,IAAI,IAAI,CAAC;IAClB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE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