1/** 2@license 3Copyright (c) 2017 The Polymer Project Authors. All rights reserved. 4This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7Code distributed by Google as part of the polymer project is also 8subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9*/ 10 11'use strict'; 12 13import CustomStyleInterface from '../src/custom-style-interface.js'; 14import {getComputedStyleValue, updateNativeProperties} from '../src/common-utils.js'; 15import {nativeCssVariables, nativeShadow, cssBuild} from '../src/style-settings.js'; 16 17const customStyleInterface = new CustomStyleInterface(); 18 19if (!window.ShadyCSS) { 20 window.ShadyCSS = { 21 /** 22 * @param {!HTMLTemplateElement} template 23 * @param {string} elementName 24 * @param {string=} elementExtends 25 */ 26 prepareTemplate(template, elementName, elementExtends) {}, // eslint-disable-line no-unused-vars 27 28 /** 29 * @param {!HTMLTemplateElement} template 30 * @param {string} elementName 31 */ 32 prepareTemplateDom(template, elementName) {}, // eslint-disable-line no-unused-vars 33 34 /** 35 * @param {!HTMLTemplateElement} template 36 * @param {string} elementName 37 * @param {string=} elementExtends 38 */ 39 prepareTemplateStyles(template, elementName, elementExtends) {}, // eslint-disable-line no-unused-vars 40 41 /** 42 * @param {Element} element 43 * @param {Object=} properties 44 */ 45 styleSubtree(element, properties) { 46 customStyleInterface.processStyles(); 47 updateNativeProperties(element, properties); 48 }, 49 50 /** 51 * @param {Element} element 52 */ 53 styleElement(element) { // eslint-disable-line no-unused-vars 54 customStyleInterface.processStyles(); 55 }, 56 57 /** 58 * @param {Object=} properties 59 */ 60 styleDocument(properties) { 61 customStyleInterface.processStyles(); 62 updateNativeProperties(document.body, properties); 63 }, 64 65 /** 66 * @param {Element} element 67 * @param {string} property 68 * @return {string} 69 */ 70 getComputedStyleValue(element, property) { 71 return getComputedStyleValue(element, property); 72 }, 73 74 flushCustomStyles() {}, 75 nativeCss: nativeCssVariables, 76 nativeShadow: nativeShadow, 77 cssBuild: cssBuild 78 } 79} 80 81window.ShadyCSS.CustomStyleInterface = customStyleInterface;