CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
at-rule.d.ts140 linesDownload Raw Back to lib
1import Container, {2  ContainerProps,3  ContainerWithChildren4} from './container.js'5 6declare namespace AtRule {7  export interface AtRuleRaws extends Record<string, unknown> {8    /**9     * The space symbols after the last child of the node to the end of the node.10     */11    after?: string12 13    /**14     * The space between the at-rule name and its parameters.15     */16    afterName?: string17 18    /**19     * The space symbols before the node. It also stores `*`20     * and `_` symbols before the declaration (IE hack).21     */22    before?: string23 24    /**25     * The symbols between the last parameter and `{` for rules.26     */27    between?: string28 29    /**30     * The rule’s selector with comments.31     */32    params?: {33      raw: string34      value: string35    }36 37    /**38     * Contains `true` if the last child has an (optional) semicolon.39     */40    semicolon?: boolean41  }42 43  export interface AtRuleProps extends ContainerProps {44    /** Name of the at-rule. */45    name: string46    /** Parameters following the name of the at-rule. */47    params?: number | string48    /** Information used to generate byte-to-byte equal node string as it was in the origin input. */49    raws?: AtRuleRaws50  }51 52  export { AtRule_ as default }53}54 55/**56 * Represents an at-rule.57 *58 * ```js59 * Once (root, { AtRule }) {60 *   let media = new AtRule({ name: 'media', params: 'print' })61 *   media.append(…)62 *   root.append(media)63 * }64 * ```65 *66 * If it’s followed in the CSS by a `{}` block, this node will have67 * a nodes property representing its children.68 *69 * ```js70 * const root = postcss.parse('@charset "UTF-8"; @media print {}')71 *72 * const charset = root.first73 * charset.type  //=> 'atrule'74 * charset.nodes //=> undefined75 *76 * const media = root.last77 * media.nodes   //=> []78 * ```79 */80declare class AtRule_ extends Container {81  /**82   * An array containing the layer’s children.83   *84   * ```js85   * const root = postcss.parse('@layer example { a { color: black } }')86   * const layer = root.first87   * layer.nodes.length           //=> 188   * layer.nodes[0].selector      //=> 'a'89   * ```90   *91   * Can be `undefinded` if the at-rule has no body.92   *93   * ```js94   * const root = postcss.parse('@layer a, b, c;')95   * const layer = root.first96   * layer.nodes //=> undefined97   * ```98   */99  nodes: Container['nodes'] | undefined100  parent: ContainerWithChildren | undefined101 102  raws: AtRule.AtRuleRaws103  type: 'atrule'104  /**105   * The at-rule’s name immediately follows the `@`.106   *107   * ```js108   * const root  = postcss.parse('@media print {}')109   * const media = root.first110   * media.name //=> 'media'111   * ```112   */113  get name(): string114  set name(value: string)115 116  /**117   * The at-rule’s parameters, the values that follow the at-rule’s name118   * but precede any `{}` block.119   *120   * ```js121   * const root  = postcss.parse('@media print, screen {}')122   * const media = root.first123   * media.params //=> 'print, screen'124   * ```125   */126  get params(): string127 128  set params(value: string)129 130  constructor(defaults?: AtRule.AtRuleProps)131  assign(overrides: AtRule.AtRuleProps | object): this132  clone(overrides?: Partial<AtRule.AtRuleProps>): this133  cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this134  cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this135}136 137declare class AtRule extends AtRule_ {}138 139export = AtRule140