drawland 0.0.0-stage → 0.3.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/native.d.ts ADDED
@@ -0,0 +1,119 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
12
+ /** A drawn map. */
13
+ export declare class Map {
14
+ /** The profile's `title(...)`, if it set one. */
15
+ get title(): string | null
16
+ /** The whole map as one layered SVG, in paper millimetres. */
17
+ get svg(): string
18
+ /** The groups in draw order, each a pen, with its stroke count. */
19
+ get groups(): Array<Group>
20
+ /** The sheets when the output is cut (`output.slices`), by name. */
21
+ get slices(): Array<SvgFile>
22
+ /** The files `options` asks for. */
23
+ files(options?: ExportFiles | undefined | null): Array<SvgFile>
24
+ /** Write `path`, and beside it a file per sheet or layer; the paths. */
25
+ save(path: string, options?: ExportFiles | undefined | null): Array<string>
26
+ }
27
+
28
+ export declare class NativeGraph {
29
+ constructor(lat?: number | undefined | null, lng?: number | undefined | null, dir?: string | undefined | null)
30
+ call(name: string, args: string): string
31
+ prop(name: string): string
32
+ get(of: string, part: string): string
33
+ describe(v: string): string
34
+ outputBegin(spec: string): boolean
35
+ outputWarps(done: string): void
36
+ remapGrid(warp: string, n: number): string
37
+ remapMesh(n: number, columns: number, rows: number, points: string, went: string): string
38
+ viewBegin(spec: string): void
39
+ viewEnd(ok: boolean): string
40
+ /**
41
+ * A view drawn in a JavaScript (or TypeScript) style by name, read
42
+ * beside the graph's `dir`.
43
+ */
44
+ viewStyle(spec: string, name: string): string
45
+ /** The graph built, as its JSON. The graph is finished. */
46
+ finish(): string
47
+ }
48
+
49
+ /**
50
+ * The command line, `drawland map …`, on `argv` (without the program's
51
+ * name); the exit code.
52
+ */
53
+ export declare function cli(argv: Array<string>): number
54
+
55
+ /** Draw a profile at a place, off the main thread: a Promise of the map. */
56
+ export declare function draw(options?: DrawOptions | undefined | null): Promise<Map>
57
+
58
+ /** Where and what to draw, and how to download. */
59
+ export interface DrawOptions {
60
+ /** A profile file: a script (`.js`) or a saved graph (`.json`). */
61
+ profile?: string
62
+ /** A script's text, instead of a file. */
63
+ script?: string
64
+ /** The script is TypeScript. */
65
+ typescript?: boolean
66
+ /** A graph's JSON, as `Graph.finish` gives it. */
67
+ graph?: string
68
+ /** Where a `script` reads beside it (datasets, styles its views name). */
69
+ dir?: string
70
+ lat?: number
71
+ lng?: number
72
+ /** Looked up with Nominatim; instead of `lat`/`lng`. */
73
+ address?: string
74
+ /** The response cache (default `cache`). */
75
+ cache?: string
76
+ offline?: boolean
77
+ refresh?: boolean
78
+ /** Paint the progress on stderr, as the command line does. */
79
+ progress?: boolean
80
+ }
81
+
82
+ /** Which files to write. */
83
+ export interface ExportFiles {
84
+ /** One file per top-level layer as well: a file per pen. */
85
+ perLayer?: boolean
86
+ /** `"whole"`, `"slices"` or `"both"` (default), for a cut output. */
87
+ slices?: string
88
+ /** Coordinate decimals, 0 to 6. */
89
+ decimals?: number
90
+ }
91
+
92
+ /** Every function of the library, as a script names it (`areas.union`). */
93
+ export declare function functions(): Array<string>
94
+
95
+ /** The graph a profile builds, as JSON text: no map data is downloaded. */
96
+ export declare function graph(options?: DrawOptions | undefined | null): string
97
+
98
+ export interface Group {
99
+ id: string
100
+ strokes: number
101
+ }
102
+
103
+ /**
104
+ * The library's JavaScript face (`library.js`), the one a profile's
105
+ * interpreter runs: `index.js` builds `Graph` on it.
106
+ */
107
+ export declare const LIBRARY: string
108
+
109
+ /** The built-in postcard's script: the profile drawn when none is given. */
110
+ export declare const POSTCARD: string
111
+
112
+ /** The values a script reads rather than calls (`page.width`). */
113
+ export declare function properties(): Array<string>
114
+
115
+ export interface SvgFile {
116
+ /** `""` the whole map, `"-r1c1"` a sheet, `"-roads"` a layer. */
117
+ suffix: string
118
+ svg: string
119
+ }