UNPKG

8.17 kBTypeScriptView Raw
1export var font: Readonly<{
2 __proto__: any;
3 cssAppend: (dir?: string) => void;
4 cssLoaded: (callback: Function) => void;
5 cssLoadedLine: (callback: Function) => void;
6 cssLoadedFill: (callback: Function) => void;
7 symbolSize: (id: number) => number[];
8 symbolLine: (id: number) => string;
9 symbolFill: (id: number) => string;
10 symbolText: (id: number) => string;
11}>;
12export var fsw: Readonly<{
13 __proto__: any;
14 symbolSize: (fsw: string) => number[];
15 symbolLine: (fsw: string) => string;
16 symbolFill: (fsw: string) => string;
17 symbolText: (fsw: string) => string;
18 symbolSvgBody: (fswSym: string) => string;
19 symbolSvg: (fswSym: string) => string;
20 symbolPng: (fswSym: string) => string;
21 symbolNormalize: (fswSym: string) => string;
22 signSvgBody: (fswSign: string) => string;
23 signSvg: (fswSign: string) => string;
24 signPng: (fswSign: string) => string;
25 signNormalize: (fswSign: string) => string;
26 columnSvg: (fswColumn: ColumnSegment[], options: ColumnOptions) => string;
27 columnsSvg: (fswText: string, options: ColumnOptions) => string[];
28 columnPng: (fswColumn: ColumnSegment[], options: ColumnOptions) => string;
29 columnsPng: (fswText: string, options: ColumnOptions) => string[];
30}>;
31export var swu: Readonly<{
32 __proto__: any;
33 symbolSize: (swu: string) => number[];
34 symbolLine: (swu: string) => string;
35 symbolFill: (swu: string) => string;
36 symbolText: (swu: string) => string;
37 symbolSvgBody: (swuSym: string) => string;
38 symbolSvg: (swuSym: string) => string;
39 symbolPng: (swuSym: string) => string;
40 symbolNormalize: (swuSym: string) => string;
41 signSvgBody: (swuSign: string) => string;
42 signSvg: (swuSign: string) => string;
43 signPng: (swuSign: string) => string;
44 signNormalize: (swuSign: string) => string;
45 columnSvg: (swuColumn: ColumnSegment[], options: ColumnOptions) => string;
46 columnsSvg: (swuText: string, options: ColumnOptions) => string[];
47 columnPng: (swuColumn: ColumnSegment[], options: ColumnOptions) => string;
48 columnsPng: (swuText: string, options: ColumnOptions) => string[];
49}>;
50export var __esModule: boolean;
51/**
52 * Object of query elements with regular expression identification.
53 */
54type QueryObject = {
55 /**
56 * - required true for query object
57 */
58 query: boolean;
59 /**
60 * - an object for prefix elements
61 */
62 prefix?: {
63 /**
64 * - true if sorting prefix is required
65 */
66 required: boolean;
67 /**
68 * - array of symbol strings, range arrays, and OR arrays of strings and range arrays
69 */
70 parts?: (string | string[] | (string | string[])[])[];
71 };
72 /**
73 * - array of objects for symbols, ranges, and list of symbols or ranges, with optional coordinates
74 */
75 signbox?: (QuerySignboxSymbol | QuerySignboxRange | QuerySignboxOr)[];
76 /**
77 * - amount that x or y coordinates can vary and find a match, defaults to 20
78 */
79 variance?: number;
80 /**
81 * - boolean value for including style string in matches
82 */
83 style?: boolean;
84};
85type QuerySignboxSymbol = {
86 /**
87 * - a symbol
88 */
89 symbol: string;
90 /**
91 * - an optional coordinate
92 */
93 coord?: number[];
94};
95type QuerySignboxRange = {
96 /**
97 * - an array of two symbols
98 */
99 range: string[];
100 /**
101 * - an optional coordinate
102 */
103 coord?: number[];
104};
105type QuerySignboxOr = {
106 /**
107 * - an array of symbol strings and range arrays
108 */
109 or: (string | string[])[];
110 /**
111 * - an optional coordinate
112 */
113 coord?: number[];
114};
115type ColumnOptions = {
116 /**
117 * - the height of the columns
118 */
119 height?: number;
120 /**
121 * - the widths of the columns
122 */
123 width?: number;
124 /**
125 * - the lane offset for left and right lanes
126 */
127 offset?: number;
128 /**
129 * - amount of padding before and after signs as well as at top, left, and right of columns
130 */
131 pad?: number;
132 /**
133 * - amount of space at bottom of column that is not available
134 */
135 margin?: number;
136 /**
137 * - enables variable width columns
138 */
139 dynamic?: boolean;
140 /**
141 * - background color for columns
142 */
143 background?: string;
144 /**
145 * - an object of style options
146 */
147 style?: StyleObject;
148 /**
149 * - an object of punctuation options
150 */
151 punctuation?: {
152 /**
153 * - enables special spacing for punctuation with no space above and custom space below
154 */
155 spacing?: boolean;
156 /**
157 * - the amount of spacing after a punctuation if punctuation spacing is enabled
158 */
159 pad?: number;
160 /**
161 * - prevents line breaks before punctuation by reducing spacing between signs in a column
162 */
163 pull?: boolean;
164 };
165};
166type ColumnData = ColumnSegment[];
167type ColumnSegment = {
168 /**
169 * - the x position in the column
170 */
171 x: number;
172 /**
173 * - the y position in the column
174 */
175 y: number;
176 /**
177 * - the min x value within the segment
178 */
179 minX: number;
180 /**
181 * - the min y value within the segment
182 */
183 minY: number;
184 /**
185 * - the width of the text segment
186 */
187 width: number;
188 /**
189 * - the height of the text segment
190 */
191 height: number;
192 /**
193 * - Left as -1, Middle as 0, Right as 1
194 */
195 lane: number;
196 /**
197 * - the padding of the text segment affects colored background
198 */
199 padding: number;
200 /**
201 * - "sign" or "symbol"
202 */
203 segment: string;
204 /**
205 * - the text of the sign or symbol with optional style string
206 */
207 text: string;
208 /**
209 * - the zoom size of the segment
210 */
211 zoom: number;
212};
213type SegmentInfo = {
214 /**
215 * - the min x value within the segment
216 */
217 minX: number;
218 /**
219 * - the min y value within the segment
220 */
221 minY: number;
222 /**
223 * - the width of the text segment
224 */
225 width: number;
226 /**
227 * - the height of the text segment
228 */
229 height: number;
230 /**
231 * - Left as -1, Middle as 0, Right as 1
232 */
233 lane: number;
234 /**
235 * - the padding of the text segment affects colored background
236 */
237 padding: number;
238 /**
239 * - "sign" or "symbol"
240 */
241 segment: string;
242 /**
243 * - the zoom size of the segment
244 */
245 zoom: number;
246};
247/**
248 * The elements of a style string
249 */
250type StyleObject = {
251 /**
252 * - boolean to use standardized colors for symbol groups
253 */
254 colorize?: boolean;
255 /**
256 * - integer value for padding around symbol or sign
257 */
258 padding?: number;
259 /**
260 * - css name or hex color for background
261 */
262 background?: string;
263 /**
264 * - array for css name or hex color for line and optional fill
265 */
266 detail?: string[];
267 /**
268 * - decimal value for zoom level
269 */
270 zoom?: number;
271 /**
272 * - custom colors for individual symbols
273 */
274 detailsym?: {
275 /**
276 * - symbol index in sign box
277 */
278 index: number;
279 /**
280 * - array for css name or hex color for line and optional fill
281 */
282 detail: string[];
283 }[];
284 /**
285 * - list of class names separated with spaces used for SVG
286 */
287 classes?: string;
288 /**
289 * - id name used for SVG
290 */
291 id?: string;
292};
293/**
294 * The elements of a symbol string
295 */
296type SymbolObject = {
297 /**
298 * - symbol identifier
299 */
300 symbol?: string;
301 /**
302 * - x,y coordinate
303 */
304 coord?: number[];
305 /**
306 * - style string
307 */
308 style?: string;
309};
310/**
311 * The elements of a sign string
312 */
313type SignObject = {
314 /**
315 * - array of symbols
316 */
317 sequence?: string[];
318 /**
319 * - signbox marker or lane
320 */
321 box?: string;
322 /**
323 * - preprocessed x,y coordinate
324 */
325 max?: number[];
326 /**
327 * - array of symbols with coordinates
328 */
329 spatials?: {
330 symbol: string;
331 coord: number[];
332 }[];
333 /**
334 * - style string
335 */
336 style?: string;
337};