@tbela99/css-parser 0.0.1-alpha4 → 0.0.1-alpha5
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/.gitattributes +2 -0
- package/README.md +2 -0
- package/dist/index-umd-web.js +454 -172
- package/dist/index.cjs +454 -172
- package/dist/index.d.ts +18 -7
- package/dist/lib/parser/deduplicate.js +416 -141
- package/dist/lib/parser/parse.js +35 -11
- package/dist/lib/renderer/render.js +5 -22
- package/dist/lib/walker/walk.js +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -272,9 +272,20 @@ interface AstDeclaration extends Node {
|
|
|
272
272
|
|
|
273
273
|
interface AstRule extends Node {
|
|
274
274
|
|
|
275
|
-
typ: 'Rule'
|
|
276
|
-
sel: string
|
|
277
|
-
chi: Array<AstDeclaration | AstComment | AstRuleList
|
|
275
|
+
typ: 'Rule';
|
|
276
|
+
sel: string;
|
|
277
|
+
chi: Array<AstDeclaration | AstComment | AstRuleList>;
|
|
278
|
+
optimized?: OptimizedSelector;
|
|
279
|
+
raw?: RawSelectorTokens;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
declare type RawSelectorTokens = string[][];
|
|
283
|
+
|
|
284
|
+
interface OptimizedSelector {
|
|
285
|
+
match: boolean;
|
|
286
|
+
optimized: string[];
|
|
287
|
+
selector: string[][],
|
|
288
|
+
reducible: boolean;
|
|
278
289
|
}
|
|
279
290
|
|
|
280
291
|
interface AstAtRule extends Node {
|
|
@@ -303,14 +314,14 @@ type AstNode =
|
|
|
303
314
|
| AstDeclaration;
|
|
304
315
|
|
|
305
316
|
declare function deduplicate(ast: AstNode, options?: ParserOptions, recursive?: boolean): AstNode;
|
|
306
|
-
declare function hasDeclaration(node:
|
|
307
|
-
declare function deduplicateRule(ast:
|
|
308
|
-
declare function reduceSelector(selector: string[][]):
|
|
317
|
+
declare function hasDeclaration(node: AstRule): boolean;
|
|
318
|
+
declare function deduplicateRule(ast: AstRule | AstAtRule): AstRule | AstAtRule;
|
|
319
|
+
declare function reduceSelector(selector: string[][]): {
|
|
309
320
|
match: boolean;
|
|
310
321
|
optimized: string[];
|
|
311
322
|
selector: string[][];
|
|
312
323
|
reducible: boolean;
|
|
313
|
-
};
|
|
324
|
+
} | null;
|
|
314
325
|
|
|
315
326
|
declare function render(data: AstNode, opt?: RenderOptions): RenderResult;
|
|
316
327
|
declare function renderToken(token: Token, options?: RenderOptions): string;
|