1 |
|
2 |
|
3 | import { EventEmitter } from "events";
|
4 |
|
5 | import Renderer = require("./lib/renderer");
|
6 |
|
7 | declare var stylus: Stylus.Static;
|
8 | export = stylus;
|
9 |
|
10 | declare namespace stylus {
|
11 | interface RenderOptions {
|
12 | globals?: Stylus.Dictionary<any> | undefined;
|
13 | functions?: Stylus.Dictionary<any> | undefined;
|
14 | imports?: string[] | undefined;
|
15 | paths?: string[] | undefined;
|
16 | filename?: string | undefined;
|
17 | Evaluator?: typeof Stylus.Evaluator | undefined;
|
18 | }
|
19 | type RenderCallback = (err: Error, css: string, js: string) => void;
|
20 | }
|
21 |
|
22 | declare namespace Stylus {
|
23 | export interface Static {
|
24 | |
25 |
|
26 |
|
27 | (str: string): Renderer;
|
28 | (str: string, options: stylus.RenderOptions): Renderer;
|
29 |
|
30 | |
31 |
|
32 |
|
33 | version: string;
|
34 |
|
35 | |
36 |
|
37 |
|
38 | nodes: NodeStatic;
|
39 |
|
40 | |
41 |
|
42 |
|
43 | functions: Functions;
|
44 |
|
45 | |
46 |
|
47 |
|
48 | utils: Utils;
|
49 |
|
50 | Visitor: typeof Visitor;
|
51 | Parser: typeof Parser;
|
52 | Evaluator: typeof Evaluator;
|
53 | Compiler: typeof Compiler;
|
54 |
|
55 | |
56 |
|
57 |
|
58 | middleware(dir: string): Middleware;
|
59 | middleware(options: any): Middleware;
|
60 |
|
61 | |
62 |
|
63 |
|
64 | convertCSS(css: string): string;
|
65 |
|
66 | |
67 |
|
68 |
|
69 |
|
70 | render(str: string): string;
|
71 | render(str: string, options: stylus.RenderOptions): string;
|
72 | render(str: string, callback: stylus.RenderCallback): void;
|
73 | render(str: string, options: stylus.RenderOptions, callback: stylus.RenderCallback): void;
|
74 |
|
75 | |
76 |
|
77 |
|
78 | url: UrlFunction;
|
79 |
|
80 | |
81 |
|
82 |
|
83 | resolver(options: any): LiteralFunction;
|
84 | }
|
85 |
|
86 |
|
87 |
|
88 | export interface NodeStatic {
|
89 | Node: typeof Nodes.Node;
|
90 | Root: typeof Nodes.Root;
|
91 | Null: typeof Nodes.Null;
|
92 | Each: typeof Nodes.Each;
|
93 | If: typeof Nodes.If;
|
94 | Call: typeof Nodes.Call;
|
95 | UnaryOp: typeof Nodes.UnaryOp;
|
96 | BinOp: typeof Nodes.BinOp;
|
97 | Ternary: typeof Nodes.Ternary;
|
98 | Block: typeof Nodes.Block;
|
99 | Unit: typeof Nodes.Unit;
|
100 | String: typeof Nodes.String;
|
101 | HSLA: typeof Nodes.HSLA;
|
102 | RGBA: typeof Nodes.RGBA;
|
103 | Ident: typeof Nodes.Ident;
|
104 | Group: typeof Nodes.Group;
|
105 | Literal: typeof Nodes.Literal;
|
106 | Boolean: typeof Nodes.Boolean;
|
107 | Return: typeof Nodes.Return;
|
108 | Media: typeof Nodes.Media;
|
109 | QueryList: typeof Nodes.QueryList;
|
110 | Query: typeof Nodes.Query;
|
111 | QueryExpr: typeof Nodes.QueryExpr;
|
112 | Params: typeof Nodes.Params;
|
113 | Comment: typeof Nodes.Comment;
|
114 | Keyframes: typeof Nodes.Keyframes;
|
115 | Member: typeof Nodes.Member;
|
116 | Charset: typeof Nodes.Charset;
|
117 | Namespace: typeof Nodes.Namespace;
|
118 | Import: typeof Nodes.Import;
|
119 | Extend: typeof Nodes.Extend;
|
120 | Object: typeof Nodes.Object;
|
121 | Function: typeof Nodes.Function;
|
122 | Property: typeof Nodes.Property;
|
123 | Selector: typeof Nodes.Selector;
|
124 | Expression: typeof Nodes.Expression;
|
125 | Arguments: typeof Nodes.Arguments;
|
126 | Atblock: typeof Nodes.Atblock;
|
127 | Atrule: typeof Nodes.Atrule;
|
128 |
|
129 | true: Nodes.Boolean;
|
130 | false: Nodes.Boolean;
|
131 | null: Nodes.Null;
|
132 | }
|
133 |
|
134 | export interface Functions {
|
135 | |
136 |
|
137 |
|
138 |
|
139 | hsla(rgba: Nodes.RGBA): Nodes.HSLA;
|
140 | hsla(hsla: Nodes.HSLA): Nodes.HSLA;
|
141 | hsla(hue: Nodes.Unit, saturation: Nodes.Unit, lightness: Nodes.Unit, alpha: Nodes.Unit): Nodes.HSLA;
|
142 |
|
143 | |
144 |
|
145 |
|
146 |
|
147 | hsl(rgba: Nodes.RGBA): Nodes.HSLA;
|
148 | hsl(hsla: Nodes.HSLA): Nodes.HSLA;
|
149 | hsl(hue: Nodes.Unit, saturation: Nodes.Unit, lightness: Nodes.Unit): Nodes.HSLA;
|
150 |
|
151 | |
152 |
|
153 |
|
154 | type(node: Nodes.Node): string;
|
155 | |
156 |
|
157 |
|
158 | typeof(node: Nodes.Node): string;
|
159 | |
160 |
|
161 |
|
162 | "type-of"(node: Nodes.Node): string;
|
163 |
|
164 | |
165 |
|
166 |
|
167 | component(color: Nodes.RGBA, name: Nodes.String): Nodes.Unit;
|
168 | component(color: Nodes.HSLA, name: Nodes.String): Nodes.Unit;
|
169 |
|
170 | |
171 |
|
172 |
|
173 | basename(path: Nodes.String): string;
|
174 | basename(path: Nodes.String, ext: Nodes.String): string;
|
175 |
|
176 | |
177 |
|
178 |
|
179 | dirname(path: Nodes.String): string;
|
180 |
|
181 | |
182 |
|
183 |
|
184 | extname(path: Nodes.String): string;
|
185 |
|
186 | |
187 |
|
188 |
|
189 | pathjoin(...paths: Nodes.String[]): string;
|
190 |
|
191 | |
192 |
|
193 |
|
194 |
|
195 | red(color: Nodes.RGBA): Nodes.Unit;
|
196 | red(color: Nodes.HSLA): Nodes.Unit;
|
197 | red(color: Nodes.RGBA, value: Nodes.Unit): Nodes.RGBA;
|
198 | red(color: Nodes.HSLA, value: Nodes.Unit): Nodes.RGBA;
|
199 |
|
200 | |
201 |
|
202 |
|
203 |
|
204 | green(color: Nodes.RGBA): Nodes.Unit;
|
205 | green(color: Nodes.HSLA): Nodes.Unit;
|
206 | green(color: Nodes.RGBA, value: Nodes.Unit): Nodes.RGBA;
|
207 | green(color: Nodes.HSLA, value: Nodes.Unit): Nodes.RGBA;
|
208 |
|
209 | |
210 |
|
211 |
|
212 |
|
213 | blue(color: Nodes.RGBA): Nodes.Unit;
|
214 | blue(color: Nodes.HSLA): Nodes.Unit;
|
215 | blue(color: Nodes.RGBA, value: Nodes.Unit): Nodes.RGBA;
|
216 | blue(color: Nodes.HSLA, value: Nodes.Unit): Nodes.RGBA;
|
217 |
|
218 | |
219 |
|
220 |
|
221 |
|
222 | alpha(color: Nodes.RGBA): Nodes.Unit;
|
223 | alpha(color: Nodes.HSLA): Nodes.Unit;
|
224 | alpha(color: Nodes.RGBA, value: Nodes.Unit): Nodes.RGBA;
|
225 | alpha(color: Nodes.HSLA, value: Nodes.Unit): Nodes.RGBA;
|
226 |
|
227 | |
228 |
|
229 |
|
230 |
|
231 | hue(color: Nodes.RGBA): Nodes.Unit;
|
232 | hue(color: Nodes.HSLA): Nodes.Unit;
|
233 | hue(color: Nodes.RGBA, value: Nodes.Unit): Nodes.RGBA;
|
234 | hue(color: Nodes.HSLA, value: Nodes.Unit): Nodes.RGBA;
|
235 |
|
236 | |
237 |
|
238 |
|
239 |
|
240 | saturation(color: Nodes.RGBA): Nodes.Unit;
|
241 | saturation(color: Nodes.HSLA): Nodes.Unit;
|
242 | saturation(color: Nodes.RGBA, value: Nodes.Unit): Nodes.RGBA;
|
243 | saturation(color: Nodes.HSLA, value: Nodes.Unit): Nodes.RGBA;
|
244 |
|
245 | |
246 |
|
247 |
|
248 |
|
249 | lightness(color: Nodes.RGBA): Nodes.Unit;
|
250 | lightness(color: Nodes.HSLA): Nodes.Unit;
|
251 | lightness(color: Nodes.RGBA, value: Nodes.Unit): Nodes.RGBA;
|
252 | lightness(color: Nodes.HSLA, value: Nodes.Unit): Nodes.RGBA;
|
253 |
|
254 | |
255 |
|
256 |
|
257 | rgba(rgba: Nodes.RGBA): Nodes.RGBA;
|
258 | rgba(hsla: Nodes.HSLA): Nodes.RGBA;
|
259 | rgba(hue: Nodes.Unit, saturation: Nodes.Unit, lightness: Nodes.Unit, alpha: Nodes.Unit): Nodes.RGBA;
|
260 |
|
261 | |
262 |
|
263 |
|
264 | rgb(rgba: Nodes.RGBA): Nodes.RGBA;
|
265 | rgb(hsla: Nodes.HSLA): Nodes.RGBA;
|
266 | rgb(hue: Nodes.Unit, saturation: Nodes.Unit, lightness: Nodes.Unit, alpha: Nodes.Unit): Nodes.RGBA;
|
267 |
|
268 | |
269 |
|
270 |
|
271 | blend(top: Nodes.RGBA): Nodes.RGBA;
|
272 | blend(top: Nodes.RGBA, bottom: Nodes.RGBA): Nodes.RGBA;
|
273 | blend(top: Nodes.RGBA, bottom: Nodes.HSLA): Nodes.RGBA;
|
274 | blend(top: Nodes.HSLA): Nodes.RGBA;
|
275 | blend(top: Nodes.HSLA, bottom: Nodes.RGBA): Nodes.RGBA;
|
276 | blend(top: Nodes.HSLA, bottom: Nodes.HSLA): Nodes.RGBA;
|
277 |
|
278 | |
279 |
|
280 |
|
281 |
|
282 | luminosity(rgba: Nodes.RGBA): Nodes.Unit;
|
283 | luminosity(rgba: Nodes.HSLA): Nodes.Unit;
|
284 |
|
285 | |
286 |
|
287 |
|
288 |
|
289 |
|
290 | contrast(top: Nodes.RGBA): Nodes.Object;
|
291 | contrast(top: Nodes.RGBA, bottom: Nodes.RGBA): Nodes.Object;
|
292 | contrast(top: Nodes.RGBA, bottom: Nodes.HSLA): Nodes.Object;
|
293 | contrast(top: Nodes.HSLA): Nodes.Object;
|
294 | contrast(top: Nodes.HSLA, bottom: Nodes.RGBA): Nodes.Object;
|
295 | contrast(top: Nodes.HSLA, bottom: Nodes.HSLA): Nodes.Object;
|
296 |
|
297 | |
298 |
|
299 |
|
300 |
|
301 | transparentify(top: Nodes.RGBA): Nodes.Object;
|
302 | transparentify(top: Nodes.RGBA, bottom: Nodes.RGBA, alpha?: Nodes.Unit): Nodes.Object;
|
303 | transparentify(top: Nodes.RGBA, bottom: Nodes.HSLA, alpha?: Nodes.Unit): Nodes.Object;
|
304 | transparentify(top: Nodes.HSLA): Nodes.Object;
|
305 | transparentify(top: Nodes.HSLA, bottom: Nodes.RGBA, alpha?: Nodes.Unit): Nodes.Object;
|
306 | transparentify(top: Nodes.HSLA, bottom: Nodes.HSLA, alpha?: Nodes.Unit): Nodes.Object;
|
307 |
|
308 | |
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 | json(path: Nodes.String, local: Nodes.Boolean, namePrefix: Nodes.String): any;
|
322 |
|
323 | |
324 |
|
325 |
|
326 | use(plugin: Nodes.String): void;
|
327 | use(plugin: Nodes.String, options: any): void;
|
328 |
|
329 | |
330 |
|
331 |
|
332 | unquote(str: Nodes.String): Nodes.Literal;
|
333 |
|
334 | |
335 |
|
336 |
|
337 | convert(str: Nodes.String): Nodes.Node;
|
338 |
|
339 | |
340 |
|
341 |
|
342 | unit(unit: Nodes.Unit, type: Nodes.String): Nodes.Unit;
|
343 |
|
344 | |
345 |
|
346 |
|
347 | lookup(name: Nodes.String): Nodes.Node;
|
348 |
|
349 | |
350 |
|
351 |
|
352 | define(name: Nodes.String, expr: Nodes.Expression): Nodes.Null;
|
353 | define(name: Nodes.String, expr: Nodes.Expression, global: Nodes.Boolean): Nodes.Null;
|
354 |
|
355 | |
356 |
|
357 |
|
358 | operate(op: Nodes.String, left: Nodes.Node, right: Nodes.Node): Nodes.Node;
|
359 |
|
360 | |
361 |
|
362 |
|
363 | match(pattern: Nodes.String, val: Nodes.String): Nodes.Boolean;
|
364 | match(pattern: Nodes.String, val: Nodes.Ident): Nodes.Boolean;
|
365 |
|
366 | |
367 |
|
368 |
|
369 | substr(val: Nodes.String, start: Nodes.Number, length: Nodes.Number): Nodes.String;
|
370 | substr(val: Nodes.Ident, start: Nodes.Number, length: Nodes.Number): Nodes.Ident;
|
371 |
|
372 | |
373 |
|
374 |
|
375 | replace(pattern: Nodes.String, replacement: Nodes.String, val: Nodes.String): Nodes.String;
|
376 | replace(pattern: Nodes.String, replacement: Nodes.String, val: Nodes.Ident): Nodes.Ident;
|
377 |
|
378 | |
379 |
|
380 |
|
381 | split(pattern: Nodes.String, val: Nodes.String): Nodes.Expression;
|
382 | split(pattern: Nodes.String, val: Nodes.Ident): Nodes.Expression;
|
383 |
|
384 | |
385 |
|
386 |
|
387 | length(expr: Nodes.Expression): Nodes.Unit;
|
388 |
|
389 | |
390 |
|
391 |
|
392 | length(...expr: Nodes.Expression[]): Nodes.Null;
|
393 |
|
394 | |
395 |
|
396 |
|
397 | error(msg: Nodes.String): void;
|
398 |
|
399 | |
400 |
|
401 |
|
402 | warn(msg: Nodes.String): Nodes.Null;
|
403 |
|
404 | |
405 |
|
406 |
|
407 | trace(): Nodes.Null;
|
408 |
|
409 | |
410 |
|
411 |
|
412 | push(expr: Nodes.Expression, ...nodes: Nodes.Node[]): Nodes.Unit;
|
413 |
|
414 | |
415 |
|
416 |
|
417 | pop(expr: Nodes.Expression): Nodes.Node;
|
418 |
|
419 | |
420 |
|
421 |
|
422 | unshift(expr: Nodes.Expression, ...nodes: Nodes.Node[]): Nodes.Unit;
|
423 |
|
424 | |
425 |
|
426 |
|
427 | prepend(expr: Nodes.Expression, ...nodes: Nodes.Node[]): Nodes.Unit;
|
428 |
|
429 | |
430 |
|
431 |
|
432 | shift(expr: Nodes.Expression): Nodes.Node;
|
433 |
|
434 | |
435 |
|
436 |
|
437 | s(fmt: Nodes.String, ...nodes: Nodes.Node[]): Nodes.Literal;
|
438 |
|
439 | |
440 |
|
441 |
|
442 |
|
443 | "base-convert"(num: Nodes.Number, base: Nodes.Number, width: Nodes.Number): Nodes.Literal;
|
444 |
|
445 | |
446 |
|
447 |
|
448 | "opposite-position"(positions: Nodes.Expression): Nodes.Expression;
|
449 |
|
450 | |
451 |
|
452 |
|
453 | "image-size"(img: Nodes.String, ignoreErr: Nodes.Boolean): Nodes.Expression;
|
454 |
|
455 | |
456 |
|
457 |
|
458 | tan(angle: Nodes.Unit): Nodes.Unit;
|
459 |
|
460 | |
461 |
|
462 |
|
463 | math(n: Nodes.Unit, fn: Nodes.String): Nodes.Unit;
|
464 |
|
465 | |
466 |
|
467 |
|
468 | "-math-prop"(prop: Nodes.String): Nodes.Unit;
|
469 |
|
470 | |
471 |
|
472 |
|
473 | adjust(rgba: Nodes.RGBA, prop: Nodes.String, amount: Nodes.Unit): Nodes.RGBA;
|
474 | adjust(hsla: Nodes.HSLA, prop: Nodes.String, amount: Nodes.Unit): Nodes.RGBA;
|
475 |
|
476 | |
477 |
|
478 |
|
479 | clone(expr: Nodes.Expression): Nodes.Expression;
|
480 |
|
481 | |
482 |
|
483 |
|
484 | "add-property"(name: Nodes.String, expr: Nodes.Expression): Nodes.Property;
|
485 |
|
486 | |
487 |
|
488 |
|
489 | merge(dest: Nodes.Object, ...objs: Nodes.Object[]): Nodes.Object;
|
490 |
|
491 | |
492 |
|
493 |
|
494 | extend(dest: Nodes.Object, ...objs: Nodes.Object[]): Nodes.Object;
|
495 |
|
496 | |
497 |
|
498 |
|
499 | selector(): string;
|
500 | selector(sel: Nodes.String): string;
|
501 |
|
502 | |
503 |
|
504 |
|
505 | "-prefix-classes"(prefix: Nodes.String, block: Nodes.Block): Nodes.Block;
|
506 |
|
507 | |
508 |
|
509 |
|
510 | "current-media"(): Nodes.String;
|
511 |
|
512 | |
513 |
|
514 |
|
515 | "list-separator"(list: Nodes.Expression): Nodes.String;
|
516 | }
|
517 |
|
518 | export interface Utils {
|
519 | |
520 |
|
521 |
|
522 | absolute(path: string): boolean;
|
523 |
|
524 | |
525 |
|
526 |
|
527 |
|
528 | lookup(path: string, paths: string, ignore: string, resolveURL: boolean): string;
|
529 |
|
530 | |
531 |
|
532 |
|
533 |
|
534 | lookupIndex(path: string, paths: string, filename: string): string[];
|
535 |
|
536 | |
537 |
|
538 |
|
539 | find(path: string, paths: string, ignore: string): string[];
|
540 |
|
541 | |
542 |
|
543 |
|
544 | formatException(err: Error, options: ExceptionOptions): Error;
|
545 |
|
546 | |
547 |
|
548 |
|
549 | assertType(node: Nodes.Node, type: string, param: string): void;
|
550 |
|
551 | |
552 |
|
553 |
|
554 | assertString(node: Nodes.Node, param: string): void;
|
555 |
|
556 | |
557 |
|
558 |
|
559 | assertColor(node: Nodes.Node, param: string): void;
|
560 |
|
561 | |
562 |
|
563 |
|
564 | assertPresent(node: Nodes.Node, name: string): void;
|
565 |
|
566 | |
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | unwrap(expr: Nodes.Expression): Nodes.Node;
|
573 |
|
574 | |
575 |
|
576 |
|
577 | coerce(val: any): Nodes.Node;
|
578 | coerce(val: any, raw: boolean): Nodes.Node;
|
579 |
|
580 | |
581 |
|
582 |
|
583 | coerceArray(val: any): Nodes.Expression;
|
584 | coerceArray(val: any, raw: boolean): Nodes.Expression;
|
585 |
|
586 | |
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 | coerceObject(obj: any): Nodes.Expression;
|
594 | coerceObject(obj: any, raw: boolean): Nodes.Expression;
|
595 |
|
596 | |
597 |
|
598 |
|
599 | params(fn: (...args: any[]) => any): string[];
|
600 |
|
601 | |
602 |
|
603 |
|
604 | merge(a: any, b: any): any;
|
605 |
|
606 | |
607 |
|
608 |
|
609 | uniq(arr: any[]): any[];
|
610 |
|
611 | |
612 |
|
613 |
|
614 |
|
615 |
|
616 | compileSelectors(arr: string[], leaveHidden: boolean): string[];
|
617 | }
|
618 |
|
619 | export interface UrlFunction {
|
620 | (options?: UrlOptions): LiteralFunction;
|
621 |
|
622 | mimes: {
|
623 | ".gif": string;
|
624 | ".png": string;
|
625 | ".jpg": string;
|
626 | ".jpeg": string;
|
627 | ".svg": string;
|
628 | ".ttf": string;
|
629 | ".eot": string;
|
630 | ".woff": string;
|
631 | };
|
632 | }
|
633 |
|
634 | export type Middleware = (req: any, res: any, next: (...args: any[]) => any) => void;
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 | export class Visitor {
|
641 | }
|
642 |
|
643 | export class Parser {
|
644 | }
|
645 |
|
646 | export class Evaluator {
|
647 | }
|
648 |
|
649 | export class Compiler {
|
650 | }
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | export namespace Nodes {
|
657 | export class Node {
|
658 | lineno: number;
|
659 | column: number;
|
660 | filename: string;
|
661 |
|
662 | first: Node;
|
663 | hash: string;
|
664 | nodeName: string;
|
665 |
|
666 | constructor();
|
667 |
|
668 | /**
|
669 | * Return a clone of this node.
|
670 | */
|
671 | clone(): Node;
|
672 |
|
673 | /**
|
674 | * Return a JSON representation of this node.
|
675 | */
|
676 | toJSON(): { lineno: number; column: number; filename: string };
|
677 |
|
678 | |
679 |
|
680 |
|
681 | eval(): Node;
|
682 |
|
683 | |
684 |
|
685 |
|
686 |
|
687 | toBoolean(): Nodes.Boolean;
|
688 |
|
689 | |
690 |
|
691 |
|
692 | toExpression(): Expression;
|
693 |
|
694 | |
695 |
|
696 |
|
697 | shouldCoerce(op: string): boolean;
|
698 |
|
699 | |
700 |
|
701 |
|
702 | operate(op: string, right: Node): Node;
|
703 |
|
704 | |
705 |
|
706 |
|
707 | coerce(other: Node): Node;
|
708 | }
|
709 |
|
710 | export class Root extends Node {
|
711 | nodes: Node[];
|
712 |
|
713 | |
714 |
|
715 |
|
716 | push(node: Node): void;
|
717 |
|
718 | |
719 |
|
720 |
|
721 | unshift(node: Node): void;
|
722 |
|
723 | |
724 |
|
725 |
|
726 | toJSON(): { nodes: Node[]; lineno: number; column: number; filename: string };
|
727 | }
|
728 |
|
729 | export class String extends Node {
|
730 | val: string;
|
731 | string: string;
|
732 | prefixed: boolean;
|
733 | quote: string;
|
734 |
|
735 | constructor(val: string);
|
736 | constructor(val: string, quote: string);
|
737 |
|
738 | /**
|
739 | * Return a JSON representation of this node.
|
740 | */
|
741 | toJSON(): { val: string; quote: string; lineno: number; column: number; filename: string };
|
742 | }
|
743 |
|
744 | export class Number extends Node {}
|
745 |
|
746 | export class Boolean extends Node {
|
747 | val: boolean;
|
748 | isTrue: boolean;
|
749 | isFalse: boolean;
|
750 |
|
751 | constructor();
|
752 | constructor(val: boolean);
|
753 |
|
754 | /**
|
755 | * Negate the value.
|
756 | */
|
757 | // tslint:disable-next-line no-unnecessary-qualifier
|
758 | negate(): Nodes.Boolean;
|
759 |
|
760 | /**
|
761 | * Return 'Boolean'.
|
762 | */
|
763 | inspect(): string;
|
764 |
|
765 | /**
|
766 | * Return a JSON representation of this node.
|
767 | */
|
768 | toJSON(): { __type: string; val: boolean; lineno: number; column: number; filename: string };
|
769 | }
|
770 |
|
771 | export class Object extends Node {
|
772 | vals: Dictionary<Node>;
|
773 | length: number;
|
774 |
|
775 | constructor();
|
776 |
|
777 | /**
|
778 | * Set `key` to `val`.
|
779 | */
|
780 | set(key: string, value: Node): this;
|
781 |
|
782 | /**
|
783 | * Get `key`.
|
784 | */
|
785 | get(key: string): Node;
|
786 |
|
787 | /**
|
788 | * Has `key`?
|
789 | */
|
790 | has(key: string): boolean;
|
791 |
|
792 | /**
|
793 | * Convert object to string with properties.
|
794 | */
|
795 | toBlock(): string;
|
796 |
|
797 | /**
|
798 | * Return a JSON representation of this node.
|
799 | */
|
800 | toJSON(): { __type: string; vals: Dictionary<Node>; lineno: number; column: number; filename: string };
|
801 | }
|
802 |
|
803 | export class Null extends Node {
|
804 | isNull: boolean;
|
805 |
|
806 | constructor();
|
807 |
|
808 | /**
|
809 | * Return a JSON representation of this node.
|
810 | */
|
811 | toJSON(): { __type: string; lineno: number; column: number; filename: string };
|
812 | }
|
813 |
|
814 | export class Ident extends Node {
|
815 | name: string;
|
816 | string: string;
|
817 | val: Node;
|
818 | mixin: boolean;
|
819 |
|
820 | isEmpty: boolean;
|
821 |
|
822 | constructor(name: string, val: Node);
|
823 | constructor(name: string, val: Node, mixin: boolean);
|
824 |
|
825 | /**
|
826 | * Return a JSON representation of this node.
|
827 | */
|
828 | toJSON(): {
|
829 | __type: string;
|
830 | name: string;
|
831 | val: Node;
|
832 | mixin: boolean;
|
833 | lineno: number;
|
834 | column: number;
|
835 | filename: string;
|
836 | };
|
837 | }
|
838 |
|
839 | export class Literal extends Node {
|
840 | val: string;
|
841 | string: string;
|
842 | prefixed: boolean;
|
843 |
|
844 | constructor(str: string);
|
845 |
|
846 | /**
|
847 | * Return a JSON representation of this node.
|
848 | */
|
849 | toJSON(): {
|
850 | __type: string;
|
851 | string: string;
|
852 | val: string;
|
853 | prefixed: boolean;
|
854 | lineno: number;
|
855 | column: number;
|
856 | filename: string;
|
857 | };
|
858 | }
|
859 |
|
860 | export class Unit extends Node {
|
861 | val: number;
|
862 | type: string;
|
863 |
|
864 | constructor(val: number, type: string);
|
865 |
|
866 | /**
|
867 | * Return a JSON representation of this node.
|
868 | */
|
869 | toJSON(): { __type: string; val: number; type: string; lineno: number; column: number; filename: string };
|
870 | }
|
871 |
|
872 | export class RGBA extends Node {
|
873 | r: number;
|
874 | g: number;
|
875 | b: number;
|
876 | a: number;
|
877 | rgba: RGBA;
|
878 | hsla: HSLA;
|
879 |
|
880 | constructor(r: number, g: number, b: number, a: number);
|
881 |
|
882 | /**
|
883 | * Return an `RGBA` without clamping values.
|
884 | */
|
885 | static withoutClamping(r: number, g: number, b: number, a: number): RGBA;
|
886 |
|
887 | /**
|
888 | * Return a `RGBA` from the given `hsla`.
|
889 | */
|
890 | static fromHSLA(hsla: HSLA): RGBA;
|
891 |
|
892 | /**
|
893 | * Add r,g,b,a to the current component values
|
894 | */
|
895 | add(r: number, g: number, b: number, a: number): RGBA;
|
896 |
|
897 | /**
|
898 | * Subtract r,g,b,a from the current component values
|
899 | */
|
900 | substract(r: number, g: number, b: number, a: number): RGBA;
|
901 |
|
902 | /**
|
903 | * Multiply rgb components by `n`.
|
904 | */
|
905 | multiply(n: number): RGBA;
|
906 |
|
907 | /**
|
908 | * Divide rgb components by `n`.
|
909 | */
|
910 | divide(n: number): RGBA;
|
911 |
|
912 | /**
|
913 | * Return a JSON representation of this node.
|
914 | */
|
915 | toJSON(): {
|
916 | __type: string;
|
917 | r: number;
|
918 | g: number;
|
919 | b: number;
|
920 | a: number;
|
921 | lineno: number;
|
922 | column: number;
|
923 | filename: string;
|
924 | };
|
925 | }
|
926 |
|
927 | export class HSLA extends Node {
|
928 | h: number;
|
929 | s: number;
|
930 | l: number;
|
931 | a: number;
|
932 | hsla: HSLA;
|
933 | rgba: RGBA;
|
934 |
|
935 | constructor(h: number, s: number, l: number, a: number);
|
936 |
|
937 | /**
|
938 | * Return a `HSLA` from the given `hsla`.
|
939 | */
|
940 | static fromRGBA(rgba: RGBA): HSLA;
|
941 |
|
942 | /**
|
943 | * Add h,s,l to the current component values
|
944 | */
|
945 | add(h: number, s: number, l: number): HSLA;
|
946 |
|
947 | /**
|
948 | * Subtract h,s,l from the current component values
|
949 | */
|
950 | substract(h: number, s: number, l: number): HSLA;
|
951 |
|
952 | /**
|
953 | * Adjust lightness by `percent`.
|
954 | */
|
955 | adjustLightness(percent: number): HSLA;
|
956 |
|
957 | /**
|
958 | * djust hue by `deg`.
|
959 | */
|
960 | adjustHue(deg: number): HSLA;
|
961 |
|
962 | /**
|
963 | * Return a JSON representation of this node.
|
964 | */
|
965 | toJSON(): {
|
966 | __type: string;
|
967 | h: number;
|
968 | s: number;
|
969 | l: number;
|
970 | a: number;
|
971 | lineno: number;
|
972 | column: number;
|
973 | filename: string;
|
974 | };
|
975 | }
|
976 |
|
977 | export class Block extends Node {
|
978 | nodes: Node[];
|
979 | parent: Block;
|
980 | node: Node;
|
981 | scope: boolean;
|
982 |
|
983 | hasProperties: boolean;
|
984 | hasMedia: boolean;
|
985 | isEmpty: boolean;
|
986 |
|
987 | constructor(parent: Block);
|
988 | constructor(parent: Block, node: Node);
|
989 |
|
990 | /**
|
991 | * Push a `node` to this block.
|
992 | */
|
993 | push(node: Node): void;
|
994 |
|
995 | /**
|
996 | * Return a JSON representation of this node.
|
997 | */
|
998 | toJSON(): {
|
999 | __type: string;
|
1000 | nodes: Node[];
|
1001 | scope: boolean;
|
1002 | lineno: number;
|
1003 | column: number;
|
1004 | filename: string;
|
1005 | };
|
1006 | }
|
1007 |
|
1008 | export class Group extends Node {
|
1009 | nodes: Node[];
|
1010 | block: Block;
|
1011 |
|
1012 | hasOnlyPlaceholders: boolean;
|
1013 |
|
1014 | constructor();
|
1015 |
|
1016 | /**
|
1017 | * Push the given `selector` node.
|
1018 | */
|
1019 | push(node: Node): void;
|
1020 |
|
1021 | /**
|
1022 | * Return a JSON representation of this node.
|
1023 | */
|
1024 | toJSON(): { __type: string; nodes: Node[]; block: Block; lineno: number; column: number; filename: string };
|
1025 | }
|
1026 |
|
1027 | export class Expression extends Node {
|
1028 | nodes: Node[];
|
1029 | isList: boolean;
|
1030 |
|
1031 | isEmpty: boolean;
|
1032 | first: Node;
|
1033 |
|
1034 | constructor(isList: boolean);
|
1035 |
|
1036 | /**
|
1037 | * Push the given node.
|
1038 | */
|
1039 | push(node: Node): void;
|
1040 |
|
1041 | /**
|
1042 | * Return a JSON representation of this node.
|
1043 | */
|
1044 | toJSON(): {
|
1045 | __type: string;
|
1046 | nodes: Node[];
|
1047 | isList: boolean;
|
1048 | lineno: number;
|
1049 | column: number;
|
1050 | filename: string;
|
1051 | };
|
1052 | }
|
1053 |
|
1054 | export class Property extends Node {
|
1055 | segments: Node[];
|
1056 | expr: Expression;
|
1057 |
|
1058 | constructor(segs: Node[], expr: Expression);
|
1059 |
|
1060 | /**
|
1061 | * Return a JSON representation of this node.
|
1062 | */
|
1063 | toJSON(): {
|
1064 | __type: string;
|
1065 | segments: Node[];
|
1066 | name: string;
|
1067 | expr?: Expression | undefined;
|
1068 | literal?: Literal | undefined;
|
1069 | lineno: number;
|
1070 | column: number;
|
1071 | filename: string;
|
1072 | };
|
1073 | }
|
1074 |
|
1075 | export class Each extends Node {
|
1076 | val: string;
|
1077 | key: string;
|
1078 | expr: Expression;
|
1079 | block: Block;
|
1080 |
|
1081 | |
1082 |
|
1083 |
|
1084 | toJSON(): {
|
1085 | __type: string;
|
1086 | val: string;
|
1087 | key: string;
|
1088 | expr: Expression;
|
1089 | block: Block;
|
1090 | lineno: number;
|
1091 | column: number;
|
1092 | filename: string;
|
1093 | };
|
1094 | }
|
1095 |
|
1096 | export class If extends Node {
|
1097 | cond: Expression;
|
1098 | elses: Expression[];
|
1099 | block: Block;
|
1100 | negate: boolean;
|
1101 |
|
1102 | constructor(cond: Expression, negate: boolean);
|
1103 | constructor(cond: Expression, block: Block);
|
1104 |
|
1105 | /**
|
1106 | * Return a JSON representation of this node.
|
1107 | */
|
1108 | toJSON(): {
|
1109 | __type: string;
|
1110 | cond: Expression;
|
1111 | elses: Expression[];
|
1112 | block: Block;
|
1113 | negate: boolean;
|
1114 | lineno: number;
|
1115 | column: number;
|
1116 | filename: string;
|
1117 | };
|
1118 | }
|
1119 |
|
1120 | export class Call extends Node {
|
1121 | name: string;
|
1122 | args: Expression;
|
1123 |
|
1124 | constructor(name: string, args: Expression);
|
1125 |
|
1126 | /**
|
1127 | * Return a JSON representation of this node.
|
1128 | */
|
1129 | toJSON(): {
|
1130 | __type: string;
|
1131 | name: string;
|
1132 | args: Expression;
|
1133 | lineno: number;
|
1134 | column: number;
|
1135 | filename: string;
|
1136 | };
|
1137 | }
|
1138 |
|
1139 | export class UnaryOp extends Node {
|
1140 | op: string;
|
1141 | expr: Expression;
|
1142 |
|
1143 | constructor(op: string, expr: Expression);
|
1144 |
|
1145 | /**
|
1146 | * Return a JSON representation of this node.
|
1147 | */
|
1148 | toJSON(): {
|
1149 | __type: string;
|
1150 | op: string;
|
1151 | expr: Expression;
|
1152 | lineno: number;
|
1153 | column: number;
|
1154 | filename: string;
|
1155 | };
|
1156 | }
|
1157 |
|
1158 | export class BinOp extends Node {
|
1159 | op: string;
|
1160 | left: Expression;
|
1161 | right: Expression;
|
1162 |
|
1163 | constructor(op: string, left: Expression, right: Expression);
|
1164 |
|
1165 | /**
|
1166 | * Return a JSON representation of this node.
|
1167 | */
|
1168 | toJSON(): {
|
1169 | __type: string;
|
1170 | op: string;
|
1171 | left: Expression;
|
1172 | right: Expression;
|
1173 | lineno: number;
|
1174 | column: number;
|
1175 | filename: string;
|
1176 | };
|
1177 | }
|
1178 |
|
1179 | export class Ternary extends Node {
|
1180 | op: string;
|
1181 | trueExpr: Expression;
|
1182 | falseExpr: Expression;
|
1183 |
|
1184 | constructor(op: string, trueExpr: Expression, falseExpr: Expression);
|
1185 |
|
1186 | /**
|
1187 | * Return a JSON representation of this node.
|
1188 | */
|
1189 | toJSON(): {
|
1190 | __type: string;
|
1191 | op: string;
|
1192 | trueExpr: Expression;
|
1193 | falseExpr: Expression;
|
1194 | lineno: number;
|
1195 | column: number;
|
1196 | filename: string;
|
1197 | };
|
1198 | }
|
1199 |
|
1200 | export class Return extends Node {
|
1201 | expr: Expression;
|
1202 |
|
1203 | constructor(expr: Expression);
|
1204 |
|
1205 | /**
|
1206 | * Return a JSON representation of this node.
|
1207 | */
|
1208 | toJSON(): { __type: string; expr: Expression; lineno: number; column: number; filename: string };
|
1209 | }
|
1210 |
|
1211 | export class Media extends Node {
|
1212 | val: string;
|
1213 |
|
1214 | constructor(val: string);
|
1215 |
|
1216 | /**
|
1217 | * Return a JSON representation of this node.
|
1218 | */
|
1219 | toJSON(): { __type: string; val: string; lineno: number; column: number; filename: string };
|
1220 | }
|
1221 |
|
1222 | export class QueryList extends Node {
|
1223 | nodes: Node[];
|
1224 |
|
1225 | constructor();
|
1226 |
|
1227 | /**
|
1228 | * Push the given `node`.
|
1229 | */
|
1230 | push(node: Node): void;
|
1231 |
|
1232 | /**
|
1233 | * Merges this query list with the `other`.
|
1234 | */
|
1235 | merge(other: QueryList): QueryList;
|
1236 |
|
1237 | /**
|
1238 | * Return a JSON representation of this node.
|
1239 | */
|
1240 | toJSON(): { __type: string; nodes: Node[]; lineno: number; column: number; filename: string };
|
1241 | }
|
1242 |
|
1243 | export class Query extends Node {
|
1244 | nodes: QueryExpr[];
|
1245 | type: string;
|
1246 | predicate: string;
|
1247 |
|
1248 | resolvedType: string;
|
1249 | resolvedPredicate: string;
|
1250 |
|
1251 | constructor();
|
1252 |
|
1253 | /**
|
1254 | * Push the given `expr`.
|
1255 | */
|
1256 | push(expr: QueryExpr): void;
|
1257 |
|
1258 | /**
|
1259 | * Merges this query with the `other`.
|
1260 | */
|
1261 | merge(other: Query): Query;
|
1262 |
|
1263 | /**
|
1264 | * Return a JSON representation of this node.
|
1265 | */
|
1266 | toJSON(): {
|
1267 | __type: string;
|
1268 | nodes: QueryExpr[];
|
1269 | predicate: string;
|
1270 | type: string;
|
1271 | lineno: number;
|
1272 | column: number;
|
1273 | filename: string;
|
1274 | };
|
1275 | }
|
1276 |
|
1277 | export class QueryExpr extends Node {
|
1278 | segments: Node[];
|
1279 | expr: Expression;
|
1280 |
|
1281 | constructor(segs: Node[]);
|
1282 |
|
1283 | /**
|
1284 | * Return a JSON representation of this node.
|
1285 | */
|
1286 | toJSON(): { __type: string; segments: Node[]; lineno: number; column: number; filename: string };
|
1287 | }
|
1288 |
|
1289 | export class Params extends Node {
|
1290 | nodes: Node[];
|
1291 |
|
1292 | length: number;
|
1293 |
|
1294 | |
1295 |
|
1296 |
|
1297 | push(node: Node): void;
|
1298 |
|
1299 | |
1300 |
|
1301 |
|
1302 | toJSON(): { __type: string; nodes: Node[]; lineno: number; column: number; filename: string };
|
1303 | }
|
1304 |
|
1305 | export class Comment extends Node {
|
1306 | str: string;
|
1307 | suppress: boolean;
|
1308 | inline: boolean;
|
1309 |
|
1310 | constructor(str: string, suppress: boolean, inline: boolean);
|
1311 |
|
1312 | /**
|
1313 | * Return a JSON representation of this node.
|
1314 | */
|
1315 | toJSON(): {
|
1316 | __type: string;
|
1317 | str: string;
|
1318 | suppress: boolean;
|
1319 | inline: boolean;
|
1320 | lineno: number;
|
1321 | column: number;
|
1322 | filename: string;
|
1323 | };
|
1324 | }
|
1325 |
|
1326 | export class Keyframes extends Node {
|
1327 | segments: Node[];
|
1328 | prefix: string;
|
1329 |
|
1330 | constructor(segs: Node[]);
|
1331 | constructor(segs: Node[], prefix: string);
|
1332 |
|
1333 | /**
|
1334 | * Return a JSON representation of this node.
|
1335 | */
|
1336 | toJSON(): {
|
1337 | __type: string;
|
1338 | segments: Node[];
|
1339 | prefix: string;
|
1340 | block: Block;
|
1341 | lineno: number;
|
1342 | column: number;
|
1343 | filename: string;
|
1344 | };
|
1345 | }
|
1346 |
|
1347 | export class Member extends Node {
|
1348 | left: Node;
|
1349 | right: Node;
|
1350 |
|
1351 | constructor(left: Node, right: Node);
|
1352 |
|
1353 | /**
|
1354 | * Return a JSON representation of this node.
|
1355 | */
|
1356 | toJSON(): {
|
1357 | __type: string;
|
1358 | left: Node;
|
1359 | right: Node;
|
1360 | val?: string | undefined;
|
1361 | lineno: number;
|
1362 | column: number;
|
1363 | filename: string;
|
1364 | };
|
1365 | }
|
1366 |
|
1367 | export class Charset extends Node {
|
1368 | val: string;
|
1369 |
|
1370 | constructor(val: string);
|
1371 |
|
1372 | /**
|
1373 | * Return a JSON representation of this node.
|
1374 | */
|
1375 | toJSON(): { __type: string; val: string; lineno: number; column: number; filename: string };
|
1376 | }
|
1377 |
|
1378 | export class Namespace extends Node {
|
1379 | val: string;
|
1380 | prefix: string;
|
1381 |
|
1382 | constructor(val: string, prefix: string);
|
1383 |
|
1384 | /**
|
1385 | * Return a JSON representation of this node.
|
1386 | */
|
1387 | toJSON(): { __type: string; val: string; prefix: string; lineno: number; column: number; filename: string };
|
1388 | }
|
1389 |
|
1390 | export class Import extends Node {
|
1391 | path: Expression;
|
1392 | once: boolean;
|
1393 |
|
1394 | constructor(path: Expression);
|
1395 | constructor(path: Expression, once: boolean);
|
1396 |
|
1397 | /**
|
1398 | * Return a JSON representation of this node.
|
1399 | */
|
1400 | toJSON(): { __type: string; path: Expression; lineno: number; column: number; filename: string };
|
1401 | }
|
1402 |
|
1403 | export class Extend extends Node {
|
1404 | selectors: Selector[];
|
1405 |
|
1406 | constructor(selectors: Selector[]);
|
1407 |
|
1408 | /**
|
1409 | * Return a JSON representation of this node.
|
1410 | */
|
1411 | toJSON(): { __type: string; selectors: Selector[]; lineno: number; column: number; filename: string };
|
1412 | }
|
1413 |
|
1414 | export class Function extends Node {
|
1415 | name: string;
|
1416 | params: Params;
|
1417 | block: Block;
|
1418 |
|
1419 | constructor(name: string, params: Params, body: Block);
|
1420 |
|
1421 | /**
|
1422 | * Return a JSON representation of this node.
|
1423 | */
|
1424 | toJSON(): {
|
1425 | __type: string;
|
1426 | name: string;
|
1427 | params: Params;
|
1428 | block: Block;
|
1429 | lineno: number;
|
1430 | column: number;
|
1431 | filename: string;
|
1432 | };
|
1433 | }
|
1434 |
|
1435 | export class Selector extends Node {
|
1436 | inherits: boolean;
|
1437 | segments: Node[];
|
1438 |
|
1439 | constructor(segs: Node[]);
|
1440 |
|
1441 | /**
|
1442 | * Return a JSON representation of this node.
|
1443 | */
|
1444 | toJSON(): {
|
1445 | __type: string;
|
1446 | segments: Node[];
|
1447 | inherits: boolean;
|
1448 | val: string;
|
1449 | lineno: number;
|
1450 | column: number;
|
1451 | filename: string;
|
1452 | };
|
1453 | }
|
1454 |
|
1455 | export class Arguments extends Expression {
|
1456 | map: Dictionary<Node>;
|
1457 |
|
1458 | constructor();
|
1459 |
|
1460 | /**
|
1461 | * Return a JSON representation of this node.
|
1462 | */
|
1463 | toJSON(): {
|
1464 | __type: string;
|
1465 | map: Dictionary<Node>;
|
1466 | isList: boolean;
|
1467 | preserve: boolean;
|
1468 | nodes: Node[];
|
1469 | lineno: number;
|
1470 | column: number;
|
1471 | filename: string;
|
1472 | };
|
1473 | }
|
1474 |
|
1475 | export class Atblock extends Node {
|
1476 | block: Block;
|
1477 | nodes: Node[];
|
1478 |
|
1479 | constructor();
|
1480 |
|
1481 | /**
|
1482 | * Return a JSON representation of this node.
|
1483 | */
|
1484 | toJSON(): { __type: string; block: Block; lineno: number; column: number; filename: string };
|
1485 | }
|
1486 |
|
1487 | export class Atrule extends Node {
|
1488 | type: string;
|
1489 |
|
1490 | hasOnlyProperties: boolean;
|
1491 |
|
1492 | constructor(type: string);
|
1493 |
|
1494 | /**
|
1495 | * Return a JSON representation of this node.
|
1496 | */
|
1497 | toJSON(): {
|
1498 | __type: string;
|
1499 | type: string;
|
1500 | segments: Node[];
|
1501 | block?: Block | undefined;
|
1502 | lineno: number;
|
1503 | column: number;
|
1504 | filename: string;
|
1505 | };
|
1506 | }
|
1507 | }
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 | export interface Dictionary<T> {
|
1514 | [key: string]: T;
|
1515 | }
|
1516 |
|
1517 | export interface UrlOptions {
|
1518 | limit?: number | false | null | undefined;
|
1519 | paths?: string[] | undefined;
|
1520 | }
|
1521 |
|
1522 | export interface LiteralFunction {
|
1523 | (url: string): Nodes.Literal;
|
1524 | raw: boolean;
|
1525 | }
|
1526 |
|
1527 | export interface ExceptionOptions {
|
1528 | filename: string;
|
1529 | context: number;
|
1530 | lineno: number;
|
1531 | column: number;
|
1532 | input: string;
|
1533 | }
|
1534 |
|
1535 |
|
1536 | }
|