From 47de50b75924326c63c1308544f883631c84742f Mon Sep 17 00:00:00 2001 From: Monica Dinculescu Date: Wed, 11 Jan 2017 15:51:16 -0800 Subject: [PATCH] even chrome still needs shadycss for now --- entrypoints/webcomponents-hi-ce-index.js | 2 + entrypoints/webcomponents-hi-ce-sd-index.js | 2 +- .../webcomponents-hi-ce-sd-pf-index.js | 2 +- entrypoints/webcomponents-hi-index.js | 2 + entrypoints/webcomponents-none-index.js | 23 + gulpfile.js | 26 +- webcomponents-none.min.js | 2293 +++++++++++++++++ webcomponents-none.min.js.map | 1 + 8 files changed, 2344 insertions(+), 7 deletions(-) create mode 100644 entrypoints/webcomponents-none-index.js create mode 100644 webcomponents-none.min.js create mode 100644 webcomponents-none.min.js.map diff --git a/entrypoints/webcomponents-hi-ce-index.js b/entrypoints/webcomponents-hi-ce-index.js index 59d0109..df037df 100644 --- a/entrypoints/webcomponents-hi-ce-index.js +++ b/entrypoints/webcomponents-hi-ce-index.js @@ -17,5 +17,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN import '../bower_components/html-imports/src/html-imports.js' import '../src/pre-polyfill.js' import '../bower_components/custom-elements/custom-elements.min.js' +//TODO(notwaldorf): this is temporary and should be removed. +import '../bower_components/shadycss/src/ShadyCSS.js' import '../src/post-polyfill.js' import '../src/unresolved.js' diff --git a/entrypoints/webcomponents-hi-ce-sd-index.js b/entrypoints/webcomponents-hi-ce-sd-index.js index 37719f2..7210d53 100644 --- a/entrypoints/webcomponents-hi-ce-sd-index.js +++ b/entrypoints/webcomponents-hi-ce-sd-index.js @@ -18,6 +18,6 @@ import '../bower_components/html-imports/src/html-imports.js' import '../src/pre-polyfill.js' import '../bower_components/custom-elements/custom-elements.min.js' import '../bower_components/shadydom/shadydom.min.js' -import '../bower_components/shadycss/shadycss.min.js' +import '../bower_components/shadycss/src/ShadyCSS.js' import '../src/post-polyfill.js' import '../src/unresolved.js' diff --git a/entrypoints/webcomponents-hi-ce-sd-pf-index.js b/entrypoints/webcomponents-hi-ce-sd-pf-index.js index 82d573b..17e391a 100644 --- a/entrypoints/webcomponents-hi-ce-sd-pf-index.js +++ b/entrypoints/webcomponents-hi-ce-sd-pf-index.js @@ -22,6 +22,6 @@ import '../bower_components/es6-promise/dist/es6-promise.auto.min.js' import '../src/pre-polyfill.js' import '../bower_components/custom-elements/custom-elements.min.js' import '../bower_components/shadydom/shadydom.min.js' -import '../bower_components/shadycss/shadycss.min.js' +import '../bower_components/shadycss/src/ShadyCSS.js' import '../src/post-polyfill.js' import '../src/unresolved.js' diff --git a/entrypoints/webcomponents-hi-index.js b/entrypoints/webcomponents-hi-index.js index 3cbf201..89a0fcd 100644 --- a/entrypoints/webcomponents-hi-index.js +++ b/entrypoints/webcomponents-hi-index.js @@ -16,5 +16,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN import '../bower_components/html-imports/src/html-imports.js' import '../src/pre-polyfill.js' +//TODO(notwaldorf): this is temporary and should be removed. +import '../bower_components/shadycss/src/ShadyCSS.js' import '../src/post-polyfill.js' import '../src/unresolved.js' diff --git a/entrypoints/webcomponents-none-index.js b/entrypoints/webcomponents-none-index.js new file mode 100644 index 0000000..46459bc --- /dev/null +++ b/entrypoints/webcomponents-none-index.js @@ -0,0 +1,23 @@ +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ +'use strict'; + +/* + * Polyfills loaded: None + * Used in: Chrome + */ + +// TODO: This needs to not exist at all. + +import '../src/pre-polyfill.js' +//TODO(notwaldorf): this is temporary and should be removed. +import '../bower_components/shadycss/src/ShadyCSS.js' +import '../src/post-polyfill.js' +import '../src/unresolved.js' diff --git a/gulpfile.js b/gulpfile.js index 039c04c..cc0eb59 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -36,6 +36,22 @@ const babiliConfig = { shouldPrintComment: singleLicenseComment() }; +gulp.task('minify-none', () => { + return rollup({ + entry: './entrypoints/webcomponents-none-index.js', + format: 'iife', + moduleName: 'webcomponentsjs', + sourceMap: true + }) + .pipe(source('webcomponents-none-index.js')) + .pipe(buffer()) + .pipe(sourcemaps.init({loadMaps: true})) + // .pipe(babel(babiliConfig)) + .pipe(rename('webcomponents-none.min.js')) + .pipe(sourcemaps.write('.')) + .pipe(gulp.dest('./')) +}); + gulp.task('minify-hi', () => { return rollup({ entry: './entrypoints/webcomponents-hi-index.js', @@ -46,7 +62,7 @@ gulp.task('minify-hi', () => { .pipe(source('webcomponents-hi-index.js')) .pipe(buffer()) .pipe(sourcemaps.init({loadMaps: true})) - .pipe(babel(babiliConfig)) + // .pipe(babel(babiliConfig)) .pipe(rename('webcomponents-hi.min.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./')) @@ -62,7 +78,7 @@ gulp.task('minify-hi-ce', () => { .pipe(source('webcomponents-hi-ce-index.js')) .pipe(buffer()) .pipe(sourcemaps.init({loadMaps: true})) - .pipe(babel(babiliConfig)) + // .pipe(babel(babiliConfig)) .pipe(rename('webcomponents-hi-ce.min.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./')) @@ -78,7 +94,7 @@ gulp.task('minify-hi-ce-sd', () => { .pipe(source('webcomponents-hi-ce-sd-index.js')) .pipe(buffer()) .pipe(sourcemaps.init({loadMaps: true})) - .pipe(babel(babiliConfig)) + // .pipe(babel(babiliConfig)) .pipe(rename('webcomponents-hi-ce-sd.min.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./')) @@ -94,10 +110,10 @@ gulp.task('minify-hi-ce-sd-pf', () => { .pipe(source('webcomponents-hi-ce-sd-pf-index.js')) .pipe(buffer()) .pipe(sourcemaps.init({loadMaps: true})) - .pipe(babel(babiliConfig)) + // .pipe(babel(babiliConfig)) .pipe(rename('webcomponents-hi-ce-sd-pf.min.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./')) }); -gulp.task('default', ['minify-hi', 'minify-hi-ce', 'minify-hi-ce-sd', 'minify-hi-ce-sd-pf']); +gulp.task('default', ['minify-none', 'minify-hi', 'minify-hi-ce', 'minify-hi-ce-sd', 'minify-hi-ce-sd-pf']); diff --git a/webcomponents-none.min.js b/webcomponents-none.min.js new file mode 100644 index 0000000..73f40e2 --- /dev/null +++ b/webcomponents-none.min.js @@ -0,0 +1,2293 @@ +(function () { +'use strict'; + +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ + +(function(scope) { + + 'use strict'; + + var forceShady = scope.flags.shadydom; + if (forceShady) { + window.ShadyDOM = window.ShadyDOM || {}; + ShadyDOM.force = forceShady; + } + + var forceCE = scope.flags.register || scope.flags.ce; + if (forceCE && window.customElements) { + customElements.forcePolyfill = forceCE; + } + +})(window.WebComponents); + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +/* +Extremely simple css parser. Intended to be not more than what we need +and definitely not necessarily correct =). +*/ + +// given a string of css, return a simple rule tree +function parse(text) { + text = clean(text); + return parseCss(lex(text), text); +} + +// remove stuff we don't care about that may hinder parsing +function clean(cssText) { + return cssText.replace(RX.comments, '').replace(RX.port, ''); +} + +// super simple {...} lexer that returns a node tree +function lex(text) { + let root = { + start: 0, + end: text.length + }; + let n = root; + for (let i = 0, l = text.length; i < l; i++) { + if (text[i] === OPEN_BRACE) { + if (!n.rules) { + n.rules = []; + } + let p = n; + let previous = p.rules[p.rules.length - 1]; + n = { + start: i + 1, + parent: p, + previous: previous + }; + p.rules.push(n); + } else if (text[i] === CLOSE_BRACE) { + n.end = i + 1; + n = n.parent || root; + } + } + return root; +} + +// add selectors/cssText to node tree +function parseCss(node, text) { + let t = text.substring(node.start, node.end - 1); + node.parsedCssText = node.cssText = t.trim(); + if (node.parent) { + let ss = node.previous ? node.previous.end : node.parent.start; + t = text.substring(ss, node.start - 1); + t = _expandUnicodeEscapes(t); + t = t.replace(RX.multipleSpaces, ' '); + // TODO(sorvell): ad hoc; make selector include only after last ; + // helps with mixin syntax + t = t.substring(t.lastIndexOf(';') + 1); + let s = node.parsedSelector = node.selector = t.trim(); + node.atRule = (s.indexOf(AT_START) === 0); + // note, support a subset of rule types... + if (node.atRule) { + if (s.indexOf(MEDIA_START) === 0) { + node.type = types.MEDIA_RULE; + } else if (s.match(RX.keyframesRule)) { + node.type = types.KEYFRAMES_RULE; + node.keyframesName = + node.selector.split(RX.multipleSpaces).pop(); + } + } else { + if (s.indexOf(VAR_START) === 0) { + node.type = types.MIXIN_RULE; + } else { + node.type = types.STYLE_RULE; + } + } + } + let r$ = node.rules; + if (r$) { + for (let i = 0, l = r$.length, r; + (i < l) && (r = r$[i]); i++) { + parseCss(r, text); + } + } + return node; +} + +// conversion of sort unicode escapes with spaces like `\33 ` (and longer) into +// expanded form that doesn't require trailing space `\000033` +function _expandUnicodeEscapes(s) { + return s.replace(/\\([0-9a-f]{1,6})\s/gi, function() { + let code = arguments[1], + repeat = 6 - code.length; + while (repeat--) { + code = '0' + code; + } + return '\\' + code; + }); +} + +// stringify parsed css. +function stringify(node, preserveProperties, text) { + text = text || ''; + // calc rule cssText + let cssText = ''; + if (node.cssText || node.rules) { + let r$ = node.rules; + if (r$ && !_hasMixinRules(r$)) { + for (let i = 0, l = r$.length, r; + (i < l) && (r = r$[i]); i++) { + cssText = stringify(r, preserveProperties, cssText); + } + } else { + cssText = preserveProperties ? node.cssText : + removeCustomProps(node.cssText); + cssText = cssText.trim(); + if (cssText) { + cssText = ' ' + cssText + '\n'; + } + } + } + // emit rule if there is cssText + if (cssText) { + if (node.selector) { + text += node.selector + ' ' + OPEN_BRACE + '\n'; + } + text += cssText; + if (node.selector) { + text += CLOSE_BRACE + '\n\n'; + } + } + return text; +} + +function _hasMixinRules(rules) { + return rules[0].selector.indexOf(VAR_START) === 0; +} + +function removeCustomProps(cssText) { + cssText = removeCustomPropAssignment(cssText); + return removeCustomPropApply(cssText); +} + +function removeCustomPropAssignment(cssText) { + return cssText + .replace(RX.customProp, '') + .replace(RX.mixinProp, ''); +} + +function removeCustomPropApply(cssText) { + return cssText + .replace(RX.mixinApply, '') + .replace(RX.varApply, ''); +} + +let types = { + STYLE_RULE: 1, + KEYFRAMES_RULE: 7, + MEDIA_RULE: 4, + MIXIN_RULE: 1000 +}; + +let OPEN_BRACE = '{'; +let CLOSE_BRACE = '}'; + +// helper regexp's +let RX = { + comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, + port: /@import[^;]*;/gim, + customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim, + mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim, + mixinApply: /@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim, + varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim, + keyframesRule: /^@[^\s]*keyframes/, + multipleSpaces: /\s+/g +}; + +let VAR_START = '--'; +let MEDIA_START = '@media'; +let AT_START = '@'; + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +let nativeShadow = !(window.ShadyDOM && window.ShadyDOM.inUse); +// chrome 49 has semi-working css vars, check if box-shadow works +// safari 9.1 has a recalc bug: https://bugs.webkit.org/show_bug.cgi?id=155782 +let nativeCssVariables = (!navigator.userAgent.match('AppleWebKit/601') && +window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)')); + +// experimental support for native @apply +function detectNativeApply() { + let style = document.createElement('style'); + style.textContent = '.foo { @apply --foo }'; + document.head.appendChild(style); + let nativeCssApply = (style.sheet.cssRules[0].cssText.indexOf('apply') >= 0); + document.head.removeChild(style); + return nativeCssApply; +} + +let nativeCssApply = false && detectNativeApply(); + +function parseSettings(settings) { + if (settings) { + nativeCssVariables = nativeCssVariables && !settings.shimcssproperties; + nativeShadow = nativeShadow && !settings.shimshadow; + } +} + +if (window.ShadyCSS) { + parseSettings(window.ShadyCSS); +} else if (window.WebComponents) { + parseSettings(window.WebComponents.flags); +} + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +function toCssText (rules, callback) { + if (typeof rules === 'string') { + rules = parse(rules); + } + if (callback) { + forEachRule(rules, callback); + } + return stringify(rules, nativeCssVariables); +} + +function rulesForStyle(style) { + if (!style.__cssRules && style.textContent) { + style.__cssRules = parse(style.textContent); + } + return style.__cssRules; +} + +// Tests if a rule is a keyframes selector, which looks almost exactly +// like a normal selector but is not (it has nothing to do with scoping +// for example). +function isKeyframesSelector(rule) { + return rule.parent && + rule.parent.type === types.KEYFRAMES_RULE; +} + +function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) { + if (!node) { + return; + } + let skipRules = false; + if (onlyActiveRules) { + if (node.type === types.MEDIA_RULE) { + let matchMedia = node.selector.match(rx.MEDIA_MATCH); + if (matchMedia) { + // if rule is a non matching @media rule, skip subrules + if (!window.matchMedia(matchMedia[1]).matches) { + skipRules = true; + } + } + } + } + if (node.type === types.STYLE_RULE) { + styleRuleCallback(node); + } else if (keyframesRuleCallback && + node.type === types.KEYFRAMES_RULE) { + keyframesRuleCallback(node); + } else if (node.type === types.MIXIN_RULE) { + skipRules = true; + } + let r$ = node.rules; + if (r$ && !skipRules) { + for (let i=0, l=r$.length, r; (i+~])' +}; + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +/* Transforms ShadowDOM styling into ShadyDOM styling + +* scoping: + + * elements in scope get scoping selector class="x-foo-scope" + * selectors re-written as follows: + + div button -> div.x-foo-scope button.x-foo-scope + +* :host -> scopeName + +* :host(...) -> scopeName... + +* ::slotted(...) -> scopeName > ... + +* ...:dir(ltr|rtl) -> [dir="ltr|rtl"] ..., ...[dir="ltr|rtl"] + +* :host(:dir[rtl]) -> scopeName:dir(rtl) -> [dir="rtl"] scopeName, scopeName[dir="rtl"] + +*/ +const SCOPE_NAME = 'style-scope'; + +class StyleTransformer { + get SCOPE_NAME() { + return SCOPE_NAME; + } + // Given a node and scope name, add a scoping class to each node + // in the tree. This facilitates transforming css into scoped rules. + dom(node, scope, shouldRemoveScope) { + // one time optimization to skip scoping... + if (node.__styleScoped) { + node.__styleScoped = null; + } else { + this._transformDom(node, scope || '', shouldRemoveScope); + } + } + + _transformDom(node, selector, shouldRemoveScope) { + if (node.nodeType === Node.ELEMENT_NODE) { + this.element(node, selector, shouldRemoveScope); + } + let c$ = (node.localName === 'template') ? + (node.content || node._content).childNodes : + node.children || node.childNodes; + if (c$) { + for (let i=0; i `:${type}(${inner.replace(/\s/g, '')})`); + selector = selector.replace(SLOTTED_START, `${HOST} $1`); + selector = selector.replace(SIMPLE_SELECTOR_SEP, (m, c, s) => { + if (!stop) { + let info = this._transformCompoundSelector(s, c, scope, hostScope); + stop = stop || info.stop; + c = info.combinator; + s = info.value; + } + return c + s; + }); + return selector; + } + + _transformCompoundSelector(selector, combinator, scope, hostScope) { + // replace :host with host scoping class + let slottedIndex = selector.indexOf(SLOTTED); + if (selector.indexOf(HOST) >= 0) { + selector = this._transformHostSelector(selector, hostScope); + // replace other selectors with scoping class + } else if (slottedIndex !== 0) { + selector = scope ? this._transformSimpleSelector(selector, scope) : + selector; + } + // mark ::slotted() scope jump to replace with descendant selector + arg + // also ignore left-side combinator + let slotted = false; + if (slottedIndex >= 0) { + combinator = ''; + slotted = true; + } + // process scope jumping selectors up to the scope jump and then stop + let stop; + if (slotted) { + stop = true; + if (slotted) { + // .zonk ::slotted(.foo) -> .zonk.scope > .foo + selector = selector.replace(SLOTTED_PAREN, (m, paren) => ` > ${paren}`); + } + } + selector = selector.replace(DIR_PAREN, (m, before, dir) => + `[dir="${dir}"] ${before}, ${before}[dir="${dir}"]`); + return {value: selector, combinator, stop}; + } + + _transformSimpleSelector(selector, scope) { + let p$ = selector.split(PSEUDO_PREFIX); + p$[0] += scope; + return p$.join(PSEUDO_PREFIX); + } + + // :host(...) -> scopeName... + _transformHostSelector(selector, hostScope) { + let m = selector.match(HOST_PAREN); + let paren = m && m[2].trim() || ''; + if (paren) { + if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) { + // paren starts with a type selector + let typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0]; + // if the type selector is our hostScope then avoid pre-pending it + if (typeSelector === hostScope) { + return paren; + // otherwise, this selector should not match in this scope so + // output a bogus selector. + } else { + return SELECTOR_NO_MATCH; + } + } else { + // make sure to do a replace here to catch selectors like: + // `:host(.foo)::before` + return selector.replace(HOST_PAREN, function(m, host, paren) { + return hostScope + paren; + }); + } + // if no paren, do a straight :host replacement. + // TODO(sorvell): this should not strictly be necessary but + // it's needed to maintain support for `:host[foo]` type selectors + // which have been improperly used under Shady DOM. This should be + // deprecated. + } else { + return selector.replace(HOST, hostScope); + } + } + + documentRule(rule) { + // reset selector in case this is redone. + rule.selector = rule.parsedSelector; + this.normalizeRootSelector(rule); + this._transformRule(rule, this._transformDocumentSelector); + } + + normalizeRootSelector(rule) { + if (rule.selector === ROOT) { + rule.selector = 'html'; + } + } + + _transformDocumentSelector(selector) { + return selector.match(SLOTTED) ? + this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) : + this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR); + } +} + +let NTH = /:(nth[-\w]+)\(([^)]+)\)/; +let SCOPE_DOC_SELECTOR = `:not(.${SCOPE_NAME})`; +let COMPLEX_SELECTOR_SEP = ','; +let SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g; +let SIMPLE_SELECTOR_PREFIX = /[[.:#*]/; +let HOST = ':host'; +let ROOT = ':root'; +let SLOTTED = '::slotted'; +let SLOTTED_START = new RegExp(`^(${SLOTTED})`); +// NOTE: this supports 1 nested () pair for things like +// :host(:not([selected]), more general support requires +// parsing which seems like overkill +let HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/; +// similar to HOST_PAREN +let SLOTTED_PAREN = /(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/; +let DIR_PAREN = /(.*):dir\((?:(ltr|rtl))\)/; +let CSS_CLASS_PREFIX = '.'; +let PSEUDO_PREFIX = ':'; +let CLASS = 'class'; +let SELECTOR_NO_MATCH = 'should_not_match'; + +var StyleTransformer$1 = new StyleTransformer(); + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +var templateMap = {}; + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +const promise = Promise.resolve(); + +class StyleInfo { + static get(node) { + return node.__styleInfo; + } + static set(node, styleInfo) { + node.__styleInfo = styleInfo; + return styleInfo; + } + static invalidate(elementName) { + if (templateMap[elementName]) { + templateMap[elementName]._applyShimInvalid = true; + } + } + /* + the template is marked as `validating` for one microtask so that all instances + found in the tree crawl of `applyStyle` will update themselves, + but the template will only be updated once. + */ + static startValidating(elementName) { + const template = templateMap[elementName]; + if (!template._validating) { + template._validating = true; + promise.then(() => { + template._applyShimInvalid = false; + template._validating = false; + }); + } + } + constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtension, cssBuild) { + this.styleRules = ast || null; + this.placeholder = placeholder || null; + this.ownStylePropertyNames = ownStylePropertyNames || []; + this.overrideStyleProperties = null; + this.elementName = elementName || ''; + this.cssBuild = cssBuild || ''; + this.typeExtension = typeExtension || ''; + this.styleProperties = null; + this.scopeSelector = null; + this.customStyle = null; + } +} + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +// TODO: dedupe with shady +const p = window.Element.prototype; +const matchesSelector = p.matches || p.matchesSelector || + p.mozMatchesSelector || p.msMatchesSelector || + p.oMatchesSelector || p.webkitMatchesSelector; + +const IS_IE = navigator.userAgent.match('Trident'); + +const XSCOPE_NAME = 'x-scope'; + +class StyleProperties { + get XSCOPE_NAME() { + return XSCOPE_NAME; + } + // decorates styles with rule info and returns an array of used style + // property names + decorateStyles(rules) { + let self = this, props = {}, keyframes = [], ruleIndex = 0; + forEachRule(rules, function(rule) { + self.decorateRule(rule); + // mark in-order position of ast rule in styles block, used for cache key + rule.index = ruleIndex++; + self.collectPropertiesInCssText(rule.propertyInfo.cssText, props); + }, function onKeyframesRule(rule) { + keyframes.push(rule); + }); + // Cache all found keyframes rules for later reference: + rules._keyframes = keyframes; + // return this list of property names *consumes* in these styles. + let names = []; + for (let i in props) { + names.push(i); + } + return names; + } + + // decorate a single rule with property info + decorateRule(rule) { + if (rule.propertyInfo) { + return rule.propertyInfo; + } + let info = {}, properties = {}; + let hasProperties = this.collectProperties(rule, properties); + if (hasProperties) { + info.properties = properties; + // TODO(sorvell): workaround parser seeing mixins as additional rules + rule.rules = null; + } + info.cssText = this.collectCssText(rule); + rule.propertyInfo = info; + return info; + } + + // collects the custom properties from a rule's cssText + collectProperties(rule, properties) { + let info = rule.propertyInfo; + if (info) { + if (info.properties) { + Object.assign(properties, info.properties); + return true; + } + } else { + let m, rx$$1 = rx.VAR_ASSIGN; + let cssText = rule.parsedCssText; + let value; + let any; + while ((m = rx$$1.exec(cssText))) { + // note: group 2 is var, 3 is mixin + value = (m[2] || m[3]).trim(); + // value of 'inherit' or 'unset' is equivalent to not setting the property here + if (value !== 'inherit' || value !== 'unset') { + properties[m[1].trim()] = value; + } + any = true; + } + return any; + } + + } + + // returns cssText of properties that consume variables/mixins + collectCssText(rule) { + return this.collectConsumingCssText(rule.parsedCssText); + } + + // NOTE: we support consumption inside mixin assignment + // but not production, so strip out {...} + collectConsumingCssText(cssText) { + return cssText.replace(rx.BRACKETED, '') + .replace(rx.VAR_ASSIGN, ''); + } + + collectPropertiesInCssText(cssText, props) { + let m; + while ((m = rx.VAR_CONSUMED.exec(cssText))) { + let name = m[1]; + // This regex catches all variable names, and following non-whitespace char + // If next char is not ':', then variable is a consumer + if (m[2] !== ':') { + props[name] = true; + } + } + } + + // turns custom properties into realized values. + reify(props) { + // big perf optimization here: reify only *own* properties + // since this object has __proto__ of the element's scope properties + let names = Object.getOwnPropertyNames(props); + for (let i=0, n; i < names.length; i++) { + n = names[i]; + props[n] = this.valueForProperty(props[n], props); + } + } + + // given a property value, returns the reified value + // a property value may be: + // (1) a literal value like: red or 5px; + // (2) a variable value like: var(--a), var(--a, red), or var(--a, --b) or + // var(--a, var(--b)); + // (3) a literal mixin value like { properties }. Each of these properties + // can have values that are: (a) literal, (b) variables, (c) @apply mixins. + valueForProperty(property, props) { + // case (1) default + // case (3) defines a mixin and we have to reify the internals + if (property) { + if (property.indexOf(';') >=0) { + property = this.valueForProperties(property, props); + } else { + // case (2) variable + let self = this; + let fn = function(prefix, value, fallback, suffix) { + if (!value) { + return prefix + suffix; + } + let propertyValue = self.valueForProperty(props[value], props); + // if value is "initial", then the variable should be treated as unset + if (!propertyValue || propertyValue === 'initial') { + // fallback may be --a or var(--a) or literal + propertyValue = self.valueForProperty(props[fallback] || fallback, props) || + fallback; + } else if (propertyValue === 'apply-shim-inherit') { + // CSS build will replace `inherit` with `apply-shim-inherit` + // for use with native css variables. + // Since we have full control, we can use `inherit` directly. + propertyValue = 'inherit'; + } + return prefix + (propertyValue || '') + suffix; + }; + property = processVariableAndFallback(property, fn); + } + } + return property && property.trim() || ''; + } + + // note: we do not yet support mixin within mixin + valueForProperties(property, props) { + let parts = property.split(';'); + for (let i=0, p, m; i *' || parsedSelector === 'html'); + let isHost = parsedSelector.indexOf(':host') === 0 && !isRoot; + // build info is either in scope (when scope is an element) or in the style + // when scope is the default scope; note: this allows default scope to have + // mixed mode built and unbuilt styles. + if (cssBuild === 'shady') { + // :root -> x-foo > *.x-foo for elements and html for custom-style + isRoot = parsedSelector === (hostScope + ' > *.' + hostScope) || parsedSelector.indexOf('html') !== -1; + // :host -> x-foo for elements, but sub-rules have .x-foo in them + isHost = !isRoot && parsedSelector.indexOf(hostScope) === 0; + } + if (cssBuild === 'shadow') { + isRoot = parsedSelector === ':host > *' || parsedSelector === 'html'; + isHost = isHost && !isRoot; + } + if (!isRoot && !isHost) { + return; + } + let selectorToMatch = hostScope; + if (isHost) { + // need to transform :host under ShadowDOM because `:host` does not work with `matches` + if (nativeShadow && !rule.transformedSelector) { + // transform :host into a matchable selector + rule.transformedSelector = + StyleTransformer$1._transformRuleCss( + rule, + StyleTransformer$1._transformComplexSelector, + StyleTransformer$1._calcElementScope(scope.is), + hostScope + ); + } + selectorToMatch = rule.transformedSelector || hostScope; + } + callback({ + selector: selectorToMatch, + isHost: isHost, + isRoot: isRoot + }); + } + + hostAndRootPropertiesForScope(scope, rules) { + let hostProps = {}, rootProps = {}, self = this; + // note: active rules excludes non-matching @media rules + let cssBuild = rules && rules.__cssBuild; + forEachRule(rules, function(rule) { + // if scope is StyleDefaults, use _element for matchesSelector + self.whenHostOrRootRule(scope, rule, cssBuild, function(info) { + let element = scope._element || scope; + if (matchesSelector.call(element, info.selector)) { + if (info.isHost) { + self.collectProperties(rule, hostProps); + } else { + self.collectProperties(rule, rootProps); + } + } + }); + }, null, true); + return {rootProps: rootProps, hostProps: hostProps}; + } + + transformStyles(element, properties, scopeSelector) { + let self = this; + let hostSelector = StyleTransformer$1 + ._calcHostScope(element.is, element.extends); + let rxHostSelector = element.extends ? + '\\' + hostSelector.slice(0, -1) + '\\]' : + hostSelector; + let hostRx = new RegExp(rx.HOST_PREFIX + rxHostSelector + + rx.HOST_SUFFIX); + let rules = StyleInfo.get(element).styleRules; + let keyframeTransforms = + this._elementKeyframeTransforms(element, rules, scopeSelector); + return StyleTransformer$1.elementStyles(element, rules, function(rule) { + self.applyProperties(rule, properties); + if (!nativeShadow && + !isKeyframesSelector(rule) && + rule.cssText) { + // NOTE: keyframe transforms only scope munge animation names, so it + // is not necessary to apply them in ShadowDOM. + self.applyKeyframeTransforms(rule, keyframeTransforms); + self._scopeSelector(rule, hostRx, hostSelector, scopeSelector); + } + }); + } + + _elementKeyframeTransforms(element, rules, scopeSelector) { + let keyframesRules = rules._keyframes; + let keyframeTransforms = {}; + if (!nativeShadow && keyframesRules) { + // For non-ShadowDOM, we transform all known keyframes rules in + // advance for the current scope. This allows us to catch keyframes + // rules that appear anywhere in the stylesheet: + for (let i = 0, keyframesRule = keyframesRules[i]; + i < keyframesRules.length; + keyframesRule = keyframesRules[++i]) { + this._scopeKeyframes(keyframesRule, scopeSelector); + keyframeTransforms[keyframesRule.keyframesName] = + this._keyframesRuleTransformer(keyframesRule); + } + } + return keyframeTransforms; + } + + // Generate a factory for transforming a chunk of CSS text to handle a + // particular scoped keyframes rule. + _keyframesRuleTransformer(keyframesRule) { + return function(cssText) { + return cssText.replace( + keyframesRule.keyframesNameRx, + keyframesRule.transformedKeyframesName); + }; + } + + // Transforms `@keyframes` names to be unique for the current host. + // Example: @keyframes foo-anim -> @keyframes foo-anim-x-foo-0 + _scopeKeyframes(rule, scopeId) { + rule.keyframesNameRx = new RegExp(rule.keyframesName, 'g'); + rule.transformedKeyframesName = rule.keyframesName + '-' + scopeId; + rule.transformedSelector = rule.transformedSelector || rule.selector; + rule.selector = rule.transformedSelector.replace( + rule.keyframesName, rule.transformedKeyframesName); + } + + // Strategy: x scope shim a selector e.g. to scope `.x-foo-42` (via classes): + // non-host selector: .a.x-foo -> .x-foo-42 .a.x-foo + // host selector: x-foo.wide -> .x-foo-42.wide + // note: we use only the scope class (.x-foo-42) and not the hostSelector + // (x-foo) to scope :host rules; this helps make property host rules + // have low specificity. They are overrideable by class selectors but, + // unfortunately, not by type selectors (e.g. overriding via + // `.special` is ok, but not by `x-foo`). + _scopeSelector(rule, hostRx, hostSelector, scopeId) { + rule.transformedSelector = rule.transformedSelector || rule.selector; + let selector = rule.transformedSelector; + let scope = '.' + scopeId; + let parts = selector.split(','); + for (let i=0, l=parts.length, p; (i [{properties, styleElement, scopeSelector}] + this.cache = {}; + this.typeMax = typeMax; + } + + _validate(cacheEntry, properties, ownPropertyNames) { + for (let idx = 0; idx < ownPropertyNames.length; idx++) { + let pn = ownPropertyNames[idx]; + if (cacheEntry.properties[pn] !== properties[pn]) { + return false; + } + } + return true; + } + + store(tagname, properties, styleElement, scopeSelector) { + let list = this.cache[tagname] || []; + list.push({properties, styleElement, scopeSelector}); + if (list.length > this.typeMax) { + list.shift(); + } + this.cache[tagname] = list; + } + + fetch(tagname, properties, ownPropertyNames) { + let list = this.cache[tagname]; + if (!list) { + return; + } + // reverse list for most-recent lookups + for (let idx = list.length - 1; idx >= 0; idx--) { + let entry = list[idx]; + if (this._validate(entry, properties, ownPropertyNames)) { + return entry; + } + } + } +} + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ +/** + * The apply shim simulates the behavior of `@apply` proposed at + * https://tabatkins.github.io/specs/css-apply-rule/. + * The approach is to convert a property like this: + * + * --foo: {color: red; background: blue;} + * + * to this: + * + * --foo_-_color: red; + * --foo_-_background: blue; + * + * Then where `@apply --foo` is used, that is converted to: + * + * color: var(--foo_-_color); + * background: var(--foo_-_background); + * + * This approach generally works but there are some issues and limitations. + * Consider, for example, that somewhere *between* where `--foo` is set and used, + * another element sets it to: + * + * --foo: { border: 2px solid red; } + * + * We must now ensure that the color and background from the previous setting + * do not apply. This is accomplished by changing the property set to this: + * + * --foo_-_border: 2px solid red; + * --foo_-_color: initial; + * --foo_-_background: initial; + * + * This works but introduces one new issue. + * Consider this setup at the point where the `@apply` is used: + * + * background: orange; + * @apply --foo; + * + * In this case the background will be unset (initial) rather than the desired + * `orange`. We address this by altering the property set to use a fallback + * value like this: + * + * color: var(--foo_-_color); + * background: var(--foo_-_background, orange); + * border: var(--foo_-_border); + * + * Note that the default is retained in the property set and the `background` is + * the desired `orange`. This leads us to a limitation. + * + * Limitation 1: + + * Only properties in the rule where the `@apply` + * is used are considered as default values. + * If another rule matches the element and sets `background` with + * less specificity than the rule in which `@apply` appears, + * the `background` will not be set. + * + * Limitation 2: + * + * When using Polymer's `updateStyles` api, new properties may not be set for + * `@apply` properties. + +*/ + +let MIXIN_MATCH = rx.MIXIN_MATCH; +let VAR_ASSIGN = rx.VAR_ASSIGN; + +let APPLY_NAME_CLEAN = /;\s*/m; +let INITIAL_INHERIT = /^\s*(initial)|(inherit)\s*$/; + +// separator used between mixin-name and mixin-property-name when producing properties +// NOTE: plain '-' may cause collisions in user styles +let MIXIN_VAR_SEP = '_-_'; + +// map of mixin to property names +// --foo: {border: 2px} -> {properties: {(--foo, ['border'])}, dependants: {'element-name': proto}} +class MixinMap { + constructor() { + this._map = {}; + } + set(name, props) { + name = name.trim(); + this._map[name] = { + properties: props, + dependants: {} + }; + } + get(name) { + name = name.trim(); + return this._map[name]; + } +} + +class ApplyShim { + constructor() { + this._currentTemplate = null; + this._measureElement = null; + this._map = new MixinMap(); + this._separator = MIXIN_VAR_SEP; + this._boundProduceCssProperties = ( + matchText, propertyName, valueProperty, valueMixin) => + this._produceCssProperties( + matchText, propertyName, valueProperty, valueMixin); + } + // return true if `cssText` contains a mixin definition or consumption + detectMixin(cssText) { + const has = MIXIN_MATCH.test(cssText) || VAR_ASSIGN.test(cssText); + // reset state of the regexes + MIXIN_MATCH.lastIndex = 0; + VAR_ASSIGN.lastIndex = 0; + return has; + } + transformStyle(style, elementName) { + let ast = rulesForStyle(style); + this.transformRules(ast, elementName); + return ast; + } + transformRules(rules, elementName) { + this._currentTemplate = templateMap[elementName]; + forEachRule(rules, (r) => { + this.transformRule(r); + }); + this._currentTemplate = null; + } + transformRule(rule) { + rule.cssText = this.transformCssText(rule.parsedCssText); + // :root was only used for variable assignment in property shim, + // but generates invalid selectors with real properties. + // replace with `:host > *`, which serves the same effect + if (rule.selector === ':root') { + rule.selector = ':host > *'; + } + } + transformCssText(cssText) { + // produce variables + cssText = cssText.replace(VAR_ASSIGN, this._boundProduceCssProperties); + // consume mixins + return this._consumeCssProperties(cssText); + } + _getInitialValueForProperty(property) { + if (!this._measureElement) { + this._measureElement = document.createElement('meta'); + this._measureElement.style.all = 'initial'; + document.head.appendChild(this._measureElement); + } + return window.getComputedStyle(this._measureElement).getPropertyValue(property); + } + // replace mixin consumption with variable consumption + _consumeCssProperties(text) { + let m; + // loop over text until all mixins with defintions have been applied + while((m = MIXIN_MATCH.exec(text))) { + let matchText = m[0]; + let mixinName = m[1]; + let idx = m.index; + // collect properties before apply to be "defaults" if mixin might override them + // match includes a "prefix", so find the start and end positions of @apply + let applyPos = idx + matchText.indexOf('@apply'); + let afterApplyPos = idx + matchText.length; + // find props defined before this @apply + let textBeforeApply = text.slice(0, applyPos); + let textAfterApply = text.slice(afterApplyPos); + let defaults = this._cssTextToMap(textBeforeApply); + let replacement = this._atApplyToCssProperties(mixinName, defaults); + // use regex match position to replace mixin, keep linear processing time + text = [textBeforeApply, replacement, textAfterApply].join(''); + // move regex search to _after_ replacement + MIXIN_MATCH.lastIndex = idx + replacement.length; + } + return text; + } + // produce variable consumption at the site of mixin consumption + // @apply --foo; -> for all props (${propname}: var(--foo_-_${propname}, ${fallback[propname]}})) + // Example: + // border: var(--foo_-_border); padding: var(--foo_-_padding, 2px) + _atApplyToCssProperties(mixinName, fallbacks) { + mixinName = mixinName.replace(APPLY_NAME_CLEAN, ''); + let vars = []; + let mixinEntry = this._map.get(mixinName); + // if we depend on a mixin before it is created + // make a sentinel entry in the map to add this element as a dependency for when it is defined. + if (!mixinEntry) { + this._map.set(mixinName, {}); + mixinEntry = this._map.get(mixinName); + } + if (mixinEntry) { + if (this._currentTemplate) { + mixinEntry.dependants[this._currentTemplate.name] = this._currentTemplate; + } + let p, parts, f; + for (p in mixinEntry.properties) { + f = fallbacks && fallbacks[p]; + parts = [p, ': var(', mixinName, MIXIN_VAR_SEP, p]; + if (f) { + parts.push(',', f); + } + parts.push(')'); + vars.push(parts.join('')); + } + } + return vars.join('; '); + } + + _replaceInitialOrInherit(property, value) { + let match = INITIAL_INHERIT.exec(value); + if (match) { + if (match[1]) { + // initial + // replace `initial` with the concrete initial value for this property + value = ApplyShim._getInitialValueForProperty(property); + } else { + // inherit + // with this purposfully illegal value, the variable will be invalid at + // compute time (https://www.w3.org/TR/css-variables/#invalid-at-computed-value-time) + // and for inheriting values, will behave similarly + // we cannot support the same behavior for non inheriting values like 'border' + value = 'apply-shim-inherit'; + } + } + return value; + } + + // "parse" a mixin definition into a map of properties and values + // cssTextToMap('border: 2px solid black') -> ('border', '2px solid black') + _cssTextToMap(text) { + let props = text.split(';'); + let property, value; + let out = {}; + for (let i = 0, p, sp; i < props.length; i++) { + p = props[i]; + if (p) { + sp = p.split(':'); + // ignore lines that aren't definitions like @media + if (sp.length > 1) { + property = sp[0].trim(); + // some properties may have ':' in the value, like data urls + value = this._replaceInitialOrInherit(property, sp.slice(1).join(':')); + out[property] = value; + } + } + } + return out; + } + + _invalidateMixinEntry(mixinEntry) { + for (let elementName in mixinEntry.dependants) { + if (!this._currentTemplate || elementName !== this._currentTemplate.name) { + StyleInfo.invalidate(elementName); + } + } + } + + _produceCssProperties(matchText, propertyName, valueProperty, valueMixin) { + // handle case where property value is a mixin + if (valueProperty) { + // form: --mixin2: var(--mixin1), where --mixin1 is in the map + processVariableAndFallback(valueProperty, (prefix, value) => { + if (value && this._map.get(value)) { + valueMixin = '@apply ' + value + ';'; + } + }); + } + if (!valueMixin) { + return matchText; + } + let mixinAsProperties = this._consumeCssProperties(valueMixin); + let prefix = matchText.slice(0, matchText.indexOf('--')); + let mixinValues = this._cssTextToMap(mixinAsProperties); + let combinedProps = mixinValues; + let mixinEntry = this._map.get(propertyName); + let oldProps = mixinEntry && mixinEntry.properties; + if (oldProps) { + // NOTE: since we use mixin, the map of properties is updated here + // and this is what we want. + combinedProps = Object.assign(Object.create(oldProps), mixinValues); + } else { + this._map.set(propertyName, combinedProps); + } + let out = []; + let p, v; + // set variables defined by current mixin + let needToInvalidate = false; + for (p in combinedProps) { + v = mixinValues[p]; + // if property not defined by current mixin, set initial + if (v === undefined) { + v = 'initial'; + } + if (oldProps && !(p in oldProps)) { + needToInvalidate = true; + } + out.push(propertyName + MIXIN_VAR_SEP + p + ': ' + v); + } + if (needToInvalidate) { + this._invalidateMixinEntry(mixinEntry); + } + if (mixinEntry) { + mixinEntry.properties = combinedProps; + } + // because the mixinMap is global, the mixin might conflict with + // a different scope's simple variable definition: + // Example: + // some style somewhere: + // --mixin1:{ ... } + // --mixin2: var(--mixin1); + // some other element: + // --mixin1: 10px solid red; + // --foo: var(--mixin1); + // In this case, we leave the original variable definition in place. + if (valueProperty) { + prefix = matchText + ';' + prefix; + } + return prefix + out.join('; ') + ';'; + } +} + +let applyShim = new ApplyShim(); +window['ApplyShim'] = applyShim; + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +let flush = function() {}; + +if (!nativeShadow) { + let elementNeedsScoping = (element) => { + return (element.classList && + !element.classList.contains(StyleTransformer$1.SCOPE_NAME) || + // note: necessary for IE11 + (element instanceof SVGElement && (!element.hasAttribute('class') || + element.getAttribute('class').indexOf(StyleTransformer$1.SCOPE_NAME) < 0))); + }; + + let handler = (mxns) => { + for (let x=0; x < mxns.length; x++) { + let mxn = mxns[x]; + if (mxn.target === document.documentElement || + mxn.target === document.head) { + continue; + } + for (let i=0; i < mxn.addedNodes.length; i++) { + let n = mxn.addedNodes[i]; + if (elementNeedsScoping(n)) { + let root = n.getRootNode(); + if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + // may no longer be in a shadowroot + let host = root.host; + if (host) { + let scope = host.is || host.localName; + StyleTransformer$1.dom(n, scope); + } + } + } + } + for (let i=0; i < mxn.removedNodes.length; i++) { + let n = mxn.removedNodes[i]; + if (n.nodeType === Node.ELEMENT_NODE) { + let classes = undefined; + if (n.classList) { + classes = Array.from(n.classList); + } else if (n.hasAttribute('class')) { + classes = n.getAttribute('class').split(/\s+/); + } + if (classes !== undefined) { + // NOTE: relies on the scoping class always being adjacent to the + // SCOPE_NAME class. + let classIdx = classes.indexOf(StyleTransformer$1.SCOPE_NAME); + if (classIdx >= 0) { + let scope = classes[classIdx + 1]; + if (scope) { + StyleTransformer$1.dom(n, scope, true); + } + } + } + } + } + } + }; + + let observer = new MutationObserver(handler); + let start = (node) => { + observer.observe(node, {childList: true, subtree: true}); + }; + let nativeCustomElements = (window.customElements && + !window.customElements.flush); + // need to start immediately with native custom elements + // TODO(dfreedm): with polyfilled HTMLImports and native custom elements + // excessive mutations may be observed; this can be optimized via cooperation + // with the HTMLImports polyfill. + if (nativeCustomElements) { + start(document); + } else { + let delayedStart = () => { + start(document.body); + }; + // use polyfill timing if it's available + if (window.HTMLImports) { + window.HTMLImports.whenReady(delayedStart); + // otherwise push beyond native imports being ready + // which requires RAF + readystate interactive. + } else { + requestAnimationFrame(function() { + if (document.readyState === 'loading') { + let listener = function() { + delayedStart(); + document.removeEventListener('readystatechange', listener); + }; + document.addEventListener('readystatechange', listener); + } else { + delayedStart(); + } + }); + } + } + + flush = function() { + handler(observer.takeRecords()); + }; +} + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +// TODO(dfreedm): consider spliting into separate global +let styleCache = new StyleCache(); + +class ShadyCSS { + constructor() { + this._scopeCounter = {}; + this._documentOwner = document.documentElement; + this._documentOwnerStyleInfo = StyleInfo.set(document.documentElement, new StyleInfo({rules: []})); + this._elementsHaveApplied = false; + } + get nativeShadow() { + return nativeShadow; + } + get nativeCss() { + return nativeCssVariables; + } + get nativeCssApply() { + return nativeCssApply; + } + flush() { + flush(); + } + _generateScopeSelector(name) { + let id = this._scopeCounter[name] = (this._scopeCounter[name] || 0) + 1; + return `${name}-${id}`; + } + getStyleAst(style) { + return rulesForStyle(style); + } + styleAstToString(ast) { + return toCssText(ast); + } + _gatherStyles(template) { + let styles = template.content.querySelectorAll('style'); + let cssText = []; + for (let i = 0; i < styles.length; i++) { + let s = styles[i]; + cssText.push(s.textContent); + s.parentNode.removeChild(s); + } + return cssText.join('').trim(); + } + _getCssBuild(template) { + let style = template.content.querySelector('style'); + if (!style) { + return ''; + } + return style.getAttribute('css-build') || ''; + } + prepareTemplate(template, elementName, typeExtension) { + if (template._prepared) { + return; + } + template._prepared = true; + template.name = elementName; + template.extends = typeExtension; + templateMap[elementName] = template; + let cssBuild = this._getCssBuild(template); + let cssText = this._gatherStyles(template); + let info = { + is: elementName, + extends: typeExtension, + __cssBuild: cssBuild, + }; + if (!this.nativeShadow) { + StyleTransformer$1.dom(template.content, elementName); + } + // check if the styling has mixin definitions or uses + let hasMixins = applyShim.detectMixin(cssText); + let ast = parse(cssText); + // only run the applyshim transforms if there is a mixin involved + if (hasMixins && this.nativeCss && !this.nativeCssApply) { + applyShim.transformRules(ast, elementName); + } + template._styleAst = ast; + + let ownPropertyNames = []; + if (!this.nativeCss) { + ownPropertyNames = StyleProperties$1.decorateStyles(template._styleAst, info); + } + if (!ownPropertyNames.length || this.nativeCss) { + let root = this.nativeShadow ? template.content : null; + let placeholder = placeholderMap[elementName]; + let style = this._generateStaticStyle(info, template._styleAst, root, placeholder); + template._style = style; + } + template._ownPropertyNames = ownPropertyNames; + } + _generateStaticStyle(info, rules, shadowroot, placeholder) { + let cssText = StyleTransformer$1.elementStyles(info, rules); + if (cssText.length) { + return applyCss(cssText, info.is, shadowroot, placeholder); + } + } + _prepareHost(host) { + let is = host.getAttribute('is') || host.localName; + let typeExtension; + if (is !== host.localName) { + typeExtension = host.localName; + } + let placeholder = placeholderMap[is]; + let template = templateMap[is]; + let ast; + let ownStylePropertyNames; + let cssBuild; + if (template) { + ast = template._styleAst; + ownStylePropertyNames = template._ownPropertyNames; + cssBuild = template._cssBuild; + } + return StyleInfo.set(host, + new StyleInfo( + ast, + placeholder, + ownStylePropertyNames, + is, + typeExtension, + cssBuild + ) + ); + } + applyStyle(host, overrideProps) { + let is = host.getAttribute('is') || host.localName; + let styleInfo = StyleInfo.get(host); + let hasApplied = Boolean(styleInfo); + if (!styleInfo) { + styleInfo = this._prepareHost(host); + } + // Only trip the `elementsHaveApplied` flag if a node other that the root document has `applyStyle` called + if (!this._isRootOwner(host)) { + this._elementsHaveApplied = true; + } + if (window.CustomStyle) { + let CS = window.CustomStyle; + if (CS._documentDirty) { + CS.findStyles(); + if (!this.nativeCss) { + this._updateProperties(this._documentOwner, this._documentOwnerStyleInfo); + } else if (!this.nativeCssApply) { + CS._revalidateApplyShim(); + } + CS.applyStyles(); + // if no elements have booted yet, we can just update the document and be done + if (!this._elementsHaveApplied) { + return; + } + // if no native css custom properties, we must recalculate the whole tree + if (!this.nativeCss) { + this.updateStyles(); + /* + When updateStyles() runs, this element may not have a shadowroot yet. + If not, we need to make sure that this element runs `applyStyle` on itself at least once to generate a style + */ + if (hasApplied) { + return; + } + } + } + } + if (overrideProps) { + styleInfo.overrideStyleProperties = + styleInfo.overrideStyleProperties || {}; + Object.assign(styleInfo.overrideStyleProperties, overrideProps); + } + if (this.nativeCss) { + if (styleInfo.overrideStyleProperties) { + this._updateNativeProperties(host, styleInfo.overrideStyleProperties); + } + let template = templateMap[is]; + // bail early if there is no shadowroot for this element + if (!template && !this._isRootOwner(host)) { + return; + } + if (template && template._applyShimInvalid && template._style) { + // update template + if (!template._validating) { + applyShim.transformRules(template._styleAst, is); + template._style.textContent = StyleTransformer$1.elementStyles(host, styleInfo.styleRules); + StyleInfo.startValidating(is); + } + // update instance if native shadowdom + if (this.nativeShadow) { + let root = host.shadowRoot; + if (root) { + let style = root.querySelector('style'); + style.textContent = StyleTransformer$1.elementStyles(host, styleInfo.styleRules); + } + } + styleInfo.styleRules = template._styleAst; + } + } else { + this._updateProperties(host, styleInfo); + if (styleInfo.ownStylePropertyNames && styleInfo.ownStylePropertyNames.length) { + this._applyStyleProperties(host, styleInfo); + } + } + if (hasApplied) { + let root = this._isRootOwner(host) ? host : host.shadowRoot; + // note: some elements may not have a root! + if (root) { + this._applyToDescendants(root); + } + } + } + _applyToDescendants(root) { + let c$ = root.children; + for (let i = 0, c; i < c$.length; i++) { + c = c$[i]; + if (c.shadowRoot) { + this.applyStyle(c); + } + this._applyToDescendants(c); + } + } + _styleOwnerForNode(node) { + let root = node.getRootNode(); + let host = root.host; + if (host) { + if (StyleInfo.get(host)) { + return host; + } else { + return this._styleOwnerForNode(host); + } + } + return this._documentOwner; + } + _isRootOwner(node) { + return (node === this._documentOwner); + } + _applyStyleProperties(host, styleInfo) { + let is = host.getAttribute('is') || host.localName; + let cacheEntry = styleCache.fetch(is, styleInfo.styleProperties, styleInfo.ownStylePropertyNames); + let cachedScopeSelector = cacheEntry && cacheEntry.scopeSelector; + let cachedStyle = cacheEntry ? cacheEntry.styleElement : null; + let oldScopeSelector = styleInfo.scopeSelector; + // only generate new scope if cached style is not found + styleInfo.scopeSelector = cachedScopeSelector || this._generateScopeSelector(is); + let style = StyleProperties$1.applyElementStyle(host, styleInfo.styleProperties, styleInfo.scopeSelector, cachedStyle); + if (!this.nativeShadow) { + StyleProperties$1.applyElementScopeSelector(host, styleInfo.scopeSelector, oldScopeSelector); + } + if (!cacheEntry) { + styleCache.store(is, styleInfo.styleProperties, style, styleInfo.scopeSelector); + } + return style; + } + _updateProperties(host, styleInfo) { + let owner = this._styleOwnerForNode(host); + let ownerStyleInfo = StyleInfo.get(owner); + let ownerProperties = ownerStyleInfo.styleProperties; + let props = Object.create(ownerProperties || null); + let hostAndRootProps = StyleProperties$1.hostAndRootPropertiesForScope(host, styleInfo.styleRules); + let propertyData = StyleProperties$1.propertyDataFromStyles(ownerStyleInfo.styleRules, host); + let propertiesMatchingHost = propertyData.properties; + Object.assign( + props, + hostAndRootProps.hostProps, + propertiesMatchingHost, + hostAndRootProps.rootProps + ); + this._mixinOverrideStyles(props, styleInfo.overrideStyleProperties); + StyleProperties$1.reify(props); + styleInfo.styleProperties = props; + } + _mixinOverrideStyles(props, overrides) { + for (let p in overrides) { + let v = overrides[p]; + // skip override props if they are not truthy or 0 + // in order to fall back to inherited values + if (v || v === 0) { + props[p] = v; + } + } + } + _updateNativeProperties(element, properties) { + // remove previous properties + for (let p in properties) { + // NOTE: for bc with shim, don't apply null values. + if (p === null) { + element.style.removeProperty(p); + } else { + element.style.setProperty(p, properties[p]); + } + } + } + updateStyles(properties) { + this.applyStyle(this._documentOwner, properties); + } + /* Custom Style operations */ + _transformCustomStyleForDocument(style) { + let ast = rulesForStyle(style); + forEachRule(ast, (rule) => { + if (nativeShadow) { + StyleTransformer$1.normalizeRootSelector(rule); + } else { + StyleTransformer$1.documentRule(rule); + } + if (this.nativeCss && !this.nativeCssApply) { + applyShim.transformRule(rule); + } + }); + if (this.nativeCss) { + style.textContent = toCssText(ast); + } else { + this._documentOwnerStyleInfo.styleRules.rules.push(ast); + } + } + _revalidateApplyShim(style) { + if (this.nativeCss && !this.nativeCssApply) { + let ast = rulesForStyle(style); + applyShim.transformRules(ast); + style.textContent = toCssText(ast); + } + } + _applyCustomStyleToDocument(style) { + if (!this.nativeCss) { + StyleProperties$1.applyCustomStyle(style, this._documentOwnerStyleInfo.styleProperties); + } + } + getComputedStyleValue(element, property) { + let value; + if (!this.nativeCss) { + // element is either a style host, or an ancestor of a style host + let styleInfo = StyleInfo.get(element) || StyleInfo.get(this._styleOwnerForNode(element)); + value = styleInfo.styleProperties[property]; + } + // fall back to the property value from the computed styling + value = value || window.getComputedStyle(element).getPropertyValue(property); + // trim whitespace that can come after the `:` in css + // example: padding: 2px -> " 2px" + return value.trim(); + } + // given an element and a classString, replaces + // the element's class with the provided classString and adds + // any necessary ShadyCSS static and property based scoping selectors + setElementClass(element, classString) { + let root = element.getRootNode(); + let classes = classString ? classString.split(/\s/) : []; + let scopeName = root.host && root.host.localName; + // If no scope, try to discover scope name from existing class. + // This can occur if, for example, a template stamped element that + // has been scoped is manipulated when not in a root. + if (!scopeName) { + var classAttr = element.getAttribute('class'); + if (classAttr) { + let k$ = classAttr.split(/\s/); + for (let i=0; i < k$.length; i++) { + if (k$[i] === StyleTransformer$1.SCOPE_NAME) { + scopeName = k$[i+1]; + break; + } + } + } + } + if (scopeName) { + classes.push(StyleTransformer$1.SCOPE_NAME, scopeName); + } + if (!this.nativeCss) { + let styleInfo = StyleInfo.get(element); + if (styleInfo && styleInfo.scopeSelector) { + classes.push(StyleProperties$1.XSCOPE_NAME, styleInfo.scopeSelector); + } + } + setElementClassRaw(element, classes.join(' ')); + } + _styleInfoForNode(node) { + return StyleInfo.get(node); + } +} + +window['ShadyCSS'] = new ShadyCSS(); + +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ + +(function(scope) { + + 'use strict'; + + if (window.HTMLImports) { + HTMLImports.whenReady(function() { + requestAnimationFrame(function() { + window.dispatchEvent(new CustomEvent('WebComponentsReady')); + }); + }); + } else { + requestAnimationFrame(function() { + window.dispatchEvent(new CustomEvent('WebComponentsReady')); + }); + } + +})(window.WebComponents); + +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ + +(function(scope) { + + // It's desireable to provide a default stylesheet + // that's convenient for styling unresolved elements, but + // it's cumbersome to have to include this manually in every page. + // It would make sense to put inside some HTMLImport but + // the HTMLImports polyfill does not allow loading of stylesheets + // that block rendering. Therefore this injection is tolerated here. + // + // NOTE: position: relative fixes IE's failure to inherit opacity + // when a child is not statically positioned. + var style = document.createElement('style'); + style.textContent = '' + + 'body {' + + 'transition: opacity ease-in 0.2s;' + + ' } \n' + + 'body[unresolved] {' + + 'opacity: 0; display: block; overflow: hidden; position: relative;' + + ' } \n' + ; + var head = document.querySelector('head'); + head.insertBefore(style, head.firstChild); + +})(window.WebComponents); + +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ +/* + * Polyfills loaded: None + * Used in: Chrome + */ + +// TODO: This needs to not exist at all. + +//TODO(notwaldorf): this is temporary and should be removed. + +}()); + +//# sourceMappingURL=webcomponents-none.min.js.map diff --git a/webcomponents-none.min.js.map b/webcomponents-none.min.js.map new file mode 100644 index 0000000..fe59f68 --- /dev/null +++ b/webcomponents-none.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"webcomponents-none.min.js","sources":["src/pre-polyfill.js","bower_components/shadycss/src/css-parse.js","bower_components/shadycss/src/style-settings.js","bower_components/shadycss/src/style-util.js","bower_components/shadycss/src/style-transformer.js","bower_components/shadycss/src/template-map.js","bower_components/shadycss/src/style-info.js","bower_components/shadycss/src/style-properties.js","bower_components/shadycss/src/style-placeholder.js","bower_components/shadycss/src/style-cache.js","bower_components/shadycss/src/apply-shim.js","bower_components/shadycss/src/document-watcher.js","bower_components/shadycss/src/ShadyCSS.js","src/post-polyfill.js","src/unresolved.js","entrypoints/webcomponents-none-index.js"],"sourcesContent":["/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function(scope) {\n\n 'use strict';\n\n var forceShady = scope.flags.shadydom;\n if (forceShady) {\n window.ShadyDOM = window.ShadyDOM || {};\n ShadyDOM.force = forceShady;\n }\n\n var forceCE = scope.flags.register || scope.flags.ce;\n if (forceCE && window.customElements) {\n customElements.forcePolyfill = forceCE;\n }\n\n})(window.WebComponents);\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/*\nExtremely simple css parser. Intended to be not more than what we need\nand definitely not necessarily correct =).\n*/\n\n'use strict';\n\n// given a string of css, return a simple rule tree\nexport function parse(text) {\n text = clean(text);\n return parseCss(lex(text), text);\n}\n\n// remove stuff we don't care about that may hinder parsing\nfunction clean(cssText) {\n return cssText.replace(RX.comments, '').replace(RX.port, '');\n}\n\n// super simple {...} lexer that returns a node tree\nfunction lex(text) {\n let root = {\n start: 0,\n end: text.length\n };\n let n = root;\n for (let i = 0, l = text.length; i < l; i++) {\n if (text[i] === OPEN_BRACE) {\n if (!n.rules) {\n n.rules = [];\n }\n let p = n;\n let previous = p.rules[p.rules.length - 1];\n n = {\n start: i + 1,\n parent: p,\n previous: previous\n };\n p.rules.push(n);\n } else if (text[i] === CLOSE_BRACE) {\n n.end = i + 1;\n n = n.parent || root;\n }\n }\n return root;\n}\n\n// add selectors/cssText to node tree\nfunction parseCss(node, text) {\n let t = text.substring(node.start, node.end - 1);\n node.parsedCssText = node.cssText = t.trim();\n if (node.parent) {\n let ss = node.previous ? node.previous.end : node.parent.start;\n t = text.substring(ss, node.start - 1);\n t = _expandUnicodeEscapes(t);\n t = t.replace(RX.multipleSpaces, ' ');\n // TODO(sorvell): ad hoc; make selector include only after last ;\n // helps with mixin syntax\n t = t.substring(t.lastIndexOf(';') + 1);\n let s = node.parsedSelector = node.selector = t.trim();\n node.atRule = (s.indexOf(AT_START) === 0);\n // note, support a subset of rule types...\n if (node.atRule) {\n if (s.indexOf(MEDIA_START) === 0) {\n node.type = types.MEDIA_RULE;\n } else if (s.match(RX.keyframesRule)) {\n node.type = types.KEYFRAMES_RULE;\n node.keyframesName =\n node.selector.split(RX.multipleSpaces).pop();\n }\n } else {\n if (s.indexOf(VAR_START) === 0) {\n node.type = types.MIXIN_RULE;\n } else {\n node.type = types.STYLE_RULE;\n }\n }\n }\n let r$ = node.rules;\n if (r$) {\n for (let i = 0, l = r$.length, r;\n (i < l) && (r = r$[i]); i++) {\n parseCss(r, text);\n }\n }\n return node;\n}\n\n// conversion of sort unicode escapes with spaces like `\\33 ` (and longer) into\n// expanded form that doesn't require trailing space `\\000033`\nfunction _expandUnicodeEscapes(s) {\n return s.replace(/\\\\([0-9a-f]{1,6})\\s/gi, function() {\n let code = arguments[1],\n repeat = 6 - code.length;\n while (repeat--) {\n code = '0' + code;\n }\n return '\\\\' + code;\n });\n}\n\n// stringify parsed css.\nexport function stringify(node, preserveProperties, text) {\n text = text || '';\n // calc rule cssText\n let cssText = '';\n if (node.cssText || node.rules) {\n let r$ = node.rules;\n if (r$ && !_hasMixinRules(r$)) {\n for (let i = 0, l = r$.length, r;\n (i < l) && (r = r$[i]); i++) {\n cssText = stringify(r, preserveProperties, cssText);\n }\n } else {\n cssText = preserveProperties ? node.cssText :\n removeCustomProps(node.cssText);\n cssText = cssText.trim();\n if (cssText) {\n cssText = ' ' + cssText + '\\n';\n }\n }\n }\n // emit rule if there is cssText\n if (cssText) {\n if (node.selector) {\n text += node.selector + ' ' + OPEN_BRACE + '\\n';\n }\n text += cssText;\n if (node.selector) {\n text += CLOSE_BRACE + '\\n\\n';\n }\n }\n return text;\n}\n\nfunction _hasMixinRules(rules) {\n return rules[0].selector.indexOf(VAR_START) === 0;\n}\n\nfunction removeCustomProps(cssText) {\n cssText = removeCustomPropAssignment(cssText);\n return removeCustomPropApply(cssText);\n}\n\nexport function removeCustomPropAssignment(cssText) {\n return cssText\n .replace(RX.customProp, '')\n .replace(RX.mixinProp, '');\n}\n\nfunction removeCustomPropApply(cssText) {\n return cssText\n .replace(RX.mixinApply, '')\n .replace(RX.varApply, '');\n}\n\nexport let types = {\n STYLE_RULE: 1,\n KEYFRAMES_RULE: 7,\n MEDIA_RULE: 4,\n MIXIN_RULE: 1000\n}\n\nlet OPEN_BRACE = '{';\nlet CLOSE_BRACE = '}';\n\n// helper regexp's\nlet RX = {\n comments: /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//gim,\n port: /@import[^;]*;/gim,\n customProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\\n]|$)/gim,\n mixinProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\\n]|$)?/gim,\n mixinApply: /@apply\\s*\\(?[^);]*\\)?\\s*(?:[;\\n]|$)?/gim,\n varApply: /[^;:]*?:[^;]*?var\\([^;]*\\)(?:[;\\n]|$)?/gim,\n keyframesRule: /^@[^\\s]*keyframes/,\n multipleSpaces: /\\s+/g\n}\n\nlet VAR_START = '--';\nlet MEDIA_START = '@media';\nlet AT_START = '@';\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport let nativeShadow = !(window.ShadyDOM && window.ShadyDOM.inUse);\n// chrome 49 has semi-working css vars, check if box-shadow works\n// safari 9.1 has a recalc bug: https://bugs.webkit.org/show_bug.cgi?id=155782\nexport let nativeCssVariables = (!navigator.userAgent.match('AppleWebKit/601') &&\nwindow.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'));\n\n// experimental support for native @apply\nfunction detectNativeApply() {\n let style = document.createElement('style');\n style.textContent = '.foo { @apply --foo }';\n document.head.appendChild(style);\n let nativeCssApply = (style.sheet.cssRules[0].cssText.indexOf('apply') >= 0);\n document.head.removeChild(style);\n return nativeCssApply;\n}\n\nexport let nativeCssApply = false && detectNativeApply();\n\nfunction parseSettings(settings) {\n if (settings) {\n nativeCssVariables = nativeCssVariables && !settings.shimcssproperties;\n nativeShadow = nativeShadow && !settings.shimshadow;\n }\n}\n\nif (window.ShadyCSS) {\n parseSettings(window.ShadyCSS);\n} else if (window.WebComponents) {\n parseSettings(window.WebComponents.flags);\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow, nativeCssVariables} from './style-settings'\nimport {parse, stringify, types} from './css-parse'\n\nexport function toCssText (rules, callback) {\n if (typeof rules === 'string') {\n rules = parse(rules);\n }\n if (callback) {\n forEachRule(rules, callback);\n }\n return stringify(rules, nativeCssVariables);\n}\n\nexport function rulesForStyle(style) {\n if (!style.__cssRules && style.textContent) {\n style.__cssRules = parse(style.textContent);\n }\n return style.__cssRules;\n}\n\n// Tests if a rule is a keyframes selector, which looks almost exactly\n// like a normal selector but is not (it has nothing to do with scoping\n// for example).\nexport function isKeyframesSelector(rule) {\n return rule.parent &&\n rule.parent.type === types.KEYFRAMES_RULE;\n}\n\nexport function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) {\n if (!node) {\n return;\n }\n let skipRules = false;\n if (onlyActiveRules) {\n if (node.type === types.MEDIA_RULE) {\n let matchMedia = node.selector.match(rx.MEDIA_MATCH);\n if (matchMedia) {\n // if rule is a non matching @media rule, skip subrules\n if (!window.matchMedia(matchMedia[1]).matches) {\n skipRules = true;\n }\n }\n }\n }\n if (node.type === types.STYLE_RULE) {\n styleRuleCallback(node);\n } else if (keyframesRuleCallback &&\n node.type === types.KEYFRAMES_RULE) {\n keyframesRuleCallback(node);\n } else if (node.type === types.MIXIN_RULE) {\n skipRules = true;\n }\n let r$ = node.rules;\n if (r$ && !skipRules) {\n for (let i=0, l=r$.length, r; (i+~])'\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as StyleUtil from './style-util'\nimport {nativeShadow} from './style-settings'\n\n/* Transforms ShadowDOM styling into ShadyDOM styling\n\n* scoping:\n\n * elements in scope get scoping selector class=\"x-foo-scope\"\n * selectors re-written as follows:\n\n div button -> div.x-foo-scope button.x-foo-scope\n\n* :host -> scopeName\n\n* :host(...) -> scopeName...\n\n* ::slotted(...) -> scopeName > ...\n\n* ...:dir(ltr|rtl) -> [dir=\"ltr|rtl\"] ..., ...[dir=\"ltr|rtl\"]\n\n* :host(:dir[rtl]) -> scopeName:dir(rtl) -> [dir=\"rtl\"] scopeName, scopeName[dir=\"rtl\"]\n\n*/\nconst SCOPE_NAME = 'style-scope';\n\nclass StyleTransformer {\n get SCOPE_NAME() {\n return SCOPE_NAME;\n }\n // Given a node and scope name, add a scoping class to each node\n // in the tree. This facilitates transforming css into scoped rules.\n dom(node, scope, shouldRemoveScope) {\n // one time optimization to skip scoping...\n if (node.__styleScoped) {\n node.__styleScoped = null;\n } else {\n this._transformDom(node, scope || '', shouldRemoveScope);\n }\n }\n\n _transformDom(node, selector, shouldRemoveScope) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.element(node, selector, shouldRemoveScope);\n }\n let c$ = (node.localName === 'template') ?\n (node.content || node._content).childNodes :\n node.children || node.childNodes;\n if (c$) {\n for (let i=0; i `:${type}(${inner.replace(/\\s/g, '')})`);\n selector = selector.replace(SLOTTED_START, `${HOST} $1`);\n selector = selector.replace(SIMPLE_SELECTOR_SEP, (m, c, s) => {\n if (!stop) {\n let info = this._transformCompoundSelector(s, c, scope, hostScope);\n stop = stop || info.stop;\n c = info.combinator;\n s = info.value;\n }\n return c + s;\n });\n return selector;\n }\n\n _transformCompoundSelector(selector, combinator, scope, hostScope) {\n // replace :host with host scoping class\n let slottedIndex = selector.indexOf(SLOTTED);\n if (selector.indexOf(HOST) >= 0) {\n selector = this._transformHostSelector(selector, hostScope);\n // replace other selectors with scoping class\n } else if (slottedIndex !== 0) {\n selector = scope ? this._transformSimpleSelector(selector, scope) :\n selector;\n }\n // mark ::slotted() scope jump to replace with descendant selector + arg\n // also ignore left-side combinator\n let slotted = false;\n if (slottedIndex >= 0) {\n combinator = '';\n slotted = true;\n }\n // process scope jumping selectors up to the scope jump and then stop\n let stop;\n if (slotted) {\n stop = true;\n if (slotted) {\n // .zonk ::slotted(.foo) -> .zonk.scope > .foo\n selector = selector.replace(SLOTTED_PAREN, (m, paren) => ` > ${paren}`);\n }\n }\n selector = selector.replace(DIR_PAREN, (m, before, dir) =>\n `[dir=\"${dir}\"] ${before}, ${before}[dir=\"${dir}\"]`);\n return {value: selector, combinator, stop};\n }\n\n _transformSimpleSelector(selector, scope) {\n let p$ = selector.split(PSEUDO_PREFIX);\n p$[0] += scope;\n return p$.join(PSEUDO_PREFIX);\n }\n\n // :host(...) -> scopeName...\n _transformHostSelector(selector, hostScope) {\n let m = selector.match(HOST_PAREN);\n let paren = m && m[2].trim() || '';\n if (paren) {\n if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) {\n // paren starts with a type selector\n let typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0];\n // if the type selector is our hostScope then avoid pre-pending it\n if (typeSelector === hostScope) {\n return paren;\n // otherwise, this selector should not match in this scope so\n // output a bogus selector.\n } else {\n return SELECTOR_NO_MATCH;\n }\n } else {\n // make sure to do a replace here to catch selectors like:\n // `:host(.foo)::before`\n return selector.replace(HOST_PAREN, function(m, host, paren) {\n return hostScope + paren;\n });\n }\n // if no paren, do a straight :host replacement.\n // TODO(sorvell): this should not strictly be necessary but\n // it's needed to maintain support for `:host[foo]` type selectors\n // which have been improperly used under Shady DOM. This should be\n // deprecated.\n } else {\n return selector.replace(HOST, hostScope);\n }\n }\n\n documentRule(rule) {\n // reset selector in case this is redone.\n rule.selector = rule.parsedSelector;\n this.normalizeRootSelector(rule);\n this._transformRule(rule, this._transformDocumentSelector);\n }\n\n normalizeRootSelector(rule) {\n if (rule.selector === ROOT) {\n rule.selector = 'html';\n }\n }\n\n _transformDocumentSelector(selector) {\n return selector.match(SLOTTED) ?\n this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) :\n this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR);\n }\n}\n\nlet NTH = /:(nth[-\\w]+)\\(([^)]+)\\)/;\nlet SCOPE_DOC_SELECTOR = `:not(.${SCOPE_NAME})`;\nlet COMPLEX_SELECTOR_SEP = ',';\nlet SIMPLE_SELECTOR_SEP = /(^|[\\s>+~]+)((?:\\[.+?\\]|[^\\s>+~=\\[])+)/g;\nlet SIMPLE_SELECTOR_PREFIX = /[[.:#*]/;\nlet HOST = ':host';\nlet ROOT = ':root';\nlet SLOTTED = '::slotted';\nlet SLOTTED_START = new RegExp(`^(${SLOTTED})`);\n// NOTE: this supports 1 nested () pair for things like\n// :host(:not([selected]), more general support requires\n// parsing which seems like overkill\nlet HOST_PAREN = /(:host)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\n// similar to HOST_PAREN\nlet SLOTTED_PAREN = /(?:::slotted)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\nlet DIR_PAREN = /(.*):dir\\((?:(ltr|rtl))\\)/;\nlet CSS_CLASS_PREFIX = '.';\nlet PSEUDO_PREFIX = ':';\nlet CLASS = 'class';\nlet SELECTOR_NO_MATCH = 'should_not_match';\n\nexport default new StyleTransformer()","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport default {};\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport templateMap from './template-map'\n\nconst promise = Promise.resolve();\n\nexport default class StyleInfo {\n static get(node) {\n return node.__styleInfo;\n }\n static set(node, styleInfo) {\n node.__styleInfo = styleInfo;\n return styleInfo;\n }\n static invalidate(elementName) {\n if (templateMap[elementName]) {\n templateMap[elementName]._applyShimInvalid = true;\n }\n }\n /*\n the template is marked as `validating` for one microtask so that all instances\n found in the tree crawl of `applyStyle` will update themselves,\n but the template will only be updated once.\n */\n static startValidating(elementName) {\n const template = templateMap[elementName];\n if (!template._validating) {\n template._validating = true;\n promise.then(() => {\n template._applyShimInvalid = false;\n template._validating = false;\n });\n }\n }\n constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtension, cssBuild) {\n this.styleRules = ast || null;\n this.placeholder = placeholder || null;\n this.ownStylePropertyNames = ownStylePropertyNames || [];\n this.overrideStyleProperties = null;\n this.elementName = elementName || '';\n this.cssBuild = cssBuild || '';\n this.typeExtension = typeExtension || '';\n this.styleProperties = null;\n this.scopeSelector = null;\n this.customStyle = null;\n }\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {removeCustomPropAssignment} from './css-parse'\nimport {nativeShadow} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport StyleInfo from './style-info'\n\n// TODO: dedupe with shady\nconst p = window.Element.prototype;\nconst matchesSelector = p.matches || p.matchesSelector ||\n p.mozMatchesSelector || p.msMatchesSelector ||\n p.oMatchesSelector || p.webkitMatchesSelector;\n\nconst IS_IE = navigator.userAgent.match('Trident');\n\nconst XSCOPE_NAME = 'x-scope';\n\nclass StyleProperties {\n get XSCOPE_NAME() {\n return XSCOPE_NAME;\n }\n // decorates styles with rule info and returns an array of used style\n // property names\n decorateStyles(rules) {\n let self = this, props = {}, keyframes = [], ruleIndex = 0;\n StyleUtil.forEachRule(rules, function(rule) {\n self.decorateRule(rule);\n // mark in-order position of ast rule in styles block, used for cache key\n rule.index = ruleIndex++;\n self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);\n }, function onKeyframesRule(rule) {\n keyframes.push(rule);\n });\n // Cache all found keyframes rules for later reference:\n rules._keyframes = keyframes;\n // return this list of property names *consumes* in these styles.\n let names = [];\n for (let i in props) {\n names.push(i);\n }\n return names;\n }\n\n // decorate a single rule with property info\n decorateRule(rule) {\n if (rule.propertyInfo) {\n return rule.propertyInfo;\n }\n let info = {}, properties = {};\n let hasProperties = this.collectProperties(rule, properties);\n if (hasProperties) {\n info.properties = properties;\n // TODO(sorvell): workaround parser seeing mixins as additional rules\n rule.rules = null;\n }\n info.cssText = this.collectCssText(rule);\n rule.propertyInfo = info;\n return info;\n }\n\n // collects the custom properties from a rule's cssText\n collectProperties(rule, properties) {\n let info = rule.propertyInfo;\n if (info) {\n if (info.properties) {\n Object.assign(properties, info.properties);\n return true;\n }\n } else {\n let m, rx = StyleUtil.rx.VAR_ASSIGN;\n let cssText = rule.parsedCssText;\n let value;\n let any;\n while ((m = rx.exec(cssText))) {\n // note: group 2 is var, 3 is mixin\n value = (m[2] || m[3]).trim();\n // value of 'inherit' or 'unset' is equivalent to not setting the property here\n if (value !== 'inherit' || value !== 'unset') {\n properties[m[1].trim()] = value;\n }\n any = true;\n }\n return any;\n }\n\n }\n\n // returns cssText of properties that consume variables/mixins\n collectCssText(rule) {\n return this.collectConsumingCssText(rule.parsedCssText);\n }\n\n // NOTE: we support consumption inside mixin assignment\n // but not production, so strip out {...}\n collectConsumingCssText(cssText) {\n return cssText.replace(StyleUtil.rx.BRACKETED, '')\n .replace(StyleUtil.rx.VAR_ASSIGN, '');\n }\n\n collectPropertiesInCssText(cssText, props) {\n let m;\n while ((m = StyleUtil.rx.VAR_CONSUMED.exec(cssText))) {\n let name = m[1];\n // This regex catches all variable names, and following non-whitespace char\n // If next char is not ':', then variable is a consumer\n if (m[2] !== ':') {\n props[name] = true;\n }\n }\n }\n\n // turns custom properties into realized values.\n reify(props) {\n // big perf optimization here: reify only *own* properties\n // since this object has __proto__ of the element's scope properties\n let names = Object.getOwnPropertyNames(props);\n for (let i=0, n; i < names.length; i++) {\n n = names[i];\n props[n] = this.valueForProperty(props[n], props);\n }\n }\n\n // given a property value, returns the reified value\n // a property value may be:\n // (1) a literal value like: red or 5px;\n // (2) a variable value like: var(--a), var(--a, red), or var(--a, --b) or\n // var(--a, var(--b));\n // (3) a literal mixin value like { properties }. Each of these properties\n // can have values that are: (a) literal, (b) variables, (c) @apply mixins.\n valueForProperty(property, props) {\n // case (1) default\n // case (3) defines a mixin and we have to reify the internals\n if (property) {\n if (property.indexOf(';') >=0) {\n property = this.valueForProperties(property, props);\n } else {\n // case (2) variable\n let self = this;\n let fn = function(prefix, value, fallback, suffix) {\n if (!value) {\n return prefix + suffix;\n }\n let propertyValue = self.valueForProperty(props[value], props);\n // if value is \"initial\", then the variable should be treated as unset\n if (!propertyValue || propertyValue === 'initial') {\n // fallback may be --a or var(--a) or literal\n propertyValue = self.valueForProperty(props[fallback] || fallback, props) ||\n fallback;\n } else if (propertyValue === 'apply-shim-inherit') {\n // CSS build will replace `inherit` with `apply-shim-inherit`\n // for use with native css variables.\n // Since we have full control, we can use `inherit` directly.\n propertyValue = 'inherit';\n }\n return prefix + (propertyValue || '') + suffix;\n };\n property = StyleUtil.processVariableAndFallback(property, fn);\n }\n }\n return property && property.trim() || '';\n }\n\n // note: we do not yet support mixin within mixin\n valueForProperties(property, props) {\n let parts = property.split(';');\n for (let i=0, p, m; i *' || parsedSelector === 'html');\n let isHost = parsedSelector.indexOf(':host') === 0 && !isRoot;\n // build info is either in scope (when scope is an element) or in the style\n // when scope is the default scope; note: this allows default scope to have\n // mixed mode built and unbuilt styles.\n if (cssBuild === 'shady') {\n // :root -> x-foo > *.x-foo for elements and html for custom-style\n isRoot = parsedSelector === (hostScope + ' > *.' + hostScope) || parsedSelector.indexOf('html') !== -1;\n // :host -> x-foo for elements, but sub-rules have .x-foo in them\n isHost = !isRoot && parsedSelector.indexOf(hostScope) === 0;\n }\n if (cssBuild === 'shadow') {\n isRoot = parsedSelector === ':host > *' || parsedSelector === 'html';\n isHost = isHost && !isRoot;\n }\n if (!isRoot && !isHost) {\n return;\n }\n let selectorToMatch = hostScope;\n if (isHost) {\n // need to transform :host under ShadowDOM because `:host` does not work with `matches`\n if (nativeShadow && !rule.transformedSelector) {\n // transform :host into a matchable selector\n rule.transformedSelector =\n StyleTransformer._transformRuleCss(\n rule,\n StyleTransformer._transformComplexSelector,\n StyleTransformer._calcElementScope(scope.is),\n hostScope\n );\n }\n selectorToMatch = rule.transformedSelector || hostScope;\n }\n callback({\n selector: selectorToMatch,\n isHost: isHost,\n isRoot: isRoot\n });\n }\n\n hostAndRootPropertiesForScope(scope, rules) {\n let hostProps = {}, rootProps = {}, self = this;\n // note: active rules excludes non-matching @media rules\n let cssBuild = rules && rules.__cssBuild;\n StyleUtil.forEachRule(rules, function(rule) {\n // if scope is StyleDefaults, use _element for matchesSelector\n self.whenHostOrRootRule(scope, rule, cssBuild, function(info) {\n let element = scope._element || scope;\n if (matchesSelector.call(element, info.selector)) {\n if (info.isHost) {\n self.collectProperties(rule, hostProps);\n } else {\n self.collectProperties(rule, rootProps);\n }\n }\n });\n }, null, true);\n return {rootProps: rootProps, hostProps: hostProps};\n }\n\n transformStyles(element, properties, scopeSelector) {\n let self = this;\n let hostSelector = StyleTransformer\n ._calcHostScope(element.is, element.extends);\n let rxHostSelector = element.extends ?\n '\\\\' + hostSelector.slice(0, -1) + '\\\\]' :\n hostSelector;\n let hostRx = new RegExp(StyleUtil.rx.HOST_PREFIX + rxHostSelector +\n StyleUtil.rx.HOST_SUFFIX);\n let rules = StyleInfo.get(element).styleRules;\n let keyframeTransforms =\n this._elementKeyframeTransforms(element, rules, scopeSelector);\n return StyleTransformer.elementStyles(element, rules, function(rule) {\n self.applyProperties(rule, properties);\n if (!nativeShadow &&\n !StyleUtil.isKeyframesSelector(rule) &&\n rule.cssText) {\n // NOTE: keyframe transforms only scope munge animation names, so it\n // is not necessary to apply them in ShadowDOM.\n self.applyKeyframeTransforms(rule, keyframeTransforms);\n self._scopeSelector(rule, hostRx, hostSelector, scopeSelector);\n }\n });\n }\n\n _elementKeyframeTransforms(element, rules, scopeSelector) {\n let keyframesRules = rules._keyframes;\n let keyframeTransforms = {};\n if (!nativeShadow && keyframesRules) {\n // For non-ShadowDOM, we transform all known keyframes rules in\n // advance for the current scope. This allows us to catch keyframes\n // rules that appear anywhere in the stylesheet:\n for (let i = 0, keyframesRule = keyframesRules[i];\n i < keyframesRules.length;\n keyframesRule = keyframesRules[++i]) {\n this._scopeKeyframes(keyframesRule, scopeSelector);\n keyframeTransforms[keyframesRule.keyframesName] =\n this._keyframesRuleTransformer(keyframesRule);\n }\n }\n return keyframeTransforms;\n }\n\n // Generate a factory for transforming a chunk of CSS text to handle a\n // particular scoped keyframes rule.\n _keyframesRuleTransformer(keyframesRule) {\n return function(cssText) {\n return cssText.replace(\n keyframesRule.keyframesNameRx,\n keyframesRule.transformedKeyframesName);\n };\n }\n\n // Transforms `@keyframes` names to be unique for the current host.\n // Example: @keyframes foo-anim -> @keyframes foo-anim-x-foo-0\n _scopeKeyframes(rule, scopeId) {\n rule.keyframesNameRx = new RegExp(rule.keyframesName, 'g');\n rule.transformedKeyframesName = rule.keyframesName + '-' + scopeId;\n rule.transformedSelector = rule.transformedSelector || rule.selector;\n rule.selector = rule.transformedSelector.replace(\n rule.keyframesName, rule.transformedKeyframesName);\n }\n\n // Strategy: x scope shim a selector e.g. to scope `.x-foo-42` (via classes):\n // non-host selector: .a.x-foo -> .x-foo-42 .a.x-foo\n // host selector: x-foo.wide -> .x-foo-42.wide\n // note: we use only the scope class (.x-foo-42) and not the hostSelector\n // (x-foo) to scope :host rules; this helps make property host rules\n // have low specificity. They are overrideable by class selectors but,\n // unfortunately, not by type selectors (e.g. overriding via\n // `.special` is ok, but not by `x-foo`).\n _scopeSelector(rule, hostRx, hostSelector, scopeId) {\n rule.transformedSelector = rule.transformedSelector || rule.selector;\n let selector = rule.transformedSelector;\n let scope = '.' + scopeId;\n let parts = selector.split(',');\n for (let i=0, l=parts.length, p; (i [{properties, styleElement, scopeSelector}]\n this.cache = {};\n this.typeMax = typeMax;\n }\n\n _validate(cacheEntry, properties, ownPropertyNames) {\n for (let idx = 0; idx < ownPropertyNames.length; idx++) {\n let pn = ownPropertyNames[idx];\n if (cacheEntry.properties[pn] !== properties[pn]) {\n return false;\n }\n }\n return true;\n }\n\n store(tagname, properties, styleElement, scopeSelector) {\n let list = this.cache[tagname] || [];\n list.push({properties, styleElement, scopeSelector});\n if (list.length > this.typeMax) {\n list.shift();\n }\n this.cache[tagname] = list;\n }\n\n fetch(tagname, properties, ownPropertyNames) {\n let list = this.cache[tagname];\n if (!list) {\n return;\n }\n // reverse list for most-recent lookups\n for (let idx = list.length - 1; idx >= 0; idx--) {\n let entry = list[idx];\n if (this._validate(entry, properties, ownPropertyNames)) {\n return entry;\n }\n }\n }\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n/**\n * The apply shim simulates the behavior of `@apply` proposed at\n * https://tabatkins.github.io/specs/css-apply-rule/.\n * The approach is to convert a property like this:\n *\n * --foo: {color: red; background: blue;}\n *\n * to this:\n *\n * --foo_-_color: red;\n * --foo_-_background: blue;\n *\n * Then where `@apply --foo` is used, that is converted to:\n *\n * color: var(--foo_-_color);\n * background: var(--foo_-_background);\n *\n * This approach generally works but there are some issues and limitations.\n * Consider, for example, that somewhere *between* where `--foo` is set and used,\n * another element sets it to:\n *\n * --foo: { border: 2px solid red; }\n *\n * We must now ensure that the color and background from the previous setting\n * do not apply. This is accomplished by changing the property set to this:\n *\n * --foo_-_border: 2px solid red;\n * --foo_-_color: initial;\n * --foo_-_background: initial;\n *\n * This works but introduces one new issue.\n * Consider this setup at the point where the `@apply` is used:\n *\n * background: orange;\n * @apply --foo;\n *\n * In this case the background will be unset (initial) rather than the desired\n * `orange`. We address this by altering the property set to use a fallback\n * value like this:\n *\n * color: var(--foo_-_color);\n * background: var(--foo_-_background, orange);\n * border: var(--foo_-_border);\n *\n * Note that the default is retained in the property set and the `background` is\n * the desired `orange`. This leads us to a limitation.\n *\n * Limitation 1:\n\n * Only properties in the rule where the `@apply`\n * is used are considered as default values.\n * If another rule matches the element and sets `background` with\n * less specificity than the rule in which `@apply` appears,\n * the `background` will not be set.\n *\n * Limitation 2:\n *\n * When using Polymer's `updateStyles` api, new properties may not be set for\n * `@apply` properties.\n\n*/\n\n'use strict';\n\nimport {rx, forEachRule, processVariableAndFallback, rulesForStyle} from './style-util'\nimport templateMap from './template-map'\nimport StyleInfo from './style-info'\n\nlet MIXIN_MATCH = rx.MIXIN_MATCH;\nlet VAR_ASSIGN = rx.VAR_ASSIGN;\n\nlet APPLY_NAME_CLEAN = /;\\s*/m;\nlet INITIAL_INHERIT = /^\\s*(initial)|(inherit)\\s*$/;\n\n// separator used between mixin-name and mixin-property-name when producing properties\n// NOTE: plain '-' may cause collisions in user styles\nlet MIXIN_VAR_SEP = '_-_';\n\n// map of mixin to property names\n// --foo: {border: 2px} -> {properties: {(--foo, ['border'])}, dependants: {'element-name': proto}}\nclass MixinMap {\n constructor() {\n this._map = {};\n }\n set(name, props) {\n name = name.trim();\n this._map[name] = {\n properties: props,\n dependants: {}\n }\n }\n get(name) {\n name = name.trim();\n return this._map[name];\n }\n}\n\nclass ApplyShim {\n constructor() {\n this._currentTemplate = null;\n this._measureElement = null;\n this._map = new MixinMap();\n this._separator = MIXIN_VAR_SEP;\n this._boundProduceCssProperties = (\n matchText, propertyName, valueProperty, valueMixin) =>\n this._produceCssProperties(\n matchText, propertyName, valueProperty, valueMixin);\n }\n // return true if `cssText` contains a mixin definition or consumption\n detectMixin(cssText) {\n const has = MIXIN_MATCH.test(cssText) || VAR_ASSIGN.test(cssText);\n // reset state of the regexes\n MIXIN_MATCH.lastIndex = 0;\n VAR_ASSIGN.lastIndex = 0;\n return has;\n }\n transformStyle(style, elementName) {\n let ast = rulesForStyle(style);\n this.transformRules(ast, elementName);\n return ast;\n }\n transformRules(rules, elementName) {\n this._currentTemplate = templateMap[elementName];\n forEachRule(rules, (r) => {\n this.transformRule(r);\n });\n this._currentTemplate = null;\n }\n transformRule(rule) {\n rule.cssText = this.transformCssText(rule.parsedCssText);\n // :root was only used for variable assignment in property shim,\n // but generates invalid selectors with real properties.\n // replace with `:host > *`, which serves the same effect\n if (rule.selector === ':root') {\n rule.selector = ':host > *';\n }\n }\n transformCssText(cssText) {\n // produce variables\n cssText = cssText.replace(VAR_ASSIGN, this._boundProduceCssProperties);\n // consume mixins\n return this._consumeCssProperties(cssText);\n }\n _getInitialValueForProperty(property) {\n if (!this._measureElement) {\n this._measureElement = document.createElement('meta');\n this._measureElement.style.all = 'initial';\n document.head.appendChild(this._measureElement);\n }\n return window.getComputedStyle(this._measureElement).getPropertyValue(property);\n }\n // replace mixin consumption with variable consumption\n _consumeCssProperties(text) {\n let m;\n // loop over text until all mixins with defintions have been applied\n while((m = MIXIN_MATCH.exec(text))) {\n let matchText = m[0];\n let mixinName = m[1];\n let idx = m.index;\n // collect properties before apply to be \"defaults\" if mixin might override them\n // match includes a \"prefix\", so find the start and end positions of @apply\n let applyPos = idx + matchText.indexOf('@apply');\n let afterApplyPos = idx + matchText.length;\n // find props defined before this @apply\n let textBeforeApply = text.slice(0, applyPos);\n let textAfterApply = text.slice(afterApplyPos);\n let defaults = this._cssTextToMap(textBeforeApply);\n let replacement = this._atApplyToCssProperties(mixinName, defaults);\n // use regex match position to replace mixin, keep linear processing time\n text = [textBeforeApply, replacement, textAfterApply].join('');\n // move regex search to _after_ replacement\n MIXIN_MATCH.lastIndex = idx + replacement.length;\n }\n return text;\n }\n // produce variable consumption at the site of mixin consumption\n // @apply --foo; -> for all props (${propname}: var(--foo_-_${propname}, ${fallback[propname]}}))\n // Example:\n // border: var(--foo_-_border); padding: var(--foo_-_padding, 2px)\n _atApplyToCssProperties(mixinName, fallbacks) {\n mixinName = mixinName.replace(APPLY_NAME_CLEAN, '');\n let vars = [];\n let mixinEntry = this._map.get(mixinName);\n // if we depend on a mixin before it is created\n // make a sentinel entry in the map to add this element as a dependency for when it is defined.\n if (!mixinEntry) {\n this._map.set(mixinName, {});\n mixinEntry = this._map.get(mixinName);\n }\n if (mixinEntry) {\n if (this._currentTemplate) {\n mixinEntry.dependants[this._currentTemplate.name] = this._currentTemplate;\n }\n let p, parts, f;\n for (p in mixinEntry.properties) {\n f = fallbacks && fallbacks[p];\n parts = [p, ': var(', mixinName, MIXIN_VAR_SEP, p];\n if (f) {\n parts.push(',', f);\n }\n parts.push(')');\n vars.push(parts.join(''));\n }\n }\n return vars.join('; ');\n }\n\n _replaceInitialOrInherit(property, value) {\n let match = INITIAL_INHERIT.exec(value);\n if (match) {\n if (match[1]) {\n // initial\n // replace `initial` with the concrete initial value for this property\n value = ApplyShim._getInitialValueForProperty(property);\n } else {\n // inherit\n // with this purposfully illegal value, the variable will be invalid at\n // compute time (https://www.w3.org/TR/css-variables/#invalid-at-computed-value-time)\n // and for inheriting values, will behave similarly\n // we cannot support the same behavior for non inheriting values like 'border'\n value = 'apply-shim-inherit';\n }\n }\n return value;\n }\n\n // \"parse\" a mixin definition into a map of properties and values\n // cssTextToMap('border: 2px solid black') -> ('border', '2px solid black')\n _cssTextToMap(text) {\n let props = text.split(';');\n let property, value;\n let out = {};\n for (let i = 0, p, sp; i < props.length; i++) {\n p = props[i];\n if (p) {\n sp = p.split(':');\n // ignore lines that aren't definitions like @media\n if (sp.length > 1) {\n property = sp[0].trim();\n // some properties may have ':' in the value, like data urls\n value = this._replaceInitialOrInherit(property, sp.slice(1).join(':'));\n out[property] = value;\n }\n }\n }\n return out;\n }\n\n _invalidateMixinEntry(mixinEntry) {\n for (let elementName in mixinEntry.dependants) {\n if (!this._currentTemplate || elementName !== this._currentTemplate.name) {\n StyleInfo.invalidate(elementName);\n }\n }\n }\n\n _produceCssProperties(matchText, propertyName, valueProperty, valueMixin) {\n // handle case where property value is a mixin\n if (valueProperty) {\n // form: --mixin2: var(--mixin1), where --mixin1 is in the map\n processVariableAndFallback(valueProperty, (prefix, value) => {\n if (value && this._map.get(value)) {\n valueMixin = '@apply ' + value + ';';\n }\n });\n }\n if (!valueMixin) {\n return matchText;\n }\n let mixinAsProperties = this._consumeCssProperties(valueMixin);\n let prefix = matchText.slice(0, matchText.indexOf('--'));\n let mixinValues = this._cssTextToMap(mixinAsProperties);\n let combinedProps = mixinValues;\n let mixinEntry = this._map.get(propertyName);\n let oldProps = mixinEntry && mixinEntry.properties;\n if (oldProps) {\n // NOTE: since we use mixin, the map of properties is updated here\n // and this is what we want.\n combinedProps = Object.assign(Object.create(oldProps), mixinValues);\n } else {\n this._map.set(propertyName, combinedProps);\n }\n let out = [];\n let p, v;\n // set variables defined by current mixin\n let needToInvalidate = false;\n for (p in combinedProps) {\n v = mixinValues[p];\n // if property not defined by current mixin, set initial\n if (v === undefined) {\n v = 'initial';\n }\n if (oldProps && !(p in oldProps)) {\n needToInvalidate = true;\n }\n out.push(propertyName + MIXIN_VAR_SEP + p + ': ' + v);\n }\n if (needToInvalidate) {\n this._invalidateMixinEntry(mixinEntry);\n }\n if (mixinEntry) {\n mixinEntry.properties = combinedProps;\n }\n // because the mixinMap is global, the mixin might conflict with\n // a different scope's simple variable definition:\n // Example:\n // some style somewhere:\n // --mixin1:{ ... }\n // --mixin2: var(--mixin1);\n // some other element:\n // --mixin1: 10px solid red;\n // --foo: var(--mixin1);\n // In this case, we leave the original variable definition in place.\n if (valueProperty) {\n prefix = matchText + ';' + prefix;\n }\n return prefix + out.join('; ') + ';';\n }\n}\n\nlet applyShim = new ApplyShim();\nwindow['ApplyShim'] = applyShim;\nexport default applyShim;\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow} from './style-settings'\nimport StyleTransformer from './style-transformer'\n\nexport let flush = function() {};\n\nif (!nativeShadow) {\n let elementNeedsScoping = (element) => {\n return (element.classList &&\n !element.classList.contains(StyleTransformer.SCOPE_NAME) ||\n // note: necessary for IE11\n (element instanceof SVGElement && (!element.hasAttribute('class') ||\n element.getAttribute('class').indexOf(StyleTransformer.SCOPE_NAME) < 0)));\n }\n\n let handler = (mxns) => {\n for (let x=0; x < mxns.length; x++) {\n let mxn = mxns[x];\n if (mxn.target === document.documentElement ||\n mxn.target === document.head) {\n continue;\n }\n for (let i=0; i < mxn.addedNodes.length; i++) {\n let n = mxn.addedNodes[i];\n if (elementNeedsScoping(n)) {\n let root = n.getRootNode();\n if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n // may no longer be in a shadowroot\n let host = root.host;\n if (host) {\n let scope = host.is || host.localName;\n StyleTransformer.dom(n, scope);\n }\n }\n }\n }\n for (let i=0; i < mxn.removedNodes.length; i++) {\n let n = mxn.removedNodes[i];\n if (n.nodeType === Node.ELEMENT_NODE) {\n let classes = undefined;\n if (n.classList) {\n classes = Array.from(n.classList);\n } else if (n.hasAttribute('class')) {\n classes = n.getAttribute('class').split(/\\s+/);\n }\n if (classes !== undefined) {\n // NOTE: relies on the scoping class always being adjacent to the\n // SCOPE_NAME class.\n let classIdx = classes.indexOf(StyleTransformer.SCOPE_NAME);\n if (classIdx >= 0) {\n let scope = classes[classIdx + 1];\n if (scope) {\n StyleTransformer.dom(n, scope, true);\n }\n }\n }\n }\n }\n }\n };\n\n let observer = new MutationObserver(handler);\n let start = (node) => {\n observer.observe(node, {childList: true, subtree: true});\n }\n let nativeCustomElements = (window.customElements &&\n !window.customElements.flush);\n // need to start immediately with native custom elements\n // TODO(dfreedm): with polyfilled HTMLImports and native custom elements\n // excessive mutations may be observed; this can be optimized via cooperation\n // with the HTMLImports polyfill.\n if (nativeCustomElements) {\n start(document);\n } else {\n let delayedStart = () => {\n start(document.body);\n }\n // use polyfill timing if it's available\n if (window.HTMLImports) {\n window.HTMLImports.whenReady(delayedStart);\n // otherwise push beyond native imports being ready\n // which requires RAF + readystate interactive.\n } else {\n requestAnimationFrame(function() {\n if (document.readyState === 'loading') {\n let listener = function() {\n delayedStart();\n document.removeEventListener('readystatechange', listener);\n }\n document.addEventListener('readystatechange', listener);\n } else {\n delayedStart();\n }\n });\n }\n }\n\n flush = function() {\n handler(observer.takeRecords());\n }\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {parse} from './css-parse'\nimport {nativeShadow, nativeCssVariables, nativeCssApply} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport StyleProperties from './style-properties'\nimport templateMap from './template-map'\nimport placeholderMap from './style-placeholder'\nimport StyleInfo from './style-info'\nimport StyleCache from './style-cache'\n\n// TODO(dfreedm): consider spliting into separate global\nimport ApplyShim from './apply-shim'\nimport {flush as watcherFlush} from './document-watcher'\n\nlet styleCache = new StyleCache();\n\nclass ShadyCSS {\n constructor() {\n this._scopeCounter = {};\n this._documentOwner = document.documentElement;\n this._documentOwnerStyleInfo = StyleInfo.set(document.documentElement, new StyleInfo({rules: []}));\n this._elementsHaveApplied = false;\n }\n get nativeShadow() {\n return nativeShadow;\n }\n get nativeCss() {\n return nativeCssVariables;\n }\n get nativeCssApply() {\n return nativeCssApply;\n }\n flush() {\n watcherFlush();\n }\n _generateScopeSelector(name) {\n let id = this._scopeCounter[name] = (this._scopeCounter[name] || 0) + 1;\n return `${name}-${id}`;\n }\n getStyleAst(style) {\n return StyleUtil.rulesForStyle(style);\n }\n styleAstToString(ast) {\n return StyleUtil.toCssText(ast);\n }\n _gatherStyles(template) {\n let styles = template.content.querySelectorAll('style');\n let cssText = [];\n for (let i = 0; i < styles.length; i++) {\n let s = styles[i];\n cssText.push(s.textContent);\n s.parentNode.removeChild(s);\n }\n return cssText.join('').trim();\n }\n _getCssBuild(template) {\n let style = template.content.querySelector('style');\n if (!style) {\n return '';\n }\n return style.getAttribute('css-build') || '';\n }\n prepareTemplate(template, elementName, typeExtension) {\n if (template._prepared) {\n return;\n }\n template._prepared = true;\n template.name = elementName;\n template.extends = typeExtension;\n templateMap[elementName] = template;\n let cssBuild = this._getCssBuild(template);\n let cssText = this._gatherStyles(template);\n let info = {\n is: elementName,\n extends: typeExtension,\n __cssBuild: cssBuild,\n };\n if (!this.nativeShadow) {\n StyleTransformer.dom(template.content, elementName);\n }\n // check if the styling has mixin definitions or uses\n let hasMixins = ApplyShim.detectMixin(cssText);\n let ast = parse(cssText);\n // only run the applyshim transforms if there is a mixin involved\n if (hasMixins && this.nativeCss && !this.nativeCssApply) {\n ApplyShim.transformRules(ast, elementName);\n }\n template._styleAst = ast;\n\n let ownPropertyNames = [];\n if (!this.nativeCss) {\n ownPropertyNames = StyleProperties.decorateStyles(template._styleAst, info);\n }\n if (!ownPropertyNames.length || this.nativeCss) {\n let root = this.nativeShadow ? template.content : null;\n let placeholder = placeholderMap[elementName];\n let style = this._generateStaticStyle(info, template._styleAst, root, placeholder);\n template._style = style;\n }\n template._ownPropertyNames = ownPropertyNames;\n }\n _generateStaticStyle(info, rules, shadowroot, placeholder) {\n let cssText = StyleTransformer.elementStyles(info, rules);\n if (cssText.length) {\n return StyleUtil.applyCss(cssText, info.is, shadowroot, placeholder);\n }\n }\n _prepareHost(host) {\n let is = host.getAttribute('is') || host.localName;\n let typeExtension;\n if (is !== host.localName) {\n typeExtension = host.localName;\n }\n let placeholder = placeholderMap[is];\n let template = templateMap[is];\n let ast;\n let ownStylePropertyNames;\n let cssBuild;\n if (template) {\n ast = template._styleAst;\n ownStylePropertyNames = template._ownPropertyNames;\n cssBuild = template._cssBuild;\n }\n return StyleInfo.set(host,\n new StyleInfo(\n ast,\n placeholder,\n ownStylePropertyNames,\n is,\n typeExtension,\n cssBuild\n )\n );\n }\n applyStyle(host, overrideProps) {\n let is = host.getAttribute('is') || host.localName;\n let styleInfo = StyleInfo.get(host);\n let hasApplied = Boolean(styleInfo);\n if (!styleInfo) {\n styleInfo = this._prepareHost(host);\n }\n // Only trip the `elementsHaveApplied` flag if a node other that the root document has `applyStyle` called\n if (!this._isRootOwner(host)) {\n this._elementsHaveApplied = true;\n }\n if (window.CustomStyle) {\n let CS = window.CustomStyle;\n if (CS._documentDirty) {\n CS.findStyles();\n if (!this.nativeCss) {\n this._updateProperties(this._documentOwner, this._documentOwnerStyleInfo);\n } else if (!this.nativeCssApply) {\n CS._revalidateApplyShim();\n }\n CS.applyStyles();\n // if no elements have booted yet, we can just update the document and be done\n if (!this._elementsHaveApplied) {\n return;\n }\n // if no native css custom properties, we must recalculate the whole tree\n if (!this.nativeCss) {\n this.updateStyles();\n /*\n When updateStyles() runs, this element may not have a shadowroot yet.\n If not, we need to make sure that this element runs `applyStyle` on itself at least once to generate a style\n */\n if (hasApplied) {\n return;\n }\n }\n }\n }\n if (overrideProps) {\n styleInfo.overrideStyleProperties =\n styleInfo.overrideStyleProperties || {};\n Object.assign(styleInfo.overrideStyleProperties, overrideProps);\n }\n if (this.nativeCss) {\n if (styleInfo.overrideStyleProperties) {\n this._updateNativeProperties(host, styleInfo.overrideStyleProperties);\n }\n let template = templateMap[is];\n // bail early if there is no shadowroot for this element\n if (!template && !this._isRootOwner(host)) {\n return;\n }\n if (template && template._applyShimInvalid && template._style) {\n // update template\n if (!template._validating) {\n ApplyShim.transformRules(template._styleAst, is);\n template._style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n StyleInfo.startValidating(is);\n }\n // update instance if native shadowdom\n if (this.nativeShadow) {\n let root = host.shadowRoot;\n if (root) {\n let style = root.querySelector('style');\n style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n }\n }\n styleInfo.styleRules = template._styleAst;\n }\n } else {\n this._updateProperties(host, styleInfo);\n if (styleInfo.ownStylePropertyNames && styleInfo.ownStylePropertyNames.length) {\n this._applyStyleProperties(host, styleInfo);\n }\n }\n if (hasApplied) {\n let root = this._isRootOwner(host) ? host : host.shadowRoot;\n // note: some elements may not have a root!\n if (root) {\n this._applyToDescendants(root);\n }\n }\n }\n _applyToDescendants(root) {\n let c$ = root.children;\n for (let i = 0, c; i < c$.length; i++) {\n c = c$[i];\n if (c.shadowRoot) {\n this.applyStyle(c);\n }\n this._applyToDescendants(c);\n }\n }\n _styleOwnerForNode(node) {\n let root = node.getRootNode();\n let host = root.host;\n if (host) {\n if (StyleInfo.get(host)) {\n return host;\n } else {\n return this._styleOwnerForNode(host);\n }\n }\n return this._documentOwner;\n }\n _isRootOwner(node) {\n return (node === this._documentOwner);\n }\n _applyStyleProperties(host, styleInfo) {\n let is = host.getAttribute('is') || host.localName;\n let cacheEntry = styleCache.fetch(is, styleInfo.styleProperties, styleInfo.ownStylePropertyNames);\n let cachedScopeSelector = cacheEntry && cacheEntry.scopeSelector;\n let cachedStyle = cacheEntry ? cacheEntry.styleElement : null;\n let oldScopeSelector = styleInfo.scopeSelector;\n // only generate new scope if cached style is not found\n styleInfo.scopeSelector = cachedScopeSelector || this._generateScopeSelector(is);\n let style = StyleProperties.applyElementStyle(host, styleInfo.styleProperties, styleInfo.scopeSelector, cachedStyle);\n if (!this.nativeShadow) {\n StyleProperties.applyElementScopeSelector(host, styleInfo.scopeSelector, oldScopeSelector);\n }\n if (!cacheEntry) {\n styleCache.store(is, styleInfo.styleProperties, style, styleInfo.scopeSelector);\n }\n return style;\n }\n _updateProperties(host, styleInfo) {\n let owner = this._styleOwnerForNode(host);\n let ownerStyleInfo = StyleInfo.get(owner);\n let ownerProperties = ownerStyleInfo.styleProperties;\n let props = Object.create(ownerProperties || null);\n let hostAndRootProps = StyleProperties.hostAndRootPropertiesForScope(host, styleInfo.styleRules);\n let propertyData = StyleProperties.propertyDataFromStyles(ownerStyleInfo.styleRules, host);\n let propertiesMatchingHost = propertyData.properties\n Object.assign(\n props,\n hostAndRootProps.hostProps,\n propertiesMatchingHost,\n hostAndRootProps.rootProps\n );\n this._mixinOverrideStyles(props, styleInfo.overrideStyleProperties);\n StyleProperties.reify(props);\n styleInfo.styleProperties = props;\n }\n _mixinOverrideStyles(props, overrides) {\n for (let p in overrides) {\n let v = overrides[p];\n // skip override props if they are not truthy or 0\n // in order to fall back to inherited values\n if (v || v === 0) {\n props[p] = v;\n }\n }\n }\n _updateNativeProperties(element, properties) {\n // remove previous properties\n for (let p in properties) {\n // NOTE: for bc with shim, don't apply null values.\n if (p === null) {\n element.style.removeProperty(p);\n } else {\n element.style.setProperty(p, properties[p]);\n }\n }\n }\n updateStyles(properties) {\n this.applyStyle(this._documentOwner, properties);\n }\n /* Custom Style operations */\n _transformCustomStyleForDocument(style) {\n let ast = StyleUtil.rulesForStyle(style);\n StyleUtil.forEachRule(ast, (rule) => {\n if (nativeShadow) {\n StyleTransformer.normalizeRootSelector(rule);\n } else {\n StyleTransformer.documentRule(rule);\n }\n if (this.nativeCss && !this.nativeCssApply) {\n ApplyShim.transformRule(rule);\n }\n });\n if (this.nativeCss) {\n style.textContent = StyleUtil.toCssText(ast);\n } else {\n this._documentOwnerStyleInfo.styleRules.rules.push(ast);\n }\n }\n _revalidateApplyShim(style) {\n if (this.nativeCss && !this.nativeCssApply) {\n let ast = StyleUtil.rulesForStyle(style);\n ApplyShim.transformRules(ast);\n style.textContent = StyleUtil.toCssText(ast);\n }\n }\n _applyCustomStyleToDocument(style) {\n if (!this.nativeCss) {\n StyleProperties.applyCustomStyle(style, this._documentOwnerStyleInfo.styleProperties);\n }\n }\n getComputedStyleValue(element, property) {\n let value;\n if (!this.nativeCss) {\n // element is either a style host, or an ancestor of a style host\n let styleInfo = StyleInfo.get(element) || StyleInfo.get(this._styleOwnerForNode(element));\n value = styleInfo.styleProperties[property];\n }\n // fall back to the property value from the computed styling\n value = value || window.getComputedStyle(element).getPropertyValue(property);\n // trim whitespace that can come after the `:` in css\n // example: padding: 2px -> \" 2px\"\n return value.trim();\n }\n // given an element and a classString, replaces\n // the element's class with the provided classString and adds\n // any necessary ShadyCSS static and property based scoping selectors\n setElementClass(element, classString) {\n let root = element.getRootNode();\n let classes = classString ? classString.split(/\\s/) : [];\n let scopeName = root.host && root.host.localName;\n // If no scope, try to discover scope name from existing class.\n // This can occur if, for example, a template stamped element that\n // has been scoped is manipulated when not in a root.\n if (!scopeName) {\n var classAttr = element.getAttribute('class');\n if (classAttr) {\n let k$ = classAttr.split(/\\s/);\n for (let i=0; i < k$.length; i++) {\n if (k$[i] === StyleTransformer.SCOPE_NAME) {\n scopeName = k$[i+1];\n break;\n }\n }\n }\n }\n if (scopeName) {\n classes.push(StyleTransformer.SCOPE_NAME, scopeName);\n }\n if (!this.nativeCss) {\n let styleInfo = StyleInfo.get(element);\n if (styleInfo && styleInfo.scopeSelector) {\n classes.push(StyleProperties.XSCOPE_NAME, styleInfo.scopeSelector);\n }\n }\n StyleUtil.setElementClassRaw(element, classes.join(' '));\n }\n _styleInfoForNode(node) {\n return StyleInfo.get(node);\n }\n}\n\nwindow['ShadyCSS'] = new ShadyCSS();","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function(scope) {\n\n 'use strict';\n\n if (window.HTMLImports) {\n HTMLImports.whenReady(function() {\n requestAnimationFrame(function() {\n window.dispatchEvent(new CustomEvent('WebComponentsReady'));\n });\n });\n } else {\n requestAnimationFrame(function() {\n window.dispatchEvent(new CustomEvent('WebComponentsReady'));\n });\n }\n\n})(window.WebComponents);\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function(scope) {\n\n // It's desireable to provide a default stylesheet\n // that's convenient for styling unresolved elements, but\n // it's cumbersome to have to include this manually in every page.\n // It would make sense to put inside some HTMLImport but\n // the HTMLImports polyfill does not allow loading of stylesheets\n // that block rendering. Therefore this injection is tolerated here.\n //\n // NOTE: position: relative fixes IE's failure to inherit opacity\n // when a child is not statically positioned.\n var style = document.createElement('style');\n style.textContent = ''\n + 'body {'\n + 'transition: opacity ease-in 0.2s;'\n + ' } \\n'\n + 'body[unresolved] {'\n + 'opacity: 0; display: block; overflow: hidden; position: relative;'\n + ' } \\n'\n ;\n var head = document.querySelector('head');\n head.insertBefore(style, head.firstChild);\n\n})(window.WebComponents);\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n'use strict';\n\n/*\n * Polyfills loaded: None\n * Used in: Chrome\n */\n\n// TODO: This needs to not exist at all.\n\nimport '../src/pre-polyfill.js'\n//TODO(notwaldorf): this is temporary and should be removed.\nimport '../bower_components/shadycss/src/ShadyCSS.js'\nimport '../src/post-polyfill.js'\nimport '../src/unresolved.js'\n"],"names":["StyleUtil.setElementClassRaw","StyleUtil.toCssText","StyleUtil.isKeyframesSelector","StyleUtil.forEachRule","rx","StyleUtil.rx","StyleUtil.processVariableAndFallback","StyleTransformer","StyleUtil.applyCss","StyleUtil.applyStyle","StyleUtil.rulesForStyle","watcherFlush","ApplyShim","StyleProperties"],"mappings":";;;AAAA;;;;;;;;;;AAUA,CAAC,SAAS,KAAK,EAAE;;EAEf,YAAY,CAAC;;EAEb,IAAI,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;EACtC,IAAI,UAAU,EAAE;IACd,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;IACxC,QAAQ,CAAC,KAAK,GAAG,UAAU,CAAC;GAC7B;;EAED,IAAI,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;EACrD,IAAI,OAAO,IAAI,MAAM,CAAC,cAAc,EAAE;IACpC,cAAc,CAAC,aAAa,GAAG,OAAO,CAAC;GACxC;;CAEF,EAAE,MAAM,CAAC,aAAa,CAAC,C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