source: trip-planner-front/node_modules/@angular/compiler/src/shadow_css.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 98.7 KB
Line 
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(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/shadow_css", ["require", "exports", "tslib"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.repeatGroups = exports.processRules = exports.CssRule = exports.ShadowCss = void 0;
20 var tslib_1 = require("tslib");
21 /**
22 * This file is a port of shadowCSS from webcomponents.js to TypeScript.
23 *
24 * Please make sure to keep to edits in sync with the source file.
25 *
26 * Source:
27 * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
28 *
29 * The original file level comment is reproduced below
30 */
31 /*
32 This is a limited shim for ShadowDOM css styling.
33 https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
34
35 The intention here is to support only the styling features which can be
36 relatively simply implemented. The goal is to allow users to avoid the
37 most obvious pitfalls and do so without compromising performance significantly.
38 For ShadowDOM styling that's not covered here, a set of best practices
39 can be provided that should allow users to accomplish more complex styling.
40
41 The following is a list of specific ShadowDOM styling features and a brief
42 discussion of the approach used to shim.
43
44 Shimmed features:
45
46 * :host, :host-context: ShadowDOM allows styling of the shadowRoot's host
47 element using the :host rule. To shim this feature, the :host styles are
48 reformatted and prefixed with a given scope name and promoted to a
49 document level stylesheet.
50 For example, given a scope name of .foo, a rule like this:
51
52 :host {
53 background: red;
54 }
55 }
56
57 becomes:
58
59 .foo {
60 background: red;
61 }
62
63 * encapsulation: Styles defined within ShadowDOM, apply only to
64 dom inside the ShadowDOM. Polymer uses one of two techniques to implement
65 this feature.
66
67 By default, rules are prefixed with the host element tag name
68 as a descendant selector. This ensures styling does not leak out of the 'top'
69 of the element's ShadowDOM. For example,
70
71 div {
72 font-weight: bold;
73 }
74
75 becomes:
76
77 x-foo div {
78 font-weight: bold;
79 }
80
81 becomes:
82
83
84 Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
85 selectors are scoped by adding an attribute selector suffix to each
86 simple selector that contains the host element tag name. Each element
87 in the element's ShadowDOM template is also given the scope attribute.
88 Thus, these rules match only elements that have the scope attribute.
89 For example, given a scope name of x-foo, a rule like this:
90
91 div {
92 font-weight: bold;
93 }
94
95 becomes:
96
97 div[x-foo] {
98 font-weight: bold;
99 }
100
101 Note that elements that are dynamically added to a scope must have the scope
102 selector added to them manually.
103
104 * upper/lower bound encapsulation: Styles which are defined outside a
105 shadowRoot should not cross the ShadowDOM boundary and should not apply
106 inside a shadowRoot.
107
108 This styling behavior is not emulated. Some possible ways to do this that
109 were rejected due to complexity and/or performance concerns include: (1) reset
110 every possible property for every possible selector for a given scope name;
111 (2) re-implement css in javascript.
112
113 As an alternative, users should make sure to use selectors
114 specific to the scope in which they are working.
115
116 * ::distributed: This behavior is not emulated. It's often not necessary
117 to style the contents of a specific insertion point and instead, descendants
118 of the host element can be styled selectively. Users can also create an
119 extra node around an insertion point and style that node's contents
120 via descendent selectors. For example, with a shadowRoot like this:
121
122 <style>
123 ::content(div) {
124 background: red;
125 }
126 </style>
127 <content></content>
128
129 could become:
130
131 <style>
132 / *@polyfill .content-container div * /
133 ::content(div) {
134 background: red;
135 }
136 </style>
137 <div class="content-container">
138 <content></content>
139 </div>
140
141 Note the use of @polyfill in the comment above a ShadowDOM specific style
142 declaration. This is a directive to the styling shim to use the selector
143 in comments in lieu of the next selector when running under polyfill.
144 */
145 var ShadowCss = /** @class */ (function () {
146 function ShadowCss() {
147 this.strictStyling = true;
148 }
149 /*
150 * Shim some cssText with the given selector. Returns cssText that can
151 * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css).
152 *
153 * When strictStyling is true:
154 * - selector is the attribute added to all elements inside the host,
155 * - hostSelector is the attribute added to the host itself.
156 */
157 ShadowCss.prototype.shimCssText = function (cssText, selector, hostSelector) {
158 if (hostSelector === void 0) { hostSelector = ''; }
159 var commentsWithHash = extractCommentsWithHash(cssText);
160 cssText = stripComments(cssText);
161 cssText = this._insertDirectives(cssText);
162 var scopedCssText = this._scopeCssText(cssText, selector, hostSelector);
163 return tslib_1.__spreadArray([scopedCssText], tslib_1.__read(commentsWithHash)).join('\n');
164 };
165 ShadowCss.prototype._insertDirectives = function (cssText) {
166 cssText = this._insertPolyfillDirectivesInCssText(cssText);
167 return this._insertPolyfillRulesInCssText(cssText);
168 };
169 /*
170 * Process styles to convert native ShadowDOM rules that will trip
171 * up the css parser; we rely on decorating the stylesheet with inert rules.
172 *
173 * For example, we convert this rule:
174 *
175 * polyfill-next-selector { content: ':host menu-item'; }
176 * ::content menu-item {
177 *
178 * to this:
179 *
180 * scopeName menu-item {
181 *
182 **/
183 ShadowCss.prototype._insertPolyfillDirectivesInCssText = function (cssText) {
184 // Difference with webcomponents.js: does not handle comments
185 return cssText.replace(_cssContentNextSelectorRe, function () {
186 var m = [];
187 for (var _i = 0; _i < arguments.length; _i++) {
188 m[_i] = arguments[_i];
189 }
190 return m[2] + '{';
191 });
192 };
193 /*
194 * Process styles to add rules which will only apply under the polyfill
195 *
196 * For example, we convert this rule:
197 *
198 * polyfill-rule {
199 * content: ':host menu-item';
200 * ...
201 * }
202 *
203 * to this:
204 *
205 * scopeName menu-item {...}
206 *
207 **/
208 ShadowCss.prototype._insertPolyfillRulesInCssText = function (cssText) {
209 // Difference with webcomponents.js: does not handle comments
210 return cssText.replace(_cssContentRuleRe, function () {
211 var m = [];
212 for (var _i = 0; _i < arguments.length; _i++) {
213 m[_i] = arguments[_i];
214 }
215 var rule = m[0].replace(m[1], '').replace(m[2], '');
216 return m[4] + rule;
217 });
218 };
219 /* Ensure styles are scoped. Pseudo-scoping takes a rule like:
220 *
221 * .foo {... }
222 *
223 * and converts this to
224 *
225 * scopeName .foo { ... }
226 */
227 ShadowCss.prototype._scopeCssText = function (cssText, scopeSelector, hostSelector) {
228 var unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
229 // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively
230 cssText = this._insertPolyfillHostInCssText(cssText);
231 cssText = this._convertColonHost(cssText);
232 cssText = this._convertColonHostContext(cssText);
233 cssText = this._convertShadowDOMSelectors(cssText);
234 if (scopeSelector) {
235 cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
236 }
237 cssText = cssText + '\n' + unscopedRules;
238 return cssText.trim();
239 };
240 /*
241 * Process styles to add rules which will only apply under the polyfill
242 * and do not process via CSSOM. (CSSOM is destructive to rules on rare
243 * occasions, e.g. -webkit-calc on Safari.)
244 * For example, we convert this rule:
245 *
246 * @polyfill-unscoped-rule {
247 * content: 'menu-item';
248 * ... }
249 *
250 * to this:
251 *
252 * menu-item {...}
253 *
254 **/
255 ShadowCss.prototype._extractUnscopedRulesFromCssText = function (cssText) {
256 // Difference with webcomponents.js: does not handle comments
257 var r = '';
258 var m;
259 _cssContentUnscopedRuleRe.lastIndex = 0;
260 while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) {
261 var rule = m[0].replace(m[2], '').replace(m[1], m[4]);
262 r += rule + '\n\n';
263 }
264 return r;
265 };
266 /*
267 * convert a rule like :host(.foo) > .bar { }
268 *
269 * to
270 *
271 * .foo<scopeName> > .bar
272 */
273 ShadowCss.prototype._convertColonHost = function (cssText) {
274 return cssText.replace(_cssColonHostRe, function (_, hostSelectors, otherSelectors) {
275 var e_1, _a;
276 if (hostSelectors) {
277 var convertedSelectors = [];
278 var hostSelectorArray = hostSelectors.split(',').map(function (p) { return p.trim(); });
279 try {
280 for (var hostSelectorArray_1 = tslib_1.__values(hostSelectorArray), hostSelectorArray_1_1 = hostSelectorArray_1.next(); !hostSelectorArray_1_1.done; hostSelectorArray_1_1 = hostSelectorArray_1.next()) {
281 var hostSelector = hostSelectorArray_1_1.value;
282 if (!hostSelector)
283 break;
284 var convertedSelector = _polyfillHostNoCombinator + hostSelector.replace(_polyfillHost, '') + otherSelectors;
285 convertedSelectors.push(convertedSelector);
286 }
287 }
288 catch (e_1_1) { e_1 = { error: e_1_1 }; }
289 finally {
290 try {
291 if (hostSelectorArray_1_1 && !hostSelectorArray_1_1.done && (_a = hostSelectorArray_1.return)) _a.call(hostSelectorArray_1);
292 }
293 finally { if (e_1) throw e_1.error; }
294 }
295 return convertedSelectors.join(',');
296 }
297 else {
298 return _polyfillHostNoCombinator + otherSelectors;
299 }
300 });
301 };
302 /*
303 * convert a rule like :host-context(.foo) > .bar { }
304 *
305 * to
306 *
307 * .foo<scopeName> > .bar, .foo <scopeName> > .bar { }
308 *
309 * and
310 *
311 * :host-context(.foo:host) .bar { ... }
312 *
313 * to
314 *
315 * .foo<scopeName> .bar { ... }
316 */
317 ShadowCss.prototype._convertColonHostContext = function (cssText) {
318 return cssText.replace(_cssColonHostContextReGlobal, function (selectorText) {
319 // We have captured a selector that contains a `:host-context` rule.
320 var _a;
321 // For backward compatibility `:host-context` may contain a comma separated list of selectors.
322 // Each context selector group will contain a list of host-context selectors that must match
323 // an ancestor of the host.
324 // (Normally `contextSelectorGroups` will only contain a single array of context selectors.)
325 var contextSelectorGroups = [[]];
326 // There may be more than `:host-context` in this selector so `selectorText` could look like:
327 // `:host-context(.one):host-context(.two)`.
328 // Execute `_cssColonHostContextRe` over and over until we have extracted all the
329 // `:host-context` selectors from this selector.
330 var match;
331 while (match = _cssColonHostContextRe.exec(selectorText)) {
332 // `match` = [':host-context(<selectors>)<rest>', <selectors>, <rest>]
333 // The `<selectors>` could actually be a comma separated list: `:host-context(.one, .two)`.
334 var newContextSelectors = ((_a = match[1]) !== null && _a !== void 0 ? _a : '').trim().split(',').map(function (m) { return m.trim(); }).filter(function (m) { return m !== ''; });
335 // We must duplicate the current selector group for each of these new selectors.
336 // For example if the current groups are:
337 // ```
338 // [
339 // ['a', 'b', 'c'],
340 // ['x', 'y', 'z'],
341 // ]
342 // ```
343 // And we have a new set of comma separated selectors: `:host-context(m,n)` then the new
344 // groups are:
345 // ```
346 // [
347 // ['a', 'b', 'c', 'm'],
348 // ['x', 'y', 'z', 'm'],
349 // ['a', 'b', 'c', 'n'],
350 // ['x', 'y', 'z', 'n'],
351 // ]
352 // ```
353 var contextSelectorGroupsLength = contextSelectorGroups.length;
354 repeatGroups(contextSelectorGroups, newContextSelectors.length);
355 for (var i = 0; i < newContextSelectors.length; i++) {
356 for (var j = 0; j < contextSelectorGroupsLength; j++) {
357 contextSelectorGroups[j + (i * contextSelectorGroupsLength)].push(newContextSelectors[i]);
358 }
359 }
360 // Update the `selectorText` and see repeat to see if there are more `:host-context`s.
361 selectorText = match[2];
362 }
363 // The context selectors now must be combined with each other to capture all the possible
364 // selectors that `:host-context` can match. See `combineHostContextSelectors()` for more
365 // info about how this is done.
366 return contextSelectorGroups
367 .map(function (contextSelectors) { return combineHostContextSelectors(contextSelectors, selectorText); })
368 .join(', ');
369 });
370 };
371 /*
372 * Convert combinators like ::shadow and pseudo-elements like ::content
373 * by replacing with space.
374 */
375 ShadowCss.prototype._convertShadowDOMSelectors = function (cssText) {
376 return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText);
377 };
378 // change a selector like 'div' to 'name div'
379 ShadowCss.prototype._scopeSelectors = function (cssText, scopeSelector, hostSelector) {
380 var _this = this;
381 return processRules(cssText, function (rule) {
382 var selector = rule.selector;
383 var content = rule.content;
384 if (rule.selector[0] !== '@') {
385 selector =
386 _this._scopeSelector(rule.selector, scopeSelector, hostSelector, _this.strictStyling);
387 }
388 else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
389 rule.selector.startsWith('@document')) {
390 content = _this._scopeSelectors(rule.content, scopeSelector, hostSelector);
391 }
392 else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
393 content = _this._stripScopingSelectors(rule.content);
394 }
395 return new CssRule(selector, content);
396 });
397 };
398 /**
399 * Handle a css text that is within a rule that should not contain scope selectors by simply
400 * removing them! An example of such a rule is `@font-face`.
401 *
402 * `@font-face` rules cannot contain nested selectors. Nor can they be nested under a selector.
403 * Normally this would be a syntax error by the author of the styles. But in some rare cases, such
404 * as importing styles from a library, and applying `:host ::ng-deep` to the imported styles, we
405 * can end up with broken css if the imported styles happen to contain @font-face rules.
406 *
407 * For example:
408 *
409 * ```
410 * :host ::ng-deep {
411 * import 'some/lib/containing/font-face';
412 * }
413 *
414 * Similar logic applies to `@page` rules which can contain a particular set of properties,
415 * as well as some specific at-rules. Since they can't be encapsulated, we have to strip
416 * any scoping selectors from them. For more information: https://www.w3.org/TR/css-page-3
417 * ```
418 */
419 ShadowCss.prototype._stripScopingSelectors = function (cssText) {
420 return processRules(cssText, function (rule) {
421 var selector = rule.selector.replace(_shadowDeepSelectors, ' ')
422 .replace(_polyfillHostNoCombinatorRe, ' ');
423 return new CssRule(selector, rule.content);
424 });
425 };
426 ShadowCss.prototype._scopeSelector = function (selector, scopeSelector, hostSelector, strict) {
427 var _this = this;
428 return selector.split(',')
429 .map(function (part) { return part.trim().split(_shadowDeepSelectors); })
430 .map(function (deepParts) {
431 var _a = tslib_1.__read(deepParts), shallowPart = _a[0], otherParts = _a.slice(1);
432 var applyScope = function (shallowPart) {
433 if (_this._selectorNeedsScoping(shallowPart, scopeSelector)) {
434 return strict ?
435 _this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) :
436 _this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
437 }
438 else {
439 return shallowPart;
440 }
441 };
442 return tslib_1.__spreadArray([applyScope(shallowPart)], tslib_1.__read(otherParts)).join(' ');
443 })
444 .join(', ');
445 };
446 ShadowCss.prototype._selectorNeedsScoping = function (selector, scopeSelector) {
447 var re = this._makeScopeMatcher(scopeSelector);
448 return !re.test(selector);
449 };
450 ShadowCss.prototype._makeScopeMatcher = function (scopeSelector) {
451 var lre = /\[/g;
452 var rre = /\]/g;
453 scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
454 return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
455 };
456 ShadowCss.prototype._applySelectorScope = function (selector, scopeSelector, hostSelector) {
457 // Difference from webcomponents.js: scopeSelector could not be an array
458 return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
459 };
460 // scope via name and [is=name]
461 ShadowCss.prototype._applySimpleSelectorScope = function (selector, scopeSelector, hostSelector) {
462 // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
463 _polyfillHostRe.lastIndex = 0;
464 if (_polyfillHostRe.test(selector)) {
465 var replaceBy_1 = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector;
466 return selector
467 .replace(_polyfillHostNoCombinatorRe, function (hnc, selector) {
468 return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) {
469 return before + replaceBy_1 + colon + after;
470 });
471 })
472 .replace(_polyfillHostRe, replaceBy_1 + ' ');
473 }
474 return scopeSelector + ' ' + selector;
475 };
476 // return a selector with [name] suffix on each simple selector
477 // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
478 ShadowCss.prototype._applyStrictSelectorScope = function (selector, scopeSelector, hostSelector) {
479 var _this = this;
480 var isRe = /\[is=([^\]]*)\]/g;
481 scopeSelector = scopeSelector.replace(isRe, function (_) {
482 var parts = [];
483 for (var _i = 1; _i < arguments.length; _i++) {
484 parts[_i - 1] = arguments[_i];
485 }
486 return parts[0];
487 });
488 var attrName = '[' + scopeSelector + ']';
489 var _scopeSelectorPart = function (p) {
490 var scopedP = p.trim();
491 if (!scopedP) {
492 return '';
493 }
494 if (p.indexOf(_polyfillHostNoCombinator) > -1) {
495 scopedP = _this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
496 }
497 else {
498 // remove :host since it should be unnecessary
499 var t = p.replace(_polyfillHostRe, '');
500 if (t.length > 0) {
501 var matches = t.match(/([^:]*)(:*)(.*)/);
502 if (matches) {
503 scopedP = matches[1] + attrName + matches[2] + matches[3];
504 }
505 }
506 }
507 return scopedP;
508 };
509 var safeContent = new SafeSelector(selector);
510 selector = safeContent.content();
511 var scopedSelector = '';
512 var startIndex = 0;
513 var res;
514 var sep = /( |>|\+|~(?!=))\s*/g;
515 // If a selector appears before :host it should not be shimmed as it
516 // matches on ancestor elements and not on elements in the host's shadow
517 // `:host-context(div)` is transformed to
518 // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
519 // the `div` is not part of the component in the 2nd selectors and should not be scoped.
520 // Historically `component-tag:host` was matching the component so we also want to preserve
521 // this behavior to avoid breaking legacy apps (it should not match).
522 // The behavior should be:
523 // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
524 // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
525 // `:host-context(tag)`)
526 var hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
527 // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
528 var shouldScope = !hasHost;
529 while ((res = sep.exec(selector)) !== null) {
530 var separator = res[1];
531 var part_1 = selector.slice(startIndex, res.index).trim();
532 shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1;
533 var scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1;
534 scopedSelector += scopedPart + " " + separator + " ";
535 startIndex = sep.lastIndex;
536 }
537 var part = selector.substring(startIndex);
538 shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
539 scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
540 // replace the placeholders with their original values
541 return safeContent.restore(scopedSelector);
542 };
543 ShadowCss.prototype._insertPolyfillHostInCssText = function (selector) {
544 return selector.replace(_colonHostContextRe, _polyfillHostContext)
545 .replace(_colonHostRe, _polyfillHost);
546 };
547 return ShadowCss;
548 }());
549 exports.ShadowCss = ShadowCss;
550 var SafeSelector = /** @class */ (function () {
551 function SafeSelector(selector) {
552 var _this = this;
553 this.placeholders = [];
554 this.index = 0;
555 // Replaces attribute selectors with placeholders.
556 // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
557 selector = this._escapeRegexMatches(selector, /(\[[^\]]*\])/g);
558 // CSS allows for certain special characters to be used in selectors if they're escaped.
559 // E.g. `.foo:blue` won't match a class called `foo:blue`, because the colon denotes a
560 // pseudo-class, but writing `.foo\:blue` will match, because the colon was escaped.
561 // Replace all escape sequences (`\` followed by a character) with a placeholder so
562 // that our handling of pseudo-selectors doesn't mess with them.
563 selector = this._escapeRegexMatches(selector, /(\\.)/g);
564 // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
565 // WS and "+" would otherwise be interpreted as selector separators.
566 this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) {
567 var replaceBy = "__ph-" + _this.index + "__";
568 _this.placeholders.push(exp);
569 _this.index++;
570 return pseudo + replaceBy;
571 });
572 }
573 SafeSelector.prototype.restore = function (content) {
574 var _this = this;
575 return content.replace(/__ph-(\d+)__/g, function (_ph, index) { return _this.placeholders[+index]; });
576 };
577 SafeSelector.prototype.content = function () {
578 return this._content;
579 };
580 /**
581 * Replaces all of the substrings that match a regex within a
582 * special string (e.g. `__ph-0__`, `__ph-1__`, etc).
583 */
584 SafeSelector.prototype._escapeRegexMatches = function (content, pattern) {
585 var _this = this;
586 return content.replace(pattern, function (_, keep) {
587 var replaceBy = "__ph-" + _this.index + "__";
588 _this.placeholders.push(keep);
589 _this.index++;
590 return replaceBy;
591 });
592 };
593 return SafeSelector;
594 }());
595 var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
596 var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
597 var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
598 var _polyfillHost = '-shadowcsshost';
599 // note: :host-context pre-processed to -shadowcsshostcontext.
600 var _polyfillHostContext = '-shadowcsscontext';
601 var _parenSuffix = '(?:\\((' +
602 '(?:\\([^)(]*\\)|[^)(]*)+?' +
603 ')\\))?([^,{]*)';
604 var _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, 'gim');
605 var _cssColonHostContextReGlobal = new RegExp(_polyfillHostContext + _parenSuffix, 'gim');
606 var _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, 'im');
607 var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
608 var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
609 var _shadowDOMSelectorsRe = [
610 /::shadow/g,
611 /::content/g,
612 // Deprecated selectors
613 /\/shadow-deep\//g,
614 /\/shadow\//g,
615 ];
616 // The deep combinator is deprecated in the CSS spec
617 // Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future.
618 // see https://github.com/angular/angular/pull/17677
619 var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g;
620 var _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
621 var _polyfillHostRe = /-shadowcsshost/gim;
622 var _colonHostRe = /:host/gim;
623 var _colonHostContextRe = /:host-context/gim;
624 var _commentRe = /\/\*[\s\S]*?\*\//g;
625 function stripComments(input) {
626 return input.replace(_commentRe, '');
627 }
628 var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
629 function extractCommentsWithHash(input) {
630 return input.match(_commentWithHashRe) || [];
631 }
632 var BLOCK_PLACEHOLDER = '%BLOCK%';
633 var QUOTE_PLACEHOLDER = '%QUOTED%';
634 var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
635 var _quotedRe = /%QUOTED%/g;
636 var CONTENT_PAIRS = new Map([['{', '}']]);
637 var QUOTE_PAIRS = new Map([["\"", "\""], ["'", "'"]]);
638 var CssRule = /** @class */ (function () {
639 function CssRule(selector, content) {
640 this.selector = selector;
641 this.content = content;
642 }
643 return CssRule;
644 }());
645 exports.CssRule = CssRule;
646 function processRules(input, ruleCallback) {
647 var inputWithEscapedQuotes = escapeBlocks(input, QUOTE_PAIRS, QUOTE_PLACEHOLDER);
648 var inputWithEscapedBlocks = escapeBlocks(inputWithEscapedQuotes.escapedString, CONTENT_PAIRS, BLOCK_PLACEHOLDER);
649 var nextBlockIndex = 0;
650 var nextQuoteIndex = 0;
651 return inputWithEscapedBlocks.escapedString
652 .replace(_ruleRe, function () {
653 var m = [];
654 for (var _i = 0; _i < arguments.length; _i++) {
655 m[_i] = arguments[_i];
656 }
657 var selector = m[2];
658 var content = '';
659 var suffix = m[4];
660 var contentPrefix = '';
661 if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
662 content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
663 suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
664 contentPrefix = '{';
665 }
666 var rule = ruleCallback(new CssRule(selector, content));
667 return "" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix;
668 })
669 .replace(_quotedRe, function () { return inputWithEscapedQuotes.blocks[nextQuoteIndex++]; });
670 }
671 exports.processRules = processRules;
672 var StringWithEscapedBlocks = /** @class */ (function () {
673 function StringWithEscapedBlocks(escapedString, blocks) {
674 this.escapedString = escapedString;
675 this.blocks = blocks;
676 }
677 return StringWithEscapedBlocks;
678 }());
679 function escapeBlocks(input, charPairs, placeholder) {
680 var resultParts = [];
681 var escapedBlocks = [];
682 var openCharCount = 0;
683 var nonBlockStartIndex = 0;
684 var blockStartIndex = -1;
685 var openChar;
686 var closeChar;
687 for (var i = 0; i < input.length; i++) {
688 var char = input[i];
689 if (char === '\\') {
690 i++;
691 }
692 else if (char === closeChar) {
693 openCharCount--;
694 if (openCharCount === 0) {
695 escapedBlocks.push(input.substring(blockStartIndex, i));
696 resultParts.push(placeholder);
697 nonBlockStartIndex = i;
698 blockStartIndex = -1;
699 openChar = closeChar = undefined;
700 }
701 }
702 else if (char === openChar) {
703 openCharCount++;
704 }
705 else if (openCharCount === 0 && charPairs.has(char)) {
706 openChar = char;
707 closeChar = charPairs.get(char);
708 openCharCount = 1;
709 blockStartIndex = i + 1;
710 resultParts.push(input.substring(nonBlockStartIndex, blockStartIndex));
711 }
712 }
713 if (blockStartIndex !== -1) {
714 escapedBlocks.push(input.substring(blockStartIndex));
715 resultParts.push(placeholder);
716 }
717 else {
718 resultParts.push(input.substring(nonBlockStartIndex));
719 }
720 return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
721 }
722 /**
723 * Combine the `contextSelectors` with the `hostMarker` and the `otherSelectors`
724 * to create a selector that matches the same as `:host-context()`.
725 *
726 * Given a single context selector `A` we need to output selectors that match on the host and as an
727 * ancestor of the host:
728 *
729 * ```
730 * A <hostMarker>, A<hostMarker> {}
731 * ```
732 *
733 * When there is more than one context selector we also have to create combinations of those
734 * selectors with each other. For example if there are `A` and `B` selectors the output is:
735 *
736 * ```
737 * AB<hostMarker>, AB <hostMarker>, A B<hostMarker>,
738 * B A<hostMarker>, A B <hostMarker>, B A <hostMarker> {}
739 * ```
740 *
741 * And so on...
742 *
743 * @param hostMarker the string that selects the host element.
744 * @param contextSelectors an array of context selectors that will be combined.
745 * @param otherSelectors the rest of the selectors that are not context selectors.
746 */
747 function combineHostContextSelectors(contextSelectors, otherSelectors) {
748 var hostMarker = _polyfillHostNoCombinator;
749 _polyfillHostRe.lastIndex = 0; // reset the regex to ensure we get an accurate test
750 var otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors);
751 // If there are no context selectors then just output a host marker
752 if (contextSelectors.length === 0) {
753 return hostMarker + otherSelectors;
754 }
755 var combined = [contextSelectors.pop() || ''];
756 while (contextSelectors.length > 0) {
757 var length_1 = combined.length;
758 var contextSelector = contextSelectors.pop();
759 for (var i = 0; i < length_1; i++) {
760 var previousSelectors = combined[i];
761 // Add the new selector as a descendant of the previous selectors
762 combined[length_1 * 2 + i] = previousSelectors + ' ' + contextSelector;
763 // Add the new selector as an ancestor of the previous selectors
764 combined[length_1 + i] = contextSelector + ' ' + previousSelectors;
765 // Add the new selector to act on the same element as the previous selectors
766 combined[i] = contextSelector + previousSelectors;
767 }
768 }
769 // Finally connect the selector to the `hostMarker`s: either acting directly on the host
770 // (A<hostMarker>) or as an ancestor (A <hostMarker>).
771 return combined
772 .map(function (s) { return otherSelectorsHasHost ?
773 "" + s + otherSelectors :
774 "" + s + hostMarker + otherSelectors + ", " + s + " " + hostMarker + otherSelectors; })
775 .join(',');
776 }
777 /**
778 * Mutate the given `groups` array so that there are `multiples` clones of the original array
779 * stored.
780 *
781 * For example `repeatGroups([a, b], 3)` will result in `[a, b, a, b, a, b]` - but importantly the
782 * newly added groups will be clones of the original.
783 *
784 * @param groups An array of groups of strings that will be repeated. This array is mutated
785 * in-place.
786 * @param multiples The number of times the current groups should appear.
787 */
788 function repeatGroups(groups, multiples) {
789 var length = groups.length;
790 for (var i = 1; i < multiples; i++) {
791 for (var j = 0; j < length; j++) {
792 groups[j + (i * length)] = groups[j].slice(0);
793 }
794 }
795 }
796 exports.repeatGroups = repeatGroups;
797});
798//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhZG93X2Nzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9zaGFkb3dfY3NzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7SUFFSDs7Ozs7Ozs7O09BU0c7SUFFSDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7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LCAudHdvKWAuXG4gICAgICAgIGNvbnN0IG5ld0NvbnRleHRTZWxlY3RvcnMgPVxuICAgICAgICAgICAgKG1hdGNoWzFdID8/ICcnKS50cmltKCkuc3BsaXQoJywnKS5tYXAobSA9PiBtLnRyaW0oKSkuZmlsdGVyKG0gPT4gbSAhPT0gJycpO1xuXG4gICAgICAgIC8vIFdlIG11c3QgZHVwbGljYXRlIHRoZSBjdXJyZW50IHNlbGVjdG9yIGdyb3VwIGZvciBlYWNoIG9mIHRoZXNlIG5ldyBzZWxlY3RvcnMuXG4gICAgICAgIC8vIEZvciBleGFtcGxlIGlmIHRoZSBjdXJyZW50IGdyb3VwcyBhcmU6XG4gICAgICAgIC8vIGBgYFxuICAgICAgICAvLyBbXG4gICAgICAgIC8vICAgWydhJywgJ2InLCAnYyddLFxuICAgICAgICAvLyAgIFsneCcsICd5JywgJ3onXSxcbiAgICAgICAgLy8gXVxuICAgICAgICAvLyBgYGBcbiAgICAgICAgLy8gQW5kIHdlIGhhdmUgYSBuZXcgc2V0IG9mIGNvbW1hIHNlcGFyYXRlZCBzZWxlY3RvcnM6IGA6aG9zdC1jb250ZXh0KG0sbilgIHRoZW4gdGhlIG5ld1xuICAgICAgICAvLyBncm91cHMgYXJlOlxuICAgICAgICAvLyBgYGBcbiAgICAgICAgLy8gW1xuICAgICAgICAvLyAgIFsnYScsICdiJywgJ2MnLCAnbSddLFxuICAgICAgICAvLyAgIFsneCcsICd5JywgJ3onLCAnbSddLFxuICAgICAgICAvLyAgIFsnYScsICdiJywgJ2MnLCAnbiddLFxuICAgICAgICAvLyAgIFsneCcsICd5JywgJ3onLCAnbiddLFxuICAgICAgICAvLyBdXG4gICAgICAgIC8vIGBgYFxuICAgICAgICBjb25zdCBjb250ZXh0U2VsZWN0b3JHcm91cHNMZW5ndGggPSBjb250ZXh0U2VsZWN0b3JHcm91cHMubGVuZ3RoO1xuICAgICAgICByZXBlYXRHcm91cHMoY29udGV4dFNlbGVjdG9yR3JvdXBzLCBu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hvc3RTZWxlY3Rvcik7XG4gIH1cblxuICAvLyBzY29wZSB2aWEgbmFtZSBhbmQgW2lzPW5hbWVdXG4gIHByaXZhdGUgX2FwcGx5U2ltcGxlU2VsZWN0b3JTY29wZShzZWxlY3Rvcjogc3RyaW5nLCBzY29wZVNlbGVjdG9yOiBzdHJpbmcsIGhvc3RTZWxlY3Rvcjogc3RyaW5nKTpcbiAgICAgIHN0cmluZyB7XG4gICAgLy8gSW4gQW5kcm9pZCBicm93c2VyLCB0aGUgbGFzdEluZGV4IGlzIG5vdCByZXNldCB3aGVuIHRoZSByZWdleCBpcyB1c2VkIGluIFN0cmluZy5yZXBsYWNlKClcbiAgICBfcG9seWZpbGxIb3N0UmUubGFzdEluZGV4ID0gMDtcbiAgICBpZiAoX3BvbHlmaWxsSG9zdFJlLnRlc3Qoc2VsZWN0b3IpKSB7XG4gICAgICBjb25zdCByZXBsYWNlQnkgPSB0aGlzLnN0cmljdFN0eWxpbmcgPyBgWyR7aG9zdFNlbGVjdG9yfV1gIDogc2NvcGVTZWxlY3RvcjtcbiAgICAgIHJldHVybiBzZWxlY3RvclxuICAgICAgICAgIC5yZXBsYWNlKFxuICAgICAgICAgICAgICBfcG9seWZpbGxIb3N0Tm9Db21iaW5hdG9yUmUsXG4gICAgICAgICAgICAgIChobmMsIHNlbGVjdG9yKSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNlbGVjdG9yLnJlcGxhY2UoXG4gICAgICAgICAgICAgICAgICAgIC8oW146XSopKDoqKSguKikvLFxuICAgICAgICAgICAgICAgICAgICAoXzogc3RyaW5nLCBiZWZvcmU6IHN0cmluZywgY29sb246IHN0cmluZywgYWZ0ZXI6IHN0cmluZykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiZWZvcmUgKyByZXBsYWNlQnkgKyBjb2xvbiArIGFmdGVyO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAucmVw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iZSBjbG9uZXMgb2YgdGhlIG9yaWdpbmFsLlxuICpcbiAqIEBwYXJhbSBncm91cHMgQW4gYXJyYXkgb2YgZ3JvdXBzIG9mIHN0cmluZ3MgdGhhdCB3aWxsIGJlIHJlcGVhdGVkLiBUaGlzIGFycmF5IGlzIG11dGF0ZWRcbiAqICAgICBpbi1wbGFjZS5cbiAqIEBwYXJhbSBtdWx0aXBsZXMgVGhlIG51bWJlciBvZiB0aW1lcyB0aGUgY3VycmVudCBncm91cHMgc2hvdWxkIGFwcGVhci5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHJlcGVhdEdyb3Vwcyhncm91cHM6IHN0cmluZ1tdW10sIG11bHRpcGxlczogbnVtYmVyKTogdm9pZCB7XG4gIGNvbnN0IGxlbmd0aCA9IGdyb3Vwcy5sZW5ndGg7XG4gIGZvciAobGV0IGkgPSAxOyBpIDwgbXVsdGlwbGVzOyBpKyspIHtcbiAgICBmb3IgKGxldCBqID0gMDsgaiA8IGxlbmd0aDsgaisrKSB7XG4gICAgICBncm91cHNbaiArIChpICogbGVuZ3RoKV0gPSBncm91cHNbal0uc2xpY2UoMCk7XG4gICAgfVxuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.