Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. declare namespace postcssValueParser {
  2. interface BaseNode {
  3. /**
  4. * The offset inside the CSS value at which the node starts
  5. */
  6. sourceIndex: number;
  7. /**
  8. * The node's characteristic value
  9. */
  10. value: string;
  11. }
  12. interface ClosableNode {
  13. /**
  14. * Whether the parsed CSS value ended before the node was properly closed
  15. */
  16. unclosed?: true;
  17. }
  18. interface AdjacentAwareNode {
  19. /**
  20. * The token at the start of the node
  21. */
  22. before: string;
  23. /**
  24. * The token at the end of the node
  25. */
  26. after: string;
  27. }
  28. interface CommentNode extends BaseNode, ClosableNode {
  29. type: "comment";
  30. }
  31. interface DivNode extends BaseNode, AdjacentAwareNode {
  32. type: "div";
  33. }
  34. interface FunctionNode extends BaseNode, ClosableNode, AdjacentAwareNode {
  35. type: "function";
  36. /**
  37. * Nodes inside the function
  38. */
  39. nodes: Node[];
  40. }
  41. interface SpaceNode extends BaseNode {
  42. type: "space";
  43. }
  44. interface StringNode extends BaseNode, ClosableNode {
  45. type: "string";
  46. /**
  47. * The quote type delimiting the string
  48. */
  49. quote: '"' | "'";
  50. }
  51. interface UnicodeRangeNode extends BaseNode {
  52. type: "unicode-range";
  53. }
  54. interface WordNode extends BaseNode {
  55. type: "word";
  56. }
  57. /**
  58. * Any node parsed from a CSS value
  59. */
  60. type Node =
  61. | CommentNode
  62. | DivNode
  63. | FunctionNode
  64. | SpaceNode
  65. | StringNode
  66. | UnicodeRangeNode
  67. | WordNode;
  68. interface CustomStringifierCallback {
  69. /**
  70. * @param node The node to stringify
  71. * @returns The serialized CSS representation of the node
  72. */
  73. (nodes: Node): string | undefined;
  74. }
  75. interface WalkCallback {
  76. /**
  77. * @param node The currently visited node
  78. * @param index The index of the node in the series of parsed nodes
  79. * @param nodes The series of parsed nodes
  80. * @returns Returning `false` will prevent traversal of descendant nodes (only applies if `bubble` was set to `true` in the `walk()` call)
  81. */
  82. (node: Node, index: number, nodes: Node[]): void | boolean;
  83. }
  84. /**
  85. * A CSS dimension, decomposed into its numeric and unit parts
  86. */
  87. interface Dimension {
  88. number: string;
  89. unit: string;
  90. }
  91. /**
  92. * A wrapper around a parsed CSS value that allows for inspecting and walking nodes
  93. */
  94. interface ParsedValue {
  95. /**
  96. * The series of parsed nodes
  97. */
  98. nodes: Node[];
  99. /**
  100. * Walk all parsed nodes, applying a callback
  101. *
  102. * @param callback A visitor callback that will be executed for each node
  103. * @param bubble When set to `true`, walking will be done inside-out instead of outside-in
  104. */
  105. walk(callback: WalkCallback, bubble?: boolean): this;
  106. }
  107. interface ValueParser {
  108. /**
  109. * Decompose a CSS dimension into its numeric and unit part
  110. *
  111. * @param value The dimension to decompose
  112. * @returns An object representing `number` and `unit` part of the dimension or `false` if the decomposing fails
  113. */
  114. unit(value: string): Dimension | false;
  115. /**
  116. * Serialize a series of nodes into a CSS value
  117. *
  118. * @param nodes The nodes to stringify
  119. * @param custom A custom stringifier callback
  120. * @returns The generated CSS value
  121. */
  122. stringify(nodes: Node | Node[], custom?: CustomStringifierCallback): string;
  123. /**
  124. * Walk a series of nodes, applying a callback
  125. *
  126. * @param nodes The nodes to walk
  127. * @param callback A visitor callback that will be executed for each node
  128. * @param bubble When set to `true`, walking will be done inside-out instead of outside-in
  129. */
  130. walk(nodes: Node[], callback: WalkCallback, bubble?: boolean): void;
  131. /**
  132. * Parse a CSS value into a series of nodes to operate on
  133. *
  134. * @param value The value to parse
  135. */
  136. new (value: string): ParsedValue;
  137. /**
  138. * Parse a CSS value into a series of nodes to operate on
  139. *
  140. * @param value The value to parse
  141. */
  142. (value: string): ParsedValue;
  143. }
  144. }
  145. declare const postcssValueParser: postcssValueParser.ValueParser;
  146. export = postcssValueParser;