1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | /**
|
---|
9 | * This file is a port of shadowCSS from webcomponents.js to TypeScript.
|
---|
10 | *
|
---|
11 | * Please make sure to keep to edits in sync with the source file.
|
---|
12 | *
|
---|
13 | * Source:
|
---|
14 | * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
---|
15 | *
|
---|
16 | * The original file level comment is reproduced below
|
---|
17 | */
|
---|
18 | export declare class ShadowCss {
|
---|
19 | strictStyling: boolean;
|
---|
20 | shimCssText(cssText: string, selector: string, hostSelector?: string): string;
|
---|
21 | private _insertDirectives;
|
---|
22 | private _insertPolyfillDirectivesInCssText;
|
---|
23 | private _insertPolyfillRulesInCssText;
|
---|
24 | private _scopeCssText;
|
---|
25 | private _extractUnscopedRulesFromCssText;
|
---|
26 | private _convertColonHost;
|
---|
27 | private _convertColonHostContext;
|
---|
28 | private _convertShadowDOMSelectors;
|
---|
29 | private _scopeSelectors;
|
---|
30 | /**
|
---|
31 | * Handle a css text that is within a rule that should not contain scope selectors by simply
|
---|
32 | * removing them! An example of such a rule is `@font-face`.
|
---|
33 | *
|
---|
34 | * `@font-face` rules cannot contain nested selectors. Nor can they be nested under a selector.
|
---|
35 | * Normally this would be a syntax error by the author of the styles. But in some rare cases, such
|
---|
36 | * as importing styles from a library, and applying `:host ::ng-deep` to the imported styles, we
|
---|
37 | * can end up with broken css if the imported styles happen to contain @font-face rules.
|
---|
38 | *
|
---|
39 | * For example:
|
---|
40 | *
|
---|
41 | * ```
|
---|
42 | * :host ::ng-deep {
|
---|
43 | * import 'some/lib/containing/font-face';
|
---|
44 | * }
|
---|
45 | *
|
---|
46 | * Similar logic applies to `@page` rules which can contain a particular set of properties,
|
---|
47 | * as well as some specific at-rules. Since they can't be encapsulated, we have to strip
|
---|
48 | * any scoping selectors from them. For more information: https://www.w3.org/TR/css-page-3
|
---|
49 | * ```
|
---|
50 | */
|
---|
51 | private _stripScopingSelectors;
|
---|
52 | private _scopeSelector;
|
---|
53 | private _selectorNeedsScoping;
|
---|
54 | private _makeScopeMatcher;
|
---|
55 | private _applySelectorScope;
|
---|
56 | private _applySimpleSelectorScope;
|
---|
57 | private _insertPolyfillHostInCssText;
|
---|
58 | }
|
---|
59 | export declare class CssRule {
|
---|
60 | selector: string;
|
---|
61 | content: string;
|
---|
62 | constructor(selector: string, content: string);
|
---|
63 | }
|
---|
64 | export declare function processRules(input: string, ruleCallback: (rule: CssRule) => CssRule): string;
|
---|
65 | /**
|
---|
66 | * Mutate the given `groups` array so that there are `multiples` clones of the original array
|
---|
67 | * stored.
|
---|
68 | *
|
---|
69 | * For example `repeatGroups([a, b], 3)` will result in `[a, b, a, b, a, b]` - but importantly the
|
---|
70 | * newly added groups will be clones of the original.
|
---|
71 | *
|
---|
72 | * @param groups An array of groups of strings that will be repeated. This array is mutated
|
---|
73 | * in-place.
|
---|
74 | * @param multiples The number of times the current groups should appear.
|
---|
75 | */
|
---|
76 | export declare function repeatGroups(groups: string[][], multiples: number): void;
|
---|